@walletconnect/ethereum-provider 2.17.4 → 2.17.5
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 +35 -35
- package/dist/index.umd.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(wn,fr){typeof exports=="object"&&typeof module<"u"?fr(exports):typeof define=="function"&&define.amd?define(["exports"],fr):(wn=typeof globalThis<"u"?globalThis:wn||self,fr(wn["@walletconnect/ethereum-provider"]={}))})(this,function(wn){"use strict";var fr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function V6(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function ju(r){var e=r.default;if(typeof e=="function"){var t=function(){return e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var n=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:function(){return r[i]}})}),t}var zr={exports:{}},ba=typeof Reflect=="object"?Reflect:null,rg=ba&&typeof ba.apply=="function"?ba.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)},el;ba&&typeof ba.ownKeys=="function"?el=ba.ownKeys:Object.getOwnPropertySymbols?el=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:el=function(e){return Object.getOwnPropertyNames(e)};function G6(r){console&&console.warn&&console.warn(r)}var ig=Number.isNaN||function(e){return e!==e};function Jt(){Jt.init.call(this)}zr.exports=Jt,zr.exports.once=Z6,Jt.EventEmitter=Jt,Jt.prototype._events=void 0,Jt.prototype._eventsCount=0,Jt.prototype._maxListeners=void 0;var ng=10;function tl(r){if(typeof r!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r)}Object.defineProperty(Jt,"defaultMaxListeners",{enumerable:!0,get:function(){return ng},set:function(r){if(typeof r!="number"||r<0||ig(r))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+r+".");ng=r}}),Jt.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},Jt.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||ig(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 sg(r){return r._maxListeners===void 0?Jt.defaultMaxListeners:r._maxListeners}Jt.prototype.getMaxListeners=function(){return sg(this)},Jt.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var n=e==="error",s=this._events;if(s!==void 0)n=n&&s.error===void 0;else if(!n)return!1;if(n){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var f=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw f.context=a,f}var h=s[e];if(h===void 0)return!1;if(typeof h=="function")rg(h,this,t);else for(var u=h.length,g=lg(h,u),i=0;i<u;++i)rg(g[i],this,t);return!0};function og(r,e,t,i){var n,s,a;if(tl(t),s=r._events,s===void 0?(s=r._events=Object.create(null),r._eventsCount=0):(s.newListener!==void 0&&(r.emit("newListener",e,t.listener?t.listener:t),s=r._events),a=s[e]),a===void 0)a=s[e]=t,++r._eventsCount;else if(typeof a=="function"?a=s[e]=i?[t,a]:[a,t]:i?a.unshift(t):a.push(t),n=sg(r),n>0&&a.length>n&&!a.warned){a.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=r,f.type=e,f.count=a.length,G6(f)}return r}Jt.prototype.addListener=function(e,t){return og(this,e,t,!1)},Jt.prototype.on=Jt.prototype.addListener,Jt.prototype.prependListener=function(e,t){return og(this,e,t,!0)};function Y6(){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 ag(r,e,t){var i={fired:!1,wrapFn:void 0,target:r,type:e,listener:t},n=Y6.bind(i);return n.listener=t,i.wrapFn=n,n}Jt.prototype.once=function(e,t){return tl(t),this.on(e,ag(this,e,t)),this},Jt.prototype.prependOnceListener=function(e,t){return tl(t),this.prependListener(e,ag(this,e,t)),this},Jt.prototype.removeListener=function(e,t){var i,n,s,a,f;if(tl(t),n=this._events,n===void 0)return this;if(i=n[e],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||t));else if(typeof i!="function"){for(s=-1,a=i.length-1;a>=0;a--)if(i[a]===t||i[a].listener===t){f=i[a].listener,s=a;break}if(s<0)return this;s===0?i.shift():J6(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,f||t)}return this},Jt.prototype.off=Jt.prototype.removeListener,Jt.prototype.removeAllListeners=function(e){var t,i,n;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var s=Object.keys(i),a;for(n=0;n<s.length;++n)a=s[n],a!=="removeListener"&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=i[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this};function cg(r,e,t){var i=r._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n=="function"?t?[n.listener||n]:[n]:t?Q6(n):lg(n,n.length)}Jt.prototype.listeners=function(e){return cg(this,e,!0)},Jt.prototype.rawListeners=function(e){return cg(this,e,!1)},Jt.listenerCount=function(r,e){return typeof r.listenerCount=="function"?r.listenerCount(e):fg.call(r,e)},Jt.prototype.listenerCount=fg;function fg(r){var e=this._events;if(e!==void 0){var t=e[r];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}Jt.prototype.eventNames=function(){return this._eventsCount>0?el(this._events):[]};function lg(r,e){for(var t=new Array(e),i=0;i<e;++i)t[i]=r[i];return t}function J6(r,e){for(;e+1<r.length;e++)r[e]=r[e+1];r.pop()}function Q6(r){for(var e=new Array(r.length),t=0;t<e.length;++t)e[t]=r[t].listener||r[t];return e}function Z6(r,e){return new Promise(function(t,i){function n(a){r.removeListener(e,s),i(a)}function s(){typeof r.removeListener=="function"&&r.removeListener("error",n),t([].slice.call(arguments))}hg(r,e,s,{once:!0}),e!=="error"&&X6(r,n,{once:!0})})}function X6(r,e,t){typeof r.on=="function"&&hg(r,"error",e,t)}function hg(r,e,t,i){if(typeof r.on=="function")i.once?r.once(e,t):r.on(e,t);else if(typeof r.addEventListener=="function")r.addEventListener(e,function n(s){i.once&&r.removeEventListener(e,n),t(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof r)}var ug=function(r,e,t){if(t||arguments.length===2)for(var i=0,n=e.length,s;i<n;i++)(s||!(i in e))&&(s||(s=Array.prototype.slice.call(e,0,i)),s[i]=e[i]);return r.concat(s||Array.prototype.slice.call(e))},e5=function(){function r(e,t,i){this.name=e,this.version=t,this.os=i,this.type="browser"}return r}(),t5=function(){function r(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return r}(),r5=function(){function r(e,t,i,n){this.name=e,this.version=t,this.os=i,this.bot=n,this.type="bot-device"}return r}(),i5=function(){function r(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return r}(),n5=function(){function r(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return r}(),s5=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,o5=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,dg=3,a5=[["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",s5]],pg=[["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 c5(r){return r?gg(r):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new n5:typeof navigator<"u"?gg(navigator.userAgent):h5()}function f5(r){return r!==""&&a5.reduce(function(e,t){var i=t[0],n=t[1];if(e)return e;var s=n.exec(r);return!!s&&[i,s]},!1)}function gg(r){var e=f5(r);if(!e)return null;var t=e[0],i=e[1];if(t==="searchbot")return new i5;var n=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);n?n.length<dg&&(n=ug(ug([],n,!0),u5(dg-n.length),!0)):n=[];var s=n.join("."),a=l5(r),f=o5.exec(r);return f&&f[1]?new r5(t,s,a,f[1]):new e5(t,s,a)}function l5(r){for(var e=0,t=pg.length;e<t;e++){var i=pg[e],n=i[0],s=i[1],a=s.exec(r);if(a)return n}return null}function h5(){var r=typeof process<"u"&&process.version;return r?new t5(process.version.slice(1)):null}function u5(r){for(var e=[],t=0;t<r;t++)e.push("0");return e}var _e={};/*! *****************************************************************************
|
|
1
|
+
(function(wn,fr){typeof exports=="object"&&typeof module<"u"?fr(exports):typeof define=="function"&&define.amd?define(["exports"],fr):(wn=typeof globalThis<"u"?globalThis:wn||self,fr(wn["@walletconnect/ethereum-provider"]={}))})(this,function(wn){"use strict";var fr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function L6(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Hu(r){var e=r.default;if(typeof e=="function"){var t=function(){return e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var n=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:function(){return r[i]}})}),t}var zr={exports:{}},ba=typeof Reflect=="object"?Reflect:null,eg=ba&&typeof ba.apply=="function"?ba.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)},Xf;ba&&typeof ba.ownKeys=="function"?Xf=ba.ownKeys:Object.getOwnPropertySymbols?Xf=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Xf=function(e){return Object.getOwnPropertyNames(e)};function B6(r){console&&console.warn&&console.warn(r)}var tg=Number.isNaN||function(e){return e!==e};function Yt(){Yt.init.call(this)}zr.exports=Yt,zr.exports.once=z6,Yt.EventEmitter=Yt,Yt.prototype._events=void 0,Yt.prototype._eventsCount=0,Yt.prototype._maxListeners=void 0;var rg=10;function el(r){if(typeof r!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r)}Object.defineProperty(Yt,"defaultMaxListeners",{enumerable:!0,get:function(){return rg},set:function(r){if(typeof r!="number"||r<0||tg(r))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+r+".");rg=r}}),Yt.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},Yt.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||tg(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 ig(r){return r._maxListeners===void 0?Yt.defaultMaxListeners:r._maxListeners}Yt.prototype.getMaxListeners=function(){return ig(this)},Yt.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var n=e==="error",s=this._events;if(s!==void 0)n=n&&s.error===void 0;else if(!n)return!1;if(n){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var f=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw f.context=a,f}var h=s[e];if(h===void 0)return!1;if(typeof h=="function")eg(h,this,t);else for(var u=h.length,g=cg(h,u),i=0;i<u;++i)eg(g[i],this,t);return!0};function ng(r,e,t,i){var n,s,a;if(el(t),s=r._events,s===void 0?(s=r._events=Object.create(null),r._eventsCount=0):(s.newListener!==void 0&&(r.emit("newListener",e,t.listener?t.listener:t),s=r._events),a=s[e]),a===void 0)a=s[e]=t,++r._eventsCount;else if(typeof a=="function"?a=s[e]=i?[t,a]:[a,t]:i?a.unshift(t):a.push(t),n=ig(r),n>0&&a.length>n&&!a.warned){a.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=r,f.type=e,f.count=a.length,B6(f)}return r}Yt.prototype.addListener=function(e,t){return ng(this,e,t,!1)},Yt.prototype.on=Yt.prototype.addListener,Yt.prototype.prependListener=function(e,t){return ng(this,e,t,!0)};function U6(){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 sg(r,e,t){var i={fired:!1,wrapFn:void 0,target:r,type:e,listener:t},n=U6.bind(i);return n.listener=t,i.wrapFn=n,n}Yt.prototype.once=function(e,t){return el(t),this.on(e,sg(this,e,t)),this},Yt.prototype.prependOnceListener=function(e,t){return el(t),this.prependListener(e,sg(this,e,t)),this},Yt.prototype.removeListener=function(e,t){var i,n,s,a,f;if(el(t),n=this._events,n===void 0)return this;if(i=n[e],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||t));else if(typeof i!="function"){for(s=-1,a=i.length-1;a>=0;a--)if(i[a]===t||i[a].listener===t){f=i[a].listener,s=a;break}if(s<0)return this;s===0?i.shift():F6(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,f||t)}return this},Yt.prototype.off=Yt.prototype.removeListener,Yt.prototype.removeAllListeners=function(e){var t,i,n;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var s=Object.keys(i),a;for(n=0;n<s.length;++n)a=s[n],a!=="removeListener"&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=i[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this};function og(r,e,t){var i=r._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n=="function"?t?[n.listener||n]:[n]:t?q6(n):cg(n,n.length)}Yt.prototype.listeners=function(e){return og(this,e,!0)},Yt.prototype.rawListeners=function(e){return og(this,e,!1)},Yt.listenerCount=function(r,e){return typeof r.listenerCount=="function"?r.listenerCount(e):ag.call(r,e)},Yt.prototype.listenerCount=ag;function ag(r){var e=this._events;if(e!==void 0){var t=e[r];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}Yt.prototype.eventNames=function(){return this._eventsCount>0?Xf(this._events):[]};function cg(r,e){for(var t=new Array(e),i=0;i<e;++i)t[i]=r[i];return t}function F6(r,e){for(;e+1<r.length;e++)r[e]=r[e+1];r.pop()}function q6(r){for(var e=new Array(r.length),t=0;t<e.length;++t)e[t]=r[t].listener||r[t];return e}function z6(r,e){return new Promise(function(t,i){function n(a){r.removeListener(e,s),i(a)}function s(){typeof r.removeListener=="function"&&r.removeListener("error",n),t([].slice.call(arguments))}fg(r,e,s,{once:!0}),e!=="error"&&k6(r,n,{once:!0})})}function k6(r,e,t){typeof r.on=="function"&&fg(r,"error",e,t)}function fg(r,e,t,i){if(typeof r.on=="function")i.once?r.once(e,t):r.on(e,t);else if(typeof r.addEventListener=="function")r.addEventListener(e,function n(s){i.once&&r.removeEventListener(e,n),t(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof r)}var lg=function(r,e,t){if(t||arguments.length===2)for(var i=0,n=e.length,s;i<n;i++)(s||!(i in e))&&(s||(s=Array.prototype.slice.call(e,0,i)),s[i]=e[i]);return r.concat(s||Array.prototype.slice.call(e))},H6=function(){function r(e,t,i){this.name=e,this.version=t,this.os=i,this.type="browser"}return r}(),j6=function(){function r(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return r}(),W6=function(){function r(e,t,i,n){this.name=e,this.version=t,this.os=i,this.bot=n,this.type="bot-device"}return r}(),K6=function(){function r(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return r}(),V6=function(){function r(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return r}(),G6=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,J6=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,hg=3,Y6=[["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",G6]],ug=[["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 Q6(r){return r?dg(r):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new V6:typeof navigator<"u"?dg(navigator.userAgent):e5()}function Z6(r){return r!==""&&Y6.reduce(function(e,t){var i=t[0],n=t[1];if(e)return e;var s=n.exec(r);return!!s&&[i,s]},!1)}function dg(r){var e=Z6(r);if(!e)return null;var t=e[0],i=e[1];if(t==="searchbot")return new K6;var n=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);n?n.length<hg&&(n=lg(lg([],n,!0),t5(hg-n.length),!0)):n=[];var s=n.join("."),a=X6(r),f=J6.exec(r);return f&&f[1]?new W6(t,s,a,f[1]):new H6(t,s,a)}function X6(r){for(var e=0,t=ug.length;e<t;e++){var i=ug[e],n=i[0],s=i[1],a=s.exec(r);if(a)return n}return null}function e5(){var r=typeof process<"u"&&process.version;return r?new j6(process.version.slice(1)):null}function t5(r){for(var e=[],t=0;t<r;t++)e.push("0");return e}var _e={};/*! *****************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -11,23 +11,23 @@
|
|
|
11
11
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
12
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
13
|
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
-
***************************************************************************** */var Wu=function(r,e){return Wu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Wu(r,e)};function d5(r,e){Wu(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Ku=function(){return Ku=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},Ku.apply(this,arguments)};function p5(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(t[i[n]]=r[i[n]]);return t}function g5(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var f=r.length-1;f>=0;f--)(a=r[f])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s}function v5(r,e){return function(t,i){e(t,i,r)}}function m5(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function b5(r,e,t,i){function n(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function f(g){try{u(i.next(g))}catch(w){a(w)}}function h(g){try{u(i.throw(g))}catch(w){a(w)}}function u(g){g.done?s(g.value):n(g.value).then(f,h)}u((i=i.apply(r,e||[])).next())})}function w5(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,a;return a={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function f(u){return function(g){return h([u,g])}}function h(u){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(s=u[0]&2?n.return:u[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,u[1])).done)return s;switch(n=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,n=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){t.label=u[1];break}if(u[0]===6&&t.label<s[1]){t.label=s[1],s=u;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(u);break}s[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(r,t)}catch(g){u=[6,g],n=0}finally{i=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function y5(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}function _5(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function Vu(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function vg(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],a;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(f){a={error:f}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(a)throw a.error}}return s}function x5(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(vg(arguments[e]));return r}function A5(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var i=Array(r),n=0,e=0;e<t;e++)for(var s=arguments[e],a=0,f=s.length;a<f;a++,n++)i[n]=s[a];return i}function Cc(r){return this instanceof Cc?(this.v=r,this):new Cc(r)}function E5(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(r,e||[]),n,s=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(M){i[M]&&(n[M]=function(C){return new Promise(function(O,N){s.push([M,C,O,N])>1||f(M,C)})})}function f(M,C){try{h(i[M](C))}catch(O){w(s[0][3],O)}}function h(M){M.value instanceof Cc?Promise.resolve(M.value.v).then(u,g):w(s[0][2],M)}function u(M){f("next",M)}function g(M){f("throw",M)}function w(M,C){M(C),s.shift(),s.length&&f(s[0][0],s[0][1])}}function S5(r){var e,t;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=r[n]?function(a){return(t=!t)?{value:Cc(r[n](a)),done:n==="return"}:s?s(a):a}:s}}function I5(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof Vu=="function"?Vu(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(s){t[s]=r[s]&&function(a){return new Promise(function(f,h){a=r[s](a),n(f,h,a.done,a.value)})}}function n(s,a,f,h){Promise.resolve(h).then(function(u){s({value:u,done:f})},a)}}function M5(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function C5(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function P5(r){return r&&r.__esModule?r:{default:r}}function D5(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function O5(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var R5=Object.freeze({__proto__:null,__extends:d5,get __assign(){return Ku},__rest:p5,__decorate:g5,__param:v5,__metadata:m5,__awaiter:b5,__generator:w5,__createBinding:y5,__exportStar:_5,__values:Vu,__read:vg,__spread:x5,__spreadArrays:A5,__await:Cc,__asyncGenerator:E5,__asyncDelegator:S5,__asyncValues:I5,__makeTemplateObject:M5,__importStar:C5,__importDefault:P5,__classPrivateFieldGet:D5,__classPrivateFieldSet:O5}),rl=ju(R5),Gu={},Pc={},mg;function T5(){if(mg)return Pc;mg=1,Object.defineProperty(Pc,"__esModule",{value:!0}),Pc.delay=void 0;function r(e){return new Promise(t=>{setTimeout(()=>{t(!0)},e)})}return Pc.delay=r,Pc}var xo={},Yu={},Ao={},bg;function N5(){return bg||(bg=1,Object.defineProperty(Ao,"__esModule",{value:!0}),Ao.ONE_THOUSAND=Ao.ONE_HUNDRED=void 0,Ao.ONE_HUNDRED=100,Ao.ONE_THOUSAND=1e3),Ao}var Ju={},wg;function $5(){return wg||(wg=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.ONE_YEAR=r.FOUR_WEEKS=r.THREE_WEEKS=r.TWO_WEEKS=r.ONE_WEEK=r.THIRTY_DAYS=r.SEVEN_DAYS=r.FIVE_DAYS=r.THREE_DAYS=r.ONE_DAY=r.TWENTY_FOUR_HOURS=r.TWELVE_HOURS=r.SIX_HOURS=r.THREE_HOURS=r.ONE_HOUR=r.SIXTY_MINUTES=r.THIRTY_MINUTES=r.TEN_MINUTES=r.FIVE_MINUTES=r.ONE_MINUTE=r.SIXTY_SECONDS=r.THIRTY_SECONDS=r.TEN_SECONDS=r.FIVE_SECONDS=r.ONE_SECOND=void 0,r.ONE_SECOND=1,r.FIVE_SECONDS=5,r.TEN_SECONDS=10,r.THIRTY_SECONDS=30,r.SIXTY_SECONDS=60,r.ONE_MINUTE=r.SIXTY_SECONDS,r.FIVE_MINUTES=r.ONE_MINUTE*5,r.TEN_MINUTES=r.ONE_MINUTE*10,r.THIRTY_MINUTES=r.ONE_MINUTE*30,r.SIXTY_MINUTES=r.ONE_MINUTE*60,r.ONE_HOUR=r.SIXTY_MINUTES,r.THREE_HOURS=r.ONE_HOUR*3,r.SIX_HOURS=r.ONE_HOUR*6,r.TWELVE_HOURS=r.ONE_HOUR*12,r.TWENTY_FOUR_HOURS=r.ONE_HOUR*24,r.ONE_DAY=r.TWENTY_FOUR_HOURS,r.THREE_DAYS=r.ONE_DAY*3,r.FIVE_DAYS=r.ONE_DAY*5,r.SEVEN_DAYS=r.ONE_DAY*7,r.THIRTY_DAYS=r.ONE_DAY*30,r.ONE_WEEK=r.SEVEN_DAYS,r.TWO_WEEKS=r.ONE_WEEK*2,r.THREE_WEEKS=r.ONE_WEEK*3,r.FOUR_WEEKS=r.ONE_WEEK*4,r.ONE_YEAR=r.ONE_DAY*365}(Ju)),Ju}var yg;function _g(){return yg||(yg=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=rl;e.__exportStar(N5(),r),e.__exportStar($5(),r)}(Yu)),Yu}var xg;function L5(){if(xg)return xo;xg=1,Object.defineProperty(xo,"__esModule",{value:!0}),xo.fromMiliseconds=xo.toMiliseconds=void 0;const r=_g();function e(i){return i*r.ONE_THOUSAND}xo.toMiliseconds=e;function t(i){return Math.floor(i/r.ONE_THOUSAND)}return xo.fromMiliseconds=t,xo}var Ag;function B5(){return Ag||(Ag=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=rl;e.__exportStar(T5(),r),e.__exportStar(L5(),r)}(Gu)),Gu}var wa={},Eg;function F5(){if(Eg)return wa;Eg=1,Object.defineProperty(wa,"__esModule",{value:!0}),wa.Watch=void 0;class r{constructor(){this.timestamps=new Map}start(t){if(this.timestamps.has(t))throw new Error(`Watch already started for label: ${t}`);this.timestamps.set(t,{started:Date.now()})}stop(t){const i=this.get(t);if(typeof i.elapsed<"u")throw new Error(`Watch already stopped for label: ${t}`);const n=Date.now()-i.started;this.timestamps.set(t,{started:i.started,elapsed:n})}get(t){const i=this.timestamps.get(t);if(typeof i>"u")throw new Error(`No timestamp found for label: ${t}`);return i}elapsed(t){const i=this.get(t);return i.elapsed||Date.now()-i.started}}return wa.Watch=r,wa.default=r,wa}var Qu={},Dc={},Sg;function U5(){if(Sg)return Dc;Sg=1,Object.defineProperty(Dc,"__esModule",{value:!0}),Dc.IWatch=void 0;class r{}return Dc.IWatch=r,Dc}var Ig;function q5(){return Ig||(Ig=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),rl.__exportStar(U5(),r)}(Qu)),Qu}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=rl;e.__exportStar(B5(),r),e.__exportStar(F5(),r),e.__exportStar(q5(),r),e.__exportStar(_g(),r)})(_e);var rr={};Object.defineProperty(rr,"__esModule",{value:!0}),rr.getLocalStorage=rr.getLocalStorageOrThrow=rr.getCrypto=rr.getCryptoOrThrow=Mg=rr.getLocation=rr.getLocationOrThrow=Zu=rr.getNavigator=rr.getNavigatorOrThrow=Oc=rr.getDocument=rr.getDocumentOrThrow=rr.getFromWindowOrThrow=rr.getFromWindow=void 0;function Eo(r){let e;return typeof window<"u"&&typeof window[r]<"u"&&(e=window[r]),e}rr.getFromWindow=Eo;function ya(r){const e=Eo(r);if(!e)throw new Error(`${r} is not defined in Window`);return e}rr.getFromWindowOrThrow=ya;function z5(){return ya("document")}rr.getDocumentOrThrow=z5;function H5(){return Eo("document")}var Oc=rr.getDocument=H5;function k5(){return ya("navigator")}rr.getNavigatorOrThrow=k5;function j5(){return Eo("navigator")}var Zu=rr.getNavigator=j5;function W5(){return ya("location")}rr.getLocationOrThrow=W5;function K5(){return Eo("location")}var Mg=rr.getLocation=K5;function V5(){return ya("crypto")}rr.getCryptoOrThrow=V5;function G5(){return Eo("crypto")}rr.getCrypto=G5;function Y5(){return ya("localStorage")}rr.getLocalStorageOrThrow=Y5;function J5(){return Eo("localStorage")}rr.getLocalStorage=J5;var Xu={};Object.defineProperty(Xu,"__esModule",{value:!0});var Cg=Xu.getWindowMetadata=void 0;const Pg=rr;function Q5(){let r,e;try{r=Pg.getDocumentOrThrow(),e=Pg.getLocationOrThrow()}catch{return null}function t(){const w=r.getElementsByTagName("link"),M=[];for(let C=0;C<w.length;C++){const O=w[C],N=O.getAttribute("rel");if(N&&N.toLowerCase().indexOf("icon")>-1){const j=O.getAttribute("href");if(j)if(j.toLowerCase().indexOf("https:")===-1&&j.toLowerCase().indexOf("http:")===-1&&j.indexOf("//")!==0){let H=e.protocol+"//"+e.host;if(j.indexOf("/")===0)H+=j;else{const F=e.pathname.split("/");F.pop();const G=F.join("/");H+=G+"/"+j}M.push(H)}else if(j.indexOf("//")===0){const H=e.protocol+j;M.push(H)}else M.push(j)}}return M}function i(...w){const M=r.getElementsByTagName("meta");for(let C=0;C<M.length;C++){const O=M[C],N=["itemprop","property","name"].map(j=>O.getAttribute(j)).filter(j=>j?w.includes(j):!1);if(N.length&&N){const j=O.getAttribute("content");if(j)return j}}return""}function n(){let w=i("name","og:site_name","og:title","twitter:title");return w||(w=r.title),w}function s(){return i("description","og:description","twitter:description","keywords")}const a=n(),f=s(),h=e.origin,u=t();return{description:f,url:h,icons:u,name:a}}Cg=Xu.getWindowMetadata=Q5;var Rc={},Z5=r=>encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Dg="%[a-f0-9]{2}",Og=new RegExp("("+Dg+")|([^%]+?)","gi"),Rg=new RegExp("("+Dg+")+","gi");function ed(r,e){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;e=e||1;var t=r.slice(0,e),i=r.slice(e);return Array.prototype.concat.call([],ed(t),ed(i))}function X5(r){try{return decodeURIComponent(r)}catch{for(var e=r.match(Og)||[],t=1;t<e.length;t++)r=ed(e,t).join(""),e=r.match(Og)||[];return r}}function e4(r){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},t=Rg.exec(r);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch{var i=X5(t[0]);i!==t[0]&&(e[t[0]]=i)}t=Rg.exec(r)}e["%C2"]="\uFFFD";for(var n=Object.keys(e),s=0;s<n.length;s++){var a=n[s];r=r.replace(new RegExp(a,"g"),e[a])}return r}var t4=function(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return r=r.replace(/\+/g," "),decodeURIComponent(r)}catch{return e4(r)}},r4=(r,e)=>{if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[r];const t=r.indexOf(e);return t===-1?[r]:[r.slice(0,t),r.slice(t+e.length)]},i4=function(r,e){for(var t={},i=Object.keys(r),n=Array.isArray(e),s=0;s<i.length;s++){var a=i[s],f=r[a];(n?e.indexOf(a)!==-1:e(a,f,r))&&(t[a]=f)}return t};(function(r){const e=Z5,t=t4,i=r4,n=i4,s=F=>F==null,a=Symbol("encodeFragmentIdentifier");function f(F){switch(F.arrayFormat){case"index":return G=>(B,z)=>{const W=B.length;return z===void 0||F.skipNull&&z===null||F.skipEmptyString&&z===""?B:z===null?[...B,[g(G,F),"[",W,"]"].join("")]:[...B,[g(G,F),"[",g(W,F),"]=",g(z,F)].join("")]};case"bracket":return G=>(B,z)=>z===void 0||F.skipNull&&z===null||F.skipEmptyString&&z===""?B:z===null?[...B,[g(G,F),"[]"].join("")]:[...B,[g(G,F),"[]=",g(z,F)].join("")];case"colon-list-separator":return G=>(B,z)=>z===void 0||F.skipNull&&z===null||F.skipEmptyString&&z===""?B:z===null?[...B,[g(G,F),":list="].join("")]:[...B,[g(G,F),":list=",g(z,F)].join("")];case"comma":case"separator":case"bracket-separator":{const G=F.arrayFormat==="bracket-separator"?"[]=":"=";return B=>(z,W)=>W===void 0||F.skipNull&&W===null||F.skipEmptyString&&W===""?z:(W=W===null?"":W,z.length===0?[[g(B,F),G,g(W,F)].join("")]:[[z,g(W,F)].join(F.arrayFormatSeparator)])}default:return G=>(B,z)=>z===void 0||F.skipNull&&z===null||F.skipEmptyString&&z===""?B:z===null?[...B,g(G,F)]:[...B,[g(G,F),"=",g(z,F)].join("")]}}function h(F){let G;switch(F.arrayFormat){case"index":return(B,z,W)=>{if(G=/\[(\d*)\]$/.exec(B),B=B.replace(/\[\d*\]$/,""),!G){W[B]=z;return}W[B]===void 0&&(W[B]={}),W[B][G[1]]=z};case"bracket":return(B,z,W)=>{if(G=/(\[\])$/.exec(B),B=B.replace(/\[\]$/,""),!G){W[B]=z;return}if(W[B]===void 0){W[B]=[z];return}W[B]=[].concat(W[B],z)};case"colon-list-separator":return(B,z,W)=>{if(G=/(:list)$/.exec(B),B=B.replace(/:list$/,""),!G){W[B]=z;return}if(W[B]===void 0){W[B]=[z];return}W[B]=[].concat(W[B],z)};case"comma":case"separator":return(B,z,W)=>{const _=typeof z=="string"&&z.includes(F.arrayFormatSeparator),U=typeof z=="string"&&!_&&w(z,F).includes(F.arrayFormatSeparator);z=U?w(z,F):z;const ee=_||U?z.split(F.arrayFormatSeparator).map(oe=>w(oe,F)):z===null?z:w(z,F);W[B]=ee};case"bracket-separator":return(B,z,W)=>{const _=/(\[\])$/.test(B);if(B=B.replace(/\[\]$/,""),!_){W[B]=z&&w(z,F);return}const U=z===null?[]:z.split(F.arrayFormatSeparator).map(ee=>w(ee,F));if(W[B]===void 0){W[B]=U;return}W[B]=[].concat(W[B],U)};default:return(B,z,W)=>{if(W[B]===void 0){W[B]=z;return}W[B]=[].concat(W[B],z)}}}function u(F){if(typeof F!="string"||F.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function g(F,G){return G.encode?G.strict?e(F):encodeURIComponent(F):F}function w(F,G){return G.decode?t(F):F}function M(F){return Array.isArray(F)?F.sort():typeof F=="object"?M(Object.keys(F)).sort((G,B)=>Number(G)-Number(B)).map(G=>F[G]):F}function C(F){const G=F.indexOf("#");return G!==-1&&(F=F.slice(0,G)),F}function O(F){let G="";const B=F.indexOf("#");return B!==-1&&(G=F.slice(B)),G}function N(F){F=C(F);const G=F.indexOf("?");return G===-1?"":F.slice(G+1)}function j(F,G){return G.parseNumbers&&!Number.isNaN(Number(F))&&typeof F=="string"&&F.trim()!==""?F=Number(F):G.parseBooleans&&F!==null&&(F.toLowerCase()==="true"||F.toLowerCase()==="false")&&(F=F.toLowerCase()==="true"),F}function H(F,G){G=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},G),u(G.arrayFormatSeparator);const B=h(G),z=Object.create(null);if(typeof F!="string"||(F=F.trim().replace(/^[?#&]/,""),!F))return z;for(const W of F.split("&")){if(W==="")continue;let[_,U]=i(G.decode?W.replace(/\+/g," "):W,"=");U=U===void 0?null:["comma","separator","bracket-separator"].includes(G.arrayFormat)?U:w(U,G),B(w(_,G),U,z)}for(const W of Object.keys(z)){const _=z[W];if(typeof _=="object"&&_!==null)for(const U of Object.keys(_))_[U]=j(_[U],G);else z[W]=j(_,G)}return G.sort===!1?z:(G.sort===!0?Object.keys(z).sort():Object.keys(z).sort(G.sort)).reduce((W,_)=>{const U=z[_];return U&&typeof U=="object"&&!Array.isArray(U)?W[_]=M(U):W[_]=U,W},Object.create(null))}r.extract=N,r.parse=H,r.stringify=(F,G)=>{if(!F)return"";G=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},G),u(G.arrayFormatSeparator);const B=U=>G.skipNull&&s(F[U])||G.skipEmptyString&&F[U]==="",z=f(G),W={};for(const U of Object.keys(F))B(U)||(W[U]=F[U]);const _=Object.keys(W);return G.sort!==!1&&_.sort(G.sort),_.map(U=>{const ee=F[U];return ee===void 0?"":ee===null?g(U,G):Array.isArray(ee)?ee.length===0&&G.arrayFormat==="bracket-separator"?g(U,G)+"[]":ee.reduce(z(U),[]).join("&"):g(U,G)+"="+g(ee,G)}).filter(U=>U.length>0).join("&")},r.parseUrl=(F,G)=>{G=Object.assign({decode:!0},G);const[B,z]=i(F,"#");return Object.assign({url:B.split("?")[0]||"",query:H(N(F),G)},G&&G.parseFragmentIdentifier&&z?{fragmentIdentifier:w(z,G)}:{})},r.stringifyUrl=(F,G)=>{G=Object.assign({encode:!0,strict:!0,[a]:!0},G);const B=C(F.url).split("?")[0]||"",z=r.extract(F.url),W=r.parse(z,{sort:!1}),_=Object.assign(W,F.query);let U=r.stringify(_,G);U&&(U=`?${U}`);let ee=O(F.url);return F.fragmentIdentifier&&(ee=`#${G[a]?g(F.fragmentIdentifier,G):F.fragmentIdentifier}`),`${B}${U}${ee}`},r.pick=(F,G,B)=>{B=Object.assign({parseFragmentIdentifier:!0,[a]:!1},B);const{url:z,query:W,fragmentIdentifier:_}=r.parseUrl(F,B);return r.stringifyUrl({url:z,query:n(W,G),fragmentIdentifier:_},B)},r.exclude=(F,G,B)=>{const z=Array.isArray(G)?W=>!G.includes(W):(W,_)=>!G(W,_);return r.pick(F,z,B)}})(Rc);var Tg={exports:{}};/**
|
|
14
|
+
***************************************************************************** */var ju=function(r,e){return ju=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},ju(r,e)};function r5(r,e){ju(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Wu=function(){return Wu=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},Wu.apply(this,arguments)};function i5(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(t[i[n]]=r[i[n]]);return t}function n5(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var f=r.length-1;f>=0;f--)(a=r[f])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s}function s5(r,e){return function(t,i){e(t,i,r)}}function o5(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function a5(r,e,t,i){function n(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function f(g){try{u(i.next(g))}catch(w){a(w)}}function h(g){try{u(i.throw(g))}catch(w){a(w)}}function u(g){g.done?s(g.value):n(g.value).then(f,h)}u((i=i.apply(r,e||[])).next())})}function c5(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,a;return a={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function f(u){return function(g){return h([u,g])}}function h(u){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(s=u[0]&2?n.return:u[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,u[1])).done)return s;switch(n=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,n=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){t.label=u[1];break}if(u[0]===6&&t.label<s[1]){t.label=s[1],s=u;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(u);break}s[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(r,t)}catch(g){u=[6,g],n=0}finally{i=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function f5(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}function l5(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function Ku(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function pg(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],a;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(f){a={error:f}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(a)throw a.error}}return s}function h5(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(pg(arguments[e]));return r}function u5(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var i=Array(r),n=0,e=0;e<t;e++)for(var s=arguments[e],a=0,f=s.length;a<f;a++,n++)i[n]=s[a];return i}function Cc(r){return this instanceof Cc?(this.v=r,this):new Cc(r)}function d5(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(r,e||[]),n,s=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(M){i[M]&&(n[M]=function(P){return new Promise(function(O,$){s.push([M,P,O,$])>1||f(M,P)})})}function f(M,P){try{h(i[M](P))}catch(O){w(s[0][3],O)}}function h(M){M.value instanceof Cc?Promise.resolve(M.value.v).then(u,g):w(s[0][2],M)}function u(M){f("next",M)}function g(M){f("throw",M)}function w(M,P){M(P),s.shift(),s.length&&f(s[0][0],s[0][1])}}function p5(r){var e,t;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=r[n]?function(a){return(t=!t)?{value:Cc(r[n](a)),done:n==="return"}:s?s(a):a}:s}}function g5(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof Ku=="function"?Ku(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(s){t[s]=r[s]&&function(a){return new Promise(function(f,h){a=r[s](a),n(f,h,a.done,a.value)})}}function n(s,a,f,h){Promise.resolve(h).then(function(u){s({value:u,done:f})},a)}}function v5(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function m5(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function b5(r){return r&&r.__esModule?r:{default:r}}function w5(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function y5(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var _5=Object.freeze({__proto__:null,__extends:r5,get __assign(){return Wu},__rest:i5,__decorate:n5,__param:s5,__metadata:o5,__awaiter:a5,__generator:c5,__createBinding:f5,__exportStar:l5,__values:Ku,__read:pg,__spread:h5,__spreadArrays:u5,__await:Cc,__asyncGenerator:d5,__asyncDelegator:p5,__asyncValues:g5,__makeTemplateObject:v5,__importStar:m5,__importDefault:b5,__classPrivateFieldGet:w5,__classPrivateFieldSet:y5}),tl=Hu(_5),Vu={},Pc={},gg;function x5(){if(gg)return Pc;gg=1,Object.defineProperty(Pc,"__esModule",{value:!0}),Pc.delay=void 0;function r(e){return new Promise(t=>{setTimeout(()=>{t(!0)},e)})}return Pc.delay=r,Pc}var xo={},Gu={},Eo={},vg;function E5(){return vg||(vg=1,Object.defineProperty(Eo,"__esModule",{value:!0}),Eo.ONE_THOUSAND=Eo.ONE_HUNDRED=void 0,Eo.ONE_HUNDRED=100,Eo.ONE_THOUSAND=1e3),Eo}var Ju={},mg;function A5(){return mg||(mg=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.ONE_YEAR=r.FOUR_WEEKS=r.THREE_WEEKS=r.TWO_WEEKS=r.ONE_WEEK=r.THIRTY_DAYS=r.SEVEN_DAYS=r.FIVE_DAYS=r.THREE_DAYS=r.ONE_DAY=r.TWENTY_FOUR_HOURS=r.TWELVE_HOURS=r.SIX_HOURS=r.THREE_HOURS=r.ONE_HOUR=r.SIXTY_MINUTES=r.THIRTY_MINUTES=r.TEN_MINUTES=r.FIVE_MINUTES=r.ONE_MINUTE=r.SIXTY_SECONDS=r.THIRTY_SECONDS=r.TEN_SECONDS=r.FIVE_SECONDS=r.ONE_SECOND=void 0,r.ONE_SECOND=1,r.FIVE_SECONDS=5,r.TEN_SECONDS=10,r.THIRTY_SECONDS=30,r.SIXTY_SECONDS=60,r.ONE_MINUTE=r.SIXTY_SECONDS,r.FIVE_MINUTES=r.ONE_MINUTE*5,r.TEN_MINUTES=r.ONE_MINUTE*10,r.THIRTY_MINUTES=r.ONE_MINUTE*30,r.SIXTY_MINUTES=r.ONE_MINUTE*60,r.ONE_HOUR=r.SIXTY_MINUTES,r.THREE_HOURS=r.ONE_HOUR*3,r.SIX_HOURS=r.ONE_HOUR*6,r.TWELVE_HOURS=r.ONE_HOUR*12,r.TWENTY_FOUR_HOURS=r.ONE_HOUR*24,r.ONE_DAY=r.TWENTY_FOUR_HOURS,r.THREE_DAYS=r.ONE_DAY*3,r.FIVE_DAYS=r.ONE_DAY*5,r.SEVEN_DAYS=r.ONE_DAY*7,r.THIRTY_DAYS=r.ONE_DAY*30,r.ONE_WEEK=r.SEVEN_DAYS,r.TWO_WEEKS=r.ONE_WEEK*2,r.THREE_WEEKS=r.ONE_WEEK*3,r.FOUR_WEEKS=r.ONE_WEEK*4,r.ONE_YEAR=r.ONE_DAY*365}(Ju)),Ju}var bg;function wg(){return bg||(bg=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=tl;e.__exportStar(E5(),r),e.__exportStar(A5(),r)}(Gu)),Gu}var yg;function S5(){if(yg)return xo;yg=1,Object.defineProperty(xo,"__esModule",{value:!0}),xo.fromMiliseconds=xo.toMiliseconds=void 0;const r=wg();function e(i){return i*r.ONE_THOUSAND}xo.toMiliseconds=e;function t(i){return Math.floor(i/r.ONE_THOUSAND)}return xo.fromMiliseconds=t,xo}var _g;function I5(){return _g||(_g=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=tl;e.__exportStar(x5(),r),e.__exportStar(S5(),r)}(Vu)),Vu}var wa={},xg;function M5(){if(xg)return wa;xg=1,Object.defineProperty(wa,"__esModule",{value:!0}),wa.Watch=void 0;class r{constructor(){this.timestamps=new Map}start(t){if(this.timestamps.has(t))throw new Error(`Watch already started for label: ${t}`);this.timestamps.set(t,{started:Date.now()})}stop(t){const i=this.get(t);if(typeof i.elapsed<"u")throw new Error(`Watch already stopped for label: ${t}`);const n=Date.now()-i.started;this.timestamps.set(t,{started:i.started,elapsed:n})}get(t){const i=this.timestamps.get(t);if(typeof i>"u")throw new Error(`No timestamp found for label: ${t}`);return i}elapsed(t){const i=this.get(t);return i.elapsed||Date.now()-i.started}}return wa.Watch=r,wa.default=r,wa}var Yu={},Dc={},Eg;function C5(){if(Eg)return Dc;Eg=1,Object.defineProperty(Dc,"__esModule",{value:!0}),Dc.IWatch=void 0;class r{}return Dc.IWatch=r,Dc}var Ag;function P5(){return Ag||(Ag=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),tl.__exportStar(C5(),r)}(Yu)),Yu}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=tl;e.__exportStar(I5(),r),e.__exportStar(M5(),r),e.__exportStar(P5(),r),e.__exportStar(wg(),r)})(_e);var rr={};Object.defineProperty(rr,"__esModule",{value:!0}),rr.getLocalStorage=rr.getLocalStorageOrThrow=rr.getCrypto=rr.getCryptoOrThrow=Sg=rr.getLocation=rr.getLocationOrThrow=Qu=rr.getNavigator=rr.getNavigatorOrThrow=Oc=rr.getDocument=rr.getDocumentOrThrow=rr.getFromWindowOrThrow=rr.getFromWindow=void 0;function Ao(r){let e;return typeof window<"u"&&typeof window[r]<"u"&&(e=window[r]),e}rr.getFromWindow=Ao;function ya(r){const e=Ao(r);if(!e)throw new Error(`${r} is not defined in Window`);return e}rr.getFromWindowOrThrow=ya;function D5(){return ya("document")}rr.getDocumentOrThrow=D5;function O5(){return Ao("document")}var Oc=rr.getDocument=O5;function R5(){return ya("navigator")}rr.getNavigatorOrThrow=R5;function T5(){return Ao("navigator")}var Qu=rr.getNavigator=T5;function N5(){return ya("location")}rr.getLocationOrThrow=N5;function $5(){return Ao("location")}var Sg=rr.getLocation=$5;function L5(){return ya("crypto")}rr.getCryptoOrThrow=L5;function B5(){return Ao("crypto")}rr.getCrypto=B5;function U5(){return ya("localStorage")}rr.getLocalStorageOrThrow=U5;function F5(){return Ao("localStorage")}rr.getLocalStorage=F5;var Zu={};Object.defineProperty(Zu,"__esModule",{value:!0});var Ig=Zu.getWindowMetadata=void 0;const Mg=rr;function q5(){let r,e;try{r=Mg.getDocumentOrThrow(),e=Mg.getLocationOrThrow()}catch{return null}function t(){const w=r.getElementsByTagName("link"),M=[];for(let P=0;P<w.length;P++){const O=w[P],$=O.getAttribute("rel");if($&&$.toLowerCase().indexOf("icon")>-1){const q=O.getAttribute("href");if(q)if(q.toLowerCase().indexOf("https:")===-1&&q.toLowerCase().indexOf("http:")===-1&&q.indexOf("//")!==0){let U=e.protocol+"//"+e.host;if(q.indexOf("/")===0)U+=q;else{const J=e.pathname.split("/");J.pop();const ee=J.join("/");U+=ee+"/"+q}M.push(U)}else if(q.indexOf("//")===0){const U=e.protocol+q;M.push(U)}else M.push(q)}}return M}function i(...w){const M=r.getElementsByTagName("meta");for(let P=0;P<M.length;P++){const O=M[P],$=["itemprop","property","name"].map(q=>O.getAttribute(q)).filter(q=>q?w.includes(q):!1);if($.length&&$){const q=O.getAttribute("content");if(q)return q}}return""}function n(){let w=i("name","og:site_name","og:title","twitter:title");return w||(w=r.title),w}function s(){return i("description","og:description","twitter:description","keywords")}const a=n(),f=s(),h=e.origin,u=t();return{description:f,url:h,icons:u,name:a}}Ig=Zu.getWindowMetadata=q5;var Cg={exports:{}};/**
|
|
15
15
|
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
|
16
16
|
*
|
|
17
17
|
* @version 0.8.0
|
|
18
18
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
19
19
|
* @copyright Chen, Yi-Cyuan 2015-2018
|
|
20
20
|
* @license MIT
|
|
21
|
-
*/(function(r){(function(){var e="input is invalid type",t="finalize already called",i=typeof window=="object",n=i?window:{};n.JS_SHA3_NO_WINDOW&&(i=!1);var s=!i&&typeof self=="object",a=!n.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;a?n=fr:s&&(n=self);var f=!n.JS_SHA3_NO_COMMON_JS&&!0&&r.exports,h=!n.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",u="0123456789abcdef".split(""),g=[31,7936,2031616,520093696],w=[4,1024,262144,67108864],M=[1,256,65536,16777216],C=[6,1536,393216,100663296],O=[0,8,16,24],N=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],j=[224,256,384,512],H=[128,256],F=["hex","buffer","arrayBuffer","array","digest"],G={128:168,256:136};(n.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(R){return Object.prototype.toString.call(R)==="[object Array]"}),h&&(n.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(R){return typeof R=="object"&&R.buffer&&R.buffer.constructor===ArrayBuffer});for(var B=function(R,X,V){return function(J){return new x(R,X,R).update(J)[V]()}},z=function(R,X,V){return function(J,K){return new x(R,X,K).update(J)[V]()}},W=function(R,X,V){return function(J,K,E,Y){return l["cshake"+R].update(J,K,E,Y)[V]()}},_=function(R,X,V){return function(J,K,E,Y){return l["kmac"+R].update(J,K,E,Y)[V]()}},U=function(R,X,V,J){for(var K=0;K<F.length;++K){var E=F[K];R[E]=X(V,J,E)}return R},ee=function(R,X){var V=B(R,X,"hex");return V.create=function(){return new x(R,X,R)},V.update=function(J){return V.create().update(J)},U(V,B,R,X)},oe=function(R,X){var V=z(R,X,"hex");return V.create=function(J){return new x(R,X,J)},V.update=function(J,K){return V.create(K).update(J)},U(V,z,R,X)},L=function(R,X){var V=G[R],J=W(R,X,"hex");return J.create=function(K,E,Y){return!E&&!Y?l["shake"+R].create(K):new x(R,X,K).bytepad([E,Y],V)},J.update=function(K,E,Y,re){return J.create(E,Y,re).update(K)},U(J,W,R,X)},b=function(R,X){var V=G[R],J=_(R,X,"hex");return J.create=function(K,E,Y){return new $(R,X,E).bytepad(["KMAC",Y],V).bytepad([K],V)},J.update=function(K,E,Y,re){return J.create(K,Y,re).update(E)},U(J,_,R,X)},m=[{name:"keccak",padding:M,bits:j,createMethod:ee},{name:"sha3",padding:C,bits:j,createMethod:ee},{name:"shake",padding:g,bits:H,createMethod:oe},{name:"cshake",padding:w,bits:H,createMethod:L},{name:"kmac",padding:w,bits:H,createMethod:b}],l={},d=[],y=0;y<m.length;++y)for(var P=m[y],D=P.bits,S=0;S<D.length;++S){var v=P.name+"_"+D[S];if(d.push(v),l[v]=P.createMethod(D[S],P.padding),P.name!=="sha3"){var A=P.name+D[S];d.push(A),l[A]=l[v]}}function x(R,X,V){this.blocks=[],this.s=[],this.padding=X,this.outputBits=V,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(R<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=V>>5,this.extraBytes=(V&31)>>3;for(var J=0;J<50;++J)this.s[J]=0}x.prototype.update=function(R){if(this.finalized)throw new Error(t);var X,V=typeof R;if(V!=="string"){if(V==="object"){if(R===null)throw new Error(e);if(h&&R.constructor===ArrayBuffer)R=new Uint8Array(R);else if(!Array.isArray(R)&&(!h||!ArrayBuffer.isView(R)))throw new Error(e)}else throw new Error(e);X=!0}for(var J=this.blocks,K=this.byteCount,E=R.length,Y=this.blockCount,re=0,le=this.s,he,ge;re<E;){if(this.reset)for(this.reset=!1,J[0]=this.block,he=1;he<Y+1;++he)J[he]=0;if(X)for(he=this.start;re<E&&he<K;++re)J[he>>2]|=R[re]<<O[he++&3];else for(he=this.start;re<E&&he<K;++re)ge=R.charCodeAt(re),ge<128?J[he>>2]|=ge<<O[he++&3]:ge<2048?(J[he>>2]|=(192|ge>>6)<<O[he++&3],J[he>>2]|=(128|ge&63)<<O[he++&3]):ge<55296||ge>=57344?(J[he>>2]|=(224|ge>>12)<<O[he++&3],J[he>>2]|=(128|ge>>6&63)<<O[he++&3],J[he>>2]|=(128|ge&63)<<O[he++&3]):(ge=65536+((ge&1023)<<10|R.charCodeAt(++re)&1023),J[he>>2]|=(240|ge>>18)<<O[he++&3],J[he>>2]|=(128|ge>>12&63)<<O[he++&3],J[he>>2]|=(128|ge>>6&63)<<O[he++&3],J[he>>2]|=(128|ge&63)<<O[he++&3]);if(this.lastByteIndex=he,he>=K){for(this.start=he-K,this.block=J[Y],he=0;he<Y;++he)le[he]^=J[he];ae(le),this.reset=!0}else this.start=he}return this},x.prototype.encode=function(R,X){var V=R&255,J=1,K=[V];for(R=R>>8,V=R&255;V>0;)K.unshift(V),R=R>>8,V=R&255,++J;return X?K.push(J):K.unshift(J),this.update(K),K.length},x.prototype.encodeString=function(R){var X,V=typeof R;if(V!=="string"){if(V==="object"){if(R===null)throw new Error(e);if(h&&R.constructor===ArrayBuffer)R=new Uint8Array(R);else if(!Array.isArray(R)&&(!h||!ArrayBuffer.isView(R)))throw new Error(e)}else throw new Error(e);X=!0}var J=0,K=R.length;if(X)J=K;else for(var E=0;E<R.length;++E){var Y=R.charCodeAt(E);Y<128?J+=1:Y<2048?J+=2:Y<55296||Y>=57344?J+=3:(Y=65536+((Y&1023)<<10|R.charCodeAt(++E)&1023),J+=4)}return J+=this.encode(J*8),this.update(R),J},x.prototype.bytepad=function(R,X){for(var V=this.encode(X),J=0;J<R.length;++J)V+=this.encodeString(R[J]);var K=X-V%X,E=[];return E.length=K,this.update(E),this},x.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var R=this.blocks,X=this.lastByteIndex,V=this.blockCount,J=this.s;if(R[X>>2]|=this.padding[X&3],this.lastByteIndex===this.byteCount)for(R[0]=R[V],X=1;X<V+1;++X)R[X]=0;for(R[V-1]|=2147483648,X=0;X<V;++X)J[X]^=R[X];ae(J)}},x.prototype.toString=x.prototype.hex=function(){this.finalize();for(var R=this.blockCount,X=this.s,V=this.outputBlocks,J=this.extraBytes,K=0,E=0,Y="",re;E<V;){for(K=0;K<R&&E<V;++K,++E)re=X[K],Y+=u[re>>4&15]+u[re&15]+u[re>>12&15]+u[re>>8&15]+u[re>>20&15]+u[re>>16&15]+u[re>>28&15]+u[re>>24&15];E%R===0&&(ae(X),K=0)}return J&&(re=X[K],Y+=u[re>>4&15]+u[re&15],J>1&&(Y+=u[re>>12&15]+u[re>>8&15]),J>2&&(Y+=u[re>>20&15]+u[re>>16&15])),Y},x.prototype.arrayBuffer=function(){this.finalize();var R=this.blockCount,X=this.s,V=this.outputBlocks,J=this.extraBytes,K=0,E=0,Y=this.outputBits>>3,re;J?re=new ArrayBuffer(V+1<<2):re=new ArrayBuffer(Y);for(var le=new Uint32Array(re);E<V;){for(K=0;K<R&&E<V;++K,++E)le[E]=X[K];E%R===0&&ae(X)}return J&&(le[K]=X[K],re=re.slice(0,Y)),re},x.prototype.buffer=x.prototype.arrayBuffer,x.prototype.digest=x.prototype.array=function(){this.finalize();for(var R=this.blockCount,X=this.s,V=this.outputBlocks,J=this.extraBytes,K=0,E=0,Y=[],re,le;E<V;){for(K=0;K<R&&E<V;++K,++E)re=E<<2,le=X[K],Y[re]=le&255,Y[re+1]=le>>8&255,Y[re+2]=le>>16&255,Y[re+3]=le>>24&255;E%R===0&&ae(X)}return J&&(re=E<<2,le=X[K],Y[re]=le&255,J>1&&(Y[re+1]=le>>8&255),J>2&&(Y[re+2]=le>>16&255)),Y};function $(R,X,V){x.call(this,R,X,V)}$.prototype=new x,$.prototype.finalize=function(){return this.encode(this.outputBits,!0),x.prototype.finalize.call(this)};var ae=function(R){var X,V,J,K,E,Y,re,le,he,ge,He,Te,Ce,Xe,Ne,be,Pe,De,ye,Ie,Oe,me,Me,Be,we,ke,We,Ae,Ve,Ke,Ge,mt,It,Ye,Pt,Ot,Ze,rt,et,$e,it,tt,Re,lt,ht,Le,ut,nt,Fe,st,Qe,qe,dt,Ht,at,kt,_t,qt,Zr,Xr,ei,ti,vr;for(J=0;J<48;J+=2)K=R[0]^R[10]^R[20]^R[30]^R[40],E=R[1]^R[11]^R[21]^R[31]^R[41],Y=R[2]^R[12]^R[22]^R[32]^R[42],re=R[3]^R[13]^R[23]^R[33]^R[43],le=R[4]^R[14]^R[24]^R[34]^R[44],he=R[5]^R[15]^R[25]^R[35]^R[45],ge=R[6]^R[16]^R[26]^R[36]^R[46],He=R[7]^R[17]^R[27]^R[37]^R[47],Te=R[8]^R[18]^R[28]^R[38]^R[48],Ce=R[9]^R[19]^R[29]^R[39]^R[49],X=Te^(Y<<1|re>>>31),V=Ce^(re<<1|Y>>>31),R[0]^=X,R[1]^=V,R[10]^=X,R[11]^=V,R[20]^=X,R[21]^=V,R[30]^=X,R[31]^=V,R[40]^=X,R[41]^=V,X=K^(le<<1|he>>>31),V=E^(he<<1|le>>>31),R[2]^=X,R[3]^=V,R[12]^=X,R[13]^=V,R[22]^=X,R[23]^=V,R[32]^=X,R[33]^=V,R[42]^=X,R[43]^=V,X=Y^(ge<<1|He>>>31),V=re^(He<<1|ge>>>31),R[4]^=X,R[5]^=V,R[14]^=X,R[15]^=V,R[24]^=X,R[25]^=V,R[34]^=X,R[35]^=V,R[44]^=X,R[45]^=V,X=le^(Te<<1|Ce>>>31),V=he^(Ce<<1|Te>>>31),R[6]^=X,R[7]^=V,R[16]^=X,R[17]^=V,R[26]^=X,R[27]^=V,R[36]^=X,R[37]^=V,R[46]^=X,R[47]^=V,X=ge^(K<<1|E>>>31),V=He^(E<<1|K>>>31),R[8]^=X,R[9]^=V,R[18]^=X,R[19]^=V,R[28]^=X,R[29]^=V,R[38]^=X,R[39]^=V,R[48]^=X,R[49]^=V,Xe=R[0],Ne=R[1],Le=R[11]<<4|R[10]>>>28,ut=R[10]<<4|R[11]>>>28,Ae=R[20]<<3|R[21]>>>29,Ve=R[21]<<3|R[20]>>>29,Xr=R[31]<<9|R[30]>>>23,ei=R[30]<<9|R[31]>>>23,tt=R[40]<<18|R[41]>>>14,Re=R[41]<<18|R[40]>>>14,Ye=R[2]<<1|R[3]>>>31,Pt=R[3]<<1|R[2]>>>31,be=R[13]<<12|R[12]>>>20,Pe=R[12]<<12|R[13]>>>20,nt=R[22]<<10|R[23]>>>22,Fe=R[23]<<10|R[22]>>>22,Ke=R[33]<<13|R[32]>>>19,Ge=R[32]<<13|R[33]>>>19,ti=R[42]<<2|R[43]>>>30,vr=R[43]<<2|R[42]>>>30,Ht=R[5]<<30|R[4]>>>2,at=R[4]<<30|R[5]>>>2,Ot=R[14]<<6|R[15]>>>26,Ze=R[15]<<6|R[14]>>>26,De=R[25]<<11|R[24]>>>21,ye=R[24]<<11|R[25]>>>21,st=R[34]<<15|R[35]>>>17,Qe=R[35]<<15|R[34]>>>17,mt=R[45]<<29|R[44]>>>3,It=R[44]<<29|R[45]>>>3,Be=R[6]<<28|R[7]>>>4,we=R[7]<<28|R[6]>>>4,kt=R[17]<<23|R[16]>>>9,_t=R[16]<<23|R[17]>>>9,rt=R[26]<<25|R[27]>>>7,et=R[27]<<25|R[26]>>>7,Ie=R[36]<<21|R[37]>>>11,Oe=R[37]<<21|R[36]>>>11,qe=R[47]<<24|R[46]>>>8,dt=R[46]<<24|R[47]>>>8,lt=R[8]<<27|R[9]>>>5,ht=R[9]<<27|R[8]>>>5,ke=R[18]<<20|R[19]>>>12,We=R[19]<<20|R[18]>>>12,qt=R[29]<<7|R[28]>>>25,Zr=R[28]<<7|R[29]>>>25,$e=R[38]<<8|R[39]>>>24,it=R[39]<<8|R[38]>>>24,me=R[48]<<14|R[49]>>>18,Me=R[49]<<14|R[48]>>>18,R[0]=Xe^~be&De,R[1]=Ne^~Pe&ye,R[10]=Be^~ke&Ae,R[11]=we^~We&Ve,R[20]=Ye^~Ot&rt,R[21]=Pt^~Ze&et,R[30]=lt^~Le&nt,R[31]=ht^~ut&Fe,R[40]=Ht^~kt&qt,R[41]=at^~_t&Zr,R[2]=be^~De&Ie,R[3]=Pe^~ye&Oe,R[12]=ke^~Ae&Ke,R[13]=We^~Ve&Ge,R[22]=Ot^~rt&$e,R[23]=Ze^~et&it,R[32]=Le^~nt&st,R[33]=ut^~Fe&Qe,R[42]=kt^~qt&Xr,R[43]=_t^~Zr&ei,R[4]=De^~Ie&me,R[5]=ye^~Oe&Me,R[14]=Ae^~Ke&mt,R[15]=Ve^~Ge&It,R[24]=rt^~$e&tt,R[25]=et^~it&Re,R[34]=nt^~st&qe,R[35]=Fe^~Qe&dt,R[44]=qt^~Xr&ti,R[45]=Zr^~ei&vr,R[6]=Ie^~me&Xe,R[7]=Oe^~Me&Ne,R[16]=Ke^~mt&Be,R[17]=Ge^~It&we,R[26]=$e^~tt&Ye,R[27]=it^~Re&Pt,R[36]=st^~qe<,R[37]=Qe^~dt&ht,R[46]=Xr^~ti&Ht,R[47]=ei^~vr&at,R[8]=me^~Xe&be,R[9]=Me^~Ne&Pe,R[18]=mt^~Be&ke,R[19]=It^~we&We,R[28]=tt^~Ye&Ot,R[29]=Re^~Pt&Ze,R[38]=qe^~lt&Le,R[39]=dt^~ht&ut,R[48]=ti^~Ht&kt,R[49]=vr^~at&_t,R[0]^=N[J],R[1]^=N[J+1]};if(f)r.exports=l;else for(y=0;y<d.length;++y)n[d[y]]=l[d[y]]})()})(Tg);var n4=Tg.exports;const s4="logger/5.7.0";let Ng=!1,$g=!1;const il={debug:1,default:2,info:2,warning:3,error:4,off:5};let Lg=il.default,td=null;function o4(){try{const r=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{r.push(e)}}),r.length)throw new Error("missing "+r.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(r){return r.message}return null}const Bg=o4();var rd;(function(r){r.DEBUG="DEBUG",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r.OFF="OFF"})(rd||(rd={}));var yn;(function(r){r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",r.NETWORK_ERROR="NETWORK_ERROR",r.SERVER_ERROR="SERVER_ERROR",r.TIMEOUT="TIMEOUT",r.BUFFER_OVERRUN="BUFFER_OVERRUN",r.NUMERIC_FAULT="NUMERIC_FAULT",r.MISSING_NEW="MISSING_NEW",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",r.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",r.TRANSACTION_REPLACED="TRANSACTION_REPLACED",r.ACTION_REJECTED="ACTION_REJECTED"})(yn||(yn={}));const Fg="0123456789abcdef";class xt{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const i=e.toLowerCase();il[i]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Lg>il[i])&&console.log.apply(console,t)}debug(...e){this._log(xt.levels.DEBUG,e)}info(...e){this._log(xt.levels.INFO,e)}warn(...e){this._log(xt.levels.WARNING,e)}makeError(e,t,i){if($g)return this.makeError("censored error",t,{});t||(t=xt.errors.UNKNOWN_ERROR),i||(i={});const n=[];Object.keys(i).forEach(h=>{const u=i[h];try{if(u instanceof Uint8Array){let g="";for(let w=0;w<u.length;w++)g+=Fg[u[w]>>4],g+=Fg[u[w]&15];n.push(h+"=Uint8Array(0x"+g+")")}else n.push(h+"="+JSON.stringify(u))}catch{n.push(h+"="+JSON.stringify(i[h].toString()))}}),n.push(`code=${t}`),n.push(`version=${this.version}`);const s=e;let a="";switch(t){case yn.NUMERIC_FAULT:{a="NUMERIC_FAULT";const h=e;switch(h){case"overflow":case"underflow":case"division-by-zero":a+="-"+h;break;case"negative-power":case"negative-width":a+="-unsupported";break;case"unbound-bitwise-result":a+="-unbound-result";break}break}case yn.CALL_EXCEPTION:case yn.INSUFFICIENT_FUNDS:case yn.MISSING_NEW:case yn.NONCE_EXPIRED:case yn.REPLACEMENT_UNDERPRICED:case yn.TRANSACTION_REPLACED:case yn.UNPREDICTABLE_GAS_LIMIT:a=t;break}a&&(e+=" [ See: https://links.ethers.org/v5-errors-"+a+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const f=new Error(e);return f.reason=s,f.code=t,Object.keys(i).forEach(function(h){f[h]=i[h]}),f}throwError(e,t,i){throw this.makeError(e,t,i)}throwArgumentError(e,t,i){return this.throwError(e,xt.errors.INVALID_ARGUMENT,{argument:t,value:i})}assert(e,t,i,n){e||this.throwError(t,i,n)}assertArgument(e,t,i,n){e||this.throwArgumentError(t,i,n)}checkNormalize(e){Bg&&this.throwError("platform missing String.prototype.normalize",xt.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Bg})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,xt.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,xt.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,i){i?i=": "+i:i="",e<t&&this.throwError("missing argument"+i,xt.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+i,xt.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",xt.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",xt.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",xt.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return td||(td=new xt(s4)),td}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",xt.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Ng){if(!e)return;this.globalLogger().throwError("error censorship permanent",xt.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}$g=!!e,Ng=!!t}static setLogLevel(e){const t=il[e.toLowerCase()];if(t==null){xt.globalLogger().warn("invalid log level - "+e);return}Lg=t}static from(e){return new xt(e)}}xt.errors=yn,xt.levels=rd;const a4="bytes/5.7.0",br=new xt(a4);function Ug(r){return!!r.toHexString}function _a(r){return r.slice||(r.slice=function(){const e=Array.prototype.slice.call(arguments);return _a(new Uint8Array(Array.prototype.slice.apply(r,e)))}),r}function c4(r){return Oi(r)&&!(r.length%2)||xa(r)}function qg(r){return typeof r=="number"&&r==r&&r%1===0}function xa(r){if(r==null)return!1;if(r.constructor===Uint8Array)return!0;if(typeof r=="string"||!qg(r.length)||r.length<0)return!1;for(let e=0;e<r.length;e++){const t=r[e];if(!qg(t)||t<0||t>=256)return!1}return!0}function ur(r,e){if(e||(e={}),typeof r=="number"){br.checkSafeUint53(r,"invalid arrayify value");const t=[];for(;r;)t.unshift(r&255),r=parseInt(String(r/256));return t.length===0&&t.push(0),_a(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),Ug(r)&&(r=r.toHexString()),Oi(r)){let t=r.substring(2);t.length%2&&(e.hexPad==="left"?t="0"+t:e.hexPad==="right"?t+="0":br.throwArgumentError("hex data is odd-length","value",r));const i=[];for(let n=0;n<t.length;n+=2)i.push(parseInt(t.substring(n,n+2),16));return _a(new Uint8Array(i))}return xa(r)?_a(new Uint8Array(r)):br.throwArgumentError("invalid arrayify value","value",r)}function f4(r){const e=r.map(n=>ur(n)),t=e.reduce((n,s)=>n+s.length,0),i=new Uint8Array(t);return e.reduce((n,s)=>(i.set(s,n),n+s.length),0),_a(i)}function l4(r,e){r=ur(r),r.length>e&&br.throwArgumentError("value out of range","value",arguments[0]);const t=new Uint8Array(e);return t.set(r,e-r.length),_a(t)}function Oi(r,e){return!(typeof r!="string"||!r.match(/^0x[0-9A-Fa-f]*$/)||e&&r.length!==2+2*e)}const id="0123456789abcdef";function ni(r,e){if(e||(e={}),typeof r=="number"){br.checkSafeUint53(r,"invalid hexlify value");let t="";for(;r;)t=id[r&15]+t,r=Math.floor(r/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if(typeof r=="bigint")return r=r.toString(16),r.length%2?"0x0"+r:"0x"+r;if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),Ug(r))return r.toHexString();if(Oi(r))return r.length%2&&(e.hexPad==="left"?r="0x0"+r.substring(2):e.hexPad==="right"?r+="0":br.throwArgumentError("hex data is odd-length","value",r)),r.toLowerCase();if(xa(r)){let t="0x";for(let i=0;i<r.length;i++){let n=r[i];t+=id[(n&240)>>4]+id[n&15]}return t}return br.throwArgumentError("invalid hexlify value","value",r)}function h4(r){if(typeof r!="string")r=ni(r);else if(!Oi(r)||r.length%2)return null;return(r.length-2)/2}function zg(r,e,t){return typeof r!="string"?r=ni(r):(!Oi(r)||r.length%2)&&br.throwArgumentError("invalid hexData","value",r),e=2+2*e,t!=null?"0x"+r.substring(e,2+2*t):"0x"+r.substring(e)}function qn(r,e){for(typeof r!="string"?r=ni(r):Oi(r)||br.throwArgumentError("invalid hex string","value",r),r.length>2*e+2&&br.throwArgumentError("value out of range","value",arguments[1]);r.length<2*e+2;)r="0x0"+r.substring(2);return r}function Hg(r){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(c4(r)){let t=ur(r);t.length===64?(e.v=27+(t[32]>>7),t[32]&=127,e.r=ni(t.slice(0,32)),e.s=ni(t.slice(32,64))):t.length===65?(e.r=ni(t.slice(0,32)),e.s=ni(t.slice(32,64)),e.v=t[64]):br.throwArgumentError("invalid signature string","signature",r),e.v<27&&(e.v===0||e.v===1?e.v+=27:br.throwArgumentError("signature invalid v byte","signature",r)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(t[32]|=128),e._vs=ni(t.slice(32,64))}else{if(e.r=r.r,e.s=r.s,e.v=r.v,e.recoveryParam=r.recoveryParam,e._vs=r._vs,e._vs!=null){const n=l4(ur(e._vs),32);e._vs=ni(n);const s=n[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&br.throwArgumentError("signature recoveryParam mismatch _vs","signature",r),n[0]&=127;const a=ni(n);e.s==null?e.s=a:e.s!==a&&br.throwArgumentError("signature v mismatch _vs","signature",r)}if(e.recoveryParam==null)e.v==null?br.throwArgumentError("signature missing v and recoveryParam","signature",r):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const n=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==n&&br.throwArgumentError("signature recoveryParam mismatch v","signature",r)}e.r==null||!Oi(e.r)?br.throwArgumentError("signature missing or invalid r","signature",r):e.r=qn(e.r,32),e.s==null||!Oi(e.s)?br.throwArgumentError("signature missing or invalid s","signature",r):e.s=qn(e.s,32);const t=ur(e.s);t[0]>=128&&br.throwArgumentError("signature s out of range","signature",r),e.recoveryParam&&(t[0]|=128);const i=ni(t);e._vs&&(Oi(e._vs)||br.throwArgumentError("signature invalid _vs","signature",r),e._vs=qn(e._vs,32)),e._vs==null?e._vs=i:e._vs!==i&&br.throwArgumentError("signature _vs mismatch v and s","signature",r)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function nd(r){return"0x"+n4.keccak_256(ur(r))}var kg={exports:{}},u4={},d4=Object.freeze({__proto__:null,default:u4}),nl=ju(d4);(function(r){(function(e,t){function i(m,l){if(!m)throw new Error(l||"Assertion failed")}function n(m,l){m.super_=l;var d=function(){};d.prototype=l.prototype,m.prototype=new d,m.prototype.constructor=m}function s(m,l,d){if(s.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((l==="le"||l==="be")&&(d=l,l=10),this._init(m||0,l||10,d||"be"))}typeof e=="object"?e.exports=s:t.BN=s,s.BN=s,s.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=nl.Buffer}catch{}s.isBN=function(l){return l instanceof s?!0:l!==null&&typeof l=="object"&&l.constructor.wordSize===s.wordSize&&Array.isArray(l.words)},s.max=function(l,d){return l.cmp(d)>0?l:d},s.min=function(l,d){return l.cmp(d)<0?l:d},s.prototype._init=function(l,d,y){if(typeof l=="number")return this._initNumber(l,d,y);if(typeof l=="object")return this._initArray(l,d,y);d==="hex"&&(d=16),i(d===(d|0)&&d>=2&&d<=36),l=l.toString().replace(/\s+/g,"");var P=0;l[0]==="-"&&(P++,this.negative=1),P<l.length&&(d===16?this._parseHex(l,P,y):(this._parseBase(l,d,P),y==="le"&&this._initArray(this.toArray(),d,y)))},s.prototype._initNumber=function(l,d,y){l<0&&(this.negative=1,l=-l),l<67108864?(this.words=[l&67108863],this.length=1):l<4503599627370496?(this.words=[l&67108863,l/67108864&67108863],this.length=2):(i(l<9007199254740992),this.words=[l&67108863,l/67108864&67108863,1],this.length=3),y==="le"&&this._initArray(this.toArray(),d,y)},s.prototype._initArray=function(l,d,y){if(i(typeof l.length=="number"),l.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(l.length/3),this.words=new Array(this.length);for(var P=0;P<this.length;P++)this.words[P]=0;var D,S,v=0;if(y==="be")for(P=l.length-1,D=0;P>=0;P-=3)S=l[P]|l[P-1]<<8|l[P-2]<<16,this.words[D]|=S<<v&67108863,this.words[D+1]=S>>>26-v&67108863,v+=24,v>=26&&(v-=26,D++);else if(y==="le")for(P=0,D=0;P<l.length;P+=3)S=l[P]|l[P+1]<<8|l[P+2]<<16,this.words[D]|=S<<v&67108863,this.words[D+1]=S>>>26-v&67108863,v+=24,v>=26&&(v-=26,D++);return this._strip()};function f(m,l){var d=m.charCodeAt(l);if(d>=48&&d<=57)return d-48;if(d>=65&&d<=70)return d-55;if(d>=97&&d<=102)return d-87;i(!1,"Invalid character in "+m)}function h(m,l,d){var y=f(m,d);return d-1>=l&&(y|=f(m,d-1)<<4),y}s.prototype._parseHex=function(l,d,y){this.length=Math.ceil((l.length-d)/6),this.words=new Array(this.length);for(var P=0;P<this.length;P++)this.words[P]=0;var D=0,S=0,v;if(y==="be")for(P=l.length-1;P>=d;P-=2)v=h(l,d,P)<<D,this.words[S]|=v&67108863,D>=18?(D-=18,S+=1,this.words[S]|=v>>>26):D+=8;else{var A=l.length-d;for(P=A%2===0?d+1:d;P<l.length;P+=2)v=h(l,d,P)<<D,this.words[S]|=v&67108863,D>=18?(D-=18,S+=1,this.words[S]|=v>>>26):D+=8}this._strip()};function u(m,l,d,y){for(var P=0,D=0,S=Math.min(m.length,d),v=l;v<S;v++){var A=m.charCodeAt(v)-48;P*=y,A>=49?D=A-49+10:A>=17?D=A-17+10:D=A,i(A>=0&&D<y,"Invalid character"),P+=D}return P}s.prototype._parseBase=function(l,d,y){this.words=[0],this.length=1;for(var P=0,D=1;D<=67108863;D*=d)P++;P--,D=D/d|0;for(var S=l.length-y,v=S%P,A=Math.min(S,S-v)+y,x=0,$=y;$<A;$+=P)x=u(l,$,$+P,d),this.imuln(D),this.words[0]+x<67108864?this.words[0]+=x:this._iaddn(x);if(v!==0){var ae=1;for(x=u(l,$,l.length,d),$=0;$<v;$++)ae*=d;this.imuln(ae),this.words[0]+x<67108864?this.words[0]+=x:this._iaddn(x)}this._strip()},s.prototype.copy=function(l){l.words=new Array(this.length);for(var d=0;d<this.length;d++)l.words[d]=this.words[d];l.length=this.length,l.negative=this.negative,l.red=this.red};function g(m,l){m.words=l.words,m.length=l.length,m.negative=l.negative,m.red=l.red}if(s.prototype._move=function(l){g(l,this)},s.prototype.clone=function(){var l=new s(null);return this.copy(l),l},s.prototype._expand=function(l){for(;this.length<l;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=w}catch{s.prototype.inspect=w}else s.prototype.inspect=w;function w(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var M=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],C=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],O=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(l,d){l=l||10,d=d|0||1;var y;if(l===16||l==="hex"){y="";for(var P=0,D=0,S=0;S<this.length;S++){var v=this.words[S],A=((v<<P|D)&16777215).toString(16);D=v>>>24-P&16777215,P+=2,P>=26&&(P-=26,S--),D!==0||S!==this.length-1?y=M[6-A.length]+A+y:y=A+y}for(D!==0&&(y=D.toString(16)+y);y.length%d!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}if(l===(l|0)&&l>=2&&l<=36){var x=C[l],$=O[l];y="";var ae=this.clone();for(ae.negative=0;!ae.isZero();){var R=ae.modrn($).toString(l);ae=ae.idivn($),ae.isZero()?y=R+y:y=M[x-R.length]+R+y}for(this.isZero()&&(y="0"+y);y.length%d!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var l=this.words[0];return this.length===2?l+=this.words[1]*67108864:this.length===3&&this.words[2]===1?l+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-l:l},s.prototype.toJSON=function(){return this.toString(16,2)},a&&(s.prototype.toBuffer=function(l,d){return this.toArrayLike(a,l,d)}),s.prototype.toArray=function(l,d){return this.toArrayLike(Array,l,d)};var N=function(l,d){return l.allocUnsafe?l.allocUnsafe(d):new l(d)};s.prototype.toArrayLike=function(l,d,y){this._strip();var P=this.byteLength(),D=y||Math.max(1,P);i(P<=D,"byte array longer than desired length"),i(D>0,"Requested array length <= 0");var S=N(l,D),v=d==="le"?"LE":"BE";return this["_toArrayLike"+v](S,P),S},s.prototype._toArrayLikeLE=function(l,d){for(var y=0,P=0,D=0,S=0;D<this.length;D++){var v=this.words[D]<<S|P;l[y++]=v&255,y<l.length&&(l[y++]=v>>8&255),y<l.length&&(l[y++]=v>>16&255),S===6?(y<l.length&&(l[y++]=v>>24&255),P=0,S=0):(P=v>>>24,S+=2)}if(y<l.length)for(l[y++]=P;y<l.length;)l[y++]=0},s.prototype._toArrayLikeBE=function(l,d){for(var y=l.length-1,P=0,D=0,S=0;D<this.length;D++){var v=this.words[D]<<S|P;l[y--]=v&255,y>=0&&(l[y--]=v>>8&255),y>=0&&(l[y--]=v>>16&255),S===6?(y>=0&&(l[y--]=v>>24&255),P=0,S=0):(P=v>>>24,S+=2)}if(y>=0)for(l[y--]=P;y>=0;)l[y--]=0},Math.clz32?s.prototype._countBits=function(l){return 32-Math.clz32(l)}:s.prototype._countBits=function(l){var d=l,y=0;return d>=4096&&(y+=13,d>>>=13),d>=64&&(y+=7,d>>>=7),d>=8&&(y+=4,d>>>=4),d>=2&&(y+=2,d>>>=2),y+d},s.prototype._zeroBits=function(l){if(l===0)return 26;var d=l,y=0;return d&8191||(y+=13,d>>>=13),d&127||(y+=7,d>>>=7),d&15||(y+=4,d>>>=4),d&3||(y+=2,d>>>=2),d&1||y++,y},s.prototype.bitLength=function(){var l=this.words[this.length-1],d=this._countBits(l);return(this.length-1)*26+d};function j(m){for(var l=new Array(m.bitLength()),d=0;d<l.length;d++){var y=d/26|0,P=d%26;l[d]=m.words[y]>>>P&1}return l}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var l=0,d=0;d<this.length;d++){var y=this._zeroBits(this.words[d]);if(l+=y,y!==26)break}return l},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(l){return this.negative!==0?this.abs().inotn(l).iaddn(1):this.clone()},s.prototype.fromTwos=function(l){return this.testn(l-1)?this.notn(l).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(l){for(;this.length<l.length;)this.words[this.length++]=0;for(var d=0;d<l.length;d++)this.words[d]=this.words[d]|l.words[d];return this._strip()},s.prototype.ior=function(l){return i((this.negative|l.negative)===0),this.iuor(l)},s.prototype.or=function(l){return this.length>l.length?this.clone().ior(l):l.clone().ior(this)},s.prototype.uor=function(l){return this.length>l.length?this.clone().iuor(l):l.clone().iuor(this)},s.prototype.iuand=function(l){var d;this.length>l.length?d=l:d=this;for(var y=0;y<d.length;y++)this.words[y]=this.words[y]&l.words[y];return this.length=d.length,this._strip()},s.prototype.iand=function(l){return i((this.negative|l.negative)===0),this.iuand(l)},s.prototype.and=function(l){return this.length>l.length?this.clone().iand(l):l.clone().iand(this)},s.prototype.uand=function(l){return this.length>l.length?this.clone().iuand(l):l.clone().iuand(this)},s.prototype.iuxor=function(l){var d,y;this.length>l.length?(d=this,y=l):(d=l,y=this);for(var P=0;P<y.length;P++)this.words[P]=d.words[P]^y.words[P];if(this!==d)for(;P<d.length;P++)this.words[P]=d.words[P];return this.length=d.length,this._strip()},s.prototype.ixor=function(l){return i((this.negative|l.negative)===0),this.iuxor(l)},s.prototype.xor=function(l){return this.length>l.length?this.clone().ixor(l):l.clone().ixor(this)},s.prototype.uxor=function(l){return this.length>l.length?this.clone().iuxor(l):l.clone().iuxor(this)},s.prototype.inotn=function(l){i(typeof l=="number"&&l>=0);var d=Math.ceil(l/26)|0,y=l%26;this._expand(d),y>0&&d--;for(var P=0;P<d;P++)this.words[P]=~this.words[P]&67108863;return y>0&&(this.words[P]=~this.words[P]&67108863>>26-y),this._strip()},s.prototype.notn=function(l){return this.clone().inotn(l)},s.prototype.setn=function(l,d){i(typeof l=="number"&&l>=0);var y=l/26|0,P=l%26;return this._expand(y+1),d?this.words[y]=this.words[y]|1<<P:this.words[y]=this.words[y]&~(1<<P),this._strip()},s.prototype.iadd=function(l){var d;if(this.negative!==0&&l.negative===0)return this.negative=0,d=this.isub(l),this.negative^=1,this._normSign();if(this.negative===0&&l.negative!==0)return l.negative=0,d=this.isub(l),l.negative=1,d._normSign();var y,P;this.length>l.length?(y=this,P=l):(y=l,P=this);for(var D=0,S=0;S<P.length;S++)d=(y.words[S]|0)+(P.words[S]|0)+D,this.words[S]=d&67108863,D=d>>>26;for(;D!==0&&S<y.length;S++)d=(y.words[S]|0)+D,this.words[S]=d&67108863,D=d>>>26;if(this.length=y.length,D!==0)this.words[this.length]=D,this.length++;else if(y!==this)for(;S<y.length;S++)this.words[S]=y.words[S];return this},s.prototype.add=function(l){var d;return l.negative!==0&&this.negative===0?(l.negative=0,d=this.sub(l),l.negative^=1,d):l.negative===0&&this.negative!==0?(this.negative=0,d=l.sub(this),this.negative=1,d):this.length>l.length?this.clone().iadd(l):l.clone().iadd(this)},s.prototype.isub=function(l){if(l.negative!==0){l.negative=0;var d=this.iadd(l);return l.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(l),this.negative=1,this._normSign();var y=this.cmp(l);if(y===0)return this.negative=0,this.length=1,this.words[0]=0,this;var P,D;y>0?(P=this,D=l):(P=l,D=this);for(var S=0,v=0;v<D.length;v++)d=(P.words[v]|0)-(D.words[v]|0)+S,S=d>>26,this.words[v]=d&67108863;for(;S!==0&&v<P.length;v++)d=(P.words[v]|0)+S,S=d>>26,this.words[v]=d&67108863;if(S===0&&v<P.length&&P!==this)for(;v<P.length;v++)this.words[v]=P.words[v];return this.length=Math.max(this.length,v),P!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(l){return this.clone().isub(l)};function H(m,l,d){d.negative=l.negative^m.negative;var y=m.length+l.length|0;d.length=y,y=y-1|0;var P=m.words[0]|0,D=l.words[0]|0,S=P*D,v=S&67108863,A=S/67108864|0;d.words[0]=v;for(var x=1;x<y;x++){for(var $=A>>>26,ae=A&67108863,R=Math.min(x,l.length-1),X=Math.max(0,x-m.length+1);X<=R;X++){var V=x-X|0;P=m.words[V]|0,D=l.words[X]|0,S=P*D+ae,$+=S/67108864|0,ae=S&67108863}d.words[x]=ae|0,A=$|0}return A!==0?d.words[x]=A|0:d.length--,d._strip()}var F=function(l,d,y){var P=l.words,D=d.words,S=y.words,v=0,A,x,$,ae=P[0]|0,R=ae&8191,X=ae>>>13,V=P[1]|0,J=V&8191,K=V>>>13,E=P[2]|0,Y=E&8191,re=E>>>13,le=P[3]|0,he=le&8191,ge=le>>>13,He=P[4]|0,Te=He&8191,Ce=He>>>13,Xe=P[5]|0,Ne=Xe&8191,be=Xe>>>13,Pe=P[6]|0,De=Pe&8191,ye=Pe>>>13,Ie=P[7]|0,Oe=Ie&8191,me=Ie>>>13,Me=P[8]|0,Be=Me&8191,we=Me>>>13,ke=P[9]|0,We=ke&8191,Ae=ke>>>13,Ve=D[0]|0,Ke=Ve&8191,Ge=Ve>>>13,mt=D[1]|0,It=mt&8191,Ye=mt>>>13,Pt=D[2]|0,Ot=Pt&8191,Ze=Pt>>>13,rt=D[3]|0,et=rt&8191,$e=rt>>>13,it=D[4]|0,tt=it&8191,Re=it>>>13,lt=D[5]|0,ht=lt&8191,Le=lt>>>13,ut=D[6]|0,nt=ut&8191,Fe=ut>>>13,st=D[7]|0,Qe=st&8191,qe=st>>>13,dt=D[8]|0,Ht=dt&8191,at=dt>>>13,kt=D[9]|0,_t=kt&8191,qt=kt>>>13;y.negative=l.negative^d.negative,y.length=19,A=Math.imul(R,Ke),x=Math.imul(R,Ge),x=x+Math.imul(X,Ke)|0,$=Math.imul(X,Ge);var Zr=(v+A|0)+((x&8191)<<13)|0;v=($+(x>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,A=Math.imul(J,Ke),x=Math.imul(J,Ge),x=x+Math.imul(K,Ke)|0,$=Math.imul(K,Ge),A=A+Math.imul(R,It)|0,x=x+Math.imul(R,Ye)|0,x=x+Math.imul(X,It)|0,$=$+Math.imul(X,Ye)|0;var Xr=(v+A|0)+((x&8191)<<13)|0;v=($+(x>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,A=Math.imul(Y,Ke),x=Math.imul(Y,Ge),x=x+Math.imul(re,Ke)|0,$=Math.imul(re,Ge),A=A+Math.imul(J,It)|0,x=x+Math.imul(J,Ye)|0,x=x+Math.imul(K,It)|0,$=$+Math.imul(K,Ye)|0,A=A+Math.imul(R,Ot)|0,x=x+Math.imul(R,Ze)|0,x=x+Math.imul(X,Ot)|0,$=$+Math.imul(X,Ze)|0;var ei=(v+A|0)+((x&8191)<<13)|0;v=($+(x>>>13)|0)+(ei>>>26)|0,ei&=67108863,A=Math.imul(he,Ke),x=Math.imul(he,Ge),x=x+Math.imul(ge,Ke)|0,$=Math.imul(ge,Ge),A=A+Math.imul(Y,It)|0,x=x+Math.imul(Y,Ye)|0,x=x+Math.imul(re,It)|0,$=$+Math.imul(re,Ye)|0,A=A+Math.imul(J,Ot)|0,x=x+Math.imul(J,Ze)|0,x=x+Math.imul(K,Ot)|0,$=$+Math.imul(K,Ze)|0,A=A+Math.imul(R,et)|0,x=x+Math.imul(R,$e)|0,x=x+Math.imul(X,et)|0,$=$+Math.imul(X,$e)|0;var ti=(v+A|0)+((x&8191)<<13)|0;v=($+(x>>>13)|0)+(ti>>>26)|0,ti&=67108863,A=Math.imul(Te,Ke),x=Math.imul(Te,Ge),x=x+Math.imul(Ce,Ke)|0,$=Math.imul(Ce,Ge),A=A+Math.imul(he,It)|0,x=x+Math.imul(he,Ye)|0,x=x+Math.imul(ge,It)|0,$=$+Math.imul(ge,Ye)|0,A=A+Math.imul(Y,Ot)|0,x=x+Math.imul(Y,Ze)|0,x=x+Math.imul(re,Ot)|0,$=$+Math.imul(re,Ze)|0,A=A+Math.imul(J,et)|0,x=x+Math.imul(J,$e)|0,x=x+Math.imul(K,et)|0,$=$+Math.imul(K,$e)|0,A=A+Math.imul(R,tt)|0,x=x+Math.imul(R,Re)|0,x=x+Math.imul(X,tt)|0,$=$+Math.imul(X,Re)|0;var vr=(v+A|0)+((x&8191)<<13)|0;v=($+(x>>>13)|0)+(vr>>>26)|0,vr&=67108863,A=Math.imul(Ne,Ke),x=Math.imul(Ne,Ge),x=x+Math.imul(be,Ke)|0,$=Math.imul(be,Ge),A=A+Math.imul(Te,It)|0,x=x+Math.imul(Te,Ye)|0,x=x+Math.imul(Ce,It)|0,$=$+Math.imul(Ce,Ye)|0,A=A+Math.imul(he,Ot)|0,x=x+Math.imul(he,Ze)|0,x=x+Math.imul(ge,Ot)|0,$=$+Math.imul(ge,Ze)|0,A=A+Math.imul(Y,et)|0,x=x+Math.imul(Y,$e)|0,x=x+Math.imul(re,et)|0,$=$+Math.imul(re,$e)|0,A=A+Math.imul(J,tt)|0,x=x+Math.imul(J,Re)|0,x=x+Math.imul(K,tt)|0,$=$+Math.imul(K,Re)|0,A=A+Math.imul(R,ht)|0,x=x+Math.imul(R,Le)|0,x=x+Math.imul(X,ht)|0,$=$+Math.imul(X,Le)|0;var Ai=(v+A|0)+((x&8191)<<13)|0;v=($+(x>>>13)|0)+(Ai>>>26)|0,Ai&=67108863,A=Math.imul(De,Ke),x=Math.imul(De,Ge),x=x+Math.imul(ye,Ke)|0,$=Math.imul(ye,Ge),A=A+Math.imul(Ne,It)|0,x=x+Math.imul(Ne,Ye)|0,x=x+Math.imul(be,It)|0,$=$+Math.imul(be,Ye)|0,A=A+Math.imul(Te,Ot)|0,x=x+Math.imul(Te,Ze)|0,x=x+Math.imul(Ce,Ot)|0,$=$+Math.imul(Ce,Ze)|0,A=A+Math.imul(he,et)|0,x=x+Math.imul(he,$e)|0,x=x+Math.imul(ge,et)|0,$=$+Math.imul(ge,$e)|0,A=A+Math.imul(Y,tt)|0,x=x+Math.imul(Y,Re)|0,x=x+Math.imul(re,tt)|0,$=$+Math.imul(re,Re)|0,A=A+Math.imul(J,ht)|0,x=x+Math.imul(J,Le)|0,x=x+Math.imul(K,ht)|0,$=$+Math.imul(K,Le)|0,A=A+Math.imul(R,nt)|0,x=x+Math.imul(R,Fe)|0,x=x+Math.imul(X,nt)|0,$=$+Math.imul(X,Fe)|0;var Pn=(v+A|0)+((x&8191)<<13)|0;v=($+(x>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,A=Math.imul(Oe,Ke),x=Math.imul(Oe,Ge),x=x+Math.imul(me,Ke)|0,$=Math.imul(me,Ge),A=A+Math.imul(De,It)|0,x=x+Math.imul(De,Ye)|0,x=x+Math.imul(ye,It)|0,$=$+Math.imul(ye,Ye)|0,A=A+Math.imul(Ne,Ot)|0,x=x+Math.imul(Ne,Ze)|0,x=x+Math.imul(be,Ot)|0,$=$+Math.imul(be,Ze)|0,A=A+Math.imul(Te,et)|0,x=x+Math.imul(Te,$e)|0,x=x+Math.imul(Ce,et)|0,$=$+Math.imul(Ce,$e)|0,A=A+Math.imul(he,tt)|0,x=x+Math.imul(he,Re)|0,x=x+Math.imul(ge,tt)|0,$=$+Math.imul(ge,Re)|0,A=A+Math.imul(Y,ht)|0,x=x+Math.imul(Y,Le)|0,x=x+Math.imul(re,ht)|0,$=$+Math.imul(re,Le)|0,A=A+Math.imul(J,nt)|0,x=x+Math.imul(J,Fe)|0,x=x+Math.imul(K,nt)|0,$=$+Math.imul(K,Fe)|0,A=A+Math.imul(R,Qe)|0,x=x+Math.imul(R,qe)|0,x=x+Math.imul(X,Qe)|0,$=$+Math.imul(X,qe)|0;var Ei=(v+A|0)+((x&8191)<<13)|0;v=($+(x>>>13)|0)+(Ei>>>26)|0,Ei&=67108863,A=Math.imul(Be,Ke),x=Math.imul(Be,Ge),x=x+Math.imul(we,Ke)|0,$=Math.imul(we,Ge),A=A+Math.imul(Oe,It)|0,x=x+Math.imul(Oe,Ye)|0,x=x+Math.imul(me,It)|0,$=$+Math.imul(me,Ye)|0,A=A+Math.imul(De,Ot)|0,x=x+Math.imul(De,Ze)|0,x=x+Math.imul(ye,Ot)|0,$=$+Math.imul(ye,Ze)|0,A=A+Math.imul(Ne,et)|0,x=x+Math.imul(Ne,$e)|0,x=x+Math.imul(be,et)|0,$=$+Math.imul(be,$e)|0,A=A+Math.imul(Te,tt)|0,x=x+Math.imul(Te,Re)|0,x=x+Math.imul(Ce,tt)|0,$=$+Math.imul(Ce,Re)|0,A=A+Math.imul(he,ht)|0,x=x+Math.imul(he,Le)|0,x=x+Math.imul(ge,ht)|0,$=$+Math.imul(ge,Le)|0,A=A+Math.imul(Y,nt)|0,x=x+Math.imul(Y,Fe)|0,x=x+Math.imul(re,nt)|0,$=$+Math.imul(re,Fe)|0,A=A+Math.imul(J,Qe)|0,x=x+Math.imul(J,qe)|0,x=x+Math.imul(K,Qe)|0,$=$+Math.imul(K,qe)|0,A=A+Math.imul(R,Ht)|0,x=x+Math.imul(R,at)|0,x=x+Math.imul(X,Ht)|0,$=$+Math.imul(X,at)|0;var Dn=(v+A|0)+((x&8191)<<13)|0;v=($+(x>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,A=Math.imul(We,Ke),x=Math.imul(We,Ge),x=x+Math.imul(Ae,Ke)|0,$=Math.imul(Ae,Ge),A=A+Math.imul(Be,It)|0,x=x+Math.imul(Be,Ye)|0,x=x+Math.imul(we,It)|0,$=$+Math.imul(we,Ye)|0,A=A+Math.imul(Oe,Ot)|0,x=x+Math.imul(Oe,Ze)|0,x=x+Math.imul(me,Ot)|0,$=$+Math.imul(me,Ze)|0,A=A+Math.imul(De,et)|0,x=x+Math.imul(De,$e)|0,x=x+Math.imul(ye,et)|0,$=$+Math.imul(ye,$e)|0,A=A+Math.imul(Ne,tt)|0,x=x+Math.imul(Ne,Re)|0,x=x+Math.imul(be,tt)|0,$=$+Math.imul(be,Re)|0,A=A+Math.imul(Te,ht)|0,x=x+Math.imul(Te,Le)|0,x=x+Math.imul(Ce,ht)|0,$=$+Math.imul(Ce,Le)|0,A=A+Math.imul(he,nt)|0,x=x+Math.imul(he,Fe)|0,x=x+Math.imul(ge,nt)|0,$=$+Math.imul(ge,Fe)|0,A=A+Math.imul(Y,Qe)|0,x=x+Math.imul(Y,qe)|0,x=x+Math.imul(re,Qe)|0,$=$+Math.imul(re,qe)|0,A=A+Math.imul(J,Ht)|0,x=x+Math.imul(J,at)|0,x=x+Math.imul(K,Ht)|0,$=$+Math.imul(K,at)|0,A=A+Math.imul(R,_t)|0,x=x+Math.imul(R,qt)|0,x=x+Math.imul(X,_t)|0,$=$+Math.imul(X,qt)|0;var On=(v+A|0)+((x&8191)<<13)|0;v=($+(x>>>13)|0)+(On>>>26)|0,On&=67108863,A=Math.imul(We,It),x=Math.imul(We,Ye),x=x+Math.imul(Ae,It)|0,$=Math.imul(Ae,Ye),A=A+Math.imul(Be,Ot)|0,x=x+Math.imul(Be,Ze)|0,x=x+Math.imul(we,Ot)|0,$=$+Math.imul(we,Ze)|0,A=A+Math.imul(Oe,et)|0,x=x+Math.imul(Oe,$e)|0,x=x+Math.imul(me,et)|0,$=$+Math.imul(me,$e)|0,A=A+Math.imul(De,tt)|0,x=x+Math.imul(De,Re)|0,x=x+Math.imul(ye,tt)|0,$=$+Math.imul(ye,Re)|0,A=A+Math.imul(Ne,ht)|0,x=x+Math.imul(Ne,Le)|0,x=x+Math.imul(be,ht)|0,$=$+Math.imul(be,Le)|0,A=A+Math.imul(Te,nt)|0,x=x+Math.imul(Te,Fe)|0,x=x+Math.imul(Ce,nt)|0,$=$+Math.imul(Ce,Fe)|0,A=A+Math.imul(he,Qe)|0,x=x+Math.imul(he,qe)|0,x=x+Math.imul(ge,Qe)|0,$=$+Math.imul(ge,qe)|0,A=A+Math.imul(Y,Ht)|0,x=x+Math.imul(Y,at)|0,x=x+Math.imul(re,Ht)|0,$=$+Math.imul(re,at)|0,A=A+Math.imul(J,_t)|0,x=x+Math.imul(J,qt)|0,x=x+Math.imul(K,_t)|0,$=$+Math.imul(K,qt)|0;var Si=(v+A|0)+((x&8191)<<13)|0;v=($+(x>>>13)|0)+(Si>>>26)|0,Si&=67108863,A=Math.imul(We,Ot),x=Math.imul(We,Ze),x=x+Math.imul(Ae,Ot)|0,$=Math.imul(Ae,Ze),A=A+Math.imul(Be,et)|0,x=x+Math.imul(Be,$e)|0,x=x+Math.imul(we,et)|0,$=$+Math.imul(we,$e)|0,A=A+Math.imul(Oe,tt)|0,x=x+Math.imul(Oe,Re)|0,x=x+Math.imul(me,tt)|0,$=$+Math.imul(me,Re)|0,A=A+Math.imul(De,ht)|0,x=x+Math.imul(De,Le)|0,x=x+Math.imul(ye,ht)|0,$=$+Math.imul(ye,Le)|0,A=A+Math.imul(Ne,nt)|0,x=x+Math.imul(Ne,Fe)|0,x=x+Math.imul(be,nt)|0,$=$+Math.imul(be,Fe)|0,A=A+Math.imul(Te,Qe)|0,x=x+Math.imul(Te,qe)|0,x=x+Math.imul(Ce,Qe)|0,$=$+Math.imul(Ce,qe)|0,A=A+Math.imul(he,Ht)|0,x=x+Math.imul(he,at)|0,x=x+Math.imul(ge,Ht)|0,$=$+Math.imul(ge,at)|0,A=A+Math.imul(Y,_t)|0,x=x+Math.imul(Y,qt)|0,x=x+Math.imul(re,_t)|0,$=$+Math.imul(re,qt)|0;var fn=(v+A|0)+((x&8191)<<13)|0;v=($+(x>>>13)|0)+(fn>>>26)|0,fn&=67108863,A=Math.imul(We,et),x=Math.imul(We,$e),x=x+Math.imul(Ae,et)|0,$=Math.imul(Ae,$e),A=A+Math.imul(Be,tt)|0,x=x+Math.imul(Be,Re)|0,x=x+Math.imul(we,tt)|0,$=$+Math.imul(we,Re)|0,A=A+Math.imul(Oe,ht)|0,x=x+Math.imul(Oe,Le)|0,x=x+Math.imul(me,ht)|0,$=$+Math.imul(me,Le)|0,A=A+Math.imul(De,nt)|0,x=x+Math.imul(De,Fe)|0,x=x+Math.imul(ye,nt)|0,$=$+Math.imul(ye,Fe)|0,A=A+Math.imul(Ne,Qe)|0,x=x+Math.imul(Ne,qe)|0,x=x+Math.imul(be,Qe)|0,$=$+Math.imul(be,qe)|0,A=A+Math.imul(Te,Ht)|0,x=x+Math.imul(Te,at)|0,x=x+Math.imul(Ce,Ht)|0,$=$+Math.imul(Ce,at)|0,A=A+Math.imul(he,_t)|0,x=x+Math.imul(he,qt)|0,x=x+Math.imul(ge,_t)|0,$=$+Math.imul(ge,qt)|0;var ln=(v+A|0)+((x&8191)<<13)|0;v=($+(x>>>13)|0)+(ln>>>26)|0,ln&=67108863,A=Math.imul(We,tt),x=Math.imul(We,Re),x=x+Math.imul(Ae,tt)|0,$=Math.imul(Ae,Re),A=A+Math.imul(Be,ht)|0,x=x+Math.imul(Be,Le)|0,x=x+Math.imul(we,ht)|0,$=$+Math.imul(we,Le)|0,A=A+Math.imul(Oe,nt)|0,x=x+Math.imul(Oe,Fe)|0,x=x+Math.imul(me,nt)|0,$=$+Math.imul(me,Fe)|0,A=A+Math.imul(De,Qe)|0,x=x+Math.imul(De,qe)|0,x=x+Math.imul(ye,Qe)|0,$=$+Math.imul(ye,qe)|0,A=A+Math.imul(Ne,Ht)|0,x=x+Math.imul(Ne,at)|0,x=x+Math.imul(be,Ht)|0,$=$+Math.imul(be,at)|0,A=A+Math.imul(Te,_t)|0,x=x+Math.imul(Te,qt)|0,x=x+Math.imul(Ce,_t)|0,$=$+Math.imul(Ce,qt)|0;var Cr=(v+A|0)+((x&8191)<<13)|0;v=($+(x>>>13)|0)+(Cr>>>26)|0,Cr&=67108863,A=Math.imul(We,ht),x=Math.imul(We,Le),x=x+Math.imul(Ae,ht)|0,$=Math.imul(Ae,Le),A=A+Math.imul(Be,nt)|0,x=x+Math.imul(Be,Fe)|0,x=x+Math.imul(we,nt)|0,$=$+Math.imul(we,Fe)|0,A=A+Math.imul(Oe,Qe)|0,x=x+Math.imul(Oe,qe)|0,x=x+Math.imul(me,Qe)|0,$=$+Math.imul(me,qe)|0,A=A+Math.imul(De,Ht)|0,x=x+Math.imul(De,at)|0,x=x+Math.imul(ye,Ht)|0,$=$+Math.imul(ye,at)|0,A=A+Math.imul(Ne,_t)|0,x=x+Math.imul(Ne,qt)|0,x=x+Math.imul(be,_t)|0,$=$+Math.imul(be,qt)|0;var Rn=(v+A|0)+((x&8191)<<13)|0;v=($+(x>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,A=Math.imul(We,nt),x=Math.imul(We,Fe),x=x+Math.imul(Ae,nt)|0,$=Math.imul(Ae,Fe),A=A+Math.imul(Be,Qe)|0,x=x+Math.imul(Be,qe)|0,x=x+Math.imul(we,Qe)|0,$=$+Math.imul(we,qe)|0,A=A+Math.imul(Oe,Ht)|0,x=x+Math.imul(Oe,at)|0,x=x+Math.imul(me,Ht)|0,$=$+Math.imul(me,at)|0,A=A+Math.imul(De,_t)|0,x=x+Math.imul(De,qt)|0,x=x+Math.imul(ye,_t)|0,$=$+Math.imul(ye,qt)|0;var Tn=(v+A|0)+((x&8191)<<13)|0;v=($+(x>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,A=Math.imul(We,Qe),x=Math.imul(We,qe),x=x+Math.imul(Ae,Qe)|0,$=Math.imul(Ae,qe),A=A+Math.imul(Be,Ht)|0,x=x+Math.imul(Be,at)|0,x=x+Math.imul(we,Ht)|0,$=$+Math.imul(we,at)|0,A=A+Math.imul(Oe,_t)|0,x=x+Math.imul(Oe,qt)|0,x=x+Math.imul(me,_t)|0,$=$+Math.imul(me,qt)|0;var Nn=(v+A|0)+((x&8191)<<13)|0;v=($+(x>>>13)|0)+(Nn>>>26)|0,Nn&=67108863,A=Math.imul(We,Ht),x=Math.imul(We,at),x=x+Math.imul(Ae,Ht)|0,$=Math.imul(Ae,at),A=A+Math.imul(Be,_t)|0,x=x+Math.imul(Be,qt)|0,x=x+Math.imul(we,_t)|0,$=$+Math.imul(we,qt)|0;var na=(v+A|0)+((x&8191)<<13)|0;v=($+(x>>>13)|0)+(na>>>26)|0,na&=67108863,A=Math.imul(We,_t),x=Math.imul(We,qt),x=x+Math.imul(Ae,_t)|0,$=Math.imul(Ae,qt);var lo=(v+A|0)+((x&8191)<<13)|0;return v=($+(x>>>13)|0)+(lo>>>26)|0,lo&=67108863,S[0]=Zr,S[1]=Xr,S[2]=ei,S[3]=ti,S[4]=vr,S[5]=Ai,S[6]=Pn,S[7]=Ei,S[8]=Dn,S[9]=On,S[10]=Si,S[11]=fn,S[12]=ln,S[13]=Cr,S[14]=Rn,S[15]=Tn,S[16]=Nn,S[17]=na,S[18]=lo,v!==0&&(S[19]=v,y.length++),y};Math.imul||(F=H);function G(m,l,d){d.negative=l.negative^m.negative,d.length=m.length+l.length;for(var y=0,P=0,D=0;D<d.length-1;D++){var S=P;P=0;for(var v=y&67108863,A=Math.min(D,l.length-1),x=Math.max(0,D-m.length+1);x<=A;x++){var $=D-x,ae=m.words[$]|0,R=l.words[x]|0,X=ae*R,V=X&67108863;S=S+(X/67108864|0)|0,V=V+v|0,v=V&67108863,S=S+(V>>>26)|0,P+=S>>>26,S&=67108863}d.words[D]=v,y=S,S=P}return y!==0?d.words[D]=y:d.length--,d._strip()}function B(m,l,d){return G(m,l,d)}s.prototype.mulTo=function(l,d){var y,P=this.length+l.length;return this.length===10&&l.length===10?y=F(this,l,d):P<63?y=H(this,l,d):P<1024?y=G(this,l,d):y=B(this,l,d),y},s.prototype.mul=function(l){var d=new s(null);return d.words=new Array(this.length+l.length),this.mulTo(l,d)},s.prototype.mulf=function(l){var d=new s(null);return d.words=new Array(this.length+l.length),B(this,l,d)},s.prototype.imul=function(l){return this.clone().mulTo(l,this)},s.prototype.imuln=function(l){var d=l<0;d&&(l=-l),i(typeof l=="number"),i(l<67108864);for(var y=0,P=0;P<this.length;P++){var D=(this.words[P]|0)*l,S=(D&67108863)+(y&67108863);y>>=26,y+=D/67108864|0,y+=S>>>26,this.words[P]=S&67108863}return y!==0&&(this.words[P]=y,this.length++),d?this.ineg():this},s.prototype.muln=function(l){return this.clone().imuln(l)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(l){var d=j(l);if(d.length===0)return new s(1);for(var y=this,P=0;P<d.length&&d[P]===0;P++,y=y.sqr());if(++P<d.length)for(var D=y.sqr();P<d.length;P++,D=D.sqr())d[P]!==0&&(y=y.mul(D));return y},s.prototype.iushln=function(l){i(typeof l=="number"&&l>=0);var d=l%26,y=(l-d)/26,P=67108863>>>26-d<<26-d,D;if(d!==0){var S=0;for(D=0;D<this.length;D++){var v=this.words[D]&P,A=(this.words[D]|0)-v<<d;this.words[D]=A|S,S=v>>>26-d}S&&(this.words[D]=S,this.length++)}if(y!==0){for(D=this.length-1;D>=0;D--)this.words[D+y]=this.words[D];for(D=0;D<y;D++)this.words[D]=0;this.length+=y}return this._strip()},s.prototype.ishln=function(l){return i(this.negative===0),this.iushln(l)},s.prototype.iushrn=function(l,d,y){i(typeof l=="number"&&l>=0);var P;d?P=(d-d%26)/26:P=0;var D=l%26,S=Math.min((l-D)/26,this.length),v=67108863^67108863>>>D<<D,A=y;if(P-=S,P=Math.max(0,P),A){for(var x=0;x<S;x++)A.words[x]=this.words[x];A.length=S}if(S!==0)if(this.length>S)for(this.length-=S,x=0;x<this.length;x++)this.words[x]=this.words[x+S];else this.words[0]=0,this.length=1;var $=0;for(x=this.length-1;x>=0&&($!==0||x>=P);x--){var ae=this.words[x]|0;this.words[x]=$<<26-D|ae>>>D,$=ae&v}return A&&$!==0&&(A.words[A.length++]=$),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(l,d,y){return i(this.negative===0),this.iushrn(l,d,y)},s.prototype.shln=function(l){return this.clone().ishln(l)},s.prototype.ushln=function(l){return this.clone().iushln(l)},s.prototype.shrn=function(l){return this.clone().ishrn(l)},s.prototype.ushrn=function(l){return this.clone().iushrn(l)},s.prototype.testn=function(l){i(typeof l=="number"&&l>=0);var d=l%26,y=(l-d)/26,P=1<<d;if(this.length<=y)return!1;var D=this.words[y];return!!(D&P)},s.prototype.imaskn=function(l){i(typeof l=="number"&&l>=0);var d=l%26,y=(l-d)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=y)return this;if(d!==0&&y++,this.length=Math.min(y,this.length),d!==0){var P=67108863^67108863>>>d<<d;this.words[this.length-1]&=P}return this._strip()},s.prototype.maskn=function(l){return this.clone().imaskn(l)},s.prototype.iaddn=function(l){return i(typeof l=="number"),i(l<67108864),l<0?this.isubn(-l):this.negative!==0?this.length===1&&(this.words[0]|0)<=l?(this.words[0]=l-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(l),this.negative=1,this):this._iaddn(l)},s.prototype._iaddn=function(l){this.words[0]+=l;for(var d=0;d<this.length&&this.words[d]>=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},s.prototype.isubn=function(l){if(i(typeof l=="number"),i(l<67108864),l<0)return this.iaddn(-l);if(this.negative!==0)return this.negative=0,this.iaddn(l),this.negative=1,this;if(this.words[0]-=l,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d<this.length&&this.words[d]<0;d++)this.words[d]+=67108864,this.words[d+1]-=1;return this._strip()},s.prototype.addn=function(l){return this.clone().iaddn(l)},s.prototype.subn=function(l){return this.clone().isubn(l)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(l,d,y){var P=l.length+y,D;this._expand(P);var S,v=0;for(D=0;D<l.length;D++){S=(this.words[D+y]|0)+v;var A=(l.words[D]|0)*d;S-=A&67108863,v=(S>>26)-(A/67108864|0),this.words[D+y]=S&67108863}for(;D<this.length-y;D++)S=(this.words[D+y]|0)+v,v=S>>26,this.words[D+y]=S&67108863;if(v===0)return this._strip();for(i(v===-1),v=0,D=0;D<this.length;D++)S=-(this.words[D]|0)+v,v=S>>26,this.words[D]=S&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(l,d){var y=this.length-l.length,P=this.clone(),D=l,S=D.words[D.length-1]|0,v=this._countBits(S);y=26-v,y!==0&&(D=D.ushln(y),P.iushln(y),S=D.words[D.length-1]|0);var A=P.length-D.length,x;if(d!=="mod"){x=new s(null),x.length=A+1,x.words=new Array(x.length);for(var $=0;$<x.length;$++)x.words[$]=0}var ae=P.clone()._ishlnsubmul(D,1,A);ae.negative===0&&(P=ae,x&&(x.words[A]=1));for(var R=A-1;R>=0;R--){var X=(P.words[D.length+R]|0)*67108864+(P.words[D.length+R-1]|0);for(X=Math.min(X/S|0,67108863),P._ishlnsubmul(D,X,R);P.negative!==0;)X--,P.negative=0,P._ishlnsubmul(D,1,R),P.isZero()||(P.negative^=1);x&&(x.words[R]=X)}return x&&x._strip(),P._strip(),d!=="div"&&y!==0&&P.iushrn(y),{div:x||null,mod:P}},s.prototype.divmod=function(l,d,y){if(i(!l.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var P,D,S;return this.negative!==0&&l.negative===0?(S=this.neg().divmod(l,d),d!=="mod"&&(P=S.div.neg()),d!=="div"&&(D=S.mod.neg(),y&&D.negative!==0&&D.iadd(l)),{div:P,mod:D}):this.negative===0&&l.negative!==0?(S=this.divmod(l.neg(),d),d!=="mod"&&(P=S.div.neg()),{div:P,mod:S.mod}):this.negative&l.negative?(S=this.neg().divmod(l.neg(),d),d!=="div"&&(D=S.mod.neg(),y&&D.negative!==0&&D.isub(l)),{div:S.div,mod:D}):l.length>this.length||this.cmp(l)<0?{div:new s(0),mod:this}:l.length===1?d==="div"?{div:this.divn(l.words[0]),mod:null}:d==="mod"?{div:null,mod:new s(this.modrn(l.words[0]))}:{div:this.divn(l.words[0]),mod:new s(this.modrn(l.words[0]))}:this._wordDiv(l,d)},s.prototype.div=function(l){return this.divmod(l,"div",!1).div},s.prototype.mod=function(l){return this.divmod(l,"mod",!1).mod},s.prototype.umod=function(l){return this.divmod(l,"mod",!0).mod},s.prototype.divRound=function(l){var d=this.divmod(l);if(d.mod.isZero())return d.div;var y=d.div.negative!==0?d.mod.isub(l):d.mod,P=l.ushrn(1),D=l.andln(1),S=y.cmp(P);return S<0||D===1&&S===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},s.prototype.modrn=function(l){var d=l<0;d&&(l=-l),i(l<=67108863);for(var y=(1<<26)%l,P=0,D=this.length-1;D>=0;D--)P=(y*P+(this.words[D]|0))%l;return d?-P:P},s.prototype.modn=function(l){return this.modrn(l)},s.prototype.idivn=function(l){var d=l<0;d&&(l=-l),i(l<=67108863);for(var y=0,P=this.length-1;P>=0;P--){var D=(this.words[P]|0)+y*67108864;this.words[P]=D/l|0,y=D%l}return this._strip(),d?this.ineg():this},s.prototype.divn=function(l){return this.clone().idivn(l)},s.prototype.egcd=function(l){i(l.negative===0),i(!l.isZero());var d=this,y=l.clone();d.negative!==0?d=d.umod(l):d=d.clone();for(var P=new s(1),D=new s(0),S=new s(0),v=new s(1),A=0;d.isEven()&&y.isEven();)d.iushrn(1),y.iushrn(1),++A;for(var x=y.clone(),$=d.clone();!d.isZero();){for(var ae=0,R=1;!(d.words[0]&R)&&ae<26;++ae,R<<=1);if(ae>0)for(d.iushrn(ae);ae-- >0;)(P.isOdd()||D.isOdd())&&(P.iadd(x),D.isub($)),P.iushrn(1),D.iushrn(1);for(var X=0,V=1;!(y.words[0]&V)&&X<26;++X,V<<=1);if(X>0)for(y.iushrn(X);X-- >0;)(S.isOdd()||v.isOdd())&&(S.iadd(x),v.isub($)),S.iushrn(1),v.iushrn(1);d.cmp(y)>=0?(d.isub(y),P.isub(S),D.isub(v)):(y.isub(d),S.isub(P),v.isub(D))}return{a:S,b:v,gcd:y.iushln(A)}},s.prototype._invmp=function(l){i(l.negative===0),i(!l.isZero());var d=this,y=l.clone();d.negative!==0?d=d.umod(l):d=d.clone();for(var P=new s(1),D=new s(0),S=y.clone();d.cmpn(1)>0&&y.cmpn(1)>0;){for(var v=0,A=1;!(d.words[0]&A)&&v<26;++v,A<<=1);if(v>0)for(d.iushrn(v);v-- >0;)P.isOdd()&&P.iadd(S),P.iushrn(1);for(var x=0,$=1;!(y.words[0]&$)&&x<26;++x,$<<=1);if(x>0)for(y.iushrn(x);x-- >0;)D.isOdd()&&D.iadd(S),D.iushrn(1);d.cmp(y)>=0?(d.isub(y),P.isub(D)):(y.isub(d),D.isub(P))}var ae;return d.cmpn(1)===0?ae=P:ae=D,ae.cmpn(0)<0&&ae.iadd(l),ae},s.prototype.gcd=function(l){if(this.isZero())return l.abs();if(l.isZero())return this.abs();var d=this.clone(),y=l.clone();d.negative=0,y.negative=0;for(var P=0;d.isEven()&&y.isEven();P++)d.iushrn(1),y.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;y.isEven();)y.iushrn(1);var D=d.cmp(y);if(D<0){var S=d;d=y,y=S}else if(D===0||y.cmpn(1)===0)break;d.isub(y)}while(!0);return y.iushln(P)},s.prototype.invm=function(l){return this.egcd(l).a.umod(l)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(l){return this.words[0]&l},s.prototype.bincn=function(l){i(typeof l=="number");var d=l%26,y=(l-d)/26,P=1<<d;if(this.length<=y)return this._expand(y+1),this.words[y]|=P,this;for(var D=P,S=y;D!==0&&S<this.length;S++){var v=this.words[S]|0;v+=D,D=v>>>26,v&=67108863,this.words[S]=v}return D!==0&&(this.words[S]=D,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(l){var d=l<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var y;if(this.length>1)y=1;else{d&&(l=-l),i(l<=67108863,"Number is too big");var P=this.words[0]|0;y=P===l?0:P<l?-1:1}return this.negative!==0?-y|0:y},s.prototype.cmp=function(l){if(this.negative!==0&&l.negative===0)return-1;if(this.negative===0&&l.negative!==0)return 1;var d=this.ucmp(l);return this.negative!==0?-d|0:d},s.prototype.ucmp=function(l){if(this.length>l.length)return 1;if(this.length<l.length)return-1;for(var d=0,y=this.length-1;y>=0;y--){var P=this.words[y]|0,D=l.words[y]|0;if(P!==D){P<D?d=-1:P>D&&(d=1);break}}return d},s.prototype.gtn=function(l){return this.cmpn(l)===1},s.prototype.gt=function(l){return this.cmp(l)===1},s.prototype.gten=function(l){return this.cmpn(l)>=0},s.prototype.gte=function(l){return this.cmp(l)>=0},s.prototype.ltn=function(l){return this.cmpn(l)===-1},s.prototype.lt=function(l){return this.cmp(l)===-1},s.prototype.lten=function(l){return this.cmpn(l)<=0},s.prototype.lte=function(l){return this.cmp(l)<=0},s.prototype.eqn=function(l){return this.cmpn(l)===0},s.prototype.eq=function(l){return this.cmp(l)===0},s.red=function(l){return new L(l)},s.prototype.toRed=function(l){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),l.convertTo(this)._forceRed(l)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(l){return this.red=l,this},s.prototype.forceRed=function(l){return i(!this.red,"Already a number in reduction context"),this._forceRed(l)},s.prototype.redAdd=function(l){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,l)},s.prototype.redIAdd=function(l){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,l)},s.prototype.redSub=function(l){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,l)},s.prototype.redISub=function(l){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,l)},s.prototype.redShl=function(l){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,l)},s.prototype.redMul=function(l){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.mul(this,l)},s.prototype.redIMul=function(l){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.imul(this,l)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(l){return i(this.red&&!l.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,l)};var z={k256:null,p224:null,p192:null,p25519:null};function W(m,l){this.name=m,this.p=new s(l,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}W.prototype._tmp=function(){var l=new s(null);return l.words=new Array(Math.ceil(this.n/13)),l},W.prototype.ireduce=function(l){var d=l,y;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),y=d.bitLength();while(y>this.n);var P=y<this.n?-1:d.ucmp(this.p);return P===0?(d.words[0]=0,d.length=1):P>0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},W.prototype.split=function(l,d){l.iushrn(this.n,0,d)},W.prototype.imulK=function(l){return l.imul(this.k)};function _(){W.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(_,W),_.prototype.split=function(l,d){for(var y=4194303,P=Math.min(l.length,9),D=0;D<P;D++)d.words[D]=l.words[D];if(d.length=P,l.length<=9){l.words[0]=0,l.length=1;return}var S=l.words[9];for(d.words[d.length++]=S&y,D=10;D<l.length;D++){var v=l.words[D]|0;l.words[D-10]=(v&y)<<4|S>>>22,S=v}S>>>=22,l.words[D-10]=S,S===0&&l.length>10?l.length-=10:l.length-=9},_.prototype.imulK=function(l){l.words[l.length]=0,l.words[l.length+1]=0,l.length+=2;for(var d=0,y=0;y<l.length;y++){var P=l.words[y]|0;d+=P*977,l.words[y]=d&67108863,d=P*64+(d/67108864|0)}return l.words[l.length-1]===0&&(l.length--,l.words[l.length-1]===0&&l.length--),l};function U(){W.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(U,W);function ee(){W.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(ee,W);function oe(){W.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(oe,W),oe.prototype.imulK=function(l){for(var d=0,y=0;y<l.length;y++){var P=(l.words[y]|0)*19+d,D=P&67108863;P>>>=26,l.words[y]=D,d=P}return d!==0&&(l.words[l.length++]=d),l},s._prime=function(l){if(z[l])return z[l];var d;if(l==="k256")d=new _;else if(l==="p224")d=new U;else if(l==="p192")d=new ee;else if(l==="p25519")d=new oe;else throw new Error("Unknown prime "+l);return z[l]=d,d};function L(m){if(typeof m=="string"){var l=s._prime(m);this.m=l.p,this.prime=l}else i(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}L.prototype._verify1=function(l){i(l.negative===0,"red works only with positives"),i(l.red,"red works only with red numbers")},L.prototype._verify2=function(l,d){i((l.negative|d.negative)===0,"red works only with positives"),i(l.red&&l.red===d.red,"red works only with red numbers")},L.prototype.imod=function(l){return this.prime?this.prime.ireduce(l)._forceRed(this):(g(l,l.umod(this.m)._forceRed(this)),l)},L.prototype.neg=function(l){return l.isZero()?l.clone():this.m.sub(l)._forceRed(this)},L.prototype.add=function(l,d){this._verify2(l,d);var y=l.add(d);return y.cmp(this.m)>=0&&y.isub(this.m),y._forceRed(this)},L.prototype.iadd=function(l,d){this._verify2(l,d);var y=l.iadd(d);return y.cmp(this.m)>=0&&y.isub(this.m),y},L.prototype.sub=function(l,d){this._verify2(l,d);var y=l.sub(d);return y.cmpn(0)<0&&y.iadd(this.m),y._forceRed(this)},L.prototype.isub=function(l,d){this._verify2(l,d);var y=l.isub(d);return y.cmpn(0)<0&&y.iadd(this.m),y},L.prototype.shl=function(l,d){return this._verify1(l),this.imod(l.ushln(d))},L.prototype.imul=function(l,d){return this._verify2(l,d),this.imod(l.imul(d))},L.prototype.mul=function(l,d){return this._verify2(l,d),this.imod(l.mul(d))},L.prototype.isqr=function(l){return this.imul(l,l.clone())},L.prototype.sqr=function(l){return this.mul(l,l)},L.prototype.sqrt=function(l){if(l.isZero())return l.clone();var d=this.m.andln(3);if(i(d%2===1),d===3){var y=this.m.add(new s(1)).iushrn(2);return this.pow(l,y)}for(var P=this.m.subn(1),D=0;!P.isZero()&&P.andln(1)===0;)D++,P.iushrn(1);i(!P.isZero());var S=new s(1).toRed(this),v=S.redNeg(),A=this.m.subn(1).iushrn(1),x=this.m.bitLength();for(x=new s(2*x*x).toRed(this);this.pow(x,A).cmp(v)!==0;)x.redIAdd(v);for(var $=this.pow(x,P),ae=this.pow(l,P.addn(1).iushrn(1)),R=this.pow(l,P),X=D;R.cmp(S)!==0;){for(var V=R,J=0;V.cmp(S)!==0;J++)V=V.redSqr();i(J<X);var K=this.pow($,new s(1).iushln(X-J-1));ae=ae.redMul(K),$=K.redSqr(),R=R.redMul($),X=J}return ae},L.prototype.invm=function(l){var d=l._invmp(this.m);return d.negative!==0?(d.negative=0,this.imod(d).redNeg()):this.imod(d)},L.prototype.pow=function(l,d){if(d.isZero())return new s(1).toRed(this);if(d.cmpn(1)===0)return l.clone();var y=4,P=new Array(1<<y);P[0]=new s(1).toRed(this),P[1]=l;for(var D=2;D<P.length;D++)P[D]=this.mul(P[D-1],l);var S=P[0],v=0,A=0,x=d.bitLength()%26;for(x===0&&(x=26),D=d.length-1;D>=0;D--){for(var $=d.words[D],ae=x-1;ae>=0;ae--){var R=$>>ae&1;if(S!==P[0]&&(S=this.sqr(S)),R===0&&v===0){A=0;continue}v<<=1,v|=R,A++,!(A!==y&&(D!==0||ae!==0))&&(S=this.mul(S,P[v]),A=0,v=0)}x=26}return S},L.prototype.convertTo=function(l){var d=l.umod(this.m);return d===l?d.clone():d},L.prototype.convertFrom=function(l){var d=l.clone();return d.red=null,d},s.mont=function(l){return new b(l)};function b(m){L.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(b,L),b.prototype.convertTo=function(l){return this.imod(l.ushln(this.shift))},b.prototype.convertFrom=function(l){var d=this.imod(l.mul(this.rinv));return d.red=null,d},b.prototype.imul=function(l,d){if(l.isZero()||d.isZero())return l.words[0]=0,l.length=1,l;var y=l.imul(d),P=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),D=y.isub(P).iushrn(this.shift),S=D;return D.cmp(this.m)>=0?S=D.isub(this.m):D.cmpn(0)<0&&(S=D.iadd(this.m)),S._forceRed(this)},b.prototype.mul=function(l,d){if(l.isZero()||d.isZero())return new s(0)._forceRed(this);var y=l.mul(d),P=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),D=y.isub(P).iushrn(this.shift),S=D;return D.cmp(this.m)>=0?S=D.isub(this.m):D.cmpn(0)<0&&(S=D.iadd(this.m)),S._forceRed(this)},b.prototype.invm=function(l){var d=this.imod(l._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(r,fr)})(kg);var vt=kg.exports;const jg="bignumber/5.7.0";var sl=vt.BN;const ds=new xt(jg),sd={},Wg=9007199254740991;function p4(r){return r!=null&&(ir.isBigNumber(r)||typeof r=="number"&&r%1===0||typeof r=="string"&&!!r.match(/^-?[0-9]+$/)||Oi(r)||typeof r=="bigint"||xa(r))}let Kg=!1;class ir{constructor(e,t){e!==sd&&ds.throwError("cannot call constructor directly; use BigNumber.from",xt.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return gi(Tt(this).fromTwos(e))}toTwos(e){return gi(Tt(this).toTwos(e))}abs(){return this._hex[0]==="-"?ir.from(this._hex.substring(1)):this}add(e){return gi(Tt(this).add(Tt(e)))}sub(e){return gi(Tt(this).sub(Tt(e)))}div(e){return ir.from(e).isZero()&&Gi("division-by-zero","div"),gi(Tt(this).div(Tt(e)))}mul(e){return gi(Tt(this).mul(Tt(e)))}mod(e){const t=Tt(e);return t.isNeg()&&Gi("division-by-zero","mod"),gi(Tt(this).umod(t))}pow(e){const t=Tt(e);return t.isNeg()&&Gi("negative-power","pow"),gi(Tt(this).pow(t))}and(e){const t=Tt(e);return(this.isNegative()||t.isNeg())&&Gi("unbound-bitwise-result","and"),gi(Tt(this).and(t))}or(e){const t=Tt(e);return(this.isNegative()||t.isNeg())&&Gi("unbound-bitwise-result","or"),gi(Tt(this).or(t))}xor(e){const t=Tt(e);return(this.isNegative()||t.isNeg())&&Gi("unbound-bitwise-result","xor"),gi(Tt(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Gi("negative-width","mask"),gi(Tt(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Gi("negative-width","shl"),gi(Tt(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Gi("negative-width","shr"),gi(Tt(this).shrn(e))}eq(e){return Tt(this).eq(Tt(e))}lt(e){return Tt(this).lt(Tt(e))}lte(e){return Tt(this).lte(Tt(e))}gt(e){return Tt(this).gt(Tt(e))}gte(e){return Tt(this).gte(Tt(e))}isNegative(){return this._hex[0]==="-"}isZero(){return Tt(this).isZero()}toNumber(){try{return Tt(this).toNumber()}catch{Gi("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return ds.throwError("this platform does not support BigInt",xt.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?Kg||(Kg=!0,ds.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?ds.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",xt.errors.UNEXPECTED_ARGUMENT,{}):ds.throwError("BigNumber.toString does not accept parameters",xt.errors.UNEXPECTED_ARGUMENT,{})),Tt(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof ir)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new ir(sd,Tc(e)):e.match(/^-?[0-9]+$/)?new ir(sd,Tc(new sl(e))):ds.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Gi("underflow","BigNumber.from",e),(e>=Wg||e<=-Wg)&&Gi("overflow","BigNumber.from",e),ir.from(String(e));const t=e;if(typeof t=="bigint")return ir.from(t.toString());if(xa(t))return ir.from(ni(t));if(t)if(t.toHexString){const i=t.toHexString();if(typeof i=="string")return ir.from(i)}else{let i=t._hex;if(i==null&&t.type==="BigNumber"&&(i=t.hex),typeof i=="string"&&(Oi(i)||i[0]==="-"&&Oi(i.substring(1))))return ir.from(i)}return ds.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function Tc(r){if(typeof r!="string")return Tc(r.toString(16));if(r[0]==="-")return r=r.substring(1),r[0]==="-"&&ds.throwArgumentError("invalid hex","value",r),r=Tc(r),r==="0x00"?r:"-"+r;if(r.substring(0,2)!=="0x"&&(r="0x"+r),r==="0x")return"0x00";for(r.length%2&&(r="0x0"+r.substring(2));r.length>4&&r.substring(0,4)==="0x00";)r="0x"+r.substring(4);return r}function gi(r){return ir.from(Tc(r))}function Tt(r){const e=ir.from(r).toHexString();return e[0]==="-"?new sl("-"+e.substring(3),16):new sl(e.substring(2),16)}function Gi(r,e,t){const i={fault:r,operation:e};return t!=null&&(i.value=t),ds.throwError(r,xt.errors.NUMERIC_FAULT,i)}function g4(r){return new sl(r,36).toString(16)}const si=new xt(jg),Nc={},Vg=ir.from(0),Gg=ir.from(-1);function Yg(r,e,t,i){const n={fault:e,operation:t};return i!==void 0&&(n.value=i),si.throwError(r,xt.errors.NUMERIC_FAULT,n)}let $c="0";for(;$c.length<256;)$c+=$c;function od(r){if(typeof r!="number")try{r=ir.from(r).toNumber()}catch{}return typeof r=="number"&&r>=0&&r<=256&&!(r%1)?"1"+$c.substring(0,r):si.throwArgumentError("invalid decimal size","decimals",r)}function ad(r,e){e==null&&(e=0);const t=od(e);r=ir.from(r);const i=r.lt(Vg);i&&(r=r.mul(Gg));let n=r.mod(t).toString();for(;n.length<t.length-1;)n="0"+n;n=n.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=r.div(t).toString();return t.length===1?r=s:r=s+"."+n,i&&(r="-"+r),r}function ps(r,e){e==null&&(e=0);const t=od(e);(typeof r!="string"||!r.match(/^-?[0-9.]+$/))&&si.throwArgumentError("invalid decimal value","value",r);const i=r.substring(0,1)==="-";i&&(r=r.substring(1)),r==="."&&si.throwArgumentError("missing value","value",r);const n=r.split(".");n.length>2&&si.throwArgumentError("too many decimal points","value",r);let s=n[0],a=n[1];for(s||(s="0"),a||(a="0");a[a.length-1]==="0";)a=a.substring(0,a.length-1);for(a.length>t.length-1&&Yg("fractional component exceeds decimals","underflow","parseFixed"),a===""&&(a="0");a.length<t.length-1;)a+="0";const f=ir.from(s),h=ir.from(a);let u=f.mul(t).add(h);return i&&(u=u.mul(Gg)),u}class Aa{constructor(e,t,i,n){e!==Nc&&si.throwError("cannot use FixedFormat constructor; use FixedFormat.from",xt.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=i,this.decimals=n,this.name=(t?"":"u")+"fixed"+String(i)+"x"+String(n),this._multiplier=od(n),Object.freeze(this)}static from(e){if(e instanceof Aa)return e;typeof e=="number"&&(e=`fixed128x${e}`);let t=!0,i=128,n=18;if(typeof e=="string"){if(e!=="fixed")if(e==="ufixed")t=!1;else{const s=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);s||si.throwArgumentError("invalid fixed format","format",e),t=s[1]!=="u",i=parseInt(s[2]),n=parseInt(s[3])}}else if(e){const s=(a,f,h)=>e[a]==null?h:(typeof e[a]!==f&&si.throwArgumentError("invalid fixed format ("+a+" not "+f+")","format."+a,e[a]),e[a]);t=s("signed","boolean",t),i=s("width","number",i),n=s("decimals","number",n)}return i%8&&si.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",i),n>80&&si.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new Aa(Nc,t,i,n)}}class Hr{constructor(e,t,i,n){e!==Nc&&si.throwError("cannot use FixedNumber constructor; use FixedNumber.from",xt.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=i,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&si.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=ps(this._value,this.format.decimals),i=ps(e._value,e.format.decimals);return Hr.fromValue(t.add(i),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=ps(this._value,this.format.decimals),i=ps(e._value,e.format.decimals);return Hr.fromValue(t.sub(i),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=ps(this._value,this.format.decimals),i=ps(e._value,e.format.decimals);return Hr.fromValue(t.mul(i).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=ps(this._value,this.format.decimals),i=ps(e._value,e.format.decimals);return Hr.fromValue(t.mul(this.format._multiplier).div(i),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");e.length===1&&e.push("0");let t=Hr.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return this.isNegative()&&i&&(t=t.subUnsafe(Jg.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");e.length===1&&e.push("0");let t=Hr.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return!this.isNegative()&&i&&(t=t.addUnsafe(Jg.toFormat(t.format))),t}round(e){e==null&&(e=0);const t=this.toString().split(".");if(t.length===1&&t.push("0"),(e<0||e>80||e%1)&&si.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const i=Hr.from("1"+$c.substring(0,e),this.format),n=v4.toFormat(this.format);return this.mulUnsafe(i).addUnsafe(n).floor().divUnsafe(i)}isZero(){return this._value==="0.0"||this._value==="0"}isNegative(){return this._value[0]==="-"}toString(){return this._value}toHexString(e){if(e==null)return this._hex;e%8&&si.throwArgumentError("invalid byte width","width",e);const t=ir.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return qn(t,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return Hr.fromString(this._value,e)}static fromValue(e,t,i){return i==null&&t!=null&&!p4(t)&&(i=t,t=null),t==null&&(t=0),i==null&&(i="fixed"),Hr.fromString(ad(e,t),Aa.from(i))}static fromString(e,t){t==null&&(t="fixed");const i=Aa.from(t),n=ps(e,i.decimals);!i.signed&&n.lt(Vg)&&Yg("unsigned value cannot be negative","overflow","value",e);let s=null;i.signed?s=n.toTwos(i.width).toHexString():(s=n.toHexString(),s=qn(s,i.width/8));const a=ad(n,i.decimals);return new Hr(Nc,s,a,i)}static fromBytes(e,t){t==null&&(t="fixed");const i=Aa.from(t);if(ur(e).length>i.width/8)throw new Error("overflow");let n=ir.from(e);i.signed&&(n=n.fromTwos(i.width));const s=n.toTwos((i.signed?0:1)+i.width).toHexString(),a=ad(n,i.decimals);return new Hr(Nc,s,a,i)}static from(e,t){if(typeof e=="string")return Hr.fromString(e,t);if(xa(e))return Hr.fromBytes(e,t);try{return Hr.fromValue(e,0,t)}catch(i){if(i.code!==xt.errors.INVALID_ARGUMENT)throw i}return si.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}}const Jg=Hr.from(1),v4=Hr.from("0.5"),m4="strings/5.7.0",Qg=new xt(m4);var ol;(function(r){r.current="",r.NFC="NFC",r.NFD="NFD",r.NFKC="NFKC",r.NFKD="NFKD"})(ol||(ol={}));var Ea;(function(r){r.UNEXPECTED_CONTINUE="unexpected continuation byte",r.BAD_PREFIX="bad codepoint prefix",r.OVERRUN="string overrun",r.MISSING_CONTINUE="missing continuation byte",r.OUT_OF_RANGE="out of UTF-8 range",r.UTF16_SURROGATE="UTF-16 surrogate",r.OVERLONG="overlong representation"})(Ea||(Ea={}));function b4(r,e,t,i,n){return Qg.throwArgumentError(`invalid codepoint at offset ${e}; ${r}`,"bytes",t)}function Zg(r,e,t,i,n){if(r===Ea.BAD_PREFIX||r===Ea.UNEXPECTED_CONTINUE){let s=0;for(let a=e+1;a<t.length&&t[a]>>6===2;a++)s++;return s}return r===Ea.OVERRUN?t.length-e-1:0}function w4(r,e,t,i,n){return r===Ea.OVERLONG?(i.push(n),0):(i.push(65533),Zg(r,e,t))}Object.freeze({error:b4,ignore:Zg,replace:w4});function cd(r,e=ol.current){e!=ol.current&&(Qg.checkNormalize(),r=r.normalize(e));let t=[];for(let i=0;i<r.length;i++){const n=r.charCodeAt(i);if(n<128)t.push(n);else if(n<2048)t.push(n>>6|192),t.push(n&63|128);else if((n&64512)==55296){i++;const s=r.charCodeAt(i);if(i>=r.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const a=65536+((n&1023)<<10)+(s&1023);t.push(a>>18|240),t.push(a>>12&63|128),t.push(a>>6&63|128),t.push(a&63|128)}else t.push(n>>12|224),t.push(n>>6&63|128),t.push(n&63|128)}return ur(t)}function y4(r){if(r.length%4!==0)throw new Error("bad data");let e=[];for(let t=0;t<r.length;t+=4)e.push(parseInt(r.substring(t,t+4),16));return e}function fd(r,e){e||(e=function(n){return[parseInt(n,16)]});let t=0,i={};return r.split(",").forEach(n=>{let s=n.split(":");t+=parseInt(s[0],16),i[t]=e(s[1])}),i}function Xg(r){let e=0;return r.split(",").map(t=>{let i=t.split("-");i.length===1?i[1]="0":i[1]===""&&(i[1]="1");let n=e+parseInt(i[0],16);return e=parseInt(i[1],16),{l:n,h:e}})}Xg("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(r=>parseInt(r,16)),fd("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),fd("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),fd("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",y4),Xg("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");const ev="hash/5.7.0";function _4(r){r=atob(r);const e=[];for(let t=0;t<r.length;t++)e.push(r.charCodeAt(t));return ur(e)}function tv(r,e){e==null&&(e=1);const t=[],i=t.forEach,n=function(s,a){i.call(s,function(f){a>0&&Array.isArray(f)?n(f,a-1):t.push(f)})};return n(r,e),t}function x4(r){const e={};for(let t=0;t<r.length;t++){const i=r[t];e[i[0]]=i[1]}return e}function A4(r){let e=0;function t(){return r[e++]<<8|r[e++]}let i=t(),n=1,s=[0,1];for(let z=1;z<i;z++)s.push(n+=t());let a=t(),f=e;e+=a;let h=0,u=0;function g(){return h==0&&(u=u<<8|r[e++],h=8),u>>--h&1}const w=31,M=Math.pow(2,w),C=M>>>1,O=C>>1,N=M-1;let j=0;for(let z=0;z<w;z++)j=j<<1|g();let H=[],F=0,G=M;for(;;){let z=Math.floor(((j-F+1)*n-1)/G),W=0,_=i;for(;_-W>1;){let oe=W+_>>>1;z<s[oe]?_=oe:W=oe}if(W==0)break;H.push(W);let U=F+Math.floor(G*s[W]/n),ee=F+Math.floor(G*s[W+1]/n)-1;for(;!((U^ee)&C);)j=j<<1&N|g(),U=U<<1&N,ee=ee<<1&N|1;for(;U&~ee&O;)j=j&C|j<<1&N>>>1|g(),U=U<<1^C,ee=(ee^C)<<1|C|1;F=U,G=1+ee-U}let B=i-4;return H.map(z=>{switch(z-B){case 3:return B+65792+(r[f++]<<16|r[f++]<<8|r[f++]);case 2:return B+256+(r[f++]<<8|r[f++]);case 1:return B+r[f++];default:return z-1}})}function E4(r){let e=0;return()=>r[e++]}function S4(r){return E4(A4(r))}function I4(r){return r&1?~r>>1:r>>1}function M4(r,e){let t=Array(r);for(let i=0;i<r;i++)t[i]=1+e();return t}function rv(r,e){let t=Array(r);for(let i=0,n=-1;i<r;i++)t[i]=n+=1+e();return t}function C4(r,e){let t=Array(r);for(let i=0,n=0;i<r;i++)t[i]=n+=I4(e());return t}function al(r,e){let t=rv(r(),r),i=r(),n=rv(i,r),s=M4(i,r);for(let a=0;a<i;a++)for(let f=0;f<s[a];f++)t.push(n[a]+f);return e?t.map(a=>e[a]):t}function P4(r){let e=[];for(;;){let t=r();if(t==0)break;e.push(O4(t,r))}for(;;){let t=r()-1;if(t<0)break;e.push(R4(t,r))}return x4(tv(e))}function D4(r){let e=[];for(;;){let t=r();if(t==0)break;e.push(t)}return e}function iv(r,e,t){let i=Array(r).fill(void 0).map(()=>[]);for(let n=0;n<e;n++)C4(r,t).forEach((s,a)=>i[a].push(s));return i}function O4(r,e){let t=1+e(),i=e(),n=D4(e),s=iv(n.length,1+r,e);return tv(s.map((a,f)=>{const h=a[0],u=a.slice(1);return Array(n[f]).fill(void 0).map((g,w)=>{let M=w*i;return[h+w*t,u.map(C=>C+M)]})}))}function R4(r,e){let t=1+e();return iv(t,1+r,e).map(n=>[n[0],n.slice(1)])}function T4(r){let e=al(r).sort((i,n)=>i-n);return t();function t(){let i=[];for(;;){let u=al(r,e);if(u.length==0)break;i.push({set:new Set(u),node:t()})}i.sort((u,g)=>g.set.size-u.set.size);let n=r(),s=n%3;n=n/3|0;let a=!!(n&1);n>>=1;let f=n==1,h=n==2;return{branches:i,valid:s,fe0f:a,save:f,check:h}}}function N4(){return S4(_4("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const cl=N4();new Set(al(cl)),new Set(al(cl)),P4(cl),T4(cl),new xt(ev),new Uint8Array(32).fill(0);const $4=`Ethereum Signed Message:
|
|
22
|
-
`;function nv(r){return typeof r=="string"&&(r=cd(r)),nd(f4([cd($4),cd(String(r.length)),r]))}const L4="rlp/5.7.0";new xt(L4);const B4="address/5.7.0",Lc=new xt(B4);function sv(r){Oi(r,20)||Lc.throwArgumentError("invalid address","address",r),r=r.toLowerCase();const e=r.substring(2).split(""),t=new Uint8Array(40);for(let n=0;n<40;n++)t[n]=e[n].charCodeAt(0);const i=ur(nd(t));for(let n=0;n<40;n+=2)i[n>>1]>>4>=8&&(e[n]=e[n].toUpperCase()),(i[n>>1]&15)>=8&&(e[n+1]=e[n+1].toUpperCase());return"0x"+e.join("")}const F4=9007199254740991;function U4(r){return Math.log10?Math.log10(r):Math.log(r)/Math.LN10}const ld={};for(let r=0;r<10;r++)ld[String(r)]=String(r);for(let r=0;r<26;r++)ld[String.fromCharCode(65+r)]=String(10+r);const ov=Math.floor(U4(F4));function q4(r){r=r.toUpperCase(),r=r.substring(4)+r.substring(0,2)+"00";let e=r.split("").map(i=>ld[i]).join("");for(;e.length>=ov;){let i=e.substring(0,ov);e=parseInt(i,10)%97+e.substring(i.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}function z4(r){let e=null;if(typeof r!="string"&&Lc.throwArgumentError("invalid address","address",r),r.match(/^(0x)?[0-9a-fA-F]{40}$/))r.substring(0,2)!=="0x"&&(r="0x"+r),e=sv(r),r.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==r&&Lc.throwArgumentError("bad address checksum","address",r);else if(r.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(r.substring(2,4)!==q4(r)&&Lc.throwArgumentError("bad icap checksum","address",r),e=g4(r.substring(4));e.length<40;)e="0"+e;e=sv("0x"+e)}else Lc.throwArgumentError("invalid address","address",r);return e}const H4="properties/5.7.0";new xt(H4);function Bc(r,e,t){Object.defineProperty(r,e,{enumerable:!0,value:t,writable:!1})}new xt(ev),new Uint8Array(32).fill(0),ir.from(-1);const k4=ir.from(0),j4=ir.from(1);ir.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),qn(j4.toHexString(),32),qn(k4.toHexString(),32);var Ri={},Nt={},So=av;function av(r,e){if(!r)throw new Error(e||"Assertion failed")}av.equal=function(e,t,i){if(e!=t)throw new Error(i||"Assertion failed: "+e+" != "+t)};var Sa={exports:{}};typeof Object.create=="function"?Sa.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Sa.exports=function(e,t){if(t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}};var W4=So,K4=Sa.exports;Nt.inherits=K4;function V4(r,e){return(r.charCodeAt(e)&64512)!==55296||e<0||e+1>=r.length?!1:(r.charCodeAt(e+1)&64512)===56320}function G4(r,e){if(Array.isArray(r))return r.slice();if(!r)return[];var t=[];if(typeof r=="string")if(e){if(e==="hex")for(r=r.replace(/[^a-z0-9]+/ig,""),r.length%2!==0&&(r="0"+r),n=0;n<r.length;n+=2)t.push(parseInt(r[n]+r[n+1],16))}else for(var i=0,n=0;n<r.length;n++){var s=r.charCodeAt(n);s<128?t[i++]=s:s<2048?(t[i++]=s>>6|192,t[i++]=s&63|128):V4(r,n)?(s=65536+((s&1023)<<10)+(r.charCodeAt(++n)&1023),t[i++]=s>>18|240,t[i++]=s>>12&63|128,t[i++]=s>>6&63|128,t[i++]=s&63|128):(t[i++]=s>>12|224,t[i++]=s>>6&63|128,t[i++]=s&63|128)}else for(n=0;n<r.length;n++)t[n]=r[n]|0;return t}Nt.toArray=G4;function Y4(r){for(var e="",t=0;t<r.length;t++)e+=fv(r[t].toString(16));return e}Nt.toHex=Y4;function cv(r){var e=r>>>24|r>>>8&65280|r<<8&16711680|(r&255)<<24;return e>>>0}Nt.htonl=cv;function J4(r,e){for(var t="",i=0;i<r.length;i++){var n=r[i];e==="little"&&(n=cv(n)),t+=lv(n.toString(16))}return t}Nt.toHex32=J4;function fv(r){return r.length===1?"0"+r:r}Nt.zero2=fv;function lv(r){return r.length===7?"0"+r:r.length===6?"00"+r:r.length===5?"000"+r:r.length===4?"0000"+r:r.length===3?"00000"+r:r.length===2?"000000"+r:r.length===1?"0000000"+r:r}Nt.zero8=lv;function Q4(r,e,t,i){var n=t-e;W4(n%4===0);for(var s=new Array(n/4),a=0,f=e;a<s.length;a++,f+=4){var h;i==="big"?h=r[f]<<24|r[f+1]<<16|r[f+2]<<8|r[f+3]:h=r[f+3]<<24|r[f+2]<<16|r[f+1]<<8|r[f],s[a]=h>>>0}return s}Nt.join32=Q4;function Z4(r,e){for(var t=new Array(r.length*4),i=0,n=0;i<r.length;i++,n+=4){var s=r[i];e==="big"?(t[n]=s>>>24,t[n+1]=s>>>16&255,t[n+2]=s>>>8&255,t[n+3]=s&255):(t[n+3]=s>>>24,t[n+2]=s>>>16&255,t[n+1]=s>>>8&255,t[n]=s&255)}return t}Nt.split32=Z4;function X4(r,e){return r>>>e|r<<32-e}Nt.rotr32=X4;function e8(r,e){return r<<e|r>>>32-e}Nt.rotl32=e8;function t8(r,e){return r+e>>>0}Nt.sum32=t8;function r8(r,e,t){return r+e+t>>>0}Nt.sum32_3=r8;function i8(r,e,t,i){return r+e+t+i>>>0}Nt.sum32_4=i8;function n8(r,e,t,i,n){return r+e+t+i+n>>>0}Nt.sum32_5=n8;function s8(r,e,t,i){var n=r[e],s=r[e+1],a=i+s>>>0,f=(a<i?1:0)+t+n;r[e]=f>>>0,r[e+1]=a}Nt.sum64=s8;function o8(r,e,t,i){var n=e+i>>>0,s=(n<e?1:0)+r+t;return s>>>0}Nt.sum64_hi=o8;function a8(r,e,t,i){var n=e+i;return n>>>0}Nt.sum64_lo=a8;function c8(r,e,t,i,n,s,a,f){var h=0,u=e;u=u+i>>>0,h+=u<e?1:0,u=u+s>>>0,h+=u<s?1:0,u=u+f>>>0,h+=u<f?1:0;var g=r+t+n+a+h;return g>>>0}Nt.sum64_4_hi=c8;function f8(r,e,t,i,n,s,a,f){var h=e+i+s+f;return h>>>0}Nt.sum64_4_lo=f8;function l8(r,e,t,i,n,s,a,f,h,u){var g=0,w=e;w=w+i>>>0,g+=w<e?1:0,w=w+s>>>0,g+=w<s?1:0,w=w+f>>>0,g+=w<f?1:0,w=w+u>>>0,g+=w<u?1:0;var M=r+t+n+a+h+g;return M>>>0}Nt.sum64_5_hi=l8;function h8(r,e,t,i,n,s,a,f,h,u){var g=e+i+s+f+u;return g>>>0}Nt.sum64_5_lo=h8;function u8(r,e,t){var i=e<<32-t|r>>>t;return i>>>0}Nt.rotr64_hi=u8;function d8(r,e,t){var i=r<<32-t|e>>>t;return i>>>0}Nt.rotr64_lo=d8;function p8(r,e,t){return r>>>t}Nt.shr64_hi=p8;function g8(r,e,t){var i=r<<32-t|e>>>t;return i>>>0}Nt.shr64_lo=g8;var Ia={},hv=Nt,v8=So;function fl(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Ia.BlockHash=fl,fl.prototype.update=function(e,t){if(e=hv.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var i=e.length%this._delta8;this.pending=e.slice(e.length-i,e.length),this.pending.length===0&&(this.pending=null),e=hv.join32(e,0,e.length-i,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},fl.prototype.digest=function(e){return this.update(this._pad()),v8(this.pending===null),this._digest(e)},fl.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,i=t-(e+this.padLength)%t,n=new Array(i+this.padLength);n[0]=128;for(var s=1;s<i;s++)n[s]=0;if(e<<=3,this.endian==="big"){for(var a=8;a<this.padLength;a++)n[s++]=0;n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=e>>>24&255,n[s++]=e>>>16&255,n[s++]=e>>>8&255,n[s++]=e&255}else for(n[s++]=e&255,n[s++]=e>>>8&255,n[s++]=e>>>16&255,n[s++]=e>>>24&255,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,a=8;a<this.padLength;a++)n[s++]=0;return n};var Ma={},zn={},m8=Nt,Hn=m8.rotr32;function b8(r,e,t,i){if(r===0)return uv(e,t,i);if(r===1||r===3)return pv(e,t,i);if(r===2)return dv(e,t,i)}zn.ft_1=b8;function uv(r,e,t){return r&e^~r&t}zn.ch32=uv;function dv(r,e,t){return r&e^r&t^e&t}zn.maj32=dv;function pv(r,e,t){return r^e^t}zn.p32=pv;function w8(r){return Hn(r,2)^Hn(r,13)^Hn(r,22)}zn.s0_256=w8;function y8(r){return Hn(r,6)^Hn(r,11)^Hn(r,25)}zn.s1_256=y8;function _8(r){return Hn(r,7)^Hn(r,18)^r>>>3}zn.g0_256=_8;function x8(r){return Hn(r,17)^Hn(r,19)^r>>>10}zn.g1_256=x8;var Ca=Nt,A8=Ia,E8=zn,hd=Ca.rotl32,Fc=Ca.sum32,S8=Ca.sum32_5,I8=E8.ft_1,gv=A8.BlockHash,M8=[1518500249,1859775393,2400959708,3395469782];function kn(){if(!(this instanceof kn))return new kn;gv.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Ca.inherits(kn,gv);var C8=kn;kn.blockSize=512,kn.outSize=160,kn.hmacStrength=80,kn.padLength=64,kn.prototype._update=function(e,t){for(var i=this.W,n=0;n<16;n++)i[n]=e[t+n];for(;n<i.length;n++)i[n]=hd(i[n-3]^i[n-8]^i[n-14]^i[n-16],1);var s=this.h[0],a=this.h[1],f=this.h[2],h=this.h[3],u=this.h[4];for(n=0;n<i.length;n++){var g=~~(n/20),w=S8(hd(s,5),I8(g,a,f,h),u,i[n],M8[g]);u=h,h=f,f=hd(a,30),a=s,s=w}this.h[0]=Fc(this.h[0],s),this.h[1]=Fc(this.h[1],a),this.h[2]=Fc(this.h[2],f),this.h[3]=Fc(this.h[3],h),this.h[4]=Fc(this.h[4],u)},kn.prototype._digest=function(e){return e==="hex"?Ca.toHex32(this.h,"big"):Ca.split32(this.h,"big")};var Pa=Nt,P8=Ia,Da=zn,D8=So,_n=Pa.sum32,O8=Pa.sum32_4,R8=Pa.sum32_5,T8=Da.ch32,N8=Da.maj32,$8=Da.s0_256,L8=Da.s1_256,B8=Da.g0_256,F8=Da.g1_256,vv=P8.BlockHash,U8=[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 jn(){if(!(this instanceof jn))return new jn;vv.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=U8,this.W=new Array(64)}Pa.inherits(jn,vv);var mv=jn;jn.blockSize=512,jn.outSize=256,jn.hmacStrength=192,jn.padLength=64,jn.prototype._update=function(e,t){for(var i=this.W,n=0;n<16;n++)i[n]=e[t+n];for(;n<i.length;n++)i[n]=O8(F8(i[n-2]),i[n-7],B8(i[n-15]),i[n-16]);var s=this.h[0],a=this.h[1],f=this.h[2],h=this.h[3],u=this.h[4],g=this.h[5],w=this.h[6],M=this.h[7];for(D8(this.k.length===i.length),n=0;n<i.length;n++){var C=R8(M,L8(u),T8(u,g,w),this.k[n],i[n]),O=_n($8(s),N8(s,a,f));M=w,w=g,g=u,u=_n(h,C),h=f,f=a,a=s,s=_n(C,O)}this.h[0]=_n(this.h[0],s),this.h[1]=_n(this.h[1],a),this.h[2]=_n(this.h[2],f),this.h[3]=_n(this.h[3],h),this.h[4]=_n(this.h[4],u),this.h[5]=_n(this.h[5],g),this.h[6]=_n(this.h[6],w),this.h[7]=_n(this.h[7],M)},jn.prototype._digest=function(e){return e==="hex"?Pa.toHex32(this.h,"big"):Pa.split32(this.h,"big")};var ud=Nt,bv=mv;function gs(){if(!(this instanceof gs))return new gs;bv.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}ud.inherits(gs,bv);var q8=gs;gs.blockSize=512,gs.outSize=224,gs.hmacStrength=192,gs.padLength=64,gs.prototype._digest=function(e){return e==="hex"?ud.toHex32(this.h.slice(0,7),"big"):ud.split32(this.h.slice(0,7),"big")};var vi=Nt,z8=Ia,H8=So,Wn=vi.rotr64_hi,Kn=vi.rotr64_lo,wv=vi.shr64_hi,yv=vi.shr64_lo,Us=vi.sum64,dd=vi.sum64_hi,pd=vi.sum64_lo,k8=vi.sum64_4_hi,j8=vi.sum64_4_lo,W8=vi.sum64_5_hi,K8=vi.sum64_5_lo,_v=z8.BlockHash,V8=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function xn(){if(!(this instanceof xn))return new xn;_v.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=V8,this.W=new Array(160)}vi.inherits(xn,_v);var xv=xn;xn.blockSize=1024,xn.outSize=512,xn.hmacStrength=192,xn.padLength=128,xn.prototype._prepareBlock=function(e,t){for(var i=this.W,n=0;n<32;n++)i[n]=e[t+n];for(;n<i.length;n+=2){var s=n_(i[n-4],i[n-3]),a=s_(i[n-4],i[n-3]),f=i[n-14],h=i[n-13],u=r_(i[n-30],i[n-29]),g=i_(i[n-30],i[n-29]),w=i[n-32],M=i[n-31];i[n]=k8(s,a,f,h,u,g,w,M),i[n+1]=j8(s,a,f,h,u,g,w,M)}},xn.prototype._update=function(e,t){this._prepareBlock(e,t);var i=this.W,n=this.h[0],s=this.h[1],a=this.h[2],f=this.h[3],h=this.h[4],u=this.h[5],g=this.h[6],w=this.h[7],M=this.h[8],C=this.h[9],O=this.h[10],N=this.h[11],j=this.h[12],H=this.h[13],F=this.h[14],G=this.h[15];H8(this.k.length===i.length);for(var B=0;B<i.length;B+=2){var z=F,W=G,_=e_(M,C),U=t_(M,C),ee=G8(M,C,O,N,j),oe=Y8(M,C,O,N,j,H),L=this.k[B],b=this.k[B+1],m=i[B],l=i[B+1],d=W8(z,W,_,U,ee,oe,L,b,m,l),y=K8(z,W,_,U,ee,oe,L,b,m,l);z=Z8(n,s),W=X8(n,s),_=J8(n,s,a,f,h),U=Q8(n,s,a,f,h,u);var P=dd(z,W,_,U),D=pd(z,W,_,U);F=j,G=H,j=O,H=N,O=M,N=C,M=dd(g,w,d,y),C=pd(w,w,d,y),g=h,w=u,h=a,u=f,a=n,f=s,n=dd(d,y,P,D),s=pd(d,y,P,D)}Us(this.h,0,n,s),Us(this.h,2,a,f),Us(this.h,4,h,u),Us(this.h,6,g,w),Us(this.h,8,M,C),Us(this.h,10,O,N),Us(this.h,12,j,H),Us(this.h,14,F,G)},xn.prototype._digest=function(e){return e==="hex"?vi.toHex32(this.h,"big"):vi.split32(this.h,"big")};function G8(r,e,t,i,n){var s=r&t^~r&n;return s<0&&(s+=4294967296),s}function Y8(r,e,t,i,n,s){var a=e&i^~e&s;return a<0&&(a+=4294967296),a}function J8(r,e,t,i,n){var s=r&t^r&n^t&n;return s<0&&(s+=4294967296),s}function Q8(r,e,t,i,n,s){var a=e&i^e&s^i&s;return a<0&&(a+=4294967296),a}function Z8(r,e){var t=Wn(r,e,28),i=Wn(e,r,2),n=Wn(e,r,7),s=t^i^n;return s<0&&(s+=4294967296),s}function X8(r,e){var t=Kn(r,e,28),i=Kn(e,r,2),n=Kn(e,r,7),s=t^i^n;return s<0&&(s+=4294967296),s}function e_(r,e){var t=Wn(r,e,14),i=Wn(r,e,18),n=Wn(e,r,9),s=t^i^n;return s<0&&(s+=4294967296),s}function t_(r,e){var t=Kn(r,e,14),i=Kn(r,e,18),n=Kn(e,r,9),s=t^i^n;return s<0&&(s+=4294967296),s}function r_(r,e){var t=Wn(r,e,1),i=Wn(r,e,8),n=wv(r,e,7),s=t^i^n;return s<0&&(s+=4294967296),s}function i_(r,e){var t=Kn(r,e,1),i=Kn(r,e,8),n=yv(r,e,7),s=t^i^n;return s<0&&(s+=4294967296),s}function n_(r,e){var t=Wn(r,e,19),i=Wn(e,r,29),n=wv(r,e,6),s=t^i^n;return s<0&&(s+=4294967296),s}function s_(r,e){var t=Kn(r,e,19),i=Kn(e,r,29),n=yv(r,e,6),s=t^i^n;return s<0&&(s+=4294967296),s}var gd=Nt,Av=xv;function vs(){if(!(this instanceof vs))return new vs;Av.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}gd.inherits(vs,Av);var o_=vs;vs.blockSize=1024,vs.outSize=384,vs.hmacStrength=192,vs.padLength=128,vs.prototype._digest=function(e){return e==="hex"?gd.toHex32(this.h.slice(0,12),"big"):gd.split32(this.h.slice(0,12),"big")},Ma.sha1=C8,Ma.sha224=q8,Ma.sha256=mv,Ma.sha384=o_,Ma.sha512=xv;var Ev={},Io=Nt,a_=Ia,ll=Io.rotl32,Sv=Io.sum32,Uc=Io.sum32_3,Iv=Io.sum32_4,Mv=a_.BlockHash;function Vn(){if(!(this instanceof Vn))return new Vn;Mv.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Io.inherits(Vn,Mv),Ev.ripemd160=Vn,Vn.blockSize=512,Vn.outSize=160,Vn.hmacStrength=192,Vn.padLength=64,Vn.prototype._update=function(e,t){for(var i=this.h[0],n=this.h[1],s=this.h[2],a=this.h[3],f=this.h[4],h=i,u=n,g=s,w=a,M=f,C=0;C<80;C++){var O=Sv(ll(Iv(i,Cv(C,n,s,a),e[l_[C]+t],c_(C)),u_[C]),f);i=f,f=a,a=ll(s,10),s=n,n=O,O=Sv(ll(Iv(h,Cv(79-C,u,g,w),e[h_[C]+t],f_(C)),d_[C]),M),h=M,M=w,w=ll(g,10),g=u,u=O}O=Uc(this.h[1],s,w),this.h[1]=Uc(this.h[2],a,M),this.h[2]=Uc(this.h[3],f,h),this.h[3]=Uc(this.h[4],i,u),this.h[4]=Uc(this.h[0],n,g),this.h[0]=O},Vn.prototype._digest=function(e){return e==="hex"?Io.toHex32(this.h,"little"):Io.split32(this.h,"little")};function Cv(r,e,t,i){return r<=15?e^t^i:r<=31?e&t|~e&i:r<=47?(e|~t)^i:r<=63?e&i|t&~i:e^(t|~i)}function c_(r){return r<=15?0:r<=31?1518500249:r<=47?1859775393:r<=63?2400959708:2840853838}function f_(r){return r<=15?1352829926:r<=31?1548603684:r<=47?1836072691:r<=63?2053994217:0}var l_=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],h_=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],u_=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],d_=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],p_=Nt,g_=So;function Oa(r,e,t){if(!(this instanceof Oa))return new Oa(r,e,t);this.Hash=r,this.blockSize=r.blockSize/8,this.outSize=r.outSize/8,this.inner=null,this.outer=null,this._init(p_.toArray(e,t))}var v_=Oa;Oa.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),g_(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=new this.Hash().update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=new this.Hash().update(e)},Oa.prototype.update=function(e,t){return this.inner.update(e,t),this},Oa.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},function(r){var e=r;e.utils=Nt,e.common=Ia,e.sha=Ma,e.ripemd=Ev,e.hmac=v_,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(Ri);function Ra(r,e,t){return t={path:e,exports:{},require:function(i,n){return m_(i,n??t.path)}},r(t,t.exports),t.exports}function m_(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var vd=Pv;function Pv(r,e){if(!r)throw new Error(e||"Assertion failed")}Pv.equal=function(e,t,i){if(e!=t)throw new Error(i||"Assertion failed: "+e+" != "+t)};var An=Ra(function(r,e){var t=e;function i(a,f){if(Array.isArray(a))return a.slice();if(!a)return[];var h=[];if(typeof a!="string"){for(var u=0;u<a.length;u++)h[u]=a[u]|0;return h}if(f==="hex"){a=a.replace(/[^a-z0-9]+/ig,""),a.length%2!==0&&(a="0"+a);for(var u=0;u<a.length;u+=2)h.push(parseInt(a[u]+a[u+1],16))}else for(var u=0;u<a.length;u++){var g=a.charCodeAt(u),w=g>>8,M=g&255;w?h.push(w,M):h.push(M)}return h}t.toArray=i;function n(a){return a.length===1?"0"+a:a}t.zero2=n;function s(a){for(var f="",h=0;h<a.length;h++)f+=n(a[h].toString(16));return f}t.toHex=s,t.encode=function(f,h){return h==="hex"?s(f):f}}),Ti=Ra(function(r,e){var t=e;t.assert=vd,t.toArray=An.toArray,t.zero2=An.zero2,t.toHex=An.toHex,t.encode=An.encode;function i(h,u,g){var w=new Array(Math.max(h.bitLength(),g)+1);w.fill(0);for(var M=1<<u+1,C=h.clone(),O=0;O<w.length;O++){var N,j=C.andln(M-1);C.isOdd()?(j>(M>>1)-1?N=(M>>1)-j:N=j,C.isubn(N)):N=0,w[O]=N,C.iushrn(1)}return w}t.getNAF=i;function n(h,u){var g=[[],[]];h=h.clone(),u=u.clone();for(var w=0,M=0,C;h.cmpn(-w)>0||u.cmpn(-M)>0;){var O=h.andln(3)+w&3,N=u.andln(3)+M&3;O===3&&(O=-1),N===3&&(N=-1);var j;O&1?(C=h.andln(7)+w&7,(C===3||C===5)&&N===2?j=-O:j=O):j=0,g[0].push(j);var H;N&1?(C=u.andln(7)+M&7,(C===3||C===5)&&O===2?H=-N:H=N):H=0,g[1].push(H),2*w===j+1&&(w=1-w),2*M===H+1&&(M=1-M),h.iushrn(1),u.iushrn(1)}return g}t.getJSF=n;function s(h,u,g){var w="_"+u;h.prototype[u]=function(){return this[w]!==void 0?this[w]:this[w]=g.call(this)}}t.cachedProperty=s;function a(h){return typeof h=="string"?t.toArray(h,"hex"):h}t.parseBytes=a;function f(h){return new vt(h,"hex","le")}t.intFromLE=f}),hl=Ti.getNAF,b_=Ti.getJSF,ul=Ti.assert;function qs(r,e){this.type=r,this.p=new vt(e.p,16),this.red=e.prime?vt.red(e.prime):vt.mont(this.p),this.zero=new vt(0).toRed(this.red),this.one=new vt(1).toRed(this.red),this.two=new vt(2).toRed(this.red),this.n=e.n&&new vt(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Mo=qs;qs.prototype.point=function(){throw new Error("Not implemented")},qs.prototype.validate=function(){throw new Error("Not implemented")},qs.prototype._fixedNafMul=function(e,t){ul(e.precomputed);var i=e._getDoubles(),n=hl(t,1,this._bitLength),s=(1<<i.step+1)-(i.step%2===0?2:1);s/=3;var a=[],f,h;for(f=0;f<n.length;f+=i.step){h=0;for(var u=f+i.step-1;u>=f;u--)h=(h<<1)+n[u];a.push(h)}for(var g=this.jpoint(null,null,null),w=this.jpoint(null,null,null),M=s;M>0;M--){for(f=0;f<a.length;f++)h=a[f],h===M?w=w.mixedAdd(i.points[f]):h===-M&&(w=w.mixedAdd(i.points[f].neg()));g=g.add(w)}return g.toP()},qs.prototype._wnafMul=function(e,t){var i=4,n=e._getNAFPoints(i);i=n.wnd;for(var s=n.points,a=hl(t,i,this._bitLength),f=this.jpoint(null,null,null),h=a.length-1;h>=0;h--){for(var u=0;h>=0&&a[h]===0;h--)u++;if(h>=0&&u++,f=f.dblp(u),h<0)break;var g=a[h];ul(g!==0),e.type==="affine"?g>0?f=f.mixedAdd(s[g-1>>1]):f=f.mixedAdd(s[-g-1>>1].neg()):g>0?f=f.add(s[g-1>>1]):f=f.add(s[-g-1>>1].neg())}return e.type==="affine"?f.toP():f},qs.prototype._wnafMulAdd=function(e,t,i,n,s){var a=this._wnafT1,f=this._wnafT2,h=this._wnafT3,u=0,g,w,M;for(g=0;g<n;g++){M=t[g];var C=M._getNAFPoints(e);a[g]=C.wnd,f[g]=C.points}for(g=n-1;g>=1;g-=2){var O=g-1,N=g;if(a[O]!==1||a[N]!==1){h[O]=hl(i[O],a[O],this._bitLength),h[N]=hl(i[N],a[N],this._bitLength),u=Math.max(h[O].length,u),u=Math.max(h[N].length,u);continue}var j=[t[O],null,null,t[N]];t[O].y.cmp(t[N].y)===0?(j[1]=t[O].add(t[N]),j[2]=t[O].toJ().mixedAdd(t[N].neg())):t[O].y.cmp(t[N].y.redNeg())===0?(j[1]=t[O].toJ().mixedAdd(t[N]),j[2]=t[O].add(t[N].neg())):(j[1]=t[O].toJ().mixedAdd(t[N]),j[2]=t[O].toJ().mixedAdd(t[N].neg()));var H=[-3,-1,-5,-7,0,7,5,1,3],F=b_(i[O],i[N]);for(u=Math.max(F[0].length,u),h[O]=new Array(u),h[N]=new Array(u),w=0;w<u;w++){var G=F[0][w]|0,B=F[1][w]|0;h[O][w]=H[(G+1)*3+(B+1)],h[N][w]=0,f[O]=j}}var z=this.jpoint(null,null,null),W=this._wnafT4;for(g=u;g>=0;g--){for(var _=0;g>=0;){var U=!0;for(w=0;w<n;w++)W[w]=h[w][g]|0,W[w]!==0&&(U=!1);if(!U)break;_++,g--}if(g>=0&&_++,z=z.dblp(_),g<0)break;for(w=0;w<n;w++){var ee=W[w];ee!==0&&(ee>0?M=f[w][ee-1>>1]:ee<0&&(M=f[w][-ee-1>>1].neg()),M.type==="affine"?z=z.mixedAdd(M):z=z.add(M))}}for(g=0;g<n;g++)f[g]=null;return s?z:z.toP()};function Yi(r,e){this.curve=r,this.type=e,this.precomputed=null}qs.BasePoint=Yi,Yi.prototype.eq=function(){throw new Error("Not implemented")},Yi.prototype.validate=function(){return this.curve.validate(this)},qs.prototype.decodePoint=function(e,t){e=Ti.toArray(e,t);var i=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*i){e[0]===6?ul(e[e.length-1]%2===0):e[0]===7&&ul(e[e.length-1]%2===1);var n=this.point(e.slice(1,1+i),e.slice(1+i,1+2*i));return n}else if((e[0]===2||e[0]===3)&&e.length-1===i)return this.pointFromX(e.slice(1,1+i),e[0]===3);throw new Error("Unknown point format")},Yi.prototype.encodeCompressed=function(e){return this.encode(e,!0)},Yi.prototype._encode=function(e){var t=this.curve.p.byteLength(),i=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(i):[4].concat(i,this.getY().toArray("be",t))},Yi.prototype.encode=function(e,t){return Ti.encode(this._encode(t),e)},Yi.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},Yi.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((e.bitLength()+1)/t.step):!1},Yi.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],n=this,s=0;s<t;s+=e){for(var a=0;a<e;a++)n=n.dbl();i.push(n)}return{step:e,points:i}},Yi.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],i=(1<<e)-1,n=i===1?null:this.dbl(),s=1;s<i;s++)t[s]=t[s-1].add(n);return{wnd:e,points:t}},Yi.prototype._getBeta=function(){return null},Yi.prototype.dblp=function(e){for(var t=this,i=0;i<e;i++)t=t.dbl();return t};var md=Ra(function(r){typeof Object.create=="function"?r.exports=function(t,i){i&&(t.super_=i,t.prototype=Object.create(i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:r.exports=function(t,i){if(i){t.super_=i;var n=function(){};n.prototype=i.prototype,t.prototype=new n,t.prototype.constructor=t}}}),w_=Ti.assert;function Ji(r){Mo.call(this,"short",r),this.a=new vt(r.a,16).toRed(this.red),this.b=new vt(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}md(Ji,Mo);var y_=Ji;Ji.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,i;if(e.beta)t=new vt(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=n[0].cmp(n[1])<0?n[0]:n[1],t=t.toRed(this.red)}if(e.lambda)i=new vt(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(t))===0?i=s[0]:(i=s[1],w_(this.g.mul(i).x.cmp(this.g.x.redMul(t))===0))}var a;return e.basis?a=e.basis.map(function(f){return{a:new vt(f.a,16),b:new vt(f.b,16)}}):a=this._getEndoBasis(i),{beta:t,lambda:i,basis:a}}},Ji.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:vt.mont(e),i=new vt(2).toRed(t).redInvm(),n=i.redNeg(),s=new vt(3).toRed(t).redNeg().redSqrt().redMul(i),a=n.redAdd(s).fromRed(),f=n.redSub(s).fromRed();return[a,f]},Ji.prototype._getEndoBasis=function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),i=e,n=this.n.clone(),s=new vt(1),a=new vt(0),f=new vt(0),h=new vt(1),u,g,w,M,C,O,N,j=0,H,F;i.cmpn(0)!==0;){var G=n.div(i);H=n.sub(G.mul(i)),F=f.sub(G.mul(s));var B=h.sub(G.mul(a));if(!w&&H.cmp(t)<0)u=N.neg(),g=s,w=H.neg(),M=F;else if(w&&++j===2)break;N=H,n=i,i=H,f=s,s=F,h=a,a=B}C=H.neg(),O=F;var z=w.sqr().add(M.sqr()),W=C.sqr().add(O.sqr());return W.cmp(z)>=0&&(C=u,O=g),w.negative&&(w=w.neg(),M=M.neg()),C.negative&&(C=C.neg(),O=O.neg()),[{a:w,b:M},{a:C,b:O}]},Ji.prototype._endoSplit=function(e){var t=this.endo.basis,i=t[0],n=t[1],s=n.b.mul(e).divRound(this.n),a=i.b.neg().mul(e).divRound(this.n),f=s.mul(i.a),h=a.mul(n.a),u=s.mul(i.b),g=a.mul(n.b),w=e.sub(f).sub(h),M=u.add(g).neg();return{k1:w,k2:M}},Ji.prototype.pointFromX=function(e,t){e=new vt(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=i.redSqrt();if(n.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var s=n.fromRed().isOdd();return(t&&!s||!t&&s)&&(n=n.redNeg()),this.point(e,n)},Ji.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,i=e.y,n=this.a.redMul(t),s=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return i.redSqr().redISub(s).cmpn(0)===0},Ji.prototype._endoWnafMulAdd=function(e,t,i){for(var n=this._endoWnafT1,s=this._endoWnafT2,a=0;a<e.length;a++){var f=this._endoSplit(t[a]),h=e[a],u=h._getBeta();f.k1.negative&&(f.k1.ineg(),h=h.neg(!0)),f.k2.negative&&(f.k2.ineg(),u=u.neg(!0)),n[a*2]=h,n[a*2+1]=u,s[a*2]=f.k1,s[a*2+1]=f.k2}for(var g=this._wnafMulAdd(1,n,s,a*2,i),w=0;w<a*2;w++)n[w]=null,s[w]=null;return g};function Or(r,e,t,i){Mo.BasePoint.call(this,r,"affine"),e===null&&t===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new vt(e,16),this.y=new vt(t,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}md(Or,Mo.BasePoint),Ji.prototype.point=function(e,t,i){return new Or(this,e,t,i)},Ji.prototype.pointFromJSON=function(e,t){return Or.fromJSON(this,e,t)},Or.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var i=this.curve,n=function(s){return i.point(s.x.redMul(i.endo.beta),s.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},Or.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Or.fromJSON=function(e,t,i){typeof t=="string"&&(t=JSON.parse(t));var n=e.point(t[0],t[1],i);if(!t[2])return n;function s(f){return e.point(f[0],f[1],i)}var a=t[2];return n.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[n].concat(a.doubles.points.map(s))},naf:a.naf&&{wnd:a.naf.wnd,points:[n].concat(a.naf.points.map(s))}},n},Or.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Or.prototype.isInfinity=function(){return this.inf},Or.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var i=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)},Or.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,i=this.x.redSqr(),n=e.redInvm(),s=i.redAdd(i).redIAdd(i).redIAdd(t).redMul(n),a=s.redSqr().redISub(this.x.redAdd(this.x)),f=s.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,f)},Or.prototype.getX=function(){return this.x.fromRed()},Or.prototype.getY=function(){return this.y.fromRed()},Or.prototype.mul=function(e){return e=new vt(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Or.prototype.mulAdd=function(e,t,i){var n=[this,t],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s):this.curve._wnafMulAdd(1,n,s,2)},Or.prototype.jmulAdd=function(e,t,i){var n=[this,t],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s,!0):this.curve._wnafMulAdd(1,n,s,2,!0)},Or.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Or.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,n=function(s){return s.neg()};t.precomputed={naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(n)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(n)}}}return t},Or.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function kr(r,e,t,i){Mo.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new vt(0)):(this.x=new vt(e,16),this.y=new vt(t,16),this.z=new vt(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}md(kr,Mo.BasePoint),Ji.prototype.jpoint=function(e,t,i){return new kr(this,e,t,i)},kr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),i=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(i,n)},kr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},kr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),i=this.z.redSqr(),n=this.x.redMul(t),s=e.x.redMul(i),a=this.y.redMul(t.redMul(e.z)),f=e.y.redMul(i.redMul(this.z)),h=n.redSub(s),u=a.redSub(f);if(h.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var g=h.redSqr(),w=g.redMul(h),M=n.redMul(g),C=u.redSqr().redIAdd(w).redISub(M).redISub(M),O=u.redMul(M.redISub(C)).redISub(a.redMul(w)),N=this.z.redMul(e.z).redMul(h);return this.curve.jpoint(C,O,N)},kr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),i=this.x,n=e.x.redMul(t),s=this.y,a=e.y.redMul(t).redMul(this.z),f=i.redSub(n),h=s.redSub(a);if(f.cmpn(0)===0)return h.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=f.redSqr(),g=u.redMul(f),w=i.redMul(u),M=h.redSqr().redIAdd(g).redISub(w).redISub(w),C=h.redMul(w.redISub(M)).redISub(s.redMul(g)),O=this.z.redMul(f);return this.curve.jpoint(M,C,O)},kr.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var i=this;for(t=0;t<e;t++)i=i.dbl();return i}var n=this.curve.a,s=this.curve.tinv,a=this.x,f=this.y,h=this.z,u=h.redSqr().redSqr(),g=f.redAdd(f);for(t=0;t<e;t++){var w=a.redSqr(),M=g.redSqr(),C=M.redSqr(),O=w.redAdd(w).redIAdd(w).redIAdd(n.redMul(u)),N=a.redMul(M),j=O.redSqr().redISub(N.redAdd(N)),H=N.redISub(j),F=O.redMul(H);F=F.redIAdd(F).redISub(C);var G=g.redMul(h);t+1<e&&(u=u.redMul(C)),a=j,h=G,g=F}return this.curve.jpoint(a,g.redMul(s),h)},kr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},kr.prototype._zeroDbl=function(){var e,t,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),f=this.x.redAdd(s).redSqr().redISub(n).redISub(a);f=f.redIAdd(f);var h=n.redAdd(n).redIAdd(n),u=h.redSqr().redISub(f).redISub(f),g=a.redIAdd(a);g=g.redIAdd(g),g=g.redIAdd(g),e=u,t=h.redMul(f.redISub(u)).redISub(g),i=this.y.redAdd(this.y)}else{var w=this.x.redSqr(),M=this.y.redSqr(),C=M.redSqr(),O=this.x.redAdd(M).redSqr().redISub(w).redISub(C);O=O.redIAdd(O);var N=w.redAdd(w).redIAdd(w),j=N.redSqr(),H=C.redIAdd(C);H=H.redIAdd(H),H=H.redIAdd(H),e=j.redISub(O).redISub(O),t=N.redMul(O.redISub(e)).redISub(H),i=this.y.redMul(this.z),i=i.redIAdd(i)}return this.curve.jpoint(e,t,i)},kr.prototype._threeDbl=function(){var e,t,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),f=this.x.redAdd(s).redSqr().redISub(n).redISub(a);f=f.redIAdd(f);var h=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=h.redSqr().redISub(f).redISub(f);e=u;var g=a.redIAdd(a);g=g.redIAdd(g),g=g.redIAdd(g),t=h.redMul(f.redISub(u)).redISub(g),i=this.y.redAdd(this.y)}else{var w=this.z.redSqr(),M=this.y.redSqr(),C=this.x.redMul(M),O=this.x.redSub(w).redMul(this.x.redAdd(w));O=O.redAdd(O).redIAdd(O);var N=C.redIAdd(C);N=N.redIAdd(N);var j=N.redAdd(N);e=O.redSqr().redISub(j),i=this.y.redAdd(this.z).redSqr().redISub(M).redISub(w);var H=M.redSqr();H=H.redIAdd(H),H=H.redIAdd(H),H=H.redIAdd(H),t=O.redMul(N.redISub(e)).redISub(H)}return this.curve.jpoint(e,t,i)},kr.prototype._dbl=function(){var e=this.curve.a,t=this.x,i=this.y,n=this.z,s=n.redSqr().redSqr(),a=t.redSqr(),f=i.redSqr(),h=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(s)),u=t.redAdd(t);u=u.redIAdd(u);var g=u.redMul(f),w=h.redSqr().redISub(g.redAdd(g)),M=g.redISub(w),C=f.redSqr();C=C.redIAdd(C),C=C.redIAdd(C),C=C.redIAdd(C);var O=h.redMul(M).redISub(C),N=i.redAdd(i).redMul(n);return this.curve.jpoint(w,O,N)},kr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),i=this.z.redSqr(),n=t.redSqr(),s=e.redAdd(e).redIAdd(e),a=s.redSqr(),f=this.x.redAdd(t).redSqr().redISub(e).redISub(n);f=f.redIAdd(f),f=f.redAdd(f).redIAdd(f),f=f.redISub(a);var h=f.redSqr(),u=n.redIAdd(n);u=u.redIAdd(u),u=u.redIAdd(u),u=u.redIAdd(u);var g=s.redIAdd(f).redSqr().redISub(a).redISub(h).redISub(u),w=t.redMul(g);w=w.redIAdd(w),w=w.redIAdd(w);var M=this.x.redMul(h).redISub(w);M=M.redIAdd(M),M=M.redIAdd(M);var C=this.y.redMul(g.redMul(u.redISub(g)).redISub(f.redMul(h)));C=C.redIAdd(C),C=C.redIAdd(C),C=C.redIAdd(C);var O=this.z.redAdd(f).redSqr().redISub(i).redISub(h);return this.curve.jpoint(M,C,O)},kr.prototype.mul=function(e,t){return e=new vt(e,t),this.curve._wnafMul(this,e)},kr.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),i=e.z.redSqr();if(this.x.redMul(i).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var n=t.redMul(this.z),s=i.redMul(e.z);return this.y.redMul(s).redISub(e.y.redMul(n)).cmpn(0)===0},kr.prototype.eqXToP=function(e){var t=this.z.redSqr(),i=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(i)===0)return!0;for(var n=e.clone(),s=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(i.redIAdd(s),this.x.cmp(i)===0)return!0}},kr.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},kr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var dl=Ra(function(r,e){var t=e;t.base=Mo,t.short=y_,t.mont=null,t.edwards=null}),pl=Ra(function(r,e){var t=e,i=Ti.assert;function n(f){f.type==="short"?this.curve=new dl.short(f):f.type==="edwards"?this.curve=new dl.edwards(f):this.curve=new dl.mont(f),this.g=this.curve.g,this.n=this.curve.n,this.hash=f.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}t.PresetCurve=n;function s(f,h){Object.defineProperty(t,f,{configurable:!0,enumerable:!0,get:function(){var u=new n(h);return Object.defineProperty(t,f,{configurable:!0,enumerable:!0,value:u}),u}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Ri.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Ri.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Ri.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Ri.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Ri.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ri.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ri.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var a;try{a=null.crash()}catch{a=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Ri.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})});function zs(r){if(!(this instanceof zs))return new zs(r);this.hash=r.hash,this.predResist=!!r.predResist,this.outLen=this.hash.outSize,this.minEntropy=r.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=An.toArray(r.entropy,r.entropyEnc||"hex"),t=An.toArray(r.nonce,r.nonceEnc||"hex"),i=An.toArray(r.pers,r.persEnc||"hex");vd(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,i)}var Dv=zs;zs.prototype._init=function(e,t,i){var n=e.concat(t).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},zs.prototype._hmac=function(){return new Ri.hmac(this.hash,this.K)},zs.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},zs.prototype.reseed=function(e,t,i,n){typeof t!="string"&&(n=i,i=t,t=null),e=An.toArray(e,t),i=An.toArray(i,n),vd(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this._reseed=1},zs.prototype.generate=function(e,t,i,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(n=i,i=t,t=null),i&&(i=An.toArray(i,n||"hex"),this._update(i));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var a=s.slice(0,e);return this._update(i),this._reseed++,An.encode(a,t)};var bd=Ti.assert;function Gr(r,e){this.ec=r,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var wd=Gr;Gr.fromPublic=function(e,t,i){return t instanceof Gr?t:new Gr(e,{pub:t,pubEnc:i})},Gr.fromPrivate=function(e,t,i){return t instanceof Gr?t:new Gr(e,{priv:t,privEnc:i})},Gr.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},Gr.prototype.getPublic=function(e,t){return typeof e=="string"&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},Gr.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv},Gr.prototype._importPrivate=function(e,t){this.priv=new vt(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},Gr.prototype._importPublic=function(e,t){if(e.x||e.y){this.ec.curve.type==="mont"?bd(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&bd(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)},Gr.prototype.derive=function(e){return e.validate()||bd(e.validate(),"public point not validated"),e.mul(this.priv).getX()},Gr.prototype.sign=function(e,t,i){return this.ec.sign(e,this,t,i)},Gr.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},Gr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var __=Ti.assert;function gl(r,e){if(r instanceof gl)return r;this._importDER(r,e)||(__(r.r&&r.s,"Signature without r or s"),this.r=new vt(r.r,16),this.s=new vt(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}var vl=gl;function x_(){this.place=0}function yd(r,e){var t=r[e.place++];if(!(t&128))return t;var i=t&15;if(i===0||i>4)return!1;for(var n=0,s=0,a=e.place;s<i;s++,a++)n<<=8,n|=r[a],n>>>=0;return n<=127?!1:(e.place=a,n)}function Ov(r){for(var e=0,t=r.length-1;!r[e]&&!(r[e+1]&128)&&e<t;)e++;return e===0?r:r.slice(e)}gl.prototype._importDER=function(e,t){e=Ti.toArray(e,t);var i=new x_;if(e[i.place++]!==48)return!1;var n=yd(e,i);if(n===!1||n+i.place!==e.length||e[i.place++]!==2)return!1;var s=yd(e,i);if(s===!1)return!1;var a=e.slice(i.place,s+i.place);if(i.place+=s,e[i.place++]!==2)return!1;var f=yd(e,i);if(f===!1||e.length!==f+i.place)return!1;var h=e.slice(i.place,f+i.place);if(a[0]===0)if(a[1]&128)a=a.slice(1);else return!1;if(h[0]===0)if(h[1]&128)h=h.slice(1);else return!1;return this.r=new vt(a),this.s=new vt(h),this.recoveryParam=null,!0};function _d(r,e){if(e<128){r.push(e);return}var t=1+(Math.log(e)/Math.LN2>>>3);for(r.push(t|128);--t;)r.push(e>>>(t<<3)&255);r.push(e)}gl.prototype.toDER=function(e){var t=this.r.toArray(),i=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),i[0]&128&&(i=[0].concat(i)),t=Ov(t),i=Ov(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var n=[2];_d(n,t.length),n=n.concat(t),n.push(2),_d(n,i.length);var s=n.concat(i),a=[48];return _d(a,s.length),a=a.concat(s),Ti.encode(a,e)};var A_=function(){throw new Error("unsupported")},Rv=Ti.assert;function Qi(r){if(!(this instanceof Qi))return new Qi(r);typeof r=="string"&&(Rv(Object.prototype.hasOwnProperty.call(pl,r),"Unknown curve "+r),r=pl[r]),r instanceof pl.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}var E_=Qi;Qi.prototype.keyPair=function(e){return new wd(this,e)},Qi.prototype.keyFromPrivate=function(e,t){return wd.fromPrivate(this,e,t)},Qi.prototype.keyFromPublic=function(e,t){return wd.fromPublic(this,e,t)},Qi.prototype.genKeyPair=function(e){e||(e={});for(var t=new Dv({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||A_(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),n=this.n.sub(new vt(2));;){var s=new vt(t.generate(i));if(!(s.cmp(n)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Qi.prototype._truncateToN=function(e,t){var i=e.byteLength()*8-this.n.bitLength();return i>0&&(e=e.ushrn(i)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},Qi.prototype.sign=function(e,t,i,n){typeof i=="object"&&(n=i,i=null),n||(n={}),t=this.keyFromPrivate(t,i),e=this._truncateToN(new vt(e,16));for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),f=e.toArray("be",s),h=new Dv({hash:this.hash,entropy:a,nonce:f,pers:n.pers,persEnc:n.persEnc||"utf8"}),u=this.n.sub(new vt(1)),g=0;;g++){var w=n.k?n.k(g):new vt(h.generate(this.n.byteLength()));if(w=this._truncateToN(w,!0),!(w.cmpn(1)<=0||w.cmp(u)>=0)){var M=this.g.mul(w);if(!M.isInfinity()){var C=M.getX(),O=C.umod(this.n);if(O.cmpn(0)!==0){var N=w.invm(this.n).mul(O.mul(t.getPrivate()).iadd(e));if(N=N.umod(this.n),N.cmpn(0)!==0){var j=(M.getY().isOdd()?1:0)|(C.cmp(O)!==0?2:0);return n.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),j^=1),new vl({r:O,s:N,recoveryParam:j})}}}}}},Qi.prototype.verify=function(e,t,i,n){e=this._truncateToN(new vt(e,16)),i=this.keyFromPublic(i,n),t=new vl(t,"hex");var s=t.r,a=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var f=a.invm(this.n),h=f.mul(e).umod(this.n),u=f.mul(s).umod(this.n),g;return this.curve._maxwellTrick?(g=this.g.jmulAdd(h,i.getPublic(),u),g.isInfinity()?!1:g.eqXToP(s)):(g=this.g.mulAdd(h,i.getPublic(),u),g.isInfinity()?!1:g.getX().umod(this.n).cmp(s)===0)},Qi.prototype.recoverPubKey=function(r,e,t,i){Rv((3&t)===t,"The recovery param is more than two bits"),e=new vl(e,i);var n=this.n,s=new vt(r),a=e.r,f=e.s,h=t&1,u=t>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?a=this.curve.pointFromX(a.add(this.curve.n),h):a=this.curve.pointFromX(a,h);var g=e.r.invm(n),w=n.sub(s).mul(g).umod(n),M=f.mul(g).umod(n);return this.g.mulAdd(w,a,M)},Qi.prototype.getKeyRecoveryParam=function(r,e,t,i){if(e=new vl(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(r,e,n)}catch{continue}if(s.eq(t))return n}throw new Error("Unable to find valid recovery factor")};var S_=Ra(function(r,e){var t=e;t.version="6.5.4",t.utils=Ti,t.rand=function(){throw new Error("unsupported")},t.curve=dl,t.curves=pl,t.ec=E_,t.eddsa=null}),I_=S_.ec;const M_="signing-key/5.7.0",xd=new xt(M_);let Ad=null;function Gn(){return Ad||(Ad=new I_("secp256k1")),Ad}class C_{constructor(e){Bc(this,"curve","secp256k1"),Bc(this,"privateKey",ni(e)),h4(this.privateKey)!==32&&xd.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=Gn().keyFromPrivate(ur(this.privateKey));Bc(this,"publicKey","0x"+t.getPublic(!1,"hex")),Bc(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Bc(this,"_isSigningKey",!0)}_addPoint(e){const t=Gn().keyFromPublic(ur(this.publicKey)),i=Gn().keyFromPublic(ur(e));return"0x"+t.pub.add(i.pub).encodeCompressed("hex")}signDigest(e){const t=Gn().keyFromPrivate(ur(this.privateKey)),i=ur(e);i.length!==32&&xd.throwArgumentError("bad digest length","digest",e);const n=t.sign(i,{canonical:!0});return Hg({recoveryParam:n.recoveryParam,r:qn("0x"+n.r.toString(16),32),s:qn("0x"+n.s.toString(16),32)})}computeSharedSecret(e){const t=Gn().keyFromPrivate(ur(this.privateKey)),i=Gn().keyFromPublic(ur(Tv(e)));return qn("0x"+t.derive(i.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function P_(r,e){const t=Hg(e),i={r:ur(t.r),s:ur(t.s)};return"0x"+Gn().recoverPubKey(ur(r),i,t.recoveryParam).encode("hex",!1)}function Tv(r,e){const t=ur(r);if(t.length===32){const i=new C_(t);return e?"0x"+Gn().keyFromPrivate(t).getPublic(!0,"hex"):i.publicKey}else{if(t.length===33)return e?ni(t):"0x"+Gn().keyFromPublic(t).getPublic(!1,"hex");if(t.length===65)return e?"0x"+Gn().keyFromPublic(t).getPublic(!0,"hex"):ni(t)}return xd.throwArgumentError("invalid public or private key","key","[REDACTED]")}const D_="transactions/5.7.0";new xt(D_);var Nv;(function(r){r[r.legacy=0]="legacy",r[r.eip2930=1]="eip2930",r[r.eip1559=2]="eip1559"})(Nv||(Nv={}));function O_(r){const e=Tv(r);return z4(zg(nd(zg(e,1)),12))}function R_(r,e){return O_(P_(ur(r),e))}var Ed={},ml={},yt={},$v={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});function e(f,h){var u=f>>>16&65535,g=f&65535,w=h>>>16&65535,M=h&65535;return g*M+(u*M+g*w<<16>>>0)|0}r.mul=Math.imul||e;function t(f,h){return f+h|0}r.add=t;function i(f,h){return f-h|0}r.sub=i;function n(f,h){return f<<h|f>>>32-h}r.rotl=n;function s(f,h){return f<<32-h|f>>>h}r.rotr=s;function a(f){return typeof f=="number"&&isFinite(f)&&Math.floor(f)===f}r.isInteger=Number.isInteger||a,r.MAX_SAFE_INTEGER=9007199254740991,r.isSafeInteger=function(f){return r.isInteger(f)&&f>=-r.MAX_SAFE_INTEGER&&f<=r.MAX_SAFE_INTEGER}})($v),Object.defineProperty(yt,"__esModule",{value:!0});var Lv=$v;function T_(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])<<16>>16}yt.readInt16BE=T_;function N_(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])>>>0}yt.readUint16BE=N_;function $_(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])<<16>>16}yt.readInt16LE=$_;function L_(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])>>>0}yt.readUint16LE=L_;function Bv(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>8,e[t+1]=r>>>0,e}yt.writeUint16BE=Bv,yt.writeInt16BE=Bv;function Fv(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e}yt.writeUint16LE=Fv,yt.writeInt16LE=Fv;function Sd(r,e){return e===void 0&&(e=0),r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}yt.readInt32BE=Sd;function Id(r,e){return e===void 0&&(e=0),(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}yt.readUint32BE=Id;function Md(r,e){return e===void 0&&(e=0),r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e]}yt.readInt32LE=Md;function Cd(r,e){return e===void 0&&(e=0),(r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e])>>>0}yt.readUint32LE=Cd;function bl(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>24,e[t+1]=r>>>16,e[t+2]=r>>>8,e[t+3]=r>>>0,e}yt.writeUint32BE=bl,yt.writeInt32BE=bl;function wl(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e[t+2]=r>>>16,e[t+3]=r>>>24,e}yt.writeUint32LE=wl,yt.writeInt32LE=wl;function B_(r,e){e===void 0&&(e=0);var t=Sd(r,e),i=Sd(r,e+4);return t*4294967296+i-(i>>31)*4294967296}yt.readInt64BE=B_;function F_(r,e){e===void 0&&(e=0);var t=Id(r,e),i=Id(r,e+4);return t*4294967296+i}yt.readUint64BE=F_;function U_(r,e){e===void 0&&(e=0);var t=Md(r,e),i=Md(r,e+4);return i*4294967296+t-(t>>31)*4294967296}yt.readInt64LE=U_;function q_(r,e){e===void 0&&(e=0);var t=Cd(r,e),i=Cd(r,e+4);return i*4294967296+t}yt.readUint64LE=q_;function Uv(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),bl(r/4294967296>>>0,e,t),bl(r>>>0,e,t+4),e}yt.writeUint64BE=Uv,yt.writeInt64BE=Uv;function qv(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),wl(r>>>0,e,t),wl(r/4294967296>>>0,e,t+4),e}yt.writeUint64LE=qv,yt.writeInt64LE=qv;function z_(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,n=1,s=r/8+t-1;s>=t;s--)i+=e[s]*n,n*=256;return i}yt.readUintBE=z_;function H_(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,n=1,s=t;s<t+r/8;s++)i+=e[s]*n,n*=256;return i}yt.readUintLE=H_;function k_(r,e,t,i){if(t===void 0&&(t=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!Lv.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var n=1,s=r/8+i-1;s>=i;s--)t[s]=e/n&255,n*=256;return t}yt.writeUintBE=k_;function j_(r,e,t,i){if(t===void 0&&(t=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Lv.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var n=1,s=i;s<i+r/8;s++)t[s]=e/n&255,n*=256;return t}yt.writeUintLE=j_;function W_(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e)}yt.readFloat32BE=W_;function K_(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e,!0)}yt.readFloat32LE=K_;function V_(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e)}yt.readFloat64BE=V_;function G_(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e,!0)}yt.readFloat64LE=G_;function Y_(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(t,r),e}yt.writeFloat32BE=Y_;function J_(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(t,r,!0),e}yt.writeFloat32LE=J_;function Q_(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(t,r),e}yt.writeFloat64BE=Q_;function Z_(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(t,r,!0),e}yt.writeFloat64LE=Z_;var Ni={};Object.defineProperty(Ni,"__esModule",{value:!0});function X_(r){for(var e=0;e<r.length;e++)r[e]=0;return r}Ni.wipe=X_,Object.defineProperty(ml,"__esModule",{value:!0});var Yr=yt,Pd=Ni,e7=20;function t7(r,e,t){for(var i=1634760805,n=857760878,s=2036477234,a=1797285236,f=t[3]<<24|t[2]<<16|t[1]<<8|t[0],h=t[7]<<24|t[6]<<16|t[5]<<8|t[4],u=t[11]<<24|t[10]<<16|t[9]<<8|t[8],g=t[15]<<24|t[14]<<16|t[13]<<8|t[12],w=t[19]<<24|t[18]<<16|t[17]<<8|t[16],M=t[23]<<24|t[22]<<16|t[21]<<8|t[20],C=t[27]<<24|t[26]<<16|t[25]<<8|t[24],O=t[31]<<24|t[30]<<16|t[29]<<8|t[28],N=e[3]<<24|e[2]<<16|e[1]<<8|e[0],j=e[7]<<24|e[6]<<16|e[5]<<8|e[4],H=e[11]<<24|e[10]<<16|e[9]<<8|e[8],F=e[15]<<24|e[14]<<16|e[13]<<8|e[12],G=i,B=n,z=s,W=a,_=f,U=h,ee=u,oe=g,L=w,b=M,m=C,l=O,d=N,y=j,P=H,D=F,S=0;S<e7;S+=2)G=G+_|0,d^=G,d=d>>>32-16|d<<16,L=L+d|0,_^=L,_=_>>>32-12|_<<12,B=B+U|0,y^=B,y=y>>>32-16|y<<16,b=b+y|0,U^=b,U=U>>>32-12|U<<12,z=z+ee|0,P^=z,P=P>>>32-16|P<<16,m=m+P|0,ee^=m,ee=ee>>>32-12|ee<<12,W=W+oe|0,D^=W,D=D>>>32-16|D<<16,l=l+D|0,oe^=l,oe=oe>>>32-12|oe<<12,z=z+ee|0,P^=z,P=P>>>32-8|P<<8,m=m+P|0,ee^=m,ee=ee>>>32-7|ee<<7,W=W+oe|0,D^=W,D=D>>>32-8|D<<8,l=l+D|0,oe^=l,oe=oe>>>32-7|oe<<7,B=B+U|0,y^=B,y=y>>>32-8|y<<8,b=b+y|0,U^=b,U=U>>>32-7|U<<7,G=G+_|0,d^=G,d=d>>>32-8|d<<8,L=L+d|0,_^=L,_=_>>>32-7|_<<7,G=G+U|0,D^=G,D=D>>>32-16|D<<16,m=m+D|0,U^=m,U=U>>>32-12|U<<12,B=B+ee|0,d^=B,d=d>>>32-16|d<<16,l=l+d|0,ee^=l,ee=ee>>>32-12|ee<<12,z=z+oe|0,y^=z,y=y>>>32-16|y<<16,L=L+y|0,oe^=L,oe=oe>>>32-12|oe<<12,W=W+_|0,P^=W,P=P>>>32-16|P<<16,b=b+P|0,_^=b,_=_>>>32-12|_<<12,z=z+oe|0,y^=z,y=y>>>32-8|y<<8,L=L+y|0,oe^=L,oe=oe>>>32-7|oe<<7,W=W+_|0,P^=W,P=P>>>32-8|P<<8,b=b+P|0,_^=b,_=_>>>32-7|_<<7,B=B+ee|0,d^=B,d=d>>>32-8|d<<8,l=l+d|0,ee^=l,ee=ee>>>32-7|ee<<7,G=G+U|0,D^=G,D=D>>>32-8|D<<8,m=m+D|0,U^=m,U=U>>>32-7|U<<7;Yr.writeUint32LE(G+i|0,r,0),Yr.writeUint32LE(B+n|0,r,4),Yr.writeUint32LE(z+s|0,r,8),Yr.writeUint32LE(W+a|0,r,12),Yr.writeUint32LE(_+f|0,r,16),Yr.writeUint32LE(U+h|0,r,20),Yr.writeUint32LE(ee+u|0,r,24),Yr.writeUint32LE(oe+g|0,r,28),Yr.writeUint32LE(L+w|0,r,32),Yr.writeUint32LE(b+M|0,r,36),Yr.writeUint32LE(m+C|0,r,40),Yr.writeUint32LE(l+O|0,r,44),Yr.writeUint32LE(d+N|0,r,48),Yr.writeUint32LE(y+j|0,r,52),Yr.writeUint32LE(P+H|0,r,56),Yr.writeUint32LE(D+F|0,r,60)}function zv(r,e,t,i,n){if(n===void 0&&(n=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length<t.length)throw new Error("ChaCha: destination is shorter than source");var s,a;if(n===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");s=new Uint8Array(16),a=s.length-e.length,s.set(e,a)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");s=e,a=n}for(var f=new Uint8Array(64),h=0;h<t.length;h+=64){t7(f,s,r);for(var u=h;u<h+64&&u<t.length;u++)i[u]=t[u]^f[u-h];i7(s,0,a)}return Pd.wipe(f),n===0&&Pd.wipe(s),i}ml.streamXOR=zv;function r7(r,e,t,i){return i===void 0&&(i=0),Pd.wipe(t),zv(r,e,t,t,i)}ml.stream=r7;function i7(r,e,t){for(var i=1;t--;)i=i+(r[e]&255)|0,r[e]=i&255,i>>>=8,e++;if(i>0)throw new Error("ChaCha: counter overflow")}var Hv={},Hs={};Object.defineProperty(Hs,"__esModule",{value:!0});function n7(r,e,t){return~(r-1)&e|r-1&t}Hs.select=n7;function s7(r,e){return(r|0)-(e|0)-1>>>31&1}Hs.lessOrEqual=s7;function kv(r,e){if(r.length!==e.length)return 0;for(var t=0,i=0;i<r.length;i++)t|=r[i]^e[i];return 1&t-1>>>8}Hs.compare=kv;function o7(r,e){return r.length===0||e.length===0?!1:kv(r,e)!==0}Hs.equal=o7,function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=Hs,t=Ni;r.DIGEST_LENGTH=16;var i=function(){function a(f){this.digestLength=r.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var h=f[0]|f[1]<<8;this._r[0]=h&8191;var u=f[2]|f[3]<<8;this._r[1]=(h>>>13|u<<3)&8191;var g=f[4]|f[5]<<8;this._r[2]=(u>>>10|g<<6)&7939;var w=f[6]|f[7]<<8;this._r[3]=(g>>>7|w<<9)&8191;var M=f[8]|f[9]<<8;this._r[4]=(w>>>4|M<<12)&255,this._r[5]=M>>>1&8190;var C=f[10]|f[11]<<8;this._r[6]=(M>>>14|C<<2)&8191;var O=f[12]|f[13]<<8;this._r[7]=(C>>>11|O<<5)&8065;var N=f[14]|f[15]<<8;this._r[8]=(O>>>8|N<<8)&8191,this._r[9]=N>>>5&127,this._pad[0]=f[16]|f[17]<<8,this._pad[1]=f[18]|f[19]<<8,this._pad[2]=f[20]|f[21]<<8,this._pad[3]=f[22]|f[23]<<8,this._pad[4]=f[24]|f[25]<<8,this._pad[5]=f[26]|f[27]<<8,this._pad[6]=f[28]|f[29]<<8,this._pad[7]=f[30]|f[31]<<8}return a.prototype._blocks=function(f,h,u){for(var g=this._fin?0:2048,w=this._h[0],M=this._h[1],C=this._h[2],O=this._h[3],N=this._h[4],j=this._h[5],H=this._h[6],F=this._h[7],G=this._h[8],B=this._h[9],z=this._r[0],W=this._r[1],_=this._r[2],U=this._r[3],ee=this._r[4],oe=this._r[5],L=this._r[6],b=this._r[7],m=this._r[8],l=this._r[9];u>=16;){var d=f[h+0]|f[h+1]<<8;w+=d&8191;var y=f[h+2]|f[h+3]<<8;M+=(d>>>13|y<<3)&8191;var P=f[h+4]|f[h+5]<<8;C+=(y>>>10|P<<6)&8191;var D=f[h+6]|f[h+7]<<8;O+=(P>>>7|D<<9)&8191;var S=f[h+8]|f[h+9]<<8;N+=(D>>>4|S<<12)&8191,j+=S>>>1&8191;var v=f[h+10]|f[h+11]<<8;H+=(S>>>14|v<<2)&8191;var A=f[h+12]|f[h+13]<<8;F+=(v>>>11|A<<5)&8191;var x=f[h+14]|f[h+15]<<8;G+=(A>>>8|x<<8)&8191,B+=x>>>5|g;var $=0,ae=$;ae+=w*z,ae+=M*(5*l),ae+=C*(5*m),ae+=O*(5*b),ae+=N*(5*L),$=ae>>>13,ae&=8191,ae+=j*(5*oe),ae+=H*(5*ee),ae+=F*(5*U),ae+=G*(5*_),ae+=B*(5*W),$+=ae>>>13,ae&=8191;var R=$;R+=w*W,R+=M*z,R+=C*(5*l),R+=O*(5*m),R+=N*(5*b),$=R>>>13,R&=8191,R+=j*(5*L),R+=H*(5*oe),R+=F*(5*ee),R+=G*(5*U),R+=B*(5*_),$+=R>>>13,R&=8191;var X=$;X+=w*_,X+=M*W,X+=C*z,X+=O*(5*l),X+=N*(5*m),$=X>>>13,X&=8191,X+=j*(5*b),X+=H*(5*L),X+=F*(5*oe),X+=G*(5*ee),X+=B*(5*U),$+=X>>>13,X&=8191;var V=$;V+=w*U,V+=M*_,V+=C*W,V+=O*z,V+=N*(5*l),$=V>>>13,V&=8191,V+=j*(5*m),V+=H*(5*b),V+=F*(5*L),V+=G*(5*oe),V+=B*(5*ee),$+=V>>>13,V&=8191;var J=$;J+=w*ee,J+=M*U,J+=C*_,J+=O*W,J+=N*z,$=J>>>13,J&=8191,J+=j*(5*l),J+=H*(5*m),J+=F*(5*b),J+=G*(5*L),J+=B*(5*oe),$+=J>>>13,J&=8191;var K=$;K+=w*oe,K+=M*ee,K+=C*U,K+=O*_,K+=N*W,$=K>>>13,K&=8191,K+=j*z,K+=H*(5*l),K+=F*(5*m),K+=G*(5*b),K+=B*(5*L),$+=K>>>13,K&=8191;var E=$;E+=w*L,E+=M*oe,E+=C*ee,E+=O*U,E+=N*_,$=E>>>13,E&=8191,E+=j*W,E+=H*z,E+=F*(5*l),E+=G*(5*m),E+=B*(5*b),$+=E>>>13,E&=8191;var Y=$;Y+=w*b,Y+=M*L,Y+=C*oe,Y+=O*ee,Y+=N*U,$=Y>>>13,Y&=8191,Y+=j*_,Y+=H*W,Y+=F*z,Y+=G*(5*l),Y+=B*(5*m),$+=Y>>>13,Y&=8191;var re=$;re+=w*m,re+=M*b,re+=C*L,re+=O*oe,re+=N*ee,$=re>>>13,re&=8191,re+=j*U,re+=H*_,re+=F*W,re+=G*z,re+=B*(5*l),$+=re>>>13,re&=8191;var le=$;le+=w*l,le+=M*m,le+=C*b,le+=O*L,le+=N*oe,$=le>>>13,le&=8191,le+=j*ee,le+=H*U,le+=F*_,le+=G*W,le+=B*z,$+=le>>>13,le&=8191,$=($<<2)+$|0,$=$+ae|0,ae=$&8191,$=$>>>13,R+=$,w=ae,M=R,C=X,O=V,N=J,j=K,H=E,F=Y,G=re,B=le,h+=16,u-=16}this._h[0]=w,this._h[1]=M,this._h[2]=C,this._h[3]=O,this._h[4]=N,this._h[5]=j,this._h[6]=H,this._h[7]=F,this._h[8]=G,this._h[9]=B},a.prototype.finish=function(f,h){h===void 0&&(h=0);var u=new Uint16Array(10),g,w,M,C;if(this._leftover){for(C=this._leftover,this._buffer[C++]=1;C<16;C++)this._buffer[C]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(g=this._h[1]>>>13,this._h[1]&=8191,C=2;C<10;C++)this._h[C]+=g,g=this._h[C]>>>13,this._h[C]&=8191;for(this._h[0]+=g*5,g=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=g,g=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=g,u[0]=this._h[0]+5,g=u[0]>>>13,u[0]&=8191,C=1;C<10;C++)u[C]=this._h[C]+g,g=u[C]>>>13,u[C]&=8191;for(u[9]-=8192,w=(g^1)-1,C=0;C<10;C++)u[C]&=w;for(w=~w,C=0;C<10;C++)this._h[C]=this._h[C]&w|u[C];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,M=this._h[0]+this._pad[0],this._h[0]=M&65535,C=1;C<8;C++)M=(this._h[C]+this._pad[C]|0)+(M>>>16)|0,this._h[C]=M&65535;return f[h+0]=this._h[0]>>>0,f[h+1]=this._h[0]>>>8,f[h+2]=this._h[1]>>>0,f[h+3]=this._h[1]>>>8,f[h+4]=this._h[2]>>>0,f[h+5]=this._h[2]>>>8,f[h+6]=this._h[3]>>>0,f[h+7]=this._h[3]>>>8,f[h+8]=this._h[4]>>>0,f[h+9]=this._h[4]>>>8,f[h+10]=this._h[5]>>>0,f[h+11]=this._h[5]>>>8,f[h+12]=this._h[6]>>>0,f[h+13]=this._h[6]>>>8,f[h+14]=this._h[7]>>>0,f[h+15]=this._h[7]>>>8,this._finished=!0,this},a.prototype.update=function(f){var h=0,u=f.length,g;if(this._leftover){g=16-this._leftover,g>u&&(g=u);for(var w=0;w<g;w++)this._buffer[this._leftover+w]=f[h+w];if(u-=g,h+=g,this._leftover+=g,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(u>=16&&(g=u-u%16,this._blocks(f,h,g),h+=g,u-=g),u){for(var w=0;w<u;w++)this._buffer[this._leftover+w]=f[h+w];this._leftover+=u}return this},a.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var f=new Uint8Array(16);return this.finish(f),f},a.prototype.clean=function(){return t.wipe(this._buffer),t.wipe(this._r),t.wipe(this._h),t.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},a}();r.Poly1305=i;function n(a,f){var h=new i(a);h.update(f);var u=h.digest();return h.clean(),u}r.oneTimeAuth=n;function s(a,f){return a.length!==r.DIGEST_LENGTH||f.length!==r.DIGEST_LENGTH?!1:e.equal(a,f)}r.equal=s}(Hv),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=ml,t=Hv,i=Ni,n=yt,s=Hs;r.KEY_LENGTH=32,r.NONCE_LENGTH=12,r.TAG_LENGTH=16;var a=new Uint8Array(16),f=function(){function h(u){if(this.nonceLength=r.NONCE_LENGTH,this.tagLength=r.TAG_LENGTH,u.length!==r.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(u)}return h.prototype.seal=function(u,g,w,M){if(u.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var C=new Uint8Array(16);C.set(u,C.length-u.length);var O=new Uint8Array(32);e.stream(this._key,C,O,4);var N=g.length+this.tagLength,j;if(M){if(M.length!==N)throw new Error("ChaCha20Poly1305: incorrect destination length");j=M}else j=new Uint8Array(N);return e.streamXOR(this._key,C,g,j,4),this._authenticate(j.subarray(j.length-this.tagLength,j.length),O,j.subarray(0,j.length-this.tagLength),w),i.wipe(C),j},h.prototype.open=function(u,g,w,M){if(u.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(g.length<this.tagLength)return null;var C=new Uint8Array(16);C.set(u,C.length-u.length);var O=new Uint8Array(32);e.stream(this._key,C,O,4);var N=new Uint8Array(this.tagLength);if(this._authenticate(N,O,g.subarray(0,g.length-this.tagLength),w),!s.equal(N,g.subarray(g.length-this.tagLength,g.length)))return null;var j=g.length-this.tagLength,H;if(M){if(M.length!==j)throw new Error("ChaCha20Poly1305: incorrect destination length");H=M}else H=new Uint8Array(j);return e.streamXOR(this._key,C,g.subarray(0,g.length-this.tagLength),H,4),i.wipe(C),H},h.prototype.clean=function(){return i.wipe(this._key),this},h.prototype._authenticate=function(u,g,w,M){var C=new t.Poly1305(g);M&&(C.update(M),M.length%16>0&&C.update(a.subarray(M.length%16))),C.update(w),w.length%16>0&&C.update(a.subarray(w.length%16));var O=new Uint8Array(8);M&&n.writeUint64LE(M.length,O),C.update(O),n.writeUint64LE(w.length,O),C.update(O);for(var N=C.digest(),j=0;j<N.length;j++)u[j]=N[j];C.clean(),i.wipe(N),i.wipe(O)},h}();r.ChaCha20Poly1305=f}(Ed);var jv={},qc={},Dd={};Object.defineProperty(Dd,"__esModule",{value:!0});function a7(r){return typeof r.saveState<"u"&&typeof r.restoreState<"u"&&typeof r.cleanSavedState<"u"}Dd.isSerializableHash=a7,Object.defineProperty(qc,"__esModule",{value:!0});var Yn=Dd,c7=Hs,f7=Ni,Wv=function(){function r(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(i).clean():i.set(t);for(var n=0;n<i.length;n++)i[n]^=54;this._inner.update(i);for(var n=0;n<i.length;n++)i[n]^=106;this._outer.update(i),Yn.isSerializableHash(this._inner)&&Yn.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),f7.wipe(i)}return r.prototype.reset=function(){if(!Yn.isSerializableHash(this._inner)||!Yn.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.clean=function(){Yn.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),Yn.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},r.prototype.update=function(e){return this._inner.update(e),this},r.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},r.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},r.prototype.saveState=function(){if(!Yn.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},r.prototype.restoreState=function(e){if(!Yn.isSerializableHash(this._inner)||!Yn.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.cleanSavedState=function(e){if(!Yn.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},r}();qc.HMAC=Wv;function l7(r,e,t){var i=new Wv(r,e);i.update(t);var n=i.digest();return i.clean(),n}qc.hmac=l7,qc.equal=c7.equal,Object.defineProperty(jv,"__esModule",{value:!0});var Kv=qc,Vv=Ni,h7=function(){function r(e,t,i,n){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=n;var s=Kv.hmac(this._hash,i,t);this._hmac=new Kv.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return r.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},r.prototype.expand=function(e){for(var t=new Uint8Array(e),i=0;i<t.length;i++)this._bufpos===this._buffer.length&&this._fillBuffer(),t[i]=this._buffer[this._bufpos++];return t},r.prototype.clean=function(){this._hmac.clean(),Vv.wipe(this._buffer),Vv.wipe(this._counter),this._bufpos=0},r}(),u7=jv.HKDF=h7,ks={},yl={},_l={};Object.defineProperty(_l,"__esModule",{value:!0}),_l.BrowserRandomSource=void 0;const Gv=65536;class d7{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const t=new Uint8Array(e);for(let i=0;i<t.length;i+=Gv)this._crypto.getRandomValues(t.subarray(i,i+Math.min(t.length-i,Gv)));return t}}_l.BrowserRandomSource=d7;function p7(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var xl={};Object.defineProperty(xl,"__esModule",{value:!0}),xl.NodeRandomSource=void 0;const g7=Ni;class v7{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof p7<"u"){const e=nl;e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const i=new Uint8Array(e);for(let n=0;n<i.length;n++)i[n]=t[n];return(0,g7.wipe)(t),i}}xl.NodeRandomSource=v7,Object.defineProperty(yl,"__esModule",{value:!0}),yl.SystemRandomSource=void 0;const m7=_l,b7=xl;class w7{constructor(){if(this.isAvailable=!1,this.name="",this._source=new m7.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new b7.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)}}yl.SystemRandomSource=w7,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.randomStringForEntropy=r.randomString=r.randomUint32=r.randomBytes=r.defaultRandomSource=void 0;const e=yl,t=yt,i=Ni;r.defaultRandomSource=new e.SystemRandomSource;function n(u,g=r.defaultRandomSource){return g.randomBytes(u)}r.randomBytes=n;function s(u=r.defaultRandomSource){const g=n(4,u),w=(0,t.readUint32LE)(g);return(0,i.wipe)(g),w}r.randomUint32=s;const a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function f(u,g=a,w=r.defaultRandomSource){if(g.length<2)throw new Error("randomString charset is too short");if(g.length>256)throw new Error("randomString charset is too long");let M="";const C=g.length,O=256-256%C;for(;u>0;){const N=n(Math.ceil(u*256/O),w);for(let j=0;j<N.length&&u>0;j++){const H=N[j];H<O&&(M+=g.charAt(H%C),u--)}(0,i.wipe)(N)}return M}r.randomString=f;function h(u,g=a,w=r.defaultRandomSource){const M=Math.ceil(u/(Math.log(g.length)/Math.LN2));return f(M,g,w)}r.randomStringForEntropy=h}(ks);var zc={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=yt,t=Ni;r.DIGEST_LENGTH=32,r.BLOCK_SIZE=64;var i=function(){function f(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return f.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},f.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},f.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._temp),this.reset()},f.prototype.update=function(h,u){if(u===void 0&&(u=h.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var g=0;if(this._bytesHashed+=u,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&u>0;)this._buffer[this._bufferLength++]=h[g++],u--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(u>=this.blockSize&&(g=s(this._temp,this._state,h,g,u),u%=this.blockSize);u>0;)this._buffer[this._bufferLength++]=h[g++],u--;return this},f.prototype.finish=function(h){if(!this._finished){var u=this._bytesHashed,g=this._bufferLength,w=u/536870912|0,M=u<<3,C=u%64<56?64:128;this._buffer[g]=128;for(var O=g+1;O<C-8;O++)this._buffer[O]=0;e.writeUint32BE(w,this._buffer,C-8),e.writeUint32BE(M,this._buffer,C-4),s(this._temp,this._state,this._buffer,0,C),this._finished=!0}for(var O=0;O<this.digestLength/4;O++)e.writeUint32BE(this._state[O],h,O*4);return this},f.prototype.digest=function(){var h=new Uint8Array(this.digestLength);return this.finish(h),h},f.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},f.prototype.restoreState=function(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},f.prototype.cleanSavedState=function(h){t.wipe(h.state),h.buffer&&t.wipe(h.buffer),h.bufferLength=0,h.bytesHashed=0},f}();r.SHA256=i;var n=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(f,h,u,g,w){for(;w>=64;){for(var M=h[0],C=h[1],O=h[2],N=h[3],j=h[4],H=h[5],F=h[6],G=h[7],B=0;B<16;B++){var z=g+B*4;f[B]=e.readUint32BE(u,z)}for(var B=16;B<64;B++){var W=f[B-2],_=(W>>>17|W<<32-17)^(W>>>19|W<<32-19)^W>>>10;W=f[B-15];var U=(W>>>7|W<<32-7)^(W>>>18|W<<32-18)^W>>>3;f[B]=(_+f[B-7]|0)+(U+f[B-16]|0)}for(var B=0;B<64;B++){var _=(((j>>>6|j<<26)^(j>>>11|j<<21)^(j>>>25|j<<7))+(j&H^~j&F)|0)+(G+(n[B]+f[B]|0)|0)|0,U=((M>>>2|M<<32-2)^(M>>>13|M<<32-13)^(M>>>22|M<<32-22))+(M&C^M&O^C&O)|0;G=F,F=H,H=j,j=N+_|0,N=O,O=C,C=M,M=_+U|0}h[0]+=M,h[1]+=C,h[2]+=O,h[3]+=N,h[4]+=j,h[5]+=H,h[6]+=F,h[7]+=G,g+=64,w-=64}return g}function a(f){var h=new i;h.update(f);var u=h.digest();return h.clean(),u}r.hash=a})(zc);var Od={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.sharedKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.scalarMultBase=r.scalarMult=r.SHARED_KEY_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=void 0;const e=ks,t=Ni;r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=32,r.SHARED_KEY_LENGTH=32;function i(B){const z=new Float64Array(16);if(B)for(let W=0;W<B.length;W++)z[W]=B[W];return z}const n=new Uint8Array(32);n[0]=9;const s=i([56129,1]);function a(B){let z=1;for(let W=0;W<16;W++){let _=B[W]+z+65535;z=Math.floor(_/65536),B[W]=_-z*65536}B[0]+=z-1+37*(z-1)}function f(B,z,W){const _=~(W-1);for(let U=0;U<16;U++){const ee=_&(B[U]^z[U]);B[U]^=ee,z[U]^=ee}}function h(B,z){const W=i(),_=i();for(let U=0;U<16;U++)_[U]=z[U];a(_),a(_),a(_);for(let U=0;U<2;U++){W[0]=_[0]-65517;for(let oe=1;oe<15;oe++)W[oe]=_[oe]-65535-(W[oe-1]>>16&1),W[oe-1]&=65535;W[15]=_[15]-32767-(W[14]>>16&1);const ee=W[15]>>16&1;W[14]&=65535,f(_,W,1-ee)}for(let U=0;U<16;U++)B[2*U]=_[U]&255,B[2*U+1]=_[U]>>8}function u(B,z){for(let W=0;W<16;W++)B[W]=z[2*W]+(z[2*W+1]<<8);B[15]&=32767}function g(B,z,W){for(let _=0;_<16;_++)B[_]=z[_]+W[_]}function w(B,z,W){for(let _=0;_<16;_++)B[_]=z[_]-W[_]}function M(B,z,W){let _,U,ee=0,oe=0,L=0,b=0,m=0,l=0,d=0,y=0,P=0,D=0,S=0,v=0,A=0,x=0,$=0,ae=0,R=0,X=0,V=0,J=0,K=0,E=0,Y=0,re=0,le=0,he=0,ge=0,He=0,Te=0,Ce=0,Xe=0,Ne=W[0],be=W[1],Pe=W[2],De=W[3],ye=W[4],Ie=W[5],Oe=W[6],me=W[7],Me=W[8],Be=W[9],we=W[10],ke=W[11],We=W[12],Ae=W[13],Ve=W[14],Ke=W[15];_=z[0],ee+=_*Ne,oe+=_*be,L+=_*Pe,b+=_*De,m+=_*ye,l+=_*Ie,d+=_*Oe,y+=_*me,P+=_*Me,D+=_*Be,S+=_*we,v+=_*ke,A+=_*We,x+=_*Ae,$+=_*Ve,ae+=_*Ke,_=z[1],oe+=_*Ne,L+=_*be,b+=_*Pe,m+=_*De,l+=_*ye,d+=_*Ie,y+=_*Oe,P+=_*me,D+=_*Me,S+=_*Be,v+=_*we,A+=_*ke,x+=_*We,$+=_*Ae,ae+=_*Ve,R+=_*Ke,_=z[2],L+=_*Ne,b+=_*be,m+=_*Pe,l+=_*De,d+=_*ye,y+=_*Ie,P+=_*Oe,D+=_*me,S+=_*Me,v+=_*Be,A+=_*we,x+=_*ke,$+=_*We,ae+=_*Ae,R+=_*Ve,X+=_*Ke,_=z[3],b+=_*Ne,m+=_*be,l+=_*Pe,d+=_*De,y+=_*ye,P+=_*Ie,D+=_*Oe,S+=_*me,v+=_*Me,A+=_*Be,x+=_*we,$+=_*ke,ae+=_*We,R+=_*Ae,X+=_*Ve,V+=_*Ke,_=z[4],m+=_*Ne,l+=_*be,d+=_*Pe,y+=_*De,P+=_*ye,D+=_*Ie,S+=_*Oe,v+=_*me,A+=_*Me,x+=_*Be,$+=_*we,ae+=_*ke,R+=_*We,X+=_*Ae,V+=_*Ve,J+=_*Ke,_=z[5],l+=_*Ne,d+=_*be,y+=_*Pe,P+=_*De,D+=_*ye,S+=_*Ie,v+=_*Oe,A+=_*me,x+=_*Me,$+=_*Be,ae+=_*we,R+=_*ke,X+=_*We,V+=_*Ae,J+=_*Ve,K+=_*Ke,_=z[6],d+=_*Ne,y+=_*be,P+=_*Pe,D+=_*De,S+=_*ye,v+=_*Ie,A+=_*Oe,x+=_*me,$+=_*Me,ae+=_*Be,R+=_*we,X+=_*ke,V+=_*We,J+=_*Ae,K+=_*Ve,E+=_*Ke,_=z[7],y+=_*Ne,P+=_*be,D+=_*Pe,S+=_*De,v+=_*ye,A+=_*Ie,x+=_*Oe,$+=_*me,ae+=_*Me,R+=_*Be,X+=_*we,V+=_*ke,J+=_*We,K+=_*Ae,E+=_*Ve,Y+=_*Ke,_=z[8],P+=_*Ne,D+=_*be,S+=_*Pe,v+=_*De,A+=_*ye,x+=_*Ie,$+=_*Oe,ae+=_*me,R+=_*Me,X+=_*Be,V+=_*we,J+=_*ke,K+=_*We,E+=_*Ae,Y+=_*Ve,re+=_*Ke,_=z[9],D+=_*Ne,S+=_*be,v+=_*Pe,A+=_*De,x+=_*ye,$+=_*Ie,ae+=_*Oe,R+=_*me,X+=_*Me,V+=_*Be,J+=_*we,K+=_*ke,E+=_*We,Y+=_*Ae,re+=_*Ve,le+=_*Ke,_=z[10],S+=_*Ne,v+=_*be,A+=_*Pe,x+=_*De,$+=_*ye,ae+=_*Ie,R+=_*Oe,X+=_*me,V+=_*Me,J+=_*Be,K+=_*we,E+=_*ke,Y+=_*We,re+=_*Ae,le+=_*Ve,he+=_*Ke,_=z[11],v+=_*Ne,A+=_*be,x+=_*Pe,$+=_*De,ae+=_*ye,R+=_*Ie,X+=_*Oe,V+=_*me,J+=_*Me,K+=_*Be,E+=_*we,Y+=_*ke,re+=_*We,le+=_*Ae,he+=_*Ve,ge+=_*Ke,_=z[12],A+=_*Ne,x+=_*be,$+=_*Pe,ae+=_*De,R+=_*ye,X+=_*Ie,V+=_*Oe,J+=_*me,K+=_*Me,E+=_*Be,Y+=_*we,re+=_*ke,le+=_*We,he+=_*Ae,ge+=_*Ve,He+=_*Ke,_=z[13],x+=_*Ne,$+=_*be,ae+=_*Pe,R+=_*De,X+=_*ye,V+=_*Ie,J+=_*Oe,K+=_*me,E+=_*Me,Y+=_*Be,re+=_*we,le+=_*ke,he+=_*We,ge+=_*Ae,He+=_*Ve,Te+=_*Ke,_=z[14],$+=_*Ne,ae+=_*be,R+=_*Pe,X+=_*De,V+=_*ye,J+=_*Ie,K+=_*Oe,E+=_*me,Y+=_*Me,re+=_*Be,le+=_*we,he+=_*ke,ge+=_*We,He+=_*Ae,Te+=_*Ve,Ce+=_*Ke,_=z[15],ae+=_*Ne,R+=_*be,X+=_*Pe,V+=_*De,J+=_*ye,K+=_*Ie,E+=_*Oe,Y+=_*me,re+=_*Me,le+=_*Be,he+=_*we,ge+=_*ke,He+=_*We,Te+=_*Ae,Ce+=_*Ve,Xe+=_*Ke,ee+=38*R,oe+=38*X,L+=38*V,b+=38*J,m+=38*K,l+=38*E,d+=38*Y,y+=38*re,P+=38*le,D+=38*he,S+=38*ge,v+=38*He,A+=38*Te,x+=38*Ce,$+=38*Xe,U=1,_=ee+U+65535,U=Math.floor(_/65536),ee=_-U*65536,_=oe+U+65535,U=Math.floor(_/65536),oe=_-U*65536,_=L+U+65535,U=Math.floor(_/65536),L=_-U*65536,_=b+U+65535,U=Math.floor(_/65536),b=_-U*65536,_=m+U+65535,U=Math.floor(_/65536),m=_-U*65536,_=l+U+65535,U=Math.floor(_/65536),l=_-U*65536,_=d+U+65535,U=Math.floor(_/65536),d=_-U*65536,_=y+U+65535,U=Math.floor(_/65536),y=_-U*65536,_=P+U+65535,U=Math.floor(_/65536),P=_-U*65536,_=D+U+65535,U=Math.floor(_/65536),D=_-U*65536,_=S+U+65535,U=Math.floor(_/65536),S=_-U*65536,_=v+U+65535,U=Math.floor(_/65536),v=_-U*65536,_=A+U+65535,U=Math.floor(_/65536),A=_-U*65536,_=x+U+65535,U=Math.floor(_/65536),x=_-U*65536,_=$+U+65535,U=Math.floor(_/65536),$=_-U*65536,_=ae+U+65535,U=Math.floor(_/65536),ae=_-U*65536,ee+=U-1+37*(U-1),U=1,_=ee+U+65535,U=Math.floor(_/65536),ee=_-U*65536,_=oe+U+65535,U=Math.floor(_/65536),oe=_-U*65536,_=L+U+65535,U=Math.floor(_/65536),L=_-U*65536,_=b+U+65535,U=Math.floor(_/65536),b=_-U*65536,_=m+U+65535,U=Math.floor(_/65536),m=_-U*65536,_=l+U+65535,U=Math.floor(_/65536),l=_-U*65536,_=d+U+65535,U=Math.floor(_/65536),d=_-U*65536,_=y+U+65535,U=Math.floor(_/65536),y=_-U*65536,_=P+U+65535,U=Math.floor(_/65536),P=_-U*65536,_=D+U+65535,U=Math.floor(_/65536),D=_-U*65536,_=S+U+65535,U=Math.floor(_/65536),S=_-U*65536,_=v+U+65535,U=Math.floor(_/65536),v=_-U*65536,_=A+U+65535,U=Math.floor(_/65536),A=_-U*65536,_=x+U+65535,U=Math.floor(_/65536),x=_-U*65536,_=$+U+65535,U=Math.floor(_/65536),$=_-U*65536,_=ae+U+65535,U=Math.floor(_/65536),ae=_-U*65536,ee+=U-1+37*(U-1),B[0]=ee,B[1]=oe,B[2]=L,B[3]=b,B[4]=m,B[5]=l,B[6]=d,B[7]=y,B[8]=P,B[9]=D,B[10]=S,B[11]=v,B[12]=A,B[13]=x,B[14]=$,B[15]=ae}function C(B,z){M(B,z,z)}function O(B,z){const W=i();for(let _=0;_<16;_++)W[_]=z[_];for(let _=253;_>=0;_--)C(W,W),_!==2&&_!==4&&M(W,W,z);for(let _=0;_<16;_++)B[_]=W[_]}function N(B,z){const W=new Uint8Array(32),_=new Float64Array(80),U=i(),ee=i(),oe=i(),L=i(),b=i(),m=i();for(let P=0;P<31;P++)W[P]=B[P];W[31]=B[31]&127|64,W[0]&=248,u(_,z);for(let P=0;P<16;P++)ee[P]=_[P];U[0]=L[0]=1;for(let P=254;P>=0;--P){const D=W[P>>>3]>>>(P&7)&1;f(U,ee,D),f(oe,L,D),g(b,U,oe),w(U,U,oe),g(oe,ee,L),w(ee,ee,L),C(L,b),C(m,U),M(U,oe,U),M(oe,ee,b),g(b,U,oe),w(U,U,oe),C(ee,U),w(oe,L,m),M(U,oe,s),g(U,U,L),M(oe,oe,U),M(U,L,m),M(L,ee,_),C(ee,b),f(U,ee,D),f(oe,L,D)}for(let P=0;P<16;P++)_[P+16]=U[P],_[P+32]=oe[P],_[P+48]=ee[P],_[P+64]=L[P];const l=_.subarray(32),d=_.subarray(16);O(l,l),M(d,d,l);const y=new Uint8Array(32);return h(y,d),y}r.scalarMult=N;function j(B){return N(B,n)}r.scalarMultBase=j;function H(B){if(B.length!==r.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${r.SECRET_KEY_LENGTH} bytes`);const z=new Uint8Array(B);return{publicKey:j(z),secretKey:z}}r.generateKeyPairFromSeed=H;function F(B){const z=(0,e.randomBytes)(32,B),W=H(z);return(0,t.wipe)(z),W}r.generateKeyPair=F;function G(B,z,W=!1){if(B.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(z.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const _=N(B,z);if(W){let U=0;for(let ee=0;ee<_.length;ee++)U|=_[ee];if(U===0)throw new Error("X25519: invalid shared key")}return _}r.sharedKey=G})(Od);function Yv(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function Rd(r,e){e||(e=r.reduce((n,s)=>n+s.length,0));const t=Yv(e);let i=0;for(const n of r)t.set(n,i),i+=n.length;return t}function y7(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i<t.length;i++)t[i]=255;for(var n=0;n<r.length;n++){var s=r.charAt(n),a=s.charCodeAt(0);if(t[a]!==255)throw new TypeError(s+" is ambiguous");t[a]=n}var f=r.length,h=r.charAt(0),u=Math.log(f)/Math.log(256),g=Math.log(256)/Math.log(f);function w(O){if(O instanceof Uint8Array||(ArrayBuffer.isView(O)?O=new Uint8Array(O.buffer,O.byteOffset,O.byteLength):Array.isArray(O)&&(O=Uint8Array.from(O))),!(O instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(O.length===0)return"";for(var N=0,j=0,H=0,F=O.length;H!==F&&O[H]===0;)H++,N++;for(var G=(F-H)*g+1>>>0,B=new Uint8Array(G);H!==F;){for(var z=O[H],W=0,_=G-1;(z!==0||W<j)&&_!==-1;_--,W++)z+=256*B[_]>>>0,B[_]=z%f>>>0,z=z/f>>>0;if(z!==0)throw new Error("Non-zero carry");j=W,H++}for(var U=G-j;U!==G&&B[U]===0;)U++;for(var ee=h.repeat(N);U<G;++U)ee+=r.charAt(B[U]);return ee}function M(O){if(typeof O!="string")throw new TypeError("Expected String");if(O.length===0)return new Uint8Array;var N=0;if(O[N]!==" "){for(var j=0,H=0;O[N]===h;)j++,N++;for(var F=(O.length-N)*u+1>>>0,G=new Uint8Array(F);O[N];){var B=t[O.charCodeAt(N)];if(B===255)return;for(var z=0,W=F-1;(B!==0||z<H)&&W!==-1;W--,z++)B+=f*G[W]>>>0,G[W]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");H=z,N++}if(O[N]!==" "){for(var _=F-H;_!==F&&G[_]===0;)_++;for(var U=new Uint8Array(j+(F-_)),ee=j;_!==F;)U[ee++]=G[_++];return U}}}function C(O){var N=M(O);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:M,decode:C}}var _7=y7,x7=_7;const Jv=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},A7=r=>new TextEncoder().encode(r),E7=r=>new TextDecoder().decode(r);class S7{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class I7{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Qv(this,e)}}class M7{constructor(e){this.decoders=e}or(e){return Qv(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Qv=(r,e)=>new M7({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});class C7{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new S7(e,t,i),this.decoder=new I7(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Al=({name:r,prefix:e,encode:t,decode:i})=>new C7(r,e,t,i),Hc=({prefix:r,name:e,alphabet:t})=>{const{encode:i,decode:n}=x7(t,e);return Al({prefix:r,name:e,encode:i,decode:s=>Jv(n(s))})},P7=(r,e,t,i)=>{const n={};for(let g=0;g<e.length;++g)n[e[g]]=g;let s=r.length;for(;r[s-1]==="=";)--s;const a=new Uint8Array(s*t/8|0);let f=0,h=0,u=0;for(let g=0;g<s;++g){const w=n[r[g]];if(w===void 0)throw new SyntaxError(`Non-${i} character`);h=h<<t|w,f+=t,f>=8&&(f-=8,a[u++]=255&h>>f)}if(f>=t||255&h<<8-f)throw new SyntaxError("Unexpected end of data");return a},D7=(r,e,t)=>{const i=e[e.length-1]==="=",n=(1<<t)-1;let s="",a=0,f=0;for(let h=0;h<r.length;++h)for(f=f<<8|r[h],a+=8;a>t;)a-=t,s+=e[n&f>>a];if(a&&(s+=e[n&f<<t-a]),i)for(;s.length*t&7;)s+="=";return s},jr=({name:r,prefix:e,bitsPerChar:t,alphabet:i})=>Al({prefix:e,name:r,encode(n){return D7(n,i,t)},decode(n){return P7(n,i,t,r)}}),O7=Al({prefix:"\0",name:"identity",encode:r=>E7(r),decode:r=>A7(r)});var R7=Object.freeze({__proto__:null,identity:O7});const T7=jr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var N7=Object.freeze({__proto__:null,base2:T7});const $7=jr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var L7=Object.freeze({__proto__:null,base8:$7});const B7=Hc({prefix:"9",name:"base10",alphabet:"0123456789"});var F7=Object.freeze({__proto__:null,base10:B7});const U7=jr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),q7=jr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var z7=Object.freeze({__proto__:null,base16:U7,base16upper:q7});const H7=jr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),k7=jr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),j7=jr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),W7=jr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),K7=jr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),V7=jr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),G7=jr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Y7=jr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),J7=jr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Q7=Object.freeze({__proto__:null,base32:H7,base32upper:k7,base32pad:j7,base32padupper:W7,base32hex:K7,base32hexupper:V7,base32hexpad:G7,base32hexpadupper:Y7,base32z:J7});const Z7=Hc({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),X7=Hc({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var e9=Object.freeze({__proto__:null,base36:Z7,base36upper:X7});const t9=Hc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),r9=Hc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var i9=Object.freeze({__proto__:null,base58btc:t9,base58flickr:r9});const n9=jr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),s9=jr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),o9=jr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),a9=jr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var c9=Object.freeze({__proto__:null,base64:n9,base64pad:s9,base64url:o9,base64urlpad:a9});const Zv=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}"),f9=Zv.reduce((r,e,t)=>(r[t]=e,r),[]),l9=Zv.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function h9(r){return r.reduce((e,t)=>(e+=f9[t],e),"")}function u9(r){const e=[];for(const t of r){const i=l9[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const d9=Al({prefix:"\u{1F680}",name:"base256emoji",encode:h9,decode:u9});var p9=Object.freeze({__proto__:null,base256emoji:d9}),g9=em,Xv=128,v9=127,m9=~v9,b9=Math.pow(2,31);function em(r,e,t){e=e||[],t=t||0;for(var i=t;r>=b9;)e[t++]=r&255|Xv,r/=128;for(;r&m9;)e[t++]=r&255|Xv,r>>>=7;return e[t]=r|0,em.bytes=t-i+1,e}var w9=Td,y9=128,tm=127;function Td(r,i){var t=0,i=i||0,n=0,s=i,a,f=r.length;do{if(s>=f)throw Td.bytes=0,new RangeError("Could not decode varint");a=r[s++],t+=n<28?(a&tm)<<n:(a&tm)*Math.pow(2,n),n+=7}while(a>=y9);return Td.bytes=s-i,t}var _9=Math.pow(2,7),x9=Math.pow(2,14),A9=Math.pow(2,21),E9=Math.pow(2,28),S9=Math.pow(2,35),I9=Math.pow(2,42),M9=Math.pow(2,49),C9=Math.pow(2,56),P9=Math.pow(2,63),D9=function(r){return r<_9?1:r<x9?2:r<A9?3:r<E9?4:r<S9?5:r<I9?6:r<M9?7:r<C9?8:r<P9?9:10},O9={encode:g9,decode:w9,encodingLength:D9},rm=O9;const im=(r,e,t=0)=>(rm.encode(r,e,t),e),nm=r=>rm.encodingLength(r),Nd=(r,e)=>{const t=e.byteLength,i=nm(r),n=i+nm(t),s=new Uint8Array(n+t);return im(r,s,0),im(t,s,i),s.set(e,n),new R9(r,t,e,s)};class R9{constructor(e,t,i,n){this.code=e,this.size=t,this.digest=i,this.bytes=n}}const sm=({name:r,code:e,encode:t})=>new T9(r,e,t);class T9{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Nd(this.code,t):t.then(i=>Nd(this.code,i))}else throw Error("Unknown type, must be binary type")}}const om=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),N9=sm({name:"sha2-256",code:18,encode:om("SHA-256")}),$9=sm({name:"sha2-512",code:19,encode:om("SHA-512")});var L9=Object.freeze({__proto__:null,sha256:N9,sha512:$9});const am=0,B9="identity",cm=Jv;var F9=Object.freeze({__proto__:null,identity:{code:am,name:B9,encode:cm,digest:r=>Nd(am,cm(r))}});new TextEncoder,new TextDecoder;const Ta={...R7,...N7,...L7,...F7,...z7,...Q7,...e9,...i9,...c9,...p9};({...L9,...F9});function fm(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const lm=fm("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),$d=fm("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=Yv(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),hm={utf8:lm,"utf-8":lm,hex:Ta.base16,latin1:$d,ascii:$d,binary:$d,...Ta};function Zi(r,e="utf8"){const t=hm[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):t.decoder.decode(`${t.prefix}${r}`)}function $i(r,e="utf8"){const t=hm[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}var um={},U9="elliptic",q9="6.6.1",z9="EC cryptography",H9="lib/elliptic.js",k9=["lib"],j9={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},W9={type:"git",url:"git@github.com:indutny/elliptic"},K9=["EC","Elliptic","curve","Cryptography"],V9="Fedor Indutny <fedor@indutny.com>",G9="MIT",Y9={url:"https://github.com/indutny/elliptic/issues"},J9="https://github.com/indutny/elliptic",Q9={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},Z9={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},X9={name:U9,version:q9,description:z9,main:H9,files:k9,scripts:j9,repository:W9,keywords:K9,author:V9,license:G9,bugs:Y9,homepage:J9,devDependencies:Q9,dependencies:Z9},Li={},Jn={exports:{}};(function(r){(function(e,t){function i(L,b){if(!L)throw new Error(b||"Assertion failed")}function n(L,b){L.super_=b;var m=function(){};m.prototype=b.prototype,L.prototype=new m,L.prototype.constructor=L}function s(L,b,m){if(s.isBN(L))return L;this.negative=0,this.words=null,this.length=0,this.red=null,L!==null&&((b==="le"||b==="be")&&(m=b,b=10),this._init(L||0,b||10,m||"be"))}typeof e=="object"?e.exports=s:t.BN=s,s.BN=s,s.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=nl.Buffer}catch{}s.isBN=function(b){return b instanceof s?!0:b!==null&&typeof b=="object"&&b.constructor.wordSize===s.wordSize&&Array.isArray(b.words)},s.max=function(b,m){return b.cmp(m)>0?b:m},s.min=function(b,m){return b.cmp(m)<0?b:m},s.prototype._init=function(b,m,l){if(typeof b=="number")return this._initNumber(b,m,l);if(typeof b=="object")return this._initArray(b,m,l);m==="hex"&&(m=16),i(m===(m|0)&&m>=2&&m<=36),b=b.toString().replace(/\s+/g,"");var d=0;b[0]==="-"&&(d++,this.negative=1),d<b.length&&(m===16?this._parseHex(b,d,l):(this._parseBase(b,m,d),l==="le"&&this._initArray(this.toArray(),m,l)))},s.prototype._initNumber=function(b,m,l){b<0&&(this.negative=1,b=-b),b<67108864?(this.words=[b&67108863],this.length=1):b<4503599627370496?(this.words=[b&67108863,b/67108864&67108863],this.length=2):(i(b<9007199254740992),this.words=[b&67108863,b/67108864&67108863,1],this.length=3),l==="le"&&this._initArray(this.toArray(),m,l)},s.prototype._initArray=function(b,m,l){if(i(typeof b.length=="number"),b.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(b.length/3),this.words=new Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var y,P,D=0;if(l==="be")for(d=b.length-1,y=0;d>=0;d-=3)P=b[d]|b[d-1]<<8|b[d-2]<<16,this.words[y]|=P<<D&67108863,this.words[y+1]=P>>>26-D&67108863,D+=24,D>=26&&(D-=26,y++);else if(l==="le")for(d=0,y=0;d<b.length;d+=3)P=b[d]|b[d+1]<<8|b[d+2]<<16,this.words[y]|=P<<D&67108863,this.words[y+1]=P>>>26-D&67108863,D+=24,D>=26&&(D-=26,y++);return this.strip()};function f(L,b){var m=L.charCodeAt(b);return m>=65&&m<=70?m-55:m>=97&&m<=102?m-87:m-48&15}function h(L,b,m){var l=f(L,m);return m-1>=b&&(l|=f(L,m-1)<<4),l}s.prototype._parseHex=function(b,m,l){this.length=Math.ceil((b.length-m)/6),this.words=new Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var y=0,P=0,D;if(l==="be")for(d=b.length-1;d>=m;d-=2)D=h(b,m,d)<<y,this.words[P]|=D&67108863,y>=18?(y-=18,P+=1,this.words[P]|=D>>>26):y+=8;else{var S=b.length-m;for(d=S%2===0?m+1:m;d<b.length;d+=2)D=h(b,m,d)<<y,this.words[P]|=D&67108863,y>=18?(y-=18,P+=1,this.words[P]|=D>>>26):y+=8}this.strip()};function u(L,b,m,l){for(var d=0,y=Math.min(L.length,m),P=b;P<y;P++){var D=L.charCodeAt(P)-48;d*=l,D>=49?d+=D-49+10:D>=17?d+=D-17+10:d+=D}return d}s.prototype._parseBase=function(b,m,l){this.words=[0],this.length=1;for(var d=0,y=1;y<=67108863;y*=m)d++;d--,y=y/m|0;for(var P=b.length-l,D=P%d,S=Math.min(P,P-D)+l,v=0,A=l;A<S;A+=d)v=u(b,A,A+d,m),this.imuln(y),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v);if(D!==0){var x=1;for(v=u(b,A,b.length,m),A=0;A<D;A++)x*=m;this.imuln(x),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v)}this.strip()},s.prototype.copy=function(b){b.words=new Array(this.length);for(var m=0;m<this.length;m++)b.words[m]=this.words[m];b.length=this.length,b.negative=this.negative,b.red=this.red},s.prototype.clone=function(){var b=new s(null);return this.copy(b),b},s.prototype._expand=function(b){for(;this.length<b;)this.words[this.length++]=0;return this},s.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var g=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],w=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(b,m){b=b||10,m=m|0||1;var l;if(b===16||b==="hex"){l="";for(var d=0,y=0,P=0;P<this.length;P++){var D=this.words[P],S=((D<<d|y)&16777215).toString(16);y=D>>>24-d&16777215,d+=2,d>=26&&(d-=26,P--),y!==0||P!==this.length-1?l=g[6-S.length]+S+l:l=S+l}for(y!==0&&(l=y.toString(16)+l);l.length%m!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}if(b===(b|0)&&b>=2&&b<=36){var v=w[b],A=M[b];l="";var x=this.clone();for(x.negative=0;!x.isZero();){var $=x.modn(A).toString(b);x=x.idivn(A),x.isZero()?l=$+l:l=g[v-$.length]+$+l}for(this.isZero()&&(l="0"+l);l.length%m!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var b=this.words[0];return this.length===2?b+=this.words[1]*67108864:this.length===3&&this.words[2]===1?b+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-b:b},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(b,m){return i(typeof a<"u"),this.toArrayLike(a,b,m)},s.prototype.toArray=function(b,m){return this.toArrayLike(Array,b,m)},s.prototype.toArrayLike=function(b,m,l){var d=this.byteLength(),y=l||Math.max(1,d);i(d<=y,"byte array longer than desired length"),i(y>0,"Requested array length <= 0"),this.strip();var P=m==="le",D=new b(y),S,v,A=this.clone();if(P){for(v=0;!A.isZero();v++)S=A.andln(255),A.iushrn(8),D[v]=S;for(;v<y;v++)D[v]=0}else{for(v=0;v<y-d;v++)D[v]=0;for(v=0;!A.isZero();v++)S=A.andln(255),A.iushrn(8),D[y-v-1]=S}return D},Math.clz32?s.prototype._countBits=function(b){return 32-Math.clz32(b)}:s.prototype._countBits=function(b){var m=b,l=0;return m>=4096&&(l+=13,m>>>=13),m>=64&&(l+=7,m>>>=7),m>=8&&(l+=4,m>>>=4),m>=2&&(l+=2,m>>>=2),l+m},s.prototype._zeroBits=function(b){if(b===0)return 26;var m=b,l=0;return m&8191||(l+=13,m>>>=13),m&127||(l+=7,m>>>=7),m&15||(l+=4,m>>>=4),m&3||(l+=2,m>>>=2),m&1||l++,l},s.prototype.bitLength=function(){var b=this.words[this.length-1],m=this._countBits(b);return(this.length-1)*26+m};function C(L){for(var b=new Array(L.bitLength()),m=0;m<b.length;m++){var l=m/26|0,d=m%26;b[m]=(L.words[l]&1<<d)>>>d}return b}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var b=0,m=0;m<this.length;m++){var l=this._zeroBits(this.words[m]);if(b+=l,l!==26)break}return b},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(b){return this.negative!==0?this.abs().inotn(b).iaddn(1):this.clone()},s.prototype.fromTwos=function(b){return this.testn(b-1)?this.notn(b).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(b){for(;this.length<b.length;)this.words[this.length++]=0;for(var m=0;m<b.length;m++)this.words[m]=this.words[m]|b.words[m];return this.strip()},s.prototype.ior=function(b){return i((this.negative|b.negative)===0),this.iuor(b)},s.prototype.or=function(b){return this.length>b.length?this.clone().ior(b):b.clone().ior(this)},s.prototype.uor=function(b){return this.length>b.length?this.clone().iuor(b):b.clone().iuor(this)},s.prototype.iuand=function(b){var m;this.length>b.length?m=b:m=this;for(var l=0;l<m.length;l++)this.words[l]=this.words[l]&b.words[l];return this.length=m.length,this.strip()},s.prototype.iand=function(b){return i((this.negative|b.negative)===0),this.iuand(b)},s.prototype.and=function(b){return this.length>b.length?this.clone().iand(b):b.clone().iand(this)},s.prototype.uand=function(b){return this.length>b.length?this.clone().iuand(b):b.clone().iuand(this)},s.prototype.iuxor=function(b){var m,l;this.length>b.length?(m=this,l=b):(m=b,l=this);for(var d=0;d<l.length;d++)this.words[d]=m.words[d]^l.words[d];if(this!==m)for(;d<m.length;d++)this.words[d]=m.words[d];return this.length=m.length,this.strip()},s.prototype.ixor=function(b){return i((this.negative|b.negative)===0),this.iuxor(b)},s.prototype.xor=function(b){return this.length>b.length?this.clone().ixor(b):b.clone().ixor(this)},s.prototype.uxor=function(b){return this.length>b.length?this.clone().iuxor(b):b.clone().iuxor(this)},s.prototype.inotn=function(b){i(typeof b=="number"&&b>=0);var m=Math.ceil(b/26)|0,l=b%26;this._expand(m),l>0&&m--;for(var d=0;d<m;d++)this.words[d]=~this.words[d]&67108863;return l>0&&(this.words[d]=~this.words[d]&67108863>>26-l),this.strip()},s.prototype.notn=function(b){return this.clone().inotn(b)},s.prototype.setn=function(b,m){i(typeof b=="number"&&b>=0);var l=b/26|0,d=b%26;return this._expand(l+1),m?this.words[l]=this.words[l]|1<<d:this.words[l]=this.words[l]&~(1<<d),this.strip()},s.prototype.iadd=function(b){var m;if(this.negative!==0&&b.negative===0)return this.negative=0,m=this.isub(b),this.negative^=1,this._normSign();if(this.negative===0&&b.negative!==0)return b.negative=0,m=this.isub(b),b.negative=1,m._normSign();var l,d;this.length>b.length?(l=this,d=b):(l=b,d=this);for(var y=0,P=0;P<d.length;P++)m=(l.words[P]|0)+(d.words[P]|0)+y,this.words[P]=m&67108863,y=m>>>26;for(;y!==0&&P<l.length;P++)m=(l.words[P]|0)+y,this.words[P]=m&67108863,y=m>>>26;if(this.length=l.length,y!==0)this.words[this.length]=y,this.length++;else if(l!==this)for(;P<l.length;P++)this.words[P]=l.words[P];return this},s.prototype.add=function(b){var m;return b.negative!==0&&this.negative===0?(b.negative=0,m=this.sub(b),b.negative^=1,m):b.negative===0&&this.negative!==0?(this.negative=0,m=b.sub(this),this.negative=1,m):this.length>b.length?this.clone().iadd(b):b.clone().iadd(this)},s.prototype.isub=function(b){if(b.negative!==0){b.negative=0;var m=this.iadd(b);return b.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(b),this.negative=1,this._normSign();var l=this.cmp(b);if(l===0)return this.negative=0,this.length=1,this.words[0]=0,this;var d,y;l>0?(d=this,y=b):(d=b,y=this);for(var P=0,D=0;D<y.length;D++)m=(d.words[D]|0)-(y.words[D]|0)+P,P=m>>26,this.words[D]=m&67108863;for(;P!==0&&D<d.length;D++)m=(d.words[D]|0)+P,P=m>>26,this.words[D]=m&67108863;if(P===0&&D<d.length&&d!==this)for(;D<d.length;D++)this.words[D]=d.words[D];return this.length=Math.max(this.length,D),d!==this&&(this.negative=1),this.strip()},s.prototype.sub=function(b){return this.clone().isub(b)};function O(L,b,m){m.negative=b.negative^L.negative;var l=L.length+b.length|0;m.length=l,l=l-1|0;var d=L.words[0]|0,y=b.words[0]|0,P=d*y,D=P&67108863,S=P/67108864|0;m.words[0]=D;for(var v=1;v<l;v++){for(var A=S>>>26,x=S&67108863,$=Math.min(v,b.length-1),ae=Math.max(0,v-L.length+1);ae<=$;ae++){var R=v-ae|0;d=L.words[R]|0,y=b.words[ae]|0,P=d*y+x,A+=P/67108864|0,x=P&67108863}m.words[v]=x|0,S=A|0}return S!==0?m.words[v]=S|0:m.length--,m.strip()}var N=function(b,m,l){var d=b.words,y=m.words,P=l.words,D=0,S,v,A,x=d[0]|0,$=x&8191,ae=x>>>13,R=d[1]|0,X=R&8191,V=R>>>13,J=d[2]|0,K=J&8191,E=J>>>13,Y=d[3]|0,re=Y&8191,le=Y>>>13,he=d[4]|0,ge=he&8191,He=he>>>13,Te=d[5]|0,Ce=Te&8191,Xe=Te>>>13,Ne=d[6]|0,be=Ne&8191,Pe=Ne>>>13,De=d[7]|0,ye=De&8191,Ie=De>>>13,Oe=d[8]|0,me=Oe&8191,Me=Oe>>>13,Be=d[9]|0,we=Be&8191,ke=Be>>>13,We=y[0]|0,Ae=We&8191,Ve=We>>>13,Ke=y[1]|0,Ge=Ke&8191,mt=Ke>>>13,It=y[2]|0,Ye=It&8191,Pt=It>>>13,Ot=y[3]|0,Ze=Ot&8191,rt=Ot>>>13,et=y[4]|0,$e=et&8191,it=et>>>13,tt=y[5]|0,Re=tt&8191,lt=tt>>>13,ht=y[6]|0,Le=ht&8191,ut=ht>>>13,nt=y[7]|0,Fe=nt&8191,st=nt>>>13,Qe=y[8]|0,qe=Qe&8191,dt=Qe>>>13,Ht=y[9]|0,at=Ht&8191,kt=Ht>>>13;l.negative=b.negative^m.negative,l.length=19,S=Math.imul($,Ae),v=Math.imul($,Ve),v=v+Math.imul(ae,Ae)|0,A=Math.imul(ae,Ve);var _t=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(_t>>>26)|0,_t&=67108863,S=Math.imul(X,Ae),v=Math.imul(X,Ve),v=v+Math.imul(V,Ae)|0,A=Math.imul(V,Ve),S=S+Math.imul($,Ge)|0,v=v+Math.imul($,mt)|0,v=v+Math.imul(ae,Ge)|0,A=A+Math.imul(ae,mt)|0;var qt=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(qt>>>26)|0,qt&=67108863,S=Math.imul(K,Ae),v=Math.imul(K,Ve),v=v+Math.imul(E,Ae)|0,A=Math.imul(E,Ve),S=S+Math.imul(X,Ge)|0,v=v+Math.imul(X,mt)|0,v=v+Math.imul(V,Ge)|0,A=A+Math.imul(V,mt)|0,S=S+Math.imul($,Ye)|0,v=v+Math.imul($,Pt)|0,v=v+Math.imul(ae,Ye)|0,A=A+Math.imul(ae,Pt)|0;var Zr=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,S=Math.imul(re,Ae),v=Math.imul(re,Ve),v=v+Math.imul(le,Ae)|0,A=Math.imul(le,Ve),S=S+Math.imul(K,Ge)|0,v=v+Math.imul(K,mt)|0,v=v+Math.imul(E,Ge)|0,A=A+Math.imul(E,mt)|0,S=S+Math.imul(X,Ye)|0,v=v+Math.imul(X,Pt)|0,v=v+Math.imul(V,Ye)|0,A=A+Math.imul(V,Pt)|0,S=S+Math.imul($,Ze)|0,v=v+Math.imul($,rt)|0,v=v+Math.imul(ae,Ze)|0,A=A+Math.imul(ae,rt)|0;var Xr=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,S=Math.imul(ge,Ae),v=Math.imul(ge,Ve),v=v+Math.imul(He,Ae)|0,A=Math.imul(He,Ve),S=S+Math.imul(re,Ge)|0,v=v+Math.imul(re,mt)|0,v=v+Math.imul(le,Ge)|0,A=A+Math.imul(le,mt)|0,S=S+Math.imul(K,Ye)|0,v=v+Math.imul(K,Pt)|0,v=v+Math.imul(E,Ye)|0,A=A+Math.imul(E,Pt)|0,S=S+Math.imul(X,Ze)|0,v=v+Math.imul(X,rt)|0,v=v+Math.imul(V,Ze)|0,A=A+Math.imul(V,rt)|0,S=S+Math.imul($,$e)|0,v=v+Math.imul($,it)|0,v=v+Math.imul(ae,$e)|0,A=A+Math.imul(ae,it)|0;var ei=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(ei>>>26)|0,ei&=67108863,S=Math.imul(Ce,Ae),v=Math.imul(Ce,Ve),v=v+Math.imul(Xe,Ae)|0,A=Math.imul(Xe,Ve),S=S+Math.imul(ge,Ge)|0,v=v+Math.imul(ge,mt)|0,v=v+Math.imul(He,Ge)|0,A=A+Math.imul(He,mt)|0,S=S+Math.imul(re,Ye)|0,v=v+Math.imul(re,Pt)|0,v=v+Math.imul(le,Ye)|0,A=A+Math.imul(le,Pt)|0,S=S+Math.imul(K,Ze)|0,v=v+Math.imul(K,rt)|0,v=v+Math.imul(E,Ze)|0,A=A+Math.imul(E,rt)|0,S=S+Math.imul(X,$e)|0,v=v+Math.imul(X,it)|0,v=v+Math.imul(V,$e)|0,A=A+Math.imul(V,it)|0,S=S+Math.imul($,Re)|0,v=v+Math.imul($,lt)|0,v=v+Math.imul(ae,Re)|0,A=A+Math.imul(ae,lt)|0;var ti=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(ti>>>26)|0,ti&=67108863,S=Math.imul(be,Ae),v=Math.imul(be,Ve),v=v+Math.imul(Pe,Ae)|0,A=Math.imul(Pe,Ve),S=S+Math.imul(Ce,Ge)|0,v=v+Math.imul(Ce,mt)|0,v=v+Math.imul(Xe,Ge)|0,A=A+Math.imul(Xe,mt)|0,S=S+Math.imul(ge,Ye)|0,v=v+Math.imul(ge,Pt)|0,v=v+Math.imul(He,Ye)|0,A=A+Math.imul(He,Pt)|0,S=S+Math.imul(re,Ze)|0,v=v+Math.imul(re,rt)|0,v=v+Math.imul(le,Ze)|0,A=A+Math.imul(le,rt)|0,S=S+Math.imul(K,$e)|0,v=v+Math.imul(K,it)|0,v=v+Math.imul(E,$e)|0,A=A+Math.imul(E,it)|0,S=S+Math.imul(X,Re)|0,v=v+Math.imul(X,lt)|0,v=v+Math.imul(V,Re)|0,A=A+Math.imul(V,lt)|0,S=S+Math.imul($,Le)|0,v=v+Math.imul($,ut)|0,v=v+Math.imul(ae,Le)|0,A=A+Math.imul(ae,ut)|0;var vr=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(vr>>>26)|0,vr&=67108863,S=Math.imul(ye,Ae),v=Math.imul(ye,Ve),v=v+Math.imul(Ie,Ae)|0,A=Math.imul(Ie,Ve),S=S+Math.imul(be,Ge)|0,v=v+Math.imul(be,mt)|0,v=v+Math.imul(Pe,Ge)|0,A=A+Math.imul(Pe,mt)|0,S=S+Math.imul(Ce,Ye)|0,v=v+Math.imul(Ce,Pt)|0,v=v+Math.imul(Xe,Ye)|0,A=A+Math.imul(Xe,Pt)|0,S=S+Math.imul(ge,Ze)|0,v=v+Math.imul(ge,rt)|0,v=v+Math.imul(He,Ze)|0,A=A+Math.imul(He,rt)|0,S=S+Math.imul(re,$e)|0,v=v+Math.imul(re,it)|0,v=v+Math.imul(le,$e)|0,A=A+Math.imul(le,it)|0,S=S+Math.imul(K,Re)|0,v=v+Math.imul(K,lt)|0,v=v+Math.imul(E,Re)|0,A=A+Math.imul(E,lt)|0,S=S+Math.imul(X,Le)|0,v=v+Math.imul(X,ut)|0,v=v+Math.imul(V,Le)|0,A=A+Math.imul(V,ut)|0,S=S+Math.imul($,Fe)|0,v=v+Math.imul($,st)|0,v=v+Math.imul(ae,Fe)|0,A=A+Math.imul(ae,st)|0;var Ai=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Ai>>>26)|0,Ai&=67108863,S=Math.imul(me,Ae),v=Math.imul(me,Ve),v=v+Math.imul(Me,Ae)|0,A=Math.imul(Me,Ve),S=S+Math.imul(ye,Ge)|0,v=v+Math.imul(ye,mt)|0,v=v+Math.imul(Ie,Ge)|0,A=A+Math.imul(Ie,mt)|0,S=S+Math.imul(be,Ye)|0,v=v+Math.imul(be,Pt)|0,v=v+Math.imul(Pe,Ye)|0,A=A+Math.imul(Pe,Pt)|0,S=S+Math.imul(Ce,Ze)|0,v=v+Math.imul(Ce,rt)|0,v=v+Math.imul(Xe,Ze)|0,A=A+Math.imul(Xe,rt)|0,S=S+Math.imul(ge,$e)|0,v=v+Math.imul(ge,it)|0,v=v+Math.imul(He,$e)|0,A=A+Math.imul(He,it)|0,S=S+Math.imul(re,Re)|0,v=v+Math.imul(re,lt)|0,v=v+Math.imul(le,Re)|0,A=A+Math.imul(le,lt)|0,S=S+Math.imul(K,Le)|0,v=v+Math.imul(K,ut)|0,v=v+Math.imul(E,Le)|0,A=A+Math.imul(E,ut)|0,S=S+Math.imul(X,Fe)|0,v=v+Math.imul(X,st)|0,v=v+Math.imul(V,Fe)|0,A=A+Math.imul(V,st)|0,S=S+Math.imul($,qe)|0,v=v+Math.imul($,dt)|0,v=v+Math.imul(ae,qe)|0,A=A+Math.imul(ae,dt)|0;var Pn=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,S=Math.imul(we,Ae),v=Math.imul(we,Ve),v=v+Math.imul(ke,Ae)|0,A=Math.imul(ke,Ve),S=S+Math.imul(me,Ge)|0,v=v+Math.imul(me,mt)|0,v=v+Math.imul(Me,Ge)|0,A=A+Math.imul(Me,mt)|0,S=S+Math.imul(ye,Ye)|0,v=v+Math.imul(ye,Pt)|0,v=v+Math.imul(Ie,Ye)|0,A=A+Math.imul(Ie,Pt)|0,S=S+Math.imul(be,Ze)|0,v=v+Math.imul(be,rt)|0,v=v+Math.imul(Pe,Ze)|0,A=A+Math.imul(Pe,rt)|0,S=S+Math.imul(Ce,$e)|0,v=v+Math.imul(Ce,it)|0,v=v+Math.imul(Xe,$e)|0,A=A+Math.imul(Xe,it)|0,S=S+Math.imul(ge,Re)|0,v=v+Math.imul(ge,lt)|0,v=v+Math.imul(He,Re)|0,A=A+Math.imul(He,lt)|0,S=S+Math.imul(re,Le)|0,v=v+Math.imul(re,ut)|0,v=v+Math.imul(le,Le)|0,A=A+Math.imul(le,ut)|0,S=S+Math.imul(K,Fe)|0,v=v+Math.imul(K,st)|0,v=v+Math.imul(E,Fe)|0,A=A+Math.imul(E,st)|0,S=S+Math.imul(X,qe)|0,v=v+Math.imul(X,dt)|0,v=v+Math.imul(V,qe)|0,A=A+Math.imul(V,dt)|0,S=S+Math.imul($,at)|0,v=v+Math.imul($,kt)|0,v=v+Math.imul(ae,at)|0,A=A+Math.imul(ae,kt)|0;var Ei=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Ei>>>26)|0,Ei&=67108863,S=Math.imul(we,Ge),v=Math.imul(we,mt),v=v+Math.imul(ke,Ge)|0,A=Math.imul(ke,mt),S=S+Math.imul(me,Ye)|0,v=v+Math.imul(me,Pt)|0,v=v+Math.imul(Me,Ye)|0,A=A+Math.imul(Me,Pt)|0,S=S+Math.imul(ye,Ze)|0,v=v+Math.imul(ye,rt)|0,v=v+Math.imul(Ie,Ze)|0,A=A+Math.imul(Ie,rt)|0,S=S+Math.imul(be,$e)|0,v=v+Math.imul(be,it)|0,v=v+Math.imul(Pe,$e)|0,A=A+Math.imul(Pe,it)|0,S=S+Math.imul(Ce,Re)|0,v=v+Math.imul(Ce,lt)|0,v=v+Math.imul(Xe,Re)|0,A=A+Math.imul(Xe,lt)|0,S=S+Math.imul(ge,Le)|0,v=v+Math.imul(ge,ut)|0,v=v+Math.imul(He,Le)|0,A=A+Math.imul(He,ut)|0,S=S+Math.imul(re,Fe)|0,v=v+Math.imul(re,st)|0,v=v+Math.imul(le,Fe)|0,A=A+Math.imul(le,st)|0,S=S+Math.imul(K,qe)|0,v=v+Math.imul(K,dt)|0,v=v+Math.imul(E,qe)|0,A=A+Math.imul(E,dt)|0,S=S+Math.imul(X,at)|0,v=v+Math.imul(X,kt)|0,v=v+Math.imul(V,at)|0,A=A+Math.imul(V,kt)|0;var Dn=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,S=Math.imul(we,Ye),v=Math.imul(we,Pt),v=v+Math.imul(ke,Ye)|0,A=Math.imul(ke,Pt),S=S+Math.imul(me,Ze)|0,v=v+Math.imul(me,rt)|0,v=v+Math.imul(Me,Ze)|0,A=A+Math.imul(Me,rt)|0,S=S+Math.imul(ye,$e)|0,v=v+Math.imul(ye,it)|0,v=v+Math.imul(Ie,$e)|0,A=A+Math.imul(Ie,it)|0,S=S+Math.imul(be,Re)|0,v=v+Math.imul(be,lt)|0,v=v+Math.imul(Pe,Re)|0,A=A+Math.imul(Pe,lt)|0,S=S+Math.imul(Ce,Le)|0,v=v+Math.imul(Ce,ut)|0,v=v+Math.imul(Xe,Le)|0,A=A+Math.imul(Xe,ut)|0,S=S+Math.imul(ge,Fe)|0,v=v+Math.imul(ge,st)|0,v=v+Math.imul(He,Fe)|0,A=A+Math.imul(He,st)|0,S=S+Math.imul(re,qe)|0,v=v+Math.imul(re,dt)|0,v=v+Math.imul(le,qe)|0,A=A+Math.imul(le,dt)|0,S=S+Math.imul(K,at)|0,v=v+Math.imul(K,kt)|0,v=v+Math.imul(E,at)|0,A=A+Math.imul(E,kt)|0;var On=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(On>>>26)|0,On&=67108863,S=Math.imul(we,Ze),v=Math.imul(we,rt),v=v+Math.imul(ke,Ze)|0,A=Math.imul(ke,rt),S=S+Math.imul(me,$e)|0,v=v+Math.imul(me,it)|0,v=v+Math.imul(Me,$e)|0,A=A+Math.imul(Me,it)|0,S=S+Math.imul(ye,Re)|0,v=v+Math.imul(ye,lt)|0,v=v+Math.imul(Ie,Re)|0,A=A+Math.imul(Ie,lt)|0,S=S+Math.imul(be,Le)|0,v=v+Math.imul(be,ut)|0,v=v+Math.imul(Pe,Le)|0,A=A+Math.imul(Pe,ut)|0,S=S+Math.imul(Ce,Fe)|0,v=v+Math.imul(Ce,st)|0,v=v+Math.imul(Xe,Fe)|0,A=A+Math.imul(Xe,st)|0,S=S+Math.imul(ge,qe)|0,v=v+Math.imul(ge,dt)|0,v=v+Math.imul(He,qe)|0,A=A+Math.imul(He,dt)|0,S=S+Math.imul(re,at)|0,v=v+Math.imul(re,kt)|0,v=v+Math.imul(le,at)|0,A=A+Math.imul(le,kt)|0;var Si=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Si>>>26)|0,Si&=67108863,S=Math.imul(we,$e),v=Math.imul(we,it),v=v+Math.imul(ke,$e)|0,A=Math.imul(ke,it),S=S+Math.imul(me,Re)|0,v=v+Math.imul(me,lt)|0,v=v+Math.imul(Me,Re)|0,A=A+Math.imul(Me,lt)|0,S=S+Math.imul(ye,Le)|0,v=v+Math.imul(ye,ut)|0,v=v+Math.imul(Ie,Le)|0,A=A+Math.imul(Ie,ut)|0,S=S+Math.imul(be,Fe)|0,v=v+Math.imul(be,st)|0,v=v+Math.imul(Pe,Fe)|0,A=A+Math.imul(Pe,st)|0,S=S+Math.imul(Ce,qe)|0,v=v+Math.imul(Ce,dt)|0,v=v+Math.imul(Xe,qe)|0,A=A+Math.imul(Xe,dt)|0,S=S+Math.imul(ge,at)|0,v=v+Math.imul(ge,kt)|0,v=v+Math.imul(He,at)|0,A=A+Math.imul(He,kt)|0;var fn=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(fn>>>26)|0,fn&=67108863,S=Math.imul(we,Re),v=Math.imul(we,lt),v=v+Math.imul(ke,Re)|0,A=Math.imul(ke,lt),S=S+Math.imul(me,Le)|0,v=v+Math.imul(me,ut)|0,v=v+Math.imul(Me,Le)|0,A=A+Math.imul(Me,ut)|0,S=S+Math.imul(ye,Fe)|0,v=v+Math.imul(ye,st)|0,v=v+Math.imul(Ie,Fe)|0,A=A+Math.imul(Ie,st)|0,S=S+Math.imul(be,qe)|0,v=v+Math.imul(be,dt)|0,v=v+Math.imul(Pe,qe)|0,A=A+Math.imul(Pe,dt)|0,S=S+Math.imul(Ce,at)|0,v=v+Math.imul(Ce,kt)|0,v=v+Math.imul(Xe,at)|0,A=A+Math.imul(Xe,kt)|0;var ln=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(ln>>>26)|0,ln&=67108863,S=Math.imul(we,Le),v=Math.imul(we,ut),v=v+Math.imul(ke,Le)|0,A=Math.imul(ke,ut),S=S+Math.imul(me,Fe)|0,v=v+Math.imul(me,st)|0,v=v+Math.imul(Me,Fe)|0,A=A+Math.imul(Me,st)|0,S=S+Math.imul(ye,qe)|0,v=v+Math.imul(ye,dt)|0,v=v+Math.imul(Ie,qe)|0,A=A+Math.imul(Ie,dt)|0,S=S+Math.imul(be,at)|0,v=v+Math.imul(be,kt)|0,v=v+Math.imul(Pe,at)|0,A=A+Math.imul(Pe,kt)|0;var Cr=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Cr>>>26)|0,Cr&=67108863,S=Math.imul(we,Fe),v=Math.imul(we,st),v=v+Math.imul(ke,Fe)|0,A=Math.imul(ke,st),S=S+Math.imul(me,qe)|0,v=v+Math.imul(me,dt)|0,v=v+Math.imul(Me,qe)|0,A=A+Math.imul(Me,dt)|0,S=S+Math.imul(ye,at)|0,v=v+Math.imul(ye,kt)|0,v=v+Math.imul(Ie,at)|0,A=A+Math.imul(Ie,kt)|0;var Rn=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,S=Math.imul(we,qe),v=Math.imul(we,dt),v=v+Math.imul(ke,qe)|0,A=Math.imul(ke,dt),S=S+Math.imul(me,at)|0,v=v+Math.imul(me,kt)|0,v=v+Math.imul(Me,at)|0,A=A+Math.imul(Me,kt)|0;var Tn=(D+S|0)+((v&8191)<<13)|0;D=(A+(v>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,S=Math.imul(we,at),v=Math.imul(we,kt),v=v+Math.imul(ke,at)|0,A=Math.imul(ke,kt);var Nn=(D+S|0)+((v&8191)<<13)|0;return D=(A+(v>>>13)|0)+(Nn>>>26)|0,Nn&=67108863,P[0]=_t,P[1]=qt,P[2]=Zr,P[3]=Xr,P[4]=ei,P[5]=ti,P[6]=vr,P[7]=Ai,P[8]=Pn,P[9]=Ei,P[10]=Dn,P[11]=On,P[12]=Si,P[13]=fn,P[14]=ln,P[15]=Cr,P[16]=Rn,P[17]=Tn,P[18]=Nn,D!==0&&(P[19]=D,l.length++),l};Math.imul||(N=O);function j(L,b,m){m.negative=b.negative^L.negative,m.length=L.length+b.length;for(var l=0,d=0,y=0;y<m.length-1;y++){var P=d;d=0;for(var D=l&67108863,S=Math.min(y,b.length-1),v=Math.max(0,y-L.length+1);v<=S;v++){var A=y-v,x=L.words[A]|0,$=b.words[v]|0,ae=x*$,R=ae&67108863;P=P+(ae/67108864|0)|0,R=R+D|0,D=R&67108863,P=P+(R>>>26)|0,d+=P>>>26,P&=67108863}m.words[y]=D,l=P,P=d}return l!==0?m.words[y]=l:m.length--,m.strip()}function H(L,b,m){var l=new F;return l.mulp(L,b,m)}s.prototype.mulTo=function(b,m){var l,d=this.length+b.length;return this.length===10&&b.length===10?l=N(this,b,m):d<63?l=O(this,b,m):d<1024?l=j(this,b,m):l=H(this,b,m),l};function F(L,b){this.x=L,this.y=b}F.prototype.makeRBT=function(b){for(var m=new Array(b),l=s.prototype._countBits(b)-1,d=0;d<b;d++)m[d]=this.revBin(d,l,b);return m},F.prototype.revBin=function(b,m,l){if(b===0||b===l-1)return b;for(var d=0,y=0;y<m;y++)d|=(b&1)<<m-y-1,b>>=1;return d},F.prototype.permute=function(b,m,l,d,y,P){for(var D=0;D<P;D++)d[D]=m[b[D]],y[D]=l[b[D]]},F.prototype.transform=function(b,m,l,d,y,P){this.permute(P,b,m,l,d,y);for(var D=1;D<y;D<<=1)for(var S=D<<1,v=Math.cos(2*Math.PI/S),A=Math.sin(2*Math.PI/S),x=0;x<y;x+=S)for(var $=v,ae=A,R=0;R<D;R++){var X=l[x+R],V=d[x+R],J=l[x+R+D],K=d[x+R+D],E=$*J-ae*K;K=$*K+ae*J,J=E,l[x+R]=X+J,d[x+R]=V+K,l[x+R+D]=X-J,d[x+R+D]=V-K,R!==S&&(E=v*$-A*ae,ae=v*ae+A*$,$=E)}},F.prototype.guessLen13b=function(b,m){var l=Math.max(m,b)|1,d=l&1,y=0;for(l=l/2|0;l;l=l>>>1)y++;return 1<<y+1+d},F.prototype.conjugate=function(b,m,l){if(!(l<=1))for(var d=0;d<l/2;d++){var y=b[d];b[d]=b[l-d-1],b[l-d-1]=y,y=m[d],m[d]=-m[l-d-1],m[l-d-1]=-y}},F.prototype.normalize13b=function(b,m){for(var l=0,d=0;d<m/2;d++){var y=Math.round(b[2*d+1]/m)*8192+Math.round(b[2*d]/m)+l;b[d]=y&67108863,y<67108864?l=0:l=y/67108864|0}return b},F.prototype.convert13b=function(b,m,l,d){for(var y=0,P=0;P<m;P++)y=y+(b[P]|0),l[2*P]=y&8191,y=y>>>13,l[2*P+1]=y&8191,y=y>>>13;for(P=2*m;P<d;++P)l[P]=0;i(y===0),i((y&-8192)===0)},F.prototype.stub=function(b){for(var m=new Array(b),l=0;l<b;l++)m[l]=0;return m},F.prototype.mulp=function(b,m,l){var d=2*this.guessLen13b(b.length,m.length),y=this.makeRBT(d),P=this.stub(d),D=new Array(d),S=new Array(d),v=new Array(d),A=new Array(d),x=new Array(d),$=new Array(d),ae=l.words;ae.length=d,this.convert13b(b.words,b.length,D,d),this.convert13b(m.words,m.length,A,d),this.transform(D,P,S,v,d,y),this.transform(A,P,x,$,d,y);for(var R=0;R<d;R++){var X=S[R]*x[R]-v[R]*$[R];v[R]=S[R]*$[R]+v[R]*x[R],S[R]=X}return this.conjugate(S,v,d),this.transform(S,v,ae,P,d,y),this.conjugate(ae,P,d),this.normalize13b(ae,d),l.negative=b.negative^m.negative,l.length=b.length+m.length,l.strip()},s.prototype.mul=function(b){var m=new s(null);return m.words=new Array(this.length+b.length),this.mulTo(b,m)},s.prototype.mulf=function(b){var m=new s(null);return m.words=new Array(this.length+b.length),H(this,b,m)},s.prototype.imul=function(b){return this.clone().mulTo(b,this)},s.prototype.imuln=function(b){i(typeof b=="number"),i(b<67108864);for(var m=0,l=0;l<this.length;l++){var d=(this.words[l]|0)*b,y=(d&67108863)+(m&67108863);m>>=26,m+=d/67108864|0,m+=y>>>26,this.words[l]=y&67108863}return m!==0&&(this.words[l]=m,this.length++),this},s.prototype.muln=function(b){return this.clone().imuln(b)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(b){var m=C(b);if(m.length===0)return new s(1);for(var l=this,d=0;d<m.length&&m[d]===0;d++,l=l.sqr());if(++d<m.length)for(var y=l.sqr();d<m.length;d++,y=y.sqr())m[d]!==0&&(l=l.mul(y));return l},s.prototype.iushln=function(b){i(typeof b=="number"&&b>=0);var m=b%26,l=(b-m)/26,d=67108863>>>26-m<<26-m,y;if(m!==0){var P=0;for(y=0;y<this.length;y++){var D=this.words[y]&d,S=(this.words[y]|0)-D<<m;this.words[y]=S|P,P=D>>>26-m}P&&(this.words[y]=P,this.length++)}if(l!==0){for(y=this.length-1;y>=0;y--)this.words[y+l]=this.words[y];for(y=0;y<l;y++)this.words[y]=0;this.length+=l}return this.strip()},s.prototype.ishln=function(b){return i(this.negative===0),this.iushln(b)},s.prototype.iushrn=function(b,m,l){i(typeof b=="number"&&b>=0);var d;m?d=(m-m%26)/26:d=0;var y=b%26,P=Math.min((b-y)/26,this.length),D=67108863^67108863>>>y<<y,S=l;if(d-=P,d=Math.max(0,d),S){for(var v=0;v<P;v++)S.words[v]=this.words[v];S.length=P}if(P!==0)if(this.length>P)for(this.length-=P,v=0;v<this.length;v++)this.words[v]=this.words[v+P];else this.words[0]=0,this.length=1;var A=0;for(v=this.length-1;v>=0&&(A!==0||v>=d);v--){var x=this.words[v]|0;this.words[v]=A<<26-y|x>>>y,A=x&D}return S&&A!==0&&(S.words[S.length++]=A),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(b,m,l){return i(this.negative===0),this.iushrn(b,m,l)},s.prototype.shln=function(b){return this.clone().ishln(b)},s.prototype.ushln=function(b){return this.clone().iushln(b)},s.prototype.shrn=function(b){return this.clone().ishrn(b)},s.prototype.ushrn=function(b){return this.clone().iushrn(b)},s.prototype.testn=function(b){i(typeof b=="number"&&b>=0);var m=b%26,l=(b-m)/26,d=1<<m;if(this.length<=l)return!1;var y=this.words[l];return!!(y&d)},s.prototype.imaskn=function(b){i(typeof b=="number"&&b>=0);var m=b%26,l=(b-m)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=l)return this;if(m!==0&&l++,this.length=Math.min(l,this.length),m!==0){var d=67108863^67108863>>>m<<m;this.words[this.length-1]&=d}return this.strip()},s.prototype.maskn=function(b){return this.clone().imaskn(b)},s.prototype.iaddn=function(b){return i(typeof b=="number"),i(b<67108864),b<0?this.isubn(-b):this.negative!==0?this.length===1&&(this.words[0]|0)<b?(this.words[0]=b-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(b),this.negative=1,this):this._iaddn(b)},s.prototype._iaddn=function(b){this.words[0]+=b;for(var m=0;m<this.length&&this.words[m]>=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},s.prototype.isubn=function(b){if(i(typeof b=="number"),i(b<67108864),b<0)return this.iaddn(-b);if(this.negative!==0)return this.negative=0,this.iaddn(b),this.negative=1,this;if(this.words[0]-=b,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m<this.length&&this.words[m]<0;m++)this.words[m]+=67108864,this.words[m+1]-=1;return this.strip()},s.prototype.addn=function(b){return this.clone().iaddn(b)},s.prototype.subn=function(b){return this.clone().isubn(b)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(b,m,l){var d=b.length+l,y;this._expand(d);var P,D=0;for(y=0;y<b.length;y++){P=(this.words[y+l]|0)+D;var S=(b.words[y]|0)*m;P-=S&67108863,D=(P>>26)-(S/67108864|0),this.words[y+l]=P&67108863}for(;y<this.length-l;y++)P=(this.words[y+l]|0)+D,D=P>>26,this.words[y+l]=P&67108863;if(D===0)return this.strip();for(i(D===-1),D=0,y=0;y<this.length;y++)P=-(this.words[y]|0)+D,D=P>>26,this.words[y]=P&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(b,m){var l=this.length-b.length,d=this.clone(),y=b,P=y.words[y.length-1]|0,D=this._countBits(P);l=26-D,l!==0&&(y=y.ushln(l),d.iushln(l),P=y.words[y.length-1]|0);var S=d.length-y.length,v;if(m!=="mod"){v=new s(null),v.length=S+1,v.words=new Array(v.length);for(var A=0;A<v.length;A++)v.words[A]=0}var x=d.clone()._ishlnsubmul(y,1,S);x.negative===0&&(d=x,v&&(v.words[S]=1));for(var $=S-1;$>=0;$--){var ae=(d.words[y.length+$]|0)*67108864+(d.words[y.length+$-1]|0);for(ae=Math.min(ae/P|0,67108863),d._ishlnsubmul(y,ae,$);d.negative!==0;)ae--,d.negative=0,d._ishlnsubmul(y,1,$),d.isZero()||(d.negative^=1);v&&(v.words[$]=ae)}return v&&v.strip(),d.strip(),m!=="div"&&l!==0&&d.iushrn(l),{div:v||null,mod:d}},s.prototype.divmod=function(b,m,l){if(i(!b.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var d,y,P;return this.negative!==0&&b.negative===0?(P=this.neg().divmod(b,m),m!=="mod"&&(d=P.div.neg()),m!=="div"&&(y=P.mod.neg(),l&&y.negative!==0&&y.iadd(b)),{div:d,mod:y}):this.negative===0&&b.negative!==0?(P=this.divmod(b.neg(),m),m!=="mod"&&(d=P.div.neg()),{div:d,mod:P.mod}):this.negative&b.negative?(P=this.neg().divmod(b.neg(),m),m!=="div"&&(y=P.mod.neg(),l&&y.negative!==0&&y.isub(b)),{div:P.div,mod:y}):b.length>this.length||this.cmp(b)<0?{div:new s(0),mod:this}:b.length===1?m==="div"?{div:this.divn(b.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modn(b.words[0]))}:{div:this.divn(b.words[0]),mod:new s(this.modn(b.words[0]))}:this._wordDiv(b,m)},s.prototype.div=function(b){return this.divmod(b,"div",!1).div},s.prototype.mod=function(b){return this.divmod(b,"mod",!1).mod},s.prototype.umod=function(b){return this.divmod(b,"mod",!0).mod},s.prototype.divRound=function(b){var m=this.divmod(b);if(m.mod.isZero())return m.div;var l=m.div.negative!==0?m.mod.isub(b):m.mod,d=b.ushrn(1),y=b.andln(1),P=l.cmp(d);return P<0||y===1&&P===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},s.prototype.modn=function(b){i(b<=67108863);for(var m=(1<<26)%b,l=0,d=this.length-1;d>=0;d--)l=(m*l+(this.words[d]|0))%b;return l},s.prototype.idivn=function(b){i(b<=67108863);for(var m=0,l=this.length-1;l>=0;l--){var d=(this.words[l]|0)+m*67108864;this.words[l]=d/b|0,m=d%b}return this.strip()},s.prototype.divn=function(b){return this.clone().idivn(b)},s.prototype.egcd=function(b){i(b.negative===0),i(!b.isZero());var m=this,l=b.clone();m.negative!==0?m=m.umod(b):m=m.clone();for(var d=new s(1),y=new s(0),P=new s(0),D=new s(1),S=0;m.isEven()&&l.isEven();)m.iushrn(1),l.iushrn(1),++S;for(var v=l.clone(),A=m.clone();!m.isZero();){for(var x=0,$=1;!(m.words[0]&$)&&x<26;++x,$<<=1);if(x>0)for(m.iushrn(x);x-- >0;)(d.isOdd()||y.isOdd())&&(d.iadd(v),y.isub(A)),d.iushrn(1),y.iushrn(1);for(var ae=0,R=1;!(l.words[0]&R)&&ae<26;++ae,R<<=1);if(ae>0)for(l.iushrn(ae);ae-- >0;)(P.isOdd()||D.isOdd())&&(P.iadd(v),D.isub(A)),P.iushrn(1),D.iushrn(1);m.cmp(l)>=0?(m.isub(l),d.isub(P),y.isub(D)):(l.isub(m),P.isub(d),D.isub(y))}return{a:P,b:D,gcd:l.iushln(S)}},s.prototype._invmp=function(b){i(b.negative===0),i(!b.isZero());var m=this,l=b.clone();m.negative!==0?m=m.umod(b):m=m.clone();for(var d=new s(1),y=new s(0),P=l.clone();m.cmpn(1)>0&&l.cmpn(1)>0;){for(var D=0,S=1;!(m.words[0]&S)&&D<26;++D,S<<=1);if(D>0)for(m.iushrn(D);D-- >0;)d.isOdd()&&d.iadd(P),d.iushrn(1);for(var v=0,A=1;!(l.words[0]&A)&&v<26;++v,A<<=1);if(v>0)for(l.iushrn(v);v-- >0;)y.isOdd()&&y.iadd(P),y.iushrn(1);m.cmp(l)>=0?(m.isub(l),d.isub(y)):(l.isub(m),y.isub(d))}var x;return m.cmpn(1)===0?x=d:x=y,x.cmpn(0)<0&&x.iadd(b),x},s.prototype.gcd=function(b){if(this.isZero())return b.abs();if(b.isZero())return this.abs();var m=this.clone(),l=b.clone();m.negative=0,l.negative=0;for(var d=0;m.isEven()&&l.isEven();d++)m.iushrn(1),l.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;l.isEven();)l.iushrn(1);var y=m.cmp(l);if(y<0){var P=m;m=l,l=P}else if(y===0||l.cmpn(1)===0)break;m.isub(l)}while(!0);return l.iushln(d)},s.prototype.invm=function(b){return this.egcd(b).a.umod(b)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(b){return this.words[0]&b},s.prototype.bincn=function(b){i(typeof b=="number");var m=b%26,l=(b-m)/26,d=1<<m;if(this.length<=l)return this._expand(l+1),this.words[l]|=d,this;for(var y=d,P=l;y!==0&&P<this.length;P++){var D=this.words[P]|0;D+=y,y=D>>>26,D&=67108863,this.words[P]=D}return y!==0&&(this.words[P]=y,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(b){var m=b<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this.strip();var l;if(this.length>1)l=1;else{m&&(b=-b),i(b<=67108863,"Number is too big");var d=this.words[0]|0;l=d===b?0:d<b?-1:1}return this.negative!==0?-l|0:l},s.prototype.cmp=function(b){if(this.negative!==0&&b.negative===0)return-1;if(this.negative===0&&b.negative!==0)return 1;var m=this.ucmp(b);return this.negative!==0?-m|0:m},s.prototype.ucmp=function(b){if(this.length>b.length)return 1;if(this.length<b.length)return-1;for(var m=0,l=this.length-1;l>=0;l--){var d=this.words[l]|0,y=b.words[l]|0;if(d!==y){d<y?m=-1:d>y&&(m=1);break}}return m},s.prototype.gtn=function(b){return this.cmpn(b)===1},s.prototype.gt=function(b){return this.cmp(b)===1},s.prototype.gten=function(b){return this.cmpn(b)>=0},s.prototype.gte=function(b){return this.cmp(b)>=0},s.prototype.ltn=function(b){return this.cmpn(b)===-1},s.prototype.lt=function(b){return this.cmp(b)===-1},s.prototype.lten=function(b){return this.cmpn(b)<=0},s.prototype.lte=function(b){return this.cmp(b)<=0},s.prototype.eqn=function(b){return this.cmpn(b)===0},s.prototype.eq=function(b){return this.cmp(b)===0},s.red=function(b){return new ee(b)},s.prototype.toRed=function(b){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),b.convertTo(this)._forceRed(b)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(b){return this.red=b,this},s.prototype.forceRed=function(b){return i(!this.red,"Already a number in reduction context"),this._forceRed(b)},s.prototype.redAdd=function(b){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,b)},s.prototype.redIAdd=function(b){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,b)},s.prototype.redSub=function(b){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,b)},s.prototype.redISub=function(b){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,b)},s.prototype.redShl=function(b){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,b)},s.prototype.redMul=function(b){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,b),this.red.mul(this,b)},s.prototype.redIMul=function(b){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,b),this.red.imul(this,b)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(b){return i(this.red&&!b.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,b)};var G={k256:null,p224:null,p192:null,p25519:null};function B(L,b){this.name=L,this.p=new s(b,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}B.prototype._tmp=function(){var b=new s(null);return b.words=new Array(Math.ceil(this.n/13)),b},B.prototype.ireduce=function(b){var m=b,l;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),l=m.bitLength();while(l>this.n);var d=l<this.n?-1:m.ucmp(this.p);return d===0?(m.words[0]=0,m.length=1):d>0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},B.prototype.split=function(b,m){b.iushrn(this.n,0,m)},B.prototype.imulK=function(b){return b.imul(this.k)};function z(){B.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(z,B),z.prototype.split=function(b,m){for(var l=4194303,d=Math.min(b.length,9),y=0;y<d;y++)m.words[y]=b.words[y];if(m.length=d,b.length<=9){b.words[0]=0,b.length=1;return}var P=b.words[9];for(m.words[m.length++]=P&l,y=10;y<b.length;y++){var D=b.words[y]|0;b.words[y-10]=(D&l)<<4|P>>>22,P=D}P>>>=22,b.words[y-10]=P,P===0&&b.length>10?b.length-=10:b.length-=9},z.prototype.imulK=function(b){b.words[b.length]=0,b.words[b.length+1]=0,b.length+=2;for(var m=0,l=0;l<b.length;l++){var d=b.words[l]|0;m+=d*977,b.words[l]=m&67108863,m=d*64+(m/67108864|0)}return b.words[b.length-1]===0&&(b.length--,b.words[b.length-1]===0&&b.length--),b};function W(){B.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(W,B);function _(){B.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(_,B);function U(){B.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(U,B),U.prototype.imulK=function(b){for(var m=0,l=0;l<b.length;l++){var d=(b.words[l]|0)*19+m,y=d&67108863;d>>>=26,b.words[l]=y,m=d}return m!==0&&(b.words[b.length++]=m),b},s._prime=function(b){if(G[b])return G[b];var m;if(b==="k256")m=new z;else if(b==="p224")m=new W;else if(b==="p192")m=new _;else if(b==="p25519")m=new U;else throw new Error("Unknown prime "+b);return G[b]=m,m};function ee(L){if(typeof L=="string"){var b=s._prime(L);this.m=b.p,this.prime=b}else i(L.gtn(1),"modulus must be greater than 1"),this.m=L,this.prime=null}ee.prototype._verify1=function(b){i(b.negative===0,"red works only with positives"),i(b.red,"red works only with red numbers")},ee.prototype._verify2=function(b,m){i((b.negative|m.negative)===0,"red works only with positives"),i(b.red&&b.red===m.red,"red works only with red numbers")},ee.prototype.imod=function(b){return this.prime?this.prime.ireduce(b)._forceRed(this):b.umod(this.m)._forceRed(this)},ee.prototype.neg=function(b){return b.isZero()?b.clone():this.m.sub(b)._forceRed(this)},ee.prototype.add=function(b,m){this._verify2(b,m);var l=b.add(m);return l.cmp(this.m)>=0&&l.isub(this.m),l._forceRed(this)},ee.prototype.iadd=function(b,m){this._verify2(b,m);var l=b.iadd(m);return l.cmp(this.m)>=0&&l.isub(this.m),l},ee.prototype.sub=function(b,m){this._verify2(b,m);var l=b.sub(m);return l.cmpn(0)<0&&l.iadd(this.m),l._forceRed(this)},ee.prototype.isub=function(b,m){this._verify2(b,m);var l=b.isub(m);return l.cmpn(0)<0&&l.iadd(this.m),l},ee.prototype.shl=function(b,m){return this._verify1(b),this.imod(b.ushln(m))},ee.prototype.imul=function(b,m){return this._verify2(b,m),this.imod(b.imul(m))},ee.prototype.mul=function(b,m){return this._verify2(b,m),this.imod(b.mul(m))},ee.prototype.isqr=function(b){return this.imul(b,b.clone())},ee.prototype.sqr=function(b){return this.mul(b,b)},ee.prototype.sqrt=function(b){if(b.isZero())return b.clone();var m=this.m.andln(3);if(i(m%2===1),m===3){var l=this.m.add(new s(1)).iushrn(2);return this.pow(b,l)}for(var d=this.m.subn(1),y=0;!d.isZero()&&d.andln(1)===0;)y++,d.iushrn(1);i(!d.isZero());var P=new s(1).toRed(this),D=P.redNeg(),S=this.m.subn(1).iushrn(1),v=this.m.bitLength();for(v=new s(2*v*v).toRed(this);this.pow(v,S).cmp(D)!==0;)v.redIAdd(D);for(var A=this.pow(v,d),x=this.pow(b,d.addn(1).iushrn(1)),$=this.pow(b,d),ae=y;$.cmp(P)!==0;){for(var R=$,X=0;R.cmp(P)!==0;X++)R=R.redSqr();i(X<ae);var V=this.pow(A,new s(1).iushln(ae-X-1));x=x.redMul(V),A=V.redSqr(),$=$.redMul(A),ae=X}return x},ee.prototype.invm=function(b){var m=b._invmp(this.m);return m.negative!==0?(m.negative=0,this.imod(m).redNeg()):this.imod(m)},ee.prototype.pow=function(b,m){if(m.isZero())return new s(1).toRed(this);if(m.cmpn(1)===0)return b.clone();var l=4,d=new Array(1<<l);d[0]=new s(1).toRed(this),d[1]=b;for(var y=2;y<d.length;y++)d[y]=this.mul(d[y-1],b);var P=d[0],D=0,S=0,v=m.bitLength()%26;for(v===0&&(v=26),y=m.length-1;y>=0;y--){for(var A=m.words[y],x=v-1;x>=0;x--){var $=A>>x&1;if(P!==d[0]&&(P=this.sqr(P)),$===0&&D===0){S=0;continue}D<<=1,D|=$,S++,!(S!==l&&(y!==0||x!==0))&&(P=this.mul(P,d[D]),S=0,D=0)}v=26}return P},ee.prototype.convertTo=function(b){var m=b.umod(this.m);return m===b?m.clone():m},ee.prototype.convertFrom=function(b){var m=b.clone();return m.red=null,m},s.mont=function(b){return new oe(b)};function oe(L){ee.call(this,L),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(oe,ee),oe.prototype.convertTo=function(b){return this.imod(b.ushln(this.shift))},oe.prototype.convertFrom=function(b){var m=this.imod(b.mul(this.rinv));return m.red=null,m},oe.prototype.imul=function(b,m){if(b.isZero()||m.isZero())return b.words[0]=0,b.length=1,b;var l=b.imul(m),d=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=l.isub(d).iushrn(this.shift),P=y;return y.cmp(this.m)>=0?P=y.isub(this.m):y.cmpn(0)<0&&(P=y.iadd(this.m)),P._forceRed(this)},oe.prototype.mul=function(b,m){if(b.isZero()||m.isZero())return new s(0)._forceRed(this);var l=b.mul(m),d=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=l.isub(d).iushrn(this.shift),P=y;return y.cmp(this.m)>=0?P=y.isub(this.m):y.cmpn(0)<0&&(P=y.iadd(this.m)),P._forceRed(this)},oe.prototype.invm=function(b){var m=this.imod(b._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(r,fr)})(Jn);var Ld={};(function(r){var e=r;function t(s,a){if(Array.isArray(s))return s.slice();if(!s)return[];var f=[];if(typeof s!="string"){for(var h=0;h<s.length;h++)f[h]=s[h]|0;return f}if(a==="hex"){s=s.replace(/[^a-z0-9]+/ig,""),s.length%2!==0&&(s="0"+s);for(var h=0;h<s.length;h+=2)f.push(parseInt(s[h]+s[h+1],16))}else for(var h=0;h<s.length;h++){var u=s.charCodeAt(h),g=u>>8,w=u&255;g?f.push(g,w):f.push(w)}return f}e.toArray=t;function i(s){return s.length===1?"0"+s:s}e.zero2=i;function n(s){for(var a="",f=0;f<s.length;f++)a+=i(s[f].toString(16));return a}e.toHex=n,e.encode=function(a,f){return f==="hex"?n(a):a}})(Ld),function(r){var e=r,t=Jn.exports,i=So,n=Ld;e.assert=i,e.toArray=n.toArray,e.zero2=n.zero2,e.toHex=n.toHex,e.encode=n.encode;function s(g,w,M){var C=new Array(Math.max(g.bitLength(),M)+1),O;for(O=0;O<C.length;O+=1)C[O]=0;var N=1<<w+1,j=g.clone();for(O=0;O<C.length;O++){var H,F=j.andln(N-1);j.isOdd()?(F>(N>>1)-1?H=(N>>1)-F:H=F,j.isubn(H)):H=0,C[O]=H,j.iushrn(1)}return C}e.getNAF=s;function a(g,w){var M=[[],[]];g=g.clone(),w=w.clone();for(var C=0,O=0,N;g.cmpn(-C)>0||w.cmpn(-O)>0;){var j=g.andln(3)+C&3,H=w.andln(3)+O&3;j===3&&(j=-1),H===3&&(H=-1);var F;j&1?(N=g.andln(7)+C&7,(N===3||N===5)&&H===2?F=-j:F=j):F=0,M[0].push(F);var G;H&1?(N=w.andln(7)+O&7,(N===3||N===5)&&j===2?G=-H:G=H):G=0,M[1].push(G),2*C===F+1&&(C=1-C),2*O===G+1&&(O=1-O),g.iushrn(1),w.iushrn(1)}return M}e.getJSF=a;function f(g,w,M){var C="_"+w;g.prototype[w]=function(){return this[C]!==void 0?this[C]:this[C]=M.call(this)}}e.cachedProperty=f;function h(g){return typeof g=="string"?e.toArray(g,"hex"):g}e.parseBytes=h;function u(g){return new t(g,"hex","le")}e.intFromLE=u}(Li);var El={exports:{}},Bd;El.exports=function(e){return Bd||(Bd=new js(null)),Bd.generate(e)};function js(r){this.rand=r}if(El.exports.Rand=js,js.prototype.generate=function(e){return this._rand(e)},js.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),i=0;i<t.length;i++)t[i]=this.rand.getByte();return t},typeof self=="object")self.crypto&&self.crypto.getRandomValues?js.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?js.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:typeof window=="object"&&(js.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var dm=nl;if(typeof dm.randomBytes!="function")throw new Error("Not supported");js.prototype._rand=function(e){return dm.randomBytes(e)}}catch{}var Fd={},Co=Jn.exports,kc=Li,Sl=kc.getNAF,ex=kc.getJSF,Il=kc.assert;function Ws(r,e){this.type=r,this.p=new Co(e.p,16),this.red=e.prime?Co.red(e.prime):Co.mont(this.p),this.zero=new Co(0).toRed(this.red),this.one=new Co(1).toRed(this.red),this.two=new Co(2).toRed(this.red),this.n=e.n&&new Co(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Ml=Ws;Ws.prototype.point=function(){throw new Error("Not implemented")},Ws.prototype.validate=function(){throw new Error("Not implemented")},Ws.prototype._fixedNafMul=function(e,t){Il(e.precomputed);var i=e._getDoubles(),n=Sl(t,1,this._bitLength),s=(1<<i.step+1)-(i.step%2===0?2:1);s/=3;var a=[],f,h;for(f=0;f<n.length;f+=i.step){h=0;for(var u=f+i.step-1;u>=f;u--)h=(h<<1)+n[u];a.push(h)}for(var g=this.jpoint(null,null,null),w=this.jpoint(null,null,null),M=s;M>0;M--){for(f=0;f<a.length;f++)h=a[f],h===M?w=w.mixedAdd(i.points[f]):h===-M&&(w=w.mixedAdd(i.points[f].neg()));g=g.add(w)}return g.toP()},Ws.prototype._wnafMul=function(e,t){var i=4,n=e._getNAFPoints(i);i=n.wnd;for(var s=n.points,a=Sl(t,i,this._bitLength),f=this.jpoint(null,null,null),h=a.length-1;h>=0;h--){for(var u=0;h>=0&&a[h]===0;h--)u++;if(h>=0&&u++,f=f.dblp(u),h<0)break;var g=a[h];Il(g!==0),e.type==="affine"?g>0?f=f.mixedAdd(s[g-1>>1]):f=f.mixedAdd(s[-g-1>>1].neg()):g>0?f=f.add(s[g-1>>1]):f=f.add(s[-g-1>>1].neg())}return e.type==="affine"?f.toP():f},Ws.prototype._wnafMulAdd=function(e,t,i,n,s){var a=this._wnafT1,f=this._wnafT2,h=this._wnafT3,u=0,g,w,M;for(g=0;g<n;g++){M=t[g];var C=M._getNAFPoints(e);a[g]=C.wnd,f[g]=C.points}for(g=n-1;g>=1;g-=2){var O=g-1,N=g;if(a[O]!==1||a[N]!==1){h[O]=Sl(i[O],a[O],this._bitLength),h[N]=Sl(i[N],a[N],this._bitLength),u=Math.max(h[O].length,u),u=Math.max(h[N].length,u);continue}var j=[t[O],null,null,t[N]];t[O].y.cmp(t[N].y)===0?(j[1]=t[O].add(t[N]),j[2]=t[O].toJ().mixedAdd(t[N].neg())):t[O].y.cmp(t[N].y.redNeg())===0?(j[1]=t[O].toJ().mixedAdd(t[N]),j[2]=t[O].add(t[N].neg())):(j[1]=t[O].toJ().mixedAdd(t[N]),j[2]=t[O].toJ().mixedAdd(t[N].neg()));var H=[-3,-1,-5,-7,0,7,5,1,3],F=ex(i[O],i[N]);for(u=Math.max(F[0].length,u),h[O]=new Array(u),h[N]=new Array(u),w=0;w<u;w++){var G=F[0][w]|0,B=F[1][w]|0;h[O][w]=H[(G+1)*3+(B+1)],h[N][w]=0,f[O]=j}}var z=this.jpoint(null,null,null),W=this._wnafT4;for(g=u;g>=0;g--){for(var _=0;g>=0;){var U=!0;for(w=0;w<n;w++)W[w]=h[w][g]|0,W[w]!==0&&(U=!1);if(!U)break;_++,g--}if(g>=0&&_++,z=z.dblp(_),g<0)break;for(w=0;w<n;w++){var ee=W[w];ee!==0&&(ee>0?M=f[w][ee-1>>1]:ee<0&&(M=f[w][-ee-1>>1].neg()),M.type==="affine"?z=z.mixedAdd(M):z=z.add(M))}}for(g=0;g<n;g++)f[g]=null;return s?z:z.toP()};function Xi(r,e){this.curve=r,this.type=e,this.precomputed=null}Ws.BasePoint=Xi,Xi.prototype.eq=function(){throw new Error("Not implemented")},Xi.prototype.validate=function(){return this.curve.validate(this)},Ws.prototype.decodePoint=function(e,t){e=kc.toArray(e,t);var i=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*i){e[0]===6?Il(e[e.length-1]%2===0):e[0]===7&&Il(e[e.length-1]%2===1);var n=this.point(e.slice(1,1+i),e.slice(1+i,1+2*i));return n}else if((e[0]===2||e[0]===3)&&e.length-1===i)return this.pointFromX(e.slice(1,1+i),e[0]===3);throw new Error("Unknown point format")},Xi.prototype.encodeCompressed=function(e){return this.encode(e,!0)},Xi.prototype._encode=function(e){var t=this.curve.p.byteLength(),i=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(i):[4].concat(i,this.getY().toArray("be",t))},Xi.prototype.encode=function(e,t){return kc.encode(this._encode(t),e)},Xi.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},Xi.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((e.bitLength()+1)/t.step):!1},Xi.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],n=this,s=0;s<t;s+=e){for(var a=0;a<e;a++)n=n.dbl();i.push(n)}return{step:e,points:i}},Xi.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],i=(1<<e)-1,n=i===1?null:this.dbl(),s=1;s<i;s++)t[s]=t[s-1].add(n);return{wnd:e,points:t}},Xi.prototype._getBeta=function(){return null},Xi.prototype.dblp=function(e){for(var t=this,i=0;i<e;i++)t=t.dbl();return t};var tx=Li,dr=Jn.exports,Ud=Sa.exports,Na=Ml,rx=tx.assert;function en(r){Na.call(this,"short",r),this.a=new dr(r.a,16).toRed(this.red),this.b=new dr(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Ud(en,Na);var ix=en;en.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,i;if(e.beta)t=new dr(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=n[0].cmp(n[1])<0?n[0]:n[1],t=t.toRed(this.red)}if(e.lambda)i=new dr(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(t))===0?i=s[0]:(i=s[1],rx(this.g.mul(i).x.cmp(this.g.x.redMul(t))===0))}var a;return e.basis?a=e.basis.map(function(f){return{a:new dr(f.a,16),b:new dr(f.b,16)}}):a=this._getEndoBasis(i),{beta:t,lambda:i,basis:a}}},en.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:dr.mont(e),i=new dr(2).toRed(t).redInvm(),n=i.redNeg(),s=new dr(3).toRed(t).redNeg().redSqrt().redMul(i),a=n.redAdd(s).fromRed(),f=n.redSub(s).fromRed();return[a,f]},en.prototype._getEndoBasis=function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),i=e,n=this.n.clone(),s=new dr(1),a=new dr(0),f=new dr(0),h=new dr(1),u,g,w,M,C,O,N,j=0,H,F;i.cmpn(0)!==0;){var G=n.div(i);H=n.sub(G.mul(i)),F=f.sub(G.mul(s));var B=h.sub(G.mul(a));if(!w&&H.cmp(t)<0)u=N.neg(),g=s,w=H.neg(),M=F;else if(w&&++j===2)break;N=H,n=i,i=H,f=s,s=F,h=a,a=B}C=H.neg(),O=F;var z=w.sqr().add(M.sqr()),W=C.sqr().add(O.sqr());return W.cmp(z)>=0&&(C=u,O=g),w.negative&&(w=w.neg(),M=M.neg()),C.negative&&(C=C.neg(),O=O.neg()),[{a:w,b:M},{a:C,b:O}]},en.prototype._endoSplit=function(e){var t=this.endo.basis,i=t[0],n=t[1],s=n.b.mul(e).divRound(this.n),a=i.b.neg().mul(e).divRound(this.n),f=s.mul(i.a),h=a.mul(n.a),u=s.mul(i.b),g=a.mul(n.b),w=e.sub(f).sub(h),M=u.add(g).neg();return{k1:w,k2:M}},en.prototype.pointFromX=function(e,t){e=new dr(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=i.redSqrt();if(n.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var s=n.fromRed().isOdd();return(t&&!s||!t&&s)&&(n=n.redNeg()),this.point(e,n)},en.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,i=e.y,n=this.a.redMul(t),s=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return i.redSqr().redISub(s).cmpn(0)===0},en.prototype._endoWnafMulAdd=function(e,t,i){for(var n=this._endoWnafT1,s=this._endoWnafT2,a=0;a<e.length;a++){var f=this._endoSplit(t[a]),h=e[a],u=h._getBeta();f.k1.negative&&(f.k1.ineg(),h=h.neg(!0)),f.k2.negative&&(f.k2.ineg(),u=u.neg(!0)),n[a*2]=h,n[a*2+1]=u,s[a*2]=f.k1,s[a*2+1]=f.k2}for(var g=this._wnafMulAdd(1,n,s,a*2,i),w=0;w<a*2;w++)n[w]=null,s[w]=null;return g};function Rr(r,e,t,i){Na.BasePoint.call(this,r,"affine"),e===null&&t===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new dr(e,16),this.y=new dr(t,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}Ud(Rr,Na.BasePoint),en.prototype.point=function(e,t,i){return new Rr(this,e,t,i)},en.prototype.pointFromJSON=function(e,t){return Rr.fromJSON(this,e,t)},Rr.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var i=this.curve,n=function(s){return i.point(s.x.redMul(i.endo.beta),s.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},Rr.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Rr.fromJSON=function(e,t,i){typeof t=="string"&&(t=JSON.parse(t));var n=e.point(t[0],t[1],i);if(!t[2])return n;function s(f){return e.point(f[0],f[1],i)}var a=t[2];return n.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[n].concat(a.doubles.points.map(s))},naf:a.naf&&{wnd:a.naf.wnd,points:[n].concat(a.naf.points.map(s))}},n},Rr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Rr.prototype.isInfinity=function(){return this.inf},Rr.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var i=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)},Rr.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,i=this.x.redSqr(),n=e.redInvm(),s=i.redAdd(i).redIAdd(i).redIAdd(t).redMul(n),a=s.redSqr().redISub(this.x.redAdd(this.x)),f=s.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,f)},Rr.prototype.getX=function(){return this.x.fromRed()},Rr.prototype.getY=function(){return this.y.fromRed()},Rr.prototype.mul=function(e){return e=new dr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Rr.prototype.mulAdd=function(e,t,i){var n=[this,t],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s):this.curve._wnafMulAdd(1,n,s,2)},Rr.prototype.jmulAdd=function(e,t,i){var n=[this,t],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s,!0):this.curve._wnafMulAdd(1,n,s,2,!0)},Rr.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Rr.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,n=function(s){return s.neg()};t.precomputed={naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(n)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(n)}}}return t},Rr.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Wr(r,e,t,i){Na.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new dr(0)):(this.x=new dr(e,16),this.y=new dr(t,16),this.z=new dr(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Ud(Wr,Na.BasePoint),en.prototype.jpoint=function(e,t,i){return new Wr(this,e,t,i)},Wr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),i=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(i,n)},Wr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Wr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),i=this.z.redSqr(),n=this.x.redMul(t),s=e.x.redMul(i),a=this.y.redMul(t.redMul(e.z)),f=e.y.redMul(i.redMul(this.z)),h=n.redSub(s),u=a.redSub(f);if(h.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var g=h.redSqr(),w=g.redMul(h),M=n.redMul(g),C=u.redSqr().redIAdd(w).redISub(M).redISub(M),O=u.redMul(M.redISub(C)).redISub(a.redMul(w)),N=this.z.redMul(e.z).redMul(h);return this.curve.jpoint(C,O,N)},Wr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),i=this.x,n=e.x.redMul(t),s=this.y,a=e.y.redMul(t).redMul(this.z),f=i.redSub(n),h=s.redSub(a);if(f.cmpn(0)===0)return h.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=f.redSqr(),g=u.redMul(f),w=i.redMul(u),M=h.redSqr().redIAdd(g).redISub(w).redISub(w),C=h.redMul(w.redISub(M)).redISub(s.redMul(g)),O=this.z.redMul(f);return this.curve.jpoint(M,C,O)},Wr.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var i=this;for(t=0;t<e;t++)i=i.dbl();return i}var n=this.curve.a,s=this.curve.tinv,a=this.x,f=this.y,h=this.z,u=h.redSqr().redSqr(),g=f.redAdd(f);for(t=0;t<e;t++){var w=a.redSqr(),M=g.redSqr(),C=M.redSqr(),O=w.redAdd(w).redIAdd(w).redIAdd(n.redMul(u)),N=a.redMul(M),j=O.redSqr().redISub(N.redAdd(N)),H=N.redISub(j),F=O.redMul(H);F=F.redIAdd(F).redISub(C);var G=g.redMul(h);t+1<e&&(u=u.redMul(C)),a=j,h=G,g=F}return this.curve.jpoint(a,g.redMul(s),h)},Wr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},Wr.prototype._zeroDbl=function(){var e,t,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),f=this.x.redAdd(s).redSqr().redISub(n).redISub(a);f=f.redIAdd(f);var h=n.redAdd(n).redIAdd(n),u=h.redSqr().redISub(f).redISub(f),g=a.redIAdd(a);g=g.redIAdd(g),g=g.redIAdd(g),e=u,t=h.redMul(f.redISub(u)).redISub(g),i=this.y.redAdd(this.y)}else{var w=this.x.redSqr(),M=this.y.redSqr(),C=M.redSqr(),O=this.x.redAdd(M).redSqr().redISub(w).redISub(C);O=O.redIAdd(O);var N=w.redAdd(w).redIAdd(w),j=N.redSqr(),H=C.redIAdd(C);H=H.redIAdd(H),H=H.redIAdd(H),e=j.redISub(O).redISub(O),t=N.redMul(O.redISub(e)).redISub(H),i=this.y.redMul(this.z),i=i.redIAdd(i)}return this.curve.jpoint(e,t,i)},Wr.prototype._threeDbl=function(){var e,t,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),f=this.x.redAdd(s).redSqr().redISub(n).redISub(a);f=f.redIAdd(f);var h=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=h.redSqr().redISub(f).redISub(f);e=u;var g=a.redIAdd(a);g=g.redIAdd(g),g=g.redIAdd(g),t=h.redMul(f.redISub(u)).redISub(g),i=this.y.redAdd(this.y)}else{var w=this.z.redSqr(),M=this.y.redSqr(),C=this.x.redMul(M),O=this.x.redSub(w).redMul(this.x.redAdd(w));O=O.redAdd(O).redIAdd(O);var N=C.redIAdd(C);N=N.redIAdd(N);var j=N.redAdd(N);e=O.redSqr().redISub(j),i=this.y.redAdd(this.z).redSqr().redISub(M).redISub(w);var H=M.redSqr();H=H.redIAdd(H),H=H.redIAdd(H),H=H.redIAdd(H),t=O.redMul(N.redISub(e)).redISub(H)}return this.curve.jpoint(e,t,i)},Wr.prototype._dbl=function(){var e=this.curve.a,t=this.x,i=this.y,n=this.z,s=n.redSqr().redSqr(),a=t.redSqr(),f=i.redSqr(),h=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(s)),u=t.redAdd(t);u=u.redIAdd(u);var g=u.redMul(f),w=h.redSqr().redISub(g.redAdd(g)),M=g.redISub(w),C=f.redSqr();C=C.redIAdd(C),C=C.redIAdd(C),C=C.redIAdd(C);var O=h.redMul(M).redISub(C),N=i.redAdd(i).redMul(n);return this.curve.jpoint(w,O,N)},Wr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),i=this.z.redSqr(),n=t.redSqr(),s=e.redAdd(e).redIAdd(e),a=s.redSqr(),f=this.x.redAdd(t).redSqr().redISub(e).redISub(n);f=f.redIAdd(f),f=f.redAdd(f).redIAdd(f),f=f.redISub(a);var h=f.redSqr(),u=n.redIAdd(n);u=u.redIAdd(u),u=u.redIAdd(u),u=u.redIAdd(u);var g=s.redIAdd(f).redSqr().redISub(a).redISub(h).redISub(u),w=t.redMul(g);w=w.redIAdd(w),w=w.redIAdd(w);var M=this.x.redMul(h).redISub(w);M=M.redIAdd(M),M=M.redIAdd(M);var C=this.y.redMul(g.redMul(u.redISub(g)).redISub(f.redMul(h)));C=C.redIAdd(C),C=C.redIAdd(C),C=C.redIAdd(C);var O=this.z.redAdd(f).redSqr().redISub(i).redISub(h);return this.curve.jpoint(M,C,O)},Wr.prototype.mul=function(e,t){return e=new dr(e,t),this.curve._wnafMul(this,e)},Wr.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),i=e.z.redSqr();if(this.x.redMul(i).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var n=t.redMul(this.z),s=i.redMul(e.z);return this.y.redMul(s).redISub(e.y.redMul(n)).cmpn(0)===0},Wr.prototype.eqXToP=function(e){var t=this.z.redSqr(),i=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(i)===0)return!0;for(var n=e.clone(),s=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(i.redIAdd(s),this.x.cmp(i)===0)return!0}},Wr.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},Wr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var $a=Jn.exports,pm=Sa.exports,Cl=Ml,nx=Li;function La(r){Cl.call(this,"mont",r),this.a=new $a(r.a,16).toRed(this.red),this.b=new $a(r.b,16).toRed(this.red),this.i4=new $a(4).toRed(this.red).redInvm(),this.two=new $a(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}pm(La,Cl);var sx=La;La.prototype.validate=function(e){var t=e.normalize().x,i=t.redSqr(),n=i.redMul(t).redAdd(i.redMul(this.a)).redAdd(t),s=n.redSqrt();return s.redSqr().cmp(n)===0};function Tr(r,e,t){Cl.BasePoint.call(this,r,"projective"),e===null&&t===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new $a(e,16),this.z=new $a(t,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}pm(Tr,Cl.BasePoint),La.prototype.decodePoint=function(e,t){return this.point(nx.toArray(e,t),1)},La.prototype.point=function(e,t){return new Tr(this,e,t)},La.prototype.pointFromJSON=function(e){return Tr.fromJSON(this,e)},Tr.prototype.precompute=function(){},Tr.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Tr.fromJSON=function(e,t){return new Tr(e,t[0],t[1]||e.one)},Tr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Tr.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Tr.prototype.dbl=function(){var e=this.x.redAdd(this.z),t=e.redSqr(),i=this.x.redSub(this.z),n=i.redSqr(),s=t.redSub(n),a=t.redMul(n),f=s.redMul(n.redAdd(this.curve.a24.redMul(s)));return this.curve.point(a,f)},Tr.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Tr.prototype.diffAdd=function(e,t){var i=this.x.redAdd(this.z),n=this.x.redSub(this.z),s=e.x.redAdd(e.z),a=e.x.redSub(e.z),f=a.redMul(i),h=s.redMul(n),u=t.z.redMul(f.redAdd(h).redSqr()),g=t.x.redMul(f.redISub(h).redSqr());return this.curve.point(u,g)},Tr.prototype.mul=function(e){for(var t=e.clone(),i=this,n=this.curve.point(null,null),s=this,a=[];t.cmpn(0)!==0;t.iushrn(1))a.push(t.andln(1));for(var f=a.length-1;f>=0;f--)a[f]===0?(i=i.diffAdd(n,s),n=n.dbl()):(n=i.diffAdd(n,s),i=i.dbl());return n},Tr.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Tr.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Tr.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Tr.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Tr.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var ox=Li,ms=Jn.exports,gm=Sa.exports,Pl=Ml,ax=ox.assert;function Qn(r){this.twisted=(r.a|0)!==1,this.mOneA=this.twisted&&(r.a|0)===-1,this.extended=this.mOneA,Pl.call(this,"edwards",r),this.a=new ms(r.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new ms(r.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new ms(r.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),ax(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(r.c|0)===1}gm(Qn,Pl);var cx=Qn;Qn.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},Qn.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},Qn.prototype.jpoint=function(e,t,i,n){return this.point(e,t,i,n)},Qn.prototype.pointFromX=function(e,t){e=new ms(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),n=this.c2.redSub(this.a.redMul(i)),s=this.one.redSub(this.c2.redMul(this.d).redMul(i)),a=n.redMul(s.redInvm()),f=a.redSqrt();if(f.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");var h=f.fromRed().isOdd();return(t&&!h||!t&&h)&&(f=f.redNeg()),this.point(e,f)},Qn.prototype.pointFromY=function(e,t){e=new ms(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),n=i.redSub(this.c2),s=i.redMul(this.d).redMul(this.c2).redSub(this.a),a=n.redMul(s.redInvm());if(a.cmp(this.zero)===0){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var f=a.redSqrt();if(f.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");return f.fromRed().isOdd()!==t&&(f=f.redNeg()),this.point(f,e)},Qn.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),i=e.y.redSqr(),n=t.redMul(this.a).redAdd(i),s=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(i)));return n.cmp(s)===0};function nr(r,e,t,i,n){Pl.BasePoint.call(this,r,"projective"),e===null&&t===null&&i===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new ms(e,16),this.y=new ms(t,16),this.z=i?new ms(i,16):this.curve.one,this.t=n&&new ms(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}gm(nr,Pl.BasePoint),Qn.prototype.pointFromJSON=function(e){return nr.fromJSON(this,e)},Qn.prototype.point=function(e,t,i,n){return new nr(this,e,t,i,n)},nr.fromJSON=function(e,t){return new nr(e,t[0],t[1],t[2])},nr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},nr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},nr.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),i=this.z.redSqr();i=i.redIAdd(i);var n=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),a=n.redAdd(t),f=a.redSub(i),h=n.redSub(t),u=s.redMul(f),g=a.redMul(h),w=s.redMul(h),M=f.redMul(a);return this.curve.point(u,g,M,w)},nr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),t=this.x.redSqr(),i=this.y.redSqr(),n,s,a,f,h,u;if(this.curve.twisted){f=this.curve._mulA(t);var g=f.redAdd(i);this.zOne?(n=e.redSub(t).redSub(i).redMul(g.redSub(this.curve.two)),s=g.redMul(f.redSub(i)),a=g.redSqr().redSub(g).redSub(g)):(h=this.z.redSqr(),u=g.redSub(h).redISub(h),n=e.redSub(t).redISub(i).redMul(u),s=g.redMul(f.redSub(i)),a=g.redMul(u))}else f=t.redAdd(i),h=this.curve._mulC(this.z).redSqr(),u=f.redSub(h).redSub(h),n=this.curve._mulC(e.redISub(f)).redMul(u),s=this.curve._mulC(f).redMul(t.redISub(i)),a=f.redMul(u);return this.curve.point(n,s,a)},nr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},nr.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),i=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),a=i.redSub(t),f=s.redSub(n),h=s.redAdd(n),u=i.redAdd(t),g=a.redMul(f),w=h.redMul(u),M=a.redMul(u),C=f.redMul(h);return this.curve.point(g,w,C,M)},nr.prototype._projAdd=function(e){var t=this.z.redMul(e.z),i=t.redSqr(),n=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(n).redMul(s),f=i.redSub(a),h=i.redAdd(a),u=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(n).redISub(s),g=t.redMul(f).redMul(u),w,M;return this.curve.twisted?(w=t.redMul(h).redMul(s.redSub(this.curve._mulA(n))),M=f.redMul(h)):(w=t.redMul(h).redMul(s.redSub(n)),M=this.curve._mulC(f).redMul(h)),this.curve.point(g,w,M)},nr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},nr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},nr.prototype.mulAdd=function(e,t,i){return this.curve._wnafMulAdd(1,[this,t],[e,i],2,!1)},nr.prototype.jmulAdd=function(e,t,i){return this.curve._wnafMulAdd(1,[this,t],[e,i],2,!0)},nr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},nr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},nr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},nr.prototype.getY=function(){return this.normalize(),this.y.fromRed()},nr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},nr.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(t)===0)return!0;for(var i=e.clone(),n=this.curve.redN.redMul(this.z);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),this.x.cmp(t)===0)return!0}},nr.prototype.toP=nr.prototype.normalize,nr.prototype.mixedAdd=nr.prototype.add,function(r){var e=r;e.base=Ml,e.short=ix,e.mont=sx,e.edwards=cx}(Fd);var Dl={},qd,vm;function fx(){return vm||(vm=1,qd={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),qd}(function(r){var e=r,t=Ri,i=Fd,n=Li,s=n.assert;function a(u){u.type==="short"?this.curve=new i.short(u):u.type==="edwards"?this.curve=new i.edwards(u):this.curve=new i.mont(u),this.g=this.curve.g,this.n=this.curve.n,this.hash=u.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=a;function f(u,g){Object.defineProperty(e,u,{configurable:!0,enumerable:!0,get:function(){var w=new a(g);return Object.defineProperty(e,u,{configurable:!0,enumerable:!0,value:w}),w}})}f("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:t.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),f("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:t.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),f("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:t.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),f("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:t.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),f("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:t.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),f("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:t.sha256,gRed:!1,g:["9"]}),f("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:t.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var h;try{h=fx()}catch{h=void 0}f("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:t.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",h]})})(Dl);var lx=Ri,Po=Ld,mm=So;function Ks(r){if(!(this instanceof Ks))return new Ks(r);this.hash=r.hash,this.predResist=!!r.predResist,this.outLen=this.hash.outSize,this.minEntropy=r.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Po.toArray(r.entropy,r.entropyEnc||"hex"),t=Po.toArray(r.nonce,r.nonceEnc||"hex"),i=Po.toArray(r.pers,r.persEnc||"hex");mm(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,i)}var hx=Ks;Ks.prototype._init=function(e,t,i){var n=e.concat(t).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},Ks.prototype._hmac=function(){return new lx.hmac(this.hash,this.K)},Ks.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},Ks.prototype.reseed=function(e,t,i,n){typeof t!="string"&&(n=i,i=t,t=null),e=Po.toArray(e,t),i=Po.toArray(i,n),mm(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this._reseed=1},Ks.prototype.generate=function(e,t,i,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(n=i,i=t,t=null),i&&(i=Po.toArray(i,n||"hex"),this._update(i));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var a=s.slice(0,e);return this._update(i),this._reseed++,Po.encode(a,t)};var ux=Jn.exports,dx=Li,zd=dx.assert;function Jr(r,e){this.ec=r,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var px=Jr;Jr.fromPublic=function(e,t,i){return t instanceof Jr?t:new Jr(e,{pub:t,pubEnc:i})},Jr.fromPrivate=function(e,t,i){return t instanceof Jr?t:new Jr(e,{priv:t,privEnc:i})},Jr.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},Jr.prototype.getPublic=function(e,t){return typeof e=="string"&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},Jr.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv},Jr.prototype._importPrivate=function(e,t){this.priv=new ux(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},Jr.prototype._importPublic=function(e,t){if(e.x||e.y){this.ec.curve.type==="mont"?zd(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&zd(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)},Jr.prototype.derive=function(e){return e.validate()||zd(e.validate(),"public point not validated"),e.mul(this.priv).getX()},Jr.prototype.sign=function(e,t,i){return this.ec.sign(e,this,t,i)},Jr.prototype.verify=function(e,t,i){return this.ec.verify(e,t,this,void 0,i)},Jr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var Ol=Jn.exports,Hd=Li,gx=Hd.assert;function Rl(r,e){if(r instanceof Rl)return r;this._importDER(r,e)||(gx(r.r&&r.s,"Signature without r or s"),this.r=new Ol(r.r,16),this.s=new Ol(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}var vx=Rl;function mx(){this.place=0}function kd(r,e){var t=r[e.place++];if(!(t&128))return t;var i=t&15;if(i===0||i>4||r[e.place]===0)return!1;for(var n=0,s=0,a=e.place;s<i;s++,a++)n<<=8,n|=r[a],n>>>=0;return n<=127?!1:(e.place=a,n)}function bm(r){for(var e=0,t=r.length-1;!r[e]&&!(r[e+1]&128)&&e<t;)e++;return e===0?r:r.slice(e)}Rl.prototype._importDER=function(e,t){e=Hd.toArray(e,t);var i=new mx;if(e[i.place++]!==48)return!1;var n=kd(e,i);if(n===!1||n+i.place!==e.length||e[i.place++]!==2)return!1;var s=kd(e,i);if(s===!1||e[i.place]&128)return!1;var a=e.slice(i.place,s+i.place);if(i.place+=s,e[i.place++]!==2)return!1;var f=kd(e,i);if(f===!1||e.length!==f+i.place||e[i.place]&128)return!1;var h=e.slice(i.place,f+i.place);if(a[0]===0)if(a[1]&128)a=a.slice(1);else return!1;if(h[0]===0)if(h[1]&128)h=h.slice(1);else return!1;return this.r=new Ol(a),this.s=new Ol(h),this.recoveryParam=null,!0};function jd(r,e){if(e<128){r.push(e);return}var t=1+(Math.log(e)/Math.LN2>>>3);for(r.push(t|128);--t;)r.push(e>>>(t<<3)&255);r.push(e)}Rl.prototype.toDER=function(e){var t=this.r.toArray(),i=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),i[0]&128&&(i=[0].concat(i)),t=bm(t),i=bm(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var n=[2];jd(n,t.length),n=n.concat(t),n.push(2),jd(n,i.length);var s=n.concat(i),a=[48];return jd(a,s.length),a=a.concat(s),Hd.encode(a,e)};var En=Jn.exports,wm=hx,bx=Li,Wd=Dl,wx=El.exports,Do=bx.assert,Kd=px,Tl=vx;function tn(r){if(!(this instanceof tn))return new tn(r);typeof r=="string"&&(Do(Object.prototype.hasOwnProperty.call(Wd,r),"Unknown curve "+r),r=Wd[r]),r instanceof Wd.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}var yx=tn;tn.prototype.keyPair=function(e){return new Kd(this,e)},tn.prototype.keyFromPrivate=function(e,t){return Kd.fromPrivate(this,e,t)},tn.prototype.keyFromPublic=function(e,t){return Kd.fromPublic(this,e,t)},tn.prototype.genKeyPair=function(e){e||(e={});for(var t=new wm({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||wx(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),n=this.n.sub(new En(2));;){var s=new En(t.generate(i));if(!(s.cmp(n)>0))return s.iaddn(1),this.keyFromPrivate(s)}},tn.prototype._truncateToN=function(e,t,i){var n;if(En.isBN(e)||typeof e=="number")e=new En(e,16),n=e.byteLength();else if(typeof e=="object")n=e.length,e=new En(e,16);else{var s=e.toString();n=s.length+1>>>1,e=new En(s,16)}typeof i!="number"&&(i=n*8);var a=i-this.n.bitLength();return a>0&&(e=e.ushrn(a)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},tn.prototype.sign=function(e,t,i,n){if(typeof i=="object"&&(n=i,i=null),n||(n={}),typeof e!="string"&&typeof e!="number"&&!En.isBN(e)){Do(typeof e=="object"&&e&&typeof e.length=="number","Expected message to be an array-like, a hex string, or a BN instance"),Do(e.length>>>0===e.length);for(var s=0;s<e.length;s++)Do((e[s]&255)===e[s])}t=this.keyFromPrivate(t,i),e=this._truncateToN(e,!1,n.msgBitLength),Do(!e.isNeg(),"Can not sign a negative message");var a=this.n.byteLength(),f=t.getPrivate().toArray("be",a),h=e.toArray("be",a);Do(new En(h).eq(e),"Can not sign message");for(var u=new wm({hash:this.hash,entropy:f,nonce:h,pers:n.pers,persEnc:n.persEnc||"utf8"}),g=this.n.sub(new En(1)),w=0;;w++){var M=n.k?n.k(w):new En(u.generate(this.n.byteLength()));if(M=this._truncateToN(M,!0),!(M.cmpn(1)<=0||M.cmp(g)>=0)){var C=this.g.mul(M);if(!C.isInfinity()){var O=C.getX(),N=O.umod(this.n);if(N.cmpn(0)!==0){var j=M.invm(this.n).mul(N.mul(t.getPrivate()).iadd(e));if(j=j.umod(this.n),j.cmpn(0)!==0){var H=(C.getY().isOdd()?1:0)|(O.cmp(N)!==0?2:0);return n.canonical&&j.cmp(this.nh)>0&&(j=this.n.sub(j),H^=1),new Tl({r:N,s:j,recoveryParam:H})}}}}}},tn.prototype.verify=function(e,t,i,n,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),i=this.keyFromPublic(i,n),t=new Tl(t,"hex");var a=t.r,f=t.s;if(a.cmpn(1)<0||a.cmp(this.n)>=0||f.cmpn(1)<0||f.cmp(this.n)>=0)return!1;var h=f.invm(this.n),u=h.mul(e).umod(this.n),g=h.mul(a).umod(this.n),w;return this.curve._maxwellTrick?(w=this.g.jmulAdd(u,i.getPublic(),g),w.isInfinity()?!1:w.eqXToP(a)):(w=this.g.mulAdd(u,i.getPublic(),g),w.isInfinity()?!1:w.getX().umod(this.n).cmp(a)===0)},tn.prototype.recoverPubKey=function(r,e,t,i){Do((3&t)===t,"The recovery param is more than two bits"),e=new Tl(e,i);var n=this.n,s=new En(r),a=e.r,f=e.s,h=t&1,u=t>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?a=this.curve.pointFromX(a.add(this.curve.n),h):a=this.curve.pointFromX(a,h);var g=e.r.invm(n),w=n.sub(s).mul(g).umod(n),M=f.mul(g).umod(n);return this.g.mulAdd(w,a,M)},tn.prototype.getKeyRecoveryParam=function(r,e,t,i){if(e=new Tl(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(r,e,n)}catch{continue}if(s.eq(t))return n}throw new Error("Unable to find valid recovery factor")};var jc=Li,ym=jc.assert,_m=jc.parseBytes,Ba=jc.cachedProperty;function Nr(r,e){this.eddsa=r,this._secret=_m(e.secret),r.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=_m(e.pub)}Nr.fromPublic=function(e,t){return t instanceof Nr?t:new Nr(e,{pub:t})},Nr.fromSecret=function(e,t){return t instanceof Nr?t:new Nr(e,{secret:t})},Nr.prototype.secret=function(){return this._secret},Ba(Nr,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),Ba(Nr,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),Ba(Nr,"privBytes",function(){var e=this.eddsa,t=this.hash(),i=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[i]&=127,n[i]|=64,n}),Ba(Nr,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),Ba(Nr,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),Ba(Nr,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),Nr.prototype.sign=function(e){return ym(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Nr.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},Nr.prototype.getSecret=function(e){return ym(this._secret,"KeyPair is public only"),jc.encode(this.secret(),e)},Nr.prototype.getPublic=function(e){return jc.encode(this.pubBytes(),e)};var _x=Nr,xx=Jn.exports,Nl=Li,xm=Nl.assert,$l=Nl.cachedProperty,Ax=Nl.parseBytes;function Oo(r,e){this.eddsa=r,typeof e!="object"&&(e=Ax(e)),Array.isArray(e)&&(xm(e.length===r.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,r.encodingLength),S:e.slice(r.encodingLength)}),xm(e.R&&e.S,"Signature without R or S"),r.isPoint(e.R)&&(this._R=e.R),e.S instanceof xx&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}$l(Oo,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),$l(Oo,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),$l(Oo,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),$l(Oo,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),Oo.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Oo.prototype.toHex=function(){return Nl.encode(this.toBytes(),"hex").toUpperCase()};var Ex=Oo,Sx=Ri,Ix=Dl,Fa=Li,Mx=Fa.assert,Am=Fa.parseBytes,Em=_x,Sm=Ex;function mi(r){if(Mx(r==="ed25519","only tested with ed25519 so far"),!(this instanceof mi))return new mi(r);r=Ix[r].curve,this.curve=r,this.g=r.g,this.g.precompute(r.n.bitLength()+1),this.pointClass=r.point().constructor,this.encodingLength=Math.ceil(r.n.bitLength()/8),this.hash=Sx.sha512}var Cx=mi;mi.prototype.sign=function(e,t){e=Am(e);var i=this.keyFromSecret(t),n=this.hashInt(i.messagePrefix(),e),s=this.g.mul(n),a=this.encodePoint(s),f=this.hashInt(a,i.pubBytes(),e).mul(i.priv()),h=n.add(f).umod(this.curve.n);return this.makeSignature({R:s,S:h,Rencoded:a})},mi.prototype.verify=function(e,t,i){if(e=Am(e),t=this.makeSignature(t),t.S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var n=this.keyFromPublic(i),s=this.hashInt(t.Rencoded(),n.pubBytes(),e),a=this.g.mul(t.S()),f=t.R().add(n.pub().mul(s));return f.eq(a)},mi.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return Fa.intFromLE(e.digest()).umod(this.curve.n)},mi.prototype.keyFromPublic=function(e){return Em.fromPublic(this,e)},mi.prototype.keyFromSecret=function(e){return Em.fromSecret(this,e)},mi.prototype.makeSignature=function(e){return e instanceof Sm?e:new Sm(this,e)},mi.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},mi.prototype.decodePoint=function(e){e=Fa.parseBytes(e);var t=e.length-1,i=e.slice(0,t).concat(e[t]&-129),n=(e[t]&128)!==0,s=Fa.intFromLE(i);return this.curve.pointFromY(s,n)},mi.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},mi.prototype.decodeInt=function(e){return Fa.intFromLE(e)},mi.prototype.isPoint=function(e){return e instanceof this.pointClass},function(r){var e=r;e.version=X9.version,e.utils=Li,e.rand=El.exports,e.curve=Fd,e.curves=Dl,e.ec=yx,e.eddsa=Cx}(um);var Vd={},Im={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=yt,t=Ni;r.DIGEST_LENGTH=64,r.BLOCK_SIZE=128;var i=function(){function f(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return f.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},f.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},f.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._tempHi),t.wipe(this._tempLo),this.reset()},f.prototype.update=function(h,u){if(u===void 0&&(u=h.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var g=0;if(this._bytesHashed+=u,this._bufferLength>0){for(;this._bufferLength<r.BLOCK_SIZE&&u>0;)this._buffer[this._bufferLength++]=h[g++],u--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(u>=this.blockSize&&(g=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,h,g,u),u%=this.blockSize);u>0;)this._buffer[this._bufferLength++]=h[g++],u--;return this},f.prototype.finish=function(h){if(!this._finished){var u=this._bytesHashed,g=this._bufferLength,w=u/536870912|0,M=u<<3,C=u%128<112?128:256;this._buffer[g]=128;for(var O=g+1;O<C-8;O++)this._buffer[O]=0;e.writeUint32BE(w,this._buffer,C-8),e.writeUint32BE(M,this._buffer,C-4),s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,C),this._finished=!0}for(var O=0;O<this.digestLength/8;O++)e.writeUint32BE(this._stateHi[O],h,O*8),e.writeUint32BE(this._stateLo[O],h,O*8+4);return this},f.prototype.digest=function(){var h=new Uint8Array(this.digestLength);return this.finish(h),h},f.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},f.prototype.restoreState=function(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},f.prototype.cleanSavedState=function(h){t.wipe(h.stateHi),t.wipe(h.stateLo),h.buffer&&t.wipe(h.buffer),h.bufferLength=0,h.bytesHashed=0},f}();r.SHA512=i;var n=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(f,h,u,g,w,M,C){for(var O=u[0],N=u[1],j=u[2],H=u[3],F=u[4],G=u[5],B=u[6],z=u[7],W=g[0],_=g[1],U=g[2],ee=g[3],oe=g[4],L=g[5],b=g[6],m=g[7],l,d,y,P,D,S,v,A;C>=128;){for(var x=0;x<16;x++){var $=8*x+M;f[x]=e.readUint32BE(w,$),h[x]=e.readUint32BE(w,$+4)}for(var x=0;x<80;x++){var ae=O,R=N,X=j,V=H,J=F,K=G,E=B,Y=z,re=W,le=_,he=U,ge=ee,He=oe,Te=L,Ce=b,Xe=m;if(l=z,d=m,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=(F>>>14|oe<<32-14)^(F>>>18|oe<<32-18)^(oe>>>41-32|F<<32-(41-32)),d=(oe>>>14|F<<32-14)^(oe>>>18|F<<32-18)^(F>>>41-32|oe<<32-(41-32)),D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,l=F&G^~F&B,d=oe&L^~oe&b,D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,l=n[x*2],d=n[x*2+1],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,l=f[x%16],d=h[x%16],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,y=v&65535|A<<16,P=D&65535|S<<16,l=y,d=P,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=(O>>>28|W<<32-28)^(W>>>34-32|O<<32-(34-32))^(W>>>39-32|O<<32-(39-32)),d=(W>>>28|O<<32-28)^(O>>>34-32|W<<32-(34-32))^(O>>>39-32|W<<32-(39-32)),D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,l=O&N^O&j^N&j,d=W&_^W&U^_&U,D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,Y=v&65535|A<<16,Xe=D&65535|S<<16,l=V,d=ge,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=y,d=P,D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,V=v&65535|A<<16,ge=D&65535|S<<16,N=ae,j=R,H=X,F=V,G=J,B=K,z=E,O=Y,_=re,U=le,ee=he,oe=ge,L=He,b=Te,m=Ce,W=Xe,x%16===15)for(var $=0;$<16;$++)l=f[$],d=h[$],D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=f[($+9)%16],d=h[($+9)%16],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,y=f[($+1)%16],P=h[($+1)%16],l=(y>>>1|P<<32-1)^(y>>>8|P<<32-8)^y>>>7,d=(P>>>1|y<<32-1)^(P>>>8|y<<32-8)^(P>>>7|y<<32-7),D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,y=f[($+14)%16],P=h[($+14)%16],l=(y>>>19|P<<32-19)^(P>>>61-32|y<<32-(61-32))^y>>>6,d=(P>>>19|y<<32-19)^(y>>>61-32|P<<32-(61-32))^(P>>>6|y<<32-6),D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,f[$]=v&65535|A<<16,h[$]=D&65535|S<<16}l=O,d=W,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=u[0],d=g[0],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,u[0]=O=v&65535|A<<16,g[0]=W=D&65535|S<<16,l=N,d=_,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=u[1],d=g[1],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,u[1]=N=v&65535|A<<16,g[1]=_=D&65535|S<<16,l=j,d=U,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=u[2],d=g[2],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,u[2]=j=v&65535|A<<16,g[2]=U=D&65535|S<<16,l=H,d=ee,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=u[3],d=g[3],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,u[3]=H=v&65535|A<<16,g[3]=ee=D&65535|S<<16,l=F,d=oe,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=u[4],d=g[4],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,u[4]=F=v&65535|A<<16,g[4]=oe=D&65535|S<<16,l=G,d=L,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=u[5],d=g[5],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,u[5]=G=v&65535|A<<16,g[5]=L=D&65535|S<<16,l=B,d=b,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=u[6],d=g[6],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,u[6]=B=v&65535|A<<16,g[6]=b=D&65535|S<<16,l=z,d=m,D=d&65535,S=d>>>16,v=l&65535,A=l>>>16,l=u[7],d=g[7],D+=d&65535,S+=d>>>16,v+=l&65535,A+=l>>>16,S+=D>>>16,v+=S>>>16,A+=v>>>16,u[7]=z=v&65535|A<<16,g[7]=m=D&65535|S<<16,M+=128,C-=128}return M}function a(f){var h=new i;h.update(f);var u=h.digest();return h.clean(),u}r.hash=a})(Im),function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertSecretKeyToX25519=r.convertPublicKeyToX25519=r.verify=r.sign=r.extractPublicKeyFromSecretKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.SEED_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=r.SIGNATURE_LENGTH=void 0;const e=ks,t=Im,i=Ni;r.SIGNATURE_LENGTH=64,r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=64,r.SEED_LENGTH=32;function n(V){const J=new Float64Array(16);if(V)for(let K=0;K<V.length;K++)J[K]=V[K];return J}const s=new Uint8Array(32);s[0]=9;const a=n(),f=n([1]),h=n([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),u=n([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),g=n([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),w=n([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),M=n([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function C(V,J){for(let K=0;K<16;K++)V[K]=J[K]|0}function O(V){let J=1;for(let K=0;K<16;K++){let E=V[K]+J+65535;J=Math.floor(E/65536),V[K]=E-J*65536}V[0]+=J-1+37*(J-1)}function N(V,J,K){const E=~(K-1);for(let Y=0;Y<16;Y++){const re=E&(V[Y]^J[Y]);V[Y]^=re,J[Y]^=re}}function j(V,J){const K=n(),E=n();for(let Y=0;Y<16;Y++)E[Y]=J[Y];O(E),O(E),O(E);for(let Y=0;Y<2;Y++){K[0]=E[0]-65517;for(let le=1;le<15;le++)K[le]=E[le]-65535-(K[le-1]>>16&1),K[le-1]&=65535;K[15]=E[15]-32767-(K[14]>>16&1);const re=K[15]>>16&1;K[14]&=65535,N(E,K,1-re)}for(let Y=0;Y<16;Y++)V[2*Y]=E[Y]&255,V[2*Y+1]=E[Y]>>8}function H(V,J){let K=0;for(let E=0;E<32;E++)K|=V[E]^J[E];return(1&K-1>>>8)-1}function F(V,J){const K=new Uint8Array(32),E=new Uint8Array(32);return j(K,V),j(E,J),H(K,E)}function G(V){const J=new Uint8Array(32);return j(J,V),J[0]&1}function B(V,J){for(let K=0;K<16;K++)V[K]=J[2*K]+(J[2*K+1]<<8);V[15]&=32767}function z(V,J,K){for(let E=0;E<16;E++)V[E]=J[E]+K[E]}function W(V,J,K){for(let E=0;E<16;E++)V[E]=J[E]-K[E]}function _(V,J,K){let E,Y,re=0,le=0,he=0,ge=0,He=0,Te=0,Ce=0,Xe=0,Ne=0,be=0,Pe=0,De=0,ye=0,Ie=0,Oe=0,me=0,Me=0,Be=0,we=0,ke=0,We=0,Ae=0,Ve=0,Ke=0,Ge=0,mt=0,It=0,Ye=0,Pt=0,Ot=0,Ze=0,rt=K[0],et=K[1],$e=K[2],it=K[3],tt=K[4],Re=K[5],lt=K[6],ht=K[7],Le=K[8],ut=K[9],nt=K[10],Fe=K[11],st=K[12],Qe=K[13],qe=K[14],dt=K[15];E=J[0],re+=E*rt,le+=E*et,he+=E*$e,ge+=E*it,He+=E*tt,Te+=E*Re,Ce+=E*lt,Xe+=E*ht,Ne+=E*Le,be+=E*ut,Pe+=E*nt,De+=E*Fe,ye+=E*st,Ie+=E*Qe,Oe+=E*qe,me+=E*dt,E=J[1],le+=E*rt,he+=E*et,ge+=E*$e,He+=E*it,Te+=E*tt,Ce+=E*Re,Xe+=E*lt,Ne+=E*ht,be+=E*Le,Pe+=E*ut,De+=E*nt,ye+=E*Fe,Ie+=E*st,Oe+=E*Qe,me+=E*qe,Me+=E*dt,E=J[2],he+=E*rt,ge+=E*et,He+=E*$e,Te+=E*it,Ce+=E*tt,Xe+=E*Re,Ne+=E*lt,be+=E*ht,Pe+=E*Le,De+=E*ut,ye+=E*nt,Ie+=E*Fe,Oe+=E*st,me+=E*Qe,Me+=E*qe,Be+=E*dt,E=J[3],ge+=E*rt,He+=E*et,Te+=E*$e,Ce+=E*it,Xe+=E*tt,Ne+=E*Re,be+=E*lt,Pe+=E*ht,De+=E*Le,ye+=E*ut,Ie+=E*nt,Oe+=E*Fe,me+=E*st,Me+=E*Qe,Be+=E*qe,we+=E*dt,E=J[4],He+=E*rt,Te+=E*et,Ce+=E*$e,Xe+=E*it,Ne+=E*tt,be+=E*Re,Pe+=E*lt,De+=E*ht,ye+=E*Le,Ie+=E*ut,Oe+=E*nt,me+=E*Fe,Me+=E*st,Be+=E*Qe,we+=E*qe,ke+=E*dt,E=J[5],Te+=E*rt,Ce+=E*et,Xe+=E*$e,Ne+=E*it,be+=E*tt,Pe+=E*Re,De+=E*lt,ye+=E*ht,Ie+=E*Le,Oe+=E*ut,me+=E*nt,Me+=E*Fe,Be+=E*st,we+=E*Qe,ke+=E*qe,We+=E*dt,E=J[6],Ce+=E*rt,Xe+=E*et,Ne+=E*$e,be+=E*it,Pe+=E*tt,De+=E*Re,ye+=E*lt,Ie+=E*ht,Oe+=E*Le,me+=E*ut,Me+=E*nt,Be+=E*Fe,we+=E*st,ke+=E*Qe,We+=E*qe,Ae+=E*dt,E=J[7],Xe+=E*rt,Ne+=E*et,be+=E*$e,Pe+=E*it,De+=E*tt,ye+=E*Re,Ie+=E*lt,Oe+=E*ht,me+=E*Le,Me+=E*ut,Be+=E*nt,we+=E*Fe,ke+=E*st,We+=E*Qe,Ae+=E*qe,Ve+=E*dt,E=J[8],Ne+=E*rt,be+=E*et,Pe+=E*$e,De+=E*it,ye+=E*tt,Ie+=E*Re,Oe+=E*lt,me+=E*ht,Me+=E*Le,Be+=E*ut,we+=E*nt,ke+=E*Fe,We+=E*st,Ae+=E*Qe,Ve+=E*qe,Ke+=E*dt,E=J[9],be+=E*rt,Pe+=E*et,De+=E*$e,ye+=E*it,Ie+=E*tt,Oe+=E*Re,me+=E*lt,Me+=E*ht,Be+=E*Le,we+=E*ut,ke+=E*nt,We+=E*Fe,Ae+=E*st,Ve+=E*Qe,Ke+=E*qe,Ge+=E*dt,E=J[10],Pe+=E*rt,De+=E*et,ye+=E*$e,Ie+=E*it,Oe+=E*tt,me+=E*Re,Me+=E*lt,Be+=E*ht,we+=E*Le,ke+=E*ut,We+=E*nt,Ae+=E*Fe,Ve+=E*st,Ke+=E*Qe,Ge+=E*qe,mt+=E*dt,E=J[11],De+=E*rt,ye+=E*et,Ie+=E*$e,Oe+=E*it,me+=E*tt,Me+=E*Re,Be+=E*lt,we+=E*ht,ke+=E*Le,We+=E*ut,Ae+=E*nt,Ve+=E*Fe,Ke+=E*st,Ge+=E*Qe,mt+=E*qe,It+=E*dt,E=J[12],ye+=E*rt,Ie+=E*et,Oe+=E*$e,me+=E*it,Me+=E*tt,Be+=E*Re,we+=E*lt,ke+=E*ht,We+=E*Le,Ae+=E*ut,Ve+=E*nt,Ke+=E*Fe,Ge+=E*st,mt+=E*Qe,It+=E*qe,Ye+=E*dt,E=J[13],Ie+=E*rt,Oe+=E*et,me+=E*$e,Me+=E*it,Be+=E*tt,we+=E*Re,ke+=E*lt,We+=E*ht,Ae+=E*Le,Ve+=E*ut,Ke+=E*nt,Ge+=E*Fe,mt+=E*st,It+=E*Qe,Ye+=E*qe,Pt+=E*dt,E=J[14],Oe+=E*rt,me+=E*et,Me+=E*$e,Be+=E*it,we+=E*tt,ke+=E*Re,We+=E*lt,Ae+=E*ht,Ve+=E*Le,Ke+=E*ut,Ge+=E*nt,mt+=E*Fe,It+=E*st,Ye+=E*Qe,Pt+=E*qe,Ot+=E*dt,E=J[15],me+=E*rt,Me+=E*et,Be+=E*$e,we+=E*it,ke+=E*tt,We+=E*Re,Ae+=E*lt,Ve+=E*ht,Ke+=E*Le,Ge+=E*ut,mt+=E*nt,It+=E*Fe,Ye+=E*st,Pt+=E*Qe,Ot+=E*qe,Ze+=E*dt,re+=38*Me,le+=38*Be,he+=38*we,ge+=38*ke,He+=38*We,Te+=38*Ae,Ce+=38*Ve,Xe+=38*Ke,Ne+=38*Ge,be+=38*mt,Pe+=38*It,De+=38*Ye,ye+=38*Pt,Ie+=38*Ot,Oe+=38*Ze,Y=1,E=re+Y+65535,Y=Math.floor(E/65536),re=E-Y*65536,E=le+Y+65535,Y=Math.floor(E/65536),le=E-Y*65536,E=he+Y+65535,Y=Math.floor(E/65536),he=E-Y*65536,E=ge+Y+65535,Y=Math.floor(E/65536),ge=E-Y*65536,E=He+Y+65535,Y=Math.floor(E/65536),He=E-Y*65536,E=Te+Y+65535,Y=Math.floor(E/65536),Te=E-Y*65536,E=Ce+Y+65535,Y=Math.floor(E/65536),Ce=E-Y*65536,E=Xe+Y+65535,Y=Math.floor(E/65536),Xe=E-Y*65536,E=Ne+Y+65535,Y=Math.floor(E/65536),Ne=E-Y*65536,E=be+Y+65535,Y=Math.floor(E/65536),be=E-Y*65536,E=Pe+Y+65535,Y=Math.floor(E/65536),Pe=E-Y*65536,E=De+Y+65535,Y=Math.floor(E/65536),De=E-Y*65536,E=ye+Y+65535,Y=Math.floor(E/65536),ye=E-Y*65536,E=Ie+Y+65535,Y=Math.floor(E/65536),Ie=E-Y*65536,E=Oe+Y+65535,Y=Math.floor(E/65536),Oe=E-Y*65536,E=me+Y+65535,Y=Math.floor(E/65536),me=E-Y*65536,re+=Y-1+37*(Y-1),Y=1,E=re+Y+65535,Y=Math.floor(E/65536),re=E-Y*65536,E=le+Y+65535,Y=Math.floor(E/65536),le=E-Y*65536,E=he+Y+65535,Y=Math.floor(E/65536),he=E-Y*65536,E=ge+Y+65535,Y=Math.floor(E/65536),ge=E-Y*65536,E=He+Y+65535,Y=Math.floor(E/65536),He=E-Y*65536,E=Te+Y+65535,Y=Math.floor(E/65536),Te=E-Y*65536,E=Ce+Y+65535,Y=Math.floor(E/65536),Ce=E-Y*65536,E=Xe+Y+65535,Y=Math.floor(E/65536),Xe=E-Y*65536,E=Ne+Y+65535,Y=Math.floor(E/65536),Ne=E-Y*65536,E=be+Y+65535,Y=Math.floor(E/65536),be=E-Y*65536,E=Pe+Y+65535,Y=Math.floor(E/65536),Pe=E-Y*65536,E=De+Y+65535,Y=Math.floor(E/65536),De=E-Y*65536,E=ye+Y+65535,Y=Math.floor(E/65536),ye=E-Y*65536,E=Ie+Y+65535,Y=Math.floor(E/65536),Ie=E-Y*65536,E=Oe+Y+65535,Y=Math.floor(E/65536),Oe=E-Y*65536,E=me+Y+65535,Y=Math.floor(E/65536),me=E-Y*65536,re+=Y-1+37*(Y-1),V[0]=re,V[1]=le,V[2]=he,V[3]=ge,V[4]=He,V[5]=Te,V[6]=Ce,V[7]=Xe,V[8]=Ne,V[9]=be,V[10]=Pe,V[11]=De,V[12]=ye,V[13]=Ie,V[14]=Oe,V[15]=me}function U(V,J){_(V,J,J)}function ee(V,J){const K=n();let E;for(E=0;E<16;E++)K[E]=J[E];for(E=253;E>=0;E--)U(K,K),E!==2&&E!==4&&_(K,K,J);for(E=0;E<16;E++)V[E]=K[E]}function oe(V,J){const K=n();let E;for(E=0;E<16;E++)K[E]=J[E];for(E=250;E>=0;E--)U(K,K),E!==1&&_(K,K,J);for(E=0;E<16;E++)V[E]=K[E]}function L(V,J){const K=n(),E=n(),Y=n(),re=n(),le=n(),he=n(),ge=n(),He=n(),Te=n();W(K,V[1],V[0]),W(Te,J[1],J[0]),_(K,K,Te),z(E,V[0],V[1]),z(Te,J[0],J[1]),_(E,E,Te),_(Y,V[3],J[3]),_(Y,Y,u),_(re,V[2],J[2]),z(re,re,re),W(le,E,K),W(he,re,Y),z(ge,re,Y),z(He,E,K),_(V[0],le,he),_(V[1],He,ge),_(V[2],ge,he),_(V[3],le,He)}function b(V,J,K){for(let E=0;E<4;E++)N(V[E],J[E],K)}function m(V,J){const K=n(),E=n(),Y=n();ee(Y,J[2]),_(K,J[0],Y),_(E,J[1],Y),j(V,E),V[31]^=G(K)<<7}function l(V,J,K){C(V[0],a),C(V[1],f),C(V[2],f),C(V[3],a);for(let E=255;E>=0;--E){const Y=K[E/8|0]>>(E&7)&1;b(V,J,Y),L(J,V),L(V,V),b(V,J,Y)}}function d(V,J){const K=[n(),n(),n(),n()];C(K[0],g),C(K[1],w),C(K[2],f),_(K[3],g,w),l(V,K,J)}function y(V){if(V.length!==r.SEED_LENGTH)throw new Error(`ed25519: seed must be ${r.SEED_LENGTH} bytes`);const J=(0,t.hash)(V);J[0]&=248,J[31]&=127,J[31]|=64;const K=new Uint8Array(32),E=[n(),n(),n(),n()];d(E,J),m(K,E);const Y=new Uint8Array(64);return Y.set(V),Y.set(K,32),{publicKey:K,secretKey:Y}}r.generateKeyPairFromSeed=y;function P(V){const J=(0,e.randomBytes)(32,V),K=y(J);return(0,i.wipe)(J),K}r.generateKeyPair=P;function D(V){if(V.length!==r.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${r.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(V.subarray(32))}r.extractPublicKeyFromSecretKey=D;const S=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 v(V,J){let K,E,Y,re;for(E=63;E>=32;--E){for(K=0,Y=E-32,re=E-12;Y<re;++Y)J[Y]+=K-16*J[E]*S[Y-(E-32)],K=Math.floor((J[Y]+128)/256),J[Y]-=K*256;J[Y]+=K,J[E]=0}for(K=0,Y=0;Y<32;Y++)J[Y]+=K-(J[31]>>4)*S[Y],K=J[Y]>>8,J[Y]&=255;for(Y=0;Y<32;Y++)J[Y]-=K*S[Y];for(E=0;E<32;E++)J[E+1]+=J[E]>>8,V[E]=J[E]&255}function A(V){const J=new Float64Array(64);for(let K=0;K<64;K++)J[K]=V[K];for(let K=0;K<64;K++)V[K]=0;v(V,J)}function x(V,J){const K=new Float64Array(64),E=[n(),n(),n(),n()],Y=(0,t.hash)(V.subarray(0,32));Y[0]&=248,Y[31]&=127,Y[31]|=64;const re=new Uint8Array(64);re.set(Y.subarray(32),32);const le=new t.SHA512;le.update(re.subarray(32)),le.update(J);const he=le.digest();le.clean(),A(he),d(E,he),m(re,E),le.reset(),le.update(re.subarray(0,32)),le.update(V.subarray(32)),le.update(J);const ge=le.digest();A(ge);for(let He=0;He<32;He++)K[He]=he[He];for(let He=0;He<32;He++)for(let Te=0;Te<32;Te++)K[He+Te]+=ge[He]*Y[Te];return v(re.subarray(32),K),re}r.sign=x;function $(V,J){const K=n(),E=n(),Y=n(),re=n(),le=n(),he=n(),ge=n();return C(V[2],f),B(V[1],J),U(Y,V[1]),_(re,Y,h),W(Y,Y,V[2]),z(re,V[2],re),U(le,re),U(he,le),_(ge,he,le),_(K,ge,Y),_(K,K,re),oe(K,K),_(K,K,Y),_(K,K,re),_(K,K,re),_(V[0],K,re),U(E,V[0]),_(E,E,re),F(E,Y)&&_(V[0],V[0],M),U(E,V[0]),_(E,E,re),F(E,Y)?-1:(G(V[0])===J[31]>>7&&W(V[0],a,V[0]),_(V[3],V[0],V[1]),0)}function ae(V,J,K){const E=new Uint8Array(32),Y=[n(),n(),n(),n()],re=[n(),n(),n(),n()];if(K.length!==r.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${r.SIGNATURE_LENGTH} bytes`);if($(re,V))return!1;const le=new t.SHA512;le.update(K.subarray(0,32)),le.update(V),le.update(J);const he=le.digest();return A(he),l(Y,re,he),d(re,K.subarray(32)),L(Y,re),m(E,Y),!H(K,E)}r.verify=ae;function R(V){let J=[n(),n(),n(),n()];if($(J,V))throw new Error("Ed25519: invalid public key");let K=n(),E=n(),Y=J[1];z(K,f,Y),W(E,f,Y),ee(E,E),_(K,K,E);let re=new Uint8Array(32);return j(re,K),re}r.convertPublicKeyToX25519=R;function X(V){const J=(0,t.hash)(V.subarray(0,32));J[0]&=248,J[31]&=127,J[31]|=64;const K=new Uint8Array(J.subarray(0,32));return(0,i.wipe)(J),K}r.convertSecretKeyToX25519=X}(Vd);const Px="EdDSA",Dx="JWT",Ll=".",Bl="base64url",Mm="utf8",Cm="utf8",Ox=":",Rx="did",Tx="key",Pm="base58btc",Nx="z",$x="K36",Lx=32;function Gd(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function Dm(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Gd(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Bx(r,e){e||(e=r.reduce((n,s)=>n+s.length,0));const t=Dm(e);let i=0;for(const n of r)t.set(n,i),i+=n.length;return Gd(t)}function Om(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const Rm=Om("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Yd=Om("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=Dm(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),Tm={utf8:Rm,"utf-8":Rm,hex:Ta.base16,latin1:Yd,ascii:Yd,binary:Yd,...Ta};function Fl(r,e="utf8"){const t=Tm[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}function Ua(r,e="utf8"){const t=Tm[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Gd(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}const Fx=r=>JSON.stringify(r,(e,t)=>typeof t=="bigint"?t.toString()+"n":t),Ux=r=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,t=r.replace(e,'$1"$2n"$3');return JSON.parse(t,(i,n)=>typeof n=="string"&&n.match(/^\d+n$/)?BigInt(n.substring(0,n.length-1)):n)};function Ro(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return Ux(r)}catch{return r}}function bs(r){return typeof r=="string"?r:Fx(r)||""}function Nm(r){return Ro(Fl(Ua(r,Bl),Mm))}function Ul(r){return Fl(Ua(bs(r),Mm),Bl)}function $m(r){const e=Ua($x,Pm),t=Nx+Fl(Bx([e,r]),Pm);return[Rx,Tx,t].join(Ox)}function qx(r){return Fl(r,Bl)}function zx(r){return Ua(r,Bl)}function Hx(r){return Ua([Ul(r.header),Ul(r.payload)].join(Ll),Cm)}function kx(r){return[Ul(r.header),Ul(r.payload),qx(r.signature)].join(Ll)}function Jd(r){const e=r.split(Ll),t=Nm(e[0]),i=Nm(e[1]),n=zx(e[2]),s=Ua(e.slice(0,2).join(Ll),Cm);return{header:t,payload:i,signature:n,data:s}}function Lm(r=ks.randomBytes(Lx)){return Vd.generateKeyPairFromSeed(r)}async function jx(r,e,t,i,n=_e.fromMiliseconds(Date.now())){const s={alg:Px,typ:Dx},a=$m(i.publicKey),f=n+t,h={iss:a,sub:r,aud:e,iat:n,exp:f},u=Hx({header:s,payload:h}),g=Vd.sign(i.secretKey,u);return kx({header:s,payload:h,signature:g})}const Wx={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}},Kx=":";function qa(r){const[e,t]=r.split(Kx);return{namespace:e,reference:t}}function Bm(r,e=[]){const t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;const n=r[i];t.push(...n.accounts)}),t}function Fm(r,e){return r.includes(":")?[r]:e.chains||[]}var Vx=Object.defineProperty,Um=Object.getOwnPropertySymbols,Gx=Object.prototype.hasOwnProperty,Yx=Object.prototype.propertyIsEnumerable,qm=(r,e,t)=>e in r?Vx(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,zm=(r,e)=>{for(var t in e||(e={}))Gx.call(e,t)&&qm(r,t,e[t]);if(Um)for(var t of Um(e))Yx.call(e,t)&&qm(r,t,e[t]);return r};const Jx="ReactNative",Bi={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Qx="js";function ql(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Vs(){return!Oc()&&!!Zu()&&navigator.product===Jx}function Zx(){return Vs()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="android"}function Xx(){return Vs()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="ios"}function Wc(){return!ql()&&!!Zu()&&!!Oc()}function Kc(){return Vs()?Bi.reactNative:ql()?Bi.node:Wc()?Bi.browser:Bi.unknown}function Hm(){var r;try{return Vs()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(r=global.Application)==null?void 0:r.applicationId:void 0}catch{return}}function eA(r,e){let t=Rc.parse(r);return t=zm(zm({},t),e),r=Rc.stringify(t),r}function km(){return Cg()||{name:"",description:"",url:"",icons:[""]}}function tA(){if(Kc()===Bi.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:t,Version:i}=global.Platform;return[t,i].join("-")}const r=c5();if(r===null)return"unknown";const e=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[e,r.name,r.version].join("-"):[e,r.version].join("-")}function rA(){var r;const e=Kc();return e===Bi.browser?[e,((r=Mg())==null?void 0:r.host)||"unknown"].join(":"):e}function jm(r,e,t){const i=tA(),n=rA();return[[r,e].join("-"),[Qx,t].join("-"),i,n].join("/")}function iA({protocol:r,version:e,relayUrl:t,sdkVersion:i,auth:n,projectId:s,useOnCloseEvent:a,bundleId:f,packageName:h}){const u=t.split("?"),g=jm(r,e,i),w={auth:n,ua:g,projectId:s,useOnCloseEvent:a||void 0,packageName:h||void 0,bundleId:f||void 0},M=eA(u[1]||"",w);return u[0]+"?"+M}function To(r,e){return r.filter(t=>e.includes(t)).length===r.length}function Wm(r){return Object.fromEntries(r.entries())}function Km(r){return new Map(Object.entries(r))}function No(r=_e.FIVE_MINUTES,e){const t=_e.toMiliseconds(r||_e.FIVE_MINUTES);let i,n,s,a;return{resolve:f=>{s&&i&&(clearTimeout(s),i(f),a=Promise.resolve(f))},reject:f=>{s&&n&&(clearTimeout(s),n(f))},done:()=>new Promise((f,h)=>{if(a)return f(a);s=setTimeout(()=>{const u=new Error(e);a=Promise.reject(u),h(u)},t),i=f,n=h})}}function Gs(r,e,t){return new Promise(async(i,n)=>{const s=setTimeout(()=>n(new Error(t)),e);try{const a=await r;i(a)}catch(a){n(a)}clearTimeout(s)})}function Vm(r,e){if(typeof e=="string"&&e.startsWith(`${r}:`))return e;if(r.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(r.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${r}`)}function nA(r){return Vm("topic",r)}function sA(r){return Vm("id",r)}function Gm(r){const[e,t]=r.split(":"),i={id:void 0,topic:void 0};if(e==="topic"&&typeof t=="string")i.topic=t;else if(e==="id"&&Number.isInteger(Number(t)))i.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${t}`);return i}function Ir(r,e){return _e.fromMiliseconds((e||Date.now())+_e.toMiliseconds(r))}function Ys(r){return Date.now()>=_e.toMiliseconds(r)}function Dt(r,e){return`${r}${e?`:${e}`:""}`}function zl(r=[],e=[]){return[...new Set([...r,...e])]}async function oA({id:r,topic:e,wcDeepLink:t}){var i;try{if(!t)return;const n=typeof t=="string"?JSON.parse(t):t,s=n?.href;if(typeof s!="string")return;const a=aA(s,r,e),f=Kc();if(f===Bi.browser){if(!((i=Oc())!=null&&i.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}a.startsWith("https://")||a.startsWith("http://")?window.open(a,"_blank","noreferrer noopener"):window.open(a,fA()?"_blank":"_self","noreferrer noopener")}else f===Bi.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(a)}catch(n){console.error(n)}}function aA(r,e,t){const i=`requestId=${e}&sessionTopic=${t}`;r.endsWith("/")&&(r=r.slice(0,-1));let n=`${r}`;if(r.startsWith("https://t.me")){const s=r.includes("?")?"&startapp=":"?startapp=";n=`${n}${s}${lA(i,!0)}`}else n=`${n}/wc?${i}`;return n}async function cA(r,e){let t="";try{if(Wc()&&(t=localStorage.getItem(e),t))return t;t=await r.getItem(e)}catch(i){console.error(i)}return t}function Ym(r,e){if(!r.includes(e))return null;const t=r.split(/([&,?,=])/),i=t.indexOf(e);return t[i+2]}function Jm(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,r=>{const e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)})}function Qd(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function fA(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function lA(r,e=!1){const t=Buffer.from(r).toString("base64");return e?t.replace(/[=]/g,""):t}function Qm(r){return Buffer.from(r,"base64").toString("utf-8")}function hA(r){return new Promise(e=>setTimeout(e,r))}const uA="https://rpc.walletconnect.org/v1";async function dA(r,e,t,i,n,s){switch(t.t){case"eip191":return pA(r,e,t.s);case"eip1271":return await gA(r,e,t.s,i,n,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${t.t}`)}}function pA(r,e,t){return R_(nv(e),t).toLowerCase()===r.toLowerCase()}async function gA(r,e,t,i,n,s){const a=qa(i);if(!a.namespace||!a.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${i}`);try{const f="0x1626ba7e",h="0000000000000000000000000000000000000000000000000000000000000040",u="0000000000000000000000000000000000000000000000000000000000000041",g=t.substring(2),w=nv(e).substring(2),M=f+w+h+u+g,C=await fetch(`${s||uA}/?chainId=${i}&projectId=${n}`,{method:"POST",body:JSON.stringify({id:vA(),jsonrpc:"2.0",method:"eth_call",params:[{to:r,data:M},"latest"]})}),{result:O}=await C.json();return O?O.slice(0,f.length).toLowerCase()===f.toLowerCase():!1}catch(f){return console.error("isValidEip1271Signature: ",f),!1}}function vA(){return Date.now()+Math.floor(Math.random()*1e3)}var mA=Object.defineProperty,bA=Object.defineProperties,wA=Object.getOwnPropertyDescriptors,Zm=Object.getOwnPropertySymbols,yA=Object.prototype.hasOwnProperty,_A=Object.prototype.propertyIsEnumerable,Xm=(r,e,t)=>e in r?mA(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,xA=(r,e)=>{for(var t in e||(e={}))yA.call(e,t)&&Xm(r,t,e[t]);if(Zm)for(var t of Zm(e))_A.call(e,t)&&Xm(r,t,e[t]);return r},AA=(r,e)=>bA(r,wA(e));const EA="did:pkh:",Zd=r=>r?.split(":"),SA=r=>{const e=r&&Zd(r);if(e)return r.includes(EA)?e[3]:e[1]},Xd=r=>{const e=r&&Zd(r);if(e)return e[2]+":"+e[3]},Hl=r=>{const e=r&&Zd(r);if(e)return e.pop()};async function eb(r){const{cacao:e,projectId:t}=r,{s:i,p:n}=e,s=tb(n,n.iss),a=Hl(n.iss);return await dA(a,s,i,Xd(n.iss),t)}const tb=(r,e)=>{const t=`${r.domain} wants you to sign in with your Ethereum account:`,i=Hl(e);if(!r.aud&&!r.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let n=r.statement||void 0;const s=`URI: ${r.aud||r.uri}`,a=`Version: ${r.version}`,f=`Chain ID: ${SA(e)}`,h=`Nonce: ${r.nonce}`,u=`Issued At: ${r.iat}`,g=r.exp?`Expiration Time: ${r.exp}`:void 0,w=r.nbf?`Not Before: ${r.nbf}`:void 0,M=r.requestId?`Request ID: ${r.requestId}`:void 0,C=r.resources?`Resources:${r.resources.map(N=>`
|
|
23
|
-
- ${
|
|
24
|
-
`)};function IA(r){return Buffer.from(JSON.stringify(r)).toString("base64")}function MA(r){return JSON.parse(Buffer.from(r,"base64").toString("utf-8"))}function $o(r){if(!r)throw new Error("No recap provided, value is undefined");if(!r.att)throw new Error("No `att` property found");const e=Object.keys(r.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(t=>{const i=r.att[t];if(Array.isArray(i))throw new Error(`Resource must be an object: ${t}`);if(typeof i!="object")throw new Error(`Resource must be an object: ${t}`);if(!Object.keys(i).length)throw new Error(`Resource object is empty: ${t}`);Object.keys(i).forEach(n=>{const s=i[n];if(!Array.isArray(s))throw new Error(`Ability limits ${n} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${n} is empty array, must be an array with objects`);s.forEach(a=>{if(typeof a!="object")throw new Error(`Ability limits (${n}) must be an array of objects, found: ${a}`)})})})}function CA(r,e,t,i={}){return t?.sort((n,s)=>n.localeCompare(s)),{att:{[r]:PA(e,t,i)}}}function PA(r,e,t={}){e=e?.sort((n,s)=>n.localeCompare(s));const i=e.map(n=>({[`${r}/${n}`]:[t]}));return Object.assign({},...i)}function rb(r){return $o(r),`urn:recap:${IA(r).replace(/=/g,"")}`}function Vc(r){const e=MA(r.replace("urn:recap:",""));return $o(e),e}function DA(r,e,t){const i=CA(r,e,t);return rb(i)}function OA(r){return r&&r.includes("urn:recap:")}function RA(r,e){const t=Vc(r),i=Vc(e),n=TA(t,i);return rb(n)}function TA(r,e){$o(r),$o(e);const t=Object.keys(r.att).concat(Object.keys(e.att)).sort((n,s)=>n.localeCompare(s)),i={att:{}};return t.forEach(n=>{var s,a;Object.keys(((s=r.att)==null?void 0:s[n])||{}).concat(Object.keys(((a=e.att)==null?void 0:a[n])||{})).sort((f,h)=>f.localeCompare(h)).forEach(f=>{var h,u;i.att[n]=AA(xA({},i.att[n]),{[f]:((h=r.att[n])==null?void 0:h[f])||((u=e.att[n])==null?void 0:u[f])})})}),i}function NA(r="",e){$o(e);const t="I further authorize the stated URI to perform the following actions on my behalf: ";if(r.includes(t))return r;const i=[];let n=0;Object.keys(e.att).forEach(f=>{const h=Object.keys(e.att[f]).map(w=>({ability:w.split("/")[0],action:w.split("/")[1]}));h.sort((w,M)=>w.action.localeCompare(M.action));const u={};h.forEach(w=>{u[w.ability]||(u[w.ability]=[]),u[w.ability].push(w.action)});const g=Object.keys(u).map(w=>(n++,`(${n}) '${w}': '${u[w].join("', '")}' for '${f}'.`));i.push(g.join(", ").replace(".,","."))});const s=i.join(" "),a=`${t}${s}`;return`${r?r+" ":""}${a}`}function ib(r){var e;const t=Vc(r);$o(t);const i=(e=t.att)==null?void 0:e.eip155;return i?Object.keys(i).map(n=>n.split("/")[1]):[]}function nb(r){const e=Vc(r);$o(e);const t=[];return Object.values(e.att).forEach(i=>{Object.values(i).forEach(n=>{var s;(s=n?.[0])!=null&&s.chains&&t.push(n[0].chains)})}),[...new Set(t.flat())]}function kl(r){if(!r)return;const e=r?.[r.length-1];return OA(e)?e:void 0}const sb="base10",oi="base16",Js="base64pad",Gc="base64url",Yc="utf8",ob=0,ws=1,Jc=2,$A=0,ab=1,Qc=12,e0=32;function LA(){const r=Od.generateKeyPair();return{privateKey:$i(r.secretKey,oi),publicKey:$i(r.publicKey,oi)}}function t0(){const r=ks.randomBytes(e0);return $i(r,oi)}function BA(r,e){const t=Od.sharedKey(Zi(r,oi),Zi(e,oi),!0),i=new u7(zc.SHA256,t).expand(e0);return $i(i,oi)}function jl(r){const e=zc.hash(Zi(r,oi));return $i(e,oi)}function ys(r){const e=zc.hash(Zi(r,Yc));return $i(e,oi)}function cb(r){return Zi(`${r}`,sb)}function Lo(r){return Number($i(r,sb))}function FA(r){const e=cb(typeof r.type<"u"?r.type:ob);if(Lo(e)===ws&&typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const t=typeof r.senderPublicKey<"u"?Zi(r.senderPublicKey,oi):void 0,i=typeof r.iv<"u"?Zi(r.iv,oi):ks.randomBytes(Qc),n=new Ed.ChaCha20Poly1305(Zi(r.symKey,oi)).seal(i,Zi(r.message,Yc));return fb({type:e,sealed:n,iv:i,senderPublicKey:t,encoding:r.encoding})}function UA(r,e){const t=cb(Jc),i=ks.randomBytes(Qc),n=Zi(r,Yc);return fb({type:t,sealed:n,iv:i,encoding:e})}function qA(r){const e=new Ed.ChaCha20Poly1305(Zi(r.symKey,oi)),{sealed:t,iv:i}=Zc({encoded:r.encoded,encoding:r?.encoding}),n=e.open(i,t);if(n===null)throw new Error("Failed to decrypt");return $i(n,Yc)}function zA(r,e){const{sealed:t}=Zc({encoded:r,encoding:e});return $i(t,Yc)}function fb(r){const{encoding:e=Js}=r;if(Lo(r.type)===Jc)return $i(Rd([r.type,r.sealed]),e);if(Lo(r.type)===ws){if(typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return $i(Rd([r.type,r.senderPublicKey,r.iv,r.sealed]),e)}return $i(Rd([r.type,r.iv,r.sealed]),e)}function Zc(r){const{encoded:e,encoding:t=Js}=r,i=Zi(e,t),n=i.slice($A,ab),s=ab;if(Lo(n)===ws){const u=s+e0,g=u+Qc,w=i.slice(s,u),M=i.slice(u,g),C=i.slice(g);return{type:n,sealed:C,iv:M,senderPublicKey:w}}if(Lo(n)===Jc){const u=i.slice(s),g=ks.randomBytes(Qc);return{type:n,sealed:u,iv:g}}const a=s+Qc,f=i.slice(s,a),h=i.slice(a);return{type:n,sealed:h,iv:f}}function HA(r,e){const t=Zc({encoded:r,encoding:e?.encoding});return lb({type:Lo(t.type),senderPublicKey:typeof t.senderPublicKey<"u"?$i(t.senderPublicKey,oi):void 0,receiverPublicKey:e?.receiverPublicKey})}function lb(r){const e=r?.type||ob;if(e===ws){if(typeof r?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof r?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:r?.senderPublicKey,receiverPublicKey:r?.receiverPublicKey}}function hb(r){return r.type===ws&&typeof r.senderPublicKey=="string"&&typeof r.receiverPublicKey=="string"}function ub(r){return r.type===Jc}function kA(r){return new um.ec("p256").keyFromPublic({x:Buffer.from(r.x,"base64").toString("hex"),y:Buffer.from(r.y,"base64").toString("hex")},"hex")}function jA(r){let e=r.replace(/-/g,"+").replace(/_/g,"/");const t=e.length%4;return t>0&&(e+="=".repeat(4-t)),e}function WA(r){return Buffer.from(jA(r),"base64")}function KA(r,e){const[t,i,n]=r.split("."),s=WA(n);if(s.length!==64)throw new Error("Invalid signature length");const a=s.slice(0,32).toString("hex"),f=s.slice(32,64).toString("hex"),h=`${t}.${i}`,u=new zc.SHA256().update(Buffer.from(h)).digest(),g=kA(e),w=Buffer.from(u).toString("hex");if(!g.verify(w,{r:a,s:f}))throw new Error("Invalid signature");return Jd(r).payload}const VA="irn";function Wl(r){return r?.relay||{protocol:VA}}function Xc(r){const e=Wx[r];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${r}`);return e}var GA=Object.defineProperty,YA=Object.defineProperties,JA=Object.getOwnPropertyDescriptors,db=Object.getOwnPropertySymbols,QA=Object.prototype.hasOwnProperty,ZA=Object.prototype.propertyIsEnumerable,pb=(r,e,t)=>e in r?GA(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,gb=(r,e)=>{for(var t in e||(e={}))QA.call(e,t)&&pb(r,t,e[t]);if(db)for(var t of db(e))ZA.call(e,t)&&pb(r,t,e[t]);return r},XA=(r,e)=>YA(r,JA(e));function eE(r,e="-"){const t={},i="relay"+e;return Object.keys(r).forEach(n=>{if(n.startsWith(i)){const s=n.replace(i,""),a=r[n];t[s]=a}}),t}function vb(r){if(!r.includes("wc:")){const h=Qm(r);h!=null&&h.includes("wc:")&&(r=h)}r=r.includes("wc://")?r.replace("wc://",""):r,r=r.includes("wc:")?r.replace("wc:",""):r;const e=r.indexOf(":"),t=r.indexOf("?")!==-1?r.indexOf("?"):void 0,i=r.substring(0,e),n=r.substring(e+1,t).split("@"),s=typeof t<"u"?r.substring(t):"",a=Rc.parse(s),f=typeof a.methods=="string"?a.methods.split(","):void 0;return{protocol:i,topic:tE(n[0]),version:parseInt(n[1],10),symKey:a.symKey,relay:eE(a),methods:f,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function tE(r){return r.startsWith("//")?r.substring(2):r}function rE(r,e="-"){const t="relay",i={};return Object.keys(r).forEach(n=>{const s=t+e+n;r[n]&&(i[s]=r[n])}),i}function mb(r){return`${r.protocol}:${r.topic}@${r.version}?`+Rc.stringify(gb(XA(gb({symKey:r.symKey},rE(r.relay)),{expiryTimestamp:r.expiryTimestamp}),r.methods?{methods:r.methods.join(",")}:{}))}function Kl(r,e,t){return`${r}?wc_ev=${t}&topic=${e}`}function za(r){const e=[];return r.forEach(t=>{const[i,n]=t.split(":");e.push(`${i}:${n}`)}),e}function iE(r){const e=[];return Object.values(r).forEach(t=>{e.push(...za(t.accounts))}),e}function nE(r,e){const t=[];return Object.values(r).forEach(i=>{za(i.accounts).includes(e)&&t.push(...i.methods)}),t}function sE(r,e){const t=[];return Object.values(r).forEach(i=>{za(i.accounts).includes(e)&&t.push(...i.events)}),t}function r0(r){return r.includes(":")}function ef(r){return r0(r)?r.split(":")[0]:r}function oE(r){const e={};return r?.forEach(t=>{const[i,n]=t.split(":");e[i]||(e[i]={accounts:[],chains:[],events:[]}),e[i].accounts.push(t),e[i].chains.push(`${i}:${n}`)}),e}function bb(r,e){e=e.map(i=>i.replace("did:pkh:",""));const t=oE(e);for(const[i,n]of Object.entries(t))n.methods?n.methods=zl(n.methods,r):n.methods=r,n.events=["chainChanged","accountsChanged"];return t}const aE={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}},cE={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 xe(r,e){const{message:t,code:i}=cE[r];return{message:e?`${t} ${e}`:t,code:i}}function Gt(r,e){const{message:t,code:i}=aE[r];return{message:e?`${t} ${e}`:t,code:i}}function _s(r,e){return Array.isArray(r)?typeof e<"u"&&r.length?r.every(e):!0:!1}function tf(r){return Object.getPrototypeOf(r)===Object.prototype&&Object.keys(r).length}function ai(r){return typeof r>"u"}function wr(r,e){return e&&ai(r)?!0:typeof r=="string"&&!!r.trim().length}function i0(r,e){return e&&ai(r)?!0:typeof r=="number"&&!isNaN(r)}function fE(r,e){const{requiredNamespaces:t}=e,i=Object.keys(r.namespaces),n=Object.keys(t);let s=!0;return To(n,i)?(i.forEach(a=>{const{accounts:f,methods:h,events:u}=r.namespaces[a],g=za(f),w=t[a];(!To(Fm(a,w),g)||!To(w.methods,h)||!To(w.events,u))&&(s=!1)}),s):!1}function Vl(r){return wr(r,!1)&&r.includes(":")?r.split(":").length===2:!1}function lE(r){if(wr(r,!1)&&r.includes(":")){const e=r.split(":");if(e.length===3){const t=e[0]+":"+e[1];return!!e[2]&&Vl(t)}}return!1}function hE(r){function e(t){try{return typeof new URL(t)<"u"}catch{return!1}}try{if(wr(r,!1)){if(e(r))return!0;const t=Qm(r);return e(t)}}catch{}return!1}function uE(r){var e;return(e=r?.proposer)==null?void 0:e.publicKey}function dE(r){return r?.topic}function pE(r,e){let t=null;return wr(r?.publicKey,!1)||(t=xe("MISSING_OR_INVALID",`${e} controller public key should be a string`)),t}function wb(r){let e=!0;return _s(r)?r.length&&(e=r.every(t=>wr(t,!1))):e=!1,e}function gE(r,e,t){let i=null;return _s(e)&&e.length?e.forEach(n=>{i||Vl(n)||(i=Gt("UNSUPPORTED_CHAINS",`${t}, chain ${n} should be a string and conform to "namespace:chainId" format`))}):Vl(r)||(i=Gt("UNSUPPORTED_CHAINS",`${t}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),i}function vE(r,e,t){let i=null;return Object.entries(r).forEach(([n,s])=>{if(i)return;const a=gE(n,Fm(n,s),`${e} ${t}`);a&&(i=a)}),i}function mE(r,e){let t=null;return _s(r)?r.forEach(i=>{t||lE(i)||(t=Gt("UNSUPPORTED_ACCOUNTS",`${e}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):t=Gt("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),t}function bE(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;const n=mE(i?.accounts,`${e} namespace`);n&&(t=n)}),t}function wE(r,e){let t=null;return wb(r?.methods)?wb(r?.events)||(t=Gt("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):t=Gt("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),t}function yb(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;const n=wE(i,`${e}, namespace`);n&&(t=n)}),t}function yE(r,e,t){let i=null;if(r&&tf(r)){const n=yb(r,e);n&&(i=n);const s=vE(r,e,t);s&&(i=s)}else i=xe("MISSING_OR_INVALID",`${e}, ${t} should be an object with data`);return i}function n0(r,e){let t=null;if(r&&tf(r)){const i=yb(r,e);i&&(t=i);const n=bE(r,e);n&&(t=n)}else t=xe("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return t}function _b(r){return wr(r.protocol,!0)}function _E(r,e){let t=!1;return e&&!r?t=!0:r&&_s(r)&&r.length&&r.forEach(i=>{t=_b(i)}),t}function xE(r){return typeof r=="number"}function bi(r){return typeof r<"u"&&typeof r!==null}function AE(r){return!(!r||typeof r!="object"||!r.code||!i0(r.code,!1)||!r.message||!wr(r.message,!1))}function EE(r){return!(ai(r)||!wr(r.method,!1))}function SE(r){return!(ai(r)||ai(r.result)&&ai(r.error)||!i0(r.id,!1)||!wr(r.jsonrpc,!1))}function IE(r){return!(ai(r)||!wr(r.name,!1))}function xb(r,e){return!(!Vl(e)||!iE(r).includes(e))}function ME(r,e,t){return wr(t,!1)?nE(r,e).includes(t):!1}function CE(r,e,t){return wr(t,!1)?sE(r,e).includes(t):!1}function Ab(r,e,t){let i=null;const n=PE(r),s=DE(e),a=Object.keys(n),f=Object.keys(s),h=Eb(Object.keys(r)),u=Eb(Object.keys(e)),g=h.filter(w=>!u.includes(w));return g.length&&(i=xe("NON_CONFORMING_NAMESPACES",`${t} namespaces keys don't satisfy requiredNamespaces.
|
|
21
|
+
*/(function(r){(function(){var e="input is invalid type",t="finalize already called",i=typeof window=="object",n=i?window:{};n.JS_SHA3_NO_WINDOW&&(i=!1);var s=!i&&typeof self=="object",a=!n.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;a?n=fr:s&&(n=self);var f=!n.JS_SHA3_NO_COMMON_JS&&!0&&r.exports,h=!n.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",u="0123456789abcdef".split(""),g=[31,7936,2031616,520093696],w=[4,1024,262144,67108864],M=[1,256,65536,16777216],P=[6,1536,393216,100663296],O=[0,8,16,24],$=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],q=[224,256,384,512],U=[128,256],J=["hex","buffer","arrayBuffer","array","digest"],ee={128:168,256:136};(n.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(R){return Object.prototype.toString.call(R)==="[object Array]"}),h&&(n.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(R){return typeof R=="object"&&R.buffer&&R.buffer.constructor===ArrayBuffer});for(var W=function(R,Z,H){return function(K){return new _(R,Z,R).update(K)[H]()}},G=function(R,Z,H){return function(K,k){return new _(R,Z,k).update(K)[H]()}},Q=function(R,Z,H){return function(K,k,E,j){return l["cshake"+R].update(K,k,E,j)[H]()}},A=function(R,Z,H){return function(K,k,E,j){return l["kmac"+R].update(K,k,E,j)[H]()}},z=function(R,Z,H,K){for(var k=0;k<J.length;++k){var E=J[k];R[E]=Z(H,K,E)}return R},te=function(R,Z){var H=W(R,Z,"hex");return H.create=function(){return new _(R,Z,R)},H.update=function(K){return H.create().update(K)},z(H,W,R,Z)},ae=function(R,Z){var H=G(R,Z,"hex");return H.create=function(K){return new _(R,Z,K)},H.update=function(K,k){return H.create(k).update(K)},z(H,G,R,Z)},L=function(R,Z){var H=ee[R],K=Q(R,Z,"hex");return K.create=function(k,E,j){return!E&&!j?l["shake"+R].create(k):new _(R,Z,k).bytepad([E,j],H)},K.update=function(k,E,j,re){return K.create(E,j,re).update(k)},z(K,Q,R,Z)},b=function(R,Z){var H=ee[R],K=A(R,Z,"hex");return K.create=function(k,E,j){return new N(R,Z,E).bytepad(["KMAC",j],H).bytepad([k],H)},K.update=function(k,E,j,re){return K.create(k,j,re).update(E)},z(K,A,R,Z)},m=[{name:"keccak",padding:M,bits:q,createMethod:te},{name:"sha3",padding:P,bits:q,createMethod:te},{name:"shake",padding:g,bits:U,createMethod:ae},{name:"cshake",padding:w,bits:U,createMethod:L},{name:"kmac",padding:w,bits:U,createMethod:b}],l={},d=[],y=0;y<m.length;++y)for(var C=m[y],D=C.bits,S=0;S<D.length;++S){var v=C.name+"_"+D[S];if(d.push(v),l[v]=C.createMethod(D[S],C.padding),C.name!=="sha3"){var x=C.name+D[S];d.push(x),l[x]=l[v]}}function _(R,Z,H){this.blocks=[],this.s=[],this.padding=Z,this.outputBits=H,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(R<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=H>>5,this.extraBytes=(H&31)>>3;for(var K=0;K<50;++K)this.s[K]=0}_.prototype.update=function(R){if(this.finalized)throw new Error(t);var Z,H=typeof R;if(H!=="string"){if(H==="object"){if(R===null)throw new Error(e);if(h&&R.constructor===ArrayBuffer)R=new Uint8Array(R);else if(!Array.isArray(R)&&(!h||!ArrayBuffer.isView(R)))throw new Error(e)}else throw new Error(e);Z=!0}for(var K=this.blocks,k=this.byteCount,E=R.length,j=this.blockCount,re=0,le=this.s,he,ge;re<E;){if(this.reset)for(this.reset=!1,K[0]=this.block,he=1;he<j+1;++he)K[he]=0;if(Z)for(he=this.start;re<E&&he<k;++re)K[he>>2]|=R[re]<<O[he++&3];else for(he=this.start;re<E&&he<k;++re)ge=R.charCodeAt(re),ge<128?K[he>>2]|=ge<<O[he++&3]:ge<2048?(K[he>>2]|=(192|ge>>6)<<O[he++&3],K[he>>2]|=(128|ge&63)<<O[he++&3]):ge<55296||ge>=57344?(K[he>>2]|=(224|ge>>12)<<O[he++&3],K[he>>2]|=(128|ge>>6&63)<<O[he++&3],K[he>>2]|=(128|ge&63)<<O[he++&3]):(ge=65536+((ge&1023)<<10|R.charCodeAt(++re)&1023),K[he>>2]|=(240|ge>>18)<<O[he++&3],K[he>>2]|=(128|ge>>12&63)<<O[he++&3],K[he>>2]|=(128|ge>>6&63)<<O[he++&3],K[he>>2]|=(128|ge&63)<<O[he++&3]);if(this.lastByteIndex=he,he>=k){for(this.start=he-k,this.block=K[j],he=0;he<j;++he)le[he]^=K[he];oe(le),this.reset=!0}else this.start=he}return this},_.prototype.encode=function(R,Z){var H=R&255,K=1,k=[H];for(R=R>>8,H=R&255;H>0;)k.unshift(H),R=R>>8,H=R&255,++K;return Z?k.push(K):k.unshift(K),this.update(k),k.length},_.prototype.encodeString=function(R){var Z,H=typeof R;if(H!=="string"){if(H==="object"){if(R===null)throw new Error(e);if(h&&R.constructor===ArrayBuffer)R=new Uint8Array(R);else if(!Array.isArray(R)&&(!h||!ArrayBuffer.isView(R)))throw new Error(e)}else throw new Error(e);Z=!0}var K=0,k=R.length;if(Z)K=k;else for(var E=0;E<R.length;++E){var j=R.charCodeAt(E);j<128?K+=1:j<2048?K+=2:j<55296||j>=57344?K+=3:(j=65536+((j&1023)<<10|R.charCodeAt(++E)&1023),K+=4)}return K+=this.encode(K*8),this.update(R),K},_.prototype.bytepad=function(R,Z){for(var H=this.encode(Z),K=0;K<R.length;++K)H+=this.encodeString(R[K]);var k=Z-H%Z,E=[];return E.length=k,this.update(E),this},_.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var R=this.blocks,Z=this.lastByteIndex,H=this.blockCount,K=this.s;if(R[Z>>2]|=this.padding[Z&3],this.lastByteIndex===this.byteCount)for(R[0]=R[H],Z=1;Z<H+1;++Z)R[Z]=0;for(R[H-1]|=2147483648,Z=0;Z<H;++Z)K[Z]^=R[Z];oe(K)}},_.prototype.toString=_.prototype.hex=function(){this.finalize();for(var R=this.blockCount,Z=this.s,H=this.outputBlocks,K=this.extraBytes,k=0,E=0,j="",re;E<H;){for(k=0;k<R&&E<H;++k,++E)re=Z[k],j+=u[re>>4&15]+u[re&15]+u[re>>12&15]+u[re>>8&15]+u[re>>20&15]+u[re>>16&15]+u[re>>28&15]+u[re>>24&15];E%R===0&&(oe(Z),k=0)}return K&&(re=Z[k],j+=u[re>>4&15]+u[re&15],K>1&&(j+=u[re>>12&15]+u[re>>8&15]),K>2&&(j+=u[re>>20&15]+u[re>>16&15])),j},_.prototype.arrayBuffer=function(){this.finalize();var R=this.blockCount,Z=this.s,H=this.outputBlocks,K=this.extraBytes,k=0,E=0,j=this.outputBits>>3,re;K?re=new ArrayBuffer(H+1<<2):re=new ArrayBuffer(j);for(var le=new Uint32Array(re);E<H;){for(k=0;k<R&&E<H;++k,++E)le[E]=Z[k];E%R===0&&oe(Z)}return K&&(le[k]=Z[k],re=re.slice(0,j)),re},_.prototype.buffer=_.prototype.arrayBuffer,_.prototype.digest=_.prototype.array=function(){this.finalize();for(var R=this.blockCount,Z=this.s,H=this.outputBlocks,K=this.extraBytes,k=0,E=0,j=[],re,le;E<H;){for(k=0;k<R&&E<H;++k,++E)re=E<<2,le=Z[k],j[re]=le&255,j[re+1]=le>>8&255,j[re+2]=le>>16&255,j[re+3]=le>>24&255;E%R===0&&oe(Z)}return K&&(re=E<<2,le=Z[k],j[re]=le&255,K>1&&(j[re+1]=le>>8&255),K>2&&(j[re+2]=le>>16&255)),j};function N(R,Z,H){_.call(this,R,Z,H)}N.prototype=new _,N.prototype.finalize=function(){return this.encode(this.outputBits,!0),_.prototype.finalize.call(this)};var oe=function(R){var Z,H,K,k,E,j,re,le,he,ge,ke,Te,Ce,Xe,Ne,be,Pe,De,ye,Ie,Oe,me,Me,Be,we,He,We,Ee,Ve,Ke,Ge,mt,It,Je,Pt,Ot,Ze,rt,et,$e,it,tt,Re,lt,ht,Le,ut,nt,Ue,st,Qe,qe,dt,kt,at,Ht,_t,qt,Zr,Xr,ei,ti,vr;for(K=0;K<48;K+=2)k=R[0]^R[10]^R[20]^R[30]^R[40],E=R[1]^R[11]^R[21]^R[31]^R[41],j=R[2]^R[12]^R[22]^R[32]^R[42],re=R[3]^R[13]^R[23]^R[33]^R[43],le=R[4]^R[14]^R[24]^R[34]^R[44],he=R[5]^R[15]^R[25]^R[35]^R[45],ge=R[6]^R[16]^R[26]^R[36]^R[46],ke=R[7]^R[17]^R[27]^R[37]^R[47],Te=R[8]^R[18]^R[28]^R[38]^R[48],Ce=R[9]^R[19]^R[29]^R[39]^R[49],Z=Te^(j<<1|re>>>31),H=Ce^(re<<1|j>>>31),R[0]^=Z,R[1]^=H,R[10]^=Z,R[11]^=H,R[20]^=Z,R[21]^=H,R[30]^=Z,R[31]^=H,R[40]^=Z,R[41]^=H,Z=k^(le<<1|he>>>31),H=E^(he<<1|le>>>31),R[2]^=Z,R[3]^=H,R[12]^=Z,R[13]^=H,R[22]^=Z,R[23]^=H,R[32]^=Z,R[33]^=H,R[42]^=Z,R[43]^=H,Z=j^(ge<<1|ke>>>31),H=re^(ke<<1|ge>>>31),R[4]^=Z,R[5]^=H,R[14]^=Z,R[15]^=H,R[24]^=Z,R[25]^=H,R[34]^=Z,R[35]^=H,R[44]^=Z,R[45]^=H,Z=le^(Te<<1|Ce>>>31),H=he^(Ce<<1|Te>>>31),R[6]^=Z,R[7]^=H,R[16]^=Z,R[17]^=H,R[26]^=Z,R[27]^=H,R[36]^=Z,R[37]^=H,R[46]^=Z,R[47]^=H,Z=ge^(k<<1|E>>>31),H=ke^(E<<1|k>>>31),R[8]^=Z,R[9]^=H,R[18]^=Z,R[19]^=H,R[28]^=Z,R[29]^=H,R[38]^=Z,R[39]^=H,R[48]^=Z,R[49]^=H,Xe=R[0],Ne=R[1],Le=R[11]<<4|R[10]>>>28,ut=R[10]<<4|R[11]>>>28,Ee=R[20]<<3|R[21]>>>29,Ve=R[21]<<3|R[20]>>>29,Xr=R[31]<<9|R[30]>>>23,ei=R[30]<<9|R[31]>>>23,tt=R[40]<<18|R[41]>>>14,Re=R[41]<<18|R[40]>>>14,Je=R[2]<<1|R[3]>>>31,Pt=R[3]<<1|R[2]>>>31,be=R[13]<<12|R[12]>>>20,Pe=R[12]<<12|R[13]>>>20,nt=R[22]<<10|R[23]>>>22,Ue=R[23]<<10|R[22]>>>22,Ke=R[33]<<13|R[32]>>>19,Ge=R[32]<<13|R[33]>>>19,ti=R[42]<<2|R[43]>>>30,vr=R[43]<<2|R[42]>>>30,kt=R[5]<<30|R[4]>>>2,at=R[4]<<30|R[5]>>>2,Ot=R[14]<<6|R[15]>>>26,Ze=R[15]<<6|R[14]>>>26,De=R[25]<<11|R[24]>>>21,ye=R[24]<<11|R[25]>>>21,st=R[34]<<15|R[35]>>>17,Qe=R[35]<<15|R[34]>>>17,mt=R[45]<<29|R[44]>>>3,It=R[44]<<29|R[45]>>>3,Be=R[6]<<28|R[7]>>>4,we=R[7]<<28|R[6]>>>4,Ht=R[17]<<23|R[16]>>>9,_t=R[16]<<23|R[17]>>>9,rt=R[26]<<25|R[27]>>>7,et=R[27]<<25|R[26]>>>7,Ie=R[36]<<21|R[37]>>>11,Oe=R[37]<<21|R[36]>>>11,qe=R[47]<<24|R[46]>>>8,dt=R[46]<<24|R[47]>>>8,lt=R[8]<<27|R[9]>>>5,ht=R[9]<<27|R[8]>>>5,He=R[18]<<20|R[19]>>>12,We=R[19]<<20|R[18]>>>12,qt=R[29]<<7|R[28]>>>25,Zr=R[28]<<7|R[29]>>>25,$e=R[38]<<8|R[39]>>>24,it=R[39]<<8|R[38]>>>24,me=R[48]<<14|R[49]>>>18,Me=R[49]<<14|R[48]>>>18,R[0]=Xe^~be&De,R[1]=Ne^~Pe&ye,R[10]=Be^~He&Ee,R[11]=we^~We&Ve,R[20]=Je^~Ot&rt,R[21]=Pt^~Ze&et,R[30]=lt^~Le&nt,R[31]=ht^~ut&Ue,R[40]=kt^~Ht&qt,R[41]=at^~_t&Zr,R[2]=be^~De&Ie,R[3]=Pe^~ye&Oe,R[12]=He^~Ee&Ke,R[13]=We^~Ve&Ge,R[22]=Ot^~rt&$e,R[23]=Ze^~et&it,R[32]=Le^~nt&st,R[33]=ut^~Ue&Qe,R[42]=Ht^~qt&Xr,R[43]=_t^~Zr&ei,R[4]=De^~Ie&me,R[5]=ye^~Oe&Me,R[14]=Ee^~Ke&mt,R[15]=Ve^~Ge&It,R[24]=rt^~$e&tt,R[25]=et^~it&Re,R[34]=nt^~st&qe,R[35]=Ue^~Qe&dt,R[44]=qt^~Xr&ti,R[45]=Zr^~ei&vr,R[6]=Ie^~me&Xe,R[7]=Oe^~Me&Ne,R[16]=Ke^~mt&Be,R[17]=Ge^~It&we,R[26]=$e^~tt&Je,R[27]=it^~Re&Pt,R[36]=st^~qe<,R[37]=Qe^~dt&ht,R[46]=Xr^~ti&kt,R[47]=ei^~vr&at,R[8]=me^~Xe&be,R[9]=Me^~Ne&Pe,R[18]=mt^~Be&He,R[19]=It^~we&We,R[28]=tt^~Je&Ot,R[29]=Re^~Pt&Ze,R[38]=qe^~lt&Le,R[39]=dt^~ht&ut,R[48]=ti^~kt&Ht,R[49]=vr^~at&_t,R[0]^=$[K],R[1]^=$[K+1]};if(f)r.exports=l;else for(y=0;y<d.length;++y)n[d[y]]=l[d[y]]})()})(Cg);var z5=Cg.exports;const k5="logger/5.7.0";let Pg=!1,Dg=!1;const rl={debug:1,default:2,info:2,warning:3,error:4,off:5};let Og=rl.default,Xu=null;function H5(){try{const r=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{r.push(e)}}),r.length)throw new Error("missing "+r.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(r){return r.message}return null}const Rg=H5();var ed;(function(r){r.DEBUG="DEBUG",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r.OFF="OFF"})(ed||(ed={}));var yn;(function(r){r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",r.NETWORK_ERROR="NETWORK_ERROR",r.SERVER_ERROR="SERVER_ERROR",r.TIMEOUT="TIMEOUT",r.BUFFER_OVERRUN="BUFFER_OVERRUN",r.NUMERIC_FAULT="NUMERIC_FAULT",r.MISSING_NEW="MISSING_NEW",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",r.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",r.TRANSACTION_REPLACED="TRANSACTION_REPLACED",r.ACTION_REJECTED="ACTION_REJECTED"})(yn||(yn={}));const Tg="0123456789abcdef";class xt{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const i=e.toLowerCase();rl[i]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Og>rl[i])&&console.log.apply(console,t)}debug(...e){this._log(xt.levels.DEBUG,e)}info(...e){this._log(xt.levels.INFO,e)}warn(...e){this._log(xt.levels.WARNING,e)}makeError(e,t,i){if(Dg)return this.makeError("censored error",t,{});t||(t=xt.errors.UNKNOWN_ERROR),i||(i={});const n=[];Object.keys(i).forEach(h=>{const u=i[h];try{if(u instanceof Uint8Array){let g="";for(let w=0;w<u.length;w++)g+=Tg[u[w]>>4],g+=Tg[u[w]&15];n.push(h+"=Uint8Array(0x"+g+")")}else n.push(h+"="+JSON.stringify(u))}catch{n.push(h+"="+JSON.stringify(i[h].toString()))}}),n.push(`code=${t}`),n.push(`version=${this.version}`);const s=e;let a="";switch(t){case yn.NUMERIC_FAULT:{a="NUMERIC_FAULT";const h=e;switch(h){case"overflow":case"underflow":case"division-by-zero":a+="-"+h;break;case"negative-power":case"negative-width":a+="-unsupported";break;case"unbound-bitwise-result":a+="-unbound-result";break}break}case yn.CALL_EXCEPTION:case yn.INSUFFICIENT_FUNDS:case yn.MISSING_NEW:case yn.NONCE_EXPIRED:case yn.REPLACEMENT_UNDERPRICED:case yn.TRANSACTION_REPLACED:case yn.UNPREDICTABLE_GAS_LIMIT:a=t;break}a&&(e+=" [ See: https://links.ethers.org/v5-errors-"+a+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const f=new Error(e);return f.reason=s,f.code=t,Object.keys(i).forEach(function(h){f[h]=i[h]}),f}throwError(e,t,i){throw this.makeError(e,t,i)}throwArgumentError(e,t,i){return this.throwError(e,xt.errors.INVALID_ARGUMENT,{argument:t,value:i})}assert(e,t,i,n){e||this.throwError(t,i,n)}assertArgument(e,t,i,n){e||this.throwArgumentError(t,i,n)}checkNormalize(e){Rg&&this.throwError("platform missing String.prototype.normalize",xt.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Rg})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,xt.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,xt.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,i){i?i=": "+i:i="",e<t&&this.throwError("missing argument"+i,xt.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+i,xt.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",xt.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",xt.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",xt.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return Xu||(Xu=new xt(k5)),Xu}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",xt.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Pg){if(!e)return;this.globalLogger().throwError("error censorship permanent",xt.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Dg=!!e,Pg=!!t}static setLogLevel(e){const t=rl[e.toLowerCase()];if(t==null){xt.globalLogger().warn("invalid log level - "+e);return}Og=t}static from(e){return new xt(e)}}xt.errors=yn,xt.levels=ed;const j5="bytes/5.7.0",br=new xt(j5);function Ng(r){return!!r.toHexString}function _a(r){return r.slice||(r.slice=function(){const e=Array.prototype.slice.call(arguments);return _a(new Uint8Array(Array.prototype.slice.apply(r,e)))}),r}function W5(r){return Oi(r)&&!(r.length%2)||xa(r)}function $g(r){return typeof r=="number"&&r==r&&r%1===0}function xa(r){if(r==null)return!1;if(r.constructor===Uint8Array)return!0;if(typeof r=="string"||!$g(r.length)||r.length<0)return!1;for(let e=0;e<r.length;e++){const t=r[e];if(!$g(t)||t<0||t>=256)return!1}return!0}function ur(r,e){if(e||(e={}),typeof r=="number"){br.checkSafeUint53(r,"invalid arrayify value");const t=[];for(;r;)t.unshift(r&255),r=parseInt(String(r/256));return t.length===0&&t.push(0),_a(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),Ng(r)&&(r=r.toHexString()),Oi(r)){let t=r.substring(2);t.length%2&&(e.hexPad==="left"?t="0"+t:e.hexPad==="right"?t+="0":br.throwArgumentError("hex data is odd-length","value",r));const i=[];for(let n=0;n<t.length;n+=2)i.push(parseInt(t.substring(n,n+2),16));return _a(new Uint8Array(i))}return xa(r)?_a(new Uint8Array(r)):br.throwArgumentError("invalid arrayify value","value",r)}function K5(r){const e=r.map(n=>ur(n)),t=e.reduce((n,s)=>n+s.length,0),i=new Uint8Array(t);return e.reduce((n,s)=>(i.set(s,n),n+s.length),0),_a(i)}function V5(r,e){r=ur(r),r.length>e&&br.throwArgumentError("value out of range","value",arguments[0]);const t=new Uint8Array(e);return t.set(r,e-r.length),_a(t)}function Oi(r,e){return!(typeof r!="string"||!r.match(/^0x[0-9A-Fa-f]*$/)||e&&r.length!==2+2*e)}const td="0123456789abcdef";function ni(r,e){if(e||(e={}),typeof r=="number"){br.checkSafeUint53(r,"invalid hexlify value");let t="";for(;r;)t=td[r&15]+t,r=Math.floor(r/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if(typeof r=="bigint")return r=r.toString(16),r.length%2?"0x0"+r:"0x"+r;if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),Ng(r))return r.toHexString();if(Oi(r))return r.length%2&&(e.hexPad==="left"?r="0x0"+r.substring(2):e.hexPad==="right"?r+="0":br.throwArgumentError("hex data is odd-length","value",r)),r.toLowerCase();if(xa(r)){let t="0x";for(let i=0;i<r.length;i++){let n=r[i];t+=td[(n&240)>>4]+td[n&15]}return t}return br.throwArgumentError("invalid hexlify value","value",r)}function G5(r){if(typeof r!="string")r=ni(r);else if(!Oi(r)||r.length%2)return null;return(r.length-2)/2}function Lg(r,e,t){return typeof r!="string"?r=ni(r):(!Oi(r)||r.length%2)&&br.throwArgumentError("invalid hexData","value",r),e=2+2*e,t!=null?"0x"+r.substring(e,2+2*t):"0x"+r.substring(e)}function qn(r,e){for(typeof r!="string"?r=ni(r):Oi(r)||br.throwArgumentError("invalid hex string","value",r),r.length>2*e+2&&br.throwArgumentError("value out of range","value",arguments[1]);r.length<2*e+2;)r="0x0"+r.substring(2);return r}function Bg(r){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(W5(r)){let t=ur(r);t.length===64?(e.v=27+(t[32]>>7),t[32]&=127,e.r=ni(t.slice(0,32)),e.s=ni(t.slice(32,64))):t.length===65?(e.r=ni(t.slice(0,32)),e.s=ni(t.slice(32,64)),e.v=t[64]):br.throwArgumentError("invalid signature string","signature",r),e.v<27&&(e.v===0||e.v===1?e.v+=27:br.throwArgumentError("signature invalid v byte","signature",r)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(t[32]|=128),e._vs=ni(t.slice(32,64))}else{if(e.r=r.r,e.s=r.s,e.v=r.v,e.recoveryParam=r.recoveryParam,e._vs=r._vs,e._vs!=null){const n=V5(ur(e._vs),32);e._vs=ni(n);const s=n[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&br.throwArgumentError("signature recoveryParam mismatch _vs","signature",r),n[0]&=127;const a=ni(n);e.s==null?e.s=a:e.s!==a&&br.throwArgumentError("signature v mismatch _vs","signature",r)}if(e.recoveryParam==null)e.v==null?br.throwArgumentError("signature missing v and recoveryParam","signature",r):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const n=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==n&&br.throwArgumentError("signature recoveryParam mismatch v","signature",r)}e.r==null||!Oi(e.r)?br.throwArgumentError("signature missing or invalid r","signature",r):e.r=qn(e.r,32),e.s==null||!Oi(e.s)?br.throwArgumentError("signature missing or invalid s","signature",r):e.s=qn(e.s,32);const t=ur(e.s);t[0]>=128&&br.throwArgumentError("signature s out of range","signature",r),e.recoveryParam&&(t[0]|=128);const i=ni(t);e._vs&&(Oi(e._vs)||br.throwArgumentError("signature invalid _vs","signature",r),e._vs=qn(e._vs,32)),e._vs==null?e._vs=i:e._vs!==i&&br.throwArgumentError("signature _vs mismatch v and s","signature",r)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function rd(r){return"0x"+z5.keccak_256(ur(r))}var Ug={exports:{}},J5={},Y5=Object.freeze({__proto__:null,default:J5}),il=Hu(Y5);(function(r){(function(e,t){function i(m,l){if(!m)throw new Error(l||"Assertion failed")}function n(m,l){m.super_=l;var d=function(){};d.prototype=l.prototype,m.prototype=new d,m.prototype.constructor=m}function s(m,l,d){if(s.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((l==="le"||l==="be")&&(d=l,l=10),this._init(m||0,l||10,d||"be"))}typeof e=="object"?e.exports=s:t.BN=s,s.BN=s,s.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=il.Buffer}catch{}s.isBN=function(l){return l instanceof s?!0:l!==null&&typeof l=="object"&&l.constructor.wordSize===s.wordSize&&Array.isArray(l.words)},s.max=function(l,d){return l.cmp(d)>0?l:d},s.min=function(l,d){return l.cmp(d)<0?l:d},s.prototype._init=function(l,d,y){if(typeof l=="number")return this._initNumber(l,d,y);if(typeof l=="object")return this._initArray(l,d,y);d==="hex"&&(d=16),i(d===(d|0)&&d>=2&&d<=36),l=l.toString().replace(/\s+/g,"");var C=0;l[0]==="-"&&(C++,this.negative=1),C<l.length&&(d===16?this._parseHex(l,C,y):(this._parseBase(l,d,C),y==="le"&&this._initArray(this.toArray(),d,y)))},s.prototype._initNumber=function(l,d,y){l<0&&(this.negative=1,l=-l),l<67108864?(this.words=[l&67108863],this.length=1):l<4503599627370496?(this.words=[l&67108863,l/67108864&67108863],this.length=2):(i(l<9007199254740992),this.words=[l&67108863,l/67108864&67108863,1],this.length=3),y==="le"&&this._initArray(this.toArray(),d,y)},s.prototype._initArray=function(l,d,y){if(i(typeof l.length=="number"),l.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(l.length/3),this.words=new Array(this.length);for(var C=0;C<this.length;C++)this.words[C]=0;var D,S,v=0;if(y==="be")for(C=l.length-1,D=0;C>=0;C-=3)S=l[C]|l[C-1]<<8|l[C-2]<<16,this.words[D]|=S<<v&67108863,this.words[D+1]=S>>>26-v&67108863,v+=24,v>=26&&(v-=26,D++);else if(y==="le")for(C=0,D=0;C<l.length;C+=3)S=l[C]|l[C+1]<<8|l[C+2]<<16,this.words[D]|=S<<v&67108863,this.words[D+1]=S>>>26-v&67108863,v+=24,v>=26&&(v-=26,D++);return this._strip()};function f(m,l){var d=m.charCodeAt(l);if(d>=48&&d<=57)return d-48;if(d>=65&&d<=70)return d-55;if(d>=97&&d<=102)return d-87;i(!1,"Invalid character in "+m)}function h(m,l,d){var y=f(m,d);return d-1>=l&&(y|=f(m,d-1)<<4),y}s.prototype._parseHex=function(l,d,y){this.length=Math.ceil((l.length-d)/6),this.words=new Array(this.length);for(var C=0;C<this.length;C++)this.words[C]=0;var D=0,S=0,v;if(y==="be")for(C=l.length-1;C>=d;C-=2)v=h(l,d,C)<<D,this.words[S]|=v&67108863,D>=18?(D-=18,S+=1,this.words[S]|=v>>>26):D+=8;else{var x=l.length-d;for(C=x%2===0?d+1:d;C<l.length;C+=2)v=h(l,d,C)<<D,this.words[S]|=v&67108863,D>=18?(D-=18,S+=1,this.words[S]|=v>>>26):D+=8}this._strip()};function u(m,l,d,y){for(var C=0,D=0,S=Math.min(m.length,d),v=l;v<S;v++){var x=m.charCodeAt(v)-48;C*=y,x>=49?D=x-49+10:x>=17?D=x-17+10:D=x,i(x>=0&&D<y,"Invalid character"),C+=D}return C}s.prototype._parseBase=function(l,d,y){this.words=[0],this.length=1;for(var C=0,D=1;D<=67108863;D*=d)C++;C--,D=D/d|0;for(var S=l.length-y,v=S%C,x=Math.min(S,S-v)+y,_=0,N=y;N<x;N+=C)_=u(l,N,N+C,d),this.imuln(D),this.words[0]+_<67108864?this.words[0]+=_:this._iaddn(_);if(v!==0){var oe=1;for(_=u(l,N,l.length,d),N=0;N<v;N++)oe*=d;this.imuln(oe),this.words[0]+_<67108864?this.words[0]+=_:this._iaddn(_)}this._strip()},s.prototype.copy=function(l){l.words=new Array(this.length);for(var d=0;d<this.length;d++)l.words[d]=this.words[d];l.length=this.length,l.negative=this.negative,l.red=this.red};function g(m,l){m.words=l.words,m.length=l.length,m.negative=l.negative,m.red=l.red}if(s.prototype._move=function(l){g(l,this)},s.prototype.clone=function(){var l=new s(null);return this.copy(l),l},s.prototype._expand=function(l){for(;this.length<l;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=w}catch{s.prototype.inspect=w}else s.prototype.inspect=w;function w(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var M=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],P=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],O=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(l,d){l=l||10,d=d|0||1;var y;if(l===16||l==="hex"){y="";for(var C=0,D=0,S=0;S<this.length;S++){var v=this.words[S],x=((v<<C|D)&16777215).toString(16);D=v>>>24-C&16777215,C+=2,C>=26&&(C-=26,S--),D!==0||S!==this.length-1?y=M[6-x.length]+x+y:y=x+y}for(D!==0&&(y=D.toString(16)+y);y.length%d!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}if(l===(l|0)&&l>=2&&l<=36){var _=P[l],N=O[l];y="";var oe=this.clone();for(oe.negative=0;!oe.isZero();){var R=oe.modrn(N).toString(l);oe=oe.idivn(N),oe.isZero()?y=R+y:y=M[_-R.length]+R+y}for(this.isZero()&&(y="0"+y);y.length%d!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var l=this.words[0];return this.length===2?l+=this.words[1]*67108864:this.length===3&&this.words[2]===1?l+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-l:l},s.prototype.toJSON=function(){return this.toString(16,2)},a&&(s.prototype.toBuffer=function(l,d){return this.toArrayLike(a,l,d)}),s.prototype.toArray=function(l,d){return this.toArrayLike(Array,l,d)};var $=function(l,d){return l.allocUnsafe?l.allocUnsafe(d):new l(d)};s.prototype.toArrayLike=function(l,d,y){this._strip();var C=this.byteLength(),D=y||Math.max(1,C);i(C<=D,"byte array longer than desired length"),i(D>0,"Requested array length <= 0");var S=$(l,D),v=d==="le"?"LE":"BE";return this["_toArrayLike"+v](S,C),S},s.prototype._toArrayLikeLE=function(l,d){for(var y=0,C=0,D=0,S=0;D<this.length;D++){var v=this.words[D]<<S|C;l[y++]=v&255,y<l.length&&(l[y++]=v>>8&255),y<l.length&&(l[y++]=v>>16&255),S===6?(y<l.length&&(l[y++]=v>>24&255),C=0,S=0):(C=v>>>24,S+=2)}if(y<l.length)for(l[y++]=C;y<l.length;)l[y++]=0},s.prototype._toArrayLikeBE=function(l,d){for(var y=l.length-1,C=0,D=0,S=0;D<this.length;D++){var v=this.words[D]<<S|C;l[y--]=v&255,y>=0&&(l[y--]=v>>8&255),y>=0&&(l[y--]=v>>16&255),S===6?(y>=0&&(l[y--]=v>>24&255),C=0,S=0):(C=v>>>24,S+=2)}if(y>=0)for(l[y--]=C;y>=0;)l[y--]=0},Math.clz32?s.prototype._countBits=function(l){return 32-Math.clz32(l)}:s.prototype._countBits=function(l){var d=l,y=0;return d>=4096&&(y+=13,d>>>=13),d>=64&&(y+=7,d>>>=7),d>=8&&(y+=4,d>>>=4),d>=2&&(y+=2,d>>>=2),y+d},s.prototype._zeroBits=function(l){if(l===0)return 26;var d=l,y=0;return d&8191||(y+=13,d>>>=13),d&127||(y+=7,d>>>=7),d&15||(y+=4,d>>>=4),d&3||(y+=2,d>>>=2),d&1||y++,y},s.prototype.bitLength=function(){var l=this.words[this.length-1],d=this._countBits(l);return(this.length-1)*26+d};function q(m){for(var l=new Array(m.bitLength()),d=0;d<l.length;d++){var y=d/26|0,C=d%26;l[d]=m.words[y]>>>C&1}return l}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var l=0,d=0;d<this.length;d++){var y=this._zeroBits(this.words[d]);if(l+=y,y!==26)break}return l},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(l){return this.negative!==0?this.abs().inotn(l).iaddn(1):this.clone()},s.prototype.fromTwos=function(l){return this.testn(l-1)?this.notn(l).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(l){for(;this.length<l.length;)this.words[this.length++]=0;for(var d=0;d<l.length;d++)this.words[d]=this.words[d]|l.words[d];return this._strip()},s.prototype.ior=function(l){return i((this.negative|l.negative)===0),this.iuor(l)},s.prototype.or=function(l){return this.length>l.length?this.clone().ior(l):l.clone().ior(this)},s.prototype.uor=function(l){return this.length>l.length?this.clone().iuor(l):l.clone().iuor(this)},s.prototype.iuand=function(l){var d;this.length>l.length?d=l:d=this;for(var y=0;y<d.length;y++)this.words[y]=this.words[y]&l.words[y];return this.length=d.length,this._strip()},s.prototype.iand=function(l){return i((this.negative|l.negative)===0),this.iuand(l)},s.prototype.and=function(l){return this.length>l.length?this.clone().iand(l):l.clone().iand(this)},s.prototype.uand=function(l){return this.length>l.length?this.clone().iuand(l):l.clone().iuand(this)},s.prototype.iuxor=function(l){var d,y;this.length>l.length?(d=this,y=l):(d=l,y=this);for(var C=0;C<y.length;C++)this.words[C]=d.words[C]^y.words[C];if(this!==d)for(;C<d.length;C++)this.words[C]=d.words[C];return this.length=d.length,this._strip()},s.prototype.ixor=function(l){return i((this.negative|l.negative)===0),this.iuxor(l)},s.prototype.xor=function(l){return this.length>l.length?this.clone().ixor(l):l.clone().ixor(this)},s.prototype.uxor=function(l){return this.length>l.length?this.clone().iuxor(l):l.clone().iuxor(this)},s.prototype.inotn=function(l){i(typeof l=="number"&&l>=0);var d=Math.ceil(l/26)|0,y=l%26;this._expand(d),y>0&&d--;for(var C=0;C<d;C++)this.words[C]=~this.words[C]&67108863;return y>0&&(this.words[C]=~this.words[C]&67108863>>26-y),this._strip()},s.prototype.notn=function(l){return this.clone().inotn(l)},s.prototype.setn=function(l,d){i(typeof l=="number"&&l>=0);var y=l/26|0,C=l%26;return this._expand(y+1),d?this.words[y]=this.words[y]|1<<C:this.words[y]=this.words[y]&~(1<<C),this._strip()},s.prototype.iadd=function(l){var d;if(this.negative!==0&&l.negative===0)return this.negative=0,d=this.isub(l),this.negative^=1,this._normSign();if(this.negative===0&&l.negative!==0)return l.negative=0,d=this.isub(l),l.negative=1,d._normSign();var y,C;this.length>l.length?(y=this,C=l):(y=l,C=this);for(var D=0,S=0;S<C.length;S++)d=(y.words[S]|0)+(C.words[S]|0)+D,this.words[S]=d&67108863,D=d>>>26;for(;D!==0&&S<y.length;S++)d=(y.words[S]|0)+D,this.words[S]=d&67108863,D=d>>>26;if(this.length=y.length,D!==0)this.words[this.length]=D,this.length++;else if(y!==this)for(;S<y.length;S++)this.words[S]=y.words[S];return this},s.prototype.add=function(l){var d;return l.negative!==0&&this.negative===0?(l.negative=0,d=this.sub(l),l.negative^=1,d):l.negative===0&&this.negative!==0?(this.negative=0,d=l.sub(this),this.negative=1,d):this.length>l.length?this.clone().iadd(l):l.clone().iadd(this)},s.prototype.isub=function(l){if(l.negative!==0){l.negative=0;var d=this.iadd(l);return l.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(l),this.negative=1,this._normSign();var y=this.cmp(l);if(y===0)return this.negative=0,this.length=1,this.words[0]=0,this;var C,D;y>0?(C=this,D=l):(C=l,D=this);for(var S=0,v=0;v<D.length;v++)d=(C.words[v]|0)-(D.words[v]|0)+S,S=d>>26,this.words[v]=d&67108863;for(;S!==0&&v<C.length;v++)d=(C.words[v]|0)+S,S=d>>26,this.words[v]=d&67108863;if(S===0&&v<C.length&&C!==this)for(;v<C.length;v++)this.words[v]=C.words[v];return this.length=Math.max(this.length,v),C!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(l){return this.clone().isub(l)};function U(m,l,d){d.negative=l.negative^m.negative;var y=m.length+l.length|0;d.length=y,y=y-1|0;var C=m.words[0]|0,D=l.words[0]|0,S=C*D,v=S&67108863,x=S/67108864|0;d.words[0]=v;for(var _=1;_<y;_++){for(var N=x>>>26,oe=x&67108863,R=Math.min(_,l.length-1),Z=Math.max(0,_-m.length+1);Z<=R;Z++){var H=_-Z|0;C=m.words[H]|0,D=l.words[Z]|0,S=C*D+oe,N+=S/67108864|0,oe=S&67108863}d.words[_]=oe|0,x=N|0}return x!==0?d.words[_]=x|0:d.length--,d._strip()}var J=function(l,d,y){var C=l.words,D=d.words,S=y.words,v=0,x,_,N,oe=C[0]|0,R=oe&8191,Z=oe>>>13,H=C[1]|0,K=H&8191,k=H>>>13,E=C[2]|0,j=E&8191,re=E>>>13,le=C[3]|0,he=le&8191,ge=le>>>13,ke=C[4]|0,Te=ke&8191,Ce=ke>>>13,Xe=C[5]|0,Ne=Xe&8191,be=Xe>>>13,Pe=C[6]|0,De=Pe&8191,ye=Pe>>>13,Ie=C[7]|0,Oe=Ie&8191,me=Ie>>>13,Me=C[8]|0,Be=Me&8191,we=Me>>>13,He=C[9]|0,We=He&8191,Ee=He>>>13,Ve=D[0]|0,Ke=Ve&8191,Ge=Ve>>>13,mt=D[1]|0,It=mt&8191,Je=mt>>>13,Pt=D[2]|0,Ot=Pt&8191,Ze=Pt>>>13,rt=D[3]|0,et=rt&8191,$e=rt>>>13,it=D[4]|0,tt=it&8191,Re=it>>>13,lt=D[5]|0,ht=lt&8191,Le=lt>>>13,ut=D[6]|0,nt=ut&8191,Ue=ut>>>13,st=D[7]|0,Qe=st&8191,qe=st>>>13,dt=D[8]|0,kt=dt&8191,at=dt>>>13,Ht=D[9]|0,_t=Ht&8191,qt=Ht>>>13;y.negative=l.negative^d.negative,y.length=19,x=Math.imul(R,Ke),_=Math.imul(R,Ge),_=_+Math.imul(Z,Ke)|0,N=Math.imul(Z,Ge);var Zr=(v+x|0)+((_&8191)<<13)|0;v=(N+(_>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,x=Math.imul(K,Ke),_=Math.imul(K,Ge),_=_+Math.imul(k,Ke)|0,N=Math.imul(k,Ge),x=x+Math.imul(R,It)|0,_=_+Math.imul(R,Je)|0,_=_+Math.imul(Z,It)|0,N=N+Math.imul(Z,Je)|0;var Xr=(v+x|0)+((_&8191)<<13)|0;v=(N+(_>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,x=Math.imul(j,Ke),_=Math.imul(j,Ge),_=_+Math.imul(re,Ke)|0,N=Math.imul(re,Ge),x=x+Math.imul(K,It)|0,_=_+Math.imul(K,Je)|0,_=_+Math.imul(k,It)|0,N=N+Math.imul(k,Je)|0,x=x+Math.imul(R,Ot)|0,_=_+Math.imul(R,Ze)|0,_=_+Math.imul(Z,Ot)|0,N=N+Math.imul(Z,Ze)|0;var ei=(v+x|0)+((_&8191)<<13)|0;v=(N+(_>>>13)|0)+(ei>>>26)|0,ei&=67108863,x=Math.imul(he,Ke),_=Math.imul(he,Ge),_=_+Math.imul(ge,Ke)|0,N=Math.imul(ge,Ge),x=x+Math.imul(j,It)|0,_=_+Math.imul(j,Je)|0,_=_+Math.imul(re,It)|0,N=N+Math.imul(re,Je)|0,x=x+Math.imul(K,Ot)|0,_=_+Math.imul(K,Ze)|0,_=_+Math.imul(k,Ot)|0,N=N+Math.imul(k,Ze)|0,x=x+Math.imul(R,et)|0,_=_+Math.imul(R,$e)|0,_=_+Math.imul(Z,et)|0,N=N+Math.imul(Z,$e)|0;var ti=(v+x|0)+((_&8191)<<13)|0;v=(N+(_>>>13)|0)+(ti>>>26)|0,ti&=67108863,x=Math.imul(Te,Ke),_=Math.imul(Te,Ge),_=_+Math.imul(Ce,Ke)|0,N=Math.imul(Ce,Ge),x=x+Math.imul(he,It)|0,_=_+Math.imul(he,Je)|0,_=_+Math.imul(ge,It)|0,N=N+Math.imul(ge,Je)|0,x=x+Math.imul(j,Ot)|0,_=_+Math.imul(j,Ze)|0,_=_+Math.imul(re,Ot)|0,N=N+Math.imul(re,Ze)|0,x=x+Math.imul(K,et)|0,_=_+Math.imul(K,$e)|0,_=_+Math.imul(k,et)|0,N=N+Math.imul(k,$e)|0,x=x+Math.imul(R,tt)|0,_=_+Math.imul(R,Re)|0,_=_+Math.imul(Z,tt)|0,N=N+Math.imul(Z,Re)|0;var vr=(v+x|0)+((_&8191)<<13)|0;v=(N+(_>>>13)|0)+(vr>>>26)|0,vr&=67108863,x=Math.imul(Ne,Ke),_=Math.imul(Ne,Ge),_=_+Math.imul(be,Ke)|0,N=Math.imul(be,Ge),x=x+Math.imul(Te,It)|0,_=_+Math.imul(Te,Je)|0,_=_+Math.imul(Ce,It)|0,N=N+Math.imul(Ce,Je)|0,x=x+Math.imul(he,Ot)|0,_=_+Math.imul(he,Ze)|0,_=_+Math.imul(ge,Ot)|0,N=N+Math.imul(ge,Ze)|0,x=x+Math.imul(j,et)|0,_=_+Math.imul(j,$e)|0,_=_+Math.imul(re,et)|0,N=N+Math.imul(re,$e)|0,x=x+Math.imul(K,tt)|0,_=_+Math.imul(K,Re)|0,_=_+Math.imul(k,tt)|0,N=N+Math.imul(k,Re)|0,x=x+Math.imul(R,ht)|0,_=_+Math.imul(R,Le)|0,_=_+Math.imul(Z,ht)|0,N=N+Math.imul(Z,Le)|0;var Ei=(v+x|0)+((_&8191)<<13)|0;v=(N+(_>>>13)|0)+(Ei>>>26)|0,Ei&=67108863,x=Math.imul(De,Ke),_=Math.imul(De,Ge),_=_+Math.imul(ye,Ke)|0,N=Math.imul(ye,Ge),x=x+Math.imul(Ne,It)|0,_=_+Math.imul(Ne,Je)|0,_=_+Math.imul(be,It)|0,N=N+Math.imul(be,Je)|0,x=x+Math.imul(Te,Ot)|0,_=_+Math.imul(Te,Ze)|0,_=_+Math.imul(Ce,Ot)|0,N=N+Math.imul(Ce,Ze)|0,x=x+Math.imul(he,et)|0,_=_+Math.imul(he,$e)|0,_=_+Math.imul(ge,et)|0,N=N+Math.imul(ge,$e)|0,x=x+Math.imul(j,tt)|0,_=_+Math.imul(j,Re)|0,_=_+Math.imul(re,tt)|0,N=N+Math.imul(re,Re)|0,x=x+Math.imul(K,ht)|0,_=_+Math.imul(K,Le)|0,_=_+Math.imul(k,ht)|0,N=N+Math.imul(k,Le)|0,x=x+Math.imul(R,nt)|0,_=_+Math.imul(R,Ue)|0,_=_+Math.imul(Z,nt)|0,N=N+Math.imul(Z,Ue)|0;var Pn=(v+x|0)+((_&8191)<<13)|0;v=(N+(_>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,x=Math.imul(Oe,Ke),_=Math.imul(Oe,Ge),_=_+Math.imul(me,Ke)|0,N=Math.imul(me,Ge),x=x+Math.imul(De,It)|0,_=_+Math.imul(De,Je)|0,_=_+Math.imul(ye,It)|0,N=N+Math.imul(ye,Je)|0,x=x+Math.imul(Ne,Ot)|0,_=_+Math.imul(Ne,Ze)|0,_=_+Math.imul(be,Ot)|0,N=N+Math.imul(be,Ze)|0,x=x+Math.imul(Te,et)|0,_=_+Math.imul(Te,$e)|0,_=_+Math.imul(Ce,et)|0,N=N+Math.imul(Ce,$e)|0,x=x+Math.imul(he,tt)|0,_=_+Math.imul(he,Re)|0,_=_+Math.imul(ge,tt)|0,N=N+Math.imul(ge,Re)|0,x=x+Math.imul(j,ht)|0,_=_+Math.imul(j,Le)|0,_=_+Math.imul(re,ht)|0,N=N+Math.imul(re,Le)|0,x=x+Math.imul(K,nt)|0,_=_+Math.imul(K,Ue)|0,_=_+Math.imul(k,nt)|0,N=N+Math.imul(k,Ue)|0,x=x+Math.imul(R,Qe)|0,_=_+Math.imul(R,qe)|0,_=_+Math.imul(Z,Qe)|0,N=N+Math.imul(Z,qe)|0;var Ai=(v+x|0)+((_&8191)<<13)|0;v=(N+(_>>>13)|0)+(Ai>>>26)|0,Ai&=67108863,x=Math.imul(Be,Ke),_=Math.imul(Be,Ge),_=_+Math.imul(we,Ke)|0,N=Math.imul(we,Ge),x=x+Math.imul(Oe,It)|0,_=_+Math.imul(Oe,Je)|0,_=_+Math.imul(me,It)|0,N=N+Math.imul(me,Je)|0,x=x+Math.imul(De,Ot)|0,_=_+Math.imul(De,Ze)|0,_=_+Math.imul(ye,Ot)|0,N=N+Math.imul(ye,Ze)|0,x=x+Math.imul(Ne,et)|0,_=_+Math.imul(Ne,$e)|0,_=_+Math.imul(be,et)|0,N=N+Math.imul(be,$e)|0,x=x+Math.imul(Te,tt)|0,_=_+Math.imul(Te,Re)|0,_=_+Math.imul(Ce,tt)|0,N=N+Math.imul(Ce,Re)|0,x=x+Math.imul(he,ht)|0,_=_+Math.imul(he,Le)|0,_=_+Math.imul(ge,ht)|0,N=N+Math.imul(ge,Le)|0,x=x+Math.imul(j,nt)|0,_=_+Math.imul(j,Ue)|0,_=_+Math.imul(re,nt)|0,N=N+Math.imul(re,Ue)|0,x=x+Math.imul(K,Qe)|0,_=_+Math.imul(K,qe)|0,_=_+Math.imul(k,Qe)|0,N=N+Math.imul(k,qe)|0,x=x+Math.imul(R,kt)|0,_=_+Math.imul(R,at)|0,_=_+Math.imul(Z,kt)|0,N=N+Math.imul(Z,at)|0;var Dn=(v+x|0)+((_&8191)<<13)|0;v=(N+(_>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,x=Math.imul(We,Ke),_=Math.imul(We,Ge),_=_+Math.imul(Ee,Ke)|0,N=Math.imul(Ee,Ge),x=x+Math.imul(Be,It)|0,_=_+Math.imul(Be,Je)|0,_=_+Math.imul(we,It)|0,N=N+Math.imul(we,Je)|0,x=x+Math.imul(Oe,Ot)|0,_=_+Math.imul(Oe,Ze)|0,_=_+Math.imul(me,Ot)|0,N=N+Math.imul(me,Ze)|0,x=x+Math.imul(De,et)|0,_=_+Math.imul(De,$e)|0,_=_+Math.imul(ye,et)|0,N=N+Math.imul(ye,$e)|0,x=x+Math.imul(Ne,tt)|0,_=_+Math.imul(Ne,Re)|0,_=_+Math.imul(be,tt)|0,N=N+Math.imul(be,Re)|0,x=x+Math.imul(Te,ht)|0,_=_+Math.imul(Te,Le)|0,_=_+Math.imul(Ce,ht)|0,N=N+Math.imul(Ce,Le)|0,x=x+Math.imul(he,nt)|0,_=_+Math.imul(he,Ue)|0,_=_+Math.imul(ge,nt)|0,N=N+Math.imul(ge,Ue)|0,x=x+Math.imul(j,Qe)|0,_=_+Math.imul(j,qe)|0,_=_+Math.imul(re,Qe)|0,N=N+Math.imul(re,qe)|0,x=x+Math.imul(K,kt)|0,_=_+Math.imul(K,at)|0,_=_+Math.imul(k,kt)|0,N=N+Math.imul(k,at)|0,x=x+Math.imul(R,_t)|0,_=_+Math.imul(R,qt)|0,_=_+Math.imul(Z,_t)|0,N=N+Math.imul(Z,qt)|0;var On=(v+x|0)+((_&8191)<<13)|0;v=(N+(_>>>13)|0)+(On>>>26)|0,On&=67108863,x=Math.imul(We,It),_=Math.imul(We,Je),_=_+Math.imul(Ee,It)|0,N=Math.imul(Ee,Je),x=x+Math.imul(Be,Ot)|0,_=_+Math.imul(Be,Ze)|0,_=_+Math.imul(we,Ot)|0,N=N+Math.imul(we,Ze)|0,x=x+Math.imul(Oe,et)|0,_=_+Math.imul(Oe,$e)|0,_=_+Math.imul(me,et)|0,N=N+Math.imul(me,$e)|0,x=x+Math.imul(De,tt)|0,_=_+Math.imul(De,Re)|0,_=_+Math.imul(ye,tt)|0,N=N+Math.imul(ye,Re)|0,x=x+Math.imul(Ne,ht)|0,_=_+Math.imul(Ne,Le)|0,_=_+Math.imul(be,ht)|0,N=N+Math.imul(be,Le)|0,x=x+Math.imul(Te,nt)|0,_=_+Math.imul(Te,Ue)|0,_=_+Math.imul(Ce,nt)|0,N=N+Math.imul(Ce,Ue)|0,x=x+Math.imul(he,Qe)|0,_=_+Math.imul(he,qe)|0,_=_+Math.imul(ge,Qe)|0,N=N+Math.imul(ge,qe)|0,x=x+Math.imul(j,kt)|0,_=_+Math.imul(j,at)|0,_=_+Math.imul(re,kt)|0,N=N+Math.imul(re,at)|0,x=x+Math.imul(K,_t)|0,_=_+Math.imul(K,qt)|0,_=_+Math.imul(k,_t)|0,N=N+Math.imul(k,qt)|0;var Si=(v+x|0)+((_&8191)<<13)|0;v=(N+(_>>>13)|0)+(Si>>>26)|0,Si&=67108863,x=Math.imul(We,Ot),_=Math.imul(We,Ze),_=_+Math.imul(Ee,Ot)|0,N=Math.imul(Ee,Ze),x=x+Math.imul(Be,et)|0,_=_+Math.imul(Be,$e)|0,_=_+Math.imul(we,et)|0,N=N+Math.imul(we,$e)|0,x=x+Math.imul(Oe,tt)|0,_=_+Math.imul(Oe,Re)|0,_=_+Math.imul(me,tt)|0,N=N+Math.imul(me,Re)|0,x=x+Math.imul(De,ht)|0,_=_+Math.imul(De,Le)|0,_=_+Math.imul(ye,ht)|0,N=N+Math.imul(ye,Le)|0,x=x+Math.imul(Ne,nt)|0,_=_+Math.imul(Ne,Ue)|0,_=_+Math.imul(be,nt)|0,N=N+Math.imul(be,Ue)|0,x=x+Math.imul(Te,Qe)|0,_=_+Math.imul(Te,qe)|0,_=_+Math.imul(Ce,Qe)|0,N=N+Math.imul(Ce,qe)|0,x=x+Math.imul(he,kt)|0,_=_+Math.imul(he,at)|0,_=_+Math.imul(ge,kt)|0,N=N+Math.imul(ge,at)|0,x=x+Math.imul(j,_t)|0,_=_+Math.imul(j,qt)|0,_=_+Math.imul(re,_t)|0,N=N+Math.imul(re,qt)|0;var fn=(v+x|0)+((_&8191)<<13)|0;v=(N+(_>>>13)|0)+(fn>>>26)|0,fn&=67108863,x=Math.imul(We,et),_=Math.imul(We,$e),_=_+Math.imul(Ee,et)|0,N=Math.imul(Ee,$e),x=x+Math.imul(Be,tt)|0,_=_+Math.imul(Be,Re)|0,_=_+Math.imul(we,tt)|0,N=N+Math.imul(we,Re)|0,x=x+Math.imul(Oe,ht)|0,_=_+Math.imul(Oe,Le)|0,_=_+Math.imul(me,ht)|0,N=N+Math.imul(me,Le)|0,x=x+Math.imul(De,nt)|0,_=_+Math.imul(De,Ue)|0,_=_+Math.imul(ye,nt)|0,N=N+Math.imul(ye,Ue)|0,x=x+Math.imul(Ne,Qe)|0,_=_+Math.imul(Ne,qe)|0,_=_+Math.imul(be,Qe)|0,N=N+Math.imul(be,qe)|0,x=x+Math.imul(Te,kt)|0,_=_+Math.imul(Te,at)|0,_=_+Math.imul(Ce,kt)|0,N=N+Math.imul(Ce,at)|0,x=x+Math.imul(he,_t)|0,_=_+Math.imul(he,qt)|0,_=_+Math.imul(ge,_t)|0,N=N+Math.imul(ge,qt)|0;var ln=(v+x|0)+((_&8191)<<13)|0;v=(N+(_>>>13)|0)+(ln>>>26)|0,ln&=67108863,x=Math.imul(We,tt),_=Math.imul(We,Re),_=_+Math.imul(Ee,tt)|0,N=Math.imul(Ee,Re),x=x+Math.imul(Be,ht)|0,_=_+Math.imul(Be,Le)|0,_=_+Math.imul(we,ht)|0,N=N+Math.imul(we,Le)|0,x=x+Math.imul(Oe,nt)|0,_=_+Math.imul(Oe,Ue)|0,_=_+Math.imul(me,nt)|0,N=N+Math.imul(me,Ue)|0,x=x+Math.imul(De,Qe)|0,_=_+Math.imul(De,qe)|0,_=_+Math.imul(ye,Qe)|0,N=N+Math.imul(ye,qe)|0,x=x+Math.imul(Ne,kt)|0,_=_+Math.imul(Ne,at)|0,_=_+Math.imul(be,kt)|0,N=N+Math.imul(be,at)|0,x=x+Math.imul(Te,_t)|0,_=_+Math.imul(Te,qt)|0,_=_+Math.imul(Ce,_t)|0,N=N+Math.imul(Ce,qt)|0;var Cr=(v+x|0)+((_&8191)<<13)|0;v=(N+(_>>>13)|0)+(Cr>>>26)|0,Cr&=67108863,x=Math.imul(We,ht),_=Math.imul(We,Le),_=_+Math.imul(Ee,ht)|0,N=Math.imul(Ee,Le),x=x+Math.imul(Be,nt)|0,_=_+Math.imul(Be,Ue)|0,_=_+Math.imul(we,nt)|0,N=N+Math.imul(we,Ue)|0,x=x+Math.imul(Oe,Qe)|0,_=_+Math.imul(Oe,qe)|0,_=_+Math.imul(me,Qe)|0,N=N+Math.imul(me,qe)|0,x=x+Math.imul(De,kt)|0,_=_+Math.imul(De,at)|0,_=_+Math.imul(ye,kt)|0,N=N+Math.imul(ye,at)|0,x=x+Math.imul(Ne,_t)|0,_=_+Math.imul(Ne,qt)|0,_=_+Math.imul(be,_t)|0,N=N+Math.imul(be,qt)|0;var Rn=(v+x|0)+((_&8191)<<13)|0;v=(N+(_>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,x=Math.imul(We,nt),_=Math.imul(We,Ue),_=_+Math.imul(Ee,nt)|0,N=Math.imul(Ee,Ue),x=x+Math.imul(Be,Qe)|0,_=_+Math.imul(Be,qe)|0,_=_+Math.imul(we,Qe)|0,N=N+Math.imul(we,qe)|0,x=x+Math.imul(Oe,kt)|0,_=_+Math.imul(Oe,at)|0,_=_+Math.imul(me,kt)|0,N=N+Math.imul(me,at)|0,x=x+Math.imul(De,_t)|0,_=_+Math.imul(De,qt)|0,_=_+Math.imul(ye,_t)|0,N=N+Math.imul(ye,qt)|0;var Tn=(v+x|0)+((_&8191)<<13)|0;v=(N+(_>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,x=Math.imul(We,Qe),_=Math.imul(We,qe),_=_+Math.imul(Ee,Qe)|0,N=Math.imul(Ee,qe),x=x+Math.imul(Be,kt)|0,_=_+Math.imul(Be,at)|0,_=_+Math.imul(we,kt)|0,N=N+Math.imul(we,at)|0,x=x+Math.imul(Oe,_t)|0,_=_+Math.imul(Oe,qt)|0,_=_+Math.imul(me,_t)|0,N=N+Math.imul(me,qt)|0;var Nn=(v+x|0)+((_&8191)<<13)|0;v=(N+(_>>>13)|0)+(Nn>>>26)|0,Nn&=67108863,x=Math.imul(We,kt),_=Math.imul(We,at),_=_+Math.imul(Ee,kt)|0,N=Math.imul(Ee,at),x=x+Math.imul(Be,_t)|0,_=_+Math.imul(Be,qt)|0,_=_+Math.imul(we,_t)|0,N=N+Math.imul(we,qt)|0;var na=(v+x|0)+((_&8191)<<13)|0;v=(N+(_>>>13)|0)+(na>>>26)|0,na&=67108863,x=Math.imul(We,_t),_=Math.imul(We,qt),_=_+Math.imul(Ee,_t)|0,N=Math.imul(Ee,qt);var lo=(v+x|0)+((_&8191)<<13)|0;return v=(N+(_>>>13)|0)+(lo>>>26)|0,lo&=67108863,S[0]=Zr,S[1]=Xr,S[2]=ei,S[3]=ti,S[4]=vr,S[5]=Ei,S[6]=Pn,S[7]=Ai,S[8]=Dn,S[9]=On,S[10]=Si,S[11]=fn,S[12]=ln,S[13]=Cr,S[14]=Rn,S[15]=Tn,S[16]=Nn,S[17]=na,S[18]=lo,v!==0&&(S[19]=v,y.length++),y};Math.imul||(J=U);function ee(m,l,d){d.negative=l.negative^m.negative,d.length=m.length+l.length;for(var y=0,C=0,D=0;D<d.length-1;D++){var S=C;C=0;for(var v=y&67108863,x=Math.min(D,l.length-1),_=Math.max(0,D-m.length+1);_<=x;_++){var N=D-_,oe=m.words[N]|0,R=l.words[_]|0,Z=oe*R,H=Z&67108863;S=S+(Z/67108864|0)|0,H=H+v|0,v=H&67108863,S=S+(H>>>26)|0,C+=S>>>26,S&=67108863}d.words[D]=v,y=S,S=C}return y!==0?d.words[D]=y:d.length--,d._strip()}function W(m,l,d){return ee(m,l,d)}s.prototype.mulTo=function(l,d){var y,C=this.length+l.length;return this.length===10&&l.length===10?y=J(this,l,d):C<63?y=U(this,l,d):C<1024?y=ee(this,l,d):y=W(this,l,d),y},s.prototype.mul=function(l){var d=new s(null);return d.words=new Array(this.length+l.length),this.mulTo(l,d)},s.prototype.mulf=function(l){var d=new s(null);return d.words=new Array(this.length+l.length),W(this,l,d)},s.prototype.imul=function(l){return this.clone().mulTo(l,this)},s.prototype.imuln=function(l){var d=l<0;d&&(l=-l),i(typeof l=="number"),i(l<67108864);for(var y=0,C=0;C<this.length;C++){var D=(this.words[C]|0)*l,S=(D&67108863)+(y&67108863);y>>=26,y+=D/67108864|0,y+=S>>>26,this.words[C]=S&67108863}return y!==0&&(this.words[C]=y,this.length++),d?this.ineg():this},s.prototype.muln=function(l){return this.clone().imuln(l)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(l){var d=q(l);if(d.length===0)return new s(1);for(var y=this,C=0;C<d.length&&d[C]===0;C++,y=y.sqr());if(++C<d.length)for(var D=y.sqr();C<d.length;C++,D=D.sqr())d[C]!==0&&(y=y.mul(D));return y},s.prototype.iushln=function(l){i(typeof l=="number"&&l>=0);var d=l%26,y=(l-d)/26,C=67108863>>>26-d<<26-d,D;if(d!==0){var S=0;for(D=0;D<this.length;D++){var v=this.words[D]&C,x=(this.words[D]|0)-v<<d;this.words[D]=x|S,S=v>>>26-d}S&&(this.words[D]=S,this.length++)}if(y!==0){for(D=this.length-1;D>=0;D--)this.words[D+y]=this.words[D];for(D=0;D<y;D++)this.words[D]=0;this.length+=y}return this._strip()},s.prototype.ishln=function(l){return i(this.negative===0),this.iushln(l)},s.prototype.iushrn=function(l,d,y){i(typeof l=="number"&&l>=0);var C;d?C=(d-d%26)/26:C=0;var D=l%26,S=Math.min((l-D)/26,this.length),v=67108863^67108863>>>D<<D,x=y;if(C-=S,C=Math.max(0,C),x){for(var _=0;_<S;_++)x.words[_]=this.words[_];x.length=S}if(S!==0)if(this.length>S)for(this.length-=S,_=0;_<this.length;_++)this.words[_]=this.words[_+S];else this.words[0]=0,this.length=1;var N=0;for(_=this.length-1;_>=0&&(N!==0||_>=C);_--){var oe=this.words[_]|0;this.words[_]=N<<26-D|oe>>>D,N=oe&v}return x&&N!==0&&(x.words[x.length++]=N),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(l,d,y){return i(this.negative===0),this.iushrn(l,d,y)},s.prototype.shln=function(l){return this.clone().ishln(l)},s.prototype.ushln=function(l){return this.clone().iushln(l)},s.prototype.shrn=function(l){return this.clone().ishrn(l)},s.prototype.ushrn=function(l){return this.clone().iushrn(l)},s.prototype.testn=function(l){i(typeof l=="number"&&l>=0);var d=l%26,y=(l-d)/26,C=1<<d;if(this.length<=y)return!1;var D=this.words[y];return!!(D&C)},s.prototype.imaskn=function(l){i(typeof l=="number"&&l>=0);var d=l%26,y=(l-d)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=y)return this;if(d!==0&&y++,this.length=Math.min(y,this.length),d!==0){var C=67108863^67108863>>>d<<d;this.words[this.length-1]&=C}return this._strip()},s.prototype.maskn=function(l){return this.clone().imaskn(l)},s.prototype.iaddn=function(l){return i(typeof l=="number"),i(l<67108864),l<0?this.isubn(-l):this.negative!==0?this.length===1&&(this.words[0]|0)<=l?(this.words[0]=l-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(l),this.negative=1,this):this._iaddn(l)},s.prototype._iaddn=function(l){this.words[0]+=l;for(var d=0;d<this.length&&this.words[d]>=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},s.prototype.isubn=function(l){if(i(typeof l=="number"),i(l<67108864),l<0)return this.iaddn(-l);if(this.negative!==0)return this.negative=0,this.iaddn(l),this.negative=1,this;if(this.words[0]-=l,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d<this.length&&this.words[d]<0;d++)this.words[d]+=67108864,this.words[d+1]-=1;return this._strip()},s.prototype.addn=function(l){return this.clone().iaddn(l)},s.prototype.subn=function(l){return this.clone().isubn(l)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(l,d,y){var C=l.length+y,D;this._expand(C);var S,v=0;for(D=0;D<l.length;D++){S=(this.words[D+y]|0)+v;var x=(l.words[D]|0)*d;S-=x&67108863,v=(S>>26)-(x/67108864|0),this.words[D+y]=S&67108863}for(;D<this.length-y;D++)S=(this.words[D+y]|0)+v,v=S>>26,this.words[D+y]=S&67108863;if(v===0)return this._strip();for(i(v===-1),v=0,D=0;D<this.length;D++)S=-(this.words[D]|0)+v,v=S>>26,this.words[D]=S&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(l,d){var y=this.length-l.length,C=this.clone(),D=l,S=D.words[D.length-1]|0,v=this._countBits(S);y=26-v,y!==0&&(D=D.ushln(y),C.iushln(y),S=D.words[D.length-1]|0);var x=C.length-D.length,_;if(d!=="mod"){_=new s(null),_.length=x+1,_.words=new Array(_.length);for(var N=0;N<_.length;N++)_.words[N]=0}var oe=C.clone()._ishlnsubmul(D,1,x);oe.negative===0&&(C=oe,_&&(_.words[x]=1));for(var R=x-1;R>=0;R--){var Z=(C.words[D.length+R]|0)*67108864+(C.words[D.length+R-1]|0);for(Z=Math.min(Z/S|0,67108863),C._ishlnsubmul(D,Z,R);C.negative!==0;)Z--,C.negative=0,C._ishlnsubmul(D,1,R),C.isZero()||(C.negative^=1);_&&(_.words[R]=Z)}return _&&_._strip(),C._strip(),d!=="div"&&y!==0&&C.iushrn(y),{div:_||null,mod:C}},s.prototype.divmod=function(l,d,y){if(i(!l.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var C,D,S;return this.negative!==0&&l.negative===0?(S=this.neg().divmod(l,d),d!=="mod"&&(C=S.div.neg()),d!=="div"&&(D=S.mod.neg(),y&&D.negative!==0&&D.iadd(l)),{div:C,mod:D}):this.negative===0&&l.negative!==0?(S=this.divmod(l.neg(),d),d!=="mod"&&(C=S.div.neg()),{div:C,mod:S.mod}):this.negative&l.negative?(S=this.neg().divmod(l.neg(),d),d!=="div"&&(D=S.mod.neg(),y&&D.negative!==0&&D.isub(l)),{div:S.div,mod:D}):l.length>this.length||this.cmp(l)<0?{div:new s(0),mod:this}:l.length===1?d==="div"?{div:this.divn(l.words[0]),mod:null}:d==="mod"?{div:null,mod:new s(this.modrn(l.words[0]))}:{div:this.divn(l.words[0]),mod:new s(this.modrn(l.words[0]))}:this._wordDiv(l,d)},s.prototype.div=function(l){return this.divmod(l,"div",!1).div},s.prototype.mod=function(l){return this.divmod(l,"mod",!1).mod},s.prototype.umod=function(l){return this.divmod(l,"mod",!0).mod},s.prototype.divRound=function(l){var d=this.divmod(l);if(d.mod.isZero())return d.div;var y=d.div.negative!==0?d.mod.isub(l):d.mod,C=l.ushrn(1),D=l.andln(1),S=y.cmp(C);return S<0||D===1&&S===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},s.prototype.modrn=function(l){var d=l<0;d&&(l=-l),i(l<=67108863);for(var y=(1<<26)%l,C=0,D=this.length-1;D>=0;D--)C=(y*C+(this.words[D]|0))%l;return d?-C:C},s.prototype.modn=function(l){return this.modrn(l)},s.prototype.idivn=function(l){var d=l<0;d&&(l=-l),i(l<=67108863);for(var y=0,C=this.length-1;C>=0;C--){var D=(this.words[C]|0)+y*67108864;this.words[C]=D/l|0,y=D%l}return this._strip(),d?this.ineg():this},s.prototype.divn=function(l){return this.clone().idivn(l)},s.prototype.egcd=function(l){i(l.negative===0),i(!l.isZero());var d=this,y=l.clone();d.negative!==0?d=d.umod(l):d=d.clone();for(var C=new s(1),D=new s(0),S=new s(0),v=new s(1),x=0;d.isEven()&&y.isEven();)d.iushrn(1),y.iushrn(1),++x;for(var _=y.clone(),N=d.clone();!d.isZero();){for(var oe=0,R=1;!(d.words[0]&R)&&oe<26;++oe,R<<=1);if(oe>0)for(d.iushrn(oe);oe-- >0;)(C.isOdd()||D.isOdd())&&(C.iadd(_),D.isub(N)),C.iushrn(1),D.iushrn(1);for(var Z=0,H=1;!(y.words[0]&H)&&Z<26;++Z,H<<=1);if(Z>0)for(y.iushrn(Z);Z-- >0;)(S.isOdd()||v.isOdd())&&(S.iadd(_),v.isub(N)),S.iushrn(1),v.iushrn(1);d.cmp(y)>=0?(d.isub(y),C.isub(S),D.isub(v)):(y.isub(d),S.isub(C),v.isub(D))}return{a:S,b:v,gcd:y.iushln(x)}},s.prototype._invmp=function(l){i(l.negative===0),i(!l.isZero());var d=this,y=l.clone();d.negative!==0?d=d.umod(l):d=d.clone();for(var C=new s(1),D=new s(0),S=y.clone();d.cmpn(1)>0&&y.cmpn(1)>0;){for(var v=0,x=1;!(d.words[0]&x)&&v<26;++v,x<<=1);if(v>0)for(d.iushrn(v);v-- >0;)C.isOdd()&&C.iadd(S),C.iushrn(1);for(var _=0,N=1;!(y.words[0]&N)&&_<26;++_,N<<=1);if(_>0)for(y.iushrn(_);_-- >0;)D.isOdd()&&D.iadd(S),D.iushrn(1);d.cmp(y)>=0?(d.isub(y),C.isub(D)):(y.isub(d),D.isub(C))}var oe;return d.cmpn(1)===0?oe=C:oe=D,oe.cmpn(0)<0&&oe.iadd(l),oe},s.prototype.gcd=function(l){if(this.isZero())return l.abs();if(l.isZero())return this.abs();var d=this.clone(),y=l.clone();d.negative=0,y.negative=0;for(var C=0;d.isEven()&&y.isEven();C++)d.iushrn(1),y.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;y.isEven();)y.iushrn(1);var D=d.cmp(y);if(D<0){var S=d;d=y,y=S}else if(D===0||y.cmpn(1)===0)break;d.isub(y)}while(!0);return y.iushln(C)},s.prototype.invm=function(l){return this.egcd(l).a.umod(l)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(l){return this.words[0]&l},s.prototype.bincn=function(l){i(typeof l=="number");var d=l%26,y=(l-d)/26,C=1<<d;if(this.length<=y)return this._expand(y+1),this.words[y]|=C,this;for(var D=C,S=y;D!==0&&S<this.length;S++){var v=this.words[S]|0;v+=D,D=v>>>26,v&=67108863,this.words[S]=v}return D!==0&&(this.words[S]=D,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(l){var d=l<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var y;if(this.length>1)y=1;else{d&&(l=-l),i(l<=67108863,"Number is too big");var C=this.words[0]|0;y=C===l?0:C<l?-1:1}return this.negative!==0?-y|0:y},s.prototype.cmp=function(l){if(this.negative!==0&&l.negative===0)return-1;if(this.negative===0&&l.negative!==0)return 1;var d=this.ucmp(l);return this.negative!==0?-d|0:d},s.prototype.ucmp=function(l){if(this.length>l.length)return 1;if(this.length<l.length)return-1;for(var d=0,y=this.length-1;y>=0;y--){var C=this.words[y]|0,D=l.words[y]|0;if(C!==D){C<D?d=-1:C>D&&(d=1);break}}return d},s.prototype.gtn=function(l){return this.cmpn(l)===1},s.prototype.gt=function(l){return this.cmp(l)===1},s.prototype.gten=function(l){return this.cmpn(l)>=0},s.prototype.gte=function(l){return this.cmp(l)>=0},s.prototype.ltn=function(l){return this.cmpn(l)===-1},s.prototype.lt=function(l){return this.cmp(l)===-1},s.prototype.lten=function(l){return this.cmpn(l)<=0},s.prototype.lte=function(l){return this.cmp(l)<=0},s.prototype.eqn=function(l){return this.cmpn(l)===0},s.prototype.eq=function(l){return this.cmp(l)===0},s.red=function(l){return new L(l)},s.prototype.toRed=function(l){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),l.convertTo(this)._forceRed(l)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(l){return this.red=l,this},s.prototype.forceRed=function(l){return i(!this.red,"Already a number in reduction context"),this._forceRed(l)},s.prototype.redAdd=function(l){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,l)},s.prototype.redIAdd=function(l){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,l)},s.prototype.redSub=function(l){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,l)},s.prototype.redISub=function(l){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,l)},s.prototype.redShl=function(l){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,l)},s.prototype.redMul=function(l){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.mul(this,l)},s.prototype.redIMul=function(l){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.imul(this,l)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(l){return i(this.red&&!l.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,l)};var G={k256:null,p224:null,p192:null,p25519:null};function Q(m,l){this.name=m,this.p=new s(l,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Q.prototype._tmp=function(){var l=new s(null);return l.words=new Array(Math.ceil(this.n/13)),l},Q.prototype.ireduce=function(l){var d=l,y;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),y=d.bitLength();while(y>this.n);var C=y<this.n?-1:d.ucmp(this.p);return C===0?(d.words[0]=0,d.length=1):C>0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},Q.prototype.split=function(l,d){l.iushrn(this.n,0,d)},Q.prototype.imulK=function(l){return l.imul(this.k)};function A(){Q.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(A,Q),A.prototype.split=function(l,d){for(var y=4194303,C=Math.min(l.length,9),D=0;D<C;D++)d.words[D]=l.words[D];if(d.length=C,l.length<=9){l.words[0]=0,l.length=1;return}var S=l.words[9];for(d.words[d.length++]=S&y,D=10;D<l.length;D++){var v=l.words[D]|0;l.words[D-10]=(v&y)<<4|S>>>22,S=v}S>>>=22,l.words[D-10]=S,S===0&&l.length>10?l.length-=10:l.length-=9},A.prototype.imulK=function(l){l.words[l.length]=0,l.words[l.length+1]=0,l.length+=2;for(var d=0,y=0;y<l.length;y++){var C=l.words[y]|0;d+=C*977,l.words[y]=d&67108863,d=C*64+(d/67108864|0)}return l.words[l.length-1]===0&&(l.length--,l.words[l.length-1]===0&&l.length--),l};function z(){Q.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(z,Q);function te(){Q.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(te,Q);function ae(){Q.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(ae,Q),ae.prototype.imulK=function(l){for(var d=0,y=0;y<l.length;y++){var C=(l.words[y]|0)*19+d,D=C&67108863;C>>>=26,l.words[y]=D,d=C}return d!==0&&(l.words[l.length++]=d),l},s._prime=function(l){if(G[l])return G[l];var d;if(l==="k256")d=new A;else if(l==="p224")d=new z;else if(l==="p192")d=new te;else if(l==="p25519")d=new ae;else throw new Error("Unknown prime "+l);return G[l]=d,d};function L(m){if(typeof m=="string"){var l=s._prime(m);this.m=l.p,this.prime=l}else i(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}L.prototype._verify1=function(l){i(l.negative===0,"red works only with positives"),i(l.red,"red works only with red numbers")},L.prototype._verify2=function(l,d){i((l.negative|d.negative)===0,"red works only with positives"),i(l.red&&l.red===d.red,"red works only with red numbers")},L.prototype.imod=function(l){return this.prime?this.prime.ireduce(l)._forceRed(this):(g(l,l.umod(this.m)._forceRed(this)),l)},L.prototype.neg=function(l){return l.isZero()?l.clone():this.m.sub(l)._forceRed(this)},L.prototype.add=function(l,d){this._verify2(l,d);var y=l.add(d);return y.cmp(this.m)>=0&&y.isub(this.m),y._forceRed(this)},L.prototype.iadd=function(l,d){this._verify2(l,d);var y=l.iadd(d);return y.cmp(this.m)>=0&&y.isub(this.m),y},L.prototype.sub=function(l,d){this._verify2(l,d);var y=l.sub(d);return y.cmpn(0)<0&&y.iadd(this.m),y._forceRed(this)},L.prototype.isub=function(l,d){this._verify2(l,d);var y=l.isub(d);return y.cmpn(0)<0&&y.iadd(this.m),y},L.prototype.shl=function(l,d){return this._verify1(l),this.imod(l.ushln(d))},L.prototype.imul=function(l,d){return this._verify2(l,d),this.imod(l.imul(d))},L.prototype.mul=function(l,d){return this._verify2(l,d),this.imod(l.mul(d))},L.prototype.isqr=function(l){return this.imul(l,l.clone())},L.prototype.sqr=function(l){return this.mul(l,l)},L.prototype.sqrt=function(l){if(l.isZero())return l.clone();var d=this.m.andln(3);if(i(d%2===1),d===3){var y=this.m.add(new s(1)).iushrn(2);return this.pow(l,y)}for(var C=this.m.subn(1),D=0;!C.isZero()&&C.andln(1)===0;)D++,C.iushrn(1);i(!C.isZero());var S=new s(1).toRed(this),v=S.redNeg(),x=this.m.subn(1).iushrn(1),_=this.m.bitLength();for(_=new s(2*_*_).toRed(this);this.pow(_,x).cmp(v)!==0;)_.redIAdd(v);for(var N=this.pow(_,C),oe=this.pow(l,C.addn(1).iushrn(1)),R=this.pow(l,C),Z=D;R.cmp(S)!==0;){for(var H=R,K=0;H.cmp(S)!==0;K++)H=H.redSqr();i(K<Z);var k=this.pow(N,new s(1).iushln(Z-K-1));oe=oe.redMul(k),N=k.redSqr(),R=R.redMul(N),Z=K}return oe},L.prototype.invm=function(l){var d=l._invmp(this.m);return d.negative!==0?(d.negative=0,this.imod(d).redNeg()):this.imod(d)},L.prototype.pow=function(l,d){if(d.isZero())return new s(1).toRed(this);if(d.cmpn(1)===0)return l.clone();var y=4,C=new Array(1<<y);C[0]=new s(1).toRed(this),C[1]=l;for(var D=2;D<C.length;D++)C[D]=this.mul(C[D-1],l);var S=C[0],v=0,x=0,_=d.bitLength()%26;for(_===0&&(_=26),D=d.length-1;D>=0;D--){for(var N=d.words[D],oe=_-1;oe>=0;oe--){var R=N>>oe&1;if(S!==C[0]&&(S=this.sqr(S)),R===0&&v===0){x=0;continue}v<<=1,v|=R,x++,!(x!==y&&(D!==0||oe!==0))&&(S=this.mul(S,C[v]),x=0,v=0)}_=26}return S},L.prototype.convertTo=function(l){var d=l.umod(this.m);return d===l?d.clone():d},L.prototype.convertFrom=function(l){var d=l.clone();return d.red=null,d},s.mont=function(l){return new b(l)};function b(m){L.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(b,L),b.prototype.convertTo=function(l){return this.imod(l.ushln(this.shift))},b.prototype.convertFrom=function(l){var d=this.imod(l.mul(this.rinv));return d.red=null,d},b.prototype.imul=function(l,d){if(l.isZero()||d.isZero())return l.words[0]=0,l.length=1,l;var y=l.imul(d),C=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),D=y.isub(C).iushrn(this.shift),S=D;return D.cmp(this.m)>=0?S=D.isub(this.m):D.cmpn(0)<0&&(S=D.iadd(this.m)),S._forceRed(this)},b.prototype.mul=function(l,d){if(l.isZero()||d.isZero())return new s(0)._forceRed(this);var y=l.mul(d),C=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),D=y.isub(C).iushrn(this.shift),S=D;return D.cmp(this.m)>=0?S=D.isub(this.m):D.cmpn(0)<0&&(S=D.iadd(this.m)),S._forceRed(this)},b.prototype.invm=function(l){var d=this.imod(l._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(r,fr)})(Ug);var vt=Ug.exports;const Fg="bignumber/5.7.0";var nl=vt.BN;const ds=new xt(Fg),id={},qg=9007199254740991;function Q5(r){return r!=null&&(ir.isBigNumber(r)||typeof r=="number"&&r%1===0||typeof r=="string"&&!!r.match(/^-?[0-9]+$/)||Oi(r)||typeof r=="bigint"||xa(r))}let zg=!1;class ir{constructor(e,t){e!==id&&ds.throwError("cannot call constructor directly; use BigNumber.from",xt.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return gi(Tt(this).fromTwos(e))}toTwos(e){return gi(Tt(this).toTwos(e))}abs(){return this._hex[0]==="-"?ir.from(this._hex.substring(1)):this}add(e){return gi(Tt(this).add(Tt(e)))}sub(e){return gi(Tt(this).sub(Tt(e)))}div(e){return ir.from(e).isZero()&&Gi("division-by-zero","div"),gi(Tt(this).div(Tt(e)))}mul(e){return gi(Tt(this).mul(Tt(e)))}mod(e){const t=Tt(e);return t.isNeg()&&Gi("division-by-zero","mod"),gi(Tt(this).umod(t))}pow(e){const t=Tt(e);return t.isNeg()&&Gi("negative-power","pow"),gi(Tt(this).pow(t))}and(e){const t=Tt(e);return(this.isNegative()||t.isNeg())&&Gi("unbound-bitwise-result","and"),gi(Tt(this).and(t))}or(e){const t=Tt(e);return(this.isNegative()||t.isNeg())&&Gi("unbound-bitwise-result","or"),gi(Tt(this).or(t))}xor(e){const t=Tt(e);return(this.isNegative()||t.isNeg())&&Gi("unbound-bitwise-result","xor"),gi(Tt(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Gi("negative-width","mask"),gi(Tt(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Gi("negative-width","shl"),gi(Tt(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Gi("negative-width","shr"),gi(Tt(this).shrn(e))}eq(e){return Tt(this).eq(Tt(e))}lt(e){return Tt(this).lt(Tt(e))}lte(e){return Tt(this).lte(Tt(e))}gt(e){return Tt(this).gt(Tt(e))}gte(e){return Tt(this).gte(Tt(e))}isNegative(){return this._hex[0]==="-"}isZero(){return Tt(this).isZero()}toNumber(){try{return Tt(this).toNumber()}catch{Gi("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return ds.throwError("this platform does not support BigInt",xt.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?zg||(zg=!0,ds.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?ds.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",xt.errors.UNEXPECTED_ARGUMENT,{}):ds.throwError("BigNumber.toString does not accept parameters",xt.errors.UNEXPECTED_ARGUMENT,{})),Tt(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof ir)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new ir(id,Rc(e)):e.match(/^-?[0-9]+$/)?new ir(id,Rc(new nl(e))):ds.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Gi("underflow","BigNumber.from",e),(e>=qg||e<=-qg)&&Gi("overflow","BigNumber.from",e),ir.from(String(e));const t=e;if(typeof t=="bigint")return ir.from(t.toString());if(xa(t))return ir.from(ni(t));if(t)if(t.toHexString){const i=t.toHexString();if(typeof i=="string")return ir.from(i)}else{let i=t._hex;if(i==null&&t.type==="BigNumber"&&(i=t.hex),typeof i=="string"&&(Oi(i)||i[0]==="-"&&Oi(i.substring(1))))return ir.from(i)}return ds.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function Rc(r){if(typeof r!="string")return Rc(r.toString(16));if(r[0]==="-")return r=r.substring(1),r[0]==="-"&&ds.throwArgumentError("invalid hex","value",r),r=Rc(r),r==="0x00"?r:"-"+r;if(r.substring(0,2)!=="0x"&&(r="0x"+r),r==="0x")return"0x00";for(r.length%2&&(r="0x0"+r.substring(2));r.length>4&&r.substring(0,4)==="0x00";)r="0x"+r.substring(4);return r}function gi(r){return ir.from(Rc(r))}function Tt(r){const e=ir.from(r).toHexString();return e[0]==="-"?new nl("-"+e.substring(3),16):new nl(e.substring(2),16)}function Gi(r,e,t){const i={fault:r,operation:e};return t!=null&&(i.value=t),ds.throwError(r,xt.errors.NUMERIC_FAULT,i)}function Z5(r){return new nl(r,36).toString(16)}const si=new xt(Fg),Tc={},kg=ir.from(0),Hg=ir.from(-1);function jg(r,e,t,i){const n={fault:e,operation:t};return i!==void 0&&(n.value=i),si.throwError(r,xt.errors.NUMERIC_FAULT,n)}let Nc="0";for(;Nc.length<256;)Nc+=Nc;function nd(r){if(typeof r!="number")try{r=ir.from(r).toNumber()}catch{}return typeof r=="number"&&r>=0&&r<=256&&!(r%1)?"1"+Nc.substring(0,r):si.throwArgumentError("invalid decimal size","decimals",r)}function sd(r,e){e==null&&(e=0);const t=nd(e);r=ir.from(r);const i=r.lt(kg);i&&(r=r.mul(Hg));let n=r.mod(t).toString();for(;n.length<t.length-1;)n="0"+n;n=n.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=r.div(t).toString();return t.length===1?r=s:r=s+"."+n,i&&(r="-"+r),r}function ps(r,e){e==null&&(e=0);const t=nd(e);(typeof r!="string"||!r.match(/^-?[0-9.]+$/))&&si.throwArgumentError("invalid decimal value","value",r);const i=r.substring(0,1)==="-";i&&(r=r.substring(1)),r==="."&&si.throwArgumentError("missing value","value",r);const n=r.split(".");n.length>2&&si.throwArgumentError("too many decimal points","value",r);let s=n[0],a=n[1];for(s||(s="0"),a||(a="0");a[a.length-1]==="0";)a=a.substring(0,a.length-1);for(a.length>t.length-1&&jg("fractional component exceeds decimals","underflow","parseFixed"),a===""&&(a="0");a.length<t.length-1;)a+="0";const f=ir.from(s),h=ir.from(a);let u=f.mul(t).add(h);return i&&(u=u.mul(Hg)),u}class Ea{constructor(e,t,i,n){e!==Tc&&si.throwError("cannot use FixedFormat constructor; use FixedFormat.from",xt.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=i,this.decimals=n,this.name=(t?"":"u")+"fixed"+String(i)+"x"+String(n),this._multiplier=nd(n),Object.freeze(this)}static from(e){if(e instanceof Ea)return e;typeof e=="number"&&(e=`fixed128x${e}`);let t=!0,i=128,n=18;if(typeof e=="string"){if(e!=="fixed")if(e==="ufixed")t=!1;else{const s=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);s||si.throwArgumentError("invalid fixed format","format",e),t=s[1]!=="u",i=parseInt(s[2]),n=parseInt(s[3])}}else if(e){const s=(a,f,h)=>e[a]==null?h:(typeof e[a]!==f&&si.throwArgumentError("invalid fixed format ("+a+" not "+f+")","format."+a,e[a]),e[a]);t=s("signed","boolean",t),i=s("width","number",i),n=s("decimals","number",n)}return i%8&&si.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",i),n>80&&si.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new Ea(Tc,t,i,n)}}class kr{constructor(e,t,i,n){e!==Tc&&si.throwError("cannot use FixedNumber constructor; use FixedNumber.from",xt.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=i,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&si.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=ps(this._value,this.format.decimals),i=ps(e._value,e.format.decimals);return kr.fromValue(t.add(i),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=ps(this._value,this.format.decimals),i=ps(e._value,e.format.decimals);return kr.fromValue(t.sub(i),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=ps(this._value,this.format.decimals),i=ps(e._value,e.format.decimals);return kr.fromValue(t.mul(i).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=ps(this._value,this.format.decimals),i=ps(e._value,e.format.decimals);return kr.fromValue(t.mul(this.format._multiplier).div(i),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");e.length===1&&e.push("0");let t=kr.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return this.isNegative()&&i&&(t=t.subUnsafe(Wg.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");e.length===1&&e.push("0");let t=kr.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return!this.isNegative()&&i&&(t=t.addUnsafe(Wg.toFormat(t.format))),t}round(e){e==null&&(e=0);const t=this.toString().split(".");if(t.length===1&&t.push("0"),(e<0||e>80||e%1)&&si.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const i=kr.from("1"+Nc.substring(0,e),this.format),n=X5.toFormat(this.format);return this.mulUnsafe(i).addUnsafe(n).floor().divUnsafe(i)}isZero(){return this._value==="0.0"||this._value==="0"}isNegative(){return this._value[0]==="-"}toString(){return this._value}toHexString(e){if(e==null)return this._hex;e%8&&si.throwArgumentError("invalid byte width","width",e);const t=ir.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return qn(t,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return kr.fromString(this._value,e)}static fromValue(e,t,i){return i==null&&t!=null&&!Q5(t)&&(i=t,t=null),t==null&&(t=0),i==null&&(i="fixed"),kr.fromString(sd(e,t),Ea.from(i))}static fromString(e,t){t==null&&(t="fixed");const i=Ea.from(t),n=ps(e,i.decimals);!i.signed&&n.lt(kg)&&jg("unsigned value cannot be negative","overflow","value",e);let s=null;i.signed?s=n.toTwos(i.width).toHexString():(s=n.toHexString(),s=qn(s,i.width/8));const a=sd(n,i.decimals);return new kr(Tc,s,a,i)}static fromBytes(e,t){t==null&&(t="fixed");const i=Ea.from(t);if(ur(e).length>i.width/8)throw new Error("overflow");let n=ir.from(e);i.signed&&(n=n.fromTwos(i.width));const s=n.toTwos((i.signed?0:1)+i.width).toHexString(),a=sd(n,i.decimals);return new kr(Tc,s,a,i)}static from(e,t){if(typeof e=="string")return kr.fromString(e,t);if(xa(e))return kr.fromBytes(e,t);try{return kr.fromValue(e,0,t)}catch(i){if(i.code!==xt.errors.INVALID_ARGUMENT)throw i}return si.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}}const Wg=kr.from(1),X5=kr.from("0.5"),e4="strings/5.7.0",Kg=new xt(e4);var sl;(function(r){r.current="",r.NFC="NFC",r.NFD="NFD",r.NFKC="NFKC",r.NFKD="NFKD"})(sl||(sl={}));var Aa;(function(r){r.UNEXPECTED_CONTINUE="unexpected continuation byte",r.BAD_PREFIX="bad codepoint prefix",r.OVERRUN="string overrun",r.MISSING_CONTINUE="missing continuation byte",r.OUT_OF_RANGE="out of UTF-8 range",r.UTF16_SURROGATE="UTF-16 surrogate",r.OVERLONG="overlong representation"})(Aa||(Aa={}));function t4(r,e,t,i,n){return Kg.throwArgumentError(`invalid codepoint at offset ${e}; ${r}`,"bytes",t)}function Vg(r,e,t,i,n){if(r===Aa.BAD_PREFIX||r===Aa.UNEXPECTED_CONTINUE){let s=0;for(let a=e+1;a<t.length&&t[a]>>6===2;a++)s++;return s}return r===Aa.OVERRUN?t.length-e-1:0}function r4(r,e,t,i,n){return r===Aa.OVERLONG?(i.push(n),0):(i.push(65533),Vg(r,e,t))}Object.freeze({error:t4,ignore:Vg,replace:r4});function od(r,e=sl.current){e!=sl.current&&(Kg.checkNormalize(),r=r.normalize(e));let t=[];for(let i=0;i<r.length;i++){const n=r.charCodeAt(i);if(n<128)t.push(n);else if(n<2048)t.push(n>>6|192),t.push(n&63|128);else if((n&64512)==55296){i++;const s=r.charCodeAt(i);if(i>=r.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const a=65536+((n&1023)<<10)+(s&1023);t.push(a>>18|240),t.push(a>>12&63|128),t.push(a>>6&63|128),t.push(a&63|128)}else t.push(n>>12|224),t.push(n>>6&63|128),t.push(n&63|128)}return ur(t)}function i4(r){if(r.length%4!==0)throw new Error("bad data");let e=[];for(let t=0;t<r.length;t+=4)e.push(parseInt(r.substring(t,t+4),16));return e}function ad(r,e){e||(e=function(n){return[parseInt(n,16)]});let t=0,i={};return r.split(",").forEach(n=>{let s=n.split(":");t+=parseInt(s[0],16),i[t]=e(s[1])}),i}function Gg(r){let e=0;return r.split(",").map(t=>{let i=t.split("-");i.length===1?i[1]="0":i[1]===""&&(i[1]="1");let n=e+parseInt(i[0],16);return e=parseInt(i[1],16),{l:n,h:e}})}Gg("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(r=>parseInt(r,16)),ad("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),ad("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),ad("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",i4),Gg("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");const Jg="hash/5.7.0";function n4(r){r=atob(r);const e=[];for(let t=0;t<r.length;t++)e.push(r.charCodeAt(t));return ur(e)}function Yg(r,e){e==null&&(e=1);const t=[],i=t.forEach,n=function(s,a){i.call(s,function(f){a>0&&Array.isArray(f)?n(f,a-1):t.push(f)})};return n(r,e),t}function s4(r){const e={};for(let t=0;t<r.length;t++){const i=r[t];e[i[0]]=i[1]}return e}function o4(r){let e=0;function t(){return r[e++]<<8|r[e++]}let i=t(),n=1,s=[0,1];for(let G=1;G<i;G++)s.push(n+=t());let a=t(),f=e;e+=a;let h=0,u=0;function g(){return h==0&&(u=u<<8|r[e++],h=8),u>>--h&1}const w=31,M=Math.pow(2,w),P=M>>>1,O=P>>1,$=M-1;let q=0;for(let G=0;G<w;G++)q=q<<1|g();let U=[],J=0,ee=M;for(;;){let G=Math.floor(((q-J+1)*n-1)/ee),Q=0,A=i;for(;A-Q>1;){let ae=Q+A>>>1;G<s[ae]?A=ae:Q=ae}if(Q==0)break;U.push(Q);let z=J+Math.floor(ee*s[Q]/n),te=J+Math.floor(ee*s[Q+1]/n)-1;for(;!((z^te)&P);)q=q<<1&$|g(),z=z<<1&$,te=te<<1&$|1;for(;z&~te&O;)q=q&P|q<<1&$>>>1|g(),z=z<<1^P,te=(te^P)<<1|P|1;J=z,ee=1+te-z}let W=i-4;return U.map(G=>{switch(G-W){case 3:return W+65792+(r[f++]<<16|r[f++]<<8|r[f++]);case 2:return W+256+(r[f++]<<8|r[f++]);case 1:return W+r[f++];default:return G-1}})}function a4(r){let e=0;return()=>r[e++]}function c4(r){return a4(o4(r))}function f4(r){return r&1?~r>>1:r>>1}function l4(r,e){let t=Array(r);for(let i=0;i<r;i++)t[i]=1+e();return t}function Qg(r,e){let t=Array(r);for(let i=0,n=-1;i<r;i++)t[i]=n+=1+e();return t}function h4(r,e){let t=Array(r);for(let i=0,n=0;i<r;i++)t[i]=n+=f4(e());return t}function ol(r,e){let t=Qg(r(),r),i=r(),n=Qg(i,r),s=l4(i,r);for(let a=0;a<i;a++)for(let f=0;f<s[a];f++)t.push(n[a]+f);return e?t.map(a=>e[a]):t}function u4(r){let e=[];for(;;){let t=r();if(t==0)break;e.push(p4(t,r))}for(;;){let t=r()-1;if(t<0)break;e.push(g4(t,r))}return s4(Yg(e))}function d4(r){let e=[];for(;;){let t=r();if(t==0)break;e.push(t)}return e}function Zg(r,e,t){let i=Array(r).fill(void 0).map(()=>[]);for(let n=0;n<e;n++)h4(r,t).forEach((s,a)=>i[a].push(s));return i}function p4(r,e){let t=1+e(),i=e(),n=d4(e),s=Zg(n.length,1+r,e);return Yg(s.map((a,f)=>{const h=a[0],u=a.slice(1);return Array(n[f]).fill(void 0).map((g,w)=>{let M=w*i;return[h+w*t,u.map(P=>P+M)]})}))}function g4(r,e){let t=1+e();return Zg(t,1+r,e).map(n=>[n[0],n.slice(1)])}function v4(r){let e=ol(r).sort((i,n)=>i-n);return t();function t(){let i=[];for(;;){let u=ol(r,e);if(u.length==0)break;i.push({set:new Set(u),node:t()})}i.sort((u,g)=>g.set.size-u.set.size);let n=r(),s=n%3;n=n/3|0;let a=!!(n&1);n>>=1;let f=n==1,h=n==2;return{branches:i,valid:s,fe0f:a,save:f,check:h}}}function m4(){return c4(n4("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const al=m4();new Set(ol(al)),new Set(ol(al)),u4(al),v4(al),new xt(Jg),new Uint8Array(32).fill(0);const b4=`Ethereum Signed Message:
|
|
22
|
+
`;function Xg(r){return typeof r=="string"&&(r=od(r)),rd(K5([od(b4),od(String(r.length)),r]))}const w4="rlp/5.7.0";new xt(w4);const y4="address/5.7.0",$c=new xt(y4);function ev(r){Oi(r,20)||$c.throwArgumentError("invalid address","address",r),r=r.toLowerCase();const e=r.substring(2).split(""),t=new Uint8Array(40);for(let n=0;n<40;n++)t[n]=e[n].charCodeAt(0);const i=ur(rd(t));for(let n=0;n<40;n+=2)i[n>>1]>>4>=8&&(e[n]=e[n].toUpperCase()),(i[n>>1]&15)>=8&&(e[n+1]=e[n+1].toUpperCase());return"0x"+e.join("")}const _4=9007199254740991;function x4(r){return Math.log10?Math.log10(r):Math.log(r)/Math.LN10}const cd={};for(let r=0;r<10;r++)cd[String(r)]=String(r);for(let r=0;r<26;r++)cd[String.fromCharCode(65+r)]=String(10+r);const tv=Math.floor(x4(_4));function E4(r){r=r.toUpperCase(),r=r.substring(4)+r.substring(0,2)+"00";let e=r.split("").map(i=>cd[i]).join("");for(;e.length>=tv;){let i=e.substring(0,tv);e=parseInt(i,10)%97+e.substring(i.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}function A4(r){let e=null;if(typeof r!="string"&&$c.throwArgumentError("invalid address","address",r),r.match(/^(0x)?[0-9a-fA-F]{40}$/))r.substring(0,2)!=="0x"&&(r="0x"+r),e=ev(r),r.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==r&&$c.throwArgumentError("bad address checksum","address",r);else if(r.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(r.substring(2,4)!==E4(r)&&$c.throwArgumentError("bad icap checksum","address",r),e=Z5(r.substring(4));e.length<40;)e="0"+e;e=ev("0x"+e)}else $c.throwArgumentError("invalid address","address",r);return e}const S4="properties/5.7.0";new xt(S4);function Lc(r,e,t){Object.defineProperty(r,e,{enumerable:!0,value:t,writable:!1})}new xt(Jg),new Uint8Array(32).fill(0),ir.from(-1);const I4=ir.from(0),M4=ir.from(1);ir.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),qn(M4.toHexString(),32),qn(I4.toHexString(),32);var Ri={},Nt={},So=rv;function rv(r,e){if(!r)throw new Error(e||"Assertion failed")}rv.equal=function(e,t,i){if(e!=t)throw new Error(i||"Assertion failed: "+e+" != "+t)};var Sa={exports:{}};typeof Object.create=="function"?Sa.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Sa.exports=function(e,t){if(t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}};var C4=So,P4=Sa.exports;Nt.inherits=P4;function D4(r,e){return(r.charCodeAt(e)&64512)!==55296||e<0||e+1>=r.length?!1:(r.charCodeAt(e+1)&64512)===56320}function O4(r,e){if(Array.isArray(r))return r.slice();if(!r)return[];var t=[];if(typeof r=="string")if(e){if(e==="hex")for(r=r.replace(/[^a-z0-9]+/ig,""),r.length%2!==0&&(r="0"+r),n=0;n<r.length;n+=2)t.push(parseInt(r[n]+r[n+1],16))}else for(var i=0,n=0;n<r.length;n++){var s=r.charCodeAt(n);s<128?t[i++]=s:s<2048?(t[i++]=s>>6|192,t[i++]=s&63|128):D4(r,n)?(s=65536+((s&1023)<<10)+(r.charCodeAt(++n)&1023),t[i++]=s>>18|240,t[i++]=s>>12&63|128,t[i++]=s>>6&63|128,t[i++]=s&63|128):(t[i++]=s>>12|224,t[i++]=s>>6&63|128,t[i++]=s&63|128)}else for(n=0;n<r.length;n++)t[n]=r[n]|0;return t}Nt.toArray=O4;function R4(r){for(var e="",t=0;t<r.length;t++)e+=nv(r[t].toString(16));return e}Nt.toHex=R4;function iv(r){var e=r>>>24|r>>>8&65280|r<<8&16711680|(r&255)<<24;return e>>>0}Nt.htonl=iv;function T4(r,e){for(var t="",i=0;i<r.length;i++){var n=r[i];e==="little"&&(n=iv(n)),t+=sv(n.toString(16))}return t}Nt.toHex32=T4;function nv(r){return r.length===1?"0"+r:r}Nt.zero2=nv;function sv(r){return r.length===7?"0"+r:r.length===6?"00"+r:r.length===5?"000"+r:r.length===4?"0000"+r:r.length===3?"00000"+r:r.length===2?"000000"+r:r.length===1?"0000000"+r:r}Nt.zero8=sv;function N4(r,e,t,i){var n=t-e;C4(n%4===0);for(var s=new Array(n/4),a=0,f=e;a<s.length;a++,f+=4){var h;i==="big"?h=r[f]<<24|r[f+1]<<16|r[f+2]<<8|r[f+3]:h=r[f+3]<<24|r[f+2]<<16|r[f+1]<<8|r[f],s[a]=h>>>0}return s}Nt.join32=N4;function $4(r,e){for(var t=new Array(r.length*4),i=0,n=0;i<r.length;i++,n+=4){var s=r[i];e==="big"?(t[n]=s>>>24,t[n+1]=s>>>16&255,t[n+2]=s>>>8&255,t[n+3]=s&255):(t[n+3]=s>>>24,t[n+2]=s>>>16&255,t[n+1]=s>>>8&255,t[n]=s&255)}return t}Nt.split32=$4;function L4(r,e){return r>>>e|r<<32-e}Nt.rotr32=L4;function B4(r,e){return r<<e|r>>>32-e}Nt.rotl32=B4;function U4(r,e){return r+e>>>0}Nt.sum32=U4;function F4(r,e,t){return r+e+t>>>0}Nt.sum32_3=F4;function q4(r,e,t,i){return r+e+t+i>>>0}Nt.sum32_4=q4;function z4(r,e,t,i,n){return r+e+t+i+n>>>0}Nt.sum32_5=z4;function k4(r,e,t,i){var n=r[e],s=r[e+1],a=i+s>>>0,f=(a<i?1:0)+t+n;r[e]=f>>>0,r[e+1]=a}Nt.sum64=k4;function H4(r,e,t,i){var n=e+i>>>0,s=(n<e?1:0)+r+t;return s>>>0}Nt.sum64_hi=H4;function j4(r,e,t,i){var n=e+i;return n>>>0}Nt.sum64_lo=j4;function W4(r,e,t,i,n,s,a,f){var h=0,u=e;u=u+i>>>0,h+=u<e?1:0,u=u+s>>>0,h+=u<s?1:0,u=u+f>>>0,h+=u<f?1:0;var g=r+t+n+a+h;return g>>>0}Nt.sum64_4_hi=W4;function K4(r,e,t,i,n,s,a,f){var h=e+i+s+f;return h>>>0}Nt.sum64_4_lo=K4;function V4(r,e,t,i,n,s,a,f,h,u){var g=0,w=e;w=w+i>>>0,g+=w<e?1:0,w=w+s>>>0,g+=w<s?1:0,w=w+f>>>0,g+=w<f?1:0,w=w+u>>>0,g+=w<u?1:0;var M=r+t+n+a+h+g;return M>>>0}Nt.sum64_5_hi=V4;function G4(r,e,t,i,n,s,a,f,h,u){var g=e+i+s+f+u;return g>>>0}Nt.sum64_5_lo=G4;function J4(r,e,t){var i=e<<32-t|r>>>t;return i>>>0}Nt.rotr64_hi=J4;function Y4(r,e,t){var i=r<<32-t|e>>>t;return i>>>0}Nt.rotr64_lo=Y4;function Q4(r,e,t){return r>>>t}Nt.shr64_hi=Q4;function Z4(r,e,t){var i=r<<32-t|e>>>t;return i>>>0}Nt.shr64_lo=Z4;var Ia={},ov=Nt,X4=So;function cl(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Ia.BlockHash=cl,cl.prototype.update=function(e,t){if(e=ov.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var i=e.length%this._delta8;this.pending=e.slice(e.length-i,e.length),this.pending.length===0&&(this.pending=null),e=ov.join32(e,0,e.length-i,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},cl.prototype.digest=function(e){return this.update(this._pad()),X4(this.pending===null),this._digest(e)},cl.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,i=t-(e+this.padLength)%t,n=new Array(i+this.padLength);n[0]=128;for(var s=1;s<i;s++)n[s]=0;if(e<<=3,this.endian==="big"){for(var a=8;a<this.padLength;a++)n[s++]=0;n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=e>>>24&255,n[s++]=e>>>16&255,n[s++]=e>>>8&255,n[s++]=e&255}else for(n[s++]=e&255,n[s++]=e>>>8&255,n[s++]=e>>>16&255,n[s++]=e>>>24&255,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,a=8;a<this.padLength;a++)n[s++]=0;return n};var Ma={},zn={},e8=Nt,kn=e8.rotr32;function t8(r,e,t,i){if(r===0)return av(e,t,i);if(r===1||r===3)return fv(e,t,i);if(r===2)return cv(e,t,i)}zn.ft_1=t8;function av(r,e,t){return r&e^~r&t}zn.ch32=av;function cv(r,e,t){return r&e^r&t^e&t}zn.maj32=cv;function fv(r,e,t){return r^e^t}zn.p32=fv;function r8(r){return kn(r,2)^kn(r,13)^kn(r,22)}zn.s0_256=r8;function i8(r){return kn(r,6)^kn(r,11)^kn(r,25)}zn.s1_256=i8;function n8(r){return kn(r,7)^kn(r,18)^r>>>3}zn.g0_256=n8;function s8(r){return kn(r,17)^kn(r,19)^r>>>10}zn.g1_256=s8;var Ca=Nt,o8=Ia,a8=zn,fd=Ca.rotl32,Bc=Ca.sum32,c8=Ca.sum32_5,f8=a8.ft_1,lv=o8.BlockHash,l8=[1518500249,1859775393,2400959708,3395469782];function Hn(){if(!(this instanceof Hn))return new Hn;lv.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Ca.inherits(Hn,lv);var h8=Hn;Hn.blockSize=512,Hn.outSize=160,Hn.hmacStrength=80,Hn.padLength=64,Hn.prototype._update=function(e,t){for(var i=this.W,n=0;n<16;n++)i[n]=e[t+n];for(;n<i.length;n++)i[n]=fd(i[n-3]^i[n-8]^i[n-14]^i[n-16],1);var s=this.h[0],a=this.h[1],f=this.h[2],h=this.h[3],u=this.h[4];for(n=0;n<i.length;n++){var g=~~(n/20),w=c8(fd(s,5),f8(g,a,f,h),u,i[n],l8[g]);u=h,h=f,f=fd(a,30),a=s,s=w}this.h[0]=Bc(this.h[0],s),this.h[1]=Bc(this.h[1],a),this.h[2]=Bc(this.h[2],f),this.h[3]=Bc(this.h[3],h),this.h[4]=Bc(this.h[4],u)},Hn.prototype._digest=function(e){return e==="hex"?Ca.toHex32(this.h,"big"):Ca.split32(this.h,"big")};var Pa=Nt,u8=Ia,Da=zn,d8=So,_n=Pa.sum32,p8=Pa.sum32_4,g8=Pa.sum32_5,v8=Da.ch32,m8=Da.maj32,b8=Da.s0_256,w8=Da.s1_256,y8=Da.g0_256,_8=Da.g1_256,hv=u8.BlockHash,x8=[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 jn(){if(!(this instanceof jn))return new jn;hv.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=x8,this.W=new Array(64)}Pa.inherits(jn,hv);var uv=jn;jn.blockSize=512,jn.outSize=256,jn.hmacStrength=192,jn.padLength=64,jn.prototype._update=function(e,t){for(var i=this.W,n=0;n<16;n++)i[n]=e[t+n];for(;n<i.length;n++)i[n]=p8(_8(i[n-2]),i[n-7],y8(i[n-15]),i[n-16]);var s=this.h[0],a=this.h[1],f=this.h[2],h=this.h[3],u=this.h[4],g=this.h[5],w=this.h[6],M=this.h[7];for(d8(this.k.length===i.length),n=0;n<i.length;n++){var P=g8(M,w8(u),v8(u,g,w),this.k[n],i[n]),O=_n(b8(s),m8(s,a,f));M=w,w=g,g=u,u=_n(h,P),h=f,f=a,a=s,s=_n(P,O)}this.h[0]=_n(this.h[0],s),this.h[1]=_n(this.h[1],a),this.h[2]=_n(this.h[2],f),this.h[3]=_n(this.h[3],h),this.h[4]=_n(this.h[4],u),this.h[5]=_n(this.h[5],g),this.h[6]=_n(this.h[6],w),this.h[7]=_n(this.h[7],M)},jn.prototype._digest=function(e){return e==="hex"?Pa.toHex32(this.h,"big"):Pa.split32(this.h,"big")};var ld=Nt,dv=uv;function gs(){if(!(this instanceof gs))return new gs;dv.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}ld.inherits(gs,dv);var E8=gs;gs.blockSize=512,gs.outSize=224,gs.hmacStrength=192,gs.padLength=64,gs.prototype._digest=function(e){return e==="hex"?ld.toHex32(this.h.slice(0,7),"big"):ld.split32(this.h.slice(0,7),"big")};var vi=Nt,A8=Ia,S8=So,Wn=vi.rotr64_hi,Kn=vi.rotr64_lo,pv=vi.shr64_hi,gv=vi.shr64_lo,Fs=vi.sum64,hd=vi.sum64_hi,ud=vi.sum64_lo,I8=vi.sum64_4_hi,M8=vi.sum64_4_lo,C8=vi.sum64_5_hi,P8=vi.sum64_5_lo,vv=A8.BlockHash,D8=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function xn(){if(!(this instanceof xn))return new xn;vv.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=D8,this.W=new Array(160)}vi.inherits(xn,vv);var mv=xn;xn.blockSize=1024,xn.outSize=512,xn.hmacStrength=192,xn.padLength=128,xn.prototype._prepareBlock=function(e,t){for(var i=this.W,n=0;n<32;n++)i[n]=e[t+n];for(;n<i.length;n+=2){var s=z8(i[n-4],i[n-3]),a=k8(i[n-4],i[n-3]),f=i[n-14],h=i[n-13],u=F8(i[n-30],i[n-29]),g=q8(i[n-30],i[n-29]),w=i[n-32],M=i[n-31];i[n]=I8(s,a,f,h,u,g,w,M),i[n+1]=M8(s,a,f,h,u,g,w,M)}},xn.prototype._update=function(e,t){this._prepareBlock(e,t);var i=this.W,n=this.h[0],s=this.h[1],a=this.h[2],f=this.h[3],h=this.h[4],u=this.h[5],g=this.h[6],w=this.h[7],M=this.h[8],P=this.h[9],O=this.h[10],$=this.h[11],q=this.h[12],U=this.h[13],J=this.h[14],ee=this.h[15];S8(this.k.length===i.length);for(var W=0;W<i.length;W+=2){var G=J,Q=ee,A=B8(M,P),z=U8(M,P),te=O8(M,P,O,$,q),ae=R8(M,P,O,$,q,U),L=this.k[W],b=this.k[W+1],m=i[W],l=i[W+1],d=C8(G,Q,A,z,te,ae,L,b,m,l),y=P8(G,Q,A,z,te,ae,L,b,m,l);G=$8(n,s),Q=L8(n,s),A=T8(n,s,a,f,h),z=N8(n,s,a,f,h,u);var C=hd(G,Q,A,z),D=ud(G,Q,A,z);J=q,ee=U,q=O,U=$,O=M,$=P,M=hd(g,w,d,y),P=ud(w,w,d,y),g=h,w=u,h=a,u=f,a=n,f=s,n=hd(d,y,C,D),s=ud(d,y,C,D)}Fs(this.h,0,n,s),Fs(this.h,2,a,f),Fs(this.h,4,h,u),Fs(this.h,6,g,w),Fs(this.h,8,M,P),Fs(this.h,10,O,$),Fs(this.h,12,q,U),Fs(this.h,14,J,ee)},xn.prototype._digest=function(e){return e==="hex"?vi.toHex32(this.h,"big"):vi.split32(this.h,"big")};function O8(r,e,t,i,n){var s=r&t^~r&n;return s<0&&(s+=4294967296),s}function R8(r,e,t,i,n,s){var a=e&i^~e&s;return a<0&&(a+=4294967296),a}function T8(r,e,t,i,n){var s=r&t^r&n^t&n;return s<0&&(s+=4294967296),s}function N8(r,e,t,i,n,s){var a=e&i^e&s^i&s;return a<0&&(a+=4294967296),a}function $8(r,e){var t=Wn(r,e,28),i=Wn(e,r,2),n=Wn(e,r,7),s=t^i^n;return s<0&&(s+=4294967296),s}function L8(r,e){var t=Kn(r,e,28),i=Kn(e,r,2),n=Kn(e,r,7),s=t^i^n;return s<0&&(s+=4294967296),s}function B8(r,e){var t=Wn(r,e,14),i=Wn(r,e,18),n=Wn(e,r,9),s=t^i^n;return s<0&&(s+=4294967296),s}function U8(r,e){var t=Kn(r,e,14),i=Kn(r,e,18),n=Kn(e,r,9),s=t^i^n;return s<0&&(s+=4294967296),s}function F8(r,e){var t=Wn(r,e,1),i=Wn(r,e,8),n=pv(r,e,7),s=t^i^n;return s<0&&(s+=4294967296),s}function q8(r,e){var t=Kn(r,e,1),i=Kn(r,e,8),n=gv(r,e,7),s=t^i^n;return s<0&&(s+=4294967296),s}function z8(r,e){var t=Wn(r,e,19),i=Wn(e,r,29),n=pv(r,e,6),s=t^i^n;return s<0&&(s+=4294967296),s}function k8(r,e){var t=Kn(r,e,19),i=Kn(e,r,29),n=gv(r,e,6),s=t^i^n;return s<0&&(s+=4294967296),s}var dd=Nt,bv=mv;function vs(){if(!(this instanceof vs))return new vs;bv.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}dd.inherits(vs,bv);var H8=vs;vs.blockSize=1024,vs.outSize=384,vs.hmacStrength=192,vs.padLength=128,vs.prototype._digest=function(e){return e==="hex"?dd.toHex32(this.h.slice(0,12),"big"):dd.split32(this.h.slice(0,12),"big")},Ma.sha1=h8,Ma.sha224=E8,Ma.sha256=uv,Ma.sha384=H8,Ma.sha512=mv;var wv={},Io=Nt,j8=Ia,fl=Io.rotl32,yv=Io.sum32,Uc=Io.sum32_3,_v=Io.sum32_4,xv=j8.BlockHash;function Vn(){if(!(this instanceof Vn))return new Vn;xv.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Io.inherits(Vn,xv),wv.ripemd160=Vn,Vn.blockSize=512,Vn.outSize=160,Vn.hmacStrength=192,Vn.padLength=64,Vn.prototype._update=function(e,t){for(var i=this.h[0],n=this.h[1],s=this.h[2],a=this.h[3],f=this.h[4],h=i,u=n,g=s,w=a,M=f,P=0;P<80;P++){var O=yv(fl(_v(i,Ev(P,n,s,a),e[V8[P]+t],W8(P)),J8[P]),f);i=f,f=a,a=fl(s,10),s=n,n=O,O=yv(fl(_v(h,Ev(79-P,u,g,w),e[G8[P]+t],K8(P)),Y8[P]),M),h=M,M=w,w=fl(g,10),g=u,u=O}O=Uc(this.h[1],s,w),this.h[1]=Uc(this.h[2],a,M),this.h[2]=Uc(this.h[3],f,h),this.h[3]=Uc(this.h[4],i,u),this.h[4]=Uc(this.h[0],n,g),this.h[0]=O},Vn.prototype._digest=function(e){return e==="hex"?Io.toHex32(this.h,"little"):Io.split32(this.h,"little")};function Ev(r,e,t,i){return r<=15?e^t^i:r<=31?e&t|~e&i:r<=47?(e|~t)^i:r<=63?e&i|t&~i:e^(t|~i)}function W8(r){return r<=15?0:r<=31?1518500249:r<=47?1859775393:r<=63?2400959708:2840853838}function K8(r){return r<=15?1352829926:r<=31?1548603684:r<=47?1836072691:r<=63?2053994217:0}var V8=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],G8=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],J8=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],Y8=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Q8=Nt,Z8=So;function Oa(r,e,t){if(!(this instanceof Oa))return new Oa(r,e,t);this.Hash=r,this.blockSize=r.blockSize/8,this.outSize=r.outSize/8,this.inner=null,this.outer=null,this._init(Q8.toArray(e,t))}var X8=Oa;Oa.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),Z8(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=new this.Hash().update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=new this.Hash().update(e)},Oa.prototype.update=function(e,t){return this.inner.update(e,t),this},Oa.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},function(r){var e=r;e.utils=Nt,e.common=Ia,e.sha=Ma,e.ripemd=wv,e.hmac=X8,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(Ri);function Ra(r,e,t){return t={path:e,exports:{},require:function(i,n){return e_(i,n??t.path)}},r(t,t.exports),t.exports}function e_(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var pd=Av;function Av(r,e){if(!r)throw new Error(e||"Assertion failed")}Av.equal=function(e,t,i){if(e!=t)throw new Error(i||"Assertion failed: "+e+" != "+t)};var En=Ra(function(r,e){var t=e;function i(a,f){if(Array.isArray(a))return a.slice();if(!a)return[];var h=[];if(typeof a!="string"){for(var u=0;u<a.length;u++)h[u]=a[u]|0;return h}if(f==="hex"){a=a.replace(/[^a-z0-9]+/ig,""),a.length%2!==0&&(a="0"+a);for(var u=0;u<a.length;u+=2)h.push(parseInt(a[u]+a[u+1],16))}else for(var u=0;u<a.length;u++){var g=a.charCodeAt(u),w=g>>8,M=g&255;w?h.push(w,M):h.push(M)}return h}t.toArray=i;function n(a){return a.length===1?"0"+a:a}t.zero2=n;function s(a){for(var f="",h=0;h<a.length;h++)f+=n(a[h].toString(16));return f}t.toHex=s,t.encode=function(f,h){return h==="hex"?s(f):f}}),Ti=Ra(function(r,e){var t=e;t.assert=pd,t.toArray=En.toArray,t.zero2=En.zero2,t.toHex=En.toHex,t.encode=En.encode;function i(h,u,g){var w=new Array(Math.max(h.bitLength(),g)+1);w.fill(0);for(var M=1<<u+1,P=h.clone(),O=0;O<w.length;O++){var $,q=P.andln(M-1);P.isOdd()?(q>(M>>1)-1?$=(M>>1)-q:$=q,P.isubn($)):$=0,w[O]=$,P.iushrn(1)}return w}t.getNAF=i;function n(h,u){var g=[[],[]];h=h.clone(),u=u.clone();for(var w=0,M=0,P;h.cmpn(-w)>0||u.cmpn(-M)>0;){var O=h.andln(3)+w&3,$=u.andln(3)+M&3;O===3&&(O=-1),$===3&&($=-1);var q;O&1?(P=h.andln(7)+w&7,(P===3||P===5)&&$===2?q=-O:q=O):q=0,g[0].push(q);var U;$&1?(P=u.andln(7)+M&7,(P===3||P===5)&&O===2?U=-$:U=$):U=0,g[1].push(U),2*w===q+1&&(w=1-w),2*M===U+1&&(M=1-M),h.iushrn(1),u.iushrn(1)}return g}t.getJSF=n;function s(h,u,g){var w="_"+u;h.prototype[u]=function(){return this[w]!==void 0?this[w]:this[w]=g.call(this)}}t.cachedProperty=s;function a(h){return typeof h=="string"?t.toArray(h,"hex"):h}t.parseBytes=a;function f(h){return new vt(h,"hex","le")}t.intFromLE=f}),ll=Ti.getNAF,t_=Ti.getJSF,hl=Ti.assert;function qs(r,e){this.type=r,this.p=new vt(e.p,16),this.red=e.prime?vt.red(e.prime):vt.mont(this.p),this.zero=new vt(0).toRed(this.red),this.one=new vt(1).toRed(this.red),this.two=new vt(2).toRed(this.red),this.n=e.n&&new vt(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Mo=qs;qs.prototype.point=function(){throw new Error("Not implemented")},qs.prototype.validate=function(){throw new Error("Not implemented")},qs.prototype._fixedNafMul=function(e,t){hl(e.precomputed);var i=e._getDoubles(),n=ll(t,1,this._bitLength),s=(1<<i.step+1)-(i.step%2===0?2:1);s/=3;var a=[],f,h;for(f=0;f<n.length;f+=i.step){h=0;for(var u=f+i.step-1;u>=f;u--)h=(h<<1)+n[u];a.push(h)}for(var g=this.jpoint(null,null,null),w=this.jpoint(null,null,null),M=s;M>0;M--){for(f=0;f<a.length;f++)h=a[f],h===M?w=w.mixedAdd(i.points[f]):h===-M&&(w=w.mixedAdd(i.points[f].neg()));g=g.add(w)}return g.toP()},qs.prototype._wnafMul=function(e,t){var i=4,n=e._getNAFPoints(i);i=n.wnd;for(var s=n.points,a=ll(t,i,this._bitLength),f=this.jpoint(null,null,null),h=a.length-1;h>=0;h--){for(var u=0;h>=0&&a[h]===0;h--)u++;if(h>=0&&u++,f=f.dblp(u),h<0)break;var g=a[h];hl(g!==0),e.type==="affine"?g>0?f=f.mixedAdd(s[g-1>>1]):f=f.mixedAdd(s[-g-1>>1].neg()):g>0?f=f.add(s[g-1>>1]):f=f.add(s[-g-1>>1].neg())}return e.type==="affine"?f.toP():f},qs.prototype._wnafMulAdd=function(e,t,i,n,s){var a=this._wnafT1,f=this._wnafT2,h=this._wnafT3,u=0,g,w,M;for(g=0;g<n;g++){M=t[g];var P=M._getNAFPoints(e);a[g]=P.wnd,f[g]=P.points}for(g=n-1;g>=1;g-=2){var O=g-1,$=g;if(a[O]!==1||a[$]!==1){h[O]=ll(i[O],a[O],this._bitLength),h[$]=ll(i[$],a[$],this._bitLength),u=Math.max(h[O].length,u),u=Math.max(h[$].length,u);continue}var q=[t[O],null,null,t[$]];t[O].y.cmp(t[$].y)===0?(q[1]=t[O].add(t[$]),q[2]=t[O].toJ().mixedAdd(t[$].neg())):t[O].y.cmp(t[$].y.redNeg())===0?(q[1]=t[O].toJ().mixedAdd(t[$]),q[2]=t[O].add(t[$].neg())):(q[1]=t[O].toJ().mixedAdd(t[$]),q[2]=t[O].toJ().mixedAdd(t[$].neg()));var U=[-3,-1,-5,-7,0,7,5,1,3],J=t_(i[O],i[$]);for(u=Math.max(J[0].length,u),h[O]=new Array(u),h[$]=new Array(u),w=0;w<u;w++){var ee=J[0][w]|0,W=J[1][w]|0;h[O][w]=U[(ee+1)*3+(W+1)],h[$][w]=0,f[O]=q}}var G=this.jpoint(null,null,null),Q=this._wnafT4;for(g=u;g>=0;g--){for(var A=0;g>=0;){var z=!0;for(w=0;w<n;w++)Q[w]=h[w][g]|0,Q[w]!==0&&(z=!1);if(!z)break;A++,g--}if(g>=0&&A++,G=G.dblp(A),g<0)break;for(w=0;w<n;w++){var te=Q[w];te!==0&&(te>0?M=f[w][te-1>>1]:te<0&&(M=f[w][-te-1>>1].neg()),M.type==="affine"?G=G.mixedAdd(M):G=G.add(M))}}for(g=0;g<n;g++)f[g]=null;return s?G:G.toP()};function Ji(r,e){this.curve=r,this.type=e,this.precomputed=null}qs.BasePoint=Ji,Ji.prototype.eq=function(){throw new Error("Not implemented")},Ji.prototype.validate=function(){return this.curve.validate(this)},qs.prototype.decodePoint=function(e,t){e=Ti.toArray(e,t);var i=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*i){e[0]===6?hl(e[e.length-1]%2===0):e[0]===7&&hl(e[e.length-1]%2===1);var n=this.point(e.slice(1,1+i),e.slice(1+i,1+2*i));return n}else if((e[0]===2||e[0]===3)&&e.length-1===i)return this.pointFromX(e.slice(1,1+i),e[0]===3);throw new Error("Unknown point format")},Ji.prototype.encodeCompressed=function(e){return this.encode(e,!0)},Ji.prototype._encode=function(e){var t=this.curve.p.byteLength(),i=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(i):[4].concat(i,this.getY().toArray("be",t))},Ji.prototype.encode=function(e,t){return Ti.encode(this._encode(t),e)},Ji.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},Ji.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((e.bitLength()+1)/t.step):!1},Ji.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],n=this,s=0;s<t;s+=e){for(var a=0;a<e;a++)n=n.dbl();i.push(n)}return{step:e,points:i}},Ji.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],i=(1<<e)-1,n=i===1?null:this.dbl(),s=1;s<i;s++)t[s]=t[s-1].add(n);return{wnd:e,points:t}},Ji.prototype._getBeta=function(){return null},Ji.prototype.dblp=function(e){for(var t=this,i=0;i<e;i++)t=t.dbl();return t};var gd=Ra(function(r){typeof Object.create=="function"?r.exports=function(t,i){i&&(t.super_=i,t.prototype=Object.create(i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:r.exports=function(t,i){if(i){t.super_=i;var n=function(){};n.prototype=i.prototype,t.prototype=new n,t.prototype.constructor=t}}}),r_=Ti.assert;function Yi(r){Mo.call(this,"short",r),this.a=new vt(r.a,16).toRed(this.red),this.b=new vt(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}gd(Yi,Mo);var i_=Yi;Yi.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,i;if(e.beta)t=new vt(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=n[0].cmp(n[1])<0?n[0]:n[1],t=t.toRed(this.red)}if(e.lambda)i=new vt(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(t))===0?i=s[0]:(i=s[1],r_(this.g.mul(i).x.cmp(this.g.x.redMul(t))===0))}var a;return e.basis?a=e.basis.map(function(f){return{a:new vt(f.a,16),b:new vt(f.b,16)}}):a=this._getEndoBasis(i),{beta:t,lambda:i,basis:a}}},Yi.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:vt.mont(e),i=new vt(2).toRed(t).redInvm(),n=i.redNeg(),s=new vt(3).toRed(t).redNeg().redSqrt().redMul(i),a=n.redAdd(s).fromRed(),f=n.redSub(s).fromRed();return[a,f]},Yi.prototype._getEndoBasis=function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),i=e,n=this.n.clone(),s=new vt(1),a=new vt(0),f=new vt(0),h=new vt(1),u,g,w,M,P,O,$,q=0,U,J;i.cmpn(0)!==0;){var ee=n.div(i);U=n.sub(ee.mul(i)),J=f.sub(ee.mul(s));var W=h.sub(ee.mul(a));if(!w&&U.cmp(t)<0)u=$.neg(),g=s,w=U.neg(),M=J;else if(w&&++q===2)break;$=U,n=i,i=U,f=s,s=J,h=a,a=W}P=U.neg(),O=J;var G=w.sqr().add(M.sqr()),Q=P.sqr().add(O.sqr());return Q.cmp(G)>=0&&(P=u,O=g),w.negative&&(w=w.neg(),M=M.neg()),P.negative&&(P=P.neg(),O=O.neg()),[{a:w,b:M},{a:P,b:O}]},Yi.prototype._endoSplit=function(e){var t=this.endo.basis,i=t[0],n=t[1],s=n.b.mul(e).divRound(this.n),a=i.b.neg().mul(e).divRound(this.n),f=s.mul(i.a),h=a.mul(n.a),u=s.mul(i.b),g=a.mul(n.b),w=e.sub(f).sub(h),M=u.add(g).neg();return{k1:w,k2:M}},Yi.prototype.pointFromX=function(e,t){e=new vt(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=i.redSqrt();if(n.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var s=n.fromRed().isOdd();return(t&&!s||!t&&s)&&(n=n.redNeg()),this.point(e,n)},Yi.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,i=e.y,n=this.a.redMul(t),s=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return i.redSqr().redISub(s).cmpn(0)===0},Yi.prototype._endoWnafMulAdd=function(e,t,i){for(var n=this._endoWnafT1,s=this._endoWnafT2,a=0;a<e.length;a++){var f=this._endoSplit(t[a]),h=e[a],u=h._getBeta();f.k1.negative&&(f.k1.ineg(),h=h.neg(!0)),f.k2.negative&&(f.k2.ineg(),u=u.neg(!0)),n[a*2]=h,n[a*2+1]=u,s[a*2]=f.k1,s[a*2+1]=f.k2}for(var g=this._wnafMulAdd(1,n,s,a*2,i),w=0;w<a*2;w++)n[w]=null,s[w]=null;return g};function Or(r,e,t,i){Mo.BasePoint.call(this,r,"affine"),e===null&&t===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new vt(e,16),this.y=new vt(t,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}gd(Or,Mo.BasePoint),Yi.prototype.point=function(e,t,i){return new Or(this,e,t,i)},Yi.prototype.pointFromJSON=function(e,t){return Or.fromJSON(this,e,t)},Or.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var i=this.curve,n=function(s){return i.point(s.x.redMul(i.endo.beta),s.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},Or.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Or.fromJSON=function(e,t,i){typeof t=="string"&&(t=JSON.parse(t));var n=e.point(t[0],t[1],i);if(!t[2])return n;function s(f){return e.point(f[0],f[1],i)}var a=t[2];return n.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[n].concat(a.doubles.points.map(s))},naf:a.naf&&{wnd:a.naf.wnd,points:[n].concat(a.naf.points.map(s))}},n},Or.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Or.prototype.isInfinity=function(){return this.inf},Or.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var i=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)},Or.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,i=this.x.redSqr(),n=e.redInvm(),s=i.redAdd(i).redIAdd(i).redIAdd(t).redMul(n),a=s.redSqr().redISub(this.x.redAdd(this.x)),f=s.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,f)},Or.prototype.getX=function(){return this.x.fromRed()},Or.prototype.getY=function(){return this.y.fromRed()},Or.prototype.mul=function(e){return e=new vt(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Or.prototype.mulAdd=function(e,t,i){var n=[this,t],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s):this.curve._wnafMulAdd(1,n,s,2)},Or.prototype.jmulAdd=function(e,t,i){var n=[this,t],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s,!0):this.curve._wnafMulAdd(1,n,s,2,!0)},Or.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Or.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,n=function(s){return s.neg()};t.precomputed={naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(n)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(n)}}}return t},Or.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Hr(r,e,t,i){Mo.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new vt(0)):(this.x=new vt(e,16),this.y=new vt(t,16),this.z=new vt(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}gd(Hr,Mo.BasePoint),Yi.prototype.jpoint=function(e,t,i){return new Hr(this,e,t,i)},Hr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),i=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(i,n)},Hr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Hr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),i=this.z.redSqr(),n=this.x.redMul(t),s=e.x.redMul(i),a=this.y.redMul(t.redMul(e.z)),f=e.y.redMul(i.redMul(this.z)),h=n.redSub(s),u=a.redSub(f);if(h.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var g=h.redSqr(),w=g.redMul(h),M=n.redMul(g),P=u.redSqr().redIAdd(w).redISub(M).redISub(M),O=u.redMul(M.redISub(P)).redISub(a.redMul(w)),$=this.z.redMul(e.z).redMul(h);return this.curve.jpoint(P,O,$)},Hr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),i=this.x,n=e.x.redMul(t),s=this.y,a=e.y.redMul(t).redMul(this.z),f=i.redSub(n),h=s.redSub(a);if(f.cmpn(0)===0)return h.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=f.redSqr(),g=u.redMul(f),w=i.redMul(u),M=h.redSqr().redIAdd(g).redISub(w).redISub(w),P=h.redMul(w.redISub(M)).redISub(s.redMul(g)),O=this.z.redMul(f);return this.curve.jpoint(M,P,O)},Hr.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var i=this;for(t=0;t<e;t++)i=i.dbl();return i}var n=this.curve.a,s=this.curve.tinv,a=this.x,f=this.y,h=this.z,u=h.redSqr().redSqr(),g=f.redAdd(f);for(t=0;t<e;t++){var w=a.redSqr(),M=g.redSqr(),P=M.redSqr(),O=w.redAdd(w).redIAdd(w).redIAdd(n.redMul(u)),$=a.redMul(M),q=O.redSqr().redISub($.redAdd($)),U=$.redISub(q),J=O.redMul(U);J=J.redIAdd(J).redISub(P);var ee=g.redMul(h);t+1<e&&(u=u.redMul(P)),a=q,h=ee,g=J}return this.curve.jpoint(a,g.redMul(s),h)},Hr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},Hr.prototype._zeroDbl=function(){var e,t,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),f=this.x.redAdd(s).redSqr().redISub(n).redISub(a);f=f.redIAdd(f);var h=n.redAdd(n).redIAdd(n),u=h.redSqr().redISub(f).redISub(f),g=a.redIAdd(a);g=g.redIAdd(g),g=g.redIAdd(g),e=u,t=h.redMul(f.redISub(u)).redISub(g),i=this.y.redAdd(this.y)}else{var w=this.x.redSqr(),M=this.y.redSqr(),P=M.redSqr(),O=this.x.redAdd(M).redSqr().redISub(w).redISub(P);O=O.redIAdd(O);var $=w.redAdd(w).redIAdd(w),q=$.redSqr(),U=P.redIAdd(P);U=U.redIAdd(U),U=U.redIAdd(U),e=q.redISub(O).redISub(O),t=$.redMul(O.redISub(e)).redISub(U),i=this.y.redMul(this.z),i=i.redIAdd(i)}return this.curve.jpoint(e,t,i)},Hr.prototype._threeDbl=function(){var e,t,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),f=this.x.redAdd(s).redSqr().redISub(n).redISub(a);f=f.redIAdd(f);var h=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=h.redSqr().redISub(f).redISub(f);e=u;var g=a.redIAdd(a);g=g.redIAdd(g),g=g.redIAdd(g),t=h.redMul(f.redISub(u)).redISub(g),i=this.y.redAdd(this.y)}else{var w=this.z.redSqr(),M=this.y.redSqr(),P=this.x.redMul(M),O=this.x.redSub(w).redMul(this.x.redAdd(w));O=O.redAdd(O).redIAdd(O);var $=P.redIAdd(P);$=$.redIAdd($);var q=$.redAdd($);e=O.redSqr().redISub(q),i=this.y.redAdd(this.z).redSqr().redISub(M).redISub(w);var U=M.redSqr();U=U.redIAdd(U),U=U.redIAdd(U),U=U.redIAdd(U),t=O.redMul($.redISub(e)).redISub(U)}return this.curve.jpoint(e,t,i)},Hr.prototype._dbl=function(){var e=this.curve.a,t=this.x,i=this.y,n=this.z,s=n.redSqr().redSqr(),a=t.redSqr(),f=i.redSqr(),h=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(s)),u=t.redAdd(t);u=u.redIAdd(u);var g=u.redMul(f),w=h.redSqr().redISub(g.redAdd(g)),M=g.redISub(w),P=f.redSqr();P=P.redIAdd(P),P=P.redIAdd(P),P=P.redIAdd(P);var O=h.redMul(M).redISub(P),$=i.redAdd(i).redMul(n);return this.curve.jpoint(w,O,$)},Hr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),i=this.z.redSqr(),n=t.redSqr(),s=e.redAdd(e).redIAdd(e),a=s.redSqr(),f=this.x.redAdd(t).redSqr().redISub(e).redISub(n);f=f.redIAdd(f),f=f.redAdd(f).redIAdd(f),f=f.redISub(a);var h=f.redSqr(),u=n.redIAdd(n);u=u.redIAdd(u),u=u.redIAdd(u),u=u.redIAdd(u);var g=s.redIAdd(f).redSqr().redISub(a).redISub(h).redISub(u),w=t.redMul(g);w=w.redIAdd(w),w=w.redIAdd(w);var M=this.x.redMul(h).redISub(w);M=M.redIAdd(M),M=M.redIAdd(M);var P=this.y.redMul(g.redMul(u.redISub(g)).redISub(f.redMul(h)));P=P.redIAdd(P),P=P.redIAdd(P),P=P.redIAdd(P);var O=this.z.redAdd(f).redSqr().redISub(i).redISub(h);return this.curve.jpoint(M,P,O)},Hr.prototype.mul=function(e,t){return e=new vt(e,t),this.curve._wnafMul(this,e)},Hr.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),i=e.z.redSqr();if(this.x.redMul(i).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var n=t.redMul(this.z),s=i.redMul(e.z);return this.y.redMul(s).redISub(e.y.redMul(n)).cmpn(0)===0},Hr.prototype.eqXToP=function(e){var t=this.z.redSqr(),i=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(i)===0)return!0;for(var n=e.clone(),s=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(i.redIAdd(s),this.x.cmp(i)===0)return!0}},Hr.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},Hr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var ul=Ra(function(r,e){var t=e;t.base=Mo,t.short=i_,t.mont=null,t.edwards=null}),dl=Ra(function(r,e){var t=e,i=Ti.assert;function n(f){f.type==="short"?this.curve=new ul.short(f):f.type==="edwards"?this.curve=new ul.edwards(f):this.curve=new ul.mont(f),this.g=this.curve.g,this.n=this.curve.n,this.hash=f.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}t.PresetCurve=n;function s(f,h){Object.defineProperty(t,f,{configurable:!0,enumerable:!0,get:function(){var u=new n(h);return Object.defineProperty(t,f,{configurable:!0,enumerable:!0,value:u}),u}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Ri.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Ri.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Ri.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Ri.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Ri.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ri.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ri.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var a;try{a=null.crash()}catch{a=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Ri.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})});function zs(r){if(!(this instanceof zs))return new zs(r);this.hash=r.hash,this.predResist=!!r.predResist,this.outLen=this.hash.outSize,this.minEntropy=r.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=En.toArray(r.entropy,r.entropyEnc||"hex"),t=En.toArray(r.nonce,r.nonceEnc||"hex"),i=En.toArray(r.pers,r.persEnc||"hex");pd(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,i)}var Sv=zs;zs.prototype._init=function(e,t,i){var n=e.concat(t).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},zs.prototype._hmac=function(){return new Ri.hmac(this.hash,this.K)},zs.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},zs.prototype.reseed=function(e,t,i,n){typeof t!="string"&&(n=i,i=t,t=null),e=En.toArray(e,t),i=En.toArray(i,n),pd(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this._reseed=1},zs.prototype.generate=function(e,t,i,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(n=i,i=t,t=null),i&&(i=En.toArray(i,n||"hex"),this._update(i));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var a=s.slice(0,e);return this._update(i),this._reseed++,En.encode(a,t)};var vd=Ti.assert;function Gr(r,e){this.ec=r,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var md=Gr;Gr.fromPublic=function(e,t,i){return t instanceof Gr?t:new Gr(e,{pub:t,pubEnc:i})},Gr.fromPrivate=function(e,t,i){return t instanceof Gr?t:new Gr(e,{priv:t,privEnc:i})},Gr.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},Gr.prototype.getPublic=function(e,t){return typeof e=="string"&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},Gr.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv},Gr.prototype._importPrivate=function(e,t){this.priv=new vt(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},Gr.prototype._importPublic=function(e,t){if(e.x||e.y){this.ec.curve.type==="mont"?vd(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&vd(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)},Gr.prototype.derive=function(e){return e.validate()||vd(e.validate(),"public point not validated"),e.mul(this.priv).getX()},Gr.prototype.sign=function(e,t,i){return this.ec.sign(e,this,t,i)},Gr.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},Gr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var n_=Ti.assert;function pl(r,e){if(r instanceof pl)return r;this._importDER(r,e)||(n_(r.r&&r.s,"Signature without r or s"),this.r=new vt(r.r,16),this.s=new vt(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}var gl=pl;function s_(){this.place=0}function bd(r,e){var t=r[e.place++];if(!(t&128))return t;var i=t&15;if(i===0||i>4)return!1;for(var n=0,s=0,a=e.place;s<i;s++,a++)n<<=8,n|=r[a],n>>>=0;return n<=127?!1:(e.place=a,n)}function Iv(r){for(var e=0,t=r.length-1;!r[e]&&!(r[e+1]&128)&&e<t;)e++;return e===0?r:r.slice(e)}pl.prototype._importDER=function(e,t){e=Ti.toArray(e,t);var i=new s_;if(e[i.place++]!==48)return!1;var n=bd(e,i);if(n===!1||n+i.place!==e.length||e[i.place++]!==2)return!1;var s=bd(e,i);if(s===!1)return!1;var a=e.slice(i.place,s+i.place);if(i.place+=s,e[i.place++]!==2)return!1;var f=bd(e,i);if(f===!1||e.length!==f+i.place)return!1;var h=e.slice(i.place,f+i.place);if(a[0]===0)if(a[1]&128)a=a.slice(1);else return!1;if(h[0]===0)if(h[1]&128)h=h.slice(1);else return!1;return this.r=new vt(a),this.s=new vt(h),this.recoveryParam=null,!0};function wd(r,e){if(e<128){r.push(e);return}var t=1+(Math.log(e)/Math.LN2>>>3);for(r.push(t|128);--t;)r.push(e>>>(t<<3)&255);r.push(e)}pl.prototype.toDER=function(e){var t=this.r.toArray(),i=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),i[0]&128&&(i=[0].concat(i)),t=Iv(t),i=Iv(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var n=[2];wd(n,t.length),n=n.concat(t),n.push(2),wd(n,i.length);var s=n.concat(i),a=[48];return wd(a,s.length),a=a.concat(s),Ti.encode(a,e)};var o_=function(){throw new Error("unsupported")},Mv=Ti.assert;function Qi(r){if(!(this instanceof Qi))return new Qi(r);typeof r=="string"&&(Mv(Object.prototype.hasOwnProperty.call(dl,r),"Unknown curve "+r),r=dl[r]),r instanceof dl.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}var a_=Qi;Qi.prototype.keyPair=function(e){return new md(this,e)},Qi.prototype.keyFromPrivate=function(e,t){return md.fromPrivate(this,e,t)},Qi.prototype.keyFromPublic=function(e,t){return md.fromPublic(this,e,t)},Qi.prototype.genKeyPair=function(e){e||(e={});for(var t=new Sv({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||o_(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),n=this.n.sub(new vt(2));;){var s=new vt(t.generate(i));if(!(s.cmp(n)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Qi.prototype._truncateToN=function(e,t){var i=e.byteLength()*8-this.n.bitLength();return i>0&&(e=e.ushrn(i)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},Qi.prototype.sign=function(e,t,i,n){typeof i=="object"&&(n=i,i=null),n||(n={}),t=this.keyFromPrivate(t,i),e=this._truncateToN(new vt(e,16));for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),f=e.toArray("be",s),h=new Sv({hash:this.hash,entropy:a,nonce:f,pers:n.pers,persEnc:n.persEnc||"utf8"}),u=this.n.sub(new vt(1)),g=0;;g++){var w=n.k?n.k(g):new vt(h.generate(this.n.byteLength()));if(w=this._truncateToN(w,!0),!(w.cmpn(1)<=0||w.cmp(u)>=0)){var M=this.g.mul(w);if(!M.isInfinity()){var P=M.getX(),O=P.umod(this.n);if(O.cmpn(0)!==0){var $=w.invm(this.n).mul(O.mul(t.getPrivate()).iadd(e));if($=$.umod(this.n),$.cmpn(0)!==0){var q=(M.getY().isOdd()?1:0)|(P.cmp(O)!==0?2:0);return n.canonical&&$.cmp(this.nh)>0&&($=this.n.sub($),q^=1),new gl({r:O,s:$,recoveryParam:q})}}}}}},Qi.prototype.verify=function(e,t,i,n){e=this._truncateToN(new vt(e,16)),i=this.keyFromPublic(i,n),t=new gl(t,"hex");var s=t.r,a=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var f=a.invm(this.n),h=f.mul(e).umod(this.n),u=f.mul(s).umod(this.n),g;return this.curve._maxwellTrick?(g=this.g.jmulAdd(h,i.getPublic(),u),g.isInfinity()?!1:g.eqXToP(s)):(g=this.g.mulAdd(h,i.getPublic(),u),g.isInfinity()?!1:g.getX().umod(this.n).cmp(s)===0)},Qi.prototype.recoverPubKey=function(r,e,t,i){Mv((3&t)===t,"The recovery param is more than two bits"),e=new gl(e,i);var n=this.n,s=new vt(r),a=e.r,f=e.s,h=t&1,u=t>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?a=this.curve.pointFromX(a.add(this.curve.n),h):a=this.curve.pointFromX(a,h);var g=e.r.invm(n),w=n.sub(s).mul(g).umod(n),M=f.mul(g).umod(n);return this.g.mulAdd(w,a,M)},Qi.prototype.getKeyRecoveryParam=function(r,e,t,i){if(e=new gl(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(r,e,n)}catch{continue}if(s.eq(t))return n}throw new Error("Unable to find valid recovery factor")};var c_=Ra(function(r,e){var t=e;t.version="6.5.4",t.utils=Ti,t.rand=function(){throw new Error("unsupported")},t.curve=ul,t.curves=dl,t.ec=a_,t.eddsa=null}),f_=c_.ec;const l_="signing-key/5.7.0",yd=new xt(l_);let _d=null;function Gn(){return _d||(_d=new f_("secp256k1")),_d}class h_{constructor(e){Lc(this,"curve","secp256k1"),Lc(this,"privateKey",ni(e)),G5(this.privateKey)!==32&&yd.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=Gn().keyFromPrivate(ur(this.privateKey));Lc(this,"publicKey","0x"+t.getPublic(!1,"hex")),Lc(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Lc(this,"_isSigningKey",!0)}_addPoint(e){const t=Gn().keyFromPublic(ur(this.publicKey)),i=Gn().keyFromPublic(ur(e));return"0x"+t.pub.add(i.pub).encodeCompressed("hex")}signDigest(e){const t=Gn().keyFromPrivate(ur(this.privateKey)),i=ur(e);i.length!==32&&yd.throwArgumentError("bad digest length","digest",e);const n=t.sign(i,{canonical:!0});return Bg({recoveryParam:n.recoveryParam,r:qn("0x"+n.r.toString(16),32),s:qn("0x"+n.s.toString(16),32)})}computeSharedSecret(e){const t=Gn().keyFromPrivate(ur(this.privateKey)),i=Gn().keyFromPublic(ur(Cv(e)));return qn("0x"+t.derive(i.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function u_(r,e){const t=Bg(e),i={r:ur(t.r),s:ur(t.s)};return"0x"+Gn().recoverPubKey(ur(r),i,t.recoveryParam).encode("hex",!1)}function Cv(r,e){const t=ur(r);if(t.length===32){const i=new h_(t);return e?"0x"+Gn().keyFromPrivate(t).getPublic(!0,"hex"):i.publicKey}else{if(t.length===33)return e?ni(t):"0x"+Gn().keyFromPublic(t).getPublic(!1,"hex");if(t.length===65)return e?"0x"+Gn().keyFromPublic(t).getPublic(!0,"hex"):ni(t)}return yd.throwArgumentError("invalid public or private key","key","[REDACTED]")}const d_="transactions/5.7.0";new xt(d_);var Pv;(function(r){r[r.legacy=0]="legacy",r[r.eip2930=1]="eip2930",r[r.eip1559=2]="eip1559"})(Pv||(Pv={}));function p_(r){const e=Cv(r);return A4(Lg(rd(Lg(e,1)),12))}function g_(r,e){return p_(u_(ur(r),e))}var xd={},vl={},yt={},Dv={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});function e(f,h){var u=f>>>16&65535,g=f&65535,w=h>>>16&65535,M=h&65535;return g*M+(u*M+g*w<<16>>>0)|0}r.mul=Math.imul||e;function t(f,h){return f+h|0}r.add=t;function i(f,h){return f-h|0}r.sub=i;function n(f,h){return f<<h|f>>>32-h}r.rotl=n;function s(f,h){return f<<32-h|f>>>h}r.rotr=s;function a(f){return typeof f=="number"&&isFinite(f)&&Math.floor(f)===f}r.isInteger=Number.isInteger||a,r.MAX_SAFE_INTEGER=9007199254740991,r.isSafeInteger=function(f){return r.isInteger(f)&&f>=-r.MAX_SAFE_INTEGER&&f<=r.MAX_SAFE_INTEGER}})(Dv),Object.defineProperty(yt,"__esModule",{value:!0});var Ov=Dv;function v_(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])<<16>>16}yt.readInt16BE=v_;function m_(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])>>>0}yt.readUint16BE=m_;function b_(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])<<16>>16}yt.readInt16LE=b_;function w_(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])>>>0}yt.readUint16LE=w_;function Rv(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>8,e[t+1]=r>>>0,e}yt.writeUint16BE=Rv,yt.writeInt16BE=Rv;function Tv(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e}yt.writeUint16LE=Tv,yt.writeInt16LE=Tv;function Ed(r,e){return e===void 0&&(e=0),r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}yt.readInt32BE=Ed;function Ad(r,e){return e===void 0&&(e=0),(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}yt.readUint32BE=Ad;function Sd(r,e){return e===void 0&&(e=0),r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e]}yt.readInt32LE=Sd;function Id(r,e){return e===void 0&&(e=0),(r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e])>>>0}yt.readUint32LE=Id;function ml(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>24,e[t+1]=r>>>16,e[t+2]=r>>>8,e[t+3]=r>>>0,e}yt.writeUint32BE=ml,yt.writeInt32BE=ml;function bl(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e[t+2]=r>>>16,e[t+3]=r>>>24,e}yt.writeUint32LE=bl,yt.writeInt32LE=bl;function y_(r,e){e===void 0&&(e=0);var t=Ed(r,e),i=Ed(r,e+4);return t*4294967296+i-(i>>31)*4294967296}yt.readInt64BE=y_;function __(r,e){e===void 0&&(e=0);var t=Ad(r,e),i=Ad(r,e+4);return t*4294967296+i}yt.readUint64BE=__;function x_(r,e){e===void 0&&(e=0);var t=Sd(r,e),i=Sd(r,e+4);return i*4294967296+t-(t>>31)*4294967296}yt.readInt64LE=x_;function E_(r,e){e===void 0&&(e=0);var t=Id(r,e),i=Id(r,e+4);return i*4294967296+t}yt.readUint64LE=E_;function Nv(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),ml(r/4294967296>>>0,e,t),ml(r>>>0,e,t+4),e}yt.writeUint64BE=Nv,yt.writeInt64BE=Nv;function $v(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),bl(r>>>0,e,t),bl(r/4294967296>>>0,e,t+4),e}yt.writeUint64LE=$v,yt.writeInt64LE=$v;function A_(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,n=1,s=r/8+t-1;s>=t;s--)i+=e[s]*n,n*=256;return i}yt.readUintBE=A_;function S_(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,n=1,s=t;s<t+r/8;s++)i+=e[s]*n,n*=256;return i}yt.readUintLE=S_;function I_(r,e,t,i){if(t===void 0&&(t=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!Ov.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var n=1,s=r/8+i-1;s>=i;s--)t[s]=e/n&255,n*=256;return t}yt.writeUintBE=I_;function M_(r,e,t,i){if(t===void 0&&(t=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Ov.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var n=1,s=i;s<i+r/8;s++)t[s]=e/n&255,n*=256;return t}yt.writeUintLE=M_;function C_(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e)}yt.readFloat32BE=C_;function P_(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e,!0)}yt.readFloat32LE=P_;function D_(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e)}yt.readFloat64BE=D_;function O_(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e,!0)}yt.readFloat64LE=O_;function R_(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(t,r),e}yt.writeFloat32BE=R_;function T_(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(t,r,!0),e}yt.writeFloat32LE=T_;function N_(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(t,r),e}yt.writeFloat64BE=N_;function $_(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(t,r,!0),e}yt.writeFloat64LE=$_;var Ni={};Object.defineProperty(Ni,"__esModule",{value:!0});function L_(r){for(var e=0;e<r.length;e++)r[e]=0;return r}Ni.wipe=L_,Object.defineProperty(vl,"__esModule",{value:!0});var Jr=yt,Md=Ni,B_=20;function U_(r,e,t){for(var i=1634760805,n=857760878,s=2036477234,a=1797285236,f=t[3]<<24|t[2]<<16|t[1]<<8|t[0],h=t[7]<<24|t[6]<<16|t[5]<<8|t[4],u=t[11]<<24|t[10]<<16|t[9]<<8|t[8],g=t[15]<<24|t[14]<<16|t[13]<<8|t[12],w=t[19]<<24|t[18]<<16|t[17]<<8|t[16],M=t[23]<<24|t[22]<<16|t[21]<<8|t[20],P=t[27]<<24|t[26]<<16|t[25]<<8|t[24],O=t[31]<<24|t[30]<<16|t[29]<<8|t[28],$=e[3]<<24|e[2]<<16|e[1]<<8|e[0],q=e[7]<<24|e[6]<<16|e[5]<<8|e[4],U=e[11]<<24|e[10]<<16|e[9]<<8|e[8],J=e[15]<<24|e[14]<<16|e[13]<<8|e[12],ee=i,W=n,G=s,Q=a,A=f,z=h,te=u,ae=g,L=w,b=M,m=P,l=O,d=$,y=q,C=U,D=J,S=0;S<B_;S+=2)ee=ee+A|0,d^=ee,d=d>>>32-16|d<<16,L=L+d|0,A^=L,A=A>>>32-12|A<<12,W=W+z|0,y^=W,y=y>>>32-16|y<<16,b=b+y|0,z^=b,z=z>>>32-12|z<<12,G=G+te|0,C^=G,C=C>>>32-16|C<<16,m=m+C|0,te^=m,te=te>>>32-12|te<<12,Q=Q+ae|0,D^=Q,D=D>>>32-16|D<<16,l=l+D|0,ae^=l,ae=ae>>>32-12|ae<<12,G=G+te|0,C^=G,C=C>>>32-8|C<<8,m=m+C|0,te^=m,te=te>>>32-7|te<<7,Q=Q+ae|0,D^=Q,D=D>>>32-8|D<<8,l=l+D|0,ae^=l,ae=ae>>>32-7|ae<<7,W=W+z|0,y^=W,y=y>>>32-8|y<<8,b=b+y|0,z^=b,z=z>>>32-7|z<<7,ee=ee+A|0,d^=ee,d=d>>>32-8|d<<8,L=L+d|0,A^=L,A=A>>>32-7|A<<7,ee=ee+z|0,D^=ee,D=D>>>32-16|D<<16,m=m+D|0,z^=m,z=z>>>32-12|z<<12,W=W+te|0,d^=W,d=d>>>32-16|d<<16,l=l+d|0,te^=l,te=te>>>32-12|te<<12,G=G+ae|0,y^=G,y=y>>>32-16|y<<16,L=L+y|0,ae^=L,ae=ae>>>32-12|ae<<12,Q=Q+A|0,C^=Q,C=C>>>32-16|C<<16,b=b+C|0,A^=b,A=A>>>32-12|A<<12,G=G+ae|0,y^=G,y=y>>>32-8|y<<8,L=L+y|0,ae^=L,ae=ae>>>32-7|ae<<7,Q=Q+A|0,C^=Q,C=C>>>32-8|C<<8,b=b+C|0,A^=b,A=A>>>32-7|A<<7,W=W+te|0,d^=W,d=d>>>32-8|d<<8,l=l+d|0,te^=l,te=te>>>32-7|te<<7,ee=ee+z|0,D^=ee,D=D>>>32-8|D<<8,m=m+D|0,z^=m,z=z>>>32-7|z<<7;Jr.writeUint32LE(ee+i|0,r,0),Jr.writeUint32LE(W+n|0,r,4),Jr.writeUint32LE(G+s|0,r,8),Jr.writeUint32LE(Q+a|0,r,12),Jr.writeUint32LE(A+f|0,r,16),Jr.writeUint32LE(z+h|0,r,20),Jr.writeUint32LE(te+u|0,r,24),Jr.writeUint32LE(ae+g|0,r,28),Jr.writeUint32LE(L+w|0,r,32),Jr.writeUint32LE(b+M|0,r,36),Jr.writeUint32LE(m+P|0,r,40),Jr.writeUint32LE(l+O|0,r,44),Jr.writeUint32LE(d+$|0,r,48),Jr.writeUint32LE(y+q|0,r,52),Jr.writeUint32LE(C+U|0,r,56),Jr.writeUint32LE(D+J|0,r,60)}function Lv(r,e,t,i,n){if(n===void 0&&(n=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length<t.length)throw new Error("ChaCha: destination is shorter than source");var s,a;if(n===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");s=new Uint8Array(16),a=s.length-e.length,s.set(e,a)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");s=e,a=n}for(var f=new Uint8Array(64),h=0;h<t.length;h+=64){U_(f,s,r);for(var u=h;u<h+64&&u<t.length;u++)i[u]=t[u]^f[u-h];q_(s,0,a)}return Md.wipe(f),n===0&&Md.wipe(s),i}vl.streamXOR=Lv;function F_(r,e,t,i){return i===void 0&&(i=0),Md.wipe(t),Lv(r,e,t,t,i)}vl.stream=F_;function q_(r,e,t){for(var i=1;t--;)i=i+(r[e]&255)|0,r[e]=i&255,i>>>=8,e++;if(i>0)throw new Error("ChaCha: counter overflow")}var Bv={},ks={};Object.defineProperty(ks,"__esModule",{value:!0});function z_(r,e,t){return~(r-1)&e|r-1&t}ks.select=z_;function k_(r,e){return(r|0)-(e|0)-1>>>31&1}ks.lessOrEqual=k_;function Uv(r,e){if(r.length!==e.length)return 0;for(var t=0,i=0;i<r.length;i++)t|=r[i]^e[i];return 1&t-1>>>8}ks.compare=Uv;function H_(r,e){return r.length===0||e.length===0?!1:Uv(r,e)!==0}ks.equal=H_,function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=ks,t=Ni;r.DIGEST_LENGTH=16;var i=function(){function a(f){this.digestLength=r.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var h=f[0]|f[1]<<8;this._r[0]=h&8191;var u=f[2]|f[3]<<8;this._r[1]=(h>>>13|u<<3)&8191;var g=f[4]|f[5]<<8;this._r[2]=(u>>>10|g<<6)&7939;var w=f[6]|f[7]<<8;this._r[3]=(g>>>7|w<<9)&8191;var M=f[8]|f[9]<<8;this._r[4]=(w>>>4|M<<12)&255,this._r[5]=M>>>1&8190;var P=f[10]|f[11]<<8;this._r[6]=(M>>>14|P<<2)&8191;var O=f[12]|f[13]<<8;this._r[7]=(P>>>11|O<<5)&8065;var $=f[14]|f[15]<<8;this._r[8]=(O>>>8|$<<8)&8191,this._r[9]=$>>>5&127,this._pad[0]=f[16]|f[17]<<8,this._pad[1]=f[18]|f[19]<<8,this._pad[2]=f[20]|f[21]<<8,this._pad[3]=f[22]|f[23]<<8,this._pad[4]=f[24]|f[25]<<8,this._pad[5]=f[26]|f[27]<<8,this._pad[6]=f[28]|f[29]<<8,this._pad[7]=f[30]|f[31]<<8}return a.prototype._blocks=function(f,h,u){for(var g=this._fin?0:2048,w=this._h[0],M=this._h[1],P=this._h[2],O=this._h[3],$=this._h[4],q=this._h[5],U=this._h[6],J=this._h[7],ee=this._h[8],W=this._h[9],G=this._r[0],Q=this._r[1],A=this._r[2],z=this._r[3],te=this._r[4],ae=this._r[5],L=this._r[6],b=this._r[7],m=this._r[8],l=this._r[9];u>=16;){var d=f[h+0]|f[h+1]<<8;w+=d&8191;var y=f[h+2]|f[h+3]<<8;M+=(d>>>13|y<<3)&8191;var C=f[h+4]|f[h+5]<<8;P+=(y>>>10|C<<6)&8191;var D=f[h+6]|f[h+7]<<8;O+=(C>>>7|D<<9)&8191;var S=f[h+8]|f[h+9]<<8;$+=(D>>>4|S<<12)&8191,q+=S>>>1&8191;var v=f[h+10]|f[h+11]<<8;U+=(S>>>14|v<<2)&8191;var x=f[h+12]|f[h+13]<<8;J+=(v>>>11|x<<5)&8191;var _=f[h+14]|f[h+15]<<8;ee+=(x>>>8|_<<8)&8191,W+=_>>>5|g;var N=0,oe=N;oe+=w*G,oe+=M*(5*l),oe+=P*(5*m),oe+=O*(5*b),oe+=$*(5*L),N=oe>>>13,oe&=8191,oe+=q*(5*ae),oe+=U*(5*te),oe+=J*(5*z),oe+=ee*(5*A),oe+=W*(5*Q),N+=oe>>>13,oe&=8191;var R=N;R+=w*Q,R+=M*G,R+=P*(5*l),R+=O*(5*m),R+=$*(5*b),N=R>>>13,R&=8191,R+=q*(5*L),R+=U*(5*ae),R+=J*(5*te),R+=ee*(5*z),R+=W*(5*A),N+=R>>>13,R&=8191;var Z=N;Z+=w*A,Z+=M*Q,Z+=P*G,Z+=O*(5*l),Z+=$*(5*m),N=Z>>>13,Z&=8191,Z+=q*(5*b),Z+=U*(5*L),Z+=J*(5*ae),Z+=ee*(5*te),Z+=W*(5*z),N+=Z>>>13,Z&=8191;var H=N;H+=w*z,H+=M*A,H+=P*Q,H+=O*G,H+=$*(5*l),N=H>>>13,H&=8191,H+=q*(5*m),H+=U*(5*b),H+=J*(5*L),H+=ee*(5*ae),H+=W*(5*te),N+=H>>>13,H&=8191;var K=N;K+=w*te,K+=M*z,K+=P*A,K+=O*Q,K+=$*G,N=K>>>13,K&=8191,K+=q*(5*l),K+=U*(5*m),K+=J*(5*b),K+=ee*(5*L),K+=W*(5*ae),N+=K>>>13,K&=8191;var k=N;k+=w*ae,k+=M*te,k+=P*z,k+=O*A,k+=$*Q,N=k>>>13,k&=8191,k+=q*G,k+=U*(5*l),k+=J*(5*m),k+=ee*(5*b),k+=W*(5*L),N+=k>>>13,k&=8191;var E=N;E+=w*L,E+=M*ae,E+=P*te,E+=O*z,E+=$*A,N=E>>>13,E&=8191,E+=q*Q,E+=U*G,E+=J*(5*l),E+=ee*(5*m),E+=W*(5*b),N+=E>>>13,E&=8191;var j=N;j+=w*b,j+=M*L,j+=P*ae,j+=O*te,j+=$*z,N=j>>>13,j&=8191,j+=q*A,j+=U*Q,j+=J*G,j+=ee*(5*l),j+=W*(5*m),N+=j>>>13,j&=8191;var re=N;re+=w*m,re+=M*b,re+=P*L,re+=O*ae,re+=$*te,N=re>>>13,re&=8191,re+=q*z,re+=U*A,re+=J*Q,re+=ee*G,re+=W*(5*l),N+=re>>>13,re&=8191;var le=N;le+=w*l,le+=M*m,le+=P*b,le+=O*L,le+=$*ae,N=le>>>13,le&=8191,le+=q*te,le+=U*z,le+=J*A,le+=ee*Q,le+=W*G,N+=le>>>13,le&=8191,N=(N<<2)+N|0,N=N+oe|0,oe=N&8191,N=N>>>13,R+=N,w=oe,M=R,P=Z,O=H,$=K,q=k,U=E,J=j,ee=re,W=le,h+=16,u-=16}this._h[0]=w,this._h[1]=M,this._h[2]=P,this._h[3]=O,this._h[4]=$,this._h[5]=q,this._h[6]=U,this._h[7]=J,this._h[8]=ee,this._h[9]=W},a.prototype.finish=function(f,h){h===void 0&&(h=0);var u=new Uint16Array(10),g,w,M,P;if(this._leftover){for(P=this._leftover,this._buffer[P++]=1;P<16;P++)this._buffer[P]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(g=this._h[1]>>>13,this._h[1]&=8191,P=2;P<10;P++)this._h[P]+=g,g=this._h[P]>>>13,this._h[P]&=8191;for(this._h[0]+=g*5,g=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=g,g=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=g,u[0]=this._h[0]+5,g=u[0]>>>13,u[0]&=8191,P=1;P<10;P++)u[P]=this._h[P]+g,g=u[P]>>>13,u[P]&=8191;for(u[9]-=8192,w=(g^1)-1,P=0;P<10;P++)u[P]&=w;for(w=~w,P=0;P<10;P++)this._h[P]=this._h[P]&w|u[P];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,M=this._h[0]+this._pad[0],this._h[0]=M&65535,P=1;P<8;P++)M=(this._h[P]+this._pad[P]|0)+(M>>>16)|0,this._h[P]=M&65535;return f[h+0]=this._h[0]>>>0,f[h+1]=this._h[0]>>>8,f[h+2]=this._h[1]>>>0,f[h+3]=this._h[1]>>>8,f[h+4]=this._h[2]>>>0,f[h+5]=this._h[2]>>>8,f[h+6]=this._h[3]>>>0,f[h+7]=this._h[3]>>>8,f[h+8]=this._h[4]>>>0,f[h+9]=this._h[4]>>>8,f[h+10]=this._h[5]>>>0,f[h+11]=this._h[5]>>>8,f[h+12]=this._h[6]>>>0,f[h+13]=this._h[6]>>>8,f[h+14]=this._h[7]>>>0,f[h+15]=this._h[7]>>>8,this._finished=!0,this},a.prototype.update=function(f){var h=0,u=f.length,g;if(this._leftover){g=16-this._leftover,g>u&&(g=u);for(var w=0;w<g;w++)this._buffer[this._leftover+w]=f[h+w];if(u-=g,h+=g,this._leftover+=g,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(u>=16&&(g=u-u%16,this._blocks(f,h,g),h+=g,u-=g),u){for(var w=0;w<u;w++)this._buffer[this._leftover+w]=f[h+w];this._leftover+=u}return this},a.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var f=new Uint8Array(16);return this.finish(f),f},a.prototype.clean=function(){return t.wipe(this._buffer),t.wipe(this._r),t.wipe(this._h),t.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},a}();r.Poly1305=i;function n(a,f){var h=new i(a);h.update(f);var u=h.digest();return h.clean(),u}r.oneTimeAuth=n;function s(a,f){return a.length!==r.DIGEST_LENGTH||f.length!==r.DIGEST_LENGTH?!1:e.equal(a,f)}r.equal=s}(Bv),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=vl,t=Bv,i=Ni,n=yt,s=ks;r.KEY_LENGTH=32,r.NONCE_LENGTH=12,r.TAG_LENGTH=16;var a=new Uint8Array(16),f=function(){function h(u){if(this.nonceLength=r.NONCE_LENGTH,this.tagLength=r.TAG_LENGTH,u.length!==r.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(u)}return h.prototype.seal=function(u,g,w,M){if(u.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var P=new Uint8Array(16);P.set(u,P.length-u.length);var O=new Uint8Array(32);e.stream(this._key,P,O,4);var $=g.length+this.tagLength,q;if(M){if(M.length!==$)throw new Error("ChaCha20Poly1305: incorrect destination length");q=M}else q=new Uint8Array($);return e.streamXOR(this._key,P,g,q,4),this._authenticate(q.subarray(q.length-this.tagLength,q.length),O,q.subarray(0,q.length-this.tagLength),w),i.wipe(P),q},h.prototype.open=function(u,g,w,M){if(u.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(g.length<this.tagLength)return null;var P=new Uint8Array(16);P.set(u,P.length-u.length);var O=new Uint8Array(32);e.stream(this._key,P,O,4);var $=new Uint8Array(this.tagLength);if(this._authenticate($,O,g.subarray(0,g.length-this.tagLength),w),!s.equal($,g.subarray(g.length-this.tagLength,g.length)))return null;var q=g.length-this.tagLength,U;if(M){if(M.length!==q)throw new Error("ChaCha20Poly1305: incorrect destination length");U=M}else U=new Uint8Array(q);return e.streamXOR(this._key,P,g.subarray(0,g.length-this.tagLength),U,4),i.wipe(P),U},h.prototype.clean=function(){return i.wipe(this._key),this},h.prototype._authenticate=function(u,g,w,M){var P=new t.Poly1305(g);M&&(P.update(M),M.length%16>0&&P.update(a.subarray(M.length%16))),P.update(w),w.length%16>0&&P.update(a.subarray(w.length%16));var O=new Uint8Array(8);M&&n.writeUint64LE(M.length,O),P.update(O),n.writeUint64LE(w.length,O),P.update(O);for(var $=P.digest(),q=0;q<$.length;q++)u[q]=$[q];P.clean(),i.wipe($),i.wipe(O)},h}();r.ChaCha20Poly1305=f}(xd);var Fv={},Fc={},Cd={};Object.defineProperty(Cd,"__esModule",{value:!0});function j_(r){return typeof r.saveState<"u"&&typeof r.restoreState<"u"&&typeof r.cleanSavedState<"u"}Cd.isSerializableHash=j_,Object.defineProperty(Fc,"__esModule",{value:!0});var Jn=Cd,W_=ks,K_=Ni,qv=function(){function r(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(i).clean():i.set(t);for(var n=0;n<i.length;n++)i[n]^=54;this._inner.update(i);for(var n=0;n<i.length;n++)i[n]^=106;this._outer.update(i),Jn.isSerializableHash(this._inner)&&Jn.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),K_.wipe(i)}return r.prototype.reset=function(){if(!Jn.isSerializableHash(this._inner)||!Jn.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.clean=function(){Jn.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),Jn.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},r.prototype.update=function(e){return this._inner.update(e),this},r.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},r.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},r.prototype.saveState=function(){if(!Jn.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},r.prototype.restoreState=function(e){if(!Jn.isSerializableHash(this._inner)||!Jn.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.cleanSavedState=function(e){if(!Jn.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},r}();Fc.HMAC=qv;function V_(r,e,t){var i=new qv(r,e);i.update(t);var n=i.digest();return i.clean(),n}Fc.hmac=V_,Fc.equal=W_.equal,Object.defineProperty(Fv,"__esModule",{value:!0});var zv=Fc,kv=Ni,G_=function(){function r(e,t,i,n){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=n;var s=zv.hmac(this._hash,i,t);this._hmac=new zv.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return r.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},r.prototype.expand=function(e){for(var t=new Uint8Array(e),i=0;i<t.length;i++)this._bufpos===this._buffer.length&&this._fillBuffer(),t[i]=this._buffer[this._bufpos++];return t},r.prototype.clean=function(){this._hmac.clean(),kv.wipe(this._buffer),kv.wipe(this._counter),this._bufpos=0},r}(),J_=Fv.HKDF=G_,Hs={},wl={},yl={};Object.defineProperty(yl,"__esModule",{value:!0}),yl.BrowserRandomSource=void 0;const Hv=65536;class Y_{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const t=new Uint8Array(e);for(let i=0;i<t.length;i+=Hv)this._crypto.getRandomValues(t.subarray(i,i+Math.min(t.length-i,Hv)));return t}}yl.BrowserRandomSource=Y_;function Q_(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var _l={};Object.defineProperty(_l,"__esModule",{value:!0}),_l.NodeRandomSource=void 0;const Z_=Ni;class X_{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof Q_<"u"){const e=il;e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const i=new Uint8Array(e);for(let n=0;n<i.length;n++)i[n]=t[n];return(0,Z_.wipe)(t),i}}_l.NodeRandomSource=X_,Object.defineProperty(wl,"__esModule",{value:!0}),wl.SystemRandomSource=void 0;const e7=yl,t7=_l;class r7{constructor(){if(this.isAvailable=!1,this.name="",this._source=new e7.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new t7.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)}}wl.SystemRandomSource=r7,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.randomStringForEntropy=r.randomString=r.randomUint32=r.randomBytes=r.defaultRandomSource=void 0;const e=wl,t=yt,i=Ni;r.defaultRandomSource=new e.SystemRandomSource;function n(u,g=r.defaultRandomSource){return g.randomBytes(u)}r.randomBytes=n;function s(u=r.defaultRandomSource){const g=n(4,u),w=(0,t.readUint32LE)(g);return(0,i.wipe)(g),w}r.randomUint32=s;const a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function f(u,g=a,w=r.defaultRandomSource){if(g.length<2)throw new Error("randomString charset is too short");if(g.length>256)throw new Error("randomString charset is too long");let M="";const P=g.length,O=256-256%P;for(;u>0;){const $=n(Math.ceil(u*256/O),w);for(let q=0;q<$.length&&u>0;q++){const U=$[q];U<O&&(M+=g.charAt(U%P),u--)}(0,i.wipe)($)}return M}r.randomString=f;function h(u,g=a,w=r.defaultRandomSource){const M=Math.ceil(u/(Math.log(g.length)/Math.LN2));return f(M,g,w)}r.randomStringForEntropy=h}(Hs);var qc={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=yt,t=Ni;r.DIGEST_LENGTH=32,r.BLOCK_SIZE=64;var i=function(){function f(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return f.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},f.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},f.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._temp),this.reset()},f.prototype.update=function(h,u){if(u===void 0&&(u=h.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var g=0;if(this._bytesHashed+=u,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&u>0;)this._buffer[this._bufferLength++]=h[g++],u--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(u>=this.blockSize&&(g=s(this._temp,this._state,h,g,u),u%=this.blockSize);u>0;)this._buffer[this._bufferLength++]=h[g++],u--;return this},f.prototype.finish=function(h){if(!this._finished){var u=this._bytesHashed,g=this._bufferLength,w=u/536870912|0,M=u<<3,P=u%64<56?64:128;this._buffer[g]=128;for(var O=g+1;O<P-8;O++)this._buffer[O]=0;e.writeUint32BE(w,this._buffer,P-8),e.writeUint32BE(M,this._buffer,P-4),s(this._temp,this._state,this._buffer,0,P),this._finished=!0}for(var O=0;O<this.digestLength/4;O++)e.writeUint32BE(this._state[O],h,O*4);return this},f.prototype.digest=function(){var h=new Uint8Array(this.digestLength);return this.finish(h),h},f.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},f.prototype.restoreState=function(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},f.prototype.cleanSavedState=function(h){t.wipe(h.state),h.buffer&&t.wipe(h.buffer),h.bufferLength=0,h.bytesHashed=0},f}();r.SHA256=i;var n=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(f,h,u,g,w){for(;w>=64;){for(var M=h[0],P=h[1],O=h[2],$=h[3],q=h[4],U=h[5],J=h[6],ee=h[7],W=0;W<16;W++){var G=g+W*4;f[W]=e.readUint32BE(u,G)}for(var W=16;W<64;W++){var Q=f[W-2],A=(Q>>>17|Q<<32-17)^(Q>>>19|Q<<32-19)^Q>>>10;Q=f[W-15];var z=(Q>>>7|Q<<32-7)^(Q>>>18|Q<<32-18)^Q>>>3;f[W]=(A+f[W-7]|0)+(z+f[W-16]|0)}for(var W=0;W<64;W++){var A=(((q>>>6|q<<26)^(q>>>11|q<<21)^(q>>>25|q<<7))+(q&U^~q&J)|0)+(ee+(n[W]+f[W]|0)|0)|0,z=((M>>>2|M<<32-2)^(M>>>13|M<<32-13)^(M>>>22|M<<32-22))+(M&P^M&O^P&O)|0;ee=J,J=U,U=q,q=$+A|0,$=O,O=P,P=M,M=A+z|0}h[0]+=M,h[1]+=P,h[2]+=O,h[3]+=$,h[4]+=q,h[5]+=U,h[6]+=J,h[7]+=ee,g+=64,w-=64}return g}function a(f){var h=new i;h.update(f);var u=h.digest();return h.clean(),u}r.hash=a})(qc);var Pd={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.sharedKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.scalarMultBase=r.scalarMult=r.SHARED_KEY_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=void 0;const e=Hs,t=Ni;r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=32,r.SHARED_KEY_LENGTH=32;function i(W){const G=new Float64Array(16);if(W)for(let Q=0;Q<W.length;Q++)G[Q]=W[Q];return G}const n=new Uint8Array(32);n[0]=9;const s=i([56129,1]);function a(W){let G=1;for(let Q=0;Q<16;Q++){let A=W[Q]+G+65535;G=Math.floor(A/65536),W[Q]=A-G*65536}W[0]+=G-1+37*(G-1)}function f(W,G,Q){const A=~(Q-1);for(let z=0;z<16;z++){const te=A&(W[z]^G[z]);W[z]^=te,G[z]^=te}}function h(W,G){const Q=i(),A=i();for(let z=0;z<16;z++)A[z]=G[z];a(A),a(A),a(A);for(let z=0;z<2;z++){Q[0]=A[0]-65517;for(let ae=1;ae<15;ae++)Q[ae]=A[ae]-65535-(Q[ae-1]>>16&1),Q[ae-1]&=65535;Q[15]=A[15]-32767-(Q[14]>>16&1);const te=Q[15]>>16&1;Q[14]&=65535,f(A,Q,1-te)}for(let z=0;z<16;z++)W[2*z]=A[z]&255,W[2*z+1]=A[z]>>8}function u(W,G){for(let Q=0;Q<16;Q++)W[Q]=G[2*Q]+(G[2*Q+1]<<8);W[15]&=32767}function g(W,G,Q){for(let A=0;A<16;A++)W[A]=G[A]+Q[A]}function w(W,G,Q){for(let A=0;A<16;A++)W[A]=G[A]-Q[A]}function M(W,G,Q){let A,z,te=0,ae=0,L=0,b=0,m=0,l=0,d=0,y=0,C=0,D=0,S=0,v=0,x=0,_=0,N=0,oe=0,R=0,Z=0,H=0,K=0,k=0,E=0,j=0,re=0,le=0,he=0,ge=0,ke=0,Te=0,Ce=0,Xe=0,Ne=Q[0],be=Q[1],Pe=Q[2],De=Q[3],ye=Q[4],Ie=Q[5],Oe=Q[6],me=Q[7],Me=Q[8],Be=Q[9],we=Q[10],He=Q[11],We=Q[12],Ee=Q[13],Ve=Q[14],Ke=Q[15];A=G[0],te+=A*Ne,ae+=A*be,L+=A*Pe,b+=A*De,m+=A*ye,l+=A*Ie,d+=A*Oe,y+=A*me,C+=A*Me,D+=A*Be,S+=A*we,v+=A*He,x+=A*We,_+=A*Ee,N+=A*Ve,oe+=A*Ke,A=G[1],ae+=A*Ne,L+=A*be,b+=A*Pe,m+=A*De,l+=A*ye,d+=A*Ie,y+=A*Oe,C+=A*me,D+=A*Me,S+=A*Be,v+=A*we,x+=A*He,_+=A*We,N+=A*Ee,oe+=A*Ve,R+=A*Ke,A=G[2],L+=A*Ne,b+=A*be,m+=A*Pe,l+=A*De,d+=A*ye,y+=A*Ie,C+=A*Oe,D+=A*me,S+=A*Me,v+=A*Be,x+=A*we,_+=A*He,N+=A*We,oe+=A*Ee,R+=A*Ve,Z+=A*Ke,A=G[3],b+=A*Ne,m+=A*be,l+=A*Pe,d+=A*De,y+=A*ye,C+=A*Ie,D+=A*Oe,S+=A*me,v+=A*Me,x+=A*Be,_+=A*we,N+=A*He,oe+=A*We,R+=A*Ee,Z+=A*Ve,H+=A*Ke,A=G[4],m+=A*Ne,l+=A*be,d+=A*Pe,y+=A*De,C+=A*ye,D+=A*Ie,S+=A*Oe,v+=A*me,x+=A*Me,_+=A*Be,N+=A*we,oe+=A*He,R+=A*We,Z+=A*Ee,H+=A*Ve,K+=A*Ke,A=G[5],l+=A*Ne,d+=A*be,y+=A*Pe,C+=A*De,D+=A*ye,S+=A*Ie,v+=A*Oe,x+=A*me,_+=A*Me,N+=A*Be,oe+=A*we,R+=A*He,Z+=A*We,H+=A*Ee,K+=A*Ve,k+=A*Ke,A=G[6],d+=A*Ne,y+=A*be,C+=A*Pe,D+=A*De,S+=A*ye,v+=A*Ie,x+=A*Oe,_+=A*me,N+=A*Me,oe+=A*Be,R+=A*we,Z+=A*He,H+=A*We,K+=A*Ee,k+=A*Ve,E+=A*Ke,A=G[7],y+=A*Ne,C+=A*be,D+=A*Pe,S+=A*De,v+=A*ye,x+=A*Ie,_+=A*Oe,N+=A*me,oe+=A*Me,R+=A*Be,Z+=A*we,H+=A*He,K+=A*We,k+=A*Ee,E+=A*Ve,j+=A*Ke,A=G[8],C+=A*Ne,D+=A*be,S+=A*Pe,v+=A*De,x+=A*ye,_+=A*Ie,N+=A*Oe,oe+=A*me,R+=A*Me,Z+=A*Be,H+=A*we,K+=A*He,k+=A*We,E+=A*Ee,j+=A*Ve,re+=A*Ke,A=G[9],D+=A*Ne,S+=A*be,v+=A*Pe,x+=A*De,_+=A*ye,N+=A*Ie,oe+=A*Oe,R+=A*me,Z+=A*Me,H+=A*Be,K+=A*we,k+=A*He,E+=A*We,j+=A*Ee,re+=A*Ve,le+=A*Ke,A=G[10],S+=A*Ne,v+=A*be,x+=A*Pe,_+=A*De,N+=A*ye,oe+=A*Ie,R+=A*Oe,Z+=A*me,H+=A*Me,K+=A*Be,k+=A*we,E+=A*He,j+=A*We,re+=A*Ee,le+=A*Ve,he+=A*Ke,A=G[11],v+=A*Ne,x+=A*be,_+=A*Pe,N+=A*De,oe+=A*ye,R+=A*Ie,Z+=A*Oe,H+=A*me,K+=A*Me,k+=A*Be,E+=A*we,j+=A*He,re+=A*We,le+=A*Ee,he+=A*Ve,ge+=A*Ke,A=G[12],x+=A*Ne,_+=A*be,N+=A*Pe,oe+=A*De,R+=A*ye,Z+=A*Ie,H+=A*Oe,K+=A*me,k+=A*Me,E+=A*Be,j+=A*we,re+=A*He,le+=A*We,he+=A*Ee,ge+=A*Ve,ke+=A*Ke,A=G[13],_+=A*Ne,N+=A*be,oe+=A*Pe,R+=A*De,Z+=A*ye,H+=A*Ie,K+=A*Oe,k+=A*me,E+=A*Me,j+=A*Be,re+=A*we,le+=A*He,he+=A*We,ge+=A*Ee,ke+=A*Ve,Te+=A*Ke,A=G[14],N+=A*Ne,oe+=A*be,R+=A*Pe,Z+=A*De,H+=A*ye,K+=A*Ie,k+=A*Oe,E+=A*me,j+=A*Me,re+=A*Be,le+=A*we,he+=A*He,ge+=A*We,ke+=A*Ee,Te+=A*Ve,Ce+=A*Ke,A=G[15],oe+=A*Ne,R+=A*be,Z+=A*Pe,H+=A*De,K+=A*ye,k+=A*Ie,E+=A*Oe,j+=A*me,re+=A*Me,le+=A*Be,he+=A*we,ge+=A*He,ke+=A*We,Te+=A*Ee,Ce+=A*Ve,Xe+=A*Ke,te+=38*R,ae+=38*Z,L+=38*H,b+=38*K,m+=38*k,l+=38*E,d+=38*j,y+=38*re,C+=38*le,D+=38*he,S+=38*ge,v+=38*ke,x+=38*Te,_+=38*Ce,N+=38*Xe,z=1,A=te+z+65535,z=Math.floor(A/65536),te=A-z*65536,A=ae+z+65535,z=Math.floor(A/65536),ae=A-z*65536,A=L+z+65535,z=Math.floor(A/65536),L=A-z*65536,A=b+z+65535,z=Math.floor(A/65536),b=A-z*65536,A=m+z+65535,z=Math.floor(A/65536),m=A-z*65536,A=l+z+65535,z=Math.floor(A/65536),l=A-z*65536,A=d+z+65535,z=Math.floor(A/65536),d=A-z*65536,A=y+z+65535,z=Math.floor(A/65536),y=A-z*65536,A=C+z+65535,z=Math.floor(A/65536),C=A-z*65536,A=D+z+65535,z=Math.floor(A/65536),D=A-z*65536,A=S+z+65535,z=Math.floor(A/65536),S=A-z*65536,A=v+z+65535,z=Math.floor(A/65536),v=A-z*65536,A=x+z+65535,z=Math.floor(A/65536),x=A-z*65536,A=_+z+65535,z=Math.floor(A/65536),_=A-z*65536,A=N+z+65535,z=Math.floor(A/65536),N=A-z*65536,A=oe+z+65535,z=Math.floor(A/65536),oe=A-z*65536,te+=z-1+37*(z-1),z=1,A=te+z+65535,z=Math.floor(A/65536),te=A-z*65536,A=ae+z+65535,z=Math.floor(A/65536),ae=A-z*65536,A=L+z+65535,z=Math.floor(A/65536),L=A-z*65536,A=b+z+65535,z=Math.floor(A/65536),b=A-z*65536,A=m+z+65535,z=Math.floor(A/65536),m=A-z*65536,A=l+z+65535,z=Math.floor(A/65536),l=A-z*65536,A=d+z+65535,z=Math.floor(A/65536),d=A-z*65536,A=y+z+65535,z=Math.floor(A/65536),y=A-z*65536,A=C+z+65535,z=Math.floor(A/65536),C=A-z*65536,A=D+z+65535,z=Math.floor(A/65536),D=A-z*65536,A=S+z+65535,z=Math.floor(A/65536),S=A-z*65536,A=v+z+65535,z=Math.floor(A/65536),v=A-z*65536,A=x+z+65535,z=Math.floor(A/65536),x=A-z*65536,A=_+z+65535,z=Math.floor(A/65536),_=A-z*65536,A=N+z+65535,z=Math.floor(A/65536),N=A-z*65536,A=oe+z+65535,z=Math.floor(A/65536),oe=A-z*65536,te+=z-1+37*(z-1),W[0]=te,W[1]=ae,W[2]=L,W[3]=b,W[4]=m,W[5]=l,W[6]=d,W[7]=y,W[8]=C,W[9]=D,W[10]=S,W[11]=v,W[12]=x,W[13]=_,W[14]=N,W[15]=oe}function P(W,G){M(W,G,G)}function O(W,G){const Q=i();for(let A=0;A<16;A++)Q[A]=G[A];for(let A=253;A>=0;A--)P(Q,Q),A!==2&&A!==4&&M(Q,Q,G);for(let A=0;A<16;A++)W[A]=Q[A]}function $(W,G){const Q=new Uint8Array(32),A=new Float64Array(80),z=i(),te=i(),ae=i(),L=i(),b=i(),m=i();for(let C=0;C<31;C++)Q[C]=W[C];Q[31]=W[31]&127|64,Q[0]&=248,u(A,G);for(let C=0;C<16;C++)te[C]=A[C];z[0]=L[0]=1;for(let C=254;C>=0;--C){const D=Q[C>>>3]>>>(C&7)&1;f(z,te,D),f(ae,L,D),g(b,z,ae),w(z,z,ae),g(ae,te,L),w(te,te,L),P(L,b),P(m,z),M(z,ae,z),M(ae,te,b),g(b,z,ae),w(z,z,ae),P(te,z),w(ae,L,m),M(z,ae,s),g(z,z,L),M(ae,ae,z),M(z,L,m),M(L,te,A),P(te,b),f(z,te,D),f(ae,L,D)}for(let C=0;C<16;C++)A[C+16]=z[C],A[C+32]=ae[C],A[C+48]=te[C],A[C+64]=L[C];const l=A.subarray(32),d=A.subarray(16);O(l,l),M(d,d,l);const y=new Uint8Array(32);return h(y,d),y}r.scalarMult=$;function q(W){return $(W,n)}r.scalarMultBase=q;function U(W){if(W.length!==r.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${r.SECRET_KEY_LENGTH} bytes`);const G=new Uint8Array(W);return{publicKey:q(G),secretKey:G}}r.generateKeyPairFromSeed=U;function J(W){const G=(0,e.randomBytes)(32,W),Q=U(G);return(0,t.wipe)(G),Q}r.generateKeyPair=J;function ee(W,G,Q=!1){if(W.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(G.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const A=$(W,G);if(Q){let z=0;for(let te=0;te<A.length;te++)z|=A[te];if(z===0)throw new Error("X25519: invalid shared key")}return A}r.sharedKey=ee})(Pd);function jv(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function Dd(r,e){e||(e=r.reduce((n,s)=>n+s.length,0));const t=jv(e);let i=0;for(const n of r)t.set(n,i),i+=n.length;return t}function i7(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i<t.length;i++)t[i]=255;for(var n=0;n<r.length;n++){var s=r.charAt(n),a=s.charCodeAt(0);if(t[a]!==255)throw new TypeError(s+" is ambiguous");t[a]=n}var f=r.length,h=r.charAt(0),u=Math.log(f)/Math.log(256),g=Math.log(256)/Math.log(f);function w(O){if(O instanceof Uint8Array||(ArrayBuffer.isView(O)?O=new Uint8Array(O.buffer,O.byteOffset,O.byteLength):Array.isArray(O)&&(O=Uint8Array.from(O))),!(O instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(O.length===0)return"";for(var $=0,q=0,U=0,J=O.length;U!==J&&O[U]===0;)U++,$++;for(var ee=(J-U)*g+1>>>0,W=new Uint8Array(ee);U!==J;){for(var G=O[U],Q=0,A=ee-1;(G!==0||Q<q)&&A!==-1;A--,Q++)G+=256*W[A]>>>0,W[A]=G%f>>>0,G=G/f>>>0;if(G!==0)throw new Error("Non-zero carry");q=Q,U++}for(var z=ee-q;z!==ee&&W[z]===0;)z++;for(var te=h.repeat($);z<ee;++z)te+=r.charAt(W[z]);return te}function M(O){if(typeof O!="string")throw new TypeError("Expected String");if(O.length===0)return new Uint8Array;var $=0;if(O[$]!==" "){for(var q=0,U=0;O[$]===h;)q++,$++;for(var J=(O.length-$)*u+1>>>0,ee=new Uint8Array(J);O[$];){var W=t[O.charCodeAt($)];if(W===255)return;for(var G=0,Q=J-1;(W!==0||G<U)&&Q!==-1;Q--,G++)W+=f*ee[Q]>>>0,ee[Q]=W%256>>>0,W=W/256>>>0;if(W!==0)throw new Error("Non-zero carry");U=G,$++}if(O[$]!==" "){for(var A=J-U;A!==J&&ee[A]===0;)A++;for(var z=new Uint8Array(q+(J-A)),te=q;A!==J;)z[te++]=ee[A++];return z}}}function P(O){var $=M(O);if($)return $;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:M,decode:P}}var n7=i7,s7=n7;const Wv=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},o7=r=>new TextEncoder().encode(r),a7=r=>new TextDecoder().decode(r);class c7{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class f7{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Kv(this,e)}}class l7{constructor(e){this.decoders=e}or(e){return Kv(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Kv=(r,e)=>new l7({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});class h7{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new c7(e,t,i),this.decoder=new f7(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const xl=({name:r,prefix:e,encode:t,decode:i})=>new h7(r,e,t,i),zc=({prefix:r,name:e,alphabet:t})=>{const{encode:i,decode:n}=s7(t,e);return xl({prefix:r,name:e,encode:i,decode:s=>Wv(n(s))})},u7=(r,e,t,i)=>{const n={};for(let g=0;g<e.length;++g)n[e[g]]=g;let s=r.length;for(;r[s-1]==="=";)--s;const a=new Uint8Array(s*t/8|0);let f=0,h=0,u=0;for(let g=0;g<s;++g){const w=n[r[g]];if(w===void 0)throw new SyntaxError(`Non-${i} character`);h=h<<t|w,f+=t,f>=8&&(f-=8,a[u++]=255&h>>f)}if(f>=t||255&h<<8-f)throw new SyntaxError("Unexpected end of data");return a},d7=(r,e,t)=>{const i=e[e.length-1]==="=",n=(1<<t)-1;let s="",a=0,f=0;for(let h=0;h<r.length;++h)for(f=f<<8|r[h],a+=8;a>t;)a-=t,s+=e[n&f>>a];if(a&&(s+=e[n&f<<t-a]),i)for(;s.length*t&7;)s+="=";return s},jr=({name:r,prefix:e,bitsPerChar:t,alphabet:i})=>xl({prefix:e,name:r,encode(n){return d7(n,i,t)},decode(n){return u7(n,i,t,r)}}),p7=xl({prefix:"\0",name:"identity",encode:r=>a7(r),decode:r=>o7(r)});var g7=Object.freeze({__proto__:null,identity:p7});const v7=jr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var m7=Object.freeze({__proto__:null,base2:v7});const b7=jr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var w7=Object.freeze({__proto__:null,base8:b7});const y7=zc({prefix:"9",name:"base10",alphabet:"0123456789"});var _7=Object.freeze({__proto__:null,base10:y7});const x7=jr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),E7=jr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var A7=Object.freeze({__proto__:null,base16:x7,base16upper:E7});const S7=jr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),I7=jr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),M7=jr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),C7=jr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),P7=jr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),D7=jr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),O7=jr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),R7=jr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),T7=jr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var N7=Object.freeze({__proto__:null,base32:S7,base32upper:I7,base32pad:M7,base32padupper:C7,base32hex:P7,base32hexupper:D7,base32hexpad:O7,base32hexpadupper:R7,base32z:T7});const $7=zc({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),L7=zc({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var B7=Object.freeze({__proto__:null,base36:$7,base36upper:L7});const U7=zc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),F7=zc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var q7=Object.freeze({__proto__:null,base58btc:U7,base58flickr:F7});const z7=jr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),k7=jr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),H7=jr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),j7=jr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var W7=Object.freeze({__proto__:null,base64:z7,base64pad:k7,base64url:H7,base64urlpad:j7});const Vv=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}"),K7=Vv.reduce((r,e,t)=>(r[t]=e,r),[]),V7=Vv.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function G7(r){return r.reduce((e,t)=>(e+=K7[t],e),"")}function J7(r){const e=[];for(const t of r){const i=V7[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const Y7=xl({prefix:"\u{1F680}",name:"base256emoji",encode:G7,decode:J7});var Q7=Object.freeze({__proto__:null,base256emoji:Y7}),Z7=Jv,Gv=128,X7=127,e9=~X7,t9=Math.pow(2,31);function Jv(r,e,t){e=e||[],t=t||0;for(var i=t;r>=t9;)e[t++]=r&255|Gv,r/=128;for(;r&e9;)e[t++]=r&255|Gv,r>>>=7;return e[t]=r|0,Jv.bytes=t-i+1,e}var r9=Od,i9=128,Yv=127;function Od(r,i){var t=0,i=i||0,n=0,s=i,a,f=r.length;do{if(s>=f)throw Od.bytes=0,new RangeError("Could not decode varint");a=r[s++],t+=n<28?(a&Yv)<<n:(a&Yv)*Math.pow(2,n),n+=7}while(a>=i9);return Od.bytes=s-i,t}var n9=Math.pow(2,7),s9=Math.pow(2,14),o9=Math.pow(2,21),a9=Math.pow(2,28),c9=Math.pow(2,35),f9=Math.pow(2,42),l9=Math.pow(2,49),h9=Math.pow(2,56),u9=Math.pow(2,63),d9=function(r){return r<n9?1:r<s9?2:r<o9?3:r<a9?4:r<c9?5:r<f9?6:r<l9?7:r<h9?8:r<u9?9:10},p9={encode:Z7,decode:r9,encodingLength:d9},Qv=p9;const Zv=(r,e,t=0)=>(Qv.encode(r,e,t),e),Xv=r=>Qv.encodingLength(r),Rd=(r,e)=>{const t=e.byteLength,i=Xv(r),n=i+Xv(t),s=new Uint8Array(n+t);return Zv(r,s,0),Zv(t,s,i),s.set(e,n),new g9(r,t,e,s)};class g9{constructor(e,t,i,n){this.code=e,this.size=t,this.digest=i,this.bytes=n}}const em=({name:r,code:e,encode:t})=>new v9(r,e,t);class v9{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Rd(this.code,t):t.then(i=>Rd(this.code,i))}else throw Error("Unknown type, must be binary type")}}const tm=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),m9=em({name:"sha2-256",code:18,encode:tm("SHA-256")}),b9=em({name:"sha2-512",code:19,encode:tm("SHA-512")});var w9=Object.freeze({__proto__:null,sha256:m9,sha512:b9});const rm=0,y9="identity",im=Wv;var _9=Object.freeze({__proto__:null,identity:{code:rm,name:y9,encode:im,digest:r=>Rd(rm,im(r))}});new TextEncoder,new TextDecoder;const Ta={...g7,...m7,...w7,..._7,...A7,...N7,...B7,...q7,...W7,...Q7};({...w9,..._9});function nm(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const sm=nm("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Td=nm("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=jv(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),om={utf8:sm,"utf-8":sm,hex:Ta.base16,latin1:Td,ascii:Td,binary:Td,...Ta};function Zi(r,e="utf8"){const t=om[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):t.decoder.decode(`${t.prefix}${r}`)}function $i(r,e="utf8"){const t=om[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}var am={},x9="elliptic",E9="6.6.1",A9="EC cryptography",S9="lib/elliptic.js",I9=["lib"],M9={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},C9={type:"git",url:"git@github.com:indutny/elliptic"},P9=["EC","Elliptic","curve","Cryptography"],D9="Fedor Indutny <fedor@indutny.com>",O9="MIT",R9={url:"https://github.com/indutny/elliptic/issues"},T9="https://github.com/indutny/elliptic",N9={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},$9={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},L9={name:x9,version:E9,description:A9,main:S9,files:I9,scripts:M9,repository:C9,keywords:P9,author:D9,license:O9,bugs:R9,homepage:T9,devDependencies:N9,dependencies:$9},Li={},Yn={exports:{}};(function(r){(function(e,t){function i(L,b){if(!L)throw new Error(b||"Assertion failed")}function n(L,b){L.super_=b;var m=function(){};m.prototype=b.prototype,L.prototype=new m,L.prototype.constructor=L}function s(L,b,m){if(s.isBN(L))return L;this.negative=0,this.words=null,this.length=0,this.red=null,L!==null&&((b==="le"||b==="be")&&(m=b,b=10),this._init(L||0,b||10,m||"be"))}typeof e=="object"?e.exports=s:t.BN=s,s.BN=s,s.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=il.Buffer}catch{}s.isBN=function(b){return b instanceof s?!0:b!==null&&typeof b=="object"&&b.constructor.wordSize===s.wordSize&&Array.isArray(b.words)},s.max=function(b,m){return b.cmp(m)>0?b:m},s.min=function(b,m){return b.cmp(m)<0?b:m},s.prototype._init=function(b,m,l){if(typeof b=="number")return this._initNumber(b,m,l);if(typeof b=="object")return this._initArray(b,m,l);m==="hex"&&(m=16),i(m===(m|0)&&m>=2&&m<=36),b=b.toString().replace(/\s+/g,"");var d=0;b[0]==="-"&&(d++,this.negative=1),d<b.length&&(m===16?this._parseHex(b,d,l):(this._parseBase(b,m,d),l==="le"&&this._initArray(this.toArray(),m,l)))},s.prototype._initNumber=function(b,m,l){b<0&&(this.negative=1,b=-b),b<67108864?(this.words=[b&67108863],this.length=1):b<4503599627370496?(this.words=[b&67108863,b/67108864&67108863],this.length=2):(i(b<9007199254740992),this.words=[b&67108863,b/67108864&67108863,1],this.length=3),l==="le"&&this._initArray(this.toArray(),m,l)},s.prototype._initArray=function(b,m,l){if(i(typeof b.length=="number"),b.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(b.length/3),this.words=new Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var y,C,D=0;if(l==="be")for(d=b.length-1,y=0;d>=0;d-=3)C=b[d]|b[d-1]<<8|b[d-2]<<16,this.words[y]|=C<<D&67108863,this.words[y+1]=C>>>26-D&67108863,D+=24,D>=26&&(D-=26,y++);else if(l==="le")for(d=0,y=0;d<b.length;d+=3)C=b[d]|b[d+1]<<8|b[d+2]<<16,this.words[y]|=C<<D&67108863,this.words[y+1]=C>>>26-D&67108863,D+=24,D>=26&&(D-=26,y++);return this.strip()};function f(L,b){var m=L.charCodeAt(b);return m>=65&&m<=70?m-55:m>=97&&m<=102?m-87:m-48&15}function h(L,b,m){var l=f(L,m);return m-1>=b&&(l|=f(L,m-1)<<4),l}s.prototype._parseHex=function(b,m,l){this.length=Math.ceil((b.length-m)/6),this.words=new Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var y=0,C=0,D;if(l==="be")for(d=b.length-1;d>=m;d-=2)D=h(b,m,d)<<y,this.words[C]|=D&67108863,y>=18?(y-=18,C+=1,this.words[C]|=D>>>26):y+=8;else{var S=b.length-m;for(d=S%2===0?m+1:m;d<b.length;d+=2)D=h(b,m,d)<<y,this.words[C]|=D&67108863,y>=18?(y-=18,C+=1,this.words[C]|=D>>>26):y+=8}this.strip()};function u(L,b,m,l){for(var d=0,y=Math.min(L.length,m),C=b;C<y;C++){var D=L.charCodeAt(C)-48;d*=l,D>=49?d+=D-49+10:D>=17?d+=D-17+10:d+=D}return d}s.prototype._parseBase=function(b,m,l){this.words=[0],this.length=1;for(var d=0,y=1;y<=67108863;y*=m)d++;d--,y=y/m|0;for(var C=b.length-l,D=C%d,S=Math.min(C,C-D)+l,v=0,x=l;x<S;x+=d)v=u(b,x,x+d,m),this.imuln(y),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v);if(D!==0){var _=1;for(v=u(b,x,b.length,m),x=0;x<D;x++)_*=m;this.imuln(_),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v)}this.strip()},s.prototype.copy=function(b){b.words=new Array(this.length);for(var m=0;m<this.length;m++)b.words[m]=this.words[m];b.length=this.length,b.negative=this.negative,b.red=this.red},s.prototype.clone=function(){var b=new s(null);return this.copy(b),b},s.prototype._expand=function(b){for(;this.length<b;)this.words[this.length++]=0;return this},s.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var g=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],w=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(b,m){b=b||10,m=m|0||1;var l;if(b===16||b==="hex"){l="";for(var d=0,y=0,C=0;C<this.length;C++){var D=this.words[C],S=((D<<d|y)&16777215).toString(16);y=D>>>24-d&16777215,d+=2,d>=26&&(d-=26,C--),y!==0||C!==this.length-1?l=g[6-S.length]+S+l:l=S+l}for(y!==0&&(l=y.toString(16)+l);l.length%m!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}if(b===(b|0)&&b>=2&&b<=36){var v=w[b],x=M[b];l="";var _=this.clone();for(_.negative=0;!_.isZero();){var N=_.modn(x).toString(b);_=_.idivn(x),_.isZero()?l=N+l:l=g[v-N.length]+N+l}for(this.isZero()&&(l="0"+l);l.length%m!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var b=this.words[0];return this.length===2?b+=this.words[1]*67108864:this.length===3&&this.words[2]===1?b+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-b:b},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(b,m){return i(typeof a<"u"),this.toArrayLike(a,b,m)},s.prototype.toArray=function(b,m){return this.toArrayLike(Array,b,m)},s.prototype.toArrayLike=function(b,m,l){var d=this.byteLength(),y=l||Math.max(1,d);i(d<=y,"byte array longer than desired length"),i(y>0,"Requested array length <= 0"),this.strip();var C=m==="le",D=new b(y),S,v,x=this.clone();if(C){for(v=0;!x.isZero();v++)S=x.andln(255),x.iushrn(8),D[v]=S;for(;v<y;v++)D[v]=0}else{for(v=0;v<y-d;v++)D[v]=0;for(v=0;!x.isZero();v++)S=x.andln(255),x.iushrn(8),D[y-v-1]=S}return D},Math.clz32?s.prototype._countBits=function(b){return 32-Math.clz32(b)}:s.prototype._countBits=function(b){var m=b,l=0;return m>=4096&&(l+=13,m>>>=13),m>=64&&(l+=7,m>>>=7),m>=8&&(l+=4,m>>>=4),m>=2&&(l+=2,m>>>=2),l+m},s.prototype._zeroBits=function(b){if(b===0)return 26;var m=b,l=0;return m&8191||(l+=13,m>>>=13),m&127||(l+=7,m>>>=7),m&15||(l+=4,m>>>=4),m&3||(l+=2,m>>>=2),m&1||l++,l},s.prototype.bitLength=function(){var b=this.words[this.length-1],m=this._countBits(b);return(this.length-1)*26+m};function P(L){for(var b=new Array(L.bitLength()),m=0;m<b.length;m++){var l=m/26|0,d=m%26;b[m]=(L.words[l]&1<<d)>>>d}return b}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var b=0,m=0;m<this.length;m++){var l=this._zeroBits(this.words[m]);if(b+=l,l!==26)break}return b},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(b){return this.negative!==0?this.abs().inotn(b).iaddn(1):this.clone()},s.prototype.fromTwos=function(b){return this.testn(b-1)?this.notn(b).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(b){for(;this.length<b.length;)this.words[this.length++]=0;for(var m=0;m<b.length;m++)this.words[m]=this.words[m]|b.words[m];return this.strip()},s.prototype.ior=function(b){return i((this.negative|b.negative)===0),this.iuor(b)},s.prototype.or=function(b){return this.length>b.length?this.clone().ior(b):b.clone().ior(this)},s.prototype.uor=function(b){return this.length>b.length?this.clone().iuor(b):b.clone().iuor(this)},s.prototype.iuand=function(b){var m;this.length>b.length?m=b:m=this;for(var l=0;l<m.length;l++)this.words[l]=this.words[l]&b.words[l];return this.length=m.length,this.strip()},s.prototype.iand=function(b){return i((this.negative|b.negative)===0),this.iuand(b)},s.prototype.and=function(b){return this.length>b.length?this.clone().iand(b):b.clone().iand(this)},s.prototype.uand=function(b){return this.length>b.length?this.clone().iuand(b):b.clone().iuand(this)},s.prototype.iuxor=function(b){var m,l;this.length>b.length?(m=this,l=b):(m=b,l=this);for(var d=0;d<l.length;d++)this.words[d]=m.words[d]^l.words[d];if(this!==m)for(;d<m.length;d++)this.words[d]=m.words[d];return this.length=m.length,this.strip()},s.prototype.ixor=function(b){return i((this.negative|b.negative)===0),this.iuxor(b)},s.prototype.xor=function(b){return this.length>b.length?this.clone().ixor(b):b.clone().ixor(this)},s.prototype.uxor=function(b){return this.length>b.length?this.clone().iuxor(b):b.clone().iuxor(this)},s.prototype.inotn=function(b){i(typeof b=="number"&&b>=0);var m=Math.ceil(b/26)|0,l=b%26;this._expand(m),l>0&&m--;for(var d=0;d<m;d++)this.words[d]=~this.words[d]&67108863;return l>0&&(this.words[d]=~this.words[d]&67108863>>26-l),this.strip()},s.prototype.notn=function(b){return this.clone().inotn(b)},s.prototype.setn=function(b,m){i(typeof b=="number"&&b>=0);var l=b/26|0,d=b%26;return this._expand(l+1),m?this.words[l]=this.words[l]|1<<d:this.words[l]=this.words[l]&~(1<<d),this.strip()},s.prototype.iadd=function(b){var m;if(this.negative!==0&&b.negative===0)return this.negative=0,m=this.isub(b),this.negative^=1,this._normSign();if(this.negative===0&&b.negative!==0)return b.negative=0,m=this.isub(b),b.negative=1,m._normSign();var l,d;this.length>b.length?(l=this,d=b):(l=b,d=this);for(var y=0,C=0;C<d.length;C++)m=(l.words[C]|0)+(d.words[C]|0)+y,this.words[C]=m&67108863,y=m>>>26;for(;y!==0&&C<l.length;C++)m=(l.words[C]|0)+y,this.words[C]=m&67108863,y=m>>>26;if(this.length=l.length,y!==0)this.words[this.length]=y,this.length++;else if(l!==this)for(;C<l.length;C++)this.words[C]=l.words[C];return this},s.prototype.add=function(b){var m;return b.negative!==0&&this.negative===0?(b.negative=0,m=this.sub(b),b.negative^=1,m):b.negative===0&&this.negative!==0?(this.negative=0,m=b.sub(this),this.negative=1,m):this.length>b.length?this.clone().iadd(b):b.clone().iadd(this)},s.prototype.isub=function(b){if(b.negative!==0){b.negative=0;var m=this.iadd(b);return b.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(b),this.negative=1,this._normSign();var l=this.cmp(b);if(l===0)return this.negative=0,this.length=1,this.words[0]=0,this;var d,y;l>0?(d=this,y=b):(d=b,y=this);for(var C=0,D=0;D<y.length;D++)m=(d.words[D]|0)-(y.words[D]|0)+C,C=m>>26,this.words[D]=m&67108863;for(;C!==0&&D<d.length;D++)m=(d.words[D]|0)+C,C=m>>26,this.words[D]=m&67108863;if(C===0&&D<d.length&&d!==this)for(;D<d.length;D++)this.words[D]=d.words[D];return this.length=Math.max(this.length,D),d!==this&&(this.negative=1),this.strip()},s.prototype.sub=function(b){return this.clone().isub(b)};function O(L,b,m){m.negative=b.negative^L.negative;var l=L.length+b.length|0;m.length=l,l=l-1|0;var d=L.words[0]|0,y=b.words[0]|0,C=d*y,D=C&67108863,S=C/67108864|0;m.words[0]=D;for(var v=1;v<l;v++){for(var x=S>>>26,_=S&67108863,N=Math.min(v,b.length-1),oe=Math.max(0,v-L.length+1);oe<=N;oe++){var R=v-oe|0;d=L.words[R]|0,y=b.words[oe]|0,C=d*y+_,x+=C/67108864|0,_=C&67108863}m.words[v]=_|0,S=x|0}return S!==0?m.words[v]=S|0:m.length--,m.strip()}var $=function(b,m,l){var d=b.words,y=m.words,C=l.words,D=0,S,v,x,_=d[0]|0,N=_&8191,oe=_>>>13,R=d[1]|0,Z=R&8191,H=R>>>13,K=d[2]|0,k=K&8191,E=K>>>13,j=d[3]|0,re=j&8191,le=j>>>13,he=d[4]|0,ge=he&8191,ke=he>>>13,Te=d[5]|0,Ce=Te&8191,Xe=Te>>>13,Ne=d[6]|0,be=Ne&8191,Pe=Ne>>>13,De=d[7]|0,ye=De&8191,Ie=De>>>13,Oe=d[8]|0,me=Oe&8191,Me=Oe>>>13,Be=d[9]|0,we=Be&8191,He=Be>>>13,We=y[0]|0,Ee=We&8191,Ve=We>>>13,Ke=y[1]|0,Ge=Ke&8191,mt=Ke>>>13,It=y[2]|0,Je=It&8191,Pt=It>>>13,Ot=y[3]|0,Ze=Ot&8191,rt=Ot>>>13,et=y[4]|0,$e=et&8191,it=et>>>13,tt=y[5]|0,Re=tt&8191,lt=tt>>>13,ht=y[6]|0,Le=ht&8191,ut=ht>>>13,nt=y[7]|0,Ue=nt&8191,st=nt>>>13,Qe=y[8]|0,qe=Qe&8191,dt=Qe>>>13,kt=y[9]|0,at=kt&8191,Ht=kt>>>13;l.negative=b.negative^m.negative,l.length=19,S=Math.imul(N,Ee),v=Math.imul(N,Ve),v=v+Math.imul(oe,Ee)|0,x=Math.imul(oe,Ve);var _t=(D+S|0)+((v&8191)<<13)|0;D=(x+(v>>>13)|0)+(_t>>>26)|0,_t&=67108863,S=Math.imul(Z,Ee),v=Math.imul(Z,Ve),v=v+Math.imul(H,Ee)|0,x=Math.imul(H,Ve),S=S+Math.imul(N,Ge)|0,v=v+Math.imul(N,mt)|0,v=v+Math.imul(oe,Ge)|0,x=x+Math.imul(oe,mt)|0;var qt=(D+S|0)+((v&8191)<<13)|0;D=(x+(v>>>13)|0)+(qt>>>26)|0,qt&=67108863,S=Math.imul(k,Ee),v=Math.imul(k,Ve),v=v+Math.imul(E,Ee)|0,x=Math.imul(E,Ve),S=S+Math.imul(Z,Ge)|0,v=v+Math.imul(Z,mt)|0,v=v+Math.imul(H,Ge)|0,x=x+Math.imul(H,mt)|0,S=S+Math.imul(N,Je)|0,v=v+Math.imul(N,Pt)|0,v=v+Math.imul(oe,Je)|0,x=x+Math.imul(oe,Pt)|0;var Zr=(D+S|0)+((v&8191)<<13)|0;D=(x+(v>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,S=Math.imul(re,Ee),v=Math.imul(re,Ve),v=v+Math.imul(le,Ee)|0,x=Math.imul(le,Ve),S=S+Math.imul(k,Ge)|0,v=v+Math.imul(k,mt)|0,v=v+Math.imul(E,Ge)|0,x=x+Math.imul(E,mt)|0,S=S+Math.imul(Z,Je)|0,v=v+Math.imul(Z,Pt)|0,v=v+Math.imul(H,Je)|0,x=x+Math.imul(H,Pt)|0,S=S+Math.imul(N,Ze)|0,v=v+Math.imul(N,rt)|0,v=v+Math.imul(oe,Ze)|0,x=x+Math.imul(oe,rt)|0;var Xr=(D+S|0)+((v&8191)<<13)|0;D=(x+(v>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,S=Math.imul(ge,Ee),v=Math.imul(ge,Ve),v=v+Math.imul(ke,Ee)|0,x=Math.imul(ke,Ve),S=S+Math.imul(re,Ge)|0,v=v+Math.imul(re,mt)|0,v=v+Math.imul(le,Ge)|0,x=x+Math.imul(le,mt)|0,S=S+Math.imul(k,Je)|0,v=v+Math.imul(k,Pt)|0,v=v+Math.imul(E,Je)|0,x=x+Math.imul(E,Pt)|0,S=S+Math.imul(Z,Ze)|0,v=v+Math.imul(Z,rt)|0,v=v+Math.imul(H,Ze)|0,x=x+Math.imul(H,rt)|0,S=S+Math.imul(N,$e)|0,v=v+Math.imul(N,it)|0,v=v+Math.imul(oe,$e)|0,x=x+Math.imul(oe,it)|0;var ei=(D+S|0)+((v&8191)<<13)|0;D=(x+(v>>>13)|0)+(ei>>>26)|0,ei&=67108863,S=Math.imul(Ce,Ee),v=Math.imul(Ce,Ve),v=v+Math.imul(Xe,Ee)|0,x=Math.imul(Xe,Ve),S=S+Math.imul(ge,Ge)|0,v=v+Math.imul(ge,mt)|0,v=v+Math.imul(ke,Ge)|0,x=x+Math.imul(ke,mt)|0,S=S+Math.imul(re,Je)|0,v=v+Math.imul(re,Pt)|0,v=v+Math.imul(le,Je)|0,x=x+Math.imul(le,Pt)|0,S=S+Math.imul(k,Ze)|0,v=v+Math.imul(k,rt)|0,v=v+Math.imul(E,Ze)|0,x=x+Math.imul(E,rt)|0,S=S+Math.imul(Z,$e)|0,v=v+Math.imul(Z,it)|0,v=v+Math.imul(H,$e)|0,x=x+Math.imul(H,it)|0,S=S+Math.imul(N,Re)|0,v=v+Math.imul(N,lt)|0,v=v+Math.imul(oe,Re)|0,x=x+Math.imul(oe,lt)|0;var ti=(D+S|0)+((v&8191)<<13)|0;D=(x+(v>>>13)|0)+(ti>>>26)|0,ti&=67108863,S=Math.imul(be,Ee),v=Math.imul(be,Ve),v=v+Math.imul(Pe,Ee)|0,x=Math.imul(Pe,Ve),S=S+Math.imul(Ce,Ge)|0,v=v+Math.imul(Ce,mt)|0,v=v+Math.imul(Xe,Ge)|0,x=x+Math.imul(Xe,mt)|0,S=S+Math.imul(ge,Je)|0,v=v+Math.imul(ge,Pt)|0,v=v+Math.imul(ke,Je)|0,x=x+Math.imul(ke,Pt)|0,S=S+Math.imul(re,Ze)|0,v=v+Math.imul(re,rt)|0,v=v+Math.imul(le,Ze)|0,x=x+Math.imul(le,rt)|0,S=S+Math.imul(k,$e)|0,v=v+Math.imul(k,it)|0,v=v+Math.imul(E,$e)|0,x=x+Math.imul(E,it)|0,S=S+Math.imul(Z,Re)|0,v=v+Math.imul(Z,lt)|0,v=v+Math.imul(H,Re)|0,x=x+Math.imul(H,lt)|0,S=S+Math.imul(N,Le)|0,v=v+Math.imul(N,ut)|0,v=v+Math.imul(oe,Le)|0,x=x+Math.imul(oe,ut)|0;var vr=(D+S|0)+((v&8191)<<13)|0;D=(x+(v>>>13)|0)+(vr>>>26)|0,vr&=67108863,S=Math.imul(ye,Ee),v=Math.imul(ye,Ve),v=v+Math.imul(Ie,Ee)|0,x=Math.imul(Ie,Ve),S=S+Math.imul(be,Ge)|0,v=v+Math.imul(be,mt)|0,v=v+Math.imul(Pe,Ge)|0,x=x+Math.imul(Pe,mt)|0,S=S+Math.imul(Ce,Je)|0,v=v+Math.imul(Ce,Pt)|0,v=v+Math.imul(Xe,Je)|0,x=x+Math.imul(Xe,Pt)|0,S=S+Math.imul(ge,Ze)|0,v=v+Math.imul(ge,rt)|0,v=v+Math.imul(ke,Ze)|0,x=x+Math.imul(ke,rt)|0,S=S+Math.imul(re,$e)|0,v=v+Math.imul(re,it)|0,v=v+Math.imul(le,$e)|0,x=x+Math.imul(le,it)|0,S=S+Math.imul(k,Re)|0,v=v+Math.imul(k,lt)|0,v=v+Math.imul(E,Re)|0,x=x+Math.imul(E,lt)|0,S=S+Math.imul(Z,Le)|0,v=v+Math.imul(Z,ut)|0,v=v+Math.imul(H,Le)|0,x=x+Math.imul(H,ut)|0,S=S+Math.imul(N,Ue)|0,v=v+Math.imul(N,st)|0,v=v+Math.imul(oe,Ue)|0,x=x+Math.imul(oe,st)|0;var Ei=(D+S|0)+((v&8191)<<13)|0;D=(x+(v>>>13)|0)+(Ei>>>26)|0,Ei&=67108863,S=Math.imul(me,Ee),v=Math.imul(me,Ve),v=v+Math.imul(Me,Ee)|0,x=Math.imul(Me,Ve),S=S+Math.imul(ye,Ge)|0,v=v+Math.imul(ye,mt)|0,v=v+Math.imul(Ie,Ge)|0,x=x+Math.imul(Ie,mt)|0,S=S+Math.imul(be,Je)|0,v=v+Math.imul(be,Pt)|0,v=v+Math.imul(Pe,Je)|0,x=x+Math.imul(Pe,Pt)|0,S=S+Math.imul(Ce,Ze)|0,v=v+Math.imul(Ce,rt)|0,v=v+Math.imul(Xe,Ze)|0,x=x+Math.imul(Xe,rt)|0,S=S+Math.imul(ge,$e)|0,v=v+Math.imul(ge,it)|0,v=v+Math.imul(ke,$e)|0,x=x+Math.imul(ke,it)|0,S=S+Math.imul(re,Re)|0,v=v+Math.imul(re,lt)|0,v=v+Math.imul(le,Re)|0,x=x+Math.imul(le,lt)|0,S=S+Math.imul(k,Le)|0,v=v+Math.imul(k,ut)|0,v=v+Math.imul(E,Le)|0,x=x+Math.imul(E,ut)|0,S=S+Math.imul(Z,Ue)|0,v=v+Math.imul(Z,st)|0,v=v+Math.imul(H,Ue)|0,x=x+Math.imul(H,st)|0,S=S+Math.imul(N,qe)|0,v=v+Math.imul(N,dt)|0,v=v+Math.imul(oe,qe)|0,x=x+Math.imul(oe,dt)|0;var Pn=(D+S|0)+((v&8191)<<13)|0;D=(x+(v>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,S=Math.imul(we,Ee),v=Math.imul(we,Ve),v=v+Math.imul(He,Ee)|0,x=Math.imul(He,Ve),S=S+Math.imul(me,Ge)|0,v=v+Math.imul(me,mt)|0,v=v+Math.imul(Me,Ge)|0,x=x+Math.imul(Me,mt)|0,S=S+Math.imul(ye,Je)|0,v=v+Math.imul(ye,Pt)|0,v=v+Math.imul(Ie,Je)|0,x=x+Math.imul(Ie,Pt)|0,S=S+Math.imul(be,Ze)|0,v=v+Math.imul(be,rt)|0,v=v+Math.imul(Pe,Ze)|0,x=x+Math.imul(Pe,rt)|0,S=S+Math.imul(Ce,$e)|0,v=v+Math.imul(Ce,it)|0,v=v+Math.imul(Xe,$e)|0,x=x+Math.imul(Xe,it)|0,S=S+Math.imul(ge,Re)|0,v=v+Math.imul(ge,lt)|0,v=v+Math.imul(ke,Re)|0,x=x+Math.imul(ke,lt)|0,S=S+Math.imul(re,Le)|0,v=v+Math.imul(re,ut)|0,v=v+Math.imul(le,Le)|0,x=x+Math.imul(le,ut)|0,S=S+Math.imul(k,Ue)|0,v=v+Math.imul(k,st)|0,v=v+Math.imul(E,Ue)|0,x=x+Math.imul(E,st)|0,S=S+Math.imul(Z,qe)|0,v=v+Math.imul(Z,dt)|0,v=v+Math.imul(H,qe)|0,x=x+Math.imul(H,dt)|0,S=S+Math.imul(N,at)|0,v=v+Math.imul(N,Ht)|0,v=v+Math.imul(oe,at)|0,x=x+Math.imul(oe,Ht)|0;var Ai=(D+S|0)+((v&8191)<<13)|0;D=(x+(v>>>13)|0)+(Ai>>>26)|0,Ai&=67108863,S=Math.imul(we,Ge),v=Math.imul(we,mt),v=v+Math.imul(He,Ge)|0,x=Math.imul(He,mt),S=S+Math.imul(me,Je)|0,v=v+Math.imul(me,Pt)|0,v=v+Math.imul(Me,Je)|0,x=x+Math.imul(Me,Pt)|0,S=S+Math.imul(ye,Ze)|0,v=v+Math.imul(ye,rt)|0,v=v+Math.imul(Ie,Ze)|0,x=x+Math.imul(Ie,rt)|0,S=S+Math.imul(be,$e)|0,v=v+Math.imul(be,it)|0,v=v+Math.imul(Pe,$e)|0,x=x+Math.imul(Pe,it)|0,S=S+Math.imul(Ce,Re)|0,v=v+Math.imul(Ce,lt)|0,v=v+Math.imul(Xe,Re)|0,x=x+Math.imul(Xe,lt)|0,S=S+Math.imul(ge,Le)|0,v=v+Math.imul(ge,ut)|0,v=v+Math.imul(ke,Le)|0,x=x+Math.imul(ke,ut)|0,S=S+Math.imul(re,Ue)|0,v=v+Math.imul(re,st)|0,v=v+Math.imul(le,Ue)|0,x=x+Math.imul(le,st)|0,S=S+Math.imul(k,qe)|0,v=v+Math.imul(k,dt)|0,v=v+Math.imul(E,qe)|0,x=x+Math.imul(E,dt)|0,S=S+Math.imul(Z,at)|0,v=v+Math.imul(Z,Ht)|0,v=v+Math.imul(H,at)|0,x=x+Math.imul(H,Ht)|0;var Dn=(D+S|0)+((v&8191)<<13)|0;D=(x+(v>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,S=Math.imul(we,Je),v=Math.imul(we,Pt),v=v+Math.imul(He,Je)|0,x=Math.imul(He,Pt),S=S+Math.imul(me,Ze)|0,v=v+Math.imul(me,rt)|0,v=v+Math.imul(Me,Ze)|0,x=x+Math.imul(Me,rt)|0,S=S+Math.imul(ye,$e)|0,v=v+Math.imul(ye,it)|0,v=v+Math.imul(Ie,$e)|0,x=x+Math.imul(Ie,it)|0,S=S+Math.imul(be,Re)|0,v=v+Math.imul(be,lt)|0,v=v+Math.imul(Pe,Re)|0,x=x+Math.imul(Pe,lt)|0,S=S+Math.imul(Ce,Le)|0,v=v+Math.imul(Ce,ut)|0,v=v+Math.imul(Xe,Le)|0,x=x+Math.imul(Xe,ut)|0,S=S+Math.imul(ge,Ue)|0,v=v+Math.imul(ge,st)|0,v=v+Math.imul(ke,Ue)|0,x=x+Math.imul(ke,st)|0,S=S+Math.imul(re,qe)|0,v=v+Math.imul(re,dt)|0,v=v+Math.imul(le,qe)|0,x=x+Math.imul(le,dt)|0,S=S+Math.imul(k,at)|0,v=v+Math.imul(k,Ht)|0,v=v+Math.imul(E,at)|0,x=x+Math.imul(E,Ht)|0;var On=(D+S|0)+((v&8191)<<13)|0;D=(x+(v>>>13)|0)+(On>>>26)|0,On&=67108863,S=Math.imul(we,Ze),v=Math.imul(we,rt),v=v+Math.imul(He,Ze)|0,x=Math.imul(He,rt),S=S+Math.imul(me,$e)|0,v=v+Math.imul(me,it)|0,v=v+Math.imul(Me,$e)|0,x=x+Math.imul(Me,it)|0,S=S+Math.imul(ye,Re)|0,v=v+Math.imul(ye,lt)|0,v=v+Math.imul(Ie,Re)|0,x=x+Math.imul(Ie,lt)|0,S=S+Math.imul(be,Le)|0,v=v+Math.imul(be,ut)|0,v=v+Math.imul(Pe,Le)|0,x=x+Math.imul(Pe,ut)|0,S=S+Math.imul(Ce,Ue)|0,v=v+Math.imul(Ce,st)|0,v=v+Math.imul(Xe,Ue)|0,x=x+Math.imul(Xe,st)|0,S=S+Math.imul(ge,qe)|0,v=v+Math.imul(ge,dt)|0,v=v+Math.imul(ke,qe)|0,x=x+Math.imul(ke,dt)|0,S=S+Math.imul(re,at)|0,v=v+Math.imul(re,Ht)|0,v=v+Math.imul(le,at)|0,x=x+Math.imul(le,Ht)|0;var Si=(D+S|0)+((v&8191)<<13)|0;D=(x+(v>>>13)|0)+(Si>>>26)|0,Si&=67108863,S=Math.imul(we,$e),v=Math.imul(we,it),v=v+Math.imul(He,$e)|0,x=Math.imul(He,it),S=S+Math.imul(me,Re)|0,v=v+Math.imul(me,lt)|0,v=v+Math.imul(Me,Re)|0,x=x+Math.imul(Me,lt)|0,S=S+Math.imul(ye,Le)|0,v=v+Math.imul(ye,ut)|0,v=v+Math.imul(Ie,Le)|0,x=x+Math.imul(Ie,ut)|0,S=S+Math.imul(be,Ue)|0,v=v+Math.imul(be,st)|0,v=v+Math.imul(Pe,Ue)|0,x=x+Math.imul(Pe,st)|0,S=S+Math.imul(Ce,qe)|0,v=v+Math.imul(Ce,dt)|0,v=v+Math.imul(Xe,qe)|0,x=x+Math.imul(Xe,dt)|0,S=S+Math.imul(ge,at)|0,v=v+Math.imul(ge,Ht)|0,v=v+Math.imul(ke,at)|0,x=x+Math.imul(ke,Ht)|0;var fn=(D+S|0)+((v&8191)<<13)|0;D=(x+(v>>>13)|0)+(fn>>>26)|0,fn&=67108863,S=Math.imul(we,Re),v=Math.imul(we,lt),v=v+Math.imul(He,Re)|0,x=Math.imul(He,lt),S=S+Math.imul(me,Le)|0,v=v+Math.imul(me,ut)|0,v=v+Math.imul(Me,Le)|0,x=x+Math.imul(Me,ut)|0,S=S+Math.imul(ye,Ue)|0,v=v+Math.imul(ye,st)|0,v=v+Math.imul(Ie,Ue)|0,x=x+Math.imul(Ie,st)|0,S=S+Math.imul(be,qe)|0,v=v+Math.imul(be,dt)|0,v=v+Math.imul(Pe,qe)|0,x=x+Math.imul(Pe,dt)|0,S=S+Math.imul(Ce,at)|0,v=v+Math.imul(Ce,Ht)|0,v=v+Math.imul(Xe,at)|0,x=x+Math.imul(Xe,Ht)|0;var ln=(D+S|0)+((v&8191)<<13)|0;D=(x+(v>>>13)|0)+(ln>>>26)|0,ln&=67108863,S=Math.imul(we,Le),v=Math.imul(we,ut),v=v+Math.imul(He,Le)|0,x=Math.imul(He,ut),S=S+Math.imul(me,Ue)|0,v=v+Math.imul(me,st)|0,v=v+Math.imul(Me,Ue)|0,x=x+Math.imul(Me,st)|0,S=S+Math.imul(ye,qe)|0,v=v+Math.imul(ye,dt)|0,v=v+Math.imul(Ie,qe)|0,x=x+Math.imul(Ie,dt)|0,S=S+Math.imul(be,at)|0,v=v+Math.imul(be,Ht)|0,v=v+Math.imul(Pe,at)|0,x=x+Math.imul(Pe,Ht)|0;var Cr=(D+S|0)+((v&8191)<<13)|0;D=(x+(v>>>13)|0)+(Cr>>>26)|0,Cr&=67108863,S=Math.imul(we,Ue),v=Math.imul(we,st),v=v+Math.imul(He,Ue)|0,x=Math.imul(He,st),S=S+Math.imul(me,qe)|0,v=v+Math.imul(me,dt)|0,v=v+Math.imul(Me,qe)|0,x=x+Math.imul(Me,dt)|0,S=S+Math.imul(ye,at)|0,v=v+Math.imul(ye,Ht)|0,v=v+Math.imul(Ie,at)|0,x=x+Math.imul(Ie,Ht)|0;var Rn=(D+S|0)+((v&8191)<<13)|0;D=(x+(v>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,S=Math.imul(we,qe),v=Math.imul(we,dt),v=v+Math.imul(He,qe)|0,x=Math.imul(He,dt),S=S+Math.imul(me,at)|0,v=v+Math.imul(me,Ht)|0,v=v+Math.imul(Me,at)|0,x=x+Math.imul(Me,Ht)|0;var Tn=(D+S|0)+((v&8191)<<13)|0;D=(x+(v>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,S=Math.imul(we,at),v=Math.imul(we,Ht),v=v+Math.imul(He,at)|0,x=Math.imul(He,Ht);var Nn=(D+S|0)+((v&8191)<<13)|0;return D=(x+(v>>>13)|0)+(Nn>>>26)|0,Nn&=67108863,C[0]=_t,C[1]=qt,C[2]=Zr,C[3]=Xr,C[4]=ei,C[5]=ti,C[6]=vr,C[7]=Ei,C[8]=Pn,C[9]=Ai,C[10]=Dn,C[11]=On,C[12]=Si,C[13]=fn,C[14]=ln,C[15]=Cr,C[16]=Rn,C[17]=Tn,C[18]=Nn,D!==0&&(C[19]=D,l.length++),l};Math.imul||($=O);function q(L,b,m){m.negative=b.negative^L.negative,m.length=L.length+b.length;for(var l=0,d=0,y=0;y<m.length-1;y++){var C=d;d=0;for(var D=l&67108863,S=Math.min(y,b.length-1),v=Math.max(0,y-L.length+1);v<=S;v++){var x=y-v,_=L.words[x]|0,N=b.words[v]|0,oe=_*N,R=oe&67108863;C=C+(oe/67108864|0)|0,R=R+D|0,D=R&67108863,C=C+(R>>>26)|0,d+=C>>>26,C&=67108863}m.words[y]=D,l=C,C=d}return l!==0?m.words[y]=l:m.length--,m.strip()}function U(L,b,m){var l=new J;return l.mulp(L,b,m)}s.prototype.mulTo=function(b,m){var l,d=this.length+b.length;return this.length===10&&b.length===10?l=$(this,b,m):d<63?l=O(this,b,m):d<1024?l=q(this,b,m):l=U(this,b,m),l};function J(L,b){this.x=L,this.y=b}J.prototype.makeRBT=function(b){for(var m=new Array(b),l=s.prototype._countBits(b)-1,d=0;d<b;d++)m[d]=this.revBin(d,l,b);return m},J.prototype.revBin=function(b,m,l){if(b===0||b===l-1)return b;for(var d=0,y=0;y<m;y++)d|=(b&1)<<m-y-1,b>>=1;return d},J.prototype.permute=function(b,m,l,d,y,C){for(var D=0;D<C;D++)d[D]=m[b[D]],y[D]=l[b[D]]},J.prototype.transform=function(b,m,l,d,y,C){this.permute(C,b,m,l,d,y);for(var D=1;D<y;D<<=1)for(var S=D<<1,v=Math.cos(2*Math.PI/S),x=Math.sin(2*Math.PI/S),_=0;_<y;_+=S)for(var N=v,oe=x,R=0;R<D;R++){var Z=l[_+R],H=d[_+R],K=l[_+R+D],k=d[_+R+D],E=N*K-oe*k;k=N*k+oe*K,K=E,l[_+R]=Z+K,d[_+R]=H+k,l[_+R+D]=Z-K,d[_+R+D]=H-k,R!==S&&(E=v*N-x*oe,oe=v*oe+x*N,N=E)}},J.prototype.guessLen13b=function(b,m){var l=Math.max(m,b)|1,d=l&1,y=0;for(l=l/2|0;l;l=l>>>1)y++;return 1<<y+1+d},J.prototype.conjugate=function(b,m,l){if(!(l<=1))for(var d=0;d<l/2;d++){var y=b[d];b[d]=b[l-d-1],b[l-d-1]=y,y=m[d],m[d]=-m[l-d-1],m[l-d-1]=-y}},J.prototype.normalize13b=function(b,m){for(var l=0,d=0;d<m/2;d++){var y=Math.round(b[2*d+1]/m)*8192+Math.round(b[2*d]/m)+l;b[d]=y&67108863,y<67108864?l=0:l=y/67108864|0}return b},J.prototype.convert13b=function(b,m,l,d){for(var y=0,C=0;C<m;C++)y=y+(b[C]|0),l[2*C]=y&8191,y=y>>>13,l[2*C+1]=y&8191,y=y>>>13;for(C=2*m;C<d;++C)l[C]=0;i(y===0),i((y&-8192)===0)},J.prototype.stub=function(b){for(var m=new Array(b),l=0;l<b;l++)m[l]=0;return m},J.prototype.mulp=function(b,m,l){var d=2*this.guessLen13b(b.length,m.length),y=this.makeRBT(d),C=this.stub(d),D=new Array(d),S=new Array(d),v=new Array(d),x=new Array(d),_=new Array(d),N=new Array(d),oe=l.words;oe.length=d,this.convert13b(b.words,b.length,D,d),this.convert13b(m.words,m.length,x,d),this.transform(D,C,S,v,d,y),this.transform(x,C,_,N,d,y);for(var R=0;R<d;R++){var Z=S[R]*_[R]-v[R]*N[R];v[R]=S[R]*N[R]+v[R]*_[R],S[R]=Z}return this.conjugate(S,v,d),this.transform(S,v,oe,C,d,y),this.conjugate(oe,C,d),this.normalize13b(oe,d),l.negative=b.negative^m.negative,l.length=b.length+m.length,l.strip()},s.prototype.mul=function(b){var m=new s(null);return m.words=new Array(this.length+b.length),this.mulTo(b,m)},s.prototype.mulf=function(b){var m=new s(null);return m.words=new Array(this.length+b.length),U(this,b,m)},s.prototype.imul=function(b){return this.clone().mulTo(b,this)},s.prototype.imuln=function(b){i(typeof b=="number"),i(b<67108864);for(var m=0,l=0;l<this.length;l++){var d=(this.words[l]|0)*b,y=(d&67108863)+(m&67108863);m>>=26,m+=d/67108864|0,m+=y>>>26,this.words[l]=y&67108863}return m!==0&&(this.words[l]=m,this.length++),this},s.prototype.muln=function(b){return this.clone().imuln(b)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(b){var m=P(b);if(m.length===0)return new s(1);for(var l=this,d=0;d<m.length&&m[d]===0;d++,l=l.sqr());if(++d<m.length)for(var y=l.sqr();d<m.length;d++,y=y.sqr())m[d]!==0&&(l=l.mul(y));return l},s.prototype.iushln=function(b){i(typeof b=="number"&&b>=0);var m=b%26,l=(b-m)/26,d=67108863>>>26-m<<26-m,y;if(m!==0){var C=0;for(y=0;y<this.length;y++){var D=this.words[y]&d,S=(this.words[y]|0)-D<<m;this.words[y]=S|C,C=D>>>26-m}C&&(this.words[y]=C,this.length++)}if(l!==0){for(y=this.length-1;y>=0;y--)this.words[y+l]=this.words[y];for(y=0;y<l;y++)this.words[y]=0;this.length+=l}return this.strip()},s.prototype.ishln=function(b){return i(this.negative===0),this.iushln(b)},s.prototype.iushrn=function(b,m,l){i(typeof b=="number"&&b>=0);var d;m?d=(m-m%26)/26:d=0;var y=b%26,C=Math.min((b-y)/26,this.length),D=67108863^67108863>>>y<<y,S=l;if(d-=C,d=Math.max(0,d),S){for(var v=0;v<C;v++)S.words[v]=this.words[v];S.length=C}if(C!==0)if(this.length>C)for(this.length-=C,v=0;v<this.length;v++)this.words[v]=this.words[v+C];else this.words[0]=0,this.length=1;var x=0;for(v=this.length-1;v>=0&&(x!==0||v>=d);v--){var _=this.words[v]|0;this.words[v]=x<<26-y|_>>>y,x=_&D}return S&&x!==0&&(S.words[S.length++]=x),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(b,m,l){return i(this.negative===0),this.iushrn(b,m,l)},s.prototype.shln=function(b){return this.clone().ishln(b)},s.prototype.ushln=function(b){return this.clone().iushln(b)},s.prototype.shrn=function(b){return this.clone().ishrn(b)},s.prototype.ushrn=function(b){return this.clone().iushrn(b)},s.prototype.testn=function(b){i(typeof b=="number"&&b>=0);var m=b%26,l=(b-m)/26,d=1<<m;if(this.length<=l)return!1;var y=this.words[l];return!!(y&d)},s.prototype.imaskn=function(b){i(typeof b=="number"&&b>=0);var m=b%26,l=(b-m)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=l)return this;if(m!==0&&l++,this.length=Math.min(l,this.length),m!==0){var d=67108863^67108863>>>m<<m;this.words[this.length-1]&=d}return this.strip()},s.prototype.maskn=function(b){return this.clone().imaskn(b)},s.prototype.iaddn=function(b){return i(typeof b=="number"),i(b<67108864),b<0?this.isubn(-b):this.negative!==0?this.length===1&&(this.words[0]|0)<b?(this.words[0]=b-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(b),this.negative=1,this):this._iaddn(b)},s.prototype._iaddn=function(b){this.words[0]+=b;for(var m=0;m<this.length&&this.words[m]>=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},s.prototype.isubn=function(b){if(i(typeof b=="number"),i(b<67108864),b<0)return this.iaddn(-b);if(this.negative!==0)return this.negative=0,this.iaddn(b),this.negative=1,this;if(this.words[0]-=b,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m<this.length&&this.words[m]<0;m++)this.words[m]+=67108864,this.words[m+1]-=1;return this.strip()},s.prototype.addn=function(b){return this.clone().iaddn(b)},s.prototype.subn=function(b){return this.clone().isubn(b)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(b,m,l){var d=b.length+l,y;this._expand(d);var C,D=0;for(y=0;y<b.length;y++){C=(this.words[y+l]|0)+D;var S=(b.words[y]|0)*m;C-=S&67108863,D=(C>>26)-(S/67108864|0),this.words[y+l]=C&67108863}for(;y<this.length-l;y++)C=(this.words[y+l]|0)+D,D=C>>26,this.words[y+l]=C&67108863;if(D===0)return this.strip();for(i(D===-1),D=0,y=0;y<this.length;y++)C=-(this.words[y]|0)+D,D=C>>26,this.words[y]=C&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(b,m){var l=this.length-b.length,d=this.clone(),y=b,C=y.words[y.length-1]|0,D=this._countBits(C);l=26-D,l!==0&&(y=y.ushln(l),d.iushln(l),C=y.words[y.length-1]|0);var S=d.length-y.length,v;if(m!=="mod"){v=new s(null),v.length=S+1,v.words=new Array(v.length);for(var x=0;x<v.length;x++)v.words[x]=0}var _=d.clone()._ishlnsubmul(y,1,S);_.negative===0&&(d=_,v&&(v.words[S]=1));for(var N=S-1;N>=0;N--){var oe=(d.words[y.length+N]|0)*67108864+(d.words[y.length+N-1]|0);for(oe=Math.min(oe/C|0,67108863),d._ishlnsubmul(y,oe,N);d.negative!==0;)oe--,d.negative=0,d._ishlnsubmul(y,1,N),d.isZero()||(d.negative^=1);v&&(v.words[N]=oe)}return v&&v.strip(),d.strip(),m!=="div"&&l!==0&&d.iushrn(l),{div:v||null,mod:d}},s.prototype.divmod=function(b,m,l){if(i(!b.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var d,y,C;return this.negative!==0&&b.negative===0?(C=this.neg().divmod(b,m),m!=="mod"&&(d=C.div.neg()),m!=="div"&&(y=C.mod.neg(),l&&y.negative!==0&&y.iadd(b)),{div:d,mod:y}):this.negative===0&&b.negative!==0?(C=this.divmod(b.neg(),m),m!=="mod"&&(d=C.div.neg()),{div:d,mod:C.mod}):this.negative&b.negative?(C=this.neg().divmod(b.neg(),m),m!=="div"&&(y=C.mod.neg(),l&&y.negative!==0&&y.isub(b)),{div:C.div,mod:y}):b.length>this.length||this.cmp(b)<0?{div:new s(0),mod:this}:b.length===1?m==="div"?{div:this.divn(b.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modn(b.words[0]))}:{div:this.divn(b.words[0]),mod:new s(this.modn(b.words[0]))}:this._wordDiv(b,m)},s.prototype.div=function(b){return this.divmod(b,"div",!1).div},s.prototype.mod=function(b){return this.divmod(b,"mod",!1).mod},s.prototype.umod=function(b){return this.divmod(b,"mod",!0).mod},s.prototype.divRound=function(b){var m=this.divmod(b);if(m.mod.isZero())return m.div;var l=m.div.negative!==0?m.mod.isub(b):m.mod,d=b.ushrn(1),y=b.andln(1),C=l.cmp(d);return C<0||y===1&&C===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},s.prototype.modn=function(b){i(b<=67108863);for(var m=(1<<26)%b,l=0,d=this.length-1;d>=0;d--)l=(m*l+(this.words[d]|0))%b;return l},s.prototype.idivn=function(b){i(b<=67108863);for(var m=0,l=this.length-1;l>=0;l--){var d=(this.words[l]|0)+m*67108864;this.words[l]=d/b|0,m=d%b}return this.strip()},s.prototype.divn=function(b){return this.clone().idivn(b)},s.prototype.egcd=function(b){i(b.negative===0),i(!b.isZero());var m=this,l=b.clone();m.negative!==0?m=m.umod(b):m=m.clone();for(var d=new s(1),y=new s(0),C=new s(0),D=new s(1),S=0;m.isEven()&&l.isEven();)m.iushrn(1),l.iushrn(1),++S;for(var v=l.clone(),x=m.clone();!m.isZero();){for(var _=0,N=1;!(m.words[0]&N)&&_<26;++_,N<<=1);if(_>0)for(m.iushrn(_);_-- >0;)(d.isOdd()||y.isOdd())&&(d.iadd(v),y.isub(x)),d.iushrn(1),y.iushrn(1);for(var oe=0,R=1;!(l.words[0]&R)&&oe<26;++oe,R<<=1);if(oe>0)for(l.iushrn(oe);oe-- >0;)(C.isOdd()||D.isOdd())&&(C.iadd(v),D.isub(x)),C.iushrn(1),D.iushrn(1);m.cmp(l)>=0?(m.isub(l),d.isub(C),y.isub(D)):(l.isub(m),C.isub(d),D.isub(y))}return{a:C,b:D,gcd:l.iushln(S)}},s.prototype._invmp=function(b){i(b.negative===0),i(!b.isZero());var m=this,l=b.clone();m.negative!==0?m=m.umod(b):m=m.clone();for(var d=new s(1),y=new s(0),C=l.clone();m.cmpn(1)>0&&l.cmpn(1)>0;){for(var D=0,S=1;!(m.words[0]&S)&&D<26;++D,S<<=1);if(D>0)for(m.iushrn(D);D-- >0;)d.isOdd()&&d.iadd(C),d.iushrn(1);for(var v=0,x=1;!(l.words[0]&x)&&v<26;++v,x<<=1);if(v>0)for(l.iushrn(v);v-- >0;)y.isOdd()&&y.iadd(C),y.iushrn(1);m.cmp(l)>=0?(m.isub(l),d.isub(y)):(l.isub(m),y.isub(d))}var _;return m.cmpn(1)===0?_=d:_=y,_.cmpn(0)<0&&_.iadd(b),_},s.prototype.gcd=function(b){if(this.isZero())return b.abs();if(b.isZero())return this.abs();var m=this.clone(),l=b.clone();m.negative=0,l.negative=0;for(var d=0;m.isEven()&&l.isEven();d++)m.iushrn(1),l.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;l.isEven();)l.iushrn(1);var y=m.cmp(l);if(y<0){var C=m;m=l,l=C}else if(y===0||l.cmpn(1)===0)break;m.isub(l)}while(!0);return l.iushln(d)},s.prototype.invm=function(b){return this.egcd(b).a.umod(b)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(b){return this.words[0]&b},s.prototype.bincn=function(b){i(typeof b=="number");var m=b%26,l=(b-m)/26,d=1<<m;if(this.length<=l)return this._expand(l+1),this.words[l]|=d,this;for(var y=d,C=l;y!==0&&C<this.length;C++){var D=this.words[C]|0;D+=y,y=D>>>26,D&=67108863,this.words[C]=D}return y!==0&&(this.words[C]=y,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(b){var m=b<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this.strip();var l;if(this.length>1)l=1;else{m&&(b=-b),i(b<=67108863,"Number is too big");var d=this.words[0]|0;l=d===b?0:d<b?-1:1}return this.negative!==0?-l|0:l},s.prototype.cmp=function(b){if(this.negative!==0&&b.negative===0)return-1;if(this.negative===0&&b.negative!==0)return 1;var m=this.ucmp(b);return this.negative!==0?-m|0:m},s.prototype.ucmp=function(b){if(this.length>b.length)return 1;if(this.length<b.length)return-1;for(var m=0,l=this.length-1;l>=0;l--){var d=this.words[l]|0,y=b.words[l]|0;if(d!==y){d<y?m=-1:d>y&&(m=1);break}}return m},s.prototype.gtn=function(b){return this.cmpn(b)===1},s.prototype.gt=function(b){return this.cmp(b)===1},s.prototype.gten=function(b){return this.cmpn(b)>=0},s.prototype.gte=function(b){return this.cmp(b)>=0},s.prototype.ltn=function(b){return this.cmpn(b)===-1},s.prototype.lt=function(b){return this.cmp(b)===-1},s.prototype.lten=function(b){return this.cmpn(b)<=0},s.prototype.lte=function(b){return this.cmp(b)<=0},s.prototype.eqn=function(b){return this.cmpn(b)===0},s.prototype.eq=function(b){return this.cmp(b)===0},s.red=function(b){return new te(b)},s.prototype.toRed=function(b){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),b.convertTo(this)._forceRed(b)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(b){return this.red=b,this},s.prototype.forceRed=function(b){return i(!this.red,"Already a number in reduction context"),this._forceRed(b)},s.prototype.redAdd=function(b){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,b)},s.prototype.redIAdd=function(b){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,b)},s.prototype.redSub=function(b){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,b)},s.prototype.redISub=function(b){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,b)},s.prototype.redShl=function(b){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,b)},s.prototype.redMul=function(b){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,b),this.red.mul(this,b)},s.prototype.redIMul=function(b){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,b),this.red.imul(this,b)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(b){return i(this.red&&!b.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,b)};var ee={k256:null,p224:null,p192:null,p25519:null};function W(L,b){this.name=L,this.p=new s(b,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}W.prototype._tmp=function(){var b=new s(null);return b.words=new Array(Math.ceil(this.n/13)),b},W.prototype.ireduce=function(b){var m=b,l;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),l=m.bitLength();while(l>this.n);var d=l<this.n?-1:m.ucmp(this.p);return d===0?(m.words[0]=0,m.length=1):d>0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},W.prototype.split=function(b,m){b.iushrn(this.n,0,m)},W.prototype.imulK=function(b){return b.imul(this.k)};function G(){W.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(G,W),G.prototype.split=function(b,m){for(var l=4194303,d=Math.min(b.length,9),y=0;y<d;y++)m.words[y]=b.words[y];if(m.length=d,b.length<=9){b.words[0]=0,b.length=1;return}var C=b.words[9];for(m.words[m.length++]=C&l,y=10;y<b.length;y++){var D=b.words[y]|0;b.words[y-10]=(D&l)<<4|C>>>22,C=D}C>>>=22,b.words[y-10]=C,C===0&&b.length>10?b.length-=10:b.length-=9},G.prototype.imulK=function(b){b.words[b.length]=0,b.words[b.length+1]=0,b.length+=2;for(var m=0,l=0;l<b.length;l++){var d=b.words[l]|0;m+=d*977,b.words[l]=m&67108863,m=d*64+(m/67108864|0)}return b.words[b.length-1]===0&&(b.length--,b.words[b.length-1]===0&&b.length--),b};function Q(){W.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(Q,W);function A(){W.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(A,W);function z(){W.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(z,W),z.prototype.imulK=function(b){for(var m=0,l=0;l<b.length;l++){var d=(b.words[l]|0)*19+m,y=d&67108863;d>>>=26,b.words[l]=y,m=d}return m!==0&&(b.words[b.length++]=m),b},s._prime=function(b){if(ee[b])return ee[b];var m;if(b==="k256")m=new G;else if(b==="p224")m=new Q;else if(b==="p192")m=new A;else if(b==="p25519")m=new z;else throw new Error("Unknown prime "+b);return ee[b]=m,m};function te(L){if(typeof L=="string"){var b=s._prime(L);this.m=b.p,this.prime=b}else i(L.gtn(1),"modulus must be greater than 1"),this.m=L,this.prime=null}te.prototype._verify1=function(b){i(b.negative===0,"red works only with positives"),i(b.red,"red works only with red numbers")},te.prototype._verify2=function(b,m){i((b.negative|m.negative)===0,"red works only with positives"),i(b.red&&b.red===m.red,"red works only with red numbers")},te.prototype.imod=function(b){return this.prime?this.prime.ireduce(b)._forceRed(this):b.umod(this.m)._forceRed(this)},te.prototype.neg=function(b){return b.isZero()?b.clone():this.m.sub(b)._forceRed(this)},te.prototype.add=function(b,m){this._verify2(b,m);var l=b.add(m);return l.cmp(this.m)>=0&&l.isub(this.m),l._forceRed(this)},te.prototype.iadd=function(b,m){this._verify2(b,m);var l=b.iadd(m);return l.cmp(this.m)>=0&&l.isub(this.m),l},te.prototype.sub=function(b,m){this._verify2(b,m);var l=b.sub(m);return l.cmpn(0)<0&&l.iadd(this.m),l._forceRed(this)},te.prototype.isub=function(b,m){this._verify2(b,m);var l=b.isub(m);return l.cmpn(0)<0&&l.iadd(this.m),l},te.prototype.shl=function(b,m){return this._verify1(b),this.imod(b.ushln(m))},te.prototype.imul=function(b,m){return this._verify2(b,m),this.imod(b.imul(m))},te.prototype.mul=function(b,m){return this._verify2(b,m),this.imod(b.mul(m))},te.prototype.isqr=function(b){return this.imul(b,b.clone())},te.prototype.sqr=function(b){return this.mul(b,b)},te.prototype.sqrt=function(b){if(b.isZero())return b.clone();var m=this.m.andln(3);if(i(m%2===1),m===3){var l=this.m.add(new s(1)).iushrn(2);return this.pow(b,l)}for(var d=this.m.subn(1),y=0;!d.isZero()&&d.andln(1)===0;)y++,d.iushrn(1);i(!d.isZero());var C=new s(1).toRed(this),D=C.redNeg(),S=this.m.subn(1).iushrn(1),v=this.m.bitLength();for(v=new s(2*v*v).toRed(this);this.pow(v,S).cmp(D)!==0;)v.redIAdd(D);for(var x=this.pow(v,d),_=this.pow(b,d.addn(1).iushrn(1)),N=this.pow(b,d),oe=y;N.cmp(C)!==0;){for(var R=N,Z=0;R.cmp(C)!==0;Z++)R=R.redSqr();i(Z<oe);var H=this.pow(x,new s(1).iushln(oe-Z-1));_=_.redMul(H),x=H.redSqr(),N=N.redMul(x),oe=Z}return _},te.prototype.invm=function(b){var m=b._invmp(this.m);return m.negative!==0?(m.negative=0,this.imod(m).redNeg()):this.imod(m)},te.prototype.pow=function(b,m){if(m.isZero())return new s(1).toRed(this);if(m.cmpn(1)===0)return b.clone();var l=4,d=new Array(1<<l);d[0]=new s(1).toRed(this),d[1]=b;for(var y=2;y<d.length;y++)d[y]=this.mul(d[y-1],b);var C=d[0],D=0,S=0,v=m.bitLength()%26;for(v===0&&(v=26),y=m.length-1;y>=0;y--){for(var x=m.words[y],_=v-1;_>=0;_--){var N=x>>_&1;if(C!==d[0]&&(C=this.sqr(C)),N===0&&D===0){S=0;continue}D<<=1,D|=N,S++,!(S!==l&&(y!==0||_!==0))&&(C=this.mul(C,d[D]),S=0,D=0)}v=26}return C},te.prototype.convertTo=function(b){var m=b.umod(this.m);return m===b?m.clone():m},te.prototype.convertFrom=function(b){var m=b.clone();return m.red=null,m},s.mont=function(b){return new ae(b)};function ae(L){te.call(this,L),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(ae,te),ae.prototype.convertTo=function(b){return this.imod(b.ushln(this.shift))},ae.prototype.convertFrom=function(b){var m=this.imod(b.mul(this.rinv));return m.red=null,m},ae.prototype.imul=function(b,m){if(b.isZero()||m.isZero())return b.words[0]=0,b.length=1,b;var l=b.imul(m),d=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=l.isub(d).iushrn(this.shift),C=y;return y.cmp(this.m)>=0?C=y.isub(this.m):y.cmpn(0)<0&&(C=y.iadd(this.m)),C._forceRed(this)},ae.prototype.mul=function(b,m){if(b.isZero()||m.isZero())return new s(0)._forceRed(this);var l=b.mul(m),d=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=l.isub(d).iushrn(this.shift),C=y;return y.cmp(this.m)>=0?C=y.isub(this.m):y.cmpn(0)<0&&(C=y.iadd(this.m)),C._forceRed(this)},ae.prototype.invm=function(b){var m=this.imod(b._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(r,fr)})(Yn);var Nd={};(function(r){var e=r;function t(s,a){if(Array.isArray(s))return s.slice();if(!s)return[];var f=[];if(typeof s!="string"){for(var h=0;h<s.length;h++)f[h]=s[h]|0;return f}if(a==="hex"){s=s.replace(/[^a-z0-9]+/ig,""),s.length%2!==0&&(s="0"+s);for(var h=0;h<s.length;h+=2)f.push(parseInt(s[h]+s[h+1],16))}else for(var h=0;h<s.length;h++){var u=s.charCodeAt(h),g=u>>8,w=u&255;g?f.push(g,w):f.push(w)}return f}e.toArray=t;function i(s){return s.length===1?"0"+s:s}e.zero2=i;function n(s){for(var a="",f=0;f<s.length;f++)a+=i(s[f].toString(16));return a}e.toHex=n,e.encode=function(a,f){return f==="hex"?n(a):a}})(Nd),function(r){var e=r,t=Yn.exports,i=So,n=Nd;e.assert=i,e.toArray=n.toArray,e.zero2=n.zero2,e.toHex=n.toHex,e.encode=n.encode;function s(g,w,M){var P=new Array(Math.max(g.bitLength(),M)+1),O;for(O=0;O<P.length;O+=1)P[O]=0;var $=1<<w+1,q=g.clone();for(O=0;O<P.length;O++){var U,J=q.andln($-1);q.isOdd()?(J>($>>1)-1?U=($>>1)-J:U=J,q.isubn(U)):U=0,P[O]=U,q.iushrn(1)}return P}e.getNAF=s;function a(g,w){var M=[[],[]];g=g.clone(),w=w.clone();for(var P=0,O=0,$;g.cmpn(-P)>0||w.cmpn(-O)>0;){var q=g.andln(3)+P&3,U=w.andln(3)+O&3;q===3&&(q=-1),U===3&&(U=-1);var J;q&1?($=g.andln(7)+P&7,($===3||$===5)&&U===2?J=-q:J=q):J=0,M[0].push(J);var ee;U&1?($=w.andln(7)+O&7,($===3||$===5)&&q===2?ee=-U:ee=U):ee=0,M[1].push(ee),2*P===J+1&&(P=1-P),2*O===ee+1&&(O=1-O),g.iushrn(1),w.iushrn(1)}return M}e.getJSF=a;function f(g,w,M){var P="_"+w;g.prototype[w]=function(){return this[P]!==void 0?this[P]:this[P]=M.call(this)}}e.cachedProperty=f;function h(g){return typeof g=="string"?e.toArray(g,"hex"):g}e.parseBytes=h;function u(g){return new t(g,"hex","le")}e.intFromLE=u}(Li);var El={exports:{}},$d;El.exports=function(e){return $d||($d=new js(null)),$d.generate(e)};function js(r){this.rand=r}if(El.exports.Rand=js,js.prototype.generate=function(e){return this._rand(e)},js.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),i=0;i<t.length;i++)t[i]=this.rand.getByte();return t},typeof self=="object")self.crypto&&self.crypto.getRandomValues?js.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?js.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:typeof window=="object"&&(js.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var cm=il;if(typeof cm.randomBytes!="function")throw new Error("Not supported");js.prototype._rand=function(e){return cm.randomBytes(e)}}catch{}var Ld={},Co=Yn.exports,kc=Li,Al=kc.getNAF,B9=kc.getJSF,Sl=kc.assert;function Ws(r,e){this.type=r,this.p=new Co(e.p,16),this.red=e.prime?Co.red(e.prime):Co.mont(this.p),this.zero=new Co(0).toRed(this.red),this.one=new Co(1).toRed(this.red),this.two=new Co(2).toRed(this.red),this.n=e.n&&new Co(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Il=Ws;Ws.prototype.point=function(){throw new Error("Not implemented")},Ws.prototype.validate=function(){throw new Error("Not implemented")},Ws.prototype._fixedNafMul=function(e,t){Sl(e.precomputed);var i=e._getDoubles(),n=Al(t,1,this._bitLength),s=(1<<i.step+1)-(i.step%2===0?2:1);s/=3;var a=[],f,h;for(f=0;f<n.length;f+=i.step){h=0;for(var u=f+i.step-1;u>=f;u--)h=(h<<1)+n[u];a.push(h)}for(var g=this.jpoint(null,null,null),w=this.jpoint(null,null,null),M=s;M>0;M--){for(f=0;f<a.length;f++)h=a[f],h===M?w=w.mixedAdd(i.points[f]):h===-M&&(w=w.mixedAdd(i.points[f].neg()));g=g.add(w)}return g.toP()},Ws.prototype._wnafMul=function(e,t){var i=4,n=e._getNAFPoints(i);i=n.wnd;for(var s=n.points,a=Al(t,i,this._bitLength),f=this.jpoint(null,null,null),h=a.length-1;h>=0;h--){for(var u=0;h>=0&&a[h]===0;h--)u++;if(h>=0&&u++,f=f.dblp(u),h<0)break;var g=a[h];Sl(g!==0),e.type==="affine"?g>0?f=f.mixedAdd(s[g-1>>1]):f=f.mixedAdd(s[-g-1>>1].neg()):g>0?f=f.add(s[g-1>>1]):f=f.add(s[-g-1>>1].neg())}return e.type==="affine"?f.toP():f},Ws.prototype._wnafMulAdd=function(e,t,i,n,s){var a=this._wnafT1,f=this._wnafT2,h=this._wnafT3,u=0,g,w,M;for(g=0;g<n;g++){M=t[g];var P=M._getNAFPoints(e);a[g]=P.wnd,f[g]=P.points}for(g=n-1;g>=1;g-=2){var O=g-1,$=g;if(a[O]!==1||a[$]!==1){h[O]=Al(i[O],a[O],this._bitLength),h[$]=Al(i[$],a[$],this._bitLength),u=Math.max(h[O].length,u),u=Math.max(h[$].length,u);continue}var q=[t[O],null,null,t[$]];t[O].y.cmp(t[$].y)===0?(q[1]=t[O].add(t[$]),q[2]=t[O].toJ().mixedAdd(t[$].neg())):t[O].y.cmp(t[$].y.redNeg())===0?(q[1]=t[O].toJ().mixedAdd(t[$]),q[2]=t[O].add(t[$].neg())):(q[1]=t[O].toJ().mixedAdd(t[$]),q[2]=t[O].toJ().mixedAdd(t[$].neg()));var U=[-3,-1,-5,-7,0,7,5,1,3],J=B9(i[O],i[$]);for(u=Math.max(J[0].length,u),h[O]=new Array(u),h[$]=new Array(u),w=0;w<u;w++){var ee=J[0][w]|0,W=J[1][w]|0;h[O][w]=U[(ee+1)*3+(W+1)],h[$][w]=0,f[O]=q}}var G=this.jpoint(null,null,null),Q=this._wnafT4;for(g=u;g>=0;g--){for(var A=0;g>=0;){var z=!0;for(w=0;w<n;w++)Q[w]=h[w][g]|0,Q[w]!==0&&(z=!1);if(!z)break;A++,g--}if(g>=0&&A++,G=G.dblp(A),g<0)break;for(w=0;w<n;w++){var te=Q[w];te!==0&&(te>0?M=f[w][te-1>>1]:te<0&&(M=f[w][-te-1>>1].neg()),M.type==="affine"?G=G.mixedAdd(M):G=G.add(M))}}for(g=0;g<n;g++)f[g]=null;return s?G:G.toP()};function Xi(r,e){this.curve=r,this.type=e,this.precomputed=null}Ws.BasePoint=Xi,Xi.prototype.eq=function(){throw new Error("Not implemented")},Xi.prototype.validate=function(){return this.curve.validate(this)},Ws.prototype.decodePoint=function(e,t){e=kc.toArray(e,t);var i=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*i){e[0]===6?Sl(e[e.length-1]%2===0):e[0]===7&&Sl(e[e.length-1]%2===1);var n=this.point(e.slice(1,1+i),e.slice(1+i,1+2*i));return n}else if((e[0]===2||e[0]===3)&&e.length-1===i)return this.pointFromX(e.slice(1,1+i),e[0]===3);throw new Error("Unknown point format")},Xi.prototype.encodeCompressed=function(e){return this.encode(e,!0)},Xi.prototype._encode=function(e){var t=this.curve.p.byteLength(),i=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(i):[4].concat(i,this.getY().toArray("be",t))},Xi.prototype.encode=function(e,t){return kc.encode(this._encode(t),e)},Xi.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},Xi.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((e.bitLength()+1)/t.step):!1},Xi.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],n=this,s=0;s<t;s+=e){for(var a=0;a<e;a++)n=n.dbl();i.push(n)}return{step:e,points:i}},Xi.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],i=(1<<e)-1,n=i===1?null:this.dbl(),s=1;s<i;s++)t[s]=t[s-1].add(n);return{wnd:e,points:t}},Xi.prototype._getBeta=function(){return null},Xi.prototype.dblp=function(e){for(var t=this,i=0;i<e;i++)t=t.dbl();return t};var U9=Li,dr=Yn.exports,Bd=Sa.exports,Na=Il,F9=U9.assert;function en(r){Na.call(this,"short",r),this.a=new dr(r.a,16).toRed(this.red),this.b=new dr(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Bd(en,Na);var q9=en;en.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,i;if(e.beta)t=new dr(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=n[0].cmp(n[1])<0?n[0]:n[1],t=t.toRed(this.red)}if(e.lambda)i=new dr(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(t))===0?i=s[0]:(i=s[1],F9(this.g.mul(i).x.cmp(this.g.x.redMul(t))===0))}var a;return e.basis?a=e.basis.map(function(f){return{a:new dr(f.a,16),b:new dr(f.b,16)}}):a=this._getEndoBasis(i),{beta:t,lambda:i,basis:a}}},en.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:dr.mont(e),i=new dr(2).toRed(t).redInvm(),n=i.redNeg(),s=new dr(3).toRed(t).redNeg().redSqrt().redMul(i),a=n.redAdd(s).fromRed(),f=n.redSub(s).fromRed();return[a,f]},en.prototype._getEndoBasis=function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),i=e,n=this.n.clone(),s=new dr(1),a=new dr(0),f=new dr(0),h=new dr(1),u,g,w,M,P,O,$,q=0,U,J;i.cmpn(0)!==0;){var ee=n.div(i);U=n.sub(ee.mul(i)),J=f.sub(ee.mul(s));var W=h.sub(ee.mul(a));if(!w&&U.cmp(t)<0)u=$.neg(),g=s,w=U.neg(),M=J;else if(w&&++q===2)break;$=U,n=i,i=U,f=s,s=J,h=a,a=W}P=U.neg(),O=J;var G=w.sqr().add(M.sqr()),Q=P.sqr().add(O.sqr());return Q.cmp(G)>=0&&(P=u,O=g),w.negative&&(w=w.neg(),M=M.neg()),P.negative&&(P=P.neg(),O=O.neg()),[{a:w,b:M},{a:P,b:O}]},en.prototype._endoSplit=function(e){var t=this.endo.basis,i=t[0],n=t[1],s=n.b.mul(e).divRound(this.n),a=i.b.neg().mul(e).divRound(this.n),f=s.mul(i.a),h=a.mul(n.a),u=s.mul(i.b),g=a.mul(n.b),w=e.sub(f).sub(h),M=u.add(g).neg();return{k1:w,k2:M}},en.prototype.pointFromX=function(e,t){e=new dr(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=i.redSqrt();if(n.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var s=n.fromRed().isOdd();return(t&&!s||!t&&s)&&(n=n.redNeg()),this.point(e,n)},en.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,i=e.y,n=this.a.redMul(t),s=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return i.redSqr().redISub(s).cmpn(0)===0},en.prototype._endoWnafMulAdd=function(e,t,i){for(var n=this._endoWnafT1,s=this._endoWnafT2,a=0;a<e.length;a++){var f=this._endoSplit(t[a]),h=e[a],u=h._getBeta();f.k1.negative&&(f.k1.ineg(),h=h.neg(!0)),f.k2.negative&&(f.k2.ineg(),u=u.neg(!0)),n[a*2]=h,n[a*2+1]=u,s[a*2]=f.k1,s[a*2+1]=f.k2}for(var g=this._wnafMulAdd(1,n,s,a*2,i),w=0;w<a*2;w++)n[w]=null,s[w]=null;return g};function Rr(r,e,t,i){Na.BasePoint.call(this,r,"affine"),e===null&&t===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new dr(e,16),this.y=new dr(t,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}Bd(Rr,Na.BasePoint),en.prototype.point=function(e,t,i){return new Rr(this,e,t,i)},en.prototype.pointFromJSON=function(e,t){return Rr.fromJSON(this,e,t)},Rr.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var i=this.curve,n=function(s){return i.point(s.x.redMul(i.endo.beta),s.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},Rr.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Rr.fromJSON=function(e,t,i){typeof t=="string"&&(t=JSON.parse(t));var n=e.point(t[0],t[1],i);if(!t[2])return n;function s(f){return e.point(f[0],f[1],i)}var a=t[2];return n.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[n].concat(a.doubles.points.map(s))},naf:a.naf&&{wnd:a.naf.wnd,points:[n].concat(a.naf.points.map(s))}},n},Rr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Rr.prototype.isInfinity=function(){return this.inf},Rr.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var i=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)},Rr.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,i=this.x.redSqr(),n=e.redInvm(),s=i.redAdd(i).redIAdd(i).redIAdd(t).redMul(n),a=s.redSqr().redISub(this.x.redAdd(this.x)),f=s.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,f)},Rr.prototype.getX=function(){return this.x.fromRed()},Rr.prototype.getY=function(){return this.y.fromRed()},Rr.prototype.mul=function(e){return e=new dr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Rr.prototype.mulAdd=function(e,t,i){var n=[this,t],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s):this.curve._wnafMulAdd(1,n,s,2)},Rr.prototype.jmulAdd=function(e,t,i){var n=[this,t],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s,!0):this.curve._wnafMulAdd(1,n,s,2,!0)},Rr.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Rr.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,n=function(s){return s.neg()};t.precomputed={naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(n)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(n)}}}return t},Rr.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Wr(r,e,t,i){Na.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new dr(0)):(this.x=new dr(e,16),this.y=new dr(t,16),this.z=new dr(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Bd(Wr,Na.BasePoint),en.prototype.jpoint=function(e,t,i){return new Wr(this,e,t,i)},Wr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),i=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(i,n)},Wr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Wr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),i=this.z.redSqr(),n=this.x.redMul(t),s=e.x.redMul(i),a=this.y.redMul(t.redMul(e.z)),f=e.y.redMul(i.redMul(this.z)),h=n.redSub(s),u=a.redSub(f);if(h.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var g=h.redSqr(),w=g.redMul(h),M=n.redMul(g),P=u.redSqr().redIAdd(w).redISub(M).redISub(M),O=u.redMul(M.redISub(P)).redISub(a.redMul(w)),$=this.z.redMul(e.z).redMul(h);return this.curve.jpoint(P,O,$)},Wr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),i=this.x,n=e.x.redMul(t),s=this.y,a=e.y.redMul(t).redMul(this.z),f=i.redSub(n),h=s.redSub(a);if(f.cmpn(0)===0)return h.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=f.redSqr(),g=u.redMul(f),w=i.redMul(u),M=h.redSqr().redIAdd(g).redISub(w).redISub(w),P=h.redMul(w.redISub(M)).redISub(s.redMul(g)),O=this.z.redMul(f);return this.curve.jpoint(M,P,O)},Wr.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var i=this;for(t=0;t<e;t++)i=i.dbl();return i}var n=this.curve.a,s=this.curve.tinv,a=this.x,f=this.y,h=this.z,u=h.redSqr().redSqr(),g=f.redAdd(f);for(t=0;t<e;t++){var w=a.redSqr(),M=g.redSqr(),P=M.redSqr(),O=w.redAdd(w).redIAdd(w).redIAdd(n.redMul(u)),$=a.redMul(M),q=O.redSqr().redISub($.redAdd($)),U=$.redISub(q),J=O.redMul(U);J=J.redIAdd(J).redISub(P);var ee=g.redMul(h);t+1<e&&(u=u.redMul(P)),a=q,h=ee,g=J}return this.curve.jpoint(a,g.redMul(s),h)},Wr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},Wr.prototype._zeroDbl=function(){var e,t,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),f=this.x.redAdd(s).redSqr().redISub(n).redISub(a);f=f.redIAdd(f);var h=n.redAdd(n).redIAdd(n),u=h.redSqr().redISub(f).redISub(f),g=a.redIAdd(a);g=g.redIAdd(g),g=g.redIAdd(g),e=u,t=h.redMul(f.redISub(u)).redISub(g),i=this.y.redAdd(this.y)}else{var w=this.x.redSqr(),M=this.y.redSqr(),P=M.redSqr(),O=this.x.redAdd(M).redSqr().redISub(w).redISub(P);O=O.redIAdd(O);var $=w.redAdd(w).redIAdd(w),q=$.redSqr(),U=P.redIAdd(P);U=U.redIAdd(U),U=U.redIAdd(U),e=q.redISub(O).redISub(O),t=$.redMul(O.redISub(e)).redISub(U),i=this.y.redMul(this.z),i=i.redIAdd(i)}return this.curve.jpoint(e,t,i)},Wr.prototype._threeDbl=function(){var e,t,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),f=this.x.redAdd(s).redSqr().redISub(n).redISub(a);f=f.redIAdd(f);var h=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=h.redSqr().redISub(f).redISub(f);e=u;var g=a.redIAdd(a);g=g.redIAdd(g),g=g.redIAdd(g),t=h.redMul(f.redISub(u)).redISub(g),i=this.y.redAdd(this.y)}else{var w=this.z.redSqr(),M=this.y.redSqr(),P=this.x.redMul(M),O=this.x.redSub(w).redMul(this.x.redAdd(w));O=O.redAdd(O).redIAdd(O);var $=P.redIAdd(P);$=$.redIAdd($);var q=$.redAdd($);e=O.redSqr().redISub(q),i=this.y.redAdd(this.z).redSqr().redISub(M).redISub(w);var U=M.redSqr();U=U.redIAdd(U),U=U.redIAdd(U),U=U.redIAdd(U),t=O.redMul($.redISub(e)).redISub(U)}return this.curve.jpoint(e,t,i)},Wr.prototype._dbl=function(){var e=this.curve.a,t=this.x,i=this.y,n=this.z,s=n.redSqr().redSqr(),a=t.redSqr(),f=i.redSqr(),h=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(s)),u=t.redAdd(t);u=u.redIAdd(u);var g=u.redMul(f),w=h.redSqr().redISub(g.redAdd(g)),M=g.redISub(w),P=f.redSqr();P=P.redIAdd(P),P=P.redIAdd(P),P=P.redIAdd(P);var O=h.redMul(M).redISub(P),$=i.redAdd(i).redMul(n);return this.curve.jpoint(w,O,$)},Wr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),i=this.z.redSqr(),n=t.redSqr(),s=e.redAdd(e).redIAdd(e),a=s.redSqr(),f=this.x.redAdd(t).redSqr().redISub(e).redISub(n);f=f.redIAdd(f),f=f.redAdd(f).redIAdd(f),f=f.redISub(a);var h=f.redSqr(),u=n.redIAdd(n);u=u.redIAdd(u),u=u.redIAdd(u),u=u.redIAdd(u);var g=s.redIAdd(f).redSqr().redISub(a).redISub(h).redISub(u),w=t.redMul(g);w=w.redIAdd(w),w=w.redIAdd(w);var M=this.x.redMul(h).redISub(w);M=M.redIAdd(M),M=M.redIAdd(M);var P=this.y.redMul(g.redMul(u.redISub(g)).redISub(f.redMul(h)));P=P.redIAdd(P),P=P.redIAdd(P),P=P.redIAdd(P);var O=this.z.redAdd(f).redSqr().redISub(i).redISub(h);return this.curve.jpoint(M,P,O)},Wr.prototype.mul=function(e,t){return e=new dr(e,t),this.curve._wnafMul(this,e)},Wr.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),i=e.z.redSqr();if(this.x.redMul(i).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var n=t.redMul(this.z),s=i.redMul(e.z);return this.y.redMul(s).redISub(e.y.redMul(n)).cmpn(0)===0},Wr.prototype.eqXToP=function(e){var t=this.z.redSqr(),i=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(i)===0)return!0;for(var n=e.clone(),s=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(i.redIAdd(s),this.x.cmp(i)===0)return!0}},Wr.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},Wr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var $a=Yn.exports,fm=Sa.exports,Ml=Il,z9=Li;function La(r){Ml.call(this,"mont",r),this.a=new $a(r.a,16).toRed(this.red),this.b=new $a(r.b,16).toRed(this.red),this.i4=new $a(4).toRed(this.red).redInvm(),this.two=new $a(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}fm(La,Ml);var k9=La;La.prototype.validate=function(e){var t=e.normalize().x,i=t.redSqr(),n=i.redMul(t).redAdd(i.redMul(this.a)).redAdd(t),s=n.redSqrt();return s.redSqr().cmp(n)===0};function Tr(r,e,t){Ml.BasePoint.call(this,r,"projective"),e===null&&t===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new $a(e,16),this.z=new $a(t,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}fm(Tr,Ml.BasePoint),La.prototype.decodePoint=function(e,t){return this.point(z9.toArray(e,t),1)},La.prototype.point=function(e,t){return new Tr(this,e,t)},La.prototype.pointFromJSON=function(e){return Tr.fromJSON(this,e)},Tr.prototype.precompute=function(){},Tr.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Tr.fromJSON=function(e,t){return new Tr(e,t[0],t[1]||e.one)},Tr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Tr.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Tr.prototype.dbl=function(){var e=this.x.redAdd(this.z),t=e.redSqr(),i=this.x.redSub(this.z),n=i.redSqr(),s=t.redSub(n),a=t.redMul(n),f=s.redMul(n.redAdd(this.curve.a24.redMul(s)));return this.curve.point(a,f)},Tr.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Tr.prototype.diffAdd=function(e,t){var i=this.x.redAdd(this.z),n=this.x.redSub(this.z),s=e.x.redAdd(e.z),a=e.x.redSub(e.z),f=a.redMul(i),h=s.redMul(n),u=t.z.redMul(f.redAdd(h).redSqr()),g=t.x.redMul(f.redISub(h).redSqr());return this.curve.point(u,g)},Tr.prototype.mul=function(e){for(var t=e.clone(),i=this,n=this.curve.point(null,null),s=this,a=[];t.cmpn(0)!==0;t.iushrn(1))a.push(t.andln(1));for(var f=a.length-1;f>=0;f--)a[f]===0?(i=i.diffAdd(n,s),n=n.dbl()):(n=i.diffAdd(n,s),i=i.dbl());return n},Tr.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Tr.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Tr.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Tr.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Tr.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var H9=Li,ms=Yn.exports,lm=Sa.exports,Cl=Il,j9=H9.assert;function Qn(r){this.twisted=(r.a|0)!==1,this.mOneA=this.twisted&&(r.a|0)===-1,this.extended=this.mOneA,Cl.call(this,"edwards",r),this.a=new ms(r.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new ms(r.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new ms(r.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),j9(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(r.c|0)===1}lm(Qn,Cl);var W9=Qn;Qn.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},Qn.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},Qn.prototype.jpoint=function(e,t,i,n){return this.point(e,t,i,n)},Qn.prototype.pointFromX=function(e,t){e=new ms(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),n=this.c2.redSub(this.a.redMul(i)),s=this.one.redSub(this.c2.redMul(this.d).redMul(i)),a=n.redMul(s.redInvm()),f=a.redSqrt();if(f.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");var h=f.fromRed().isOdd();return(t&&!h||!t&&h)&&(f=f.redNeg()),this.point(e,f)},Qn.prototype.pointFromY=function(e,t){e=new ms(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),n=i.redSub(this.c2),s=i.redMul(this.d).redMul(this.c2).redSub(this.a),a=n.redMul(s.redInvm());if(a.cmp(this.zero)===0){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var f=a.redSqrt();if(f.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");return f.fromRed().isOdd()!==t&&(f=f.redNeg()),this.point(f,e)},Qn.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),i=e.y.redSqr(),n=t.redMul(this.a).redAdd(i),s=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(i)));return n.cmp(s)===0};function nr(r,e,t,i,n){Cl.BasePoint.call(this,r,"projective"),e===null&&t===null&&i===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new ms(e,16),this.y=new ms(t,16),this.z=i?new ms(i,16):this.curve.one,this.t=n&&new ms(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}lm(nr,Cl.BasePoint),Qn.prototype.pointFromJSON=function(e){return nr.fromJSON(this,e)},Qn.prototype.point=function(e,t,i,n){return new nr(this,e,t,i,n)},nr.fromJSON=function(e,t){return new nr(e,t[0],t[1],t[2])},nr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},nr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},nr.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),i=this.z.redSqr();i=i.redIAdd(i);var n=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),a=n.redAdd(t),f=a.redSub(i),h=n.redSub(t),u=s.redMul(f),g=a.redMul(h),w=s.redMul(h),M=f.redMul(a);return this.curve.point(u,g,M,w)},nr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),t=this.x.redSqr(),i=this.y.redSqr(),n,s,a,f,h,u;if(this.curve.twisted){f=this.curve._mulA(t);var g=f.redAdd(i);this.zOne?(n=e.redSub(t).redSub(i).redMul(g.redSub(this.curve.two)),s=g.redMul(f.redSub(i)),a=g.redSqr().redSub(g).redSub(g)):(h=this.z.redSqr(),u=g.redSub(h).redISub(h),n=e.redSub(t).redISub(i).redMul(u),s=g.redMul(f.redSub(i)),a=g.redMul(u))}else f=t.redAdd(i),h=this.curve._mulC(this.z).redSqr(),u=f.redSub(h).redSub(h),n=this.curve._mulC(e.redISub(f)).redMul(u),s=this.curve._mulC(f).redMul(t.redISub(i)),a=f.redMul(u);return this.curve.point(n,s,a)},nr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},nr.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),i=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),a=i.redSub(t),f=s.redSub(n),h=s.redAdd(n),u=i.redAdd(t),g=a.redMul(f),w=h.redMul(u),M=a.redMul(u),P=f.redMul(h);return this.curve.point(g,w,P,M)},nr.prototype._projAdd=function(e){var t=this.z.redMul(e.z),i=t.redSqr(),n=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(n).redMul(s),f=i.redSub(a),h=i.redAdd(a),u=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(n).redISub(s),g=t.redMul(f).redMul(u),w,M;return this.curve.twisted?(w=t.redMul(h).redMul(s.redSub(this.curve._mulA(n))),M=f.redMul(h)):(w=t.redMul(h).redMul(s.redSub(n)),M=this.curve._mulC(f).redMul(h)),this.curve.point(g,w,M)},nr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},nr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},nr.prototype.mulAdd=function(e,t,i){return this.curve._wnafMulAdd(1,[this,t],[e,i],2,!1)},nr.prototype.jmulAdd=function(e,t,i){return this.curve._wnafMulAdd(1,[this,t],[e,i],2,!0)},nr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},nr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},nr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},nr.prototype.getY=function(){return this.normalize(),this.y.fromRed()},nr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},nr.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(t)===0)return!0;for(var i=e.clone(),n=this.curve.redN.redMul(this.z);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),this.x.cmp(t)===0)return!0}},nr.prototype.toP=nr.prototype.normalize,nr.prototype.mixedAdd=nr.prototype.add,function(r){var e=r;e.base=Il,e.short=q9,e.mont=k9,e.edwards=W9}(Ld);var Pl={},Ud,hm;function K9(){return hm||(hm=1,Ud={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),Ud}(function(r){var e=r,t=Ri,i=Ld,n=Li,s=n.assert;function a(u){u.type==="short"?this.curve=new i.short(u):u.type==="edwards"?this.curve=new i.edwards(u):this.curve=new i.mont(u),this.g=this.curve.g,this.n=this.curve.n,this.hash=u.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=a;function f(u,g){Object.defineProperty(e,u,{configurable:!0,enumerable:!0,get:function(){var w=new a(g);return Object.defineProperty(e,u,{configurable:!0,enumerable:!0,value:w}),w}})}f("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:t.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),f("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:t.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),f("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:t.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),f("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:t.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),f("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:t.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),f("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:t.sha256,gRed:!1,g:["9"]}),f("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:t.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var h;try{h=K9()}catch{h=void 0}f("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:t.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",h]})})(Pl);var V9=Ri,Po=Nd,um=So;function Ks(r){if(!(this instanceof Ks))return new Ks(r);this.hash=r.hash,this.predResist=!!r.predResist,this.outLen=this.hash.outSize,this.minEntropy=r.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Po.toArray(r.entropy,r.entropyEnc||"hex"),t=Po.toArray(r.nonce,r.nonceEnc||"hex"),i=Po.toArray(r.pers,r.persEnc||"hex");um(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,i)}var G9=Ks;Ks.prototype._init=function(e,t,i){var n=e.concat(t).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},Ks.prototype._hmac=function(){return new V9.hmac(this.hash,this.K)},Ks.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},Ks.prototype.reseed=function(e,t,i,n){typeof t!="string"&&(n=i,i=t,t=null),e=Po.toArray(e,t),i=Po.toArray(i,n),um(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this._reseed=1},Ks.prototype.generate=function(e,t,i,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(n=i,i=t,t=null),i&&(i=Po.toArray(i,n||"hex"),this._update(i));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var a=s.slice(0,e);return this._update(i),this._reseed++,Po.encode(a,t)};var J9=Yn.exports,Y9=Li,Fd=Y9.assert;function Yr(r,e){this.ec=r,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var Q9=Yr;Yr.fromPublic=function(e,t,i){return t instanceof Yr?t:new Yr(e,{pub:t,pubEnc:i})},Yr.fromPrivate=function(e,t,i){return t instanceof Yr?t:new Yr(e,{priv:t,privEnc:i})},Yr.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},Yr.prototype.getPublic=function(e,t){return typeof e=="string"&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},Yr.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv},Yr.prototype._importPrivate=function(e,t){this.priv=new J9(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},Yr.prototype._importPublic=function(e,t){if(e.x||e.y){this.ec.curve.type==="mont"?Fd(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Fd(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)},Yr.prototype.derive=function(e){return e.validate()||Fd(e.validate(),"public point not validated"),e.mul(this.priv).getX()},Yr.prototype.sign=function(e,t,i){return this.ec.sign(e,this,t,i)},Yr.prototype.verify=function(e,t,i){return this.ec.verify(e,t,this,void 0,i)},Yr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var Dl=Yn.exports,qd=Li,Z9=qd.assert;function Ol(r,e){if(r instanceof Ol)return r;this._importDER(r,e)||(Z9(r.r&&r.s,"Signature without r or s"),this.r=new Dl(r.r,16),this.s=new Dl(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}var X9=Ol;function ex(){this.place=0}function zd(r,e){var t=r[e.place++];if(!(t&128))return t;var i=t&15;if(i===0||i>4||r[e.place]===0)return!1;for(var n=0,s=0,a=e.place;s<i;s++,a++)n<<=8,n|=r[a],n>>>=0;return n<=127?!1:(e.place=a,n)}function dm(r){for(var e=0,t=r.length-1;!r[e]&&!(r[e+1]&128)&&e<t;)e++;return e===0?r:r.slice(e)}Ol.prototype._importDER=function(e,t){e=qd.toArray(e,t);var i=new ex;if(e[i.place++]!==48)return!1;var n=zd(e,i);if(n===!1||n+i.place!==e.length||e[i.place++]!==2)return!1;var s=zd(e,i);if(s===!1||e[i.place]&128)return!1;var a=e.slice(i.place,s+i.place);if(i.place+=s,e[i.place++]!==2)return!1;var f=zd(e,i);if(f===!1||e.length!==f+i.place||e[i.place]&128)return!1;var h=e.slice(i.place,f+i.place);if(a[0]===0)if(a[1]&128)a=a.slice(1);else return!1;if(h[0]===0)if(h[1]&128)h=h.slice(1);else return!1;return this.r=new Dl(a),this.s=new Dl(h),this.recoveryParam=null,!0};function kd(r,e){if(e<128){r.push(e);return}var t=1+(Math.log(e)/Math.LN2>>>3);for(r.push(t|128);--t;)r.push(e>>>(t<<3)&255);r.push(e)}Ol.prototype.toDER=function(e){var t=this.r.toArray(),i=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),i[0]&128&&(i=[0].concat(i)),t=dm(t),i=dm(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var n=[2];kd(n,t.length),n=n.concat(t),n.push(2),kd(n,i.length);var s=n.concat(i),a=[48];return kd(a,s.length),a=a.concat(s),qd.encode(a,e)};var An=Yn.exports,pm=G9,tx=Li,Hd=Pl,rx=El.exports,Do=tx.assert,jd=Q9,Rl=X9;function tn(r){if(!(this instanceof tn))return new tn(r);typeof r=="string"&&(Do(Object.prototype.hasOwnProperty.call(Hd,r),"Unknown curve "+r),r=Hd[r]),r instanceof Hd.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}var ix=tn;tn.prototype.keyPair=function(e){return new jd(this,e)},tn.prototype.keyFromPrivate=function(e,t){return jd.fromPrivate(this,e,t)},tn.prototype.keyFromPublic=function(e,t){return jd.fromPublic(this,e,t)},tn.prototype.genKeyPair=function(e){e||(e={});for(var t=new pm({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||rx(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),n=this.n.sub(new An(2));;){var s=new An(t.generate(i));if(!(s.cmp(n)>0))return s.iaddn(1),this.keyFromPrivate(s)}},tn.prototype._truncateToN=function(e,t,i){var n;if(An.isBN(e)||typeof e=="number")e=new An(e,16),n=e.byteLength();else if(typeof e=="object")n=e.length,e=new An(e,16);else{var s=e.toString();n=s.length+1>>>1,e=new An(s,16)}typeof i!="number"&&(i=n*8);var a=i-this.n.bitLength();return a>0&&(e=e.ushrn(a)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},tn.prototype.sign=function(e,t,i,n){if(typeof i=="object"&&(n=i,i=null),n||(n={}),typeof e!="string"&&typeof e!="number"&&!An.isBN(e)){Do(typeof e=="object"&&e&&typeof e.length=="number","Expected message to be an array-like, a hex string, or a BN instance"),Do(e.length>>>0===e.length);for(var s=0;s<e.length;s++)Do((e[s]&255)===e[s])}t=this.keyFromPrivate(t,i),e=this._truncateToN(e,!1,n.msgBitLength),Do(!e.isNeg(),"Can not sign a negative message");var a=this.n.byteLength(),f=t.getPrivate().toArray("be",a),h=e.toArray("be",a);Do(new An(h).eq(e),"Can not sign message");for(var u=new pm({hash:this.hash,entropy:f,nonce:h,pers:n.pers,persEnc:n.persEnc||"utf8"}),g=this.n.sub(new An(1)),w=0;;w++){var M=n.k?n.k(w):new An(u.generate(this.n.byteLength()));if(M=this._truncateToN(M,!0),!(M.cmpn(1)<=0||M.cmp(g)>=0)){var P=this.g.mul(M);if(!P.isInfinity()){var O=P.getX(),$=O.umod(this.n);if($.cmpn(0)!==0){var q=M.invm(this.n).mul($.mul(t.getPrivate()).iadd(e));if(q=q.umod(this.n),q.cmpn(0)!==0){var U=(P.getY().isOdd()?1:0)|(O.cmp($)!==0?2:0);return n.canonical&&q.cmp(this.nh)>0&&(q=this.n.sub(q),U^=1),new Rl({r:$,s:q,recoveryParam:U})}}}}}},tn.prototype.verify=function(e,t,i,n,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),i=this.keyFromPublic(i,n),t=new Rl(t,"hex");var a=t.r,f=t.s;if(a.cmpn(1)<0||a.cmp(this.n)>=0||f.cmpn(1)<0||f.cmp(this.n)>=0)return!1;var h=f.invm(this.n),u=h.mul(e).umod(this.n),g=h.mul(a).umod(this.n),w;return this.curve._maxwellTrick?(w=this.g.jmulAdd(u,i.getPublic(),g),w.isInfinity()?!1:w.eqXToP(a)):(w=this.g.mulAdd(u,i.getPublic(),g),w.isInfinity()?!1:w.getX().umod(this.n).cmp(a)===0)},tn.prototype.recoverPubKey=function(r,e,t,i){Do((3&t)===t,"The recovery param is more than two bits"),e=new Rl(e,i);var n=this.n,s=new An(r),a=e.r,f=e.s,h=t&1,u=t>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?a=this.curve.pointFromX(a.add(this.curve.n),h):a=this.curve.pointFromX(a,h);var g=e.r.invm(n),w=n.sub(s).mul(g).umod(n),M=f.mul(g).umod(n);return this.g.mulAdd(w,a,M)},tn.prototype.getKeyRecoveryParam=function(r,e,t,i){if(e=new Rl(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(r,e,n)}catch{continue}if(s.eq(t))return n}throw new Error("Unable to find valid recovery factor")};var Hc=Li,gm=Hc.assert,vm=Hc.parseBytes,Ba=Hc.cachedProperty;function Nr(r,e){this.eddsa=r,this._secret=vm(e.secret),r.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=vm(e.pub)}Nr.fromPublic=function(e,t){return t instanceof Nr?t:new Nr(e,{pub:t})},Nr.fromSecret=function(e,t){return t instanceof Nr?t:new Nr(e,{secret:t})},Nr.prototype.secret=function(){return this._secret},Ba(Nr,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),Ba(Nr,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),Ba(Nr,"privBytes",function(){var e=this.eddsa,t=this.hash(),i=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[i]&=127,n[i]|=64,n}),Ba(Nr,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),Ba(Nr,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),Ba(Nr,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),Nr.prototype.sign=function(e){return gm(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Nr.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},Nr.prototype.getSecret=function(e){return gm(this._secret,"KeyPair is public only"),Hc.encode(this.secret(),e)},Nr.prototype.getPublic=function(e){return Hc.encode(this.pubBytes(),e)};var nx=Nr,sx=Yn.exports,Tl=Li,mm=Tl.assert,Nl=Tl.cachedProperty,ox=Tl.parseBytes;function Oo(r,e){this.eddsa=r,typeof e!="object"&&(e=ox(e)),Array.isArray(e)&&(mm(e.length===r.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,r.encodingLength),S:e.slice(r.encodingLength)}),mm(e.R&&e.S,"Signature without R or S"),r.isPoint(e.R)&&(this._R=e.R),e.S instanceof sx&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Nl(Oo,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Nl(Oo,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Nl(Oo,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Nl(Oo,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),Oo.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Oo.prototype.toHex=function(){return Tl.encode(this.toBytes(),"hex").toUpperCase()};var ax=Oo,cx=Ri,fx=Pl,Ua=Li,lx=Ua.assert,bm=Ua.parseBytes,wm=nx,ym=ax;function mi(r){if(lx(r==="ed25519","only tested with ed25519 so far"),!(this instanceof mi))return new mi(r);r=fx[r].curve,this.curve=r,this.g=r.g,this.g.precompute(r.n.bitLength()+1),this.pointClass=r.point().constructor,this.encodingLength=Math.ceil(r.n.bitLength()/8),this.hash=cx.sha512}var hx=mi;mi.prototype.sign=function(e,t){e=bm(e);var i=this.keyFromSecret(t),n=this.hashInt(i.messagePrefix(),e),s=this.g.mul(n),a=this.encodePoint(s),f=this.hashInt(a,i.pubBytes(),e).mul(i.priv()),h=n.add(f).umod(this.curve.n);return this.makeSignature({R:s,S:h,Rencoded:a})},mi.prototype.verify=function(e,t,i){if(e=bm(e),t=this.makeSignature(t),t.S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var n=this.keyFromPublic(i),s=this.hashInt(t.Rencoded(),n.pubBytes(),e),a=this.g.mul(t.S()),f=t.R().add(n.pub().mul(s));return f.eq(a)},mi.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return Ua.intFromLE(e.digest()).umod(this.curve.n)},mi.prototype.keyFromPublic=function(e){return wm.fromPublic(this,e)},mi.prototype.keyFromSecret=function(e){return wm.fromSecret(this,e)},mi.prototype.makeSignature=function(e){return e instanceof ym?e:new ym(this,e)},mi.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},mi.prototype.decodePoint=function(e){e=Ua.parseBytes(e);var t=e.length-1,i=e.slice(0,t).concat(e[t]&-129),n=(e[t]&128)!==0,s=Ua.intFromLE(i);return this.curve.pointFromY(s,n)},mi.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},mi.prototype.decodeInt=function(e){return Ua.intFromLE(e)},mi.prototype.isPoint=function(e){return e instanceof this.pointClass},function(r){var e=r;e.version=L9.version,e.utils=Li,e.rand=El.exports,e.curve=Ld,e.curves=Pl,e.ec=ix,e.eddsa=hx}(am);var Wd={},_m={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=yt,t=Ni;r.DIGEST_LENGTH=64,r.BLOCK_SIZE=128;var i=function(){function f(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return f.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},f.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},f.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._tempHi),t.wipe(this._tempLo),this.reset()},f.prototype.update=function(h,u){if(u===void 0&&(u=h.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var g=0;if(this._bytesHashed+=u,this._bufferLength>0){for(;this._bufferLength<r.BLOCK_SIZE&&u>0;)this._buffer[this._bufferLength++]=h[g++],u--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(u>=this.blockSize&&(g=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,h,g,u),u%=this.blockSize);u>0;)this._buffer[this._bufferLength++]=h[g++],u--;return this},f.prototype.finish=function(h){if(!this._finished){var u=this._bytesHashed,g=this._bufferLength,w=u/536870912|0,M=u<<3,P=u%128<112?128:256;this._buffer[g]=128;for(var O=g+1;O<P-8;O++)this._buffer[O]=0;e.writeUint32BE(w,this._buffer,P-8),e.writeUint32BE(M,this._buffer,P-4),s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,P),this._finished=!0}for(var O=0;O<this.digestLength/8;O++)e.writeUint32BE(this._stateHi[O],h,O*8),e.writeUint32BE(this._stateLo[O],h,O*8+4);return this},f.prototype.digest=function(){var h=new Uint8Array(this.digestLength);return this.finish(h),h},f.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},f.prototype.restoreState=function(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},f.prototype.cleanSavedState=function(h){t.wipe(h.stateHi),t.wipe(h.stateLo),h.buffer&&t.wipe(h.buffer),h.bufferLength=0,h.bytesHashed=0},f}();r.SHA512=i;var n=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(f,h,u,g,w,M,P){for(var O=u[0],$=u[1],q=u[2],U=u[3],J=u[4],ee=u[5],W=u[6],G=u[7],Q=g[0],A=g[1],z=g[2],te=g[3],ae=g[4],L=g[5],b=g[6],m=g[7],l,d,y,C,D,S,v,x;P>=128;){for(var _=0;_<16;_++){var N=8*_+M;f[_]=e.readUint32BE(w,N),h[_]=e.readUint32BE(w,N+4)}for(var _=0;_<80;_++){var oe=O,R=$,Z=q,H=U,K=J,k=ee,E=W,j=G,re=Q,le=A,he=z,ge=te,ke=ae,Te=L,Ce=b,Xe=m;if(l=G,d=m,D=d&65535,S=d>>>16,v=l&65535,x=l>>>16,l=(J>>>14|ae<<32-14)^(J>>>18|ae<<32-18)^(ae>>>41-32|J<<32-(41-32)),d=(ae>>>14|J<<32-14)^(ae>>>18|J<<32-18)^(J>>>41-32|ae<<32-(41-32)),D+=d&65535,S+=d>>>16,v+=l&65535,x+=l>>>16,l=J&ee^~J&W,d=ae&L^~ae&b,D+=d&65535,S+=d>>>16,v+=l&65535,x+=l>>>16,l=n[_*2],d=n[_*2+1],D+=d&65535,S+=d>>>16,v+=l&65535,x+=l>>>16,l=f[_%16],d=h[_%16],D+=d&65535,S+=d>>>16,v+=l&65535,x+=l>>>16,S+=D>>>16,v+=S>>>16,x+=v>>>16,y=v&65535|x<<16,C=D&65535|S<<16,l=y,d=C,D=d&65535,S=d>>>16,v=l&65535,x=l>>>16,l=(O>>>28|Q<<32-28)^(Q>>>34-32|O<<32-(34-32))^(Q>>>39-32|O<<32-(39-32)),d=(Q>>>28|O<<32-28)^(O>>>34-32|Q<<32-(34-32))^(O>>>39-32|Q<<32-(39-32)),D+=d&65535,S+=d>>>16,v+=l&65535,x+=l>>>16,l=O&$^O&q^$&q,d=Q&A^Q&z^A&z,D+=d&65535,S+=d>>>16,v+=l&65535,x+=l>>>16,S+=D>>>16,v+=S>>>16,x+=v>>>16,j=v&65535|x<<16,Xe=D&65535|S<<16,l=H,d=ge,D=d&65535,S=d>>>16,v=l&65535,x=l>>>16,l=y,d=C,D+=d&65535,S+=d>>>16,v+=l&65535,x+=l>>>16,S+=D>>>16,v+=S>>>16,x+=v>>>16,H=v&65535|x<<16,ge=D&65535|S<<16,$=oe,q=R,U=Z,J=H,ee=K,W=k,G=E,O=j,A=re,z=le,te=he,ae=ge,L=ke,b=Te,m=Ce,Q=Xe,_%16===15)for(var N=0;N<16;N++)l=f[N],d=h[N],D=d&65535,S=d>>>16,v=l&65535,x=l>>>16,l=f[(N+9)%16],d=h[(N+9)%16],D+=d&65535,S+=d>>>16,v+=l&65535,x+=l>>>16,y=f[(N+1)%16],C=h[(N+1)%16],l=(y>>>1|C<<32-1)^(y>>>8|C<<32-8)^y>>>7,d=(C>>>1|y<<32-1)^(C>>>8|y<<32-8)^(C>>>7|y<<32-7),D+=d&65535,S+=d>>>16,v+=l&65535,x+=l>>>16,y=f[(N+14)%16],C=h[(N+14)%16],l=(y>>>19|C<<32-19)^(C>>>61-32|y<<32-(61-32))^y>>>6,d=(C>>>19|y<<32-19)^(y>>>61-32|C<<32-(61-32))^(C>>>6|y<<32-6),D+=d&65535,S+=d>>>16,v+=l&65535,x+=l>>>16,S+=D>>>16,v+=S>>>16,x+=v>>>16,f[N]=v&65535|x<<16,h[N]=D&65535|S<<16}l=O,d=Q,D=d&65535,S=d>>>16,v=l&65535,x=l>>>16,l=u[0],d=g[0],D+=d&65535,S+=d>>>16,v+=l&65535,x+=l>>>16,S+=D>>>16,v+=S>>>16,x+=v>>>16,u[0]=O=v&65535|x<<16,g[0]=Q=D&65535|S<<16,l=$,d=A,D=d&65535,S=d>>>16,v=l&65535,x=l>>>16,l=u[1],d=g[1],D+=d&65535,S+=d>>>16,v+=l&65535,x+=l>>>16,S+=D>>>16,v+=S>>>16,x+=v>>>16,u[1]=$=v&65535|x<<16,g[1]=A=D&65535|S<<16,l=q,d=z,D=d&65535,S=d>>>16,v=l&65535,x=l>>>16,l=u[2],d=g[2],D+=d&65535,S+=d>>>16,v+=l&65535,x+=l>>>16,S+=D>>>16,v+=S>>>16,x+=v>>>16,u[2]=q=v&65535|x<<16,g[2]=z=D&65535|S<<16,l=U,d=te,D=d&65535,S=d>>>16,v=l&65535,x=l>>>16,l=u[3],d=g[3],D+=d&65535,S+=d>>>16,v+=l&65535,x+=l>>>16,S+=D>>>16,v+=S>>>16,x+=v>>>16,u[3]=U=v&65535|x<<16,g[3]=te=D&65535|S<<16,l=J,d=ae,D=d&65535,S=d>>>16,v=l&65535,x=l>>>16,l=u[4],d=g[4],D+=d&65535,S+=d>>>16,v+=l&65535,x+=l>>>16,S+=D>>>16,v+=S>>>16,x+=v>>>16,u[4]=J=v&65535|x<<16,g[4]=ae=D&65535|S<<16,l=ee,d=L,D=d&65535,S=d>>>16,v=l&65535,x=l>>>16,l=u[5],d=g[5],D+=d&65535,S+=d>>>16,v+=l&65535,x+=l>>>16,S+=D>>>16,v+=S>>>16,x+=v>>>16,u[5]=ee=v&65535|x<<16,g[5]=L=D&65535|S<<16,l=W,d=b,D=d&65535,S=d>>>16,v=l&65535,x=l>>>16,l=u[6],d=g[6],D+=d&65535,S+=d>>>16,v+=l&65535,x+=l>>>16,S+=D>>>16,v+=S>>>16,x+=v>>>16,u[6]=W=v&65535|x<<16,g[6]=b=D&65535|S<<16,l=G,d=m,D=d&65535,S=d>>>16,v=l&65535,x=l>>>16,l=u[7],d=g[7],D+=d&65535,S+=d>>>16,v+=l&65535,x+=l>>>16,S+=D>>>16,v+=S>>>16,x+=v>>>16,u[7]=G=v&65535|x<<16,g[7]=m=D&65535|S<<16,M+=128,P-=128}return M}function a(f){var h=new i;h.update(f);var u=h.digest();return h.clean(),u}r.hash=a})(_m),function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertSecretKeyToX25519=r.convertPublicKeyToX25519=r.verify=r.sign=r.extractPublicKeyFromSecretKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.SEED_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=r.SIGNATURE_LENGTH=void 0;const e=Hs,t=_m,i=Ni;r.SIGNATURE_LENGTH=64,r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=64,r.SEED_LENGTH=32;function n(H){const K=new Float64Array(16);if(H)for(let k=0;k<H.length;k++)K[k]=H[k];return K}const s=new Uint8Array(32);s[0]=9;const a=n(),f=n([1]),h=n([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),u=n([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),g=n([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),w=n([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),M=n([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function P(H,K){for(let k=0;k<16;k++)H[k]=K[k]|0}function O(H){let K=1;for(let k=0;k<16;k++){let E=H[k]+K+65535;K=Math.floor(E/65536),H[k]=E-K*65536}H[0]+=K-1+37*(K-1)}function $(H,K,k){const E=~(k-1);for(let j=0;j<16;j++){const re=E&(H[j]^K[j]);H[j]^=re,K[j]^=re}}function q(H,K){const k=n(),E=n();for(let j=0;j<16;j++)E[j]=K[j];O(E),O(E),O(E);for(let j=0;j<2;j++){k[0]=E[0]-65517;for(let le=1;le<15;le++)k[le]=E[le]-65535-(k[le-1]>>16&1),k[le-1]&=65535;k[15]=E[15]-32767-(k[14]>>16&1);const re=k[15]>>16&1;k[14]&=65535,$(E,k,1-re)}for(let j=0;j<16;j++)H[2*j]=E[j]&255,H[2*j+1]=E[j]>>8}function U(H,K){let k=0;for(let E=0;E<32;E++)k|=H[E]^K[E];return(1&k-1>>>8)-1}function J(H,K){const k=new Uint8Array(32),E=new Uint8Array(32);return q(k,H),q(E,K),U(k,E)}function ee(H){const K=new Uint8Array(32);return q(K,H),K[0]&1}function W(H,K){for(let k=0;k<16;k++)H[k]=K[2*k]+(K[2*k+1]<<8);H[15]&=32767}function G(H,K,k){for(let E=0;E<16;E++)H[E]=K[E]+k[E]}function Q(H,K,k){for(let E=0;E<16;E++)H[E]=K[E]-k[E]}function A(H,K,k){let E,j,re=0,le=0,he=0,ge=0,ke=0,Te=0,Ce=0,Xe=0,Ne=0,be=0,Pe=0,De=0,ye=0,Ie=0,Oe=0,me=0,Me=0,Be=0,we=0,He=0,We=0,Ee=0,Ve=0,Ke=0,Ge=0,mt=0,It=0,Je=0,Pt=0,Ot=0,Ze=0,rt=k[0],et=k[1],$e=k[2],it=k[3],tt=k[4],Re=k[5],lt=k[6],ht=k[7],Le=k[8],ut=k[9],nt=k[10],Ue=k[11],st=k[12],Qe=k[13],qe=k[14],dt=k[15];E=K[0],re+=E*rt,le+=E*et,he+=E*$e,ge+=E*it,ke+=E*tt,Te+=E*Re,Ce+=E*lt,Xe+=E*ht,Ne+=E*Le,be+=E*ut,Pe+=E*nt,De+=E*Ue,ye+=E*st,Ie+=E*Qe,Oe+=E*qe,me+=E*dt,E=K[1],le+=E*rt,he+=E*et,ge+=E*$e,ke+=E*it,Te+=E*tt,Ce+=E*Re,Xe+=E*lt,Ne+=E*ht,be+=E*Le,Pe+=E*ut,De+=E*nt,ye+=E*Ue,Ie+=E*st,Oe+=E*Qe,me+=E*qe,Me+=E*dt,E=K[2],he+=E*rt,ge+=E*et,ke+=E*$e,Te+=E*it,Ce+=E*tt,Xe+=E*Re,Ne+=E*lt,be+=E*ht,Pe+=E*Le,De+=E*ut,ye+=E*nt,Ie+=E*Ue,Oe+=E*st,me+=E*Qe,Me+=E*qe,Be+=E*dt,E=K[3],ge+=E*rt,ke+=E*et,Te+=E*$e,Ce+=E*it,Xe+=E*tt,Ne+=E*Re,be+=E*lt,Pe+=E*ht,De+=E*Le,ye+=E*ut,Ie+=E*nt,Oe+=E*Ue,me+=E*st,Me+=E*Qe,Be+=E*qe,we+=E*dt,E=K[4],ke+=E*rt,Te+=E*et,Ce+=E*$e,Xe+=E*it,Ne+=E*tt,be+=E*Re,Pe+=E*lt,De+=E*ht,ye+=E*Le,Ie+=E*ut,Oe+=E*nt,me+=E*Ue,Me+=E*st,Be+=E*Qe,we+=E*qe,He+=E*dt,E=K[5],Te+=E*rt,Ce+=E*et,Xe+=E*$e,Ne+=E*it,be+=E*tt,Pe+=E*Re,De+=E*lt,ye+=E*ht,Ie+=E*Le,Oe+=E*ut,me+=E*nt,Me+=E*Ue,Be+=E*st,we+=E*Qe,He+=E*qe,We+=E*dt,E=K[6],Ce+=E*rt,Xe+=E*et,Ne+=E*$e,be+=E*it,Pe+=E*tt,De+=E*Re,ye+=E*lt,Ie+=E*ht,Oe+=E*Le,me+=E*ut,Me+=E*nt,Be+=E*Ue,we+=E*st,He+=E*Qe,We+=E*qe,Ee+=E*dt,E=K[7],Xe+=E*rt,Ne+=E*et,be+=E*$e,Pe+=E*it,De+=E*tt,ye+=E*Re,Ie+=E*lt,Oe+=E*ht,me+=E*Le,Me+=E*ut,Be+=E*nt,we+=E*Ue,He+=E*st,We+=E*Qe,Ee+=E*qe,Ve+=E*dt,E=K[8],Ne+=E*rt,be+=E*et,Pe+=E*$e,De+=E*it,ye+=E*tt,Ie+=E*Re,Oe+=E*lt,me+=E*ht,Me+=E*Le,Be+=E*ut,we+=E*nt,He+=E*Ue,We+=E*st,Ee+=E*Qe,Ve+=E*qe,Ke+=E*dt,E=K[9],be+=E*rt,Pe+=E*et,De+=E*$e,ye+=E*it,Ie+=E*tt,Oe+=E*Re,me+=E*lt,Me+=E*ht,Be+=E*Le,we+=E*ut,He+=E*nt,We+=E*Ue,Ee+=E*st,Ve+=E*Qe,Ke+=E*qe,Ge+=E*dt,E=K[10],Pe+=E*rt,De+=E*et,ye+=E*$e,Ie+=E*it,Oe+=E*tt,me+=E*Re,Me+=E*lt,Be+=E*ht,we+=E*Le,He+=E*ut,We+=E*nt,Ee+=E*Ue,Ve+=E*st,Ke+=E*Qe,Ge+=E*qe,mt+=E*dt,E=K[11],De+=E*rt,ye+=E*et,Ie+=E*$e,Oe+=E*it,me+=E*tt,Me+=E*Re,Be+=E*lt,we+=E*ht,He+=E*Le,We+=E*ut,Ee+=E*nt,Ve+=E*Ue,Ke+=E*st,Ge+=E*Qe,mt+=E*qe,It+=E*dt,E=K[12],ye+=E*rt,Ie+=E*et,Oe+=E*$e,me+=E*it,Me+=E*tt,Be+=E*Re,we+=E*lt,He+=E*ht,We+=E*Le,Ee+=E*ut,Ve+=E*nt,Ke+=E*Ue,Ge+=E*st,mt+=E*Qe,It+=E*qe,Je+=E*dt,E=K[13],Ie+=E*rt,Oe+=E*et,me+=E*$e,Me+=E*it,Be+=E*tt,we+=E*Re,He+=E*lt,We+=E*ht,Ee+=E*Le,Ve+=E*ut,Ke+=E*nt,Ge+=E*Ue,mt+=E*st,It+=E*Qe,Je+=E*qe,Pt+=E*dt,E=K[14],Oe+=E*rt,me+=E*et,Me+=E*$e,Be+=E*it,we+=E*tt,He+=E*Re,We+=E*lt,Ee+=E*ht,Ve+=E*Le,Ke+=E*ut,Ge+=E*nt,mt+=E*Ue,It+=E*st,Je+=E*Qe,Pt+=E*qe,Ot+=E*dt,E=K[15],me+=E*rt,Me+=E*et,Be+=E*$e,we+=E*it,He+=E*tt,We+=E*Re,Ee+=E*lt,Ve+=E*ht,Ke+=E*Le,Ge+=E*ut,mt+=E*nt,It+=E*Ue,Je+=E*st,Pt+=E*Qe,Ot+=E*qe,Ze+=E*dt,re+=38*Me,le+=38*Be,he+=38*we,ge+=38*He,ke+=38*We,Te+=38*Ee,Ce+=38*Ve,Xe+=38*Ke,Ne+=38*Ge,be+=38*mt,Pe+=38*It,De+=38*Je,ye+=38*Pt,Ie+=38*Ot,Oe+=38*Ze,j=1,E=re+j+65535,j=Math.floor(E/65536),re=E-j*65536,E=le+j+65535,j=Math.floor(E/65536),le=E-j*65536,E=he+j+65535,j=Math.floor(E/65536),he=E-j*65536,E=ge+j+65535,j=Math.floor(E/65536),ge=E-j*65536,E=ke+j+65535,j=Math.floor(E/65536),ke=E-j*65536,E=Te+j+65535,j=Math.floor(E/65536),Te=E-j*65536,E=Ce+j+65535,j=Math.floor(E/65536),Ce=E-j*65536,E=Xe+j+65535,j=Math.floor(E/65536),Xe=E-j*65536,E=Ne+j+65535,j=Math.floor(E/65536),Ne=E-j*65536,E=be+j+65535,j=Math.floor(E/65536),be=E-j*65536,E=Pe+j+65535,j=Math.floor(E/65536),Pe=E-j*65536,E=De+j+65535,j=Math.floor(E/65536),De=E-j*65536,E=ye+j+65535,j=Math.floor(E/65536),ye=E-j*65536,E=Ie+j+65535,j=Math.floor(E/65536),Ie=E-j*65536,E=Oe+j+65535,j=Math.floor(E/65536),Oe=E-j*65536,E=me+j+65535,j=Math.floor(E/65536),me=E-j*65536,re+=j-1+37*(j-1),j=1,E=re+j+65535,j=Math.floor(E/65536),re=E-j*65536,E=le+j+65535,j=Math.floor(E/65536),le=E-j*65536,E=he+j+65535,j=Math.floor(E/65536),he=E-j*65536,E=ge+j+65535,j=Math.floor(E/65536),ge=E-j*65536,E=ke+j+65535,j=Math.floor(E/65536),ke=E-j*65536,E=Te+j+65535,j=Math.floor(E/65536),Te=E-j*65536,E=Ce+j+65535,j=Math.floor(E/65536),Ce=E-j*65536,E=Xe+j+65535,j=Math.floor(E/65536),Xe=E-j*65536,E=Ne+j+65535,j=Math.floor(E/65536),Ne=E-j*65536,E=be+j+65535,j=Math.floor(E/65536),be=E-j*65536,E=Pe+j+65535,j=Math.floor(E/65536),Pe=E-j*65536,E=De+j+65535,j=Math.floor(E/65536),De=E-j*65536,E=ye+j+65535,j=Math.floor(E/65536),ye=E-j*65536,E=Ie+j+65535,j=Math.floor(E/65536),Ie=E-j*65536,E=Oe+j+65535,j=Math.floor(E/65536),Oe=E-j*65536,E=me+j+65535,j=Math.floor(E/65536),me=E-j*65536,re+=j-1+37*(j-1),H[0]=re,H[1]=le,H[2]=he,H[3]=ge,H[4]=ke,H[5]=Te,H[6]=Ce,H[7]=Xe,H[8]=Ne,H[9]=be,H[10]=Pe,H[11]=De,H[12]=ye,H[13]=Ie,H[14]=Oe,H[15]=me}function z(H,K){A(H,K,K)}function te(H,K){const k=n();let E;for(E=0;E<16;E++)k[E]=K[E];for(E=253;E>=0;E--)z(k,k),E!==2&&E!==4&&A(k,k,K);for(E=0;E<16;E++)H[E]=k[E]}function ae(H,K){const k=n();let E;for(E=0;E<16;E++)k[E]=K[E];for(E=250;E>=0;E--)z(k,k),E!==1&&A(k,k,K);for(E=0;E<16;E++)H[E]=k[E]}function L(H,K){const k=n(),E=n(),j=n(),re=n(),le=n(),he=n(),ge=n(),ke=n(),Te=n();Q(k,H[1],H[0]),Q(Te,K[1],K[0]),A(k,k,Te),G(E,H[0],H[1]),G(Te,K[0],K[1]),A(E,E,Te),A(j,H[3],K[3]),A(j,j,u),A(re,H[2],K[2]),G(re,re,re),Q(le,E,k),Q(he,re,j),G(ge,re,j),G(ke,E,k),A(H[0],le,he),A(H[1],ke,ge),A(H[2],ge,he),A(H[3],le,ke)}function b(H,K,k){for(let E=0;E<4;E++)$(H[E],K[E],k)}function m(H,K){const k=n(),E=n(),j=n();te(j,K[2]),A(k,K[0],j),A(E,K[1],j),q(H,E),H[31]^=ee(k)<<7}function l(H,K,k){P(H[0],a),P(H[1],f),P(H[2],f),P(H[3],a);for(let E=255;E>=0;--E){const j=k[E/8|0]>>(E&7)&1;b(H,K,j),L(K,H),L(H,H),b(H,K,j)}}function d(H,K){const k=[n(),n(),n(),n()];P(k[0],g),P(k[1],w),P(k[2],f),A(k[3],g,w),l(H,k,K)}function y(H){if(H.length!==r.SEED_LENGTH)throw new Error(`ed25519: seed must be ${r.SEED_LENGTH} bytes`);const K=(0,t.hash)(H);K[0]&=248,K[31]&=127,K[31]|=64;const k=new Uint8Array(32),E=[n(),n(),n(),n()];d(E,K),m(k,E);const j=new Uint8Array(64);return j.set(H),j.set(k,32),{publicKey:k,secretKey:j}}r.generateKeyPairFromSeed=y;function C(H){const K=(0,e.randomBytes)(32,H),k=y(K);return(0,i.wipe)(K),k}r.generateKeyPair=C;function D(H){if(H.length!==r.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${r.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(H.subarray(32))}r.extractPublicKeyFromSecretKey=D;const S=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 v(H,K){let k,E,j,re;for(E=63;E>=32;--E){for(k=0,j=E-32,re=E-12;j<re;++j)K[j]+=k-16*K[E]*S[j-(E-32)],k=Math.floor((K[j]+128)/256),K[j]-=k*256;K[j]+=k,K[E]=0}for(k=0,j=0;j<32;j++)K[j]+=k-(K[31]>>4)*S[j],k=K[j]>>8,K[j]&=255;for(j=0;j<32;j++)K[j]-=k*S[j];for(E=0;E<32;E++)K[E+1]+=K[E]>>8,H[E]=K[E]&255}function x(H){const K=new Float64Array(64);for(let k=0;k<64;k++)K[k]=H[k];for(let k=0;k<64;k++)H[k]=0;v(H,K)}function _(H,K){const k=new Float64Array(64),E=[n(),n(),n(),n()],j=(0,t.hash)(H.subarray(0,32));j[0]&=248,j[31]&=127,j[31]|=64;const re=new Uint8Array(64);re.set(j.subarray(32),32);const le=new t.SHA512;le.update(re.subarray(32)),le.update(K);const he=le.digest();le.clean(),x(he),d(E,he),m(re,E),le.reset(),le.update(re.subarray(0,32)),le.update(H.subarray(32)),le.update(K);const ge=le.digest();x(ge);for(let ke=0;ke<32;ke++)k[ke]=he[ke];for(let ke=0;ke<32;ke++)for(let Te=0;Te<32;Te++)k[ke+Te]+=ge[ke]*j[Te];return v(re.subarray(32),k),re}r.sign=_;function N(H,K){const k=n(),E=n(),j=n(),re=n(),le=n(),he=n(),ge=n();return P(H[2],f),W(H[1],K),z(j,H[1]),A(re,j,h),Q(j,j,H[2]),G(re,H[2],re),z(le,re),z(he,le),A(ge,he,le),A(k,ge,j),A(k,k,re),ae(k,k),A(k,k,j),A(k,k,re),A(k,k,re),A(H[0],k,re),z(E,H[0]),A(E,E,re),J(E,j)&&A(H[0],H[0],M),z(E,H[0]),A(E,E,re),J(E,j)?-1:(ee(H[0])===K[31]>>7&&Q(H[0],a,H[0]),A(H[3],H[0],H[1]),0)}function oe(H,K,k){const E=new Uint8Array(32),j=[n(),n(),n(),n()],re=[n(),n(),n(),n()];if(k.length!==r.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${r.SIGNATURE_LENGTH} bytes`);if(N(re,H))return!1;const le=new t.SHA512;le.update(k.subarray(0,32)),le.update(H),le.update(K);const he=le.digest();return x(he),l(j,re,he),d(re,k.subarray(32)),L(j,re),m(E,j),!U(k,E)}r.verify=oe;function R(H){let K=[n(),n(),n(),n()];if(N(K,H))throw new Error("Ed25519: invalid public key");let k=n(),E=n(),j=K[1];G(k,f,j),Q(E,f,j),te(E,E),A(k,k,E);let re=new Uint8Array(32);return q(re,k),re}r.convertPublicKeyToX25519=R;function Z(H){const K=(0,t.hash)(H.subarray(0,32));K[0]&=248,K[31]&=127,K[31]|=64;const k=new Uint8Array(K.subarray(0,32));return(0,i.wipe)(K),k}r.convertSecretKeyToX25519=Z}(Wd);const ux="EdDSA",dx="JWT",$l=".",Ll="base64url",xm="utf8",Em="utf8",px=":",gx="did",vx="key",Am="base58btc",mx="z",bx="K36",wx=32;function Kd(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function Sm(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Kd(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function yx(r,e){e||(e=r.reduce((n,s)=>n+s.length,0));const t=Sm(e);let i=0;for(const n of r)t.set(n,i),i+=n.length;return Kd(t)}function Im(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const Mm=Im("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Vd=Im("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=Sm(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),Cm={utf8:Mm,"utf-8":Mm,hex:Ta.base16,latin1:Vd,ascii:Vd,binary:Vd,...Ta};function Bl(r,e="utf8"){const t=Cm[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}function Fa(r,e="utf8"){const t=Cm[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Kd(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}const _x=r=>JSON.stringify(r,(e,t)=>typeof t=="bigint"?t.toString()+"n":t),xx=r=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,t=r.replace(e,'$1"$2n"$3');return JSON.parse(t,(i,n)=>typeof n=="string"&&n.match(/^\d+n$/)?BigInt(n.substring(0,n.length-1)):n)};function Ro(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return xx(r)}catch{return r}}function bs(r){return typeof r=="string"?r:_x(r)||""}function Pm(r){return Ro(Bl(Fa(r,Ll),xm))}function Ul(r){return Bl(Fa(bs(r),xm),Ll)}function Dm(r){const e=Fa(bx,Am),t=mx+Bl(yx([e,r]),Am);return[gx,vx,t].join(px)}function Ex(r){return Bl(r,Ll)}function Ax(r){return Fa(r,Ll)}function Sx(r){return Fa([Ul(r.header),Ul(r.payload)].join($l),Em)}function Ix(r){return[Ul(r.header),Ul(r.payload),Ex(r.signature)].join($l)}function Gd(r){const e=r.split($l),t=Pm(e[0]),i=Pm(e[1]),n=Ax(e[2]),s=Fa(e.slice(0,2).join($l),Em);return{header:t,payload:i,signature:n,data:s}}function Om(r=Hs.randomBytes(wx)){return Wd.generateKeyPairFromSeed(r)}async function Mx(r,e,t,i,n=_e.fromMiliseconds(Date.now())){const s={alg:ux,typ:dx},a=Dm(i.publicKey),f=n+t,h={iss:a,sub:r,aud:e,iat:n,exp:f},u=Sx({header:s,payload:h}),g=Wd.sign(i.secretKey,u);return Ix({header:s,payload:h,signature:g})}const Cx={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}},Px=":";function qa(r){const[e,t]=r.split(Px);return{namespace:e,reference:t}}function Rm(r,e=[]){const t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;const n=r[i];t.push(...n.accounts)}),t}function Tm(r,e){return r.includes(":")?[r]:e.chains||[]}const Dx="ReactNative",Bi={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Ox="js";function Fl(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Vs(){return!Oc()&&!!Qu()&&navigator.product===Dx}function Rx(){return Vs()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="android"}function Tx(){return Vs()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="ios"}function jc(){return!Fl()&&!!Qu()&&!!Oc()}function Wc(){return Vs()?Bi.reactNative:Fl()?Bi.node:jc()?Bi.browser:Bi.unknown}function Nm(){var r;try{return Vs()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(r=global.Application)==null?void 0:r.applicationId:void 0}catch{return}}function Nx(r,e){const t=new URLSearchParams(r);for(const i of Object.keys(e).sort())if(e.hasOwnProperty(i)){const n=e[i];n!==void 0&&t.set(i,n)}return t.toString()}function $m(){return Ig()||{name:"",description:"",url:"",icons:[""]}}function $x(){if(Wc()===Bi.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:t,Version:i}=global.Platform;return[t,i].join("-")}const r=Q6();if(r===null)return"unknown";const e=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[e,r.name,r.version].join("-"):[e,r.version].join("-")}function Lx(){var r;const e=Wc();return e===Bi.browser?[e,((r=Sg())==null?void 0:r.host)||"unknown"].join(":"):e}function Lm(r,e,t){const i=$x(),n=Lx();return[[r,e].join("-"),[Ox,t].join("-"),i,n].join("/")}function Bx({protocol:r,version:e,relayUrl:t,sdkVersion:i,auth:n,projectId:s,useOnCloseEvent:a,bundleId:f,packageName:h}){const u=t.split("?"),g=Lm(r,e,i),w={auth:n,ua:g,projectId:s,useOnCloseEvent:a||void 0,packageName:h||void 0,bundleId:f||void 0},M=Nx(u[1]||"",w);return u[0]+"?"+M}function To(r,e){return r.filter(t=>e.includes(t)).length===r.length}function Bm(r){return Object.fromEntries(r.entries())}function Um(r){return new Map(Object.entries(r))}function No(r=_e.FIVE_MINUTES,e){const t=_e.toMiliseconds(r||_e.FIVE_MINUTES);let i,n,s,a;return{resolve:f=>{s&&i&&(clearTimeout(s),i(f),a=Promise.resolve(f))},reject:f=>{s&&n&&(clearTimeout(s),n(f))},done:()=>new Promise((f,h)=>{if(a)return f(a);s=setTimeout(()=>{const u=new Error(e);a=Promise.reject(u),h(u)},t),i=f,n=h})}}function Gs(r,e,t){return new Promise(async(i,n)=>{const s=setTimeout(()=>n(new Error(t)),e);try{const a=await r;i(a)}catch(a){n(a)}clearTimeout(s)})}function Fm(r,e){if(typeof e=="string"&&e.startsWith(`${r}:`))return e;if(r.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(r.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${r}`)}function Ux(r){return Fm("topic",r)}function Fx(r){return Fm("id",r)}function qm(r){const[e,t]=r.split(":"),i={id:void 0,topic:void 0};if(e==="topic"&&typeof t=="string")i.topic=t;else if(e==="id"&&Number.isInteger(Number(t)))i.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${t}`);return i}function Ir(r,e){return _e.fromMiliseconds((e||Date.now())+_e.toMiliseconds(r))}function Js(r){return Date.now()>=_e.toMiliseconds(r)}function Dt(r,e){return`${r}${e?`:${e}`:""}`}function ql(r=[],e=[]){return[...new Set([...r,...e])]}async function qx({id:r,topic:e,wcDeepLink:t}){var i;try{if(!t)return;const n=typeof t=="string"?JSON.parse(t):t,s=n?.href;if(typeof s!="string")return;const a=zx(s,r,e),f=Wc();if(f===Bi.browser){if(!((i=Oc())!=null&&i.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}kx(a)}else f===Bi.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(a)}catch(n){console.error(n)}}function zx(r,e,t){const i=`requestId=${e}&sessionTopic=${t}`;r.endsWith("/")&&(r=r.slice(0,-1));let n=`${r}`;if(r.startsWith("https://t.me")){const s=r.includes("?")?"&startapp=":"?startapp=";n=`${n}${s}${Kx(i,!0)}`}else n=`${n}/wc?${i}`;return n}function kx(r){let e="_self";Wx()?e="_top":(jx()||r.startsWith("https://")||r.startsWith("http://"))&&(e="_blank"),window.open(r,e,"noreferrer noopener")}async function Hx(r,e){let t="";try{if(jc()&&(t=localStorage.getItem(e),t))return t;t=await r.getItem(e)}catch(i){console.error(i)}return t}function zm(r,e){if(!r.includes(e))return null;const t=r.split(/([&,?,=])/),i=t.indexOf(e);return t[i+2]}function km(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,r=>{const e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)})}function Jd(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function jx(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function Wx(){try{return window.self!==window.top}catch{return!1}}function Kx(r,e=!1){const t=Buffer.from(r).toString("base64");return e?t.replace(/[=]/g,""):t}function Hm(r){return Buffer.from(r,"base64").toString("utf-8")}function Vx(r){return new Promise(e=>setTimeout(e,r))}const Gx="https://rpc.walletconnect.org/v1";async function Jx(r,e,t,i,n,s){switch(t.t){case"eip191":return Yx(r,e,t.s);case"eip1271":return await Qx(r,e,t.s,i,n,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${t.t}`)}}function Yx(r,e,t){return g_(Xg(e),t).toLowerCase()===r.toLowerCase()}async function Qx(r,e,t,i,n,s){const a=qa(i);if(!a.namespace||!a.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${i}`);try{const f="0x1626ba7e",h="0000000000000000000000000000000000000000000000000000000000000040",u="0000000000000000000000000000000000000000000000000000000000000041",g=t.substring(2),w=Xg(e).substring(2),M=f+w+h+u+g,P=await fetch(`${s||Gx}/?chainId=${i}&projectId=${n}`,{method:"POST",body:JSON.stringify({id:Zx(),jsonrpc:"2.0",method:"eth_call",params:[{to:r,data:M},"latest"]})}),{result:O}=await P.json();return O?O.slice(0,f.length).toLowerCase()===f.toLowerCase():!1}catch(f){return console.error("isValidEip1271Signature: ",f),!1}}function Zx(){return Date.now()+Math.floor(Math.random()*1e3)}var Xx=Object.defineProperty,eE=Object.defineProperties,tE=Object.getOwnPropertyDescriptors,jm=Object.getOwnPropertySymbols,rE=Object.prototype.hasOwnProperty,iE=Object.prototype.propertyIsEnumerable,Wm=(r,e,t)=>e in r?Xx(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,nE=(r,e)=>{for(var t in e||(e={}))rE.call(e,t)&&Wm(r,t,e[t]);if(jm)for(var t of jm(e))iE.call(e,t)&&Wm(r,t,e[t]);return r},sE=(r,e)=>eE(r,tE(e));const oE="did:pkh:",Yd=r=>r?.split(":"),aE=r=>{const e=r&&Yd(r);if(e)return r.includes(oE)?e[3]:e[1]},Qd=r=>{const e=r&&Yd(r);if(e)return e[2]+":"+e[3]},zl=r=>{const e=r&&Yd(r);if(e)return e.pop()};async function Km(r){const{cacao:e,projectId:t}=r,{s:i,p:n}=e,s=Vm(n,n.iss),a=zl(n.iss);return await Jx(a,s,i,Qd(n.iss),t)}const Vm=(r,e)=>{const t=`${r.domain} wants you to sign in with your Ethereum account:`,i=zl(e);if(!r.aud&&!r.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let n=r.statement||void 0;const s=`URI: ${r.aud||r.uri}`,a=`Version: ${r.version}`,f=`Chain ID: ${aE(e)}`,h=`Nonce: ${r.nonce}`,u=`Issued At: ${r.iat}`,g=r.exp?`Expiration Time: ${r.exp}`:void 0,w=r.nbf?`Not Before: ${r.nbf}`:void 0,M=r.requestId?`Request ID: ${r.requestId}`:void 0,P=r.resources?`Resources:${r.resources.map($=>`
|
|
23
|
+
- ${$}`).join("")}`:void 0,O=kl(r.resources);if(O){const $=Kc(O);n=vE(n,$)}return[t,i,"",n,"",s,a,f,h,u,g,w,M,P].filter($=>$!=null).join(`
|
|
24
|
+
`)};function cE(r){return Buffer.from(JSON.stringify(r)).toString("base64")}function fE(r){return JSON.parse(Buffer.from(r,"base64").toString("utf-8"))}function $o(r){if(!r)throw new Error("No recap provided, value is undefined");if(!r.att)throw new Error("No `att` property found");const e=Object.keys(r.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(t=>{const i=r.att[t];if(Array.isArray(i))throw new Error(`Resource must be an object: ${t}`);if(typeof i!="object")throw new Error(`Resource must be an object: ${t}`);if(!Object.keys(i).length)throw new Error(`Resource object is empty: ${t}`);Object.keys(i).forEach(n=>{const s=i[n];if(!Array.isArray(s))throw new Error(`Ability limits ${n} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${n} is empty array, must be an array with objects`);s.forEach(a=>{if(typeof a!="object")throw new Error(`Ability limits (${n}) must be an array of objects, found: ${a}`)})})})}function lE(r,e,t,i={}){return t?.sort((n,s)=>n.localeCompare(s)),{att:{[r]:hE(e,t,i)}}}function hE(r,e,t={}){e=e?.sort((n,s)=>n.localeCompare(s));const i=e.map(n=>({[`${r}/${n}`]:[t]}));return Object.assign({},...i)}function Gm(r){return $o(r),`urn:recap:${cE(r).replace(/=/g,"")}`}function Kc(r){const e=fE(r.replace("urn:recap:",""));return $o(e),e}function uE(r,e,t){const i=lE(r,e,t);return Gm(i)}function dE(r){return r&&r.includes("urn:recap:")}function pE(r,e){const t=Kc(r),i=Kc(e),n=gE(t,i);return Gm(n)}function gE(r,e){$o(r),$o(e);const t=Object.keys(r.att).concat(Object.keys(e.att)).sort((n,s)=>n.localeCompare(s)),i={att:{}};return t.forEach(n=>{var s,a;Object.keys(((s=r.att)==null?void 0:s[n])||{}).concat(Object.keys(((a=e.att)==null?void 0:a[n])||{})).sort((f,h)=>f.localeCompare(h)).forEach(f=>{var h,u;i.att[n]=sE(nE({},i.att[n]),{[f]:((h=r.att[n])==null?void 0:h[f])||((u=e.att[n])==null?void 0:u[f])})})}),i}function vE(r="",e){$o(e);const t="I further authorize the stated URI to perform the following actions on my behalf: ";if(r.includes(t))return r;const i=[];let n=0;Object.keys(e.att).forEach(f=>{const h=Object.keys(e.att[f]).map(w=>({ability:w.split("/")[0],action:w.split("/")[1]}));h.sort((w,M)=>w.action.localeCompare(M.action));const u={};h.forEach(w=>{u[w.ability]||(u[w.ability]=[]),u[w.ability].push(w.action)});const g=Object.keys(u).map(w=>(n++,`(${n}) '${w}': '${u[w].join("', '")}' for '${f}'.`));i.push(g.join(", ").replace(".,","."))});const s=i.join(" "),a=`${t}${s}`;return`${r?r+" ":""}${a}`}function Jm(r){var e;const t=Kc(r);$o(t);const i=(e=t.att)==null?void 0:e.eip155;return i?Object.keys(i).map(n=>n.split("/")[1]):[]}function Ym(r){const e=Kc(r);$o(e);const t=[];return Object.values(e.att).forEach(i=>{Object.values(i).forEach(n=>{var s;(s=n?.[0])!=null&&s.chains&&t.push(n[0].chains)})}),[...new Set(t.flat())]}function kl(r){if(!r)return;const e=r?.[r.length-1];return dE(e)?e:void 0}const Qm="base10",oi="base16",Ys="base64pad",Vc="base64url",Gc="utf8",Zm=0,ws=1,Jc=2,mE=0,Xm=1,Yc=12,Zd=32;function bE(){const r=Pd.generateKeyPair();return{privateKey:$i(r.secretKey,oi),publicKey:$i(r.publicKey,oi)}}function Xd(){const r=Hs.randomBytes(Zd);return $i(r,oi)}function wE(r,e){const t=Pd.sharedKey(Zi(r,oi),Zi(e,oi),!0),i=new J_(qc.SHA256,t).expand(Zd);return $i(i,oi)}function Hl(r){const e=qc.hash(Zi(r,oi));return $i(e,oi)}function ys(r){const e=qc.hash(Zi(r,Gc));return $i(e,oi)}function eb(r){return Zi(`${r}`,Qm)}function Lo(r){return Number($i(r,Qm))}function yE(r){const e=eb(typeof r.type<"u"?r.type:Zm);if(Lo(e)===ws&&typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const t=typeof r.senderPublicKey<"u"?Zi(r.senderPublicKey,oi):void 0,i=typeof r.iv<"u"?Zi(r.iv,oi):Hs.randomBytes(Yc),n=new xd.ChaCha20Poly1305(Zi(r.symKey,oi)).seal(i,Zi(r.message,Gc));return tb({type:e,sealed:n,iv:i,senderPublicKey:t,encoding:r.encoding})}function _E(r,e){const t=eb(Jc),i=Hs.randomBytes(Yc),n=Zi(r,Gc);return tb({type:t,sealed:n,iv:i,encoding:e})}function xE(r){const e=new xd.ChaCha20Poly1305(Zi(r.symKey,oi)),{sealed:t,iv:i}=Qc({encoded:r.encoded,encoding:r?.encoding}),n=e.open(i,t);if(n===null)throw new Error("Failed to decrypt");return $i(n,Gc)}function EE(r,e){const{sealed:t}=Qc({encoded:r,encoding:e});return $i(t,Gc)}function tb(r){const{encoding:e=Ys}=r;if(Lo(r.type)===Jc)return $i(Dd([r.type,r.sealed]),e);if(Lo(r.type)===ws){if(typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return $i(Dd([r.type,r.senderPublicKey,r.iv,r.sealed]),e)}return $i(Dd([r.type,r.iv,r.sealed]),e)}function Qc(r){const{encoded:e,encoding:t=Ys}=r,i=Zi(e,t),n=i.slice(mE,Xm),s=Xm;if(Lo(n)===ws){const u=s+Zd,g=u+Yc,w=i.slice(s,u),M=i.slice(u,g),P=i.slice(g);return{type:n,sealed:P,iv:M,senderPublicKey:w}}if(Lo(n)===Jc){const u=i.slice(s),g=Hs.randomBytes(Yc);return{type:n,sealed:u,iv:g}}const a=s+Yc,f=i.slice(s,a),h=i.slice(a);return{type:n,sealed:h,iv:f}}function AE(r,e){const t=Qc({encoded:r,encoding:e?.encoding});return rb({type:Lo(t.type),senderPublicKey:typeof t.senderPublicKey<"u"?$i(t.senderPublicKey,oi):void 0,receiverPublicKey:e?.receiverPublicKey})}function rb(r){const e=r?.type||Zm;if(e===ws){if(typeof r?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof r?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:r?.senderPublicKey,receiverPublicKey:r?.receiverPublicKey}}function ib(r){return r.type===ws&&typeof r.senderPublicKey=="string"&&typeof r.receiverPublicKey=="string"}function nb(r){return r.type===Jc}function SE(r){return new am.ec("p256").keyFromPublic({x:Buffer.from(r.x,"base64").toString("hex"),y:Buffer.from(r.y,"base64").toString("hex")},"hex")}function IE(r){let e=r.replace(/-/g,"+").replace(/_/g,"/");const t=e.length%4;return t>0&&(e+="=".repeat(4-t)),e}function ME(r){return Buffer.from(IE(r),"base64")}function CE(r,e){const[t,i,n]=r.split("."),s=ME(n);if(s.length!==64)throw new Error("Invalid signature length");const a=s.slice(0,32).toString("hex"),f=s.slice(32,64).toString("hex"),h=`${t}.${i}`,u=new qc.SHA256().update(Buffer.from(h)).digest(),g=SE(e),w=Buffer.from(u).toString("hex");if(!g.verify(w,{r:a,s:f}))throw new Error("Invalid signature");return Gd(r).payload}const PE="irn";function jl(r){return r?.relay||{protocol:PE}}function Zc(r){const e=Cx[r];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${r}`);return e}function DE(r,e="-"){const t={},i="relay"+e;return Object.keys(r).forEach(n=>{if(n.startsWith(i)){const s=n.replace(i,""),a=r[n];t[s]=a}}),t}function sb(r){if(!r.includes("wc:")){const u=Hm(r);u!=null&&u.includes("wc:")&&(r=u)}r=r.includes("wc://")?r.replace("wc://",""):r,r=r.includes("wc:")?r.replace("wc:",""):r;const e=r.indexOf(":"),t=r.indexOf("?")!==-1?r.indexOf("?"):void 0,i=r.substring(0,e),n=r.substring(e+1,t).split("@"),s=typeof t<"u"?r.substring(t):"",a=new URLSearchParams(s),f={};a.forEach((u,g)=>{f[g]=u});const h=typeof f.methods=="string"?f.methods.split(","):void 0;return{protocol:i,topic:OE(n[0]),version:parseInt(n[1],10),symKey:f.symKey,relay:DE(f),methods:h,expiryTimestamp:f.expiryTimestamp?parseInt(f.expiryTimestamp,10):void 0}}function OE(r){return r.startsWith("//")?r.substring(2):r}function RE(r,e="-"){const t="relay",i={};return Object.keys(r).forEach(n=>{const s=t+e+n;r[n]&&(i[s]=r[n])}),i}function ob(r){const e=new URLSearchParams,t=RE(r.relay);Object.keys(t).sort().forEach(n=>{e.set(n,t[n])}),e.set("symKey",r.symKey),r.expiryTimestamp&&e.set("expiryTimestamp",r.expiryTimestamp.toString()),r.methods&&e.set("methods",r.methods.join(","));const i=e.toString();return`${r.protocol}:${r.topic}@${r.version}?${i}`}function Wl(r,e,t){return`${r}?wc_ev=${t}&topic=${e}`}function za(r){const e=[];return r.forEach(t=>{const[i,n]=t.split(":");e.push(`${i}:${n}`)}),e}function TE(r){const e=[];return Object.values(r).forEach(t=>{e.push(...za(t.accounts))}),e}function NE(r,e){const t=[];return Object.values(r).forEach(i=>{za(i.accounts).includes(e)&&t.push(...i.methods)}),t}function $E(r,e){const t=[];return Object.values(r).forEach(i=>{za(i.accounts).includes(e)&&t.push(...i.events)}),t}function e0(r){return r.includes(":")}function Xc(r){return e0(r)?r.split(":")[0]:r}function LE(r){const e={};return r?.forEach(t=>{const[i,n]=t.split(":");e[i]||(e[i]={accounts:[],chains:[],events:[]}),e[i].accounts.push(t),e[i].chains.push(`${i}:${n}`)}),e}function ab(r,e){e=e.map(i=>i.replace("did:pkh:",""));const t=LE(e);for(const[i,n]of Object.entries(t))n.methods?n.methods=ql(n.methods,r):n.methods=r,n.events=["chainChanged","accountsChanged"];return t}const BE={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}},UE={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 xe(r,e){const{message:t,code:i}=UE[r];return{message:e?`${t} ${e}`:t,code:i}}function Gt(r,e){const{message:t,code:i}=BE[r];return{message:e?`${t} ${e}`:t,code:i}}function _s(r,e){return Array.isArray(r)?typeof e<"u"&&r.length?r.every(e):!0:!1}function ef(r){return Object.getPrototypeOf(r)===Object.prototype&&Object.keys(r).length}function ai(r){return typeof r>"u"}function wr(r,e){return e&&ai(r)?!0:typeof r=="string"&&!!r.trim().length}function t0(r,e){return e&&ai(r)?!0:typeof r=="number"&&!isNaN(r)}function FE(r,e){const{requiredNamespaces:t}=e,i=Object.keys(r.namespaces),n=Object.keys(t);let s=!0;return To(n,i)?(i.forEach(a=>{const{accounts:f,methods:h,events:u}=r.namespaces[a],g=za(f),w=t[a];(!To(Tm(a,w),g)||!To(w.methods,h)||!To(w.events,u))&&(s=!1)}),s):!1}function Kl(r){return wr(r,!1)&&r.includes(":")?r.split(":").length===2:!1}function qE(r){if(wr(r,!1)&&r.includes(":")){const e=r.split(":");if(e.length===3){const t=e[0]+":"+e[1];return!!e[2]&&Kl(t)}}return!1}function zE(r){function e(t){try{return typeof new URL(t)<"u"}catch{return!1}}try{if(wr(r,!1)){if(e(r))return!0;const t=Hm(r);return e(t)}}catch{}return!1}function kE(r){var e;return(e=r?.proposer)==null?void 0:e.publicKey}function HE(r){return r?.topic}function jE(r,e){let t=null;return wr(r?.publicKey,!1)||(t=xe("MISSING_OR_INVALID",`${e} controller public key should be a string`)),t}function cb(r){let e=!0;return _s(r)?r.length&&(e=r.every(t=>wr(t,!1))):e=!1,e}function WE(r,e,t){let i=null;return _s(e)&&e.length?e.forEach(n=>{i||Kl(n)||(i=Gt("UNSUPPORTED_CHAINS",`${t}, chain ${n} should be a string and conform to "namespace:chainId" format`))}):Kl(r)||(i=Gt("UNSUPPORTED_CHAINS",`${t}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),i}function KE(r,e,t){let i=null;return Object.entries(r).forEach(([n,s])=>{if(i)return;const a=WE(n,Tm(n,s),`${e} ${t}`);a&&(i=a)}),i}function VE(r,e){let t=null;return _s(r)?r.forEach(i=>{t||qE(i)||(t=Gt("UNSUPPORTED_ACCOUNTS",`${e}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):t=Gt("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),t}function GE(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;const n=VE(i?.accounts,`${e} namespace`);n&&(t=n)}),t}function JE(r,e){let t=null;return cb(r?.methods)?cb(r?.events)||(t=Gt("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):t=Gt("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),t}function fb(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;const n=JE(i,`${e}, namespace`);n&&(t=n)}),t}function YE(r,e,t){let i=null;if(r&&ef(r)){const n=fb(r,e);n&&(i=n);const s=KE(r,e,t);s&&(i=s)}else i=xe("MISSING_OR_INVALID",`${e}, ${t} should be an object with data`);return i}function r0(r,e){let t=null;if(r&&ef(r)){const i=fb(r,e);i&&(t=i);const n=GE(r,e);n&&(t=n)}else t=xe("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return t}function lb(r){return wr(r.protocol,!0)}function QE(r,e){let t=!1;return e&&!r?t=!0:r&&_s(r)&&r.length&&r.forEach(i=>{t=lb(i)}),t}function ZE(r){return typeof r=="number"}function bi(r){return typeof r<"u"&&typeof r!==null}function XE(r){return!(!r||typeof r!="object"||!r.code||!t0(r.code,!1)||!r.message||!wr(r.message,!1))}function eA(r){return!(ai(r)||!wr(r.method,!1))}function tA(r){return!(ai(r)||ai(r.result)&&ai(r.error)||!t0(r.id,!1)||!wr(r.jsonrpc,!1))}function rA(r){return!(ai(r)||!wr(r.name,!1))}function hb(r,e){return!(!Kl(e)||!TE(r).includes(e))}function iA(r,e,t){return wr(t,!1)?NE(r,e).includes(t):!1}function nA(r,e,t){return wr(t,!1)?$E(r,e).includes(t):!1}function ub(r,e,t){let i=null;const n=sA(r),s=oA(e),a=Object.keys(n),f=Object.keys(s),h=db(Object.keys(r)),u=db(Object.keys(e)),g=h.filter(w=>!u.includes(w));return g.length&&(i=xe("NON_CONFORMING_NAMESPACES",`${t} namespaces keys don't satisfy requiredNamespaces.
|
|
25
25
|
Required: ${g.toString()}
|
|
26
26
|
Received: ${Object.keys(e).toString()}`)),To(a,f)||(i=xe("NON_CONFORMING_NAMESPACES",`${t} namespaces chains don't satisfy required namespaces.
|
|
27
27
|
Required: ${a.toString()}
|
|
28
28
|
Approved: ${f.toString()}`)),Object.keys(e).forEach(w=>{if(!w.includes(":")||i)return;const M=za(e[w].accounts);M.includes(w)||(i=xe("NON_CONFORMING_NAMESPACES",`${t} namespaces accounts don't satisfy namespace accounts for ${w}
|
|
29
29
|
Required: ${w}
|
|
30
|
-
Approved: ${M.toString()}`))}),a.forEach(w=>{i||(To(n[w].methods,s[w].methods)?To(n[w].events,s[w].events)||(i=xe("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy namespace events for ${w}`)):i=xe("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy namespace methods for ${w}`))}),i}function PE(r){const e={};return Object.keys(r).forEach(t=>{var i;t.includes(":")?e[t]=r[t]:(i=r[t].chains)==null||i.forEach(n=>{e[n]={methods:r[t].methods,events:r[t].events}})}),e}function Eb(r){return[...new Set(r.map(e=>e.includes(":")?e.split(":")[0]:e))]}function DE(r){const e={};return Object.keys(r).forEach(t=>{if(t.includes(":"))e[t]=r[t];else{const i=za(r[t].accounts);i?.forEach(n=>{e[n]={accounts:r[t].accounts.filter(s=>s.includes(`${n}:`)),methods:r[t].methods,events:r[t].events}})}}),e}function OE(r,e){return i0(r,!1)&&r<=e.max&&r>=e.min}function Sb(){const r=Kc();return new Promise(e=>{switch(r){case Bi.browser:e(RE());break;case Bi.reactNative:e(TE());break;case Bi.node:e(NE());break;default:e(!0)}})}function RE(){return Wc()&&navigator?.onLine}async function TE(){if(Vs()&&typeof global<"u"&&global!=null&&global.NetInfo){const r=await(global==null?void 0:global.NetInfo.fetch());return r?.isConnected}return!0}function NE(){return!0}function $E(r){switch(Kc()){case Bi.browser:LE(r);break;case Bi.reactNative:BE(r);break}}function LE(r){!Vs()&&Wc()&&(window.addEventListener("online",()=>r(!0)),window.addEventListener("offline",()=>r(!1)))}function BE(r){Vs()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>r(e?.isConnected))}const s0={};class rf{static get(e){return s0[e]}static set(e,t){s0[e]=t}static delete(e){delete s0[e]}}class Bo{}class FE extends Bo{constructor(e){super()}}const Ib=_e.FIVE_SECONDS,Ha={pulse:"heartbeat_pulse"};class o0 extends FE{constructor(e){super(e),this.events=new zr.exports.EventEmitter,this.interval=Ib,this.interval=e?.interval||Ib}static async init(e){const t=new o0(e);return await t.init(),t}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),_e.toMiliseconds(this.interval))}pulse(){this.events.emit(Ha.pulse)}}const UE=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,qE=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,zE=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function HE(r,e){if(r==="__proto__"||r==="constructor"&&e&&typeof e=="object"&&"prototype"in e){kE(r);return}return e}function kE(r){console.warn(`[destr] Dropping "${r}" key to prevent prototype pollution.`)}function Gl(r,e={}){if(typeof r!="string")return r;const t=r.trim();if(r[0]==='"'&&r.at(-1)==='"'&&!r.includes("\\"))return t.slice(1,-1);if(t.length<=9){const i=t.toLowerCase();if(i==="true")return!0;if(i==="false")return!1;if(i==="undefined")return;if(i==="null")return null;if(i==="nan")return Number.NaN;if(i==="infinity")return Number.POSITIVE_INFINITY;if(i==="-infinity")return Number.NEGATIVE_INFINITY}if(!zE.test(r)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return r}try{if(UE.test(r)||qE.test(r)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(r,HE)}return JSON.parse(r)}catch(i){if(e.strict)throw i;return r}}function jE(r){return!r||typeof r.then!="function"?Promise.resolve(r):r}function $r(r,...e){try{return jE(r(...e))}catch(t){return Promise.reject(t)}}function WE(r){const e=typeof r;return r===null||e!=="object"&&e!=="function"}function KE(r){const e=Object.getPrototypeOf(r);return!e||e.isPrototypeOf(Object)}function Yl(r){if(WE(r))return String(r);if(KE(r)||Array.isArray(r))return JSON.stringify(r);if(typeof r.toJSON=="function")return Yl(r.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function Mb(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}const a0="base64:";function VE(r){if(typeof r=="string")return r;Mb();const e=Buffer.from(r).toString("base64");return a0+e}function GE(r){return typeof r!="string"||!r.startsWith(a0)?r:(Mb(),Buffer.from(r.slice(a0.length),"base64"))}function wi(r){return r?r.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function YE(...r){return wi(r.join(":"))}function Jl(r){return r=wi(r),r?r+":":""}function pH(r){return r}const JE="memory",QE=()=>{const r=new Map;return{name:JE,options:{},hasItem(e){return r.has(e)},getItem(e){return r.get(e)||null},getItemRaw(e){return r.get(e)||null},setItem(e,t){r.set(e,t)},setItemRaw(e,t){r.set(e,t)},removeItem(e){r.delete(e)},getKeys(){return Array.from(r.keys())},clear(){r.clear()},dispose(){r.clear()}}};function ZE(r={}){const e={mounts:{"":r.driver||QE()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},t=u=>{for(const g of e.mountpoints)if(u.startsWith(g))return{base:g,relativeKey:u.slice(g.length),driver:e.mounts[g]};return{base:"",relativeKey:u,driver:e.mounts[""]}},i=(u,g)=>e.mountpoints.filter(w=>w.startsWith(u)||g&&u.startsWith(w)).map(w=>({relativeBase:u.length>w.length?u.slice(w.length):void 0,mountpoint:w,driver:e.mounts[w]})),n=(u,g)=>{if(e.watching){g=wi(g);for(const w of e.watchListeners)w(u,g)}},s=async()=>{if(!e.watching){e.watching=!0;for(const u in e.mounts)e.unwatch[u]=await Cb(e.mounts[u],n,u)}},a=async()=>{if(e.watching){for(const u in e.unwatch)await e.unwatch[u]();e.unwatch={},e.watching=!1}},f=(u,g,w)=>{const M=new Map,C=O=>{let N=M.get(O.base);return N||(N={driver:O.driver,base:O.base,items:[]},M.set(O.base,N)),N};for(const O of u){const N=typeof O=="string",j=wi(N?O:O.key),H=N?void 0:O.value,F=N||!O.options?g:{...g,...O.options},G=t(j);C(G).items.push({key:j,value:H,relativeKey:G.relativeKey,options:F})}return Promise.all([...M.values()].map(O=>w(O))).then(O=>O.flat())},h={hasItem(u,g={}){u=wi(u);const{relativeKey:w,driver:M}=t(u);return $r(M.hasItem,w,g)},getItem(u,g={}){u=wi(u);const{relativeKey:w,driver:M}=t(u);return $r(M.getItem,w,g).then(C=>Gl(C))},getItems(u,g){return f(u,g,w=>w.driver.getItems?$r(w.driver.getItems,w.items.map(M=>({key:M.relativeKey,options:M.options})),g).then(M=>M.map(C=>({key:YE(w.base,C.key),value:Gl(C.value)}))):Promise.all(w.items.map(M=>$r(w.driver.getItem,M.relativeKey,M.options).then(C=>({key:M.key,value:Gl(C)})))))},getItemRaw(u,g={}){u=wi(u);const{relativeKey:w,driver:M}=t(u);return M.getItemRaw?$r(M.getItemRaw,w,g):$r(M.getItem,w,g).then(C=>GE(C))},async setItem(u,g,w={}){if(g===void 0)return h.removeItem(u);u=wi(u);const{relativeKey:M,driver:C}=t(u);C.setItem&&(await $r(C.setItem,M,Yl(g),w),C.watch||n("update",u))},async setItems(u,g){await f(u,g,async w=>{w.driver.setItems&&await $r(w.driver.setItems,w.items.map(M=>({key:M.relativeKey,value:Yl(M.value),options:M.options})),g),w.driver.setItem&&await Promise.all(w.items.map(M=>$r(w.driver.setItem,M.relativeKey,Yl(M.value),M.options)))})},async setItemRaw(u,g,w={}){if(g===void 0)return h.removeItem(u,w);u=wi(u);const{relativeKey:M,driver:C}=t(u);if(C.setItemRaw)await $r(C.setItemRaw,M,g,w);else if(C.setItem)await $r(C.setItem,M,VE(g),w);else return;C.watch||n("update",u)},async removeItem(u,g={}){typeof g=="boolean"&&(g={removeMeta:g}),u=wi(u);const{relativeKey:w,driver:M}=t(u);M.removeItem&&(await $r(M.removeItem,w,g),(g.removeMeta||g.removeMata)&&await $r(M.removeItem,w+"$",g),M.watch||n("remove",u))},async getMeta(u,g={}){typeof g=="boolean"&&(g={nativeOnly:g}),u=wi(u);const{relativeKey:w,driver:M}=t(u),C=Object.create(null);if(M.getMeta&&Object.assign(C,await $r(M.getMeta,w,g)),!g.nativeOnly){const O=await $r(M.getItem,w+"$",g).then(N=>Gl(N));O&&typeof O=="object"&&(typeof O.atime=="string"&&(O.atime=new Date(O.atime)),typeof O.mtime=="string"&&(O.mtime=new Date(O.mtime)),Object.assign(C,O))}return C},setMeta(u,g,w={}){return this.setItem(u+"$",g,w)},removeMeta(u,g={}){return this.removeItem(u+"$",g)},async getKeys(u,g={}){u=Jl(u);const w=i(u,!0);let M=[];const C=[];for(const O of w){const j=(await $r(O.driver.getKeys,O.relativeBase,g)).map(H=>O.mountpoint+wi(H)).filter(H=>!M.some(F=>H.startsWith(F)));C.push(...j),M=[O.mountpoint,...M.filter(H=>!H.startsWith(O.mountpoint))]}return u?C.filter(O=>O.startsWith(u)&&!O.endsWith("$")):C.filter(O=>!O.endsWith("$"))},async clear(u,g={}){u=Jl(u),await Promise.all(i(u,!1).map(async w=>{if(w.driver.clear)return $r(w.driver.clear,w.relativeBase,g);if(w.driver.removeItem){const M=await w.driver.getKeys(w.relativeBase||"",g);return Promise.all(M.map(C=>w.driver.removeItem(C,g)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(u=>Pb(u)))},async watch(u){return await s(),e.watchListeners.push(u),async()=>{e.watchListeners=e.watchListeners.filter(g=>g!==u),e.watchListeners.length===0&&await a()}},async unwatch(){e.watchListeners=[],await a()},mount(u,g){if(u=Jl(u),u&&e.mounts[u])throw new Error(`already mounted at ${u}`);return u&&(e.mountpoints.push(u),e.mountpoints.sort((w,M)=>M.length-w.length)),e.mounts[u]=g,e.watching&&Promise.resolve(Cb(g,n,u)).then(w=>{e.unwatch[u]=w}).catch(console.error),h},async unmount(u,g=!0){u=Jl(u),!(!u||!e.mounts[u])&&(e.watching&&u in e.unwatch&&(e.unwatch[u](),delete e.unwatch[u]),g&&await Pb(e.mounts[u]),e.mountpoints=e.mountpoints.filter(w=>w!==u),delete e.mounts[u])},getMount(u=""){u=wi(u)+":";const g=t(u);return{driver:g.driver,base:g.base}},getMounts(u="",g={}){return u=wi(u),i(u,g.parents).map(M=>({driver:M.driver,base:M.mountpoint}))}};return h}function Cb(r,e,t){return r.watch?r.watch((i,n)=>e(i,t+n)):()=>{}}async function Pb(r){typeof r.dispose=="function"&&await $r(r.dispose)}function Fo(r){return new Promise((e,t)=>{r.oncomplete=r.onsuccess=()=>e(r.result),r.onabort=r.onerror=()=>t(r.error)})}function Db(r,e){const t=indexedDB.open(r);t.onupgradeneeded=()=>t.result.createObjectStore(e);const i=Fo(t);return(n,s)=>i.then(a=>s(a.transaction(e,n).objectStore(e)))}let c0;function nf(){return c0||(c0=Db("keyval-store","keyval")),c0}function Ob(r,e=nf()){return e("readonly",t=>Fo(t.get(r)))}function XE(r,e,t=nf()){return t("readwrite",i=>(i.put(e,r),Fo(i.transaction)))}function eS(r,e=nf()){return e("readwrite",t=>(t.delete(r),Fo(t.transaction)))}function tS(r=nf()){return r("readwrite",e=>(e.clear(),Fo(e.transaction)))}function rS(r,e){return r.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Fo(r.transaction)}function iS(r=nf()){return r("readonly",e=>{if(e.getAllKeys)return Fo(e.getAllKeys());const t=[];return rS(e,i=>t.push(i.key)).then(()=>t)})}const nS="idb-keyval";var sS=(r={})=>{const e=r.base&&r.base.length>0?`${r.base}:`:"",t=n=>e+n;let i;return r.dbName&&r.storeName&&(i=Db(r.dbName,r.storeName)),{name:nS,options:r,async hasItem(n){return!(typeof await Ob(t(n),i)>"u")},async getItem(n){return await Ob(t(n),i)??null},setItem(n,s){return XE(t(n),s,i)},removeItem(n){return eS(t(n),i)},getKeys(){return iS(i)},clear(){return tS(i)}}};const oS="WALLET_CONNECT_V2_INDEXED_DB",aS="keyvaluestorage";class cS{constructor(){this.indexedDb=ZE({driver:sS({dbName:oS,storeName:aS})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const t=await this.indexedDb.getItem(e);if(t!==null)return t}async setItem(e,t){await this.indexedDb.setItem(e,bs(t))}async removeItem(e){await this.indexedDb.removeItem(e)}}var f0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ql={exports:{}};(function(){let r;function e(){}r=e,r.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},r.prototype.setItem=function(t,i){this[t]=String(i)},r.prototype.removeItem=function(t){delete this[t]},r.prototype.clear=function(){const t=this;Object.keys(t).forEach(function(i){t[i]=void 0,delete t[i]})},r.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof f0<"u"&&f0.localStorage?Ql.exports=f0.localStorage:typeof window<"u"&&window.localStorage?Ql.exports=window.localStorage:Ql.exports=new e})();function fS(r){var e;return[r[0],Ro((e=r[1])!=null?e:"")]}class lS{constructor(){this.localStorage=Ql.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(fS)}async getItem(e){const t=this.localStorage.getItem(e);if(t!==null)return Ro(t)}async setItem(e,t){this.localStorage.setItem(e,bs(t))}async removeItem(e){this.localStorage.removeItem(e)}}const hS="wc_storage_version",Rb=1,uS=async(r,e,t)=>{const i=hS,n=await e.getItem(i);if(n&&n>=Rb){t(e);return}const s=await r.getKeys();if(!s.length){t(e);return}const a=[];for(;s.length;){const f=s.shift();if(!f)continue;const h=f.toLowerCase();if(h.includes("wc@")||h.includes("walletconnect")||h.includes("wc_")||h.includes("wallet_connect")){const u=await r.getItem(f);await e.setItem(f,u),a.push(f)}}await e.setItem(i,Rb),t(e),dS(r,a)},dS=async(r,e)=>{e.length&&e.forEach(async t=>{await r.removeItem(t)})};class pS{constructor(){this.initialized=!1,this.setInitialized=t=>{this.storage=t,this.initialized=!0};const e=new lS;this.storage=e;try{const t=new cS;uS(e,t,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const t=setInterval(()=>{this.initialized&&(clearInterval(t),e())},20)})}}function gS(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}var vS=mS;function mS(r,e,t){var i=t&&t.stringify||gS,n=1;if(typeof r=="object"&&r!==null){var s=e.length+n;if(s===1)return r;var a=new Array(s);a[0]=i(r);for(var f=1;f<s;f++)a[f]=i(e[f]);return a.join(" ")}if(typeof r!="string")return r;var h=e.length;if(h===0)return r;for(var u="",g=1-n,w=-1,M=r&&r.length||0,C=0;C<M;){if(r.charCodeAt(C)===37&&C+1<M){switch(w=w>-1?w:0,r.charCodeAt(C+1)){case 100:case 102:if(g>=h||e[g]==null)break;w<C&&(u+=r.slice(w,C)),u+=Number(e[g]),w=C+2,C++;break;case 105:if(g>=h||e[g]==null)break;w<C&&(u+=r.slice(w,C)),u+=Math.floor(Number(e[g])),w=C+2,C++;break;case 79:case 111:case 106:if(g>=h||e[g]===void 0)break;w<C&&(u+=r.slice(w,C));var O=typeof e[g];if(O==="string"){u+="'"+e[g]+"'",w=C+2,C++;break}if(O==="function"){u+=e[g].name||"<anonymous>",w=C+2,C++;break}u+=i(e[g]),w=C+2,C++;break;case 115:if(g>=h)break;w<C&&(u+=r.slice(w,C)),u+=String(e[g]),w=C+2,C++;break;case 37:w<C&&(u+=r.slice(w,C)),u+="%",w=C+2,C++,g--;break}++g}++C}return w===-1?r:(w<M&&(u+=r.slice(w)),u)}const Tb=vS;var Zn=Xn;const sf=MS().console||{},bS={mapHttpRequest:Xl,mapHttpResponse:Xl,wrapRequestSerializer:h0,wrapResponseSerializer:h0,wrapErrorSerializer:h0,req:Xl,res:Xl,err:AS};function wS(r,e){return Array.isArray(r)?r.filter(function(i){return i!=="!stdSerializers.err"}):r===!0?Object.keys(e):!1}function Xn(r){r=r||{},r.browser=r.browser||{};const e=r.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");const t=r.browser.write||sf;r.browser.write&&(r.browser.asObject=!0);const i=r.serializers||{},n=wS(r.browser.serialize,i);let s=r.browser.serialize;Array.isArray(r.browser.serialize)&&r.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);const a=["error","fatal","warn","info","debug","trace"];typeof t=="function"&&(t.error=t.fatal=t.warn=t.info=t.debug=t.trace=t),r.enabled===!1&&(r.level="silent");const f=r.level||"info",h=Object.create(t);h.log||(h.log=of),Object.defineProperty(h,"levelVal",{get:g}),Object.defineProperty(h,"level",{get:w,set:M});const u={transmit:e,serialize:n,asObject:r.browser.asObject,levels:a,timestamp:ES(r)};h.levels=Xn.levels,h.level=f,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=of,h.serializers=i,h._serialize=n,h._stdErrSerialize=s,h.child=C,e&&(h._logEvent=l0());function g(){return this.level==="silent"?1/0:this.levels.values[this.level]}function w(){return this._level}function M(O){if(O!=="silent"&&!this.levels.values[O])throw Error("unknown level "+O);this._level=O,ka(u,h,"error","log"),ka(u,h,"fatal","error"),ka(u,h,"warn","error"),ka(u,h,"info","log"),ka(u,h,"debug","log"),ka(u,h,"trace","log")}function C(O,N){if(!O)throw new Error("missing bindings for child Pino");N=N||{},n&&O.serializers&&(N.serializers=O.serializers);const j=N.serializers;if(n&&j){var H=Object.assign({},i,j),F=r.browser.serialize===!0?Object.keys(H):n;delete O.serializers,Zl([O],F,H,this._stdErrSerialize)}function G(B){this._childLevel=(B._childLevel|0)+1,this.error=ja(B,O,"error"),this.fatal=ja(B,O,"fatal"),this.warn=ja(B,O,"warn"),this.info=ja(B,O,"info"),this.debug=ja(B,O,"debug"),this.trace=ja(B,O,"trace"),H&&(this.serializers=H,this._serialize=F),e&&(this._logEvent=l0([].concat(B._logEvent.bindings,O)))}return G.prototype=this,new G(this)}return h}Xn.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"}},Xn.stdSerializers=bS,Xn.stdTimeFunctions=Object.assign({},{nullTime:Nb,epochTime:$b,unixTime:SS,isoTime:IS});function ka(r,e,t,i){const n=Object.getPrototypeOf(e);e[t]=e.levelVal>e.levels.values[t]?of:n[t]?n[t]:sf[t]||sf[i]||of,yS(r,e,t)}function yS(r,e,t){!r.transmit&&e[t]===of||(e[t]=function(i){return function(){const s=r.timestamp(),a=new Array(arguments.length),f=Object.getPrototypeOf&&Object.getPrototypeOf(this)===sf?sf:this;for(var h=0;h<a.length;h++)a[h]=arguments[h];if(r.serialize&&!r.asObject&&Zl(a,this._serialize,this.serializers,this._stdErrSerialize),r.asObject?i.call(f,_S(this,t,a,s)):i.apply(f,a),r.transmit){const u=r.transmit.level||e.level,g=Xn.levels.values[u],w=Xn.levels.values[t];if(w<g)return;xS(this,{ts:s,methodLevel:t,methodValue:w,transmitLevel:u,transmitValue:Xn.levels.values[r.transmit.level||e.level],send:r.transmit.send,val:e.levelVal},a)}}}(e[t]))}function _S(r,e,t,i){r._serialize&&Zl(t,r._serialize,r.serializers,r._stdErrSerialize);const n=t.slice();let s=n[0];const a={};i&&(a.time=i),a.level=Xn.levels.values[e];let f=(r._childLevel|0)+1;if(f<1&&(f=1),s!==null&&typeof s=="object"){for(;f--&&typeof n[0]=="object";)Object.assign(a,n.shift());s=n.length?Tb(n.shift(),n):void 0}else typeof s=="string"&&(s=Tb(n.shift(),n));return s!==void 0&&(a.msg=s),a}function Zl(r,e,t,i){for(const n in r)if(i&&r[n]instanceof Error)r[n]=Xn.stdSerializers.err(r[n]);else if(typeof r[n]=="object"&&!Array.isArray(r[n]))for(const s in r[n])e&&e.indexOf(s)>-1&&s in t&&(r[n][s]=t[s](r[n][s]))}function ja(r,e,t){return function(){const i=new Array(1+arguments.length);i[0]=e;for(var n=1;n<i.length;n++)i[n]=arguments[n-1];return r[t].apply(this,i)}}function xS(r,e,t){const i=e.send,n=e.ts,s=e.methodLevel,a=e.methodValue,f=e.val,h=r._logEvent.bindings;Zl(t,r._serialize||Object.keys(r.serializers),r.serializers,r._stdErrSerialize===void 0?!0:r._stdErrSerialize),r._logEvent.ts=n,r._logEvent.messages=t.filter(function(u){return h.indexOf(u)===-1}),r._logEvent.level.label=s,r._logEvent.level.value=a,i(s,r._logEvent,f),r._logEvent=l0(h)}function l0(r){return{ts:0,messages:[],bindings:r||[],level:{label:"",value:0}}}function AS(r){const e={type:r.constructor.name,msg:r.message,stack:r.stack};for(const t in r)e[t]===void 0&&(e[t]=r[t]);return e}function ES(r){return typeof r.timestamp=="function"?r.timestamp:r.timestamp===!1?Nb:$b}function Xl(){return{}}function h0(r){return r}function of(){}function Nb(){return!1}function $b(){return Date.now()}function SS(){return Math.round(Date.now()/1e3)}function IS(){return new Date(Date.now()).toISOString()}function MS(){function r(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 r(self)||r(window)||r(this)||{}}}const CS={level:"info"},af="custom_context",u0=1e3*1024;class PS{constructor(e){this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class Lb{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const t=new PS(e);if(t.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let t=this.head;for(;t!==null;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}}class Bb{constructor(e,t=u0){this.level=e??"error",this.levelValue=Zn.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new Lb(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===Zn.levels.values.error?console.error(e):t===Zn.levels.values.warn?console.warn(e):t===Zn.levels.values.debug?console.debug(e):t===Zn.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(bs({timestamp:new Date().toISOString(),log:e}));const t=typeof e=="string"?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new Lb(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const t=this.getLogArray();return t.push(bs({extraMetadata:e})),new Blob(t,{type:"application/json"})}}class DS{constructor(e,t=u0){this.baseChunkLogger=new Bb(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),i=document.createElement("a");i.href=t,i.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(t)}}class OS{constructor(e,t=u0){this.baseChunkLogger=new Bb(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var RS=Object.defineProperty,TS=Object.defineProperties,NS=Object.getOwnPropertyDescriptors,Fb=Object.getOwnPropertySymbols,$S=Object.prototype.hasOwnProperty,LS=Object.prototype.propertyIsEnumerable,Ub=(r,e,t)=>e in r?RS(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,eh=(r,e)=>{for(var t in e||(e={}))$S.call(e,t)&&Ub(r,t,e[t]);if(Fb)for(var t of Fb(e))LS.call(e,t)&&Ub(r,t,e[t]);return r},th=(r,e)=>TS(r,NS(e));function rh(r){return th(eh({},r),{level:r?.level||CS.level})}function BS(r,e=af){return r[e]||""}function FS(r,e,t=af){return r[t]=e,r}function yi(r,e=af){let t="";return typeof r.bindings>"u"?t=BS(r,e):t=r.bindings().context||"",t}function US(r,e,t=af){const i=yi(r,t);return i.trim()?`${i}/${e}`:e}function ci(r,e,t=af){const i=US(r,e,t),n=r.child({context:i});return FS(n,i,t)}function qS(r){var e,t;const i=new DS((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:Zn(th(eh({},r.opts),{level:"trace",browser:th(eh({},(t=r.opts)==null?void 0:t.browser),{write:n=>i.write(n)})})),chunkLoggerController:i}}function zS(r){var e;const t=new OS((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:Zn(th(eh({},r.opts),{level:"trace"})),chunkLoggerController:t}}function HS(r){return typeof r.loggerOverride<"u"&&typeof r.loggerOverride!="string"?{logger:r.loggerOverride,chunkLoggerController:null}:typeof window<"u"?qS(r):zS(r)}class kS extends Bo{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class jS extends Bo{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}}class WS{constructor(e,t){this.logger=e,this.core=t}}class KS extends Bo{constructor(e,t){super(),this.relayer=e,this.logger=t}}class VS extends Bo{constructor(e){super()}}class GS{constructor(e,t,i,n){this.core=e,this.logger=t,this.name=i}}class YS extends Bo{constructor(e,t){super(),this.relayer=e,this.logger=t}}class JS extends Bo{constructor(e,t){super(),this.core=e,this.logger=t}}class QS{constructor(e,t,i){this.core=e,this.logger=t,this.store=i}}class ZS{constructor(e,t){this.projectId=e,this.logger=t}}class XS{constructor(e,t,i){this.core=e,this.logger=t,this.telemetryEnabled=i}}class eI{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class tI{constructor(e){this.client=e}}function rI(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function qb(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const zb=qb("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),d0=qb("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=rI(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),iI={utf8:zb,"utf-8":zb,hex:Ta.base16,latin1:d0,ascii:d0,binary:d0,...Ta};function nI(r,e="utf8"){const t=iI[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}const sI="PARSE_ERROR",oI="INVALID_REQUEST",aI="METHOD_NOT_FOUND",cI="INVALID_PARAMS",Hb="INTERNAL_ERROR",p0="SERVER_ERROR",fI=[-32700,-32600,-32601,-32602,-32603],cf={[sI]:{code:-32700,message:"Parse error"},[oI]:{code:-32600,message:"Invalid Request"},[aI]:{code:-32601,message:"Method not found"},[cI]:{code:-32602,message:"Invalid params"},[Hb]:{code:-32603,message:"Internal error"},[p0]:{code:-32e3,message:"Server error"}},kb=p0;function lI(r){return fI.includes(r)}function jb(r){return Object.keys(cf).includes(r)?cf[r]:cf[kb]}function hI(r){const e=Object.values(cf).find(t=>t.code===r);return e||cf[kb]}function Wb(r,e,t){return r.message.includes("getaddrinfo ENOTFOUND")||r.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${t} RPC url at ${e}`):r}var Kb={};/*! *****************************************************************************
|
|
30
|
+
Approved: ${M.toString()}`))}),a.forEach(w=>{i||(To(n[w].methods,s[w].methods)?To(n[w].events,s[w].events)||(i=xe("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy namespace events for ${w}`)):i=xe("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy namespace methods for ${w}`))}),i}function sA(r){const e={};return Object.keys(r).forEach(t=>{var i;t.includes(":")?e[t]=r[t]:(i=r[t].chains)==null||i.forEach(n=>{e[n]={methods:r[t].methods,events:r[t].events}})}),e}function db(r){return[...new Set(r.map(e=>e.includes(":")?e.split(":")[0]:e))]}function oA(r){const e={};return Object.keys(r).forEach(t=>{if(t.includes(":"))e[t]=r[t];else{const i=za(r[t].accounts);i?.forEach(n=>{e[n]={accounts:r[t].accounts.filter(s=>s.includes(`${n}:`)),methods:r[t].methods,events:r[t].events}})}}),e}function aA(r,e){return t0(r,!1)&&r<=e.max&&r>=e.min}function pb(){const r=Wc();return new Promise(e=>{switch(r){case Bi.browser:e(cA());break;case Bi.reactNative:e(fA());break;case Bi.node:e(lA());break;default:e(!0)}})}function cA(){return jc()&&navigator?.onLine}async function fA(){if(Vs()&&typeof global<"u"&&global!=null&&global.NetInfo){const r=await(global==null?void 0:global.NetInfo.fetch());return r?.isConnected}return!0}function lA(){return!0}function hA(r){switch(Wc()){case Bi.browser:uA(r);break;case Bi.reactNative:dA(r);break}}function uA(r){!Vs()&&jc()&&(window.addEventListener("online",()=>r(!0)),window.addEventListener("offline",()=>r(!1)))}function dA(r){Vs()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>r(e?.isConnected))}const i0={};class tf{static get(e){return i0[e]}static set(e,t){i0[e]=t}static delete(e){delete i0[e]}}class Bo{}class pA extends Bo{constructor(e){super()}}const gb=_e.FIVE_SECONDS,ka={pulse:"heartbeat_pulse"};class n0 extends pA{constructor(e){super(e),this.events=new zr.exports.EventEmitter,this.interval=gb,this.interval=e?.interval||gb}static async init(e){const t=new n0(e);return await t.init(),t}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),_e.toMiliseconds(this.interval))}pulse(){this.events.emit(ka.pulse)}}const gA=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,vA=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,mA=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function bA(r,e){if(r==="__proto__"||r==="constructor"&&e&&typeof e=="object"&&"prototype"in e){wA(r);return}return e}function wA(r){console.warn(`[destr] Dropping "${r}" key to prevent prototype pollution.`)}function Vl(r,e={}){if(typeof r!="string")return r;const t=r.trim();if(r[0]==='"'&&r.at(-1)==='"'&&!r.includes("\\"))return t.slice(1,-1);if(t.length<=9){const i=t.toLowerCase();if(i==="true")return!0;if(i==="false")return!1;if(i==="undefined")return;if(i==="null")return null;if(i==="nan")return Number.NaN;if(i==="infinity")return Number.POSITIVE_INFINITY;if(i==="-infinity")return Number.NEGATIVE_INFINITY}if(!mA.test(r)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return r}try{if(gA.test(r)||vA.test(r)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(r,bA)}return JSON.parse(r)}catch(i){if(e.strict)throw i;return r}}function yA(r){return!r||typeof r.then!="function"?Promise.resolve(r):r}function $r(r,...e){try{return yA(r(...e))}catch(t){return Promise.reject(t)}}function _A(r){const e=typeof r;return r===null||e!=="object"&&e!=="function"}function xA(r){const e=Object.getPrototypeOf(r);return!e||e.isPrototypeOf(Object)}function Gl(r){if(_A(r))return String(r);if(xA(r)||Array.isArray(r))return JSON.stringify(r);if(typeof r.toJSON=="function")return Gl(r.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function vb(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}const s0="base64:";function EA(r){if(typeof r=="string")return r;vb();const e=Buffer.from(r).toString("base64");return s0+e}function AA(r){return typeof r!="string"||!r.startsWith(s0)?r:(vb(),Buffer.from(r.slice(s0.length),"base64"))}function wi(r){return r?r.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function SA(...r){return wi(r.join(":"))}function Jl(r){return r=wi(r),r?r+":":""}function jz(r){return r}const IA="memory",MA=()=>{const r=new Map;return{name:IA,options:{},hasItem(e){return r.has(e)},getItem(e){return r.get(e)||null},getItemRaw(e){return r.get(e)||null},setItem(e,t){r.set(e,t)},setItemRaw(e,t){r.set(e,t)},removeItem(e){r.delete(e)},getKeys(){return Array.from(r.keys())},clear(){r.clear()},dispose(){r.clear()}}};function CA(r={}){const e={mounts:{"":r.driver||MA()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},t=u=>{for(const g of e.mountpoints)if(u.startsWith(g))return{base:g,relativeKey:u.slice(g.length),driver:e.mounts[g]};return{base:"",relativeKey:u,driver:e.mounts[""]}},i=(u,g)=>e.mountpoints.filter(w=>w.startsWith(u)||g&&u.startsWith(w)).map(w=>({relativeBase:u.length>w.length?u.slice(w.length):void 0,mountpoint:w,driver:e.mounts[w]})),n=(u,g)=>{if(e.watching){g=wi(g);for(const w of e.watchListeners)w(u,g)}},s=async()=>{if(!e.watching){e.watching=!0;for(const u in e.mounts)e.unwatch[u]=await mb(e.mounts[u],n,u)}},a=async()=>{if(e.watching){for(const u in e.unwatch)await e.unwatch[u]();e.unwatch={},e.watching=!1}},f=(u,g,w)=>{const M=new Map,P=O=>{let $=M.get(O.base);return $||($={driver:O.driver,base:O.base,items:[]},M.set(O.base,$)),$};for(const O of u){const $=typeof O=="string",q=wi($?O:O.key),U=$?void 0:O.value,J=$||!O.options?g:{...g,...O.options},ee=t(q);P(ee).items.push({key:q,value:U,relativeKey:ee.relativeKey,options:J})}return Promise.all([...M.values()].map(O=>w(O))).then(O=>O.flat())},h={hasItem(u,g={}){u=wi(u);const{relativeKey:w,driver:M}=t(u);return $r(M.hasItem,w,g)},getItem(u,g={}){u=wi(u);const{relativeKey:w,driver:M}=t(u);return $r(M.getItem,w,g).then(P=>Vl(P))},getItems(u,g){return f(u,g,w=>w.driver.getItems?$r(w.driver.getItems,w.items.map(M=>({key:M.relativeKey,options:M.options})),g).then(M=>M.map(P=>({key:SA(w.base,P.key),value:Vl(P.value)}))):Promise.all(w.items.map(M=>$r(w.driver.getItem,M.relativeKey,M.options).then(P=>({key:M.key,value:Vl(P)})))))},getItemRaw(u,g={}){u=wi(u);const{relativeKey:w,driver:M}=t(u);return M.getItemRaw?$r(M.getItemRaw,w,g):$r(M.getItem,w,g).then(P=>AA(P))},async setItem(u,g,w={}){if(g===void 0)return h.removeItem(u);u=wi(u);const{relativeKey:M,driver:P}=t(u);P.setItem&&(await $r(P.setItem,M,Gl(g),w),P.watch||n("update",u))},async setItems(u,g){await f(u,g,async w=>{w.driver.setItems&&await $r(w.driver.setItems,w.items.map(M=>({key:M.relativeKey,value:Gl(M.value),options:M.options})),g),w.driver.setItem&&await Promise.all(w.items.map(M=>$r(w.driver.setItem,M.relativeKey,Gl(M.value),M.options)))})},async setItemRaw(u,g,w={}){if(g===void 0)return h.removeItem(u,w);u=wi(u);const{relativeKey:M,driver:P}=t(u);if(P.setItemRaw)await $r(P.setItemRaw,M,g,w);else if(P.setItem)await $r(P.setItem,M,EA(g),w);else return;P.watch||n("update",u)},async removeItem(u,g={}){typeof g=="boolean"&&(g={removeMeta:g}),u=wi(u);const{relativeKey:w,driver:M}=t(u);M.removeItem&&(await $r(M.removeItem,w,g),(g.removeMeta||g.removeMata)&&await $r(M.removeItem,w+"$",g),M.watch||n("remove",u))},async getMeta(u,g={}){typeof g=="boolean"&&(g={nativeOnly:g}),u=wi(u);const{relativeKey:w,driver:M}=t(u),P=Object.create(null);if(M.getMeta&&Object.assign(P,await $r(M.getMeta,w,g)),!g.nativeOnly){const O=await $r(M.getItem,w+"$",g).then($=>Vl($));O&&typeof O=="object"&&(typeof O.atime=="string"&&(O.atime=new Date(O.atime)),typeof O.mtime=="string"&&(O.mtime=new Date(O.mtime)),Object.assign(P,O))}return P},setMeta(u,g,w={}){return this.setItem(u+"$",g,w)},removeMeta(u,g={}){return this.removeItem(u+"$",g)},async getKeys(u,g={}){u=Jl(u);const w=i(u,!0);let M=[];const P=[];for(const O of w){const q=(await $r(O.driver.getKeys,O.relativeBase,g)).map(U=>O.mountpoint+wi(U)).filter(U=>!M.some(J=>U.startsWith(J)));P.push(...q),M=[O.mountpoint,...M.filter(U=>!U.startsWith(O.mountpoint))]}return u?P.filter(O=>O.startsWith(u)&&!O.endsWith("$")):P.filter(O=>!O.endsWith("$"))},async clear(u,g={}){u=Jl(u),await Promise.all(i(u,!1).map(async w=>{if(w.driver.clear)return $r(w.driver.clear,w.relativeBase,g);if(w.driver.removeItem){const M=await w.driver.getKeys(w.relativeBase||"",g);return Promise.all(M.map(P=>w.driver.removeItem(P,g)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(u=>bb(u)))},async watch(u){return await s(),e.watchListeners.push(u),async()=>{e.watchListeners=e.watchListeners.filter(g=>g!==u),e.watchListeners.length===0&&await a()}},async unwatch(){e.watchListeners=[],await a()},mount(u,g){if(u=Jl(u),u&&e.mounts[u])throw new Error(`already mounted at ${u}`);return u&&(e.mountpoints.push(u),e.mountpoints.sort((w,M)=>M.length-w.length)),e.mounts[u]=g,e.watching&&Promise.resolve(mb(g,n,u)).then(w=>{e.unwatch[u]=w}).catch(console.error),h},async unmount(u,g=!0){u=Jl(u),!(!u||!e.mounts[u])&&(e.watching&&u in e.unwatch&&(e.unwatch[u](),delete e.unwatch[u]),g&&await bb(e.mounts[u]),e.mountpoints=e.mountpoints.filter(w=>w!==u),delete e.mounts[u])},getMount(u=""){u=wi(u)+":";const g=t(u);return{driver:g.driver,base:g.base}},getMounts(u="",g={}){return u=wi(u),i(u,g.parents).map(M=>({driver:M.driver,base:M.mountpoint}))}};return h}function mb(r,e,t){return r.watch?r.watch((i,n)=>e(i,t+n)):()=>{}}async function bb(r){typeof r.dispose=="function"&&await $r(r.dispose)}function Uo(r){return new Promise((e,t)=>{r.oncomplete=r.onsuccess=()=>e(r.result),r.onabort=r.onerror=()=>t(r.error)})}function wb(r,e){const t=indexedDB.open(r);t.onupgradeneeded=()=>t.result.createObjectStore(e);const i=Uo(t);return(n,s)=>i.then(a=>s(a.transaction(e,n).objectStore(e)))}let o0;function rf(){return o0||(o0=wb("keyval-store","keyval")),o0}function yb(r,e=rf()){return e("readonly",t=>Uo(t.get(r)))}function PA(r,e,t=rf()){return t("readwrite",i=>(i.put(e,r),Uo(i.transaction)))}function DA(r,e=rf()){return e("readwrite",t=>(t.delete(r),Uo(t.transaction)))}function OA(r=rf()){return r("readwrite",e=>(e.clear(),Uo(e.transaction)))}function RA(r,e){return r.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Uo(r.transaction)}function TA(r=rf()){return r("readonly",e=>{if(e.getAllKeys)return Uo(e.getAllKeys());const t=[];return RA(e,i=>t.push(i.key)).then(()=>t)})}const NA="idb-keyval";var $A=(r={})=>{const e=r.base&&r.base.length>0?`${r.base}:`:"",t=n=>e+n;let i;return r.dbName&&r.storeName&&(i=wb(r.dbName,r.storeName)),{name:NA,options:r,async hasItem(n){return!(typeof await yb(t(n),i)>"u")},async getItem(n){return await yb(t(n),i)??null},setItem(n,s){return PA(t(n),s,i)},removeItem(n){return DA(t(n),i)},getKeys(){return TA(i)},clear(){return OA(i)}}};const LA="WALLET_CONNECT_V2_INDEXED_DB",BA="keyvaluestorage";class UA{constructor(){this.indexedDb=CA({driver:$A({dbName:LA,storeName:BA})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const t=await this.indexedDb.getItem(e);if(t!==null)return t}async setItem(e,t){await this.indexedDb.setItem(e,bs(t))}async removeItem(e){await this.indexedDb.removeItem(e)}}var a0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Yl={exports:{}};(function(){let r;function e(){}r=e,r.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},r.prototype.setItem=function(t,i){this[t]=String(i)},r.prototype.removeItem=function(t){delete this[t]},r.prototype.clear=function(){const t=this;Object.keys(t).forEach(function(i){t[i]=void 0,delete t[i]})},r.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof a0<"u"&&a0.localStorage?Yl.exports=a0.localStorage:typeof window<"u"&&window.localStorage?Yl.exports=window.localStorage:Yl.exports=new e})();function FA(r){var e;return[r[0],Ro((e=r[1])!=null?e:"")]}class qA{constructor(){this.localStorage=Yl.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(FA)}async getItem(e){const t=this.localStorage.getItem(e);if(t!==null)return Ro(t)}async setItem(e,t){this.localStorage.setItem(e,bs(t))}async removeItem(e){this.localStorage.removeItem(e)}}const zA="wc_storage_version",_b=1,kA=async(r,e,t)=>{const i=zA,n=await e.getItem(i);if(n&&n>=_b){t(e);return}const s=await r.getKeys();if(!s.length){t(e);return}const a=[];for(;s.length;){const f=s.shift();if(!f)continue;const h=f.toLowerCase();if(h.includes("wc@")||h.includes("walletconnect")||h.includes("wc_")||h.includes("wallet_connect")){const u=await r.getItem(f);await e.setItem(f,u),a.push(f)}}await e.setItem(i,_b),t(e),HA(r,a)},HA=async(r,e)=>{e.length&&e.forEach(async t=>{await r.removeItem(t)})};class jA{constructor(){this.initialized=!1,this.setInitialized=t=>{this.storage=t,this.initialized=!0};const e=new qA;this.storage=e;try{const t=new UA;kA(e,t,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const t=setInterval(()=>{this.initialized&&(clearInterval(t),e())},20)})}}function WA(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}var KA=VA;function VA(r,e,t){var i=t&&t.stringify||WA,n=1;if(typeof r=="object"&&r!==null){var s=e.length+n;if(s===1)return r;var a=new Array(s);a[0]=i(r);for(var f=1;f<s;f++)a[f]=i(e[f]);return a.join(" ")}if(typeof r!="string")return r;var h=e.length;if(h===0)return r;for(var u="",g=1-n,w=-1,M=r&&r.length||0,P=0;P<M;){if(r.charCodeAt(P)===37&&P+1<M){switch(w=w>-1?w:0,r.charCodeAt(P+1)){case 100:case 102:if(g>=h||e[g]==null)break;w<P&&(u+=r.slice(w,P)),u+=Number(e[g]),w=P+2,P++;break;case 105:if(g>=h||e[g]==null)break;w<P&&(u+=r.slice(w,P)),u+=Math.floor(Number(e[g])),w=P+2,P++;break;case 79:case 111:case 106:if(g>=h||e[g]===void 0)break;w<P&&(u+=r.slice(w,P));var O=typeof e[g];if(O==="string"){u+="'"+e[g]+"'",w=P+2,P++;break}if(O==="function"){u+=e[g].name||"<anonymous>",w=P+2,P++;break}u+=i(e[g]),w=P+2,P++;break;case 115:if(g>=h)break;w<P&&(u+=r.slice(w,P)),u+=String(e[g]),w=P+2,P++;break;case 37:w<P&&(u+=r.slice(w,P)),u+="%",w=P+2,P++,g--;break}++g}++P}return w===-1?r:(w<M&&(u+=r.slice(w)),u)}const xb=KA;var Zn=Xn;const nf=iS().console||{},GA={mapHttpRequest:Zl,mapHttpResponse:Zl,wrapRequestSerializer:f0,wrapResponseSerializer:f0,wrapErrorSerializer:f0,req:Zl,res:Zl,err:XA};function JA(r,e){return Array.isArray(r)?r.filter(function(i){return i!=="!stdSerializers.err"}):r===!0?Object.keys(e):!1}function Xn(r){r=r||{},r.browser=r.browser||{};const e=r.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");const t=r.browser.write||nf;r.browser.write&&(r.browser.asObject=!0);const i=r.serializers||{},n=JA(r.browser.serialize,i);let s=r.browser.serialize;Array.isArray(r.browser.serialize)&&r.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);const a=["error","fatal","warn","info","debug","trace"];typeof t=="function"&&(t.error=t.fatal=t.warn=t.info=t.debug=t.trace=t),r.enabled===!1&&(r.level="silent");const f=r.level||"info",h=Object.create(t);h.log||(h.log=sf),Object.defineProperty(h,"levelVal",{get:g}),Object.defineProperty(h,"level",{get:w,set:M});const u={transmit:e,serialize:n,asObject:r.browser.asObject,levels:a,timestamp:eS(r)};h.levels=Xn.levels,h.level=f,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=sf,h.serializers=i,h._serialize=n,h._stdErrSerialize=s,h.child=P,e&&(h._logEvent=c0());function g(){return this.level==="silent"?1/0:this.levels.values[this.level]}function w(){return this._level}function M(O){if(O!=="silent"&&!this.levels.values[O])throw Error("unknown level "+O);this._level=O,Ha(u,h,"error","log"),Ha(u,h,"fatal","error"),Ha(u,h,"warn","error"),Ha(u,h,"info","log"),Ha(u,h,"debug","log"),Ha(u,h,"trace","log")}function P(O,$){if(!O)throw new Error("missing bindings for child Pino");$=$||{},n&&O.serializers&&($.serializers=O.serializers);const q=$.serializers;if(n&&q){var U=Object.assign({},i,q),J=r.browser.serialize===!0?Object.keys(U):n;delete O.serializers,Ql([O],J,U,this._stdErrSerialize)}function ee(W){this._childLevel=(W._childLevel|0)+1,this.error=ja(W,O,"error"),this.fatal=ja(W,O,"fatal"),this.warn=ja(W,O,"warn"),this.info=ja(W,O,"info"),this.debug=ja(W,O,"debug"),this.trace=ja(W,O,"trace"),U&&(this.serializers=U,this._serialize=J),e&&(this._logEvent=c0([].concat(W._logEvent.bindings,O)))}return ee.prototype=this,new ee(this)}return h}Xn.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"}},Xn.stdSerializers=GA,Xn.stdTimeFunctions=Object.assign({},{nullTime:Eb,epochTime:Ab,unixTime:tS,isoTime:rS});function Ha(r,e,t,i){const n=Object.getPrototypeOf(e);e[t]=e.levelVal>e.levels.values[t]?sf:n[t]?n[t]:nf[t]||nf[i]||sf,YA(r,e,t)}function YA(r,e,t){!r.transmit&&e[t]===sf||(e[t]=function(i){return function(){const s=r.timestamp(),a=new Array(arguments.length),f=Object.getPrototypeOf&&Object.getPrototypeOf(this)===nf?nf:this;for(var h=0;h<a.length;h++)a[h]=arguments[h];if(r.serialize&&!r.asObject&&Ql(a,this._serialize,this.serializers,this._stdErrSerialize),r.asObject?i.call(f,QA(this,t,a,s)):i.apply(f,a),r.transmit){const u=r.transmit.level||e.level,g=Xn.levels.values[u],w=Xn.levels.values[t];if(w<g)return;ZA(this,{ts:s,methodLevel:t,methodValue:w,transmitLevel:u,transmitValue:Xn.levels.values[r.transmit.level||e.level],send:r.transmit.send,val:e.levelVal},a)}}}(e[t]))}function QA(r,e,t,i){r._serialize&&Ql(t,r._serialize,r.serializers,r._stdErrSerialize);const n=t.slice();let s=n[0];const a={};i&&(a.time=i),a.level=Xn.levels.values[e];let f=(r._childLevel|0)+1;if(f<1&&(f=1),s!==null&&typeof s=="object"){for(;f--&&typeof n[0]=="object";)Object.assign(a,n.shift());s=n.length?xb(n.shift(),n):void 0}else typeof s=="string"&&(s=xb(n.shift(),n));return s!==void 0&&(a.msg=s),a}function Ql(r,e,t,i){for(const n in r)if(i&&r[n]instanceof Error)r[n]=Xn.stdSerializers.err(r[n]);else if(typeof r[n]=="object"&&!Array.isArray(r[n]))for(const s in r[n])e&&e.indexOf(s)>-1&&s in t&&(r[n][s]=t[s](r[n][s]))}function ja(r,e,t){return function(){const i=new Array(1+arguments.length);i[0]=e;for(var n=1;n<i.length;n++)i[n]=arguments[n-1];return r[t].apply(this,i)}}function ZA(r,e,t){const i=e.send,n=e.ts,s=e.methodLevel,a=e.methodValue,f=e.val,h=r._logEvent.bindings;Ql(t,r._serialize||Object.keys(r.serializers),r.serializers,r._stdErrSerialize===void 0?!0:r._stdErrSerialize),r._logEvent.ts=n,r._logEvent.messages=t.filter(function(u){return h.indexOf(u)===-1}),r._logEvent.level.label=s,r._logEvent.level.value=a,i(s,r._logEvent,f),r._logEvent=c0(h)}function c0(r){return{ts:0,messages:[],bindings:r||[],level:{label:"",value:0}}}function XA(r){const e={type:r.constructor.name,msg:r.message,stack:r.stack};for(const t in r)e[t]===void 0&&(e[t]=r[t]);return e}function eS(r){return typeof r.timestamp=="function"?r.timestamp:r.timestamp===!1?Eb:Ab}function Zl(){return{}}function f0(r){return r}function sf(){}function Eb(){return!1}function Ab(){return Date.now()}function tS(){return Math.round(Date.now()/1e3)}function rS(){return new Date(Date.now()).toISOString()}function iS(){function r(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 r(self)||r(window)||r(this)||{}}}const nS={level:"info"},of="custom_context",l0=1e3*1024;class sS{constructor(e){this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class Sb{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const t=new sS(e);if(t.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let t=this.head;for(;t!==null;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}}class Ib{constructor(e,t=l0){this.level=e??"error",this.levelValue=Zn.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new Sb(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===Zn.levels.values.error?console.error(e):t===Zn.levels.values.warn?console.warn(e):t===Zn.levels.values.debug?console.debug(e):t===Zn.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(bs({timestamp:new Date().toISOString(),log:e}));const t=typeof e=="string"?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new Sb(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const t=this.getLogArray();return t.push(bs({extraMetadata:e})),new Blob(t,{type:"application/json"})}}class oS{constructor(e,t=l0){this.baseChunkLogger=new Ib(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),i=document.createElement("a");i.href=t,i.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(t)}}class aS{constructor(e,t=l0){this.baseChunkLogger=new Ib(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var cS=Object.defineProperty,fS=Object.defineProperties,lS=Object.getOwnPropertyDescriptors,Mb=Object.getOwnPropertySymbols,hS=Object.prototype.hasOwnProperty,uS=Object.prototype.propertyIsEnumerable,Cb=(r,e,t)=>e in r?cS(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Xl=(r,e)=>{for(var t in e||(e={}))hS.call(e,t)&&Cb(r,t,e[t]);if(Mb)for(var t of Mb(e))uS.call(e,t)&&Cb(r,t,e[t]);return r},eh=(r,e)=>fS(r,lS(e));function th(r){return eh(Xl({},r),{level:r?.level||nS.level})}function dS(r,e=of){return r[e]||""}function pS(r,e,t=of){return r[t]=e,r}function yi(r,e=of){let t="";return typeof r.bindings>"u"?t=dS(r,e):t=r.bindings().context||"",t}function gS(r,e,t=of){const i=yi(r,t);return i.trim()?`${i}/${e}`:e}function ci(r,e,t=of){const i=gS(r,e,t),n=r.child({context:i});return pS(n,i,t)}function vS(r){var e,t;const i=new oS((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:Zn(eh(Xl({},r.opts),{level:"trace",browser:eh(Xl({},(t=r.opts)==null?void 0:t.browser),{write:n=>i.write(n)})})),chunkLoggerController:i}}function mS(r){var e;const t=new aS((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:Zn(eh(Xl({},r.opts),{level:"trace"})),chunkLoggerController:t}}function bS(r){return typeof r.loggerOverride<"u"&&typeof r.loggerOverride!="string"?{logger:r.loggerOverride,chunkLoggerController:null}:typeof window<"u"?vS(r):mS(r)}class wS extends Bo{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class yS extends Bo{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}}class _S{constructor(e,t){this.logger=e,this.core=t}}class xS extends Bo{constructor(e,t){super(),this.relayer=e,this.logger=t}}class ES extends Bo{constructor(e){super()}}class AS{constructor(e,t,i,n){this.core=e,this.logger=t,this.name=i}}class SS extends Bo{constructor(e,t){super(),this.relayer=e,this.logger=t}}class IS extends Bo{constructor(e,t){super(),this.core=e,this.logger=t}}class MS{constructor(e,t,i){this.core=e,this.logger=t,this.store=i}}class CS{constructor(e,t){this.projectId=e,this.logger=t}}class PS{constructor(e,t,i){this.core=e,this.logger=t,this.telemetryEnabled=i}}class DS{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class OS{constructor(e){this.client=e}}function RS(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function Pb(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const Db=Pb("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),h0=Pb("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=RS(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),TS={utf8:Db,"utf-8":Db,hex:Ta.base16,latin1:h0,ascii:h0,binary:h0,...Ta};function NS(r,e="utf8"){const t=TS[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}const $S="PARSE_ERROR",LS="INVALID_REQUEST",BS="METHOD_NOT_FOUND",US="INVALID_PARAMS",Ob="INTERNAL_ERROR",u0="SERVER_ERROR",FS=[-32700,-32600,-32601,-32602,-32603],af={[$S]:{code:-32700,message:"Parse error"},[LS]:{code:-32600,message:"Invalid Request"},[BS]:{code:-32601,message:"Method not found"},[US]:{code:-32602,message:"Invalid params"},[Ob]:{code:-32603,message:"Internal error"},[u0]:{code:-32e3,message:"Server error"}},Rb=u0;function qS(r){return FS.includes(r)}function Tb(r){return Object.keys(af).includes(r)?af[r]:af[Rb]}function zS(r){const e=Object.values(af).find(t=>t.code===r);return e||af[Rb]}function Nb(r,e,t){return r.message.includes("getaddrinfo ENOTFOUND")||r.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${t} RPC url at ${e}`):r}var $b={};/*! *****************************************************************************
|
|
31
31
|
Copyright (c) Microsoft Corporation.
|
|
32
32
|
|
|
33
33
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -40,84 +40,84 @@
|
|
|
40
40
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
41
41
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
42
42
|
PERFORMANCE OF THIS SOFTWARE.
|
|
43
|
-
***************************************************************************** */var g0=function(r,e){return g0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},g0(r,e)};function uI(r,e){g0(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var v0=function(){return v0=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},v0.apply(this,arguments)};function dI(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(t[i[n]]=r[i[n]]);return t}function pI(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var f=r.length-1;f>=0;f--)(a=r[f])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s}function gI(r,e){return function(t,i){e(t,i,r)}}function vI(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function mI(r,e,t,i){function n(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function f(g){try{u(i.next(g))}catch(w){a(w)}}function h(g){try{u(i.throw(g))}catch(w){a(w)}}function u(g){g.done?s(g.value):n(g.value).then(f,h)}u((i=i.apply(r,e||[])).next())})}function bI(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,a;return a={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function f(u){return function(g){return h([u,g])}}function h(u){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(s=u[0]&2?n.return:u[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,u[1])).done)return s;switch(n=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,n=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){t.label=u[1];break}if(u[0]===6&&t.label<s[1]){t.label=s[1],s=u;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(u);break}s[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(r,t)}catch(g){u=[6,g],n=0}finally{i=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function wI(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}function yI(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function m0(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Vb(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],a;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(f){a={error:f}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(a)throw a.error}}return s}function _I(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(Vb(arguments[e]));return r}function xI(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var i=Array(r),n=0,e=0;e<t;e++)for(var s=arguments[e],a=0,f=s.length;a<f;a++,n++)i[n]=s[a];return i}function ff(r){return this instanceof ff?(this.v=r,this):new ff(r)}function AI(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(r,e||[]),n,s=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(M){i[M]&&(n[M]=function(C){return new Promise(function(O,N){s.push([M,C,O,N])>1||f(M,C)})})}function f(M,C){try{h(i[M](C))}catch(O){w(s[0][3],O)}}function h(M){M.value instanceof ff?Promise.resolve(M.value.v).then(u,g):w(s[0][2],M)}function u(M){f("next",M)}function g(M){f("throw",M)}function w(M,C){M(C),s.shift(),s.length&&f(s[0][0],s[0][1])}}function EI(r){var e,t;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=r[n]?function(a){return(t=!t)?{value:ff(r[n](a)),done:n==="return"}:s?s(a):a}:s}}function SI(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof m0=="function"?m0(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(s){t[s]=r[s]&&function(a){return new Promise(function(f,h){a=r[s](a),n(f,h,a.done,a.value)})}}function n(s,a,f,h){Promise.resolve(h).then(function(u){s({value:u,done:f})},a)}}function II(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function MI(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function CI(r){return r&&r.__esModule?r:{default:r}}function PI(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function DI(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var OI=Object.freeze({__proto__:null,__extends:uI,get __assign(){return v0},__rest:dI,__decorate:pI,__param:gI,__metadata:vI,__awaiter:mI,__generator:bI,__createBinding:wI,__exportStar:yI,__values:m0,__read:Vb,__spread:_I,__spreadArrays:xI,__await:ff,__asyncGenerator:AI,__asyncDelegator:EI,__asyncValues:SI,__makeTemplateObject:II,__importStar:MI,__importDefault:CI,__classPrivateFieldGet:PI,__classPrivateFieldSet:DI}),RI=ju(OI),xs={},Gb;function TI(){if(Gb)return xs;Gb=1,Object.defineProperty(xs,"__esModule",{value:!0}),xs.isBrowserCryptoAvailable=xs.getSubtleCrypto=xs.getBrowerCrypto=void 0;function r(){return fr?.crypto||fr?.msCrypto||{}}xs.getBrowerCrypto=r;function e(){const i=r();return i.subtle||i.webkitSubtle}xs.getSubtleCrypto=e;function t(){return!!r()&&!!e()}return xs.isBrowserCryptoAvailable=t,xs}var As={},Yb;function NI(){if(Yb)return As;Yb=1,Object.defineProperty(As,"__esModule",{value:!0}),As.isBrowser=As.isNode=As.isReactNative=void 0;function r(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}As.isReactNative=r;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}As.isNode=e;function t(){return!r()&&!e()}return As.isBrowser=t,As}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=RI;e.__exportStar(TI(),r),e.__exportStar(NI(),r)})(Kb);function Es(r=3){const e=Date.now()*Math.pow(10,r),t=Math.floor(Math.random()*Math.pow(10,r));return e+t}function Uo(r=6){return BigInt(Es(r))}function Qs(r,e,t){return{id:t||Es(),jsonrpc:"2.0",method:r,params:e}}function ih(r,e){return{id:r,jsonrpc:"2.0",result:e}}function nh(r,e,t){return{id:r,jsonrpc:"2.0",error:$I(e,t)}}function $I(r,e){return typeof r>"u"?jb(Hb):(typeof r=="string"&&(r=Object.assign(Object.assign({},jb(p0)),{message:r})),typeof e<"u"&&(r.data=e),lI(r.code)&&(r=hI(r.code)),r)}class LI{}class BI extends LI{constructor(){super()}}class FI extends BI{constructor(e){super()}}const UI="^https?:",qI="^wss?:";function zI(r){const e=r.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function Jb(r,e){const t=zI(r);return typeof t>"u"?!1:new RegExp(e).test(t)}function Qb(r){return Jb(r,UI)}function Zb(r){return Jb(r,qI)}function HI(r){return new RegExp("wss?://localhost(:d{2,5})?").test(r)}function Xb(r){return typeof r=="object"&&"id"in r&&"jsonrpc"in r&&r.jsonrpc==="2.0"}function b0(r){return Xb(r)&&"method"in r}function sh(r){return Xb(r)&&(es(r)||rn(r))}function es(r){return"result"in r}function rn(r){return"error"in r}class nn extends FI{constructor(e){super(e),this.events=new zr.exports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(Qs(e.method,e.params||[],e.id||Uo().toString()),t)}async requestStrict(e,t){return new Promise(async(i,n)=>{if(!this.connection.connected)try{await this.open()}catch(s){n(s)}this.events.on(`${e.id}`,s=>{rn(s)?n(s.error):i(s.result)});try{await this.connection.send(e,t)}catch(s){n(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),sh(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}}const kI=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),jI=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",e2=r=>r.split("?")[0],t2=10,WI=kI();class KI{constructor(e){if(this.url=e,this.events=new zr.exports.EventEmitter,this.registering=!1,!Zb(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,t)=>{if(typeof this.socket>"u"){t(new Error("Connection already closed"));return}this.socket.onclose=i=>{this.onClose(i),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(bs(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!Zb(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,n)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),n(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return n(new Error("WebSocket connection is missing or invalid"));i(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,i)=>{const n=Kb.isReactNative()?void 0:{rejectUnauthorized:!HI(e)},s=new WI(e,[],n);jI()?s.onerror=a=>{const f=a;i(this.emitError(f.error))}:s.on("error",a=>{i(this.emitError(a))}),s.onopen=()=>{this.onOpen(s),t(s)}})}onOpen(e){e.onmessage=t=>this.onPayload(t),e.onclose=t=>this.onClose(t),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?Ro(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const i=this.parseError(t),n=i.message||i.toString(),s=nh(e,n);this.events.emit("payload",s)}parseError(e,t=this.url){return Wb(e,e2(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>t2&&this.events.setMaxListeners(t2)}emitError(e){const t=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${e2(this.url)}`));return this.events.emit("register_error",t),t}}var w0={exports:{}};(function(r,e){var t=200,i="__lodash_hash_undefined__",n=1,s=2,a=9007199254740991,f="[object Arguments]",h="[object Array]",u="[object AsyncFunction]",g="[object Boolean]",w="[object Date]",M="[object Error]",C="[object Function]",O="[object GeneratorFunction]",N="[object Map]",j="[object Number]",H="[object Null]",F="[object Object]",G="[object Promise]",B="[object Proxy]",z="[object RegExp]",W="[object Set]",_="[object String]",U="[object Symbol]",ee="[object Undefined]",oe="[object WeakMap]",L="[object ArrayBuffer]",b="[object DataView]",m="[object Float32Array]",l="[object Float64Array]",d="[object Int8Array]",y="[object Int16Array]",P="[object Int32Array]",D="[object Uint8Array]",S="[object Uint8ClampedArray]",v="[object Uint16Array]",A="[object Uint32Array]",x=/[\\^$.*+?()[\]{}|]/g,$=/^\[object .+?Constructor\]$/,ae=/^(?:0|[1-9]\d*)$/,R={};R[m]=R[l]=R[d]=R[y]=R[P]=R[D]=R[S]=R[v]=R[A]=!0,R[f]=R[h]=R[L]=R[g]=R[b]=R[w]=R[M]=R[C]=R[N]=R[j]=R[F]=R[z]=R[W]=R[_]=R[oe]=!1;var X=typeof fr=="object"&&fr&&fr.Object===Object&&fr,V=typeof self=="object"&&self&&self.Object===Object&&self,J=X||V||Function("return this")(),K=e&&!e.nodeType&&e,E=K&&!0&&r&&!r.nodeType&&r,Y=E&&E.exports===K,re=Y&&X.process,le=function(){try{return re&&re.binding&&re.binding("util")}catch{}}(),he=le&&le.isTypedArray;function ge(Q,ne){for(var pe=-1,Ue=Q==null?0:Q.length,Xt=0,bt=[];++pe<Ue;){var or=Q[pe];ne(or,pe,Q)&&(bt[Xt++]=or)}return bt}function He(Q,ne){for(var pe=-1,Ue=ne.length,Xt=Q.length;++pe<Ue;)Q[Xt+pe]=ne[pe];return Q}function Te(Q,ne){for(var pe=-1,Ue=Q==null?0:Q.length;++pe<Ue;)if(ne(Q[pe],pe,Q))return!0;return!1}function Ce(Q,ne){for(var pe=-1,Ue=Array(Q);++pe<Q;)Ue[pe]=ne(pe);return Ue}function Xe(Q){return function(ne){return Q(ne)}}function Ne(Q,ne){return Q.has(ne)}function be(Q,ne){return Q?.[ne]}function Pe(Q){var ne=-1,pe=Array(Q.size);return Q.forEach(function(Ue,Xt){pe[++ne]=[Xt,Ue]}),pe}function De(Q,ne){return function(pe){return Q(ne(pe))}}function ye(Q){var ne=-1,pe=Array(Q.size);return Q.forEach(function(Ue){pe[++ne]=Ue}),pe}var Ie=Array.prototype,Oe=Function.prototype,me=Object.prototype,Me=J["__core-js_shared__"],Be=Oe.toString,we=me.hasOwnProperty,ke=function(){var Q=/[^.]+$/.exec(Me&&Me.keys&&Me.keys.IE_PROTO||"");return Q?"Symbol(src)_1."+Q:""}(),We=me.toString,Ae=RegExp("^"+Be.call(we).replace(x,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ve=Y?J.Buffer:void 0,Ke=J.Symbol,Ge=J.Uint8Array,mt=me.propertyIsEnumerable,It=Ie.splice,Ye=Ke?Ke.toStringTag:void 0,Pt=Object.getOwnPropertySymbols,Ot=Ve?Ve.isBuffer:void 0,Ze=De(Object.keys,Object),rt=Hi(J,"DataView"),et=Hi(J,"Map"),$e=Hi(J,"Promise"),it=Hi(J,"Set"),tt=Hi(J,"WeakMap"),Re=Hi(Object,"create"),lt=Ps(rt),ht=Ps(et),Le=Ps($e),ut=Ps(it),nt=Ps(tt),Fe=Ke?Ke.prototype:void 0,st=Fe?Fe.valueOf:void 0;function Qe(Q){var ne=-1,pe=Q==null?0:Q.length;for(this.clear();++ne<pe;){var Ue=Q[ne];this.set(Ue[0],Ue[1])}}function qe(){this.__data__=Re?Re(null):{},this.size=0}function dt(Q){var ne=this.has(Q)&&delete this.__data__[Q];return this.size-=ne?1:0,ne}function Ht(Q){var ne=this.__data__;if(Re){var pe=ne[Q];return pe===i?void 0:pe}return we.call(ne,Q)?ne[Q]:void 0}function at(Q){var ne=this.__data__;return Re?ne[Q]!==void 0:we.call(ne,Q)}function kt(Q,ne){var pe=this.__data__;return this.size+=this.has(Q)?0:1,pe[Q]=Re&&ne===void 0?i:ne,this}Qe.prototype.clear=qe,Qe.prototype.delete=dt,Qe.prototype.get=Ht,Qe.prototype.has=at,Qe.prototype.set=kt;function _t(Q){var ne=-1,pe=Q==null?0:Q.length;for(this.clear();++ne<pe;){var Ue=Q[ne];this.set(Ue[0],Ue[1])}}function qt(){this.__data__=[],this.size=0}function Zr(Q){var ne=this.__data__,pe=sa(ne,Q);if(pe<0)return!1;var Ue=ne.length-1;return pe==Ue?ne.pop():It.call(ne,pe,1),--this.size,!0}function Xr(Q){var ne=this.__data__,pe=sa(ne,Q);return pe<0?void 0:ne[pe][1]}function ei(Q){return sa(this.__data__,Q)>-1}function ti(Q,ne){var pe=this.__data__,Ue=sa(pe,Q);return Ue<0?(++this.size,pe.push([Q,ne])):pe[Ue][1]=ne,this}_t.prototype.clear=qt,_t.prototype.delete=Zr,_t.prototype.get=Xr,_t.prototype.has=ei,_t.prototype.set=ti;function vr(Q){var ne=-1,pe=Q==null?0:Q.length;for(this.clear();++ne<pe;){var Ue=Q[ne];this.set(Ue[0],Ue[1])}}function Ai(){this.size=0,this.__data__={hash:new Qe,map:new(et||_t),string:new Qe}}function Pn(Q){var ne=ho(this,Q).delete(Q);return this.size-=ne?1:0,ne}function Ei(Q){return ho(this,Q).get(Q)}function Dn(Q){return ho(this,Q).has(Q)}function On(Q,ne){var pe=ho(this,Q),Ue=pe.size;return pe.set(Q,ne),this.size+=pe.size==Ue?0:1,this}vr.prototype.clear=Ai,vr.prototype.delete=Pn,vr.prototype.get=Ei,vr.prototype.has=Dn,vr.prototype.set=On;function Si(Q){var ne=-1,pe=Q==null?0:Q.length;for(this.__data__=new vr;++ne<pe;)this.add(Q[ne])}function fn(Q){return this.__data__.set(Q,i),this}function ln(Q){return this.__data__.has(Q)}Si.prototype.add=Si.prototype.push=fn,Si.prototype.has=ln;function Cr(Q){var ne=this.__data__=new _t(Q);this.size=ne.size}function Rn(){this.__data__=new _t,this.size=0}function Tn(Q){var ne=this.__data__,pe=ne.delete(Q);return this.size=ne.size,pe}function Nn(Q){return this.__data__.get(Q)}function na(Q){return this.__data__.has(Q)}function lo(Q,ne){var pe=this.__data__;if(pe instanceof _t){var Ue=pe.__data__;if(!et||Ue.length<t-1)return Ue.push([Q,ne]),this.size=++pe.size,this;pe=this.__data__=new vr(Ue)}return pe.set(Q,ne),this.size=pe.size,this}Cr.prototype.clear=Rn,Cr.prototype.delete=Tn,Cr.prototype.get=Nn,Cr.prototype.has=na,Cr.prototype.set=lo;function kh(Q,ne){var pe=dc(Q),Ue=!pe&&tu(Q),Xt=!pe&&!Ue&&Bf(Q),bt=!pe&&!Ue&&!Xt&&nu(Q),or=pe||Ue||Xt||bt,Er=or?Ce(Q.length,String):[],Bt=Er.length;for(var er in Q)(ne||we.call(Q,er))&&!(or&&(er=="length"||Xt&&(er=="offset"||er=="parent")||bt&&(er=="buffer"||er=="byteLength"||er=="byteOffset")||Jh(er,Bt)))&&Er.push(er);return Er}function sa(Q,ne){for(var pe=Q.length;pe--;)if(eu(Q[pe][0],ne))return pe;return-1}function $f(Q,ne,pe){var Ue=ne(Q);return dc(Q)?Ue:He(Ue,pe(Q))}function oa(Q){return Q==null?Q===void 0?ee:H:Ye&&Ye in Object(Q)?Gh(Q):Yp(Q)}function Lf(Q){return ca(Q)&&oa(Q)==f}function aa(Q,ne,pe,Ue,Xt){return Q===ne?!0:Q==null||ne==null||!ca(Q)&&!ca(ne)?Q!==Q&&ne!==ne:jh(Q,ne,pe,Ue,aa,Xt)}function jh(Q,ne,pe,Ue,Xt,bt){var or=dc(Q),Er=dc(ne),Bt=or?h:cs(Q),er=Er?h:cs(ne);Bt=Bt==f?F:Bt,er=er==f?F:er;var _r=Bt==F,Ii=er==F,Sr=Bt==er;if(Sr&&Bf(Q)){if(!Bf(ne))return!1;or=!0,_r=!1}if(Sr&&!_r)return bt||(bt=new Cr),or||nu(Q)?hc(Q,ne,pe,Ue,Xt,bt):Gp(Q,ne,Bt,pe,Ue,Xt,bt);if(!(pe&n)){var ar=_r&&we.call(Q,"__wrapped__"),hi=Ii&&we.call(ne,"__wrapped__");if(ar||hi){var $n=ar?Q.value():Q,hn=hi?ne.value():ne;return bt||(bt=new Cr),Xt($n,hn,pe,Ue,bt)}}return Sr?(bt||(bt=new Cr),Vh(Q,ne,pe,Ue,Xt,bt)):!1}function Vp(Q){if(!iu(Q)||Zh(Q))return!1;var ne=pc(Q)?Ae:$;return ne.test(Ps(Q))}function Wh(Q){return ca(Q)&&ru(Q.length)&&!!R[oa(Q)]}function Kh(Q){if(!Xh(Q))return Ze(Q);var ne=[];for(var pe in Object(Q))we.call(Q,pe)&&pe!="constructor"&&ne.push(pe);return ne}function hc(Q,ne,pe,Ue,Xt,bt){var or=pe&n,Er=Q.length,Bt=ne.length;if(Er!=Bt&&!(or&&Bt>Er))return!1;var er=bt.get(Q);if(er&&bt.get(ne))return er==ne;var _r=-1,Ii=!0,Sr=pe&s?new Si:void 0;for(bt.set(Q,ne),bt.set(ne,Q);++_r<Er;){var ar=Q[_r],hi=ne[_r];if(Ue)var $n=or?Ue(hi,ar,_r,ne,Q,bt):Ue(ar,hi,_r,Q,ne,bt);if($n!==void 0){if($n)continue;Ii=!1;break}if(Sr){if(!Te(ne,function(hn,fs){if(!Ne(Sr,fs)&&(ar===hn||Xt(ar,hn,pe,Ue,bt)))return Sr.push(fs)})){Ii=!1;break}}else if(!(ar===hi||Xt(ar,hi,pe,Ue,bt))){Ii=!1;break}}return bt.delete(Q),bt.delete(ne),Ii}function Gp(Q,ne,pe,Ue,Xt,bt,or){switch(pe){case b:if(Q.byteLength!=ne.byteLength||Q.byteOffset!=ne.byteOffset)return!1;Q=Q.buffer,ne=ne.buffer;case L:return!(Q.byteLength!=ne.byteLength||!bt(new Ge(Q),new Ge(ne)));case g:case w:case j:return eu(+Q,+ne);case M:return Q.name==ne.name&&Q.message==ne.message;case z:case _:return Q==ne+"";case N:var Er=Pe;case W:var Bt=Ue&n;if(Er||(Er=ye),Q.size!=ne.size&&!Bt)return!1;var er=or.get(Q);if(er)return er==ne;Ue|=s,or.set(Q,ne);var _r=hc(Er(Q),Er(ne),Ue,Xt,bt,or);return or.delete(Q),_r;case U:if(st)return st.call(Q)==st.call(ne)}return!1}function Vh(Q,ne,pe,Ue,Xt,bt){var or=pe&n,Er=uc(Q),Bt=Er.length,er=uc(ne),_r=er.length;if(Bt!=_r&&!or)return!1;for(var Ii=Bt;Ii--;){var Sr=Er[Ii];if(!(or?Sr in ne:we.call(ne,Sr)))return!1}var ar=bt.get(Q);if(ar&&bt.get(ne))return ar==ne;var hi=!0;bt.set(Q,ne),bt.set(ne,Q);for(var $n=or;++Ii<Bt;){Sr=Er[Ii];var hn=Q[Sr],fs=ne[Sr];if(Ue)var Ff=or?Ue(fs,hn,Sr,ne,Q,bt):Ue(hn,fs,Sr,Q,ne,bt);if(!(Ff===void 0?hn===fs||Xt(hn,fs,pe,Ue,bt):Ff)){hi=!1;break}$n||($n=Sr=="constructor")}if(hi&&!$n){var fa=Q.constructor,Ur=ne.constructor;fa!=Ur&&"constructor"in Q&&"constructor"in ne&&!(typeof fa=="function"&&fa instanceof fa&&typeof Ur=="function"&&Ur instanceof Ur)&&(hi=!1)}return bt.delete(Q),bt.delete(ne),hi}function uc(Q){return $f(Q,Zp,Yh)}function ho(Q,ne){var pe=Q.__data__;return Qh(ne)?pe[typeof ne=="string"?"string":"hash"]:pe.map}function Hi(Q,ne){var pe=be(Q,ne);return Vp(pe)?pe:void 0}function Gh(Q){var ne=we.call(Q,Ye),pe=Q[Ye];try{Q[Ye]=void 0;var Ue=!0}catch{}var Xt=We.call(Q);return Ue&&(ne?Q[Ye]=pe:delete Q[Ye]),Xt}var Yh=Pt?function(Q){return Q==null?[]:(Q=Object(Q),ge(Pt(Q),function(ne){return mt.call(Q,ne)}))}:Zt,cs=oa;(rt&&cs(new rt(new ArrayBuffer(1)))!=b||et&&cs(new et)!=N||$e&&cs($e.resolve())!=G||it&&cs(new it)!=W||tt&&cs(new tt)!=oe)&&(cs=function(Q){var ne=oa(Q),pe=ne==F?Q.constructor:void 0,Ue=pe?Ps(pe):"";if(Ue)switch(Ue){case lt:return b;case ht:return N;case Le:return G;case ut:return W;case nt:return oe}return ne});function Jh(Q,ne){return ne=ne??a,!!ne&&(typeof Q=="number"||ae.test(Q))&&Q>-1&&Q%1==0&&Q<ne}function Qh(Q){var ne=typeof Q;return ne=="string"||ne=="number"||ne=="symbol"||ne=="boolean"?Q!=="__proto__":Q===null}function Zh(Q){return!!ke&&ke in Q}function Xh(Q){var ne=Q&&Q.constructor,pe=typeof ne=="function"&&ne.prototype||me;return Q===pe}function Yp(Q){return We.call(Q)}function Ps(Q){if(Q!=null){try{return Be.call(Q)}catch{}try{return Q+""}catch{}}return""}function eu(Q,ne){return Q===ne||Q!==Q&&ne!==ne}var tu=Lf(function(){return arguments}())?Lf:function(Q){return ca(Q)&&we.call(Q,"callee")&&!mt.call(Q,"callee")},dc=Array.isArray;function Jp(Q){return Q!=null&&ru(Q.length)&&!pc(Q)}var Bf=Ot||Qt;function Qp(Q,ne){return aa(Q,ne)}function pc(Q){if(!iu(Q))return!1;var ne=oa(Q);return ne==C||ne==O||ne==u||ne==B}function ru(Q){return typeof Q=="number"&&Q>-1&&Q%1==0&&Q<=a}function iu(Q){var ne=typeof Q;return Q!=null&&(ne=="object"||ne=="function")}function ca(Q){return Q!=null&&typeof Q=="object"}var nu=he?Xe(he):Wh;function Zp(Q){return Jp(Q)?kh(Q):Kh(Q)}function Zt(){return[]}function Qt(){return!1}r.exports=Qp})(w0,w0.exports);var VI=w0.exports,GI=Object.defineProperty,r2=Object.getOwnPropertySymbols,YI=Object.prototype.hasOwnProperty,JI=Object.prototype.propertyIsEnumerable,i2=(r,e,t)=>e in r?GI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,fi=(r,e)=>{for(var t in e||(e={}))YI.call(e,t)&&i2(r,t,e[t]);if(r2)for(var t of r2(e))JI.call(e,t)&&i2(r,t,e[t]);return r};const n2="wc",s2=2,oh="core",ts=`${n2}@2:${oh}:`,QI={name:oh,logger:"error"},ZI={database:":memory:"},XI="crypto",o2="client_ed25519_seed",eM=_e.ONE_DAY,tM="keychain",rM="0.3",iM="messages",nM="0.3",a2=_e.SIX_HOURS,sM="publisher",c2="irn",oM="error",f2="wss://relay.walletconnect.org",aM="relayer",Lr={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},cM="_subscription",sn={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},fM=.1,y0="2.17.4",sr={link_mode:"link_mode",relay:"relay"},lM="0.3",hM="WALLETCONNECT_CLIENT_ID",l2="WALLETCONNECT_LINK_MODE_APPS",Fi={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},uM="subscription",dM="0.3",pM=_e.FIVE_SECONDS*1e3,gM="pairing",vM="0.3",lf={wc_pairingDelete:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:_e.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:_e.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:_e.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:0},res:{ttl:_e.ONE_DAY,prompt:!1,tag:0}}},qo={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},Sn={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},mM="history",bM="0.3",wM="expirer",on={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},yM="0.3",_M="verify-api",xM="https://verify.walletconnect.com",h2="https://verify.walletconnect.org",hf=h2,AM=`${hf}/v3`,EM=[xM,h2],SM="echo",IM="https://echo.walletconnect.com",rs={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},Ss={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},In={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},zo={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},Ho={authenticated_session_approve_started:"authenticated_session_approve_started",authenticated_session_not_expired:"authenticated_session_not_expired",chains_caip2_compliant:"chains_caip2_compliant",chains_evm_compliant:"chains_evm_compliant",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve",authenticated_session_approve_publish_success:"authenticated_session_approve_publish_success"},uf={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",missing_session_authenticate_request:"missing_session_authenticate_request",session_authenticate_request_expired:"session_authenticate_request_expired",chains_caip2_compliant_failure:"chains_caip2_compliant_failure",chains_evm_compliant_failure:"chains_evm_compliant_failure",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},MM=.1,CM="event-client",PM=86400,DM="https://pulse.walletconnect.org/batch";function OM(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i<t.length;i++)t[i]=255;for(var n=0;n<r.length;n++){var s=r.charAt(n),a=s.charCodeAt(0);if(t[a]!==255)throw new TypeError(s+" is ambiguous");t[a]=n}var f=r.length,h=r.charAt(0),u=Math.log(f)/Math.log(256),g=Math.log(256)/Math.log(f);function w(O){if(O instanceof Uint8Array||(ArrayBuffer.isView(O)?O=new Uint8Array(O.buffer,O.byteOffset,O.byteLength):Array.isArray(O)&&(O=Uint8Array.from(O))),!(O instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(O.length===0)return"";for(var N=0,j=0,H=0,F=O.length;H!==F&&O[H]===0;)H++,N++;for(var G=(F-H)*g+1>>>0,B=new Uint8Array(G);H!==F;){for(var z=O[H],W=0,_=G-1;(z!==0||W<j)&&_!==-1;_--,W++)z+=256*B[_]>>>0,B[_]=z%f>>>0,z=z/f>>>0;if(z!==0)throw new Error("Non-zero carry");j=W,H++}for(var U=G-j;U!==G&&B[U]===0;)U++;for(var ee=h.repeat(N);U<G;++U)ee+=r.charAt(B[U]);return ee}function M(O){if(typeof O!="string")throw new TypeError("Expected String");if(O.length===0)return new Uint8Array;var N=0;if(O[N]!==" "){for(var j=0,H=0;O[N]===h;)j++,N++;for(var F=(O.length-N)*u+1>>>0,G=new Uint8Array(F);O[N];){var B=t[O.charCodeAt(N)];if(B===255)return;for(var z=0,W=F-1;(B!==0||z<H)&&W!==-1;W--,z++)B+=f*G[W]>>>0,G[W]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");H=z,N++}if(O[N]!==" "){for(var _=F-H;_!==F&&G[_]===0;)_++;for(var U=new Uint8Array(j+(F-_)),ee=j;_!==F;)U[ee++]=G[_++];return U}}}function C(O){var N=M(O);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:M,decode:C}}var RM=OM,TM=RM;const u2=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},NM=r=>new TextEncoder().encode(r),$M=r=>new TextDecoder().decode(r);class LM{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class BM{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return d2(this,e)}}class FM{constructor(e){this.decoders=e}or(e){return d2(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const d2=(r,e)=>new FM(fi(fi({},r.decoders||{[r.prefix]:r}),e.decoders||{[e.prefix]:e}));class UM{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new LM(e,t,i),this.decoder=new BM(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const ah=({name:r,prefix:e,encode:t,decode:i})=>new UM(r,e,t,i),df=({prefix:r,name:e,alphabet:t})=>{const{encode:i,decode:n}=TM(t,e);return ah({prefix:r,name:e,encode:i,decode:s=>u2(n(s))})},qM=(r,e,t,i)=>{const n={};for(let g=0;g<e.length;++g)n[e[g]]=g;let s=r.length;for(;r[s-1]==="=";)--s;const a=new Uint8Array(s*t/8|0);let f=0,h=0,u=0;for(let g=0;g<s;++g){const w=n[r[g]];if(w===void 0)throw new SyntaxError(`Non-${i} character`);h=h<<t|w,f+=t,f>=8&&(f-=8,a[u++]=255&h>>f)}if(f>=t||255&h<<8-f)throw new SyntaxError("Unexpected end of data");return a},zM=(r,e,t)=>{const i=e[e.length-1]==="=",n=(1<<t)-1;let s="",a=0,f=0;for(let h=0;h<r.length;++h)for(f=f<<8|r[h],a+=8;a>t;)a-=t,s+=e[n&f>>a];if(a&&(s+=e[n&f<<t-a]),i)for(;s.length*t&7;)s+="=";return s},Kr=({name:r,prefix:e,bitsPerChar:t,alphabet:i})=>ah({prefix:e,name:r,encode(n){return zM(n,i,t)},decode(n){return qM(n,i,t,r)}}),HM=ah({prefix:"\0",name:"identity",encode:r=>$M(r),decode:r=>NM(r)});var kM=Object.freeze({__proto__:null,identity:HM});const jM=Kr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var WM=Object.freeze({__proto__:null,base2:jM});const KM=Kr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var VM=Object.freeze({__proto__:null,base8:KM});const GM=df({prefix:"9",name:"base10",alphabet:"0123456789"});var YM=Object.freeze({__proto__:null,base10:GM});const JM=Kr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),QM=Kr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var ZM=Object.freeze({__proto__:null,base16:JM,base16upper:QM});const XM=Kr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),eC=Kr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),tC=Kr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),rC=Kr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),iC=Kr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),nC=Kr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),sC=Kr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),oC=Kr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),aC=Kr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var cC=Object.freeze({__proto__:null,base32:XM,base32upper:eC,base32pad:tC,base32padupper:rC,base32hex:iC,base32hexupper:nC,base32hexpad:sC,base32hexpadupper:oC,base32z:aC});const fC=df({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),lC=df({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var hC=Object.freeze({__proto__:null,base36:fC,base36upper:lC});const uC=df({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),dC=df({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var pC=Object.freeze({__proto__:null,base58btc:uC,base58flickr:dC});const gC=Kr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),vC=Kr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),mC=Kr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),bC=Kr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var wC=Object.freeze({__proto__:null,base64:gC,base64pad:vC,base64url:mC,base64urlpad:bC});const p2=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}"),yC=p2.reduce((r,e,t)=>(r[t]=e,r),[]),_C=p2.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function xC(r){return r.reduce((e,t)=>(e+=yC[t],e),"")}function AC(r){const e=[];for(const t of r){const i=_C[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const EC=ah({prefix:"\u{1F680}",name:"base256emoji",encode:xC,decode:AC});var SC=Object.freeze({__proto__:null,base256emoji:EC}),IC=v2,g2=128,MC=127,CC=~MC,PC=Math.pow(2,31);function v2(r,e,t){e=e||[],t=t||0;for(var i=t;r>=PC;)e[t++]=r&255|g2,r/=128;for(;r&CC;)e[t++]=r&255|g2,r>>>=7;return e[t]=r|0,v2.bytes=t-i+1,e}var DC=_0,OC=128,m2=127;function _0(r,i){var t=0,i=i||0,n=0,s=i,a,f=r.length;do{if(s>=f)throw _0.bytes=0,new RangeError("Could not decode varint");a=r[s++],t+=n<28?(a&m2)<<n:(a&m2)*Math.pow(2,n),n+=7}while(a>=OC);return _0.bytes=s-i,t}var RC=Math.pow(2,7),TC=Math.pow(2,14),NC=Math.pow(2,21),$C=Math.pow(2,28),LC=Math.pow(2,35),BC=Math.pow(2,42),FC=Math.pow(2,49),UC=Math.pow(2,56),qC=Math.pow(2,63),zC=function(r){return r<RC?1:r<TC?2:r<NC?3:r<$C?4:r<LC?5:r<BC?6:r<FC?7:r<UC?8:r<qC?9:10},HC={encode:IC,decode:DC,encodingLength:zC},b2=HC;const w2=(r,e,t=0)=>(b2.encode(r,e,t),e),y2=r=>b2.encodingLength(r),x0=(r,e)=>{const t=e.byteLength,i=y2(r),n=i+y2(t),s=new Uint8Array(n+t);return w2(r,s,0),w2(t,s,i),s.set(e,n),new kC(r,t,e,s)};class kC{constructor(e,t,i,n){this.code=e,this.size=t,this.digest=i,this.bytes=n}}const _2=({name:r,code:e,encode:t})=>new jC(r,e,t);class jC{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?x0(this.code,t):t.then(i=>x0(this.code,i))}else throw Error("Unknown type, must be binary type")}}const x2=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),WC=_2({name:"sha2-256",code:18,encode:x2("SHA-256")}),KC=_2({name:"sha2-512",code:19,encode:x2("SHA-512")});var VC=Object.freeze({__proto__:null,sha256:WC,sha512:KC});const A2=0,GC="identity",E2=u2;var YC=Object.freeze({__proto__:null,identity:{code:A2,name:GC,encode:E2,digest:r=>x0(A2,E2(r))}});new TextEncoder,new TextDecoder;const S2=fi(fi(fi(fi(fi(fi(fi(fi(fi(fi({},kM),WM),VM),YM),ZM),cC),hC),pC),wC),SC);fi(fi({},VC),YC);function JC(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function I2(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const M2=I2("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),A0=I2("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=JC(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),QC=fi({utf8:M2,"utf-8":M2,hex:S2.base16,latin1:A0,ascii:A0,binary:A0},S2);function ZC(r,e="utf8"){const t=QC[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):t.decoder.decode(`${t.prefix}${r}`)}class XC{constructor(e,t){this.core=e,this.logger=t,this.keychain=new Map,this.name=tM,this.version=rM,this.initialized=!1,this.storagePrefix=ts,this.init=async()=>{if(!this.initialized){const i=await this.getKeyChain();typeof i<"u"&&(this.keychain=i),this.initialized=!0}},this.has=i=>(this.isInitialized(),this.keychain.has(i)),this.set=async(i,n)=>{this.isInitialized(),this.keychain.set(i,n),await this.persist()},this.get=i=>{this.isInitialized();const n=this.keychain.get(i);if(typeof n>"u"){const{message:s}=xe("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(s)}return n},this.del=async i=>{this.isInitialized(),this.keychain.delete(i),await this.persist()},this.core=e,this.logger=ci(t,this.name)}get context(){return yi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,Wm(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Km(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}}class eP{constructor(e,t,i){this.core=e,this.logger=t,this.name=XI,this.randomSessionIdentifier=t0(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=n=>(this.isInitialized(),this.keychain.has(n)),this.getClientId=async()=>{this.isInitialized();const n=await this.getClientSeed(),s=Lm(n);return $m(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const n=LA();return this.setPrivateKey(n.publicKey,n.privateKey)},this.signJWT=async n=>{this.isInitialized();const s=await this.getClientSeed(),a=Lm(s),f=this.randomSessionIdentifier;return await jx(f,n,eM,a)},this.generateSharedKey=(n,s,a)=>{this.isInitialized();const f=this.getPrivateKey(n),h=BA(f,s);return this.setSymKey(h,a)},this.setSymKey=async(n,s)=>{this.isInitialized();const a=s||jl(n);return await this.keychain.set(a,n),a},this.deleteKeyPair=async n=>{this.isInitialized(),await this.keychain.del(n)},this.deleteSymKey=async n=>{this.isInitialized(),await this.keychain.del(n)},this.encode=async(n,s,a)=>{this.isInitialized();const f=lb(a),h=bs(s);if(ub(f))return UA(h,a?.encoding);if(hb(f)){const M=f.senderPublicKey,C=f.receiverPublicKey;n=await this.generateSharedKey(M,C)}const u=this.getSymKey(n),{type:g,senderPublicKey:w}=f;return FA({type:g,symKey:u,message:h,senderPublicKey:w,encoding:a?.encoding})},this.decode=async(n,s,a)=>{this.isInitialized();const f=HA(s,a);if(ub(f)){const h=zA(s,a?.encoding);return Ro(h)}if(hb(f)){const h=f.receiverPublicKey,u=f.senderPublicKey;n=await this.generateSharedKey(h,u)}try{const h=this.getSymKey(n),u=qA({symKey:h,encoded:s,encoding:a?.encoding});return Ro(u)}catch(h){this.logger.error(`Failed to decode message from topic: '${n}', clientId: '${await this.getClientId()}'`),this.logger.error(h)}},this.getPayloadType=(n,s=Js)=>{const a=Zc({encoded:n,encoding:s});return Lo(a.type)},this.getPayloadSenderPublicKey=(n,s=Js)=>{const a=Zc({encoded:n,encoding:s});return a.senderPublicKey?nI(a.senderPublicKey,oi):void 0},this.core=e,this.logger=ci(t,this.name),this.keychain=i||new XC(this.core,this.logger)}get context(){return yi(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(o2)}catch{e=t0(),await this.keychain.set(o2,e)}return ZC(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}}class tP extends WS{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=iM,this.version=nM,this.initialized=!1,this.storagePrefix=ts,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const i=await this.getRelayerMessages();typeof i<"u"&&(this.messages=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}finally{this.initialized=!0}}},this.set=async(i,n)=>{this.isInitialized();const s=ys(n);let a=this.messages.get(i);return typeof a>"u"&&(a={}),typeof a[s]<"u"||(a[s]=n,this.messages.set(i,a),await this.persist()),s},this.get=i=>{this.isInitialized();let n=this.messages.get(i);return typeof n>"u"&&(n={}),n},this.has=(i,n)=>{this.isInitialized();const s=this.get(i),a=ys(n);return typeof s[a]<"u"},this.del=async i=>{this.isInitialized(),this.messages.delete(i),await this.persist()},this.logger=ci(e,this.name),this.core=t}get context(){return yi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,Wm(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Km(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}}var rP=Object.defineProperty,iP=Object.defineProperties,nP=Object.getOwnPropertyDescriptors,C2=Object.getOwnPropertySymbols,sP=Object.prototype.hasOwnProperty,oP=Object.prototype.propertyIsEnumerable,P2=(r,e,t)=>e in r?rP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,D2=(r,e)=>{for(var t in e||(e={}))sP.call(e,t)&&P2(r,t,e[t]);if(C2)for(var t of C2(e))oP.call(e,t)&&P2(r,t,e[t]);return r},O2=(r,e)=>iP(r,nP(e));class aP extends KS{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new zr.exports.EventEmitter,this.name=sM,this.queue=new Map,this.publishTimeout=_e.toMiliseconds(_e.ONE_MINUTE),this.initialPublishTimeout=_e.toMiliseconds(_e.ONE_SECOND*15),this.needsTransportRestart=!1,this.publish=async(i,n,s)=>{var a;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:n,opts:s}});const f=s?.ttl||a2,h=Wl(s),u=s?.prompt||!1,g=s?.tag||0,w=s?.id||Uo().toString(),M={topic:i,message:n,opts:{ttl:f,relay:h,prompt:u,tag:g,id:w,attestation:s?.attestation}},C=`Failed to publish payload, please try again. id:${w} tag:${g}`;try{const O=new Promise(async N=>{const j=({id:F})=>{M.opts.id===F&&(this.removeRequestFromQueue(F),this.relayer.events.removeListener(Lr.publish,j),N(M))};this.relayer.events.on(Lr.publish,j);const H=Gs(new Promise((F,G)=>{this.rpcPublish({topic:i,message:n,ttl:f,prompt:u,tag:g,id:w,attestation:s?.attestation}).then(F).catch(B=>{this.logger.warn(B,B?.message),G(B)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${w} tag:${g}`);try{await H,this.events.removeListener(Lr.publish,j)}catch(F){this.queue.set(w,O2(D2({},M),{attempt:1})),this.logger.warn(F,F?.message)}});this.logger.trace({type:"method",method:"publish",params:{id:w,topic:i,message:n,opts:s}}),await Gs(O,this.publishTimeout,C)}catch(O){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(O),(a=s?.internal)!=null&&a.throwOnFailedPublish)throw O}finally{this.queue.delete(w)}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.relayer=e,this.logger=ci(t,this.name),this.registerEventListeners()}get context(){return yi(this.logger)}async rpcPublish(e){var t,i,n,s;const{topic:a,message:f,ttl:h=a2,prompt:u,tag:g,id:w,attestation:M}=e,C={method:Xc(Wl().protocol).publish,params:{topic:a,message:f,ttl:h,prompt:u,tag:g,attestation:M},id:w};ai((t=C.params)==null?void 0:t.prompt)&&((i=C.params)==null||delete i.prompt),ai((n=C.params)==null?void 0:n.tag)&&((s=C.params)==null||delete s.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:C});const O=await this.relayer.request(C);return this.relayer.events.emit(Lr.publish,e),this.logger.debug("Successfully Published Payload"),O}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async(e,t)=>{const i=e.attempt+1;this.queue.set(t,O2(D2({},e),{attempt:i}));const{topic:n,message:s,opts:a,attestation:f}=e;this.logger.warn({},`Publisher: queue->publishing: ${e.opts.id}, tag: ${e.opts.tag}, attempt: ${i}`),await this.rpcPublish({topic:n,message:s,ttl:a.ttl,prompt:a.prompt,tag:a.tag,id:a.id,attestation:f}),this.logger.warn({},`Publisher: queue->published: ${e.opts.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(Ha.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(Lr.connection_stalled);return}this.checkQueue()}),this.relayer.on(Lr.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class cP{constructor(){this.map=new Map,this.set=(e,t)=>{const i=this.get(e);this.exists(e,t)||this.map.set(e,[...i,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const i=this.get(e);if(!this.exists(e,t))return;const n=i.filter(s=>s!==t);if(!n.length){this.map.delete(e);return}this.map.set(e,n)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var fP=Object.defineProperty,lP=Object.defineProperties,hP=Object.getOwnPropertyDescriptors,R2=Object.getOwnPropertySymbols,uP=Object.prototype.hasOwnProperty,dP=Object.prototype.propertyIsEnumerable,T2=(r,e,t)=>e in r?fP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pf=(r,e)=>{for(var t in e||(e={}))uP.call(e,t)&&T2(r,t,e[t]);if(R2)for(var t of R2(e))dP.call(e,t)&&T2(r,t,e[t]);return r},E0=(r,e)=>lP(r,hP(e));class pP extends YS{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new cP,this.events=new zr.exports.EventEmitter,this.name=uM,this.version=dM,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=ts,this.subscribeTimeout=_e.toMiliseconds(_e.ONE_MINUTE),this.initialSubscribeTimeout=_e.toMiliseconds(_e.ONE_SECOND*15),this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(i,n)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}});try{const s=Wl(n),a={topic:i,relay:s,transportType:n?.transportType};this.pending.set(i,a);const f=await this.rpcSubscribe(i,s,n);return typeof f=="string"&&(this.onSubscribe(f,a),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}})),f}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(i,n)=>{await this.restartToComplete(),this.isInitialized(),typeof n?.id<"u"?await this.unsubscribeById(i,n.id,n):await this.unsubscribeByTopic(i,n)},this.isSubscribed=async i=>{if(this.topics.includes(i))return!0;const n=`${this.pendingSubscriptionWatchLabel}_${i}`;return await new Promise((s,a)=>{const f=new _e.Watch;f.start(n);const h=setInterval(()=>{(!this.pending.has(i)&&this.topics.includes(i)||this.cached.some(u=>u.topic===i))&&(clearInterval(h),f.stop(n),s(!0)),f.elapsed(n)>=pM&&(clearInterval(h),f.stop(n),a(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{await this.restore(),await this.onRestart()},this.checkPending=async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const i=[];this.pending.forEach(n=>{i.push(n)}),await this.batchSubscribe(i)},this.registerEventListeners=()=>{this.relayer.core.heartbeat.on(Ha.pulse,async()=>{await this.checkPending()}),this.events.on(Fi.created,async i=>{const n=Fi.created;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:i}),await this.persist()}),this.events.on(Fi.deleted,async i=>{const n=Fi.deleted;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:i}),await this.persist()})},this.relayer=e,this.logger=ci(t,this.name),this.clientId=""}get context(){return yi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let i=!1;try{i=this.getSubscription(e).topic===t}catch{}return i}reset(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const i=this.topicMap.get(e);await Promise.all(i.map(async n=>await this.unsubscribeById(e,n,t)))}async unsubscribeById(e,t,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}});try{const n=Wl(i);await this.rpcUnsubscribe(e,t,n);const s=Gt("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}})}catch(n){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(n),n}}async rpcSubscribe(e,t,i){var n;i?.transportType===sr.relay&&await this.restartToComplete();const s={method:Xc(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const a=(n=i?.internal)==null?void 0:n.throwOnFailedPublish;try{const f=this.getSubscriptionId(e);if(i?.transportType===sr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(g=>this.logger.warn(g))},_e.toMiliseconds(_e.ONE_SECOND)),f;const h=new Promise(async g=>{const w=M=>{M.topic===e&&(this.events.removeListener(Fi.created,w),g(M.id))};this.events.on(Fi.created,w);try{const M=await Gs(new Promise((C,O)=>{this.relayer.request(s).catch(N=>{this.logger.warn(N,N?.message),O(N)}).then(C)}),this.initialSubscribeTimeout,`Subscribing to ${e} failed, please try again`);this.events.removeListener(Fi.created,w),g(M)}catch{}}),u=await Gs(h,this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!u&&a)throw new Error(`Subscribing to ${e} failed, please try again`);return u?f:null}catch(f){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Lr.connection_stalled),a)throw f}return null}async rpcBatchSubscribe(e){if(!e.length)return;const t=e[0].relay,i={method:Xc(t.protocol).batchSubscribe,params:{topics:e.map(n=>n.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{await await Gs(new Promise(n=>{this.relayer.request(i).catch(s=>this.logger.warn(s)).then(n)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(Lr.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const t=e[0].relay,i={method:Xc(t.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});let n;try{n=await await Gs(new Promise((s,a)=>{this.relayer.request(i).catch(f=>{this.logger.warn(f),a(f)}).then(s)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(Lr.connection_stalled)}return n}rpcUnsubscribe(e,t,i){const n={method:Xc(i.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),this.relayer.request(n)}onSubscribe(e,t){this.setSubscription(e,E0(pf({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach(t=>{this.setSubscription(t.id,pf({},t)),this.pending.delete(t.topic)})}async onUnsubscribe(e,t,i){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,i),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t)}addSubscription(e,t){this.subscriptions.set(e,pf({},t)),this.topicMap.set(t.topic,e),this.events.emit(Fi.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:i}=xe("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const i=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(i.topic,e),this.events.emit(Fi.deleted,E0(pf({},i),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Fi.sync)}async onRestart(){if(this.cached.length){const e=[...this.cached],t=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let i=0;i<t;i++){const n=e.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(n)}}this.events.emit(Fi.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:t}=xe("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){e.length&&(await this.rpcBatchSubscribe(e),this.onBatchSubscribe(e.map(t=>E0(pf({},t),{id:this.getSubscriptionId(t.topic)}))))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const t=await this.rpcBatchFetchMessages(e);t&&t.messages&&(await hA(_e.toMiliseconds(_e.ONE_SECOND)),await this.relayer.handleBatchMessageEvents(t.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen()}getSubscriptionId(e){return ys(e+this.clientId)}}var gP=Object.defineProperty,N2=Object.getOwnPropertySymbols,vP=Object.prototype.hasOwnProperty,mP=Object.prototype.propertyIsEnumerable,$2=(r,e,t)=>e in r?gP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,L2=(r,e)=>{for(var t in e||(e={}))vP.call(e,t)&&$2(r,t,e[t]);if(N2)for(var t of N2(e))mP.call(e,t)&&$2(r,t,e[t]);return r};class bP extends VS{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new zr.exports.EventEmitter,this.name=aM,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1,this.heartBeatTimeout=_e.toMiliseconds(_e.THIRTY_SECONDS+_e.FIVE_SECONDS),this.requestsInFlight=[],this.connectTimeout=_e.toMiliseconds(_e.ONE_SECOND*15),this.request=async t=>{var i,n;this.logger.debug("Publishing Request Payload");const s=t.id||Uo().toString();await this.toEstablishConnection();try{this.logger.trace({id:s,method:t.method,topic:(i=t.params)==null?void 0:i.topic},"relayer.request - publishing...");const a=`${s}:${((n=t.params)==null?void 0:n.tag)||""}`;this.requestsInFlight.push(a);const f=await this.provider.request(t);return this.requestsInFlight=this.requestsInFlight.filter(h=>h!==a),f}catch(a){throw this.logger.debug(`Failed to Publish Request: ${s}`),a}},this.resetPingTimeout=()=>{if(ql())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var t,i,n;this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(n=(i=(t=this.provider)==null?void 0:t.connection)==null?void 0:i.socket)==null||n.terminate()},this.heartBeatTimeout)}catch(t){this.logger.warn(t,t?.message)}},this.onPayloadHandler=t=>{this.onProviderPayload(t),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.warn({},"Relayer connected \u{1F6DC}"),this.startPingTimeout(),this.events.emit(Lr.connect)},this.onDisconnectHandler=()=>{this.logger.warn({},"Relayer disconnected \u{1F6D1}"),this.requestsInFlight=[],this.onProviderDisconnect()},this.onProviderErrorHandler=t=>{this.logger.fatal(t,`Fatal socket error: ${t?.message}`),this.events.emit(Lr.error,t),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(sn.payload,this.onPayloadHandler),this.provider.on(sn.connect,this.onConnectHandler),this.provider.on(sn.disconnect,this.onDisconnectHandler),this.provider.on(sn.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?ci(e.logger,this.name):Zn(rh({level:e.logger||oM})),this.messages=new tP(this.logger,e.core),this.subscriber=new pP(this,this.logger),this.publisher=new aP(this,this.logger),this.relayUrl=e?.relayUrl||f2,this.projectId=e.projectId,Zx()?this.packageName=Hm():Xx()&&(this.bundleId=Hm()),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e,e?.message)}}get context(){return yi(this.logger)}get connected(){var e,t,i;return((i=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:i.readyState)===1}get connecting(){var e,t,i;return((i=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:i.readyState)===0}async publish(e,t,i){this.isInitialized(),await this.publisher.publish(e,t,i),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now(),transportType:sr.relay})}async subscribe(e,t){var i,n,s;this.isInitialized(),(!(t!=null&&t.transportType)||t?.transportType==="relay")&&await this.toEstablishConnection();const a=typeof((i=t?.internal)==null?void 0:i.throwOnFailedPublish)>"u"?!0:(n=t?.internal)==null?void 0:n.throwOnFailedPublish;let f=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",h;const u=g=>{g.topic===e&&(this.subscriber.off(Fi.created,u),h())};return await Promise.all([new Promise(g=>{h=g,this.subscriber.on(Fi.created,u)}),new Promise(async(g,w)=>{f=await this.subscriber.subscribe(e,L2({internal:{throwOnFailedPublish:a}},t)).catch(M=>{a&&w(M)})||f,g()})]),f}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Gs(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise(async(t,i)=>{await this.connect(e).then(t).catch(i).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw new Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(e){this.logger.debug({},"Restarting transport..."),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Sb())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if(e?.length===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const t=e.sort((i,n)=>i.publishedAt-n.publishedAt);this.logger.debug(`Batch of ${t.length} message events sorted`);for(const i of t)try{await this.onMessageEvent(i)}catch(n){this.logger.warn(n,"Error while processing batch message event: "+n?.message)}this.logger.trace(`Batch of ${t.length} message events processed`)}async onLinkMessageEvent(e,t){const{topic:i}=e;if(!t.sessionExists){const n=Ir(_e.FIVE_MINUTES),s={topic:i,expiry:n,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(i,s)}this.events.emit(Lr.message,e),await this.recordMessageEvent(e)}async connect(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let t=1;for(;t<6;){try{this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${t}...`),await this.createProvider(),await new Promise(async(i,n)=>{const s=()=>{n(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(sn.disconnect,s),await Gs(new Promise((a,f)=>{this.provider.connect().then(a).catch(f)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(a=>{n(a)}).finally(()=>{this.provider.off(sn.disconnect,s),clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),await new Promise(async(a,f)=>{const h=()=>{f(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(sn.disconnect,h),await this.subscriber.start().then(a).catch(f).finally(()=>{this.provider.off(sn.disconnect,h)})}),this.hasExperiencedNetworkDisruption=!1,i()})}catch(i){await this.subscriber.stop();const n=i;this.logger.warn({},n.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${t}`);break}await new Promise(i=>setTimeout(i,_e.toMiliseconds(t*1))),t++}}startPingTimeout(){var e,t,i,n,s;if(ql())try{(t=(e=this.provider)==null?void 0:e.connection)!=null&&t.socket&&((s=(n=(i=this.provider)==null?void 0:i.connection)==null?void 0:n.socket)==null||s.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(a){this.logger.warn(a,a?.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new nn(new KI(iA({sdkVersion:y0,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:t,message:i}=e;await this.messages.set(t,i)}async shouldIgnoreMessageEvent(e){const{topic:t,message:i}=e;if(!i||i.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${i}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.warn(`Ignoring message for non-subscribed topic ${t}`),!0;const n=this.messages.has(t,i);return n&&this.logger.warn(`Ignoring duplicate message: ${i}`),n}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),b0(e)){if(!e.method.endsWith(cM))return;const t=e.params,{topic:i,message:n,publishedAt:s,attestation:a}=t.data,f={topic:i,message:n,publishedAt:s,transportType:sr.relay,attestation:a};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(L2({type:"event",event:t.id},f)),this.events.emit(t.id,f),await this.acknowledgePayload(e),await this.onMessageEvent(f)}else sh(e)&&this.events.emit(Lr.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Lr.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const t=ih(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(sn.payload,this.onPayloadHandler),this.provider.off(sn.connect,this.onConnectHandler),this.provider.off(sn.disconnect,this.onDisconnectHandler),this.provider.off(sn.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await Sb();$E(async t=>{e!==t&&(e=t,t?await this.transportOpen().catch(i=>this.logger.error(i,i?.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),clearTimeout(this.pingTimeout),this.events.emit(Lr.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||this.connectPromise||(this.reconnectTimeout=setTimeout(async()=>{clearTimeout(this.reconnectTimeout),await this.transportOpen().catch(e=>this.logger.error(e,e?.message))},_e.toMiliseconds(fM))))}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&await this.transportOpen()}}var wP=Object.defineProperty,B2=Object.getOwnPropertySymbols,yP=Object.prototype.hasOwnProperty,_P=Object.prototype.propertyIsEnumerable,F2=(r,e,t)=>e in r?wP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,U2=(r,e)=>{for(var t in e||(e={}))yP.call(e,t)&&F2(r,t,e[t]);if(B2)for(var t of B2(e))_P.call(e,t)&&F2(r,t,e[t]);return r};class ko extends GS{constructor(e,t,i,n=ts,s=void 0){super(e,t,i,n),this.core=e,this.logger=t,this.name=i,this.map=new Map,this.version=lM,this.cached=[],this.initialized=!1,this.storagePrefix=ts,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(a=>{this.getKey&&a!==null&&!ai(a)?this.map.set(this.getKey(a),a):uE(a)?this.map.set(a.id,a):dE(a)&&this.map.set(a.topic,a)}),this.cached=[],this.initialized=!0)},this.set=async(a,f)=>{this.isInitialized(),this.map.has(a)?await this.update(a,f):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:a,value:f}),this.map.set(a,f),await this.persist())},this.get=a=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:a}),this.getData(a)),this.getAll=a=>(this.isInitialized(),a?this.values.filter(f=>Object.keys(a).every(h=>VI(f[h],a[h]))):this.values),this.update=async(a,f)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:a,update:f});const h=U2(U2({},this.getData(a)),f);this.map.set(a,h),await this.persist()},this.delete=async(a,f)=>{this.isInitialized(),this.map.has(a)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:a,reason:f}),this.map.delete(a),this.addToRecentlyDeleted(a),await this.persist())},this.logger=ci(t,this.name),this.storagePrefix=n,this.getKey=s}get context(){return yi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){const{message:n}=xe("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}const{message:i}=xe("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:t}=xe("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}}class xP{constructor(e,t){this.core=e,this.logger=t,this.name=gM,this.version=vM,this.events=new zr.exports,this.initialized=!1,this.storagePrefix=ts,this.ignoredPayloadTypes=[ws],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:i})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...i])]},this.create=async i=>{this.isInitialized();const n=t0(),s=await this.core.crypto.setSymKey(n),a=Ir(_e.FIVE_MINUTES),f={protocol:c2},h={topic:s,expiry:a,relay:f,active:!1,methods:i?.methods},u=mb({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:n,relay:f,expiryTimestamp:a,methods:i?.methods});return this.events.emit(qo.create,h),this.core.expirer.set(s,a),await this.pairings.set(s,h),await this.core.relayer.subscribe(s,{transportType:i?.transportType}),{topic:s,uri:u}},this.pair=async i=>{this.isInitialized();const n=this.core.eventClient.createEvent({properties:{topic:i?.uri,trace:[rs.pairing_started]}});this.isValidPair(i,n);const{topic:s,symKey:a,relay:f,expiryTimestamp:h,methods:u}=vb(i.uri);n.props.properties.topic=s,n.addTrace(rs.pairing_uri_validation_success),n.addTrace(rs.pairing_uri_not_expired);let g;if(this.pairings.keys.includes(s)){if(g=this.pairings.get(s),n.addTrace(rs.existing_pairing),g.active)throw n.setError(Ss.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);n.addTrace(rs.pairing_not_expired)}const w=h||Ir(_e.FIVE_MINUTES),M={topic:s,relay:f,expiry:w,active:!1,methods:u};this.core.expirer.set(s,w),await this.pairings.set(s,M),n.addTrace(rs.store_new_pairing),i.activatePairing&&await this.activate({topic:s}),this.events.emit(qo.create,M),n.addTrace(rs.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(a,s),n.addTrace(rs.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{n.setError(Ss.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:f})}catch(C){throw n.setError(Ss.subscribe_pairing_topic_failure),C}return n.addTrace(rs.subscribe_pairing_topic_success),M},this.activate=async({topic:i})=>{this.isInitialized();const n=Ir(_e.THIRTY_DAYS);this.core.expirer.set(i,n),await this.pairings.update(i,{active:!0,expiry:n})},this.ping=async i=>{this.isInitialized(),await this.isValidPing(i);const{topic:n}=i;if(this.pairings.keys.includes(n)){const s=await this.sendRequest(n,"wc_pairingPing",{}),{done:a,resolve:f,reject:h}=No();this.events.once(Dt("pairing_ping",s),({error:u})=>{u?h(u):f()}),await a()}},this.updateExpiry=async({topic:i,expiry:n})=>{this.isInitialized(),await this.pairings.update(i,{expiry:n})},this.updateMetadata=async({topic:i,metadata:n})=>{this.isInitialized(),await this.pairings.update(i,{peerMetadata:n})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async i=>{this.isInitialized(),await this.isValidDisconnect(i);const{topic:n}=i;this.pairings.keys.includes(n)&&(await this.sendRequest(n,"wc_pairingDelete",Gt("USER_DISCONNECTED")),await this.deletePairing(n))},this.formatUriFromPairing=i=>{this.isInitialized();const{topic:n,relay:s,expiry:a,methods:f}=i,h=this.core.crypto.keychain.get(n);return mb({protocol:this.core.protocol,version:this.core.version,topic:n,symKey:h,relay:s,expiryTimestamp:a,methods:f})},this.sendRequest=async(i,n,s)=>{const a=Qs(n,s),f=await this.core.crypto.encode(i,a),h=lf[n].req;return this.core.history.set(i,a),this.core.relayer.publish(i,f,h),a.id},this.sendResult=async(i,n,s)=>{const a=ih(i,s),f=await this.core.crypto.encode(n,a),h=await this.core.history.get(n,i),u=lf[h.request.method].res;await this.core.relayer.publish(n,f,u),await this.core.history.resolve(a)},this.sendError=async(i,n,s)=>{const a=nh(i,s),f=await this.core.crypto.encode(n,a),h=await this.core.history.get(n,i),u=lf[h.request.method]?lf[h.request.method].res:lf.unregistered_method.res;await this.core.relayer.publish(n,f,u),await this.core.history.resolve(a)},this.deletePairing=async(i,n)=>{await this.core.relayer.unsubscribe(i),await Promise.all([this.pairings.delete(i,Gt("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(i),n?Promise.resolve():this.core.expirer.del(i)])},this.cleanup=async()=>{const i=this.pairings.getAll().filter(n=>Ys(n.expiry));await Promise.all(i.map(n=>this.deletePairing(n.topic)))},this.onRelayEventRequest=i=>{const{topic:n,payload:s}=i;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(n,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(n,s);default:return this.onUnknownRpcMethodRequest(n,s)}},this.onRelayEventResponse=async i=>{const{topic:n,payload:s}=i,a=(await this.core.history.get(n,s.id)).request.method;switch(a){case"wc_pairingPing":return this.onPairingPingResponse(n,s);default:return this.onUnknownRpcMethodResponse(a)}},this.onPairingPingRequest=async(i,n)=>{const{id:s}=n;try{this.isValidPing({topic:i}),await this.sendResult(s,i,!0),this.events.emit(qo.ping,{id:s,topic:i})}catch(a){await this.sendError(s,i,a),this.logger.error(a)}},this.onPairingPingResponse=(i,n)=>{const{id:s}=n;setTimeout(()=>{es(n)?this.events.emit(Dt("pairing_ping",s),{}):rn(n)&&this.events.emit(Dt("pairing_ping",s),{error:n.error})},500)},this.onPairingDeleteRequest=async(i,n)=>{const{id:s}=n;try{this.isValidDisconnect({topic:i}),await this.deletePairing(i),this.events.emit(qo.delete,{id:s,topic:i})}catch(a){await this.sendError(s,i,a),this.logger.error(a)}},this.onUnknownRpcMethodRequest=async(i,n)=>{const{id:s,method:a}=n;try{if(this.registeredMethods.includes(a))return;const f=Gt("WC_METHOD_UNSUPPORTED",a);await this.sendError(s,i,f),this.logger.error(f)}catch(f){await this.sendError(s,i,f),this.logger.error(f)}},this.onUnknownRpcMethodResponse=i=>{this.registeredMethods.includes(i)||this.logger.error(Gt("WC_METHOD_UNSUPPORTED",i))},this.isValidPair=(i,n)=>{var s;if(!bi(i)){const{message:f}=xe("MISSING_OR_INVALID",`pair() params: ${i}`);throw n.setError(Ss.malformed_pairing_uri),new Error(f)}if(!hE(i.uri)){const{message:f}=xe("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw n.setError(Ss.malformed_pairing_uri),new Error(f)}const a=vb(i?.uri);if(!((s=a?.relay)!=null&&s.protocol)){const{message:f}=xe("MISSING_OR_INVALID","pair() uri#relay-protocol");throw n.setError(Ss.malformed_pairing_uri),new Error(f)}if(!(a!=null&&a.symKey)){const{message:f}=xe("MISSING_OR_INVALID","pair() uri#symKey");throw n.setError(Ss.malformed_pairing_uri),new Error(f)}if(a!=null&&a.expiryTimestamp&&_e.toMiliseconds(a?.expiryTimestamp)<Date.now()){n.setError(Ss.pairing_expired);const{message:f}=xe("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(f)}},this.isValidPing=async i=>{if(!bi(i)){const{message:s}=xe("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(s)}const{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidDisconnect=async i=>{if(!bi(i)){const{message:s}=xe("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(s)}const{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidPairingTopic=async i=>{if(!wr(i,!1)){const{message:n}=xe("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(n)}if(!this.pairings.keys.includes(i)){const{message:n}=xe("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(n)}if(Ys(this.pairings.get(i).expiry)){await this.deletePairing(i);const{message:n}=xe("EXPIRED",`pairing topic: ${i}`);throw new Error(n)}},this.core=e,this.logger=ci(t,this.name),this.pairings=new ko(this.core,this.logger,this.name,this.storagePrefix)}get context(){return yi(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Lr.message,async e=>{const{topic:t,message:i,transportType:n}=e;if(!this.pairings.keys.includes(t)||n===sr.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))return;const s=await this.core.crypto.decode(t,i);try{b0(s)?(this.core.history.set(t,s),this.onRelayEventRequest({topic:t,payload:s})):sh(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:t,payload:s}),this.core.history.delete(t,s.id))}catch(a){this.logger.error(a)}})}registerExpirerEvents(){this.core.expirer.on(on.expired,async e=>{const{topic:t}=Gm(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(qo.expire,{topic:t}))})}}class AP extends jS{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new zr.exports.EventEmitter,this.name=mM,this.version=bM,this.cached=[],this.initialized=!1,this.storagePrefix=ts,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.records.set(i.id,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(i,n,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:i,request:n,chainId:s}),this.records.has(n.id))return;const a={id:n.id,topic:i,request:{method:n.method,params:n.params||null},chainId:s,expiry:Ir(_e.THIRTY_DAYS)};this.records.set(a.id,a),this.persist(),this.events.emit(Sn.created,a)},this.resolve=async i=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:i}),!this.records.has(i.id))return;const n=await this.getRecord(i.id);typeof n.response>"u"&&(n.response=rn(i)?{error:i.error}:{result:i.result},this.records.set(n.id,n),this.persist(),this.events.emit(Sn.updated,n))},this.get=async(i,n)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:i,id:n}),await this.getRecord(n)),this.delete=(i,n)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:n}),this.values.forEach(s=>{if(s.topic===i){if(typeof n<"u"&&s.id!==n)return;this.records.delete(s.id),this.events.emit(Sn.deleted,s)}}),this.persist()},this.exists=async(i,n)=>(this.isInitialized(),this.records.has(n)?(await this.getRecord(n)).topic===i:!1),this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=ci(t,this.name)}get context(){return yi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(t=>{if(typeof t.response<"u")return;const i={topic:t.topic,request:Qs(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(i)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const t=this.records.get(e);if(!t){const{message:i}=xe("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Sn.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:t}=xe("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Sn.created,e=>{const t=Sn.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(Sn.updated,e=>{const t=Sn.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(Sn.deleted,e=>{const t=Sn.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.core.heartbeat.on(Ha.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(t=>{_e.toMiliseconds(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.records.delete(t.id),this.events.emit(Sn.deleted,t,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}}class EP extends JS{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new zr.exports.EventEmitter,this.name=wM,this.version=yM,this.cached=[],this.initialized=!1,this.storagePrefix=ts,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.expirations.set(i.target,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=i=>{try{const n=this.formatTarget(i);return typeof this.getExpiration(n)<"u"}catch{return!1}},this.set=(i,n)=>{this.isInitialized();const s=this.formatTarget(i),a={target:s,expiry:n};this.expirations.set(s,a),this.checkExpiry(s,a),this.events.emit(on.created,{target:s,expiration:a})},this.get=i=>{this.isInitialized();const n=this.formatTarget(i);return this.getExpiration(n)},this.del=i=>{if(this.isInitialized(),this.has(i)){const n=this.formatTarget(i),s=this.getExpiration(n);this.expirations.delete(n),this.events.emit(on.deleted,{target:n,expiration:s})}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=ci(t,this.name)}get context(){return yi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return nA(e);if(typeof e=="number")return sA(e);const{message:t}=xe("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(on.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:t}=xe("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:i}=xe("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(i),new Error(i)}return t}checkExpiry(e,t){const{expiry:i}=t;_e.toMiliseconds(i)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(on.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(Ha.pulse,()=>this.checkExpirations()),this.events.on(on.created,e=>{const t=on.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(on.expired,e=>{const t=on.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(on.deleted,e=>{const t=on.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}}class SP extends QS{constructor(e,t,i){super(e,t,i),this.core=e,this.logger=t,this.store=i,this.name=_M,this.verifyUrlV3=AM,this.storagePrefix=ts,this.version=s2,this.init=async()=>{var n;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&_e.toMiliseconds((n=this.publicKey)==null?void 0:n.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))},this.register=async n=>{if(!Wc()||this.isDevEnv)return;const s=window.location.origin,{id:a,decryptedId:f}=n,h=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${a}&decryptedId=${f}`;try{const u=Oc(),g=this.startAbortTimer(_e.ONE_SECOND*5),w=await new Promise((M,C)=>{const O=()=>{window.removeEventListener("message",j),u.body.removeChild(N),C("attestation aborted")};this.abortController.signal.addEventListener("abort",O);const N=u.createElement("iframe");N.src=h,N.style.display="none",N.addEventListener("error",O,{signal:this.abortController.signal});const j=H=>{if(H.data&&typeof H.data=="string")try{const F=JSON.parse(H.data);if(F.type==="verify_attestation"){if(Jd(F.attestation).payload.id!==a)return;clearInterval(g),u.body.removeChild(N),this.abortController.signal.removeEventListener("abort",O),window.removeEventListener("message",j),M(F.attestation===null?"":F.attestation)}}catch(F){this.logger.warn(F)}};u.body.appendChild(N),window.addEventListener("message",j,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",w),w}catch(u){this.logger.warn(u)}return""},this.resolve=async n=>{if(this.isDevEnv)return"";const{attestationId:s,hash:a,encryptedId:f}=n;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(Jd(s).payload.id!==f)return;const u=await this.isValidJwtAttestation(s);if(u){if(!u.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return u}}if(!a)return;const h=this.getVerifyUrl(n?.verifyUrl);return this.fetchAttestation(a,h)},this.fetchAttestation=async(n,s)=>{this.logger.debug(`resolving attestation: ${n} from url: ${s}`);const a=this.startAbortTimer(_e.ONE_SECOND*5),f=await fetch(`${s}/attestation/${n}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(a),f.status===200?await f.json():void 0},this.getVerifyUrl=n=>{let s=n||hf;return EM.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${hf}`),s=hf),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const n=this.startAbortTimer(_e.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(n),await s.json()}catch(n){this.logger.warn(n)}},this.persistPublicKey=async n=>{this.logger.debug("persisting public key to local storage",n),await this.store.setItem(this.storeKey,n),this.publicKey=n},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async n=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(n,s)}catch(f){this.logger.error(f),this.logger.warn("error validating attestation")}const a=await this.fetchAndPersistPublicKey();try{if(a)return this.validateAttestation(n,a)}catch(f){this.logger.error(f),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const a=await this.fetchPublicKey();a&&(await this.persistPublicKey(a),s(a))});const n=await this.fetchPromise;return this.fetchPromise=void 0,n},this.validateAttestation=(n,s)=>{const a=KA(n,s.publicKey),f={hasExpired:_e.toMiliseconds(a.exp)<Date.now(),payload:a};if(f.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:f.payload.origin,isScam:f.payload.isScam,isVerified:f.payload.isVerified}},this.logger=ci(t,this.name),this.abortController=new AbortController,this.isDevEnv=Qd(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return yi(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),_e.toMiliseconds(e))}}class IP extends ZS{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.context=SM,this.registerDeviceToken=async i=>{const{clientId:n,token:s,notificationType:a,enableEncrypted:f=!1}=i,h=`${IM}/${this.projectId}/clients`;await fetch(h,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:n,type:a,token:s,always_raw:f})})},this.logger=ci(t,this.context)}}var MP=Object.defineProperty,q2=Object.getOwnPropertySymbols,CP=Object.prototype.hasOwnProperty,PP=Object.prototype.propertyIsEnumerable,z2=(r,e,t)=>e in r?MP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,gf=(r,e)=>{for(var t in e||(e={}))CP.call(e,t)&&z2(r,t,e[t]);if(q2)for(var t of q2(e))PP.call(e,t)&&z2(r,t,e[t]);return r};class DP extends XS{constructor(e,t,i=!0){super(e,t,i),this.core=e,this.logger=t,this.context=CM,this.storagePrefix=ts,this.storageVersion=MM,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!Qd())try{const n={eventId:Jm(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:jm(this.core.relayer.protocol,this.core.relayer.version,y0)}}};await this.sendEvent([n])}catch(n){this.logger.warn(n)}},this.createEvent=n=>{const{event:s="ERROR",type:a="",properties:{topic:f,trace:h}}=n,u=Jm(),g=this.core.projectId||"",w=Date.now(),M=gf({eventId:u,timestamp:w,props:{event:s,type:a,properties:{topic:f,trace:h}},bundleId:g,domain:this.getAppDomain()},this.setMethods(u));return this.telemetryEnabled&&(this.events.set(u,M),this.shouldPersist=!0),M},this.getEvent=n=>{const{eventId:s,topic:a}=n;if(s)return this.events.get(s);const f=Array.from(this.events.values()).find(h=>h.props.properties.topic===a);if(f)return gf(gf({},f),this.setMethods(f.eventId))},this.deleteEvent=n=>{const{eventId:s}=n;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(Ha.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(n=>{_e.fromMiliseconds(Date.now())-_e.fromMiliseconds(n.timestamp)>PM&&(this.events.delete(n.eventId),this.shouldPersist=!0)})})},this.setMethods=n=>({addTrace:s=>this.addTrace(n,s),setError:s=>this.setError(n,s)}),this.addTrace=(n,s)=>{const a=this.events.get(n);a&&(a.props.properties.trace.push(s),this.events.set(n,a),this.shouldPersist=!0)},this.setError=(n,s)=>{const a=this.events.get(n);a&&(a.props.type=s,a.timestamp=Date.now(),this.events.set(n,a),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const n=await this.core.storage.getItem(this.storageKey)||[];if(!n.length)return;n.forEach(s=>{this.events.set(s.eventId,gf(gf({},s),this.setMethods(s.eventId)))})}catch(n){this.logger.warn(n)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const n=[];for(const[s,a]of this.events)a.props.type&&n.push(a);if(n.length!==0)try{if((await this.sendEvent(n)).ok)for(const s of n)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async n=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${DM}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${y0}${s}`,{method:"POST",body:JSON.stringify(n)})},this.getAppDomain=()=>km().url,this.logger=ci(t,this.context),this.telemetryEnabled=i,i?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var OP=Object.defineProperty,H2=Object.getOwnPropertySymbols,RP=Object.prototype.hasOwnProperty,TP=Object.prototype.propertyIsEnumerable,k2=(r,e,t)=>e in r?OP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,j2=(r,e)=>{for(var t in e||(e={}))RP.call(e,t)&&k2(r,t,e[t]);if(H2)for(var t of H2(e))TP.call(e,t)&&k2(r,t,e[t]);return r};class S0 extends kS{constructor(e){var t;super(e),this.protocol=n2,this.version=s2,this.name=oh,this.events=new zr.exports.EventEmitter,this.initialized=!1,this.on=(a,f)=>this.events.on(a,f),this.once=(a,f)=>this.events.once(a,f),this.off=(a,f)=>this.events.off(a,f),this.removeListener=(a,f)=>this.events.removeListener(a,f),this.dispatchEnvelope=({topic:a,message:f,sessionExists:h})=>{if(!a||!f)return;const u={topic:a,message:f,publishedAt:Date.now(),transportType:sr.link_mode};this.relayer.onLinkMessageEvent(u,{sessionExists:h})},this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||f2,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const i=rh({level:typeof e?.logger=="string"&&e.logger?e.logger:QI.logger,name:oh}),{logger:n,chunkLoggerController:s}=HS({opts:i,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=s,(t=this.logChunkController)!=null&&t.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var a,f;(a=this.logChunkController)!=null&&a.downloadLogsBlobInBrowser&&((f=this.logChunkController)==null||f.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ci(n,this.name),this.heartbeat=new o0,this.crypto=new eP(this,this.logger,e?.keychain),this.history=new AP(this,this.logger),this.expirer=new EP(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new pS(j2(j2({},ZI),e?.storageOptions)),this.relayer=new bP({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new xP(this,this.logger),this.verify=new SP(this,this.logger,this.storage),this.echoClient=new IP(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new DP(this,this.logger,e?.telemetryEnabled)}static async init(e){const t=new S0(e);await t.initialize();const i=await t.crypto.getClientId();return await t.storage.setItem(hM,i),t}get context(){return yi(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(l2,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(l2)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const NP=S0,W2="wc",K2=2,V2="client",I0=`${W2}@${K2}:${V2}:`,M0={name:V2,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.org"},G2="WALLETCONNECT_DEEPLINK_CHOICE",$P="proposal",Y2="Proposal expired",LP="session",Wa=_e.SEVEN_DAYS,BP="engine",Br={wc_sessionPropose:{req:{ttl:_e.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:1104},res:{ttl:_e.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:1106},res:{ttl:_e.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:_e.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:_e.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:1112},res:{ttl:_e.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:1114},res:{ttl:_e.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:_e.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:_e.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1119}}},C0={min:_e.FIVE_MINUTES,max:_e.SEVEN_DAYS},is={idle:"IDLE",active:"ACTIVE"},FP="request",UP=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],qP="wc",zP="auth",HP="authKeys",kP="pairingTopics",jP="requests",ch=`${qP}@${1.5}:${zP}:`,fh=`${ch}:PUB_KEY`;var WP=Object.defineProperty,KP=Object.defineProperties,VP=Object.getOwnPropertyDescriptors,J2=Object.getOwnPropertySymbols,GP=Object.prototype.hasOwnProperty,YP=Object.prototype.propertyIsEnumerable,Q2=(r,e,t)=>e in r?WP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pr=(r,e)=>{for(var t in e||(e={}))GP.call(e,t)&&Q2(r,t,e[t]);if(J2)for(var t of J2(e))YP.call(e,t)&&Q2(r,t,e[t]);return r},Mn=(r,e)=>KP(r,VP(e));class JP extends tI{constructor(e){super(e),this.name=BP,this.events=new zr.exports,this.initialized=!1,this.requestQueue={state:is.idle,queue:[]},this.sessionRequestQueue={state:is.idle,queue:[]},this.requestQueueDelay=_e.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(Br)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},_e.toMiliseconds(this.requestQueueDelay)))},this.connect=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const i=Mn(pr({},t),{requiredNamespaces:t.requiredNamespaces||{},optionalNamespaces:t.optionalNamespaces||{}});await this.isValidConnect(i);const{pairingTopic:n,requiredNamespaces:s,optionalNamespaces:a,sessionProperties:f,relays:h}=i;let u=n,g,w=!1;try{u&&(w=this.client.core.pairing.pairings.get(u).active)}catch(B){throw this.client.logger.error(`connect() -> pairing.get(${u}) failed`),B}if(!u||!w){const{topic:B,uri:z}=await this.client.core.pairing.create();u=B,g=z}if(!u){const{message:B}=xe("NO_MATCHING_KEY",`connect() pairing topic: ${u}`);throw new Error(B)}const M=await this.client.core.crypto.generateKeyPair(),C=Br.wc_sessionPropose.req.ttl||_e.FIVE_MINUTES,O=Ir(C),N=pr({requiredNamespaces:s,optionalNamespaces:a,relays:h??[{protocol:c2}],proposer:{publicKey:M,metadata:this.client.metadata},expiryTimestamp:O,pairingTopic:u},f&&{sessionProperties:f}),{reject:j,resolve:H,done:F}=No(C,Y2);this.events.once(Dt("session_connect"),async({error:B,session:z})=>{if(B)j(B);else if(z){z.self.publicKey=M;const W=Mn(pr({},z),{pairingTopic:N.pairingTopic,requiredNamespaces:N.requiredNamespaces,optionalNamespaces:N.optionalNamespaces,transportType:sr.relay});await this.client.session.set(z.topic,W),await this.setExpiry(z.topic,z.expiry),u&&await this.client.core.pairing.updateMetadata({topic:u,metadata:z.peer.metadata}),this.cleanupDuplicatePairings(W),H(W)}});const G=await this.sendRequest({topic:u,method:"wc_sessionPropose",params:N,throwOnFailedPublish:!0});return await this.setProposal(G,pr({id:G},N)),{uri:g,approval:F}},this.pair=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(t)}catch(i){throw this.client.logger.error("pair() failed"),i}},this.approve=async t=>{var i,n,s;const a=this.client.core.eventClient.createEvent({properties:{topic:(i=t?.id)==null?void 0:i.toString(),trace:[In.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(U){throw a.setError(zo.no_internet_connection),U}try{await this.isValidProposalId(t?.id)}catch(U){throw this.client.logger.error(`approve() -> proposal.get(${t?.id}) failed`),a.setError(zo.proposal_not_found),U}try{await this.isValidApprove(t)}catch(U){throw this.client.logger.error("approve() -> isValidApprove() failed"),a.setError(zo.session_approve_namespace_validation_failure),U}const{id:f,relayProtocol:h,namespaces:u,sessionProperties:g,sessionConfig:w}=t,M=this.client.proposal.get(f);this.client.core.eventClient.deleteEvent({eventId:a.eventId});const{pairingTopic:C,proposer:O,requiredNamespaces:N,optionalNamespaces:j}=M;let H=(n=this.client.core.eventClient)==null?void 0:n.getEvent({topic:C});H||(H=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:In.session_approve_started,properties:{topic:C,trace:[In.session_approve_started,In.session_namespaces_validation_success]}}));const F=await this.client.core.crypto.generateKeyPair(),G=O.publicKey,B=await this.client.core.crypto.generateSharedKey(F,G),z=pr(pr({relay:{protocol:h??"irn"},namespaces:u,controller:{publicKey:F,metadata:this.client.metadata},expiry:Ir(Wa)},g&&{sessionProperties:g}),w&&{sessionConfig:w}),W=sr.relay;H.addTrace(In.subscribing_session_topic);try{await this.client.core.relayer.subscribe(B,{transportType:W})}catch(U){throw H.setError(zo.subscribe_session_topic_failure),U}H.addTrace(In.subscribe_session_topic_success);const _=Mn(pr({},z),{topic:B,requiredNamespaces:N,optionalNamespaces:j,pairingTopic:C,acknowledged:!1,self:z.controller,peer:{publicKey:O.publicKey,metadata:O.metadata},controller:F,transportType:sr.relay});await this.client.session.set(B,_),H.addTrace(In.store_session);try{H.addTrace(In.publishing_session_settle),await this.sendRequest({topic:B,method:"wc_sessionSettle",params:z,throwOnFailedPublish:!0}).catch(U=>{throw H?.setError(zo.session_settle_publish_failure),U}),H.addTrace(In.session_settle_publish_success),H.addTrace(In.publishing_session_approve),await this.sendResult({id:f,topic:C,result:{relay:{protocol:h??"irn"},responderPublicKey:F},throwOnFailedPublish:!0}).catch(U=>{throw H?.setError(zo.session_approve_publish_failure),U}),H.addTrace(In.session_approve_publish_success)}catch(U){throw this.client.logger.error(U),this.client.session.delete(B,Gt("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(B),U}return this.client.core.eventClient.deleteEvent({eventId:H.eventId}),await this.client.core.pairing.updateMetadata({topic:C,metadata:O.metadata}),await this.client.proposal.delete(f,Gt("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:C}),await this.setExpiry(B,Ir(Wa)),{topic:B,acknowledged:()=>Promise.resolve(this.client.session.get(B))}},this.reject=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(t)}catch(a){throw this.client.logger.error("reject() -> isValidReject() failed"),a}const{id:i,reason:n}=t;let s;try{s=this.client.proposal.get(i).pairingTopic}catch(a){throw this.client.logger.error(`reject() -> proposal.get(${i}) failed`),a}s&&(await this.sendError({id:i,topic:s,error:n,rpcOpts:Br.wc_sessionPropose.reject}),await this.client.proposal.delete(i,Gt("USER_DISCONNECTED")))},this.update=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(t)}catch(w){throw this.client.logger.error("update() -> isValidUpdate() failed"),w}const{topic:i,namespaces:n}=t,{done:s,resolve:a,reject:f}=No(),h=Es(),u=Uo().toString(),g=this.client.session.get(i).namespaces;return this.events.once(Dt("session_update",h),({error:w})=>{w?f(w):a()}),await this.client.session.update(i,{namespaces:n}),await this.sendRequest({topic:i,method:"wc_sessionUpdate",params:{namespaces:n},throwOnFailedPublish:!0,clientRpcId:h,relayRpcId:u}).catch(w=>{this.client.logger.error(w),this.client.session.update(i,{namespaces:g}),f(w)}),{acknowledged:s}},this.extend=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(t)}catch(h){throw this.client.logger.error("extend() -> isValidExtend() failed"),h}const{topic:i}=t,n=Es(),{done:s,resolve:a,reject:f}=No();return this.events.once(Dt("session_extend",n),({error:h})=>{h?f(h):a()}),await this.setExpiry(i,Ir(Wa)),this.sendRequest({topic:i,method:"wc_sessionExtend",params:{},clientRpcId:n,throwOnFailedPublish:!0}).catch(h=>{f(h)}),{acknowledged:s}},this.request=async t=>{this.isInitialized();try{await this.isValidRequest(t)}catch(O){throw this.client.logger.error("request() -> isValidRequest() failed"),O}const{chainId:i,request:n,topic:s,expiry:a=Br.wc_sessionRequest.req.ttl}=t,f=this.client.session.get(s);f?.transportType===sr.relay&&await this.confirmOnlineStateOrThrow();const h=Es(),u=Uo().toString(),{done:g,resolve:w,reject:M}=No(a,"Request expired. Please try again.");this.events.once(Dt("session_request",h),({error:O,result:N})=>{O?M(O):w(N)});const C=this.getAppLinkIfEnabled(f.peer.metadata,f.transportType);return C?(await this.sendRequest({clientRpcId:h,relayRpcId:u,topic:s,method:"wc_sessionRequest",params:{request:Mn(pr({},n),{expiryTimestamp:Ir(a)}),chainId:i},expiry:a,throwOnFailedPublish:!0,appLink:C}).catch(O=>M(O)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:i,id:h}),await g()):await Promise.all([new Promise(async O=>{await this.sendRequest({clientRpcId:h,relayRpcId:u,topic:s,method:"wc_sessionRequest",params:{request:Mn(pr({},n),{expiryTimestamp:Ir(a)}),chainId:i},expiry:a,throwOnFailedPublish:!0}).catch(N=>M(N)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:i,id:h}),O()}),new Promise(async O=>{var N;if(!((N=f.sessionConfig)!=null&&N.disableDeepLink)){const j=await cA(this.client.core.storage,G2);await oA({id:h,topic:s,wcDeepLink:j})}O()}),g()]).then(O=>O[2])},this.respond=async t=>{this.isInitialized(),await this.isValidRespond(t);const{topic:i,response:n}=t,{id:s}=n,a=this.client.session.get(i);a.transportType===sr.relay&&await this.confirmOnlineStateOrThrow();const f=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);es(n)?await this.sendResult({id:s,topic:i,result:n.result,throwOnFailedPublish:!0,appLink:f}):rn(n)&&await this.sendError({id:s,topic:i,error:n.error,appLink:f}),this.cleanupAfterResponse(t)},this.ping=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(t)}catch(n){throw this.client.logger.error("ping() -> isValidPing() failed"),n}const{topic:i}=t;if(this.client.session.keys.includes(i)){const n=Es(),s=Uo().toString(),{done:a,resolve:f,reject:h}=No();this.events.once(Dt("session_ping",n),({error:u})=>{u?h(u):f()}),await Promise.all([this.sendRequest({topic:i,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:n,relayRpcId:s}),a()])}else this.client.core.pairing.pairings.keys.includes(i)&&await this.client.core.pairing.ping({topic:i})},this.emit=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(t);const{topic:i,event:n,chainId:s}=t,a=Uo().toString(),f=Es();await this.sendRequest({topic:i,method:"wc_sessionEvent",params:{event:n,chainId:s},throwOnFailedPublish:!0,relayRpcId:a,clientRpcId:f})},this.disconnect=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(t);const{topic:i}=t;if(this.client.session.keys.includes(i))await this.sendRequest({topic:i,method:"wc_sessionDelete",params:Gt("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:i,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(i))await this.client.core.pairing.disconnect({topic:i});else{const{message:n}=xe("MISMATCHED_TOPIC",`Session or pairing topic not found: ${i}`);throw new Error(n)}},this.find=t=>(this.isInitialized(),this.client.session.getAll().filter(i=>fE(i,t))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(t,i)=>{var n;this.isInitialized(),this.isValidAuthenticate(t);const s=i&&this.client.core.linkModeSupportedApps.includes(i)&&((n=this.client.metadata.redirect)==null?void 0:n.linkMode),a=s?sr.link_mode:sr.relay;a===sr.relay&&await this.confirmOnlineStateOrThrow();const{chains:f,statement:h="",uri:u,domain:g,nonce:w,type:M,exp:C,nbf:O,methods:N=[],expiry:j}=t,H=[...t.resources||[]],{topic:F,uri:G}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:a});this.client.logger.info({message:"Generated new pairing",pairing:{topic:F,uri:G}});const B=await this.client.core.crypto.generateKeyPair(),z=jl(B);if(await Promise.all([this.client.auth.authKeys.set(fh,{responseTopic:z,publicKey:B}),this.client.auth.pairingTopics.set(z,{topic:z,pairingTopic:F})]),await this.client.core.relayer.subscribe(z,{transportType:a}),this.client.logger.info(`sending request to new pairing topic: ${F}`),N.length>0){const{namespace:D}=qa(f[0]);let S=DA(D,"request",N);kl(H)&&(S=RA(S,H.pop())),H.push(S)}const W=j&&j>Br.wc_sessionAuthenticate.req.ttl?j:Br.wc_sessionAuthenticate.req.ttl,_={authPayload:{type:M??"caip122",chains:f,statement:h,aud:u,domain:g,version:"1",nonce:w,iat:new Date().toISOString(),exp:C,nbf:O,resources:H},requester:{publicKey:B,metadata:this.client.metadata},expiryTimestamp:Ir(W)},U={eip155:{chains:f,methods:[...new Set(["personal_sign",...N])],events:["chainChanged","accountsChanged"]}},ee={requiredNamespaces:{},optionalNamespaces:U,relays:[{protocol:"irn"}],pairingTopic:F,proposer:{publicKey:B,metadata:this.client.metadata},expiryTimestamp:Ir(Br.wc_sessionPropose.req.ttl)},{done:oe,resolve:L,reject:b}=No(W,"Request expired"),m=async({error:D,session:S})=>{if(this.events.off(Dt("session_request",d),l),D)b(D);else if(S){S.self.publicKey=B,await this.client.session.set(S.topic,S),await this.setExpiry(S.topic,S.expiry),F&&await this.client.core.pairing.updateMetadata({topic:F,metadata:S.peer.metadata});const v=this.client.session.get(S.topic);await this.deleteProposal(y),L({session:v})}},l=async D=>{var S,v,A;if(await this.deletePendingAuthRequest(d,{message:"fulfilled",code:0}),D.error){const J=Gt("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return D.error.code===J.code?void 0:(this.events.off(Dt("session_connect"),m),b(D.error.message))}await this.deleteProposal(y),this.events.off(Dt("session_connect"),m);const{cacaos:x,responder:$}=D.result,ae=[],R=[];for(const J of x){await eb({cacao:J,projectId:this.client.core.projectId})||(this.client.logger.error(J,"Signature verification failed"),b(Gt("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:K}=J,E=kl(K.resources),Y=[Xd(K.iss)],re=Hl(K.iss);if(E){const le=ib(E),he=nb(E);ae.push(...le),Y.push(...he)}for(const le of Y)R.push(`${le}:${re}`)}const X=await this.client.core.crypto.generateSharedKey(B,$.publicKey);let V;ae.length>0&&(V={topic:X,acknowledged:!0,self:{publicKey:B,metadata:this.client.metadata},peer:$,controller:$.publicKey,expiry:Ir(Wa),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:F,namespaces:bb([...new Set(ae)],[...new Set(R)]),transportType:a},await this.client.core.relayer.subscribe(X,{transportType:a}),await this.client.session.set(X,V),F&&await this.client.core.pairing.updateMetadata({topic:F,metadata:$.metadata}),V=this.client.session.get(X)),(S=this.client.metadata.redirect)!=null&&S.linkMode&&(v=$.metadata.redirect)!=null&&v.linkMode&&(A=$.metadata.redirect)!=null&&A.universal&&i&&(this.client.core.addLinkModeSupportedApp($.metadata.redirect.universal),this.client.session.update(X,{transportType:sr.link_mode})),L({auths:x,session:V})},d=Es(),y=Es();this.events.once(Dt("session_connect"),m),this.events.once(Dt("session_request",d),l);let P;try{if(s){const D=Qs("wc_sessionAuthenticate",_,d);this.client.core.history.set(F,D);const S=await this.client.core.crypto.encode("",D,{type:Jc,encoding:Gc});P=Kl(i,F,S)}else await Promise.all([this.sendRequest({topic:F,method:"wc_sessionAuthenticate",params:_,expiry:t.expiry,throwOnFailedPublish:!0,clientRpcId:d}),this.sendRequest({topic:F,method:"wc_sessionPropose",params:ee,expiry:Br.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:y})])}catch(D){throw this.events.off(Dt("session_connect"),m),this.events.off(Dt("session_request",d),l),D}return await this.setProposal(y,pr({id:y},ee)),await this.setAuthRequest(d,{request:Mn(pr({},_),{verifyContext:{}}),pairingTopic:F,transportType:a}),{uri:P??G,response:oe}},this.approveSessionAuthenticate=async t=>{const{id:i,auths:n}=t,s=this.client.core.eventClient.createEvent({properties:{topic:i.toString(),trace:[Ho.authenticated_session_approve_started]}});try{this.isInitialized()}catch(j){throw s.setError(uf.no_internet_connection),j}const a=this.getPendingAuthRequest(i);if(!a)throw s.setError(uf.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${i}`);const f=a.transportType||sr.relay;f===sr.relay&&await this.confirmOnlineStateOrThrow();const h=a.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),g=jl(h),w={type:ws,receiverPublicKey:h,senderPublicKey:u},M=[],C=[];for(const j of n){if(!await eb({cacao:j,projectId:this.client.core.projectId})){s.setError(uf.invalid_cacao);const z=Gt("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:i,topic:g,error:z,encodeOpts:w}),new Error(z.message)}s.addTrace(Ho.cacaos_verified);const{p:H}=j,F=kl(H.resources),G=[Xd(H.iss)],B=Hl(H.iss);if(F){const z=ib(F),W=nb(F);M.push(...z),G.push(...W)}for(const z of G)C.push(`${z}:${B}`)}const O=await this.client.core.crypto.generateSharedKey(u,h);s.addTrace(Ho.create_authenticated_session_topic);let N;if(M?.length>0){N={topic:O,acknowledged:!0,self:{publicKey:u,metadata:this.client.metadata},peer:{publicKey:h,metadata:a.requester.metadata},controller:h,expiry:Ir(Wa),authentication:n,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:a.pairingTopic,namespaces:bb([...new Set(M)],[...new Set(C)]),transportType:f},s.addTrace(Ho.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(O,{transportType:f})}catch(j){throw s.setError(uf.subscribe_authenticated_session_topic_failure),j}s.addTrace(Ho.subscribe_authenticated_session_topic_success),await this.client.session.set(O,N),s.addTrace(Ho.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:a.pairingTopic,metadata:a.requester.metadata})}s.addTrace(Ho.publishing_authenticated_session_approve);try{await this.sendResult({topic:g,id:i,result:{cacaos:n,responder:{publicKey:u,metadata:this.client.metadata}},encodeOpts:w,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(a.requester.metadata,f)})}catch(j){throw s.setError(uf.authenticated_session_approve_publish_failure),j}return await this.client.auth.requests.delete(i,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:a.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:N}},this.rejectSessionAuthenticate=async t=>{this.isInitialized();const{id:i,reason:n}=t,s=this.getPendingAuthRequest(i);if(!s)throw new Error(`Could not find pending auth request with id ${i}`);s.transportType===sr.relay&&await this.confirmOnlineStateOrThrow();const a=s.requester.publicKey,f=await this.client.core.crypto.generateKeyPair(),h=jl(a),u={type:ws,receiverPublicKey:a,senderPublicKey:f};await this.sendError({id:i,topic:h,error:n,encodeOpts:u,rpcOpts:Br.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(i,{message:"rejected",code:0}),await this.client.proposal.delete(i,Gt("USER_DISCONNECTED"))},this.formatAuthMessage=t=>{this.isInitialized();const{request:i,iss:n}=t;return tb(i,n)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const t=this.relayMessageCache.shift();t&&await this.onRelayMessage(t)}catch(t){this.client.logger.error(t)}},50)},this.cleanupDuplicatePairings=async t=>{if(t.pairingTopic)try{const i=this.client.core.pairing.pairings.get(t.pairingTopic),n=this.client.core.pairing.pairings.getAll().filter(s=>{var a,f;return((a=s.peerMetadata)==null?void 0:a.url)&&((f=s.peerMetadata)==null?void 0:f.url)===t.peer.metadata.url&&s.topic&&s.topic!==i.topic});if(n.length===0)return;this.client.logger.info(`Cleaning up ${n.length} duplicate pairing(s)`),await Promise.all(n.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(i){this.client.logger.error(i)}},this.deleteSession=async t=>{var i;const{topic:n,expirerHasDeleted:s=!1,emitEvent:a=!0,id:f=0}=t,{self:h}=this.client.session.get(n);await this.client.core.relayer.unsubscribe(n),await this.client.session.delete(n,Gt("USER_DISCONNECTED")),this.addToRecentlyDeleted(n,"session"),this.client.core.crypto.keychain.has(h.publicKey)&&await this.client.core.crypto.deleteKeyPair(h.publicKey),this.client.core.crypto.keychain.has(n)&&await this.client.core.crypto.deleteSymKey(n),s||this.client.core.expirer.del(n),this.client.core.storage.removeItem(G2).catch(u=>this.client.logger.warn(u)),this.getPendingSessionRequests().forEach(u=>{u.topic===n&&this.deletePendingSessionRequest(u.id,Gt("USER_DISCONNECTED"))}),n===((i=this.sessionRequestQueue.queue[0])==null?void 0:i.topic)&&(this.sessionRequestQueue.state=is.idle),a&&this.client.events.emit("session_delete",{id:f,topic:n})},this.deleteProposal=async(t,i)=>{if(i)try{const n=this.client.proposal.get(t),s=this.client.core.eventClient.getEvent({topic:n.pairingTopic});s?.setError(zo.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(t,Gt("USER_DISCONNECTED")),i?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"proposal")},this.deletePendingSessionRequest=async(t,i,n=!1)=>{await Promise.all([this.client.pendingRequest.delete(t,i),n?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==t),n&&(this.sessionRequestQueue.state=is.idle,this.client.events.emit("session_request_expire",{id:t}))},this.deletePendingAuthRequest=async(t,i,n=!1)=>{await Promise.all([this.client.auth.requests.delete(t,i),n?Promise.resolve():this.client.core.expirer.del(t)])},this.setExpiry=async(t,i)=>{this.client.session.keys.includes(t)&&(this.client.core.expirer.set(t,i),await this.client.session.update(t,{expiry:i}))},this.setProposal=async(t,i)=>{this.client.core.expirer.set(t,Ir(Br.wc_sessionPropose.req.ttl)),await this.client.proposal.set(t,i)},this.setAuthRequest=async(t,i)=>{const{request:n,pairingTopic:s,transportType:a=sr.relay}=i;this.client.core.expirer.set(t,n.expiryTimestamp),await this.client.auth.requests.set(t,{authPayload:n.authPayload,requester:n.requester,expiryTimestamp:n.expiryTimestamp,id:t,pairingTopic:s,verifyContext:n.verifyContext,transportType:a})},this.setPendingSessionRequest=async t=>{const{id:i,topic:n,params:s,verifyContext:a}=t,f=s.request.expiryTimestamp||Ir(Br.wc_sessionRequest.req.ttl);this.client.core.expirer.set(i,f),await this.client.pendingRequest.set(i,{id:i,topic:n,params:s,verifyContext:a})},this.sendRequest=async t=>{const{topic:i,method:n,params:s,expiry:a,relayRpcId:f,clientRpcId:h,throwOnFailedPublish:u,appLink:g}=t,w=Qs(n,s,h);let M;const C=!!g;try{const j=C?Gc:Js;M=await this.client.core.crypto.encode(i,w,{encoding:j})}catch(j){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${i} failed`),j}let O;if(UP.includes(n)){const j=ys(JSON.stringify(w)),H=ys(M);O=await this.client.core.verify.register({id:H,decryptedId:j})}const N=Br[n].req;if(N.attestation=O,a&&(N.ttl=a),f&&(N.id=f),this.client.core.history.set(i,w),C){const j=Kl(g,i,M);await global.Linking.openURL(j,this.client.name)}else{const j=Br[n].req;a&&(j.ttl=a),f&&(j.id=f),u?(j.internal=Mn(pr({},j.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,M,j)):this.client.core.relayer.publish(i,M,j).catch(H=>this.client.logger.error(H))}return w.id},this.sendResult=async t=>{const{id:i,topic:n,result:s,throwOnFailedPublish:a,encodeOpts:f,appLink:h}=t,u=ih(i,s);let g;const w=h&&typeof(global==null?void 0:global.Linking)<"u";try{const C=w?Gc:Js;g=await this.client.core.crypto.encode(n,u,Mn(pr({},f||{}),{encoding:C}))}catch(C){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${n} failed`),C}let M;try{M=await this.client.core.history.get(n,i)}catch(C){throw this.client.logger.error(`sendResult() -> history.get(${n}, ${i}) failed`),C}if(w){const C=Kl(h,n,g);await global.Linking.openURL(C,this.client.name)}else{const C=Br[M.request.method].res;a?(C.internal=Mn(pr({},C.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,g,C)):this.client.core.relayer.publish(n,g,C).catch(O=>this.client.logger.error(O))}await this.client.core.history.resolve(u)},this.sendError=async t=>{const{id:i,topic:n,error:s,encodeOpts:a,rpcOpts:f,appLink:h}=t,u=nh(i,s);let g;const w=h&&typeof(global==null?void 0:global.Linking)<"u";try{const C=w?Gc:Js;g=await this.client.core.crypto.encode(n,u,Mn(pr({},a||{}),{encoding:C}))}catch(C){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${n} failed`),C}let M;try{M=await this.client.core.history.get(n,i)}catch(C){throw this.client.logger.error(`sendError() -> history.get(${n}, ${i}) failed`),C}if(w){const C=Kl(h,n,g);await global.Linking.openURL(C,this.client.name)}else{const C=f||Br[M.request.method].res;this.client.core.relayer.publish(n,g,C)}await this.client.core.history.resolve(u)},this.cleanup=async()=>{const t=[],i=[];this.client.session.getAll().forEach(n=>{let s=!1;Ys(n.expiry)&&(s=!0),this.client.core.crypto.keychain.has(n.topic)||(s=!0),s&&t.push(n.topic)}),this.client.proposal.getAll().forEach(n=>{Ys(n.expiryTimestamp)&&i.push(n.id)}),await Promise.all([...t.map(n=>this.deleteSession({topic:n})),...i.map(n=>this.deleteProposal(n))])},this.onRelayEventRequest=async t=>{this.requestQueue.queue.push(t),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===is.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=is.active;const t=this.requestQueue.queue.shift();if(t)try{await this.processRequest(t)}catch(i){this.client.logger.warn(i)}}this.requestQueue.state=is.idle},this.processRequest=async t=>{const{topic:i,payload:n,attestation:s,transportType:a,encryptedId:f}=t,h=n.method;if(!this.shouldIgnorePairingRequest({topic:i,requestMethod:h}))switch(h){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:i,payload:n,attestation:s,encryptedId:f});case"wc_sessionSettle":return await this.onSessionSettleRequest(i,n);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(i,n);case"wc_sessionExtend":return await this.onSessionExtendRequest(i,n);case"wc_sessionPing":return await this.onSessionPingRequest(i,n);case"wc_sessionDelete":return await this.onSessionDeleteRequest(i,n);case"wc_sessionRequest":return await this.onSessionRequest({topic:i,payload:n,attestation:s,encryptedId:f,transportType:a});case"wc_sessionEvent":return await this.onSessionEventRequest(i,n);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:i,payload:n,attestation:s,encryptedId:f,transportType:a});default:return this.client.logger.info(`Unsupported request method ${h}`)}},this.onRelayEventResponse=async t=>{const{topic:i,payload:n,transportType:s}=t,a=(await this.client.core.history.get(i,n.id)).request.method;switch(a){case"wc_sessionPropose":return this.onSessionProposeResponse(i,n,s);case"wc_sessionSettle":return this.onSessionSettleResponse(i,n);case"wc_sessionUpdate":return this.onSessionUpdateResponse(i,n);case"wc_sessionExtend":return this.onSessionExtendResponse(i,n);case"wc_sessionPing":return this.onSessionPingResponse(i,n);case"wc_sessionRequest":return this.onSessionRequestResponse(i,n);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(i,n);default:return this.client.logger.info(`Unsupported response method ${a}`)}},this.onRelayEventUnknownPayload=t=>{const{topic:i}=t,{message:n}=xe("MISSING_OR_INVALID",`Decoded payload on topic ${i} is not identifiable as a JSON-RPC request or a response.`);throw new Error(n)},this.shouldIgnorePairingRequest=t=>{const{topic:i,requestMethod:n}=t,s=this.expectedPairingMethodMap.get(i);return!s||s.includes(n)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async t=>{const{topic:i,payload:n,attestation:s,encryptedId:a}=t,{params:f,id:h}=n;try{const u=this.client.core.eventClient.getEvent({topic:i});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),u?.setError(Ss.proposal_listener_not_found)),this.isValidConnect(pr({},n.params));const g=f.expiryTimestamp||Ir(Br.wc_sessionPropose.req.ttl),w=pr({id:h,pairingTopic:i,expiryTimestamp:g},f);await this.setProposal(h,w);const M=await this.getVerifyContext({attestationId:s,hash:ys(JSON.stringify(n)),encryptedId:a,metadata:w.proposer.metadata});u?.addTrace(rs.emit_session_proposal),this.client.events.emit("session_proposal",{id:h,params:w,verifyContext:M})}catch(u){await this.sendError({id:h,topic:i,error:u,rpcOpts:Br.wc_sessionPropose.autoReject}),this.client.logger.error(u)}},this.onSessionProposeResponse=async(t,i,n)=>{const{id:s}=i;if(es(i)){const{result:a}=i;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:a});const f=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:f});const h=f.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:h});const u=a.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});const g=await this.client.core.crypto.generateSharedKey(h,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:g});const w=await this.client.core.relayer.subscribe(g,{transportType:n});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:w}),await this.client.core.pairing.activate({topic:t})}else if(rn(i)){await this.client.proposal.delete(s,Gt("USER_DISCONNECTED"));const a=Dt("session_connect");if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners, 954`);this.events.emit(Dt("session_connect"),{error:i.error})}},this.onSessionSettleRequest=async(t,i)=>{const{id:n,params:s}=i;try{this.isValidSessionSettleRequest(s);const{relay:a,controller:f,expiry:h,namespaces:u,sessionProperties:g,sessionConfig:w}=i.params,M=Mn(pr(pr({topic:t,relay:a,expiry:h,namespaces:u,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:f.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:f.publicKey,metadata:f.metadata}},g&&{sessionProperties:g}),w&&{sessionConfig:w}),{transportType:sr.relay}),C=Dt("session_connect");if(this.events.listenerCount(C)===0)throw new Error(`emitting ${C} without any listeners 997`);this.events.emit(Dt("session_connect"),{session:M}),await this.sendResult({id:i.id,topic:t,result:!0,throwOnFailedPublish:!0})}catch(a){await this.sendError({id:n,topic:t,error:a}),this.client.logger.error(a)}},this.onSessionSettleResponse=async(t,i)=>{const{id:n}=i;es(i)?(await this.client.session.update(t,{acknowledged:!0}),this.events.emit(Dt("session_approve",n),{})):rn(i)&&(await this.client.session.delete(t,Gt("USER_DISCONNECTED")),this.events.emit(Dt("session_approve",n),{error:i.error}))},this.onSessionUpdateRequest=async(t,i)=>{const{params:n,id:s}=i;try{const a=`${t}_session_update`,f=rf.get(a);if(f&&this.isRequestOutOfSync(f,s)){this.client.logger.warn(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:t,error:Gt("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(pr({topic:t},n));try{rf.set(a,s),await this.client.session.update(t,{namespaces:n.namespaces}),await this.sendResult({id:s,topic:t,result:!0,throwOnFailedPublish:!0})}catch(h){throw rf.delete(a),h}this.client.events.emit("session_update",{id:s,topic:t,params:n})}catch(a){await this.sendError({id:s,topic:t,error:a}),this.client.logger.error(a)}},this.isRequestOutOfSync=(t,i)=>i.toString().slice(0,-3)<t.toString().slice(0,-3),this.onSessionUpdateResponse=(t,i)=>{const{id:n}=i,s=Dt("session_update",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);es(i)?this.events.emit(Dt("session_update",n),{}):rn(i)&&this.events.emit(Dt("session_update",n),{error:i.error})},this.onSessionExtendRequest=async(t,i)=>{const{id:n}=i;try{this.isValidExtend({topic:t}),await this.setExpiry(t,Ir(Wa)),await this.sendResult({id:n,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:n,topic:t})}catch(s){await this.sendError({id:n,topic:t,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(t,i)=>{const{id:n}=i,s=Dt("session_extend",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);es(i)?this.events.emit(Dt("session_extend",n),{}):rn(i)&&this.events.emit(Dt("session_extend",n),{error:i.error})},this.onSessionPingRequest=async(t,i)=>{const{id:n}=i;try{this.isValidPing({topic:t}),await this.sendResult({id:n,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:n,topic:t})}catch(s){await this.sendError({id:n,topic:t,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(t,i)=>{const{id:n}=i,s=Dt("session_ping",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{es(i)?this.events.emit(Dt("session_ping",n),{}):rn(i)&&this.events.emit(Dt("session_ping",n),{error:i.error})},500)},this.onSessionDeleteRequest=async(t,i)=>{const{id:n}=i;try{this.isValidDisconnect({topic:t,reason:i.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(Lr.publish,async()=>{s(await this.deleteSession({topic:t,id:n}))})}),this.sendResult({id:n,topic:t,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:t,error:Gt("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async t=>{var i,n,s;const{topic:a,payload:f,attestation:h,encryptedId:u,transportType:g}=t,{id:w,params:M}=f;try{await this.isValidRequest(pr({topic:a},M));const C=this.client.session.get(a),O=await this.getVerifyContext({attestationId:h,hash:ys(JSON.stringify(Qs("wc_sessionRequest",M,w))),encryptedId:u,metadata:C.peer.metadata,transportType:g}),N={id:w,topic:a,params:M,verifyContext:O};await this.setPendingSessionRequest(N),g===sr.link_mode&&(i=C.peer.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp((n=C.peer.metadata.redirect)==null?void 0:n.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(N):(this.addSessionRequestToSessionRequestQueue(N),this.processSessionRequestQueue())}catch(C){await this.sendError({id:w,topic:a,error:C}),this.client.logger.error(C)}},this.onSessionRequestResponse=(t,i)=>{const{id:n}=i,s=Dt("session_request",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);es(i)?this.events.emit(Dt("session_request",n),{result:i.result}):rn(i)&&this.events.emit(Dt("session_request",n),{error:i.error})},this.onSessionEventRequest=async(t,i)=>{const{id:n,params:s}=i;try{const a=`${t}_session_event_${s.event.name}`,f=rf.get(a);if(f&&this.isRequestOutOfSync(f,n)){this.client.logger.info(`Discarding out of sync request - ${n}`);return}this.isValidEmit(pr({topic:t},s)),this.client.events.emit("session_event",{id:n,topic:t,params:s}),rf.set(a,n)}catch(a){await this.sendError({id:n,topic:t,error:a}),this.client.logger.error(a)}},this.onSessionAuthenticateResponse=(t,i)=>{const{id:n}=i;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:t,payload:i}),es(i)?this.events.emit(Dt("session_request",n),{result:i.result}):rn(i)&&this.events.emit(Dt("session_request",n),{error:i.error})},this.onSessionAuthenticateRequest=async t=>{var i;const{topic:n,payload:s,attestation:a,encryptedId:f,transportType:h}=t;try{const{requester:u,authPayload:g,expiryTimestamp:w}=s.params,M=await this.getVerifyContext({attestationId:a,hash:ys(JSON.stringify(s)),encryptedId:f,metadata:u.metadata,transportType:h}),C={requester:u,pairingTopic:n,id:s.id,authPayload:g,verifyContext:M,expiryTimestamp:w};await this.setAuthRequest(s.id,{request:C,pairingTopic:n,transportType:h}),h===sr.link_mode&&(i=u.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp(u.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:n,params:s.params,id:s.id,verifyContext:M})}catch(u){this.client.logger.error(u);const g=s.params.requester.publicKey,w=await this.client.core.crypto.generateKeyPair(),M=this.getAppLinkIfEnabled(s.params.requester.metadata,h),C={type:ws,receiverPublicKey:g,senderPublicKey:w};await this.sendError({id:s.id,topic:n,error:u,encodeOpts:C,rpcOpts:Br.wc_sessionAuthenticate.autoReject,appLink:M})}},this.addSessionRequestToSessionRequestQueue=t=>{this.sessionRequestQueue.queue.push(t)},this.cleanupAfterResponse=t=>{this.deletePendingSessionRequest(t.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=is.idle,this.processSessionRequestQueue()},_e.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:t,error:i})=>{const n=this.client.core.history.pending;n.length>0&&n.filter(s=>s.topic===t&&s.request.method==="wc_sessionRequest").forEach(s=>{const a=s.request.id,f=Dt("session_request",a);if(this.events.listenerCount(f)===0)throw new Error(`emitting ${f} without any listeners`);this.events.emit(Dt("session_request",s.request.id),{error:i})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===is.active){this.client.logger.info("session request queue is already active.");return}const t=this.sessionRequestQueue.queue[0];if(!t){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=is.active,this.emitSessionRequest(t)}catch(i){this.client.logger.error(i)}},this.emitSessionRequest=t=>{this.client.events.emit("session_request",t)},this.onPairingCreated=t=>{if(t.methods&&this.expectedPairingMethodMap.set(t.topic,t.methods),t.active)return;const i=this.client.proposal.getAll().find(n=>n.pairingTopic===t.topic);i&&this.onSessionProposeRequest({topic:t.topic,payload:Qs("wc_sessionPropose",{requiredNamespaces:i.requiredNamespaces,optionalNamespaces:i.optionalNamespaces,relays:i.relays,proposer:i.proposer,sessionProperties:i.sessionProperties},i.id)})},this.isValidConnect=async t=>{if(!bi(t)){const{message:h}=xe("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(t)}`);throw new Error(h)}const{pairingTopic:i,requiredNamespaces:n,optionalNamespaces:s,sessionProperties:a,relays:f}=t;if(ai(i)||await this.isValidPairingTopic(i),!_E(f,!0)){const{message:h}=xe("MISSING_OR_INVALID",`connect() relays: ${f}`);throw new Error(h)}!ai(n)&&tf(n)!==0&&this.validateNamespaces(n,"requiredNamespaces"),!ai(s)&&tf(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),ai(a)||this.validateSessionProps(a,"sessionProperties")},this.validateNamespaces=(t,i)=>{const n=yE(t,"connect()",i);if(n)throw new Error(n.message)},this.isValidApprove=async t=>{if(!bi(t))throw new Error(xe("MISSING_OR_INVALID",`approve() params: ${t}`).message);const{id:i,namespaces:n,relayProtocol:s,sessionProperties:a}=t;this.checkRecentlyDeleted(i),await this.isValidProposalId(i);const f=this.client.proposal.get(i),h=n0(n,"approve()");if(h)throw new Error(h.message);const u=Ab(f.requiredNamespaces,n,"approve()");if(u)throw new Error(u.message);if(!wr(s,!0)){const{message:g}=xe("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(g)}ai(a)||this.validateSessionProps(a,"sessionProperties")},this.isValidReject=async t=>{if(!bi(t)){const{message:s}=xe("MISSING_OR_INVALID",`reject() params: ${t}`);throw new Error(s)}const{id:i,reason:n}=t;if(this.checkRecentlyDeleted(i),await this.isValidProposalId(i),!AE(n)){const{message:s}=xe("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(s)}},this.isValidSessionSettleRequest=t=>{if(!bi(t)){const{message:u}=xe("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${t}`);throw new Error(u)}const{relay:i,controller:n,namespaces:s,expiry:a}=t;if(!_b(i)){const{message:u}=xe("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(u)}const f=pE(n,"onSessionSettleRequest()");if(f)throw new Error(f.message);const h=n0(s,"onSessionSettleRequest()");if(h)throw new Error(h.message);if(Ys(a)){const{message:u}=xe("EXPIRED","onSessionSettleRequest()");throw new Error(u)}},this.isValidUpdate=async t=>{if(!bi(t)){const{message:h}=xe("MISSING_OR_INVALID",`update() params: ${t}`);throw new Error(h)}const{topic:i,namespaces:n}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const s=this.client.session.get(i),a=n0(n,"update()");if(a)throw new Error(a.message);const f=Ab(s.requiredNamespaces,n,"update()");if(f)throw new Error(f.message)},this.isValidExtend=async t=>{if(!bi(t)){const{message:n}=xe("MISSING_OR_INVALID",`extend() params: ${t}`);throw new Error(n)}const{topic:i}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i)},this.isValidRequest=async t=>{if(!bi(t)){const{message:h}=xe("MISSING_OR_INVALID",`request() params: ${t}`);throw new Error(h)}const{topic:i,request:n,chainId:s,expiry:a}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const{namespaces:f}=this.client.session.get(i);if(!xb(f,s)){const{message:h}=xe("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(h)}if(!EE(n)){const{message:h}=xe("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(h)}if(!ME(f,s,n.method)){const{message:h}=xe("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(h)}if(a&&!OE(a,C0)){const{message:h}=xe("MISSING_OR_INVALID",`request() expiry: ${a}. Expiry must be a number (in seconds) between ${C0.min} and ${C0.max}`);throw new Error(h)}},this.isValidRespond=async t=>{var i;if(!bi(t)){const{message:a}=xe("MISSING_OR_INVALID",`respond() params: ${t}`);throw new Error(a)}const{topic:n,response:s}=t;try{await this.isValidSessionTopic(n)}catch(a){throw(i=t?.response)!=null&&i.id&&this.cleanupAfterResponse(t),a}if(!SE(s)){const{message:a}=xe("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(a)}},this.isValidPing=async t=>{if(!bi(t)){const{message:n}=xe("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(n)}const{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.isValidEmit=async t=>{if(!bi(t)){const{message:f}=xe("MISSING_OR_INVALID",`emit() params: ${t}`);throw new Error(f)}const{topic:i,event:n,chainId:s}=t;await this.isValidSessionTopic(i);const{namespaces:a}=this.client.session.get(i);if(!xb(a,s)){const{message:f}=xe("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(f)}if(!IE(n)){const{message:f}=xe("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(f)}if(!CE(a,s,n.name)){const{message:f}=xe("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(f)}},this.isValidDisconnect=async t=>{if(!bi(t)){const{message:n}=xe("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(n)}const{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.isValidAuthenticate=t=>{const{chains:i,uri:n,domain:s,nonce:a}=t;if(!Array.isArray(i)||i.length===0)throw new Error("chains is required and must be a non-empty array");if(!wr(n,!1))throw new Error("uri is required parameter");if(!wr(s,!1))throw new Error("domain is required parameter");if(!wr(a,!1))throw new Error("nonce is required parameter");if([...new Set(i.map(h=>qa(h).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:f}=qa(i[0]);if(f!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async t=>{const{attestationId:i,hash:n,encryptedId:s,metadata:a,transportType:f}=t,h={verified:{verifyUrl:a.verifyUrl||hf,validation:"UNKNOWN",origin:a.url||""}};try{if(f===sr.link_mode){const g=this.getAppLinkIfEnabled(a,f);return h.verified.validation=g&&new URL(g).origin===new URL(a.url).origin?"VALID":"INVALID",h}const u=await this.client.core.verify.resolve({attestationId:i,hash:n,encryptedId:s,verifyUrl:a.verifyUrl});u&&(h.verified.origin=u.origin,h.verified.isScam=u.isScam,h.verified.validation=u.origin===new URL(a.url).origin?"VALID":"INVALID")}catch(u){this.client.logger.warn(u)}return this.client.logger.debug(`Verify context: ${JSON.stringify(h)}`),h},this.validateSessionProps=(t,i)=>{Object.values(t).forEach(n=>{if(!wr(n,!1)){const{message:s}=xe("MISSING_OR_INVALID",`${i} must be in Record<string, string> format. Received: ${JSON.stringify(n)}`);throw new Error(s)}})},this.getPendingAuthRequest=t=>{const i=this.client.auth.requests.get(t);return typeof i=="object"?i:void 0},this.addToRecentlyDeleted=(t,i)=>{if(this.recentlyDeletedMap.set(t,i),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let n=0;const s=this.recentlyDeletedLimit/2;for(const a of this.recentlyDeletedMap.keys()){if(n++>=s)break;this.recentlyDeletedMap.delete(a)}}},this.checkRecentlyDeleted=t=>{const i=this.recentlyDeletedMap.get(t);if(i){const{message:n}=xe("MISSING_OR_INVALID",`Record was recently deleted - ${i}: ${t}`);throw new Error(n)}},this.isLinkModeEnabled=(t,i)=>{var n,s,a,f,h,u,g,w,M;return!t||i!==sr.link_mode?!1:((s=(n=this.client.metadata)==null?void 0:n.redirect)==null?void 0:s.linkMode)===!0&&((f=(a=this.client.metadata)==null?void 0:a.redirect)==null?void 0:f.universal)!==void 0&&((u=(h=this.client.metadata)==null?void 0:h.redirect)==null?void 0:u.universal)!==""&&((g=t?.redirect)==null?void 0:g.universal)!==void 0&&((w=t?.redirect)==null?void 0:w.universal)!==""&&((M=t?.redirect)==null?void 0:M.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(t.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(t,i)=>{var n;return this.isLinkModeEnabled(t,i)?(n=t?.redirect)==null?void 0:n.universal:void 0},this.handleLinkModeMessage=({url:t})=>{if(!t||!t.includes("wc_ev")||!t.includes("topic"))return;const i=Ym(t,"topic")||"",n=decodeURIComponent(Ym(t,"wc_ev")||""),s=this.client.session.keys.includes(i);s&&this.client.session.update(i,{transportType:sr.link_mode}),this.client.core.dispatchEnvelope({topic:i,message:n,sessionExists:s})},this.registerLinkModeListeners=async()=>{var t;if(Qd()||Vs()&&(t=this.client.metadata.redirect)!=null&&t.linkMode){const i=global==null?void 0:global.Linking;if(typeof i<"u"){i.addEventListener("url",this.handleLinkModeMessage,this.client.name);const n=await i.getInitialURL();n&&setTimeout(()=>{this.handleLinkModeMessage({url:n})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Lr.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:t,message:i,attestation:n,transportType:s}=e,{publicKey:a}=this.client.auth.authKeys.keys.includes(fh)?this.client.auth.authKeys.get(fh):{responseTopic:void 0,publicKey:void 0},f=await this.client.core.crypto.decode(t,i,{receiverPublicKey:a,encoding:s===sr.link_mode?Gc:Js});try{b0(f)?(this.client.core.history.set(t,f),this.onRelayEventRequest({topic:t,payload:f,attestation:n,transportType:s,encryptedId:ys(i)})):sh(f)?(await this.client.core.history.resolve(f),await this.onRelayEventResponse({topic:t,payload:f,transportType:s}),this.client.core.history.delete(t,f.id)):this.onRelayEventUnknownPayload({topic:t,payload:f,transportType:s})}catch(h){this.client.logger.error(h)}}registerExpirerEvents(){this.client.core.expirer.on(on.expired,async e=>{const{topic:t,id:i}=Gm(e.target);if(i&&this.client.pendingRequest.keys.includes(i))return await this.deletePendingSessionRequest(i,xe("EXPIRED"),!0);if(i&&this.client.auth.requests.keys.includes(i))return await this.deletePendingAuthRequest(i,xe("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):i&&(await this.deleteProposal(i,!0),this.client.events.emit("proposal_expire",{id:i}))})}registerPairingEvents(){this.client.core.pairing.events.on(qo.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(qo.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!wr(e,!1)){const{message:t}=xe("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:t}=xe("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(Ys(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=xe("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!wr(e,!1)){const{message:t}=xe("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:t}=xe("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(Ys(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:t}=xe("EXPIRED",`session topic: ${e}`);throw new Error(t)}if(!this.client.core.crypto.keychain.has(e)){const{message:t}=xe("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(t)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(wr(e,!1)){const{message:t}=xe("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}else{const{message:t}=xe("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}async isValidProposalId(e){if(!xE(e)){const{message:t}=xe("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=xe("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(Ys(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:t}=xe("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}}class QP extends ko{constructor(e,t){super(e,t,$P,I0),this.core=e,this.logger=t}}class ZP extends ko{constructor(e,t){super(e,t,LP,I0),this.core=e,this.logger=t}}class XP extends ko{constructor(e,t){super(e,t,FP,I0,i=>i.id),this.core=e,this.logger=t}}class eD extends ko{constructor(e,t){super(e,t,HP,ch,()=>fh),this.core=e,this.logger=t}}class tD extends ko{constructor(e,t){super(e,t,kP,ch),this.core=e,this.logger=t}}class rD extends ko{constructor(e,t){super(e,t,jP,ch,i=>i.id),this.core=e,this.logger=t}}class iD{constructor(e,t){this.core=e,this.logger=t,this.authKeys=new eD(this.core,this.logger),this.pairingTopics=new tD(this.core,this.logger),this.requests=new rD(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class P0 extends eI{constructor(e){super(e),this.protocol=W2,this.version=K2,this.name=M0.name,this.events=new zr.exports.EventEmitter,this.on=(i,n)=>this.events.on(i,n),this.once=(i,n)=>this.events.once(i,n),this.off=(i,n)=>this.events.off(i,n),this.removeListener=(i,n)=>this.events.removeListener(i,n),this.removeAllListeners=i=>this.events.removeAllListeners(i),this.connect=async i=>{try{return await this.engine.connect(i)}catch(n){throw this.logger.error(n.message),n}},this.pair=async i=>{try{return await this.engine.pair(i)}catch(n){throw this.logger.error(n.message),n}},this.approve=async i=>{try{return await this.engine.approve(i)}catch(n){throw this.logger.error(n.message),n}},this.reject=async i=>{try{return await this.engine.reject(i)}catch(n){throw this.logger.error(n.message),n}},this.update=async i=>{try{return await this.engine.update(i)}catch(n){throw this.logger.error(n.message),n}},this.extend=async i=>{try{return await this.engine.extend(i)}catch(n){throw this.logger.error(n.message),n}},this.request=async i=>{try{return await this.engine.request(i)}catch(n){throw this.logger.error(n.message),n}},this.respond=async i=>{try{return await this.engine.respond(i)}catch(n){throw this.logger.error(n.message),n}},this.ping=async i=>{try{return await this.engine.ping(i)}catch(n){throw this.logger.error(n.message),n}},this.emit=async i=>{try{return await this.engine.emit(i)}catch(n){throw this.logger.error(n.message),n}},this.disconnect=async i=>{try{return await this.engine.disconnect(i)}catch(n){throw this.logger.error(n.message),n}},this.find=i=>{try{return this.engine.find(i)}catch(n){throw this.logger.error(n.message),n}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(i){throw this.logger.error(i.message),i}},this.authenticate=async(i,n)=>{try{return await this.engine.authenticate(i,n)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=i=>{try{return this.engine.formatAuthMessage(i)}catch(n){throw this.logger.error(n.message),n}},this.approveSessionAuthenticate=async i=>{try{return await this.engine.approveSessionAuthenticate(i)}catch(n){throw this.logger.error(n.message),n}},this.rejectSessionAuthenticate=async i=>{try{return await this.engine.rejectSessionAuthenticate(i)}catch(n){throw this.logger.error(n.message),n}},this.name=e?.name||M0.name,this.metadata=e?.metadata||km(),this.signConfig=e?.signConfig;const t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Zn(rh({level:e?.logger||M0.logger}));this.core=e?.core||new NP(e),this.logger=ci(t,this.name),this.session=new ZP(this.core,this.logger),this.proposal=new QP(this.core,this.logger),this.pendingRequest=new XP(this.core,this.logger),this.engine=new JP(this),this.auth=new iD(this.core,this.logger)}static async init(e){const t=new P0(e);return await t.initialize(),t}get context(){return yi(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),setTimeout(()=>{this.engine.processRelayMessageCache()},_e.toMiliseconds(_e.ONE_SECOND))}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var D0={exports:{}};/**
|
|
43
|
+
***************************************************************************** */var d0=function(r,e){return d0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},d0(r,e)};function kS(r,e){d0(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var p0=function(){return p0=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},p0.apply(this,arguments)};function HS(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(t[i[n]]=r[i[n]]);return t}function jS(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var f=r.length-1;f>=0;f--)(a=r[f])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s}function WS(r,e){return function(t,i){e(t,i,r)}}function KS(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function VS(r,e,t,i){function n(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function f(g){try{u(i.next(g))}catch(w){a(w)}}function h(g){try{u(i.throw(g))}catch(w){a(w)}}function u(g){g.done?s(g.value):n(g.value).then(f,h)}u((i=i.apply(r,e||[])).next())})}function GS(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,a;return a={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function f(u){return function(g){return h([u,g])}}function h(u){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(s=u[0]&2?n.return:u[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,u[1])).done)return s;switch(n=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,n=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){t.label=u[1];break}if(u[0]===6&&t.label<s[1]){t.label=s[1],s=u;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(u);break}s[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(r,t)}catch(g){u=[6,g],n=0}finally{i=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function JS(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}function YS(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function g0(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Lb(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],a;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(f){a={error:f}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(a)throw a.error}}return s}function QS(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(Lb(arguments[e]));return r}function ZS(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var i=Array(r),n=0,e=0;e<t;e++)for(var s=arguments[e],a=0,f=s.length;a<f;a++,n++)i[n]=s[a];return i}function cf(r){return this instanceof cf?(this.v=r,this):new cf(r)}function XS(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(r,e||[]),n,s=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(M){i[M]&&(n[M]=function(P){return new Promise(function(O,$){s.push([M,P,O,$])>1||f(M,P)})})}function f(M,P){try{h(i[M](P))}catch(O){w(s[0][3],O)}}function h(M){M.value instanceof cf?Promise.resolve(M.value.v).then(u,g):w(s[0][2],M)}function u(M){f("next",M)}function g(M){f("throw",M)}function w(M,P){M(P),s.shift(),s.length&&f(s[0][0],s[0][1])}}function eI(r){var e,t;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=r[n]?function(a){return(t=!t)?{value:cf(r[n](a)),done:n==="return"}:s?s(a):a}:s}}function tI(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof g0=="function"?g0(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(s){t[s]=r[s]&&function(a){return new Promise(function(f,h){a=r[s](a),n(f,h,a.done,a.value)})}}function n(s,a,f,h){Promise.resolve(h).then(function(u){s({value:u,done:f})},a)}}function rI(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function iI(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function nI(r){return r&&r.__esModule?r:{default:r}}function sI(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function oI(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var aI=Object.freeze({__proto__:null,__extends:kS,get __assign(){return p0},__rest:HS,__decorate:jS,__param:WS,__metadata:KS,__awaiter:VS,__generator:GS,__createBinding:JS,__exportStar:YS,__values:g0,__read:Lb,__spread:QS,__spreadArrays:ZS,__await:cf,__asyncGenerator:XS,__asyncDelegator:eI,__asyncValues:tI,__makeTemplateObject:rI,__importStar:iI,__importDefault:nI,__classPrivateFieldGet:sI,__classPrivateFieldSet:oI}),cI=Hu(aI),xs={},Bb;function fI(){if(Bb)return xs;Bb=1,Object.defineProperty(xs,"__esModule",{value:!0}),xs.isBrowserCryptoAvailable=xs.getSubtleCrypto=xs.getBrowerCrypto=void 0;function r(){return fr?.crypto||fr?.msCrypto||{}}xs.getBrowerCrypto=r;function e(){const i=r();return i.subtle||i.webkitSubtle}xs.getSubtleCrypto=e;function t(){return!!r()&&!!e()}return xs.isBrowserCryptoAvailable=t,xs}var Es={},Ub;function lI(){if(Ub)return Es;Ub=1,Object.defineProperty(Es,"__esModule",{value:!0}),Es.isBrowser=Es.isNode=Es.isReactNative=void 0;function r(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Es.isReactNative=r;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Es.isNode=e;function t(){return!r()&&!e()}return Es.isBrowser=t,Es}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=cI;e.__exportStar(fI(),r),e.__exportStar(lI(),r)})($b);function As(r=3){const e=Date.now()*Math.pow(10,r),t=Math.floor(Math.random()*Math.pow(10,r));return e+t}function Fo(r=6){return BigInt(As(r))}function Qs(r,e,t){return{id:t||As(),jsonrpc:"2.0",method:r,params:e}}function rh(r,e){return{id:r,jsonrpc:"2.0",result:e}}function ih(r,e,t){return{id:r,jsonrpc:"2.0",error:hI(e,t)}}function hI(r,e){return typeof r>"u"?Tb(Ob):(typeof r=="string"&&(r=Object.assign(Object.assign({},Tb(u0)),{message:r})),typeof e<"u"&&(r.data=e),qS(r.code)&&(r=zS(r.code)),r)}class uI{}class dI extends uI{constructor(){super()}}class pI extends dI{constructor(e){super()}}const gI="^https?:",vI="^wss?:";function mI(r){const e=r.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function Fb(r,e){const t=mI(r);return typeof t>"u"?!1:new RegExp(e).test(t)}function qb(r){return Fb(r,gI)}function zb(r){return Fb(r,vI)}function bI(r){return new RegExp("wss?://localhost(:d{2,5})?").test(r)}function kb(r){return typeof r=="object"&&"id"in r&&"jsonrpc"in r&&r.jsonrpc==="2.0"}function v0(r){return kb(r)&&"method"in r}function nh(r){return kb(r)&&(es(r)||rn(r))}function es(r){return"result"in r}function rn(r){return"error"in r}class nn extends pI{constructor(e){super(e),this.events=new zr.exports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(Qs(e.method,e.params||[],e.id||Fo().toString()),t)}async requestStrict(e,t){return new Promise(async(i,n)=>{if(!this.connection.connected)try{await this.open()}catch(s){n(s)}this.events.on(`${e.id}`,s=>{rn(s)?n(s.error):i(s.result)});try{await this.connection.send(e,t)}catch(s){n(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),nh(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}}const wI=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),yI=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",Hb=r=>r.split("?")[0],jb=10,_I=wI();class xI{constructor(e){if(this.url=e,this.events=new zr.exports.EventEmitter,this.registering=!1,!zb(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,t)=>{if(typeof this.socket>"u"){t(new Error("Connection already closed"));return}this.socket.onclose=i=>{this.onClose(i),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(bs(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!zb(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,n)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),n(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return n(new Error("WebSocket connection is missing or invalid"));i(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,i)=>{const n=$b.isReactNative()?void 0:{rejectUnauthorized:!bI(e)},s=new _I(e,[],n);yI()?s.onerror=a=>{const f=a;i(this.emitError(f.error))}:s.on("error",a=>{i(this.emitError(a))}),s.onopen=()=>{this.onOpen(s),t(s)}})}onOpen(e){e.onmessage=t=>this.onPayload(t),e.onclose=t=>this.onClose(t),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?Ro(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const i=this.parseError(t),n=i.message||i.toString(),s=ih(e,n);this.events.emit("payload",s)}parseError(e,t=this.url){return Nb(e,Hb(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>jb&&this.events.setMaxListeners(jb)}emitError(e){const t=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${Hb(this.url)}`));return this.events.emit("register_error",t),t}}var m0={exports:{}};(function(r,e){var t=200,i="__lodash_hash_undefined__",n=1,s=2,a=9007199254740991,f="[object Arguments]",h="[object Array]",u="[object AsyncFunction]",g="[object Boolean]",w="[object Date]",M="[object Error]",P="[object Function]",O="[object GeneratorFunction]",$="[object Map]",q="[object Number]",U="[object Null]",J="[object Object]",ee="[object Promise]",W="[object Proxy]",G="[object RegExp]",Q="[object Set]",A="[object String]",z="[object Symbol]",te="[object Undefined]",ae="[object WeakMap]",L="[object ArrayBuffer]",b="[object DataView]",m="[object Float32Array]",l="[object Float64Array]",d="[object Int8Array]",y="[object Int16Array]",C="[object Int32Array]",D="[object Uint8Array]",S="[object Uint8ClampedArray]",v="[object Uint16Array]",x="[object Uint32Array]",_=/[\\^$.*+?()[\]{}|]/g,N=/^\[object .+?Constructor\]$/,oe=/^(?:0|[1-9]\d*)$/,R={};R[m]=R[l]=R[d]=R[y]=R[C]=R[D]=R[S]=R[v]=R[x]=!0,R[f]=R[h]=R[L]=R[g]=R[b]=R[w]=R[M]=R[P]=R[$]=R[q]=R[J]=R[G]=R[Q]=R[A]=R[ae]=!1;var Z=typeof fr=="object"&&fr&&fr.Object===Object&&fr,H=typeof self=="object"&&self&&self.Object===Object&&self,K=Z||H||Function("return this")(),k=e&&!e.nodeType&&e,E=k&&!0&&r&&!r.nodeType&&r,j=E&&E.exports===k,re=j&&Z.process,le=function(){try{return re&&re.binding&&re.binding("util")}catch{}}(),he=le&&le.isTypedArray;function ge(V,ne){for(var pe=-1,Fe=V==null?0:V.length,Xt=0,bt=[];++pe<Fe;){var or=V[pe];ne(or,pe,V)&&(bt[Xt++]=or)}return bt}function ke(V,ne){for(var pe=-1,Fe=ne.length,Xt=V.length;++pe<Fe;)V[Xt+pe]=ne[pe];return V}function Te(V,ne){for(var pe=-1,Fe=V==null?0:V.length;++pe<Fe;)if(ne(V[pe],pe,V))return!0;return!1}function Ce(V,ne){for(var pe=-1,Fe=Array(V);++pe<V;)Fe[pe]=ne(pe);return Fe}function Xe(V){return function(ne){return V(ne)}}function Ne(V,ne){return V.has(ne)}function be(V,ne){return V?.[ne]}function Pe(V){var ne=-1,pe=Array(V.size);return V.forEach(function(Fe,Xt){pe[++ne]=[Xt,Fe]}),pe}function De(V,ne){return function(pe){return V(ne(pe))}}function ye(V){var ne=-1,pe=Array(V.size);return V.forEach(function(Fe){pe[++ne]=Fe}),pe}var Ie=Array.prototype,Oe=Function.prototype,me=Object.prototype,Me=K["__core-js_shared__"],Be=Oe.toString,we=me.hasOwnProperty,He=function(){var V=/[^.]+$/.exec(Me&&Me.keys&&Me.keys.IE_PROTO||"");return V?"Symbol(src)_1."+V:""}(),We=me.toString,Ee=RegExp("^"+Be.call(we).replace(_,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ve=j?K.Buffer:void 0,Ke=K.Symbol,Ge=K.Uint8Array,mt=me.propertyIsEnumerable,It=Ie.splice,Je=Ke?Ke.toStringTag:void 0,Pt=Object.getOwnPropertySymbols,Ot=Ve?Ve.isBuffer:void 0,Ze=De(Object.keys,Object),rt=ki(K,"DataView"),et=ki(K,"Map"),$e=ki(K,"Promise"),it=ki(K,"Set"),tt=ki(K,"WeakMap"),Re=ki(Object,"create"),lt=Ps(rt),ht=Ps(et),Le=Ps($e),ut=Ps(it),nt=Ps(tt),Ue=Ke?Ke.prototype:void 0,st=Ue?Ue.valueOf:void 0;function Qe(V){var ne=-1,pe=V==null?0:V.length;for(this.clear();++ne<pe;){var Fe=V[ne];this.set(Fe[0],Fe[1])}}function qe(){this.__data__=Re?Re(null):{},this.size=0}function dt(V){var ne=this.has(V)&&delete this.__data__[V];return this.size-=ne?1:0,ne}function kt(V){var ne=this.__data__;if(Re){var pe=ne[V];return pe===i?void 0:pe}return we.call(ne,V)?ne[V]:void 0}function at(V){var ne=this.__data__;return Re?ne[V]!==void 0:we.call(ne,V)}function Ht(V,ne){var pe=this.__data__;return this.size+=this.has(V)?0:1,pe[V]=Re&&ne===void 0?i:ne,this}Qe.prototype.clear=qe,Qe.prototype.delete=dt,Qe.prototype.get=kt,Qe.prototype.has=at,Qe.prototype.set=Ht;function _t(V){var ne=-1,pe=V==null?0:V.length;for(this.clear();++ne<pe;){var Fe=V[ne];this.set(Fe[0],Fe[1])}}function qt(){this.__data__=[],this.size=0}function Zr(V){var ne=this.__data__,pe=sa(ne,V);if(pe<0)return!1;var Fe=ne.length-1;return pe==Fe?ne.pop():It.call(ne,pe,1),--this.size,!0}function Xr(V){var ne=this.__data__,pe=sa(ne,V);return pe<0?void 0:ne[pe][1]}function ei(V){return sa(this.__data__,V)>-1}function ti(V,ne){var pe=this.__data__,Fe=sa(pe,V);return Fe<0?(++this.size,pe.push([V,ne])):pe[Fe][1]=ne,this}_t.prototype.clear=qt,_t.prototype.delete=Zr,_t.prototype.get=Xr,_t.prototype.has=ei,_t.prototype.set=ti;function vr(V){var ne=-1,pe=V==null?0:V.length;for(this.clear();++ne<pe;){var Fe=V[ne];this.set(Fe[0],Fe[1])}}function Ei(){this.size=0,this.__data__={hash:new Qe,map:new(et||_t),string:new Qe}}function Pn(V){var ne=ho(this,V).delete(V);return this.size-=ne?1:0,ne}function Ai(V){return ho(this,V).get(V)}function Dn(V){return ho(this,V).has(V)}function On(V,ne){var pe=ho(this,V),Fe=pe.size;return pe.set(V,ne),this.size+=pe.size==Fe?0:1,this}vr.prototype.clear=Ei,vr.prototype.delete=Pn,vr.prototype.get=Ai,vr.prototype.has=Dn,vr.prototype.set=On;function Si(V){var ne=-1,pe=V==null?0:V.length;for(this.__data__=new vr;++ne<pe;)this.add(V[ne])}function fn(V){return this.__data__.set(V,i),this}function ln(V){return this.__data__.has(V)}Si.prototype.add=Si.prototype.push=fn,Si.prototype.has=ln;function Cr(V){var ne=this.__data__=new _t(V);this.size=ne.size}function Rn(){this.__data__=new _t,this.size=0}function Tn(V){var ne=this.__data__,pe=ne.delete(V);return this.size=ne.size,pe}function Nn(V){return this.__data__.get(V)}function na(V){return this.__data__.has(V)}function lo(V,ne){var pe=this.__data__;if(pe instanceof _t){var Fe=pe.__data__;if(!et||Fe.length<t-1)return Fe.push([V,ne]),this.size=++pe.size,this;pe=this.__data__=new vr(Fe)}return pe.set(V,ne),this.size=pe.size,this}Cr.prototype.clear=Rn,Cr.prototype.delete=Tn,Cr.prototype.get=Nn,Cr.prototype.has=na,Cr.prototype.set=lo;function kh(V,ne){var pe=dc(V),Fe=!pe&&eu(V),Xt=!pe&&!Fe&&Lf(V),bt=!pe&&!Fe&&!Xt&&iu(V),or=pe||Fe||Xt||bt,Ar=or?Ce(V.length,String):[],Bt=Ar.length;for(var er in V)(ne||we.call(V,er))&&!(or&&(er=="length"||Xt&&(er=="offset"||er=="parent")||bt&&(er=="buffer"||er=="byteLength"||er=="byteOffset")||Jh(er,Bt)))&&Ar.push(er);return Ar}function sa(V,ne){for(var pe=V.length;pe--;)if(Xh(V[pe][0],ne))return pe;return-1}function Nf(V,ne,pe){var Fe=ne(V);return dc(V)?Fe:ke(Fe,pe(V))}function oa(V){return V==null?V===void 0?te:U:Je&&Je in Object(V)?Vh(V):Vp(V)}function $f(V){return ca(V)&&oa(V)==f}function aa(V,ne,pe,Fe,Xt){return V===ne?!0:V==null||ne==null||!ca(V)&&!ca(ne)?V!==V&&ne!==ne:Hh(V,ne,pe,Fe,aa,Xt)}function Hh(V,ne,pe,Fe,Xt,bt){var or=dc(V),Ar=dc(ne),Bt=or?h:cs(V),er=Ar?h:cs(ne);Bt=Bt==f?J:Bt,er=er==f?J:er;var _r=Bt==J,Ii=er==J,Sr=Bt==er;if(Sr&&Lf(V)){if(!Lf(ne))return!1;or=!0,_r=!1}if(Sr&&!_r)return bt||(bt=new Cr),or||iu(V)?hc(V,ne,pe,Fe,Xt,bt):Kp(V,ne,Bt,pe,Fe,Xt,bt);if(!(pe&n)){var ar=_r&&we.call(V,"__wrapped__"),hi=Ii&&we.call(ne,"__wrapped__");if(ar||hi){var $n=ar?V.value():V,hn=hi?ne.value():ne;return bt||(bt=new Cr),Xt($n,hn,pe,Fe,bt)}}return Sr?(bt||(bt=new Cr),Kh(V,ne,pe,Fe,Xt,bt)):!1}function Wp(V){if(!ru(V)||Qh(V))return!1;var ne=pc(V)?Ee:N;return ne.test(Ps(V))}function jh(V){return ca(V)&&tu(V.length)&&!!R[oa(V)]}function Wh(V){if(!Zh(V))return Ze(V);var ne=[];for(var pe in Object(V))we.call(V,pe)&&pe!="constructor"&&ne.push(pe);return ne}function hc(V,ne,pe,Fe,Xt,bt){var or=pe&n,Ar=V.length,Bt=ne.length;if(Ar!=Bt&&!(or&&Bt>Ar))return!1;var er=bt.get(V);if(er&&bt.get(ne))return er==ne;var _r=-1,Ii=!0,Sr=pe&s?new Si:void 0;for(bt.set(V,ne),bt.set(ne,V);++_r<Ar;){var ar=V[_r],hi=ne[_r];if(Fe)var $n=or?Fe(hi,ar,_r,ne,V,bt):Fe(ar,hi,_r,V,ne,bt);if($n!==void 0){if($n)continue;Ii=!1;break}if(Sr){if(!Te(ne,function(hn,fs){if(!Ne(Sr,fs)&&(ar===hn||Xt(ar,hn,pe,Fe,bt)))return Sr.push(fs)})){Ii=!1;break}}else if(!(ar===hi||Xt(ar,hi,pe,Fe,bt))){Ii=!1;break}}return bt.delete(V),bt.delete(ne),Ii}function Kp(V,ne,pe,Fe,Xt,bt,or){switch(pe){case b:if(V.byteLength!=ne.byteLength||V.byteOffset!=ne.byteOffset)return!1;V=V.buffer,ne=ne.buffer;case L:return!(V.byteLength!=ne.byteLength||!bt(new Ge(V),new Ge(ne)));case g:case w:case q:return Xh(+V,+ne);case M:return V.name==ne.name&&V.message==ne.message;case G:case A:return V==ne+"";case $:var Ar=Pe;case Q:var Bt=Fe&n;if(Ar||(Ar=ye),V.size!=ne.size&&!Bt)return!1;var er=or.get(V);if(er)return er==ne;Fe|=s,or.set(V,ne);var _r=hc(Ar(V),Ar(ne),Fe,Xt,bt,or);return or.delete(V),_r;case z:if(st)return st.call(V)==st.call(ne)}return!1}function Kh(V,ne,pe,Fe,Xt,bt){var or=pe&n,Ar=uc(V),Bt=Ar.length,er=uc(ne),_r=er.length;if(Bt!=_r&&!or)return!1;for(var Ii=Bt;Ii--;){var Sr=Ar[Ii];if(!(or?Sr in ne:we.call(ne,Sr)))return!1}var ar=bt.get(V);if(ar&&bt.get(ne))return ar==ne;var hi=!0;bt.set(V,ne),bt.set(ne,V);for(var $n=or;++Ii<Bt;){Sr=Ar[Ii];var hn=V[Sr],fs=ne[Sr];if(Fe)var Bf=or?Fe(fs,hn,Sr,ne,V,bt):Fe(hn,fs,Sr,V,ne,bt);if(!(Bf===void 0?hn===fs||Xt(hn,fs,pe,Fe,bt):Bf)){hi=!1;break}$n||($n=Sr=="constructor")}if(hi&&!$n){var fa=V.constructor,Fr=ne.constructor;fa!=Fr&&"constructor"in V&&"constructor"in ne&&!(typeof fa=="function"&&fa instanceof fa&&typeof Fr=="function"&&Fr instanceof Fr)&&(hi=!1)}return bt.delete(V),bt.delete(ne),hi}function uc(V){return Nf(V,Yp,Gh)}function ho(V,ne){var pe=V.__data__;return Yh(ne)?pe[typeof ne=="string"?"string":"hash"]:pe.map}function ki(V,ne){var pe=be(V,ne);return Wp(pe)?pe:void 0}function Vh(V){var ne=we.call(V,Je),pe=V[Je];try{V[Je]=void 0;var Fe=!0}catch{}var Xt=We.call(V);return Fe&&(ne?V[Je]=pe:delete V[Je]),Xt}var Gh=Pt?function(V){return V==null?[]:(V=Object(V),ge(Pt(V),function(ne){return mt.call(V,ne)}))}:Zt,cs=oa;(rt&&cs(new rt(new ArrayBuffer(1)))!=b||et&&cs(new et)!=$||$e&&cs($e.resolve())!=ee||it&&cs(new it)!=Q||tt&&cs(new tt)!=ae)&&(cs=function(V){var ne=oa(V),pe=ne==J?V.constructor:void 0,Fe=pe?Ps(pe):"";if(Fe)switch(Fe){case lt:return b;case ht:return $;case Le:return ee;case ut:return Q;case nt:return ae}return ne});function Jh(V,ne){return ne=ne??a,!!ne&&(typeof V=="number"||oe.test(V))&&V>-1&&V%1==0&&V<ne}function Yh(V){var ne=typeof V;return ne=="string"||ne=="number"||ne=="symbol"||ne=="boolean"?V!=="__proto__":V===null}function Qh(V){return!!He&&He in V}function Zh(V){var ne=V&&V.constructor,pe=typeof ne=="function"&&ne.prototype||me;return V===pe}function Vp(V){return We.call(V)}function Ps(V){if(V!=null){try{return Be.call(V)}catch{}try{return V+""}catch{}}return""}function Xh(V,ne){return V===ne||V!==V&&ne!==ne}var eu=$f(function(){return arguments}())?$f:function(V){return ca(V)&&we.call(V,"callee")&&!mt.call(V,"callee")},dc=Array.isArray;function Gp(V){return V!=null&&tu(V.length)&&!pc(V)}var Lf=Ot||Qt;function Jp(V,ne){return aa(V,ne)}function pc(V){if(!ru(V))return!1;var ne=oa(V);return ne==P||ne==O||ne==u||ne==W}function tu(V){return typeof V=="number"&&V>-1&&V%1==0&&V<=a}function ru(V){var ne=typeof V;return V!=null&&(ne=="object"||ne=="function")}function ca(V){return V!=null&&typeof V=="object"}var iu=he?Xe(he):jh;function Yp(V){return Gp(V)?kh(V):Wh(V)}function Zt(){return[]}function Qt(){return!1}r.exports=Jp})(m0,m0.exports);var EI=m0.exports,AI=Object.defineProperty,Wb=Object.getOwnPropertySymbols,SI=Object.prototype.hasOwnProperty,II=Object.prototype.propertyIsEnumerable,Kb=(r,e,t)=>e in r?AI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,fi=(r,e)=>{for(var t in e||(e={}))SI.call(e,t)&&Kb(r,t,e[t]);if(Wb)for(var t of Wb(e))II.call(e,t)&&Kb(r,t,e[t]);return r};const Vb="wc",Gb=2,sh="core",ts=`${Vb}@2:${sh}:`,MI={name:sh,logger:"error"},CI={database:":memory:"},PI="crypto",Jb="client_ed25519_seed",DI=_e.ONE_DAY,OI="keychain",RI="0.3",TI="messages",NI="0.3",Yb=_e.SIX_HOURS,$I="publisher",Qb="irn",LI="error",Zb="wss://relay.walletconnect.org",BI="relayer",Lr={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},UI="_subscription",sn={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},FI=.1,b0="2.17.5",sr={link_mode:"link_mode",relay:"relay"},qI="0.3",zI="WALLETCONNECT_CLIENT_ID",Xb="WALLETCONNECT_LINK_MODE_APPS",Ui={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},kI="subscription",HI="0.3",jI=_e.FIVE_SECONDS*1e3,WI="pairing",KI="0.3",ff={wc_pairingDelete:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:_e.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:_e.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:_e.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:0},res:{ttl:_e.ONE_DAY,prompt:!1,tag:0}}},qo={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},Sn={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},VI="history",GI="0.3",JI="expirer",on={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},YI="0.3",QI="verify-api",ZI="https://verify.walletconnect.com",e2="https://verify.walletconnect.org",lf=e2,XI=`${lf}/v3`,eM=[ZI,e2],tM="echo",rM="https://echo.walletconnect.com",rs={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},Ss={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},In={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},zo={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},ko={authenticated_session_approve_started:"authenticated_session_approve_started",authenticated_session_not_expired:"authenticated_session_not_expired",chains_caip2_compliant:"chains_caip2_compliant",chains_evm_compliant:"chains_evm_compliant",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve",authenticated_session_approve_publish_success:"authenticated_session_approve_publish_success"},hf={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",missing_session_authenticate_request:"missing_session_authenticate_request",session_authenticate_request_expired:"session_authenticate_request_expired",chains_caip2_compliant_failure:"chains_caip2_compliant_failure",chains_evm_compliant_failure:"chains_evm_compliant_failure",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},iM=.1,nM="event-client",sM=86400,oM="https://pulse.walletconnect.org/batch";function aM(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i<t.length;i++)t[i]=255;for(var n=0;n<r.length;n++){var s=r.charAt(n),a=s.charCodeAt(0);if(t[a]!==255)throw new TypeError(s+" is ambiguous");t[a]=n}var f=r.length,h=r.charAt(0),u=Math.log(f)/Math.log(256),g=Math.log(256)/Math.log(f);function w(O){if(O instanceof Uint8Array||(ArrayBuffer.isView(O)?O=new Uint8Array(O.buffer,O.byteOffset,O.byteLength):Array.isArray(O)&&(O=Uint8Array.from(O))),!(O instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(O.length===0)return"";for(var $=0,q=0,U=0,J=O.length;U!==J&&O[U]===0;)U++,$++;for(var ee=(J-U)*g+1>>>0,W=new Uint8Array(ee);U!==J;){for(var G=O[U],Q=0,A=ee-1;(G!==0||Q<q)&&A!==-1;A--,Q++)G+=256*W[A]>>>0,W[A]=G%f>>>0,G=G/f>>>0;if(G!==0)throw new Error("Non-zero carry");q=Q,U++}for(var z=ee-q;z!==ee&&W[z]===0;)z++;for(var te=h.repeat($);z<ee;++z)te+=r.charAt(W[z]);return te}function M(O){if(typeof O!="string")throw new TypeError("Expected String");if(O.length===0)return new Uint8Array;var $=0;if(O[$]!==" "){for(var q=0,U=0;O[$]===h;)q++,$++;for(var J=(O.length-$)*u+1>>>0,ee=new Uint8Array(J);O[$];){var W=t[O.charCodeAt($)];if(W===255)return;for(var G=0,Q=J-1;(W!==0||G<U)&&Q!==-1;Q--,G++)W+=f*ee[Q]>>>0,ee[Q]=W%256>>>0,W=W/256>>>0;if(W!==0)throw new Error("Non-zero carry");U=G,$++}if(O[$]!==" "){for(var A=J-U;A!==J&&ee[A]===0;)A++;for(var z=new Uint8Array(q+(J-A)),te=q;A!==J;)z[te++]=ee[A++];return z}}}function P(O){var $=M(O);if($)return $;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:M,decode:P}}var cM=aM,fM=cM;const t2=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},lM=r=>new TextEncoder().encode(r),hM=r=>new TextDecoder().decode(r);class uM{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class dM{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return r2(this,e)}}class pM{constructor(e){this.decoders=e}or(e){return r2(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const r2=(r,e)=>new pM(fi(fi({},r.decoders||{[r.prefix]:r}),e.decoders||{[e.prefix]:e}));class gM{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new uM(e,t,i),this.decoder=new dM(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const oh=({name:r,prefix:e,encode:t,decode:i})=>new gM(r,e,t,i),uf=({prefix:r,name:e,alphabet:t})=>{const{encode:i,decode:n}=fM(t,e);return oh({prefix:r,name:e,encode:i,decode:s=>t2(n(s))})},vM=(r,e,t,i)=>{const n={};for(let g=0;g<e.length;++g)n[e[g]]=g;let s=r.length;for(;r[s-1]==="=";)--s;const a=new Uint8Array(s*t/8|0);let f=0,h=0,u=0;for(let g=0;g<s;++g){const w=n[r[g]];if(w===void 0)throw new SyntaxError(`Non-${i} character`);h=h<<t|w,f+=t,f>=8&&(f-=8,a[u++]=255&h>>f)}if(f>=t||255&h<<8-f)throw new SyntaxError("Unexpected end of data");return a},mM=(r,e,t)=>{const i=e[e.length-1]==="=",n=(1<<t)-1;let s="",a=0,f=0;for(let h=0;h<r.length;++h)for(f=f<<8|r[h],a+=8;a>t;)a-=t,s+=e[n&f>>a];if(a&&(s+=e[n&f<<t-a]),i)for(;s.length*t&7;)s+="=";return s},Kr=({name:r,prefix:e,bitsPerChar:t,alphabet:i})=>oh({prefix:e,name:r,encode(n){return mM(n,i,t)},decode(n){return vM(n,i,t,r)}}),bM=oh({prefix:"\0",name:"identity",encode:r=>hM(r),decode:r=>lM(r)});var wM=Object.freeze({__proto__:null,identity:bM});const yM=Kr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var _M=Object.freeze({__proto__:null,base2:yM});const xM=Kr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var EM=Object.freeze({__proto__:null,base8:xM});const AM=uf({prefix:"9",name:"base10",alphabet:"0123456789"});var SM=Object.freeze({__proto__:null,base10:AM});const IM=Kr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),MM=Kr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var CM=Object.freeze({__proto__:null,base16:IM,base16upper:MM});const PM=Kr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),DM=Kr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),OM=Kr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),RM=Kr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),TM=Kr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),NM=Kr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),$M=Kr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),LM=Kr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),BM=Kr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var UM=Object.freeze({__proto__:null,base32:PM,base32upper:DM,base32pad:OM,base32padupper:RM,base32hex:TM,base32hexupper:NM,base32hexpad:$M,base32hexpadupper:LM,base32z:BM});const FM=uf({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),qM=uf({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var zM=Object.freeze({__proto__:null,base36:FM,base36upper:qM});const kM=uf({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),HM=uf({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var jM=Object.freeze({__proto__:null,base58btc:kM,base58flickr:HM});const WM=Kr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),KM=Kr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),VM=Kr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),GM=Kr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var JM=Object.freeze({__proto__:null,base64:WM,base64pad:KM,base64url:VM,base64urlpad:GM});const i2=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}"),YM=i2.reduce((r,e,t)=>(r[t]=e,r),[]),QM=i2.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function ZM(r){return r.reduce((e,t)=>(e+=YM[t],e),"")}function XM(r){const e=[];for(const t of r){const i=QM[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const eC=oh({prefix:"\u{1F680}",name:"base256emoji",encode:ZM,decode:XM});var tC=Object.freeze({__proto__:null,base256emoji:eC}),rC=s2,n2=128,iC=127,nC=~iC,sC=Math.pow(2,31);function s2(r,e,t){e=e||[],t=t||0;for(var i=t;r>=sC;)e[t++]=r&255|n2,r/=128;for(;r&nC;)e[t++]=r&255|n2,r>>>=7;return e[t]=r|0,s2.bytes=t-i+1,e}var oC=w0,aC=128,o2=127;function w0(r,i){var t=0,i=i||0,n=0,s=i,a,f=r.length;do{if(s>=f)throw w0.bytes=0,new RangeError("Could not decode varint");a=r[s++],t+=n<28?(a&o2)<<n:(a&o2)*Math.pow(2,n),n+=7}while(a>=aC);return w0.bytes=s-i,t}var cC=Math.pow(2,7),fC=Math.pow(2,14),lC=Math.pow(2,21),hC=Math.pow(2,28),uC=Math.pow(2,35),dC=Math.pow(2,42),pC=Math.pow(2,49),gC=Math.pow(2,56),vC=Math.pow(2,63),mC=function(r){return r<cC?1:r<fC?2:r<lC?3:r<hC?4:r<uC?5:r<dC?6:r<pC?7:r<gC?8:r<vC?9:10},bC={encode:rC,decode:oC,encodingLength:mC},a2=bC;const c2=(r,e,t=0)=>(a2.encode(r,e,t),e),f2=r=>a2.encodingLength(r),y0=(r,e)=>{const t=e.byteLength,i=f2(r),n=i+f2(t),s=new Uint8Array(n+t);return c2(r,s,0),c2(t,s,i),s.set(e,n),new wC(r,t,e,s)};class wC{constructor(e,t,i,n){this.code=e,this.size=t,this.digest=i,this.bytes=n}}const l2=({name:r,code:e,encode:t})=>new yC(r,e,t);class yC{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?y0(this.code,t):t.then(i=>y0(this.code,i))}else throw Error("Unknown type, must be binary type")}}const h2=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),_C=l2({name:"sha2-256",code:18,encode:h2("SHA-256")}),xC=l2({name:"sha2-512",code:19,encode:h2("SHA-512")});var EC=Object.freeze({__proto__:null,sha256:_C,sha512:xC});const u2=0,AC="identity",d2=t2;var SC=Object.freeze({__proto__:null,identity:{code:u2,name:AC,encode:d2,digest:r=>y0(u2,d2(r))}});new TextEncoder,new TextDecoder;const p2=fi(fi(fi(fi(fi(fi(fi(fi(fi(fi({},wM),_M),EM),SM),CM),UM),zM),jM),JM),tC);fi(fi({},EC),SC);function IC(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function g2(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const v2=g2("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),_0=g2("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=IC(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),MC=fi({utf8:v2,"utf-8":v2,hex:p2.base16,latin1:_0,ascii:_0,binary:_0},p2);function CC(r,e="utf8"){const t=MC[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):t.decoder.decode(`${t.prefix}${r}`)}class PC{constructor(e,t){this.core=e,this.logger=t,this.keychain=new Map,this.name=OI,this.version=RI,this.initialized=!1,this.storagePrefix=ts,this.init=async()=>{if(!this.initialized){const i=await this.getKeyChain();typeof i<"u"&&(this.keychain=i),this.initialized=!0}},this.has=i=>(this.isInitialized(),this.keychain.has(i)),this.set=async(i,n)=>{this.isInitialized(),this.keychain.set(i,n),await this.persist()},this.get=i=>{this.isInitialized();const n=this.keychain.get(i);if(typeof n>"u"){const{message:s}=xe("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(s)}return n},this.del=async i=>{this.isInitialized(),this.keychain.delete(i),await this.persist()},this.core=e,this.logger=ci(t,this.name)}get context(){return yi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,Bm(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Um(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}}class DC{constructor(e,t,i){this.core=e,this.logger=t,this.name=PI,this.randomSessionIdentifier=Xd(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=n=>(this.isInitialized(),this.keychain.has(n)),this.getClientId=async()=>{this.isInitialized();const n=await this.getClientSeed(),s=Om(n);return Dm(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const n=bE();return this.setPrivateKey(n.publicKey,n.privateKey)},this.signJWT=async n=>{this.isInitialized();const s=await this.getClientSeed(),a=Om(s),f=this.randomSessionIdentifier;return await Mx(f,n,DI,a)},this.generateSharedKey=(n,s,a)=>{this.isInitialized();const f=this.getPrivateKey(n),h=wE(f,s);return this.setSymKey(h,a)},this.setSymKey=async(n,s)=>{this.isInitialized();const a=s||Hl(n);return await this.keychain.set(a,n),a},this.deleteKeyPair=async n=>{this.isInitialized(),await this.keychain.del(n)},this.deleteSymKey=async n=>{this.isInitialized(),await this.keychain.del(n)},this.encode=async(n,s,a)=>{this.isInitialized();const f=rb(a),h=bs(s);if(nb(f))return _E(h,a?.encoding);if(ib(f)){const M=f.senderPublicKey,P=f.receiverPublicKey;n=await this.generateSharedKey(M,P)}const u=this.getSymKey(n),{type:g,senderPublicKey:w}=f;return yE({type:g,symKey:u,message:h,senderPublicKey:w,encoding:a?.encoding})},this.decode=async(n,s,a)=>{this.isInitialized();const f=AE(s,a);if(nb(f)){const h=EE(s,a?.encoding);return Ro(h)}if(ib(f)){const h=f.receiverPublicKey,u=f.senderPublicKey;n=await this.generateSharedKey(h,u)}try{const h=this.getSymKey(n),u=xE({symKey:h,encoded:s,encoding:a?.encoding});return Ro(u)}catch(h){this.logger.error(`Failed to decode message from topic: '${n}', clientId: '${await this.getClientId()}'`),this.logger.error(h)}},this.getPayloadType=(n,s=Ys)=>{const a=Qc({encoded:n,encoding:s});return Lo(a.type)},this.getPayloadSenderPublicKey=(n,s=Ys)=>{const a=Qc({encoded:n,encoding:s});return a.senderPublicKey?NS(a.senderPublicKey,oi):void 0},this.core=e,this.logger=ci(t,this.name),this.keychain=i||new PC(this.core,this.logger)}get context(){return yi(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(Jb)}catch{e=Xd(),await this.keychain.set(Jb,e)}return CC(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}}class OC extends _S{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=TI,this.version=NI,this.initialized=!1,this.storagePrefix=ts,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const i=await this.getRelayerMessages();typeof i<"u"&&(this.messages=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}finally{this.initialized=!0}}},this.set=async(i,n)=>{this.isInitialized();const s=ys(n);let a=this.messages.get(i);return typeof a>"u"&&(a={}),typeof a[s]<"u"||(a[s]=n,this.messages.set(i,a),await this.persist()),s},this.get=i=>{this.isInitialized();let n=this.messages.get(i);return typeof n>"u"&&(n={}),n},this.has=(i,n)=>{this.isInitialized();const s=this.get(i),a=ys(n);return typeof s[a]<"u"},this.del=async i=>{this.isInitialized(),this.messages.delete(i),await this.persist()},this.logger=ci(e,this.name),this.core=t}get context(){return yi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,Bm(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Um(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}}var RC=Object.defineProperty,TC=Object.defineProperties,NC=Object.getOwnPropertyDescriptors,m2=Object.getOwnPropertySymbols,$C=Object.prototype.hasOwnProperty,LC=Object.prototype.propertyIsEnumerable,b2=(r,e,t)=>e in r?RC(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,w2=(r,e)=>{for(var t in e||(e={}))$C.call(e,t)&&b2(r,t,e[t]);if(m2)for(var t of m2(e))LC.call(e,t)&&b2(r,t,e[t]);return r},y2=(r,e)=>TC(r,NC(e));class BC extends xS{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new zr.exports.EventEmitter,this.name=$I,this.queue=new Map,this.publishTimeout=_e.toMiliseconds(_e.ONE_MINUTE),this.initialPublishTimeout=_e.toMiliseconds(_e.ONE_SECOND*15),this.needsTransportRestart=!1,this.publish=async(i,n,s)=>{var a;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:n,opts:s}});const f=s?.ttl||Yb,h=jl(s),u=s?.prompt||!1,g=s?.tag||0,w=s?.id||Fo().toString(),M={topic:i,message:n,opts:{ttl:f,relay:h,prompt:u,tag:g,id:w,attestation:s?.attestation}},P=`Failed to publish payload, please try again. id:${w} tag:${g}`;try{const O=new Promise(async $=>{const q=({id:J})=>{M.opts.id===J&&(this.removeRequestFromQueue(J),this.relayer.events.removeListener(Lr.publish,q),$(M))};this.relayer.events.on(Lr.publish,q);const U=Gs(new Promise((J,ee)=>{this.rpcPublish({topic:i,message:n,ttl:f,prompt:u,tag:g,id:w,attestation:s?.attestation}).then(J).catch(W=>{this.logger.warn(W,W?.message),ee(W)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${w} tag:${g}`);try{await U,this.events.removeListener(Lr.publish,q)}catch(J){this.queue.set(w,y2(w2({},M),{attempt:1})),this.logger.warn(J,J?.message)}});this.logger.trace({type:"method",method:"publish",params:{id:w,topic:i,message:n,opts:s}}),await Gs(O,this.publishTimeout,P)}catch(O){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(O),(a=s?.internal)!=null&&a.throwOnFailedPublish)throw O}finally{this.queue.delete(w)}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.relayer=e,this.logger=ci(t,this.name),this.registerEventListeners()}get context(){return yi(this.logger)}async rpcPublish(e){var t,i,n,s;const{topic:a,message:f,ttl:h=Yb,prompt:u,tag:g,id:w,attestation:M}=e,P={method:Zc(jl().protocol).publish,params:{topic:a,message:f,ttl:h,prompt:u,tag:g,attestation:M},id:w};ai((t=P.params)==null?void 0:t.prompt)&&((i=P.params)==null||delete i.prompt),ai((n=P.params)==null?void 0:n.tag)&&((s=P.params)==null||delete s.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:P});const O=await this.relayer.request(P);return this.relayer.events.emit(Lr.publish,e),this.logger.debug("Successfully Published Payload"),O}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async(e,t)=>{const i=e.attempt+1;this.queue.set(t,y2(w2({},e),{attempt:i}));const{topic:n,message:s,opts:a,attestation:f}=e;this.logger.warn({},`Publisher: queue->publishing: ${e.opts.id}, tag: ${e.opts.tag}, attempt: ${i}`),await this.rpcPublish({topic:n,message:s,ttl:a.ttl,prompt:a.prompt,tag:a.tag,id:a.id,attestation:f}),this.logger.warn({},`Publisher: queue->published: ${e.opts.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(ka.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(Lr.connection_stalled);return}this.checkQueue()}),this.relayer.on(Lr.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class UC{constructor(){this.map=new Map,this.set=(e,t)=>{const i=this.get(e);this.exists(e,t)||this.map.set(e,[...i,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const i=this.get(e);if(!this.exists(e,t))return;const n=i.filter(s=>s!==t);if(!n.length){this.map.delete(e);return}this.map.set(e,n)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var FC=Object.defineProperty,qC=Object.defineProperties,zC=Object.getOwnPropertyDescriptors,_2=Object.getOwnPropertySymbols,kC=Object.prototype.hasOwnProperty,HC=Object.prototype.propertyIsEnumerable,x2=(r,e,t)=>e in r?FC(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,df=(r,e)=>{for(var t in e||(e={}))kC.call(e,t)&&x2(r,t,e[t]);if(_2)for(var t of _2(e))HC.call(e,t)&&x2(r,t,e[t]);return r},x0=(r,e)=>qC(r,zC(e));class jC extends SS{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new UC,this.events=new zr.exports.EventEmitter,this.name=kI,this.version=HI,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=ts,this.subscribeTimeout=_e.toMiliseconds(_e.ONE_MINUTE),this.initialSubscribeTimeout=_e.toMiliseconds(_e.ONE_SECOND*15),this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(i,n)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}});try{const s=jl(n),a={topic:i,relay:s,transportType:n?.transportType};this.pending.set(i,a);const f=await this.rpcSubscribe(i,s,n);return typeof f=="string"&&(this.onSubscribe(f,a),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}})),f}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(i,n)=>{await this.restartToComplete(),this.isInitialized(),typeof n?.id<"u"?await this.unsubscribeById(i,n.id,n):await this.unsubscribeByTopic(i,n)},this.isSubscribed=async i=>{if(this.topics.includes(i))return!0;const n=`${this.pendingSubscriptionWatchLabel}_${i}`;return await new Promise((s,a)=>{const f=new _e.Watch;f.start(n);const h=setInterval(()=>{(!this.pending.has(i)&&this.topics.includes(i)||this.cached.some(u=>u.topic===i))&&(clearInterval(h),f.stop(n),s(!0)),f.elapsed(n)>=jI&&(clearInterval(h),f.stop(n),a(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{await this.restore(),await this.onRestart()},this.checkPending=async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const i=[];this.pending.forEach(n=>{i.push(n)}),await this.batchSubscribe(i)},this.registerEventListeners=()=>{this.relayer.core.heartbeat.on(ka.pulse,async()=>{await this.checkPending()}),this.events.on(Ui.created,async i=>{const n=Ui.created;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:i}),await this.persist()}),this.events.on(Ui.deleted,async i=>{const n=Ui.deleted;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:i}),await this.persist()})},this.relayer=e,this.logger=ci(t,this.name),this.clientId=""}get context(){return yi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let i=!1;try{i=this.getSubscription(e).topic===t}catch{}return i}reset(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const i=this.topicMap.get(e);await Promise.all(i.map(async n=>await this.unsubscribeById(e,n,t)))}async unsubscribeById(e,t,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}});try{const n=jl(i);await this.rpcUnsubscribe(e,t,n);const s=Gt("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}})}catch(n){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(n),n}}async rpcSubscribe(e,t,i){var n;i?.transportType===sr.relay&&await this.restartToComplete();const s={method:Zc(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const a=(n=i?.internal)==null?void 0:n.throwOnFailedPublish;try{const f=this.getSubscriptionId(e);if(i?.transportType===sr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(g=>this.logger.warn(g))},_e.toMiliseconds(_e.ONE_SECOND)),f;const h=new Promise(async g=>{const w=M=>{M.topic===e&&(this.events.removeListener(Ui.created,w),g(M.id))};this.events.on(Ui.created,w);try{const M=await Gs(new Promise((P,O)=>{this.relayer.request(s).catch($=>{this.logger.warn($,$?.message),O($)}).then(P)}),this.initialSubscribeTimeout,`Subscribing to ${e} failed, please try again`);this.events.removeListener(Ui.created,w),g(M)}catch{}}),u=await Gs(h,this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!u&&a)throw new Error(`Subscribing to ${e} failed, please try again`);return u?f:null}catch(f){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Lr.connection_stalled),a)throw f}return null}async rpcBatchSubscribe(e){if(!e.length)return;const t=e[0].relay,i={method:Zc(t.protocol).batchSubscribe,params:{topics:e.map(n=>n.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{await await Gs(new Promise(n=>{this.relayer.request(i).catch(s=>this.logger.warn(s)).then(n)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(Lr.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const t=e[0].relay,i={method:Zc(t.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});let n;try{n=await await Gs(new Promise((s,a)=>{this.relayer.request(i).catch(f=>{this.logger.warn(f),a(f)}).then(s)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(Lr.connection_stalled)}return n}rpcUnsubscribe(e,t,i){const n={method:Zc(i.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),this.relayer.request(n)}onSubscribe(e,t){this.setSubscription(e,x0(df({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach(t=>{this.setSubscription(t.id,df({},t)),this.pending.delete(t.topic)})}async onUnsubscribe(e,t,i){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,i),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t)}addSubscription(e,t){this.subscriptions.set(e,df({},t)),this.topicMap.set(t.topic,e),this.events.emit(Ui.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:i}=xe("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const i=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(i.topic,e),this.events.emit(Ui.deleted,x0(df({},i),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Ui.sync)}async onRestart(){if(this.cached.length){const e=[...this.cached],t=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let i=0;i<t;i++){const n=e.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(n)}}this.events.emit(Ui.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:t}=xe("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){e.length&&(await this.rpcBatchSubscribe(e),this.onBatchSubscribe(e.map(t=>x0(df({},t),{id:this.getSubscriptionId(t.topic)}))))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const t=await this.rpcBatchFetchMessages(e);t&&t.messages&&(await Vx(_e.toMiliseconds(_e.ONE_SECOND)),await this.relayer.handleBatchMessageEvents(t.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen()}getSubscriptionId(e){return ys(e+this.clientId)}}var WC=Object.defineProperty,E2=Object.getOwnPropertySymbols,KC=Object.prototype.hasOwnProperty,VC=Object.prototype.propertyIsEnumerable,A2=(r,e,t)=>e in r?WC(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,S2=(r,e)=>{for(var t in e||(e={}))KC.call(e,t)&&A2(r,t,e[t]);if(E2)for(var t of E2(e))VC.call(e,t)&&A2(r,t,e[t]);return r};class GC extends ES{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new zr.exports.EventEmitter,this.name=BI,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1,this.heartBeatTimeout=_e.toMiliseconds(_e.THIRTY_SECONDS+_e.FIVE_SECONDS),this.requestsInFlight=[],this.connectTimeout=_e.toMiliseconds(_e.ONE_SECOND*15),this.request=async t=>{var i,n;this.logger.debug("Publishing Request Payload");const s=t.id||Fo().toString();await this.toEstablishConnection();try{this.logger.trace({id:s,method:t.method,topic:(i=t.params)==null?void 0:i.topic},"relayer.request - publishing...");const a=`${s}:${((n=t.params)==null?void 0:n.tag)||""}`;this.requestsInFlight.push(a);const f=await this.provider.request(t);return this.requestsInFlight=this.requestsInFlight.filter(h=>h!==a),f}catch(a){throw this.logger.debug(`Failed to Publish Request: ${s}`),a}},this.resetPingTimeout=()=>{if(Fl())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var t,i,n;this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(n=(i=(t=this.provider)==null?void 0:t.connection)==null?void 0:i.socket)==null||n.terminate()},this.heartBeatTimeout)}catch(t){this.logger.warn(t,t?.message)}},this.onPayloadHandler=t=>{this.onProviderPayload(t),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.warn({},"Relayer connected \u{1F6DC}"),this.startPingTimeout(),this.events.emit(Lr.connect)},this.onDisconnectHandler=()=>{this.logger.warn({},"Relayer disconnected \u{1F6D1}"),this.requestsInFlight=[],this.onProviderDisconnect()},this.onProviderErrorHandler=t=>{this.logger.fatal(t,`Fatal socket error: ${t?.message}`),this.events.emit(Lr.error,t),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(sn.payload,this.onPayloadHandler),this.provider.on(sn.connect,this.onConnectHandler),this.provider.on(sn.disconnect,this.onDisconnectHandler),this.provider.on(sn.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?ci(e.logger,this.name):Zn(th({level:e.logger||LI})),this.messages=new OC(this.logger,e.core),this.subscriber=new jC(this,this.logger),this.publisher=new BC(this,this.logger),this.relayUrl=e?.relayUrl||Zb,this.projectId=e.projectId,Rx()?this.packageName=Nm():Tx()&&(this.bundleId=Nm()),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e,e?.message)}}get context(){return yi(this.logger)}get connected(){var e,t,i;return((i=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:i.readyState)===1}get connecting(){var e,t,i;return((i=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:i.readyState)===0}async publish(e,t,i){this.isInitialized(),await this.publisher.publish(e,t,i),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now(),transportType:sr.relay})}async subscribe(e,t){var i,n,s;this.isInitialized(),(!(t!=null&&t.transportType)||t?.transportType==="relay")&&await this.toEstablishConnection();const a=typeof((i=t?.internal)==null?void 0:i.throwOnFailedPublish)>"u"?!0:(n=t?.internal)==null?void 0:n.throwOnFailedPublish;let f=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",h;const u=g=>{g.topic===e&&(this.subscriber.off(Ui.created,u),h())};return await Promise.all([new Promise(g=>{h=g,this.subscriber.on(Ui.created,u)}),new Promise(async(g,w)=>{f=await this.subscriber.subscribe(e,S2({internal:{throwOnFailedPublish:a}},t)).catch(M=>{a&&w(M)})||f,g()})]),f}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Gs(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise(async(t,i)=>{await this.connect(e).then(t).catch(i).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw new Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(e){this.logger.debug({},"Restarting transport..."),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await pb())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if(e?.length===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const t=e.sort((i,n)=>i.publishedAt-n.publishedAt);this.logger.debug(`Batch of ${t.length} message events sorted`);for(const i of t)try{await this.onMessageEvent(i)}catch(n){this.logger.warn(n,"Error while processing batch message event: "+n?.message)}this.logger.trace(`Batch of ${t.length} message events processed`)}async onLinkMessageEvent(e,t){const{topic:i}=e;if(!t.sessionExists){const n=Ir(_e.FIVE_MINUTES),s={topic:i,expiry:n,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(i,s)}this.events.emit(Lr.message,e),await this.recordMessageEvent(e)}async connect(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let t=1;for(;t<6;){try{this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${t}...`),await this.createProvider(),await new Promise(async(i,n)=>{const s=()=>{n(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(sn.disconnect,s),await Gs(new Promise((a,f)=>{this.provider.connect().then(a).catch(f)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(a=>{n(a)}).finally(()=>{this.provider.off(sn.disconnect,s),clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),await new Promise(async(a,f)=>{const h=()=>{f(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(sn.disconnect,h),await this.subscriber.start().then(a).catch(f).finally(()=>{this.provider.off(sn.disconnect,h)})}),this.hasExperiencedNetworkDisruption=!1,i()})}catch(i){await this.subscriber.stop();const n=i;this.logger.warn({},n.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${t}`);break}await new Promise(i=>setTimeout(i,_e.toMiliseconds(t*1))),t++}}startPingTimeout(){var e,t,i,n,s;if(Fl())try{(t=(e=this.provider)==null?void 0:e.connection)!=null&&t.socket&&((s=(n=(i=this.provider)==null?void 0:i.connection)==null?void 0:n.socket)==null||s.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(a){this.logger.warn(a,a?.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new nn(new xI(Bx({sdkVersion:b0,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:t,message:i}=e;await this.messages.set(t,i)}async shouldIgnoreMessageEvent(e){const{topic:t,message:i}=e;if(!i||i.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${i}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.warn(`Ignoring message for non-subscribed topic ${t}`),!0;const n=this.messages.has(t,i);return n&&this.logger.warn(`Ignoring duplicate message: ${i}`),n}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),v0(e)){if(!e.method.endsWith(UI))return;const t=e.params,{topic:i,message:n,publishedAt:s,attestation:a}=t.data,f={topic:i,message:n,publishedAt:s,transportType:sr.relay,attestation:a};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(S2({type:"event",event:t.id},f)),this.events.emit(t.id,f),await this.acknowledgePayload(e),await this.onMessageEvent(f)}else nh(e)&&this.events.emit(Lr.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Lr.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const t=rh(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(sn.payload,this.onPayloadHandler),this.provider.off(sn.connect,this.onConnectHandler),this.provider.off(sn.disconnect,this.onDisconnectHandler),this.provider.off(sn.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await pb();hA(async t=>{e!==t&&(e=t,t?await this.transportOpen().catch(i=>this.logger.error(i,i?.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),clearTimeout(this.pingTimeout),this.events.emit(Lr.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||this.connectPromise||(this.reconnectTimeout=setTimeout(async()=>{clearTimeout(this.reconnectTimeout),await this.transportOpen().catch(e=>this.logger.error(e,e?.message))},_e.toMiliseconds(FI))))}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&await this.transportOpen()}}var JC=Object.defineProperty,I2=Object.getOwnPropertySymbols,YC=Object.prototype.hasOwnProperty,QC=Object.prototype.propertyIsEnumerable,M2=(r,e,t)=>e in r?JC(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,C2=(r,e)=>{for(var t in e||(e={}))YC.call(e,t)&&M2(r,t,e[t]);if(I2)for(var t of I2(e))QC.call(e,t)&&M2(r,t,e[t]);return r};class Ho extends AS{constructor(e,t,i,n=ts,s=void 0){super(e,t,i,n),this.core=e,this.logger=t,this.name=i,this.map=new Map,this.version=qI,this.cached=[],this.initialized=!1,this.storagePrefix=ts,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(a=>{this.getKey&&a!==null&&!ai(a)?this.map.set(this.getKey(a),a):kE(a)?this.map.set(a.id,a):HE(a)&&this.map.set(a.topic,a)}),this.cached=[],this.initialized=!0)},this.set=async(a,f)=>{this.isInitialized(),this.map.has(a)?await this.update(a,f):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:a,value:f}),this.map.set(a,f),await this.persist())},this.get=a=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:a}),this.getData(a)),this.getAll=a=>(this.isInitialized(),a?this.values.filter(f=>Object.keys(a).every(h=>EI(f[h],a[h]))):this.values),this.update=async(a,f)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:a,update:f});const h=C2(C2({},this.getData(a)),f);this.map.set(a,h),await this.persist()},this.delete=async(a,f)=>{this.isInitialized(),this.map.has(a)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:a,reason:f}),this.map.delete(a),this.addToRecentlyDeleted(a),await this.persist())},this.logger=ci(t,this.name),this.storagePrefix=n,this.getKey=s}get context(){return yi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){const{message:n}=xe("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}const{message:i}=xe("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:t}=xe("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}}class ZC{constructor(e,t){this.core=e,this.logger=t,this.name=WI,this.version=KI,this.events=new zr.exports,this.initialized=!1,this.storagePrefix=ts,this.ignoredPayloadTypes=[ws],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:i})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...i])]},this.create=async i=>{this.isInitialized();const n=Xd(),s=await this.core.crypto.setSymKey(n),a=Ir(_e.FIVE_MINUTES),f={protocol:Qb},h={topic:s,expiry:a,relay:f,active:!1,methods:i?.methods},u=ob({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:n,relay:f,expiryTimestamp:a,methods:i?.methods});return this.events.emit(qo.create,h),this.core.expirer.set(s,a),await this.pairings.set(s,h),await this.core.relayer.subscribe(s,{transportType:i?.transportType}),{topic:s,uri:u}},this.pair=async i=>{this.isInitialized();const n=this.core.eventClient.createEvent({properties:{topic:i?.uri,trace:[rs.pairing_started]}});this.isValidPair(i,n);const{topic:s,symKey:a,relay:f,expiryTimestamp:h,methods:u}=sb(i.uri);n.props.properties.topic=s,n.addTrace(rs.pairing_uri_validation_success),n.addTrace(rs.pairing_uri_not_expired);let g;if(this.pairings.keys.includes(s)){if(g=this.pairings.get(s),n.addTrace(rs.existing_pairing),g.active)throw n.setError(Ss.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);n.addTrace(rs.pairing_not_expired)}const w=h||Ir(_e.FIVE_MINUTES),M={topic:s,relay:f,expiry:w,active:!1,methods:u};this.core.expirer.set(s,w),await this.pairings.set(s,M),n.addTrace(rs.store_new_pairing),i.activatePairing&&await this.activate({topic:s}),this.events.emit(qo.create,M),n.addTrace(rs.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(a,s),n.addTrace(rs.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{n.setError(Ss.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:f})}catch(P){throw n.setError(Ss.subscribe_pairing_topic_failure),P}return n.addTrace(rs.subscribe_pairing_topic_success),M},this.activate=async({topic:i})=>{this.isInitialized();const n=Ir(_e.FIVE_MINUTES);this.core.expirer.set(i,n),await this.pairings.update(i,{active:!0,expiry:n})},this.ping=async i=>{this.isInitialized(),await this.isValidPing(i),this.logger.warn("ping() is deprecated and will be removed in the next major release.");const{topic:n}=i;if(this.pairings.keys.includes(n)){const s=await this.sendRequest(n,"wc_pairingPing",{}),{done:a,resolve:f,reject:h}=No();this.events.once(Dt("pairing_ping",s),({error:u})=>{u?h(u):f()}),await a()}},this.updateExpiry=async({topic:i,expiry:n})=>{this.isInitialized(),await this.pairings.update(i,{expiry:n})},this.updateMetadata=async({topic:i,metadata:n})=>{this.isInitialized(),await this.pairings.update(i,{peerMetadata:n})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async i=>{this.isInitialized(),await this.isValidDisconnect(i);const{topic:n}=i;this.pairings.keys.includes(n)&&(await this.sendRequest(n,"wc_pairingDelete",Gt("USER_DISCONNECTED")),await this.deletePairing(n))},this.formatUriFromPairing=i=>{this.isInitialized();const{topic:n,relay:s,expiry:a,methods:f}=i,h=this.core.crypto.keychain.get(n);return ob({protocol:this.core.protocol,version:this.core.version,topic:n,symKey:h,relay:s,expiryTimestamp:a,methods:f})},this.sendRequest=async(i,n,s)=>{const a=Qs(n,s),f=await this.core.crypto.encode(i,a),h=ff[n].req;return this.core.history.set(i,a),this.core.relayer.publish(i,f,h),a.id},this.sendResult=async(i,n,s)=>{const a=rh(i,s),f=await this.core.crypto.encode(n,a),h=await this.core.history.get(n,i),u=ff[h.request.method].res;await this.core.relayer.publish(n,f,u),await this.core.history.resolve(a)},this.sendError=async(i,n,s)=>{const a=ih(i,s),f=await this.core.crypto.encode(n,a),h=await this.core.history.get(n,i),u=ff[h.request.method]?ff[h.request.method].res:ff.unregistered_method.res;await this.core.relayer.publish(n,f,u),await this.core.history.resolve(a)},this.deletePairing=async(i,n)=>{await this.core.relayer.unsubscribe(i),await Promise.all([this.pairings.delete(i,Gt("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(i),n?Promise.resolve():this.core.expirer.del(i)])},this.cleanup=async()=>{const i=this.pairings.getAll().filter(n=>Js(n.expiry));await Promise.all(i.map(n=>this.deletePairing(n.topic)))},this.onRelayEventRequest=i=>{const{topic:n,payload:s}=i;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(n,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(n,s);default:return this.onUnknownRpcMethodRequest(n,s)}},this.onRelayEventResponse=async i=>{const{topic:n,payload:s}=i,a=(await this.core.history.get(n,s.id)).request.method;switch(a){case"wc_pairingPing":return this.onPairingPingResponse(n,s);default:return this.onUnknownRpcMethodResponse(a)}},this.onPairingPingRequest=async(i,n)=>{const{id:s}=n;try{this.isValidPing({topic:i}),await this.sendResult(s,i,!0),this.events.emit(qo.ping,{id:s,topic:i})}catch(a){await this.sendError(s,i,a),this.logger.error(a)}},this.onPairingPingResponse=(i,n)=>{const{id:s}=n;setTimeout(()=>{es(n)?this.events.emit(Dt("pairing_ping",s),{}):rn(n)&&this.events.emit(Dt("pairing_ping",s),{error:n.error})},500)},this.onPairingDeleteRequest=async(i,n)=>{const{id:s}=n;try{this.isValidDisconnect({topic:i}),await this.deletePairing(i),this.events.emit(qo.delete,{id:s,topic:i})}catch(a){await this.sendError(s,i,a),this.logger.error(a)}},this.onUnknownRpcMethodRequest=async(i,n)=>{const{id:s,method:a}=n;try{if(this.registeredMethods.includes(a))return;const f=Gt("WC_METHOD_UNSUPPORTED",a);await this.sendError(s,i,f),this.logger.error(f)}catch(f){await this.sendError(s,i,f),this.logger.error(f)}},this.onUnknownRpcMethodResponse=i=>{this.registeredMethods.includes(i)||this.logger.error(Gt("WC_METHOD_UNSUPPORTED",i))},this.isValidPair=(i,n)=>{var s;if(!bi(i)){const{message:f}=xe("MISSING_OR_INVALID",`pair() params: ${i}`);throw n.setError(Ss.malformed_pairing_uri),new Error(f)}if(!zE(i.uri)){const{message:f}=xe("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw n.setError(Ss.malformed_pairing_uri),new Error(f)}const a=sb(i?.uri);if(!((s=a?.relay)!=null&&s.protocol)){const{message:f}=xe("MISSING_OR_INVALID","pair() uri#relay-protocol");throw n.setError(Ss.malformed_pairing_uri),new Error(f)}if(!(a!=null&&a.symKey)){const{message:f}=xe("MISSING_OR_INVALID","pair() uri#symKey");throw n.setError(Ss.malformed_pairing_uri),new Error(f)}if(a!=null&&a.expiryTimestamp&&_e.toMiliseconds(a?.expiryTimestamp)<Date.now()){n.setError(Ss.pairing_expired);const{message:f}=xe("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(f)}},this.isValidPing=async i=>{if(!bi(i)){const{message:s}=xe("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(s)}const{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidDisconnect=async i=>{if(!bi(i)){const{message:s}=xe("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(s)}const{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidPairingTopic=async i=>{if(!wr(i,!1)){const{message:n}=xe("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(n)}if(!this.pairings.keys.includes(i)){const{message:n}=xe("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(n)}if(Js(this.pairings.get(i).expiry)){await this.deletePairing(i);const{message:n}=xe("EXPIRED",`pairing topic: ${i}`);throw new Error(n)}},this.core=e,this.logger=ci(t,this.name),this.pairings=new Ho(this.core,this.logger,this.name,this.storagePrefix)}get context(){return yi(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Lr.message,async e=>{const{topic:t,message:i,transportType:n}=e;if(!this.pairings.keys.includes(t)||n===sr.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))return;const s=await this.core.crypto.decode(t,i);try{v0(s)?(this.core.history.set(t,s),this.onRelayEventRequest({topic:t,payload:s})):nh(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:t,payload:s}),this.core.history.delete(t,s.id))}catch(a){this.logger.error(a)}})}registerExpirerEvents(){this.core.expirer.on(on.expired,async e=>{const{topic:t}=qm(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(qo.expire,{topic:t}))})}}class XC extends yS{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new zr.exports.EventEmitter,this.name=VI,this.version=GI,this.cached=[],this.initialized=!1,this.storagePrefix=ts,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.records.set(i.id,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(i,n,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:i,request:n,chainId:s}),this.records.has(n.id))return;const a={id:n.id,topic:i,request:{method:n.method,params:n.params||null},chainId:s,expiry:Ir(_e.THIRTY_DAYS)};this.records.set(a.id,a),this.persist(),this.events.emit(Sn.created,a)},this.resolve=async i=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:i}),!this.records.has(i.id))return;const n=await this.getRecord(i.id);typeof n.response>"u"&&(n.response=rn(i)?{error:i.error}:{result:i.result},this.records.set(n.id,n),this.persist(),this.events.emit(Sn.updated,n))},this.get=async(i,n)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:i,id:n}),await this.getRecord(n)),this.delete=(i,n)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:n}),this.values.forEach(s=>{if(s.topic===i){if(typeof n<"u"&&s.id!==n)return;this.records.delete(s.id),this.events.emit(Sn.deleted,s)}}),this.persist()},this.exists=async(i,n)=>(this.isInitialized(),this.records.has(n)?(await this.getRecord(n)).topic===i:!1),this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=ci(t,this.name)}get context(){return yi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(t=>{if(typeof t.response<"u")return;const i={topic:t.topic,request:Qs(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(i)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const t=this.records.get(e);if(!t){const{message:i}=xe("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Sn.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:t}=xe("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Sn.created,e=>{const t=Sn.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(Sn.updated,e=>{const t=Sn.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(Sn.deleted,e=>{const t=Sn.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.core.heartbeat.on(ka.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(t=>{_e.toMiliseconds(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.records.delete(t.id),this.events.emit(Sn.deleted,t,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}}class eP extends IS{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new zr.exports.EventEmitter,this.name=JI,this.version=YI,this.cached=[],this.initialized=!1,this.storagePrefix=ts,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.expirations.set(i.target,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=i=>{try{const n=this.formatTarget(i);return typeof this.getExpiration(n)<"u"}catch{return!1}},this.set=(i,n)=>{this.isInitialized();const s=this.formatTarget(i),a={target:s,expiry:n};this.expirations.set(s,a),this.checkExpiry(s,a),this.events.emit(on.created,{target:s,expiration:a})},this.get=i=>{this.isInitialized();const n=this.formatTarget(i);return this.getExpiration(n)},this.del=i=>{if(this.isInitialized(),this.has(i)){const n=this.formatTarget(i),s=this.getExpiration(n);this.expirations.delete(n),this.events.emit(on.deleted,{target:n,expiration:s})}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=ci(t,this.name)}get context(){return yi(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return Ux(e);if(typeof e=="number")return Fx(e);const{message:t}=xe("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(on.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:t}=xe("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:i}=xe("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(i),new Error(i)}return t}checkExpiry(e,t){const{expiry:i}=t;_e.toMiliseconds(i)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(on.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(ka.pulse,()=>this.checkExpirations()),this.events.on(on.created,e=>{const t=on.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(on.expired,e=>{const t=on.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(on.deleted,e=>{const t=on.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}}class tP extends MS{constructor(e,t,i){super(e,t,i),this.core=e,this.logger=t,this.store=i,this.name=QI,this.verifyUrlV3=XI,this.storagePrefix=ts,this.version=Gb,this.init=async()=>{var n;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&_e.toMiliseconds((n=this.publicKey)==null?void 0:n.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))},this.register=async n=>{if(!jc()||this.isDevEnv)return;const s=window.location.origin,{id:a,decryptedId:f}=n,h=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${a}&decryptedId=${f}`;try{const u=Oc(),g=this.startAbortTimer(_e.ONE_SECOND*5),w=await new Promise((M,P)=>{const O=()=>{window.removeEventListener("message",q),u.body.removeChild($),P("attestation aborted")};this.abortController.signal.addEventListener("abort",O);const $=u.createElement("iframe");$.src=h,$.style.display="none",$.addEventListener("error",O,{signal:this.abortController.signal});const q=U=>{if(U.data&&typeof U.data=="string")try{const J=JSON.parse(U.data);if(J.type==="verify_attestation"){if(Gd(J.attestation).payload.id!==a)return;clearInterval(g),u.body.removeChild($),this.abortController.signal.removeEventListener("abort",O),window.removeEventListener("message",q),M(J.attestation===null?"":J.attestation)}}catch(J){this.logger.warn(J)}};u.body.appendChild($),window.addEventListener("message",q,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",w),w}catch(u){this.logger.warn(u)}return""},this.resolve=async n=>{if(this.isDevEnv)return"";const{attestationId:s,hash:a,encryptedId:f}=n;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(Gd(s).payload.id!==f)return;const u=await this.isValidJwtAttestation(s);if(u){if(!u.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return u}}if(!a)return;const h=this.getVerifyUrl(n?.verifyUrl);return this.fetchAttestation(a,h)},this.fetchAttestation=async(n,s)=>{this.logger.debug(`resolving attestation: ${n} from url: ${s}`);const a=this.startAbortTimer(_e.ONE_SECOND*5),f=await fetch(`${s}/attestation/${n}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(a),f.status===200?await f.json():void 0},this.getVerifyUrl=n=>{let s=n||lf;return eM.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${lf}`),s=lf),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const n=this.startAbortTimer(_e.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(n),await s.json()}catch(n){this.logger.warn(n)}},this.persistPublicKey=async n=>{this.logger.debug("persisting public key to local storage",n),await this.store.setItem(this.storeKey,n),this.publicKey=n},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async n=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(n,s)}catch(f){this.logger.error(f),this.logger.warn("error validating attestation")}const a=await this.fetchAndPersistPublicKey();try{if(a)return this.validateAttestation(n,a)}catch(f){this.logger.error(f),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const a=await this.fetchPublicKey();a&&(await this.persistPublicKey(a),s(a))});const n=await this.fetchPromise;return this.fetchPromise=void 0,n},this.validateAttestation=(n,s)=>{const a=CE(n,s.publicKey),f={hasExpired:_e.toMiliseconds(a.exp)<Date.now(),payload:a};if(f.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:f.payload.origin,isScam:f.payload.isScam,isVerified:f.payload.isVerified}},this.logger=ci(t,this.name),this.abortController=new AbortController,this.isDevEnv=Jd(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return yi(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),_e.toMiliseconds(e))}}class rP extends CS{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.context=tM,this.registerDeviceToken=async i=>{const{clientId:n,token:s,notificationType:a,enableEncrypted:f=!1}=i,h=`${rM}/${this.projectId}/clients`;await fetch(h,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:n,type:a,token:s,always_raw:f})})},this.logger=ci(t,this.context)}}var iP=Object.defineProperty,P2=Object.getOwnPropertySymbols,nP=Object.prototype.hasOwnProperty,sP=Object.prototype.propertyIsEnumerable,D2=(r,e,t)=>e in r?iP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pf=(r,e)=>{for(var t in e||(e={}))nP.call(e,t)&&D2(r,t,e[t]);if(P2)for(var t of P2(e))sP.call(e,t)&&D2(r,t,e[t]);return r};class oP extends PS{constructor(e,t,i=!0){super(e,t,i),this.core=e,this.logger=t,this.context=nM,this.storagePrefix=ts,this.storageVersion=iM,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!Jd())try{const n={eventId:km(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:Lm(this.core.relayer.protocol,this.core.relayer.version,b0)}}};await this.sendEvent([n])}catch(n){this.logger.warn(n)}},this.createEvent=n=>{const{event:s="ERROR",type:a="",properties:{topic:f,trace:h}}=n,u=km(),g=this.core.projectId||"",w=Date.now(),M=pf({eventId:u,timestamp:w,props:{event:s,type:a,properties:{topic:f,trace:h}},bundleId:g,domain:this.getAppDomain()},this.setMethods(u));return this.telemetryEnabled&&(this.events.set(u,M),this.shouldPersist=!0),M},this.getEvent=n=>{const{eventId:s,topic:a}=n;if(s)return this.events.get(s);const f=Array.from(this.events.values()).find(h=>h.props.properties.topic===a);if(f)return pf(pf({},f),this.setMethods(f.eventId))},this.deleteEvent=n=>{const{eventId:s}=n;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(ka.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(n=>{_e.fromMiliseconds(Date.now())-_e.fromMiliseconds(n.timestamp)>sM&&(this.events.delete(n.eventId),this.shouldPersist=!0)})})},this.setMethods=n=>({addTrace:s=>this.addTrace(n,s),setError:s=>this.setError(n,s)}),this.addTrace=(n,s)=>{const a=this.events.get(n);a&&(a.props.properties.trace.push(s),this.events.set(n,a),this.shouldPersist=!0)},this.setError=(n,s)=>{const a=this.events.get(n);a&&(a.props.type=s,a.timestamp=Date.now(),this.events.set(n,a),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const n=await this.core.storage.getItem(this.storageKey)||[];if(!n.length)return;n.forEach(s=>{this.events.set(s.eventId,pf(pf({},s),this.setMethods(s.eventId)))})}catch(n){this.logger.warn(n)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const n=[];for(const[s,a]of this.events)a.props.type&&n.push(a);if(n.length!==0)try{if((await this.sendEvent(n)).ok)for(const s of n)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async n=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${oM}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${b0}${s}`,{method:"POST",body:JSON.stringify(n)})},this.getAppDomain=()=>$m().url,this.logger=ci(t,this.context),this.telemetryEnabled=i,i?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var aP=Object.defineProperty,O2=Object.getOwnPropertySymbols,cP=Object.prototype.hasOwnProperty,fP=Object.prototype.propertyIsEnumerable,R2=(r,e,t)=>e in r?aP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,T2=(r,e)=>{for(var t in e||(e={}))cP.call(e,t)&&R2(r,t,e[t]);if(O2)for(var t of O2(e))fP.call(e,t)&&R2(r,t,e[t]);return r};class E0 extends wS{constructor(e){var t;super(e),this.protocol=Vb,this.version=Gb,this.name=sh,this.events=new zr.exports.EventEmitter,this.initialized=!1,this.on=(a,f)=>this.events.on(a,f),this.once=(a,f)=>this.events.once(a,f),this.off=(a,f)=>this.events.off(a,f),this.removeListener=(a,f)=>this.events.removeListener(a,f),this.dispatchEnvelope=({topic:a,message:f,sessionExists:h})=>{if(!a||!f)return;const u={topic:a,message:f,publishedAt:Date.now(),transportType:sr.link_mode};this.relayer.onLinkMessageEvent(u,{sessionExists:h})},this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||Zb,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const i=th({level:typeof e?.logger=="string"&&e.logger?e.logger:MI.logger,name:sh}),{logger:n,chunkLoggerController:s}=bS({opts:i,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=s,(t=this.logChunkController)!=null&&t.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var a,f;(a=this.logChunkController)!=null&&a.downloadLogsBlobInBrowser&&((f=this.logChunkController)==null||f.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ci(n,this.name),this.heartbeat=new n0,this.crypto=new DC(this,this.logger,e?.keychain),this.history=new XC(this,this.logger),this.expirer=new eP(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new jA(T2(T2({},CI),e?.storageOptions)),this.relayer=new GC({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new ZC(this,this.logger),this.verify=new tP(this,this.logger,this.storage),this.echoClient=new rP(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new oP(this,this.logger,e?.telemetryEnabled)}static async init(e){const t=new E0(e);await t.initialize();const i=await t.crypto.getClientId();return await t.storage.setItem(zI,i),t}get context(){return yi(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(Xb,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(Xb)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const lP=E0,N2="wc",$2=2,L2="client",A0=`${N2}@${$2}:${L2}:`,S0={name:L2,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.org"},B2="WALLETCONNECT_DEEPLINK_CHOICE",hP="proposal",U2="Proposal expired",uP="session",Wa=_e.SEVEN_DAYS,dP="engine",Br={wc_sessionPropose:{req:{ttl:_e.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:1104},res:{ttl:_e.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:1106},res:{ttl:_e.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:_e.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:_e.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:1112},res:{ttl:_e.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:1114},res:{ttl:_e.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:_e.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:_e.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1119}}},I0={min:_e.FIVE_MINUTES,max:_e.SEVEN_DAYS},is={idle:"IDLE",active:"ACTIVE"},pP="request",gP=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],vP="wc",mP="auth",bP="authKeys",wP="pairingTopics",yP="requests",ah=`${vP}@${1.5}:${mP}:`,ch=`${ah}:PUB_KEY`;var _P=Object.defineProperty,xP=Object.defineProperties,EP=Object.getOwnPropertyDescriptors,F2=Object.getOwnPropertySymbols,AP=Object.prototype.hasOwnProperty,SP=Object.prototype.propertyIsEnumerable,q2=(r,e,t)=>e in r?_P(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pr=(r,e)=>{for(var t in e||(e={}))AP.call(e,t)&&q2(r,t,e[t]);if(F2)for(var t of F2(e))SP.call(e,t)&&q2(r,t,e[t]);return r},Mn=(r,e)=>xP(r,EP(e));class IP extends OS{constructor(e){super(e),this.name=dP,this.events=new zr.exports,this.initialized=!1,this.requestQueue={state:is.idle,queue:[]},this.sessionRequestQueue={state:is.idle,queue:[]},this.requestQueueDelay=_e.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(Br)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},_e.toMiliseconds(this.requestQueueDelay)))},this.connect=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const i=Mn(pr({},t),{requiredNamespaces:t.requiredNamespaces||{},optionalNamespaces:t.optionalNamespaces||{}});await this.isValidConnect(i);const{pairingTopic:n,requiredNamespaces:s,optionalNamespaces:a,sessionProperties:f,relays:h}=i;let u=n,g,w=!1;try{if(u){const W=this.client.core.pairing.pairings.get(u);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),w=W.active}}catch(W){throw this.client.logger.error(`connect() -> pairing.get(${u}) failed`),W}if(!u||!w){const{topic:W,uri:G}=await this.client.core.pairing.create();u=W,g=G}if(!u){const{message:W}=xe("NO_MATCHING_KEY",`connect() pairing topic: ${u}`);throw new Error(W)}const M=await this.client.core.crypto.generateKeyPair(),P=Br.wc_sessionPropose.req.ttl||_e.FIVE_MINUTES,O=Ir(P),$=pr({requiredNamespaces:s,optionalNamespaces:a,relays:h??[{protocol:Qb}],proposer:{publicKey:M,metadata:this.client.metadata},expiryTimestamp:O,pairingTopic:u},f&&{sessionProperties:f}),{reject:q,resolve:U,done:J}=No(P,U2);this.events.once(Dt("session_connect"),async({error:W,session:G})=>{if(W)q(W);else if(G){G.self.publicKey=M;const Q=Mn(pr({},G),{pairingTopic:$.pairingTopic,requiredNamespaces:$.requiredNamespaces,optionalNamespaces:$.optionalNamespaces,transportType:sr.relay});await this.client.session.set(G.topic,Q),await this.setExpiry(G.topic,G.expiry),u&&await this.client.core.pairing.updateMetadata({topic:u,metadata:G.peer.metadata}),this.cleanupDuplicatePairings(Q),U(Q)}});const ee=await this.sendRequest({topic:u,method:"wc_sessionPropose",params:$,throwOnFailedPublish:!0});return await this.setProposal(ee,pr({id:ee},$)),{uri:g,approval:J}},this.pair=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(t)}catch(i){throw this.client.logger.error("pair() failed"),i}},this.approve=async t=>{var i,n,s;const a=this.client.core.eventClient.createEvent({properties:{topic:(i=t?.id)==null?void 0:i.toString(),trace:[In.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(z){throw a.setError(zo.no_internet_connection),z}try{await this.isValidProposalId(t?.id)}catch(z){throw this.client.logger.error(`approve() -> proposal.get(${t?.id}) failed`),a.setError(zo.proposal_not_found),z}try{await this.isValidApprove(t)}catch(z){throw this.client.logger.error("approve() -> isValidApprove() failed"),a.setError(zo.session_approve_namespace_validation_failure),z}const{id:f,relayProtocol:h,namespaces:u,sessionProperties:g,sessionConfig:w}=t,M=this.client.proposal.get(f);this.client.core.eventClient.deleteEvent({eventId:a.eventId});const{pairingTopic:P,proposer:O,requiredNamespaces:$,optionalNamespaces:q}=M;let U=(n=this.client.core.eventClient)==null?void 0:n.getEvent({topic:P});U||(U=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:In.session_approve_started,properties:{topic:P,trace:[In.session_approve_started,In.session_namespaces_validation_success]}}));const J=await this.client.core.crypto.generateKeyPair(),ee=O.publicKey,W=await this.client.core.crypto.generateSharedKey(J,ee),G=pr(pr({relay:{protocol:h??"irn"},namespaces:u,controller:{publicKey:J,metadata:this.client.metadata},expiry:Ir(Wa)},g&&{sessionProperties:g}),w&&{sessionConfig:w}),Q=sr.relay;U.addTrace(In.subscribing_session_topic);try{await this.client.core.relayer.subscribe(W,{transportType:Q})}catch(z){throw U.setError(zo.subscribe_session_topic_failure),z}U.addTrace(In.subscribe_session_topic_success);const A=Mn(pr({},G),{topic:W,requiredNamespaces:$,optionalNamespaces:q,pairingTopic:P,acknowledged:!1,self:G.controller,peer:{publicKey:O.publicKey,metadata:O.metadata},controller:J,transportType:sr.relay});await this.client.session.set(W,A),U.addTrace(In.store_session);try{U.addTrace(In.publishing_session_settle),await this.sendRequest({topic:W,method:"wc_sessionSettle",params:G,throwOnFailedPublish:!0}).catch(z=>{throw U?.setError(zo.session_settle_publish_failure),z}),U.addTrace(In.session_settle_publish_success),U.addTrace(In.publishing_session_approve),await this.sendResult({id:f,topic:P,result:{relay:{protocol:h??"irn"},responderPublicKey:J},throwOnFailedPublish:!0}).catch(z=>{throw U?.setError(zo.session_approve_publish_failure),z}),U.addTrace(In.session_approve_publish_success)}catch(z){throw this.client.logger.error(z),this.client.session.delete(W,Gt("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(W),z}return this.client.core.eventClient.deleteEvent({eventId:U.eventId}),await this.client.core.pairing.updateMetadata({topic:P,metadata:O.metadata}),await this.client.proposal.delete(f,Gt("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:P}),await this.setExpiry(W,Ir(Wa)),{topic:W,acknowledged:()=>Promise.resolve(this.client.session.get(W))}},this.reject=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(t)}catch(a){throw this.client.logger.error("reject() -> isValidReject() failed"),a}const{id:i,reason:n}=t;let s;try{s=this.client.proposal.get(i).pairingTopic}catch(a){throw this.client.logger.error(`reject() -> proposal.get(${i}) failed`),a}s&&(await this.sendError({id:i,topic:s,error:n,rpcOpts:Br.wc_sessionPropose.reject}),await this.client.proposal.delete(i,Gt("USER_DISCONNECTED")))},this.update=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(t)}catch(w){throw this.client.logger.error("update() -> isValidUpdate() failed"),w}const{topic:i,namespaces:n}=t,{done:s,resolve:a,reject:f}=No(),h=As(),u=Fo().toString(),g=this.client.session.get(i).namespaces;return this.events.once(Dt("session_update",h),({error:w})=>{w?f(w):a()}),await this.client.session.update(i,{namespaces:n}),await this.sendRequest({topic:i,method:"wc_sessionUpdate",params:{namespaces:n},throwOnFailedPublish:!0,clientRpcId:h,relayRpcId:u}).catch(w=>{this.client.logger.error(w),this.client.session.update(i,{namespaces:g}),f(w)}),{acknowledged:s}},this.extend=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(t)}catch(h){throw this.client.logger.error("extend() -> isValidExtend() failed"),h}const{topic:i}=t,n=As(),{done:s,resolve:a,reject:f}=No();return this.events.once(Dt("session_extend",n),({error:h})=>{h?f(h):a()}),await this.setExpiry(i,Ir(Wa)),this.sendRequest({topic:i,method:"wc_sessionExtend",params:{},clientRpcId:n,throwOnFailedPublish:!0}).catch(h=>{f(h)}),{acknowledged:s}},this.request=async t=>{this.isInitialized();try{await this.isValidRequest(t)}catch(O){throw this.client.logger.error("request() -> isValidRequest() failed"),O}const{chainId:i,request:n,topic:s,expiry:a=Br.wc_sessionRequest.req.ttl}=t,f=this.client.session.get(s);f?.transportType===sr.relay&&await this.confirmOnlineStateOrThrow();const h=As(),u=Fo().toString(),{done:g,resolve:w,reject:M}=No(a,"Request expired. Please try again.");this.events.once(Dt("session_request",h),({error:O,result:$})=>{O?M(O):w($)});const P=this.getAppLinkIfEnabled(f.peer.metadata,f.transportType);return P?(await this.sendRequest({clientRpcId:h,relayRpcId:u,topic:s,method:"wc_sessionRequest",params:{request:Mn(pr({},n),{expiryTimestamp:Ir(a)}),chainId:i},expiry:a,throwOnFailedPublish:!0,appLink:P}).catch(O=>M(O)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:i,id:h}),await g()):await Promise.all([new Promise(async O=>{await this.sendRequest({clientRpcId:h,relayRpcId:u,topic:s,method:"wc_sessionRequest",params:{request:Mn(pr({},n),{expiryTimestamp:Ir(a)}),chainId:i},expiry:a,throwOnFailedPublish:!0}).catch($=>M($)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:i,id:h}),O()}),new Promise(async O=>{var $;if(!(($=f.sessionConfig)!=null&&$.disableDeepLink)){const q=await Hx(this.client.core.storage,B2);await qx({id:h,topic:s,wcDeepLink:q})}O()}),g()]).then(O=>O[2])},this.respond=async t=>{this.isInitialized(),await this.isValidRespond(t);const{topic:i,response:n}=t,{id:s}=n,a=this.client.session.get(i);a.transportType===sr.relay&&await this.confirmOnlineStateOrThrow();const f=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);es(n)?await this.sendResult({id:s,topic:i,result:n.result,throwOnFailedPublish:!0,appLink:f}):rn(n)&&await this.sendError({id:s,topic:i,error:n.error,appLink:f}),this.cleanupAfterResponse(t)},this.ping=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(t)}catch(n){throw this.client.logger.error("ping() -> isValidPing() failed"),n}const{topic:i}=t;if(this.client.session.keys.includes(i)){const n=As(),s=Fo().toString(),{done:a,resolve:f,reject:h}=No();this.events.once(Dt("session_ping",n),({error:u})=>{u?h(u):f()}),await Promise.all([this.sendRequest({topic:i,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:n,relayRpcId:s}),a()])}else this.client.core.pairing.pairings.keys.includes(i)&&(this.client.logger.warn("ping() on pairing topic is deprecated and will be removed in the next major release."),await this.client.core.pairing.ping({topic:i}))},this.emit=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(t);const{topic:i,event:n,chainId:s}=t,a=Fo().toString(),f=As();await this.sendRequest({topic:i,method:"wc_sessionEvent",params:{event:n,chainId:s},throwOnFailedPublish:!0,relayRpcId:a,clientRpcId:f})},this.disconnect=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(t);const{topic:i}=t;if(this.client.session.keys.includes(i))await this.sendRequest({topic:i,method:"wc_sessionDelete",params:Gt("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:i,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(i))await this.client.core.pairing.disconnect({topic:i});else{const{message:n}=xe("MISMATCHED_TOPIC",`Session or pairing topic not found: ${i}`);throw new Error(n)}},this.find=t=>(this.isInitialized(),this.client.session.getAll().filter(i=>FE(i,t))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(t,i)=>{var n;this.isInitialized(),this.isValidAuthenticate(t);const s=i&&this.client.core.linkModeSupportedApps.includes(i)&&((n=this.client.metadata.redirect)==null?void 0:n.linkMode),a=s?sr.link_mode:sr.relay;a===sr.relay&&await this.confirmOnlineStateOrThrow();const{chains:f,statement:h="",uri:u,domain:g,nonce:w,type:M,exp:P,nbf:O,methods:$=[],expiry:q}=t,U=[...t.resources||[]],{topic:J,uri:ee}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:a});this.client.logger.info({message:"Generated new pairing",pairing:{topic:J,uri:ee}});const W=await this.client.core.crypto.generateKeyPair(),G=Hl(W);if(await Promise.all([this.client.auth.authKeys.set(ch,{responseTopic:G,publicKey:W}),this.client.auth.pairingTopics.set(G,{topic:G,pairingTopic:J})]),await this.client.core.relayer.subscribe(G,{transportType:a}),this.client.logger.info(`sending request to new pairing topic: ${J}`),$.length>0){const{namespace:D}=qa(f[0]);let S=uE(D,"request",$);kl(U)&&(S=pE(S,U.pop())),U.push(S)}const Q=q&&q>Br.wc_sessionAuthenticate.req.ttl?q:Br.wc_sessionAuthenticate.req.ttl,A={authPayload:{type:M??"caip122",chains:f,statement:h,aud:u,domain:g,version:"1",nonce:w,iat:new Date().toISOString(),exp:P,nbf:O,resources:U},requester:{publicKey:W,metadata:this.client.metadata},expiryTimestamp:Ir(Q)},z={eip155:{chains:f,methods:[...new Set(["personal_sign",...$])],events:["chainChanged","accountsChanged"]}},te={requiredNamespaces:{},optionalNamespaces:z,relays:[{protocol:"irn"}],pairingTopic:J,proposer:{publicKey:W,metadata:this.client.metadata},expiryTimestamp:Ir(Br.wc_sessionPropose.req.ttl)},{done:ae,resolve:L,reject:b}=No(Q,"Request expired"),m=async({error:D,session:S})=>{if(this.events.off(Dt("session_request",d),l),D)b(D);else if(S){S.self.publicKey=W,await this.client.session.set(S.topic,S),await this.setExpiry(S.topic,S.expiry),J&&await this.client.core.pairing.updateMetadata({topic:J,metadata:S.peer.metadata});const v=this.client.session.get(S.topic);await this.deleteProposal(y),L({session:v})}},l=async D=>{var S,v,x;if(await this.deletePendingAuthRequest(d,{message:"fulfilled",code:0}),D.error){const K=Gt("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return D.error.code===K.code?void 0:(this.events.off(Dt("session_connect"),m),b(D.error.message))}await this.deleteProposal(y),this.events.off(Dt("session_connect"),m);const{cacaos:_,responder:N}=D.result,oe=[],R=[];for(const K of _){await Km({cacao:K,projectId:this.client.core.projectId})||(this.client.logger.error(K,"Signature verification failed"),b(Gt("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:k}=K,E=kl(k.resources),j=[Qd(k.iss)],re=zl(k.iss);if(E){const le=Jm(E),he=Ym(E);oe.push(...le),j.push(...he)}for(const le of j)R.push(`${le}:${re}`)}const Z=await this.client.core.crypto.generateSharedKey(W,N.publicKey);let H;oe.length>0&&(H={topic:Z,acknowledged:!0,self:{publicKey:W,metadata:this.client.metadata},peer:N,controller:N.publicKey,expiry:Ir(Wa),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:J,namespaces:ab([...new Set(oe)],[...new Set(R)]),transportType:a},await this.client.core.relayer.subscribe(Z,{transportType:a}),await this.client.session.set(Z,H),J&&await this.client.core.pairing.updateMetadata({topic:J,metadata:N.metadata}),H=this.client.session.get(Z)),(S=this.client.metadata.redirect)!=null&&S.linkMode&&(v=N.metadata.redirect)!=null&&v.linkMode&&(x=N.metadata.redirect)!=null&&x.universal&&i&&(this.client.core.addLinkModeSupportedApp(N.metadata.redirect.universal),this.client.session.update(Z,{transportType:sr.link_mode})),L({auths:_,session:H})},d=As(),y=As();this.events.once(Dt("session_connect"),m),this.events.once(Dt("session_request",d),l);let C;try{if(s){const D=Qs("wc_sessionAuthenticate",A,d);this.client.core.history.set(J,D);const S=await this.client.core.crypto.encode("",D,{type:Jc,encoding:Vc});C=Wl(i,J,S)}else await Promise.all([this.sendRequest({topic:J,method:"wc_sessionAuthenticate",params:A,expiry:t.expiry,throwOnFailedPublish:!0,clientRpcId:d}),this.sendRequest({topic:J,method:"wc_sessionPropose",params:te,expiry:Br.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:y})])}catch(D){throw this.events.off(Dt("session_connect"),m),this.events.off(Dt("session_request",d),l),D}return await this.setProposal(y,pr({id:y},te)),await this.setAuthRequest(d,{request:Mn(pr({},A),{verifyContext:{}}),pairingTopic:J,transportType:a}),{uri:C??ee,response:ae}},this.approveSessionAuthenticate=async t=>{const{id:i,auths:n}=t,s=this.client.core.eventClient.createEvent({properties:{topic:i.toString(),trace:[ko.authenticated_session_approve_started]}});try{this.isInitialized()}catch(q){throw s.setError(hf.no_internet_connection),q}const a=this.getPendingAuthRequest(i);if(!a)throw s.setError(hf.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${i}`);const f=a.transportType||sr.relay;f===sr.relay&&await this.confirmOnlineStateOrThrow();const h=a.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),g=Hl(h),w={type:ws,receiverPublicKey:h,senderPublicKey:u},M=[],P=[];for(const q of n){if(!await Km({cacao:q,projectId:this.client.core.projectId})){s.setError(hf.invalid_cacao);const G=Gt("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:i,topic:g,error:G,encodeOpts:w}),new Error(G.message)}s.addTrace(ko.cacaos_verified);const{p:U}=q,J=kl(U.resources),ee=[Qd(U.iss)],W=zl(U.iss);if(J){const G=Jm(J),Q=Ym(J);M.push(...G),ee.push(...Q)}for(const G of ee)P.push(`${G}:${W}`)}const O=await this.client.core.crypto.generateSharedKey(u,h);s.addTrace(ko.create_authenticated_session_topic);let $;if(M?.length>0){$={topic:O,acknowledged:!0,self:{publicKey:u,metadata:this.client.metadata},peer:{publicKey:h,metadata:a.requester.metadata},controller:h,expiry:Ir(Wa),authentication:n,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:a.pairingTopic,namespaces:ab([...new Set(M)],[...new Set(P)]),transportType:f},s.addTrace(ko.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(O,{transportType:f})}catch(q){throw s.setError(hf.subscribe_authenticated_session_topic_failure),q}s.addTrace(ko.subscribe_authenticated_session_topic_success),await this.client.session.set(O,$),s.addTrace(ko.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:a.pairingTopic,metadata:a.requester.metadata})}s.addTrace(ko.publishing_authenticated_session_approve);try{await this.sendResult({topic:g,id:i,result:{cacaos:n,responder:{publicKey:u,metadata:this.client.metadata}},encodeOpts:w,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(a.requester.metadata,f)})}catch(q){throw s.setError(hf.authenticated_session_approve_publish_failure),q}return await this.client.auth.requests.delete(i,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:a.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:$}},this.rejectSessionAuthenticate=async t=>{this.isInitialized();const{id:i,reason:n}=t,s=this.getPendingAuthRequest(i);if(!s)throw new Error(`Could not find pending auth request with id ${i}`);s.transportType===sr.relay&&await this.confirmOnlineStateOrThrow();const a=s.requester.publicKey,f=await this.client.core.crypto.generateKeyPair(),h=Hl(a),u={type:ws,receiverPublicKey:a,senderPublicKey:f};await this.sendError({id:i,topic:h,error:n,encodeOpts:u,rpcOpts:Br.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(i,{message:"rejected",code:0}),await this.client.proposal.delete(i,Gt("USER_DISCONNECTED"))},this.formatAuthMessage=t=>{this.isInitialized();const{request:i,iss:n}=t;return Vm(i,n)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const t=this.relayMessageCache.shift();t&&await this.onRelayMessage(t)}catch(t){this.client.logger.error(t)}},50)},this.cleanupDuplicatePairings=async t=>{if(t.pairingTopic)try{const i=this.client.core.pairing.pairings.get(t.pairingTopic),n=this.client.core.pairing.pairings.getAll().filter(s=>{var a,f;return((a=s.peerMetadata)==null?void 0:a.url)&&((f=s.peerMetadata)==null?void 0:f.url)===t.peer.metadata.url&&s.topic&&s.topic!==i.topic});if(n.length===0)return;this.client.logger.info(`Cleaning up ${n.length} duplicate pairing(s)`),await Promise.all(n.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(i){this.client.logger.error(i)}},this.deleteSession=async t=>{var i;const{topic:n,expirerHasDeleted:s=!1,emitEvent:a=!0,id:f=0}=t,{self:h}=this.client.session.get(n);await this.client.core.relayer.unsubscribe(n),await this.client.session.delete(n,Gt("USER_DISCONNECTED")),this.addToRecentlyDeleted(n,"session"),this.client.core.crypto.keychain.has(h.publicKey)&&await this.client.core.crypto.deleteKeyPair(h.publicKey),this.client.core.crypto.keychain.has(n)&&await this.client.core.crypto.deleteSymKey(n),s||this.client.core.expirer.del(n),this.client.core.storage.removeItem(B2).catch(u=>this.client.logger.warn(u)),this.getPendingSessionRequests().forEach(u=>{u.topic===n&&this.deletePendingSessionRequest(u.id,Gt("USER_DISCONNECTED"))}),n===((i=this.sessionRequestQueue.queue[0])==null?void 0:i.topic)&&(this.sessionRequestQueue.state=is.idle),a&&this.client.events.emit("session_delete",{id:f,topic:n})},this.deleteProposal=async(t,i)=>{if(i)try{const n=this.client.proposal.get(t),s=this.client.core.eventClient.getEvent({topic:n.pairingTopic});s?.setError(zo.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(t,Gt("USER_DISCONNECTED")),i?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"proposal")},this.deletePendingSessionRequest=async(t,i,n=!1)=>{await Promise.all([this.client.pendingRequest.delete(t,i),n?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==t),n&&(this.sessionRequestQueue.state=is.idle,this.client.events.emit("session_request_expire",{id:t}))},this.deletePendingAuthRequest=async(t,i,n=!1)=>{await Promise.all([this.client.auth.requests.delete(t,i),n?Promise.resolve():this.client.core.expirer.del(t)])},this.setExpiry=async(t,i)=>{this.client.session.keys.includes(t)&&(this.client.core.expirer.set(t,i),await this.client.session.update(t,{expiry:i}))},this.setProposal=async(t,i)=>{this.client.core.expirer.set(t,Ir(Br.wc_sessionPropose.req.ttl)),await this.client.proposal.set(t,i)},this.setAuthRequest=async(t,i)=>{const{request:n,pairingTopic:s,transportType:a=sr.relay}=i;this.client.core.expirer.set(t,n.expiryTimestamp),await this.client.auth.requests.set(t,{authPayload:n.authPayload,requester:n.requester,expiryTimestamp:n.expiryTimestamp,id:t,pairingTopic:s,verifyContext:n.verifyContext,transportType:a})},this.setPendingSessionRequest=async t=>{const{id:i,topic:n,params:s,verifyContext:a}=t,f=s.request.expiryTimestamp||Ir(Br.wc_sessionRequest.req.ttl);this.client.core.expirer.set(i,f),await this.client.pendingRequest.set(i,{id:i,topic:n,params:s,verifyContext:a})},this.sendRequest=async t=>{const{topic:i,method:n,params:s,expiry:a,relayRpcId:f,clientRpcId:h,throwOnFailedPublish:u,appLink:g}=t,w=Qs(n,s,h);let M;const P=!!g;try{const q=P?Vc:Ys;M=await this.client.core.crypto.encode(i,w,{encoding:q})}catch(q){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${i} failed`),q}let O;if(gP.includes(n)){const q=ys(JSON.stringify(w)),U=ys(M);O=await this.client.core.verify.register({id:U,decryptedId:q})}const $=Br[n].req;if($.attestation=O,a&&($.ttl=a),f&&($.id=f),this.client.core.history.set(i,w),P){const q=Wl(g,i,M);await global.Linking.openURL(q,this.client.name)}else{const q=Br[n].req;a&&(q.ttl=a),f&&(q.id=f),u?(q.internal=Mn(pr({},q.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,M,q)):this.client.core.relayer.publish(i,M,q).catch(U=>this.client.logger.error(U))}return w.id},this.sendResult=async t=>{const{id:i,topic:n,result:s,throwOnFailedPublish:a,encodeOpts:f,appLink:h}=t,u=rh(i,s);let g;const w=h&&typeof(global==null?void 0:global.Linking)<"u";try{const P=w?Vc:Ys;g=await this.client.core.crypto.encode(n,u,Mn(pr({},f||{}),{encoding:P}))}catch(P){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${n} failed`),P}let M;try{M=await this.client.core.history.get(n,i)}catch(P){throw this.client.logger.error(`sendResult() -> history.get(${n}, ${i}) failed`),P}if(w){const P=Wl(h,n,g);await global.Linking.openURL(P,this.client.name)}else{const P=Br[M.request.method].res;a?(P.internal=Mn(pr({},P.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,g,P)):this.client.core.relayer.publish(n,g,P).catch(O=>this.client.logger.error(O))}await this.client.core.history.resolve(u)},this.sendError=async t=>{const{id:i,topic:n,error:s,encodeOpts:a,rpcOpts:f,appLink:h}=t,u=ih(i,s);let g;const w=h&&typeof(global==null?void 0:global.Linking)<"u";try{const P=w?Vc:Ys;g=await this.client.core.crypto.encode(n,u,Mn(pr({},a||{}),{encoding:P}))}catch(P){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${n} failed`),P}let M;try{M=await this.client.core.history.get(n,i)}catch(P){throw this.client.logger.error(`sendError() -> history.get(${n}, ${i}) failed`),P}if(w){const P=Wl(h,n,g);await global.Linking.openURL(P,this.client.name)}else{const P=f||Br[M.request.method].res;this.client.core.relayer.publish(n,g,P)}await this.client.core.history.resolve(u)},this.cleanup=async()=>{const t=[],i=[];this.client.session.getAll().forEach(n=>{let s=!1;Js(n.expiry)&&(s=!0),this.client.core.crypto.keychain.has(n.topic)||(s=!0),s&&t.push(n.topic)}),this.client.proposal.getAll().forEach(n=>{Js(n.expiryTimestamp)&&i.push(n.id)}),await Promise.all([...t.map(n=>this.deleteSession({topic:n})),...i.map(n=>this.deleteProposal(n))])},this.onRelayEventRequest=async t=>{this.requestQueue.queue.push(t),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===is.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=is.active;const t=this.requestQueue.queue.shift();if(t)try{await this.processRequest(t)}catch(i){this.client.logger.warn(i)}}this.requestQueue.state=is.idle},this.processRequest=async t=>{const{topic:i,payload:n,attestation:s,transportType:a,encryptedId:f}=t,h=n.method;if(!this.shouldIgnorePairingRequest({topic:i,requestMethod:h}))switch(h){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:i,payload:n,attestation:s,encryptedId:f});case"wc_sessionSettle":return await this.onSessionSettleRequest(i,n);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(i,n);case"wc_sessionExtend":return await this.onSessionExtendRequest(i,n);case"wc_sessionPing":return await this.onSessionPingRequest(i,n);case"wc_sessionDelete":return await this.onSessionDeleteRequest(i,n);case"wc_sessionRequest":return await this.onSessionRequest({topic:i,payload:n,attestation:s,encryptedId:f,transportType:a});case"wc_sessionEvent":return await this.onSessionEventRequest(i,n);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:i,payload:n,attestation:s,encryptedId:f,transportType:a});default:return this.client.logger.info(`Unsupported request method ${h}`)}},this.onRelayEventResponse=async t=>{const{topic:i,payload:n,transportType:s}=t,a=(await this.client.core.history.get(i,n.id)).request.method;switch(a){case"wc_sessionPropose":return this.onSessionProposeResponse(i,n,s);case"wc_sessionSettle":return this.onSessionSettleResponse(i,n);case"wc_sessionUpdate":return this.onSessionUpdateResponse(i,n);case"wc_sessionExtend":return this.onSessionExtendResponse(i,n);case"wc_sessionPing":return this.onSessionPingResponse(i,n);case"wc_sessionRequest":return this.onSessionRequestResponse(i,n);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(i,n);default:return this.client.logger.info(`Unsupported response method ${a}`)}},this.onRelayEventUnknownPayload=t=>{const{topic:i}=t,{message:n}=xe("MISSING_OR_INVALID",`Decoded payload on topic ${i} is not identifiable as a JSON-RPC request or a response.`);throw new Error(n)},this.shouldIgnorePairingRequest=t=>{const{topic:i,requestMethod:n}=t,s=this.expectedPairingMethodMap.get(i);return!s||s.includes(n)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async t=>{const{topic:i,payload:n,attestation:s,encryptedId:a}=t,{params:f,id:h}=n;try{const u=this.client.core.eventClient.getEvent({topic:i});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),u?.setError(Ss.proposal_listener_not_found)),this.isValidConnect(pr({},n.params));const g=f.expiryTimestamp||Ir(Br.wc_sessionPropose.req.ttl),w=pr({id:h,pairingTopic:i,expiryTimestamp:g},f);await this.setProposal(h,w);const M=await this.getVerifyContext({attestationId:s,hash:ys(JSON.stringify(n)),encryptedId:a,metadata:w.proposer.metadata});u?.addTrace(rs.emit_session_proposal),this.client.events.emit("session_proposal",{id:h,params:w,verifyContext:M})}catch(u){await this.sendError({id:h,topic:i,error:u,rpcOpts:Br.wc_sessionPropose.autoReject}),this.client.logger.error(u)}},this.onSessionProposeResponse=async(t,i,n)=>{const{id:s}=i;if(es(i)){const{result:a}=i;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:a});const f=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:f});const h=f.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:h});const u=a.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});const g=await this.client.core.crypto.generateSharedKey(h,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:g});const w=await this.client.core.relayer.subscribe(g,{transportType:n});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:w}),await this.client.core.pairing.activate({topic:t})}else if(rn(i)){await this.client.proposal.delete(s,Gt("USER_DISCONNECTED"));const a=Dt("session_connect");if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners, 954`);this.events.emit(Dt("session_connect"),{error:i.error})}},this.onSessionSettleRequest=async(t,i)=>{const{id:n,params:s}=i;try{this.isValidSessionSettleRequest(s);const{relay:a,controller:f,expiry:h,namespaces:u,sessionProperties:g,sessionConfig:w}=i.params,M=Mn(pr(pr({topic:t,relay:a,expiry:h,namespaces:u,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:f.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:f.publicKey,metadata:f.metadata}},g&&{sessionProperties:g}),w&&{sessionConfig:w}),{transportType:sr.relay}),P=Dt("session_connect");if(this.events.listenerCount(P)===0)throw new Error(`emitting ${P} without any listeners 997`);this.events.emit(Dt("session_connect"),{session:M}),await this.sendResult({id:i.id,topic:t,result:!0,throwOnFailedPublish:!0})}catch(a){await this.sendError({id:n,topic:t,error:a}),this.client.logger.error(a)}},this.onSessionSettleResponse=async(t,i)=>{const{id:n}=i;es(i)?(await this.client.session.update(t,{acknowledged:!0}),this.events.emit(Dt("session_approve",n),{})):rn(i)&&(await this.client.session.delete(t,Gt("USER_DISCONNECTED")),this.events.emit(Dt("session_approve",n),{error:i.error}))},this.onSessionUpdateRequest=async(t,i)=>{const{params:n,id:s}=i;try{const a=`${t}_session_update`,f=tf.get(a);if(f&&this.isRequestOutOfSync(f,s)){this.client.logger.warn(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:t,error:Gt("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(pr({topic:t},n));try{tf.set(a,s),await this.client.session.update(t,{namespaces:n.namespaces}),await this.sendResult({id:s,topic:t,result:!0,throwOnFailedPublish:!0})}catch(h){throw tf.delete(a),h}this.client.events.emit("session_update",{id:s,topic:t,params:n})}catch(a){await this.sendError({id:s,topic:t,error:a}),this.client.logger.error(a)}},this.isRequestOutOfSync=(t,i)=>i.toString().slice(0,-3)<t.toString().slice(0,-3),this.onSessionUpdateResponse=(t,i)=>{const{id:n}=i,s=Dt("session_update",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);es(i)?this.events.emit(Dt("session_update",n),{}):rn(i)&&this.events.emit(Dt("session_update",n),{error:i.error})},this.onSessionExtendRequest=async(t,i)=>{const{id:n}=i;try{this.isValidExtend({topic:t}),await this.setExpiry(t,Ir(Wa)),await this.sendResult({id:n,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:n,topic:t})}catch(s){await this.sendError({id:n,topic:t,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(t,i)=>{const{id:n}=i,s=Dt("session_extend",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);es(i)?this.events.emit(Dt("session_extend",n),{}):rn(i)&&this.events.emit(Dt("session_extend",n),{error:i.error})},this.onSessionPingRequest=async(t,i)=>{const{id:n}=i;try{this.isValidPing({topic:t}),await this.sendResult({id:n,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:n,topic:t})}catch(s){await this.sendError({id:n,topic:t,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(t,i)=>{const{id:n}=i,s=Dt("session_ping",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{es(i)?this.events.emit(Dt("session_ping",n),{}):rn(i)&&this.events.emit(Dt("session_ping",n),{error:i.error})},500)},this.onSessionDeleteRequest=async(t,i)=>{const{id:n}=i;try{this.isValidDisconnect({topic:t,reason:i.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(Lr.publish,async()=>{s(await this.deleteSession({topic:t,id:n}))})}),this.sendResult({id:n,topic:t,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:t,error:Gt("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async t=>{var i,n,s;const{topic:a,payload:f,attestation:h,encryptedId:u,transportType:g}=t,{id:w,params:M}=f;try{await this.isValidRequest(pr({topic:a},M));const P=this.client.session.get(a),O=await this.getVerifyContext({attestationId:h,hash:ys(JSON.stringify(Qs("wc_sessionRequest",M,w))),encryptedId:u,metadata:P.peer.metadata,transportType:g}),$={id:w,topic:a,params:M,verifyContext:O};await this.setPendingSessionRequest($),g===sr.link_mode&&(i=P.peer.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp((n=P.peer.metadata.redirect)==null?void 0:n.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest($):(this.addSessionRequestToSessionRequestQueue($),this.processSessionRequestQueue())}catch(P){await this.sendError({id:w,topic:a,error:P}),this.client.logger.error(P)}},this.onSessionRequestResponse=(t,i)=>{const{id:n}=i,s=Dt("session_request",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);es(i)?this.events.emit(Dt("session_request",n),{result:i.result}):rn(i)&&this.events.emit(Dt("session_request",n),{error:i.error})},this.onSessionEventRequest=async(t,i)=>{const{id:n,params:s}=i;try{const a=`${t}_session_event_${s.event.name}`,f=tf.get(a);if(f&&this.isRequestOutOfSync(f,n)){this.client.logger.info(`Discarding out of sync request - ${n}`);return}this.isValidEmit(pr({topic:t},s)),this.client.events.emit("session_event",{id:n,topic:t,params:s}),tf.set(a,n)}catch(a){await this.sendError({id:n,topic:t,error:a}),this.client.logger.error(a)}},this.onSessionAuthenticateResponse=(t,i)=>{const{id:n}=i;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:t,payload:i}),es(i)?this.events.emit(Dt("session_request",n),{result:i.result}):rn(i)&&this.events.emit(Dt("session_request",n),{error:i.error})},this.onSessionAuthenticateRequest=async t=>{var i;const{topic:n,payload:s,attestation:a,encryptedId:f,transportType:h}=t;try{const{requester:u,authPayload:g,expiryTimestamp:w}=s.params,M=await this.getVerifyContext({attestationId:a,hash:ys(JSON.stringify(s)),encryptedId:f,metadata:u.metadata,transportType:h}),P={requester:u,pairingTopic:n,id:s.id,authPayload:g,verifyContext:M,expiryTimestamp:w};await this.setAuthRequest(s.id,{request:P,pairingTopic:n,transportType:h}),h===sr.link_mode&&(i=u.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp(u.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:n,params:s.params,id:s.id,verifyContext:M})}catch(u){this.client.logger.error(u);const g=s.params.requester.publicKey,w=await this.client.core.crypto.generateKeyPair(),M=this.getAppLinkIfEnabled(s.params.requester.metadata,h),P={type:ws,receiverPublicKey:g,senderPublicKey:w};await this.sendError({id:s.id,topic:n,error:u,encodeOpts:P,rpcOpts:Br.wc_sessionAuthenticate.autoReject,appLink:M})}},this.addSessionRequestToSessionRequestQueue=t=>{this.sessionRequestQueue.queue.push(t)},this.cleanupAfterResponse=t=>{this.deletePendingSessionRequest(t.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=is.idle,this.processSessionRequestQueue()},_e.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:t,error:i})=>{const n=this.client.core.history.pending;n.length>0&&n.filter(s=>s.topic===t&&s.request.method==="wc_sessionRequest").forEach(s=>{const a=s.request.id,f=Dt("session_request",a);if(this.events.listenerCount(f)===0)throw new Error(`emitting ${f} without any listeners`);this.events.emit(Dt("session_request",s.request.id),{error:i})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===is.active){this.client.logger.info("session request queue is already active.");return}const t=this.sessionRequestQueue.queue[0];if(!t){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=is.active,this.emitSessionRequest(t)}catch(i){this.client.logger.error(i)}},this.emitSessionRequest=t=>{this.client.events.emit("session_request",t)},this.onPairingCreated=t=>{if(t.methods&&this.expectedPairingMethodMap.set(t.topic,t.methods),t.active)return;const i=this.client.proposal.getAll().find(n=>n.pairingTopic===t.topic);i&&this.onSessionProposeRequest({topic:t.topic,payload:Qs("wc_sessionPropose",{requiredNamespaces:i.requiredNamespaces,optionalNamespaces:i.optionalNamespaces,relays:i.relays,proposer:i.proposer,sessionProperties:i.sessionProperties},i.id)})},this.isValidConnect=async t=>{if(!bi(t)){const{message:h}=xe("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(t)}`);throw new Error(h)}const{pairingTopic:i,requiredNamespaces:n,optionalNamespaces:s,sessionProperties:a,relays:f}=t;if(ai(i)||await this.isValidPairingTopic(i),!QE(f,!0)){const{message:h}=xe("MISSING_OR_INVALID",`connect() relays: ${f}`);throw new Error(h)}!ai(n)&&ef(n)!==0&&this.validateNamespaces(n,"requiredNamespaces"),!ai(s)&&ef(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),ai(a)||this.validateSessionProps(a,"sessionProperties")},this.validateNamespaces=(t,i)=>{const n=YE(t,"connect()",i);if(n)throw new Error(n.message)},this.isValidApprove=async t=>{if(!bi(t))throw new Error(xe("MISSING_OR_INVALID",`approve() params: ${t}`).message);const{id:i,namespaces:n,relayProtocol:s,sessionProperties:a}=t;this.checkRecentlyDeleted(i),await this.isValidProposalId(i);const f=this.client.proposal.get(i),h=r0(n,"approve()");if(h)throw new Error(h.message);const u=ub(f.requiredNamespaces,n,"approve()");if(u)throw new Error(u.message);if(!wr(s,!0)){const{message:g}=xe("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(g)}ai(a)||this.validateSessionProps(a,"sessionProperties")},this.isValidReject=async t=>{if(!bi(t)){const{message:s}=xe("MISSING_OR_INVALID",`reject() params: ${t}`);throw new Error(s)}const{id:i,reason:n}=t;if(this.checkRecentlyDeleted(i),await this.isValidProposalId(i),!XE(n)){const{message:s}=xe("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(s)}},this.isValidSessionSettleRequest=t=>{if(!bi(t)){const{message:u}=xe("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${t}`);throw new Error(u)}const{relay:i,controller:n,namespaces:s,expiry:a}=t;if(!lb(i)){const{message:u}=xe("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(u)}const f=jE(n,"onSessionSettleRequest()");if(f)throw new Error(f.message);const h=r0(s,"onSessionSettleRequest()");if(h)throw new Error(h.message);if(Js(a)){const{message:u}=xe("EXPIRED","onSessionSettleRequest()");throw new Error(u)}},this.isValidUpdate=async t=>{if(!bi(t)){const{message:h}=xe("MISSING_OR_INVALID",`update() params: ${t}`);throw new Error(h)}const{topic:i,namespaces:n}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const s=this.client.session.get(i),a=r0(n,"update()");if(a)throw new Error(a.message);const f=ub(s.requiredNamespaces,n,"update()");if(f)throw new Error(f.message)},this.isValidExtend=async t=>{if(!bi(t)){const{message:n}=xe("MISSING_OR_INVALID",`extend() params: ${t}`);throw new Error(n)}const{topic:i}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i)},this.isValidRequest=async t=>{if(!bi(t)){const{message:h}=xe("MISSING_OR_INVALID",`request() params: ${t}`);throw new Error(h)}const{topic:i,request:n,chainId:s,expiry:a}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const{namespaces:f}=this.client.session.get(i);if(!hb(f,s)){const{message:h}=xe("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(h)}if(!eA(n)){const{message:h}=xe("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(h)}if(!iA(f,s,n.method)){const{message:h}=xe("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(h)}if(a&&!aA(a,I0)){const{message:h}=xe("MISSING_OR_INVALID",`request() expiry: ${a}. Expiry must be a number (in seconds) between ${I0.min} and ${I0.max}`);throw new Error(h)}},this.isValidRespond=async t=>{var i;if(!bi(t)){const{message:a}=xe("MISSING_OR_INVALID",`respond() params: ${t}`);throw new Error(a)}const{topic:n,response:s}=t;try{await this.isValidSessionTopic(n)}catch(a){throw(i=t?.response)!=null&&i.id&&this.cleanupAfterResponse(t),a}if(!tA(s)){const{message:a}=xe("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(a)}},this.isValidPing=async t=>{if(!bi(t)){const{message:n}=xe("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(n)}const{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.isValidEmit=async t=>{if(!bi(t)){const{message:f}=xe("MISSING_OR_INVALID",`emit() params: ${t}`);throw new Error(f)}const{topic:i,event:n,chainId:s}=t;await this.isValidSessionTopic(i);const{namespaces:a}=this.client.session.get(i);if(!hb(a,s)){const{message:f}=xe("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(f)}if(!rA(n)){const{message:f}=xe("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(f)}if(!nA(a,s,n.name)){const{message:f}=xe("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(f)}},this.isValidDisconnect=async t=>{if(!bi(t)){const{message:n}=xe("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(n)}const{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.isValidAuthenticate=t=>{const{chains:i,uri:n,domain:s,nonce:a}=t;if(!Array.isArray(i)||i.length===0)throw new Error("chains is required and must be a non-empty array");if(!wr(n,!1))throw new Error("uri is required parameter");if(!wr(s,!1))throw new Error("domain is required parameter");if(!wr(a,!1))throw new Error("nonce is required parameter");if([...new Set(i.map(h=>qa(h).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:f}=qa(i[0]);if(f!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async t=>{const{attestationId:i,hash:n,encryptedId:s,metadata:a,transportType:f}=t,h={verified:{verifyUrl:a.verifyUrl||lf,validation:"UNKNOWN",origin:a.url||""}};try{if(f===sr.link_mode){const g=this.getAppLinkIfEnabled(a,f);return h.verified.validation=g&&new URL(g).origin===new URL(a.url).origin?"VALID":"INVALID",h}const u=await this.client.core.verify.resolve({attestationId:i,hash:n,encryptedId:s,verifyUrl:a.verifyUrl});u&&(h.verified.origin=u.origin,h.verified.isScam=u.isScam,h.verified.validation=u.origin===new URL(a.url).origin?"VALID":"INVALID")}catch(u){this.client.logger.warn(u)}return this.client.logger.debug(`Verify context: ${JSON.stringify(h)}`),h},this.validateSessionProps=(t,i)=>{Object.values(t).forEach(n=>{if(!wr(n,!1)){const{message:s}=xe("MISSING_OR_INVALID",`${i} must be in Record<string, string> format. Received: ${JSON.stringify(n)}`);throw new Error(s)}})},this.getPendingAuthRequest=t=>{const i=this.client.auth.requests.get(t);return typeof i=="object"?i:void 0},this.addToRecentlyDeleted=(t,i)=>{if(this.recentlyDeletedMap.set(t,i),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let n=0;const s=this.recentlyDeletedLimit/2;for(const a of this.recentlyDeletedMap.keys()){if(n++>=s)break;this.recentlyDeletedMap.delete(a)}}},this.checkRecentlyDeleted=t=>{const i=this.recentlyDeletedMap.get(t);if(i){const{message:n}=xe("MISSING_OR_INVALID",`Record was recently deleted - ${i}: ${t}`);throw new Error(n)}},this.isLinkModeEnabled=(t,i)=>{var n,s,a,f,h,u,g,w,M;return!t||i!==sr.link_mode?!1:((s=(n=this.client.metadata)==null?void 0:n.redirect)==null?void 0:s.linkMode)===!0&&((f=(a=this.client.metadata)==null?void 0:a.redirect)==null?void 0:f.universal)!==void 0&&((u=(h=this.client.metadata)==null?void 0:h.redirect)==null?void 0:u.universal)!==""&&((g=t?.redirect)==null?void 0:g.universal)!==void 0&&((w=t?.redirect)==null?void 0:w.universal)!==""&&((M=t?.redirect)==null?void 0:M.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(t.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(t,i)=>{var n;return this.isLinkModeEnabled(t,i)?(n=t?.redirect)==null?void 0:n.universal:void 0},this.handleLinkModeMessage=({url:t})=>{if(!t||!t.includes("wc_ev")||!t.includes("topic"))return;const i=zm(t,"topic")||"",n=decodeURIComponent(zm(t,"wc_ev")||""),s=this.client.session.keys.includes(i);s&&this.client.session.update(i,{transportType:sr.link_mode}),this.client.core.dispatchEnvelope({topic:i,message:n,sessionExists:s})},this.registerLinkModeListeners=async()=>{var t;if(Jd()||Vs()&&(t=this.client.metadata.redirect)!=null&&t.linkMode){const i=global==null?void 0:global.Linking;if(typeof i<"u"){i.addEventListener("url",this.handleLinkModeMessage,this.client.name);const n=await i.getInitialURL();n&&setTimeout(()=>{this.handleLinkModeMessage({url:n})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Lr.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:t,message:i,attestation:n,transportType:s}=e,{publicKey:a}=this.client.auth.authKeys.keys.includes(ch)?this.client.auth.authKeys.get(ch):{responseTopic:void 0,publicKey:void 0},f=await this.client.core.crypto.decode(t,i,{receiverPublicKey:a,encoding:s===sr.link_mode?Vc:Ys});try{v0(f)?(this.client.core.history.set(t,f),this.onRelayEventRequest({topic:t,payload:f,attestation:n,transportType:s,encryptedId:ys(i)})):nh(f)?(await this.client.core.history.resolve(f),await this.onRelayEventResponse({topic:t,payload:f,transportType:s}),this.client.core.history.delete(t,f.id)):this.onRelayEventUnknownPayload({topic:t,payload:f,transportType:s})}catch(h){this.client.logger.error(h)}}registerExpirerEvents(){this.client.core.expirer.on(on.expired,async e=>{const{topic:t,id:i}=qm(e.target);if(i&&this.client.pendingRequest.keys.includes(i))return await this.deletePendingSessionRequest(i,xe("EXPIRED"),!0);if(i&&this.client.auth.requests.keys.includes(i))return await this.deletePendingAuthRequest(i,xe("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):i&&(await this.deleteProposal(i,!0),this.client.events.emit("proposal_expire",{id:i}))})}registerPairingEvents(){this.client.core.pairing.events.on(qo.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(qo.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!wr(e,!1)){const{message:t}=xe("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:t}=xe("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(Js(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=xe("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!wr(e,!1)){const{message:t}=xe("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:t}=xe("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(Js(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:t}=xe("EXPIRED",`session topic: ${e}`);throw new Error(t)}if(!this.client.core.crypto.keychain.has(e)){const{message:t}=xe("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(t)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(wr(e,!1)){const{message:t}=xe("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}else{const{message:t}=xe("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}async isValidProposalId(e){if(!ZE(e)){const{message:t}=xe("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=xe("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(Js(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:t}=xe("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}}class MP extends Ho{constructor(e,t){super(e,t,hP,A0),this.core=e,this.logger=t}}class CP extends Ho{constructor(e,t){super(e,t,uP,A0),this.core=e,this.logger=t}}class PP extends Ho{constructor(e,t){super(e,t,pP,A0,i=>i.id),this.core=e,this.logger=t}}class DP extends Ho{constructor(e,t){super(e,t,bP,ah,()=>ch),this.core=e,this.logger=t}}class OP extends Ho{constructor(e,t){super(e,t,wP,ah),this.core=e,this.logger=t}}class RP extends Ho{constructor(e,t){super(e,t,yP,ah,i=>i.id),this.core=e,this.logger=t}}class TP{constructor(e,t){this.core=e,this.logger=t,this.authKeys=new DP(this.core,this.logger),this.pairingTopics=new OP(this.core,this.logger),this.requests=new RP(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class M0 extends DS{constructor(e){super(e),this.protocol=N2,this.version=$2,this.name=S0.name,this.events=new zr.exports.EventEmitter,this.on=(i,n)=>this.events.on(i,n),this.once=(i,n)=>this.events.once(i,n),this.off=(i,n)=>this.events.off(i,n),this.removeListener=(i,n)=>this.events.removeListener(i,n),this.removeAllListeners=i=>this.events.removeAllListeners(i),this.connect=async i=>{try{return await this.engine.connect(i)}catch(n){throw this.logger.error(n.message),n}},this.pair=async i=>{try{return await this.engine.pair(i)}catch(n){throw this.logger.error(n.message),n}},this.approve=async i=>{try{return await this.engine.approve(i)}catch(n){throw this.logger.error(n.message),n}},this.reject=async i=>{try{return await this.engine.reject(i)}catch(n){throw this.logger.error(n.message),n}},this.update=async i=>{try{return await this.engine.update(i)}catch(n){throw this.logger.error(n.message),n}},this.extend=async i=>{try{return await this.engine.extend(i)}catch(n){throw this.logger.error(n.message),n}},this.request=async i=>{try{return await this.engine.request(i)}catch(n){throw this.logger.error(n.message),n}},this.respond=async i=>{try{return await this.engine.respond(i)}catch(n){throw this.logger.error(n.message),n}},this.ping=async i=>{try{return await this.engine.ping(i)}catch(n){throw this.logger.error(n.message),n}},this.emit=async i=>{try{return await this.engine.emit(i)}catch(n){throw this.logger.error(n.message),n}},this.disconnect=async i=>{try{return await this.engine.disconnect(i)}catch(n){throw this.logger.error(n.message),n}},this.find=i=>{try{return this.engine.find(i)}catch(n){throw this.logger.error(n.message),n}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(i){throw this.logger.error(i.message),i}},this.authenticate=async(i,n)=>{try{return await this.engine.authenticate(i,n)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=i=>{try{return this.engine.formatAuthMessage(i)}catch(n){throw this.logger.error(n.message),n}},this.approveSessionAuthenticate=async i=>{try{return await this.engine.approveSessionAuthenticate(i)}catch(n){throw this.logger.error(n.message),n}},this.rejectSessionAuthenticate=async i=>{try{return await this.engine.rejectSessionAuthenticate(i)}catch(n){throw this.logger.error(n.message),n}},this.name=e?.name||S0.name,this.metadata=e?.metadata||$m(),this.signConfig=e?.signConfig;const t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Zn(th({level:e?.logger||S0.logger}));this.core=e?.core||new lP(e),this.logger=ci(t,this.name),this.session=new CP(this.core,this.logger),this.proposal=new MP(this.core,this.logger),this.pendingRequest=new PP(this.core,this.logger),this.engine=new IP(this),this.auth=new TP(this.core,this.logger)}static async init(e){const t=new M0(e);return await t.initialize(),t}get context(){return yi(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),setTimeout(()=>{this.engine.processRelayMessageCache()},_e.toMiliseconds(_e.ONE_SECOND))}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var C0={exports:{}};/**
|
|
44
44
|
* @license
|
|
45
45
|
* Lodash <https://lodash.com/>
|
|
46
46
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
47
47
|
* Released under MIT license <https://lodash.com/license>
|
|
48
48
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
49
49
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
50
|
-
*/(function(r,e){(function(){var t,i="4.17.21",n=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",f="Invalid `variable` option passed into `_.template`",h="__lodash_hash_undefined__",u=500,g="__lodash_placeholder__",w=1,M=2,C=4,O=1,N=2,j=1,H=2,F=4,G=8,B=16,z=32,W=64,_=128,U=256,ee=512,oe=30,L="...",b=800,m=16,l=1,d=2,y=3,P=1/0,D=9007199254740991,S=17976931348623157e292,v=0/0,A=4294967295,x=A-1,$=A>>>1,ae=[["ary",_],["bind",j],["bindKey",H],["curry",G],["curryRight",B],["flip",ee],["partial",z],["partialRight",W],["rearg",U]],R="[object Arguments]",X="[object Array]",V="[object AsyncFunction]",J="[object Boolean]",K="[object Date]",E="[object DOMException]",Y="[object Error]",re="[object Function]",le="[object GeneratorFunction]",he="[object Map]",ge="[object Number]",He="[object Null]",Te="[object Object]",Ce="[object Promise]",Xe="[object Proxy]",Ne="[object RegExp]",be="[object Set]",Pe="[object String]",De="[object Symbol]",ye="[object Undefined]",Ie="[object WeakMap]",Oe="[object WeakSet]",me="[object ArrayBuffer]",Me="[object DataView]",Be="[object Float32Array]",we="[object Float64Array]",ke="[object Int8Array]",We="[object Int16Array]",Ae="[object Int32Array]",Ve="[object Uint8Array]",Ke="[object Uint8ClampedArray]",Ge="[object Uint16Array]",mt="[object Uint32Array]",It=/\b__p \+= '';/g,Ye=/\b(__p \+=) '' \+/g,Pt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ot=/&(?:amp|lt|gt|quot|#39);/g,Ze=/[&<>"']/g,rt=RegExp(Ot.source),et=RegExp(Ze.source),$e=/<%-([\s\S]+?)%>/g,it=/<%([\s\S]+?)%>/g,tt=/<%=([\s\S]+?)%>/g,Re=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,lt=/^\w*$/,ht=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Le=/[\\^$.*+?()[\]{}|]/g,ut=RegExp(Le.source),nt=/^\s+/,Fe=/\s/,st=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Qe=/\{\n\/\* \[wrapped with (.+)\] \*/,qe=/,? & /,dt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Ht=/[()=,{}\[\]\/\s]/,at=/\\(\\)?/g,kt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,_t=/\w*$/,qt=/^[-+]0x[0-9a-f]+$/i,Zr=/^0b[01]+$/i,Xr=/^\[object .+?Constructor\]$/,ei=/^0o[0-7]+$/i,ti=/^(?:0|[1-9]\d*)$/,vr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ai=/($^)/,Pn=/['\n\r\u2028\u2029\\]/g,Ei="\\ud800-\\udfff",Dn="\\u0300-\\u036f",On="\\ufe20-\\ufe2f",Si="\\u20d0-\\u20ff",fn=Dn+On+Si,ln="\\u2700-\\u27bf",Cr="a-z\\xdf-\\xf6\\xf8-\\xff",Rn="\\xac\\xb1\\xd7\\xf7",Tn="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Nn="\\u2000-\\u206f",na=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",lo="A-Z\\xc0-\\xd6\\xd8-\\xde",kh="\\ufe0e\\ufe0f",sa=Rn+Tn+Nn+na,$f="['\u2019]",oa="["+Ei+"]",Lf="["+sa+"]",aa="["+fn+"]",jh="\\d+",Vp="["+ln+"]",Wh="["+Cr+"]",Kh="[^"+Ei+sa+jh+ln+Cr+lo+"]",hc="\\ud83c[\\udffb-\\udfff]",Gp="(?:"+aa+"|"+hc+")",Vh="[^"+Ei+"]",uc="(?:\\ud83c[\\udde6-\\uddff]){2}",ho="[\\ud800-\\udbff][\\udc00-\\udfff]",Hi="["+lo+"]",Gh="\\u200d",Yh="(?:"+Wh+"|"+Kh+")",cs="(?:"+Hi+"|"+Kh+")",Jh="(?:"+$f+"(?:d|ll|m|re|s|t|ve))?",Qh="(?:"+$f+"(?:D|LL|M|RE|S|T|VE))?",Zh=Gp+"?",Xh="["+kh+"]?",Yp="(?:"+Gh+"(?:"+[Vh,uc,ho].join("|")+")"+Xh+Zh+")*",Ps="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",eu="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",tu=Xh+Zh+Yp,dc="(?:"+[Vp,uc,ho].join("|")+")"+tu,Jp="(?:"+[Vh+aa+"?",aa,uc,ho,oa].join("|")+")",Bf=RegExp($f,"g"),Qp=RegExp(aa,"g"),pc=RegExp(hc+"(?="+hc+")|"+Jp+tu,"g"),ru=RegExp([Hi+"?"+Wh+"+"+Jh+"(?="+[Lf,Hi,"$"].join("|")+")",cs+"+"+Qh+"(?="+[Lf,Hi+Yh,"$"].join("|")+")",Hi+"?"+Yh+"+"+Jh,Hi+"+"+Qh,eu,Ps,jh,dc].join("|"),"g"),iu=RegExp("["+Gh+Ei+fn+kh+"]"),ca=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nu=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Zp=-1,Zt={};Zt[Be]=Zt[we]=Zt[ke]=Zt[We]=Zt[Ae]=Zt[Ve]=Zt[Ke]=Zt[Ge]=Zt[mt]=!0,Zt[R]=Zt[X]=Zt[me]=Zt[J]=Zt[Me]=Zt[K]=Zt[Y]=Zt[re]=Zt[he]=Zt[ge]=Zt[Te]=Zt[Ne]=Zt[be]=Zt[Pe]=Zt[Ie]=!1;var Qt={};Qt[R]=Qt[X]=Qt[me]=Qt[Me]=Qt[J]=Qt[K]=Qt[Be]=Qt[we]=Qt[ke]=Qt[We]=Qt[Ae]=Qt[he]=Qt[ge]=Qt[Te]=Qt[Ne]=Qt[be]=Qt[Pe]=Qt[De]=Qt[Ve]=Qt[Ke]=Qt[Ge]=Qt[mt]=!0,Qt[Y]=Qt[re]=Qt[Ie]=!1;var Q={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},ne={"&":"&","<":"<",">":">",'"':""","'":"'"},pe={"&":"&","<":"<",">":">",""":'"',"'":"'"},Ue={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Xt=parseFloat,bt=parseInt,or=typeof fr=="object"&&fr&&fr.Object===Object&&fr,Er=typeof self=="object"&&self&&self.Object===Object&&self,Bt=or||Er||Function("return this")(),er=e&&!e.nodeType&&e,_r=er&&!0&&r&&!r.nodeType&&r,Ii=_r&&_r.exports===er,Sr=Ii&&or.process,ar=function(){try{var ie=_r&&_r.require&&_r.require("util").types;return ie||Sr&&Sr.binding&&Sr.binding("util")}catch{}}(),hi=ar&&ar.isArrayBuffer,$n=ar&&ar.isDate,hn=ar&&ar.isMap,fs=ar&&ar.isRegExp,Ff=ar&&ar.isSet,fa=ar&&ar.isTypedArray;function Ur(ie,fe,ce){switch(ce.length){case 0:return ie.call(fe);case 1:return ie.call(fe,ce[0]);case 2:return ie.call(fe,ce[0],ce[1]);case 3:return ie.call(fe,ce[0],ce[1],ce[2])}return ie.apply(fe,ce)}function T$(ie,fe,ce,ze){for(var gt=-1,Wt=ie==null?0:ie.length;++gt<Wt;){var Pr=ie[gt];fe(ze,Pr,ce(Pr),ie)}return ze}function un(ie,fe){for(var ce=-1,ze=ie==null?0:ie.length;++ce<ze&&fe(ie[ce],ce,ie)!==!1;);return ie}function N$(ie,fe){for(var ce=ie==null?0:ie.length;ce--&&fe(ie[ce],ce,ie)!==!1;);return ie}function Gw(ie,fe){for(var ce=-1,ze=ie==null?0:ie.length;++ce<ze;)if(!fe(ie[ce],ce,ie))return!1;return!0}function uo(ie,fe){for(var ce=-1,ze=ie==null?0:ie.length,gt=0,Wt=[];++ce<ze;){var Pr=ie[ce];fe(Pr,ce,ie)&&(Wt[gt++]=Pr)}return Wt}function su(ie,fe){var ce=ie==null?0:ie.length;return!!ce&&gc(ie,fe,0)>-1}function Xp(ie,fe,ce){for(var ze=-1,gt=ie==null?0:ie.length;++ze<gt;)if(ce(fe,ie[ze]))return!0;return!1}function cr(ie,fe){for(var ce=-1,ze=ie==null?0:ie.length,gt=Array(ze);++ce<ze;)gt[ce]=fe(ie[ce],ce,ie);return gt}function po(ie,fe){for(var ce=-1,ze=fe.length,gt=ie.length;++ce<ze;)ie[gt+ce]=fe[ce];return ie}function e1(ie,fe,ce,ze){var gt=-1,Wt=ie==null?0:ie.length;for(ze&&Wt&&(ce=ie[++gt]);++gt<Wt;)ce=fe(ce,ie[gt],gt,ie);return ce}function $$(ie,fe,ce,ze){var gt=ie==null?0:ie.length;for(ze&>&&(ce=ie[--gt]);gt--;)ce=fe(ce,ie[gt],gt,ie);return ce}function t1(ie,fe){for(var ce=-1,ze=ie==null?0:ie.length;++ce<ze;)if(fe(ie[ce],ce,ie))return!0;return!1}var L$=r1("length");function B$(ie){return ie.split("")}function F$(ie){return ie.match(dt)||[]}function Yw(ie,fe,ce){var ze;return ce(ie,function(gt,Wt,Pr){if(fe(gt,Wt,Pr))return ze=Wt,!1}),ze}function ou(ie,fe,ce,ze){for(var gt=ie.length,Wt=ce+(ze?1:-1);ze?Wt--:++Wt<gt;)if(fe(ie[Wt],Wt,ie))return Wt;return-1}function gc(ie,fe,ce){return fe===fe?J$(ie,fe,ce):ou(ie,Jw,ce)}function U$(ie,fe,ce,ze){for(var gt=ce-1,Wt=ie.length;++gt<Wt;)if(ze(ie[gt],fe))return gt;return-1}function Jw(ie){return ie!==ie}function Qw(ie,fe){var ce=ie==null?0:ie.length;return ce?n1(ie,fe)/ce:v}function r1(ie){return function(fe){return fe==null?t:fe[ie]}}function i1(ie){return function(fe){return ie==null?t:ie[fe]}}function Zw(ie,fe,ce,ze,gt){return gt(ie,function(Wt,Pr,tr){ce=ze?(ze=!1,Wt):fe(ce,Wt,Pr,tr)}),ce}function q$(ie,fe){var ce=ie.length;for(ie.sort(fe);ce--;)ie[ce]=ie[ce].value;return ie}function n1(ie,fe){for(var ce,ze=-1,gt=ie.length;++ze<gt;){var Wt=fe(ie[ze]);Wt!==t&&(ce=ce===t?Wt:ce+Wt)}return ce}function s1(ie,fe){for(var ce=-1,ze=Array(ie);++ce<ie;)ze[ce]=fe(ce);return ze}function z$(ie,fe){return cr(fe,function(ce){return[ce,ie[ce]]})}function Xw(ie){return ie&&ie.slice(0,iy(ie)+1).replace(nt,"")}function ki(ie){return function(fe){return ie(fe)}}function o1(ie,fe){return cr(fe,function(ce){return ie[ce]})}function Uf(ie,fe){return ie.has(fe)}function ey(ie,fe){for(var ce=-1,ze=ie.length;++ce<ze&&gc(fe,ie[ce],0)>-1;);return ce}function ty(ie,fe){for(var ce=ie.length;ce--&&gc(fe,ie[ce],0)>-1;);return ce}function H$(ie,fe){for(var ce=ie.length,ze=0;ce--;)ie[ce]===fe&&++ze;return ze}var k$=i1(Q),j$=i1(ne);function W$(ie){return"\\"+Ue[ie]}function K$(ie,fe){return ie==null?t:ie[fe]}function vc(ie){return iu.test(ie)}function V$(ie){return ca.test(ie)}function G$(ie){for(var fe,ce=[];!(fe=ie.next()).done;)ce.push(fe.value);return ce}function a1(ie){var fe=-1,ce=Array(ie.size);return ie.forEach(function(ze,gt){ce[++fe]=[gt,ze]}),ce}function ry(ie,fe){return function(ce){return ie(fe(ce))}}function go(ie,fe){for(var ce=-1,ze=ie.length,gt=0,Wt=[];++ce<ze;){var Pr=ie[ce];(Pr===fe||Pr===g)&&(ie[ce]=g,Wt[gt++]=ce)}return Wt}function au(ie){var fe=-1,ce=Array(ie.size);return ie.forEach(function(ze){ce[++fe]=ze}),ce}function Y$(ie){var fe=-1,ce=Array(ie.size);return ie.forEach(function(ze){ce[++fe]=[ze,ze]}),ce}function J$(ie,fe,ce){for(var ze=ce-1,gt=ie.length;++ze<gt;)if(ie[ze]===fe)return ze;return-1}function Q$(ie,fe,ce){for(var ze=ce+1;ze--;)if(ie[ze]===fe)return ze;return ze}function mc(ie){return vc(ie)?X$(ie):L$(ie)}function Ln(ie){return vc(ie)?eL(ie):B$(ie)}function iy(ie){for(var fe=ie.length;fe--&&Fe.test(ie.charAt(fe)););return fe}var Z$=i1(pe);function X$(ie){for(var fe=pc.lastIndex=0;pc.test(ie);)++fe;return fe}function eL(ie){return ie.match(pc)||[]}function tL(ie){return ie.match(ru)||[]}var rL=function ie(fe){fe=fe==null?Bt:bc.defaults(Bt.Object(),fe,bc.pick(Bt,nu));var ce=fe.Array,ze=fe.Date,gt=fe.Error,Wt=fe.Function,Pr=fe.Math,tr=fe.Object,c1=fe.RegExp,iL=fe.String,dn=fe.TypeError,cu=ce.prototype,nL=Wt.prototype,wc=tr.prototype,fu=fe["__core-js_shared__"],lu=nL.toString,Yt=wc.hasOwnProperty,sL=0,ny=function(){var o=/[^.]+$/.exec(fu&&fu.keys&&fu.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""}(),hu=wc.toString,oL=lu.call(tr),aL=Bt._,cL=c1("^"+lu.call(Yt).replace(Le,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),uu=Ii?fe.Buffer:t,vo=fe.Symbol,du=fe.Uint8Array,sy=uu?uu.allocUnsafe:t,pu=ry(tr.getPrototypeOf,tr),oy=tr.create,ay=wc.propertyIsEnumerable,gu=cu.splice,cy=vo?vo.isConcatSpreadable:t,qf=vo?vo.iterator:t,la=vo?vo.toStringTag:t,vu=function(){try{var o=ga(tr,"defineProperty");return o({},"",{}),o}catch{}}(),fL=fe.clearTimeout!==Bt.clearTimeout&&fe.clearTimeout,lL=ze&&ze.now!==Bt.Date.now&&ze.now,hL=fe.setTimeout!==Bt.setTimeout&&fe.setTimeout,mu=Pr.ceil,bu=Pr.floor,f1=tr.getOwnPropertySymbols,uL=uu?uu.isBuffer:t,fy=fe.isFinite,dL=cu.join,pL=ry(tr.keys,tr),Dr=Pr.max,ri=Pr.min,gL=ze.now,vL=fe.parseInt,ly=Pr.random,mL=cu.reverse,l1=ga(fe,"DataView"),zf=ga(fe,"Map"),h1=ga(fe,"Promise"),yc=ga(fe,"Set"),Hf=ga(fe,"WeakMap"),kf=ga(tr,"create"),wu=Hf&&new Hf,_c={},bL=va(l1),wL=va(zf),yL=va(h1),_L=va(yc),xL=va(Hf),yu=vo?vo.prototype:t,jf=yu?yu.valueOf:t,hy=yu?yu.toString:t;function q(o){if(mr(o)&&!wt(o)&&!(o instanceof $t)){if(o instanceof pn)return o;if(Yt.call(o,"__wrapped__"))return u6(o)}return new pn(o)}var xc=function(){function o(){}return function(c){if(!hr(c))return{};if(oy)return oy(c);o.prototype=c;var p=new o;return o.prototype=t,p}}();function _u(){}function pn(o,c){this.__wrapped__=o,this.__actions__=[],this.__chain__=!!c,this.__index__=0,this.__values__=t}q.templateSettings={escape:$e,evaluate:it,interpolate:tt,variable:"",imports:{_:q}},q.prototype=_u.prototype,q.prototype.constructor=q,pn.prototype=xc(_u.prototype),pn.prototype.constructor=pn;function $t(o){this.__wrapped__=o,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=A,this.__views__=[]}function AL(){var o=new $t(this.__wrapped__);return o.__actions__=Mi(this.__actions__),o.__dir__=this.__dir__,o.__filtered__=this.__filtered__,o.__iteratees__=Mi(this.__iteratees__),o.__takeCount__=this.__takeCount__,o.__views__=Mi(this.__views__),o}function EL(){if(this.__filtered__){var o=new $t(this);o.__dir__=-1,o.__filtered__=!0}else o=this.clone(),o.__dir__*=-1;return o}function SL(){var o=this.__wrapped__.value(),c=this.__dir__,p=wt(o),I=c<0,T=p?o.length:0,k=BB(0,T,this.__views__),Z=k.start,te=k.end,se=te-Z,ue=I?te:Z-1,de=this.__iteratees__,ve=de.length,Se=0,Je=ri(se,this.__takeCount__);if(!p||!I&&T==se&&Je==se)return $y(o,this.__actions__);var ct=[];e:for(;se--&&Se<Je;){ue+=c;for(var St=-1,ft=o[ue];++St<ve;){var Rt=de[St],Ft=Rt.iteratee,Ki=Rt.type,pi=Ft(ft);if(Ki==d)ft=pi;else if(!pi){if(Ki==l)continue e;break e}}ct[Se++]=ft}return ct}$t.prototype=xc(_u.prototype),$t.prototype.constructor=$t;function ha(o){var c=-1,p=o==null?0:o.length;for(this.clear();++c<p;){var I=o[c];this.set(I[0],I[1])}}function IL(){this.__data__=kf?kf(null):{},this.size=0}function ML(o){var c=this.has(o)&&delete this.__data__[o];return this.size-=c?1:0,c}function CL(o){var c=this.__data__;if(kf){var p=c[o];return p===h?t:p}return Yt.call(c,o)?c[o]:t}function PL(o){var c=this.__data__;return kf?c[o]!==t:Yt.call(c,o)}function DL(o,c){var p=this.__data__;return this.size+=this.has(o)?0:1,p[o]=kf&&c===t?h:c,this}ha.prototype.clear=IL,ha.prototype.delete=ML,ha.prototype.get=CL,ha.prototype.has=PL,ha.prototype.set=DL;function Ds(o){var c=-1,p=o==null?0:o.length;for(this.clear();++c<p;){var I=o[c];this.set(I[0],I[1])}}function OL(){this.__data__=[],this.size=0}function RL(o){var c=this.__data__,p=xu(c,o);if(p<0)return!1;var I=c.length-1;return p==I?c.pop():gu.call(c,p,1),--this.size,!0}function TL(o){var c=this.__data__,p=xu(c,o);return p<0?t:c[p][1]}function NL(o){return xu(this.__data__,o)>-1}function $L(o,c){var p=this.__data__,I=xu(p,o);return I<0?(++this.size,p.push([o,c])):p[I][1]=c,this}Ds.prototype.clear=OL,Ds.prototype.delete=RL,Ds.prototype.get=TL,Ds.prototype.has=NL,Ds.prototype.set=$L;function Os(o){var c=-1,p=o==null?0:o.length;for(this.clear();++c<p;){var I=o[c];this.set(I[0],I[1])}}function LL(){this.size=0,this.__data__={hash:new ha,map:new(zf||Ds),string:new ha}}function BL(o){var c=Nu(this,o).delete(o);return this.size-=c?1:0,c}function FL(o){return Nu(this,o).get(o)}function UL(o){return Nu(this,o).has(o)}function qL(o,c){var p=Nu(this,o),I=p.size;return p.set(o,c),this.size+=p.size==I?0:1,this}Os.prototype.clear=LL,Os.prototype.delete=BL,Os.prototype.get=FL,Os.prototype.has=UL,Os.prototype.set=qL;function ua(o){var c=-1,p=o==null?0:o.length;for(this.__data__=new Os;++c<p;)this.add(o[c])}function zL(o){return this.__data__.set(o,h),this}function HL(o){return this.__data__.has(o)}ua.prototype.add=ua.prototype.push=zL,ua.prototype.has=HL;function Bn(o){var c=this.__data__=new Ds(o);this.size=c.size}function kL(){this.__data__=new Ds,this.size=0}function jL(o){var c=this.__data__,p=c.delete(o);return this.size=c.size,p}function WL(o){return this.__data__.get(o)}function KL(o){return this.__data__.has(o)}function VL(o,c){var p=this.__data__;if(p instanceof Ds){var I=p.__data__;if(!zf||I.length<n-1)return I.push([o,c]),this.size=++p.size,this;p=this.__data__=new Os(I)}return p.set(o,c),this.size=p.size,this}Bn.prototype.clear=kL,Bn.prototype.delete=jL,Bn.prototype.get=WL,Bn.prototype.has=KL,Bn.prototype.set=VL;function uy(o,c){var p=wt(o),I=!p&&ma(o),T=!p&&!I&&_o(o),k=!p&&!I&&!T&&Ic(o),Z=p||I||T||k,te=Z?s1(o.length,iL):[],se=te.length;for(var ue in o)(c||Yt.call(o,ue))&&!(Z&&(ue=="length"||T&&(ue=="offset"||ue=="parent")||k&&(ue=="buffer"||ue=="byteLength"||ue=="byteOffset")||$s(ue,se)))&&te.push(ue);return te}function dy(o){var c=o.length;return c?o[x1(0,c-1)]:t}function GL(o,c){return $u(Mi(o),da(c,0,o.length))}function YL(o){return $u(Mi(o))}function u1(o,c,p){(p!==t&&!Fn(o[c],p)||p===t&&!(c in o))&&Rs(o,c,p)}function Wf(o,c,p){var I=o[c];(!(Yt.call(o,c)&&Fn(I,p))||p===t&&!(c in o))&&Rs(o,c,p)}function xu(o,c){for(var p=o.length;p--;)if(Fn(o[p][0],c))return p;return-1}function JL(o,c,p,I){return mo(o,function(T,k,Z){c(I,T,p(T),Z)}),I}function py(o,c){return o&&hs(c,qr(c),o)}function QL(o,c){return o&&hs(c,Pi(c),o)}function Rs(o,c,p){c=="__proto__"&&vu?vu(o,c,{configurable:!0,enumerable:!0,value:p,writable:!0}):o[c]=p}function d1(o,c){for(var p=-1,I=c.length,T=ce(I),k=o==null;++p<I;)T[p]=k?t:V1(o,c[p]);return T}function da(o,c,p){return o===o&&(p!==t&&(o=o<=p?o:p),c!==t&&(o=o>=c?o:c)),o}function gn(o,c,p,I,T,k){var Z,te=c&w,se=c&M,ue=c&C;if(p&&(Z=T?p(o,I,T,k):p(o)),Z!==t)return Z;if(!hr(o))return o;var de=wt(o);if(de){if(Z=UB(o),!te)return Mi(o,Z)}else{var ve=ii(o),Se=ve==re||ve==le;if(_o(o))return Fy(o,te);if(ve==Te||ve==R||Se&&!T){if(Z=se||Se?{}:i6(o),!te)return se?CB(o,QL(Z,o)):MB(o,py(Z,o))}else{if(!Qt[ve])return T?o:{};Z=qB(o,ve,te)}}k||(k=new Bn);var Je=k.get(o);if(Je)return Je;k.set(o,Z),R6(o)?o.forEach(function(ft){Z.add(gn(ft,c,p,ft,o,k))}):D6(o)&&o.forEach(function(ft,Rt){Z.set(Rt,gn(ft,c,p,Rt,o,k))});var ct=ue?se?T1:R1:se?Pi:qr,St=de?t:ct(o);return un(St||o,function(ft,Rt){St&&(Rt=ft,ft=o[Rt]),Wf(Z,Rt,gn(ft,c,p,Rt,o,k))}),Z}function ZL(o){var c=qr(o);return function(p){return gy(p,o,c)}}function gy(o,c,p){var I=p.length;if(o==null)return!I;for(o=tr(o);I--;){var T=p[I],k=c[T],Z=o[T];if(Z===t&&!(T in o)||!k(Z))return!1}return!0}function vy(o,c,p){if(typeof o!="function")throw new dn(a);return Zf(function(){o.apply(t,p)},c)}function Kf(o,c,p,I){var T=-1,k=su,Z=!0,te=o.length,se=[],ue=c.length;if(!te)return se;p&&(c=cr(c,ki(p))),I?(k=Xp,Z=!1):c.length>=n&&(k=Uf,Z=!1,c=new ua(c));e:for(;++T<te;){var de=o[T],ve=p==null?de:p(de);if(de=I||de!==0?de:0,Z&&ve===ve){for(var Se=ue;Se--;)if(c[Se]===ve)continue e;se.push(de)}else k(c,ve,I)||se.push(de)}return se}var mo=ky(ls),my=ky(g1,!0);function XL(o,c){var p=!0;return mo(o,function(I,T,k){return p=!!c(I,T,k),p}),p}function Au(o,c,p){for(var I=-1,T=o.length;++I<T;){var k=o[I],Z=c(k);if(Z!=null&&(te===t?Z===Z&&!Wi(Z):p(Z,te)))var te=Z,se=k}return se}function eB(o,c,p,I){var T=o.length;for(p=Et(p),p<0&&(p=-p>T?0:T+p),I=I===t||I>T?T:Et(I),I<0&&(I+=T),I=p>I?0:N6(I);p<I;)o[p++]=c;return o}function by(o,c){var p=[];return mo(o,function(I,T,k){c(I,T,k)&&p.push(I)}),p}function Vr(o,c,p,I,T){var k=-1,Z=o.length;for(p||(p=HB),T||(T=[]);++k<Z;){var te=o[k];c>0&&p(te)?c>1?Vr(te,c-1,p,I,T):po(T,te):I||(T[T.length]=te)}return T}var p1=jy(),wy=jy(!0);function ls(o,c){return o&&p1(o,c,qr)}function g1(o,c){return o&&wy(o,c,qr)}function Eu(o,c){return uo(c,function(p){return Ls(o[p])})}function pa(o,c){c=wo(c,o);for(var p=0,I=c.length;o!=null&&p<I;)o=o[us(c[p++])];return p&&p==I?o:t}function yy(o,c,p){var I=c(o);return wt(o)?I:po(I,p(o))}function ui(o){return o==null?o===t?ye:He:la&&la in tr(o)?LB(o):YB(o)}function v1(o,c){return o>c}function tB(o,c){return o!=null&&Yt.call(o,c)}function rB(o,c){return o!=null&&c in tr(o)}function iB(o,c,p){return o>=ri(c,p)&&o<Dr(c,p)}function m1(o,c,p){for(var I=p?Xp:su,T=o[0].length,k=o.length,Z=k,te=ce(k),se=1/0,ue=[];Z--;){var de=o[Z];Z&&c&&(de=cr(de,ki(c))),se=ri(de.length,se),te[Z]=!p&&(c||T>=120&&de.length>=120)?new ua(Z&&de):t}de=o[0];var ve=-1,Se=te[0];e:for(;++ve<T&&ue.length<se;){var Je=de[ve],ct=c?c(Je):Je;if(Je=p||Je!==0?Je:0,!(Se?Uf(Se,ct):I(ue,ct,p))){for(Z=k;--Z;){var St=te[Z];if(!(St?Uf(St,ct):I(o[Z],ct,p)))continue e}Se&&Se.push(ct),ue.push(Je)}}return ue}function nB(o,c,p,I){return ls(o,function(T,k,Z){c(I,p(T),k,Z)}),I}function Vf(o,c,p){c=wo(c,o),o=a6(o,c);var I=o==null?o:o[us(mn(c))];return I==null?t:Ur(I,o,p)}function _y(o){return mr(o)&&ui(o)==R}function sB(o){return mr(o)&&ui(o)==me}function oB(o){return mr(o)&&ui(o)==K}function Gf(o,c,p,I,T){return o===c?!0:o==null||c==null||!mr(o)&&!mr(c)?o!==o&&c!==c:aB(o,c,p,I,Gf,T)}function aB(o,c,p,I,T,k){var Z=wt(o),te=wt(c),se=Z?X:ii(o),ue=te?X:ii(c);se=se==R?Te:se,ue=ue==R?Te:ue;var de=se==Te,ve=ue==Te,Se=se==ue;if(Se&&_o(o)){if(!_o(c))return!1;Z=!0,de=!1}if(Se&&!de)return k||(k=new Bn),Z||Ic(o)?e6(o,c,p,I,T,k):NB(o,c,se,p,I,T,k);if(!(p&O)){var Je=de&&Yt.call(o,"__wrapped__"),ct=ve&&Yt.call(c,"__wrapped__");if(Je||ct){var St=Je?o.value():o,ft=ct?c.value():c;return k||(k=new Bn),T(St,ft,p,I,k)}}return Se?(k||(k=new Bn),$B(o,c,p,I,T,k)):!1}function cB(o){return mr(o)&&ii(o)==he}function b1(o,c,p,I){var T=p.length,k=T,Z=!I;if(o==null)return!k;for(o=tr(o);T--;){var te=p[T];if(Z&&te[2]?te[1]!==o[te[0]]:!(te[0]in o))return!1}for(;++T<k;){te=p[T];var se=te[0],ue=o[se],de=te[1];if(Z&&te[2]){if(ue===t&&!(se in o))return!1}else{var ve=new Bn;if(I)var Se=I(ue,de,se,o,c,ve);if(!(Se===t?Gf(de,ue,O|N,I,ve):Se))return!1}}return!0}function xy(o){if(!hr(o)||jB(o))return!1;var c=Ls(o)?cL:Xr;return c.test(va(o))}function fB(o){return mr(o)&&ui(o)==Ne}function lB(o){return mr(o)&&ii(o)==be}function hB(o){return mr(o)&&zu(o.length)&&!!Zt[ui(o)]}function Ay(o){return typeof o=="function"?o:o==null?Di:typeof o=="object"?wt(o)?Iy(o[0],o[1]):Sy(o):W6(o)}function w1(o){if(!Qf(o))return pL(o);var c=[];for(var p in tr(o))Yt.call(o,p)&&p!="constructor"&&c.push(p);return c}function uB(o){if(!hr(o))return GB(o);var c=Qf(o),p=[];for(var I in o)I=="constructor"&&(c||!Yt.call(o,I))||p.push(I);return p}function y1(o,c){return o<c}function Ey(o,c){var p=-1,I=Ci(o)?ce(o.length):[];return mo(o,function(T,k,Z){I[++p]=c(T,k,Z)}),I}function Sy(o){var c=$1(o);return c.length==1&&c[0][2]?s6(c[0][0],c[0][1]):function(p){return p===o||b1(p,o,c)}}function Iy(o,c){return B1(o)&&n6(c)?s6(us(o),c):function(p){var I=V1(p,o);return I===t&&I===c?G1(p,o):Gf(c,I,O|N)}}function Su(o,c,p,I,T){o!==c&&p1(c,function(k,Z){if(T||(T=new Bn),hr(k))dB(o,c,Z,p,Su,I,T);else{var te=I?I(U1(o,Z),k,Z+"",o,c,T):t;te===t&&(te=k),u1(o,Z,te)}},Pi)}function dB(o,c,p,I,T,k,Z){var te=U1(o,p),se=U1(c,p),ue=Z.get(se);if(ue){u1(o,p,ue);return}var de=k?k(te,se,p+"",o,c,Z):t,ve=de===t;if(ve){var Se=wt(se),Je=!Se&&_o(se),ct=!Se&&!Je&&Ic(se);de=se,Se||Je||ct?wt(te)?de=te:xr(te)?de=Mi(te):Je?(ve=!1,de=Fy(se,!0)):ct?(ve=!1,de=Uy(se,!0)):de=[]:Xf(se)||ma(se)?(de=te,ma(te)?de=$6(te):(!hr(te)||Ls(te))&&(de=i6(se))):ve=!1}ve&&(Z.set(se,de),T(de,se,I,k,Z),Z.delete(se)),u1(o,p,de)}function My(o,c){var p=o.length;if(p)return c+=c<0?p:0,$s(c,p)?o[c]:t}function Cy(o,c,p){c.length?c=cr(c,function(k){return wt(k)?function(Z){return pa(Z,k.length===1?k[0]:k)}:k}):c=[Di];var I=-1;c=cr(c,ki(ot()));var T=Ey(o,function(k,Z,te){var se=cr(c,function(ue){return ue(k)});return{criteria:se,index:++I,value:k}});return q$(T,function(k,Z){return IB(k,Z,p)})}function pB(o,c){return Py(o,c,function(p,I){return G1(o,I)})}function Py(o,c,p){for(var I=-1,T=c.length,k={};++I<T;){var Z=c[I],te=pa(o,Z);p(te,Z)&&Yf(k,wo(Z,o),te)}return k}function gB(o){return function(c){return pa(c,o)}}function _1(o,c,p,I){var T=I?U$:gc,k=-1,Z=c.length,te=o;for(o===c&&(c=Mi(c)),p&&(te=cr(o,ki(p)));++k<Z;)for(var se=0,ue=c[k],de=p?p(ue):ue;(se=T(te,de,se,I))>-1;)te!==o&&gu.call(te,se,1),gu.call(o,se,1);return o}function Dy(o,c){for(var p=o?c.length:0,I=p-1;p--;){var T=c[p];if(p==I||T!==k){var k=T;$s(T)?gu.call(o,T,1):S1(o,T)}}return o}function x1(o,c){return o+bu(ly()*(c-o+1))}function vB(o,c,p,I){for(var T=-1,k=Dr(mu((c-o)/(p||1)),0),Z=ce(k);k--;)Z[I?k:++T]=o,o+=p;return Z}function A1(o,c){var p="";if(!o||c<1||c>D)return p;do c%2&&(p+=o),c=bu(c/2),c&&(o+=o);while(c);return p}function Mt(o,c){return q1(o6(o,c,Di),o+"")}function mB(o){return dy(Mc(o))}function bB(o,c){var p=Mc(o);return $u(p,da(c,0,p.length))}function Yf(o,c,p,I){if(!hr(o))return o;c=wo(c,o);for(var T=-1,k=c.length,Z=k-1,te=o;te!=null&&++T<k;){var se=us(c[T]),ue=p;if(se==="__proto__"||se==="constructor"||se==="prototype")return o;if(T!=Z){var de=te[se];ue=I?I(de,se,te):t,ue===t&&(ue=hr(de)?de:$s(c[T+1])?[]:{})}Wf(te,se,ue),te=te[se]}return o}var Oy=wu?function(o,c){return wu.set(o,c),o}:Di,wB=vu?function(o,c){return vu(o,"toString",{configurable:!0,enumerable:!1,value:J1(c),writable:!0})}:Di;function yB(o){return $u(Mc(o))}function vn(o,c,p){var I=-1,T=o.length;c<0&&(c=-c>T?0:T+c),p=p>T?T:p,p<0&&(p+=T),T=c>p?0:p-c>>>0,c>>>=0;for(var k=ce(T);++I<T;)k[I]=o[I+c];return k}function _B(o,c){var p;return mo(o,function(I,T,k){return p=c(I,T,k),!p}),!!p}function Iu(o,c,p){var I=0,T=o==null?I:o.length;if(typeof c=="number"&&c===c&&T<=$){for(;I<T;){var k=I+T>>>1,Z=o[k];Z!==null&&!Wi(Z)&&(p?Z<=c:Z<c)?I=k+1:T=k}return T}return E1(o,c,Di,p)}function E1(o,c,p,I){var T=0,k=o==null?0:o.length;if(k===0)return 0;c=p(c);for(var Z=c!==c,te=c===null,se=Wi(c),ue=c===t;T<k;){var de=bu((T+k)/2),ve=p(o[de]),Se=ve!==t,Je=ve===null,ct=ve===ve,St=Wi(ve);if(Z)var ft=I||ct;else ue?ft=ct&&(I||Se):te?ft=ct&&Se&&(I||!Je):se?ft=ct&&Se&&!Je&&(I||!St):Je||St?ft=!1:ft=I?ve<=c:ve<c;ft?T=de+1:k=de}return ri(k,x)}function Ry(o,c){for(var p=-1,I=o.length,T=0,k=[];++p<I;){var Z=o[p],te=c?c(Z):Z;if(!p||!Fn(te,se)){var se=te;k[T++]=Z===0?0:Z}}return k}function Ty(o){return typeof o=="number"?o:Wi(o)?v:+o}function ji(o){if(typeof o=="string")return o;if(wt(o))return cr(o,ji)+"";if(Wi(o))return hy?hy.call(o):"";var c=o+"";return c=="0"&&1/o==-P?"-0":c}function bo(o,c,p){var I=-1,T=su,k=o.length,Z=!0,te=[],se=te;if(p)Z=!1,T=Xp;else if(k>=n){var ue=c?null:RB(o);if(ue)return au(ue);Z=!1,T=Uf,se=new ua}else se=c?[]:te;e:for(;++I<k;){var de=o[I],ve=c?c(de):de;if(de=p||de!==0?de:0,Z&&ve===ve){for(var Se=se.length;Se--;)if(se[Se]===ve)continue e;c&&se.push(ve),te.push(de)}else T(se,ve,p)||(se!==te&&se.push(ve),te.push(de))}return te}function S1(o,c){return c=wo(c,o),o=a6(o,c),o==null||delete o[us(mn(c))]}function Ny(o,c,p,I){return Yf(o,c,p(pa(o,c)),I)}function Mu(o,c,p,I){for(var T=o.length,k=I?T:-1;(I?k--:++k<T)&&c(o[k],k,o););return p?vn(o,I?0:k,I?k+1:T):vn(o,I?k+1:0,I?T:k)}function $y(o,c){var p=o;return p instanceof $t&&(p=p.value()),e1(c,function(I,T){return T.func.apply(T.thisArg,po([I],T.args))},p)}function I1(o,c,p){var I=o.length;if(I<2)return I?bo(o[0]):[];for(var T=-1,k=ce(I);++T<I;)for(var Z=o[T],te=-1;++te<I;)te!=T&&(k[T]=Kf(k[T]||Z,o[te],c,p));return bo(Vr(k,1),c,p)}function Ly(o,c,p){for(var I=-1,T=o.length,k=c.length,Z={};++I<T;){var te=I<k?c[I]:t;p(Z,o[I],te)}return Z}function M1(o){return xr(o)?o:[]}function C1(o){return typeof o=="function"?o:Di}function wo(o,c){return wt(o)?o:B1(o,c)?[o]:h6(Vt(o))}var xB=Mt;function yo(o,c,p){var I=o.length;return p=p===t?I:p,!c&&p>=I?o:vn(o,c,p)}var By=fL||function(o){return Bt.clearTimeout(o)};function Fy(o,c){if(c)return o.slice();var p=o.length,I=sy?sy(p):new o.constructor(p);return o.copy(I),I}function P1(o){var c=new o.constructor(o.byteLength);return new du(c).set(new du(o)),c}function AB(o,c){var p=c?P1(o.buffer):o.buffer;return new o.constructor(p,o.byteOffset,o.byteLength)}function EB(o){var c=new o.constructor(o.source,_t.exec(o));return c.lastIndex=o.lastIndex,c}function SB(o){return jf?tr(jf.call(o)):{}}function Uy(o,c){var p=c?P1(o.buffer):o.buffer;return new o.constructor(p,o.byteOffset,o.length)}function qy(o,c){if(o!==c){var p=o!==t,I=o===null,T=o===o,k=Wi(o),Z=c!==t,te=c===null,se=c===c,ue=Wi(c);if(!te&&!ue&&!k&&o>c||k&&Z&&se&&!te&&!ue||I&&Z&&se||!p&&se||!T)return 1;if(!I&&!k&&!ue&&o<c||ue&&p&&T&&!I&&!k||te&&p&&T||!Z&&T||!se)return-1}return 0}function IB(o,c,p){for(var I=-1,T=o.criteria,k=c.criteria,Z=T.length,te=p.length;++I<Z;){var se=qy(T[I],k[I]);if(se){if(I>=te)return se;var ue=p[I];return se*(ue=="desc"?-1:1)}}return o.index-c.index}function zy(o,c,p,I){for(var T=-1,k=o.length,Z=p.length,te=-1,se=c.length,ue=Dr(k-Z,0),de=ce(se+ue),ve=!I;++te<se;)de[te]=c[te];for(;++T<Z;)(ve||T<k)&&(de[p[T]]=o[T]);for(;ue--;)de[te++]=o[T++];return de}function Hy(o,c,p,I){for(var T=-1,k=o.length,Z=-1,te=p.length,se=-1,ue=c.length,de=Dr(k-te,0),ve=ce(de+ue),Se=!I;++T<de;)ve[T]=o[T];for(var Je=T;++se<ue;)ve[Je+se]=c[se];for(;++Z<te;)(Se||T<k)&&(ve[Je+p[Z]]=o[T++]);return ve}function Mi(o,c){var p=-1,I=o.length;for(c||(c=ce(I));++p<I;)c[p]=o[p];return c}function hs(o,c,p,I){var T=!p;p||(p={});for(var k=-1,Z=c.length;++k<Z;){var te=c[k],se=I?I(p[te],o[te],te,p,o):t;se===t&&(se=o[te]),T?Rs(p,te,se):Wf(p,te,se)}return p}function MB(o,c){return hs(o,L1(o),c)}function CB(o,c){return hs(o,t6(o),c)}function Cu(o,c){return function(p,I){var T=wt(p)?T$:JL,k=c?c():{};return T(p,o,ot(I,2),k)}}function Ac(o){return Mt(function(c,p){var I=-1,T=p.length,k=T>1?p[T-1]:t,Z=T>2?p[2]:t;for(k=o.length>3&&typeof k=="function"?(T--,k):t,Z&&di(p[0],p[1],Z)&&(k=T<3?t:k,T=1),c=tr(c);++I<T;){var te=p[I];te&&o(c,te,I,k)}return c})}function ky(o,c){return function(p,I){if(p==null)return p;if(!Ci(p))return o(p,I);for(var T=p.length,k=c?T:-1,Z=tr(p);(c?k--:++k<T)&&I(Z[k],k,Z)!==!1;);return p}}function jy(o){return function(c,p,I){for(var T=-1,k=tr(c),Z=I(c),te=Z.length;te--;){var se=Z[o?te:++T];if(p(k[se],se,k)===!1)break}return c}}function PB(o,c,p){var I=c&j,T=Jf(o);function k(){var Z=this&&this!==Bt&&this instanceof k?T:o;return Z.apply(I?p:this,arguments)}return k}function Wy(o){return function(c){c=Vt(c);var p=vc(c)?Ln(c):t,I=p?p[0]:c.charAt(0),T=p?yo(p,1).join(""):c.slice(1);return I[o]()+T}}function Ec(o){return function(c){return e1(k6(H6(c).replace(Bf,"")),o,"")}}function Jf(o){return function(){var c=arguments;switch(c.length){case 0:return new o;case 1:return new o(c[0]);case 2:return new o(c[0],c[1]);case 3:return new o(c[0],c[1],c[2]);case 4:return new o(c[0],c[1],c[2],c[3]);case 5:return new o(c[0],c[1],c[2],c[3],c[4]);case 6:return new o(c[0],c[1],c[2],c[3],c[4],c[5]);case 7:return new o(c[0],c[1],c[2],c[3],c[4],c[5],c[6])}var p=xc(o.prototype),I=o.apply(p,c);return hr(I)?I:p}}function DB(o,c,p){var I=Jf(o);function T(){for(var k=arguments.length,Z=ce(k),te=k,se=Sc(T);te--;)Z[te]=arguments[te];var ue=k<3&&Z[0]!==se&&Z[k-1]!==se?[]:go(Z,se);if(k-=ue.length,k<p)return Jy(o,c,Pu,T.placeholder,t,Z,ue,t,t,p-k);var de=this&&this!==Bt&&this instanceof T?I:o;return Ur(de,this,Z)}return T}function Ky(o){return function(c,p,I){var T=tr(c);if(!Ci(c)){var k=ot(p,3);c=qr(c),p=function(te){return k(T[te],te,T)}}var Z=o(c,p,I);return Z>-1?T[k?c[Z]:Z]:t}}function Vy(o){return Ns(function(c){var p=c.length,I=p,T=pn.prototype.thru;for(o&&c.reverse();I--;){var k=c[I];if(typeof k!="function")throw new dn(a);if(T&&!Z&&Tu(k)=="wrapper")var Z=new pn([],!0)}for(I=Z?I:p;++I<p;){k=c[I];var te=Tu(k),se=te=="wrapper"?N1(k):t;se&&F1(se[0])&&se[1]==(_|G|z|U)&&!se[4].length&&se[9]==1?Z=Z[Tu(se[0])].apply(Z,se[3]):Z=k.length==1&&F1(k)?Z[te]():Z.thru(k)}return function(){var ue=arguments,de=ue[0];if(Z&&ue.length==1&&wt(de))return Z.plant(de).value();for(var ve=0,Se=p?c[ve].apply(this,ue):de;++ve<p;)Se=c[ve].call(this,Se);return Se}})}function Pu(o,c,p,I,T,k,Z,te,se,ue){var de=c&_,ve=c&j,Se=c&H,Je=c&(G|B),ct=c&ee,St=Se?t:Jf(o);function ft(){for(var Rt=arguments.length,Ft=ce(Rt),Ki=Rt;Ki--;)Ft[Ki]=arguments[Ki];if(Je)var pi=Sc(ft),Vi=H$(Ft,pi);if(I&&(Ft=zy(Ft,I,T,Je)),k&&(Ft=Hy(Ft,k,Z,Je)),Rt-=Vi,Je&&Rt<ue){var Ar=go(Ft,pi);return Jy(o,c,Pu,ft.placeholder,p,Ft,Ar,te,se,ue-Rt)}var Un=ve?p:this,Fs=Se?Un[o]:o;return Rt=Ft.length,te?Ft=JB(Ft,te):ct&&Rt>1&&Ft.reverse(),de&&se<Rt&&(Ft.length=se),this&&this!==Bt&&this instanceof ft&&(Fs=St||Jf(Fs)),Fs.apply(Un,Ft)}return ft}function Gy(o,c){return function(p,I){return nB(p,o,c(I),{})}}function Du(o,c){return function(p,I){var T;if(p===t&&I===t)return c;if(p!==t&&(T=p),I!==t){if(T===t)return I;typeof p=="string"||typeof I=="string"?(p=ji(p),I=ji(I)):(p=Ty(p),I=Ty(I)),T=o(p,I)}return T}}function D1(o){return Ns(function(c){return c=cr(c,ki(ot())),Mt(function(p){var I=this;return o(c,function(T){return Ur(T,I,p)})})})}function Ou(o,c){c=c===t?" ":ji(c);var p=c.length;if(p<2)return p?A1(c,o):c;var I=A1(c,mu(o/mc(c)));return vc(c)?yo(Ln(I),0,o).join(""):I.slice(0,o)}function OB(o,c,p,I){var T=c&j,k=Jf(o);function Z(){for(var te=-1,se=arguments.length,ue=-1,de=I.length,ve=ce(de+se),Se=this&&this!==Bt&&this instanceof Z?k:o;++ue<de;)ve[ue]=I[ue];for(;se--;)ve[ue++]=arguments[++te];return Ur(Se,T?p:this,ve)}return Z}function Yy(o){return function(c,p,I){return I&&typeof I!="number"&&di(c,p,I)&&(p=I=t),c=Bs(c),p===t?(p=c,c=0):p=Bs(p),I=I===t?c<p?1:-1:Bs(I),vB(c,p,I,o)}}function Ru(o){return function(c,p){return typeof c=="string"&&typeof p=="string"||(c=bn(c),p=bn(p)),o(c,p)}}function Jy(o,c,p,I,T,k,Z,te,se,ue){var de=c&G,ve=de?Z:t,Se=de?t:Z,Je=de?k:t,ct=de?t:k;c|=de?z:W,c&=~(de?W:z),c&F||(c&=~(j|H));var St=[o,c,T,Je,ve,ct,Se,te,se,ue],ft=p.apply(t,St);return F1(o)&&c6(ft,St),ft.placeholder=I,f6(ft,o,c)}function O1(o){var c=Pr[o];return function(p,I){if(p=bn(p),I=I==null?0:ri(Et(I),292),I&&fy(p)){var T=(Vt(p)+"e").split("e"),k=c(T[0]+"e"+(+T[1]+I));return T=(Vt(k)+"e").split("e"),+(T[0]+"e"+(+T[1]-I))}return c(p)}}var RB=yc&&1/au(new yc([,-0]))[1]==P?function(o){return new yc(o)}:X1;function Qy(o){return function(c){var p=ii(c);return p==he?a1(c):p==be?Y$(c):z$(c,o(c))}}function Ts(o,c,p,I,T,k,Z,te){var se=c&H;if(!se&&typeof o!="function")throw new dn(a);var ue=I?I.length:0;if(ue||(c&=~(z|W),I=T=t),Z=Z===t?Z:Dr(Et(Z),0),te=te===t?te:Et(te),ue-=T?T.length:0,c&W){var de=I,ve=T;I=T=t}var Se=se?t:N1(o),Je=[o,c,p,I,T,de,ve,k,Z,te];if(Se&&VB(Je,Se),o=Je[0],c=Je[1],p=Je[2],I=Je[3],T=Je[4],te=Je[9]=Je[9]===t?se?0:o.length:Dr(Je[9]-ue,0),!te&&c&(G|B)&&(c&=~(G|B)),!c||c==j)var ct=PB(o,c,p);else c==G||c==B?ct=DB(o,c,te):(c==z||c==(j|z))&&!T.length?ct=OB(o,c,p,I):ct=Pu.apply(t,Je);var St=Se?Oy:c6;return f6(St(ct,Je),o,c)}function Zy(o,c,p,I){return o===t||Fn(o,wc[p])&&!Yt.call(I,p)?c:o}function Xy(o,c,p,I,T,k){return hr(o)&&hr(c)&&(k.set(c,o),Su(o,c,t,Xy,k),k.delete(c)),o}function TB(o){return Xf(o)?t:o}function e6(o,c,p,I,T,k){var Z=p&O,te=o.length,se=c.length;if(te!=se&&!(Z&&se>te))return!1;var ue=k.get(o),de=k.get(c);if(ue&&de)return ue==c&&de==o;var ve=-1,Se=!0,Je=p&N?new ua:t;for(k.set(o,c),k.set(c,o);++ve<te;){var ct=o[ve],St=c[ve];if(I)var ft=Z?I(St,ct,ve,c,o,k):I(ct,St,ve,o,c,k);if(ft!==t){if(ft)continue;Se=!1;break}if(Je){if(!t1(c,function(Rt,Ft){if(!Uf(Je,Ft)&&(ct===Rt||T(ct,Rt,p,I,k)))return Je.push(Ft)})){Se=!1;break}}else if(!(ct===St||T(ct,St,p,I,k))){Se=!1;break}}return k.delete(o),k.delete(c),Se}function NB(o,c,p,I,T,k,Z){switch(p){case Me:if(o.byteLength!=c.byteLength||o.byteOffset!=c.byteOffset)return!1;o=o.buffer,c=c.buffer;case me:return!(o.byteLength!=c.byteLength||!k(new du(o),new du(c)));case J:case K:case ge:return Fn(+o,+c);case Y:return o.name==c.name&&o.message==c.message;case Ne:case Pe:return o==c+"";case he:var te=a1;case be:var se=I&O;if(te||(te=au),o.size!=c.size&&!se)return!1;var ue=Z.get(o);if(ue)return ue==c;I|=N,Z.set(o,c);var de=e6(te(o),te(c),I,T,k,Z);return Z.delete(o),de;case De:if(jf)return jf.call(o)==jf.call(c)}return!1}function $B(o,c,p,I,T,k){var Z=p&O,te=R1(o),se=te.length,ue=R1(c),de=ue.length;if(se!=de&&!Z)return!1;for(var ve=se;ve--;){var Se=te[ve];if(!(Z?Se in c:Yt.call(c,Se)))return!1}var Je=k.get(o),ct=k.get(c);if(Je&&ct)return Je==c&&ct==o;var St=!0;k.set(o,c),k.set(c,o);for(var ft=Z;++ve<se;){Se=te[ve];var Rt=o[Se],Ft=c[Se];if(I)var Ki=Z?I(Ft,Rt,Se,c,o,k):I(Rt,Ft,Se,o,c,k);if(!(Ki===t?Rt===Ft||T(Rt,Ft,p,I,k):Ki)){St=!1;break}ft||(ft=Se=="constructor")}if(St&&!ft){var pi=o.constructor,Vi=c.constructor;pi!=Vi&&"constructor"in o&&"constructor"in c&&!(typeof pi=="function"&&pi instanceof pi&&typeof Vi=="function"&&Vi instanceof Vi)&&(St=!1)}return k.delete(o),k.delete(c),St}function Ns(o){return q1(o6(o,t,g6),o+"")}function R1(o){return yy(o,qr,L1)}function T1(o){return yy(o,Pi,t6)}var N1=wu?function(o){return wu.get(o)}:X1;function Tu(o){for(var c=o.name+"",p=_c[c],I=Yt.call(_c,c)?p.length:0;I--;){var T=p[I],k=T.func;if(k==null||k==o)return T.name}return c}function Sc(o){var c=Yt.call(q,"placeholder")?q:o;return c.placeholder}function ot(){var o=q.iteratee||Q1;return o=o===Q1?Ay:o,arguments.length?o(arguments[0],arguments[1]):o}function Nu(o,c){var p=o.__data__;return kB(c)?p[typeof c=="string"?"string":"hash"]:p.map}function $1(o){for(var c=qr(o),p=c.length;p--;){var I=c[p],T=o[I];c[p]=[I,T,n6(T)]}return c}function ga(o,c){var p=K$(o,c);return xy(p)?p:t}function LB(o){var c=Yt.call(o,la),p=o[la];try{o[la]=t;var I=!0}catch{}var T=hu.call(o);return I&&(c?o[la]=p:delete o[la]),T}var L1=f1?function(o){return o==null?[]:(o=tr(o),uo(f1(o),function(c){return ay.call(o,c)}))}:eg,t6=f1?function(o){for(var c=[];o;)po(c,L1(o)),o=pu(o);return c}:eg,ii=ui;(l1&&ii(new l1(new ArrayBuffer(1)))!=Me||zf&&ii(new zf)!=he||h1&&ii(h1.resolve())!=Ce||yc&&ii(new yc)!=be||Hf&&ii(new Hf)!=Ie)&&(ii=function(o){var c=ui(o),p=c==Te?o.constructor:t,I=p?va(p):"";if(I)switch(I){case bL:return Me;case wL:return he;case yL:return Ce;case _L:return be;case xL:return Ie}return c});function BB(o,c,p){for(var I=-1,T=p.length;++I<T;){var k=p[I],Z=k.size;switch(k.type){case"drop":o+=Z;break;case"dropRight":c-=Z;break;case"take":c=ri(c,o+Z);break;case"takeRight":o=Dr(o,c-Z);break}}return{start:o,end:c}}function FB(o){var c=o.match(Qe);return c?c[1].split(qe):[]}function r6(o,c,p){c=wo(c,o);for(var I=-1,T=c.length,k=!1;++I<T;){var Z=us(c[I]);if(!(k=o!=null&&p(o,Z)))break;o=o[Z]}return k||++I!=T?k:(T=o==null?0:o.length,!!T&&zu(T)&&$s(Z,T)&&(wt(o)||ma(o)))}function UB(o){var c=o.length,p=new o.constructor(c);return c&&typeof o[0]=="string"&&Yt.call(o,"index")&&(p.index=o.index,p.input=o.input),p}function i6(o){return typeof o.constructor=="function"&&!Qf(o)?xc(pu(o)):{}}function qB(o,c,p){var I=o.constructor;switch(c){case me:return P1(o);case J:case K:return new I(+o);case Me:return AB(o,p);case Be:case we:case ke:case We:case Ae:case Ve:case Ke:case Ge:case mt:return Uy(o,p);case he:return new I;case ge:case Pe:return new I(o);case Ne:return EB(o);case be:return new I;case De:return SB(o)}}function zB(o,c){var p=c.length;if(!p)return o;var I=p-1;return c[I]=(p>1?"& ":"")+c[I],c=c.join(p>2?", ":" "),o.replace(st,`{
|
|
50
|
+
*/(function(r,e){(function(){var t,i="4.17.21",n=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",f="Invalid `variable` option passed into `_.template`",h="__lodash_hash_undefined__",u=500,g="__lodash_placeholder__",w=1,M=2,P=4,O=1,$=2,q=1,U=2,J=4,ee=8,W=16,G=32,Q=64,A=128,z=256,te=512,ae=30,L="...",b=800,m=16,l=1,d=2,y=3,C=1/0,D=9007199254740991,S=17976931348623157e292,v=0/0,x=4294967295,_=x-1,N=x>>>1,oe=[["ary",A],["bind",q],["bindKey",U],["curry",ee],["curryRight",W],["flip",te],["partial",G],["partialRight",Q],["rearg",z]],R="[object Arguments]",Z="[object Array]",H="[object AsyncFunction]",K="[object Boolean]",k="[object Date]",E="[object DOMException]",j="[object Error]",re="[object Function]",le="[object GeneratorFunction]",he="[object Map]",ge="[object Number]",ke="[object Null]",Te="[object Object]",Ce="[object Promise]",Xe="[object Proxy]",Ne="[object RegExp]",be="[object Set]",Pe="[object String]",De="[object Symbol]",ye="[object Undefined]",Ie="[object WeakMap]",Oe="[object WeakSet]",me="[object ArrayBuffer]",Me="[object DataView]",Be="[object Float32Array]",we="[object Float64Array]",He="[object Int8Array]",We="[object Int16Array]",Ee="[object Int32Array]",Ve="[object Uint8Array]",Ke="[object Uint8ClampedArray]",Ge="[object Uint16Array]",mt="[object Uint32Array]",It=/\b__p \+= '';/g,Je=/\b(__p \+=) '' \+/g,Pt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ot=/&(?:amp|lt|gt|quot|#39);/g,Ze=/[&<>"']/g,rt=RegExp(Ot.source),et=RegExp(Ze.source),$e=/<%-([\s\S]+?)%>/g,it=/<%([\s\S]+?)%>/g,tt=/<%=([\s\S]+?)%>/g,Re=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,lt=/^\w*$/,ht=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Le=/[\\^$.*+?()[\]{}|]/g,ut=RegExp(Le.source),nt=/^\s+/,Ue=/\s/,st=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Qe=/\{\n\/\* \[wrapped with (.+)\] \*/,qe=/,? & /,dt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,kt=/[()=,{}\[\]\/\s]/,at=/\\(\\)?/g,Ht=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,_t=/\w*$/,qt=/^[-+]0x[0-9a-f]+$/i,Zr=/^0b[01]+$/i,Xr=/^\[object .+?Constructor\]$/,ei=/^0o[0-7]+$/i,ti=/^(?:0|[1-9]\d*)$/,vr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ei=/($^)/,Pn=/['\n\r\u2028\u2029\\]/g,Ai="\\ud800-\\udfff",Dn="\\u0300-\\u036f",On="\\ufe20-\\ufe2f",Si="\\u20d0-\\u20ff",fn=Dn+On+Si,ln="\\u2700-\\u27bf",Cr="a-z\\xdf-\\xf6\\xf8-\\xff",Rn="\\xac\\xb1\\xd7\\xf7",Tn="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Nn="\\u2000-\\u206f",na=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",lo="A-Z\\xc0-\\xd6\\xd8-\\xde",kh="\\ufe0e\\ufe0f",sa=Rn+Tn+Nn+na,Nf="['\u2019]",oa="["+Ai+"]",$f="["+sa+"]",aa="["+fn+"]",Hh="\\d+",Wp="["+ln+"]",jh="["+Cr+"]",Wh="[^"+Ai+sa+Hh+ln+Cr+lo+"]",hc="\\ud83c[\\udffb-\\udfff]",Kp="(?:"+aa+"|"+hc+")",Kh="[^"+Ai+"]",uc="(?:\\ud83c[\\udde6-\\uddff]){2}",ho="[\\ud800-\\udbff][\\udc00-\\udfff]",ki="["+lo+"]",Vh="\\u200d",Gh="(?:"+jh+"|"+Wh+")",cs="(?:"+ki+"|"+Wh+")",Jh="(?:"+Nf+"(?:d|ll|m|re|s|t|ve))?",Yh="(?:"+Nf+"(?:D|LL|M|RE|S|T|VE))?",Qh=Kp+"?",Zh="["+kh+"]?",Vp="(?:"+Vh+"(?:"+[Kh,uc,ho].join("|")+")"+Zh+Qh+")*",Ps="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Xh="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",eu=Zh+Qh+Vp,dc="(?:"+[Wp,uc,ho].join("|")+")"+eu,Gp="(?:"+[Kh+aa+"?",aa,uc,ho,oa].join("|")+")",Lf=RegExp(Nf,"g"),Jp=RegExp(aa,"g"),pc=RegExp(hc+"(?="+hc+")|"+Gp+eu,"g"),tu=RegExp([ki+"?"+jh+"+"+Jh+"(?="+[$f,ki,"$"].join("|")+")",cs+"+"+Yh+"(?="+[$f,ki+Gh,"$"].join("|")+")",ki+"?"+Gh+"+"+Jh,ki+"+"+Yh,Xh,Ps,Hh,dc].join("|"),"g"),ru=RegExp("["+Vh+Ai+fn+kh+"]"),ca=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,iu=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Yp=-1,Zt={};Zt[Be]=Zt[we]=Zt[He]=Zt[We]=Zt[Ee]=Zt[Ve]=Zt[Ke]=Zt[Ge]=Zt[mt]=!0,Zt[R]=Zt[Z]=Zt[me]=Zt[K]=Zt[Me]=Zt[k]=Zt[j]=Zt[re]=Zt[he]=Zt[ge]=Zt[Te]=Zt[Ne]=Zt[be]=Zt[Pe]=Zt[Ie]=!1;var Qt={};Qt[R]=Qt[Z]=Qt[me]=Qt[Me]=Qt[K]=Qt[k]=Qt[Be]=Qt[we]=Qt[He]=Qt[We]=Qt[Ee]=Qt[he]=Qt[ge]=Qt[Te]=Qt[Ne]=Qt[be]=Qt[Pe]=Qt[De]=Qt[Ve]=Qt[Ke]=Qt[Ge]=Qt[mt]=!0,Qt[j]=Qt[re]=Qt[Ie]=!1;var V={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},ne={"&":"&","<":"<",">":">",'"':""","'":"'"},pe={"&":"&","<":"<",">":">",""":'"',"'":"'"},Fe={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Xt=parseFloat,bt=parseInt,or=typeof fr=="object"&&fr&&fr.Object===Object&&fr,Ar=typeof self=="object"&&self&&self.Object===Object&&self,Bt=or||Ar||Function("return this")(),er=e&&!e.nodeType&&e,_r=er&&!0&&r&&!r.nodeType&&r,Ii=_r&&_r.exports===er,Sr=Ii&&or.process,ar=function(){try{var ie=_r&&_r.require&&_r.require("util").types;return ie||Sr&&Sr.binding&&Sr.binding("util")}catch{}}(),hi=ar&&ar.isArrayBuffer,$n=ar&&ar.isDate,hn=ar&&ar.isMap,fs=ar&&ar.isRegExp,Bf=ar&&ar.isSet,fa=ar&&ar.isTypedArray;function Fr(ie,fe,ce){switch(ce.length){case 0:return ie.call(fe);case 1:return ie.call(fe,ce[0]);case 2:return ie.call(fe,ce[0],ce[1]);case 3:return ie.call(fe,ce[0],ce[1],ce[2])}return ie.apply(fe,ce)}function f$(ie,fe,ce,ze){for(var gt=-1,Wt=ie==null?0:ie.length;++gt<Wt;){var Pr=ie[gt];fe(ze,Pr,ce(Pr),ie)}return ze}function un(ie,fe){for(var ce=-1,ze=ie==null?0:ie.length;++ce<ze&&fe(ie[ce],ce,ie)!==!1;);return ie}function l$(ie,fe){for(var ce=ie==null?0:ie.length;ce--&&fe(ie[ce],ce,ie)!==!1;);return ie}function Bw(ie,fe){for(var ce=-1,ze=ie==null?0:ie.length;++ce<ze;)if(!fe(ie[ce],ce,ie))return!1;return!0}function uo(ie,fe){for(var ce=-1,ze=ie==null?0:ie.length,gt=0,Wt=[];++ce<ze;){var Pr=ie[ce];fe(Pr,ce,ie)&&(Wt[gt++]=Pr)}return Wt}function nu(ie,fe){var ce=ie==null?0:ie.length;return!!ce&&gc(ie,fe,0)>-1}function Qp(ie,fe,ce){for(var ze=-1,gt=ie==null?0:ie.length;++ze<gt;)if(ce(fe,ie[ze]))return!0;return!1}function cr(ie,fe){for(var ce=-1,ze=ie==null?0:ie.length,gt=Array(ze);++ce<ze;)gt[ce]=fe(ie[ce],ce,ie);return gt}function po(ie,fe){for(var ce=-1,ze=fe.length,gt=ie.length;++ce<ze;)ie[gt+ce]=fe[ce];return ie}function Zp(ie,fe,ce,ze){var gt=-1,Wt=ie==null?0:ie.length;for(ze&&Wt&&(ce=ie[++gt]);++gt<Wt;)ce=fe(ce,ie[gt],gt,ie);return ce}function h$(ie,fe,ce,ze){var gt=ie==null?0:ie.length;for(ze&>&&(ce=ie[--gt]);gt--;)ce=fe(ce,ie[gt],gt,ie);return ce}function Xp(ie,fe){for(var ce=-1,ze=ie==null?0:ie.length;++ce<ze;)if(fe(ie[ce],ce,ie))return!0;return!1}var u$=e1("length");function d$(ie){return ie.split("")}function p$(ie){return ie.match(dt)||[]}function Uw(ie,fe,ce){var ze;return ce(ie,function(gt,Wt,Pr){if(fe(gt,Wt,Pr))return ze=Wt,!1}),ze}function su(ie,fe,ce,ze){for(var gt=ie.length,Wt=ce+(ze?1:-1);ze?Wt--:++Wt<gt;)if(fe(ie[Wt],Wt,ie))return Wt;return-1}function gc(ie,fe,ce){return fe===fe?I$(ie,fe,ce):su(ie,Fw,ce)}function g$(ie,fe,ce,ze){for(var gt=ce-1,Wt=ie.length;++gt<Wt;)if(ze(ie[gt],fe))return gt;return-1}function Fw(ie){return ie!==ie}function qw(ie,fe){var ce=ie==null?0:ie.length;return ce?r1(ie,fe)/ce:v}function e1(ie){return function(fe){return fe==null?t:fe[ie]}}function t1(ie){return function(fe){return ie==null?t:ie[fe]}}function zw(ie,fe,ce,ze,gt){return gt(ie,function(Wt,Pr,tr){ce=ze?(ze=!1,Wt):fe(ce,Wt,Pr,tr)}),ce}function v$(ie,fe){var ce=ie.length;for(ie.sort(fe);ce--;)ie[ce]=ie[ce].value;return ie}function r1(ie,fe){for(var ce,ze=-1,gt=ie.length;++ze<gt;){var Wt=fe(ie[ze]);Wt!==t&&(ce=ce===t?Wt:ce+Wt)}return ce}function i1(ie,fe){for(var ce=-1,ze=Array(ie);++ce<ie;)ze[ce]=fe(ce);return ze}function m$(ie,fe){return cr(fe,function(ce){return[ce,ie[ce]]})}function kw(ie){return ie&&ie.slice(0,Kw(ie)+1).replace(nt,"")}function Hi(ie){return function(fe){return ie(fe)}}function n1(ie,fe){return cr(fe,function(ce){return ie[ce]})}function Uf(ie,fe){return ie.has(fe)}function Hw(ie,fe){for(var ce=-1,ze=ie.length;++ce<ze&&gc(fe,ie[ce],0)>-1;);return ce}function jw(ie,fe){for(var ce=ie.length;ce--&&gc(fe,ie[ce],0)>-1;);return ce}function b$(ie,fe){for(var ce=ie.length,ze=0;ce--;)ie[ce]===fe&&++ze;return ze}var w$=t1(V),y$=t1(ne);function _$(ie){return"\\"+Fe[ie]}function x$(ie,fe){return ie==null?t:ie[fe]}function vc(ie){return ru.test(ie)}function E$(ie){return ca.test(ie)}function A$(ie){for(var fe,ce=[];!(fe=ie.next()).done;)ce.push(fe.value);return ce}function s1(ie){var fe=-1,ce=Array(ie.size);return ie.forEach(function(ze,gt){ce[++fe]=[gt,ze]}),ce}function Ww(ie,fe){return function(ce){return ie(fe(ce))}}function go(ie,fe){for(var ce=-1,ze=ie.length,gt=0,Wt=[];++ce<ze;){var Pr=ie[ce];(Pr===fe||Pr===g)&&(ie[ce]=g,Wt[gt++]=ce)}return Wt}function ou(ie){var fe=-1,ce=Array(ie.size);return ie.forEach(function(ze){ce[++fe]=ze}),ce}function S$(ie){var fe=-1,ce=Array(ie.size);return ie.forEach(function(ze){ce[++fe]=[ze,ze]}),ce}function I$(ie,fe,ce){for(var ze=ce-1,gt=ie.length;++ze<gt;)if(ie[ze]===fe)return ze;return-1}function M$(ie,fe,ce){for(var ze=ce+1;ze--;)if(ie[ze]===fe)return ze;return ze}function mc(ie){return vc(ie)?P$(ie):u$(ie)}function Ln(ie){return vc(ie)?D$(ie):d$(ie)}function Kw(ie){for(var fe=ie.length;fe--&&Ue.test(ie.charAt(fe)););return fe}var C$=t1(pe);function P$(ie){for(var fe=pc.lastIndex=0;pc.test(ie);)++fe;return fe}function D$(ie){return ie.match(pc)||[]}function O$(ie){return ie.match(tu)||[]}var R$=function ie(fe){fe=fe==null?Bt:bc.defaults(Bt.Object(),fe,bc.pick(Bt,iu));var ce=fe.Array,ze=fe.Date,gt=fe.Error,Wt=fe.Function,Pr=fe.Math,tr=fe.Object,o1=fe.RegExp,T$=fe.String,dn=fe.TypeError,au=ce.prototype,N$=Wt.prototype,wc=tr.prototype,cu=fe["__core-js_shared__"],fu=N$.toString,Jt=wc.hasOwnProperty,$$=0,Vw=function(){var o=/[^.]+$/.exec(cu&&cu.keys&&cu.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""}(),lu=wc.toString,L$=fu.call(tr),B$=Bt._,U$=o1("^"+fu.call(Jt).replace(Le,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),hu=Ii?fe.Buffer:t,vo=fe.Symbol,uu=fe.Uint8Array,Gw=hu?hu.allocUnsafe:t,du=Ww(tr.getPrototypeOf,tr),Jw=tr.create,Yw=wc.propertyIsEnumerable,pu=au.splice,Qw=vo?vo.isConcatSpreadable:t,Ff=vo?vo.iterator:t,la=vo?vo.toStringTag:t,gu=function(){try{var o=ga(tr,"defineProperty");return o({},"",{}),o}catch{}}(),F$=fe.clearTimeout!==Bt.clearTimeout&&fe.clearTimeout,q$=ze&&ze.now!==Bt.Date.now&&ze.now,z$=fe.setTimeout!==Bt.setTimeout&&fe.setTimeout,vu=Pr.ceil,mu=Pr.floor,a1=tr.getOwnPropertySymbols,k$=hu?hu.isBuffer:t,Zw=fe.isFinite,H$=au.join,j$=Ww(tr.keys,tr),Dr=Pr.max,ri=Pr.min,W$=ze.now,K$=fe.parseInt,Xw=Pr.random,V$=au.reverse,c1=ga(fe,"DataView"),qf=ga(fe,"Map"),f1=ga(fe,"Promise"),yc=ga(fe,"Set"),zf=ga(fe,"WeakMap"),kf=ga(tr,"create"),bu=zf&&new zf,_c={},G$=va(c1),J$=va(qf),Y$=va(f1),Q$=va(yc),Z$=va(zf),wu=vo?vo.prototype:t,Hf=wu?wu.valueOf:t,ey=wu?wu.toString:t;function B(o){if(mr(o)&&!wt(o)&&!(o instanceof $t)){if(o instanceof pn)return o;if(Jt.call(o,"__wrapped__"))return t6(o)}return new pn(o)}var xc=function(){function o(){}return function(c){if(!hr(c))return{};if(Jw)return Jw(c);o.prototype=c;var p=new o;return o.prototype=t,p}}();function yu(){}function pn(o,c){this.__wrapped__=o,this.__actions__=[],this.__chain__=!!c,this.__index__=0,this.__values__=t}B.templateSettings={escape:$e,evaluate:it,interpolate:tt,variable:"",imports:{_:B}},B.prototype=yu.prototype,B.prototype.constructor=B,pn.prototype=xc(yu.prototype),pn.prototype.constructor=pn;function $t(o){this.__wrapped__=o,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=x,this.__views__=[]}function X$(){var o=new $t(this.__wrapped__);return o.__actions__=Mi(this.__actions__),o.__dir__=this.__dir__,o.__filtered__=this.__filtered__,o.__iteratees__=Mi(this.__iteratees__),o.__takeCount__=this.__takeCount__,o.__views__=Mi(this.__views__),o}function eL(){if(this.__filtered__){var o=new $t(this);o.__dir__=-1,o.__filtered__=!0}else o=this.clone(),o.__dir__*=-1;return o}function tL(){var o=this.__wrapped__.value(),c=this.__dir__,p=wt(o),I=c<0,T=p?o.length:0,F=dB(0,T,this.__views__),Y=F.start,X=F.end,se=X-Y,ue=I?X:Y-1,de=this.__iteratees__,ve=de.length,Se=0,Ye=ri(se,this.__takeCount__);if(!p||!I&&T==se&&Ye==se)return Ay(o,this.__actions__);var ct=[];e:for(;se--&&Se<Ye;){ue+=c;for(var St=-1,ft=o[ue];++St<ve;){var Rt=de[St],Ut=Rt.iteratee,Ki=Rt.type,pi=Ut(ft);if(Ki==d)ft=pi;else if(!pi){if(Ki==l)continue e;break e}}ct[Se++]=ft}return ct}$t.prototype=xc(yu.prototype),$t.prototype.constructor=$t;function ha(o){var c=-1,p=o==null?0:o.length;for(this.clear();++c<p;){var I=o[c];this.set(I[0],I[1])}}function rL(){this.__data__=kf?kf(null):{},this.size=0}function iL(o){var c=this.has(o)&&delete this.__data__[o];return this.size-=c?1:0,c}function nL(o){var c=this.__data__;if(kf){var p=c[o];return p===h?t:p}return Jt.call(c,o)?c[o]:t}function sL(o){var c=this.__data__;return kf?c[o]!==t:Jt.call(c,o)}function oL(o,c){var p=this.__data__;return this.size+=this.has(o)?0:1,p[o]=kf&&c===t?h:c,this}ha.prototype.clear=rL,ha.prototype.delete=iL,ha.prototype.get=nL,ha.prototype.has=sL,ha.prototype.set=oL;function Ds(o){var c=-1,p=o==null?0:o.length;for(this.clear();++c<p;){var I=o[c];this.set(I[0],I[1])}}function aL(){this.__data__=[],this.size=0}function cL(o){var c=this.__data__,p=_u(c,o);if(p<0)return!1;var I=c.length-1;return p==I?c.pop():pu.call(c,p,1),--this.size,!0}function fL(o){var c=this.__data__,p=_u(c,o);return p<0?t:c[p][1]}function lL(o){return _u(this.__data__,o)>-1}function hL(o,c){var p=this.__data__,I=_u(p,o);return I<0?(++this.size,p.push([o,c])):p[I][1]=c,this}Ds.prototype.clear=aL,Ds.prototype.delete=cL,Ds.prototype.get=fL,Ds.prototype.has=lL,Ds.prototype.set=hL;function Os(o){var c=-1,p=o==null?0:o.length;for(this.clear();++c<p;){var I=o[c];this.set(I[0],I[1])}}function uL(){this.size=0,this.__data__={hash:new ha,map:new(qf||Ds),string:new ha}}function dL(o){var c=Tu(this,o).delete(o);return this.size-=c?1:0,c}function pL(o){return Tu(this,o).get(o)}function gL(o){return Tu(this,o).has(o)}function vL(o,c){var p=Tu(this,o),I=p.size;return p.set(o,c),this.size+=p.size==I?0:1,this}Os.prototype.clear=uL,Os.prototype.delete=dL,Os.prototype.get=pL,Os.prototype.has=gL,Os.prototype.set=vL;function ua(o){var c=-1,p=o==null?0:o.length;for(this.__data__=new Os;++c<p;)this.add(o[c])}function mL(o){return this.__data__.set(o,h),this}function bL(o){return this.__data__.has(o)}ua.prototype.add=ua.prototype.push=mL,ua.prototype.has=bL;function Bn(o){var c=this.__data__=new Ds(o);this.size=c.size}function wL(){this.__data__=new Ds,this.size=0}function yL(o){var c=this.__data__,p=c.delete(o);return this.size=c.size,p}function _L(o){return this.__data__.get(o)}function xL(o){return this.__data__.has(o)}function EL(o,c){var p=this.__data__;if(p instanceof Ds){var I=p.__data__;if(!qf||I.length<n-1)return I.push([o,c]),this.size=++p.size,this;p=this.__data__=new Os(I)}return p.set(o,c),this.size=p.size,this}Bn.prototype.clear=wL,Bn.prototype.delete=yL,Bn.prototype.get=_L,Bn.prototype.has=xL,Bn.prototype.set=EL;function ty(o,c){var p=wt(o),I=!p&&ma(o),T=!p&&!I&&_o(o),F=!p&&!I&&!T&&Ic(o),Y=p||I||T||F,X=Y?i1(o.length,T$):[],se=X.length;for(var ue in o)(c||Jt.call(o,ue))&&!(Y&&(ue=="length"||T&&(ue=="offset"||ue=="parent")||F&&(ue=="buffer"||ue=="byteLength"||ue=="byteOffset")||$s(ue,se)))&&X.push(ue);return X}function ry(o){var c=o.length;return c?o[y1(0,c-1)]:t}function AL(o,c){return Nu(Mi(o),da(c,0,o.length))}function SL(o){return Nu(Mi(o))}function l1(o,c,p){(p!==t&&!Un(o[c],p)||p===t&&!(c in o))&&Rs(o,c,p)}function jf(o,c,p){var I=o[c];(!(Jt.call(o,c)&&Un(I,p))||p===t&&!(c in o))&&Rs(o,c,p)}function _u(o,c){for(var p=o.length;p--;)if(Un(o[p][0],c))return p;return-1}function IL(o,c,p,I){return mo(o,function(T,F,Y){c(I,T,p(T),Y)}),I}function iy(o,c){return o&&hs(c,qr(c),o)}function ML(o,c){return o&&hs(c,Pi(c),o)}function Rs(o,c,p){c=="__proto__"&&gu?gu(o,c,{configurable:!0,enumerable:!0,value:p,writable:!0}):o[c]=p}function h1(o,c){for(var p=-1,I=c.length,T=ce(I),F=o==null;++p<I;)T[p]=F?t:W1(o,c[p]);return T}function da(o,c,p){return o===o&&(p!==t&&(o=o<=p?o:p),c!==t&&(o=o>=c?o:c)),o}function gn(o,c,p,I,T,F){var Y,X=c&w,se=c&M,ue=c&P;if(p&&(Y=T?p(o,I,T,F):p(o)),Y!==t)return Y;if(!hr(o))return o;var de=wt(o);if(de){if(Y=gB(o),!X)return Mi(o,Y)}else{var ve=ii(o),Se=ve==re||ve==le;if(_o(o))return My(o,X);if(ve==Te||ve==R||Se&&!T){if(Y=se||Se?{}:Ky(o),!X)return se?nB(o,ML(Y,o)):iB(o,iy(Y,o))}else{if(!Qt[ve])return T?o:{};Y=vB(o,ve,X)}}F||(F=new Bn);var Ye=F.get(o);if(Ye)return Ye;F.set(o,Y),_6(o)?o.forEach(function(ft){Y.add(gn(ft,c,p,ft,o,F))}):w6(o)&&o.forEach(function(ft,Rt){Y.set(Rt,gn(ft,c,p,Rt,o,F))});var ct=ue?se?O1:D1:se?Pi:qr,St=de?t:ct(o);return un(St||o,function(ft,Rt){St&&(Rt=ft,ft=o[Rt]),jf(Y,Rt,gn(ft,c,p,Rt,o,F))}),Y}function CL(o){var c=qr(o);return function(p){return ny(p,o,c)}}function ny(o,c,p){var I=p.length;if(o==null)return!I;for(o=tr(o);I--;){var T=p[I],F=c[T],Y=o[T];if(Y===t&&!(T in o)||!F(Y))return!1}return!0}function sy(o,c,p){if(typeof o!="function")throw new dn(a);return Qf(function(){o.apply(t,p)},c)}function Wf(o,c,p,I){var T=-1,F=nu,Y=!0,X=o.length,se=[],ue=c.length;if(!X)return se;p&&(c=cr(c,Hi(p))),I?(F=Qp,Y=!1):c.length>=n&&(F=Uf,Y=!1,c=new ua(c));e:for(;++T<X;){var de=o[T],ve=p==null?de:p(de);if(de=I||de!==0?de:0,Y&&ve===ve){for(var Se=ue;Se--;)if(c[Se]===ve)continue e;se.push(de)}else F(c,ve,I)||se.push(de)}return se}var mo=Ry(ls),oy=Ry(d1,!0);function PL(o,c){var p=!0;return mo(o,function(I,T,F){return p=!!c(I,T,F),p}),p}function xu(o,c,p){for(var I=-1,T=o.length;++I<T;){var F=o[I],Y=c(F);if(Y!=null&&(X===t?Y===Y&&!Wi(Y):p(Y,X)))var X=Y,se=F}return se}function DL(o,c,p,I){var T=o.length;for(p=At(p),p<0&&(p=-p>T?0:T+p),I=I===t||I>T?T:At(I),I<0&&(I+=T),I=p>I?0:E6(I);p<I;)o[p++]=c;return o}function ay(o,c){var p=[];return mo(o,function(I,T,F){c(I,T,F)&&p.push(I)}),p}function Vr(o,c,p,I,T){var F=-1,Y=o.length;for(p||(p=bB),T||(T=[]);++F<Y;){var X=o[F];c>0&&p(X)?c>1?Vr(X,c-1,p,I,T):po(T,X):I||(T[T.length]=X)}return T}var u1=Ty(),cy=Ty(!0);function ls(o,c){return o&&u1(o,c,qr)}function d1(o,c){return o&&cy(o,c,qr)}function Eu(o,c){return uo(c,function(p){return Ls(o[p])})}function pa(o,c){c=wo(c,o);for(var p=0,I=c.length;o!=null&&p<I;)o=o[us(c[p++])];return p&&p==I?o:t}function fy(o,c,p){var I=c(o);return wt(o)?I:po(I,p(o))}function ui(o){return o==null?o===t?ye:ke:la&&la in tr(o)?uB(o):SB(o)}function p1(o,c){return o>c}function OL(o,c){return o!=null&&Jt.call(o,c)}function RL(o,c){return o!=null&&c in tr(o)}function TL(o,c,p){return o>=ri(c,p)&&o<Dr(c,p)}function g1(o,c,p){for(var I=p?Qp:nu,T=o[0].length,F=o.length,Y=F,X=ce(F),se=1/0,ue=[];Y--;){var de=o[Y];Y&&c&&(de=cr(de,Hi(c))),se=ri(de.length,se),X[Y]=!p&&(c||T>=120&&de.length>=120)?new ua(Y&&de):t}de=o[0];var ve=-1,Se=X[0];e:for(;++ve<T&&ue.length<se;){var Ye=de[ve],ct=c?c(Ye):Ye;if(Ye=p||Ye!==0?Ye:0,!(Se?Uf(Se,ct):I(ue,ct,p))){for(Y=F;--Y;){var St=X[Y];if(!(St?Uf(St,ct):I(o[Y],ct,p)))continue e}Se&&Se.push(ct),ue.push(Ye)}}return ue}function NL(o,c,p,I){return ls(o,function(T,F,Y){c(I,p(T),F,Y)}),I}function Kf(o,c,p){c=wo(c,o),o=Yy(o,c);var I=o==null?o:o[us(mn(c))];return I==null?t:Fr(I,o,p)}function ly(o){return mr(o)&&ui(o)==R}function $L(o){return mr(o)&&ui(o)==me}function LL(o){return mr(o)&&ui(o)==k}function Vf(o,c,p,I,T){return o===c?!0:o==null||c==null||!mr(o)&&!mr(c)?o!==o&&c!==c:BL(o,c,p,I,Vf,T)}function BL(o,c,p,I,T,F){var Y=wt(o),X=wt(c),se=Y?Z:ii(o),ue=X?Z:ii(c);se=se==R?Te:se,ue=ue==R?Te:ue;var de=se==Te,ve=ue==Te,Se=se==ue;if(Se&&_o(o)){if(!_o(c))return!1;Y=!0,de=!1}if(Se&&!de)return F||(F=new Bn),Y||Ic(o)?Hy(o,c,p,I,T,F):lB(o,c,se,p,I,T,F);if(!(p&O)){var Ye=de&&Jt.call(o,"__wrapped__"),ct=ve&&Jt.call(c,"__wrapped__");if(Ye||ct){var St=Ye?o.value():o,ft=ct?c.value():c;return F||(F=new Bn),T(St,ft,p,I,F)}}return Se?(F||(F=new Bn),hB(o,c,p,I,T,F)):!1}function UL(o){return mr(o)&&ii(o)==he}function v1(o,c,p,I){var T=p.length,F=T,Y=!I;if(o==null)return!F;for(o=tr(o);T--;){var X=p[T];if(Y&&X[2]?X[1]!==o[X[0]]:!(X[0]in o))return!1}for(;++T<F;){X=p[T];var se=X[0],ue=o[se],de=X[1];if(Y&&X[2]){if(ue===t&&!(se in o))return!1}else{var ve=new Bn;if(I)var Se=I(ue,de,se,o,c,ve);if(!(Se===t?Vf(de,ue,O|$,I,ve):Se))return!1}}return!0}function hy(o){if(!hr(o)||yB(o))return!1;var c=Ls(o)?U$:Xr;return c.test(va(o))}function FL(o){return mr(o)&&ui(o)==Ne}function qL(o){return mr(o)&&ii(o)==be}function zL(o){return mr(o)&&qu(o.length)&&!!Zt[ui(o)]}function uy(o){return typeof o=="function"?o:o==null?Di:typeof o=="object"?wt(o)?gy(o[0],o[1]):py(o):N6(o)}function m1(o){if(!Yf(o))return j$(o);var c=[];for(var p in tr(o))Jt.call(o,p)&&p!="constructor"&&c.push(p);return c}function kL(o){if(!hr(o))return AB(o);var c=Yf(o),p=[];for(var I in o)I=="constructor"&&(c||!Jt.call(o,I))||p.push(I);return p}function b1(o,c){return o<c}function dy(o,c){var p=-1,I=Ci(o)?ce(o.length):[];return mo(o,function(T,F,Y){I[++p]=c(T,F,Y)}),I}function py(o){var c=T1(o);return c.length==1&&c[0][2]?Gy(c[0][0],c[0][1]):function(p){return p===o||v1(p,o,c)}}function gy(o,c){return $1(o)&&Vy(c)?Gy(us(o),c):function(p){var I=W1(p,o);return I===t&&I===c?K1(p,o):Vf(c,I,O|$)}}function Au(o,c,p,I,T){o!==c&&u1(c,function(F,Y){if(T||(T=new Bn),hr(F))HL(o,c,Y,p,Au,I,T);else{var X=I?I(B1(o,Y),F,Y+"",o,c,T):t;X===t&&(X=F),l1(o,Y,X)}},Pi)}function HL(o,c,p,I,T,F,Y){var X=B1(o,p),se=B1(c,p),ue=Y.get(se);if(ue){l1(o,p,ue);return}var de=F?F(X,se,p+"",o,c,Y):t,ve=de===t;if(ve){var Se=wt(se),Ye=!Se&&_o(se),ct=!Se&&!Ye&&Ic(se);de=se,Se||Ye||ct?wt(X)?de=X:xr(X)?de=Mi(X):Ye?(ve=!1,de=My(se,!0)):ct?(ve=!1,de=Cy(se,!0)):de=[]:Zf(se)||ma(se)?(de=X,ma(X)?de=A6(X):(!hr(X)||Ls(X))&&(de=Ky(se))):ve=!1}ve&&(Y.set(se,de),T(de,se,I,F,Y),Y.delete(se)),l1(o,p,de)}function vy(o,c){var p=o.length;if(p)return c+=c<0?p:0,$s(c,p)?o[c]:t}function my(o,c,p){c.length?c=cr(c,function(F){return wt(F)?function(Y){return pa(Y,F.length===1?F[0]:F)}:F}):c=[Di];var I=-1;c=cr(c,Hi(ot()));var T=dy(o,function(F,Y,X){var se=cr(c,function(ue){return ue(F)});return{criteria:se,index:++I,value:F}});return v$(T,function(F,Y){return rB(F,Y,p)})}function jL(o,c){return by(o,c,function(p,I){return K1(o,I)})}function by(o,c,p){for(var I=-1,T=c.length,F={};++I<T;){var Y=c[I],X=pa(o,Y);p(X,Y)&&Gf(F,wo(Y,o),X)}return F}function WL(o){return function(c){return pa(c,o)}}function w1(o,c,p,I){var T=I?g$:gc,F=-1,Y=c.length,X=o;for(o===c&&(c=Mi(c)),p&&(X=cr(o,Hi(p)));++F<Y;)for(var se=0,ue=c[F],de=p?p(ue):ue;(se=T(X,de,se,I))>-1;)X!==o&&pu.call(X,se,1),pu.call(o,se,1);return o}function wy(o,c){for(var p=o?c.length:0,I=p-1;p--;){var T=c[p];if(p==I||T!==F){var F=T;$s(T)?pu.call(o,T,1):E1(o,T)}}return o}function y1(o,c){return o+mu(Xw()*(c-o+1))}function KL(o,c,p,I){for(var T=-1,F=Dr(vu((c-o)/(p||1)),0),Y=ce(F);F--;)Y[I?F:++T]=o,o+=p;return Y}function _1(o,c){var p="";if(!o||c<1||c>D)return p;do c%2&&(p+=o),c=mu(c/2),c&&(o+=o);while(c);return p}function Mt(o,c){return U1(Jy(o,c,Di),o+"")}function VL(o){return ry(Mc(o))}function GL(o,c){var p=Mc(o);return Nu(p,da(c,0,p.length))}function Gf(o,c,p,I){if(!hr(o))return o;c=wo(c,o);for(var T=-1,F=c.length,Y=F-1,X=o;X!=null&&++T<F;){var se=us(c[T]),ue=p;if(se==="__proto__"||se==="constructor"||se==="prototype")return o;if(T!=Y){var de=X[se];ue=I?I(de,se,X):t,ue===t&&(ue=hr(de)?de:$s(c[T+1])?[]:{})}jf(X,se,ue),X=X[se]}return o}var yy=bu?function(o,c){return bu.set(o,c),o}:Di,JL=gu?function(o,c){return gu(o,"toString",{configurable:!0,enumerable:!1,value:G1(c),writable:!0})}:Di;function YL(o){return Nu(Mc(o))}function vn(o,c,p){var I=-1,T=o.length;c<0&&(c=-c>T?0:T+c),p=p>T?T:p,p<0&&(p+=T),T=c>p?0:p-c>>>0,c>>>=0;for(var F=ce(T);++I<T;)F[I]=o[I+c];return F}function QL(o,c){var p;return mo(o,function(I,T,F){return p=c(I,T,F),!p}),!!p}function Su(o,c,p){var I=0,T=o==null?I:o.length;if(typeof c=="number"&&c===c&&T<=N){for(;I<T;){var F=I+T>>>1,Y=o[F];Y!==null&&!Wi(Y)&&(p?Y<=c:Y<c)?I=F+1:T=F}return T}return x1(o,c,Di,p)}function x1(o,c,p,I){var T=0,F=o==null?0:o.length;if(F===0)return 0;c=p(c);for(var Y=c!==c,X=c===null,se=Wi(c),ue=c===t;T<F;){var de=mu((T+F)/2),ve=p(o[de]),Se=ve!==t,Ye=ve===null,ct=ve===ve,St=Wi(ve);if(Y)var ft=I||ct;else ue?ft=ct&&(I||Se):X?ft=ct&&Se&&(I||!Ye):se?ft=ct&&Se&&!Ye&&(I||!St):Ye||St?ft=!1:ft=I?ve<=c:ve<c;ft?T=de+1:F=de}return ri(F,_)}function _y(o,c){for(var p=-1,I=o.length,T=0,F=[];++p<I;){var Y=o[p],X=c?c(Y):Y;if(!p||!Un(X,se)){var se=X;F[T++]=Y===0?0:Y}}return F}function xy(o){return typeof o=="number"?o:Wi(o)?v:+o}function ji(o){if(typeof o=="string")return o;if(wt(o))return cr(o,ji)+"";if(Wi(o))return ey?ey.call(o):"";var c=o+"";return c=="0"&&1/o==-C?"-0":c}function bo(o,c,p){var I=-1,T=nu,F=o.length,Y=!0,X=[],se=X;if(p)Y=!1,T=Qp;else if(F>=n){var ue=c?null:cB(o);if(ue)return ou(ue);Y=!1,T=Uf,se=new ua}else se=c?[]:X;e:for(;++I<F;){var de=o[I],ve=c?c(de):de;if(de=p||de!==0?de:0,Y&&ve===ve){for(var Se=se.length;Se--;)if(se[Se]===ve)continue e;c&&se.push(ve),X.push(de)}else T(se,ve,p)||(se!==X&&se.push(ve),X.push(de))}return X}function E1(o,c){return c=wo(c,o),o=Yy(o,c),o==null||delete o[us(mn(c))]}function Ey(o,c,p,I){return Gf(o,c,p(pa(o,c)),I)}function Iu(o,c,p,I){for(var T=o.length,F=I?T:-1;(I?F--:++F<T)&&c(o[F],F,o););return p?vn(o,I?0:F,I?F+1:T):vn(o,I?F+1:0,I?T:F)}function Ay(o,c){var p=o;return p instanceof $t&&(p=p.value()),Zp(c,function(I,T){return T.func.apply(T.thisArg,po([I],T.args))},p)}function A1(o,c,p){var I=o.length;if(I<2)return I?bo(o[0]):[];for(var T=-1,F=ce(I);++T<I;)for(var Y=o[T],X=-1;++X<I;)X!=T&&(F[T]=Wf(F[T]||Y,o[X],c,p));return bo(Vr(F,1),c,p)}function Sy(o,c,p){for(var I=-1,T=o.length,F=c.length,Y={};++I<T;){var X=I<F?c[I]:t;p(Y,o[I],X)}return Y}function S1(o){return xr(o)?o:[]}function I1(o){return typeof o=="function"?o:Di}function wo(o,c){return wt(o)?o:$1(o,c)?[o]:e6(Vt(o))}var ZL=Mt;function yo(o,c,p){var I=o.length;return p=p===t?I:p,!c&&p>=I?o:vn(o,c,p)}var Iy=F$||function(o){return Bt.clearTimeout(o)};function My(o,c){if(c)return o.slice();var p=o.length,I=Gw?Gw(p):new o.constructor(p);return o.copy(I),I}function M1(o){var c=new o.constructor(o.byteLength);return new uu(c).set(new uu(o)),c}function XL(o,c){var p=c?M1(o.buffer):o.buffer;return new o.constructor(p,o.byteOffset,o.byteLength)}function eB(o){var c=new o.constructor(o.source,_t.exec(o));return c.lastIndex=o.lastIndex,c}function tB(o){return Hf?tr(Hf.call(o)):{}}function Cy(o,c){var p=c?M1(o.buffer):o.buffer;return new o.constructor(p,o.byteOffset,o.length)}function Py(o,c){if(o!==c){var p=o!==t,I=o===null,T=o===o,F=Wi(o),Y=c!==t,X=c===null,se=c===c,ue=Wi(c);if(!X&&!ue&&!F&&o>c||F&&Y&&se&&!X&&!ue||I&&Y&&se||!p&&se||!T)return 1;if(!I&&!F&&!ue&&o<c||ue&&p&&T&&!I&&!F||X&&p&&T||!Y&&T||!se)return-1}return 0}function rB(o,c,p){for(var I=-1,T=o.criteria,F=c.criteria,Y=T.length,X=p.length;++I<Y;){var se=Py(T[I],F[I]);if(se){if(I>=X)return se;var ue=p[I];return se*(ue=="desc"?-1:1)}}return o.index-c.index}function Dy(o,c,p,I){for(var T=-1,F=o.length,Y=p.length,X=-1,se=c.length,ue=Dr(F-Y,0),de=ce(se+ue),ve=!I;++X<se;)de[X]=c[X];for(;++T<Y;)(ve||T<F)&&(de[p[T]]=o[T]);for(;ue--;)de[X++]=o[T++];return de}function Oy(o,c,p,I){for(var T=-1,F=o.length,Y=-1,X=p.length,se=-1,ue=c.length,de=Dr(F-X,0),ve=ce(de+ue),Se=!I;++T<de;)ve[T]=o[T];for(var Ye=T;++se<ue;)ve[Ye+se]=c[se];for(;++Y<X;)(Se||T<F)&&(ve[Ye+p[Y]]=o[T++]);return ve}function Mi(o,c){var p=-1,I=o.length;for(c||(c=ce(I));++p<I;)c[p]=o[p];return c}function hs(o,c,p,I){var T=!p;p||(p={});for(var F=-1,Y=c.length;++F<Y;){var X=c[F],se=I?I(p[X],o[X],X,p,o):t;se===t&&(se=o[X]),T?Rs(p,X,se):jf(p,X,se)}return p}function iB(o,c){return hs(o,N1(o),c)}function nB(o,c){return hs(o,jy(o),c)}function Mu(o,c){return function(p,I){var T=wt(p)?f$:IL,F=c?c():{};return T(p,o,ot(I,2),F)}}function Ec(o){return Mt(function(c,p){var I=-1,T=p.length,F=T>1?p[T-1]:t,Y=T>2?p[2]:t;for(F=o.length>3&&typeof F=="function"?(T--,F):t,Y&&di(p[0],p[1],Y)&&(F=T<3?t:F,T=1),c=tr(c);++I<T;){var X=p[I];X&&o(c,X,I,F)}return c})}function Ry(o,c){return function(p,I){if(p==null)return p;if(!Ci(p))return o(p,I);for(var T=p.length,F=c?T:-1,Y=tr(p);(c?F--:++F<T)&&I(Y[F],F,Y)!==!1;);return p}}function Ty(o){return function(c,p,I){for(var T=-1,F=tr(c),Y=I(c),X=Y.length;X--;){var se=Y[o?X:++T];if(p(F[se],se,F)===!1)break}return c}}function sB(o,c,p){var I=c&q,T=Jf(o);function F(){var Y=this&&this!==Bt&&this instanceof F?T:o;return Y.apply(I?p:this,arguments)}return F}function Ny(o){return function(c){c=Vt(c);var p=vc(c)?Ln(c):t,I=p?p[0]:c.charAt(0),T=p?yo(p,1).join(""):c.slice(1);return I[o]()+T}}function Ac(o){return function(c){return Zp(R6(O6(c).replace(Lf,"")),o,"")}}function Jf(o){return function(){var c=arguments;switch(c.length){case 0:return new o;case 1:return new o(c[0]);case 2:return new o(c[0],c[1]);case 3:return new o(c[0],c[1],c[2]);case 4:return new o(c[0],c[1],c[2],c[3]);case 5:return new o(c[0],c[1],c[2],c[3],c[4]);case 6:return new o(c[0],c[1],c[2],c[3],c[4],c[5]);case 7:return new o(c[0],c[1],c[2],c[3],c[4],c[5],c[6])}var p=xc(o.prototype),I=o.apply(p,c);return hr(I)?I:p}}function oB(o,c,p){var I=Jf(o);function T(){for(var F=arguments.length,Y=ce(F),X=F,se=Sc(T);X--;)Y[X]=arguments[X];var ue=F<3&&Y[0]!==se&&Y[F-1]!==se?[]:go(Y,se);if(F-=ue.length,F<p)return Fy(o,c,Cu,T.placeholder,t,Y,ue,t,t,p-F);var de=this&&this!==Bt&&this instanceof T?I:o;return Fr(de,this,Y)}return T}function $y(o){return function(c,p,I){var T=tr(c);if(!Ci(c)){var F=ot(p,3);c=qr(c),p=function(X){return F(T[X],X,T)}}var Y=o(c,p,I);return Y>-1?T[F?c[Y]:Y]:t}}function Ly(o){return Ns(function(c){var p=c.length,I=p,T=pn.prototype.thru;for(o&&c.reverse();I--;){var F=c[I];if(typeof F!="function")throw new dn(a);if(T&&!Y&&Ru(F)=="wrapper")var Y=new pn([],!0)}for(I=Y?I:p;++I<p;){F=c[I];var X=Ru(F),se=X=="wrapper"?R1(F):t;se&&L1(se[0])&&se[1]==(A|ee|G|z)&&!se[4].length&&se[9]==1?Y=Y[Ru(se[0])].apply(Y,se[3]):Y=F.length==1&&L1(F)?Y[X]():Y.thru(F)}return function(){var ue=arguments,de=ue[0];if(Y&&ue.length==1&&wt(de))return Y.plant(de).value();for(var ve=0,Se=p?c[ve].apply(this,ue):de;++ve<p;)Se=c[ve].call(this,Se);return Se}})}function Cu(o,c,p,I,T,F,Y,X,se,ue){var de=c&A,ve=c&q,Se=c&U,Ye=c&(ee|W),ct=c&te,St=Se?t:Jf(o);function ft(){for(var Rt=arguments.length,Ut=ce(Rt),Ki=Rt;Ki--;)Ut[Ki]=arguments[Ki];if(Ye)var pi=Sc(ft),Vi=b$(Ut,pi);if(I&&(Ut=Dy(Ut,I,T,Ye)),F&&(Ut=Oy(Ut,F,Y,Ye)),Rt-=Vi,Ye&&Rt<ue){var Er=go(Ut,pi);return Fy(o,c,Cu,ft.placeholder,p,Ut,Er,X,se,ue-Rt)}var Fn=ve?p:this,Us=Se?Fn[o]:o;return Rt=Ut.length,X?Ut=IB(Ut,X):ct&&Rt>1&&Ut.reverse(),de&&se<Rt&&(Ut.length=se),this&&this!==Bt&&this instanceof ft&&(Us=St||Jf(Us)),Us.apply(Fn,Ut)}return ft}function By(o,c){return function(p,I){return NL(p,o,c(I),{})}}function Pu(o,c){return function(p,I){var T;if(p===t&&I===t)return c;if(p!==t&&(T=p),I!==t){if(T===t)return I;typeof p=="string"||typeof I=="string"?(p=ji(p),I=ji(I)):(p=xy(p),I=xy(I)),T=o(p,I)}return T}}function C1(o){return Ns(function(c){return c=cr(c,Hi(ot())),Mt(function(p){var I=this;return o(c,function(T){return Fr(T,I,p)})})})}function Du(o,c){c=c===t?" ":ji(c);var p=c.length;if(p<2)return p?_1(c,o):c;var I=_1(c,vu(o/mc(c)));return vc(c)?yo(Ln(I),0,o).join(""):I.slice(0,o)}function aB(o,c,p,I){var T=c&q,F=Jf(o);function Y(){for(var X=-1,se=arguments.length,ue=-1,de=I.length,ve=ce(de+se),Se=this&&this!==Bt&&this instanceof Y?F:o;++ue<de;)ve[ue]=I[ue];for(;se--;)ve[ue++]=arguments[++X];return Fr(Se,T?p:this,ve)}return Y}function Uy(o){return function(c,p,I){return I&&typeof I!="number"&&di(c,p,I)&&(p=I=t),c=Bs(c),p===t?(p=c,c=0):p=Bs(p),I=I===t?c<p?1:-1:Bs(I),KL(c,p,I,o)}}function Ou(o){return function(c,p){return typeof c=="string"&&typeof p=="string"||(c=bn(c),p=bn(p)),o(c,p)}}function Fy(o,c,p,I,T,F,Y,X,se,ue){var de=c&ee,ve=de?Y:t,Se=de?t:Y,Ye=de?F:t,ct=de?t:F;c|=de?G:Q,c&=~(de?Q:G),c&J||(c&=~(q|U));var St=[o,c,T,Ye,ve,ct,Se,X,se,ue],ft=p.apply(t,St);return L1(o)&&Qy(ft,St),ft.placeholder=I,Zy(ft,o,c)}function P1(o){var c=Pr[o];return function(p,I){if(p=bn(p),I=I==null?0:ri(At(I),292),I&&Zw(p)){var T=(Vt(p)+"e").split("e"),F=c(T[0]+"e"+(+T[1]+I));return T=(Vt(F)+"e").split("e"),+(T[0]+"e"+(+T[1]-I))}return c(p)}}var cB=yc&&1/ou(new yc([,-0]))[1]==C?function(o){return new yc(o)}:Q1;function qy(o){return function(c){var p=ii(c);return p==he?s1(c):p==be?S$(c):m$(c,o(c))}}function Ts(o,c,p,I,T,F,Y,X){var se=c&U;if(!se&&typeof o!="function")throw new dn(a);var ue=I?I.length:0;if(ue||(c&=~(G|Q),I=T=t),Y=Y===t?Y:Dr(At(Y),0),X=X===t?X:At(X),ue-=T?T.length:0,c&Q){var de=I,ve=T;I=T=t}var Se=se?t:R1(o),Ye=[o,c,p,I,T,de,ve,F,Y,X];if(Se&&EB(Ye,Se),o=Ye[0],c=Ye[1],p=Ye[2],I=Ye[3],T=Ye[4],X=Ye[9]=Ye[9]===t?se?0:o.length:Dr(Ye[9]-ue,0),!X&&c&(ee|W)&&(c&=~(ee|W)),!c||c==q)var ct=sB(o,c,p);else c==ee||c==W?ct=oB(o,c,X):(c==G||c==(q|G))&&!T.length?ct=aB(o,c,p,I):ct=Cu.apply(t,Ye);var St=Se?yy:Qy;return Zy(St(ct,Ye),o,c)}function zy(o,c,p,I){return o===t||Un(o,wc[p])&&!Jt.call(I,p)?c:o}function ky(o,c,p,I,T,F){return hr(o)&&hr(c)&&(F.set(c,o),Au(o,c,t,ky,F),F.delete(c)),o}function fB(o){return Zf(o)?t:o}function Hy(o,c,p,I,T,F){var Y=p&O,X=o.length,se=c.length;if(X!=se&&!(Y&&se>X))return!1;var ue=F.get(o),de=F.get(c);if(ue&&de)return ue==c&&de==o;var ve=-1,Se=!0,Ye=p&$?new ua:t;for(F.set(o,c),F.set(c,o);++ve<X;){var ct=o[ve],St=c[ve];if(I)var ft=Y?I(St,ct,ve,c,o,F):I(ct,St,ve,o,c,F);if(ft!==t){if(ft)continue;Se=!1;break}if(Ye){if(!Xp(c,function(Rt,Ut){if(!Uf(Ye,Ut)&&(ct===Rt||T(ct,Rt,p,I,F)))return Ye.push(Ut)})){Se=!1;break}}else if(!(ct===St||T(ct,St,p,I,F))){Se=!1;break}}return F.delete(o),F.delete(c),Se}function lB(o,c,p,I,T,F,Y){switch(p){case Me:if(o.byteLength!=c.byteLength||o.byteOffset!=c.byteOffset)return!1;o=o.buffer,c=c.buffer;case me:return!(o.byteLength!=c.byteLength||!F(new uu(o),new uu(c)));case K:case k:case ge:return Un(+o,+c);case j:return o.name==c.name&&o.message==c.message;case Ne:case Pe:return o==c+"";case he:var X=s1;case be:var se=I&O;if(X||(X=ou),o.size!=c.size&&!se)return!1;var ue=Y.get(o);if(ue)return ue==c;I|=$,Y.set(o,c);var de=Hy(X(o),X(c),I,T,F,Y);return Y.delete(o),de;case De:if(Hf)return Hf.call(o)==Hf.call(c)}return!1}function hB(o,c,p,I,T,F){var Y=p&O,X=D1(o),se=X.length,ue=D1(c),de=ue.length;if(se!=de&&!Y)return!1;for(var ve=se;ve--;){var Se=X[ve];if(!(Y?Se in c:Jt.call(c,Se)))return!1}var Ye=F.get(o),ct=F.get(c);if(Ye&&ct)return Ye==c&&ct==o;var St=!0;F.set(o,c),F.set(c,o);for(var ft=Y;++ve<se;){Se=X[ve];var Rt=o[Se],Ut=c[Se];if(I)var Ki=Y?I(Ut,Rt,Se,c,o,F):I(Rt,Ut,Se,o,c,F);if(!(Ki===t?Rt===Ut||T(Rt,Ut,p,I,F):Ki)){St=!1;break}ft||(ft=Se=="constructor")}if(St&&!ft){var pi=o.constructor,Vi=c.constructor;pi!=Vi&&"constructor"in o&&"constructor"in c&&!(typeof pi=="function"&&pi instanceof pi&&typeof Vi=="function"&&Vi instanceof Vi)&&(St=!1)}return F.delete(o),F.delete(c),St}function Ns(o){return U1(Jy(o,t,n6),o+"")}function D1(o){return fy(o,qr,N1)}function O1(o){return fy(o,Pi,jy)}var R1=bu?function(o){return bu.get(o)}:Q1;function Ru(o){for(var c=o.name+"",p=_c[c],I=Jt.call(_c,c)?p.length:0;I--;){var T=p[I],F=T.func;if(F==null||F==o)return T.name}return c}function Sc(o){var c=Jt.call(B,"placeholder")?B:o;return c.placeholder}function ot(){var o=B.iteratee||J1;return o=o===J1?uy:o,arguments.length?o(arguments[0],arguments[1]):o}function Tu(o,c){var p=o.__data__;return wB(c)?p[typeof c=="string"?"string":"hash"]:p.map}function T1(o){for(var c=qr(o),p=c.length;p--;){var I=c[p],T=o[I];c[p]=[I,T,Vy(T)]}return c}function ga(o,c){var p=x$(o,c);return hy(p)?p:t}function uB(o){var c=Jt.call(o,la),p=o[la];try{o[la]=t;var I=!0}catch{}var T=lu.call(o);return I&&(c?o[la]=p:delete o[la]),T}var N1=a1?function(o){return o==null?[]:(o=tr(o),uo(a1(o),function(c){return Yw.call(o,c)}))}:Z1,jy=a1?function(o){for(var c=[];o;)po(c,N1(o)),o=du(o);return c}:Z1,ii=ui;(c1&&ii(new c1(new ArrayBuffer(1)))!=Me||qf&&ii(new qf)!=he||f1&&ii(f1.resolve())!=Ce||yc&&ii(new yc)!=be||zf&&ii(new zf)!=Ie)&&(ii=function(o){var c=ui(o),p=c==Te?o.constructor:t,I=p?va(p):"";if(I)switch(I){case G$:return Me;case J$:return he;case Y$:return Ce;case Q$:return be;case Z$:return Ie}return c});function dB(o,c,p){for(var I=-1,T=p.length;++I<T;){var F=p[I],Y=F.size;switch(F.type){case"drop":o+=Y;break;case"dropRight":c-=Y;break;case"take":c=ri(c,o+Y);break;case"takeRight":o=Dr(o,c-Y);break}}return{start:o,end:c}}function pB(o){var c=o.match(Qe);return c?c[1].split(qe):[]}function Wy(o,c,p){c=wo(c,o);for(var I=-1,T=c.length,F=!1;++I<T;){var Y=us(c[I]);if(!(F=o!=null&&p(o,Y)))break;o=o[Y]}return F||++I!=T?F:(T=o==null?0:o.length,!!T&&qu(T)&&$s(Y,T)&&(wt(o)||ma(o)))}function gB(o){var c=o.length,p=new o.constructor(c);return c&&typeof o[0]=="string"&&Jt.call(o,"index")&&(p.index=o.index,p.input=o.input),p}function Ky(o){return typeof o.constructor=="function"&&!Yf(o)?xc(du(o)):{}}function vB(o,c,p){var I=o.constructor;switch(c){case me:return M1(o);case K:case k:return new I(+o);case Me:return XL(o,p);case Be:case we:case He:case We:case Ee:case Ve:case Ke:case Ge:case mt:return Cy(o,p);case he:return new I;case ge:case Pe:return new I(o);case Ne:return eB(o);case be:return new I;case De:return tB(o)}}function mB(o,c){var p=c.length;if(!p)return o;var I=p-1;return c[I]=(p>1?"& ":"")+c[I],c=c.join(p>2?", ":" "),o.replace(st,`{
|
|
51
51
|
/* [wrapped with `+c+`] */
|
|
52
|
-
`)}function HB(o){return wt(o)||ma(o)||!!(cy&&o&&o[cy])}function $s(o,c){var p=typeof o;return c=c??D,!!c&&(p=="number"||p!="symbol"&&ti.test(o))&&o>-1&&o%1==0&&o<c}function di(o,c,p){if(!hr(p))return!1;var I=typeof c;return(I=="number"?Ci(p)&&$s(c,p.length):I=="string"&&c in p)?Fn(p[c],o):!1}function B1(o,c){if(wt(o))return!1;var p=typeof o;return p=="number"||p=="symbol"||p=="boolean"||o==null||Wi(o)?!0:lt.test(o)||!Re.test(o)||c!=null&&o in tr(c)}function kB(o){var c=typeof o;return c=="string"||c=="number"||c=="symbol"||c=="boolean"?o!=="__proto__":o===null}function F1(o){var c=Tu(o),p=q[c];if(typeof p!="function"||!(c in $t.prototype))return!1;if(o===p)return!0;var I=N1(p);return!!I&&o===I[0]}function jB(o){return!!ny&&ny in o}var WB=fu?Ls:tg;function Qf(o){var c=o&&o.constructor,p=typeof c=="function"&&c.prototype||wc;return o===p}function n6(o){return o===o&&!hr(o)}function s6(o,c){return function(p){return p==null?!1:p[o]===c&&(c!==t||o in tr(p))}}function KB(o){var c=Uu(o,function(I){return p.size===u&&p.clear(),I}),p=c.cache;return c}function VB(o,c){var p=o[1],I=c[1],T=p|I,k=T<(j|H|_),Z=I==_&&p==G||I==_&&p==U&&o[7].length<=c[8]||I==(_|U)&&c[7].length<=c[8]&&p==G;if(!(k||Z))return o;I&j&&(o[2]=c[2],T|=p&j?0:F);var te=c[3];if(te){var se=o[3];o[3]=se?zy(se,te,c[4]):te,o[4]=se?go(o[3],g):c[4]}return te=c[5],te&&(se=o[5],o[5]=se?Hy(se,te,c[6]):te,o[6]=se?go(o[5],g):c[6]),te=c[7],te&&(o[7]=te),I&_&&(o[8]=o[8]==null?c[8]:ri(o[8],c[8])),o[9]==null&&(o[9]=c[9]),o[0]=c[0],o[1]=T,o}function GB(o){var c=[];if(o!=null)for(var p in tr(o))c.push(p);return c}function YB(o){return hu.call(o)}function o6(o,c,p){return c=Dr(c===t?o.length-1:c,0),function(){for(var I=arguments,T=-1,k=Dr(I.length-c,0),Z=ce(k);++T<k;)Z[T]=I[c+T];T=-1;for(var te=ce(c+1);++T<c;)te[T]=I[T];return te[c]=p(Z),Ur(o,this,te)}}function a6(o,c){return c.length<2?o:pa(o,vn(c,0,-1))}function JB(o,c){for(var p=o.length,I=ri(c.length,p),T=Mi(o);I--;){var k=c[I];o[I]=$s(k,p)?T[k]:t}return o}function U1(o,c){if(!(c==="constructor"&&typeof o[c]=="function")&&c!="__proto__")return o[c]}var c6=l6(Oy),Zf=hL||function(o,c){return Bt.setTimeout(o,c)},q1=l6(wB);function f6(o,c,p){var I=c+"";return q1(o,zB(I,QB(FB(I),p)))}function l6(o){var c=0,p=0;return function(){var I=gL(),T=m-(I-p);if(p=I,T>0){if(++c>=b)return arguments[0]}else c=0;return o.apply(t,arguments)}}function $u(o,c){var p=-1,I=o.length,T=I-1;for(c=c===t?I:c;++p<c;){var k=x1(p,T),Z=o[k];o[k]=o[p],o[p]=Z}return o.length=c,o}var h6=KB(function(o){var c=[];return o.charCodeAt(0)===46&&c.push(""),o.replace(ht,function(p,I,T,k){c.push(T?k.replace(at,"$1"):I||p)}),c});function us(o){if(typeof o=="string"||Wi(o))return o;var c=o+"";return c=="0"&&1/o==-P?"-0":c}function va(o){if(o!=null){try{return lu.call(o)}catch{}try{return o+""}catch{}}return""}function QB(o,c){return un(ae,function(p){var I="_."+p[0];c&p[1]&&!su(o,I)&&o.push(I)}),o.sort()}function u6(o){if(o instanceof $t)return o.clone();var c=new pn(o.__wrapped__,o.__chain__);return c.__actions__=Mi(o.__actions__),c.__index__=o.__index__,c.__values__=o.__values__,c}function ZB(o,c,p){(p?di(o,c,p):c===t)?c=1:c=Dr(Et(c),0);var I=o==null?0:o.length;if(!I||c<1)return[];for(var T=0,k=0,Z=ce(mu(I/c));T<I;)Z[k++]=vn(o,T,T+=c);return Z}function XB(o){for(var c=-1,p=o==null?0:o.length,I=0,T=[];++c<p;){var k=o[c];k&&(T[I++]=k)}return T}function eF(){var o=arguments.length;if(!o)return[];for(var c=ce(o-1),p=arguments[0],I=o;I--;)c[I-1]=arguments[I];return po(wt(p)?Mi(p):[p],Vr(c,1))}var tF=Mt(function(o,c){return xr(o)?Kf(o,Vr(c,1,xr,!0)):[]}),rF=Mt(function(o,c){var p=mn(c);return xr(p)&&(p=t),xr(o)?Kf(o,Vr(c,1,xr,!0),ot(p,2)):[]}),iF=Mt(function(o,c){var p=mn(c);return xr(p)&&(p=t),xr(o)?Kf(o,Vr(c,1,xr,!0),t,p):[]});function nF(o,c,p){var I=o==null?0:o.length;return I?(c=p||c===t?1:Et(c),vn(o,c<0?0:c,I)):[]}function sF(o,c,p){var I=o==null?0:o.length;return I?(c=p||c===t?1:Et(c),c=I-c,vn(o,0,c<0?0:c)):[]}function oF(o,c){return o&&o.length?Mu(o,ot(c,3),!0,!0):[]}function aF(o,c){return o&&o.length?Mu(o,ot(c,3),!0):[]}function cF(o,c,p,I){var T=o==null?0:o.length;return T?(p&&typeof p!="number"&&di(o,c,p)&&(p=0,I=T),eB(o,c,p,I)):[]}function d6(o,c,p){var I=o==null?0:o.length;if(!I)return-1;var T=p==null?0:Et(p);return T<0&&(T=Dr(I+T,0)),ou(o,ot(c,3),T)}function p6(o,c,p){var I=o==null?0:o.length;if(!I)return-1;var T=I-1;return p!==t&&(T=Et(p),T=p<0?Dr(I+T,0):ri(T,I-1)),ou(o,ot(c,3),T,!0)}function g6(o){var c=o==null?0:o.length;return c?Vr(o,1):[]}function fF(o){var c=o==null?0:o.length;return c?Vr(o,P):[]}function lF(o,c){var p=o==null?0:o.length;return p?(c=c===t?1:Et(c),Vr(o,c)):[]}function hF(o){for(var c=-1,p=o==null?0:o.length,I={};++c<p;){var T=o[c];I[T[0]]=T[1]}return I}function v6(o){return o&&o.length?o[0]:t}function uF(o,c,p){var I=o==null?0:o.length;if(!I)return-1;var T=p==null?0:Et(p);return T<0&&(T=Dr(I+T,0)),gc(o,c,T)}function dF(o){var c=o==null?0:o.length;return c?vn(o,0,-1):[]}var pF=Mt(function(o){var c=cr(o,M1);return c.length&&c[0]===o[0]?m1(c):[]}),gF=Mt(function(o){var c=mn(o),p=cr(o,M1);return c===mn(p)?c=t:p.pop(),p.length&&p[0]===o[0]?m1(p,ot(c,2)):[]}),vF=Mt(function(o){var c=mn(o),p=cr(o,M1);return c=typeof c=="function"?c:t,c&&p.pop(),p.length&&p[0]===o[0]?m1(p,t,c):[]});function mF(o,c){return o==null?"":dL.call(o,c)}function mn(o){var c=o==null?0:o.length;return c?o[c-1]:t}function bF(o,c,p){var I=o==null?0:o.length;if(!I)return-1;var T=I;return p!==t&&(T=Et(p),T=T<0?Dr(I+T,0):ri(T,I-1)),c===c?Q$(o,c,T):ou(o,Jw,T,!0)}function wF(o,c){return o&&o.length?My(o,Et(c)):t}var yF=Mt(m6);function m6(o,c){return o&&o.length&&c&&c.length?_1(o,c):o}function _F(o,c,p){return o&&o.length&&c&&c.length?_1(o,c,ot(p,2)):o}function xF(o,c,p){return o&&o.length&&c&&c.length?_1(o,c,t,p):o}var AF=Ns(function(o,c){var p=o==null?0:o.length,I=d1(o,c);return Dy(o,cr(c,function(T){return $s(T,p)?+T:T}).sort(qy)),I});function EF(o,c){var p=[];if(!(o&&o.length))return p;var I=-1,T=[],k=o.length;for(c=ot(c,3);++I<k;){var Z=o[I];c(Z,I,o)&&(p.push(Z),T.push(I))}return Dy(o,T),p}function z1(o){return o==null?o:mL.call(o)}function SF(o,c,p){var I=o==null?0:o.length;return I?(p&&typeof p!="number"&&di(o,c,p)?(c=0,p=I):(c=c==null?0:Et(c),p=p===t?I:Et(p)),vn(o,c,p)):[]}function IF(o,c){return Iu(o,c)}function MF(o,c,p){return E1(o,c,ot(p,2))}function CF(o,c){var p=o==null?0:o.length;if(p){var I=Iu(o,c);if(I<p&&Fn(o[I],c))return I}return-1}function PF(o,c){return Iu(o,c,!0)}function DF(o,c,p){return E1(o,c,ot(p,2),!0)}function OF(o,c){var p=o==null?0:o.length;if(p){var I=Iu(o,c,!0)-1;if(Fn(o[I],c))return I}return-1}function RF(o){return o&&o.length?Ry(o):[]}function TF(o,c){return o&&o.length?Ry(o,ot(c,2)):[]}function NF(o){var c=o==null?0:o.length;return c?vn(o,1,c):[]}function $F(o,c,p){return o&&o.length?(c=p||c===t?1:Et(c),vn(o,0,c<0?0:c)):[]}function LF(o,c,p){var I=o==null?0:o.length;return I?(c=p||c===t?1:Et(c),c=I-c,vn(o,c<0?0:c,I)):[]}function BF(o,c){return o&&o.length?Mu(o,ot(c,3),!1,!0):[]}function FF(o,c){return o&&o.length?Mu(o,ot(c,3)):[]}var UF=Mt(function(o){return bo(Vr(o,1,xr,!0))}),qF=Mt(function(o){var c=mn(o);return xr(c)&&(c=t),bo(Vr(o,1,xr,!0),ot(c,2))}),zF=Mt(function(o){var c=mn(o);return c=typeof c=="function"?c:t,bo(Vr(o,1,xr,!0),t,c)});function HF(o){return o&&o.length?bo(o):[]}function kF(o,c){return o&&o.length?bo(o,ot(c,2)):[]}function jF(o,c){return c=typeof c=="function"?c:t,o&&o.length?bo(o,t,c):[]}function H1(o){if(!(o&&o.length))return[];var c=0;return o=uo(o,function(p){if(xr(p))return c=Dr(p.length,c),!0}),s1(c,function(p){return cr(o,r1(p))})}function b6(o,c){if(!(o&&o.length))return[];var p=H1(o);return c==null?p:cr(p,function(I){return Ur(c,t,I)})}var WF=Mt(function(o,c){return xr(o)?Kf(o,c):[]}),KF=Mt(function(o){return I1(uo(o,xr))}),VF=Mt(function(o){var c=mn(o);return xr(c)&&(c=t),I1(uo(o,xr),ot(c,2))}),GF=Mt(function(o){var c=mn(o);return c=typeof c=="function"?c:t,I1(uo(o,xr),t,c)}),YF=Mt(H1);function JF(o,c){return Ly(o||[],c||[],Wf)}function QF(o,c){return Ly(o||[],c||[],Yf)}var ZF=Mt(function(o){var c=o.length,p=c>1?o[c-1]:t;return p=typeof p=="function"?(o.pop(),p):t,b6(o,p)});function w6(o){var c=q(o);return c.__chain__=!0,c}function XF(o,c){return c(o),o}function Lu(o,c){return c(o)}var eU=Ns(function(o){var c=o.length,p=c?o[0]:0,I=this.__wrapped__,T=function(k){return d1(k,o)};return c>1||this.__actions__.length||!(I instanceof $t)||!$s(p)?this.thru(T):(I=I.slice(p,+p+(c?1:0)),I.__actions__.push({func:Lu,args:[T],thisArg:t}),new pn(I,this.__chain__).thru(function(k){return c&&!k.length&&k.push(t),k}))});function tU(){return w6(this)}function rU(){return new pn(this.value(),this.__chain__)}function iU(){this.__values__===t&&(this.__values__=T6(this.value()));var o=this.__index__>=this.__values__.length,c=o?t:this.__values__[this.__index__++];return{done:o,value:c}}function nU(){return this}function sU(o){for(var c,p=this;p instanceof _u;){var I=u6(p);I.__index__=0,I.__values__=t,c?T.__wrapped__=I:c=I;var T=I;p=p.__wrapped__}return T.__wrapped__=o,c}function oU(){var o=this.__wrapped__;if(o instanceof $t){var c=o;return this.__actions__.length&&(c=new $t(this)),c=c.reverse(),c.__actions__.push({func:Lu,args:[z1],thisArg:t}),new pn(c,this.__chain__)}return this.thru(z1)}function aU(){return $y(this.__wrapped__,this.__actions__)}var cU=Cu(function(o,c,p){Yt.call(o,p)?++o[p]:Rs(o,p,1)});function fU(o,c,p){var I=wt(o)?Gw:XL;return p&&di(o,c,p)&&(c=t),I(o,ot(c,3))}function lU(o,c){var p=wt(o)?uo:by;return p(o,ot(c,3))}var hU=Ky(d6),uU=Ky(p6);function dU(o,c){return Vr(Bu(o,c),1)}function pU(o,c){return Vr(Bu(o,c),P)}function gU(o,c,p){return p=p===t?1:Et(p),Vr(Bu(o,c),p)}function y6(o,c){var p=wt(o)?un:mo;return p(o,ot(c,3))}function _6(o,c){var p=wt(o)?N$:my;return p(o,ot(c,3))}var vU=Cu(function(o,c,p){Yt.call(o,p)?o[p].push(c):Rs(o,p,[c])});function mU(o,c,p,I){o=Ci(o)?o:Mc(o),p=p&&!I?Et(p):0;var T=o.length;return p<0&&(p=Dr(T+p,0)),Hu(o)?p<=T&&o.indexOf(c,p)>-1:!!T&&gc(o,c,p)>-1}var bU=Mt(function(o,c,p){var I=-1,T=typeof c=="function",k=Ci(o)?ce(o.length):[];return mo(o,function(Z){k[++I]=T?Ur(c,Z,p):Vf(Z,c,p)}),k}),wU=Cu(function(o,c,p){Rs(o,p,c)});function Bu(o,c){var p=wt(o)?cr:Ey;return p(o,ot(c,3))}function yU(o,c,p,I){return o==null?[]:(wt(c)||(c=c==null?[]:[c]),p=I?t:p,wt(p)||(p=p==null?[]:[p]),Cy(o,c,p))}var _U=Cu(function(o,c,p){o[p?0:1].push(c)},function(){return[[],[]]});function xU(o,c,p){var I=wt(o)?e1:Zw,T=arguments.length<3;return I(o,ot(c,4),p,T,mo)}function AU(o,c,p){var I=wt(o)?$$:Zw,T=arguments.length<3;return I(o,ot(c,4),p,T,my)}function EU(o,c){var p=wt(o)?uo:by;return p(o,qu(ot(c,3)))}function SU(o){var c=wt(o)?dy:mB;return c(o)}function IU(o,c,p){(p?di(o,c,p):c===t)?c=1:c=Et(c);var I=wt(o)?GL:bB;return I(o,c)}function MU(o){var c=wt(o)?YL:yB;return c(o)}function CU(o){if(o==null)return 0;if(Ci(o))return Hu(o)?mc(o):o.length;var c=ii(o);return c==he||c==be?o.size:w1(o).length}function PU(o,c,p){var I=wt(o)?t1:_B;return p&&di(o,c,p)&&(c=t),I(o,ot(c,3))}var DU=Mt(function(o,c){if(o==null)return[];var p=c.length;return p>1&&di(o,c[0],c[1])?c=[]:p>2&&di(c[0],c[1],c[2])&&(c=[c[0]]),Cy(o,Vr(c,1),[])}),Fu=lL||function(){return Bt.Date.now()};function OU(o,c){if(typeof c!="function")throw new dn(a);return o=Et(o),function(){if(--o<1)return c.apply(this,arguments)}}function x6(o,c,p){return c=p?t:c,c=o&&c==null?o.length:c,Ts(o,_,t,t,t,t,c)}function A6(o,c){var p;if(typeof c!="function")throw new dn(a);return o=Et(o),function(){return--o>0&&(p=c.apply(this,arguments)),o<=1&&(c=t),p}}var k1=Mt(function(o,c,p){var I=j;if(p.length){var T=go(p,Sc(k1));I|=z}return Ts(o,I,c,p,T)}),E6=Mt(function(o,c,p){var I=j|H;if(p.length){var T=go(p,Sc(E6));I|=z}return Ts(c,I,o,p,T)});function S6(o,c,p){c=p?t:c;var I=Ts(o,G,t,t,t,t,t,c);return I.placeholder=S6.placeholder,I}function I6(o,c,p){c=p?t:c;var I=Ts(o,B,t,t,t,t,t,c);return I.placeholder=I6.placeholder,I}function M6(o,c,p){var I,T,k,Z,te,se,ue=0,de=!1,ve=!1,Se=!0;if(typeof o!="function")throw new dn(a);c=bn(c)||0,hr(p)&&(de=!!p.leading,ve="maxWait"in p,k=ve?Dr(bn(p.maxWait)||0,c):k,Se="trailing"in p?!!p.trailing:Se);function Je(Ar){var Un=I,Fs=T;return I=T=t,ue=Ar,Z=o.apply(Fs,Un),Z}function ct(Ar){return ue=Ar,te=Zf(Rt,c),de?Je(Ar):Z}function St(Ar){var Un=Ar-se,Fs=Ar-ue,K6=c-Un;return ve?ri(K6,k-Fs):K6}function ft(Ar){var Un=Ar-se,Fs=Ar-ue;return se===t||Un>=c||Un<0||ve&&Fs>=k}function Rt(){var Ar=Fu();if(ft(Ar))return Ft(Ar);te=Zf(Rt,St(Ar))}function Ft(Ar){return te=t,Se&&I?Je(Ar):(I=T=t,Z)}function Ki(){te!==t&&By(te),ue=0,I=se=T=te=t}function pi(){return te===t?Z:Ft(Fu())}function Vi(){var Ar=Fu(),Un=ft(Ar);if(I=arguments,T=this,se=Ar,Un){if(te===t)return ct(se);if(ve)return By(te),te=Zf(Rt,c),Je(se)}return te===t&&(te=Zf(Rt,c)),Z}return Vi.cancel=Ki,Vi.flush=pi,Vi}var RU=Mt(function(o,c){return vy(o,1,c)}),TU=Mt(function(o,c,p){return vy(o,bn(c)||0,p)});function NU(o){return Ts(o,ee)}function Uu(o,c){if(typeof o!="function"||c!=null&&typeof c!="function")throw new dn(a);var p=function(){var I=arguments,T=c?c.apply(this,I):I[0],k=p.cache;if(k.has(T))return k.get(T);var Z=o.apply(this,I);return p.cache=k.set(T,Z)||k,Z};return p.cache=new(Uu.Cache||Os),p}Uu.Cache=Os;function qu(o){if(typeof o!="function")throw new dn(a);return function(){var c=arguments;switch(c.length){case 0:return!o.call(this);case 1:return!o.call(this,c[0]);case 2:return!o.call(this,c[0],c[1]);case 3:return!o.call(this,c[0],c[1],c[2])}return!o.apply(this,c)}}function $U(o){return A6(2,o)}var LU=xB(function(o,c){c=c.length==1&&wt(c[0])?cr(c[0],ki(ot())):cr(Vr(c,1),ki(ot()));var p=c.length;return Mt(function(I){for(var T=-1,k=ri(I.length,p);++T<k;)I[T]=c[T].call(this,I[T]);return Ur(o,this,I)})}),j1=Mt(function(o,c){var p=go(c,Sc(j1));return Ts(o,z,t,c,p)}),C6=Mt(function(o,c){var p=go(c,Sc(C6));return Ts(o,W,t,c,p)}),BU=Ns(function(o,c){return Ts(o,U,t,t,t,c)});function FU(o,c){if(typeof o!="function")throw new dn(a);return c=c===t?c:Et(c),Mt(o,c)}function UU(o,c){if(typeof o!="function")throw new dn(a);return c=c==null?0:Dr(Et(c),0),Mt(function(p){var I=p[c],T=yo(p,0,c);return I&&po(T,I),Ur(o,this,T)})}function qU(o,c,p){var I=!0,T=!0;if(typeof o!="function")throw new dn(a);return hr(p)&&(I="leading"in p?!!p.leading:I,T="trailing"in p?!!p.trailing:T),M6(o,c,{leading:I,maxWait:c,trailing:T})}function zU(o){return x6(o,1)}function HU(o,c){return j1(C1(c),o)}function kU(){if(!arguments.length)return[];var o=arguments[0];return wt(o)?o:[o]}function jU(o){return gn(o,C)}function WU(o,c){return c=typeof c=="function"?c:t,gn(o,C,c)}function KU(o){return gn(o,w|C)}function VU(o,c){return c=typeof c=="function"?c:t,gn(o,w|C,c)}function GU(o,c){return c==null||gy(o,c,qr(c))}function Fn(o,c){return o===c||o!==o&&c!==c}var YU=Ru(v1),JU=Ru(function(o,c){return o>=c}),ma=_y(function(){return arguments}())?_y:function(o){return mr(o)&&Yt.call(o,"callee")&&!ay.call(o,"callee")},wt=ce.isArray,QU=hi?ki(hi):sB;function Ci(o){return o!=null&&zu(o.length)&&!Ls(o)}function xr(o){return mr(o)&&Ci(o)}function ZU(o){return o===!0||o===!1||mr(o)&&ui(o)==J}var _o=uL||tg,XU=$n?ki($n):oB;function eq(o){return mr(o)&&o.nodeType===1&&!Xf(o)}function tq(o){if(o==null)return!0;if(Ci(o)&&(wt(o)||typeof o=="string"||typeof o.splice=="function"||_o(o)||Ic(o)||ma(o)))return!o.length;var c=ii(o);if(c==he||c==be)return!o.size;if(Qf(o))return!w1(o).length;for(var p in o)if(Yt.call(o,p))return!1;return!0}function rq(o,c){return Gf(o,c)}function iq(o,c,p){p=typeof p=="function"?p:t;var I=p?p(o,c):t;return I===t?Gf(o,c,t,p):!!I}function W1(o){if(!mr(o))return!1;var c=ui(o);return c==Y||c==E||typeof o.message=="string"&&typeof o.name=="string"&&!Xf(o)}function nq(o){return typeof o=="number"&&fy(o)}function Ls(o){if(!hr(o))return!1;var c=ui(o);return c==re||c==le||c==V||c==Xe}function P6(o){return typeof o=="number"&&o==Et(o)}function zu(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=D}function hr(o){var c=typeof o;return o!=null&&(c=="object"||c=="function")}function mr(o){return o!=null&&typeof o=="object"}var D6=hn?ki(hn):cB;function sq(o,c){return o===c||b1(o,c,$1(c))}function oq(o,c,p){return p=typeof p=="function"?p:t,b1(o,c,$1(c),p)}function aq(o){return O6(o)&&o!=+o}function cq(o){if(WB(o))throw new gt(s);return xy(o)}function fq(o){return o===null}function lq(o){return o==null}function O6(o){return typeof o=="number"||mr(o)&&ui(o)==ge}function Xf(o){if(!mr(o)||ui(o)!=Te)return!1;var c=pu(o);if(c===null)return!0;var p=Yt.call(c,"constructor")&&c.constructor;return typeof p=="function"&&p instanceof p&&lu.call(p)==oL}var K1=fs?ki(fs):fB;function hq(o){return P6(o)&&o>=-D&&o<=D}var R6=Ff?ki(Ff):lB;function Hu(o){return typeof o=="string"||!wt(o)&&mr(o)&&ui(o)==Pe}function Wi(o){return typeof o=="symbol"||mr(o)&&ui(o)==De}var Ic=fa?ki(fa):hB;function uq(o){return o===t}function dq(o){return mr(o)&&ii(o)==Ie}function pq(o){return mr(o)&&ui(o)==Oe}var gq=Ru(y1),vq=Ru(function(o,c){return o<=c});function T6(o){if(!o)return[];if(Ci(o))return Hu(o)?Ln(o):Mi(o);if(qf&&o[qf])return G$(o[qf]());var c=ii(o),p=c==he?a1:c==be?au:Mc;return p(o)}function Bs(o){if(!o)return o===0?o:0;if(o=bn(o),o===P||o===-P){var c=o<0?-1:1;return c*S}return o===o?o:0}function Et(o){var c=Bs(o),p=c%1;return c===c?p?c-p:c:0}function N6(o){return o?da(Et(o),0,A):0}function bn(o){if(typeof o=="number")return o;if(Wi(o))return v;if(hr(o)){var c=typeof o.valueOf=="function"?o.valueOf():o;o=hr(c)?c+"":c}if(typeof o!="string")return o===0?o:+o;o=Xw(o);var p=Zr.test(o);return p||ei.test(o)?bt(o.slice(2),p?2:8):qt.test(o)?v:+o}function $6(o){return hs(o,Pi(o))}function mq(o){return o?da(Et(o),-D,D):o===0?o:0}function Vt(o){return o==null?"":ji(o)}var bq=Ac(function(o,c){if(Qf(c)||Ci(c)){hs(c,qr(c),o);return}for(var p in c)Yt.call(c,p)&&Wf(o,p,c[p])}),L6=Ac(function(o,c){hs(c,Pi(c),o)}),ku=Ac(function(o,c,p,I){hs(c,Pi(c),o,I)}),wq=Ac(function(o,c,p,I){hs(c,qr(c),o,I)}),yq=Ns(d1);function _q(o,c){var p=xc(o);return c==null?p:py(p,c)}var xq=Mt(function(o,c){o=tr(o);var p=-1,I=c.length,T=I>2?c[2]:t;for(T&&di(c[0],c[1],T)&&(I=1);++p<I;)for(var k=c[p],Z=Pi(k),te=-1,se=Z.length;++te<se;){var ue=Z[te],de=o[ue];(de===t||Fn(de,wc[ue])&&!Yt.call(o,ue))&&(o[ue]=k[ue])}return o}),Aq=Mt(function(o){return o.push(t,Xy),Ur(B6,t,o)});function Eq(o,c){return Yw(o,ot(c,3),ls)}function Sq(o,c){return Yw(o,ot(c,3),g1)}function Iq(o,c){return o==null?o:p1(o,ot(c,3),Pi)}function Mq(o,c){return o==null?o:wy(o,ot(c,3),Pi)}function Cq(o,c){return o&&ls(o,ot(c,3))}function Pq(o,c){return o&&g1(o,ot(c,3))}function Dq(o){return o==null?[]:Eu(o,qr(o))}function Oq(o){return o==null?[]:Eu(o,Pi(o))}function V1(o,c,p){var I=o==null?t:pa(o,c);return I===t?p:I}function Rq(o,c){return o!=null&&r6(o,c,tB)}function G1(o,c){return o!=null&&r6(o,c,rB)}var Tq=Gy(function(o,c,p){c!=null&&typeof c.toString!="function"&&(c=hu.call(c)),o[c]=p},J1(Di)),Nq=Gy(function(o,c,p){c!=null&&typeof c.toString!="function"&&(c=hu.call(c)),Yt.call(o,c)?o[c].push(p):o[c]=[p]},ot),$q=Mt(Vf);function qr(o){return Ci(o)?uy(o):w1(o)}function Pi(o){return Ci(o)?uy(o,!0):uB(o)}function Lq(o,c){var p={};return c=ot(c,3),ls(o,function(I,T,k){Rs(p,c(I,T,k),I)}),p}function Bq(o,c){var p={};return c=ot(c,3),ls(o,function(I,T,k){Rs(p,T,c(I,T,k))}),p}var Fq=Ac(function(o,c,p){Su(o,c,p)}),B6=Ac(function(o,c,p,I){Su(o,c,p,I)}),Uq=Ns(function(o,c){var p={};if(o==null)return p;var I=!1;c=cr(c,function(k){return k=wo(k,o),I||(I=k.length>1),k}),hs(o,T1(o),p),I&&(p=gn(p,w|M|C,TB));for(var T=c.length;T--;)S1(p,c[T]);return p});function qq(o,c){return F6(o,qu(ot(c)))}var zq=Ns(function(o,c){return o==null?{}:pB(o,c)});function F6(o,c){if(o==null)return{};var p=cr(T1(o),function(I){return[I]});return c=ot(c),Py(o,p,function(I,T){return c(I,T[0])})}function Hq(o,c,p){c=wo(c,o);var I=-1,T=c.length;for(T||(T=1,o=t);++I<T;){var k=o==null?t:o[us(c[I])];k===t&&(I=T,k=p),o=Ls(k)?k.call(o):k}return o}function kq(o,c,p){return o==null?o:Yf(o,c,p)}function jq(o,c,p,I){return I=typeof I=="function"?I:t,o==null?o:Yf(o,c,p,I)}var U6=Qy(qr),q6=Qy(Pi);function Wq(o,c,p){var I=wt(o),T=I||_o(o)||Ic(o);if(c=ot(c,4),p==null){var k=o&&o.constructor;T?p=I?new k:[]:hr(o)?p=Ls(k)?xc(pu(o)):{}:p={}}return(T?un:ls)(o,function(Z,te,se){return c(p,Z,te,se)}),p}function Kq(o,c){return o==null?!0:S1(o,c)}function Vq(o,c,p){return o==null?o:Ny(o,c,C1(p))}function Gq(o,c,p,I){return I=typeof I=="function"?I:t,o==null?o:Ny(o,c,C1(p),I)}function Mc(o){return o==null?[]:o1(o,qr(o))}function Yq(o){return o==null?[]:o1(o,Pi(o))}function Jq(o,c,p){return p===t&&(p=c,c=t),p!==t&&(p=bn(p),p=p===p?p:0),c!==t&&(c=bn(c),c=c===c?c:0),da(bn(o),c,p)}function Qq(o,c,p){return c=Bs(c),p===t?(p=c,c=0):p=Bs(p),o=bn(o),iB(o,c,p)}function Zq(o,c,p){if(p&&typeof p!="boolean"&&di(o,c,p)&&(c=p=t),p===t&&(typeof c=="boolean"?(p=c,c=t):typeof o=="boolean"&&(p=o,o=t)),o===t&&c===t?(o=0,c=1):(o=Bs(o),c===t?(c=o,o=0):c=Bs(c)),o>c){var I=o;o=c,c=I}if(p||o%1||c%1){var T=ly();return ri(o+T*(c-o+Xt("1e-"+((T+"").length-1))),c)}return x1(o,c)}var Xq=Ec(function(o,c,p){return c=c.toLowerCase(),o+(p?z6(c):c)});function z6(o){return Y1(Vt(o).toLowerCase())}function H6(o){return o=Vt(o),o&&o.replace(vr,k$).replace(Qp,"")}function ez(o,c,p){o=Vt(o),c=ji(c);var I=o.length;p=p===t?I:da(Et(p),0,I);var T=p;return p-=c.length,p>=0&&o.slice(p,T)==c}function tz(o){return o=Vt(o),o&&et.test(o)?o.replace(Ze,j$):o}function rz(o){return o=Vt(o),o&&ut.test(o)?o.replace(Le,"\\$&"):o}var iz=Ec(function(o,c,p){return o+(p?"-":"")+c.toLowerCase()}),nz=Ec(function(o,c,p){return o+(p?" ":"")+c.toLowerCase()}),sz=Wy("toLowerCase");function oz(o,c,p){o=Vt(o),c=Et(c);var I=c?mc(o):0;if(!c||I>=c)return o;var T=(c-I)/2;return Ou(bu(T),p)+o+Ou(mu(T),p)}function az(o,c,p){o=Vt(o),c=Et(c);var I=c?mc(o):0;return c&&I<c?o+Ou(c-I,p):o}function cz(o,c,p){o=Vt(o),c=Et(c);var I=c?mc(o):0;return c&&I<c?Ou(c-I,p)+o:o}function fz(o,c,p){return p||c==null?c=0:c&&(c=+c),vL(Vt(o).replace(nt,""),c||0)}function lz(o,c,p){return(p?di(o,c,p):c===t)?c=1:c=Et(c),A1(Vt(o),c)}function hz(){var o=arguments,c=Vt(o[0]);return o.length<3?c:c.replace(o[1],o[2])}var uz=Ec(function(o,c,p){return o+(p?"_":"")+c.toLowerCase()});function dz(o,c,p){return p&&typeof p!="number"&&di(o,c,p)&&(c=p=t),p=p===t?A:p>>>0,p?(o=Vt(o),o&&(typeof c=="string"||c!=null&&!K1(c))&&(c=ji(c),!c&&vc(o))?yo(Ln(o),0,p):o.split(c,p)):[]}var pz=Ec(function(o,c,p){return o+(p?" ":"")+Y1(c)});function gz(o,c,p){return o=Vt(o),p=p==null?0:da(Et(p),0,o.length),c=ji(c),o.slice(p,p+c.length)==c}function vz(o,c,p){var I=q.templateSettings;p&&di(o,c,p)&&(c=t),o=Vt(o),c=ku({},c,I,Zy);var T=ku({},c.imports,I.imports,Zy),k=qr(T),Z=o1(T,k),te,se,ue=0,de=c.interpolate||Ai,ve="__p += '",Se=c1((c.escape||Ai).source+"|"+de.source+"|"+(de===tt?kt:Ai).source+"|"+(c.evaluate||Ai).source+"|$","g"),Je="//# sourceURL="+(Yt.call(c,"sourceURL")?(c.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Zp+"]")+`
|
|
53
|
-
`;o.replace(Se,function(ft,Rt,
|
|
52
|
+
`)}function bB(o){return wt(o)||ma(o)||!!(Qw&&o&&o[Qw])}function $s(o,c){var p=typeof o;return c=c??D,!!c&&(p=="number"||p!="symbol"&&ti.test(o))&&o>-1&&o%1==0&&o<c}function di(o,c,p){if(!hr(p))return!1;var I=typeof c;return(I=="number"?Ci(p)&&$s(c,p.length):I=="string"&&c in p)?Un(p[c],o):!1}function $1(o,c){if(wt(o))return!1;var p=typeof o;return p=="number"||p=="symbol"||p=="boolean"||o==null||Wi(o)?!0:lt.test(o)||!Re.test(o)||c!=null&&o in tr(c)}function wB(o){var c=typeof o;return c=="string"||c=="number"||c=="symbol"||c=="boolean"?o!=="__proto__":o===null}function L1(o){var c=Ru(o),p=B[c];if(typeof p!="function"||!(c in $t.prototype))return!1;if(o===p)return!0;var I=R1(p);return!!I&&o===I[0]}function yB(o){return!!Vw&&Vw in o}var _B=cu?Ls:X1;function Yf(o){var c=o&&o.constructor,p=typeof c=="function"&&c.prototype||wc;return o===p}function Vy(o){return o===o&&!hr(o)}function Gy(o,c){return function(p){return p==null?!1:p[o]===c&&(c!==t||o in tr(p))}}function xB(o){var c=Uu(o,function(I){return p.size===u&&p.clear(),I}),p=c.cache;return c}function EB(o,c){var p=o[1],I=c[1],T=p|I,F=T<(q|U|A),Y=I==A&&p==ee||I==A&&p==z&&o[7].length<=c[8]||I==(A|z)&&c[7].length<=c[8]&&p==ee;if(!(F||Y))return o;I&q&&(o[2]=c[2],T|=p&q?0:J);var X=c[3];if(X){var se=o[3];o[3]=se?Dy(se,X,c[4]):X,o[4]=se?go(o[3],g):c[4]}return X=c[5],X&&(se=o[5],o[5]=se?Oy(se,X,c[6]):X,o[6]=se?go(o[5],g):c[6]),X=c[7],X&&(o[7]=X),I&A&&(o[8]=o[8]==null?c[8]:ri(o[8],c[8])),o[9]==null&&(o[9]=c[9]),o[0]=c[0],o[1]=T,o}function AB(o){var c=[];if(o!=null)for(var p in tr(o))c.push(p);return c}function SB(o){return lu.call(o)}function Jy(o,c,p){return c=Dr(c===t?o.length-1:c,0),function(){for(var I=arguments,T=-1,F=Dr(I.length-c,0),Y=ce(F);++T<F;)Y[T]=I[c+T];T=-1;for(var X=ce(c+1);++T<c;)X[T]=I[T];return X[c]=p(Y),Fr(o,this,X)}}function Yy(o,c){return c.length<2?o:pa(o,vn(c,0,-1))}function IB(o,c){for(var p=o.length,I=ri(c.length,p),T=Mi(o);I--;){var F=c[I];o[I]=$s(F,p)?T[F]:t}return o}function B1(o,c){if(!(c==="constructor"&&typeof o[c]=="function")&&c!="__proto__")return o[c]}var Qy=Xy(yy),Qf=z$||function(o,c){return Bt.setTimeout(o,c)},U1=Xy(JL);function Zy(o,c,p){var I=c+"";return U1(o,mB(I,MB(pB(I),p)))}function Xy(o){var c=0,p=0;return function(){var I=W$(),T=m-(I-p);if(p=I,T>0){if(++c>=b)return arguments[0]}else c=0;return o.apply(t,arguments)}}function Nu(o,c){var p=-1,I=o.length,T=I-1;for(c=c===t?I:c;++p<c;){var F=y1(p,T),Y=o[F];o[F]=o[p],o[p]=Y}return o.length=c,o}var e6=xB(function(o){var c=[];return o.charCodeAt(0)===46&&c.push(""),o.replace(ht,function(p,I,T,F){c.push(T?F.replace(at,"$1"):I||p)}),c});function us(o){if(typeof o=="string"||Wi(o))return o;var c=o+"";return c=="0"&&1/o==-C?"-0":c}function va(o){if(o!=null){try{return fu.call(o)}catch{}try{return o+""}catch{}}return""}function MB(o,c){return un(oe,function(p){var I="_."+p[0];c&p[1]&&!nu(o,I)&&o.push(I)}),o.sort()}function t6(o){if(o instanceof $t)return o.clone();var c=new pn(o.__wrapped__,o.__chain__);return c.__actions__=Mi(o.__actions__),c.__index__=o.__index__,c.__values__=o.__values__,c}function CB(o,c,p){(p?di(o,c,p):c===t)?c=1:c=Dr(At(c),0);var I=o==null?0:o.length;if(!I||c<1)return[];for(var T=0,F=0,Y=ce(vu(I/c));T<I;)Y[F++]=vn(o,T,T+=c);return Y}function PB(o){for(var c=-1,p=o==null?0:o.length,I=0,T=[];++c<p;){var F=o[c];F&&(T[I++]=F)}return T}function DB(){var o=arguments.length;if(!o)return[];for(var c=ce(o-1),p=arguments[0],I=o;I--;)c[I-1]=arguments[I];return po(wt(p)?Mi(p):[p],Vr(c,1))}var OB=Mt(function(o,c){return xr(o)?Wf(o,Vr(c,1,xr,!0)):[]}),RB=Mt(function(o,c){var p=mn(c);return xr(p)&&(p=t),xr(o)?Wf(o,Vr(c,1,xr,!0),ot(p,2)):[]}),TB=Mt(function(o,c){var p=mn(c);return xr(p)&&(p=t),xr(o)?Wf(o,Vr(c,1,xr,!0),t,p):[]});function NB(o,c,p){var I=o==null?0:o.length;return I?(c=p||c===t?1:At(c),vn(o,c<0?0:c,I)):[]}function $B(o,c,p){var I=o==null?0:o.length;return I?(c=p||c===t?1:At(c),c=I-c,vn(o,0,c<0?0:c)):[]}function LB(o,c){return o&&o.length?Iu(o,ot(c,3),!0,!0):[]}function BB(o,c){return o&&o.length?Iu(o,ot(c,3),!0):[]}function UB(o,c,p,I){var T=o==null?0:o.length;return T?(p&&typeof p!="number"&&di(o,c,p)&&(p=0,I=T),DL(o,c,p,I)):[]}function r6(o,c,p){var I=o==null?0:o.length;if(!I)return-1;var T=p==null?0:At(p);return T<0&&(T=Dr(I+T,0)),su(o,ot(c,3),T)}function i6(o,c,p){var I=o==null?0:o.length;if(!I)return-1;var T=I-1;return p!==t&&(T=At(p),T=p<0?Dr(I+T,0):ri(T,I-1)),su(o,ot(c,3),T,!0)}function n6(o){var c=o==null?0:o.length;return c?Vr(o,1):[]}function FB(o){var c=o==null?0:o.length;return c?Vr(o,C):[]}function qB(o,c){var p=o==null?0:o.length;return p?(c=c===t?1:At(c),Vr(o,c)):[]}function zB(o){for(var c=-1,p=o==null?0:o.length,I={};++c<p;){var T=o[c];I[T[0]]=T[1]}return I}function s6(o){return o&&o.length?o[0]:t}function kB(o,c,p){var I=o==null?0:o.length;if(!I)return-1;var T=p==null?0:At(p);return T<0&&(T=Dr(I+T,0)),gc(o,c,T)}function HB(o){var c=o==null?0:o.length;return c?vn(o,0,-1):[]}var jB=Mt(function(o){var c=cr(o,S1);return c.length&&c[0]===o[0]?g1(c):[]}),WB=Mt(function(o){var c=mn(o),p=cr(o,S1);return c===mn(p)?c=t:p.pop(),p.length&&p[0]===o[0]?g1(p,ot(c,2)):[]}),KB=Mt(function(o){var c=mn(o),p=cr(o,S1);return c=typeof c=="function"?c:t,c&&p.pop(),p.length&&p[0]===o[0]?g1(p,t,c):[]});function VB(o,c){return o==null?"":H$.call(o,c)}function mn(o){var c=o==null?0:o.length;return c?o[c-1]:t}function GB(o,c,p){var I=o==null?0:o.length;if(!I)return-1;var T=I;return p!==t&&(T=At(p),T=T<0?Dr(I+T,0):ri(T,I-1)),c===c?M$(o,c,T):su(o,Fw,T,!0)}function JB(o,c){return o&&o.length?vy(o,At(c)):t}var YB=Mt(o6);function o6(o,c){return o&&o.length&&c&&c.length?w1(o,c):o}function QB(o,c,p){return o&&o.length&&c&&c.length?w1(o,c,ot(p,2)):o}function ZB(o,c,p){return o&&o.length&&c&&c.length?w1(o,c,t,p):o}var XB=Ns(function(o,c){var p=o==null?0:o.length,I=h1(o,c);return wy(o,cr(c,function(T){return $s(T,p)?+T:T}).sort(Py)),I});function eU(o,c){var p=[];if(!(o&&o.length))return p;var I=-1,T=[],F=o.length;for(c=ot(c,3);++I<F;){var Y=o[I];c(Y,I,o)&&(p.push(Y),T.push(I))}return wy(o,T),p}function F1(o){return o==null?o:V$.call(o)}function tU(o,c,p){var I=o==null?0:o.length;return I?(p&&typeof p!="number"&&di(o,c,p)?(c=0,p=I):(c=c==null?0:At(c),p=p===t?I:At(p)),vn(o,c,p)):[]}function rU(o,c){return Su(o,c)}function iU(o,c,p){return x1(o,c,ot(p,2))}function nU(o,c){var p=o==null?0:o.length;if(p){var I=Su(o,c);if(I<p&&Un(o[I],c))return I}return-1}function sU(o,c){return Su(o,c,!0)}function oU(o,c,p){return x1(o,c,ot(p,2),!0)}function aU(o,c){var p=o==null?0:o.length;if(p){var I=Su(o,c,!0)-1;if(Un(o[I],c))return I}return-1}function cU(o){return o&&o.length?_y(o):[]}function fU(o,c){return o&&o.length?_y(o,ot(c,2)):[]}function lU(o){var c=o==null?0:o.length;return c?vn(o,1,c):[]}function hU(o,c,p){return o&&o.length?(c=p||c===t?1:At(c),vn(o,0,c<0?0:c)):[]}function uU(o,c,p){var I=o==null?0:o.length;return I?(c=p||c===t?1:At(c),c=I-c,vn(o,c<0?0:c,I)):[]}function dU(o,c){return o&&o.length?Iu(o,ot(c,3),!1,!0):[]}function pU(o,c){return o&&o.length?Iu(o,ot(c,3)):[]}var gU=Mt(function(o){return bo(Vr(o,1,xr,!0))}),vU=Mt(function(o){var c=mn(o);return xr(c)&&(c=t),bo(Vr(o,1,xr,!0),ot(c,2))}),mU=Mt(function(o){var c=mn(o);return c=typeof c=="function"?c:t,bo(Vr(o,1,xr,!0),t,c)});function bU(o){return o&&o.length?bo(o):[]}function wU(o,c){return o&&o.length?bo(o,ot(c,2)):[]}function yU(o,c){return c=typeof c=="function"?c:t,o&&o.length?bo(o,t,c):[]}function q1(o){if(!(o&&o.length))return[];var c=0;return o=uo(o,function(p){if(xr(p))return c=Dr(p.length,c),!0}),i1(c,function(p){return cr(o,e1(p))})}function a6(o,c){if(!(o&&o.length))return[];var p=q1(o);return c==null?p:cr(p,function(I){return Fr(c,t,I)})}var _U=Mt(function(o,c){return xr(o)?Wf(o,c):[]}),xU=Mt(function(o){return A1(uo(o,xr))}),EU=Mt(function(o){var c=mn(o);return xr(c)&&(c=t),A1(uo(o,xr),ot(c,2))}),AU=Mt(function(o){var c=mn(o);return c=typeof c=="function"?c:t,A1(uo(o,xr),t,c)}),SU=Mt(q1);function IU(o,c){return Sy(o||[],c||[],jf)}function MU(o,c){return Sy(o||[],c||[],Gf)}var CU=Mt(function(o){var c=o.length,p=c>1?o[c-1]:t;return p=typeof p=="function"?(o.pop(),p):t,a6(o,p)});function c6(o){var c=B(o);return c.__chain__=!0,c}function PU(o,c){return c(o),o}function $u(o,c){return c(o)}var DU=Ns(function(o){var c=o.length,p=c?o[0]:0,I=this.__wrapped__,T=function(F){return h1(F,o)};return c>1||this.__actions__.length||!(I instanceof $t)||!$s(p)?this.thru(T):(I=I.slice(p,+p+(c?1:0)),I.__actions__.push({func:$u,args:[T],thisArg:t}),new pn(I,this.__chain__).thru(function(F){return c&&!F.length&&F.push(t),F}))});function OU(){return c6(this)}function RU(){return new pn(this.value(),this.__chain__)}function TU(){this.__values__===t&&(this.__values__=x6(this.value()));var o=this.__index__>=this.__values__.length,c=o?t:this.__values__[this.__index__++];return{done:o,value:c}}function NU(){return this}function $U(o){for(var c,p=this;p instanceof yu;){var I=t6(p);I.__index__=0,I.__values__=t,c?T.__wrapped__=I:c=I;var T=I;p=p.__wrapped__}return T.__wrapped__=o,c}function LU(){var o=this.__wrapped__;if(o instanceof $t){var c=o;return this.__actions__.length&&(c=new $t(this)),c=c.reverse(),c.__actions__.push({func:$u,args:[F1],thisArg:t}),new pn(c,this.__chain__)}return this.thru(F1)}function BU(){return Ay(this.__wrapped__,this.__actions__)}var UU=Mu(function(o,c,p){Jt.call(o,p)?++o[p]:Rs(o,p,1)});function FU(o,c,p){var I=wt(o)?Bw:PL;return p&&di(o,c,p)&&(c=t),I(o,ot(c,3))}function qU(o,c){var p=wt(o)?uo:ay;return p(o,ot(c,3))}var zU=$y(r6),kU=$y(i6);function HU(o,c){return Vr(Lu(o,c),1)}function jU(o,c){return Vr(Lu(o,c),C)}function WU(o,c,p){return p=p===t?1:At(p),Vr(Lu(o,c),p)}function f6(o,c){var p=wt(o)?un:mo;return p(o,ot(c,3))}function l6(o,c){var p=wt(o)?l$:oy;return p(o,ot(c,3))}var KU=Mu(function(o,c,p){Jt.call(o,p)?o[p].push(c):Rs(o,p,[c])});function VU(o,c,p,I){o=Ci(o)?o:Mc(o),p=p&&!I?At(p):0;var T=o.length;return p<0&&(p=Dr(T+p,0)),zu(o)?p<=T&&o.indexOf(c,p)>-1:!!T&&gc(o,c,p)>-1}var GU=Mt(function(o,c,p){var I=-1,T=typeof c=="function",F=Ci(o)?ce(o.length):[];return mo(o,function(Y){F[++I]=T?Fr(c,Y,p):Kf(Y,c,p)}),F}),JU=Mu(function(o,c,p){Rs(o,p,c)});function Lu(o,c){var p=wt(o)?cr:dy;return p(o,ot(c,3))}function YU(o,c,p,I){return o==null?[]:(wt(c)||(c=c==null?[]:[c]),p=I?t:p,wt(p)||(p=p==null?[]:[p]),my(o,c,p))}var QU=Mu(function(o,c,p){o[p?0:1].push(c)},function(){return[[],[]]});function ZU(o,c,p){var I=wt(o)?Zp:zw,T=arguments.length<3;return I(o,ot(c,4),p,T,mo)}function XU(o,c,p){var I=wt(o)?h$:zw,T=arguments.length<3;return I(o,ot(c,4),p,T,oy)}function eF(o,c){var p=wt(o)?uo:ay;return p(o,Fu(ot(c,3)))}function tF(o){var c=wt(o)?ry:VL;return c(o)}function rF(o,c,p){(p?di(o,c,p):c===t)?c=1:c=At(c);var I=wt(o)?AL:GL;return I(o,c)}function iF(o){var c=wt(o)?SL:YL;return c(o)}function nF(o){if(o==null)return 0;if(Ci(o))return zu(o)?mc(o):o.length;var c=ii(o);return c==he||c==be?o.size:m1(o).length}function sF(o,c,p){var I=wt(o)?Xp:QL;return p&&di(o,c,p)&&(c=t),I(o,ot(c,3))}var oF=Mt(function(o,c){if(o==null)return[];var p=c.length;return p>1&&di(o,c[0],c[1])?c=[]:p>2&&di(c[0],c[1],c[2])&&(c=[c[0]]),my(o,Vr(c,1),[])}),Bu=q$||function(){return Bt.Date.now()};function aF(o,c){if(typeof c!="function")throw new dn(a);return o=At(o),function(){if(--o<1)return c.apply(this,arguments)}}function h6(o,c,p){return c=p?t:c,c=o&&c==null?o.length:c,Ts(o,A,t,t,t,t,c)}function u6(o,c){var p;if(typeof c!="function")throw new dn(a);return o=At(o),function(){return--o>0&&(p=c.apply(this,arguments)),o<=1&&(c=t),p}}var z1=Mt(function(o,c,p){var I=q;if(p.length){var T=go(p,Sc(z1));I|=G}return Ts(o,I,c,p,T)}),d6=Mt(function(o,c,p){var I=q|U;if(p.length){var T=go(p,Sc(d6));I|=G}return Ts(c,I,o,p,T)});function p6(o,c,p){c=p?t:c;var I=Ts(o,ee,t,t,t,t,t,c);return I.placeholder=p6.placeholder,I}function g6(o,c,p){c=p?t:c;var I=Ts(o,W,t,t,t,t,t,c);return I.placeholder=g6.placeholder,I}function v6(o,c,p){var I,T,F,Y,X,se,ue=0,de=!1,ve=!1,Se=!0;if(typeof o!="function")throw new dn(a);c=bn(c)||0,hr(p)&&(de=!!p.leading,ve="maxWait"in p,F=ve?Dr(bn(p.maxWait)||0,c):F,Se="trailing"in p?!!p.trailing:Se);function Ye(Er){var Fn=I,Us=T;return I=T=t,ue=Er,Y=o.apply(Us,Fn),Y}function ct(Er){return ue=Er,X=Qf(Rt,c),de?Ye(Er):Y}function St(Er){var Fn=Er-se,Us=Er-ue,$6=c-Fn;return ve?ri($6,F-Us):$6}function ft(Er){var Fn=Er-se,Us=Er-ue;return se===t||Fn>=c||Fn<0||ve&&Us>=F}function Rt(){var Er=Bu();if(ft(Er))return Ut(Er);X=Qf(Rt,St(Er))}function Ut(Er){return X=t,Se&&I?Ye(Er):(I=T=t,Y)}function Ki(){X!==t&&Iy(X),ue=0,I=se=T=X=t}function pi(){return X===t?Y:Ut(Bu())}function Vi(){var Er=Bu(),Fn=ft(Er);if(I=arguments,T=this,se=Er,Fn){if(X===t)return ct(se);if(ve)return Iy(X),X=Qf(Rt,c),Ye(se)}return X===t&&(X=Qf(Rt,c)),Y}return Vi.cancel=Ki,Vi.flush=pi,Vi}var cF=Mt(function(o,c){return sy(o,1,c)}),fF=Mt(function(o,c,p){return sy(o,bn(c)||0,p)});function lF(o){return Ts(o,te)}function Uu(o,c){if(typeof o!="function"||c!=null&&typeof c!="function")throw new dn(a);var p=function(){var I=arguments,T=c?c.apply(this,I):I[0],F=p.cache;if(F.has(T))return F.get(T);var Y=o.apply(this,I);return p.cache=F.set(T,Y)||F,Y};return p.cache=new(Uu.Cache||Os),p}Uu.Cache=Os;function Fu(o){if(typeof o!="function")throw new dn(a);return function(){var c=arguments;switch(c.length){case 0:return!o.call(this);case 1:return!o.call(this,c[0]);case 2:return!o.call(this,c[0],c[1]);case 3:return!o.call(this,c[0],c[1],c[2])}return!o.apply(this,c)}}function hF(o){return u6(2,o)}var uF=ZL(function(o,c){c=c.length==1&&wt(c[0])?cr(c[0],Hi(ot())):cr(Vr(c,1),Hi(ot()));var p=c.length;return Mt(function(I){for(var T=-1,F=ri(I.length,p);++T<F;)I[T]=c[T].call(this,I[T]);return Fr(o,this,I)})}),k1=Mt(function(o,c){var p=go(c,Sc(k1));return Ts(o,G,t,c,p)}),m6=Mt(function(o,c){var p=go(c,Sc(m6));return Ts(o,Q,t,c,p)}),dF=Ns(function(o,c){return Ts(o,z,t,t,t,c)});function pF(o,c){if(typeof o!="function")throw new dn(a);return c=c===t?c:At(c),Mt(o,c)}function gF(o,c){if(typeof o!="function")throw new dn(a);return c=c==null?0:Dr(At(c),0),Mt(function(p){var I=p[c],T=yo(p,0,c);return I&&po(T,I),Fr(o,this,T)})}function vF(o,c,p){var I=!0,T=!0;if(typeof o!="function")throw new dn(a);return hr(p)&&(I="leading"in p?!!p.leading:I,T="trailing"in p?!!p.trailing:T),v6(o,c,{leading:I,maxWait:c,trailing:T})}function mF(o){return h6(o,1)}function bF(o,c){return k1(I1(c),o)}function wF(){if(!arguments.length)return[];var o=arguments[0];return wt(o)?o:[o]}function yF(o){return gn(o,P)}function _F(o,c){return c=typeof c=="function"?c:t,gn(o,P,c)}function xF(o){return gn(o,w|P)}function EF(o,c){return c=typeof c=="function"?c:t,gn(o,w|P,c)}function AF(o,c){return c==null||ny(o,c,qr(c))}function Un(o,c){return o===c||o!==o&&c!==c}var SF=Ou(p1),IF=Ou(function(o,c){return o>=c}),ma=ly(function(){return arguments}())?ly:function(o){return mr(o)&&Jt.call(o,"callee")&&!Yw.call(o,"callee")},wt=ce.isArray,MF=hi?Hi(hi):$L;function Ci(o){return o!=null&&qu(o.length)&&!Ls(o)}function xr(o){return mr(o)&&Ci(o)}function CF(o){return o===!0||o===!1||mr(o)&&ui(o)==K}var _o=k$||X1,PF=$n?Hi($n):LL;function DF(o){return mr(o)&&o.nodeType===1&&!Zf(o)}function OF(o){if(o==null)return!0;if(Ci(o)&&(wt(o)||typeof o=="string"||typeof o.splice=="function"||_o(o)||Ic(o)||ma(o)))return!o.length;var c=ii(o);if(c==he||c==be)return!o.size;if(Yf(o))return!m1(o).length;for(var p in o)if(Jt.call(o,p))return!1;return!0}function RF(o,c){return Vf(o,c)}function TF(o,c,p){p=typeof p=="function"?p:t;var I=p?p(o,c):t;return I===t?Vf(o,c,t,p):!!I}function H1(o){if(!mr(o))return!1;var c=ui(o);return c==j||c==E||typeof o.message=="string"&&typeof o.name=="string"&&!Zf(o)}function NF(o){return typeof o=="number"&&Zw(o)}function Ls(o){if(!hr(o))return!1;var c=ui(o);return c==re||c==le||c==H||c==Xe}function b6(o){return typeof o=="number"&&o==At(o)}function qu(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=D}function hr(o){var c=typeof o;return o!=null&&(c=="object"||c=="function")}function mr(o){return o!=null&&typeof o=="object"}var w6=hn?Hi(hn):UL;function $F(o,c){return o===c||v1(o,c,T1(c))}function LF(o,c,p){return p=typeof p=="function"?p:t,v1(o,c,T1(c),p)}function BF(o){return y6(o)&&o!=+o}function UF(o){if(_B(o))throw new gt(s);return hy(o)}function FF(o){return o===null}function qF(o){return o==null}function y6(o){return typeof o=="number"||mr(o)&&ui(o)==ge}function Zf(o){if(!mr(o)||ui(o)!=Te)return!1;var c=du(o);if(c===null)return!0;var p=Jt.call(c,"constructor")&&c.constructor;return typeof p=="function"&&p instanceof p&&fu.call(p)==L$}var j1=fs?Hi(fs):FL;function zF(o){return b6(o)&&o>=-D&&o<=D}var _6=Bf?Hi(Bf):qL;function zu(o){return typeof o=="string"||!wt(o)&&mr(o)&&ui(o)==Pe}function Wi(o){return typeof o=="symbol"||mr(o)&&ui(o)==De}var Ic=fa?Hi(fa):zL;function kF(o){return o===t}function HF(o){return mr(o)&&ii(o)==Ie}function jF(o){return mr(o)&&ui(o)==Oe}var WF=Ou(b1),KF=Ou(function(o,c){return o<=c});function x6(o){if(!o)return[];if(Ci(o))return zu(o)?Ln(o):Mi(o);if(Ff&&o[Ff])return A$(o[Ff]());var c=ii(o),p=c==he?s1:c==be?ou:Mc;return p(o)}function Bs(o){if(!o)return o===0?o:0;if(o=bn(o),o===C||o===-C){var c=o<0?-1:1;return c*S}return o===o?o:0}function At(o){var c=Bs(o),p=c%1;return c===c?p?c-p:c:0}function E6(o){return o?da(At(o),0,x):0}function bn(o){if(typeof o=="number")return o;if(Wi(o))return v;if(hr(o)){var c=typeof o.valueOf=="function"?o.valueOf():o;o=hr(c)?c+"":c}if(typeof o!="string")return o===0?o:+o;o=kw(o);var p=Zr.test(o);return p||ei.test(o)?bt(o.slice(2),p?2:8):qt.test(o)?v:+o}function A6(o){return hs(o,Pi(o))}function VF(o){return o?da(At(o),-D,D):o===0?o:0}function Vt(o){return o==null?"":ji(o)}var GF=Ec(function(o,c){if(Yf(c)||Ci(c)){hs(c,qr(c),o);return}for(var p in c)Jt.call(c,p)&&jf(o,p,c[p])}),S6=Ec(function(o,c){hs(c,Pi(c),o)}),ku=Ec(function(o,c,p,I){hs(c,Pi(c),o,I)}),JF=Ec(function(o,c,p,I){hs(c,qr(c),o,I)}),YF=Ns(h1);function QF(o,c){var p=xc(o);return c==null?p:iy(p,c)}var ZF=Mt(function(o,c){o=tr(o);var p=-1,I=c.length,T=I>2?c[2]:t;for(T&&di(c[0],c[1],T)&&(I=1);++p<I;)for(var F=c[p],Y=Pi(F),X=-1,se=Y.length;++X<se;){var ue=Y[X],de=o[ue];(de===t||Un(de,wc[ue])&&!Jt.call(o,ue))&&(o[ue]=F[ue])}return o}),XF=Mt(function(o){return o.push(t,ky),Fr(I6,t,o)});function eq(o,c){return Uw(o,ot(c,3),ls)}function tq(o,c){return Uw(o,ot(c,3),d1)}function rq(o,c){return o==null?o:u1(o,ot(c,3),Pi)}function iq(o,c){return o==null?o:cy(o,ot(c,3),Pi)}function nq(o,c){return o&&ls(o,ot(c,3))}function sq(o,c){return o&&d1(o,ot(c,3))}function oq(o){return o==null?[]:Eu(o,qr(o))}function aq(o){return o==null?[]:Eu(o,Pi(o))}function W1(o,c,p){var I=o==null?t:pa(o,c);return I===t?p:I}function cq(o,c){return o!=null&&Wy(o,c,OL)}function K1(o,c){return o!=null&&Wy(o,c,RL)}var fq=By(function(o,c,p){c!=null&&typeof c.toString!="function"&&(c=lu.call(c)),o[c]=p},G1(Di)),lq=By(function(o,c,p){c!=null&&typeof c.toString!="function"&&(c=lu.call(c)),Jt.call(o,c)?o[c].push(p):o[c]=[p]},ot),hq=Mt(Kf);function qr(o){return Ci(o)?ty(o):m1(o)}function Pi(o){return Ci(o)?ty(o,!0):kL(o)}function uq(o,c){var p={};return c=ot(c,3),ls(o,function(I,T,F){Rs(p,c(I,T,F),I)}),p}function dq(o,c){var p={};return c=ot(c,3),ls(o,function(I,T,F){Rs(p,T,c(I,T,F))}),p}var pq=Ec(function(o,c,p){Au(o,c,p)}),I6=Ec(function(o,c,p,I){Au(o,c,p,I)}),gq=Ns(function(o,c){var p={};if(o==null)return p;var I=!1;c=cr(c,function(F){return F=wo(F,o),I||(I=F.length>1),F}),hs(o,O1(o),p),I&&(p=gn(p,w|M|P,fB));for(var T=c.length;T--;)E1(p,c[T]);return p});function vq(o,c){return M6(o,Fu(ot(c)))}var mq=Ns(function(o,c){return o==null?{}:jL(o,c)});function M6(o,c){if(o==null)return{};var p=cr(O1(o),function(I){return[I]});return c=ot(c),by(o,p,function(I,T){return c(I,T[0])})}function bq(o,c,p){c=wo(c,o);var I=-1,T=c.length;for(T||(T=1,o=t);++I<T;){var F=o==null?t:o[us(c[I])];F===t&&(I=T,F=p),o=Ls(F)?F.call(o):F}return o}function wq(o,c,p){return o==null?o:Gf(o,c,p)}function yq(o,c,p,I){return I=typeof I=="function"?I:t,o==null?o:Gf(o,c,p,I)}var C6=qy(qr),P6=qy(Pi);function _q(o,c,p){var I=wt(o),T=I||_o(o)||Ic(o);if(c=ot(c,4),p==null){var F=o&&o.constructor;T?p=I?new F:[]:hr(o)?p=Ls(F)?xc(du(o)):{}:p={}}return(T?un:ls)(o,function(Y,X,se){return c(p,Y,X,se)}),p}function xq(o,c){return o==null?!0:E1(o,c)}function Eq(o,c,p){return o==null?o:Ey(o,c,I1(p))}function Aq(o,c,p,I){return I=typeof I=="function"?I:t,o==null?o:Ey(o,c,I1(p),I)}function Mc(o){return o==null?[]:n1(o,qr(o))}function Sq(o){return o==null?[]:n1(o,Pi(o))}function Iq(o,c,p){return p===t&&(p=c,c=t),p!==t&&(p=bn(p),p=p===p?p:0),c!==t&&(c=bn(c),c=c===c?c:0),da(bn(o),c,p)}function Mq(o,c,p){return c=Bs(c),p===t?(p=c,c=0):p=Bs(p),o=bn(o),TL(o,c,p)}function Cq(o,c,p){if(p&&typeof p!="boolean"&&di(o,c,p)&&(c=p=t),p===t&&(typeof c=="boolean"?(p=c,c=t):typeof o=="boolean"&&(p=o,o=t)),o===t&&c===t?(o=0,c=1):(o=Bs(o),c===t?(c=o,o=0):c=Bs(c)),o>c){var I=o;o=c,c=I}if(p||o%1||c%1){var T=Xw();return ri(o+T*(c-o+Xt("1e-"+((T+"").length-1))),c)}return y1(o,c)}var Pq=Ac(function(o,c,p){return c=c.toLowerCase(),o+(p?D6(c):c)});function D6(o){return V1(Vt(o).toLowerCase())}function O6(o){return o=Vt(o),o&&o.replace(vr,w$).replace(Jp,"")}function Dq(o,c,p){o=Vt(o),c=ji(c);var I=o.length;p=p===t?I:da(At(p),0,I);var T=p;return p-=c.length,p>=0&&o.slice(p,T)==c}function Oq(o){return o=Vt(o),o&&et.test(o)?o.replace(Ze,y$):o}function Rq(o){return o=Vt(o),o&&ut.test(o)?o.replace(Le,"\\$&"):o}var Tq=Ac(function(o,c,p){return o+(p?"-":"")+c.toLowerCase()}),Nq=Ac(function(o,c,p){return o+(p?" ":"")+c.toLowerCase()}),$q=Ny("toLowerCase");function Lq(o,c,p){o=Vt(o),c=At(c);var I=c?mc(o):0;if(!c||I>=c)return o;var T=(c-I)/2;return Du(mu(T),p)+o+Du(vu(T),p)}function Bq(o,c,p){o=Vt(o),c=At(c);var I=c?mc(o):0;return c&&I<c?o+Du(c-I,p):o}function Uq(o,c,p){o=Vt(o),c=At(c);var I=c?mc(o):0;return c&&I<c?Du(c-I,p)+o:o}function Fq(o,c,p){return p||c==null?c=0:c&&(c=+c),K$(Vt(o).replace(nt,""),c||0)}function qq(o,c,p){return(p?di(o,c,p):c===t)?c=1:c=At(c),_1(Vt(o),c)}function zq(){var o=arguments,c=Vt(o[0]);return o.length<3?c:c.replace(o[1],o[2])}var kq=Ac(function(o,c,p){return o+(p?"_":"")+c.toLowerCase()});function Hq(o,c,p){return p&&typeof p!="number"&&di(o,c,p)&&(c=p=t),p=p===t?x:p>>>0,p?(o=Vt(o),o&&(typeof c=="string"||c!=null&&!j1(c))&&(c=ji(c),!c&&vc(o))?yo(Ln(o),0,p):o.split(c,p)):[]}var jq=Ac(function(o,c,p){return o+(p?" ":"")+V1(c)});function Wq(o,c,p){return o=Vt(o),p=p==null?0:da(At(p),0,o.length),c=ji(c),o.slice(p,p+c.length)==c}function Kq(o,c,p){var I=B.templateSettings;p&&di(o,c,p)&&(c=t),o=Vt(o),c=ku({},c,I,zy);var T=ku({},c.imports,I.imports,zy),F=qr(T),Y=n1(T,F),X,se,ue=0,de=c.interpolate||Ei,ve="__p += '",Se=o1((c.escape||Ei).source+"|"+de.source+"|"+(de===tt?Ht:Ei).source+"|"+(c.evaluate||Ei).source+"|$","g"),Ye="//# sourceURL="+(Jt.call(c,"sourceURL")?(c.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Yp+"]")+`
|
|
53
|
+
`;o.replace(Se,function(ft,Rt,Ut,Ki,pi,Vi){return Ut||(Ut=Ki),ve+=o.slice(ue,Vi).replace(Pn,_$),Rt&&(X=!0,ve+=`' +
|
|
54
54
|
__e(`+Rt+`) +
|
|
55
55
|
'`),pi&&(se=!0,ve+=`';
|
|
56
56
|
`+pi+`;
|
|
57
|
-
__p += '`),
|
|
58
|
-
((__t = (`+
|
|
57
|
+
__p += '`),Ut&&(ve+=`' +
|
|
58
|
+
((__t = (`+Ut+`)) == null ? '' : __t) +
|
|
59
59
|
'`),ue=Vi+ft.length,ft}),ve+=`';
|
|
60
|
-
`;var ct=
|
|
60
|
+
`;var ct=Jt.call(c,"variable")&&c.variable;if(!ct)ve=`with (obj) {
|
|
61
61
|
`+ve+`
|
|
62
62
|
}
|
|
63
|
-
`;else if(
|
|
63
|
+
`;else if(kt.test(ct))throw new gt(f);ve=(se?ve.replace(It,""):ve).replace(Je,"$1").replace(Pt,"$1;"),ve="function("+(ct||"obj")+`) {
|
|
64
64
|
`+(ct?"":`obj || (obj = {});
|
|
65
|
-
`)+"var __t, __p = ''"+(
|
|
65
|
+
`)+"var __t, __p = ''"+(X?", __e = _.escape":"")+(se?`, __j = Array.prototype.join;
|
|
66
66
|
function print() { __p += __j.call(arguments, '') }
|
|
67
67
|
`:`;
|
|
68
68
|
`)+ve+`return __p
|
|
69
|
-
}`;var St=j6(function(){return Wt(k,Je+"return "+ve).apply(t,Z)});if(St.source=ve,W1(St))throw St;return St}function mz(o){return Vt(o).toLowerCase()}function bz(o){return Vt(o).toUpperCase()}function wz(o,c,p){if(o=Vt(o),o&&(p||c===t))return Xw(o);if(!o||!(c=ji(c)))return o;var I=Ln(o),T=Ln(c),k=ey(I,T),Z=ty(I,T)+1;return yo(I,k,Z).join("")}function yz(o,c,p){if(o=Vt(o),o&&(p||c===t))return o.slice(0,iy(o)+1);if(!o||!(c=ji(c)))return o;var I=Ln(o),T=ty(I,Ln(c))+1;return yo(I,0,T).join("")}function _z(o,c,p){if(o=Vt(o),o&&(p||c===t))return o.replace(nt,"");if(!o||!(c=ji(c)))return o;var I=Ln(o),T=ey(I,Ln(c));return yo(I,T).join("")}function xz(o,c){var p=oe,I=L;if(hr(c)){var T="separator"in c?c.separator:T;p="length"in c?Et(c.length):p,I="omission"in c?ji(c.omission):I}o=Vt(o);var k=o.length;if(vc(o)){var Z=Ln(o);k=Z.length}if(p>=k)return o;var te=p-mc(I);if(te<1)return I;var se=Z?yo(Z,0,te).join(""):o.slice(0,te);if(T===t)return se+I;if(Z&&(te+=se.length-te),K1(T)){if(o.slice(te).search(T)){var ue,de=se;for(T.global||(T=c1(T.source,Vt(_t.exec(T))+"g")),T.lastIndex=0;ue=T.exec(de);)var ve=ue.index;se=se.slice(0,ve===t?te:ve)}}else if(o.indexOf(ji(T),te)!=te){var Se=se.lastIndexOf(T);Se>-1&&(se=se.slice(0,Se))}return se+I}function Az(o){return o=Vt(o),o&&rt.test(o)?o.replace(Ot,Z$):o}var Ez=Ec(function(o,c,p){return o+(p?" ":"")+c.toUpperCase()}),Y1=Wy("toUpperCase");function k6(o,c,p){return o=Vt(o),c=p?t:c,c===t?V$(o)?tL(o):F$(o):o.match(c)||[]}var j6=Mt(function(o,c){try{return Ur(o,t,c)}catch(p){return W1(p)?p:new gt(p)}}),Sz=Ns(function(o,c){return un(c,function(p){p=us(p),Rs(o,p,k1(o[p],o))}),o});function Iz(o){var c=o==null?0:o.length,p=ot();return o=c?cr(o,function(I){if(typeof I[1]!="function")throw new dn(a);return[p(I[0]),I[1]]}):[],Mt(function(I){for(var T=-1;++T<c;){var k=o[T];if(Ur(k[0],this,I))return Ur(k[1],this,I)}})}function Mz(o){return ZL(gn(o,w))}function J1(o){return function(){return o}}function Cz(o,c){return o==null||o!==o?c:o}var Pz=Vy(),Dz=Vy(!0);function Di(o){return o}function Q1(o){return Ay(typeof o=="function"?o:gn(o,w))}function Oz(o){return Sy(gn(o,w))}function Rz(o,c){return Iy(o,gn(c,w))}var Tz=Mt(function(o,c){return function(p){return Vf(p,o,c)}}),Nz=Mt(function(o,c){return function(p){return Vf(o,p,c)}});function Z1(o,c,p){var I=qr(c),T=Eu(c,I);p==null&&!(hr(c)&&(T.length||!I.length))&&(p=c,c=o,o=this,T=Eu(c,qr(c)));var k=!(hr(p)&&"chain"in p)||!!p.chain,Z=Ls(o);return un(T,function(te){var se=c[te];o[te]=se,Z&&(o.prototype[te]=function(){var ue=this.__chain__;if(k||ue){var de=o(this.__wrapped__),ve=de.__actions__=Mi(this.__actions__);return ve.push({func:se,args:arguments,thisArg:o}),de.__chain__=ue,de}return se.apply(o,po([this.value()],arguments))})}),o}function $z(){return Bt._===this&&(Bt._=aL),this}function X1(){}function Lz(o){return o=Et(o),Mt(function(c){return My(c,o)})}var Bz=D1(cr),Fz=D1(Gw),Uz=D1(t1);function W6(o){return B1(o)?r1(us(o)):gB(o)}function qz(o){return function(c){return o==null?t:pa(o,c)}}var zz=Yy(),Hz=Yy(!0);function eg(){return[]}function tg(){return!1}function kz(){return{}}function jz(){return""}function Wz(){return!0}function Kz(o,c){if(o=Et(o),o<1||o>D)return[];var p=A,I=ri(o,A);c=ot(c),o-=A;for(var T=s1(I,c);++p<o;)c(p);return T}function Vz(o){return wt(o)?cr(o,us):Wi(o)?[o]:Mi(h6(Vt(o)))}function Gz(o){var c=++sL;return Vt(o)+c}var Yz=Du(function(o,c){return o+c},0),Jz=O1("ceil"),Qz=Du(function(o,c){return o/c},1),Zz=O1("floor");function Xz(o){return o&&o.length?Au(o,Di,v1):t}function eH(o,c){return o&&o.length?Au(o,ot(c,2),v1):t}function tH(o){return Qw(o,Di)}function rH(o,c){return Qw(o,ot(c,2))}function iH(o){return o&&o.length?Au(o,Di,y1):t}function nH(o,c){return o&&o.length?Au(o,ot(c,2),y1):t}var sH=Du(function(o,c){return o*c},1),oH=O1("round"),aH=Du(function(o,c){return o-c},0);function cH(o){return o&&o.length?n1(o,Di):0}function fH(o,c){return o&&o.length?n1(o,ot(c,2)):0}return q.after=OU,q.ary=x6,q.assign=bq,q.assignIn=L6,q.assignInWith=ku,q.assignWith=wq,q.at=yq,q.before=A6,q.bind=k1,q.bindAll=Sz,q.bindKey=E6,q.castArray=kU,q.chain=w6,q.chunk=ZB,q.compact=XB,q.concat=eF,q.cond=Iz,q.conforms=Mz,q.constant=J1,q.countBy=cU,q.create=_q,q.curry=S6,q.curryRight=I6,q.debounce=M6,q.defaults=xq,q.defaultsDeep=Aq,q.defer=RU,q.delay=TU,q.difference=tF,q.differenceBy=rF,q.differenceWith=iF,q.drop=nF,q.dropRight=sF,q.dropRightWhile=oF,q.dropWhile=aF,q.fill=cF,q.filter=lU,q.flatMap=dU,q.flatMapDeep=pU,q.flatMapDepth=gU,q.flatten=g6,q.flattenDeep=fF,q.flattenDepth=lF,q.flip=NU,q.flow=Pz,q.flowRight=Dz,q.fromPairs=hF,q.functions=Dq,q.functionsIn=Oq,q.groupBy=vU,q.initial=dF,q.intersection=pF,q.intersectionBy=gF,q.intersectionWith=vF,q.invert=Tq,q.invertBy=Nq,q.invokeMap=bU,q.iteratee=Q1,q.keyBy=wU,q.keys=qr,q.keysIn=Pi,q.map=Bu,q.mapKeys=Lq,q.mapValues=Bq,q.matches=Oz,q.matchesProperty=Rz,q.memoize=Uu,q.merge=Fq,q.mergeWith=B6,q.method=Tz,q.methodOf=Nz,q.mixin=Z1,q.negate=qu,q.nthArg=Lz,q.omit=Uq,q.omitBy=qq,q.once=$U,q.orderBy=yU,q.over=Bz,q.overArgs=LU,q.overEvery=Fz,q.overSome=Uz,q.partial=j1,q.partialRight=C6,q.partition=_U,q.pick=zq,q.pickBy=F6,q.property=W6,q.propertyOf=qz,q.pull=yF,q.pullAll=m6,q.pullAllBy=_F,q.pullAllWith=xF,q.pullAt=AF,q.range=zz,q.rangeRight=Hz,q.rearg=BU,q.reject=EU,q.remove=EF,q.rest=FU,q.reverse=z1,q.sampleSize=IU,q.set=kq,q.setWith=jq,q.shuffle=MU,q.slice=SF,q.sortBy=DU,q.sortedUniq=RF,q.sortedUniqBy=TF,q.split=dz,q.spread=UU,q.tail=NF,q.take=$F,q.takeRight=LF,q.takeRightWhile=BF,q.takeWhile=FF,q.tap=XF,q.throttle=qU,q.thru=Lu,q.toArray=T6,q.toPairs=U6,q.toPairsIn=q6,q.toPath=Vz,q.toPlainObject=$6,q.transform=Wq,q.unary=zU,q.union=UF,q.unionBy=qF,q.unionWith=zF,q.uniq=HF,q.uniqBy=kF,q.uniqWith=jF,q.unset=Kq,q.unzip=H1,q.unzipWith=b6,q.update=Vq,q.updateWith=Gq,q.values=Mc,q.valuesIn=Yq,q.without=WF,q.words=k6,q.wrap=HU,q.xor=KF,q.xorBy=VF,q.xorWith=GF,q.zip=YF,q.zipObject=JF,q.zipObjectDeep=QF,q.zipWith=ZF,q.entries=U6,q.entriesIn=q6,q.extend=L6,q.extendWith=ku,Z1(q,q),q.add=Yz,q.attempt=j6,q.camelCase=Xq,q.capitalize=z6,q.ceil=Jz,q.clamp=Jq,q.clone=jU,q.cloneDeep=KU,q.cloneDeepWith=VU,q.cloneWith=WU,q.conformsTo=GU,q.deburr=H6,q.defaultTo=Cz,q.divide=Qz,q.endsWith=ez,q.eq=Fn,q.escape=tz,q.escapeRegExp=rz,q.every=fU,q.find=hU,q.findIndex=d6,q.findKey=Eq,q.findLast=uU,q.findLastIndex=p6,q.findLastKey=Sq,q.floor=Zz,q.forEach=y6,q.forEachRight=_6,q.forIn=Iq,q.forInRight=Mq,q.forOwn=Cq,q.forOwnRight=Pq,q.get=V1,q.gt=YU,q.gte=JU,q.has=Rq,q.hasIn=G1,q.head=v6,q.identity=Di,q.includes=mU,q.indexOf=uF,q.inRange=Qq,q.invoke=$q,q.isArguments=ma,q.isArray=wt,q.isArrayBuffer=QU,q.isArrayLike=Ci,q.isArrayLikeObject=xr,q.isBoolean=ZU,q.isBuffer=_o,q.isDate=XU,q.isElement=eq,q.isEmpty=tq,q.isEqual=rq,q.isEqualWith=iq,q.isError=W1,q.isFinite=nq,q.isFunction=Ls,q.isInteger=P6,q.isLength=zu,q.isMap=D6,q.isMatch=sq,q.isMatchWith=oq,q.isNaN=aq,q.isNative=cq,q.isNil=lq,q.isNull=fq,q.isNumber=O6,q.isObject=hr,q.isObjectLike=mr,q.isPlainObject=Xf,q.isRegExp=K1,q.isSafeInteger=hq,q.isSet=R6,q.isString=Hu,q.isSymbol=Wi,q.isTypedArray=Ic,q.isUndefined=uq,q.isWeakMap=dq,q.isWeakSet=pq,q.join=mF,q.kebabCase=iz,q.last=mn,q.lastIndexOf=bF,q.lowerCase=nz,q.lowerFirst=sz,q.lt=gq,q.lte=vq,q.max=Xz,q.maxBy=eH,q.mean=tH,q.meanBy=rH,q.min=iH,q.minBy=nH,q.stubArray=eg,q.stubFalse=tg,q.stubObject=kz,q.stubString=jz,q.stubTrue=Wz,q.multiply=sH,q.nth=wF,q.noConflict=$z,q.noop=X1,q.now=Fu,q.pad=oz,q.padEnd=az,q.padStart=cz,q.parseInt=fz,q.random=Zq,q.reduce=xU,q.reduceRight=AU,q.repeat=lz,q.replace=hz,q.result=Hq,q.round=oH,q.runInContext=ie,q.sample=SU,q.size=CU,q.snakeCase=uz,q.some=PU,q.sortedIndex=IF,q.sortedIndexBy=MF,q.sortedIndexOf=CF,q.sortedLastIndex=PF,q.sortedLastIndexBy=DF,q.sortedLastIndexOf=OF,q.startCase=pz,q.startsWith=gz,q.subtract=aH,q.sum=cH,q.sumBy=fH,q.template=vz,q.times=Kz,q.toFinite=Bs,q.toInteger=Et,q.toLength=N6,q.toLower=mz,q.toNumber=bn,q.toSafeInteger=mq,q.toString=Vt,q.toUpper=bz,q.trim=wz,q.trimEnd=yz,q.trimStart=_z,q.truncate=xz,q.unescape=Az,q.uniqueId=Gz,q.upperCase=Ez,q.upperFirst=Y1,q.each=y6,q.eachRight=_6,q.first=v6,Z1(q,function(){var o={};return ls(q,function(c,p){Yt.call(q.prototype,p)||(o[p]=c)}),o}(),{chain:!1}),q.VERSION=i,un(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){q[o].placeholder=q}),un(["drop","take"],function(o,c){$t.prototype[o]=function(p){p=p===t?1:Dr(Et(p),0);var I=this.__filtered__&&!c?new $t(this):this.clone();return I.__filtered__?I.__takeCount__=ri(p,I.__takeCount__):I.__views__.push({size:ri(p,A),type:o+(I.__dir__<0?"Right":"")}),I},$t.prototype[o+"Right"]=function(p){return this.reverse()[o](p).reverse()}}),un(["filter","map","takeWhile"],function(o,c){var p=c+1,I=p==l||p==y;$t.prototype[o]=function(T){var k=this.clone();return k.__iteratees__.push({iteratee:ot(T,3),type:p}),k.__filtered__=k.__filtered__||I,k}}),un(["head","last"],function(o,c){var p="take"+(c?"Right":"");$t.prototype[o]=function(){return this[p](1).value()[0]}}),un(["initial","tail"],function(o,c){var p="drop"+(c?"":"Right");$t.prototype[o]=function(){return this.__filtered__?new $t(this):this[p](1)}}),$t.prototype.compact=function(){return this.filter(Di)},$t.prototype.find=function(o){return this.filter(o).head()},$t.prototype.findLast=function(o){return this.reverse().find(o)},$t.prototype.invokeMap=Mt(function(o,c){return typeof o=="function"?new $t(this):this.map(function(p){return Vf(p,o,c)})}),$t.prototype.reject=function(o){return this.filter(qu(ot(o)))},$t.prototype.slice=function(o,c){o=Et(o);var p=this;return p.__filtered__&&(o>0||c<0)?new $t(p):(o<0?p=p.takeRight(-o):o&&(p=p.drop(o)),c!==t&&(c=Et(c),p=c<0?p.dropRight(-c):p.take(c-o)),p)},$t.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},$t.prototype.toArray=function(){return this.take(A)},ls($t.prototype,function(o,c){var p=/^(?:filter|find|map|reject)|While$/.test(c),I=/^(?:head|last)$/.test(c),T=q[I?"take"+(c=="last"?"Right":""):c],k=I||/^find/.test(c);T&&(q.prototype[c]=function(){var Z=this.__wrapped__,te=I?[1]:arguments,se=Z instanceof $t,ue=te[0],de=se||wt(Z),ve=function(Rt){var Ft=T.apply(q,po([Rt],te));return I&&Se?Ft[0]:Ft};de&&p&&typeof ue=="function"&&ue.length!=1&&(se=de=!1);var Se=this.__chain__,Je=!!this.__actions__.length,ct=k&&!Se,St=se&&!Je;if(!k&&de){Z=St?Z:new $t(this);var ft=o.apply(Z,te);return ft.__actions__.push({func:Lu,args:[ve],thisArg:t}),new pn(ft,Se)}return ct&&St?o.apply(this,te):(ft=this.thru(ve),ct?I?ft.value()[0]:ft.value():ft)})}),un(["pop","push","shift","sort","splice","unshift"],function(o){var c=cu[o],p=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",I=/^(?:pop|shift)$/.test(o);q.prototype[o]=function(){var T=arguments;if(I&&!this.__chain__){var k=this.value();return c.apply(wt(k)?k:[],T)}return this[p](function(Z){return c.apply(wt(Z)?Z:[],T)})}}),ls($t.prototype,function(o,c){var p=q[c];if(p){var I=p.name+"";Yt.call(_c,I)||(_c[I]=[]),_c[I].push({name:c,func:p})}}),_c[Pu(t,H).name]=[{name:"wrapper",func:t}],$t.prototype.clone=AL,$t.prototype.reverse=EL,$t.prototype.value=SL,q.prototype.at=eU,q.prototype.chain=tU,q.prototype.commit=rU,q.prototype.next=iU,q.prototype.plant=sU,q.prototype.reverse=oU,q.prototype.toJSON=q.prototype.valueOf=q.prototype.value=aU,q.prototype.first=q.prototype.head,qf&&(q.prototype[qf]=nU),q},bc=rL();_r?((_r.exports=bc)._=bc,er._=bc):Bt._=bc}).call(fr)})(D0,D0.exports);var O0={exports:{}};(function(r,e){var t=typeof self<"u"?self:fr,i=function(){function s(){this.fetch=!1,this.DOMException=t.DOMException}return s.prototype=t,new s}();(function(s){(function(a){var f={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(l){return l&&DataView.prototype.isPrototypeOf(l)}if(f.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],g=ArrayBuffer.isView||function(l){return l&&u.indexOf(Object.prototype.toString.call(l))>-1};function w(l){if(typeof l!="string"&&(l=String(l)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(l))throw new TypeError("Invalid character in header field name");return l.toLowerCase()}function M(l){return typeof l!="string"&&(l=String(l)),l}function C(l){var d={next:function(){var y=l.shift();return{done:y===void 0,value:y}}};return f.iterable&&(d[Symbol.iterator]=function(){return d}),d}function O(l){this.map={},l instanceof O?l.forEach(function(d,y){this.append(y,d)},this):Array.isArray(l)?l.forEach(function(d){this.append(d[0],d[1])},this):l&&Object.getOwnPropertyNames(l).forEach(function(d){this.append(d,l[d])},this)}O.prototype.append=function(l,d){l=w(l),d=M(d);var y=this.map[l];this.map[l]=y?y+", "+d:d},O.prototype.delete=function(l){delete this.map[w(l)]},O.prototype.get=function(l){return l=w(l),this.has(l)?this.map[l]:null},O.prototype.has=function(l){return this.map.hasOwnProperty(w(l))},O.prototype.set=function(l,d){this.map[w(l)]=M(d)},O.prototype.forEach=function(l,d){for(var y in this.map)this.map.hasOwnProperty(y)&&l.call(d,this.map[y],y,this)},O.prototype.keys=function(){var l=[];return this.forEach(function(d,y){l.push(y)}),C(l)},O.prototype.values=function(){var l=[];return this.forEach(function(d){l.push(d)}),C(l)},O.prototype.entries=function(){var l=[];return this.forEach(function(d,y){l.push([y,d])}),C(l)},f.iterable&&(O.prototype[Symbol.iterator]=O.prototype.entries);function N(l){if(l.bodyUsed)return Promise.reject(new TypeError("Already read"));l.bodyUsed=!0}function j(l){return new Promise(function(d,y){l.onload=function(){d(l.result)},l.onerror=function(){y(l.error)}})}function H(l){var d=new FileReader,y=j(d);return d.readAsArrayBuffer(l),y}function F(l){var d=new FileReader,y=j(d);return d.readAsText(l),y}function G(l){for(var d=new Uint8Array(l),y=new Array(d.length),P=0;P<d.length;P++)y[P]=String.fromCharCode(d[P]);return y.join("")}function B(l){if(l.slice)return l.slice(0);var d=new Uint8Array(l.byteLength);return d.set(new Uint8Array(l)),d.buffer}function z(){return this.bodyUsed=!1,this._initBody=function(l){this._bodyInit=l,l?typeof l=="string"?this._bodyText=l:f.blob&&Blob.prototype.isPrototypeOf(l)?this._bodyBlob=l:f.formData&&FormData.prototype.isPrototypeOf(l)?this._bodyFormData=l:f.searchParams&&URLSearchParams.prototype.isPrototypeOf(l)?this._bodyText=l.toString():f.arrayBuffer&&f.blob&&h(l)?(this._bodyArrayBuffer=B(l.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):f.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(l)||g(l))?this._bodyArrayBuffer=B(l):this._bodyText=l=Object.prototype.toString.call(l):this._bodyText="",this.headers.get("content-type")||(typeof l=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):f.searchParams&&URLSearchParams.prototype.isPrototypeOf(l)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},f.blob&&(this.blob=function(){var l=N(this);if(l)return l;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(H)}),this.text=function(){var l=N(this);if(l)return l;if(this._bodyBlob)return F(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(G(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},f.formData&&(this.formData=function(){return this.text().then(ee)}),this.json=function(){return this.text().then(JSON.parse)},this}var W=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function _(l){var d=l.toUpperCase();return W.indexOf(d)>-1?d:l}function U(l,d){d=d||{};var y=d.body;if(l instanceof U){if(l.bodyUsed)throw new TypeError("Already read");this.url=l.url,this.credentials=l.credentials,d.headers||(this.headers=new O(l.headers)),this.method=l.method,this.mode=l.mode,this.signal=l.signal,!y&&l._bodyInit!=null&&(y=l._bodyInit,l.bodyUsed=!0)}else this.url=String(l);if(this.credentials=d.credentials||this.credentials||"same-origin",(d.headers||!this.headers)&&(this.headers=new O(d.headers)),this.method=_(d.method||this.method||"GET"),this.mode=d.mode||this.mode||null,this.signal=d.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&y)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(y)}U.prototype.clone=function(){return new U(this,{body:this._bodyInit})};function ee(l){var d=new FormData;return l.trim().split("&").forEach(function(y){if(y){var P=y.split("="),D=P.shift().replace(/\+/g," "),S=P.join("=").replace(/\+/g," ");d.append(decodeURIComponent(D),decodeURIComponent(S))}}),d}function oe(l){var d=new O,y=l.replace(/\r?\n[\t ]+/g," ");return y.split(/\r?\n/).forEach(function(P){var D=P.split(":"),S=D.shift().trim();if(S){var v=D.join(":").trim();d.append(S,v)}}),d}z.call(U.prototype);function L(l,d){d||(d={}),this.type="default",this.status=d.status===void 0?200:d.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in d?d.statusText:"OK",this.headers=new O(d.headers),this.url=d.url||"",this._initBody(l)}z.call(L.prototype),L.prototype.clone=function(){return new L(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new O(this.headers),url:this.url})},L.error=function(){var l=new L(null,{status:0,statusText:""});return l.type="error",l};var b=[301,302,303,307,308];L.redirect=function(l,d){if(b.indexOf(d)===-1)throw new RangeError("Invalid status code");return new L(null,{status:d,headers:{location:l}})},a.DOMException=s.DOMException;try{new a.DOMException}catch{a.DOMException=function(d,y){this.message=d,this.name=y;var P=Error(d);this.stack=P.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function m(l,d){return new Promise(function(y,P){var D=new U(l,d);if(D.signal&&D.signal.aborted)return P(new a.DOMException("Aborted","AbortError"));var S=new XMLHttpRequest;function v(){S.abort()}S.onload=function(){var A={status:S.status,statusText:S.statusText,headers:oe(S.getAllResponseHeaders()||"")};A.url="responseURL"in S?S.responseURL:A.headers.get("X-Request-URL");var x="response"in S?S.response:S.responseText;y(new L(x,A))},S.onerror=function(){P(new TypeError("Network request failed"))},S.ontimeout=function(){P(new TypeError("Network request failed"))},S.onabort=function(){P(new a.DOMException("Aborted","AbortError"))},S.open(D.method,D.url,!0),D.credentials==="include"?S.withCredentials=!0:D.credentials==="omit"&&(S.withCredentials=!1),"responseType"in S&&f.blob&&(S.responseType="blob"),D.headers.forEach(function(A,x){S.setRequestHeader(x,A)}),D.signal&&(D.signal.addEventListener("abort",v),S.onreadystatechange=function(){S.readyState===4&&D.signal.removeEventListener("abort",v)}),S.send(typeof D._bodyInit>"u"?null:D._bodyInit)})}return m.polyfill=!0,s.fetch||(s.fetch=m,s.Headers=O,s.Request=U,s.Response=L),a.Headers=O,a.Request=U,a.Response=L,a.fetch=m,Object.defineProperty(a,"__esModule",{value:!0}),a})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var n=i;e=n.fetch,e.default=n.fetch,e.fetch=n.fetch,e.Headers=n.Headers,e.Request=n.Request,e.Response=n.Response,r.exports=e})(O0,O0.exports);var Z2=V6(O0.exports),nD=Object.defineProperty,sD=Object.defineProperties,oD=Object.getOwnPropertyDescriptors,X2=Object.getOwnPropertySymbols,aD=Object.prototype.hasOwnProperty,cD=Object.prototype.propertyIsEnumerable,e3=(r,e,t)=>e in r?nD(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,t3=(r,e)=>{for(var t in e||(e={}))aD.call(e,t)&&e3(r,t,e[t]);if(X2)for(var t of X2(e))cD.call(e,t)&&e3(r,t,e[t]);return r},r3=(r,e)=>sD(r,oD(e));const fD={Accept:"application/json","Content-Type":"application/json"},lD="POST",i3={headers:fD,method:lD},n3=10;class Cn{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new zr.exports.EventEmitter,this.isAvailable=!1,this.registering=!1,!Qb(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const t=bs(e),i=await(await Z2(this.url,r3(t3({},i3),{body:t}))).json();this.onPayload({data:i})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!Qb(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,n)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),n(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return n(new Error("HTTP connection is missing or invalid"));i()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const t=bs({id:1,jsonrpc:"2.0",method:"test",params:[]});await Z2(e,r3(t3({},i3),{body:t}))}this.onOpen()}catch(t){const i=this.parseError(t);throw this.events.emit("register_error",i),this.onClose(),i}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?Ro(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const i=this.parseError(t),n=i.message||i.toString(),s=nh(e,n);this.events.emit("payload",s)}parseError(e,t=this.url){return Wb(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>n3&&this.events.setMaxListeners(n3)}}const s3="error",hD="wss://relay.walletconnect.org",uD="wc",dD="universal_provider",o3=`${uD}@2:${dD}:`,a3="https://rpc.walletconnect.org/v1/",Ka="generic",pD=`${a3}bundler`,an={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var gD=Object.defineProperty,vD=Object.defineProperties,mD=Object.getOwnPropertyDescriptors,c3=Object.getOwnPropertySymbols,bD=Object.prototype.hasOwnProperty,wD=Object.prototype.propertyIsEnumerable,f3=(r,e,t)=>e in r?gD(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,lh=(r,e)=>{for(var t in e||(e={}))bD.call(e,t)&&f3(r,t,e[t]);if(c3)for(var t of c3(e))wD.call(e,t)&&f3(r,t,e[t]);return r},yD=(r,e)=>vD(r,mD(e));function Ui(r,e,t){var i;const n=qa(r);return((i=e.rpcMap)==null?void 0:i[n.reference])||`${a3}?chainId=${n.namespace}:${n.reference}&projectId=${t}`}function jo(r){return r.includes(":")?r.split(":")[1]:r}function l3(r){return r.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function _D(r,e){const t=Object.keys(e.namespaces).filter(n=>n.includes(r));if(!t.length)return[];const i=[];return t.forEach(n=>{const s=e.namespaces[n].accounts;i.push(...s)}),i}function R0(r={},e={}){const t=h3(r),i=h3(e);return D0.exports.merge(t,i)}function h3(r){var e,t,i,n;const s={};if(!tf(r))return s;for(const[a,f]of Object.entries(r)){const h=r0(a)?[a]:f.chains,u=f.methods||[],g=f.events||[],w=f.rpcMap||{},M=ef(a);s[M]=yD(lh(lh({},s[M]),f),{chains:zl(h,(e=s[M])==null?void 0:e.chains),methods:zl(u,(t=s[M])==null?void 0:t.methods),events:zl(g,(i=s[M])==null?void 0:i.events),rpcMap:lh(lh({},w),(n=s[M])==null?void 0:n.rpcMap)})}return s}function xD(r){return r.includes(":")?r.split(":")[2]:r}function u3(r){const e={};for(const[t,i]of Object.entries(r)){const n=i.methods||[],s=i.events||[],a=i.accounts||[],f=r0(t)?[t]:i.chains?i.chains:l3(i.accounts);e[t]={chains:f,methods:n,events:s,accounts:a}}return e}function T0(r){return typeof r=="number"?r:r.includes("0x")?parseInt(r,16):(r=r.includes(":")?r.split(":")[1]:r,isNaN(Number(r))?r:Number(r))}const d3={},zt=r=>d3[r],N0=(r,e)=>{d3[r]=e};class AD{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(an.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=jo(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Ui(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new nn(new Cn(i,zt("disableProviderPing")))}}var ED=Object.defineProperty,SD=Object.defineProperties,ID=Object.getOwnPropertyDescriptors,p3=Object.getOwnPropertySymbols,MD=Object.prototype.hasOwnProperty,CD=Object.prototype.propertyIsEnumerable,g3=(r,e,t)=>e in r?ED(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,v3=(r,e)=>{for(var t in e||(e={}))MD.call(e,t)&&g3(r,t,e[t]);if(p3)for(var t of p3(e))CD.call(e,t)&&g3(r,t,e[t]);return r},m3=(r,e)=>SD(r,ID(e));class PD{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(an.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const i=t||Ui(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new nn(new Cn(i,zt("disableProviderPing")))}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=parseInt(jo(t));e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,i;let n=e.request.params?(t=e.request.params[0])==null?void 0:t.chainId:"0x0";n=n.startsWith("0x")?n:`0x${n}`;const s=parseInt(n,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:n}]},chainId:(i=this.namespace.chains)==null?void 0:i[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var t,i,n;const s=(i=(t=e.request)==null?void 0:t.params)==null?void 0:i[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const a=this.client.session.get(e.topic),f=((n=a?.sessionProperties)==null?void 0:n.capabilities)||{};if(f!=null&&f[s])return f?.[s];const h=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:m3(v3({},a.sessionProperties||{}),{capabilities:m3(v3({},f||{}),{[s]:h})})})}catch(u){console.warn("Failed to update session with capabilities",u)}return h}async getCallStatus(e){var t,i;const n=this.client.session.get(e.topic),s=(t=n.sessionProperties)==null?void 0:t.bundler_name;if(s){const f=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(f,e)}catch(h){console.warn("Failed to fetch call status from bundler",h,f)}}const a=(i=n.sessionProperties)==null?void 0:i.bundler_url;if(a)try{return await this.getUserOperationReceipt(a,e)}catch(f){console.warn("Failed to fetch call status from custom bundler",f,a)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,t){var i;const n=new URL(e),s=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Qs("eth_getUserOperationReceipt",[(i=t.request.params)==null?void 0:i[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,t){return`${pD}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}class DD{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(an.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=jo(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Ui(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new nn(new Cn(i,zt("disableProviderPing")))}}class OD{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(an.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=jo(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Ui(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new nn(new Cn(i,zt("disableProviderPing")))}}class RD{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){const i=t||Ui(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.chainId=e,this.events.emit(an.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Ui(e,this.namespace,this.client.core.projectId);return typeof i>"u"?void 0:new nn(new Cn(i,zt("disableProviderPing")))}}class TD{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(an.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{const i=this.getCardanoRPCUrl(t),n=jo(t);e[n]=this.createHttpProvider(n,i)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||this.getCardanoRPCUrl(e);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new nn(new Cn(i,zt("disableProviderPing")))}}class ND{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(an.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=jo(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Ui(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new nn(new Cn(i,zt("disableProviderPing")))}}class $D{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(an.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=jo(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Ui(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new nn(new Cn(i,zt("disableProviderPing")))}}class LD{constructor(e){this.name="near",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const i=t||Ui(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(an.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Ui(e,this.namespace);return typeof i>"u"?void 0:new nn(new Cn(i,zt("disableProviderPing")))}}class BD{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const i=t||Ui(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(an.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{e[t]=this.createHttpProvider(t)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Ui(e,this.namespace);return typeof i>"u"?void 0:new nn(new Cn(i))}}class FD{constructor(e){this.name=Ka,this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(an.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){var e,t;const i={};return(t=(e=this.namespace)==null?void 0:e.accounts)==null||t.forEach(n=>{const s=qa(n);i[`${s.namespace}:${s.reference}`]=this.createHttpProvider(n)}),i}getHttpProvider(e){const t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Ui(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new nn(new Cn(i,zt("disableProviderPing")))}}var UD=Object.defineProperty,qD=Object.defineProperties,zD=Object.getOwnPropertyDescriptors,b3=Object.getOwnPropertySymbols,HD=Object.prototype.hasOwnProperty,kD=Object.prototype.propertyIsEnumerable,w3=(r,e,t)=>e in r?UD(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,hh=(r,e)=>{for(var t in e||(e={}))HD.call(e,t)&&w3(r,t,e[t]);if(b3)for(var t of b3(e))kD.call(e,t)&&w3(r,t,e[t]);return r},$0=(r,e)=>qD(r,zD(e));class L0{constructor(e){this.events=new zr.exports,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Zn(rh({level:e?.logger||s3})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){const t=new L0(e);return await t.initialize(),t}async request(e,t,i){const[n,s]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:hh({},e),chainId:`${n}:${s}`,topic:this.session.topic,expiry:i})}sendAsync(e,t,i,n){const s=new Date().getTime();this.request(e,i,n).then(a=>t(null,ih(s,a))).catch(a=>t(a,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Gt("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:i,response:n}=await this.client.authenticate(e,t);i&&(this.uri=i,this.events.emit("display_uri",i));const s=await n();if(this.session=s.session,this.session){const a=u3(this.session.namespaces);this.namespaces=R0(this.namespaces,a),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:i,approval:n}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});i&&(this.uri=i,this.events.emit("display_uri",i)),await n().then(s=>{this.session=s;const a=u3(s.namespaces);this.namespaces=R0(this.namespaces,a),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==Y2)throw s;t++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[i,n]=this.validateChain(e),s=this.getProvider(i);s.name===Ka?s.setDefaultChain(`${i}:${n}`,t):s.setDefaultChain(n,t)}catch(i){if(!/Please call connect/.test(i.message))throw i}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(_s(t)){for(const i of t)e.deletePairings?this.client.core.expirer.set(i.topic,0):await this.client.core.relayer.subscriber.unsubscribe(i.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await P0.init({core:this.providerOpts.core,logger:this.providerOpts.logger||s3,relayUrl:this.providerOpts.relayUrl||hD,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(t=>ef(t)))];N0("client",this.client),N0("events",this.events),N0("disableProviderPing",this.disableProviderPing),e.forEach(t=>{if(!this.session)return;const i=_D(t,this.session),n=l3(i),s=R0(this.namespaces,this.optionalNamespaces),a=$0(hh({},s[t]),{accounts:i,chains:n});switch(t){case"eip155":this.rpcProviders[t]=new PD({namespace:a});break;case"algorand":this.rpcProviders[t]=new RD({namespace:a});break;case"solana":this.rpcProviders[t]=new DD({namespace:a});break;case"cosmos":this.rpcProviders[t]=new OD({namespace:a});break;case"polkadot":this.rpcProviders[t]=new AD({namespace:a});break;case"cip34":this.rpcProviders[t]=new TD({namespace:a});break;case"elrond":this.rpcProviders[t]=new ND({namespace:a});break;case"multiversx":this.rpcProviders[t]=new $D({namespace:a});break;case"near":this.rpcProviders[t]=new LD({namespace:a});break;case"tezos":this.rpcProviders[t]=new BD({namespace:a});break;default:this.rpcProviders[Ka]?this.rpcProviders[Ka].updateNamespace(a):this.rpcProviders[Ka]=new FD({namespace:a})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:t}=e,{event:i}=t;if(i.name==="accountsChanged"){const n=i.data;n&&_s(n)&&this.events.emit("accountsChanged",n.map(xD))}else if(i.name==="chainChanged"){const n=t.chainId,s=t.event.data,a=ef(n),f=T0(n)!==T0(s)?`${a}:${T0(s)}`:n;this.onChainChanged(f)}else this.events.emit(i.name,i.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var i;const{namespaces:n}=t,s=(i=this.client)==null?void 0:i.session.get(e);this.session=$0(hh({},s),{namespaces:n}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",$0(hh({},Gt("USER_DISCONNECTED")),{data:e.topic}))}),this.on(an.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Ka]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace((t=this.session)==null?void 0:t.namespaces[e])})}setNamespaces(e){const{namespaces:t,optionalNamespaces:i,sessionProperties:n}=e;t&&Object.keys(t).length&&(this.namespaces=t),i&&Object.keys(i).length&&(this.optionalNamespaces=i),this.sessionProperties=n,this.persist("namespaces",t),this.persist("optionalNamespaces",i)}validateChain(e){const[t,i]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,i];if(t&&!Object.keys(this.namespaces||{}).map(a=>ef(a)).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&i)return[t,i];const n=ef(Object.keys(this.namespaces)[0]),s=this.rpcProviders[n].getDefaultChain();return[n,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){if(!this.namespaces)return;const[i,n]=this.validateChain(e);n&&(t||this.getProvider(i).setDefaultChain(n),this.namespaces[i]?this.namespaces[i].defaultChain=n:this.namespaces[`${i}:${n}`]?this.namespaces[`${i}:${n}`].defaultChain=n:this.namespaces[`${i}:${n}`]={defaultChain:n},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",n))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`${o3}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${o3}/${e}`)}}const jD=L0,WD="wc",KD="ethereum_provider",VD=`${WD}@2:${KD}:`,GD="https://rpc.walletconnect.org/v1/",uh=["eth_sendTransaction","personal_sign"],y3=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],dh=["chainChanged","accountsChanged"],_3=["chainChanged","accountsChanged","message","disconnect","connect"];var YD=Object.defineProperty,JD=Object.defineProperties,QD=Object.getOwnPropertyDescriptors,x3=Object.getOwnPropertySymbols,ZD=Object.prototype.hasOwnProperty,XD=Object.prototype.propertyIsEnumerable,A3=(r,e,t)=>e in r?YD(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Va=(r,e)=>{for(var t in e||(e={}))ZD.call(e,t)&&A3(r,t,e[t]);if(x3)for(var t of x3(e))XD.call(e,t)&&A3(r,t,e[t]);return r},B0=(r,e)=>JD(r,QD(e));function ph(r){return Number(r[0].split(":")[1])}function gh(r){return`0x${r.toString(16)}`}function eO(r){const{chains:e,optionalChains:t,methods:i,optionalMethods:n,events:s,optionalEvents:a,rpcMap:f}=r;if(!_s(e))throw new Error("Invalid chains");const h={chains:e,methods:i||uh,events:s||dh,rpcMap:Va({},e.length?{[ph(e)]:f[ph(e)]}:{})},u=s?.filter(C=>!dh.includes(C)),g=i?.filter(C=>!uh.includes(C));if(!t&&!a&&!n&&!(u!=null&&u.length)&&!(g!=null&&g.length))return{required:e.length?h:void 0};const w=u?.length&&g?.length||!t,M={chains:[...new Set(w?h.chains.concat(t||[]):t)],methods:[...new Set(h.methods.concat(n!=null&&n.length?n:y3))],events:[...new Set(h.events.concat(a!=null&&a.length?a:_3))],rpcMap:f};return{required:e.length?h:void 0,optional:t.length?M:void 0}}class vh{constructor(){this.events=new zr.exports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=VD,this.on=(e,t)=>(this.events.on(e,t),this),this.once=(e,t)=>(this.events.once(e,t),this),this.removeListener=(e,t)=>(this.events.removeListener(e,t),this),this.off=(e,t)=>(this.events.off(e,t),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const t=new vh;return await t.initialize(e),t}async request(e,t){return await this.signer.request(e,this.formatChainId(this.chainId),t)}sendAsync(e,t,i){this.signer.sendAsync(e,t,this.formatChainId(this.chainId),i)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:t,optional:i}=eO(this.rpc);try{const n=await new Promise(async(a,f)=>{var h;this.rpc.showQrModal&&((h=this.modal)==null||h.subscribeModal(u=>{!u.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(B0(Va({namespaces:Va({},t&&{[this.namespace]:t})},i&&{optionalNamespaces:{[this.namespace]:i}}),{pairingTopic:e?.pairingTopic})).then(u=>{a(u)}).catch(u=>{f(new Error(u.message))})});if(!n)return;const s=Bm(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:gh(this.chainId)})}catch(n){throw this.signer.logger.error(n),n}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e?.chains});try{const i=await new Promise(async(s,a)=>{var f;this.rpc.showQrModal&&((f=this.modal)==null||f.subscribeModal(h=>{!h.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(B0(Va({},e),{chains:this.rpc.chains}),t).then(h=>{s(h)}).catch(h=>{a(new Error(h.message))})}),n=i.session;if(n){const s=Bm(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:gh(this.chainId)})}return i}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:t}=e,{event:i}=t;i.name==="accountsChanged"?(this.accounts=this.parseAccounts(i.data),this.events.emit("accountsChanged",this.accounts)):i.name==="chainChanged"?this.setChainId(this.formatChainId(i.data)):this.events.emit(i.name,i.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",gh(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",B0(Va({},Gt("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var t,i;this.rpc.showQrModal&&((t=this.modal)==null||t.closeModal(),(i=this.modal)==null||i.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const t=e.filter(i=>this.isCompatibleChainId(i)).map(i=>this.parseChainId(i));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",gh(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){const[t,i,n]=e.split(":");return{chainId:`${t}:${i}`,address:n}}setAccounts(e){this.accounts=e.filter(t=>this.parseChainId(this.parseAccountId(t).chainId)===this.chainId).map(t=>this.parseAccountId(t).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t,i;const n=(t=e?.chains)!=null?t:[],s=(i=e?.optionalChains)!=null?i:[],a=n.concat(s);if(!a.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const f=n.length?e?.methods||uh:[],h=n.length?e?.events||dh:[],u=e?.optionalMethods||[],g=e?.optionalEvents||[],w=e?.rpcMap||this.buildRpcMap(a,e.projectId),M=e?.qrModalOptions||void 0;return{chains:n?.map(C=>this.formatChainId(C)),optionalChains:s.map(C=>this.formatChainId(C)),methods:f,events:h,optionalMethods:u,optionalEvents:g,rpcMap:w,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:M,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const i={};return e.forEach(n=>{i[n]=this.getRpcUrl(n,t)}),i}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?ph(this.rpc.chains):ph(this.rpc.optionalChains),this.signer=await jD.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled,logger:e.logger}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let t;try{const{WalletConnectModal:i}=await Promise.resolve().then(function(){return AO});t=i}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(Va({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(i){throw this.signer.logger.error(i),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:t,optionalChains:i,rpcMap:n}=e;t&&_s(t)&&(this.rpc.chains=t.map(s=>this.formatChainId(s)),t.forEach(s=>{this.rpc.rpcMap[s]=n?.[s]||this.getRpcUrl(s)})),i&&_s(i)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=i?.map(s=>this.formatChainId(s)),i.forEach(s=>{this.rpc.rpcMap[s]=n?.[s]||this.getRpcUrl(s)}))}getRpcUrl(e,t){var i;return((i=this.rpc.rpcMap)==null?void 0:i[e])||`${GD}?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:t?.accounts),this.setAccounts(t?.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(t=>this.signer.logger.warn(t))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(t=>this.parseAccount(t))}}const tO=vh,rO=Symbol(),E3=Object.getPrototypeOf,F0=new WeakMap,iO=r=>r&&(F0.has(r)?F0.get(r):E3(r)===Object.prototype||E3(r)===Array.prototype),nO=r=>iO(r)&&r[rO]||null,S3=(r,e=!0)=>{F0.set(r,e)},U0=r=>typeof r=="object"&&r!==null,Zs=new WeakMap,mh=new WeakSet,sO=(r=Object.is,e=(u,g)=>new Proxy(u,g),t=u=>U0(u)&&!mh.has(u)&&(Array.isArray(u)||!(Symbol.iterator in u))&&!(u instanceof WeakMap)&&!(u instanceof WeakSet)&&!(u instanceof Error)&&!(u instanceof Number)&&!(u instanceof Date)&&!(u instanceof String)&&!(u instanceof RegExp)&&!(u instanceof ArrayBuffer),i=u=>{switch(u.status){case"fulfilled":return u.value;case"rejected":throw u.reason;default:throw u}},n=new WeakMap,s=(u,g,w=i)=>{const M=n.get(u);if(M?.[0]===g)return M[1];const C=Array.isArray(u)?[]:Object.create(Object.getPrototypeOf(u));return S3(C,!0),n.set(u,[g,C]),Reflect.ownKeys(u).forEach(O=>{if(Object.getOwnPropertyDescriptor(C,O))return;const N=Reflect.get(u,O),j={value:N,enumerable:!0,configurable:!0};if(mh.has(N))S3(N,!1);else if(N instanceof Promise)delete j.value,j.get=()=>w(N);else if(Zs.has(N)){const[H,F]=Zs.get(N);j.value=s(H,F(),w)}Object.defineProperty(C,O,j)}),Object.preventExtensions(C)},a=new WeakMap,f=[1,1],h=u=>{if(!U0(u))throw new Error("object required");const g=a.get(u);if(g)return g;let w=f[0];const M=new Set,C=(ee,oe=++f[0])=>{w!==oe&&(w=oe,M.forEach(L=>L(ee,oe)))};let O=f[1];const N=(ee=++f[1])=>(O!==ee&&!M.size&&(O=ee,H.forEach(([oe])=>{const L=oe[1](ee);L>w&&(w=L)})),w),j=ee=>(oe,L)=>{const b=[...oe];b[1]=[ee,...b[1]],C(b,L)},H=new Map,F=(ee,oe)=>{if(H.has(ee))throw new Error("prop listener already exists");if(M.size){const L=oe[3](j(ee));H.set(ee,[oe,L])}else H.set(ee,[oe])},G=ee=>{var oe;const L=H.get(ee);L&&(H.delete(ee),(oe=L[1])==null||oe.call(L))},B=ee=>(M.add(ee),M.size===1&&H.forEach(([L,b],m)=>{if(b)throw new Error("remove already exists");const l=L[3](j(m));H.set(m,[L,l])}),()=>{M.delete(ee),M.size===0&&H.forEach(([L,b],m)=>{b&&(b(),H.set(m,[L]))})}),z=Array.isArray(u)?[]:Object.create(Object.getPrototypeOf(u)),_=e(z,{deleteProperty(ee,oe){const L=Reflect.get(ee,oe);G(oe);const b=Reflect.deleteProperty(ee,oe);return b&&C(["delete",[oe],L]),b},set(ee,oe,L,b){const m=Reflect.has(ee,oe),l=Reflect.get(ee,oe,b);if(m&&(r(l,L)||a.has(L)&&r(l,a.get(L))))return!0;G(oe),U0(L)&&(L=nO(L)||L);let d=L;if(L instanceof Promise)L.then(y=>{L.status="fulfilled",L.value=y,C(["resolve",[oe],y])}).catch(y=>{L.status="rejected",L.reason=y,C(["reject",[oe],y])});else{!Zs.has(L)&&t(L)&&(d=h(L));const y=!mh.has(d)&&Zs.get(d);y&&F(oe,y)}return Reflect.set(ee,oe,d,b),C(["set",[oe],L,l]),!0}});a.set(u,_);const U=[z,N,s,B];return Zs.set(_,U),Reflect.ownKeys(u).forEach(ee=>{const oe=Object.getOwnPropertyDescriptor(u,ee);"value"in oe&&(_[ee]=u[ee],delete oe.value,delete oe.writable),Object.defineProperty(z,ee,oe)}),_})=>[h,Zs,mh,r,e,t,i,n,s,a,f],[oO]=sO();function Xs(r={}){return oO(r)}function Wo(r,e,t){const i=Zs.get(r);i||console.warn("Please use proxy object");let n;const s=[],a=i[3];let f=!1;const u=a(g=>{if(s.push(g),t){e(s.splice(0));return}n||(n=Promise.resolve().then(()=>{n=void 0,f&&e(s.splice(0))}))});return f=!0,()=>{f=!1,u()}}function aO(r,e){const t=Zs.get(r);t||console.warn("Please use proxy object");const[i,n,s]=t;return s(i,n(),e)}const Fr=Xs({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),lr={state:Fr,subscribe(r){return Wo(Fr,()=>r(Fr))},push(r,e){r!==Fr.view&&(Fr.view=r,e&&(Fr.data=e),Fr.history.push(r))},reset(r){Fr.view=r,Fr.history=[r]},replace(r){Fr.history.length>1&&(Fr.history[Fr.history.length-1]=r,Fr.view=r)},goBack(){if(Fr.history.length>1){Fr.history.pop();const[r]=Fr.history.slice(-1);Fr.view=r}},setData(r){Fr.data=r}},je={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return je.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const r=navigator.userAgent.toLowerCase();return je.isMobile()&&(r.includes("iphone")||r.includes("ipad"))},isHttpUrl(r){return r.startsWith("http://")||r.startsWith("https://")},isArray(r){return Array.isArray(r)&&r.length>0},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},formatNativeUrl(r,e,t){if(je.isHttpUrl(r))return this.formatUniversalUrl(r,e,t);let i=r;i.includes("://")||(i=r.replaceAll("/","").replaceAll(":",""),i=`${i}://`),i.endsWith("/")||(i=`${i}/`),this.setWalletConnectDeepLink(i,t);const n=encodeURIComponent(e);return`${i}wc?uri=${n}`},formatUniversalUrl(r,e,t){if(!je.isHttpUrl(r))return this.formatNativeUrl(r,e,t);let i=r;if(i.startsWith("https://t.me")){const s=Buffer.from(e).toString("base64").replace(/[=]/g,"");i.endsWith("/")&&(i=i.slice(0,-1)),this.setWalletConnectDeepLink(i,t);const a=new URL(i);return a.searchParams.set("startapp",s),a.toString()}i.endsWith("/")||(i=`${i}/`),this.setWalletConnectDeepLink(i,t);const n=encodeURIComponent(e);return`${i}wc?uri=${n}`},async wait(r){return new Promise(e=>{setTimeout(e,r)})},openHref(r,e){const t=this.isTelegram()?"_blank":e;window.open(r,t,"noreferrer noopener")},setWalletConnectDeepLink(r,e){try{localStorage.setItem(je.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:r,name:e}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(r){try{const[e]=r.split("?");localStorage.setItem(je.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(je.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(je.WCM_VERSION,"2.7.0")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var r;const e=(r=lr.state.data)==null?void 0:r.Wallet;if(!e)throw new Error('Missing "Wallet" view data');return e}},cO=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),Qr=Xs({enabled:cO,userSessionId:"",events:[],connectedWalletId:void 0}),I3={state:Qr,subscribe(r){return Wo(Qr.events,()=>r(aO(Qr.events[Qr.events.length-1])))},initialize(){Qr.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(Qr.userSessionId=crypto.randomUUID())},setConnectedWalletId(r){Qr.connectedWalletId=r},click(r){if(Qr.enabled){const e={type:"CLICK",name:r.name,userSessionId:Qr.userSessionId,timestamp:Date.now(),data:r};Qr.events.push(e)}},track(r){if(Qr.enabled){const e={type:"TRACK",name:r.name,userSessionId:Qr.userSessionId,timestamp:Date.now(),data:r};Qr.events.push(e)}},view(r){if(Qr.enabled){const e={type:"VIEW",name:r.name,userSessionId:Qr.userSessionId,timestamp:Date.now(),data:r};Qr.events.push(e)}}},ns=Xs({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),yr={state:ns,subscribe(r){return Wo(ns,()=>r(ns))},setChains(r){ns.chains=r},setWalletConnectUri(r){ns.walletConnectUri=r},setIsCustomDesktop(r){ns.isCustomDesktop=r},setIsCustomMobile(r){ns.isCustomMobile=r},setIsDataLoaded(r){ns.isDataLoaded=r},setIsUiLoaded(r){ns.isUiLoaded=r},setIsAuth(r){ns.isAuth=r}},bh=Xs({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),qi={state:bh,subscribe(r){return Wo(bh,()=>r(bh))},setConfig(r){var e,t;I3.initialize(),yr.setChains(r.chains),yr.setIsAuth(!!r.enableAuthMode),yr.setIsCustomMobile(!!((e=r.mobileWallets)!=null&&e.length)),yr.setIsCustomDesktop(!!((t=r.desktopWallets)!=null&&t.length)),je.setModalVersionInStorage(),Object.assign(bh,r)}};var fO=Object.defineProperty,M3=Object.getOwnPropertySymbols,lO=Object.prototype.hasOwnProperty,hO=Object.prototype.propertyIsEnumerable,C3=(r,e,t)=>e in r?fO(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,uO=(r,e)=>{for(var t in e||(e={}))lO.call(e,t)&&C3(r,t,e[t]);if(M3)for(var t of M3(e))hO.call(e,t)&&C3(r,t,e[t]);return r};const q0="https://explorer-api.walletconnect.com",z0="wcm",H0="js-2.7.0";async function wh(r,e){const t=uO({sdkType:z0,sdkVersion:H0},e),i=new URL(r,q0);return i.searchParams.append("projectId",qi.state.projectId),Object.entries(t).forEach(([s,a])=>{a&&i.searchParams.append(s,String(a))}),(await fetch(i)).json()}const Ko={async getDesktopListings(r){return wh("/w3m/v1/getDesktopListings",r)},async getMobileListings(r){return wh("/w3m/v1/getMobileListings",r)},async getInjectedListings(r){return wh("/w3m/v1/getInjectedListings",r)},async getAllListings(r){return wh("/w3m/v1/getAllListings",r)},getWalletImageUrl(r){return`${q0}/w3m/v1/getWalletImage/${r}?projectId=${qi.state.projectId}&sdkType=${z0}&sdkVersion=${H0}`},getAssetImageUrl(r){return`${q0}/w3m/v1/getAssetImage/${r}?projectId=${qi.state.projectId}&sdkType=${z0}&sdkVersion=${H0}`}};var dO=Object.defineProperty,P3=Object.getOwnPropertySymbols,pO=Object.prototype.hasOwnProperty,gO=Object.prototype.propertyIsEnumerable,D3=(r,e,t)=>e in r?dO(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,vO=(r,e)=>{for(var t in e||(e={}))pO.call(e,t)&&D3(r,t,e[t]);if(P3)for(var t of P3(e))gO.call(e,t)&&D3(r,t,e[t]);return r};const O3=je.isMobile(),ss=Xs({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),_i={state:ss,async getRecomendedWallets(){const{explorerRecommendedWalletIds:r,explorerExcludedWalletIds:e}=qi.state;if(r==="NONE"||e==="ALL"&&!r)return ss.recomendedWallets;if(je.isArray(r)){const i={recommendedIds:r.join(",")},{listings:n}=await Ko.getAllListings(i),s=Object.values(n);s.sort((a,f)=>{const h=r.indexOf(a.id),u=r.indexOf(f.id);return h-u}),ss.recomendedWallets=s}else{const{chains:t,isAuth:i}=yr.state,n=t?.join(","),s=je.isArray(e),a={page:1,sdks:i?"auth_v1":void 0,entries:je.RECOMMENDED_WALLET_AMOUNT,chains:n,version:2,excludedIds:s?e.join(","):void 0},{listings:f}=O3?await Ko.getMobileListings(a):await Ko.getDesktopListings(a);ss.recomendedWallets=Object.values(f)}return ss.recomendedWallets},async getWallets(r){const e=vO({},r),{explorerRecommendedWalletIds:t,explorerExcludedWalletIds:i}=qi.state,{recomendedWallets:n}=ss;if(i==="ALL")return ss.wallets;n.length?e.excludedIds=n.map(w=>w.id).join(","):je.isArray(t)&&(e.excludedIds=t.join(",")),je.isArray(i)&&(e.excludedIds=[e.excludedIds,i].filter(Boolean).join(",")),yr.state.isAuth&&(e.sdks="auth_v1");const{page:s,search:a}=r,{listings:f,total:h}=O3?await Ko.getMobileListings(e):await Ko.getDesktopListings(e),u=Object.values(f),g=a?"search":"wallets";return ss[g]={listings:[...ss[g].listings,...u],total:h,page:s??1},{listings:u,total:h}},getWalletImageUrl(r){return Ko.getWalletImageUrl(r)},getAssetImageUrl(r){return Ko.getAssetImageUrl(r)},resetSearch(){ss.search={listings:[],total:0,page:1}}},Ga=Xs({open:!1}),Vo={state:Ga,subscribe(r){return Wo(Ga,()=>r(Ga))},async open(r){return new Promise(e=>{const{isUiLoaded:t,isDataLoaded:i}=yr.state;if(je.removeWalletConnectDeepLink(),yr.setWalletConnectUri(r?.uri),yr.setChains(r?.chains),lr.reset("ConnectWallet"),t&&i)Ga.open=!0,e();else{const n=setInterval(()=>{const s=yr.state;s.isUiLoaded&&s.isDataLoaded&&(clearInterval(n),Ga.open=!0,e())},200)}})},close(){Ga.open=!1}};var mO=Object.defineProperty,R3=Object.getOwnPropertySymbols,bO=Object.prototype.hasOwnProperty,wO=Object.prototype.propertyIsEnumerable,T3=(r,e,t)=>e in r?mO(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,yO=(r,e)=>{for(var t in e||(e={}))bO.call(e,t)&&T3(r,t,e[t]);if(R3)for(var t of R3(e))wO.call(e,t)&&T3(r,t,e[t]);return r};function _O(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const vf=Xs({themeMode:_O()?"dark":"light"}),eo={state:vf,subscribe(r){return Wo(vf,()=>r(vf))},setThemeConfig(r){const{themeMode:e,themeVariables:t}=r;e&&(vf.themeMode=e),t&&(vf.themeVariables=yO({},t))}},Go=Xs({open:!1,message:"",variant:"success"}),to={state:Go,subscribe(r){return Wo(Go,()=>r(Go))},openToast(r,e){Go.open=!0,Go.message=r,Go.variant=e},closeToast(){Go.open=!1}};class xO{constructor(e){this.openModal=Vo.open,this.closeModal=Vo.close,this.subscribeModal=Vo.subscribe,this.setTheme=eo.setThemeConfig,eo.setThemeConfig(e),qi.setConfig(e),this.initUi()}async initUi(){if(typeof window<"u"){await Promise.resolve().then(function(){return R$});const e=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",e),yr.setIsUiLoaded(!0)}}}var AO=Object.freeze({__proto__:null,WalletConnectModal:xO});/**
|
|
69
|
+
}`;var St=T6(function(){return Wt(F,Ye+"return "+ve).apply(t,Y)});if(St.source=ve,H1(St))throw St;return St}function Vq(o){return Vt(o).toLowerCase()}function Gq(o){return Vt(o).toUpperCase()}function Jq(o,c,p){if(o=Vt(o),o&&(p||c===t))return kw(o);if(!o||!(c=ji(c)))return o;var I=Ln(o),T=Ln(c),F=Hw(I,T),Y=jw(I,T)+1;return yo(I,F,Y).join("")}function Yq(o,c,p){if(o=Vt(o),o&&(p||c===t))return o.slice(0,Kw(o)+1);if(!o||!(c=ji(c)))return o;var I=Ln(o),T=jw(I,Ln(c))+1;return yo(I,0,T).join("")}function Qq(o,c,p){if(o=Vt(o),o&&(p||c===t))return o.replace(nt,"");if(!o||!(c=ji(c)))return o;var I=Ln(o),T=Hw(I,Ln(c));return yo(I,T).join("")}function Zq(o,c){var p=ae,I=L;if(hr(c)){var T="separator"in c?c.separator:T;p="length"in c?At(c.length):p,I="omission"in c?ji(c.omission):I}o=Vt(o);var F=o.length;if(vc(o)){var Y=Ln(o);F=Y.length}if(p>=F)return o;var X=p-mc(I);if(X<1)return I;var se=Y?yo(Y,0,X).join(""):o.slice(0,X);if(T===t)return se+I;if(Y&&(X+=se.length-X),j1(T)){if(o.slice(X).search(T)){var ue,de=se;for(T.global||(T=o1(T.source,Vt(_t.exec(T))+"g")),T.lastIndex=0;ue=T.exec(de);)var ve=ue.index;se=se.slice(0,ve===t?X:ve)}}else if(o.indexOf(ji(T),X)!=X){var Se=se.lastIndexOf(T);Se>-1&&(se=se.slice(0,Se))}return se+I}function Xq(o){return o=Vt(o),o&&rt.test(o)?o.replace(Ot,C$):o}var ez=Ac(function(o,c,p){return o+(p?" ":"")+c.toUpperCase()}),V1=Ny("toUpperCase");function R6(o,c,p){return o=Vt(o),c=p?t:c,c===t?E$(o)?O$(o):p$(o):o.match(c)||[]}var T6=Mt(function(o,c){try{return Fr(o,t,c)}catch(p){return H1(p)?p:new gt(p)}}),tz=Ns(function(o,c){return un(c,function(p){p=us(p),Rs(o,p,z1(o[p],o))}),o});function rz(o){var c=o==null?0:o.length,p=ot();return o=c?cr(o,function(I){if(typeof I[1]!="function")throw new dn(a);return[p(I[0]),I[1]]}):[],Mt(function(I){for(var T=-1;++T<c;){var F=o[T];if(Fr(F[0],this,I))return Fr(F[1],this,I)}})}function iz(o){return CL(gn(o,w))}function G1(o){return function(){return o}}function nz(o,c){return o==null||o!==o?c:o}var sz=Ly(),oz=Ly(!0);function Di(o){return o}function J1(o){return uy(typeof o=="function"?o:gn(o,w))}function az(o){return py(gn(o,w))}function cz(o,c){return gy(o,gn(c,w))}var fz=Mt(function(o,c){return function(p){return Kf(p,o,c)}}),lz=Mt(function(o,c){return function(p){return Kf(o,p,c)}});function Y1(o,c,p){var I=qr(c),T=Eu(c,I);p==null&&!(hr(c)&&(T.length||!I.length))&&(p=c,c=o,o=this,T=Eu(c,qr(c)));var F=!(hr(p)&&"chain"in p)||!!p.chain,Y=Ls(o);return un(T,function(X){var se=c[X];o[X]=se,Y&&(o.prototype[X]=function(){var ue=this.__chain__;if(F||ue){var de=o(this.__wrapped__),ve=de.__actions__=Mi(this.__actions__);return ve.push({func:se,args:arguments,thisArg:o}),de.__chain__=ue,de}return se.apply(o,po([this.value()],arguments))})}),o}function hz(){return Bt._===this&&(Bt._=B$),this}function Q1(){}function uz(o){return o=At(o),Mt(function(c){return vy(c,o)})}var dz=C1(cr),pz=C1(Bw),gz=C1(Xp);function N6(o){return $1(o)?e1(us(o)):WL(o)}function vz(o){return function(c){return o==null?t:pa(o,c)}}var mz=Uy(),bz=Uy(!0);function Z1(){return[]}function X1(){return!1}function wz(){return{}}function yz(){return""}function _z(){return!0}function xz(o,c){if(o=At(o),o<1||o>D)return[];var p=x,I=ri(o,x);c=ot(c),o-=x;for(var T=i1(I,c);++p<o;)c(p);return T}function Ez(o){return wt(o)?cr(o,us):Wi(o)?[o]:Mi(e6(Vt(o)))}function Az(o){var c=++$$;return Vt(o)+c}var Sz=Pu(function(o,c){return o+c},0),Iz=P1("ceil"),Mz=Pu(function(o,c){return o/c},1),Cz=P1("floor");function Pz(o){return o&&o.length?xu(o,Di,p1):t}function Dz(o,c){return o&&o.length?xu(o,ot(c,2),p1):t}function Oz(o){return qw(o,Di)}function Rz(o,c){return qw(o,ot(c,2))}function Tz(o){return o&&o.length?xu(o,Di,b1):t}function Nz(o,c){return o&&o.length?xu(o,ot(c,2),b1):t}var $z=Pu(function(o,c){return o*c},1),Lz=P1("round"),Bz=Pu(function(o,c){return o-c},0);function Uz(o){return o&&o.length?r1(o,Di):0}function Fz(o,c){return o&&o.length?r1(o,ot(c,2)):0}return B.after=aF,B.ary=h6,B.assign=GF,B.assignIn=S6,B.assignInWith=ku,B.assignWith=JF,B.at=YF,B.before=u6,B.bind=z1,B.bindAll=tz,B.bindKey=d6,B.castArray=wF,B.chain=c6,B.chunk=CB,B.compact=PB,B.concat=DB,B.cond=rz,B.conforms=iz,B.constant=G1,B.countBy=UU,B.create=QF,B.curry=p6,B.curryRight=g6,B.debounce=v6,B.defaults=ZF,B.defaultsDeep=XF,B.defer=cF,B.delay=fF,B.difference=OB,B.differenceBy=RB,B.differenceWith=TB,B.drop=NB,B.dropRight=$B,B.dropRightWhile=LB,B.dropWhile=BB,B.fill=UB,B.filter=qU,B.flatMap=HU,B.flatMapDeep=jU,B.flatMapDepth=WU,B.flatten=n6,B.flattenDeep=FB,B.flattenDepth=qB,B.flip=lF,B.flow=sz,B.flowRight=oz,B.fromPairs=zB,B.functions=oq,B.functionsIn=aq,B.groupBy=KU,B.initial=HB,B.intersection=jB,B.intersectionBy=WB,B.intersectionWith=KB,B.invert=fq,B.invertBy=lq,B.invokeMap=GU,B.iteratee=J1,B.keyBy=JU,B.keys=qr,B.keysIn=Pi,B.map=Lu,B.mapKeys=uq,B.mapValues=dq,B.matches=az,B.matchesProperty=cz,B.memoize=Uu,B.merge=pq,B.mergeWith=I6,B.method=fz,B.methodOf=lz,B.mixin=Y1,B.negate=Fu,B.nthArg=uz,B.omit=gq,B.omitBy=vq,B.once=hF,B.orderBy=YU,B.over=dz,B.overArgs=uF,B.overEvery=pz,B.overSome=gz,B.partial=k1,B.partialRight=m6,B.partition=QU,B.pick=mq,B.pickBy=M6,B.property=N6,B.propertyOf=vz,B.pull=YB,B.pullAll=o6,B.pullAllBy=QB,B.pullAllWith=ZB,B.pullAt=XB,B.range=mz,B.rangeRight=bz,B.rearg=dF,B.reject=eF,B.remove=eU,B.rest=pF,B.reverse=F1,B.sampleSize=rF,B.set=wq,B.setWith=yq,B.shuffle=iF,B.slice=tU,B.sortBy=oF,B.sortedUniq=cU,B.sortedUniqBy=fU,B.split=Hq,B.spread=gF,B.tail=lU,B.take=hU,B.takeRight=uU,B.takeRightWhile=dU,B.takeWhile=pU,B.tap=PU,B.throttle=vF,B.thru=$u,B.toArray=x6,B.toPairs=C6,B.toPairsIn=P6,B.toPath=Ez,B.toPlainObject=A6,B.transform=_q,B.unary=mF,B.union=gU,B.unionBy=vU,B.unionWith=mU,B.uniq=bU,B.uniqBy=wU,B.uniqWith=yU,B.unset=xq,B.unzip=q1,B.unzipWith=a6,B.update=Eq,B.updateWith=Aq,B.values=Mc,B.valuesIn=Sq,B.without=_U,B.words=R6,B.wrap=bF,B.xor=xU,B.xorBy=EU,B.xorWith=AU,B.zip=SU,B.zipObject=IU,B.zipObjectDeep=MU,B.zipWith=CU,B.entries=C6,B.entriesIn=P6,B.extend=S6,B.extendWith=ku,Y1(B,B),B.add=Sz,B.attempt=T6,B.camelCase=Pq,B.capitalize=D6,B.ceil=Iz,B.clamp=Iq,B.clone=yF,B.cloneDeep=xF,B.cloneDeepWith=EF,B.cloneWith=_F,B.conformsTo=AF,B.deburr=O6,B.defaultTo=nz,B.divide=Mz,B.endsWith=Dq,B.eq=Un,B.escape=Oq,B.escapeRegExp=Rq,B.every=FU,B.find=zU,B.findIndex=r6,B.findKey=eq,B.findLast=kU,B.findLastIndex=i6,B.findLastKey=tq,B.floor=Cz,B.forEach=f6,B.forEachRight=l6,B.forIn=rq,B.forInRight=iq,B.forOwn=nq,B.forOwnRight=sq,B.get=W1,B.gt=SF,B.gte=IF,B.has=cq,B.hasIn=K1,B.head=s6,B.identity=Di,B.includes=VU,B.indexOf=kB,B.inRange=Mq,B.invoke=hq,B.isArguments=ma,B.isArray=wt,B.isArrayBuffer=MF,B.isArrayLike=Ci,B.isArrayLikeObject=xr,B.isBoolean=CF,B.isBuffer=_o,B.isDate=PF,B.isElement=DF,B.isEmpty=OF,B.isEqual=RF,B.isEqualWith=TF,B.isError=H1,B.isFinite=NF,B.isFunction=Ls,B.isInteger=b6,B.isLength=qu,B.isMap=w6,B.isMatch=$F,B.isMatchWith=LF,B.isNaN=BF,B.isNative=UF,B.isNil=qF,B.isNull=FF,B.isNumber=y6,B.isObject=hr,B.isObjectLike=mr,B.isPlainObject=Zf,B.isRegExp=j1,B.isSafeInteger=zF,B.isSet=_6,B.isString=zu,B.isSymbol=Wi,B.isTypedArray=Ic,B.isUndefined=kF,B.isWeakMap=HF,B.isWeakSet=jF,B.join=VB,B.kebabCase=Tq,B.last=mn,B.lastIndexOf=GB,B.lowerCase=Nq,B.lowerFirst=$q,B.lt=WF,B.lte=KF,B.max=Pz,B.maxBy=Dz,B.mean=Oz,B.meanBy=Rz,B.min=Tz,B.minBy=Nz,B.stubArray=Z1,B.stubFalse=X1,B.stubObject=wz,B.stubString=yz,B.stubTrue=_z,B.multiply=$z,B.nth=JB,B.noConflict=hz,B.noop=Q1,B.now=Bu,B.pad=Lq,B.padEnd=Bq,B.padStart=Uq,B.parseInt=Fq,B.random=Cq,B.reduce=ZU,B.reduceRight=XU,B.repeat=qq,B.replace=zq,B.result=bq,B.round=Lz,B.runInContext=ie,B.sample=tF,B.size=nF,B.snakeCase=kq,B.some=sF,B.sortedIndex=rU,B.sortedIndexBy=iU,B.sortedIndexOf=nU,B.sortedLastIndex=sU,B.sortedLastIndexBy=oU,B.sortedLastIndexOf=aU,B.startCase=jq,B.startsWith=Wq,B.subtract=Bz,B.sum=Uz,B.sumBy=Fz,B.template=Kq,B.times=xz,B.toFinite=Bs,B.toInteger=At,B.toLength=E6,B.toLower=Vq,B.toNumber=bn,B.toSafeInteger=VF,B.toString=Vt,B.toUpper=Gq,B.trim=Jq,B.trimEnd=Yq,B.trimStart=Qq,B.truncate=Zq,B.unescape=Xq,B.uniqueId=Az,B.upperCase=ez,B.upperFirst=V1,B.each=f6,B.eachRight=l6,B.first=s6,Y1(B,function(){var o={};return ls(B,function(c,p){Jt.call(B.prototype,p)||(o[p]=c)}),o}(),{chain:!1}),B.VERSION=i,un(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){B[o].placeholder=B}),un(["drop","take"],function(o,c){$t.prototype[o]=function(p){p=p===t?1:Dr(At(p),0);var I=this.__filtered__&&!c?new $t(this):this.clone();return I.__filtered__?I.__takeCount__=ri(p,I.__takeCount__):I.__views__.push({size:ri(p,x),type:o+(I.__dir__<0?"Right":"")}),I},$t.prototype[o+"Right"]=function(p){return this.reverse()[o](p).reverse()}}),un(["filter","map","takeWhile"],function(o,c){var p=c+1,I=p==l||p==y;$t.prototype[o]=function(T){var F=this.clone();return F.__iteratees__.push({iteratee:ot(T,3),type:p}),F.__filtered__=F.__filtered__||I,F}}),un(["head","last"],function(o,c){var p="take"+(c?"Right":"");$t.prototype[o]=function(){return this[p](1).value()[0]}}),un(["initial","tail"],function(o,c){var p="drop"+(c?"":"Right");$t.prototype[o]=function(){return this.__filtered__?new $t(this):this[p](1)}}),$t.prototype.compact=function(){return this.filter(Di)},$t.prototype.find=function(o){return this.filter(o).head()},$t.prototype.findLast=function(o){return this.reverse().find(o)},$t.prototype.invokeMap=Mt(function(o,c){return typeof o=="function"?new $t(this):this.map(function(p){return Kf(p,o,c)})}),$t.prototype.reject=function(o){return this.filter(Fu(ot(o)))},$t.prototype.slice=function(o,c){o=At(o);var p=this;return p.__filtered__&&(o>0||c<0)?new $t(p):(o<0?p=p.takeRight(-o):o&&(p=p.drop(o)),c!==t&&(c=At(c),p=c<0?p.dropRight(-c):p.take(c-o)),p)},$t.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},$t.prototype.toArray=function(){return this.take(x)},ls($t.prototype,function(o,c){var p=/^(?:filter|find|map|reject)|While$/.test(c),I=/^(?:head|last)$/.test(c),T=B[I?"take"+(c=="last"?"Right":""):c],F=I||/^find/.test(c);T&&(B.prototype[c]=function(){var Y=this.__wrapped__,X=I?[1]:arguments,se=Y instanceof $t,ue=X[0],de=se||wt(Y),ve=function(Rt){var Ut=T.apply(B,po([Rt],X));return I&&Se?Ut[0]:Ut};de&&p&&typeof ue=="function"&&ue.length!=1&&(se=de=!1);var Se=this.__chain__,Ye=!!this.__actions__.length,ct=F&&!Se,St=se&&!Ye;if(!F&&de){Y=St?Y:new $t(this);var ft=o.apply(Y,X);return ft.__actions__.push({func:$u,args:[ve],thisArg:t}),new pn(ft,Se)}return ct&&St?o.apply(this,X):(ft=this.thru(ve),ct?I?ft.value()[0]:ft.value():ft)})}),un(["pop","push","shift","sort","splice","unshift"],function(o){var c=au[o],p=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",I=/^(?:pop|shift)$/.test(o);B.prototype[o]=function(){var T=arguments;if(I&&!this.__chain__){var F=this.value();return c.apply(wt(F)?F:[],T)}return this[p](function(Y){return c.apply(wt(Y)?Y:[],T)})}}),ls($t.prototype,function(o,c){var p=B[c];if(p){var I=p.name+"";Jt.call(_c,I)||(_c[I]=[]),_c[I].push({name:c,func:p})}}),_c[Cu(t,U).name]=[{name:"wrapper",func:t}],$t.prototype.clone=X$,$t.prototype.reverse=eL,$t.prototype.value=tL,B.prototype.at=DU,B.prototype.chain=OU,B.prototype.commit=RU,B.prototype.next=TU,B.prototype.plant=$U,B.prototype.reverse=LU,B.prototype.toJSON=B.prototype.valueOf=B.prototype.value=BU,B.prototype.first=B.prototype.head,Ff&&(B.prototype[Ff]=NU),B},bc=R$();_r?((_r.exports=bc)._=bc,er._=bc):Bt._=bc}).call(fr)})(C0,C0.exports);var P0={exports:{}};(function(r,e){var t=typeof self<"u"?self:fr,i=function(){function s(){this.fetch=!1,this.DOMException=t.DOMException}return s.prototype=t,new s}();(function(s){(function(a){var f={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(l){return l&&DataView.prototype.isPrototypeOf(l)}if(f.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],g=ArrayBuffer.isView||function(l){return l&&u.indexOf(Object.prototype.toString.call(l))>-1};function w(l){if(typeof l!="string"&&(l=String(l)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(l))throw new TypeError("Invalid character in header field name");return l.toLowerCase()}function M(l){return typeof l!="string"&&(l=String(l)),l}function P(l){var d={next:function(){var y=l.shift();return{done:y===void 0,value:y}}};return f.iterable&&(d[Symbol.iterator]=function(){return d}),d}function O(l){this.map={},l instanceof O?l.forEach(function(d,y){this.append(y,d)},this):Array.isArray(l)?l.forEach(function(d){this.append(d[0],d[1])},this):l&&Object.getOwnPropertyNames(l).forEach(function(d){this.append(d,l[d])},this)}O.prototype.append=function(l,d){l=w(l),d=M(d);var y=this.map[l];this.map[l]=y?y+", "+d:d},O.prototype.delete=function(l){delete this.map[w(l)]},O.prototype.get=function(l){return l=w(l),this.has(l)?this.map[l]:null},O.prototype.has=function(l){return this.map.hasOwnProperty(w(l))},O.prototype.set=function(l,d){this.map[w(l)]=M(d)},O.prototype.forEach=function(l,d){for(var y in this.map)this.map.hasOwnProperty(y)&&l.call(d,this.map[y],y,this)},O.prototype.keys=function(){var l=[];return this.forEach(function(d,y){l.push(y)}),P(l)},O.prototype.values=function(){var l=[];return this.forEach(function(d){l.push(d)}),P(l)},O.prototype.entries=function(){var l=[];return this.forEach(function(d,y){l.push([y,d])}),P(l)},f.iterable&&(O.prototype[Symbol.iterator]=O.prototype.entries);function $(l){if(l.bodyUsed)return Promise.reject(new TypeError("Already read"));l.bodyUsed=!0}function q(l){return new Promise(function(d,y){l.onload=function(){d(l.result)},l.onerror=function(){y(l.error)}})}function U(l){var d=new FileReader,y=q(d);return d.readAsArrayBuffer(l),y}function J(l){var d=new FileReader,y=q(d);return d.readAsText(l),y}function ee(l){for(var d=new Uint8Array(l),y=new Array(d.length),C=0;C<d.length;C++)y[C]=String.fromCharCode(d[C]);return y.join("")}function W(l){if(l.slice)return l.slice(0);var d=new Uint8Array(l.byteLength);return d.set(new Uint8Array(l)),d.buffer}function G(){return this.bodyUsed=!1,this._initBody=function(l){this._bodyInit=l,l?typeof l=="string"?this._bodyText=l:f.blob&&Blob.prototype.isPrototypeOf(l)?this._bodyBlob=l:f.formData&&FormData.prototype.isPrototypeOf(l)?this._bodyFormData=l:f.searchParams&&URLSearchParams.prototype.isPrototypeOf(l)?this._bodyText=l.toString():f.arrayBuffer&&f.blob&&h(l)?(this._bodyArrayBuffer=W(l.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):f.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(l)||g(l))?this._bodyArrayBuffer=W(l):this._bodyText=l=Object.prototype.toString.call(l):this._bodyText="",this.headers.get("content-type")||(typeof l=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):f.searchParams&&URLSearchParams.prototype.isPrototypeOf(l)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},f.blob&&(this.blob=function(){var l=$(this);if(l)return l;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?$(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(U)}),this.text=function(){var l=$(this);if(l)return l;if(this._bodyBlob)return J(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(ee(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},f.formData&&(this.formData=function(){return this.text().then(te)}),this.json=function(){return this.text().then(JSON.parse)},this}var Q=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function A(l){var d=l.toUpperCase();return Q.indexOf(d)>-1?d:l}function z(l,d){d=d||{};var y=d.body;if(l instanceof z){if(l.bodyUsed)throw new TypeError("Already read");this.url=l.url,this.credentials=l.credentials,d.headers||(this.headers=new O(l.headers)),this.method=l.method,this.mode=l.mode,this.signal=l.signal,!y&&l._bodyInit!=null&&(y=l._bodyInit,l.bodyUsed=!0)}else this.url=String(l);if(this.credentials=d.credentials||this.credentials||"same-origin",(d.headers||!this.headers)&&(this.headers=new O(d.headers)),this.method=A(d.method||this.method||"GET"),this.mode=d.mode||this.mode||null,this.signal=d.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&y)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(y)}z.prototype.clone=function(){return new z(this,{body:this._bodyInit})};function te(l){var d=new FormData;return l.trim().split("&").forEach(function(y){if(y){var C=y.split("="),D=C.shift().replace(/\+/g," "),S=C.join("=").replace(/\+/g," ");d.append(decodeURIComponent(D),decodeURIComponent(S))}}),d}function ae(l){var d=new O,y=l.replace(/\r?\n[\t ]+/g," ");return y.split(/\r?\n/).forEach(function(C){var D=C.split(":"),S=D.shift().trim();if(S){var v=D.join(":").trim();d.append(S,v)}}),d}G.call(z.prototype);function L(l,d){d||(d={}),this.type="default",this.status=d.status===void 0?200:d.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in d?d.statusText:"OK",this.headers=new O(d.headers),this.url=d.url||"",this._initBody(l)}G.call(L.prototype),L.prototype.clone=function(){return new L(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new O(this.headers),url:this.url})},L.error=function(){var l=new L(null,{status:0,statusText:""});return l.type="error",l};var b=[301,302,303,307,308];L.redirect=function(l,d){if(b.indexOf(d)===-1)throw new RangeError("Invalid status code");return new L(null,{status:d,headers:{location:l}})},a.DOMException=s.DOMException;try{new a.DOMException}catch{a.DOMException=function(d,y){this.message=d,this.name=y;var C=Error(d);this.stack=C.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function m(l,d){return new Promise(function(y,C){var D=new z(l,d);if(D.signal&&D.signal.aborted)return C(new a.DOMException("Aborted","AbortError"));var S=new XMLHttpRequest;function v(){S.abort()}S.onload=function(){var x={status:S.status,statusText:S.statusText,headers:ae(S.getAllResponseHeaders()||"")};x.url="responseURL"in S?S.responseURL:x.headers.get("X-Request-URL");var _="response"in S?S.response:S.responseText;y(new L(_,x))},S.onerror=function(){C(new TypeError("Network request failed"))},S.ontimeout=function(){C(new TypeError("Network request failed"))},S.onabort=function(){C(new a.DOMException("Aborted","AbortError"))},S.open(D.method,D.url,!0),D.credentials==="include"?S.withCredentials=!0:D.credentials==="omit"&&(S.withCredentials=!1),"responseType"in S&&f.blob&&(S.responseType="blob"),D.headers.forEach(function(x,_){S.setRequestHeader(_,x)}),D.signal&&(D.signal.addEventListener("abort",v),S.onreadystatechange=function(){S.readyState===4&&D.signal.removeEventListener("abort",v)}),S.send(typeof D._bodyInit>"u"?null:D._bodyInit)})}return m.polyfill=!0,s.fetch||(s.fetch=m,s.Headers=O,s.Request=z,s.Response=L),a.Headers=O,a.Request=z,a.Response=L,a.fetch=m,Object.defineProperty(a,"__esModule",{value:!0}),a})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var n=i;e=n.fetch,e.default=n.fetch,e.fetch=n.fetch,e.Headers=n.Headers,e.Request=n.Request,e.Response=n.Response,r.exports=e})(P0,P0.exports);var z2=L6(P0.exports),NP=Object.defineProperty,$P=Object.defineProperties,LP=Object.getOwnPropertyDescriptors,k2=Object.getOwnPropertySymbols,BP=Object.prototype.hasOwnProperty,UP=Object.prototype.propertyIsEnumerable,H2=(r,e,t)=>e in r?NP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,j2=(r,e)=>{for(var t in e||(e={}))BP.call(e,t)&&H2(r,t,e[t]);if(k2)for(var t of k2(e))UP.call(e,t)&&H2(r,t,e[t]);return r},W2=(r,e)=>$P(r,LP(e));const FP={Accept:"application/json","Content-Type":"application/json"},qP="POST",K2={headers:FP,method:qP},V2=10;class Cn{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new zr.exports.EventEmitter,this.isAvailable=!1,this.registering=!1,!qb(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const t=bs(e),i=await(await z2(this.url,W2(j2({},K2),{body:t}))).json();this.onPayload({data:i})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!qb(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,n)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),n(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return n(new Error("HTTP connection is missing or invalid"));i()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const t=bs({id:1,jsonrpc:"2.0",method:"test",params:[]});await z2(e,W2(j2({},K2),{body:t}))}this.onOpen()}catch(t){const i=this.parseError(t);throw this.events.emit("register_error",i),this.onClose(),i}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?Ro(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const i=this.parseError(t),n=i.message||i.toString(),s=ih(e,n);this.events.emit("payload",s)}parseError(e,t=this.url){return Nb(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>V2&&this.events.setMaxListeners(V2)}}const G2="error",zP="wss://relay.walletconnect.org",kP="wc",HP="universal_provider",J2=`${kP}@2:${HP}:`,Y2="https://rpc.walletconnect.org/v1/",Ka="generic",jP=`${Y2}bundler`,an={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var WP=Object.defineProperty,KP=Object.defineProperties,VP=Object.getOwnPropertyDescriptors,Q2=Object.getOwnPropertySymbols,GP=Object.prototype.hasOwnProperty,JP=Object.prototype.propertyIsEnumerable,Z2=(r,e,t)=>e in r?WP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,fh=(r,e)=>{for(var t in e||(e={}))GP.call(e,t)&&Z2(r,t,e[t]);if(Q2)for(var t of Q2(e))JP.call(e,t)&&Z2(r,t,e[t]);return r},YP=(r,e)=>KP(r,VP(e));function Fi(r,e,t){var i;const n=qa(r);return((i=e.rpcMap)==null?void 0:i[n.reference])||`${Y2}?chainId=${n.namespace}:${n.reference}&projectId=${t}`}function jo(r){return r.includes(":")?r.split(":")[1]:r}function X2(r){return r.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function QP(r,e){const t=Object.keys(e.namespaces).filter(n=>n.includes(r));if(!t.length)return[];const i=[];return t.forEach(n=>{const s=e.namespaces[n].accounts;i.push(...s)}),i}function D0(r={},e={}){const t=e3(r),i=e3(e);return C0.exports.merge(t,i)}function e3(r){var e,t,i,n;const s={};if(!ef(r))return s;for(const[a,f]of Object.entries(r)){const h=e0(a)?[a]:f.chains,u=f.methods||[],g=f.events||[],w=f.rpcMap||{},M=Xc(a);s[M]=YP(fh(fh({},s[M]),f),{chains:ql(h,(e=s[M])==null?void 0:e.chains),methods:ql(u,(t=s[M])==null?void 0:t.methods),events:ql(g,(i=s[M])==null?void 0:i.events),rpcMap:fh(fh({},w),(n=s[M])==null?void 0:n.rpcMap)})}return s}function ZP(r){return r.includes(":")?r.split(":")[2]:r}function t3(r){const e={};for(const[t,i]of Object.entries(r)){const n=i.methods||[],s=i.events||[],a=i.accounts||[],f=e0(t)?[t]:i.chains?i.chains:X2(i.accounts);e[t]={chains:f,methods:n,events:s,accounts:a}}return e}function O0(r){return typeof r=="number"?r:r.includes("0x")?parseInt(r,16):(r=r.includes(":")?r.split(":")[1]:r,isNaN(Number(r))?r:Number(r))}const r3={},zt=r=>r3[r],R0=(r,e)=>{r3[r]=e};class XP{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(an.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=jo(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Fi(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new nn(new Cn(i,zt("disableProviderPing")))}}var eD=Object.defineProperty,tD=Object.defineProperties,rD=Object.getOwnPropertyDescriptors,i3=Object.getOwnPropertySymbols,iD=Object.prototype.hasOwnProperty,nD=Object.prototype.propertyIsEnumerable,n3=(r,e,t)=>e in r?eD(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,s3=(r,e)=>{for(var t in e||(e={}))iD.call(e,t)&&n3(r,t,e[t]);if(i3)for(var t of i3(e))nD.call(e,t)&&n3(r,t,e[t]);return r},o3=(r,e)=>tD(r,rD(e));class sD{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(an.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const i=t||Fi(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new nn(new Cn(i,zt("disableProviderPing")))}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=parseInt(jo(t));e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,i;let n=e.request.params?(t=e.request.params[0])==null?void 0:t.chainId:"0x0";n=n.startsWith("0x")?n:`0x${n}`;const s=parseInt(n,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:n}]},chainId:(i=this.namespace.chains)==null?void 0:i[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var t,i,n;const s=(i=(t=e.request)==null?void 0:t.params)==null?void 0:i[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const a=this.client.session.get(e.topic),f=((n=a?.sessionProperties)==null?void 0:n.capabilities)||{};if(f!=null&&f[s])return f?.[s];const h=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:o3(s3({},a.sessionProperties||{}),{capabilities:o3(s3({},f||{}),{[s]:h})})})}catch(u){console.warn("Failed to update session with capabilities",u)}return h}async getCallStatus(e){var t,i;const n=this.client.session.get(e.topic),s=(t=n.sessionProperties)==null?void 0:t.bundler_name;if(s){const f=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(f,e)}catch(h){console.warn("Failed to fetch call status from bundler",h,f)}}const a=(i=n.sessionProperties)==null?void 0:i.bundler_url;if(a)try{return await this.getUserOperationReceipt(a,e)}catch(f){console.warn("Failed to fetch call status from custom bundler",f,a)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,t){var i;const n=new URL(e),s=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Qs("eth_getUserOperationReceipt",[(i=t.request.params)==null?void 0:i[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,t){return`${jP}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}class oD{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(an.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=jo(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Fi(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new nn(new Cn(i,zt("disableProviderPing")))}}class aD{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(an.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=jo(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Fi(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new nn(new Cn(i,zt("disableProviderPing")))}}class cD{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){const i=t||Fi(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.chainId=e,this.events.emit(an.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Fi(e,this.namespace,this.client.core.projectId);return typeof i>"u"?void 0:new nn(new Cn(i,zt("disableProviderPing")))}}class fD{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(an.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{const i=this.getCardanoRPCUrl(t),n=jo(t);e[n]=this.createHttpProvider(n,i)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||this.getCardanoRPCUrl(e);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new nn(new Cn(i,zt("disableProviderPing")))}}class lD{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(an.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=jo(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Fi(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new nn(new Cn(i,zt("disableProviderPing")))}}class hD{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(an.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=jo(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Fi(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new nn(new Cn(i,zt("disableProviderPing")))}}class uD{constructor(e){this.name="near",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const i=t||Fi(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(an.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Fi(e,this.namespace);return typeof i>"u"?void 0:new nn(new Cn(i,zt("disableProviderPing")))}}class dD{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const i=t||Fi(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(an.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{e[t]=this.createHttpProvider(t)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Fi(e,this.namespace);return typeof i>"u"?void 0:new nn(new Cn(i))}}class pD{constructor(e){this.name=Ka,this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(an.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){var e,t;const i={};return(t=(e=this.namespace)==null?void 0:e.accounts)==null||t.forEach(n=>{const s=qa(n);i[`${s.namespace}:${s.reference}`]=this.createHttpProvider(n)}),i}getHttpProvider(e){const t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Fi(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new nn(new Cn(i,zt("disableProviderPing")))}}var gD=Object.defineProperty,vD=Object.defineProperties,mD=Object.getOwnPropertyDescriptors,a3=Object.getOwnPropertySymbols,bD=Object.prototype.hasOwnProperty,wD=Object.prototype.propertyIsEnumerable,c3=(r,e,t)=>e in r?gD(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,lh=(r,e)=>{for(var t in e||(e={}))bD.call(e,t)&&c3(r,t,e[t]);if(a3)for(var t of a3(e))wD.call(e,t)&&c3(r,t,e[t]);return r},T0=(r,e)=>vD(r,mD(e));class N0{constructor(e){this.events=new zr.exports,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Zn(th({level:e?.logger||G2})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){const t=new N0(e);return await t.initialize(),t}async request(e,t,i){const[n,s]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:lh({},e),chainId:`${n}:${s}`,topic:this.session.topic,expiry:i})}sendAsync(e,t,i,n){const s=new Date().getTime();this.request(e,i,n).then(a=>t(null,rh(s,a))).catch(a=>t(a,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Gt("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:i,response:n}=await this.client.authenticate(e,t);i&&(this.uri=i,this.events.emit("display_uri",i));const s=await n();if(this.session=s.session,this.session){const a=t3(this.session.namespaces);this.namespaces=D0(this.namespaces,a),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:i,approval:n}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});i&&(this.uri=i,this.events.emit("display_uri",i)),await n().then(s=>{this.session=s;const a=t3(s.namespaces);this.namespaces=D0(this.namespaces,a),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==U2)throw s;t++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[i,n]=this.validateChain(e),s=this.getProvider(i);s.name===Ka?s.setDefaultChain(`${i}:${n}`,t):s.setDefaultChain(n,t)}catch(i){if(!/Please call connect/.test(i.message))throw i}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(_s(t)){for(const i of t)e.deletePairings?this.client.core.expirer.set(i.topic,0):await this.client.core.relayer.subscriber.unsubscribe(i.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await M0.init({core:this.providerOpts.core,logger:this.providerOpts.logger||G2,relayUrl:this.providerOpts.relayUrl||zP,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(t=>Xc(t)))];R0("client",this.client),R0("events",this.events),R0("disableProviderPing",this.disableProviderPing),e.forEach(t=>{if(!this.session)return;const i=QP(t,this.session),n=X2(i),s=D0(this.namespaces,this.optionalNamespaces),a=T0(lh({},s[t]),{accounts:i,chains:n});switch(t){case"eip155":this.rpcProviders[t]=new sD({namespace:a});break;case"algorand":this.rpcProviders[t]=new cD({namespace:a});break;case"solana":this.rpcProviders[t]=new oD({namespace:a});break;case"cosmos":this.rpcProviders[t]=new aD({namespace:a});break;case"polkadot":this.rpcProviders[t]=new XP({namespace:a});break;case"cip34":this.rpcProviders[t]=new fD({namespace:a});break;case"elrond":this.rpcProviders[t]=new lD({namespace:a});break;case"multiversx":this.rpcProviders[t]=new hD({namespace:a});break;case"near":this.rpcProviders[t]=new uD({namespace:a});break;case"tezos":this.rpcProviders[t]=new dD({namespace:a});break;default:this.rpcProviders[Ka]?this.rpcProviders[Ka].updateNamespace(a):this.rpcProviders[Ka]=new pD({namespace:a})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:t}=e,{event:i}=t;if(i.name==="accountsChanged"){const n=i.data;n&&_s(n)&&this.events.emit("accountsChanged",n.map(ZP))}else if(i.name==="chainChanged"){const n=t.chainId,s=t.event.data,a=Xc(n),f=O0(n)!==O0(s)?`${a}:${O0(s)}`:n;this.onChainChanged(f)}else this.events.emit(i.name,i.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var i;const{namespaces:n}=t,s=(i=this.client)==null?void 0:i.session.get(e);this.session=T0(lh({},s),{namespaces:n}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",T0(lh({},Gt("USER_DISCONNECTED")),{data:e.topic}))}),this.on(an.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Ka]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace((t=this.session)==null?void 0:t.namespaces[e])})}setNamespaces(e){const{namespaces:t,optionalNamespaces:i,sessionProperties:n}=e;t&&Object.keys(t).length&&(this.namespaces=t),i&&Object.keys(i).length&&(this.optionalNamespaces=i),this.sessionProperties=n,this.persist("namespaces",t),this.persist("optionalNamespaces",i)}validateChain(e){const[t,i]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,i];if(t&&!Object.keys(this.namespaces||{}).map(a=>Xc(a)).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&i)return[t,i];const n=Xc(Object.keys(this.namespaces)[0]),s=this.rpcProviders[n].getDefaultChain();return[n,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){if(!this.namespaces)return;const[i,n]=this.validateChain(e);n&&(t||this.getProvider(i).setDefaultChain(n),this.namespaces[i]?this.namespaces[i].defaultChain=n:this.namespaces[`${i}:${n}`]?this.namespaces[`${i}:${n}`].defaultChain=n:this.namespaces[`${i}:${n}`]={defaultChain:n},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",n))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`${J2}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${J2}/${e}`)}}const yD=N0,_D="wc",xD="ethereum_provider",ED=`${_D}@2:${xD}:`,AD="https://rpc.walletconnect.org/v1/",hh=["eth_sendTransaction","personal_sign"],f3=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],uh=["chainChanged","accountsChanged"],l3=["chainChanged","accountsChanged","message","disconnect","connect"];var SD=Object.defineProperty,ID=Object.defineProperties,MD=Object.getOwnPropertyDescriptors,h3=Object.getOwnPropertySymbols,CD=Object.prototype.hasOwnProperty,PD=Object.prototype.propertyIsEnumerable,u3=(r,e,t)=>e in r?SD(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Va=(r,e)=>{for(var t in e||(e={}))CD.call(e,t)&&u3(r,t,e[t]);if(h3)for(var t of h3(e))PD.call(e,t)&&u3(r,t,e[t]);return r},$0=(r,e)=>ID(r,MD(e));function dh(r){return Number(r[0].split(":")[1])}function ph(r){return`0x${r.toString(16)}`}function DD(r){const{chains:e,optionalChains:t,methods:i,optionalMethods:n,events:s,optionalEvents:a,rpcMap:f}=r;if(!_s(e))throw new Error("Invalid chains");const h={chains:e,methods:i||hh,events:s||uh,rpcMap:Va({},e.length?{[dh(e)]:f[dh(e)]}:{})},u=s?.filter(P=>!uh.includes(P)),g=i?.filter(P=>!hh.includes(P));if(!t&&!a&&!n&&!(u!=null&&u.length)&&!(g!=null&&g.length))return{required:e.length?h:void 0};const w=u?.length&&g?.length||!t,M={chains:[...new Set(w?h.chains.concat(t||[]):t)],methods:[...new Set(h.methods.concat(n!=null&&n.length?n:f3))],events:[...new Set(h.events.concat(a!=null&&a.length?a:l3))],rpcMap:f};return{required:e.length?h:void 0,optional:t.length?M:void 0}}class gh{constructor(){this.events=new zr.exports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=ED,this.on=(e,t)=>(this.events.on(e,t),this),this.once=(e,t)=>(this.events.once(e,t),this),this.removeListener=(e,t)=>(this.events.removeListener(e,t),this),this.off=(e,t)=>(this.events.off(e,t),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const t=new gh;return await t.initialize(e),t}async request(e,t){return await this.signer.request(e,this.formatChainId(this.chainId),t)}sendAsync(e,t,i){this.signer.sendAsync(e,t,this.formatChainId(this.chainId),i)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:t,optional:i}=DD(this.rpc);try{const n=await new Promise(async(a,f)=>{var h;this.rpc.showQrModal&&((h=this.modal)==null||h.subscribeModal(u=>{!u.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.connect($0(Va({namespaces:Va({},t&&{[this.namespace]:t})},i&&{optionalNamespaces:{[this.namespace]:i}}),{pairingTopic:e?.pairingTopic})).then(u=>{a(u)}).catch(u=>{f(new Error(u.message))})});if(!n)return;const s=Rm(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:ph(this.chainId)})}catch(n){throw this.signer.logger.error(n),n}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e?.chains});try{const i=await new Promise(async(s,a)=>{var f;this.rpc.showQrModal&&((f=this.modal)==null||f.subscribeModal(h=>{!h.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate($0(Va({},e),{chains:this.rpc.chains}),t).then(h=>{s(h)}).catch(h=>{a(new Error(h.message))})}),n=i.session;if(n){const s=Rm(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:ph(this.chainId)})}return i}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:t}=e,{event:i}=t;i.name==="accountsChanged"?(this.accounts=this.parseAccounts(i.data),this.events.emit("accountsChanged",this.accounts)):i.name==="chainChanged"?this.setChainId(this.formatChainId(i.data)):this.events.emit(i.name,i.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",ph(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",$0(Va({},Gt("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var t,i;this.rpc.showQrModal&&((t=this.modal)==null||t.closeModal(),(i=this.modal)==null||i.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const t=e.filter(i=>this.isCompatibleChainId(i)).map(i=>this.parseChainId(i));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",ph(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){const[t,i,n]=e.split(":");return{chainId:`${t}:${i}`,address:n}}setAccounts(e){this.accounts=e.filter(t=>this.parseChainId(this.parseAccountId(t).chainId)===this.chainId).map(t=>this.parseAccountId(t).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t,i;const n=(t=e?.chains)!=null?t:[],s=(i=e?.optionalChains)!=null?i:[],a=n.concat(s);if(!a.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const f=n.length?e?.methods||hh:[],h=n.length?e?.events||uh:[],u=e?.optionalMethods||[],g=e?.optionalEvents||[],w=e?.rpcMap||this.buildRpcMap(a,e.projectId),M=e?.qrModalOptions||void 0;return{chains:n?.map(P=>this.formatChainId(P)),optionalChains:s.map(P=>this.formatChainId(P)),methods:f,events:h,optionalMethods:u,optionalEvents:g,rpcMap:w,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:M,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const i={};return e.forEach(n=>{i[n]=this.getRpcUrl(n,t)}),i}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?dh(this.rpc.chains):dh(this.rpc.optionalChains),this.signer=await yD.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled,logger:e.logger}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let t;try{const{WalletConnectModal:i}=await Promise.resolve().then(function(){return XD});t=i}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(Va({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(i){throw this.signer.logger.error(i),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:t,optionalChains:i,rpcMap:n}=e;t&&_s(t)&&(this.rpc.chains=t.map(s=>this.formatChainId(s)),t.forEach(s=>{this.rpc.rpcMap[s]=n?.[s]||this.getRpcUrl(s)})),i&&_s(i)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=i?.map(s=>this.formatChainId(s)),i.forEach(s=>{this.rpc.rpcMap[s]=n?.[s]||this.getRpcUrl(s)}))}getRpcUrl(e,t){var i;return((i=this.rpc.rpcMap)==null?void 0:i[e])||`${AD}?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:t?.accounts),this.setAccounts(t?.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(t=>this.signer.logger.warn(t))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(t=>this.parseAccount(t))}}const OD=gh,RD=Symbol(),d3=Object.getPrototypeOf,L0=new WeakMap,TD=r=>r&&(L0.has(r)?L0.get(r):d3(r)===Object.prototype||d3(r)===Array.prototype),ND=r=>TD(r)&&r[RD]||null,p3=(r,e=!0)=>{L0.set(r,e)},B0=r=>typeof r=="object"&&r!==null,Zs=new WeakMap,vh=new WeakSet,$D=(r=Object.is,e=(u,g)=>new Proxy(u,g),t=u=>B0(u)&&!vh.has(u)&&(Array.isArray(u)||!(Symbol.iterator in u))&&!(u instanceof WeakMap)&&!(u instanceof WeakSet)&&!(u instanceof Error)&&!(u instanceof Number)&&!(u instanceof Date)&&!(u instanceof String)&&!(u instanceof RegExp)&&!(u instanceof ArrayBuffer),i=u=>{switch(u.status){case"fulfilled":return u.value;case"rejected":throw u.reason;default:throw u}},n=new WeakMap,s=(u,g,w=i)=>{const M=n.get(u);if(M?.[0]===g)return M[1];const P=Array.isArray(u)?[]:Object.create(Object.getPrototypeOf(u));return p3(P,!0),n.set(u,[g,P]),Reflect.ownKeys(u).forEach(O=>{if(Object.getOwnPropertyDescriptor(P,O))return;const $=Reflect.get(u,O),q={value:$,enumerable:!0,configurable:!0};if(vh.has($))p3($,!1);else if($ instanceof Promise)delete q.value,q.get=()=>w($);else if(Zs.has($)){const[U,J]=Zs.get($);q.value=s(U,J(),w)}Object.defineProperty(P,O,q)}),Object.preventExtensions(P)},a=new WeakMap,f=[1,1],h=u=>{if(!B0(u))throw new Error("object required");const g=a.get(u);if(g)return g;let w=f[0];const M=new Set,P=(te,ae=++f[0])=>{w!==ae&&(w=ae,M.forEach(L=>L(te,ae)))};let O=f[1];const $=(te=++f[1])=>(O!==te&&!M.size&&(O=te,U.forEach(([ae])=>{const L=ae[1](te);L>w&&(w=L)})),w),q=te=>(ae,L)=>{const b=[...ae];b[1]=[te,...b[1]],P(b,L)},U=new Map,J=(te,ae)=>{if(U.has(te))throw new Error("prop listener already exists");if(M.size){const L=ae[3](q(te));U.set(te,[ae,L])}else U.set(te,[ae])},ee=te=>{var ae;const L=U.get(te);L&&(U.delete(te),(ae=L[1])==null||ae.call(L))},W=te=>(M.add(te),M.size===1&&U.forEach(([L,b],m)=>{if(b)throw new Error("remove already exists");const l=L[3](q(m));U.set(m,[L,l])}),()=>{M.delete(te),M.size===0&&U.forEach(([L,b],m)=>{b&&(b(),U.set(m,[L]))})}),G=Array.isArray(u)?[]:Object.create(Object.getPrototypeOf(u)),A=e(G,{deleteProperty(te,ae){const L=Reflect.get(te,ae);ee(ae);const b=Reflect.deleteProperty(te,ae);return b&&P(["delete",[ae],L]),b},set(te,ae,L,b){const m=Reflect.has(te,ae),l=Reflect.get(te,ae,b);if(m&&(r(l,L)||a.has(L)&&r(l,a.get(L))))return!0;ee(ae),B0(L)&&(L=ND(L)||L);let d=L;if(L instanceof Promise)L.then(y=>{L.status="fulfilled",L.value=y,P(["resolve",[ae],y])}).catch(y=>{L.status="rejected",L.reason=y,P(["reject",[ae],y])});else{!Zs.has(L)&&t(L)&&(d=h(L));const y=!vh.has(d)&&Zs.get(d);y&&J(ae,y)}return Reflect.set(te,ae,d,b),P(["set",[ae],L,l]),!0}});a.set(u,A);const z=[G,$,s,W];return Zs.set(A,z),Reflect.ownKeys(u).forEach(te=>{const ae=Object.getOwnPropertyDescriptor(u,te);"value"in ae&&(A[te]=u[te],delete ae.value,delete ae.writable),Object.defineProperty(G,te,ae)}),A})=>[h,Zs,vh,r,e,t,i,n,s,a,f],[LD]=$D();function Xs(r={}){return LD(r)}function Wo(r,e,t){const i=Zs.get(r);i||console.warn("Please use proxy object");let n;const s=[],a=i[3];let f=!1;const u=a(g=>{if(s.push(g),t){e(s.splice(0));return}n||(n=Promise.resolve().then(()=>{n=void 0,f&&e(s.splice(0))}))});return f=!0,()=>{f=!1,u()}}function BD(r,e){const t=Zs.get(r);t||console.warn("Please use proxy object");const[i,n,s]=t;return s(i,n(),e)}const Ur=Xs({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),lr={state:Ur,subscribe(r){return Wo(Ur,()=>r(Ur))},push(r,e){r!==Ur.view&&(Ur.view=r,e&&(Ur.data=e),Ur.history.push(r))},reset(r){Ur.view=r,Ur.history=[r]},replace(r){Ur.history.length>1&&(Ur.history[Ur.history.length-1]=r,Ur.view=r)},goBack(){if(Ur.history.length>1){Ur.history.pop();const[r]=Ur.history.slice(-1);Ur.view=r}},setData(r){Ur.data=r}},je={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return je.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const r=navigator.userAgent.toLowerCase();return je.isMobile()&&(r.includes("iphone")||r.includes("ipad"))},isHttpUrl(r){return r.startsWith("http://")||r.startsWith("https://")},isArray(r){return Array.isArray(r)&&r.length>0},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},formatNativeUrl(r,e,t){if(je.isHttpUrl(r))return this.formatUniversalUrl(r,e,t);let i=r;i.includes("://")||(i=r.replaceAll("/","").replaceAll(":",""),i=`${i}://`),i.endsWith("/")||(i=`${i}/`),this.setWalletConnectDeepLink(i,t);const n=encodeURIComponent(e);return`${i}wc?uri=${n}`},formatUniversalUrl(r,e,t){if(!je.isHttpUrl(r))return this.formatNativeUrl(r,e,t);let i=r;if(i.startsWith("https://t.me")){const s=Buffer.from(e).toString("base64").replace(/[=]/g,"");i.endsWith("/")&&(i=i.slice(0,-1)),this.setWalletConnectDeepLink(i,t);const a=new URL(i);return a.searchParams.set("startapp",s),a.toString()}i.endsWith("/")||(i=`${i}/`),this.setWalletConnectDeepLink(i,t);const n=encodeURIComponent(e);return`${i}wc?uri=${n}`},async wait(r){return new Promise(e=>{setTimeout(e,r)})},openHref(r,e){const t=this.isTelegram()?"_blank":e;window.open(r,t,"noreferrer noopener")},setWalletConnectDeepLink(r,e){try{localStorage.setItem(je.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:r,name:e}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(r){try{const[e]=r.split("?");localStorage.setItem(je.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(je.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(je.WCM_VERSION,"2.7.0")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var r;const e=(r=lr.state.data)==null?void 0:r.Wallet;if(!e)throw new Error('Missing "Wallet" view data');return e}},UD=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),Qr=Xs({enabled:UD,userSessionId:"",events:[],connectedWalletId:void 0}),g3={state:Qr,subscribe(r){return Wo(Qr.events,()=>r(BD(Qr.events[Qr.events.length-1])))},initialize(){Qr.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(Qr.userSessionId=crypto.randomUUID())},setConnectedWalletId(r){Qr.connectedWalletId=r},click(r){if(Qr.enabled){const e={type:"CLICK",name:r.name,userSessionId:Qr.userSessionId,timestamp:Date.now(),data:r};Qr.events.push(e)}},track(r){if(Qr.enabled){const e={type:"TRACK",name:r.name,userSessionId:Qr.userSessionId,timestamp:Date.now(),data:r};Qr.events.push(e)}},view(r){if(Qr.enabled){const e={type:"VIEW",name:r.name,userSessionId:Qr.userSessionId,timestamp:Date.now(),data:r};Qr.events.push(e)}}},ns=Xs({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),yr={state:ns,subscribe(r){return Wo(ns,()=>r(ns))},setChains(r){ns.chains=r},setWalletConnectUri(r){ns.walletConnectUri=r},setIsCustomDesktop(r){ns.isCustomDesktop=r},setIsCustomMobile(r){ns.isCustomMobile=r},setIsDataLoaded(r){ns.isDataLoaded=r},setIsUiLoaded(r){ns.isUiLoaded=r},setIsAuth(r){ns.isAuth=r}},mh=Xs({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),qi={state:mh,subscribe(r){return Wo(mh,()=>r(mh))},setConfig(r){var e,t;g3.initialize(),yr.setChains(r.chains),yr.setIsAuth(!!r.enableAuthMode),yr.setIsCustomMobile(!!((e=r.mobileWallets)!=null&&e.length)),yr.setIsCustomDesktop(!!((t=r.desktopWallets)!=null&&t.length)),je.setModalVersionInStorage(),Object.assign(mh,r)}};var FD=Object.defineProperty,v3=Object.getOwnPropertySymbols,qD=Object.prototype.hasOwnProperty,zD=Object.prototype.propertyIsEnumerable,m3=(r,e,t)=>e in r?FD(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,kD=(r,e)=>{for(var t in e||(e={}))qD.call(e,t)&&m3(r,t,e[t]);if(v3)for(var t of v3(e))zD.call(e,t)&&m3(r,t,e[t]);return r};const U0="https://explorer-api.walletconnect.com",F0="wcm",q0="js-2.7.0";async function bh(r,e){const t=kD({sdkType:F0,sdkVersion:q0},e),i=new URL(r,U0);return i.searchParams.append("projectId",qi.state.projectId),Object.entries(t).forEach(([s,a])=>{a&&i.searchParams.append(s,String(a))}),(await fetch(i)).json()}const Ko={async getDesktopListings(r){return bh("/w3m/v1/getDesktopListings",r)},async getMobileListings(r){return bh("/w3m/v1/getMobileListings",r)},async getInjectedListings(r){return bh("/w3m/v1/getInjectedListings",r)},async getAllListings(r){return bh("/w3m/v1/getAllListings",r)},getWalletImageUrl(r){return`${U0}/w3m/v1/getWalletImage/${r}?projectId=${qi.state.projectId}&sdkType=${F0}&sdkVersion=${q0}`},getAssetImageUrl(r){return`${U0}/w3m/v1/getAssetImage/${r}?projectId=${qi.state.projectId}&sdkType=${F0}&sdkVersion=${q0}`}};var HD=Object.defineProperty,b3=Object.getOwnPropertySymbols,jD=Object.prototype.hasOwnProperty,WD=Object.prototype.propertyIsEnumerable,w3=(r,e,t)=>e in r?HD(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,KD=(r,e)=>{for(var t in e||(e={}))jD.call(e,t)&&w3(r,t,e[t]);if(b3)for(var t of b3(e))WD.call(e,t)&&w3(r,t,e[t]);return r};const y3=je.isMobile(),ss=Xs({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),_i={state:ss,async getRecomendedWallets(){const{explorerRecommendedWalletIds:r,explorerExcludedWalletIds:e}=qi.state;if(r==="NONE"||e==="ALL"&&!r)return ss.recomendedWallets;if(je.isArray(r)){const i={recommendedIds:r.join(",")},{listings:n}=await Ko.getAllListings(i),s=Object.values(n);s.sort((a,f)=>{const h=r.indexOf(a.id),u=r.indexOf(f.id);return h-u}),ss.recomendedWallets=s}else{const{chains:t,isAuth:i}=yr.state,n=t?.join(","),s=je.isArray(e),a={page:1,sdks:i?"auth_v1":void 0,entries:je.RECOMMENDED_WALLET_AMOUNT,chains:n,version:2,excludedIds:s?e.join(","):void 0},{listings:f}=y3?await Ko.getMobileListings(a):await Ko.getDesktopListings(a);ss.recomendedWallets=Object.values(f)}return ss.recomendedWallets},async getWallets(r){const e=KD({},r),{explorerRecommendedWalletIds:t,explorerExcludedWalletIds:i}=qi.state,{recomendedWallets:n}=ss;if(i==="ALL")return ss.wallets;n.length?e.excludedIds=n.map(w=>w.id).join(","):je.isArray(t)&&(e.excludedIds=t.join(",")),je.isArray(i)&&(e.excludedIds=[e.excludedIds,i].filter(Boolean).join(",")),yr.state.isAuth&&(e.sdks="auth_v1");const{page:s,search:a}=r,{listings:f,total:h}=y3?await Ko.getMobileListings(e):await Ko.getDesktopListings(e),u=Object.values(f),g=a?"search":"wallets";return ss[g]={listings:[...ss[g].listings,...u],total:h,page:s??1},{listings:u,total:h}},getWalletImageUrl(r){return Ko.getWalletImageUrl(r)},getAssetImageUrl(r){return Ko.getAssetImageUrl(r)},resetSearch(){ss.search={listings:[],total:0,page:1}}},Ga=Xs({open:!1}),Vo={state:Ga,subscribe(r){return Wo(Ga,()=>r(Ga))},async open(r){return new Promise(e=>{const{isUiLoaded:t,isDataLoaded:i}=yr.state;if(je.removeWalletConnectDeepLink(),yr.setWalletConnectUri(r?.uri),yr.setChains(r?.chains),lr.reset("ConnectWallet"),t&&i)Ga.open=!0,e();else{const n=setInterval(()=>{const s=yr.state;s.isUiLoaded&&s.isDataLoaded&&(clearInterval(n),Ga.open=!0,e())},200)}})},close(){Ga.open=!1}};var VD=Object.defineProperty,_3=Object.getOwnPropertySymbols,GD=Object.prototype.hasOwnProperty,JD=Object.prototype.propertyIsEnumerable,x3=(r,e,t)=>e in r?VD(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,YD=(r,e)=>{for(var t in e||(e={}))GD.call(e,t)&&x3(r,t,e[t]);if(_3)for(var t of _3(e))JD.call(e,t)&&x3(r,t,e[t]);return r};function QD(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const gf=Xs({themeMode:QD()?"dark":"light"}),eo={state:gf,subscribe(r){return Wo(gf,()=>r(gf))},setThemeConfig(r){const{themeMode:e,themeVariables:t}=r;e&&(gf.themeMode=e),t&&(gf.themeVariables=YD({},t))}},Go=Xs({open:!1,message:"",variant:"success"}),to={state:Go,subscribe(r){return Wo(Go,()=>r(Go))},openToast(r,e){Go.open=!0,Go.message=r,Go.variant=e},closeToast(){Go.open=!1}};class ZD{constructor(e){this.openModal=Vo.open,this.closeModal=Vo.close,this.subscribeModal=Vo.subscribe,this.setTheme=eo.setThemeConfig,eo.setThemeConfig(e),qi.setConfig(e),this.initUi()}async initUi(){if(typeof window<"u"){await Promise.resolve().then(function(){return c$});const e=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",e),yr.setIsUiLoaded(!0)}}}var XD=Object.freeze({__proto__:null,WalletConnectModal:ZD});/**
|
|
70
70
|
* @license
|
|
71
71
|
* Copyright 2019 Google LLC
|
|
72
72
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
73
|
-
*/const
|
|
73
|
+
*/const wh=window,z0=wh.ShadowRoot&&(wh.ShadyCSS===void 0||wh.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,k0=Symbol(),E3=new WeakMap;class A3{constructor(e,t,i){if(this._$cssResult$=!0,i!==k0)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(z0&&e===void 0){const i=t!==void 0&&t.length===1;i&&(e=E3.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&E3.set(t,e))}return e}toString(){return this.cssText}}const eO=r=>new A3(typeof r=="string"?r:r+"",void 0,k0),jt=(r,...e)=>{const t=r.length===1?r[0]:e.reduce((i,n,s)=>i+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+r[s+1],r[0]);return new A3(t,r,k0)},tO=(r,e)=>{z0?r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{const i=document.createElement("style"),n=wh.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=t.cssText,r.appendChild(i)})},S3=z0?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return eO(t)})(r):r;/**
|
|
74
74
|
* @license
|
|
75
75
|
* Copyright 2017 Google LLC
|
|
76
76
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
77
|
-
*/var
|
|
77
|
+
*/var H0;const yh=window,I3=yh.trustedTypes,rO=I3?I3.emptyScript:"",M3=yh.reactiveElementPolyfillSupport,j0={toAttribute(r,e){switch(e){case Boolean:r=r?rO:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},C3=(r,e)=>e!==r&&(e==e||r==r),W0={attribute:!0,type:String,converter:j0,reflect:!1,hasChanged:C3},K0="finalized";class Ja extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),((t=this.h)!==null&&t!==void 0?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach((t,i)=>{const n=this._$Ep(i,t);n!==void 0&&(this._$Ev.set(n,i),e.push(n))}),e}static createProperty(e,t=W0){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const i=typeof e=="symbol"?Symbol():"__"+e,n=this.getPropertyDescriptor(e,i,t);n!==void 0&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(n){const s=this[e];this[t]=n,this.requestUpdate(e,s,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||W0}static finalize(){if(this.hasOwnProperty(K0))return!1;this[K0]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const n of i)this.createProperty(n,t[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const n of i)t.unshift(S3(n))}else e!==void 0&&t.push(S3(e));return t}static _$Ep(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(t=>t(this))}addController(e){var t,i;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((i=e.hostConnected)===null||i===void 0||i.call(e))}removeController(e){var t;(t=this._$ES)===null||t===void 0||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])})}createRenderRoot(){var e;const t=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return tO(t,this.constructor.elementStyles),t}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(t=>{var i;return(i=t.hostConnected)===null||i===void 0?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(t=>{var i;return(i=t.hostDisconnected)===null||i===void 0?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EO(e,t,i=W0){var n;const s=this.constructor._$Ep(e,i);if(s!==void 0&&i.reflect===!0){const a=(((n=i.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?i.converter:j0).toAttribute(t,i.type);this._$El=e,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._$El=null}}_$AK(e,t){var i;const n=this.constructor,s=n._$Ev.get(e);if(s!==void 0&&this._$El!==s){const a=n.getPropertyOptions(s),f=typeof a.converter=="function"?{fromAttribute:a.converter}:((i=a.converter)===null||i===void 0?void 0:i.fromAttribute)!==void 0?a.converter:j0;this._$El=s,this[s]=f.fromAttribute(t,a.type),this._$El=null}}requestUpdate(e,t,i){let n=!0;e!==void 0&&(((i=i||this.constructor.getPropertyOptions(e)).hasChanged||C3)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((n,s)=>this[s]=n),this._$Ei=void 0);let t=!1;const i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),(e=this._$ES)===null||e===void 0||e.forEach(n=>{var s;return(s=n.hostUpdate)===null||s===void 0?void 0:s.call(n)}),this.update(i)):this._$Ek()}catch(n){throw t=!1,this._$Ek(),n}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach(i=>{var n;return(n=i.hostUpdated)===null||n===void 0?void 0:n.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((t,i)=>this._$EO(i,this[i],t)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}Ja[K0]=!0,Ja.elementProperties=new Map,Ja.elementStyles=[],Ja.shadowRootOptions={mode:"open"},M3?.({ReactiveElement:Ja}),((H0=yh.reactiveElementVersions)!==null&&H0!==void 0?H0:yh.reactiveElementVersions=[]).push("1.6.3");/**
|
|
78
78
|
* @license
|
|
79
79
|
* Copyright 2017 Google LLC
|
|
80
80
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
81
|
-
*/var
|
|
82
|
-
\f\r]`,
|
|
83
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
81
|
+
*/var V0;const _h=window,Ya=_h.trustedTypes,P3=Ya?Ya.createPolicy("lit-html",{createHTML:r=>r}):void 0,G0="$lit$",ro=`lit$${(Math.random()+"").slice(9)}$`,D3="?"+ro,iO=`<${D3}>`,Jo=document,vf=()=>Jo.createComment(""),mf=r=>r===null||typeof r!="object"&&typeof r!="function",O3=Array.isArray,nO=r=>O3(r)||typeof r?.[Symbol.iterator]=="function",J0=`[
|
|
82
|
+
\f\r]`,bf=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,R3=/-->/g,T3=/>/g,Yo=RegExp(`>|${J0}(?:([^\\s"'>=/]+)(${J0}*=${J0}*(?:[^
|
|
83
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),N3=/'/g,$3=/"/g,L3=/^(?:script|style|textarea|title)$/i,B3=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),Ae=B3(1),gr=B3(2),Qo=Symbol.for("lit-noChange"),Mr=Symbol.for("lit-nothing"),U3=new WeakMap,Zo=Jo.createTreeWalker(Jo,129,null,!1);function F3(r,e){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return P3!==void 0?P3.createHTML(e):e}const sO=(r,e)=>{const t=r.length-1,i=[];let n,s=e===2?"<svg>":"",a=bf;for(let f=0;f<t;f++){const h=r[f];let u,g,w=-1,M=0;for(;M<h.length&&(a.lastIndex=M,g=a.exec(h),g!==null);)M=a.lastIndex,a===bf?g[1]==="!--"?a=R3:g[1]!==void 0?a=T3:g[2]!==void 0?(L3.test(g[2])&&(n=RegExp("</"+g[2],"g")),a=Yo):g[3]!==void 0&&(a=Yo):a===Yo?g[0]===">"?(a=n??bf,w=-1):g[1]===void 0?w=-2:(w=a.lastIndex-g[2].length,u=g[1],a=g[3]===void 0?Yo:g[3]==='"'?$3:N3):a===$3||a===N3?a=Yo:a===R3||a===T3?a=bf:(a=Yo,n=void 0);const P=a===Yo&&r[f+1].startsWith("/>")?" ":"";s+=a===bf?h+iO:w>=0?(i.push(u),h.slice(0,w)+G0+h.slice(w)+ro+P):h+ro+(w===-2?(i.push(void 0),f):P)}return[F3(r,s+(r[t]||"<?>")+(e===2?"</svg>":"")),i]};class wf{constructor({strings:e,_$litType$:t},i){let n;this.parts=[];let s=0,a=0;const f=e.length-1,h=this.parts,[u,g]=sO(e,t);if(this.el=wf.createElement(u,i),Zo.currentNode=this.el.content,t===2){const w=this.el.content,M=w.firstChild;M.remove(),w.append(...M.childNodes)}for(;(n=Zo.nextNode())!==null&&h.length<f;){if(n.nodeType===1){if(n.hasAttributes()){const w=[];for(const M of n.getAttributeNames())if(M.endsWith(G0)||M.startsWith(ro)){const P=g[a++];if(w.push(M),P!==void 0){const O=n.getAttribute(P.toLowerCase()+G0).split(ro),$=/([.?@])?(.*)/.exec(P);h.push({type:1,index:s,name:$[2],strings:O,ctor:$[1]==="."?aO:$[1]==="?"?fO:$[1]==="@"?lO:xh})}else h.push({type:6,index:s})}for(const M of w)n.removeAttribute(M)}if(L3.test(n.tagName)){const w=n.textContent.split(ro),M=w.length-1;if(M>0){n.textContent=Ya?Ya.emptyScript:"";for(let P=0;P<M;P++)n.append(w[P],vf()),Zo.nextNode(),h.push({type:2,index:++s});n.append(w[M],vf())}}}else if(n.nodeType===8)if(n.data===D3)h.push({type:2,index:s});else{let w=-1;for(;(w=n.data.indexOf(ro,w+1))!==-1;)h.push({type:7,index:s}),w+=ro.length-1}s++}}static createElement(e,t){const i=Jo.createElement("template");return i.innerHTML=e,i}}function Qa(r,e,t=r,i){var n,s,a,f;if(e===Qo)return e;let h=i!==void 0?(n=t._$Co)===null||n===void 0?void 0:n[i]:t._$Cl;const u=mf(e)?void 0:e._$litDirective$;return h?.constructor!==u&&((s=h?._$AO)===null||s===void 0||s.call(h,!1),u===void 0?h=void 0:(h=new u(r),h._$AT(r,t,i)),i!==void 0?((a=(f=t)._$Co)!==null&&a!==void 0?a:f._$Co=[])[i]=h:t._$Cl=h),h!==void 0&&(e=Qa(r,h._$AS(r,e.values),h,i)),e}class oO{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;const{el:{content:i},parts:n}=this._$AD,s=((t=e?.creationScope)!==null&&t!==void 0?t:Jo).importNode(i,!0);Zo.currentNode=s;let a=Zo.nextNode(),f=0,h=0,u=n[0];for(;u!==void 0;){if(f===u.index){let g;u.type===2?g=new yf(a,a.nextSibling,this,e):u.type===1?g=new u.ctor(a,u.name,u.strings,this,e):u.type===6&&(g=new hO(a,this,e)),this._$AV.push(g),u=n[++h]}f!==u?.index&&(a=Zo.nextNode(),f++)}return Zo.currentNode=Jo,s}v(e){let t=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class yf{constructor(e,t,i,n){var s;this.type=2,this._$AH=Mr,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=n,this._$Cp=(s=n?.isConnected)===null||s===void 0||s}get _$AU(){var e,t;return(t=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&t!==void 0?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Qa(this,e,t),mf(e)?e===Mr||e==null||e===""?(this._$AH!==Mr&&this._$AR(),this._$AH=Mr):e!==this._$AH&&e!==Qo&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):nO(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==Mr&&mf(this._$AH)?this._$AA.nextSibling.data=e:this.$(Jo.createTextNode(e)),this._$AH=e}g(e){var t;const{values:i,_$litType$:n}=e,s=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=wf.createElement(F3(n.h,n.h[0]),this.options)),n);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===s)this._$AH.v(i);else{const a=new oO(s,this),f=a.u(this.options);a.v(i),this.$(f),this._$AH=a}}_$AC(e){let t=U3.get(e.strings);return t===void 0&&U3.set(e.strings,t=new wf(e)),t}T(e){O3(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,n=0;for(const s of e)n===t.length?t.push(i=new yf(this.k(vf()),this.k(vf()),this,this.options)):i=t[n],i._$AI(s),n++;n<t.length&&(this._$AR(i&&i._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)===null||i===void 0||i.call(this,!1,!0,t);e&&e!==this._$AB;){const n=e.nextSibling;e.remove(),e=n}}setConnected(e){var t;this._$AM===void 0&&(this._$Cp=e,(t=this._$AP)===null||t===void 0||t.call(this,e))}}class xh{constructor(e,t,i,n,s){this.type=1,this._$AH=Mr,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=s,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Mr}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,i,n){const s=this.strings;let a=!1;if(s===void 0)e=Qa(this,e,t,0),a=!mf(e)||e!==this._$AH&&e!==Qo,a&&(this._$AH=e);else{const f=e;let h,u;for(e=s[0],h=0;h<s.length-1;h++)u=Qa(this,f[i+h],t,h),u===Qo&&(u=this._$AH[h]),a||(a=!mf(u)||u!==this._$AH[h]),u===Mr?e=Mr:e!==Mr&&(e+=(u??"")+s[h+1]),this._$AH[h]=u}a&&!n&&this.j(e)}j(e){e===Mr?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class aO extends xh{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Mr?void 0:e}}const cO=Ya?Ya.emptyScript:"";class fO extends xh{constructor(){super(...arguments),this.type=4}j(e){e&&e!==Mr?this.element.setAttribute(this.name,cO):this.element.removeAttribute(this.name)}}class lO extends xh{constructor(e,t,i,n,s){super(e,t,i,n,s),this.type=5}_$AI(e,t=this){var i;if((e=(i=Qa(this,e,t,0))!==null&&i!==void 0?i:Mr)===Qo)return;const n=this._$AH,s=e===Mr&&n!==Mr||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,a=e!==Mr&&(n===Mr||s);s&&this.element.removeEventListener(this.name,this,n),a&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,i;typeof this._$AH=="function"?this._$AH.call((i=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&i!==void 0?i:this.element,e):this._$AH.handleEvent(e)}}class hO{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){Qa(this,e)}}const q3=_h.litHtmlPolyfillSupport;q3?.(wf,yf),((V0=_h.litHtmlVersions)!==null&&V0!==void 0?V0:_h.litHtmlVersions=[]).push("2.8.0");const uO=(r,e,t)=>{var i,n;const s=(i=t?.renderBefore)!==null&&i!==void 0?i:e;let a=s._$litPart$;if(a===void 0){const f=(n=t?.renderBefore)!==null&&n!==void 0?n:null;s._$litPart$=a=new yf(e.insertBefore(vf(),f),f,void 0,t??{})}return a._$AI(r),a};/**
|
|
84
84
|
* @license
|
|
85
85
|
* Copyright 2017 Google LLC
|
|
86
86
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
87
|
-
*/var
|
|
87
|
+
*/var Y0,Q0;class Ct extends Ja{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;const i=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=i.firstChild),i}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=uO(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return Qo}}Ct.finalized=!0,Ct._$litElement$=!0,(Y0=globalThis.litElementHydrateSupport)===null||Y0===void 0||Y0.call(globalThis,{LitElement:Ct});const z3=globalThis.litElementPolyfillSupport;z3?.({LitElement:Ct}),((Q0=globalThis.litElementVersions)!==null&&Q0!==void 0?Q0:globalThis.litElementVersions=[]).push("3.3.3");/**
|
|
88
88
|
* @license
|
|
89
89
|
* Copyright 2017 Google LLC
|
|
90
90
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
91
|
-
*/const
|
|
91
|
+
*/const Ft=r=>e=>typeof e=="function"?((t,i)=>(customElements.define(t,i),i))(r,e):((t,i)=>{const{kind:n,elements:s}=i;return{kind:n,elements:s,finisher(a){customElements.define(t,a)}}})(r,e);/**
|
|
92
92
|
* @license
|
|
93
93
|
* Copyright 2017 Google LLC
|
|
94
94
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
95
|
-
*/const
|
|
95
|
+
*/const dO=(r,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(t){t.createProperty(e.key,r)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(t){t.createProperty(e.key,r)}},pO=(r,e,t)=>{e.constructor.createProperty(t,r)};function Et(r){return(e,t)=>t!==void 0?pO(r,e,t):dO(r,e)}/**
|
|
96
96
|
* @license
|
|
97
97
|
* Copyright 2017 Google LLC
|
|
98
98
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
99
|
-
*/function xi(r){return
|
|
99
|
+
*/function xi(r){return Et({...r,state:!0})}/**
|
|
100
100
|
* @license
|
|
101
101
|
* Copyright 2021 Google LLC
|
|
102
102
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
103
|
-
*/var
|
|
103
|
+
*/var Z0;((Z0=window.HTMLSlotElement)===null||Z0===void 0?void 0:Z0.prototype.assignedElements)!=null;/**
|
|
104
104
|
* @license
|
|
105
105
|
* Copyright 2017 Google LLC
|
|
106
106
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
107
|
-
*/const
|
|
107
|
+
*/const gO={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},vO=r=>(...e)=>({_$litDirective$:r,values:e});class mO{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}/**
|
|
108
108
|
* @license
|
|
109
109
|
* Copyright 2018 Google LLC
|
|
110
110
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
111
|
-
*/const Is=qO(class extends zO{constructor(r){var e;if(super(r),r.type!==UO.ATTRIBUTE||r.name!=="class"||((e=r.strings)===null||e===void 0?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(r){return" "+Object.keys(r).filter(e=>r[e]).join(" ")+" "}update(r,[e]){var t,i;if(this.it===void 0){this.it=new Set,r.strings!==void 0&&(this.nt=new Set(r.strings.join(" ").split(/\s/).filter(s=>s!=="")));for(const s in e)e[s]&&!(!((t=this.nt)===null||t===void 0)&&t.has(s))&&this.it.add(s);return this.render(e)}const n=r.element.classList;this.it.forEach(s=>{s in e||(n.remove(s),this.it.delete(s))});for(const s in e){const a=!!e[s];a===this.it.has(s)||!((i=this.nt)===null||i===void 0)&&i.has(s)||(a?(n.add(s),this.it.add(s)):(n.remove(s),this.it.delete(s)))}return Qo}});function HO(r,e){r.indexOf(e)===-1&&r.push(e)}const X3=(r,e,t)=>Math.min(Math.max(t,r),e),cn={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},Eh=r=>typeof r=="number",Za=r=>Array.isArray(r)&&!Eh(r[0]),kO=(r,e,t)=>{const i=e-r;return((t-r)%i+i)%i+r};function jO(r,e){return Za(r)?r[kO(0,r.length,e)]:r}const ew=(r,e,t)=>-t*r+t*e+r,tw=()=>{},io=r=>r,tp=(r,e,t)=>e-r===0?1:(t-r)/(e-r);function rw(r,e){const t=r[r.length-1];for(let i=1;i<=e;i++){const n=tp(0,e,i);r.push(ew(t,1,n))}}function WO(r){const e=[0];return rw(e,r-1),e}function KO(r,e=WO(r.length),t=io){const i=r.length,n=i-e.length;return n>0&&rw(e,n),s=>{let a=0;for(;a<i-2&&!(s<e[a+1]);a++);let f=X3(0,1,tp(e[a],e[a+1],s));return f=jO(t,a)(f),ew(r[a],r[a+1],f)}}const iw=r=>Array.isArray(r)&&Eh(r[0]),rp=r=>typeof r=="object"&&!!r.createAnimation,Xo=r=>typeof r=="function",VO=r=>typeof r=="string",xf={ms:r=>r*1e3,s:r=>r/1e3},nw=(r,e,t)=>(((1-3*t+3*e)*r+(3*t-6*e))*r+3*e)*r,GO=1e-7,YO=12;function JO(r,e,t,i,n){let s,a,f=0;do a=e+(t-e)/2,s=nw(a,i,n)-r,s>0?t=a:e=a;while(Math.abs(s)>GO&&++f<YO);return a}function Af(r,e,t,i){if(r===e&&t===i)return io;const n=s=>JO(s,0,1,r,t);return s=>s===0||s===1?s:nw(n(s),e,i)}const QO=(r,e="end")=>t=>{t=e==="end"?Math.min(t,.999):Math.max(t,.001);const i=t*r,n=e==="end"?Math.floor(i):Math.ceil(i);return X3(0,1,n/r)},ZO={ease:Af(.25,.1,.25,1),"ease-in":Af(.42,0,1,1),"ease-in-out":Af(.42,0,.58,1),"ease-out":Af(0,0,.58,1)},XO=/\((.*?)\)/;function sw(r){if(Xo(r))return r;if(iw(r))return Af(...r);const e=ZO[r];if(e)return e;if(r.startsWith("steps")){const t=XO.exec(r);if(t){const i=t[1].split(",");return QO(parseFloat(i[0]),i[1].trim())}}return io}class ow{constructor(e,t=[0,1],{easing:i,duration:n=cn.duration,delay:s=cn.delay,endDelay:a=cn.endDelay,repeat:f=cn.repeat,offset:h,direction:u="normal",autoplay:g=!0}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=io,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise((M,C)=>{this.resolve=M,this.reject=C}),i=i||cn.easing,rp(i)){const M=i.createAnimation(t);i=M.easing,t=M.keyframes||t,n=M.duration||n}this.repeat=f,this.easing=Za(i)?io:sw(i),this.updateDuration(n);const w=KO(t,h,Za(i)?i.map(sw):io);this.tick=M=>{var C;s=s;let O=0;this.pauseTime!==void 0?O=this.pauseTime:O=(M-this.startTime)*this.rate,this.t=O,O/=1e3,O=Math.max(O-s,0),this.playState==="finished"&&this.pauseTime===void 0&&(O=this.totalDuration);const N=O/this.duration;let j=Math.floor(N),H=N%1;!H&&N>=1&&(H=1),H===1&&j--;const F=j%2;(u==="reverse"||u==="alternate"&&F||u==="alternate-reverse"&&!F)&&(H=1-H);const G=O>=this.totalDuration?1:Math.min(H,1),B=w(this.easing(G));e(B),this.pauseTime===void 0&&(this.playState==="finished"||O>=this.totalDuration+a)?(this.playState="finished",(C=this.resolve)===null||C===void 0||C.call(this,B)):this.playState!=="idle"&&(this.frameRequestId=requestAnimationFrame(this.tick))},g&&this.play()}play(){const e=performance.now();this.playState="running",this.pauseTime!==void 0?this.startTime=e-this.pauseTime:this.startTime||(this.startTime=e),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var e;this.playState="idle",this.frameRequestId!==void 0&&cancelAnimationFrame(this.frameRequestId),(e=this.reject)===null||e===void 0||e.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(e){this.duration=e,this.totalDuration=e*(this.repeat+1)}get currentTime(){return this.t}set currentTime(e){this.pauseTime!==void 0||this.rate===0?this.pauseTime=e:this.startTime=performance.now()-e/this.rate}get playbackRate(){return this.rate}set playbackRate(e){this.rate=e}}var ip=function(){};process.env.NODE_ENV!=="production"&&(ip=function(r,e){if(!r)throw new Error(e)});class eR{setAnimation(e){this.animation=e,e?.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}const np=new WeakMap;function aw(r){return np.has(r)||np.set(r,{transforms:[],values:new Map}),np.get(r)}function tR(r,e){return r.has(e)||r.set(e,new eR),r.get(e)}const rR=["","X","Y","Z"],iR=["translate","scale","rotate","skew"],Sh={x:"translateX",y:"translateY",z:"translateZ"},cw={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:r=>r+"deg"},nR={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:r=>r+"px"},rotate:cw,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:io},skew:cw},Ef=new Map,sp=r=>`--motion-${r}`,Ih=["x","y","z"];iR.forEach(r=>{rR.forEach(e=>{Ih.push(r+e),Ef.set(sp(r+e),nR[r])})});const sR=(r,e)=>Ih.indexOf(r)-Ih.indexOf(e),oR=new Set(Ih),fw=r=>oR.has(r),aR=(r,e)=>{Sh[e]&&(e=Sh[e]);const{transforms:t}=aw(r);HO(t,e),r.style.transform=cR(t)},cR=r=>r.sort(sR).reduce(fR,"").trim(),fR=(r,e)=>`${r} ${e}(var(${sp(e)}))`,op=r=>r.startsWith("--"),lw=new Set;function lR(r){if(!lw.has(r)){lw.add(r);try{const{syntax:e,initialValue:t}=Ef.has(r)?Ef.get(r):{};CSS.registerProperty({name:r,inherits:!1,syntax:e,initialValue:t})}catch{}}}const ap=(r,e)=>document.createElement("div").animate(r,e),hw={cssRegisterProperty:()=>typeof CSS<"u"&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{ap({opacity:[1]})}catch{return!1}return!0},finished:()=>!!ap({opacity:[0,1]},{duration:.001}).finished,linearEasing:()=>{try{ap({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0}},cp={},Xa={};for(const r in hw)Xa[r]=()=>(cp[r]===void 0&&(cp[r]=hw[r]()),cp[r]);const hR=.015,uR=(r,e)=>{let t="";const i=Math.round(e/hR);for(let n=0;n<i;n++)t+=r(tp(0,i-1,n))+", ";return t.substring(0,t.length-2)},uw=(r,e)=>Xo(r)?Xa.linearEasing()?`linear(${uR(r,e)})`:cn.easing:iw(r)?dR(r):r,dR=([r,e,t,i])=>`cubic-bezier(${r}, ${e}, ${t}, ${i})`;function pR(r,e){for(let t=0;t<r.length;t++)r[t]===null&&(r[t]=t?r[t-1]:e());return r}const gR=r=>Array.isArray(r)?r:[r];function fp(r){return Sh[r]&&(r=Sh[r]),fw(r)?sp(r):r}const Mh={get:(r,e)=>{e=fp(e);let t=op(e)?r.style.getPropertyValue(e):getComputedStyle(r)[e];if(!t&&t!==0){const i=Ef.get(e);i&&(t=i.initialValue)}return t},set:(r,e,t)=>{e=fp(e),op(e)?r.style.setProperty(e,t):r.style[e]=t}};function dw(r,e=!0){if(!(!r||r.playState==="finished"))try{r.stop?r.stop():(e&&r.commitStyles(),r.cancel())}catch{}}function vR(r,e){var t;let i=e?.toDefaultUnit||io;const n=r[r.length-1];if(VO(n)){const s=((t=n.match(/(-?[\d.]+)([a-z%]*)/))===null||t===void 0?void 0:t[2])||"";s&&(i=a=>a+s)}return i}function mR(){return window.__MOTION_DEV_TOOLS_RECORD}function bR(r,e,t,i={},n){const s=mR(),a=i.record!==!1&&s;let f,{duration:h=cn.duration,delay:u=cn.delay,endDelay:g=cn.endDelay,repeat:w=cn.repeat,easing:M=cn.easing,persist:C=!1,direction:O,offset:N,allowWebkitAcceleration:j=!1,autoplay:H=!0}=i;const F=aw(r),G=fw(e);let B=Xa.waapi();G&&aR(r,e);const z=fp(e),W=tR(F.values,z),_=Ef.get(z);return dw(W.animation,!(rp(M)&&W.generator)&&i.record!==!1),()=>{const U=()=>{var L,b;return(b=(L=Mh.get(r,z))!==null&&L!==void 0?L:_?.initialValue)!==null&&b!==void 0?b:0};let ee=pR(gR(t),U);const oe=vR(ee,_);if(rp(M)){const L=M.createAnimation(ee,e!=="opacity",U,z,W);M=L.easing,ee=L.keyframes||ee,h=L.duration||h}if(op(z)&&(Xa.cssRegisterProperty()?lR(z):B=!1),G&&!Xa.linearEasing()&&(Xo(M)||Za(M)&&M.some(Xo))&&(B=!1),B){_&&(ee=ee.map(m=>Eh(m)?_.toDefaultUnit(m):m)),ee.length===1&&(!Xa.partialKeyframes()||a)&&ee.unshift(U());const L={delay:xf.ms(u),duration:xf.ms(h),endDelay:xf.ms(g),easing:Za(M)?void 0:uw(M,h),direction:O,iterations:w+1,fill:"both"};f=r.animate({[z]:ee,offset:N,easing:Za(M)?M.map(m=>uw(m,h)):void 0},L),f.finished||(f.finished=new Promise((m,l)=>{f.onfinish=m,f.oncancel=l}));const b=ee[ee.length-1];f.finished.then(()=>{C||(Mh.set(r,z,b),f.cancel())}).catch(tw),j||(f.playbackRate=1.000001)}else if(n&&G)ee=ee.map(L=>typeof L=="string"?parseFloat(L):L),ee.length===1&&ee.unshift(parseFloat(U())),f=new n(L=>{Mh.set(r,z,oe?oe(L):L)},ee,Object.assign(Object.assign({},i),{duration:h,easing:M}));else{const L=ee[ee.length-1];Mh.set(r,z,_&&Eh(L)?_.toDefaultUnit(L):L)}return a&&s(r,e,ee,{duration:h,delay:u,easing:M,repeat:w,offset:N},"motion-one"),W.setAnimation(f),f&&!H&&f.pause(),f}}const wR=(r,e)=>r[e]?Object.assign(Object.assign({},r),r[e]):Object.assign({},r);function pw(r,e){var t;return typeof r=="string"?e?((t=e[r])!==null&&t!==void 0||(e[r]=document.querySelectorAll(r)),r=e[r]):r=document.querySelectorAll(r):r instanceof Element&&(r=[r]),Array.from(r||[])}const yR=r=>r(),gw=(r,e,t=cn.duration)=>new Proxy({animations:r.map(yR).filter(Boolean),duration:t,options:e},xR),_R=r=>r.animations[0],xR={get:(r,e)=>{const t=_R(r);switch(e){case"duration":return r.duration;case"currentTime":return xf.s(t?.[e]||0);case"playbackRate":case"playState":return t?.[e];case"finished":return r.finished||(r.finished=Promise.all(r.animations.map(AR)).catch(tw)),r.finished;case"stop":return()=>{r.animations.forEach(i=>dw(i))};case"forEachNative":return i=>{r.animations.forEach(n=>i(n,r))};default:return typeof t?.[e]>"u"?void 0:()=>r.animations.forEach(i=>i[e]())}},set:(r,e,t)=>{switch(e){case"currentTime":t=xf.ms(t);case"playbackRate":for(let i=0;i<r.animations.length;i++)r.animations[i][e]=t;return!0}return!1}},AR=r=>r.finished;function ER(r,e,t){return Xo(r)?r(e,t):r}function SR(r){return function(t,i,n={}){t=pw(t);const s=t.length;ip(!!s,"No valid element provided."),ip(!!i,"No keyframes defined.");const a=[];for(let f=0;f<s;f++){const h=t[f];for(const u in i){const g=wR(n,u);g.delay=ER(g.delay,f,s);const w=bR(h,u,i[u],g,r);a.push(w)}}return gw(a,n,n.duration)}}const IR=SR(ow);function MR(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(t[i[n]]=r[i[n]]);return t}typeof SuppressedError=="function"&&SuppressedError;const CR={any:0,all:1};function PR(r,e,{root:t,margin:i,amount:n="any"}={}){if(typeof IntersectionObserver>"u")return()=>{};const s=pw(r),a=new WeakMap,f=u=>{u.forEach(g=>{const w=a.get(g.target);if(g.isIntersecting!==!!w)if(g.isIntersecting){const M=e(g);Xo(M)?a.set(g.target,M):h.unobserve(g.target)}else w&&(w(g),a.delete(g.target))})},h=new IntersectionObserver(f,{root:t,rootMargin:i,threshold:typeof n=="number"?n:CR[n]});return s.forEach(u=>h.observe(u)),()=>h.disconnect()}function lp(r,e,t){r.dispatchEvent(new CustomEvent(e,{detail:{originalEvent:t}}))}function vw(r,e,t){r.dispatchEvent(new CustomEvent(e,{detail:{originalEntry:t}}))}const DR={isActive:r=>!!r.inView,subscribe:(r,{enable:e,disable:t},{inViewOptions:i={}})=>{const{once:n}=i,s=MR(i,["once"]);return PR(r,a=>{if(e(),vw(r,"viewenter",a),!n)return f=>{t(),vw(r,"viewleave",f)}},s)}},mw=(r,e,t)=>i=>{i.pointerType&&i.pointerType!=="mouse"||(t(),lp(r,e,i))};[...Object.keys({inView:DR,hover:{isActive:r=>!!r.hover,subscribe:(r,{enable:e,disable:t})=>{const i=mw(r,"hoverstart",e),n=mw(r,"hoverend",t);return r.addEventListener("pointerenter",i),r.addEventListener("pointerleave",n),()=>{r.removeEventListener("pointerenter",i),r.removeEventListener("pointerleave",n)}}},press:{isActive:r=>!!r.press,subscribe:(r,{enable:e,disable:t})=>{const i=s=>{t(),lp(r,"pressend",s),window.removeEventListener("pointerup",i)},n=s=>{e(),lp(r,"pressstart",s),window.addEventListener("pointerup",i)};return r.addEventListener("pointerdown",n),()=>{r.removeEventListener("pointerdown",n),window.removeEventListener("pointerup",i)}}}})];function OR(r,e={}){return gw([()=>{const t=new ow(r,[0,1],e);return t.finished.catch(()=>{}),t}],e,e.duration)}function ea(r,e,t){return(Xo(r)?OR:IR)(r,e,t)}/**
|
|
111
|
+
*/const Is=vO(class extends mO{constructor(r){var e;if(super(r),r.type!==gO.ATTRIBUTE||r.name!=="class"||((e=r.strings)===null||e===void 0?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(r){return" "+Object.keys(r).filter(e=>r[e]).join(" ")+" "}update(r,[e]){var t,i;if(this.it===void 0){this.it=new Set,r.strings!==void 0&&(this.nt=new Set(r.strings.join(" ").split(/\s/).filter(s=>s!=="")));for(const s in e)e[s]&&!(!((t=this.nt)===null||t===void 0)&&t.has(s))&&this.it.add(s);return this.render(e)}const n=r.element.classList;this.it.forEach(s=>{s in e||(n.remove(s),this.it.delete(s))});for(const s in e){const a=!!e[s];a===this.it.has(s)||!((i=this.nt)===null||i===void 0)&&i.has(s)||(a?(n.add(s),this.it.add(s)):(n.remove(s),this.it.delete(s)))}return Qo}});function bO(r,e){r.indexOf(e)===-1&&r.push(e)}const k3=(r,e,t)=>Math.min(Math.max(t,r),e),cn={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},Eh=r=>typeof r=="number",Za=r=>Array.isArray(r)&&!Eh(r[0]),wO=(r,e,t)=>{const i=e-r;return((t-r)%i+i)%i+r};function yO(r,e){return Za(r)?r[wO(0,r.length,e)]:r}const H3=(r,e,t)=>-t*r+t*e+r,j3=()=>{},io=r=>r,X0=(r,e,t)=>e-r===0?1:(t-r)/(e-r);function W3(r,e){const t=r[r.length-1];for(let i=1;i<=e;i++){const n=X0(0,e,i);r.push(H3(t,1,n))}}function _O(r){const e=[0];return W3(e,r-1),e}function xO(r,e=_O(r.length),t=io){const i=r.length,n=i-e.length;return n>0&&W3(e,n),s=>{let a=0;for(;a<i-2&&!(s<e[a+1]);a++);let f=k3(0,1,X0(e[a],e[a+1],s));return f=yO(t,a)(f),H3(r[a],r[a+1],f)}}const K3=r=>Array.isArray(r)&&Eh(r[0]),ep=r=>typeof r=="object"&&!!r.createAnimation,Xo=r=>typeof r=="function",EO=r=>typeof r=="string",_f={ms:r=>r*1e3,s:r=>r/1e3},V3=(r,e,t)=>(((1-3*t+3*e)*r+(3*t-6*e))*r+3*e)*r,AO=1e-7,SO=12;function IO(r,e,t,i,n){let s,a,f=0;do a=e+(t-e)/2,s=V3(a,i,n)-r,s>0?t=a:e=a;while(Math.abs(s)>AO&&++f<SO);return a}function xf(r,e,t,i){if(r===e&&t===i)return io;const n=s=>IO(s,0,1,r,t);return s=>s===0||s===1?s:V3(n(s),e,i)}const MO=(r,e="end")=>t=>{t=e==="end"?Math.min(t,.999):Math.max(t,.001);const i=t*r,n=e==="end"?Math.floor(i):Math.ceil(i);return k3(0,1,n/r)},CO={ease:xf(.25,.1,.25,1),"ease-in":xf(.42,0,1,1),"ease-in-out":xf(.42,0,.58,1),"ease-out":xf(0,0,.58,1)},PO=/\((.*?)\)/;function G3(r){if(Xo(r))return r;if(K3(r))return xf(...r);const e=CO[r];if(e)return e;if(r.startsWith("steps")){const t=PO.exec(r);if(t){const i=t[1].split(",");return MO(parseFloat(i[0]),i[1].trim())}}return io}class J3{constructor(e,t=[0,1],{easing:i,duration:n=cn.duration,delay:s=cn.delay,endDelay:a=cn.endDelay,repeat:f=cn.repeat,offset:h,direction:u="normal",autoplay:g=!0}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=io,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise((M,P)=>{this.resolve=M,this.reject=P}),i=i||cn.easing,ep(i)){const M=i.createAnimation(t);i=M.easing,t=M.keyframes||t,n=M.duration||n}this.repeat=f,this.easing=Za(i)?io:G3(i),this.updateDuration(n);const w=xO(t,h,Za(i)?i.map(G3):io);this.tick=M=>{var P;s=s;let O=0;this.pauseTime!==void 0?O=this.pauseTime:O=(M-this.startTime)*this.rate,this.t=O,O/=1e3,O=Math.max(O-s,0),this.playState==="finished"&&this.pauseTime===void 0&&(O=this.totalDuration);const $=O/this.duration;let q=Math.floor($),U=$%1;!U&&$>=1&&(U=1),U===1&&q--;const J=q%2;(u==="reverse"||u==="alternate"&&J||u==="alternate-reverse"&&!J)&&(U=1-U);const ee=O>=this.totalDuration?1:Math.min(U,1),W=w(this.easing(ee));e(W),this.pauseTime===void 0&&(this.playState==="finished"||O>=this.totalDuration+a)?(this.playState="finished",(P=this.resolve)===null||P===void 0||P.call(this,W)):this.playState!=="idle"&&(this.frameRequestId=requestAnimationFrame(this.tick))},g&&this.play()}play(){const e=performance.now();this.playState="running",this.pauseTime!==void 0?this.startTime=e-this.pauseTime:this.startTime||(this.startTime=e),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var e;this.playState="idle",this.frameRequestId!==void 0&&cancelAnimationFrame(this.frameRequestId),(e=this.reject)===null||e===void 0||e.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(e){this.duration=e,this.totalDuration=e*(this.repeat+1)}get currentTime(){return this.t}set currentTime(e){this.pauseTime!==void 0||this.rate===0?this.pauseTime=e:this.startTime=performance.now()-e/this.rate}get playbackRate(){return this.rate}set playbackRate(e){this.rate=e}}var tp=function(){};process.env.NODE_ENV!=="production"&&(tp=function(r,e){if(!r)throw new Error(e)});class DO{setAnimation(e){this.animation=e,e?.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}const rp=new WeakMap;function Y3(r){return rp.has(r)||rp.set(r,{transforms:[],values:new Map}),rp.get(r)}function OO(r,e){return r.has(e)||r.set(e,new DO),r.get(e)}const RO=["","X","Y","Z"],TO=["translate","scale","rotate","skew"],Ah={x:"translateX",y:"translateY",z:"translateZ"},Q3={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:r=>r+"deg"},NO={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:r=>r+"px"},rotate:Q3,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:io},skew:Q3},Ef=new Map,ip=r=>`--motion-${r}`,Sh=["x","y","z"];TO.forEach(r=>{RO.forEach(e=>{Sh.push(r+e),Ef.set(ip(r+e),NO[r])})});const $O=(r,e)=>Sh.indexOf(r)-Sh.indexOf(e),LO=new Set(Sh),Z3=r=>LO.has(r),BO=(r,e)=>{Ah[e]&&(e=Ah[e]);const{transforms:t}=Y3(r);bO(t,e),r.style.transform=UO(t)},UO=r=>r.sort($O).reduce(FO,"").trim(),FO=(r,e)=>`${r} ${e}(var(${ip(e)}))`,np=r=>r.startsWith("--"),X3=new Set;function qO(r){if(!X3.has(r)){X3.add(r);try{const{syntax:e,initialValue:t}=Ef.has(r)?Ef.get(r):{};CSS.registerProperty({name:r,inherits:!1,syntax:e,initialValue:t})}catch{}}}const sp=(r,e)=>document.createElement("div").animate(r,e),ew={cssRegisterProperty:()=>typeof CSS<"u"&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{sp({opacity:[1]})}catch{return!1}return!0},finished:()=>!!sp({opacity:[0,1]},{duration:.001}).finished,linearEasing:()=>{try{sp({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0}},op={},Xa={};for(const r in ew)Xa[r]=()=>(op[r]===void 0&&(op[r]=ew[r]()),op[r]);const zO=.015,kO=(r,e)=>{let t="";const i=Math.round(e/zO);for(let n=0;n<i;n++)t+=r(X0(0,i-1,n))+", ";return t.substring(0,t.length-2)},tw=(r,e)=>Xo(r)?Xa.linearEasing()?`linear(${kO(r,e)})`:cn.easing:K3(r)?HO(r):r,HO=([r,e,t,i])=>`cubic-bezier(${r}, ${e}, ${t}, ${i})`;function jO(r,e){for(let t=0;t<r.length;t++)r[t]===null&&(r[t]=t?r[t-1]:e());return r}const WO=r=>Array.isArray(r)?r:[r];function ap(r){return Ah[r]&&(r=Ah[r]),Z3(r)?ip(r):r}const Ih={get:(r,e)=>{e=ap(e);let t=np(e)?r.style.getPropertyValue(e):getComputedStyle(r)[e];if(!t&&t!==0){const i=Ef.get(e);i&&(t=i.initialValue)}return t},set:(r,e,t)=>{e=ap(e),np(e)?r.style.setProperty(e,t):r.style[e]=t}};function rw(r,e=!0){if(!(!r||r.playState==="finished"))try{r.stop?r.stop():(e&&r.commitStyles(),r.cancel())}catch{}}function KO(r,e){var t;let i=e?.toDefaultUnit||io;const n=r[r.length-1];if(EO(n)){const s=((t=n.match(/(-?[\d.]+)([a-z%]*)/))===null||t===void 0?void 0:t[2])||"";s&&(i=a=>a+s)}return i}function VO(){return window.__MOTION_DEV_TOOLS_RECORD}function GO(r,e,t,i={},n){const s=VO(),a=i.record!==!1&&s;let f,{duration:h=cn.duration,delay:u=cn.delay,endDelay:g=cn.endDelay,repeat:w=cn.repeat,easing:M=cn.easing,persist:P=!1,direction:O,offset:$,allowWebkitAcceleration:q=!1,autoplay:U=!0}=i;const J=Y3(r),ee=Z3(e);let W=Xa.waapi();ee&&BO(r,e);const G=ap(e),Q=OO(J.values,G),A=Ef.get(G);return rw(Q.animation,!(ep(M)&&Q.generator)&&i.record!==!1),()=>{const z=()=>{var L,b;return(b=(L=Ih.get(r,G))!==null&&L!==void 0?L:A?.initialValue)!==null&&b!==void 0?b:0};let te=jO(WO(t),z);const ae=KO(te,A);if(ep(M)){const L=M.createAnimation(te,e!=="opacity",z,G,Q);M=L.easing,te=L.keyframes||te,h=L.duration||h}if(np(G)&&(Xa.cssRegisterProperty()?qO(G):W=!1),ee&&!Xa.linearEasing()&&(Xo(M)||Za(M)&&M.some(Xo))&&(W=!1),W){A&&(te=te.map(m=>Eh(m)?A.toDefaultUnit(m):m)),te.length===1&&(!Xa.partialKeyframes()||a)&&te.unshift(z());const L={delay:_f.ms(u),duration:_f.ms(h),endDelay:_f.ms(g),easing:Za(M)?void 0:tw(M,h),direction:O,iterations:w+1,fill:"both"};f=r.animate({[G]:te,offset:$,easing:Za(M)?M.map(m=>tw(m,h)):void 0},L),f.finished||(f.finished=new Promise((m,l)=>{f.onfinish=m,f.oncancel=l}));const b=te[te.length-1];f.finished.then(()=>{P||(Ih.set(r,G,b),f.cancel())}).catch(j3),q||(f.playbackRate=1.000001)}else if(n&&ee)te=te.map(L=>typeof L=="string"?parseFloat(L):L),te.length===1&&te.unshift(parseFloat(z())),f=new n(L=>{Ih.set(r,G,ae?ae(L):L)},te,Object.assign(Object.assign({},i),{duration:h,easing:M}));else{const L=te[te.length-1];Ih.set(r,G,A&&Eh(L)?A.toDefaultUnit(L):L)}return a&&s(r,e,te,{duration:h,delay:u,easing:M,repeat:w,offset:$},"motion-one"),Q.setAnimation(f),f&&!U&&f.pause(),f}}const JO=(r,e)=>r[e]?Object.assign(Object.assign({},r),r[e]):Object.assign({},r);function iw(r,e){var t;return typeof r=="string"?e?((t=e[r])!==null&&t!==void 0||(e[r]=document.querySelectorAll(r)),r=e[r]):r=document.querySelectorAll(r):r instanceof Element&&(r=[r]),Array.from(r||[])}const YO=r=>r(),nw=(r,e,t=cn.duration)=>new Proxy({animations:r.map(YO).filter(Boolean),duration:t,options:e},ZO),QO=r=>r.animations[0],ZO={get:(r,e)=>{const t=QO(r);switch(e){case"duration":return r.duration;case"currentTime":return _f.s(t?.[e]||0);case"playbackRate":case"playState":return t?.[e];case"finished":return r.finished||(r.finished=Promise.all(r.animations.map(XO)).catch(j3)),r.finished;case"stop":return()=>{r.animations.forEach(i=>rw(i))};case"forEachNative":return i=>{r.animations.forEach(n=>i(n,r))};default:return typeof t?.[e]>"u"?void 0:()=>r.animations.forEach(i=>i[e]())}},set:(r,e,t)=>{switch(e){case"currentTime":t=_f.ms(t);case"playbackRate":for(let i=0;i<r.animations.length;i++)r.animations[i][e]=t;return!0}return!1}},XO=r=>r.finished;function eR(r,e,t){return Xo(r)?r(e,t):r}function tR(r){return function(t,i,n={}){t=iw(t);const s=t.length;tp(!!s,"No valid element provided."),tp(!!i,"No keyframes defined.");const a=[];for(let f=0;f<s;f++){const h=t[f];for(const u in i){const g=JO(n,u);g.delay=eR(g.delay,f,s);const w=GO(h,u,i[u],g,r);a.push(w)}}return nw(a,n,n.duration)}}const rR=tR(J3);function iR(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(t[i[n]]=r[i[n]]);return t}typeof SuppressedError=="function"&&SuppressedError;const nR={any:0,all:1};function sR(r,e,{root:t,margin:i,amount:n="any"}={}){if(typeof IntersectionObserver>"u")return()=>{};const s=iw(r),a=new WeakMap,f=u=>{u.forEach(g=>{const w=a.get(g.target);if(g.isIntersecting!==!!w)if(g.isIntersecting){const M=e(g);Xo(M)?a.set(g.target,M):h.unobserve(g.target)}else w&&(w(g),a.delete(g.target))})},h=new IntersectionObserver(f,{root:t,rootMargin:i,threshold:typeof n=="number"?n:nR[n]});return s.forEach(u=>h.observe(u)),()=>h.disconnect()}function cp(r,e,t){r.dispatchEvent(new CustomEvent(e,{detail:{originalEvent:t}}))}function sw(r,e,t){r.dispatchEvent(new CustomEvent(e,{detail:{originalEntry:t}}))}const oR={isActive:r=>!!r.inView,subscribe:(r,{enable:e,disable:t},{inViewOptions:i={}})=>{const{once:n}=i,s=iR(i,["once"]);return sR(r,a=>{if(e(),sw(r,"viewenter",a),!n)return f=>{t(),sw(r,"viewleave",f)}},s)}},ow=(r,e,t)=>i=>{i.pointerType&&i.pointerType!=="mouse"||(t(),cp(r,e,i))};[...Object.keys({inView:oR,hover:{isActive:r=>!!r.hover,subscribe:(r,{enable:e,disable:t})=>{const i=ow(r,"hoverstart",e),n=ow(r,"hoverend",t);return r.addEventListener("pointerenter",i),r.addEventListener("pointerleave",n),()=>{r.removeEventListener("pointerenter",i),r.removeEventListener("pointerleave",n)}}},press:{isActive:r=>!!r.press,subscribe:(r,{enable:e,disable:t})=>{const i=s=>{t(),cp(r,"pressend",s),window.removeEventListener("pointerup",i)},n=s=>{e(),cp(r,"pressstart",s),window.addEventListener("pointerup",i)};return r.addEventListener("pointerdown",n),()=>{r.removeEventListener("pointerdown",n),window.removeEventListener("pointerup",i)}}}})];function aR(r,e={}){return nw([()=>{const t=new J3(r,[0,1],e);return t.finished.catch(()=>{}),t}],e,e.duration)}function ea(r,e,t){return(Xo(r)?aR:rR)(r,e,t)}/**
|
|
112
112
|
* @license
|
|
113
113
|
* Copyright 2018 Google LLC
|
|
114
114
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
115
|
-
*/const li=r=>r??Mr;var
|
|
116
|
-
]))+`;os.KANJI=new RegExp(
|
|
117
|
-
Make sure your charset is UTF-8`);t=(t>>>8&255)*192+(t&255),r.put(t,13)}};var
|
|
118
|
-
Suggested mode is: `+e.toString(
|
|
115
|
+
*/const li=r=>r??Mr;var Af={},cR=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},aw={},zi={};let fp;const fR=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];zi.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17},zi.getSymbolTotalCodewords=function(e){return fR[e]},zi.getBCHDigit=function(r){let e=0;for(;r!==0;)e++,r>>>=1;return e},zi.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');fp=e},zi.isKanjiModeEnabled=function(){return typeof fp<"u"},zi.toSJIS=function(e){return fp(e)};var Mh={};(function(r){r.L={bit:1},r.M={bit:0},r.Q={bit:3},r.H={bit:2};function e(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return r.L;case"m":case"medium":return r.M;case"q":case"quartile":return r.Q;case"h":case"high":return r.H;default:throw new Error("Unknown EC Level: "+t)}}r.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},r.from=function(i,n){if(r.isValid(i))return i;try{return e(i)}catch{return n}}})(Mh);function cw(){this.buffer=[],this.length=0}cw.prototype={get:function(r){const e=Math.floor(r/8);return(this.buffer[e]>>>7-r%8&1)===1},put:function(r,e){for(let t=0;t<e;t++)this.putBit((r>>>e-t-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(r){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),r&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var lR=cw;function Sf(r){if(!r||r<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=r,this.data=new Uint8Array(r*r),this.reservedBit=new Uint8Array(r*r)}Sf.prototype.set=function(r,e,t,i){const n=r*this.size+e;this.data[n]=t,i&&(this.reservedBit[n]=!0)},Sf.prototype.get=function(r,e){return this.data[r*this.size+e]},Sf.prototype.xor=function(r,e,t){this.data[r*this.size+e]^=t},Sf.prototype.isReserved=function(r,e){return this.reservedBit[r*this.size+e]};var hR=Sf,fw={};(function(r){const e=zi.getSymbolSize;r.getRowColCoords=function(i){if(i===1)return[];const n=Math.floor(i/7)+2,s=e(i),a=s===145?26:Math.ceil((s-13)/(2*n-2))*2,f=[s-7];for(let h=1;h<n-1;h++)f[h]=f[h-1]-a;return f.push(6),f.reverse()},r.getPositions=function(i){const n=[],s=r.getRowColCoords(i),a=s.length;for(let f=0;f<a;f++)for(let h=0;h<a;h++)f===0&&h===0||f===0&&h===a-1||f===a-1&&h===0||n.push([s[f],s[h]]);return n}})(fw);var lw={};const uR=zi.getSymbolSize,hw=7;lw.getPositions=function(e){const t=uR(e);return[[0,0],[t-hw,0],[0,t-hw]]};var uw={};(function(r){r.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const e={N1:3,N2:3,N3:40,N4:10};r.isValid=function(n){return n!=null&&n!==""&&!isNaN(n)&&n>=0&&n<=7},r.from=function(n){return r.isValid(n)?parseInt(n,10):void 0},r.getPenaltyN1=function(n){const s=n.size;let a=0,f=0,h=0,u=null,g=null;for(let w=0;w<s;w++){f=h=0,u=g=null;for(let M=0;M<s;M++){let P=n.get(w,M);P===u?f++:(f>=5&&(a+=e.N1+(f-5)),u=P,f=1),P=n.get(M,w),P===g?h++:(h>=5&&(a+=e.N1+(h-5)),g=P,h=1)}f>=5&&(a+=e.N1+(f-5)),h>=5&&(a+=e.N1+(h-5))}return a},r.getPenaltyN2=function(n){const s=n.size;let a=0;for(let f=0;f<s-1;f++)for(let h=0;h<s-1;h++){const u=n.get(f,h)+n.get(f,h+1)+n.get(f+1,h)+n.get(f+1,h+1);(u===4||u===0)&&a++}return a*e.N2},r.getPenaltyN3=function(n){const s=n.size;let a=0,f=0,h=0;for(let u=0;u<s;u++){f=h=0;for(let g=0;g<s;g++)f=f<<1&2047|n.get(u,g),g>=10&&(f===1488||f===93)&&a++,h=h<<1&2047|n.get(g,u),g>=10&&(h===1488||h===93)&&a++}return a*e.N3},r.getPenaltyN4=function(n){let s=0;const a=n.data.length;for(let h=0;h<a;h++)s+=n.data[h];return Math.abs(Math.ceil(s*100/a/5)-10)*e.N4};function t(i,n,s){switch(i){case r.Patterns.PATTERN000:return(n+s)%2===0;case r.Patterns.PATTERN001:return n%2===0;case r.Patterns.PATTERN010:return s%3===0;case r.Patterns.PATTERN011:return(n+s)%3===0;case r.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(s/3))%2===0;case r.Patterns.PATTERN101:return n*s%2+n*s%3===0;case r.Patterns.PATTERN110:return(n*s%2+n*s%3)%2===0;case r.Patterns.PATTERN111:return(n*s%3+(n+s)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}r.applyMask=function(n,s){const a=s.size;for(let f=0;f<a;f++)for(let h=0;h<a;h++)s.isReserved(h,f)||s.xor(h,f,t(n,h,f))},r.getBestMask=function(n,s){const a=Object.keys(r.Patterns).length;let f=0,h=1/0;for(let u=0;u<a;u++){s(u),r.applyMask(u,n);const g=r.getPenaltyN1(n)+r.getPenaltyN2(n)+r.getPenaltyN3(n)+r.getPenaltyN4(n);r.applyMask(u,n),g<h&&(h=g,f=u)}return f}})(uw);var Ch={};const no=Mh,Ph=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Dh=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];Ch.getBlocksCount=function(e,t){switch(t){case no.L:return Ph[(e-1)*4+0];case no.M:return Ph[(e-1)*4+1];case no.Q:return Ph[(e-1)*4+2];case no.H:return Ph[(e-1)*4+3];default:return}},Ch.getTotalCodewordsCount=function(e,t){switch(t){case no.L:return Dh[(e-1)*4+0];case no.M:return Dh[(e-1)*4+1];case no.Q:return Dh[(e-1)*4+2];case no.H:return Dh[(e-1)*4+3];default:return}};var dw={},Oh={};const If=new Uint8Array(512),Rh=new Uint8Array(256);(function(){let e=1;for(let t=0;t<255;t++)If[t]=e,Rh[e]=t,e<<=1,e&256&&(e^=285);for(let t=255;t<512;t++)If[t]=If[t-255]})(),Oh.log=function(e){if(e<1)throw new Error("log("+e+")");return Rh[e]},Oh.exp=function(e){return If[e]},Oh.mul=function(e,t){return e===0||t===0?0:If[Rh[e]+Rh[t]]},function(r){const e=Oh;r.mul=function(i,n){const s=new Uint8Array(i.length+n.length-1);for(let a=0;a<i.length;a++)for(let f=0;f<n.length;f++)s[a+f]^=e.mul(i[a],n[f]);return s},r.mod=function(i,n){let s=new Uint8Array(i);for(;s.length-n.length>=0;){const a=s[0];for(let h=0;h<n.length;h++)s[h]^=e.mul(n[h],a);let f=0;for(;f<s.length&&s[f]===0;)f++;s=s.slice(f)}return s},r.generateECPolynomial=function(i){let n=new Uint8Array([1]);for(let s=0;s<i;s++)n=r.mul(n,new Uint8Array([1,e.exp(s)]));return n}}(dw);const pw=dw;function lp(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}lp.prototype.initialize=function(e){this.degree=e,this.genPoly=pw.generateECPolynomial(this.degree)},lp.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(e.length+this.degree);t.set(e);const i=pw.mod(t,this.genPoly),n=this.degree-i.length;if(n>0){const s=new Uint8Array(this.degree);return s.set(i,n),s}return i};var dR=lp,gw={},so={},hp={};hp.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40};var os={};const vw="[0-9]+",pR="[A-Z $%*+\\-./:]+";let Mf="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Mf=Mf.replace(/u/g,"\\u");const gR="(?:(?![A-Z0-9 $%*+\\-./:]|"+Mf+`)(?:.|[\r
|
|
116
|
+
]))+`;os.KANJI=new RegExp(Mf,"g"),os.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),os.BYTE=new RegExp(gR,"g"),os.NUMERIC=new RegExp(vw,"g"),os.ALPHANUMERIC=new RegExp(pR,"g");const vR=new RegExp("^"+Mf+"$"),mR=new RegExp("^"+vw+"$"),bR=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");os.testKanji=function(e){return vR.test(e)},os.testNumeric=function(e){return mR.test(e)},os.testAlphanumeric=function(e){return bR.test(e)},function(r){const e=hp,t=os;r.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},r.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},r.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},r.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},r.MIXED={bit:-1},r.getCharCountIndicator=function(s,a){if(!s.ccBits)throw new Error("Invalid mode: "+s);if(!e.isValid(a))throw new Error("Invalid version: "+a);return a>=1&&a<10?s.ccBits[0]:a<27?s.ccBits[1]:s.ccBits[2]},r.getBestModeForData=function(s){return t.testNumeric(s)?r.NUMERIC:t.testAlphanumeric(s)?r.ALPHANUMERIC:t.testKanji(s)?r.KANJI:r.BYTE},r.toString=function(s){if(s&&s.id)return s.id;throw new Error("Invalid mode")},r.isValid=function(s){return s&&s.bit&&s.ccBits};function i(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"numeric":return r.NUMERIC;case"alphanumeric":return r.ALPHANUMERIC;case"kanji":return r.KANJI;case"byte":return r.BYTE;default:throw new Error("Unknown mode: "+n)}}r.from=function(s,a){if(r.isValid(s))return s;try{return i(s)}catch{return a}}}(so),function(r){const e=zi,t=Ch,i=Mh,n=so,s=hp,a=7973,f=e.getBCHDigit(a);function h(M,P,O){for(let $=1;$<=40;$++)if(P<=r.getCapacity($,O,M))return $}function u(M,P){return n.getCharCountIndicator(M,P)+4}function g(M,P){let O=0;return M.forEach(function($){const q=u($.mode,P);O+=q+$.getBitsLength()}),O}function w(M,P){for(let O=1;O<=40;O++)if(g(M,O)<=r.getCapacity(O,P,n.MIXED))return O}r.from=function(P,O){return s.isValid(P)?parseInt(P,10):O},r.getCapacity=function(P,O,$){if(!s.isValid(P))throw new Error("Invalid QR Code version");typeof $>"u"&&($=n.BYTE);const q=e.getSymbolTotalCodewords(P),U=t.getTotalCodewordsCount(P,O),J=(q-U)*8;if($===n.MIXED)return J;const ee=J-u($,P);switch($){case n.NUMERIC:return Math.floor(ee/10*3);case n.ALPHANUMERIC:return Math.floor(ee/11*2);case n.KANJI:return Math.floor(ee/13);case n.BYTE:default:return Math.floor(ee/8)}},r.getBestVersionForData=function(P,O){let $;const q=i.from(O,i.M);if(Array.isArray(P)){if(P.length>1)return w(P,q);if(P.length===0)return 1;$=P[0]}else $=P;return h($.mode,$.getLength(),q)},r.getEncodedBits=function(P){if(!s.isValid(P)||P<7)throw new Error("Invalid QR Code version");let O=P<<12;for(;e.getBCHDigit(O)-f>=0;)O^=a<<e.getBCHDigit(O)-f;return P<<12|O}}(gw);var mw={};const up=zi,bw=1335,wR=21522,ww=up.getBCHDigit(bw);mw.getEncodedBits=function(e,t){const i=e.bit<<3|t;let n=i<<10;for(;up.getBCHDigit(n)-ww>=0;)n^=bw<<up.getBCHDigit(n)-ww;return(i<<10|n)^wR};var yw={};const yR=so;function ec(r){this.mode=yR.NUMERIC,this.data=r.toString()}ec.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},ec.prototype.getLength=function(){return this.data.length},ec.prototype.getBitsLength=function(){return ec.getBitsLength(this.data.length)},ec.prototype.write=function(e){let t,i,n;for(t=0;t+3<=this.data.length;t+=3)i=this.data.substr(t,3),n=parseInt(i,10),e.put(n,10);const s=this.data.length-t;s>0&&(i=this.data.substr(t),n=parseInt(i,10),e.put(n,s*3+1))};var _R=ec;const xR=so,dp=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function tc(r){this.mode=xR.ALPHANUMERIC,this.data=r}tc.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)},tc.prototype.getLength=function(){return this.data.length},tc.prototype.getBitsLength=function(){return tc.getBitsLength(this.data.length)},tc.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let i=dp.indexOf(this.data[t])*45;i+=dp.indexOf(this.data[t+1]),e.put(i,11)}this.data.length%2&&e.put(dp.indexOf(this.data[t]),6)};var ER=tc,AR=function(e){for(var t=[],i=e.length,n=0;n<i;n++){var s=e.charCodeAt(n);if(s>=55296&&s<=56319&&i>n+1){var a=e.charCodeAt(n+1);a>=56320&&a<=57343&&(s=(s-55296)*1024+a-56320+65536,n+=1)}if(s<128){t.push(s);continue}if(s<2048){t.push(s>>6|192),t.push(s&63|128);continue}if(s<55296||s>=57344&&s<65536){t.push(s>>12|224),t.push(s>>6&63|128),t.push(s&63|128);continue}if(s>=65536&&s<=1114111){t.push(s>>18|240),t.push(s>>12&63|128),t.push(s>>6&63|128),t.push(s&63|128);continue}t.push(239,191,189)}return new Uint8Array(t).buffer};const SR=AR,IR=so;function rc(r){this.mode=IR.BYTE,typeof r=="string"&&(r=SR(r)),this.data=new Uint8Array(r)}rc.getBitsLength=function(e){return e*8},rc.prototype.getLength=function(){return this.data.length},rc.prototype.getBitsLength=function(){return rc.getBitsLength(this.data.length)},rc.prototype.write=function(r){for(let e=0,t=this.data.length;e<t;e++)r.put(this.data[e],8)};var MR=rc;const CR=so,PR=zi;function ic(r){this.mode=CR.KANJI,this.data=r}ic.getBitsLength=function(e){return e*13},ic.prototype.getLength=function(){return this.data.length},ic.prototype.getBitsLength=function(){return ic.getBitsLength(this.data.length)},ic.prototype.write=function(r){let e;for(e=0;e<this.data.length;e++){let t=PR.toSJIS(this.data[e]);if(t>=33088&&t<=40956)t-=33088;else if(t>=57408&&t<=60351)t-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
|
|
117
|
+
Make sure your charset is UTF-8`);t=(t>>>8&255)*192+(t&255),r.put(t,13)}};var DR=ic,_w={exports:{}};(function(r){var e={single_source_shortest_paths:function(t,i,n){var s={},a={};a[i]=0;var f=e.PriorityQueue.make();f.push(i,0);for(var h,u,g,w,M,P,O,$,q;!f.empty();){h=f.pop(),u=h.value,w=h.cost,M=t[u]||{};for(g in M)M.hasOwnProperty(g)&&(P=M[g],O=w+P,$=a[g],q=typeof a[g]>"u",(q||$>O)&&(a[g]=O,f.push(g,O),s[g]=u))}if(typeof n<"u"&&typeof a[n]>"u"){var U=["Could not find a path from ",i," to ",n,"."].join("");throw new Error(U)}return s},extract_shortest_path_from_predecessor_list:function(t,i){for(var n=[],s=i;s;)n.push(s),t[s],s=t[s];return n.reverse(),n},find_path:function(t,i,n){var s=e.single_source_shortest_paths(t,i,n);return e.extract_shortest_path_from_predecessor_list(s,n)},PriorityQueue:{make:function(t){var i=e.PriorityQueue,n={},s;t=t||{};for(s in i)i.hasOwnProperty(s)&&(n[s]=i[s]);return n.queue=[],n.sorter=t.sorter||i.default_sorter,n},default_sorter:function(t,i){return t.cost-i.cost},push:function(t,i){var n={value:t,cost:i};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};r.exports=e})(_w),function(r){const e=so,t=_R,i=ER,n=MR,s=DR,a=os,f=zi,h=_w.exports;function u(U){return unescape(encodeURIComponent(U)).length}function g(U,J,ee){const W=[];let G;for(;(G=U.exec(ee))!==null;)W.push({data:G[0],index:G.index,mode:J,length:G[0].length});return W}function w(U){const J=g(a.NUMERIC,e.NUMERIC,U),ee=g(a.ALPHANUMERIC,e.ALPHANUMERIC,U);let W,G;return f.isKanjiModeEnabled()?(W=g(a.BYTE,e.BYTE,U),G=g(a.KANJI,e.KANJI,U)):(W=g(a.BYTE_KANJI,e.BYTE,U),G=[]),J.concat(ee,W,G).sort(function(A,z){return A.index-z.index}).map(function(A){return{data:A.data,mode:A.mode,length:A.length}})}function M(U,J){switch(J){case e.NUMERIC:return t.getBitsLength(U);case e.ALPHANUMERIC:return i.getBitsLength(U);case e.KANJI:return s.getBitsLength(U);case e.BYTE:return n.getBitsLength(U)}}function P(U){return U.reduce(function(J,ee){const W=J.length-1>=0?J[J.length-1]:null;return W&&W.mode===ee.mode?(J[J.length-1].data+=ee.data,J):(J.push(ee),J)},[])}function O(U){const J=[];for(let ee=0;ee<U.length;ee++){const W=U[ee];switch(W.mode){case e.NUMERIC:J.push([W,{data:W.data,mode:e.ALPHANUMERIC,length:W.length},{data:W.data,mode:e.BYTE,length:W.length}]);break;case e.ALPHANUMERIC:J.push([W,{data:W.data,mode:e.BYTE,length:W.length}]);break;case e.KANJI:J.push([W,{data:W.data,mode:e.BYTE,length:u(W.data)}]);break;case e.BYTE:J.push([{data:W.data,mode:e.BYTE,length:u(W.data)}])}}return J}function $(U,J){const ee={},W={start:{}};let G=["start"];for(let Q=0;Q<U.length;Q++){const A=U[Q],z=[];for(let te=0;te<A.length;te++){const ae=A[te],L=""+Q+te;z.push(L),ee[L]={node:ae,lastCount:0},W[L]={};for(let b=0;b<G.length;b++){const m=G[b];ee[m]&&ee[m].node.mode===ae.mode?(W[m][L]=M(ee[m].lastCount+ae.length,ae.mode)-M(ee[m].lastCount,ae.mode),ee[m].lastCount+=ae.length):(ee[m]&&(ee[m].lastCount=ae.length),W[m][L]=M(ae.length,ae.mode)+4+e.getCharCountIndicator(ae.mode,J))}}G=z}for(let Q=0;Q<G.length;Q++)W[G[Q]].end=0;return{map:W,table:ee}}function q(U,J){let ee;const W=e.getBestModeForData(U);if(ee=e.from(J,W),ee!==e.BYTE&&ee.bit<W.bit)throw new Error('"'+U+'" cannot be encoded with mode '+e.toString(ee)+`.
|
|
118
|
+
Suggested mode is: `+e.toString(W));switch(ee===e.KANJI&&!f.isKanjiModeEnabled()&&(ee=e.BYTE),ee){case e.NUMERIC:return new t(U);case e.ALPHANUMERIC:return new i(U);case e.KANJI:return new s(U);case e.BYTE:return new n(U)}}r.fromArray=function(J){return J.reduce(function(ee,W){return typeof W=="string"?ee.push(q(W,null)):W.data&&ee.push(q(W.data,W.mode)),ee},[])},r.fromString=function(J,ee){const W=w(J,f.isKanjiModeEnabled()),G=O(W),Q=$(G,ee),A=h.find_path(Q.map,"start","end"),z=[];for(let te=1;te<A.length-1;te++)z.push(Q.table[A[te]].node);return r.fromArray(P(z))},r.rawSplit=function(J){return r.fromArray(w(J,f.isKanjiModeEnabled()))}}(yw);const Th=zi,pp=Mh,OR=lR,RR=hR,TR=fw,NR=lw,gp=uw,vp=Ch,$R=dR,Nh=gw,LR=mw,BR=so,mp=yw;function UR(r,e){const t=r.size,i=NR.getPositions(e);for(let n=0;n<i.length;n++){const s=i[n][0],a=i[n][1];for(let f=-1;f<=7;f++)if(!(s+f<=-1||t<=s+f))for(let h=-1;h<=7;h++)a+h<=-1||t<=a+h||(f>=0&&f<=6&&(h===0||h===6)||h>=0&&h<=6&&(f===0||f===6)||f>=2&&f<=4&&h>=2&&h<=4?r.set(s+f,a+h,!0,!0):r.set(s+f,a+h,!1,!0))}}function FR(r){const e=r.size;for(let t=8;t<e-8;t++){const i=t%2===0;r.set(t,6,i,!0),r.set(6,t,i,!0)}}function qR(r,e){const t=TR.getPositions(e);for(let i=0;i<t.length;i++){const n=t[i][0],s=t[i][1];for(let a=-2;a<=2;a++)for(let f=-2;f<=2;f++)a===-2||a===2||f===-2||f===2||a===0&&f===0?r.set(n+a,s+f,!0,!0):r.set(n+a,s+f,!1,!0)}}function zR(r,e){const t=r.size,i=Nh.getEncodedBits(e);let n,s,a;for(let f=0;f<18;f++)n=Math.floor(f/3),s=f%3+t-8-3,a=(i>>f&1)===1,r.set(n,s,a,!0),r.set(s,n,a,!0)}function bp(r,e,t){const i=r.size,n=LR.getEncodedBits(e,t);let s,a;for(s=0;s<15;s++)a=(n>>s&1)===1,s<6?r.set(s,8,a,!0):s<8?r.set(s+1,8,a,!0):r.set(i-15+s,8,a,!0),s<8?r.set(8,i-s-1,a,!0):s<9?r.set(8,15-s-1+1,a,!0):r.set(8,15-s-1,a,!0);r.set(i-8,8,1,!0)}function kR(r,e){const t=r.size;let i=-1,n=t-1,s=7,a=0;for(let f=t-1;f>0;f-=2)for(f===6&&f--;;){for(let h=0;h<2;h++)if(!r.isReserved(n,f-h)){let u=!1;a<e.length&&(u=(e[a]>>>s&1)===1),r.set(n,f-h,u),s--,s===-1&&(a++,s=7)}if(n+=i,n<0||t<=n){n-=i,i=-i;break}}}function HR(r,e,t){const i=new OR;t.forEach(function(h){i.put(h.mode.bit,4),i.put(h.getLength(),BR.getCharCountIndicator(h.mode,r)),h.write(i)});const n=Th.getSymbolTotalCodewords(r),s=vp.getTotalCodewordsCount(r,e),a=(n-s)*8;for(i.getLengthInBits()+4<=a&&i.put(0,4);i.getLengthInBits()%8!==0;)i.putBit(0);const f=(a-i.getLengthInBits())/8;for(let h=0;h<f;h++)i.put(h%2?17:236,8);return jR(i,r,e)}function jR(r,e,t){const i=Th.getSymbolTotalCodewords(e),n=vp.getTotalCodewordsCount(e,t),s=i-n,a=vp.getBlocksCount(e,t),f=i%a,h=a-f,u=Math.floor(i/a),g=Math.floor(s/a),w=g+1,M=u-g,P=new $R(M);let O=0;const $=new Array(a),q=new Array(a);let U=0;const J=new Uint8Array(r.buffer);for(let A=0;A<a;A++){const z=A<h?g:w;$[A]=J.slice(O,O+z),q[A]=P.encode($[A]),O+=z,U=Math.max(U,z)}const ee=new Uint8Array(i);let W=0,G,Q;for(G=0;G<U;G++)for(Q=0;Q<a;Q++)G<$[Q].length&&(ee[W++]=$[Q][G]);for(G=0;G<M;G++)for(Q=0;Q<a;Q++)ee[W++]=q[Q][G];return ee}function WR(r,e,t,i){let n;if(Array.isArray(r))n=mp.fromArray(r);else if(typeof r=="string"){let u=e;if(!u){const g=mp.rawSplit(r);u=Nh.getBestVersionForData(g,t)}n=mp.fromString(r,u||40)}else throw new Error("Invalid data");const s=Nh.getBestVersionForData(n,t);if(!s)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=s;else if(e<s)throw new Error(`
|
|
119
119
|
The chosen QR Code version cannot contain this amount of data.
|
|
120
120
|
Minimum version required to store current data is: `+s+`.
|
|
121
|
-
`);const a=
|
|
122
|
-
`;return typeof i=="function"&&i(null,M),M};const bT=RR,Ap=bw,Lw=Tw,wT=Nw;function Ep(r,e,t,i,n){const s=[].slice.call(arguments,1),a=s.length,f=typeof s[a-1]=="function";if(!f&&!bT())throw new Error("Callback required as last argument");if(f){if(a<2)throw new Error("Too few arguments provided");a===2?(n=t,t=e,e=i=void 0):a===3&&(e.getContext&&typeof n>"u"?(n=i,i=void 0):(n=i,i=t,t=e,e=void 0))}else{if(a<1)throw new Error("Too few arguments provided");return a===1?(t=e,e=i=void 0):a===2&&!e.getContext&&(i=t,t=e,e=void 0),new Promise(function(h,u){try{const g=Ap.create(t,i);h(r(g,e,i))}catch(g){u(g)}})}try{const h=Ap.create(t,i);n(null,r(h,e,i))}catch(h){n(h)}}Sf.create=Ap.create,Sf.toCanvas=Ep.bind(null,Lw.render),Sf.toDataURL=Ep.bind(null,Lw.renderToDataURL),Sf.toString=Ep.bind(null,function(r,e,t){return wT.render(r,t)});var yT=Object.defineProperty,Bw=Object.getOwnPropertySymbols,_T=Object.prototype.hasOwnProperty,xT=Object.prototype.propertyIsEnumerable,Fw=(r,e,t)=>e in r?yT(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Sp=(r,e)=>{for(var t in e||(e={}))_T.call(e,t)&&Fw(r,t,e[t]);if(Bw)for(var t of Bw(e))xT.call(e,t)&&Fw(r,t,e[t]);return r};function AT(){var r;const e=(r=eo.state.themeMode)!=null?r:"dark",i={light:{foreground:{1:"rgb(20,20,20)",2:"rgb(121,134,134)",3:"rgb(158,169,169)"},background:{1:"rgb(255,255,255)",2:"rgb(241,243,243)",3:"rgb(228,231,231)"},overlay:"rgba(0,0,0,0.1)"},dark:{foreground:{1:"rgb(228,231,231)",2:"rgb(148,158,158)",3:"rgb(110,119,119)"},background:{1:"rgb(20,20,20)",2:"rgb(39,42,42)",3:"rgb(59,64,64)"},overlay:"rgba(255,255,255,0.1)"}}[e];return{"--wcm-color-fg-1":i.foreground[1],"--wcm-color-fg-2":i.foreground[2],"--wcm-color-fg-3":i.foreground[3],"--wcm-color-bg-1":i.background[1],"--wcm-color-bg-2":i.background[2],"--wcm-color-bg-3":i.background[3],"--wcm-color-overlay":i.overlay}}function Uw(){return{"--wcm-accent-color":"#3396FF","--wcm-accent-fill-color":"#FFFFFF","--wcm-z-index":"89","--wcm-background-color":"#3396FF","--wcm-background-border-radius":"8px","--wcm-container-border-radius":"30px","--wcm-wallet-icon-border-radius":"15px","--wcm-wallet-icon-large-border-radius":"30px","--wcm-wallet-icon-small-border-radius":"7px","--wcm-input-border-radius":"28px","--wcm-button-border-radius":"10px","--wcm-notification-border-radius":"36px","--wcm-secondary-button-border-radius":"28px","--wcm-icon-button-border-radius":"50%","--wcm-button-hover-highlight-border-radius":"10px","--wcm-text-big-bold-size":"20px","--wcm-text-big-bold-weight":"600","--wcm-text-big-bold-line-height":"24px","--wcm-text-big-bold-letter-spacing":"-0.03em","--wcm-text-big-bold-text-transform":"none","--wcm-text-xsmall-bold-size":"10px","--wcm-text-xsmall-bold-weight":"700","--wcm-text-xsmall-bold-line-height":"12px","--wcm-text-xsmall-bold-letter-spacing":"0.02em","--wcm-text-xsmall-bold-text-transform":"uppercase","--wcm-text-xsmall-regular-size":"12px","--wcm-text-xsmall-regular-weight":"600","--wcm-text-xsmall-regular-line-height":"14px","--wcm-text-xsmall-regular-letter-spacing":"-0.03em","--wcm-text-xsmall-regular-text-transform":"none","--wcm-text-small-thin-size":"14px","--wcm-text-small-thin-weight":"500","--wcm-text-small-thin-line-height":"16px","--wcm-text-small-thin-letter-spacing":"-0.03em","--wcm-text-small-thin-text-transform":"none","--wcm-text-small-regular-size":"14px","--wcm-text-small-regular-weight":"600","--wcm-text-small-regular-line-height":"16px","--wcm-text-small-regular-letter-spacing":"-0.03em","--wcm-text-small-regular-text-transform":"none","--wcm-text-medium-regular-size":"16px","--wcm-text-medium-regular-weight":"600","--wcm-text-medium-regular-line-height":"20px","--wcm-text-medium-regular-letter-spacing":"-0.03em","--wcm-text-medium-regular-text-transform":"none","--wcm-font-family":"-apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', sans-serif","--wcm-font-feature-settings":"'tnum' on, 'lnum' on, 'case' on","--wcm-success-color":"rgb(38,181,98)","--wcm-error-color":"rgb(242, 90, 103)","--wcm-overlay-background-color":"rgba(0, 0, 0, 0.3)","--wcm-overlay-backdrop-filter":"none"}}const Lt={getPreset(r){return Uw()[r]},setTheme(){const r=document.querySelector(":root"),{themeVariables:e}=eo.state;if(r){const t=Sp(Sp(Sp({},AT()),Uw()),e);Object.entries(t).forEach(([i,n])=>r.style.setProperty(i,n))}},globalCss:jt`*,::after,::before{margin:0;padding:0;box-sizing:border-box;font-style:normal;text-rendering:optimizeSpeed;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-tap-highlight-color:transparent;backface-visibility:hidden}button{cursor:pointer;display:flex;justify-content:center;align-items:center;position:relative;border:none;background-color:transparent;transition:all .2s ease}@media (hover:hover) and (pointer:fine){button:active{transition:all .1s ease;transform:scale(.93)}}button::after{content:'';position:absolute;top:0;bottom:0;left:0;right:0;transition:background-color,.2s ease}button:disabled{cursor:not-allowed}button svg,button wcm-text{position:relative;z-index:1}input{border:none;outline:0;appearance:none}img{display:block}::selection{color:var(--wcm-accent-fill-color);background:var(--wcm-accent-color)}`},ET=jt`button{border-radius:var(--wcm-secondary-button-border-radius);height:28px;padding:0 10px;background-color:var(--wcm-accent-color)}button path{fill:var(--wcm-accent-fill-color)}button::after{border-radius:inherit;border:1px solid var(--wcm-color-overlay)}button:disabled::after{background-color:transparent}.wcm-icon-left svg{margin-right:5px}.wcm-icon-right svg{margin-left:5px}button:active::after{background-color:var(--wcm-color-overlay)}.wcm-ghost,.wcm-ghost:active::after,.wcm-outline{background-color:transparent}.wcm-ghost:active{opacity:.5}@media(hover:hover){button:hover::after{background-color:var(--wcm-color-overlay)}.wcm-ghost:hover::after{background-color:transparent}.wcm-ghost:hover{opacity:.5}}button:disabled{background-color:var(--wcm-color-bg-3);pointer-events:none}.wcm-ghost::after{border-color:transparent}.wcm-ghost path{fill:var(--wcm-color-fg-2)}.wcm-outline path{fill:var(--wcm-accent-color)}.wcm-outline:disabled{background-color:transparent;opacity:.5}`;var ST=Object.defineProperty,IT=Object.getOwnPropertyDescriptor,nc=(r,e,t,i)=>{for(var n=i>1?void 0:i?IT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&ST(e,t,n),n};let oo=class extends Ct{constructor(){super(...arguments),this.disabled=!1,this.iconLeft=void 0,this.iconRight=void 0,this.onClick=()=>null,this.variant="default"}render(){const r={"wcm-icon-left":this.iconLeft!==void 0,"wcm-icon-right":this.iconRight!==void 0,"wcm-ghost":this.variant==="ghost","wcm-outline":this.variant==="outline"};let e="inverse";return this.variant==="ghost"&&(e="secondary"),this.variant==="outline"&&(e="accent"),Ee`<button class="${Is(r)}" ?disabled="${this.disabled}" @click="${this.onClick}">${this.iconLeft}<wcm-text variant="small-regular" color="${e}"><slot></slot></wcm-text>${this.iconRight}</button>`}};oo.styles=[Lt.globalCss,ET],nc([At({type:Boolean})],oo.prototype,"disabled",2),nc([At()],oo.prototype,"iconLeft",2),nc([At()],oo.prototype,"iconRight",2),nc([At()],oo.prototype,"onClick",2),nc([At()],oo.prototype,"variant",2),oo=nc([Ut("wcm-button")],oo);const MT=jt`:host{display:inline-block}button{padding:0 15px 1px;height:40px;border-radius:var(--wcm-button-border-radius);color:var(--wcm-accent-fill-color);background-color:var(--wcm-accent-color)}button::after{content:'';top:0;bottom:0;left:0;right:0;position:absolute;background-color:transparent;border-radius:inherit;transition:background-color .2s ease;border:1px solid var(--wcm-color-overlay)}button:active::after{background-color:var(--wcm-color-overlay)}button:disabled{padding-bottom:0;background-color:var(--wcm-color-bg-3);color:var(--wcm-color-fg-3)}.wcm-secondary{color:var(--wcm-accent-color);background-color:transparent}.wcm-secondary::after{display:none}@media(hover:hover){button:hover::after{background-color:var(--wcm-color-overlay)}}`;var CT=Object.defineProperty,PT=Object.getOwnPropertyDescriptor,Ip=(r,e,t,i)=>{for(var n=i>1?void 0:i?PT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&CT(e,t,n),n};let Pf=class extends Ct{constructor(){super(...arguments),this.disabled=!1,this.variant="primary"}render(){const r={"wcm-secondary":this.variant==="secondary"};return Ee`<button ?disabled="${this.disabled}" class="${Is(r)}"><slot></slot></button>`}};Pf.styles=[Lt.globalCss,MT],Ip([At({type:Boolean})],Pf.prototype,"disabled",2),Ip([At()],Pf.prototype,"variant",2),Pf=Ip([Ut("wcm-button-big")],Pf);const DT=jt`:host{background-color:var(--wcm-color-bg-2);border-top:1px solid var(--wcm-color-bg-3)}div{padding:10px 20px;display:inherit;flex-direction:inherit;align-items:inherit;width:inherit;justify-content:inherit}`;var OT=Object.defineProperty,RT=Object.getOwnPropertyDescriptor,TT=(r,e,t,i)=>{for(var n=i>1?void 0:i?RT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&OT(e,t,n),n};let Mp=class extends Ct{render(){return Ee`<div><slot></slot></div>`}};Mp.styles=[Lt.globalCss,DT],Mp=TT([Ut("wcm-info-footer")],Mp);const Kt={CROSS_ICON:gr`<svg width="12" height="12" viewBox="0 0 12 12"><path d="M9.94 11A.75.75 0 1 0 11 9.94L7.414 6.353a.5.5 0 0 1 0-.708L11 2.061A.75.75 0 1 0 9.94 1L6.353 4.586a.5.5 0 0 1-.708 0L2.061 1A.75.75 0 0 0 1 2.06l3.586 3.586a.5.5 0 0 1 0 .708L1 9.939A.75.75 0 1 0 2.06 11l3.586-3.586a.5.5 0 0 1 .708 0L9.939 11Z" fill="#fff"/></svg>`,WALLET_CONNECT_LOGO:gr`<svg width="178" height="29" viewBox="0 0 178 29" id="wcm-wc-logo"><path d="M10.683 7.926c5.284-5.17 13.85-5.17 19.134 0l.636.623a.652.652 0 0 1 0 .936l-2.176 2.129a.343.343 0 0 1-.478 0l-.875-.857c-3.686-3.607-9.662-3.607-13.348 0l-.937.918a.343.343 0 0 1-.479 0l-2.175-2.13a.652.652 0 0 1 0-.936l.698-.683Zm23.633 4.403 1.935 1.895a.652.652 0 0 1 0 .936l-8.73 8.543a.687.687 0 0 1-.956 0L20.37 17.64a.172.172 0 0 0-.239 0l-6.195 6.063a.687.687 0 0 1-.957 0l-8.73-8.543a.652.652 0 0 1 0-.936l1.936-1.895a.687.687 0 0 1 .957 0l6.196 6.064a.172.172 0 0 0 .239 0l6.195-6.064a.687.687 0 0 1 .957 0l6.196 6.064a.172.172 0 0 0 .24 0l6.195-6.064a.687.687 0 0 1 .956 0ZM48.093 20.948l2.338-9.355c.139-.515.258-1.07.416-1.942.12.872.258 1.427.357 1.942l2.022 9.355h4.181l3.528-13.874h-3.21l-1.943 8.523a24.825 24.825 0 0 0-.456 2.457c-.158-.931-.317-1.625-.495-2.438l-1.883-8.542h-4.201l-2.042 8.542a41.204 41.204 0 0 0-.475 2.438 41.208 41.208 0 0 0-.476-2.438l-1.903-8.542h-3.349l3.508 13.874h4.083ZM63.33 21.304c1.585 0 2.596-.654 3.11-1.605-.059.297-.078.595-.078.892v.357h2.655V15.22c0-2.735-1.248-4.32-4.3-4.32-2.636 0-4.36 1.466-4.52 3.487h2.914c.1-.891.734-1.426 1.705-1.426.911 0 1.407.515 1.407 1.11 0 .435-.258.693-1.03.792l-1.388.159c-2.061.257-3.825 1.01-3.825 3.19 0 1.982 1.645 3.092 3.35 3.092Zm.891-2.041c-.773 0-1.348-.436-1.348-1.19 0-.733.655-1.09 1.645-1.268l.674-.119c.575-.118.892-.218 1.09-.396v.912c0 1.228-.892 2.06-2.06 2.06ZM70.398 7.074v13.874h2.874V7.074h-2.874ZM74.934 7.074v13.874h2.874V7.074h-2.874ZM84.08 21.304c2.735 0 4.5-1.546 4.697-3.567h-2.893c-.139.892-.892 1.387-1.804 1.387-1.228 0-2.12-.99-2.14-2.358h6.897v-.555c0-3.21-1.764-5.312-4.816-5.312-2.933 0-4.994 2.062-4.994 5.173 0 3.37 2.12 5.232 5.053 5.232Zm-2.16-6.421c.119-1.11.932-1.922 2.081-1.922 1.11 0 1.883.772 1.903 1.922H81.92ZM94.92 21.146c.633 0 1.248-.1 1.525-.179v-2.18c-.218.04-.475.06-.693.06-1.05 0-1.427-.595-1.427-1.566v-3.805h2.338v-2.24h-2.338V7.788H91.47v3.448H89.37v2.24h2.1v4.201c0 2.3 1.15 3.469 3.45 3.469ZM104.62 21.304c3.924 0 6.302-2.299 6.599-5.608h-3.111c-.238 1.803-1.506 3.032-3.369 3.032-2.2 0-3.746-1.784-3.746-4.796 0-2.953 1.605-4.638 3.805-4.638 1.883 0 2.953 1.15 3.171 2.834h3.191c-.317-3.448-2.854-5.41-6.342-5.41-3.984 0-7.036 2.695-7.036 7.214 0 4.677 2.676 7.372 6.838 7.372ZM117.449 21.304c2.993 0 5.114-1.882 5.114-5.172 0-3.23-2.121-5.233-5.114-5.233-2.972 0-5.093 2.002-5.093 5.233 0 3.29 2.101 5.172 5.093 5.172Zm0-2.22c-1.327 0-2.18-1.09-2.18-2.952 0-1.903.892-2.973 2.18-2.973 1.308 0 2.2 1.07 2.2 2.973 0 1.862-.872 2.953-2.2 2.953ZM126.569 20.948v-5.689c0-1.208.753-2.1 1.823-2.1 1.011 0 1.606.773 1.606 2.06v5.729h2.873v-6.144c0-2.339-1.229-3.905-3.428-3.905-1.526 0-2.458.734-2.953 1.606a5.31 5.31 0 0 0 .079-.892v-.377h-2.874v9.712h2.874ZM137.464 20.948v-5.689c0-1.208.753-2.1 1.823-2.1 1.011 0 1.606.773 1.606 2.06v5.729h2.873v-6.144c0-2.339-1.228-3.905-3.428-3.905-1.526 0-2.458.734-2.953 1.606a5.31 5.31 0 0 0 .079-.892v-.377h-2.874v9.712h2.874ZM149.949 21.304c2.735 0 4.499-1.546 4.697-3.567h-2.893c-.139.892-.892 1.387-1.804 1.387-1.228 0-2.12-.99-2.14-2.358h6.897v-.555c0-3.21-1.764-5.312-4.816-5.312-2.933 0-4.994 2.062-4.994 5.173 0 3.37 2.12 5.232 5.053 5.232Zm-2.16-6.421c.119-1.11.932-1.922 2.081-1.922 1.11 0 1.883.772 1.903 1.922h-3.984ZM160.876 21.304c3.013 0 4.658-1.645 4.975-4.201h-2.874c-.099 1.07-.713 1.982-2.001 1.982-1.309 0-2.2-1.21-2.2-2.993 0-1.942 1.03-2.933 2.259-2.933 1.209 0 1.803.872 1.883 1.882h2.873c-.218-2.358-1.823-4.142-4.776-4.142-2.874 0-5.153 1.903-5.153 5.193 0 3.25 1.923 5.212 5.014 5.212ZM172.067 21.146c.634 0 1.248-.1 1.526-.179v-2.18c-.218.04-.476.06-.694.06-1.05 0-1.427-.595-1.427-1.566v-3.805h2.339v-2.24h-2.339V7.788h-2.854v3.448h-2.1v2.24h2.1v4.201c0 2.3 1.15 3.469 3.449 3.469Z" fill="#fff"/></svg>`,WALLET_CONNECT_ICON:gr`<svg width="28" height="20" viewBox="0 0 28 20"><g clip-path="url(#a)"><path d="M7.386 6.482c3.653-3.576 9.575-3.576 13.228 0l.44.43a.451.451 0 0 1 0 .648L19.55 9.033a.237.237 0 0 1-.33 0l-.606-.592c-2.548-2.496-6.68-2.496-9.228 0l-.648.634a.237.237 0 0 1-.33 0L6.902 7.602a.451.451 0 0 1 0-.647l.483-.473Zm16.338 3.046 1.339 1.31a.451.451 0 0 1 0 .648l-6.035 5.909a.475.475 0 0 1-.662 0L14.083 13.2a.119.119 0 0 0-.166 0l-4.283 4.194a.475.475 0 0 1-.662 0l-6.035-5.91a.451.451 0 0 1 0-.647l1.338-1.31a.475.475 0 0 1 .662 0l4.283 4.194c.046.044.12.044.166 0l4.283-4.194a.475.475 0 0 1 .662 0l4.283 4.194c.046.044.12.044.166 0l4.283-4.194a.475.475 0 0 1 .662 0Z" fill="#000000"/></g><defs><clipPath id="a"><path fill="#ffffff" d="M0 0h28v20H0z"/></clipPath></defs></svg>`,WALLET_CONNECT_ICON_COLORED:gr`<svg width="96" height="96" fill="none"><path fill="#fff" d="M25.322 33.597c12.525-12.263 32.83-12.263 45.355 0l1.507 1.476a1.547 1.547 0 0 1 0 2.22l-5.156 5.048a.814.814 0 0 1-1.134 0l-2.074-2.03c-8.737-8.555-22.903-8.555-31.64 0l-2.222 2.175a.814.814 0 0 1-1.134 0l-5.156-5.049a1.547 1.547 0 0 1 0-2.22l1.654-1.62Zm56.019 10.44 4.589 4.494a1.547 1.547 0 0 1 0 2.22l-20.693 20.26a1.628 1.628 0 0 1-2.267 0L48.283 56.632a.407.407 0 0 0-.567 0L33.03 71.012a1.628 1.628 0 0 1-2.268 0L10.07 50.75a1.547 1.547 0 0 1 0-2.22l4.59-4.494a1.628 1.628 0 0 1 2.267 0l14.687 14.38c.156.153.41.153.567 0l14.685-14.38a1.628 1.628 0 0 1 2.268 0l14.687 14.38c.156.153.41.153.567 0l14.686-14.38a1.628 1.628 0 0 1 2.268 0Z"/><path stroke="#000" d="M25.672 33.954c12.33-12.072 32.325-12.072 44.655 0l1.508 1.476a1.047 1.047 0 0 1 0 1.506l-5.157 5.048a.314.314 0 0 1-.434 0l-2.074-2.03c-8.932-8.746-23.409-8.746-32.34 0l-2.222 2.174a.314.314 0 0 1-.434 0l-5.157-5.048a1.047 1.047 0 0 1 0-1.506l1.655-1.62Zm55.319 10.44 4.59 4.494a1.047 1.047 0 0 1 0 1.506l-20.694 20.26a1.128 1.128 0 0 1-1.568 0l-14.686-14.38a.907.907 0 0 0-1.267 0L32.68 70.655a1.128 1.128 0 0 1-1.568 0L10.42 50.394a1.047 1.047 0 0 1 0-1.506l4.59-4.493a1.128 1.128 0 0 1 1.567 0l14.687 14.379a.907.907 0 0 0 1.266 0l-.35-.357.35.357 14.686-14.38a1.128 1.128 0 0 1 1.568 0l14.687 14.38a.907.907 0 0 0 1.267 0l14.686-14.38a1.128 1.128 0 0 1 1.568 0Z"/></svg>`,BACK_ICON:gr`<svg width="10" height="18" viewBox="0 0 10 18"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.735.179a.75.75 0 0 1 .087 1.057L2.92 8.192a1.25 1.25 0 0 0 0 1.617l5.902 6.956a.75.75 0 1 1-1.144.97L1.776 10.78a2.75 2.75 0 0 1 0-3.559L7.678.265A.75.75 0 0 1 8.735.18Z" fill="#fff"/></svg>`,COPY_ICON:gr`<svg width="24" height="24" fill="none"><path fill="#fff" fill-rule="evenodd" d="M7.01 7.01c.03-1.545.138-2.5.535-3.28A5 5 0 0 1 9.73 1.545C10.8 1 12.2 1 15 1c2.8 0 4.2 0 5.27.545a5 5 0 0 1 2.185 2.185C23 4.8 23 6.2 23 9c0 2.8 0 4.2-.545 5.27a5 5 0 0 1-2.185 2.185c-.78.397-1.735.505-3.28.534l-.001.01c-.03 1.54-.138 2.493-.534 3.27a5 5 0 0 1-2.185 2.186C13.2 23 11.8 23 9 23c-2.8 0-4.2 0-5.27-.545a5 5 0 0 1-2.185-2.185C1 19.2 1 17.8 1 15c0-2.8 0-4.2.545-5.27A5 5 0 0 1 3.73 7.545C4.508 7.149 5.46 7.04 7 7.01h.01ZM15 15.5c-1.425 0-2.403-.001-3.162-.063-.74-.06-1.139-.172-1.427-.319a3.5 3.5 0 0 1-1.53-1.529c-.146-.288-.257-.686-.318-1.427C8.501 11.403 8.5 10.425 8.5 9c0-1.425.001-2.403.063-3.162.06-.74.172-1.139.318-1.427a3.5 3.5 0 0 1 1.53-1.53c.288-.146.686-.257 1.427-.318.759-.062 1.737-.063 3.162-.063 1.425 0 2.403.001 3.162.063.74.06 1.139.172 1.427.318a3.5 3.5 0 0 1 1.53 1.53c.146.288.257.686.318 1.427.062.759.063 1.737.063 3.162 0 1.425-.001 2.403-.063 3.162-.06.74-.172 1.139-.319 1.427a3.5 3.5 0 0 1-1.529 1.53c-.288.146-.686.257-1.427.318-.759.062-1.737.063-3.162.063ZM7 8.511c-.444.009-.825.025-1.162.052-.74.06-1.139.172-1.427.318a3.5 3.5 0 0 0-1.53 1.53c-.146.288-.257.686-.318 1.427-.062.759-.063 1.737-.063 3.162 0 1.425.001 2.403.063 3.162.06.74.172 1.139.318 1.427a3.5 3.5 0 0 0 1.53 1.53c.288.146.686.257 1.427.318.759.062 1.737.063 3.162.063 1.425 0 2.403-.001 3.162-.063.74-.06 1.139-.172 1.427-.319a3.5 3.5 0 0 0 1.53-1.53c.146-.287.257-.685.318-1.426.027-.337.043-.718.052-1.162H15c-2.8 0-4.2 0-5.27-.545a5 5 0 0 1-2.185-2.185C7 13.2 7 11.8 7 9v-.489Z" clip-rule="evenodd"/></svg>`,RETRY_ICON:gr`<svg width="15" height="16" viewBox="0 0 15 16"><path d="M6.464 2.03A.75.75 0 0 0 5.403.97L2.08 4.293a1 1 0 0 0 0 1.414L5.403 9.03a.75.75 0 0 0 1.06-1.06L4.672 6.177a.25.25 0 0 1 .177-.427h2.085a4 4 0 1 1-3.93 4.746c-.077-.407-.405-.746-.82-.746-.414 0-.755.338-.7.748a5.501 5.501 0 1 0 5.45-6.248H4.848a.25.25 0 0 1-.177-.427L6.464 2.03Z" fill="#fff"/></svg>`,DESKTOP_ICON:gr`<svg width="16" height="16" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M0 5.98c0-1.85 0-2.775.394-3.466a3 3 0 0 1 1.12-1.12C2.204 1 3.13 1 4.98 1h6.04c1.85 0 2.775 0 3.466.394a3 3 0 0 1 1.12 1.12C16 3.204 16 4.13 16 5.98v1.04c0 1.85 0 2.775-.394 3.466a3 3 0 0 1-1.12 1.12C13.796 12 12.87 12 11.02 12H4.98c-1.85 0-2.775 0-3.466-.394a3 3 0 0 1-1.12-1.12C0 9.796 0 8.87 0 7.02V5.98ZM4.98 2.5h6.04c.953 0 1.568.001 2.034.043.446.04.608.108.69.154a1.5 1.5 0 0 1 .559.56c.046.08.114.243.154.69.042.465.043 1.08.043 2.033v1.04c0 .952-.001 1.568-.043 2.034-.04.446-.108.608-.154.69a1.499 1.499 0 0 1-.56.559c-.08.046-.243.114-.69.154-.466.042-1.08.043-2.033.043H4.98c-.952 0-1.568-.001-2.034-.043-.446-.04-.608-.108-.69-.154a1.5 1.5 0 0 1-.559-.56c-.046-.08-.114-.243-.154-.69-.042-.465-.043-1.08-.043-2.033V5.98c0-.952.001-1.568.043-2.034.04-.446.108-.608.154-.69a1.5 1.5 0 0 1 .56-.559c.08-.046.243-.114.69-.154.465-.042 1.08-.043 2.033-.043Z" fill="#fff"/><path d="M4 14.25a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1-.75-.75Z" fill="#fff"/></svg>`,MOBILE_ICON:gr`<svg width="16" height="16" viewBox="0 0 16 16"><path d="M6.75 5a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M3 4.98c0-1.85 0-2.775.394-3.466a3 3 0 0 1 1.12-1.12C5.204 0 6.136 0 8 0s2.795 0 3.486.394a3 3 0 0 1 1.12 1.12C13 2.204 13 3.13 13 4.98v6.04c0 1.85 0 2.775-.394 3.466a3 3 0 0 1-1.12 1.12C10.796 16 9.864 16 8 16s-2.795 0-3.486-.394a3 3 0 0 1-1.12-1.12C3 13.796 3 12.87 3 11.02V4.98Zm8.5 0v6.04c0 .953-.001 1.568-.043 2.034-.04.446-.108.608-.154.69a1.499 1.499 0 0 1-.56.559c-.08.045-.242.113-.693.154-.47.042-1.091.043-2.05.043-.959 0-1.58-.001-2.05-.043-.45-.04-.613-.109-.693-.154a1.5 1.5 0 0 1-.56-.56c-.046-.08-.114-.243-.154-.69-.042-.466-.043-1.08-.043-2.033V4.98c0-.952.001-1.568.043-2.034.04-.446.108-.608.154-.69a1.5 1.5 0 0 1 .56-.559c.08-.045.243-.113.693-.154C6.42 1.501 7.041 1.5 8 1.5c.959 0 1.58.001 2.05.043.45.04.613.109.693.154a1.5 1.5 0 0 1 .56.56c.046.08.114.243.154.69.042.465.043 1.08.043 2.033Z" fill="#fff"/></svg>`,ARROW_DOWN_ICON:gr`<svg width="14" height="14" viewBox="0 0 14 14"><path d="M2.28 7.47a.75.75 0 0 0-1.06 1.06l5.25 5.25a.75.75 0 0 0 1.06 0l5.25-5.25a.75.75 0 0 0-1.06-1.06l-3.544 3.543a.25.25 0 0 1-.426-.177V.75a.75.75 0 0 0-1.5 0v10.086a.25.25 0 0 1-.427.176L2.28 7.47Z" fill="#fff"/></svg>`,ARROW_UP_RIGHT_ICON:gr`<svg width="15" height="14" fill="none"><path d="M4.5 1.75A.75.75 0 0 1 5.25 1H12a1.5 1.5 0 0 1 1.5 1.5v6.75a.75.75 0 0 1-1.5 0V4.164a.25.25 0 0 0-.427-.176L4.061 11.5A.75.75 0 0 1 3 10.44l7.513-7.513a.25.25 0 0 0-.177-.427H5.25a.75.75 0 0 1-.75-.75Z" fill="#fff"/></svg>`,ARROW_RIGHT_ICON:gr`<svg width="6" height="14" viewBox="0 0 6 14"><path fill-rule="evenodd" clip-rule="evenodd" d="M2.181 1.099a.75.75 0 0 1 1.024.279l2.433 4.258a2.75 2.75 0 0 1 0 2.729l-2.433 4.257a.75.75 0 1 1-1.303-.744L4.335 7.62a1.25 1.25 0 0 0 0-1.24L1.902 2.122a.75.75 0 0 1 .28-1.023Z" fill="#fff"/></svg>`,QRCODE_ICON:gr`<svg width="25" height="24" viewBox="0 0 25 24"><path d="M23.748 9a.748.748 0 0 0 .748-.752c-.018-2.596-.128-4.07-.784-5.22a6 6 0 0 0-2.24-2.24c-1.15-.656-2.624-.766-5.22-.784a.748.748 0 0 0-.752.748c0 .414.335.749.748.752 1.015.007 1.82.028 2.494.088.995.09 1.561.256 1.988.5.7.398 1.28.978 1.679 1.678.243.427.41.993.498 1.988.061.675.082 1.479.09 2.493a.753.753 0 0 0 .75.749ZM3.527.788C4.677.132 6.152.022 8.747.004A.748.748 0 0 1 9.5.752a.753.753 0 0 1-.749.752c-1.014.007-1.818.028-2.493.088-.995.09-1.561.256-1.988.5-.7.398-1.28.978-1.679 1.678-.243.427-.41.993-.499 1.988-.06.675-.081 1.479-.088 2.493A.753.753 0 0 1 1.252 9a.748.748 0 0 1-.748-.752c.018-2.596.128-4.07.784-5.22a6 6 0 0 1 2.24-2.24ZM1.252 15a.748.748 0 0 0-.748.752c.018 2.596.128 4.07.784 5.22a6 6 0 0 0 2.24 2.24c1.15.656 2.624.766 5.22.784a.748.748 0 0 0 .752-.748.753.753 0 0 0-.749-.752c-1.014-.007-1.818-.028-2.493-.089-.995-.089-1.561-.255-1.988-.498a4.5 4.5 0 0 1-1.679-1.68c-.243-.426-.41-.992-.499-1.987-.06-.675-.081-1.479-.088-2.493A.753.753 0 0 0 1.252 15ZM22.996 15.749a.753.753 0 0 1 .752-.749c.415 0 .751.338.748.752-.018 2.596-.128 4.07-.784 5.22a6 6 0 0 1-2.24 2.24c-1.15.656-2.624.766-5.22.784a.748.748 0 0 1-.752-.748c0-.414.335-.749.748-.752 1.015-.007 1.82-.028 2.494-.089.995-.089 1.561-.255 1.988-.498a4.5 4.5 0 0 0 1.679-1.68c.243-.426.41-.992.498-1.987.061-.675.082-1.479.09-2.493Z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M7 4a2.5 2.5 0 0 0-2.5 2.5v2A2.5 2.5 0 0 0 7 11h2a2.5 2.5 0 0 0 2.5-2.5v-2A2.5 2.5 0 0 0 9 4H7Zm2 1.5H7a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1ZM13.5 6.5A2.5 2.5 0 0 1 16 4h2a2.5 2.5 0 0 1 2.5 2.5v2A2.5 2.5 0 0 1 18 11h-2a2.5 2.5 0 0 1-2.5-2.5v-2Zm2.5-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1ZM7 13a2.5 2.5 0 0 0-2.5 2.5v2A2.5 2.5 0 0 0 7 20h2a2.5 2.5 0 0 0 2.5-2.5v-2A2.5 2.5 0 0 0 9 13H7Zm2 1.5H7a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1Z" fill="#fff"/><path d="M13.5 15.5c0-.465 0-.697.038-.89a2 2 0 0 1 1.572-1.572C15.303 13 15.535 13 16 13v2.5h-2.5ZM18 13c.465 0 .697 0 .89.038a2 2 0 0 1 1.572 1.572c.038.193.038.425.038.89H18V13ZM18 17.5h2.5c0 .465 0 .697-.038.89a2 2 0 0 1-1.572 1.572C18.697 20 18.465 20 18 20v-2.5ZM13.5 17.5H16V20c-.465 0-.697 0-.89-.038a2 2 0 0 1-1.572-1.572c-.038-.193-.038-.425-.038-.89Z" fill="#fff"/></svg>`,SCAN_ICON:gr`<svg width="16" height="16" fill="none"><path fill="#fff" d="M10 15.216c0 .422.347.763.768.74 1.202-.064 2.025-.222 2.71-.613a5.001 5.001 0 0 0 1.865-1.866c.39-.684.549-1.507.613-2.709a.735.735 0 0 0-.74-.768.768.768 0 0 0-.76.732c-.009.157-.02.306-.032.447-.073.812-.206 1.244-.384 1.555-.31.545-.761.996-1.306 1.306-.311.178-.743.311-1.555.384-.141.013-.29.023-.447.032a.768.768 0 0 0-.732.76ZM10 .784c0 .407.325.737.732.76.157.009.306.02.447.032.812.073 1.244.206 1.555.384a3.5 3.5 0 0 1 1.306 1.306c.178.311.311.743.384 1.555.013.142.023.29.032.447a.768.768 0 0 0 .76.732.734.734 0 0 0 .74-.768c-.064-1.202-.222-2.025-.613-2.71A5 5 0 0 0 13.477.658c-.684-.39-1.507-.549-2.709-.613a.735.735 0 0 0-.768.74ZM5.232.044A.735.735 0 0 1 6 .784a.768.768 0 0 1-.732.76c-.157.009-.305.02-.447.032-.812.073-1.244.206-1.555.384A3.5 3.5 0 0 0 1.96 3.266c-.178.311-.311.743-.384 1.555-.013.142-.023.29-.032.447A.768.768 0 0 1 .784 6a.735.735 0 0 1-.74-.768c.064-1.202.222-2.025.613-2.71A5 5 0 0 1 2.523.658C3.207.267 4.03.108 5.233.044ZM5.268 14.456a.768.768 0 0 1 .732.76.734.734 0 0 1-.768.74c-1.202-.064-2.025-.222-2.71-.613a5 5 0 0 1-1.865-1.866c-.39-.684-.549-1.507-.613-2.709A.735.735 0 0 1 .784 10c.407 0 .737.325.76.732.009.157.02.306.032.447.073.812.206 1.244.384 1.555a3.5 3.5 0 0 0 1.306 1.306c.311.178.743.311 1.555.384.142.013.29.023.447.032Z"/></svg>`,CHECKMARK_ICON:gr`<svg width="13" height="12" viewBox="0 0 13 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.155.132a.75.75 0 0 1 .232 1.035L5.821 11.535a1 1 0 0 1-1.626.09L.665 7.21a.75.75 0 1 1 1.17-.937L4.71 9.867a.25.25 0 0 0 .406-.023L11.12.364a.75.75 0 0 1 1.035-.232Z" fill="#fff"/></svg>`,SEARCH_ICON:gr`<svg width="20" height="21"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.432 13.992c-.354-.353-.91-.382-1.35-.146a5.5 5.5 0 1 1 2.265-2.265c-.237.441-.208.997.145 1.35l3.296 3.296a.75.75 0 1 1-1.06 1.061l-3.296-3.296Zm.06-5a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z" fill="#949E9E"/></svg>`,WALLET_PLACEHOLDER:gr`<svg width="60" height="60" fill="none" viewBox="0 0 60 60"><g clip-path="url(#q)"><path id="wallet-placeholder-fill" fill="#fff" d="M0 24.9c0-9.251 0-13.877 1.97-17.332a15 15 0 0 1 5.598-5.597C11.023 0 15.648 0 24.9 0h10.2c9.252 0 13.877 0 17.332 1.97a15 15 0 0 1 5.597 5.598C60 11.023 60 15.648 60 24.9v10.2c0 9.252 0 13.877-1.97 17.332a15.001 15.001 0 0 1-5.598 5.597C48.977 60 44.352 60 35.1 60H24.9c-9.251 0-13.877 0-17.332-1.97a15 15 0 0 1-5.597-5.598C0 48.977 0 44.352 0 35.1V24.9Z"/><path id="wallet-placeholder-dash" stroke="#000" stroke-dasharray="4 4" stroke-width="1.5" d="M.04 41.708a231.598 231.598 0 0 1-.039-4.403l.75-.001L.75 35.1v-2.55H0v-5.1h.75V24.9l.001-2.204h-.75c.003-1.617.011-3.077.039-4.404l.75.016c.034-1.65.099-3.08.218-4.343l-.746-.07c.158-1.678.412-3.083.82-4.316l.713.236c.224-.679.497-1.296.827-1.875a14.25 14.25 0 0 1 1.05-1.585L3.076 5.9A15 15 0 0 1 5.9 3.076l.455.596a14.25 14.25 0 0 1 1.585-1.05c.579-.33 1.196-.603 1.875-.827l-.236-.712C10.812.674 12.217.42 13.895.262l.07.746C15.23.89 16.66.824 18.308.79l-.016-.75C19.62.012 21.08.004 22.695.001l.001.75L24.9.75h2.55V0h5.1v.75h2.55l2.204.001v-.75c1.617.003 3.077.011 4.404.039l-.016.75c1.65.034 3.08.099 4.343.218l.07-.746c1.678.158 3.083.412 4.316.82l-.236.713c.679.224 1.296.497 1.875.827a14.24 14.24 0 0 1 1.585 1.05l.455-.596A14.999 14.999 0 0 1 56.924 5.9l-.596.455c.384.502.735 1.032 1.05 1.585.33.579.602 1.196.827 1.875l.712-.236c.409 1.233.663 2.638.822 4.316l-.747.07c.119 1.264.184 2.694.218 4.343l.75-.016c.028 1.327.036 2.787.039 4.403l-.75.001.001 2.204v2.55H60v5.1h-.75v2.55l-.001 2.204h.75a231.431 231.431 0 0 1-.039 4.404l-.75-.016c-.034 1.65-.099 3.08-.218 4.343l.747.07c-.159 1.678-.413 3.083-.822 4.316l-.712-.236a10.255 10.255 0 0 1-.827 1.875 14.242 14.242 0 0 1-1.05 1.585l.596.455a14.997 14.997 0 0 1-2.824 2.824l-.455-.596c-.502.384-1.032.735-1.585 1.05-.579.33-1.196.602-1.875.827l.236.712c-1.233.409-2.638.663-4.316.822l-.07-.747c-1.264.119-2.694.184-4.343.218l.016.75c-1.327.028-2.787.036-4.403.039l-.001-.75-2.204.001h-2.55V60h-5.1v-.75H24.9l-2.204-.001v.75a231.431 231.431 0 0 1-4.404-.039l.016-.75c-1.65-.034-3.08-.099-4.343-.218l-.07.747c-1.678-.159-3.083-.413-4.316-.822l.236-.712a10.258 10.258 0 0 1-1.875-.827 14.252 14.252 0 0 1-1.585-1.05l-.455.596A14.999 14.999 0 0 1 3.076 54.1l.596-.455a14.24 14.24 0 0 1-1.05-1.585 10.259 10.259 0 0 1-.827-1.875l-.712.236C.674 49.188.42 47.783.262 46.105l.746-.07C.89 44.77.824 43.34.79 41.692l-.75.016Z"/><path fill="#fff" fill-rule="evenodd" d="M35.643 32.145c-.297-.743-.445-1.114-.401-1.275a.42.42 0 0 1 .182-.27c.134-.1.463-.1 1.123-.1.742 0 1.499.046 2.236-.05a6 6 0 0 0 5.166-5.166c.051-.39.051-.855.051-1.784 0-.928 0-1.393-.051-1.783a6 6 0 0 0-5.166-5.165c-.39-.052-.854-.052-1.783-.052h-7.72c-4.934 0-7.401 0-9.244 1.051a8 8 0 0 0-2.985 2.986C16.057 22.28 16.003 24.58 16 29 15.998 31.075 16 33.15 16 35.224A7.778 7.778 0 0 0 23.778 43H28.5c1.394 0 2.09 0 2.67-.116a6 6 0 0 0 4.715-4.714c.115-.58.115-1.301.115-2.744 0-1.31 0-1.964-.114-2.49a4.998 4.998 0 0 0-.243-.792Z" clip-rule="evenodd"/><path fill="#9EA9A9" fill-rule="evenodd" d="M37 18h-7.72c-2.494 0-4.266.002-5.647.126-1.361.122-2.197.354-2.854.728a6.5 6.5 0 0 0-2.425 2.426c-.375.657-.607 1.492-.729 2.853-.11 1.233-.123 2.777-.125 4.867 0 .7 0 1.05.097 1.181.096.13.182.181.343.2.163.02.518-.18 1.229-.581a6.195 6.195 0 0 1 3.053-.8H37c.977 0 1.32-.003 1.587-.038a4.5 4.5 0 0 0 3.874-3.874c.036-.268.039-.611.039-1.588 0-.976-.003-1.319-.038-1.587a4.5 4.5 0 0 0-3.875-3.874C38.32 18.004 37.977 18 37 18Zm-7.364 12.5h-7.414a4.722 4.722 0 0 0-4.722 4.723 6.278 6.278 0 0 0 6.278 6.278H28.5c1.466 0 1.98-.008 2.378-.087a4.5 4.5 0 0 0 3.535-3.536c.08-.397.087-.933.087-2.451 0-1.391-.009-1.843-.08-2.17a3.5 3.5 0 0 0-2.676-2.676c-.328-.072-.762-.08-2.108-.08Z" clip-rule="evenodd"/></g><defs><clipPath id="q"><path fill="#fff" d="M0 0h60v60H0z"/></clipPath></defs></svg>`,GLOBE_ICON:gr`<svg width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="#fff" fill-rule="evenodd" d="M15.5 8a7.5 7.5 0 1 1-15 0 7.5 7.5 0 0 1 15 0Zm-2.113.75c.301 0 .535.264.47.558a6.01 6.01 0 0 1-2.867 3.896c-.203.116-.42-.103-.334-.32.409-1.018.691-2.274.797-3.657a.512.512 0 0 1 .507-.477h1.427Zm.47-2.058c.065.294-.169.558-.47.558H11.96a.512.512 0 0 1-.507-.477c-.106-1.383-.389-2.638-.797-3.656-.087-.217.13-.437.333-.32a6.01 6.01 0 0 1 2.868 3.895Zm-4.402.558c.286 0 .515-.24.49-.525-.121-1.361-.429-2.534-.83-3.393-.279-.6-.549-.93-.753-1.112a.535.535 0 0 0-.724 0c-.204.182-.474.513-.754 1.112-.4.859-.708 2.032-.828 3.393a.486.486 0 0 0 .49.525h2.909Zm-5.415 0c.267 0 .486-.21.507-.477.106-1.383.389-2.638.797-3.656.087-.217-.13-.437-.333-.32a6.01 6.01 0 0 0-2.868 3.895c-.065.294.169.558.47.558H4.04ZM2.143 9.308c-.065-.294.169-.558.47-.558H4.04c.267 0 .486.21.507.477.106 1.383.389 2.639.797 3.657.087.217-.13.436-.333.32a6.01 6.01 0 0 1-2.868-3.896Zm3.913-.033a.486.486 0 0 1 .49-.525h2.909c.286 0 .515.24.49.525-.121 1.361-.428 2.535-.83 3.394-.279.6-.549.93-.753 1.112a.535.535 0 0 1-.724 0c-.204-.182-.474-.513-.754-1.112-.4-.859-.708-2.033-.828-3.394Z" clip-rule="evenodd"/></svg>`},NT=jt`.wcm-toolbar-placeholder{top:0;bottom:0;left:0;right:0;width:100%;position:absolute;display:block;pointer-events:none;height:100px;border-radius:calc(var(--wcm-background-border-radius) * .9);background-color:var(--wcm-background-color);background-position:center;background-size:cover}.wcm-toolbar{height:38px;display:flex;position:relative;margin:5px 15px 5px 5px;justify-content:space-between;align-items:center}.wcm-toolbar img,.wcm-toolbar svg{height:28px;object-position:left center;object-fit:contain}#wcm-wc-logo path{fill:var(--wcm-accent-fill-color)}button{width:28px;height:28px;border-radius:var(--wcm-icon-button-border-radius);border:0;display:flex;justify-content:center;align-items:center;cursor:pointer;background-color:var(--wcm-color-bg-1);box-shadow:0 0 0 1px var(--wcm-color-overlay)}button:active{background-color:var(--wcm-color-bg-2)}button svg{display:block;object-position:center}button path{fill:var(--wcm-color-fg-1)}.wcm-toolbar div{display:flex}@media(hover:hover){button:hover{background-color:var(--wcm-color-bg-2)}}`;var $T=Object.defineProperty,LT=Object.getOwnPropertyDescriptor,BT=(r,e,t,i)=>{for(var n=i>1?void 0:i?LT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&$T(e,t,n),n};let Cp=class extends Ct{render(){return Ee`<div class="wcm-toolbar-placeholder"></div><div class="wcm-toolbar">${Kt.WALLET_CONNECT_LOGO} <button @click="${Vo.close}">${Kt.CROSS_ICON}</button></div>`}};Cp.styles=[Lt.globalCss,NT],Cp=BT([Ut("wcm-modal-backcard")],Cp);const FT=jt`main{padding:20px;padding-top:0;width:100%}`;var UT=Object.defineProperty,qT=Object.getOwnPropertyDescriptor,zT=(r,e,t,i)=>{for(var n=i>1?void 0:i?qT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&UT(e,t,n),n};let Pp=class extends Ct{render(){return Ee`<main><slot></slot></main>`}};Pp.styles=[Lt.globalCss,FT],Pp=zT([Ut("wcm-modal-content")],Pp);const HT=jt`footer{padding:10px;display:flex;flex-direction:column;align-items:inherit;justify-content:inherit;border-top:1px solid var(--wcm-color-bg-2)}`;var kT=Object.defineProperty,jT=Object.getOwnPropertyDescriptor,WT=(r,e,t,i)=>{for(var n=i>1?void 0:i?jT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&kT(e,t,n),n};let Dp=class extends Ct{render(){return Ee`<footer><slot></slot></footer>`}};Dp.styles=[Lt.globalCss,HT],Dp=WT([Ut("wcm-modal-footer")],Dp);const KT=jt`header{display:flex;justify-content:center;align-items:center;padding:20px;position:relative}.wcm-border{border-bottom:1px solid var(--wcm-color-bg-2);margin-bottom:20px}header button{padding:15px 20px}header button:active{opacity:.5}@media(hover:hover){header button:hover{opacity:.5}}.wcm-back-btn{position:absolute;left:0}.wcm-action-btn{position:absolute;right:0}path{fill:var(--wcm-accent-color)}`;var VT=Object.defineProperty,GT=Object.getOwnPropertyDescriptor,Df=(r,e,t,i)=>{for(var n=i>1?void 0:i?GT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&VT(e,t,n),n};let ta=class extends Ct{constructor(){super(...arguments),this.title="",this.onAction=void 0,this.actionIcon=void 0,this.border=!1}backBtnTemplate(){return Ee`<button class="wcm-back-btn" @click="${lr.goBack}">${Kt.BACK_ICON}</button>`}actionBtnTemplate(){return Ee`<button class="wcm-action-btn" @click="${this.onAction}">${this.actionIcon}</button>`}render(){const r={"wcm-border":this.border},e=lr.state.history.length>1,t=this.title?Ee`<wcm-text variant="big-bold">${this.title}</wcm-text>`:Ee`<slot></slot>`;return Ee`<header class="${Is(r)}">${e?this.backBtnTemplate():null} ${t} ${this.onAction?this.actionBtnTemplate():null}</header>`}};ta.styles=[Lt.globalCss,KT],Df([At()],ta.prototype,"title",2),Df([At()],ta.prototype,"onAction",2),Df([At()],ta.prototype,"actionIcon",2),Df([At({type:Boolean})],ta.prototype,"border",2),ta=Df([Ut("wcm-modal-header")],ta);const pt={MOBILE_BREAKPOINT:600,WCM_RECENT_WALLET_DATA:"WCM_RECENT_WALLET_DATA",EXPLORER_WALLET_URL:"https://explorer.walletconnect.com/?type=wallet",getShadowRootElement(r,e){const t=r.renderRoot.querySelector(e);if(!t)throw new Error(`${e} not found`);return t},getWalletIcon({id:r,image_id:e}){const{walletImages:t}=qi.state;return t?.[r]?t[r]:e?_i.getWalletImageUrl(e):""},getWalletName(r,e=!1){return e&&r.length>8?`${r.substring(0,8)}..`:r},isMobileAnimation(){return window.innerWidth<=pt.MOBILE_BREAKPOINT},async preloadImage(r){const e=new Promise((t,i)=>{const n=new Image;n.onload=t,n.onerror=i,n.crossOrigin="anonymous",n.src=r});return Promise.race([e,je.wait(3e3)])},getErrorMessage(r){return r instanceof Error?r.message:"Unknown Error"},debounce(r,e=500){let t;return(...i)=>{function n(){r(...i)}t&&clearTimeout(t),t=setTimeout(n,e)}},handleMobileLinking(r,e="_self"){const{walletConnectUri:t}=yr.state,{mobile:i,name:n}=r,s=i?.native,a=i?.universal;pt.setRecentWallet(r);function f(h){if(s){const u=je.formatNativeUrl(s,h,n);je.openHref(u,e)}else if(a){const u=je.formatUniversalUrl(a,h,n);je.openHref(u,e)}}t&&f(t)},handleAndroidLinking(){const{walletConnectUri:r}=yr.state;r&&(je.setWalletConnectAndroidDeepLink(r),je.openHref(r,je.isTelegram()?"_blank":"_self"))},async handleUriCopy(){const{walletConnectUri:r}=yr.state;if(r)try{await navigator.clipboard.writeText(r),to.openToast("Link copied","success")}catch{to.openToast("Failed to copy","error")}},getCustomImageUrls(){const{walletImages:r}=qi.state,e=Object.values(r??{});return Object.values(e)},truncate(r,e=8){return r.length<=e?r:`${r.substring(0,4)}...${r.substring(r.length-4)}`},setRecentWallet(r){try{localStorage.setItem(pt.WCM_RECENT_WALLET_DATA,JSON.stringify(r))}catch{console.info("Unable to set recent wallet")}},getRecentWallet(){try{const r=localStorage.getItem(pt.WCM_RECENT_WALLET_DATA);return r?JSON.parse(r):void 0}catch{console.info("Unable to get recent wallet")}},caseSafeIncludes(r,e){return r.toUpperCase().includes(e.toUpperCase())},openWalletExplorerUrl(){je.openHref(pt.EXPLORER_WALLET_URL,"_blank")},getCachedRouterWalletPlatforms(){const{desktop:r,mobile:e}=je.getWalletRouterData(),t=!!r?.native,i=!!r?.universal,n=!!e?.native||!!e?.universal;return{isDesktop:t,isMobile:n,isWeb:i}},goToConnectingView(r){lr.setData({Wallet:r});const e=je.isMobile(),{isDesktop:t,isWeb:i,isMobile:n}=pt.getCachedRouterWalletPlatforms();e?n?(lr.push("MobileConnecting"),!je.isAndroid()&&je.isTelegram()&&this.handleMobileLinking(r,"_blank")):i?lr.push("WebConnecting"):lr.push("InstallWallet"):t?lr.push("DesktopConnecting"):i?lr.push("WebConnecting"):n?lr.push("MobileQrcodeConnecting"):lr.push("InstallWallet")}},YT=jt`.wcm-router{overflow:hidden;will-change:transform}.wcm-content{display:flex;flex-direction:column}`;var JT=Object.defineProperty,QT=Object.getOwnPropertyDescriptor,Op=(r,e,t,i)=>{for(var n=i>1?void 0:i?QT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&JT(e,t,n),n};let Of=class extends Ct{constructor(){super(),this.view=lr.state.view,this.prevView=lr.state.view,this.unsubscribe=void 0,this.oldHeight="0px",this.resizeObserver=void 0,this.unsubscribe=lr.subscribe(r=>{this.view!==r.view&&this.onChangeRoute()})}firstUpdated(){this.resizeObserver=new ResizeObserver(([r])=>{const e=`${r.contentRect.height}px`;this.oldHeight!=="0px"&&ea(this.routerEl,{height:[this.oldHeight,e]},{duration:.2}),this.oldHeight=e}),this.resizeObserver.observe(this.contentEl)}disconnectedCallback(){var r,e;(r=this.unsubscribe)==null||r.call(this),(e=this.resizeObserver)==null||e.disconnect()}get routerEl(){return pt.getShadowRootElement(this,".wcm-router")}get contentEl(){return pt.getShadowRootElement(this,".wcm-content")}viewTemplate(){switch(this.view){case"ConnectWallet":return Ee`<wcm-connect-wallet-view></wcm-connect-wallet-view>`;case"DesktopConnecting":return Ee`<wcm-desktop-connecting-view></wcm-desktop-connecting-view>`;case"MobileConnecting":return Ee`<wcm-mobile-connecting-view></wcm-mobile-connecting-view>`;case"WebConnecting":return Ee`<wcm-web-connecting-view></wcm-web-connecting-view>`;case"MobileQrcodeConnecting":return Ee`<wcm-mobile-qr-connecting-view></wcm-mobile-qr-connecting-view>`;case"WalletExplorer":return Ee`<wcm-wallet-explorer-view></wcm-wallet-explorer-view>`;case"Qrcode":return Ee`<wcm-qrcode-view></wcm-qrcode-view>`;case"InstallWallet":return Ee`<wcm-install-wallet-view></wcm-install-wallet-view>`;default:return Ee`<div>Not Found</div>`}}async onChangeRoute(){await ea(this.routerEl,{opacity:[1,0],scale:[1,1.02]},{duration:.15,delay:.1}).finished,this.view=lr.state.view,ea(this.routerEl,{opacity:[0,1],scale:[.99,1]},{duration:.37,delay:.05})}render(){return Ee`<div class="wcm-router"><div class="wcm-content">${this.viewTemplate()}</div></div>`}};Of.styles=[Lt.globalCss,YT],Op([xi()],Of.prototype,"view",2),Op([xi()],Of.prototype,"prevView",2),Of=Op([Ut("wcm-modal-router")],Of);const ZT=jt`div{height:36px;width:max-content;display:flex;justify-content:center;align-items:center;padding:9px 15px 11px;position:absolute;top:12px;box-shadow:0 6px 14px -6px rgba(10,16,31,.3),0 10px 32px -4px rgba(10,16,31,.15);z-index:2;left:50%;transform:translateX(-50%);pointer-events:none;backdrop-filter:blur(20px) saturate(1.8);-webkit-backdrop-filter:blur(20px) saturate(1.8);border-radius:var(--wcm-notification-border-radius);border:1px solid var(--wcm-color-overlay);background-color:var(--wcm-color-overlay)}svg{margin-right:5px}@-moz-document url-prefix(){div{background-color:var(--wcm-color-bg-3)}}.wcm-success path{fill:var(--wcm-accent-color)}.wcm-error path{fill:var(--wcm-error-color)}`;var XT=Object.defineProperty,eN=Object.getOwnPropertyDescriptor,qw=(r,e,t,i)=>{for(var n=i>1?void 0:i?eN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&XT(e,t,n),n};let Lh=class extends Ct{constructor(){super(),this.open=!1,this.unsubscribe=void 0,this.timeout=void 0,this.unsubscribe=to.subscribe(r=>{r.open?(this.open=!0,this.timeout=setTimeout(()=>to.closeToast(),2200)):(this.open=!1,clearTimeout(this.timeout))})}disconnectedCallback(){var r;(r=this.unsubscribe)==null||r.call(this),clearTimeout(this.timeout),to.closeToast()}render(){const{message:r,variant:e}=to.state,t={"wcm-success":e==="success","wcm-error":e==="error"};return this.open?Ee`<div class="${Is(t)}">${e==="success"?Kt.CHECKMARK_ICON:null} ${e==="error"?Kt.CROSS_ICON:null}<wcm-text variant="small-regular">${r}</wcm-text></div>`:null}};Lh.styles=[Lt.globalCss,ZT],qw([xi()],Lh.prototype,"open",2),Lh=qw([Ut("wcm-modal-toast")],Lh);const tN=.1,zw=2.5,Ms=7;function Rp(r,e,t){return r===e?!1:(r-e<0?e-r:r-e)<=t+tN}function rN(r,e){const t=Array.prototype.slice.call(Sf.create(r,{errorCorrectionLevel:e}).modules.data,0),i=Math.sqrt(t.length);return t.reduce((n,s,a)=>(a%i===0?n.push([s]):n[n.length-1].push(s))&&n,[])}const iN={generate(r,e,t){const i="#141414",n="#ffffff",s=[],a=rN(r,"Q"),f=e/a.length,h=[{x:0,y:0},{x:1,y:0},{x:0,y:1}];h.forEach(({x:O,y:N})=>{const j=(a.length-Ms)*f*O,H=(a.length-Ms)*f*N,F=.45;for(let G=0;G<h.length;G+=1){const B=f*(Ms-G*2);s.push(gr`<rect fill="${G%2===0?i:n}" height="${B}" rx="${B*F}" ry="${B*F}" width="${B}" x="${j+f*G}" y="${H+f*G}">`)}});const u=Math.floor((t+25)/f),g=a.length/2-u/2,w=a.length/2+u/2-1,M=[];a.forEach((O,N)=>{O.forEach((j,H)=>{if(a[N][H]&&!(N<Ms&&H<Ms||N>a.length-(Ms+1)&&H<Ms||N<Ms&&H>a.length-(Ms+1))&&!(N>g&&N<w&&H>g&&H<w)){const F=N*f+f/2,G=H*f+f/2;M.push([F,G])}})});const C={};return M.forEach(([O,N])=>{C[O]?C[O].push(N):C[O]=[N]}),Object.entries(C).map(([O,N])=>{const j=N.filter(H=>N.every(F=>!Rp(H,F,f)));return[Number(O),j]}).forEach(([O,N])=>{N.forEach(j=>{s.push(gr`<circle cx="${O}" cy="${j}" fill="${i}" r="${f/zw}">`)})}),Object.entries(C).filter(([O,N])=>N.length>1).map(([O,N])=>{const j=N.filter(H=>N.some(F=>Rp(H,F,f)));return[Number(O),j]}).map(([O,N])=>{N.sort((H,F)=>H<F?-1:1);const j=[];for(const H of N){const F=j.find(G=>G.some(B=>Rp(H,B,f)));F?F.push(H):j.push([H])}return[O,j.map(H=>[H[0],H[H.length-1]])]}).forEach(([O,N])=>{N.forEach(([j,H])=>{s.push(gr`<line x1="${O}" x2="${O}" y1="${j}" y2="${H}" stroke="${i}" stroke-width="${f/(zw/2)}" stroke-linecap="round">`)})}),s}},nN=jt`@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}div{position:relative;user-select:none;display:block;overflow:hidden;aspect-ratio:1/1;animation:fadeIn ease .2s}.wcm-dark{background-color:#fff;border-radius:var(--wcm-container-border-radius);padding:18px;box-shadow:0 2px 5px #000}svg:first-child,wcm-wallet-image{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%)}wcm-wallet-image{transform:translateY(-50%) translateX(-50%)}wcm-wallet-image{width:25%;height:25%;border-radius:var(--wcm-wallet-icon-border-radius)}svg:first-child{transform:translateY(-50%) translateX(-50%) scale(.9)}svg:first-child path:first-child{fill:var(--wcm-accent-color)}svg:first-child path:last-child{stroke:var(--wcm-color-overlay)}`;var sN=Object.defineProperty,oN=Object.getOwnPropertyDescriptor,sc=(r,e,t,i)=>{for(var n=i>1?void 0:i?oN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&sN(e,t,n),n};let Cs=class extends Ct{constructor(){super(...arguments),this.uri="",this.size=0,this.imageId=void 0,this.walletId=void 0,this.imageUrl=void 0}svgTemplate(){const e=eo.state.themeMode==="light"?this.size:this.size-18*2;return gr`<svg height="${e}" width="${e}">${iN.generate(this.uri,e,e/4)}</svg>`}render(){const r={"wcm-dark":eo.state.themeMode==="dark"};return Ee`<div style="${`width: ${this.size}px`}" class="${Is(r)}">${this.walletId||this.imageUrl?Ee`<wcm-wallet-image walletId="${li(this.walletId)}" imageId="${li(this.imageId)}" imageUrl="${li(this.imageUrl)}"></wcm-wallet-image>`:Kt.WALLET_CONNECT_ICON_COLORED} ${this.svgTemplate()}</div>`}};Cs.styles=[Lt.globalCss,nN],sc([At()],Cs.prototype,"uri",2),sc([At({type:Number})],Cs.prototype,"size",2),sc([At()],Cs.prototype,"imageId",2),sc([At()],Cs.prototype,"walletId",2),sc([At()],Cs.prototype,"imageUrl",2),Cs=sc([Ut("wcm-qrcode")],Cs);const aN=jt`:host{position:relative;height:28px;width:80%}input{width:100%;height:100%;line-height:28px!important;border-radius:var(--wcm-input-border-radius);font-style:normal;font-family:-apple-system,system-ui,BlinkMacSystemFont,'Segoe UI',Roboto,Ubuntu,'Helvetica Neue',sans-serif;font-feature-settings:'case' on;font-weight:500;font-size:16px;letter-spacing:-.03em;padding:0 10px 0 34px;transition:.2s all ease;color:var(--wcm-color-fg-1);background-color:var(--wcm-color-bg-3);box-shadow:inset 0 0 0 1px var(--wcm-color-overlay);caret-color:var(--wcm-accent-color)}input::placeholder{color:var(--wcm-color-fg-2)}svg{left:10px;top:4px;pointer-events:none;position:absolute;width:20px;height:20px}input:focus-within{box-shadow:inset 0 0 0 1px var(--wcm-accent-color)}path{fill:var(--wcm-color-fg-2)}`;var cN=Object.defineProperty,fN=Object.getOwnPropertyDescriptor,Hw=(r,e,t,i)=>{for(var n=i>1?void 0:i?fN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&cN(e,t,n),n};let Bh=class extends Ct{constructor(){super(...arguments),this.onChange=()=>null}render(){return Ee`<input type="text" @input="${this.onChange}" placeholder="Search wallets"> ${Kt.SEARCH_ICON}`}};Bh.styles=[Lt.globalCss,aN],Hw([At()],Bh.prototype,"onChange",2),Bh=Hw([Ut("wcm-search-input")],Bh);const lN=jt`@keyframes rotate{100%{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}100%{stroke-dasharray:90,150;stroke-dashoffset:-124}}svg{animation:rotate 2s linear infinite;display:flex;justify-content:center;align-items:center}svg circle{stroke-linecap:round;animation:dash 1.5s ease infinite;stroke:var(--wcm-accent-color)}`;var hN=Object.defineProperty,uN=Object.getOwnPropertyDescriptor,dN=(r,e,t,i)=>{for(var n=i>1?void 0:i?uN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&hN(e,t,n),n};let Tp=class extends Ct{render(){return Ee`<svg viewBox="0 0 50 50" width="24" height="24"><circle cx="25" cy="25" r="20" fill="none" stroke-width="4" stroke="#fff"/></svg>`}};Tp.styles=[Lt.globalCss,lN],Tp=dN([Ut("wcm-spinner")],Tp);const pN=jt`span{font-style:normal;font-family:var(--wcm-font-family);font-feature-settings:var(--wcm-font-feature-settings)}.wcm-xsmall-bold{font-family:var(--wcm-text-xsmall-bold-font-family);font-weight:var(--wcm-text-xsmall-bold-weight);font-size:var(--wcm-text-xsmall-bold-size);line-height:var(--wcm-text-xsmall-bold-line-height);letter-spacing:var(--wcm-text-xsmall-bold-letter-spacing);text-transform:var(--wcm-text-xsmall-bold-text-transform)}.wcm-xsmall-regular{font-family:var(--wcm-text-xsmall-regular-font-family);font-weight:var(--wcm-text-xsmall-regular-weight);font-size:var(--wcm-text-xsmall-regular-size);line-height:var(--wcm-text-xsmall-regular-line-height);letter-spacing:var(--wcm-text-xsmall-regular-letter-spacing);text-transform:var(--wcm-text-xsmall-regular-text-transform)}.wcm-small-thin{font-family:var(--wcm-text-small-thin-font-family);font-weight:var(--wcm-text-small-thin-weight);font-size:var(--wcm-text-small-thin-size);line-height:var(--wcm-text-small-thin-line-height);letter-spacing:var(--wcm-text-small-thin-letter-spacing);text-transform:var(--wcm-text-small-thin-text-transform)}.wcm-small-regular{font-family:var(--wcm-text-small-regular-font-family);font-weight:var(--wcm-text-small-regular-weight);font-size:var(--wcm-text-small-regular-size);line-height:var(--wcm-text-small-regular-line-height);letter-spacing:var(--wcm-text-small-regular-letter-spacing);text-transform:var(--wcm-text-small-regular-text-transform)}.wcm-medium-regular{font-family:var(--wcm-text-medium-regular-font-family);font-weight:var(--wcm-text-medium-regular-weight);font-size:var(--wcm-text-medium-regular-size);line-height:var(--wcm-text-medium-regular-line-height);letter-spacing:var(--wcm-text-medium-regular-letter-spacing);text-transform:var(--wcm-text-medium-regular-text-transform)}.wcm-big-bold{font-family:var(--wcm-text-big-bold-font-family);font-weight:var(--wcm-text-big-bold-weight);font-size:var(--wcm-text-big-bold-size);line-height:var(--wcm-text-big-bold-line-height);letter-spacing:var(--wcm-text-big-bold-letter-spacing);text-transform:var(--wcm-text-big-bold-text-transform)}:host(*){color:var(--wcm-color-fg-1)}.wcm-color-primary{color:var(--wcm-color-fg-1)}.wcm-color-secondary{color:var(--wcm-color-fg-2)}.wcm-color-tertiary{color:var(--wcm-color-fg-3)}.wcm-color-inverse{color:var(--wcm-accent-fill-color)}.wcm-color-accnt{color:var(--wcm-accent-color)}.wcm-color-error{color:var(--wcm-error-color)}`;var gN=Object.defineProperty,vN=Object.getOwnPropertyDescriptor,Np=(r,e,t,i)=>{for(var n=i>1?void 0:i?vN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&gN(e,t,n),n};let Rf=class extends Ct{constructor(){super(...arguments),this.variant="medium-regular",this.color="primary"}render(){const r={"wcm-big-bold":this.variant==="big-bold","wcm-medium-regular":this.variant==="medium-regular","wcm-small-regular":this.variant==="small-regular","wcm-small-thin":this.variant==="small-thin","wcm-xsmall-regular":this.variant==="xsmall-regular","wcm-xsmall-bold":this.variant==="xsmall-bold","wcm-color-primary":this.color==="primary","wcm-color-secondary":this.color==="secondary","wcm-color-tertiary":this.color==="tertiary","wcm-color-inverse":this.color==="inverse","wcm-color-accnt":this.color==="accent","wcm-color-error":this.color==="error"};return Ee`<span><slot class="${Is(r)}"></slot></span>`}};Rf.styles=[Lt.globalCss,pN],Np([At()],Rf.prototype,"variant",2),Np([At()],Rf.prototype,"color",2),Rf=Np([Ut("wcm-text")],Rf);const mN=jt`button{width:100%;height:100%;border-radius:var(--wcm-button-hover-highlight-border-radius);display:flex;align-items:flex-start}button:active{background-color:var(--wcm-color-overlay)}@media(hover:hover){button:hover{background-color:var(--wcm-color-overlay)}}button>div{width:80px;padding:5px 0;display:flex;flex-direction:column;align-items:center}wcm-text{width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:center}wcm-wallet-image{height:60px;width:60px;transition:all .2s ease;border-radius:var(--wcm-wallet-icon-border-radius);margin-bottom:5px}.wcm-sublabel{margin-top:2px}`;var bN=Object.defineProperty,wN=Object.getOwnPropertyDescriptor,ao=(r,e,t,i)=>{for(var n=i>1?void 0:i?wN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&bN(e,t,n),n};let as=class extends Ct{constructor(){super(...arguments),this.onClick=()=>null,this.name="",this.walletId="",this.label=void 0,this.imageId=void 0,this.installed=!1,this.recent=!1}sublabelTemplate(){return this.recent?Ee`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">RECENT</wcm-text>`:this.installed?Ee`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">INSTALLED</wcm-text>`:null}handleClick(){I3.click({name:"WALLET_BUTTON",walletId:this.walletId}),this.onClick()}render(){var r;return Ee`<button @click="${this.handleClick.bind(this)}"><div><wcm-wallet-image walletId="${this.walletId}" imageId="${li(this.imageId)}"></wcm-wallet-image><wcm-text variant="xsmall-regular">${(r=this.label)!=null?r:pt.getWalletName(this.name,!0)}</wcm-text>${this.sublabelTemplate()}</div></button>`}};as.styles=[Lt.globalCss,mN],ao([At()],as.prototype,"onClick",2),ao([At()],as.prototype,"name",2),ao([At()],as.prototype,"walletId",2),ao([At()],as.prototype,"label",2),ao([At()],as.prototype,"imageId",2),ao([At({type:Boolean})],as.prototype,"installed",2),ao([At({type:Boolean})],as.prototype,"recent",2),as=ao([Ut("wcm-wallet-button")],as);const yN=jt`:host{display:block}div{overflow:hidden;position:relative;border-radius:inherit;width:100%;height:100%;background-color:var(--wcm-color-overlay)}svg{position:relative;width:100%;height:100%}div::after{content:'';position:absolute;top:0;bottom:0;left:0;right:0;border-radius:inherit;border:1px solid var(--wcm-color-overlay)}div img{width:100%;height:100%;object-fit:cover;object-position:center}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var _N=Object.defineProperty,xN=Object.getOwnPropertyDescriptor,Fh=(r,e,t,i)=>{for(var n=i>1?void 0:i?xN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&_N(e,t,n),n};let oc=class extends Ct{constructor(){super(...arguments),this.walletId="",this.imageId=void 0,this.imageUrl=void 0}render(){var r;const e=(r=this.imageUrl)!=null&&r.length?this.imageUrl:pt.getWalletIcon({id:this.walletId,image_id:this.imageId});return Ee`${e.length?Ee`<div><img crossorigin="anonymous" src="${e}" alt="${this.id}"></div>`:Kt.WALLET_PLACEHOLDER}`}};oc.styles=[Lt.globalCss,yN],Fh([At()],oc.prototype,"walletId",2),Fh([At()],oc.prototype,"imageId",2),Fh([At()],oc.prototype,"imageUrl",2),oc=Fh([Ut("wcm-wallet-image")],oc);var AN=Object.defineProperty,EN=Object.getOwnPropertyDescriptor,kw=(r,e,t,i)=>{for(var n=i>1?void 0:i?EN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&AN(e,t,n),n};let $p=class extends Ct{constructor(){super(),this.preload=!0,this.preloadData()}async loadImages(r){try{r?.length&&await Promise.all(r.map(async e=>pt.preloadImage(e)))}catch{console.info("Unsuccessful attempt at preloading some images",r)}}async preloadListings(){if(qi.state.enableExplorer){await _i.getRecomendedWallets(),yr.setIsDataLoaded(!0);const{recomendedWallets:r}=_i.state,e=r.map(t=>pt.getWalletIcon(t));await this.loadImages(e)}else yr.setIsDataLoaded(!0)}async preloadCustomImages(){const r=pt.getCustomImageUrls();await this.loadImages(r)}async preloadData(){try{this.preload&&(this.preload=!1,await Promise.all([this.preloadListings(),this.preloadCustomImages()]))}catch(r){console.error(r),to.openToast("Failed preloading","error")}}};kw([xi()],$p.prototype,"preload",2),$p=kw([Ut("wcm-explorer-context")],$p);var SN=Object.defineProperty,IN=Object.getOwnPropertyDescriptor,MN=(r,e,t,i)=>{for(var n=i>1?void 0:i?IN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&SN(e,t,n),n};let jw=class extends Ct{constructor(){super(),this.unsubscribeTheme=void 0,Lt.setTheme(),this.unsubscribeTheme=eo.subscribe(Lt.setTheme)}disconnectedCallback(){var r;(r=this.unsubscribeTheme)==null||r.call(this)}};jw=MN([Ut("wcm-theme-context")],jw);const CN=jt`@keyframes scroll{0%{transform:translate3d(0,0,0)}100%{transform:translate3d(calc(-70px * 9),0,0)}}.wcm-slider{position:relative;overflow-x:hidden;padding:10px 0;margin:0 -20px;width:calc(100% + 40px)}.wcm-track{display:flex;width:calc(70px * 18);animation:scroll 20s linear infinite;opacity:.7}.wcm-track svg{margin:0 5px}wcm-wallet-image{width:60px;height:60px;margin:0 5px;border-radius:var(--wcm-wallet-icon-border-radius)}.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between}.wcm-title{display:flex;align-items:center;margin-bottom:10px}.wcm-title svg{margin-right:6px}.wcm-title path{fill:var(--wcm-accent-color)}wcm-modal-footer .wcm-title{padding:0 10px}wcm-button-big{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%);filter:drop-shadow(0 0 17px var(--wcm-color-bg-1))}wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-info-footer wcm-text{text-align:center;margin-bottom:15px}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var PN=Object.defineProperty,DN=Object.getOwnPropertyDescriptor,ON=(r,e,t,i)=>{for(var n=i>1?void 0:i?DN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&PN(e,t,n),n};let Lp=class extends Ct{onGoToQrcode(){lr.push("Qrcode")}render(){const{recomendedWallets:r}=_i.state,e=[...r,...r],t=je.RECOMMENDED_WALLET_AMOUNT*2;return Ee`<wcm-modal-header title="Connect your wallet" .onAction="${this.onGoToQrcode}" .actionIcon="${Kt.QRCODE_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-title">${Kt.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">WalletConnect</wcm-text></div><div class="wcm-slider"><div class="wcm-track">${[...Array(t)].map((i,n)=>{const s=e[n%e.length];return s?Ee`<wcm-wallet-image walletId="${s.id}" imageId="${s.image_id}"></wcm-wallet-image>`:Kt.WALLET_PLACEHOLDER})}</div><wcm-button-big @click="${pt.handleAndroidLinking}"><wcm-text variant="medium-regular" color="inverse">Select Wallet</wcm-text></wcm-button-big></div></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">Choose WalletConnect to see supported apps on your device</wcm-text></wcm-info-footer>`}};Lp.styles=[Lt.globalCss,CN],Lp=ON([Ut("wcm-android-wallet-selection")],Lp);const RN=jt`@keyframes loading{to{stroke-dashoffset:0}}@keyframes shake{10%,90%{transform:translate3d(-1px,0,0)}20%,80%{transform:translate3d(1px,0,0)}30%,50%,70%{transform:translate3d(-2px,0,0)}40%,60%{transform:translate3d(2px,0,0)}}:host{display:flex;flex-direction:column;align-items:center}div{position:relative;width:110px;height:110px;display:flex;justify-content:center;align-items:center;margin:40px 0 20px 0;transform:translate3d(0,0,0)}svg{position:absolute;width:110px;height:110px;fill:none;stroke:transparent;stroke-linecap:round;stroke-width:2px;top:0;left:0}use{stroke:var(--wcm-accent-color);animation:loading 1s linear infinite}wcm-wallet-image{border-radius:var(--wcm-wallet-icon-large-border-radius);width:90px;height:90px}wcm-text{margin-bottom:40px}.wcm-error svg{stroke:var(--wcm-error-color)}.wcm-error use{display:none}.wcm-error{animation:shake .4s cubic-bezier(.36,.07,.19,.97) both}.wcm-stale svg,.wcm-stale use{display:none}`;var TN=Object.defineProperty,NN=Object.getOwnPropertyDescriptor,ac=(r,e,t,i)=>{for(var n=i>1?void 0:i?NN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&TN(e,t,n),n};let co=class extends Ct{constructor(){super(...arguments),this.walletId=void 0,this.imageId=void 0,this.isError=!1,this.isStale=!1,this.label=""}svgLoaderTemplate(){var r,e;const s=(e=(r=eo.state.themeVariables)==null?void 0:r["--wcm-wallet-icon-large-border-radius"])!=null?e:Lt.getPreset("--wcm-wallet-icon-large-border-radius");let a=0;s.includes("%")?a=88/100*parseInt(s,10):a=parseInt(s,10),a*=1.17;const f=317-a*1.57,h=425-a*1.8;return Ee`<svg viewBox="0 0 110 110" width="110" height="110"><rect id="wcm-loader" x="2" y="2" width="106" height="106" rx="${a}"/><use xlink:href="#wcm-loader" stroke-dasharray="106 ${f}" stroke-dashoffset="${h}"></use></svg>`}render(){const r={"wcm-error":this.isError,"wcm-stale":this.isStale};return Ee`<div class="${Is(r)}">${this.svgLoaderTemplate()}<wcm-wallet-image walletId="${li(this.walletId)}" imageId="${li(this.imageId)}"></wcm-wallet-image></div><wcm-text variant="medium-regular" color="${this.isError?"error":"primary"}">${this.isError?"Connection declined":this.label}</wcm-text>`}};co.styles=[Lt.globalCss,RN],ac([At()],co.prototype,"walletId",2),ac([At()],co.prototype,"imageId",2),ac([At({type:Boolean})],co.prototype,"isError",2),ac([At({type:Boolean})],co.prototype,"isStale",2),ac([At()],co.prototype,"label",2),co=ac([Ut("wcm-connector-waiting")],co);const cc={manualWallets(){var r,e;const{mobileWallets:t,desktopWallets:i}=qi.state,n=(r=cc.recentWallet())==null?void 0:r.id,s=je.isMobile()?t:i,a=s?.filter(f=>n!==f.id);return(e=je.isMobile()?a?.map(({id:f,name:h,links:u})=>({id:f,name:h,mobile:u,links:u})):a?.map(({id:f,name:h,links:u})=>({id:f,name:h,desktop:u,links:u})))!=null?e:[]},recentWallet(){return pt.getRecentWallet()},recomendedWallets(r=!1){var e;const t=r||(e=cc.recentWallet())==null?void 0:e.id,{recomendedWallets:i}=_i.state;return i.filter(s=>t!==s.id)}},fo={onConnecting(r){pt.goToConnectingView(r)},manualWalletsTemplate(){return cc.manualWallets().map(e=>Ee`<wcm-wallet-button walletId="${e.id}" name="${e.name}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`)},recomendedWalletsTemplate(r=!1){return cc.recomendedWallets(r).map(t=>Ee`<wcm-wallet-button name="${t.name}" walletId="${t.id}" imageId="${t.image_id}" .onClick="${()=>this.onConnecting(t)}"></wcm-wallet-button>`)},recentWalletTemplate(){const r=cc.recentWallet();if(r)return Ee`<wcm-wallet-button name="${r.name}" walletId="${r.id}" imageId="${li(r.image_id)}" .recent="${!0}" .onClick="${()=>this.onConnecting(r)}"></wcm-wallet-button>`}},$N=jt`.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between}.wcm-desktop-title,.wcm-mobile-title{display:flex;align-items:center}.wcm-mobile-title{justify-content:space-between;margin-bottom:20px;margin-top:-10px}.wcm-desktop-title{margin-bottom:10px;padding:0 10px}.wcm-subtitle{display:flex;align-items:center}.wcm-subtitle:last-child path{fill:var(--wcm-color-fg-3)}.wcm-desktop-title svg,.wcm-mobile-title svg{margin-right:6px}.wcm-desktop-title path,.wcm-mobile-title path{fill:var(--wcm-accent-color)}`;var LN=Object.defineProperty,BN=Object.getOwnPropertyDescriptor,FN=(r,e,t,i)=>{for(var n=i>1?void 0:i?BN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&LN(e,t,n),n};let Bp=class extends Ct{render(){const{explorerExcludedWalletIds:r,enableExplorer:e}=qi.state,t=r!=="ALL"&&e,i=fo.manualWalletsTemplate(),n=fo.recomendedWalletsTemplate();let a=[fo.recentWalletTemplate(),...i,...n];a=a.filter(Boolean);const f=a.length>4||t;let h=[];f?h=a.slice(0,3):h=a;const u=!!h.length;return Ee`<wcm-modal-header .border="${!0}" title="Connect your wallet" .onAction="${pt.handleUriCopy}" .actionIcon="${Kt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-mobile-title"><div class="wcm-subtitle">${Kt.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">Mobile</wcm-text></div><div class="wcm-subtitle">${Kt.SCAN_ICON}<wcm-text variant="small-regular" color="secondary">Scan with your wallet</wcm-text></div></div><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>${u?Ee`<wcm-modal-footer><div class="wcm-desktop-title">${Kt.DESKTOP_ICON}<wcm-text variant="small-regular" color="accent">Desktop</wcm-text></div><div class="wcm-grid">${h} ${f?Ee`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-footer>`:null}`}};Bp.styles=[Lt.globalCss,$N],Bp=FN([Ut("wcm-desktop-wallet-selection")],Bp);const UN=jt`div{background-color:var(--wcm-color-bg-2);padding:10px 20px 15px 20px;border-top:1px solid var(--wcm-color-bg-3);text-align:center}a{color:var(--wcm-accent-color);text-decoration:none;transition:opacity .2s ease-in-out;display:inline}a:active{opacity:.8}@media(hover:hover){a:hover{opacity:.8}}`;var qN=Object.defineProperty,zN=Object.getOwnPropertyDescriptor,HN=(r,e,t,i)=>{for(var n=i>1?void 0:i?zN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&qN(e,t,n),n};let Fp=class extends Ct{render(){const{termsOfServiceUrl:r,privacyPolicyUrl:e}=qi.state;return r??e?Ee`<div><wcm-text variant="small-regular" color="secondary">By connecting your wallet to this app, you agree to the app's ${r?Ee`<a href="${r}" target="_blank" rel="noopener noreferrer">Terms of Service</a>`:null} ${r&&e?"and":null} ${e?Ee`<a href="${e}" target="_blank" rel="noopener noreferrer">Privacy Policy</a>`:null}</wcm-text></div>`:null}};Fp.styles=[Lt.globalCss,UN],Fp=HN([Ut("wcm-legal-notice")],Fp);const kN=jt`div{display:grid;grid-template-columns:repeat(4,80px);margin:0 -10px;justify-content:space-between;row-gap:10px}`;var jN=Object.defineProperty,WN=Object.getOwnPropertyDescriptor,KN=(r,e,t,i)=>{for(var n=i>1?void 0:i?WN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&jN(e,t,n),n};let Up=class extends Ct{onQrcode(){lr.push("Qrcode")}render(){const{explorerExcludedWalletIds:r,enableExplorer:e}=qi.state,t=r!=="ALL"&&e,i=fo.manualWalletsTemplate(),n=fo.recomendedWalletsTemplate();let a=[fo.recentWalletTemplate(),...i,...n];a=a.filter(Boolean);const f=a.length>8||t;let h=[];f?h=a.slice(0,7):h=a;const u=!!h.length;return Ee`<wcm-modal-header title="Connect your wallet" .onAction="${this.onQrcode}" .actionIcon="${Kt.QRCODE_ICON}"></wcm-modal-header>${u?Ee`<wcm-modal-content><div>${h} ${f?Ee`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-content>`:null}`}};Up.styles=[Lt.globalCss,kN],Up=KN([Ut("wcm-mobile-wallet-selection")],Up);const VN=jt`:host{all:initial}.wcm-overlay{top:0;bottom:0;left:0;right:0;position:fixed;z-index:var(--wcm-z-index);overflow:hidden;display:flex;justify-content:center;align-items:center;opacity:0;pointer-events:none;background-color:var(--wcm-overlay-background-color);backdrop-filter:var(--wcm-overlay-backdrop-filter)}@media(max-height:720px) and (orientation:landscape){.wcm-overlay{overflow:scroll;align-items:flex-start;padding:20px 0}}.wcm-active{pointer-events:auto}.wcm-container{position:relative;max-width:360px;width:100%;outline:0;border-radius:var(--wcm-background-border-radius) var(--wcm-background-border-radius) var(--wcm-container-border-radius) var(--wcm-container-border-radius);border:1px solid var(--wcm-color-overlay);overflow:hidden}.wcm-card{width:100%;position:relative;border-radius:var(--wcm-container-border-radius);overflow:hidden;box-shadow:0 6px 14px -6px rgba(10,16,31,.12),0 10px 32px -4px rgba(10,16,31,.1),0 0 0 1px var(--wcm-color-overlay);background-color:var(--wcm-color-bg-1);color:var(--wcm-color-fg-1)}@media(max-width:600px){.wcm-container{max-width:440px;border-radius:var(--wcm-background-border-radius) var(--wcm-background-border-radius) 0 0}.wcm-card{border-radius:var(--wcm-container-border-radius) var(--wcm-container-border-radius) 0 0}.wcm-overlay{align-items:flex-end}}@media(max-width:440px){.wcm-container{border:0}}`;var GN=Object.defineProperty,YN=Object.getOwnPropertyDescriptor,qp=(r,e,t,i)=>{for(var n=i>1?void 0:i?YN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&GN(e,t,n),n};let fc=class extends Ct{constructor(){super(),this.open=!1,this.active=!1,this.unsubscribeModal=void 0,this.abortController=void 0,this.unsubscribeModal=Vo.subscribe(r=>{r.open?this.onOpenModalEvent():this.onCloseModalEvent()})}disconnectedCallback(){var r;(r=this.unsubscribeModal)==null||r.call(this)}get overlayEl(){return pt.getShadowRootElement(this,".wcm-overlay")}get containerEl(){return pt.getShadowRootElement(this,".wcm-container")}toggleBodyScroll(r){if(document.querySelector("body"))if(r){const t=document.getElementById("wcm-styles");t?.remove()}else document.head.insertAdjacentHTML("beforeend",'<style id="wcm-styles">html,body{touch-action:none;overflow:hidden;overscroll-behavior:contain;}</style>')}onCloseModal(r){r.target===r.currentTarget&&Vo.close()}onOpenModalEvent(){this.toggleBodyScroll(!1),this.addKeyboardEvents(),this.open=!0,setTimeout(async()=>{const r=pt.isMobileAnimation()?{y:["50vh","0vh"]}:{scale:[.98,1]},e=.1,t=.2;await Promise.all([ea(this.overlayEl,{opacity:[0,1]},{delay:e,duration:t}).finished,ea(this.containerEl,r,{delay:e,duration:t}).finished]),this.active=!0},0)}async onCloseModalEvent(){this.toggleBodyScroll(!0),this.removeKeyboardEvents();const r=pt.isMobileAnimation()?{y:["0vh","50vh"]}:{scale:[1,.98]},e=.2;await Promise.all([ea(this.overlayEl,{opacity:[1,0]},{duration:e}).finished,ea(this.containerEl,r,{duration:e}).finished]),this.containerEl.removeAttribute("style"),this.active=!1,this.open=!1}addKeyboardEvents(){this.abortController=new AbortController,window.addEventListener("keydown",r=>{var e;r.key==="Escape"?Vo.close():r.key==="Tab"&&((e=r.target)!=null&&e.tagName.includes("wcm-")||this.containerEl.focus())},this.abortController),this.containerEl.focus()}removeKeyboardEvents(){var r;(r=this.abortController)==null||r.abort(),this.abortController=void 0}render(){const r={"wcm-overlay":!0,"wcm-active":this.active};return Ee`<wcm-explorer-context></wcm-explorer-context><wcm-theme-context></wcm-theme-context><div id="wcm-modal" class="${Is(r)}" @click="${this.onCloseModal}" role="alertdialog" aria-modal="true"><div class="wcm-container" tabindex="0">${this.open?Ee`<wcm-modal-backcard></wcm-modal-backcard><div class="wcm-card"><wcm-modal-router></wcm-modal-router><wcm-modal-toast></wcm-modal-toast></div>`:null}</div></div>`}};fc.styles=[Lt.globalCss,VN],qp([xi()],fc.prototype,"open",2),qp([xi()],fc.prototype,"active",2),fc=qp([Ut("wcm-modal")],fc);const JN=jt`div{display:flex;margin-top:15px}slot{display:inline-block;margin:0 5px}wcm-button{margin:0 5px}`;var QN=Object.defineProperty,ZN=Object.getOwnPropertyDescriptor,Tf=(r,e,t,i)=>{for(var n=i>1?void 0:i?ZN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&QN(e,t,n),n};let ra=class extends Ct{constructor(){super(...arguments),this.isMobile=!1,this.isDesktop=!1,this.isWeb=!1,this.isRetry=!1}onMobile(){je.isMobile()?lr.replace("MobileConnecting"):lr.replace("MobileQrcodeConnecting")}onDesktop(){lr.replace("DesktopConnecting")}onWeb(){lr.replace("WebConnecting")}render(){return Ee`<div>${this.isRetry?Ee`<slot></slot>`:null} ${this.isMobile?Ee`<wcm-button .onClick="${this.onMobile}" .iconLeft="${Kt.MOBILE_ICON}" variant="outline">Mobile</wcm-button>`:null} ${this.isDesktop?Ee`<wcm-button .onClick="${this.onDesktop}" .iconLeft="${Kt.DESKTOP_ICON}" variant="outline">Desktop</wcm-button>`:null} ${this.isWeb?Ee`<wcm-button .onClick="${this.onWeb}" .iconLeft="${Kt.GLOBE_ICON}" variant="outline">Web</wcm-button>`:null}</div>`}};ra.styles=[Lt.globalCss,JN],Tf([At({type:Boolean})],ra.prototype,"isMobile",2),Tf([At({type:Boolean})],ra.prototype,"isDesktop",2),Tf([At({type:Boolean})],ra.prototype,"isWeb",2),Tf([At({type:Boolean})],ra.prototype,"isRetry",2),ra=Tf([Ut("wcm-platform-selection")],ra);const XN=jt`button{display:flex;flex-direction:column;padding:5px 10px;border-radius:var(--wcm-button-hover-highlight-border-radius);height:100%;justify-content:flex-start}.wcm-icons{width:60px;height:60px;display:flex;flex-wrap:wrap;padding:7px;border-radius:var(--wcm-wallet-icon-border-radius);justify-content:space-between;align-items:center;margin-bottom:5px;background-color:var(--wcm-color-bg-2);box-shadow:inset 0 0 0 1px var(--wcm-color-overlay)}button:active{background-color:var(--wcm-color-overlay)}@media(hover:hover){button:hover{background-color:var(--wcm-color-overlay)}}.wcm-icons img{width:21px;height:21px;object-fit:cover;object-position:center;border-radius:calc(var(--wcm-wallet-icon-border-radius)/ 2);border:1px solid var(--wcm-color-overlay)}.wcm-icons svg{width:21px;height:21px}.wcm-icons img:nth-child(1),.wcm-icons img:nth-child(2),.wcm-icons svg:nth-child(1),.wcm-icons svg:nth-child(2){margin-bottom:4px}wcm-text{width:100%;text-align:center}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var e$=Object.defineProperty,t$=Object.getOwnPropertyDescriptor,r$=(r,e,t,i)=>{for(var n=i>1?void 0:i?t$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&e$(e,t,n),n};let zp=class extends Ct{onClick(){lr.push("WalletExplorer")}render(){const{recomendedWallets:r}=_i.state,e=cc.manualWallets(),t=[...r,...e].reverse().slice(0,4);return Ee`<button @click="${this.onClick}"><div class="wcm-icons">${t.map(i=>{const n=pt.getWalletIcon(i);if(n)return Ee`<img crossorigin="anonymous" src="${n}">`;const s=pt.getWalletIcon({id:i.id});return s?Ee`<img crossorigin="anonymous" src="${s}">`:Kt.WALLET_PLACEHOLDER})} ${[...Array(4-t.length)].map(()=>Kt.WALLET_PLACEHOLDER)}</div><wcm-text variant="xsmall-regular">View All</wcm-text></button>`}};zp.styles=[Lt.globalCss,XN],zp=r$([Ut("wcm-view-all-wallets-button")],zp);const i$=jt`.wcm-qr-container{width:100%;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1}`;var n$=Object.defineProperty,s$=Object.getOwnPropertyDescriptor,Uh=(r,e,t,i)=>{for(var n=i>1?void 0:i?s$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&n$(e,t,n),n};let lc=class extends Ct{constructor(){super(),this.walletId="",this.imageId="",this.uri="",setTimeout(()=>{const{walletConnectUri:r}=yr.state;this.uri=r},0)}get overlayEl(){return pt.getShadowRootElement(this,".wcm-qr-container")}render(){return Ee`<div class="wcm-qr-container">${this.uri?Ee`<wcm-qrcode size="${this.overlayEl.offsetWidth}" uri="${this.uri}" walletId="${li(this.walletId)}" imageId="${li(this.imageId)}"></wcm-qrcode>`:Ee`<wcm-spinner></wcm-spinner>`}</div>`}};lc.styles=[Lt.globalCss,i$],Uh([At()],lc.prototype,"walletId",2),Uh([At()],lc.prototype,"imageId",2),Uh([xi()],lc.prototype,"uri",2),lc=Uh([Ut("wcm-walletconnect-qr")],lc);var o$=Object.defineProperty,a$=Object.getOwnPropertyDescriptor,c$=(r,e,t,i)=>{for(var n=i>1?void 0:i?a$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&o$(e,t,n),n};let Hp=class extends Ct{viewTemplate(){return je.isAndroid()&&!je.isTelegram()?Ee`<wcm-android-wallet-selection></wcm-android-wallet-selection>`:je.isMobile()?Ee`<wcm-mobile-wallet-selection></wcm-mobile-wallet-selection>`:Ee`<wcm-desktop-wallet-selection></wcm-desktop-wallet-selection>`}render(){return Ee`${this.viewTemplate()}<wcm-legal-notice></wcm-legal-notice>`}};Hp.styles=[Lt.globalCss],Hp=c$([Ut("wcm-connect-wallet-view")],Hp);const f$=jt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var l$=Object.defineProperty,h$=Object.getOwnPropertyDescriptor,Ww=(r,e,t,i)=>{for(var n=i>1?void 0:i?h$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&l$(e,t,n),n};let qh=class extends Ct{constructor(){super(),this.isError=!1,this.openDesktopApp()}onFormatAndRedirect(r){const{desktop:e,name:t}=je.getWalletRouterData(),i=e?.native,n=e?.universal;if(i){const s=je.formatNativeUrl(i,r,t);je.openHref(s,"_self")}else if(n){const s=je.formatUniversalUrl(n,r,t);je.openHref(s,"_blank")}}openDesktopApp(){const{walletConnectUri:r}=yr.state,e=je.getWalletRouterData();pt.setRecentWallet(e),r&&this.onFormatAndRedirect(r)}render(){const{name:r,id:e,image_id:t}=je.getWalletRouterData(),{isMobile:i,isWeb:n}=pt.getCachedRouterWalletPlatforms();return Ee`<wcm-modal-header title="${r}" .onAction="${pt.handleUriCopy}" .actionIcon="${Kt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${li(t)}" label="${`Continue in ${r}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Connection can continue loading if ${r} is not installed on your device`}</wcm-text><wcm-platform-selection .isMobile="${i}" .isWeb="${n}" .isRetry="${!0}"><wcm-button .onClick="${this.openDesktopApp.bind(this)}" .iconRight="${Kt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};qh.styles=[Lt.globalCss,f$],Ww([xi()],qh.prototype,"isError",2),qh=Ww([Ut("wcm-desktop-connecting-view")],qh);const u$=jt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}wcm-button{margin-top:15px}`;var d$=Object.defineProperty,p$=Object.getOwnPropertyDescriptor,g$=(r,e,t,i)=>{for(var n=i>1?void 0:i?p$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&d$(e,t,n),n};let kp=class extends Ct{onInstall(r){r&&je.openHref(r,"_blank")}render(){const{name:r,id:e,image_id:t,homepage:i}=je.getWalletRouterData();return Ee`<wcm-modal-header title="${r}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${li(t)}" label="Not Detected" .isStale="${!0}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Download ${r} to continue. If multiple browser extensions are installed, disable non ${r} ones and try again`}</wcm-text><wcm-button .onClick="${()=>this.onInstall(i)}" .iconLeft="${Kt.ARROW_DOWN_ICON}">Download</wcm-button></wcm-info-footer>`}};kp.styles=[Lt.globalCss,u$],kp=g$([Ut("wcm-install-wallet-view")],kp);const v$=jt`wcm-wallet-image{border-radius:var(--wcm-wallet-icon-large-border-radius);width:96px;height:96px;margin-bottom:20px}wcm-info-footer{display:flex;width:100%}.wcm-app-store{justify-content:space-between}.wcm-app-store wcm-wallet-image{margin-right:10px;margin-bottom:0;width:28px;height:28px;border-radius:var(--wcm-wallet-icon-small-border-radius)}.wcm-app-store div{display:flex;align-items:center}.wcm-app-store wcm-button{margin-right:-10px}.wcm-note{flex-direction:column;align-items:center;padding:5px 0}.wcm-note wcm-text{text-align:center}wcm-platform-selection{margin-top:-15px}.wcm-note wcm-text{margin-top:15px}.wcm-note wcm-text span{color:var(--wcm-accent-color)}`;var m$=Object.defineProperty,b$=Object.getOwnPropertyDescriptor,Kw=(r,e,t,i)=>{for(var n=i>1?void 0:i?b$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&m$(e,t,n),n};let zh=class extends Ct{constructor(){super(),this.isError=!1,this.openMobileApp()}onFormatAndRedirect(r,e=!1){const{mobile:t,name:i}=je.getWalletRouterData(),n=t?.native,s=t?.universal,a=je.isTelegram()?"_blank":"_self";if(r=je.isTelegram()&&je.isAndroid()?encodeURIComponent(r):r,n&&!e){const f=je.formatNativeUrl(n,r,i);je.openHref(f,a)}else if(s){const f=je.formatUniversalUrl(s,r,i);je.openHref(f,a)}}openMobileApp(r=!1){const{walletConnectUri:e}=yr.state,t=je.getWalletRouterData();e&&this.onFormatAndRedirect(e,r),pt.setRecentWallet(t)}onGoToAppStore(r){r&&je.openHref(r,"_blank")}render(){const{name:r,id:e,image_id:t,app:i,mobile:n}=je.getWalletRouterData(),{isWeb:s}=pt.getCachedRouterWalletPlatforms(),a=i?.ios,f=n?.universal;return Ee`<wcm-modal-header title="${r}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${li(t)}" label="Tap 'Open' to continue…" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer class="wcm-note"><wcm-platform-selection .isWeb="${s}" .isRetry="${!0}"><wcm-button .onClick="${()=>this.openMobileApp(!1)}" .iconRight="${Kt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection>${f?Ee`<wcm-text color="secondary" variant="small-thin">Still doesn't work? <span tabindex="0" @click="${()=>this.openMobileApp(!0)}">Try this alternate link</span></wcm-text>`:null}</wcm-info-footer><wcm-info-footer class="wcm-app-store"><div><wcm-wallet-image walletId="${e}" imageId="${li(t)}"></wcm-wallet-image><wcm-text>${`Get ${r}`}</wcm-text></div><wcm-button .iconRight="${Kt.ARROW_RIGHT_ICON}" .onClick="${()=>this.onGoToAppStore(a)}" variant="ghost">App Store</wcm-button></wcm-info-footer>`}};zh.styles=[Lt.globalCss,v$],Kw([xi()],zh.prototype,"isError",2),zh=Kw([Ut("wcm-mobile-connecting-view")],zh);const w$=jt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var y$=Object.defineProperty,_$=Object.getOwnPropertyDescriptor,x$=(r,e,t,i)=>{for(var n=i>1?void 0:i?_$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&y$(e,t,n),n};let jp=class extends Ct{render(){const{name:r,id:e,image_id:t}=je.getWalletRouterData(),{isDesktop:i,isWeb:n}=pt.getCachedRouterWalletPlatforms();return Ee`<wcm-modal-header title="${r}" .onAction="${pt.handleUriCopy}" .actionIcon="${Kt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr walletId="${e}" imageId="${li(t)}"></wcm-walletconnect-qr></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Scan this QR Code with your phone's camera or inside ${r} app`}</wcm-text><wcm-platform-selection .isDesktop="${i}" .isWeb="${n}"></wcm-platform-selection></wcm-info-footer>`}};jp.styles=[Lt.globalCss,w$],jp=x$([Ut("wcm-mobile-qr-connecting-view")],jp);var A$=Object.defineProperty,E$=Object.getOwnPropertyDescriptor,S$=(r,e,t,i)=>{for(var n=i>1?void 0:i?E$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&A$(e,t,n),n};let Wp=class extends Ct{render(){return Ee`<wcm-modal-header title="Scan the code" .onAction="${pt.handleUriCopy}" .actionIcon="${Kt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>`}};Wp.styles=[Lt.globalCss],Wp=S$([Ut("wcm-qrcode-view")],Wp);const I$=jt`wcm-modal-content{height:clamp(200px,60vh,600px);display:block;overflow:scroll;scrollbar-width:none;position:relative;margin-top:1px}.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between;margin:-15px -10px;padding-top:20px}wcm-modal-content::after,wcm-modal-content::before{content:'';position:fixed;pointer-events:none;z-index:1;width:100%;height:20px;opacity:1}wcm-modal-content::before{box-shadow:0 -1px 0 0 var(--wcm-color-bg-1);background:linear-gradient(var(--wcm-color-bg-1),rgba(255,255,255,0))}wcm-modal-content::after{box-shadow:0 1px 0 0 var(--wcm-color-bg-1);background:linear-gradient(rgba(255,255,255,0),var(--wcm-color-bg-1));top:calc(100% - 20px)}wcm-modal-content::-webkit-scrollbar{display:none}.wcm-placeholder-block{display:flex;justify-content:center;align-items:center;height:100px;overflow:hidden}.wcm-empty,.wcm-loading{display:flex}.wcm-loading .wcm-placeholder-block{height:100%}.wcm-end-reached .wcm-placeholder-block{height:0;opacity:0}.wcm-empty .wcm-placeholder-block{opacity:1;height:100%}wcm-wallet-button{margin:calc((100% - 60px)/ 3) 0}`;var M$=Object.defineProperty,C$=Object.getOwnPropertyDescriptor,Nf=(r,e,t,i)=>{for(var n=i>1?void 0:i?C$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&M$(e,t,n),n};const Kp=40;let ia=class extends Ct{constructor(){super(...arguments),this.loading=!_i.state.wallets.listings.length,this.firstFetch=!_i.state.wallets.listings.length,this.search="",this.endReached=!1,this.intersectionObserver=void 0,this.searchDebounce=pt.debounce(r=>{r.length>=1?(this.firstFetch=!0,this.endReached=!1,this.search=r,_i.resetSearch(),this.fetchWallets()):this.search&&(this.search="",this.endReached=this.isLastPage(),_i.resetSearch())})}firstUpdated(){this.createPaginationObserver()}disconnectedCallback(){var r;(r=this.intersectionObserver)==null||r.disconnect()}get placeholderEl(){return pt.getShadowRootElement(this,".wcm-placeholder-block")}createPaginationObserver(){this.intersectionObserver=new IntersectionObserver(([r])=>{r.isIntersecting&&!(this.search&&this.firstFetch)&&this.fetchWallets()}),this.intersectionObserver.observe(this.placeholderEl)}isLastPage(){const{wallets:r,search:e}=_i.state,{listings:t,total:i}=this.search?e:r;return i<=Kp||t.length>=i}async fetchWallets(){var r;const{wallets:e,search:t}=_i.state,{listings:i,total:n,page:s}=this.search?t:e;if(!this.endReached&&(this.firstFetch||n>Kp&&i.length<n))try{this.loading=!0;const a=(r=yr.state.chains)==null?void 0:r.join(","),{listings:f}=await _i.getWallets({page:this.firstFetch?1:s+1,entries:Kp,search:this.search,version:2,chains:a}),h=f.map(u=>pt.getWalletIcon(u));await Promise.all([...h.map(async u=>pt.preloadImage(u)),je.wait(300)]),this.endReached=this.isLastPage()}catch(a){console.error(a),to.openToast(pt.getErrorMessage(a),"error")}finally{this.loading=!1,this.firstFetch=!1}}onConnect(r){je.isAndroid()?pt.handleMobileLinking(r):pt.goToConnectingView(r)}onSearchChange(r){const{value:e}=r.target;this.searchDebounce(e)}render(){const{wallets:r,search:e}=_i.state,{listings:t}=this.search?e:r,i=this.loading&&!t.length,n=this.search.length>=3;let s=fo.manualWalletsTemplate(),a=fo.recomendedWalletsTemplate(!0);n&&(s=s.filter(({values:u})=>pt.caseSafeIncludes(u[0],this.search)),a=a.filter(({values:u})=>pt.caseSafeIncludes(u[0],this.search)));const f=!this.loading&&!t.length&&!a.length,h={"wcm-loading":i,"wcm-end-reached":this.endReached||!this.loading,"wcm-empty":f};return Ee`<wcm-modal-header><wcm-search-input .onChange="${this.onSearchChange.bind(this)}"></wcm-search-input></wcm-modal-header><wcm-modal-content class="${Is(h)}"><div class="wcm-grid">${i?null:s} ${i?null:a} ${i?null:t.map(u=>Ee`${u?Ee`<wcm-wallet-button imageId="${u.image_id}" name="${u.name}" walletId="${u.id}" .onClick="${()=>this.onConnect(u)}"></wcm-wallet-button>`:null}`)}</div><div class="wcm-placeholder-block">${f?Ee`<wcm-text variant="big-bold" color="secondary">No results found</wcm-text>`:null} ${!f&&this.loading?Ee`<wcm-spinner></wcm-spinner>`:null}</div></wcm-modal-content>`}};ia.styles=[Lt.globalCss,I$],Nf([xi()],ia.prototype,"loading",2),Nf([xi()],ia.prototype,"firstFetch",2),Nf([xi()],ia.prototype,"search",2),Nf([xi()],ia.prototype,"endReached",2),ia=Nf([Ut("wcm-wallet-explorer-view")],ia);const P$=jt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var D$=Object.defineProperty,O$=Object.getOwnPropertyDescriptor,Vw=(r,e,t,i)=>{for(var n=i>1?void 0:i?O$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&D$(e,t,n),n};let Hh=class extends Ct{constructor(){super(),this.isError=!1,this.openWebWallet()}onFormatAndRedirect(r){const{desktop:e,name:t}=je.getWalletRouterData(),i=e?.universal;if(i){const n=je.formatUniversalUrl(i,r,t);je.openHref(n,"_blank")}}openWebWallet(){const{walletConnectUri:r}=yr.state,e=je.getWalletRouterData();pt.setRecentWallet(e),r&&this.onFormatAndRedirect(r)}render(){const{name:r,id:e,image_id:t}=je.getWalletRouterData(),{isMobile:i,isDesktop:n}=pt.getCachedRouterWalletPlatforms(),s=je.isMobile();return Ee`<wcm-modal-header title="${r}" .onAction="${pt.handleUriCopy}" .actionIcon="${Kt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${li(t)}" label="${`Continue in ${r}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`${r} web app has opened in a new tab. Go there, accept the connection, and come back`}</wcm-text><wcm-platform-selection .isMobile="${i}" .isDesktop="${s?!1:n}" .isRetry="${!0}"><wcm-button .onClick="${this.openWebWallet.bind(this)}" .iconRight="${Kt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};Hh.styles=[Lt.globalCss,P$],Vw([xi()],Hh.prototype,"isError",2),Hh=Vw([Ut("wcm-web-connecting-view")],Hh);var R$=Object.freeze({__proto__:null,get WcmModal(){return fc},get WcmQrCode(){return Cs}});wn.EthereumProvider=tO,wn.OPTIONAL_EVENTS=_3,wn.OPTIONAL_METHODS=y3,wn.REQUIRED_EVENTS=dh,wn.REQUIRED_METHODS=uh,wn.default=vh,Object.defineProperty(wn,"__esModule",{value:!0})});
|
|
121
|
+
`);const a=HR(e,t,n),f=Th.getSymbolSize(e),h=new RR(f);return UR(h,e),FR(h),qR(h,e),bp(h,t,0),e>=7&&zR(h,e),kR(h,a),isNaN(i)&&(i=gp.getBestMask(h,bp.bind(null,h,t))),gp.applyMask(i,h),bp(h,t,i),{modules:h,version:e,errorCorrectionLevel:t,maskPattern:i,segments:n}}aw.create=function(e,t){if(typeof e>"u"||e==="")throw new Error("No input text");let i=pp.M,n,s;return typeof t<"u"&&(i=pp.from(t.errorCorrectionLevel,pp.M),n=Nh.from(t.version),s=gp.from(t.maskPattern),t.toSJISFunc&&Th.setToSJISFunction(t.toSJISFunc)),WR(e,n,i,s)};var xw={},wp={};(function(r){function e(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let i=t.slice().replace("#","").split("");if(i.length<3||i.length===5||i.length>8)throw new Error("Invalid hex color: "+t);(i.length===3||i.length===4)&&(i=Array.prototype.concat.apply([],i.map(function(s){return[s,s]}))),i.length===6&&i.push("F","F");const n=parseInt(i.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:"#"+i.slice(0,6).join("")}}r.getOptions=function(i){i||(i={}),i.color||(i.color={});const n=typeof i.margin>"u"||i.margin===null||i.margin<0?4:i.margin,s=i.width&&i.width>=21?i.width:void 0,a=i.scale||4;return{width:s,scale:s?4:a,margin:n,color:{dark:e(i.color.dark||"#000000ff"),light:e(i.color.light||"#ffffffff")},type:i.type,rendererOpts:i.rendererOpts||{}}},r.getScale=function(i,n){return n.width&&n.width>=i+n.margin*2?n.width/(i+n.margin*2):n.scale},r.getImageWidth=function(i,n){const s=r.getScale(i,n);return Math.floor((i+n.margin*2)*s)},r.qrToImageData=function(i,n,s){const a=n.modules.size,f=n.modules.data,h=r.getScale(a,s),u=Math.floor((a+s.margin*2)*h),g=s.margin*h,w=[s.color.light,s.color.dark];for(let M=0;M<u;M++)for(let P=0;P<u;P++){let O=(M*u+P)*4,$=s.color.light;if(M>=g&&P>=g&&M<u-g&&P<u-g){const q=Math.floor((M-g)/h),U=Math.floor((P-g)/h);$=w[f[q*a+U]?1:0]}i[O++]=$.r,i[O++]=$.g,i[O++]=$.b,i[O]=$.a}}})(wp),function(r){const e=wp;function t(n,s,a){n.clearRect(0,0,s.width,s.height),s.style||(s.style={}),s.height=a,s.width=a,s.style.height=a+"px",s.style.width=a+"px"}function i(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}r.render=function(s,a,f){let h=f,u=a;typeof h>"u"&&(!a||!a.getContext)&&(h=a,a=void 0),a||(u=i()),h=e.getOptions(h);const g=e.getImageWidth(s.modules.size,h),w=u.getContext("2d"),M=w.createImageData(g,g);return e.qrToImageData(M.data,s,h),t(w,u,g),w.putImageData(M,0,0),u},r.renderToDataURL=function(s,a,f){let h=f;typeof h>"u"&&(!a||!a.getContext)&&(h=a,a=void 0),h||(h={});const u=r.render(s,a,h),g=h.type||"image/png",w=h.rendererOpts||{};return u.toDataURL(g,w.quality)}}(xw);var Ew={};const KR=wp;function Aw(r,e){const t=r.a/255,i=e+'="'+r.hex+'"';return t<1?i+" "+e+'-opacity="'+t.toFixed(2).slice(1)+'"':i}function yp(r,e,t){let i=r+e;return typeof t<"u"&&(i+=" "+t),i}function VR(r,e,t){let i="",n=0,s=!1,a=0;for(let f=0;f<r.length;f++){const h=Math.floor(f%e),u=Math.floor(f/e);!h&&!s&&(s=!0),r[f]?(a++,f>0&&h>0&&r[f-1]||(i+=s?yp("M",h+t,.5+u+t):yp("m",n,0),n=0,s=!1),h+1<e&&r[f+1]||(i+=yp("h",a),a=0)):n++}return i}Ew.render=function(e,t,i){const n=KR.getOptions(t),s=e.modules.size,a=e.modules.data,f=s+n.margin*2,h=n.color.light.a?"<path "+Aw(n.color.light,"fill")+' d="M0 0h'+f+"v"+f+'H0z"/>':"",u="<path "+Aw(n.color.dark,"stroke")+' d="'+VR(a,s,n.margin)+'"/>',g='viewBox="0 0 '+f+" "+f+'"',M='<svg xmlns="http://www.w3.org/2000/svg" '+(n.width?'width="'+n.width+'" height="'+n.width+'" ':"")+g+' shape-rendering="crispEdges">'+h+u+`</svg>
|
|
122
|
+
`;return typeof i=="function"&&i(null,M),M};const GR=cR,_p=aw,Sw=xw,JR=Ew;function xp(r,e,t,i,n){const s=[].slice.call(arguments,1),a=s.length,f=typeof s[a-1]=="function";if(!f&&!GR())throw new Error("Callback required as last argument");if(f){if(a<2)throw new Error("Too few arguments provided");a===2?(n=t,t=e,e=i=void 0):a===3&&(e.getContext&&typeof n>"u"?(n=i,i=void 0):(n=i,i=t,t=e,e=void 0))}else{if(a<1)throw new Error("Too few arguments provided");return a===1?(t=e,e=i=void 0):a===2&&!e.getContext&&(i=t,t=e,e=void 0),new Promise(function(h,u){try{const g=_p.create(t,i);h(r(g,e,i))}catch(g){u(g)}})}try{const h=_p.create(t,i);n(null,r(h,e,i))}catch(h){n(h)}}Af.create=_p.create,Af.toCanvas=xp.bind(null,Sw.render),Af.toDataURL=xp.bind(null,Sw.renderToDataURL),Af.toString=xp.bind(null,function(r,e,t){return JR.render(r,t)});var YR=Object.defineProperty,Iw=Object.getOwnPropertySymbols,QR=Object.prototype.hasOwnProperty,ZR=Object.prototype.propertyIsEnumerable,Mw=(r,e,t)=>e in r?YR(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ep=(r,e)=>{for(var t in e||(e={}))QR.call(e,t)&&Mw(r,t,e[t]);if(Iw)for(var t of Iw(e))ZR.call(e,t)&&Mw(r,t,e[t]);return r};function XR(){var r;const e=(r=eo.state.themeMode)!=null?r:"dark",i={light:{foreground:{1:"rgb(20,20,20)",2:"rgb(121,134,134)",3:"rgb(158,169,169)"},background:{1:"rgb(255,255,255)",2:"rgb(241,243,243)",3:"rgb(228,231,231)"},overlay:"rgba(0,0,0,0.1)"},dark:{foreground:{1:"rgb(228,231,231)",2:"rgb(148,158,158)",3:"rgb(110,119,119)"},background:{1:"rgb(20,20,20)",2:"rgb(39,42,42)",3:"rgb(59,64,64)"},overlay:"rgba(255,255,255,0.1)"}}[e];return{"--wcm-color-fg-1":i.foreground[1],"--wcm-color-fg-2":i.foreground[2],"--wcm-color-fg-3":i.foreground[3],"--wcm-color-bg-1":i.background[1],"--wcm-color-bg-2":i.background[2],"--wcm-color-bg-3":i.background[3],"--wcm-color-overlay":i.overlay}}function Cw(){return{"--wcm-accent-color":"#3396FF","--wcm-accent-fill-color":"#FFFFFF","--wcm-z-index":"89","--wcm-background-color":"#3396FF","--wcm-background-border-radius":"8px","--wcm-container-border-radius":"30px","--wcm-wallet-icon-border-radius":"15px","--wcm-wallet-icon-large-border-radius":"30px","--wcm-wallet-icon-small-border-radius":"7px","--wcm-input-border-radius":"28px","--wcm-button-border-radius":"10px","--wcm-notification-border-radius":"36px","--wcm-secondary-button-border-radius":"28px","--wcm-icon-button-border-radius":"50%","--wcm-button-hover-highlight-border-radius":"10px","--wcm-text-big-bold-size":"20px","--wcm-text-big-bold-weight":"600","--wcm-text-big-bold-line-height":"24px","--wcm-text-big-bold-letter-spacing":"-0.03em","--wcm-text-big-bold-text-transform":"none","--wcm-text-xsmall-bold-size":"10px","--wcm-text-xsmall-bold-weight":"700","--wcm-text-xsmall-bold-line-height":"12px","--wcm-text-xsmall-bold-letter-spacing":"0.02em","--wcm-text-xsmall-bold-text-transform":"uppercase","--wcm-text-xsmall-regular-size":"12px","--wcm-text-xsmall-regular-weight":"600","--wcm-text-xsmall-regular-line-height":"14px","--wcm-text-xsmall-regular-letter-spacing":"-0.03em","--wcm-text-xsmall-regular-text-transform":"none","--wcm-text-small-thin-size":"14px","--wcm-text-small-thin-weight":"500","--wcm-text-small-thin-line-height":"16px","--wcm-text-small-thin-letter-spacing":"-0.03em","--wcm-text-small-thin-text-transform":"none","--wcm-text-small-regular-size":"14px","--wcm-text-small-regular-weight":"600","--wcm-text-small-regular-line-height":"16px","--wcm-text-small-regular-letter-spacing":"-0.03em","--wcm-text-small-regular-text-transform":"none","--wcm-text-medium-regular-size":"16px","--wcm-text-medium-regular-weight":"600","--wcm-text-medium-regular-line-height":"20px","--wcm-text-medium-regular-letter-spacing":"-0.03em","--wcm-text-medium-regular-text-transform":"none","--wcm-font-family":"-apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', sans-serif","--wcm-font-feature-settings":"'tnum' on, 'lnum' on, 'case' on","--wcm-success-color":"rgb(38,181,98)","--wcm-error-color":"rgb(242, 90, 103)","--wcm-overlay-background-color":"rgba(0, 0, 0, 0.3)","--wcm-overlay-backdrop-filter":"none"}}const Lt={getPreset(r){return Cw()[r]},setTheme(){const r=document.querySelector(":root"),{themeVariables:e}=eo.state;if(r){const t=Ep(Ep(Ep({},XR()),Cw()),e);Object.entries(t).forEach(([i,n])=>r.style.setProperty(i,n))}},globalCss:jt`*,::after,::before{margin:0;padding:0;box-sizing:border-box;font-style:normal;text-rendering:optimizeSpeed;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-tap-highlight-color:transparent;backface-visibility:hidden}button{cursor:pointer;display:flex;justify-content:center;align-items:center;position:relative;border:none;background-color:transparent;transition:all .2s ease}@media (hover:hover) and (pointer:fine){button:active{transition:all .1s ease;transform:scale(.93)}}button::after{content:'';position:absolute;top:0;bottom:0;left:0;right:0;transition:background-color,.2s ease}button:disabled{cursor:not-allowed}button svg,button wcm-text{position:relative;z-index:1}input{border:none;outline:0;appearance:none}img{display:block}::selection{color:var(--wcm-accent-fill-color);background:var(--wcm-accent-color)}`},eT=jt`button{border-radius:var(--wcm-secondary-button-border-radius);height:28px;padding:0 10px;background-color:var(--wcm-accent-color)}button path{fill:var(--wcm-accent-fill-color)}button::after{border-radius:inherit;border:1px solid var(--wcm-color-overlay)}button:disabled::after{background-color:transparent}.wcm-icon-left svg{margin-right:5px}.wcm-icon-right svg{margin-left:5px}button:active::after{background-color:var(--wcm-color-overlay)}.wcm-ghost,.wcm-ghost:active::after,.wcm-outline{background-color:transparent}.wcm-ghost:active{opacity:.5}@media(hover:hover){button:hover::after{background-color:var(--wcm-color-overlay)}.wcm-ghost:hover::after{background-color:transparent}.wcm-ghost:hover{opacity:.5}}button:disabled{background-color:var(--wcm-color-bg-3);pointer-events:none}.wcm-ghost::after{border-color:transparent}.wcm-ghost path{fill:var(--wcm-color-fg-2)}.wcm-outline path{fill:var(--wcm-accent-color)}.wcm-outline:disabled{background-color:transparent;opacity:.5}`;var tT=Object.defineProperty,rT=Object.getOwnPropertyDescriptor,nc=(r,e,t,i)=>{for(var n=i>1?void 0:i?rT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&tT(e,t,n),n};let oo=class extends Ct{constructor(){super(...arguments),this.disabled=!1,this.iconLeft=void 0,this.iconRight=void 0,this.onClick=()=>null,this.variant="default"}render(){const r={"wcm-icon-left":this.iconLeft!==void 0,"wcm-icon-right":this.iconRight!==void 0,"wcm-ghost":this.variant==="ghost","wcm-outline":this.variant==="outline"};let e="inverse";return this.variant==="ghost"&&(e="secondary"),this.variant==="outline"&&(e="accent"),Ae`<button class="${Is(r)}" ?disabled="${this.disabled}" @click="${this.onClick}">${this.iconLeft}<wcm-text variant="small-regular" color="${e}"><slot></slot></wcm-text>${this.iconRight}</button>`}};oo.styles=[Lt.globalCss,eT],nc([Et({type:Boolean})],oo.prototype,"disabled",2),nc([Et()],oo.prototype,"iconLeft",2),nc([Et()],oo.prototype,"iconRight",2),nc([Et()],oo.prototype,"onClick",2),nc([Et()],oo.prototype,"variant",2),oo=nc([Ft("wcm-button")],oo);const iT=jt`:host{display:inline-block}button{padding:0 15px 1px;height:40px;border-radius:var(--wcm-button-border-radius);color:var(--wcm-accent-fill-color);background-color:var(--wcm-accent-color)}button::after{content:'';top:0;bottom:0;left:0;right:0;position:absolute;background-color:transparent;border-radius:inherit;transition:background-color .2s ease;border:1px solid var(--wcm-color-overlay)}button:active::after{background-color:var(--wcm-color-overlay)}button:disabled{padding-bottom:0;background-color:var(--wcm-color-bg-3);color:var(--wcm-color-fg-3)}.wcm-secondary{color:var(--wcm-accent-color);background-color:transparent}.wcm-secondary::after{display:none}@media(hover:hover){button:hover::after{background-color:var(--wcm-color-overlay)}}`;var nT=Object.defineProperty,sT=Object.getOwnPropertyDescriptor,Ap=(r,e,t,i)=>{for(var n=i>1?void 0:i?sT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&nT(e,t,n),n};let Cf=class extends Ct{constructor(){super(...arguments),this.disabled=!1,this.variant="primary"}render(){const r={"wcm-secondary":this.variant==="secondary"};return Ae`<button ?disabled="${this.disabled}" class="${Is(r)}"><slot></slot></button>`}};Cf.styles=[Lt.globalCss,iT],Ap([Et({type:Boolean})],Cf.prototype,"disabled",2),Ap([Et()],Cf.prototype,"variant",2),Cf=Ap([Ft("wcm-button-big")],Cf);const oT=jt`:host{background-color:var(--wcm-color-bg-2);border-top:1px solid var(--wcm-color-bg-3)}div{padding:10px 20px;display:inherit;flex-direction:inherit;align-items:inherit;width:inherit;justify-content:inherit}`;var aT=Object.defineProperty,cT=Object.getOwnPropertyDescriptor,fT=(r,e,t,i)=>{for(var n=i>1?void 0:i?cT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&aT(e,t,n),n};let Sp=class extends Ct{render(){return Ae`<div><slot></slot></div>`}};Sp.styles=[Lt.globalCss,oT],Sp=fT([Ft("wcm-info-footer")],Sp);const Kt={CROSS_ICON:gr`<svg width="12" height="12" viewBox="0 0 12 12"><path d="M9.94 11A.75.75 0 1 0 11 9.94L7.414 6.353a.5.5 0 0 1 0-.708L11 2.061A.75.75 0 1 0 9.94 1L6.353 4.586a.5.5 0 0 1-.708 0L2.061 1A.75.75 0 0 0 1 2.06l3.586 3.586a.5.5 0 0 1 0 .708L1 9.939A.75.75 0 1 0 2.06 11l3.586-3.586a.5.5 0 0 1 .708 0L9.939 11Z" fill="#fff"/></svg>`,WALLET_CONNECT_LOGO:gr`<svg width="178" height="29" viewBox="0 0 178 29" id="wcm-wc-logo"><path d="M10.683 7.926c5.284-5.17 13.85-5.17 19.134 0l.636.623a.652.652 0 0 1 0 .936l-2.176 2.129a.343.343 0 0 1-.478 0l-.875-.857c-3.686-3.607-9.662-3.607-13.348 0l-.937.918a.343.343 0 0 1-.479 0l-2.175-2.13a.652.652 0 0 1 0-.936l.698-.683Zm23.633 4.403 1.935 1.895a.652.652 0 0 1 0 .936l-8.73 8.543a.687.687 0 0 1-.956 0L20.37 17.64a.172.172 0 0 0-.239 0l-6.195 6.063a.687.687 0 0 1-.957 0l-8.73-8.543a.652.652 0 0 1 0-.936l1.936-1.895a.687.687 0 0 1 .957 0l6.196 6.064a.172.172 0 0 0 .239 0l6.195-6.064a.687.687 0 0 1 .957 0l6.196 6.064a.172.172 0 0 0 .24 0l6.195-6.064a.687.687 0 0 1 .956 0ZM48.093 20.948l2.338-9.355c.139-.515.258-1.07.416-1.942.12.872.258 1.427.357 1.942l2.022 9.355h4.181l3.528-13.874h-3.21l-1.943 8.523a24.825 24.825 0 0 0-.456 2.457c-.158-.931-.317-1.625-.495-2.438l-1.883-8.542h-4.201l-2.042 8.542a41.204 41.204 0 0 0-.475 2.438 41.208 41.208 0 0 0-.476-2.438l-1.903-8.542h-3.349l3.508 13.874h4.083ZM63.33 21.304c1.585 0 2.596-.654 3.11-1.605-.059.297-.078.595-.078.892v.357h2.655V15.22c0-2.735-1.248-4.32-4.3-4.32-2.636 0-4.36 1.466-4.52 3.487h2.914c.1-.891.734-1.426 1.705-1.426.911 0 1.407.515 1.407 1.11 0 .435-.258.693-1.03.792l-1.388.159c-2.061.257-3.825 1.01-3.825 3.19 0 1.982 1.645 3.092 3.35 3.092Zm.891-2.041c-.773 0-1.348-.436-1.348-1.19 0-.733.655-1.09 1.645-1.268l.674-.119c.575-.118.892-.218 1.09-.396v.912c0 1.228-.892 2.06-2.06 2.06ZM70.398 7.074v13.874h2.874V7.074h-2.874ZM74.934 7.074v13.874h2.874V7.074h-2.874ZM84.08 21.304c2.735 0 4.5-1.546 4.697-3.567h-2.893c-.139.892-.892 1.387-1.804 1.387-1.228 0-2.12-.99-2.14-2.358h6.897v-.555c0-3.21-1.764-5.312-4.816-5.312-2.933 0-4.994 2.062-4.994 5.173 0 3.37 2.12 5.232 5.053 5.232Zm-2.16-6.421c.119-1.11.932-1.922 2.081-1.922 1.11 0 1.883.772 1.903 1.922H81.92ZM94.92 21.146c.633 0 1.248-.1 1.525-.179v-2.18c-.218.04-.475.06-.693.06-1.05 0-1.427-.595-1.427-1.566v-3.805h2.338v-2.24h-2.338V7.788H91.47v3.448H89.37v2.24h2.1v4.201c0 2.3 1.15 3.469 3.45 3.469ZM104.62 21.304c3.924 0 6.302-2.299 6.599-5.608h-3.111c-.238 1.803-1.506 3.032-3.369 3.032-2.2 0-3.746-1.784-3.746-4.796 0-2.953 1.605-4.638 3.805-4.638 1.883 0 2.953 1.15 3.171 2.834h3.191c-.317-3.448-2.854-5.41-6.342-5.41-3.984 0-7.036 2.695-7.036 7.214 0 4.677 2.676 7.372 6.838 7.372ZM117.449 21.304c2.993 0 5.114-1.882 5.114-5.172 0-3.23-2.121-5.233-5.114-5.233-2.972 0-5.093 2.002-5.093 5.233 0 3.29 2.101 5.172 5.093 5.172Zm0-2.22c-1.327 0-2.18-1.09-2.18-2.952 0-1.903.892-2.973 2.18-2.973 1.308 0 2.2 1.07 2.2 2.973 0 1.862-.872 2.953-2.2 2.953ZM126.569 20.948v-5.689c0-1.208.753-2.1 1.823-2.1 1.011 0 1.606.773 1.606 2.06v5.729h2.873v-6.144c0-2.339-1.229-3.905-3.428-3.905-1.526 0-2.458.734-2.953 1.606a5.31 5.31 0 0 0 .079-.892v-.377h-2.874v9.712h2.874ZM137.464 20.948v-5.689c0-1.208.753-2.1 1.823-2.1 1.011 0 1.606.773 1.606 2.06v5.729h2.873v-6.144c0-2.339-1.228-3.905-3.428-3.905-1.526 0-2.458.734-2.953 1.606a5.31 5.31 0 0 0 .079-.892v-.377h-2.874v9.712h2.874ZM149.949 21.304c2.735 0 4.499-1.546 4.697-3.567h-2.893c-.139.892-.892 1.387-1.804 1.387-1.228 0-2.12-.99-2.14-2.358h6.897v-.555c0-3.21-1.764-5.312-4.816-5.312-2.933 0-4.994 2.062-4.994 5.173 0 3.37 2.12 5.232 5.053 5.232Zm-2.16-6.421c.119-1.11.932-1.922 2.081-1.922 1.11 0 1.883.772 1.903 1.922h-3.984ZM160.876 21.304c3.013 0 4.658-1.645 4.975-4.201h-2.874c-.099 1.07-.713 1.982-2.001 1.982-1.309 0-2.2-1.21-2.2-2.993 0-1.942 1.03-2.933 2.259-2.933 1.209 0 1.803.872 1.883 1.882h2.873c-.218-2.358-1.823-4.142-4.776-4.142-2.874 0-5.153 1.903-5.153 5.193 0 3.25 1.923 5.212 5.014 5.212ZM172.067 21.146c.634 0 1.248-.1 1.526-.179v-2.18c-.218.04-.476.06-.694.06-1.05 0-1.427-.595-1.427-1.566v-3.805h2.339v-2.24h-2.339V7.788h-2.854v3.448h-2.1v2.24h2.1v4.201c0 2.3 1.15 3.469 3.449 3.469Z" fill="#fff"/></svg>`,WALLET_CONNECT_ICON:gr`<svg width="28" height="20" viewBox="0 0 28 20"><g clip-path="url(#a)"><path d="M7.386 6.482c3.653-3.576 9.575-3.576 13.228 0l.44.43a.451.451 0 0 1 0 .648L19.55 9.033a.237.237 0 0 1-.33 0l-.606-.592c-2.548-2.496-6.68-2.496-9.228 0l-.648.634a.237.237 0 0 1-.33 0L6.902 7.602a.451.451 0 0 1 0-.647l.483-.473Zm16.338 3.046 1.339 1.31a.451.451 0 0 1 0 .648l-6.035 5.909a.475.475 0 0 1-.662 0L14.083 13.2a.119.119 0 0 0-.166 0l-4.283 4.194a.475.475 0 0 1-.662 0l-6.035-5.91a.451.451 0 0 1 0-.647l1.338-1.31a.475.475 0 0 1 .662 0l4.283 4.194c.046.044.12.044.166 0l4.283-4.194a.475.475 0 0 1 .662 0l4.283 4.194c.046.044.12.044.166 0l4.283-4.194a.475.475 0 0 1 .662 0Z" fill="#000000"/></g><defs><clipPath id="a"><path fill="#ffffff" d="M0 0h28v20H0z"/></clipPath></defs></svg>`,WALLET_CONNECT_ICON_COLORED:gr`<svg width="96" height="96" fill="none"><path fill="#fff" d="M25.322 33.597c12.525-12.263 32.83-12.263 45.355 0l1.507 1.476a1.547 1.547 0 0 1 0 2.22l-5.156 5.048a.814.814 0 0 1-1.134 0l-2.074-2.03c-8.737-8.555-22.903-8.555-31.64 0l-2.222 2.175a.814.814 0 0 1-1.134 0l-5.156-5.049a1.547 1.547 0 0 1 0-2.22l1.654-1.62Zm56.019 10.44 4.589 4.494a1.547 1.547 0 0 1 0 2.22l-20.693 20.26a1.628 1.628 0 0 1-2.267 0L48.283 56.632a.407.407 0 0 0-.567 0L33.03 71.012a1.628 1.628 0 0 1-2.268 0L10.07 50.75a1.547 1.547 0 0 1 0-2.22l4.59-4.494a1.628 1.628 0 0 1 2.267 0l14.687 14.38c.156.153.41.153.567 0l14.685-14.38a1.628 1.628 0 0 1 2.268 0l14.687 14.38c.156.153.41.153.567 0l14.686-14.38a1.628 1.628 0 0 1 2.268 0Z"/><path stroke="#000" d="M25.672 33.954c12.33-12.072 32.325-12.072 44.655 0l1.508 1.476a1.047 1.047 0 0 1 0 1.506l-5.157 5.048a.314.314 0 0 1-.434 0l-2.074-2.03c-8.932-8.746-23.409-8.746-32.34 0l-2.222 2.174a.314.314 0 0 1-.434 0l-5.157-5.048a1.047 1.047 0 0 1 0-1.506l1.655-1.62Zm55.319 10.44 4.59 4.494a1.047 1.047 0 0 1 0 1.506l-20.694 20.26a1.128 1.128 0 0 1-1.568 0l-14.686-14.38a.907.907 0 0 0-1.267 0L32.68 70.655a1.128 1.128 0 0 1-1.568 0L10.42 50.394a1.047 1.047 0 0 1 0-1.506l4.59-4.493a1.128 1.128 0 0 1 1.567 0l14.687 14.379a.907.907 0 0 0 1.266 0l-.35-.357.35.357 14.686-14.38a1.128 1.128 0 0 1 1.568 0l14.687 14.38a.907.907 0 0 0 1.267 0l14.686-14.38a1.128 1.128 0 0 1 1.568 0Z"/></svg>`,BACK_ICON:gr`<svg width="10" height="18" viewBox="0 0 10 18"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.735.179a.75.75 0 0 1 .087 1.057L2.92 8.192a1.25 1.25 0 0 0 0 1.617l5.902 6.956a.75.75 0 1 1-1.144.97L1.776 10.78a2.75 2.75 0 0 1 0-3.559L7.678.265A.75.75 0 0 1 8.735.18Z" fill="#fff"/></svg>`,COPY_ICON:gr`<svg width="24" height="24" fill="none"><path fill="#fff" fill-rule="evenodd" d="M7.01 7.01c.03-1.545.138-2.5.535-3.28A5 5 0 0 1 9.73 1.545C10.8 1 12.2 1 15 1c2.8 0 4.2 0 5.27.545a5 5 0 0 1 2.185 2.185C23 4.8 23 6.2 23 9c0 2.8 0 4.2-.545 5.27a5 5 0 0 1-2.185 2.185c-.78.397-1.735.505-3.28.534l-.001.01c-.03 1.54-.138 2.493-.534 3.27a5 5 0 0 1-2.185 2.186C13.2 23 11.8 23 9 23c-2.8 0-4.2 0-5.27-.545a5 5 0 0 1-2.185-2.185C1 19.2 1 17.8 1 15c0-2.8 0-4.2.545-5.27A5 5 0 0 1 3.73 7.545C4.508 7.149 5.46 7.04 7 7.01h.01ZM15 15.5c-1.425 0-2.403-.001-3.162-.063-.74-.06-1.139-.172-1.427-.319a3.5 3.5 0 0 1-1.53-1.529c-.146-.288-.257-.686-.318-1.427C8.501 11.403 8.5 10.425 8.5 9c0-1.425.001-2.403.063-3.162.06-.74.172-1.139.318-1.427a3.5 3.5 0 0 1 1.53-1.53c.288-.146.686-.257 1.427-.318.759-.062 1.737-.063 3.162-.063 1.425 0 2.403.001 3.162.063.74.06 1.139.172 1.427.318a3.5 3.5 0 0 1 1.53 1.53c.146.288.257.686.318 1.427.062.759.063 1.737.063 3.162 0 1.425-.001 2.403-.063 3.162-.06.74-.172 1.139-.319 1.427a3.5 3.5 0 0 1-1.529 1.53c-.288.146-.686.257-1.427.318-.759.062-1.737.063-3.162.063ZM7 8.511c-.444.009-.825.025-1.162.052-.74.06-1.139.172-1.427.318a3.5 3.5 0 0 0-1.53 1.53c-.146.288-.257.686-.318 1.427-.062.759-.063 1.737-.063 3.162 0 1.425.001 2.403.063 3.162.06.74.172 1.139.318 1.427a3.5 3.5 0 0 0 1.53 1.53c.288.146.686.257 1.427.318.759.062 1.737.063 3.162.063 1.425 0 2.403-.001 3.162-.063.74-.06 1.139-.172 1.427-.319a3.5 3.5 0 0 0 1.53-1.53c.146-.287.257-.685.318-1.426.027-.337.043-.718.052-1.162H15c-2.8 0-4.2 0-5.27-.545a5 5 0 0 1-2.185-2.185C7 13.2 7 11.8 7 9v-.489Z" clip-rule="evenodd"/></svg>`,RETRY_ICON:gr`<svg width="15" height="16" viewBox="0 0 15 16"><path d="M6.464 2.03A.75.75 0 0 0 5.403.97L2.08 4.293a1 1 0 0 0 0 1.414L5.403 9.03a.75.75 0 0 0 1.06-1.06L4.672 6.177a.25.25 0 0 1 .177-.427h2.085a4 4 0 1 1-3.93 4.746c-.077-.407-.405-.746-.82-.746-.414 0-.755.338-.7.748a5.501 5.501 0 1 0 5.45-6.248H4.848a.25.25 0 0 1-.177-.427L6.464 2.03Z" fill="#fff"/></svg>`,DESKTOP_ICON:gr`<svg width="16" height="16" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M0 5.98c0-1.85 0-2.775.394-3.466a3 3 0 0 1 1.12-1.12C2.204 1 3.13 1 4.98 1h6.04c1.85 0 2.775 0 3.466.394a3 3 0 0 1 1.12 1.12C16 3.204 16 4.13 16 5.98v1.04c0 1.85 0 2.775-.394 3.466a3 3 0 0 1-1.12 1.12C13.796 12 12.87 12 11.02 12H4.98c-1.85 0-2.775 0-3.466-.394a3 3 0 0 1-1.12-1.12C0 9.796 0 8.87 0 7.02V5.98ZM4.98 2.5h6.04c.953 0 1.568.001 2.034.043.446.04.608.108.69.154a1.5 1.5 0 0 1 .559.56c.046.08.114.243.154.69.042.465.043 1.08.043 2.033v1.04c0 .952-.001 1.568-.043 2.034-.04.446-.108.608-.154.69a1.499 1.499 0 0 1-.56.559c-.08.046-.243.114-.69.154-.466.042-1.08.043-2.033.043H4.98c-.952 0-1.568-.001-2.034-.043-.446-.04-.608-.108-.69-.154a1.5 1.5 0 0 1-.559-.56c-.046-.08-.114-.243-.154-.69-.042-.465-.043-1.08-.043-2.033V5.98c0-.952.001-1.568.043-2.034.04-.446.108-.608.154-.69a1.5 1.5 0 0 1 .56-.559c.08-.046.243-.114.69-.154.465-.042 1.08-.043 2.033-.043Z" fill="#fff"/><path d="M4 14.25a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1-.75-.75Z" fill="#fff"/></svg>`,MOBILE_ICON:gr`<svg width="16" height="16" viewBox="0 0 16 16"><path d="M6.75 5a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M3 4.98c0-1.85 0-2.775.394-3.466a3 3 0 0 1 1.12-1.12C5.204 0 6.136 0 8 0s2.795 0 3.486.394a3 3 0 0 1 1.12 1.12C13 2.204 13 3.13 13 4.98v6.04c0 1.85 0 2.775-.394 3.466a3 3 0 0 1-1.12 1.12C10.796 16 9.864 16 8 16s-2.795 0-3.486-.394a3 3 0 0 1-1.12-1.12C3 13.796 3 12.87 3 11.02V4.98Zm8.5 0v6.04c0 .953-.001 1.568-.043 2.034-.04.446-.108.608-.154.69a1.499 1.499 0 0 1-.56.559c-.08.045-.242.113-.693.154-.47.042-1.091.043-2.05.043-.959 0-1.58-.001-2.05-.043-.45-.04-.613-.109-.693-.154a1.5 1.5 0 0 1-.56-.56c-.046-.08-.114-.243-.154-.69-.042-.466-.043-1.08-.043-2.033V4.98c0-.952.001-1.568.043-2.034.04-.446.108-.608.154-.69a1.5 1.5 0 0 1 .56-.559c.08-.045.243-.113.693-.154C6.42 1.501 7.041 1.5 8 1.5c.959 0 1.58.001 2.05.043.45.04.613.109.693.154a1.5 1.5 0 0 1 .56.56c.046.08.114.243.154.69.042.465.043 1.08.043 2.033Z" fill="#fff"/></svg>`,ARROW_DOWN_ICON:gr`<svg width="14" height="14" viewBox="0 0 14 14"><path d="M2.28 7.47a.75.75 0 0 0-1.06 1.06l5.25 5.25a.75.75 0 0 0 1.06 0l5.25-5.25a.75.75 0 0 0-1.06-1.06l-3.544 3.543a.25.25 0 0 1-.426-.177V.75a.75.75 0 0 0-1.5 0v10.086a.25.25 0 0 1-.427.176L2.28 7.47Z" fill="#fff"/></svg>`,ARROW_UP_RIGHT_ICON:gr`<svg width="15" height="14" fill="none"><path d="M4.5 1.75A.75.75 0 0 1 5.25 1H12a1.5 1.5 0 0 1 1.5 1.5v6.75a.75.75 0 0 1-1.5 0V4.164a.25.25 0 0 0-.427-.176L4.061 11.5A.75.75 0 0 1 3 10.44l7.513-7.513a.25.25 0 0 0-.177-.427H5.25a.75.75 0 0 1-.75-.75Z" fill="#fff"/></svg>`,ARROW_RIGHT_ICON:gr`<svg width="6" height="14" viewBox="0 0 6 14"><path fill-rule="evenodd" clip-rule="evenodd" d="M2.181 1.099a.75.75 0 0 1 1.024.279l2.433 4.258a2.75 2.75 0 0 1 0 2.729l-2.433 4.257a.75.75 0 1 1-1.303-.744L4.335 7.62a1.25 1.25 0 0 0 0-1.24L1.902 2.122a.75.75 0 0 1 .28-1.023Z" fill="#fff"/></svg>`,QRCODE_ICON:gr`<svg width="25" height="24" viewBox="0 0 25 24"><path d="M23.748 9a.748.748 0 0 0 .748-.752c-.018-2.596-.128-4.07-.784-5.22a6 6 0 0 0-2.24-2.24c-1.15-.656-2.624-.766-5.22-.784a.748.748 0 0 0-.752.748c0 .414.335.749.748.752 1.015.007 1.82.028 2.494.088.995.09 1.561.256 1.988.5.7.398 1.28.978 1.679 1.678.243.427.41.993.498 1.988.061.675.082 1.479.09 2.493a.753.753 0 0 0 .75.749ZM3.527.788C4.677.132 6.152.022 8.747.004A.748.748 0 0 1 9.5.752a.753.753 0 0 1-.749.752c-1.014.007-1.818.028-2.493.088-.995.09-1.561.256-1.988.5-.7.398-1.28.978-1.679 1.678-.243.427-.41.993-.499 1.988-.06.675-.081 1.479-.088 2.493A.753.753 0 0 1 1.252 9a.748.748 0 0 1-.748-.752c.018-2.596.128-4.07.784-5.22a6 6 0 0 1 2.24-2.24ZM1.252 15a.748.748 0 0 0-.748.752c.018 2.596.128 4.07.784 5.22a6 6 0 0 0 2.24 2.24c1.15.656 2.624.766 5.22.784a.748.748 0 0 0 .752-.748.753.753 0 0 0-.749-.752c-1.014-.007-1.818-.028-2.493-.089-.995-.089-1.561-.255-1.988-.498a4.5 4.5 0 0 1-1.679-1.68c-.243-.426-.41-.992-.499-1.987-.06-.675-.081-1.479-.088-2.493A.753.753 0 0 0 1.252 15ZM22.996 15.749a.753.753 0 0 1 .752-.749c.415 0 .751.338.748.752-.018 2.596-.128 4.07-.784 5.22a6 6 0 0 1-2.24 2.24c-1.15.656-2.624.766-5.22.784a.748.748 0 0 1-.752-.748c0-.414.335-.749.748-.752 1.015-.007 1.82-.028 2.494-.089.995-.089 1.561-.255 1.988-.498a4.5 4.5 0 0 0 1.679-1.68c.243-.426.41-.992.498-1.987.061-.675.082-1.479.09-2.493Z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M7 4a2.5 2.5 0 0 0-2.5 2.5v2A2.5 2.5 0 0 0 7 11h2a2.5 2.5 0 0 0 2.5-2.5v-2A2.5 2.5 0 0 0 9 4H7Zm2 1.5H7a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1ZM13.5 6.5A2.5 2.5 0 0 1 16 4h2a2.5 2.5 0 0 1 2.5 2.5v2A2.5 2.5 0 0 1 18 11h-2a2.5 2.5 0 0 1-2.5-2.5v-2Zm2.5-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1ZM7 13a2.5 2.5 0 0 0-2.5 2.5v2A2.5 2.5 0 0 0 7 20h2a2.5 2.5 0 0 0 2.5-2.5v-2A2.5 2.5 0 0 0 9 13H7Zm2 1.5H7a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1Z" fill="#fff"/><path d="M13.5 15.5c0-.465 0-.697.038-.89a2 2 0 0 1 1.572-1.572C15.303 13 15.535 13 16 13v2.5h-2.5ZM18 13c.465 0 .697 0 .89.038a2 2 0 0 1 1.572 1.572c.038.193.038.425.038.89H18V13ZM18 17.5h2.5c0 .465 0 .697-.038.89a2 2 0 0 1-1.572 1.572C18.697 20 18.465 20 18 20v-2.5ZM13.5 17.5H16V20c-.465 0-.697 0-.89-.038a2 2 0 0 1-1.572-1.572c-.038-.193-.038-.425-.038-.89Z" fill="#fff"/></svg>`,SCAN_ICON:gr`<svg width="16" height="16" fill="none"><path fill="#fff" d="M10 15.216c0 .422.347.763.768.74 1.202-.064 2.025-.222 2.71-.613a5.001 5.001 0 0 0 1.865-1.866c.39-.684.549-1.507.613-2.709a.735.735 0 0 0-.74-.768.768.768 0 0 0-.76.732c-.009.157-.02.306-.032.447-.073.812-.206 1.244-.384 1.555-.31.545-.761.996-1.306 1.306-.311.178-.743.311-1.555.384-.141.013-.29.023-.447.032a.768.768 0 0 0-.732.76ZM10 .784c0 .407.325.737.732.76.157.009.306.02.447.032.812.073 1.244.206 1.555.384a3.5 3.5 0 0 1 1.306 1.306c.178.311.311.743.384 1.555.013.142.023.29.032.447a.768.768 0 0 0 .76.732.734.734 0 0 0 .74-.768c-.064-1.202-.222-2.025-.613-2.71A5 5 0 0 0 13.477.658c-.684-.39-1.507-.549-2.709-.613a.735.735 0 0 0-.768.74ZM5.232.044A.735.735 0 0 1 6 .784a.768.768 0 0 1-.732.76c-.157.009-.305.02-.447.032-.812.073-1.244.206-1.555.384A3.5 3.5 0 0 0 1.96 3.266c-.178.311-.311.743-.384 1.555-.013.142-.023.29-.032.447A.768.768 0 0 1 .784 6a.735.735 0 0 1-.74-.768c.064-1.202.222-2.025.613-2.71A5 5 0 0 1 2.523.658C3.207.267 4.03.108 5.233.044ZM5.268 14.456a.768.768 0 0 1 .732.76.734.734 0 0 1-.768.74c-1.202-.064-2.025-.222-2.71-.613a5 5 0 0 1-1.865-1.866c-.39-.684-.549-1.507-.613-2.709A.735.735 0 0 1 .784 10c.407 0 .737.325.76.732.009.157.02.306.032.447.073.812.206 1.244.384 1.555a3.5 3.5 0 0 0 1.306 1.306c.311.178.743.311 1.555.384.142.013.29.023.447.032Z"/></svg>`,CHECKMARK_ICON:gr`<svg width="13" height="12" viewBox="0 0 13 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.155.132a.75.75 0 0 1 .232 1.035L5.821 11.535a1 1 0 0 1-1.626.09L.665 7.21a.75.75 0 1 1 1.17-.937L4.71 9.867a.25.25 0 0 0 .406-.023L11.12.364a.75.75 0 0 1 1.035-.232Z" fill="#fff"/></svg>`,SEARCH_ICON:gr`<svg width="20" height="21"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.432 13.992c-.354-.353-.91-.382-1.35-.146a5.5 5.5 0 1 1 2.265-2.265c-.237.441-.208.997.145 1.35l3.296 3.296a.75.75 0 1 1-1.06 1.061l-3.296-3.296Zm.06-5a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z" fill="#949E9E"/></svg>`,WALLET_PLACEHOLDER:gr`<svg width="60" height="60" fill="none" viewBox="0 0 60 60"><g clip-path="url(#q)"><path id="wallet-placeholder-fill" fill="#fff" d="M0 24.9c0-9.251 0-13.877 1.97-17.332a15 15 0 0 1 5.598-5.597C11.023 0 15.648 0 24.9 0h10.2c9.252 0 13.877 0 17.332 1.97a15 15 0 0 1 5.597 5.598C60 11.023 60 15.648 60 24.9v10.2c0 9.252 0 13.877-1.97 17.332a15.001 15.001 0 0 1-5.598 5.597C48.977 60 44.352 60 35.1 60H24.9c-9.251 0-13.877 0-17.332-1.97a15 15 0 0 1-5.597-5.598C0 48.977 0 44.352 0 35.1V24.9Z"/><path id="wallet-placeholder-dash" stroke="#000" stroke-dasharray="4 4" stroke-width="1.5" d="M.04 41.708a231.598 231.598 0 0 1-.039-4.403l.75-.001L.75 35.1v-2.55H0v-5.1h.75V24.9l.001-2.204h-.75c.003-1.617.011-3.077.039-4.404l.75.016c.034-1.65.099-3.08.218-4.343l-.746-.07c.158-1.678.412-3.083.82-4.316l.713.236c.224-.679.497-1.296.827-1.875a14.25 14.25 0 0 1 1.05-1.585L3.076 5.9A15 15 0 0 1 5.9 3.076l.455.596a14.25 14.25 0 0 1 1.585-1.05c.579-.33 1.196-.603 1.875-.827l-.236-.712C10.812.674 12.217.42 13.895.262l.07.746C15.23.89 16.66.824 18.308.79l-.016-.75C19.62.012 21.08.004 22.695.001l.001.75L24.9.75h2.55V0h5.1v.75h2.55l2.204.001v-.75c1.617.003 3.077.011 4.404.039l-.016.75c1.65.034 3.08.099 4.343.218l.07-.746c1.678.158 3.083.412 4.316.82l-.236.713c.679.224 1.296.497 1.875.827a14.24 14.24 0 0 1 1.585 1.05l.455-.596A14.999 14.999 0 0 1 56.924 5.9l-.596.455c.384.502.735 1.032 1.05 1.585.33.579.602 1.196.827 1.875l.712-.236c.409 1.233.663 2.638.822 4.316l-.747.07c.119 1.264.184 2.694.218 4.343l.75-.016c.028 1.327.036 2.787.039 4.403l-.75.001.001 2.204v2.55H60v5.1h-.75v2.55l-.001 2.204h.75a231.431 231.431 0 0 1-.039 4.404l-.75-.016c-.034 1.65-.099 3.08-.218 4.343l.747.07c-.159 1.678-.413 3.083-.822 4.316l-.712-.236a10.255 10.255 0 0 1-.827 1.875 14.242 14.242 0 0 1-1.05 1.585l.596.455a14.997 14.997 0 0 1-2.824 2.824l-.455-.596c-.502.384-1.032.735-1.585 1.05-.579.33-1.196.602-1.875.827l.236.712c-1.233.409-2.638.663-4.316.822l-.07-.747c-1.264.119-2.694.184-4.343.218l.016.75c-1.327.028-2.787.036-4.403.039l-.001-.75-2.204.001h-2.55V60h-5.1v-.75H24.9l-2.204-.001v.75a231.431 231.431 0 0 1-4.404-.039l.016-.75c-1.65-.034-3.08-.099-4.343-.218l-.07.747c-1.678-.159-3.083-.413-4.316-.822l.236-.712a10.258 10.258 0 0 1-1.875-.827 14.252 14.252 0 0 1-1.585-1.05l-.455.596A14.999 14.999 0 0 1 3.076 54.1l.596-.455a14.24 14.24 0 0 1-1.05-1.585 10.259 10.259 0 0 1-.827-1.875l-.712.236C.674 49.188.42 47.783.262 46.105l.746-.07C.89 44.77.824 43.34.79 41.692l-.75.016Z"/><path fill="#fff" fill-rule="evenodd" d="M35.643 32.145c-.297-.743-.445-1.114-.401-1.275a.42.42 0 0 1 .182-.27c.134-.1.463-.1 1.123-.1.742 0 1.499.046 2.236-.05a6 6 0 0 0 5.166-5.166c.051-.39.051-.855.051-1.784 0-.928 0-1.393-.051-1.783a6 6 0 0 0-5.166-5.165c-.39-.052-.854-.052-1.783-.052h-7.72c-4.934 0-7.401 0-9.244 1.051a8 8 0 0 0-2.985 2.986C16.057 22.28 16.003 24.58 16 29 15.998 31.075 16 33.15 16 35.224A7.778 7.778 0 0 0 23.778 43H28.5c1.394 0 2.09 0 2.67-.116a6 6 0 0 0 4.715-4.714c.115-.58.115-1.301.115-2.744 0-1.31 0-1.964-.114-2.49a4.998 4.998 0 0 0-.243-.792Z" clip-rule="evenodd"/><path fill="#9EA9A9" fill-rule="evenodd" d="M37 18h-7.72c-2.494 0-4.266.002-5.647.126-1.361.122-2.197.354-2.854.728a6.5 6.5 0 0 0-2.425 2.426c-.375.657-.607 1.492-.729 2.853-.11 1.233-.123 2.777-.125 4.867 0 .7 0 1.05.097 1.181.096.13.182.181.343.2.163.02.518-.18 1.229-.581a6.195 6.195 0 0 1 3.053-.8H37c.977 0 1.32-.003 1.587-.038a4.5 4.5 0 0 0 3.874-3.874c.036-.268.039-.611.039-1.588 0-.976-.003-1.319-.038-1.587a4.5 4.5 0 0 0-3.875-3.874C38.32 18.004 37.977 18 37 18Zm-7.364 12.5h-7.414a4.722 4.722 0 0 0-4.722 4.723 6.278 6.278 0 0 0 6.278 6.278H28.5c1.466 0 1.98-.008 2.378-.087a4.5 4.5 0 0 0 3.535-3.536c.08-.397.087-.933.087-2.451 0-1.391-.009-1.843-.08-2.17a3.5 3.5 0 0 0-2.676-2.676c-.328-.072-.762-.08-2.108-.08Z" clip-rule="evenodd"/></g><defs><clipPath id="q"><path fill="#fff" d="M0 0h60v60H0z"/></clipPath></defs></svg>`,GLOBE_ICON:gr`<svg width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="#fff" fill-rule="evenodd" d="M15.5 8a7.5 7.5 0 1 1-15 0 7.5 7.5 0 0 1 15 0Zm-2.113.75c.301 0 .535.264.47.558a6.01 6.01 0 0 1-2.867 3.896c-.203.116-.42-.103-.334-.32.409-1.018.691-2.274.797-3.657a.512.512 0 0 1 .507-.477h1.427Zm.47-2.058c.065.294-.169.558-.47.558H11.96a.512.512 0 0 1-.507-.477c-.106-1.383-.389-2.638-.797-3.656-.087-.217.13-.437.333-.32a6.01 6.01 0 0 1 2.868 3.895Zm-4.402.558c.286 0 .515-.24.49-.525-.121-1.361-.429-2.534-.83-3.393-.279-.6-.549-.93-.753-1.112a.535.535 0 0 0-.724 0c-.204.182-.474.513-.754 1.112-.4.859-.708 2.032-.828 3.393a.486.486 0 0 0 .49.525h2.909Zm-5.415 0c.267 0 .486-.21.507-.477.106-1.383.389-2.638.797-3.656.087-.217-.13-.437-.333-.32a6.01 6.01 0 0 0-2.868 3.895c-.065.294.169.558.47.558H4.04ZM2.143 9.308c-.065-.294.169-.558.47-.558H4.04c.267 0 .486.21.507.477.106 1.383.389 2.639.797 3.657.087.217-.13.436-.333.32a6.01 6.01 0 0 1-2.868-3.896Zm3.913-.033a.486.486 0 0 1 .49-.525h2.909c.286 0 .515.24.49.525-.121 1.361-.428 2.535-.83 3.394-.279.6-.549.93-.753 1.112a.535.535 0 0 1-.724 0c-.204-.182-.474-.513-.754-1.112-.4-.859-.708-2.033-.828-3.394Z" clip-rule="evenodd"/></svg>`},lT=jt`.wcm-toolbar-placeholder{top:0;bottom:0;left:0;right:0;width:100%;position:absolute;display:block;pointer-events:none;height:100px;border-radius:calc(var(--wcm-background-border-radius) * .9);background-color:var(--wcm-background-color);background-position:center;background-size:cover}.wcm-toolbar{height:38px;display:flex;position:relative;margin:5px 15px 5px 5px;justify-content:space-between;align-items:center}.wcm-toolbar img,.wcm-toolbar svg{height:28px;object-position:left center;object-fit:contain}#wcm-wc-logo path{fill:var(--wcm-accent-fill-color)}button{width:28px;height:28px;border-radius:var(--wcm-icon-button-border-radius);border:0;display:flex;justify-content:center;align-items:center;cursor:pointer;background-color:var(--wcm-color-bg-1);box-shadow:0 0 0 1px var(--wcm-color-overlay)}button:active{background-color:var(--wcm-color-bg-2)}button svg{display:block;object-position:center}button path{fill:var(--wcm-color-fg-1)}.wcm-toolbar div{display:flex}@media(hover:hover){button:hover{background-color:var(--wcm-color-bg-2)}}`;var hT=Object.defineProperty,uT=Object.getOwnPropertyDescriptor,dT=(r,e,t,i)=>{for(var n=i>1?void 0:i?uT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&hT(e,t,n),n};let Ip=class extends Ct{render(){return Ae`<div class="wcm-toolbar-placeholder"></div><div class="wcm-toolbar">${Kt.WALLET_CONNECT_LOGO} <button @click="${Vo.close}">${Kt.CROSS_ICON}</button></div>`}};Ip.styles=[Lt.globalCss,lT],Ip=dT([Ft("wcm-modal-backcard")],Ip);const pT=jt`main{padding:20px;padding-top:0;width:100%}`;var gT=Object.defineProperty,vT=Object.getOwnPropertyDescriptor,mT=(r,e,t,i)=>{for(var n=i>1?void 0:i?vT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&gT(e,t,n),n};let Mp=class extends Ct{render(){return Ae`<main><slot></slot></main>`}};Mp.styles=[Lt.globalCss,pT],Mp=mT([Ft("wcm-modal-content")],Mp);const bT=jt`footer{padding:10px;display:flex;flex-direction:column;align-items:inherit;justify-content:inherit;border-top:1px solid var(--wcm-color-bg-2)}`;var wT=Object.defineProperty,yT=Object.getOwnPropertyDescriptor,_T=(r,e,t,i)=>{for(var n=i>1?void 0:i?yT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&wT(e,t,n),n};let Cp=class extends Ct{render(){return Ae`<footer><slot></slot></footer>`}};Cp.styles=[Lt.globalCss,bT],Cp=_T([Ft("wcm-modal-footer")],Cp);const xT=jt`header{display:flex;justify-content:center;align-items:center;padding:20px;position:relative}.wcm-border{border-bottom:1px solid var(--wcm-color-bg-2);margin-bottom:20px}header button{padding:15px 20px}header button:active{opacity:.5}@media(hover:hover){header button:hover{opacity:.5}}.wcm-back-btn{position:absolute;left:0}.wcm-action-btn{position:absolute;right:0}path{fill:var(--wcm-accent-color)}`;var ET=Object.defineProperty,AT=Object.getOwnPropertyDescriptor,Pf=(r,e,t,i)=>{for(var n=i>1?void 0:i?AT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&ET(e,t,n),n};let ta=class extends Ct{constructor(){super(...arguments),this.title="",this.onAction=void 0,this.actionIcon=void 0,this.border=!1}backBtnTemplate(){return Ae`<button class="wcm-back-btn" @click="${lr.goBack}">${Kt.BACK_ICON}</button>`}actionBtnTemplate(){return Ae`<button class="wcm-action-btn" @click="${this.onAction}">${this.actionIcon}</button>`}render(){const r={"wcm-border":this.border},e=lr.state.history.length>1,t=this.title?Ae`<wcm-text variant="big-bold">${this.title}</wcm-text>`:Ae`<slot></slot>`;return Ae`<header class="${Is(r)}">${e?this.backBtnTemplate():null} ${t} ${this.onAction?this.actionBtnTemplate():null}</header>`}};ta.styles=[Lt.globalCss,xT],Pf([Et()],ta.prototype,"title",2),Pf([Et()],ta.prototype,"onAction",2),Pf([Et()],ta.prototype,"actionIcon",2),Pf([Et({type:Boolean})],ta.prototype,"border",2),ta=Pf([Ft("wcm-modal-header")],ta);const pt={MOBILE_BREAKPOINT:600,WCM_RECENT_WALLET_DATA:"WCM_RECENT_WALLET_DATA",EXPLORER_WALLET_URL:"https://explorer.walletconnect.com/?type=wallet",getShadowRootElement(r,e){const t=r.renderRoot.querySelector(e);if(!t)throw new Error(`${e} not found`);return t},getWalletIcon({id:r,image_id:e}){const{walletImages:t}=qi.state;return t?.[r]?t[r]:e?_i.getWalletImageUrl(e):""},getWalletName(r,e=!1){return e&&r.length>8?`${r.substring(0,8)}..`:r},isMobileAnimation(){return window.innerWidth<=pt.MOBILE_BREAKPOINT},async preloadImage(r){const e=new Promise((t,i)=>{const n=new Image;n.onload=t,n.onerror=i,n.crossOrigin="anonymous",n.src=r});return Promise.race([e,je.wait(3e3)])},getErrorMessage(r){return r instanceof Error?r.message:"Unknown Error"},debounce(r,e=500){let t;return(...i)=>{function n(){r(...i)}t&&clearTimeout(t),t=setTimeout(n,e)}},handleMobileLinking(r,e="_self"){const{walletConnectUri:t}=yr.state,{mobile:i,name:n}=r,s=i?.native,a=i?.universal;pt.setRecentWallet(r);function f(h){if(s){const u=je.formatNativeUrl(s,h,n);je.openHref(u,e)}else if(a){const u=je.formatUniversalUrl(a,h,n);je.openHref(u,e)}}t&&f(t)},handleAndroidLinking(){const{walletConnectUri:r}=yr.state;r&&(je.setWalletConnectAndroidDeepLink(r),je.openHref(r,je.isTelegram()?"_blank":"_self"))},async handleUriCopy(){const{walletConnectUri:r}=yr.state;if(r)try{await navigator.clipboard.writeText(r),to.openToast("Link copied","success")}catch{to.openToast("Failed to copy","error")}},getCustomImageUrls(){const{walletImages:r}=qi.state,e=Object.values(r??{});return Object.values(e)},truncate(r,e=8){return r.length<=e?r:`${r.substring(0,4)}...${r.substring(r.length-4)}`},setRecentWallet(r){try{localStorage.setItem(pt.WCM_RECENT_WALLET_DATA,JSON.stringify(r))}catch{console.info("Unable to set recent wallet")}},getRecentWallet(){try{const r=localStorage.getItem(pt.WCM_RECENT_WALLET_DATA);return r?JSON.parse(r):void 0}catch{console.info("Unable to get recent wallet")}},caseSafeIncludes(r,e){return r.toUpperCase().includes(e.toUpperCase())},openWalletExplorerUrl(){je.openHref(pt.EXPLORER_WALLET_URL,"_blank")},getCachedRouterWalletPlatforms(){const{desktop:r,mobile:e}=je.getWalletRouterData(),t=!!r?.native,i=!!r?.universal,n=!!e?.native||!!e?.universal;return{isDesktop:t,isMobile:n,isWeb:i}},goToConnectingView(r){lr.setData({Wallet:r});const e=je.isMobile(),{isDesktop:t,isWeb:i,isMobile:n}=pt.getCachedRouterWalletPlatforms();e?n?(lr.push("MobileConnecting"),!je.isAndroid()&&je.isTelegram()&&this.handleMobileLinking(r,"_blank")):i?lr.push("WebConnecting"):lr.push("InstallWallet"):t?lr.push("DesktopConnecting"):i?lr.push("WebConnecting"):n?lr.push("MobileQrcodeConnecting"):lr.push("InstallWallet")}},ST=jt`.wcm-router{overflow:hidden;will-change:transform}.wcm-content{display:flex;flex-direction:column}`;var IT=Object.defineProperty,MT=Object.getOwnPropertyDescriptor,Pp=(r,e,t,i)=>{for(var n=i>1?void 0:i?MT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&IT(e,t,n),n};let Df=class extends Ct{constructor(){super(),this.view=lr.state.view,this.prevView=lr.state.view,this.unsubscribe=void 0,this.oldHeight="0px",this.resizeObserver=void 0,this.unsubscribe=lr.subscribe(r=>{this.view!==r.view&&this.onChangeRoute()})}firstUpdated(){this.resizeObserver=new ResizeObserver(([r])=>{const e=`${r.contentRect.height}px`;this.oldHeight!=="0px"&&ea(this.routerEl,{height:[this.oldHeight,e]},{duration:.2}),this.oldHeight=e}),this.resizeObserver.observe(this.contentEl)}disconnectedCallback(){var r,e;(r=this.unsubscribe)==null||r.call(this),(e=this.resizeObserver)==null||e.disconnect()}get routerEl(){return pt.getShadowRootElement(this,".wcm-router")}get contentEl(){return pt.getShadowRootElement(this,".wcm-content")}viewTemplate(){switch(this.view){case"ConnectWallet":return Ae`<wcm-connect-wallet-view></wcm-connect-wallet-view>`;case"DesktopConnecting":return Ae`<wcm-desktop-connecting-view></wcm-desktop-connecting-view>`;case"MobileConnecting":return Ae`<wcm-mobile-connecting-view></wcm-mobile-connecting-view>`;case"WebConnecting":return Ae`<wcm-web-connecting-view></wcm-web-connecting-view>`;case"MobileQrcodeConnecting":return Ae`<wcm-mobile-qr-connecting-view></wcm-mobile-qr-connecting-view>`;case"WalletExplorer":return Ae`<wcm-wallet-explorer-view></wcm-wallet-explorer-view>`;case"Qrcode":return Ae`<wcm-qrcode-view></wcm-qrcode-view>`;case"InstallWallet":return Ae`<wcm-install-wallet-view></wcm-install-wallet-view>`;default:return Ae`<div>Not Found</div>`}}async onChangeRoute(){await ea(this.routerEl,{opacity:[1,0],scale:[1,1.02]},{duration:.15,delay:.1}).finished,this.view=lr.state.view,ea(this.routerEl,{opacity:[0,1],scale:[.99,1]},{duration:.37,delay:.05})}render(){return Ae`<div class="wcm-router"><div class="wcm-content">${this.viewTemplate()}</div></div>`}};Df.styles=[Lt.globalCss,ST],Pp([xi()],Df.prototype,"view",2),Pp([xi()],Df.prototype,"prevView",2),Df=Pp([Ft("wcm-modal-router")],Df);const CT=jt`div{height:36px;width:max-content;display:flex;justify-content:center;align-items:center;padding:9px 15px 11px;position:absolute;top:12px;box-shadow:0 6px 14px -6px rgba(10,16,31,.3),0 10px 32px -4px rgba(10,16,31,.15);z-index:2;left:50%;transform:translateX(-50%);pointer-events:none;backdrop-filter:blur(20px) saturate(1.8);-webkit-backdrop-filter:blur(20px) saturate(1.8);border-radius:var(--wcm-notification-border-radius);border:1px solid var(--wcm-color-overlay);background-color:var(--wcm-color-overlay)}svg{margin-right:5px}@-moz-document url-prefix(){div{background-color:var(--wcm-color-bg-3)}}.wcm-success path{fill:var(--wcm-accent-color)}.wcm-error path{fill:var(--wcm-error-color)}`;var PT=Object.defineProperty,DT=Object.getOwnPropertyDescriptor,Pw=(r,e,t,i)=>{for(var n=i>1?void 0:i?DT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&PT(e,t,n),n};let $h=class extends Ct{constructor(){super(),this.open=!1,this.unsubscribe=void 0,this.timeout=void 0,this.unsubscribe=to.subscribe(r=>{r.open?(this.open=!0,this.timeout=setTimeout(()=>to.closeToast(),2200)):(this.open=!1,clearTimeout(this.timeout))})}disconnectedCallback(){var r;(r=this.unsubscribe)==null||r.call(this),clearTimeout(this.timeout),to.closeToast()}render(){const{message:r,variant:e}=to.state,t={"wcm-success":e==="success","wcm-error":e==="error"};return this.open?Ae`<div class="${Is(t)}">${e==="success"?Kt.CHECKMARK_ICON:null} ${e==="error"?Kt.CROSS_ICON:null}<wcm-text variant="small-regular">${r}</wcm-text></div>`:null}};$h.styles=[Lt.globalCss,CT],Pw([xi()],$h.prototype,"open",2),$h=Pw([Ft("wcm-modal-toast")],$h);const OT=.1,Dw=2.5,Ms=7;function Dp(r,e,t){return r===e?!1:(r-e<0?e-r:r-e)<=t+OT}function RT(r,e){const t=Array.prototype.slice.call(Af.create(r,{errorCorrectionLevel:e}).modules.data,0),i=Math.sqrt(t.length);return t.reduce((n,s,a)=>(a%i===0?n.push([s]):n[n.length-1].push(s))&&n,[])}const TT={generate(r,e,t){const i="#141414",n="#ffffff",s=[],a=RT(r,"Q"),f=e/a.length,h=[{x:0,y:0},{x:1,y:0},{x:0,y:1}];h.forEach(({x:O,y:$})=>{const q=(a.length-Ms)*f*O,U=(a.length-Ms)*f*$,J=.45;for(let ee=0;ee<h.length;ee+=1){const W=f*(Ms-ee*2);s.push(gr`<rect fill="${ee%2===0?i:n}" height="${W}" rx="${W*J}" ry="${W*J}" width="${W}" x="${q+f*ee}" y="${U+f*ee}">`)}});const u=Math.floor((t+25)/f),g=a.length/2-u/2,w=a.length/2+u/2-1,M=[];a.forEach((O,$)=>{O.forEach((q,U)=>{if(a[$][U]&&!($<Ms&&U<Ms||$>a.length-(Ms+1)&&U<Ms||$<Ms&&U>a.length-(Ms+1))&&!($>g&&$<w&&U>g&&U<w)){const J=$*f+f/2,ee=U*f+f/2;M.push([J,ee])}})});const P={};return M.forEach(([O,$])=>{P[O]?P[O].push($):P[O]=[$]}),Object.entries(P).map(([O,$])=>{const q=$.filter(U=>$.every(J=>!Dp(U,J,f)));return[Number(O),q]}).forEach(([O,$])=>{$.forEach(q=>{s.push(gr`<circle cx="${O}" cy="${q}" fill="${i}" r="${f/Dw}">`)})}),Object.entries(P).filter(([O,$])=>$.length>1).map(([O,$])=>{const q=$.filter(U=>$.some(J=>Dp(U,J,f)));return[Number(O),q]}).map(([O,$])=>{$.sort((U,J)=>U<J?-1:1);const q=[];for(const U of $){const J=q.find(ee=>ee.some(W=>Dp(U,W,f)));J?J.push(U):q.push([U])}return[O,q.map(U=>[U[0],U[U.length-1]])]}).forEach(([O,$])=>{$.forEach(([q,U])=>{s.push(gr`<line x1="${O}" x2="${O}" y1="${q}" y2="${U}" stroke="${i}" stroke-width="${f/(Dw/2)}" stroke-linecap="round">`)})}),s}},NT=jt`@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}div{position:relative;user-select:none;display:block;overflow:hidden;aspect-ratio:1/1;animation:fadeIn ease .2s}.wcm-dark{background-color:#fff;border-radius:var(--wcm-container-border-radius);padding:18px;box-shadow:0 2px 5px #000}svg:first-child,wcm-wallet-image{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%)}wcm-wallet-image{transform:translateY(-50%) translateX(-50%)}wcm-wallet-image{width:25%;height:25%;border-radius:var(--wcm-wallet-icon-border-radius)}svg:first-child{transform:translateY(-50%) translateX(-50%) scale(.9)}svg:first-child path:first-child{fill:var(--wcm-accent-color)}svg:first-child path:last-child{stroke:var(--wcm-color-overlay)}`;var $T=Object.defineProperty,LT=Object.getOwnPropertyDescriptor,sc=(r,e,t,i)=>{for(var n=i>1?void 0:i?LT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&$T(e,t,n),n};let Cs=class extends Ct{constructor(){super(...arguments),this.uri="",this.size=0,this.imageId=void 0,this.walletId=void 0,this.imageUrl=void 0}svgTemplate(){const e=eo.state.themeMode==="light"?this.size:this.size-18*2;return gr`<svg height="${e}" width="${e}">${TT.generate(this.uri,e,e/4)}</svg>`}render(){const r={"wcm-dark":eo.state.themeMode==="dark"};return Ae`<div style="${`width: ${this.size}px`}" class="${Is(r)}">${this.walletId||this.imageUrl?Ae`<wcm-wallet-image walletId="${li(this.walletId)}" imageId="${li(this.imageId)}" imageUrl="${li(this.imageUrl)}"></wcm-wallet-image>`:Kt.WALLET_CONNECT_ICON_COLORED} ${this.svgTemplate()}</div>`}};Cs.styles=[Lt.globalCss,NT],sc([Et()],Cs.prototype,"uri",2),sc([Et({type:Number})],Cs.prototype,"size",2),sc([Et()],Cs.prototype,"imageId",2),sc([Et()],Cs.prototype,"walletId",2),sc([Et()],Cs.prototype,"imageUrl",2),Cs=sc([Ft("wcm-qrcode")],Cs);const BT=jt`:host{position:relative;height:28px;width:80%}input{width:100%;height:100%;line-height:28px!important;border-radius:var(--wcm-input-border-radius);font-style:normal;font-family:-apple-system,system-ui,BlinkMacSystemFont,'Segoe UI',Roboto,Ubuntu,'Helvetica Neue',sans-serif;font-feature-settings:'case' on;font-weight:500;font-size:16px;letter-spacing:-.03em;padding:0 10px 0 34px;transition:.2s all ease;color:var(--wcm-color-fg-1);background-color:var(--wcm-color-bg-3);box-shadow:inset 0 0 0 1px var(--wcm-color-overlay);caret-color:var(--wcm-accent-color)}input::placeholder{color:var(--wcm-color-fg-2)}svg{left:10px;top:4px;pointer-events:none;position:absolute;width:20px;height:20px}input:focus-within{box-shadow:inset 0 0 0 1px var(--wcm-accent-color)}path{fill:var(--wcm-color-fg-2)}`;var UT=Object.defineProperty,FT=Object.getOwnPropertyDescriptor,Ow=(r,e,t,i)=>{for(var n=i>1?void 0:i?FT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&UT(e,t,n),n};let Lh=class extends Ct{constructor(){super(...arguments),this.onChange=()=>null}render(){return Ae`<input type="text" @input="${this.onChange}" placeholder="Search wallets"> ${Kt.SEARCH_ICON}`}};Lh.styles=[Lt.globalCss,BT],Ow([Et()],Lh.prototype,"onChange",2),Lh=Ow([Ft("wcm-search-input")],Lh);const qT=jt`@keyframes rotate{100%{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}100%{stroke-dasharray:90,150;stroke-dashoffset:-124}}svg{animation:rotate 2s linear infinite;display:flex;justify-content:center;align-items:center}svg circle{stroke-linecap:round;animation:dash 1.5s ease infinite;stroke:var(--wcm-accent-color)}`;var zT=Object.defineProperty,kT=Object.getOwnPropertyDescriptor,HT=(r,e,t,i)=>{for(var n=i>1?void 0:i?kT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&zT(e,t,n),n};let Op=class extends Ct{render(){return Ae`<svg viewBox="0 0 50 50" width="24" height="24"><circle cx="25" cy="25" r="20" fill="none" stroke-width="4" stroke="#fff"/></svg>`}};Op.styles=[Lt.globalCss,qT],Op=HT([Ft("wcm-spinner")],Op);const jT=jt`span{font-style:normal;font-family:var(--wcm-font-family);font-feature-settings:var(--wcm-font-feature-settings)}.wcm-xsmall-bold{font-family:var(--wcm-text-xsmall-bold-font-family);font-weight:var(--wcm-text-xsmall-bold-weight);font-size:var(--wcm-text-xsmall-bold-size);line-height:var(--wcm-text-xsmall-bold-line-height);letter-spacing:var(--wcm-text-xsmall-bold-letter-spacing);text-transform:var(--wcm-text-xsmall-bold-text-transform)}.wcm-xsmall-regular{font-family:var(--wcm-text-xsmall-regular-font-family);font-weight:var(--wcm-text-xsmall-regular-weight);font-size:var(--wcm-text-xsmall-regular-size);line-height:var(--wcm-text-xsmall-regular-line-height);letter-spacing:var(--wcm-text-xsmall-regular-letter-spacing);text-transform:var(--wcm-text-xsmall-regular-text-transform)}.wcm-small-thin{font-family:var(--wcm-text-small-thin-font-family);font-weight:var(--wcm-text-small-thin-weight);font-size:var(--wcm-text-small-thin-size);line-height:var(--wcm-text-small-thin-line-height);letter-spacing:var(--wcm-text-small-thin-letter-spacing);text-transform:var(--wcm-text-small-thin-text-transform)}.wcm-small-regular{font-family:var(--wcm-text-small-regular-font-family);font-weight:var(--wcm-text-small-regular-weight);font-size:var(--wcm-text-small-regular-size);line-height:var(--wcm-text-small-regular-line-height);letter-spacing:var(--wcm-text-small-regular-letter-spacing);text-transform:var(--wcm-text-small-regular-text-transform)}.wcm-medium-regular{font-family:var(--wcm-text-medium-regular-font-family);font-weight:var(--wcm-text-medium-regular-weight);font-size:var(--wcm-text-medium-regular-size);line-height:var(--wcm-text-medium-regular-line-height);letter-spacing:var(--wcm-text-medium-regular-letter-spacing);text-transform:var(--wcm-text-medium-regular-text-transform)}.wcm-big-bold{font-family:var(--wcm-text-big-bold-font-family);font-weight:var(--wcm-text-big-bold-weight);font-size:var(--wcm-text-big-bold-size);line-height:var(--wcm-text-big-bold-line-height);letter-spacing:var(--wcm-text-big-bold-letter-spacing);text-transform:var(--wcm-text-big-bold-text-transform)}:host(*){color:var(--wcm-color-fg-1)}.wcm-color-primary{color:var(--wcm-color-fg-1)}.wcm-color-secondary{color:var(--wcm-color-fg-2)}.wcm-color-tertiary{color:var(--wcm-color-fg-3)}.wcm-color-inverse{color:var(--wcm-accent-fill-color)}.wcm-color-accnt{color:var(--wcm-accent-color)}.wcm-color-error{color:var(--wcm-error-color)}`;var WT=Object.defineProperty,KT=Object.getOwnPropertyDescriptor,Rp=(r,e,t,i)=>{for(var n=i>1?void 0:i?KT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&WT(e,t,n),n};let Of=class extends Ct{constructor(){super(...arguments),this.variant="medium-regular",this.color="primary"}render(){const r={"wcm-big-bold":this.variant==="big-bold","wcm-medium-regular":this.variant==="medium-regular","wcm-small-regular":this.variant==="small-regular","wcm-small-thin":this.variant==="small-thin","wcm-xsmall-regular":this.variant==="xsmall-regular","wcm-xsmall-bold":this.variant==="xsmall-bold","wcm-color-primary":this.color==="primary","wcm-color-secondary":this.color==="secondary","wcm-color-tertiary":this.color==="tertiary","wcm-color-inverse":this.color==="inverse","wcm-color-accnt":this.color==="accent","wcm-color-error":this.color==="error"};return Ae`<span><slot class="${Is(r)}"></slot></span>`}};Of.styles=[Lt.globalCss,jT],Rp([Et()],Of.prototype,"variant",2),Rp([Et()],Of.prototype,"color",2),Of=Rp([Ft("wcm-text")],Of);const VT=jt`button{width:100%;height:100%;border-radius:var(--wcm-button-hover-highlight-border-radius);display:flex;align-items:flex-start}button:active{background-color:var(--wcm-color-overlay)}@media(hover:hover){button:hover{background-color:var(--wcm-color-overlay)}}button>div{width:80px;padding:5px 0;display:flex;flex-direction:column;align-items:center}wcm-text{width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:center}wcm-wallet-image{height:60px;width:60px;transition:all .2s ease;border-radius:var(--wcm-wallet-icon-border-radius);margin-bottom:5px}.wcm-sublabel{margin-top:2px}`;var GT=Object.defineProperty,JT=Object.getOwnPropertyDescriptor,ao=(r,e,t,i)=>{for(var n=i>1?void 0:i?JT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&>(e,t,n),n};let as=class extends Ct{constructor(){super(...arguments),this.onClick=()=>null,this.name="",this.walletId="",this.label=void 0,this.imageId=void 0,this.installed=!1,this.recent=!1}sublabelTemplate(){return this.recent?Ae`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">RECENT</wcm-text>`:this.installed?Ae`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">INSTALLED</wcm-text>`:null}handleClick(){g3.click({name:"WALLET_BUTTON",walletId:this.walletId}),this.onClick()}render(){var r;return Ae`<button @click="${this.handleClick.bind(this)}"><div><wcm-wallet-image walletId="${this.walletId}" imageId="${li(this.imageId)}"></wcm-wallet-image><wcm-text variant="xsmall-regular">${(r=this.label)!=null?r:pt.getWalletName(this.name,!0)}</wcm-text>${this.sublabelTemplate()}</div></button>`}};as.styles=[Lt.globalCss,VT],ao([Et()],as.prototype,"onClick",2),ao([Et()],as.prototype,"name",2),ao([Et()],as.prototype,"walletId",2),ao([Et()],as.prototype,"label",2),ao([Et()],as.prototype,"imageId",2),ao([Et({type:Boolean})],as.prototype,"installed",2),ao([Et({type:Boolean})],as.prototype,"recent",2),as=ao([Ft("wcm-wallet-button")],as);const YT=jt`:host{display:block}div{overflow:hidden;position:relative;border-radius:inherit;width:100%;height:100%;background-color:var(--wcm-color-overlay)}svg{position:relative;width:100%;height:100%}div::after{content:'';position:absolute;top:0;bottom:0;left:0;right:0;border-radius:inherit;border:1px solid var(--wcm-color-overlay)}div img{width:100%;height:100%;object-fit:cover;object-position:center}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var QT=Object.defineProperty,ZT=Object.getOwnPropertyDescriptor,Bh=(r,e,t,i)=>{for(var n=i>1?void 0:i?ZT(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&QT(e,t,n),n};let oc=class extends Ct{constructor(){super(...arguments),this.walletId="",this.imageId=void 0,this.imageUrl=void 0}render(){var r;const e=(r=this.imageUrl)!=null&&r.length?this.imageUrl:pt.getWalletIcon({id:this.walletId,image_id:this.imageId});return Ae`${e.length?Ae`<div><img crossorigin="anonymous" src="${e}" alt="${this.id}"></div>`:Kt.WALLET_PLACEHOLDER}`}};oc.styles=[Lt.globalCss,YT],Bh([Et()],oc.prototype,"walletId",2),Bh([Et()],oc.prototype,"imageId",2),Bh([Et()],oc.prototype,"imageUrl",2),oc=Bh([Ft("wcm-wallet-image")],oc);var XT=Object.defineProperty,eN=Object.getOwnPropertyDescriptor,Rw=(r,e,t,i)=>{for(var n=i>1?void 0:i?eN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&XT(e,t,n),n};let Tp=class extends Ct{constructor(){super(),this.preload=!0,this.preloadData()}async loadImages(r){try{r?.length&&await Promise.all(r.map(async e=>pt.preloadImage(e)))}catch{console.info("Unsuccessful attempt at preloading some images",r)}}async preloadListings(){if(qi.state.enableExplorer){await _i.getRecomendedWallets(),yr.setIsDataLoaded(!0);const{recomendedWallets:r}=_i.state,e=r.map(t=>pt.getWalletIcon(t));await this.loadImages(e)}else yr.setIsDataLoaded(!0)}async preloadCustomImages(){const r=pt.getCustomImageUrls();await this.loadImages(r)}async preloadData(){try{this.preload&&(this.preload=!1,await Promise.all([this.preloadListings(),this.preloadCustomImages()]))}catch(r){console.error(r),to.openToast("Failed preloading","error")}}};Rw([xi()],Tp.prototype,"preload",2),Tp=Rw([Ft("wcm-explorer-context")],Tp);var tN=Object.defineProperty,rN=Object.getOwnPropertyDescriptor,iN=(r,e,t,i)=>{for(var n=i>1?void 0:i?rN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&tN(e,t,n),n};let Tw=class extends Ct{constructor(){super(),this.unsubscribeTheme=void 0,Lt.setTheme(),this.unsubscribeTheme=eo.subscribe(Lt.setTheme)}disconnectedCallback(){var r;(r=this.unsubscribeTheme)==null||r.call(this)}};Tw=iN([Ft("wcm-theme-context")],Tw);const nN=jt`@keyframes scroll{0%{transform:translate3d(0,0,0)}100%{transform:translate3d(calc(-70px * 9),0,0)}}.wcm-slider{position:relative;overflow-x:hidden;padding:10px 0;margin:0 -20px;width:calc(100% + 40px)}.wcm-track{display:flex;width:calc(70px * 18);animation:scroll 20s linear infinite;opacity:.7}.wcm-track svg{margin:0 5px}wcm-wallet-image{width:60px;height:60px;margin:0 5px;border-radius:var(--wcm-wallet-icon-border-radius)}.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between}.wcm-title{display:flex;align-items:center;margin-bottom:10px}.wcm-title svg{margin-right:6px}.wcm-title path{fill:var(--wcm-accent-color)}wcm-modal-footer .wcm-title{padding:0 10px}wcm-button-big{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%);filter:drop-shadow(0 0 17px var(--wcm-color-bg-1))}wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-info-footer wcm-text{text-align:center;margin-bottom:15px}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var sN=Object.defineProperty,oN=Object.getOwnPropertyDescriptor,aN=(r,e,t,i)=>{for(var n=i>1?void 0:i?oN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&sN(e,t,n),n};let Np=class extends Ct{onGoToQrcode(){lr.push("Qrcode")}render(){const{recomendedWallets:r}=_i.state,e=[...r,...r],t=je.RECOMMENDED_WALLET_AMOUNT*2;return Ae`<wcm-modal-header title="Connect your wallet" .onAction="${this.onGoToQrcode}" .actionIcon="${Kt.QRCODE_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-title">${Kt.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">WalletConnect</wcm-text></div><div class="wcm-slider"><div class="wcm-track">${[...Array(t)].map((i,n)=>{const s=e[n%e.length];return s?Ae`<wcm-wallet-image walletId="${s.id}" imageId="${s.image_id}"></wcm-wallet-image>`:Kt.WALLET_PLACEHOLDER})}</div><wcm-button-big @click="${pt.handleAndroidLinking}"><wcm-text variant="medium-regular" color="inverse">Select Wallet</wcm-text></wcm-button-big></div></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">Choose WalletConnect to see supported apps on your device</wcm-text></wcm-info-footer>`}};Np.styles=[Lt.globalCss,nN],Np=aN([Ft("wcm-android-wallet-selection")],Np);const cN=jt`@keyframes loading{to{stroke-dashoffset:0}}@keyframes shake{10%,90%{transform:translate3d(-1px,0,0)}20%,80%{transform:translate3d(1px,0,0)}30%,50%,70%{transform:translate3d(-2px,0,0)}40%,60%{transform:translate3d(2px,0,0)}}:host{display:flex;flex-direction:column;align-items:center}div{position:relative;width:110px;height:110px;display:flex;justify-content:center;align-items:center;margin:40px 0 20px 0;transform:translate3d(0,0,0)}svg{position:absolute;width:110px;height:110px;fill:none;stroke:transparent;stroke-linecap:round;stroke-width:2px;top:0;left:0}use{stroke:var(--wcm-accent-color);animation:loading 1s linear infinite}wcm-wallet-image{border-radius:var(--wcm-wallet-icon-large-border-radius);width:90px;height:90px}wcm-text{margin-bottom:40px}.wcm-error svg{stroke:var(--wcm-error-color)}.wcm-error use{display:none}.wcm-error{animation:shake .4s cubic-bezier(.36,.07,.19,.97) both}.wcm-stale svg,.wcm-stale use{display:none}`;var fN=Object.defineProperty,lN=Object.getOwnPropertyDescriptor,ac=(r,e,t,i)=>{for(var n=i>1?void 0:i?lN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&fN(e,t,n),n};let co=class extends Ct{constructor(){super(...arguments),this.walletId=void 0,this.imageId=void 0,this.isError=!1,this.isStale=!1,this.label=""}svgLoaderTemplate(){var r,e;const s=(e=(r=eo.state.themeVariables)==null?void 0:r["--wcm-wallet-icon-large-border-radius"])!=null?e:Lt.getPreset("--wcm-wallet-icon-large-border-radius");let a=0;s.includes("%")?a=88/100*parseInt(s,10):a=parseInt(s,10),a*=1.17;const f=317-a*1.57,h=425-a*1.8;return Ae`<svg viewBox="0 0 110 110" width="110" height="110"><rect id="wcm-loader" x="2" y="2" width="106" height="106" rx="${a}"/><use xlink:href="#wcm-loader" stroke-dasharray="106 ${f}" stroke-dashoffset="${h}"></use></svg>`}render(){const r={"wcm-error":this.isError,"wcm-stale":this.isStale};return Ae`<div class="${Is(r)}">${this.svgLoaderTemplate()}<wcm-wallet-image walletId="${li(this.walletId)}" imageId="${li(this.imageId)}"></wcm-wallet-image></div><wcm-text variant="medium-regular" color="${this.isError?"error":"primary"}">${this.isError?"Connection declined":this.label}</wcm-text>`}};co.styles=[Lt.globalCss,cN],ac([Et()],co.prototype,"walletId",2),ac([Et()],co.prototype,"imageId",2),ac([Et({type:Boolean})],co.prototype,"isError",2),ac([Et({type:Boolean})],co.prototype,"isStale",2),ac([Et()],co.prototype,"label",2),co=ac([Ft("wcm-connector-waiting")],co);const cc={manualWallets(){var r,e;const{mobileWallets:t,desktopWallets:i}=qi.state,n=(r=cc.recentWallet())==null?void 0:r.id,s=je.isMobile()?t:i,a=s?.filter(f=>n!==f.id);return(e=je.isMobile()?a?.map(({id:f,name:h,links:u})=>({id:f,name:h,mobile:u,links:u})):a?.map(({id:f,name:h,links:u})=>({id:f,name:h,desktop:u,links:u})))!=null?e:[]},recentWallet(){return pt.getRecentWallet()},recomendedWallets(r=!1){var e;const t=r||(e=cc.recentWallet())==null?void 0:e.id,{recomendedWallets:i}=_i.state;return i.filter(s=>t!==s.id)}},fo={onConnecting(r){pt.goToConnectingView(r)},manualWalletsTemplate(){return cc.manualWallets().map(e=>Ae`<wcm-wallet-button walletId="${e.id}" name="${e.name}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`)},recomendedWalletsTemplate(r=!1){return cc.recomendedWallets(r).map(t=>Ae`<wcm-wallet-button name="${t.name}" walletId="${t.id}" imageId="${t.image_id}" .onClick="${()=>this.onConnecting(t)}"></wcm-wallet-button>`)},recentWalletTemplate(){const r=cc.recentWallet();if(r)return Ae`<wcm-wallet-button name="${r.name}" walletId="${r.id}" imageId="${li(r.image_id)}" .recent="${!0}" .onClick="${()=>this.onConnecting(r)}"></wcm-wallet-button>`}},hN=jt`.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between}.wcm-desktop-title,.wcm-mobile-title{display:flex;align-items:center}.wcm-mobile-title{justify-content:space-between;margin-bottom:20px;margin-top:-10px}.wcm-desktop-title{margin-bottom:10px;padding:0 10px}.wcm-subtitle{display:flex;align-items:center}.wcm-subtitle:last-child path{fill:var(--wcm-color-fg-3)}.wcm-desktop-title svg,.wcm-mobile-title svg{margin-right:6px}.wcm-desktop-title path,.wcm-mobile-title path{fill:var(--wcm-accent-color)}`;var uN=Object.defineProperty,dN=Object.getOwnPropertyDescriptor,pN=(r,e,t,i)=>{for(var n=i>1?void 0:i?dN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&uN(e,t,n),n};let $p=class extends Ct{render(){const{explorerExcludedWalletIds:r,enableExplorer:e}=qi.state,t=r!=="ALL"&&e,i=fo.manualWalletsTemplate(),n=fo.recomendedWalletsTemplate();let a=[fo.recentWalletTemplate(),...i,...n];a=a.filter(Boolean);const f=a.length>4||t;let h=[];f?h=a.slice(0,3):h=a;const u=!!h.length;return Ae`<wcm-modal-header .border="${!0}" title="Connect your wallet" .onAction="${pt.handleUriCopy}" .actionIcon="${Kt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-mobile-title"><div class="wcm-subtitle">${Kt.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">Mobile</wcm-text></div><div class="wcm-subtitle">${Kt.SCAN_ICON}<wcm-text variant="small-regular" color="secondary">Scan with your wallet</wcm-text></div></div><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>${u?Ae`<wcm-modal-footer><div class="wcm-desktop-title">${Kt.DESKTOP_ICON}<wcm-text variant="small-regular" color="accent">Desktop</wcm-text></div><div class="wcm-grid">${h} ${f?Ae`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-footer>`:null}`}};$p.styles=[Lt.globalCss,hN],$p=pN([Ft("wcm-desktop-wallet-selection")],$p);const gN=jt`div{background-color:var(--wcm-color-bg-2);padding:10px 20px 15px 20px;border-top:1px solid var(--wcm-color-bg-3);text-align:center}a{color:var(--wcm-accent-color);text-decoration:none;transition:opacity .2s ease-in-out;display:inline}a:active{opacity:.8}@media(hover:hover){a:hover{opacity:.8}}`;var vN=Object.defineProperty,mN=Object.getOwnPropertyDescriptor,bN=(r,e,t,i)=>{for(var n=i>1?void 0:i?mN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&vN(e,t,n),n};let Lp=class extends Ct{render(){const{termsOfServiceUrl:r,privacyPolicyUrl:e}=qi.state;return r??e?Ae`<div><wcm-text variant="small-regular" color="secondary">By connecting your wallet to this app, you agree to the app's ${r?Ae`<a href="${r}" target="_blank" rel="noopener noreferrer">Terms of Service</a>`:null} ${r&&e?"and":null} ${e?Ae`<a href="${e}" target="_blank" rel="noopener noreferrer">Privacy Policy</a>`:null}</wcm-text></div>`:null}};Lp.styles=[Lt.globalCss,gN],Lp=bN([Ft("wcm-legal-notice")],Lp);const wN=jt`div{display:grid;grid-template-columns:repeat(4,80px);margin:0 -10px;justify-content:space-between;row-gap:10px}`;var yN=Object.defineProperty,_N=Object.getOwnPropertyDescriptor,xN=(r,e,t,i)=>{for(var n=i>1?void 0:i?_N(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&yN(e,t,n),n};let Bp=class extends Ct{onQrcode(){lr.push("Qrcode")}render(){const{explorerExcludedWalletIds:r,enableExplorer:e}=qi.state,t=r!=="ALL"&&e,i=fo.manualWalletsTemplate(),n=fo.recomendedWalletsTemplate();let a=[fo.recentWalletTemplate(),...i,...n];a=a.filter(Boolean);const f=a.length>8||t;let h=[];f?h=a.slice(0,7):h=a;const u=!!h.length;return Ae`<wcm-modal-header title="Connect your wallet" .onAction="${this.onQrcode}" .actionIcon="${Kt.QRCODE_ICON}"></wcm-modal-header>${u?Ae`<wcm-modal-content><div>${h} ${f?Ae`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-content>`:null}`}};Bp.styles=[Lt.globalCss,wN],Bp=xN([Ft("wcm-mobile-wallet-selection")],Bp);const EN=jt`:host{all:initial}.wcm-overlay{top:0;bottom:0;left:0;right:0;position:fixed;z-index:var(--wcm-z-index);overflow:hidden;display:flex;justify-content:center;align-items:center;opacity:0;pointer-events:none;background-color:var(--wcm-overlay-background-color);backdrop-filter:var(--wcm-overlay-backdrop-filter)}@media(max-height:720px) and (orientation:landscape){.wcm-overlay{overflow:scroll;align-items:flex-start;padding:20px 0}}.wcm-active{pointer-events:auto}.wcm-container{position:relative;max-width:360px;width:100%;outline:0;border-radius:var(--wcm-background-border-radius) var(--wcm-background-border-radius) var(--wcm-container-border-radius) var(--wcm-container-border-radius);border:1px solid var(--wcm-color-overlay);overflow:hidden}.wcm-card{width:100%;position:relative;border-radius:var(--wcm-container-border-radius);overflow:hidden;box-shadow:0 6px 14px -6px rgba(10,16,31,.12),0 10px 32px -4px rgba(10,16,31,.1),0 0 0 1px var(--wcm-color-overlay);background-color:var(--wcm-color-bg-1);color:var(--wcm-color-fg-1)}@media(max-width:600px){.wcm-container{max-width:440px;border-radius:var(--wcm-background-border-radius) var(--wcm-background-border-radius) 0 0}.wcm-card{border-radius:var(--wcm-container-border-radius) var(--wcm-container-border-radius) 0 0}.wcm-overlay{align-items:flex-end}}@media(max-width:440px){.wcm-container{border:0}}`;var AN=Object.defineProperty,SN=Object.getOwnPropertyDescriptor,Up=(r,e,t,i)=>{for(var n=i>1?void 0:i?SN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&AN(e,t,n),n};let fc=class extends Ct{constructor(){super(),this.open=!1,this.active=!1,this.unsubscribeModal=void 0,this.abortController=void 0,this.unsubscribeModal=Vo.subscribe(r=>{r.open?this.onOpenModalEvent():this.onCloseModalEvent()})}disconnectedCallback(){var r;(r=this.unsubscribeModal)==null||r.call(this)}get overlayEl(){return pt.getShadowRootElement(this,".wcm-overlay")}get containerEl(){return pt.getShadowRootElement(this,".wcm-container")}toggleBodyScroll(r){if(document.querySelector("body"))if(r){const t=document.getElementById("wcm-styles");t?.remove()}else document.head.insertAdjacentHTML("beforeend",'<style id="wcm-styles">html,body{touch-action:none;overflow:hidden;overscroll-behavior:contain;}</style>')}onCloseModal(r){r.target===r.currentTarget&&Vo.close()}onOpenModalEvent(){this.toggleBodyScroll(!1),this.addKeyboardEvents(),this.open=!0,setTimeout(async()=>{const r=pt.isMobileAnimation()?{y:["50vh","0vh"]}:{scale:[.98,1]},e=.1,t=.2;await Promise.all([ea(this.overlayEl,{opacity:[0,1]},{delay:e,duration:t}).finished,ea(this.containerEl,r,{delay:e,duration:t}).finished]),this.active=!0},0)}async onCloseModalEvent(){this.toggleBodyScroll(!0),this.removeKeyboardEvents();const r=pt.isMobileAnimation()?{y:["0vh","50vh"]}:{scale:[1,.98]},e=.2;await Promise.all([ea(this.overlayEl,{opacity:[1,0]},{duration:e}).finished,ea(this.containerEl,r,{duration:e}).finished]),this.containerEl.removeAttribute("style"),this.active=!1,this.open=!1}addKeyboardEvents(){this.abortController=new AbortController,window.addEventListener("keydown",r=>{var e;r.key==="Escape"?Vo.close():r.key==="Tab"&&((e=r.target)!=null&&e.tagName.includes("wcm-")||this.containerEl.focus())},this.abortController),this.containerEl.focus()}removeKeyboardEvents(){var r;(r=this.abortController)==null||r.abort(),this.abortController=void 0}render(){const r={"wcm-overlay":!0,"wcm-active":this.active};return Ae`<wcm-explorer-context></wcm-explorer-context><wcm-theme-context></wcm-theme-context><div id="wcm-modal" class="${Is(r)}" @click="${this.onCloseModal}" role="alertdialog" aria-modal="true"><div class="wcm-container" tabindex="0">${this.open?Ae`<wcm-modal-backcard></wcm-modal-backcard><div class="wcm-card"><wcm-modal-router></wcm-modal-router><wcm-modal-toast></wcm-modal-toast></div>`:null}</div></div>`}};fc.styles=[Lt.globalCss,EN],Up([xi()],fc.prototype,"open",2),Up([xi()],fc.prototype,"active",2),fc=Up([Ft("wcm-modal")],fc);const IN=jt`div{display:flex;margin-top:15px}slot{display:inline-block;margin:0 5px}wcm-button{margin:0 5px}`;var MN=Object.defineProperty,CN=Object.getOwnPropertyDescriptor,Rf=(r,e,t,i)=>{for(var n=i>1?void 0:i?CN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&MN(e,t,n),n};let ra=class extends Ct{constructor(){super(...arguments),this.isMobile=!1,this.isDesktop=!1,this.isWeb=!1,this.isRetry=!1}onMobile(){je.isMobile()?lr.replace("MobileConnecting"):lr.replace("MobileQrcodeConnecting")}onDesktop(){lr.replace("DesktopConnecting")}onWeb(){lr.replace("WebConnecting")}render(){return Ae`<div>${this.isRetry?Ae`<slot></slot>`:null} ${this.isMobile?Ae`<wcm-button .onClick="${this.onMobile}" .iconLeft="${Kt.MOBILE_ICON}" variant="outline">Mobile</wcm-button>`:null} ${this.isDesktop?Ae`<wcm-button .onClick="${this.onDesktop}" .iconLeft="${Kt.DESKTOP_ICON}" variant="outline">Desktop</wcm-button>`:null} ${this.isWeb?Ae`<wcm-button .onClick="${this.onWeb}" .iconLeft="${Kt.GLOBE_ICON}" variant="outline">Web</wcm-button>`:null}</div>`}};ra.styles=[Lt.globalCss,IN],Rf([Et({type:Boolean})],ra.prototype,"isMobile",2),Rf([Et({type:Boolean})],ra.prototype,"isDesktop",2),Rf([Et({type:Boolean})],ra.prototype,"isWeb",2),Rf([Et({type:Boolean})],ra.prototype,"isRetry",2),ra=Rf([Ft("wcm-platform-selection")],ra);const PN=jt`button{display:flex;flex-direction:column;padding:5px 10px;border-radius:var(--wcm-button-hover-highlight-border-radius);height:100%;justify-content:flex-start}.wcm-icons{width:60px;height:60px;display:flex;flex-wrap:wrap;padding:7px;border-radius:var(--wcm-wallet-icon-border-radius);justify-content:space-between;align-items:center;margin-bottom:5px;background-color:var(--wcm-color-bg-2);box-shadow:inset 0 0 0 1px var(--wcm-color-overlay)}button:active{background-color:var(--wcm-color-overlay)}@media(hover:hover){button:hover{background-color:var(--wcm-color-overlay)}}.wcm-icons img{width:21px;height:21px;object-fit:cover;object-position:center;border-radius:calc(var(--wcm-wallet-icon-border-radius)/ 2);border:1px solid var(--wcm-color-overlay)}.wcm-icons svg{width:21px;height:21px}.wcm-icons img:nth-child(1),.wcm-icons img:nth-child(2),.wcm-icons svg:nth-child(1),.wcm-icons svg:nth-child(2){margin-bottom:4px}wcm-text{width:100%;text-align:center}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var DN=Object.defineProperty,ON=Object.getOwnPropertyDescriptor,RN=(r,e,t,i)=>{for(var n=i>1?void 0:i?ON(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&DN(e,t,n),n};let Fp=class extends Ct{onClick(){lr.push("WalletExplorer")}render(){const{recomendedWallets:r}=_i.state,e=cc.manualWallets(),t=[...r,...e].reverse().slice(0,4);return Ae`<button @click="${this.onClick}"><div class="wcm-icons">${t.map(i=>{const n=pt.getWalletIcon(i);if(n)return Ae`<img crossorigin="anonymous" src="${n}">`;const s=pt.getWalletIcon({id:i.id});return s?Ae`<img crossorigin="anonymous" src="${s}">`:Kt.WALLET_PLACEHOLDER})} ${[...Array(4-t.length)].map(()=>Kt.WALLET_PLACEHOLDER)}</div><wcm-text variant="xsmall-regular">View All</wcm-text></button>`}};Fp.styles=[Lt.globalCss,PN],Fp=RN([Ft("wcm-view-all-wallets-button")],Fp);const TN=jt`.wcm-qr-container{width:100%;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1}`;var NN=Object.defineProperty,$N=Object.getOwnPropertyDescriptor,Uh=(r,e,t,i)=>{for(var n=i>1?void 0:i?$N(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&NN(e,t,n),n};let lc=class extends Ct{constructor(){super(),this.walletId="",this.imageId="",this.uri="",setTimeout(()=>{const{walletConnectUri:r}=yr.state;this.uri=r},0)}get overlayEl(){return pt.getShadowRootElement(this,".wcm-qr-container")}render(){return Ae`<div class="wcm-qr-container">${this.uri?Ae`<wcm-qrcode size="${this.overlayEl.offsetWidth}" uri="${this.uri}" walletId="${li(this.walletId)}" imageId="${li(this.imageId)}"></wcm-qrcode>`:Ae`<wcm-spinner></wcm-spinner>`}</div>`}};lc.styles=[Lt.globalCss,TN],Uh([Et()],lc.prototype,"walletId",2),Uh([Et()],lc.prototype,"imageId",2),Uh([xi()],lc.prototype,"uri",2),lc=Uh([Ft("wcm-walletconnect-qr")],lc);var LN=Object.defineProperty,BN=Object.getOwnPropertyDescriptor,UN=(r,e,t,i)=>{for(var n=i>1?void 0:i?BN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&LN(e,t,n),n};let qp=class extends Ct{viewTemplate(){return je.isAndroid()&&!je.isTelegram()?Ae`<wcm-android-wallet-selection></wcm-android-wallet-selection>`:je.isMobile()?Ae`<wcm-mobile-wallet-selection></wcm-mobile-wallet-selection>`:Ae`<wcm-desktop-wallet-selection></wcm-desktop-wallet-selection>`}render(){return Ae`${this.viewTemplate()}<wcm-legal-notice></wcm-legal-notice>`}};qp.styles=[Lt.globalCss],qp=UN([Ft("wcm-connect-wallet-view")],qp);const FN=jt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var qN=Object.defineProperty,zN=Object.getOwnPropertyDescriptor,Nw=(r,e,t,i)=>{for(var n=i>1?void 0:i?zN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&qN(e,t,n),n};let Fh=class extends Ct{constructor(){super(),this.isError=!1,this.openDesktopApp()}onFormatAndRedirect(r){const{desktop:e,name:t}=je.getWalletRouterData(),i=e?.native,n=e?.universal;if(i){const s=je.formatNativeUrl(i,r,t);je.openHref(s,"_self")}else if(n){const s=je.formatUniversalUrl(n,r,t);je.openHref(s,"_blank")}}openDesktopApp(){const{walletConnectUri:r}=yr.state,e=je.getWalletRouterData();pt.setRecentWallet(e),r&&this.onFormatAndRedirect(r)}render(){const{name:r,id:e,image_id:t}=je.getWalletRouterData(),{isMobile:i,isWeb:n}=pt.getCachedRouterWalletPlatforms();return Ae`<wcm-modal-header title="${r}" .onAction="${pt.handleUriCopy}" .actionIcon="${Kt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${li(t)}" label="${`Continue in ${r}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Connection can continue loading if ${r} is not installed on your device`}</wcm-text><wcm-platform-selection .isMobile="${i}" .isWeb="${n}" .isRetry="${!0}"><wcm-button .onClick="${this.openDesktopApp.bind(this)}" .iconRight="${Kt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};Fh.styles=[Lt.globalCss,FN],Nw([xi()],Fh.prototype,"isError",2),Fh=Nw([Ft("wcm-desktop-connecting-view")],Fh);const kN=jt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}wcm-button{margin-top:15px}`;var HN=Object.defineProperty,jN=Object.getOwnPropertyDescriptor,WN=(r,e,t,i)=>{for(var n=i>1?void 0:i?jN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&HN(e,t,n),n};let zp=class extends Ct{onInstall(r){r&&je.openHref(r,"_blank")}render(){const{name:r,id:e,image_id:t,homepage:i}=je.getWalletRouterData();return Ae`<wcm-modal-header title="${r}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${li(t)}" label="Not Detected" .isStale="${!0}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Download ${r} to continue. If multiple browser extensions are installed, disable non ${r} ones and try again`}</wcm-text><wcm-button .onClick="${()=>this.onInstall(i)}" .iconLeft="${Kt.ARROW_DOWN_ICON}">Download</wcm-button></wcm-info-footer>`}};zp.styles=[Lt.globalCss,kN],zp=WN([Ft("wcm-install-wallet-view")],zp);const KN=jt`wcm-wallet-image{border-radius:var(--wcm-wallet-icon-large-border-radius);width:96px;height:96px;margin-bottom:20px}wcm-info-footer{display:flex;width:100%}.wcm-app-store{justify-content:space-between}.wcm-app-store wcm-wallet-image{margin-right:10px;margin-bottom:0;width:28px;height:28px;border-radius:var(--wcm-wallet-icon-small-border-radius)}.wcm-app-store div{display:flex;align-items:center}.wcm-app-store wcm-button{margin-right:-10px}.wcm-note{flex-direction:column;align-items:center;padding:5px 0}.wcm-note wcm-text{text-align:center}wcm-platform-selection{margin-top:-15px}.wcm-note wcm-text{margin-top:15px}.wcm-note wcm-text span{color:var(--wcm-accent-color)}`;var VN=Object.defineProperty,GN=Object.getOwnPropertyDescriptor,$w=(r,e,t,i)=>{for(var n=i>1?void 0:i?GN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&VN(e,t,n),n};let qh=class extends Ct{constructor(){super(),this.isError=!1,this.openMobileApp()}onFormatAndRedirect(r,e=!1){const{mobile:t,name:i}=je.getWalletRouterData(),n=t?.native,s=t?.universal,a=je.isTelegram()?"_blank":"_self";if(r=je.isTelegram()&&je.isAndroid()?encodeURIComponent(r):r,n&&!e){const f=je.formatNativeUrl(n,r,i);je.openHref(f,a)}else if(s){const f=je.formatUniversalUrl(s,r,i);je.openHref(f,a)}}openMobileApp(r=!1){const{walletConnectUri:e}=yr.state,t=je.getWalletRouterData();e&&this.onFormatAndRedirect(e,r),pt.setRecentWallet(t)}onGoToAppStore(r){r&&je.openHref(r,"_blank")}render(){const{name:r,id:e,image_id:t,app:i,mobile:n}=je.getWalletRouterData(),{isWeb:s}=pt.getCachedRouterWalletPlatforms(),a=i?.ios,f=n?.universal;return Ae`<wcm-modal-header title="${r}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${li(t)}" label="Tap 'Open' to continue…" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer class="wcm-note"><wcm-platform-selection .isWeb="${s}" .isRetry="${!0}"><wcm-button .onClick="${()=>this.openMobileApp(!1)}" .iconRight="${Kt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection>${f?Ae`<wcm-text color="secondary" variant="small-thin">Still doesn't work? <span tabindex="0" @click="${()=>this.openMobileApp(!0)}">Try this alternate link</span></wcm-text>`:null}</wcm-info-footer><wcm-info-footer class="wcm-app-store"><div><wcm-wallet-image walletId="${e}" imageId="${li(t)}"></wcm-wallet-image><wcm-text>${`Get ${r}`}</wcm-text></div><wcm-button .iconRight="${Kt.ARROW_RIGHT_ICON}" .onClick="${()=>this.onGoToAppStore(a)}" variant="ghost">App Store</wcm-button></wcm-info-footer>`}};qh.styles=[Lt.globalCss,KN],$w([xi()],qh.prototype,"isError",2),qh=$w([Ft("wcm-mobile-connecting-view")],qh);const JN=jt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var YN=Object.defineProperty,QN=Object.getOwnPropertyDescriptor,ZN=(r,e,t,i)=>{for(var n=i>1?void 0:i?QN(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&YN(e,t,n),n};let kp=class extends Ct{render(){const{name:r,id:e,image_id:t}=je.getWalletRouterData(),{isDesktop:i,isWeb:n}=pt.getCachedRouterWalletPlatforms();return Ae`<wcm-modal-header title="${r}" .onAction="${pt.handleUriCopy}" .actionIcon="${Kt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr walletId="${e}" imageId="${li(t)}"></wcm-walletconnect-qr></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Scan this QR Code with your phone's camera or inside ${r} app`}</wcm-text><wcm-platform-selection .isDesktop="${i}" .isWeb="${n}"></wcm-platform-selection></wcm-info-footer>`}};kp.styles=[Lt.globalCss,JN],kp=ZN([Ft("wcm-mobile-qr-connecting-view")],kp);var XN=Object.defineProperty,e$=Object.getOwnPropertyDescriptor,t$=(r,e,t,i)=>{for(var n=i>1?void 0:i?e$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&XN(e,t,n),n};let Hp=class extends Ct{render(){return Ae`<wcm-modal-header title="Scan the code" .onAction="${pt.handleUriCopy}" .actionIcon="${Kt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>`}};Hp.styles=[Lt.globalCss],Hp=t$([Ft("wcm-qrcode-view")],Hp);const r$=jt`wcm-modal-content{height:clamp(200px,60vh,600px);display:block;overflow:scroll;scrollbar-width:none;position:relative;margin-top:1px}.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between;margin:-15px -10px;padding-top:20px}wcm-modal-content::after,wcm-modal-content::before{content:'';position:fixed;pointer-events:none;z-index:1;width:100%;height:20px;opacity:1}wcm-modal-content::before{box-shadow:0 -1px 0 0 var(--wcm-color-bg-1);background:linear-gradient(var(--wcm-color-bg-1),rgba(255,255,255,0))}wcm-modal-content::after{box-shadow:0 1px 0 0 var(--wcm-color-bg-1);background:linear-gradient(rgba(255,255,255,0),var(--wcm-color-bg-1));top:calc(100% - 20px)}wcm-modal-content::-webkit-scrollbar{display:none}.wcm-placeholder-block{display:flex;justify-content:center;align-items:center;height:100px;overflow:hidden}.wcm-empty,.wcm-loading{display:flex}.wcm-loading .wcm-placeholder-block{height:100%}.wcm-end-reached .wcm-placeholder-block{height:0;opacity:0}.wcm-empty .wcm-placeholder-block{opacity:1;height:100%}wcm-wallet-button{margin:calc((100% - 60px)/ 3) 0}`;var i$=Object.defineProperty,n$=Object.getOwnPropertyDescriptor,Tf=(r,e,t,i)=>{for(var n=i>1?void 0:i?n$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&i$(e,t,n),n};const jp=40;let ia=class extends Ct{constructor(){super(...arguments),this.loading=!_i.state.wallets.listings.length,this.firstFetch=!_i.state.wallets.listings.length,this.search="",this.endReached=!1,this.intersectionObserver=void 0,this.searchDebounce=pt.debounce(r=>{r.length>=1?(this.firstFetch=!0,this.endReached=!1,this.search=r,_i.resetSearch(),this.fetchWallets()):this.search&&(this.search="",this.endReached=this.isLastPage(),_i.resetSearch())})}firstUpdated(){this.createPaginationObserver()}disconnectedCallback(){var r;(r=this.intersectionObserver)==null||r.disconnect()}get placeholderEl(){return pt.getShadowRootElement(this,".wcm-placeholder-block")}createPaginationObserver(){this.intersectionObserver=new IntersectionObserver(([r])=>{r.isIntersecting&&!(this.search&&this.firstFetch)&&this.fetchWallets()}),this.intersectionObserver.observe(this.placeholderEl)}isLastPage(){const{wallets:r,search:e}=_i.state,{listings:t,total:i}=this.search?e:r;return i<=jp||t.length>=i}async fetchWallets(){var r;const{wallets:e,search:t}=_i.state,{listings:i,total:n,page:s}=this.search?t:e;if(!this.endReached&&(this.firstFetch||n>jp&&i.length<n))try{this.loading=!0;const a=(r=yr.state.chains)==null?void 0:r.join(","),{listings:f}=await _i.getWallets({page:this.firstFetch?1:s+1,entries:jp,search:this.search,version:2,chains:a}),h=f.map(u=>pt.getWalletIcon(u));await Promise.all([...h.map(async u=>pt.preloadImage(u)),je.wait(300)]),this.endReached=this.isLastPage()}catch(a){console.error(a),to.openToast(pt.getErrorMessage(a),"error")}finally{this.loading=!1,this.firstFetch=!1}}onConnect(r){je.isAndroid()?pt.handleMobileLinking(r):pt.goToConnectingView(r)}onSearchChange(r){const{value:e}=r.target;this.searchDebounce(e)}render(){const{wallets:r,search:e}=_i.state,{listings:t}=this.search?e:r,i=this.loading&&!t.length,n=this.search.length>=3;let s=fo.manualWalletsTemplate(),a=fo.recomendedWalletsTemplate(!0);n&&(s=s.filter(({values:u})=>pt.caseSafeIncludes(u[0],this.search)),a=a.filter(({values:u})=>pt.caseSafeIncludes(u[0],this.search)));const f=!this.loading&&!t.length&&!a.length,h={"wcm-loading":i,"wcm-end-reached":this.endReached||!this.loading,"wcm-empty":f};return Ae`<wcm-modal-header><wcm-search-input .onChange="${this.onSearchChange.bind(this)}"></wcm-search-input></wcm-modal-header><wcm-modal-content class="${Is(h)}"><div class="wcm-grid">${i?null:s} ${i?null:a} ${i?null:t.map(u=>Ae`${u?Ae`<wcm-wallet-button imageId="${u.image_id}" name="${u.name}" walletId="${u.id}" .onClick="${()=>this.onConnect(u)}"></wcm-wallet-button>`:null}`)}</div><div class="wcm-placeholder-block">${f?Ae`<wcm-text variant="big-bold" color="secondary">No results found</wcm-text>`:null} ${!f&&this.loading?Ae`<wcm-spinner></wcm-spinner>`:null}</div></wcm-modal-content>`}};ia.styles=[Lt.globalCss,r$],Tf([xi()],ia.prototype,"loading",2),Tf([xi()],ia.prototype,"firstFetch",2),Tf([xi()],ia.prototype,"search",2),Tf([xi()],ia.prototype,"endReached",2),ia=Tf([Ft("wcm-wallet-explorer-view")],ia);const s$=jt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var o$=Object.defineProperty,a$=Object.getOwnPropertyDescriptor,Lw=(r,e,t,i)=>{for(var n=i>1?void 0:i?a$(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&o$(e,t,n),n};let zh=class extends Ct{constructor(){super(),this.isError=!1,this.openWebWallet()}onFormatAndRedirect(r){const{desktop:e,name:t}=je.getWalletRouterData(),i=e?.universal;if(i){const n=je.formatUniversalUrl(i,r,t);je.openHref(n,"_blank")}}openWebWallet(){const{walletConnectUri:r}=yr.state,e=je.getWalletRouterData();pt.setRecentWallet(e),r&&this.onFormatAndRedirect(r)}render(){const{name:r,id:e,image_id:t}=je.getWalletRouterData(),{isMobile:i,isDesktop:n}=pt.getCachedRouterWalletPlatforms(),s=je.isMobile();return Ae`<wcm-modal-header title="${r}" .onAction="${pt.handleUriCopy}" .actionIcon="${Kt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${li(t)}" label="${`Continue in ${r}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`${r} web app has opened in a new tab. Go there, accept the connection, and come back`}</wcm-text><wcm-platform-selection .isMobile="${i}" .isDesktop="${s?!1:n}" .isRetry="${!0}"><wcm-button .onClick="${this.openWebWallet.bind(this)}" .iconRight="${Kt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};zh.styles=[Lt.globalCss,s$],Lw([xi()],zh.prototype,"isError",2),zh=Lw([Ft("wcm-web-connecting-view")],zh);var c$=Object.freeze({__proto__:null,get WcmModal(){return fc},get WcmQrCode(){return Cs}});wn.EthereumProvider=OD,wn.OPTIONAL_EVENTS=l3,wn.OPTIONAL_METHODS=f3,wn.REQUIRED_EVENTS=uh,wn.REQUIRED_METHODS=hh,wn.default=gh,Object.defineProperty(wn,"__esModule",{value:!0})});
|
|
123
123
|
//# sourceMappingURL=index.umd.js.map
|