@walletconnect/ethereum-provider 2.16.2-rc-0 → 2.16.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(mn,Vr){typeof exports=="object"&&typeof module<"u"?Vr(exports):typeof define=="function"&&define.amd?define(["exports"],Vr):(mn=typeof globalThis<"u"?globalThis:mn||self,Vr(mn["@walletconnect/ethereum-provider"]={}))})(this,function(mn){"use strict";var Vr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function W5(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function m0(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(r,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}),r}var kr={exports:{}},Oa=typeof Reflect=="object"?Reflect:null,Bg=Oa&&typeof Oa.apply=="function"?Oa.apply:function(e,r,i){return Function.prototype.apply.call(e,r,i)},Sf;Oa&&typeof Oa.ownKeys=="function"?Sf=Oa.ownKeys:Object.getOwnPropertySymbols?Sf=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Sf=function(e){return Object.getOwnPropertyNames(e)};function V5(t){console&&console.warn&&console.warn(t)}var Fg=Number.isNaN||function(e){return e!==e};function Yt(){Yt.init.call(this)}kr.exports=Yt,kr.exports.once=Q5,Yt.EventEmitter=Yt,Yt.prototype._events=void 0,Yt.prototype._eventsCount=0,Yt.prototype._maxListeners=void 0;var Ug=10;function If(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Yt,"defaultMaxListeners",{enumerable:!0,get:function(){return Ug},set:function(t){if(typeof t!="number"||t<0||Fg(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Ug=t}}),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||Fg(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 kg(t){return t._maxListeners===void 0?Yt.defaultMaxListeners:t._maxListeners}Yt.prototype.getMaxListeners=function(){return kg(this)},Yt.prototype.emit=function(e){for(var r=[],i=1;i<arguments.length;i++)r.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(r.length>0&&(a=r[0]),a instanceof Error)throw a;var u=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw u.context=a,u}var h=s[e];if(h===void 0)return!1;if(typeof h=="function")Bg(h,this,r);else for(var l=h.length,b=Kg(h,l),i=0;i<l;++i)Bg(b[i],this,r);return!0};function qg(t,e,r,i){var n,s,a;if(If(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),a=s[e]),a===void 0)a=s[e]=r,++t._eventsCount;else if(typeof a=="function"?a=s[e]=i?[r,a]:[a,r]:i?a.unshift(r):a.push(r),n=kg(t),n>0&&a.length>n&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=a.length,V5(u)}return t}Yt.prototype.addListener=function(e,r){return qg(this,e,r,!1)},Yt.prototype.on=Yt.prototype.addListener,Yt.prototype.prependListener=function(e,r){return qg(this,e,r,!0)};function G5(){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 jg(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=G5.bind(i);return n.listener=r,i.wrapFn=n,n}Yt.prototype.once=function(e,r){return If(r),this.on(e,jg(this,e,r)),this},Yt.prototype.prependOnceListener=function(e,r){return If(r),this.prependListener(e,jg(this,e,r)),this},Yt.prototype.removeListener=function(e,r){var i,n,s,a,u;if(If(r),n=this._events,n===void 0)return this;if(i=n[e],i===void 0)return this;if(i===r||i.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||r));else if(typeof i!="function"){for(s=-1,a=i.length-1;a>=0;a--)if(i[a]===r||i[a].listener===r){u=i[a].listener,s=a;break}if(s<0)return this;s===0?i.shift():J5(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,u||r)}return this},Yt.prototype.off=Yt.prototype.removeListener,Yt.prototype.removeAllListeners=function(e){var r,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(r=i[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(n=r.length-1;n>=0;n--)this.removeListener(e,r[n]);return this};function zg(t,e,r){var i=t._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n=="function"?r?[n.listener||n]:[n]:r?Y5(n):Kg(n,n.length)}Yt.prototype.listeners=function(e){return zg(this,e,!0)},Yt.prototype.rawListeners=function(e){return zg(this,e,!1)},Yt.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Hg.call(t,e)},Yt.prototype.listenerCount=Hg;function Hg(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Yt.prototype.eventNames=function(){return this._eventsCount>0?Sf(this._events):[]};function Kg(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}function J5(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Y5(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Q5(t,e){return new Promise(function(r,i){function n(a){t.removeListener(e,s),i(a)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",n),r([].slice.call(arguments))}Wg(t,e,s,{once:!0}),e!=="error"&&Z5(t,n,{once:!0})})}function Z5(t,e,r){typeof t.on=="function"&&Wg(t,"error",e,r)}function Wg(t,e,r,i){if(typeof t.on=="function")i.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function n(s){i.once&&t.removeEventListener(e,n),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var Vg=function(t,e,r){if(r||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 t.concat(s||Array.prototype.slice.call(e))},X5=function(){function t(e,r,i){this.name=e,this.version=r,this.os=i,this.type="browser"}return t}(),e4=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return t}(),t4=function(){function t(e,r,i,n){this.name=e,this.version=r,this.os=i,this.bot=n,this.type="bot-device"}return t}(),r4=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),i4=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),n4=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,s4=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Gg=3,o4=[["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",n4]],Jg=[["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 a4(t){return t?Yg(t):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new i4:typeof navigator<"u"?Yg(navigator.userAgent):f4()}function c4(t){return t!==""&&o4.reduce(function(e,r){var i=r[0],n=r[1];if(e)return e;var s=n.exec(t);return!!s&&[i,s]},!1)}function Yg(t){var e=c4(t);if(!e)return null;var r=e[0],i=e[1];if(r==="searchbot")return new r4;var n=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);n?n.length<Gg&&(n=Vg(Vg([],n,!0),h4(Gg-n.length),!0)):n=[];var s=n.join("."),a=u4(t),u=s4.exec(t);return u&&u[1]?new t4(r,s,a,u[1]):new X5(r,s,a)}function u4(t){for(var e=0,r=Jg.length;e<r;e++){var i=Jg[e],n=i[0],s=i[1],a=s.exec(t);if(a)return n}return null}function f4(){var t=typeof process<"u"&&process.version;return t?new e4(process.version.slice(1)):null}function h4(t){for(var e=[],r=0;r<t;r++)e.push("0");return e}var xe={};/*! *****************************************************************************
1
+ (function(mn,Vr){typeof exports=="object"&&typeof module<"u"?Vr(exports):typeof define=="function"&&define.amd?define(["exports"],Vr):(mn=typeof globalThis<"u"?globalThis:mn||self,Vr(mn["@walletconnect/ethereum-provider"]={}))})(this,function(mn){"use strict";var Vr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function V5(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function m0(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(r,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}),r}var kr={exports:{}},Oa=typeof Reflect=="object"?Reflect:null,Bg=Oa&&typeof Oa.apply=="function"?Oa.apply:function(e,r,i){return Function.prototype.apply.call(e,r,i)},Sf;Oa&&typeof Oa.ownKeys=="function"?Sf=Oa.ownKeys:Object.getOwnPropertySymbols?Sf=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Sf=function(e){return Object.getOwnPropertyNames(e)};function G5(t){console&&console.warn&&console.warn(t)}var Fg=Number.isNaN||function(e){return e!==e};function Yt(){Yt.init.call(this)}kr.exports=Yt,kr.exports.once=Z5,Yt.EventEmitter=Yt,Yt.prototype._events=void 0,Yt.prototype._eventsCount=0,Yt.prototype._maxListeners=void 0;var Ug=10;function If(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Yt,"defaultMaxListeners",{enumerable:!0,get:function(){return Ug},set:function(t){if(typeof t!="number"||t<0||Fg(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Ug=t}}),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||Fg(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 kg(t){return t._maxListeners===void 0?Yt.defaultMaxListeners:t._maxListeners}Yt.prototype.getMaxListeners=function(){return kg(this)},Yt.prototype.emit=function(e){for(var r=[],i=1;i<arguments.length;i++)r.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(r.length>0&&(a=r[0]),a instanceof Error)throw a;var u=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw u.context=a,u}var h=s[e];if(h===void 0)return!1;if(typeof h=="function")Bg(h,this,r);else for(var l=h.length,b=Kg(h,l),i=0;i<l;++i)Bg(b[i],this,r);return!0};function qg(t,e,r,i){var n,s,a;if(If(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),a=s[e]),a===void 0)a=s[e]=r,++t._eventsCount;else if(typeof a=="function"?a=s[e]=i?[r,a]:[a,r]:i?a.unshift(r):a.push(r),n=kg(t),n>0&&a.length>n&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=a.length,G5(u)}return t}Yt.prototype.addListener=function(e,r){return qg(this,e,r,!1)},Yt.prototype.on=Yt.prototype.addListener,Yt.prototype.prependListener=function(e,r){return qg(this,e,r,!0)};function J5(){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 jg(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=J5.bind(i);return n.listener=r,i.wrapFn=n,n}Yt.prototype.once=function(e,r){return If(r),this.on(e,jg(this,e,r)),this},Yt.prototype.prependOnceListener=function(e,r){return If(r),this.prependListener(e,jg(this,e,r)),this},Yt.prototype.removeListener=function(e,r){var i,n,s,a,u;if(If(r),n=this._events,n===void 0)return this;if(i=n[e],i===void 0)return this;if(i===r||i.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||r));else if(typeof i!="function"){for(s=-1,a=i.length-1;a>=0;a--)if(i[a]===r||i[a].listener===r){u=i[a].listener,s=a;break}if(s<0)return this;s===0?i.shift():Y5(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,u||r)}return this},Yt.prototype.off=Yt.prototype.removeListener,Yt.prototype.removeAllListeners=function(e){var r,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(r=i[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(n=r.length-1;n>=0;n--)this.removeListener(e,r[n]);return this};function zg(t,e,r){var i=t._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n=="function"?r?[n.listener||n]:[n]:r?Q5(n):Kg(n,n.length)}Yt.prototype.listeners=function(e){return zg(this,e,!0)},Yt.prototype.rawListeners=function(e){return zg(this,e,!1)},Yt.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Hg.call(t,e)},Yt.prototype.listenerCount=Hg;function Hg(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Yt.prototype.eventNames=function(){return this._eventsCount>0?Sf(this._events):[]};function Kg(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}function Y5(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Q5(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Z5(t,e){return new Promise(function(r,i){function n(a){t.removeListener(e,s),i(a)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",n),r([].slice.call(arguments))}Wg(t,e,s,{once:!0}),e!=="error"&&X5(t,n,{once:!0})})}function X5(t,e,r){typeof t.on=="function"&&Wg(t,"error",e,r)}function Wg(t,e,r,i){if(typeof t.on=="function")i.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function n(s){i.once&&t.removeEventListener(e,n),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var Vg=function(t,e,r){if(r||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 t.concat(s||Array.prototype.slice.call(e))},e4=function(){function t(e,r,i){this.name=e,this.version=r,this.os=i,this.type="browser"}return t}(),t4=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return t}(),r4=function(){function t(e,r,i,n){this.name=e,this.version=r,this.os=i,this.bot=n,this.type="bot-device"}return t}(),i4=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),n4=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),s4=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,o4=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Gg=3,a4=[["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",s4]],Jg=[["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 c4(t){return t?Yg(t):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new n4:typeof navigator<"u"?Yg(navigator.userAgent):h4()}function u4(t){return t!==""&&a4.reduce(function(e,r){var i=r[0],n=r[1];if(e)return e;var s=n.exec(t);return!!s&&[i,s]},!1)}function Yg(t){var e=u4(t);if(!e)return null;var r=e[0],i=e[1];if(r==="searchbot")return new i4;var n=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);n?n.length<Gg&&(n=Vg(Vg([],n,!0),l4(Gg-n.length),!0)):n=[];var s=n.join("."),a=f4(t),u=o4.exec(t);return u&&u[1]?new r4(r,s,a,u[1]):new e4(r,s,a)}function f4(t){for(var e=0,r=Jg.length;e<r;e++){var i=Jg[e],n=i[0],s=i[1],a=s.exec(t);if(a)return n}return null}function h4(){var t=typeof process<"u"&&process.version;return t?new t4(process.version.slice(1)):null}function l4(t){for(var e=[],r=0;r<t;r++)e.push("0");return e}var xe={};/*! *****************************************************************************
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 b0=function(t,e){return b0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},b0(t,e)};function l4(t,e){b0(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var y0=function(){return y0=Object.assign||function(e){for(var r,i=1,n=arguments.length;i<n;i++){r=arguments[i];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},y0.apply(this,arguments)};function d4(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r}function p4(t,e,r,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,i);else for(var u=t.length-1;u>=0;u--)(a=t[u])&&(s=(n<3?a(s):n>3?a(e,r,s):a(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s}function g4(t,e){return function(r,i){e(r,i,t)}}function v4(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function m4(t,e,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function u(b){try{l(i.next(b))}catch(w){a(w)}}function h(b){try{l(i.throw(b))}catch(w){a(w)}}function l(b){b.done?s(b.value):n(b.value).then(u,h)}l((i=i.apply(t,e||[])).next())})}function b4(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(l){return function(b){return h([l,b])}}function h(l){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,n&&(s=l[0]&2?n.return:l[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,l[1])).done)return s;switch(n=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,n=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){r.label=l[1];break}if(l[0]===6&&r.label<s[1]){r.label=s[1],s=l;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(l);break}s[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(b){l=[6,b],n=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function y4(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}function w4(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function w0(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Qg(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var i=r.call(t),n,s=[],a;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(u){a={error:u}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(a)throw a.error}}return s}function _4(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Qg(arguments[e]));return t}function E4(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var i=Array(t),n=0,e=0;e<r;e++)for(var s=arguments[e],a=0,u=s.length;a<u;a++,n++)i[n]=s[a];return i}function Jc(t){return this instanceof Jc?(this.v=t,this):new Jc(t)}function A4(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=r.apply(t,e||[]),n,s=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(I){i[I]&&(n[I]=function(S){return new Promise(function(D,T){s.push([I,S,D,T])>1||u(I,S)})})}function u(I,S){try{h(i[I](S))}catch(D){w(s[0][3],D)}}function h(I){I.value instanceof Jc?Promise.resolve(I.value.v).then(l,b):w(s[0][2],I)}function l(I){u("next",I)}function b(I){u("throw",I)}function w(I,S){I(S),s.shift(),s.length&&u(s[0][0],s[0][1])}}function x4(t){var e,r;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]=t[n]?function(a){return(r=!r)?{value:Jc(t[n](a)),done:n==="return"}:s?s(a):a}:s}}function S4(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof w0=="function"?w0(t):t[Symbol.iterator](),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(s){r[s]=t[s]&&function(a){return new Promise(function(u,h){a=t[s](a),n(u,h,a.done,a.value)})}}function n(s,a,u,h){Promise.resolve(h).then(function(l){s({value:l,done:u})},a)}}function I4(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function M4(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function C4(t){return t&&t.__esModule?t:{default:t}}function D4(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function O4(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var P4=Object.freeze({__proto__:null,__extends:l4,get __assign(){return y0},__rest:d4,__decorate:p4,__param:g4,__metadata:v4,__awaiter:m4,__generator:b4,__createBinding:y4,__exportStar:w4,__values:w0,__read:Qg,__spread:_4,__spreadArrays:E4,__await:Jc,__asyncGenerator:A4,__asyncDelegator:x4,__asyncValues:S4,__makeTemplateObject:I4,__importStar:M4,__importDefault:C4,__classPrivateFieldGet:D4,__classPrivateFieldSet:O4}),Mf=m0(P4),_0={},Yc={},Zg;function $4(){if(Zg)return Yc;Zg=1,Object.defineProperty(Yc,"__esModule",{value:!0}),Yc.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Yc.delay=t,Yc}var Ro={},E0={},No={},Xg;function R4(){return Xg||(Xg=1,Object.defineProperty(No,"__esModule",{value:!0}),No.ONE_THOUSAND=No.ONE_HUNDRED=void 0,No.ONE_HUNDRED=100,No.ONE_THOUSAND=1e3),No}var A0={},ev;function N4(){return ev||(ev=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(A0)),A0}var tv;function rv(){return tv||(tv=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Mf;e.__exportStar(R4(),t),e.__exportStar(N4(),t)}(E0)),E0}var iv;function T4(){if(iv)return Ro;iv=1,Object.defineProperty(Ro,"__esModule",{value:!0}),Ro.fromMiliseconds=Ro.toMiliseconds=void 0;const t=rv();function e(i){return i*t.ONE_THOUSAND}Ro.toMiliseconds=e;function r(i){return Math.floor(i/t.ONE_THOUSAND)}return Ro.fromMiliseconds=r,Ro}var nv;function L4(){return nv||(nv=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Mf;e.__exportStar($4(),t),e.__exportStar(T4(),t)}(_0)),_0}var Pa={},sv;function B4(){if(sv)return Pa;sv=1,Object.defineProperty(Pa,"__esModule",{value:!0}),Pa.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const i=this.get(r);if(typeof i.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const n=Date.now()-i.started;this.timestamps.set(r,{started:i.started,elapsed:n})}get(r){const i=this.timestamps.get(r);if(typeof i>"u")throw new Error(`No timestamp found for label: ${r}`);return i}elapsed(r){const i=this.get(r);return i.elapsed||Date.now()-i.started}}return Pa.Watch=t,Pa.default=t,Pa}var x0={},Qc={},ov;function F4(){if(ov)return Qc;ov=1,Object.defineProperty(Qc,"__esModule",{value:!0}),Qc.IWatch=void 0;class t{}return Qc.IWatch=t,Qc}var av;function U4(){return av||(av=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Mf.__exportStar(F4(),t)}(x0)),x0}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Mf;e.__exportStar(L4(),t),e.__exportStar(B4(),t),e.__exportStar(U4(),t),e.__exportStar(rv(),t)})(xe);var ir={};Object.defineProperty(ir,"__esModule",{value:!0}),ir.getLocalStorage=ir.getLocalStorageOrThrow=ir.getCrypto=ir.getCryptoOrThrow=cv=ir.getLocation=ir.getLocationOrThrow=S0=ir.getNavigator=ir.getNavigatorOrThrow=Cf=ir.getDocument=ir.getDocumentOrThrow=ir.getFromWindowOrThrow=ir.getFromWindow=void 0;function To(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}ir.getFromWindow=To;function $a(t){const e=To(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}ir.getFromWindowOrThrow=$a;function k4(){return $a("document")}ir.getDocumentOrThrow=k4;function q4(){return To("document")}var Cf=ir.getDocument=q4;function j4(){return $a("navigator")}ir.getNavigatorOrThrow=j4;function z4(){return To("navigator")}var S0=ir.getNavigator=z4;function H4(){return $a("location")}ir.getLocationOrThrow=H4;function K4(){return To("location")}var cv=ir.getLocation=K4;function W4(){return $a("crypto")}ir.getCryptoOrThrow=W4;function V4(){return To("crypto")}ir.getCrypto=V4;function G4(){return $a("localStorage")}ir.getLocalStorageOrThrow=G4;function J4(){return To("localStorage")}ir.getLocalStorage=J4;var I0={};Object.defineProperty(I0,"__esModule",{value:!0});var uv=I0.getWindowMetadata=void 0;const fv=ir;function Y4(){let t,e;try{t=fv.getDocumentOrThrow(),e=fv.getLocationOrThrow()}catch{return null}function r(){const w=t.getElementsByTagName("link"),I=[];for(let S=0;S<w.length;S++){const D=w[S],T=D.getAttribute("rel");if(T&&T.toLowerCase().indexOf("icon")>-1){const q=D.getAttribute("href");if(q)if(q.toLowerCase().indexOf("https:")===-1&&q.toLowerCase().indexOf("http:")===-1&&q.indexOf("//")!==0){let K=e.protocol+"//"+e.host;if(q.indexOf("/")===0)K+=q;else{const F=e.pathname.split("/");F.pop();const W=F.join("/");K+=W+"/"+q}I.push(K)}else if(q.indexOf("//")===0){const K=e.protocol+q;I.push(K)}else I.push(q)}}return I}function i(...w){const I=t.getElementsByTagName("meta");for(let S=0;S<I.length;S++){const D=I[S],T=["itemprop","property","name"].map(q=>D.getAttribute(q)).filter(q=>q?w.includes(q):!1);if(T.length&&T){const q=D.getAttribute("content");if(q)return q}}return""}function n(){let w=i("name","og:site_name","og:title","twitter:title");return w||(w=t.title),w}function s(){return i("description","og:description","twitter:description","keywords")}const a=n(),u=s(),h=e.origin,l=r();return{description:u,url:h,icons:l,name:a}}uv=I0.getWindowMetadata=Y4;var Zc={},Q4=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),hv="%[a-f0-9]{2}",lv=new RegExp("("+hv+")|([^%]+?)","gi"),dv=new RegExp("("+hv+")+","gi");function M0(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),i=t.slice(e);return Array.prototype.concat.call([],M0(r),M0(i))}function Z4(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(lv)||[],r=1;r<e.length;r++)t=M0(e,r).join(""),e=t.match(lv)||[];return t}}function X4(t){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},r=dv.exec(t);r;){try{e[r[0]]=decodeURIComponent(r[0])}catch{var i=Z4(r[0]);i!==r[0]&&(e[r[0]]=i)}r=dv.exec(t)}e["%C2"]="\uFFFD";for(var n=Object.keys(e),s=0;s<n.length;s++){var a=n[s];t=t.replace(new RegExp(a,"g"),e[a])}return t}var e8=function(t){if(typeof t!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return X4(t)}},t8=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},r8=function(t,e){for(var r={},i=Object.keys(t),n=Array.isArray(e),s=0;s<i.length;s++){var a=i[s],u=t[a];(n?e.indexOf(a)!==-1:e(a,u,t))&&(r[a]=u)}return r};(function(t){const e=Q4,r=e8,i=t8,n=r8,s=F=>F==null,a=Symbol("encodeFragmentIdentifier");function u(F){switch(F.arrayFormat){case"index":return W=>(R,k)=>{const H=R.length;return k===void 0||F.skipNull&&k===null||F.skipEmptyString&&k===""?R:k===null?[...R,[b(W,F),"[",H,"]"].join("")]:[...R,[b(W,F),"[",b(H,F),"]=",b(k,F)].join("")]};case"bracket":return W=>(R,k)=>k===void 0||F.skipNull&&k===null||F.skipEmptyString&&k===""?R:k===null?[...R,[b(W,F),"[]"].join("")]:[...R,[b(W,F),"[]=",b(k,F)].join("")];case"colon-list-separator":return W=>(R,k)=>k===void 0||F.skipNull&&k===null||F.skipEmptyString&&k===""?R:k===null?[...R,[b(W,F),":list="].join("")]:[...R,[b(W,F),":list=",b(k,F)].join("")];case"comma":case"separator":case"bracket-separator":{const W=F.arrayFormat==="bracket-separator"?"[]=":"=";return R=>(k,H)=>H===void 0||F.skipNull&&H===null||F.skipEmptyString&&H===""?k:(H=H===null?"":H,k.length===0?[[b(R,F),W,b(H,F)].join("")]:[[k,b(H,F)].join(F.arrayFormatSeparator)])}default:return W=>(R,k)=>k===void 0||F.skipNull&&k===null||F.skipEmptyString&&k===""?R:k===null?[...R,b(W,F)]:[...R,[b(W,F),"=",b(k,F)].join("")]}}function h(F){let W;switch(F.arrayFormat){case"index":return(R,k,H)=>{if(W=/\[(\d*)\]$/.exec(R),R=R.replace(/\[\d*\]$/,""),!W){H[R]=k;return}H[R]===void 0&&(H[R]={}),H[R][W[1]]=k};case"bracket":return(R,k,H)=>{if(W=/(\[\])$/.exec(R),R=R.replace(/\[\]$/,""),!W){H[R]=k;return}if(H[R]===void 0){H[R]=[k];return}H[R]=[].concat(H[R],k)};case"colon-list-separator":return(R,k,H)=>{if(W=/(:list)$/.exec(R),R=R.replace(/:list$/,""),!W){H[R]=k;return}if(H[R]===void 0){H[R]=[k];return}H[R]=[].concat(H[R],k)};case"comma":case"separator":return(R,k,H)=>{const _=typeof k=="string"&&k.includes(F.arrayFormatSeparator),B=typeof k=="string"&&!_&&w(k,F).includes(F.arrayFormatSeparator);k=B?w(k,F):k;const ee=_||B?k.split(F.arrayFormatSeparator).map(ie=>w(ie,F)):k===null?k:w(k,F);H[R]=ee};case"bracket-separator":return(R,k,H)=>{const _=/(\[\])$/.test(R);if(R=R.replace(/\[\]$/,""),!_){H[R]=k&&w(k,F);return}const B=k===null?[]:k.split(F.arrayFormatSeparator).map(ee=>w(ee,F));if(H[R]===void 0){H[R]=B;return}H[R]=[].concat(H[R],B)};default:return(R,k,H)=>{if(H[R]===void 0){H[R]=k;return}H[R]=[].concat(H[R],k)}}}function l(F){if(typeof F!="string"||F.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function b(F,W){return W.encode?W.strict?e(F):encodeURIComponent(F):F}function w(F,W){return W.decode?r(F):F}function I(F){return Array.isArray(F)?F.sort():typeof F=="object"?I(Object.keys(F)).sort((W,R)=>Number(W)-Number(R)).map(W=>F[W]):F}function S(F){const W=F.indexOf("#");return W!==-1&&(F=F.slice(0,W)),F}function D(F){let W="";const R=F.indexOf("#");return R!==-1&&(W=F.slice(R)),W}function T(F){F=S(F);const W=F.indexOf("?");return W===-1?"":F.slice(W+1)}function q(F,W){return W.parseNumbers&&!Number.isNaN(Number(F))&&typeof F=="string"&&F.trim()!==""?F=Number(F):W.parseBooleans&&F!==null&&(F.toLowerCase()==="true"||F.toLowerCase()==="false")&&(F=F.toLowerCase()==="true"),F}function K(F,W){W=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},W),l(W.arrayFormatSeparator);const R=h(W),k=Object.create(null);if(typeof F!="string"||(F=F.trim().replace(/^[?#&]/,""),!F))return k;for(const H of F.split("&")){if(H==="")continue;let[_,B]=i(W.decode?H.replace(/\+/g," "):H,"=");B=B===void 0?null:["comma","separator","bracket-separator"].includes(W.arrayFormat)?B:w(B,W),R(w(_,W),B,k)}for(const H of Object.keys(k)){const _=k[H];if(typeof _=="object"&&_!==null)for(const B of Object.keys(_))_[B]=q(_[B],W);else k[H]=q(_,W)}return W.sort===!1?k:(W.sort===!0?Object.keys(k).sort():Object.keys(k).sort(W.sort)).reduce((H,_)=>{const B=k[_];return B&&typeof B=="object"&&!Array.isArray(B)?H[_]=I(B):H[_]=B,H},Object.create(null))}t.extract=T,t.parse=K,t.stringify=(F,W)=>{if(!F)return"";W=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},W),l(W.arrayFormatSeparator);const R=B=>W.skipNull&&s(F[B])||W.skipEmptyString&&F[B]==="",k=u(W),H={};for(const B of Object.keys(F))R(B)||(H[B]=F[B]);const _=Object.keys(H);return W.sort!==!1&&_.sort(W.sort),_.map(B=>{const ee=F[B];return ee===void 0?"":ee===null?b(B,W):Array.isArray(ee)?ee.length===0&&W.arrayFormat==="bracket-separator"?b(B,W)+"[]":ee.reduce(k(B),[]).join("&"):b(B,W)+"="+b(ee,W)}).filter(B=>B.length>0).join("&")},t.parseUrl=(F,W)=>{W=Object.assign({decode:!0},W);const[R,k]=i(F,"#");return Object.assign({url:R.split("?")[0]||"",query:K(T(F),W)},W&&W.parseFragmentIdentifier&&k?{fragmentIdentifier:w(k,W)}:{})},t.stringifyUrl=(F,W)=>{W=Object.assign({encode:!0,strict:!0,[a]:!0},W);const R=S(F.url).split("?")[0]||"",k=t.extract(F.url),H=t.parse(k,{sort:!1}),_=Object.assign(H,F.query);let B=t.stringify(_,W);B&&(B=`?${B}`);let ee=D(F.url);return F.fragmentIdentifier&&(ee=`#${W[a]?b(F.fragmentIdentifier,W):F.fragmentIdentifier}`),`${R}${B}${ee}`},t.pick=(F,W,R)=>{R=Object.assign({parseFragmentIdentifier:!0,[a]:!1},R);const{url:k,query:H,fragmentIdentifier:_}=t.parseUrl(F,R);return t.stringifyUrl({url:k,query:n(H,W),fragmentIdentifier:_},R)},t.exclude=(F,W,R)=>{const k=Array.isArray(W)?H=>!W.includes(H):(H,_)=>!W(H,_);return t.pick(F,k,R)}})(Zc);var C0={},Df={},wt={},pv={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});function e(u,h){var l=u>>>16&65535,b=u&65535,w=h>>>16&65535,I=h&65535;return b*I+(l*I+b*w<<16>>>0)|0}t.mul=Math.imul||e;function r(u,h){return u+h|0}t.add=r;function i(u,h){return u-h|0}t.sub=i;function n(u,h){return u<<h|u>>>32-h}t.rotl=n;function s(u,h){return u<<32-h|u>>>h}t.rotr=s;function a(u){return typeof u=="number"&&isFinite(u)&&Math.floor(u)===u}t.isInteger=Number.isInteger||a,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(u){return t.isInteger(u)&&u>=-t.MAX_SAFE_INTEGER&&u<=t.MAX_SAFE_INTEGER}})(pv),Object.defineProperty(wt,"__esModule",{value:!0});var gv=pv;function i8(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}wt.readInt16BE=i8;function n8(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}wt.readUint16BE=n8;function s8(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}wt.readInt16LE=s8;function o8(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}wt.readUint16LE=o8;function vv(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}wt.writeUint16BE=vv,wt.writeInt16BE=vv;function mv(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}wt.writeUint16LE=mv,wt.writeInt16LE=mv;function D0(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}wt.readInt32BE=D0;function O0(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}wt.readUint32BE=O0;function P0(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}wt.readInt32LE=P0;function $0(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}wt.readUint32LE=$0;function Of(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}wt.writeUint32BE=Of,wt.writeInt32BE=Of;function Pf(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}wt.writeUint32LE=Pf,wt.writeInt32LE=Pf;function a8(t,e){e===void 0&&(e=0);var r=D0(t,e),i=D0(t,e+4);return r*4294967296+i-(i>>31)*4294967296}wt.readInt64BE=a8;function c8(t,e){e===void 0&&(e=0);var r=O0(t,e),i=O0(t,e+4);return r*4294967296+i}wt.readUint64BE=c8;function u8(t,e){e===void 0&&(e=0);var r=P0(t,e),i=P0(t,e+4);return i*4294967296+r-(r>>31)*4294967296}wt.readInt64LE=u8;function f8(t,e){e===void 0&&(e=0);var r=$0(t,e),i=$0(t,e+4);return i*4294967296+r}wt.readUint64LE=f8;function bv(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Of(t/4294967296>>>0,e,r),Of(t>>>0,e,r+4),e}wt.writeUint64BE=bv,wt.writeInt64BE=bv;function yv(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Pf(t>>>0,e,r),Pf(t/4294967296>>>0,e,r+4),e}wt.writeUint64LE=yv,wt.writeInt64LE=yv;function h8(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,n=1,s=t/8+r-1;s>=r;s--)i+=e[s]*n,n*=256;return i}wt.readUintBE=h8;function l8(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,n=1,s=r;s<r+t/8;s++)i+=e[s]*n,n*=256;return i}wt.readUintLE=l8;function d8(t,e,r,i){if(r===void 0&&(r=new Uint8Array(t/8)),i===void 0&&(i=0),t%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!gv.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var n=1,s=t/8+i-1;s>=i;s--)r[s]=e/n&255,n*=256;return r}wt.writeUintBE=d8;function p8(t,e,r,i){if(r===void 0&&(r=new Uint8Array(t/8)),i===void 0&&(i=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!gv.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var n=1,s=i;s<i+t/8;s++)r[s]=e/n&255,n*=256;return r}wt.writeUintLE=p8;function g8(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e)}wt.readFloat32BE=g8;function v8(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e,!0)}wt.readFloat32LE=v8;function m8(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e)}wt.readFloat64BE=m8;function b8(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e,!0)}wt.readFloat64LE=b8;function y8(t,e,r){e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(r,t),e}wt.writeFloat32BE=y8;function w8(t,e,r){e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(r,t,!0),e}wt.writeFloat32LE=w8;function _8(t,e,r){e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(r,t),e}wt.writeFloat64BE=_8;function E8(t,e,r){e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(r,t,!0),e}wt.writeFloat64LE=E8;var Ni={};Object.defineProperty(Ni,"__esModule",{value:!0});function A8(t){for(var e=0;e<t.length;e++)t[e]=0;return t}Ni.wipe=A8,Object.defineProperty(Df,"__esModule",{value:!0});var Gr=wt,R0=Ni,x8=20;function S8(t,e,r){for(var i=1634760805,n=857760878,s=2036477234,a=1797285236,u=r[3]<<24|r[2]<<16|r[1]<<8|r[0],h=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],b=r[15]<<24|r[14]<<16|r[13]<<8|r[12],w=r[19]<<24|r[18]<<16|r[17]<<8|r[16],I=r[23]<<24|r[22]<<16|r[21]<<8|r[20],S=r[27]<<24|r[26]<<16|r[25]<<8|r[24],D=r[31]<<24|r[30]<<16|r[29]<<8|r[28],T=e[3]<<24|e[2]<<16|e[1]<<8|e[0],q=e[7]<<24|e[6]<<16|e[5]<<8|e[4],K=e[11]<<24|e[10]<<16|e[9]<<8|e[8],F=e[15]<<24|e[14]<<16|e[13]<<8|e[12],W=i,R=n,k=s,H=a,_=u,B=h,ee=l,ie=b,L=w,y=I,f=S,d=D,v=T,E=q,C=K,O=F,M=0;M<x8;M+=2)W=W+_|0,v^=W,v=v>>>32-16|v<<16,L=L+v|0,_^=L,_=_>>>32-12|_<<12,R=R+B|0,E^=R,E=E>>>32-16|E<<16,y=y+E|0,B^=y,B=B>>>32-12|B<<12,k=k+ee|0,C^=k,C=C>>>32-16|C<<16,f=f+C|0,ee^=f,ee=ee>>>32-12|ee<<12,H=H+ie|0,O^=H,O=O>>>32-16|O<<16,d=d+O|0,ie^=d,ie=ie>>>32-12|ie<<12,k=k+ee|0,C^=k,C=C>>>32-8|C<<8,f=f+C|0,ee^=f,ee=ee>>>32-7|ee<<7,H=H+ie|0,O^=H,O=O>>>32-8|O<<8,d=d+O|0,ie^=d,ie=ie>>>32-7|ie<<7,R=R+B|0,E^=R,E=E>>>32-8|E<<8,y=y+E|0,B^=y,B=B>>>32-7|B<<7,W=W+_|0,v^=W,v=v>>>32-8|v<<8,L=L+v|0,_^=L,_=_>>>32-7|_<<7,W=W+B|0,O^=W,O=O>>>32-16|O<<16,f=f+O|0,B^=f,B=B>>>32-12|B<<12,R=R+ee|0,v^=R,v=v>>>32-16|v<<16,d=d+v|0,ee^=d,ee=ee>>>32-12|ee<<12,k=k+ie|0,E^=k,E=E>>>32-16|E<<16,L=L+E|0,ie^=L,ie=ie>>>32-12|ie<<12,H=H+_|0,C^=H,C=C>>>32-16|C<<16,y=y+C|0,_^=y,_=_>>>32-12|_<<12,k=k+ie|0,E^=k,E=E>>>32-8|E<<8,L=L+E|0,ie^=L,ie=ie>>>32-7|ie<<7,H=H+_|0,C^=H,C=C>>>32-8|C<<8,y=y+C|0,_^=y,_=_>>>32-7|_<<7,R=R+ee|0,v^=R,v=v>>>32-8|v<<8,d=d+v|0,ee^=d,ee=ee>>>32-7|ee<<7,W=W+B|0,O^=W,O=O>>>32-8|O<<8,f=f+O|0,B^=f,B=B>>>32-7|B<<7;Gr.writeUint32LE(W+i|0,t,0),Gr.writeUint32LE(R+n|0,t,4),Gr.writeUint32LE(k+s|0,t,8),Gr.writeUint32LE(H+a|0,t,12),Gr.writeUint32LE(_+u|0,t,16),Gr.writeUint32LE(B+h|0,t,20),Gr.writeUint32LE(ee+l|0,t,24),Gr.writeUint32LE(ie+b|0,t,28),Gr.writeUint32LE(L+w|0,t,32),Gr.writeUint32LE(y+I|0,t,36),Gr.writeUint32LE(f+S|0,t,40),Gr.writeUint32LE(d+D|0,t,44),Gr.writeUint32LE(v+T|0,t,48),Gr.writeUint32LE(E+q|0,t,52),Gr.writeUint32LE(C+K|0,t,56),Gr.writeUint32LE(O+F|0,t,60)}function wv(t,e,r,i,n){if(n===void 0&&(n=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length<r.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 u=new Uint8Array(64),h=0;h<r.length;h+=64){S8(u,s,t);for(var l=h;l<h+64&&l<r.length;l++)i[l]=r[l]^u[l-h];M8(s,0,a)}return R0.wipe(u),n===0&&R0.wipe(s),i}Df.streamXOR=wv;function I8(t,e,r,i){return i===void 0&&(i=0),R0.wipe(r),wv(t,e,r,r,i)}Df.stream=I8;function M8(t,e,r){for(var i=1;r--;)i=i+(t[e]&255)|0,t[e]=i&255,i>>>=8,e++;if(i>0)throw new Error("ChaCha: counter overflow")}var _v={},Qs={};Object.defineProperty(Qs,"__esModule",{value:!0});function C8(t,e,r){return~(t-1)&e|t-1&r}Qs.select=C8;function D8(t,e){return(t|0)-(e|0)-1>>>31&1}Qs.lessOrEqual=D8;function Ev(t,e){if(t.length!==e.length)return 0;for(var r=0,i=0;i<t.length;i++)r|=t[i]^e[i];return 1&r-1>>>8}Qs.compare=Ev;function O8(t,e){return t.length===0||e.length===0?!1:Ev(t,e)!==0}Qs.equal=O8,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Qs,r=Ni;t.DIGEST_LENGTH=16;var i=function(){function a(u){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var h=u[0]|u[1]<<8;this._r[0]=h&8191;var l=u[2]|u[3]<<8;this._r[1]=(h>>>13|l<<3)&8191;var b=u[4]|u[5]<<8;this._r[2]=(l>>>10|b<<6)&7939;var w=u[6]|u[7]<<8;this._r[3]=(b>>>7|w<<9)&8191;var I=u[8]|u[9]<<8;this._r[4]=(w>>>4|I<<12)&255,this._r[5]=I>>>1&8190;var S=u[10]|u[11]<<8;this._r[6]=(I>>>14|S<<2)&8191;var D=u[12]|u[13]<<8;this._r[7]=(S>>>11|D<<5)&8065;var T=u[14]|u[15]<<8;this._r[8]=(D>>>8|T<<8)&8191,this._r[9]=T>>>5&127,this._pad[0]=u[16]|u[17]<<8,this._pad[1]=u[18]|u[19]<<8,this._pad[2]=u[20]|u[21]<<8,this._pad[3]=u[22]|u[23]<<8,this._pad[4]=u[24]|u[25]<<8,this._pad[5]=u[26]|u[27]<<8,this._pad[6]=u[28]|u[29]<<8,this._pad[7]=u[30]|u[31]<<8}return a.prototype._blocks=function(u,h,l){for(var b=this._fin?0:2048,w=this._h[0],I=this._h[1],S=this._h[2],D=this._h[3],T=this._h[4],q=this._h[5],K=this._h[6],F=this._h[7],W=this._h[8],R=this._h[9],k=this._r[0],H=this._r[1],_=this._r[2],B=this._r[3],ee=this._r[4],ie=this._r[5],L=this._r[6],y=this._r[7],f=this._r[8],d=this._r[9];l>=16;){var v=u[h+0]|u[h+1]<<8;w+=v&8191;var E=u[h+2]|u[h+3]<<8;I+=(v>>>13|E<<3)&8191;var C=u[h+4]|u[h+5]<<8;S+=(E>>>10|C<<6)&8191;var O=u[h+6]|u[h+7]<<8;D+=(C>>>7|O<<9)&8191;var M=u[h+8]|u[h+9]<<8;T+=(O>>>4|M<<12)&8191,q+=M>>>1&8191;var g=u[h+10]|u[h+11]<<8;K+=(M>>>14|g<<2)&8191;var m=u[h+12]|u[h+13]<<8;F+=(g>>>11|m<<5)&8191;var N=u[h+14]|u[h+15]<<8;W+=(m>>>8|N<<8)&8191,R+=N>>>5|b;var X=0,ae=X;ae+=w*k,ae+=I*(5*d),ae+=S*(5*f),ae+=D*(5*y),ae+=T*(5*L),X=ae>>>13,ae&=8191,ae+=q*(5*ie),ae+=K*(5*ee),ae+=F*(5*B),ae+=W*(5*_),ae+=R*(5*H),X+=ae>>>13,ae&=8191;var P=X;P+=w*H,P+=I*k,P+=S*(5*d),P+=D*(5*f),P+=T*(5*y),X=P>>>13,P&=8191,P+=q*(5*L),P+=K*(5*ie),P+=F*(5*ee),P+=W*(5*B),P+=R*(5*_),X+=P>>>13,P&=8191;var te=X;te+=w*_,te+=I*H,te+=S*k,te+=D*(5*d),te+=T*(5*f),X=te>>>13,te&=8191,te+=q*(5*y),te+=K*(5*L),te+=F*(5*ie),te+=W*(5*ee),te+=R*(5*B),X+=te>>>13,te&=8191;var z=X;z+=w*B,z+=I*_,z+=S*H,z+=D*k,z+=T*(5*d),X=z>>>13,z&=8191,z+=q*(5*f),z+=K*(5*y),z+=F*(5*L),z+=W*(5*ie),z+=R*(5*ee),X+=z>>>13,z&=8191;var G=X;G+=w*ee,G+=I*B,G+=S*_,G+=D*H,G+=T*k,X=G>>>13,G&=8191,G+=q*(5*d),G+=K*(5*f),G+=F*(5*y),G+=W*(5*L),G+=R*(5*ie),X+=G>>>13,G&=8191;var J=X;J+=w*ie,J+=I*ee,J+=S*B,J+=D*_,J+=T*H,X=J>>>13,J&=8191,J+=q*k,J+=K*(5*d),J+=F*(5*f),J+=W*(5*y),J+=R*(5*L),X+=J>>>13,J&=8191;var A=X;A+=w*L,A+=I*ie,A+=S*ee,A+=D*B,A+=T*_,X=A>>>13,A&=8191,A+=q*H,A+=K*k,A+=F*(5*d),A+=W*(5*f),A+=R*(5*y),X+=A>>>13,A&=8191;var V=X;V+=w*y,V+=I*L,V+=S*ie,V+=D*ee,V+=T*B,X=V>>>13,V&=8191,V+=q*_,V+=K*H,V+=F*k,V+=W*(5*d),V+=R*(5*f),X+=V>>>13,V&=8191;var oe=X;oe+=w*f,oe+=I*y,oe+=S*L,oe+=D*ie,oe+=T*ee,X=oe>>>13,oe&=8191,oe+=q*B,oe+=K*_,oe+=F*H,oe+=W*k,oe+=R*(5*d),X+=oe>>>13,oe&=8191;var ue=X;ue+=w*d,ue+=I*f,ue+=S*y,ue+=D*L,ue+=T*ie,X=ue>>>13,ue&=8191,ue+=q*ee,ue+=K*B,ue+=F*_,ue+=W*H,ue+=R*k,X+=ue>>>13,ue&=8191,X=(X<<2)+X|0,X=X+ae|0,ae=X&8191,X=X>>>13,P+=X,w=ae,I=P,S=te,D=z,T=G,q=J,K=A,F=V,W=oe,R=ue,h+=16,l-=16}this._h[0]=w,this._h[1]=I,this._h[2]=S,this._h[3]=D,this._h[4]=T,this._h[5]=q,this._h[6]=K,this._h[7]=F,this._h[8]=W,this._h[9]=R},a.prototype.finish=function(u,h){h===void 0&&(h=0);var l=new Uint16Array(10),b,w,I,S;if(this._leftover){for(S=this._leftover,this._buffer[S++]=1;S<16;S++)this._buffer[S]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(b=this._h[1]>>>13,this._h[1]&=8191,S=2;S<10;S++)this._h[S]+=b,b=this._h[S]>>>13,this._h[S]&=8191;for(this._h[0]+=b*5,b=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=b,b=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=b,l[0]=this._h[0]+5,b=l[0]>>>13,l[0]&=8191,S=1;S<10;S++)l[S]=this._h[S]+b,b=l[S]>>>13,l[S]&=8191;for(l[9]-=8192,w=(b^1)-1,S=0;S<10;S++)l[S]&=w;for(w=~w,S=0;S<10;S++)this._h[S]=this._h[S]&w|l[S];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,I=this._h[0]+this._pad[0],this._h[0]=I&65535,S=1;S<8;S++)I=(this._h[S]+this._pad[S]|0)+(I>>>16)|0,this._h[S]=I&65535;return u[h+0]=this._h[0]>>>0,u[h+1]=this._h[0]>>>8,u[h+2]=this._h[1]>>>0,u[h+3]=this._h[1]>>>8,u[h+4]=this._h[2]>>>0,u[h+5]=this._h[2]>>>8,u[h+6]=this._h[3]>>>0,u[h+7]=this._h[3]>>>8,u[h+8]=this._h[4]>>>0,u[h+9]=this._h[4]>>>8,u[h+10]=this._h[5]>>>0,u[h+11]=this._h[5]>>>8,u[h+12]=this._h[6]>>>0,u[h+13]=this._h[6]>>>8,u[h+14]=this._h[7]>>>0,u[h+15]=this._h[7]>>>8,this._finished=!0,this},a.prototype.update=function(u){var h=0,l=u.length,b;if(this._leftover){b=16-this._leftover,b>l&&(b=l);for(var w=0;w<b;w++)this._buffer[this._leftover+w]=u[h+w];if(l-=b,h+=b,this._leftover+=b,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(l>=16&&(b=l-l%16,this._blocks(u,h,b),h+=b,l-=b),l){for(var w=0;w<l;w++)this._buffer[this._leftover+w]=u[h+w];this._leftover+=l}return this},a.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var u=new Uint8Array(16);return this.finish(u),u},a.prototype.clean=function(){return r.wipe(this._buffer),r.wipe(this._r),r.wipe(this._h),r.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},a}();t.Poly1305=i;function n(a,u){var h=new i(a);h.update(u);var l=h.digest();return h.clean(),l}t.oneTimeAuth=n;function s(a,u){return a.length!==t.DIGEST_LENGTH||u.length!==t.DIGEST_LENGTH?!1:e.equal(a,u)}t.equal=s}(_v),function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Df,r=_v,i=Ni,n=wt,s=Qs;t.KEY_LENGTH=32,t.NONCE_LENGTH=12,t.TAG_LENGTH=16;var a=new Uint8Array(16),u=function(){function h(l){if(this.nonceLength=t.NONCE_LENGTH,this.tagLength=t.TAG_LENGTH,l.length!==t.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(l)}return h.prototype.seal=function(l,b,w,I){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var S=new Uint8Array(16);S.set(l,S.length-l.length);var D=new Uint8Array(32);e.stream(this._key,S,D,4);var T=b.length+this.tagLength,q;if(I){if(I.length!==T)throw new Error("ChaCha20Poly1305: incorrect destination length");q=I}else q=new Uint8Array(T);return e.streamXOR(this._key,S,b,q,4),this._authenticate(q.subarray(q.length-this.tagLength,q.length),D,q.subarray(0,q.length-this.tagLength),w),i.wipe(S),q},h.prototype.open=function(l,b,w,I){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(b.length<this.tagLength)return null;var S=new Uint8Array(16);S.set(l,S.length-l.length);var D=new Uint8Array(32);e.stream(this._key,S,D,4);var T=new Uint8Array(this.tagLength);if(this._authenticate(T,D,b.subarray(0,b.length-this.tagLength),w),!s.equal(T,b.subarray(b.length-this.tagLength,b.length)))return null;var q=b.length-this.tagLength,K;if(I){if(I.length!==q)throw new Error("ChaCha20Poly1305: incorrect destination length");K=I}else K=new Uint8Array(q);return e.streamXOR(this._key,S,b.subarray(0,b.length-this.tagLength),K,4),i.wipe(S),K},h.prototype.clean=function(){return i.wipe(this._key),this},h.prototype._authenticate=function(l,b,w,I){var S=new r.Poly1305(b);I&&(S.update(I),I.length%16>0&&S.update(a.subarray(I.length%16))),S.update(w),w.length%16>0&&S.update(a.subarray(w.length%16));var D=new Uint8Array(8);I&&n.writeUint64LE(I.length,D),S.update(D),n.writeUint64LE(w.length,D),S.update(D);for(var T=S.digest(),q=0;q<T.length;q++)l[q]=T[q];S.clean(),i.wipe(T),i.wipe(D)},h}();t.ChaCha20Poly1305=u}(C0);var Av={},Xc={},N0={};Object.defineProperty(N0,"__esModule",{value:!0});function P8(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}N0.isSerializableHash=P8,Object.defineProperty(Xc,"__esModule",{value:!0});var qn=N0,$8=Qs,R8=Ni,xv=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(i).clean():i.set(r);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),qn.isSerializableHash(this._inner)&&qn.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),R8.wipe(i)}return t.prototype.reset=function(){if(!qn.isSerializableHash(this._inner)||!qn.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.clean=function(){qn.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),qn.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},t.prototype.update=function(e){return this._inner.update(e),this},t.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},t.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},t.prototype.saveState=function(){if(!qn.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},t.prototype.restoreState=function(e){if(!qn.isSerializableHash(this._inner)||!qn.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.cleanSavedState=function(e){if(!qn.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},t}();Xc.HMAC=xv;function N8(t,e,r){var i=new xv(t,e);i.update(r);var n=i.digest();return i.clean(),n}Xc.hmac=N8,Xc.equal=$8.equal,Object.defineProperty(Av,"__esModule",{value:!0});var Sv=Xc,Iv=Ni,T8=function(){function t(e,r,i,n){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=n;var s=Sv.hmac(this._hash,i,r);this._hmac=new Sv.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),i=0;i<r.length;i++)this._bufpos===this._buffer.length&&this._fillBuffer(),r[i]=this._buffer[this._bufpos++];return r},t.prototype.clean=function(){this._hmac.clean(),Iv.wipe(this._buffer),Iv.wipe(this._counter),this._bufpos=0},t}(),L8=Av.HKDF=T8,Zs={},$f={},Rf={};Object.defineProperty(Rf,"__esModule",{value:!0}),Rf.BrowserRandomSource=void 0;const Mv=65536;class B8{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(e);for(let i=0;i<r.length;i+=Mv)this._crypto.getRandomValues(r.subarray(i,i+Math.min(r.length-i,Mv)));return r}}Rf.BrowserRandomSource=B8;function F8(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Nf={},U8={},k8=Object.freeze({__proto__:null,default:U8}),T0=m0(k8);Object.defineProperty(Nf,"__esModule",{value:!0}),Nf.NodeRandomSource=void 0;const q8=Ni;class j8{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof F8<"u"){const e=T0;e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let r=this._crypto.randomBytes(e);if(r.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]=r[n];return(0,q8.wipe)(r),i}}Nf.NodeRandomSource=j8,Object.defineProperty($f,"__esModule",{value:!0}),$f.SystemRandomSource=void 0;const z8=Rf,H8=Nf;class K8{constructor(){if(this.isAvailable=!1,this.name="",this._source=new z8.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new H8.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)}}$f.SystemRandomSource=K8,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const e=$f,r=wt,i=Ni;t.defaultRandomSource=new e.SystemRandomSource;function n(l,b=t.defaultRandomSource){return b.randomBytes(l)}t.randomBytes=n;function s(l=t.defaultRandomSource){const b=n(4,l),w=(0,r.readUint32LE)(b);return(0,i.wipe)(b),w}t.randomUint32=s;const a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function u(l,b=a,w=t.defaultRandomSource){if(b.length<2)throw new Error("randomString charset is too short");if(b.length>256)throw new Error("randomString charset is too long");let I="";const S=b.length,D=256-256%S;for(;l>0;){const T=n(Math.ceil(l*256/D),w);for(let q=0;q<T.length&&l>0;q++){const K=T[q];K<D&&(I+=b.charAt(K%S),l--)}(0,i.wipe)(T)}return I}t.randomString=u;function h(l,b=a,w=t.defaultRandomSource){const I=Math.ceil(l/(Math.log(b.length)/Math.LN2));return u(I,b,w)}t.randomStringForEntropy=h}(Zs);var eu={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=wt,r=Ni;t.DIGEST_LENGTH=32,t.BLOCK_SIZE=64;var i=function(){function u(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return u.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},u.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},u.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._temp),this.reset()},u.prototype.update=function(h,l){if(l===void 0&&(l=h.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var b=0;if(this._bytesHashed+=l,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&l>0;)this._buffer[this._bufferLength++]=h[b++],l--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(b=s(this._temp,this._state,h,b,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=h[b++],l--;return this},u.prototype.finish=function(h){if(!this._finished){var l=this._bytesHashed,b=this._bufferLength,w=l/536870912|0,I=l<<3,S=l%64<56?64:128;this._buffer[b]=128;for(var D=b+1;D<S-8;D++)this._buffer[D]=0;e.writeUint32BE(w,this._buffer,S-8),e.writeUint32BE(I,this._buffer,S-4),s(this._temp,this._state,this._buffer,0,S),this._finished=!0}for(var D=0;D<this.digestLength/4;D++)e.writeUint32BE(this._state[D],h,D*4);return this},u.prototype.digest=function(){var h=new Uint8Array(this.digestLength);return this.finish(h),h},u.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},u.prototype.restoreState=function(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},u.prototype.cleanSavedState=function(h){r.wipe(h.state),h.buffer&&r.wipe(h.buffer),h.bufferLength=0,h.bytesHashed=0},u}();t.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(u,h,l,b,w){for(;w>=64;){for(var I=h[0],S=h[1],D=h[2],T=h[3],q=h[4],K=h[5],F=h[6],W=h[7],R=0;R<16;R++){var k=b+R*4;u[R]=e.readUint32BE(l,k)}for(var R=16;R<64;R++){var H=u[R-2],_=(H>>>17|H<<32-17)^(H>>>19|H<<32-19)^H>>>10;H=u[R-15];var B=(H>>>7|H<<32-7)^(H>>>18|H<<32-18)^H>>>3;u[R]=(_+u[R-7]|0)+(B+u[R-16]|0)}for(var R=0;R<64;R++){var _=(((q>>>6|q<<26)^(q>>>11|q<<21)^(q>>>25|q<<7))+(q&K^~q&F)|0)+(W+(n[R]+u[R]|0)|0)|0,B=((I>>>2|I<<32-2)^(I>>>13|I<<32-13)^(I>>>22|I<<32-22))+(I&S^I&D^S&D)|0;W=F,F=K,K=q,q=T+_|0,T=D,D=S,S=I,I=_+B|0}h[0]+=I,h[1]+=S,h[2]+=D,h[3]+=T,h[4]+=q,h[5]+=K,h[6]+=F,h[7]+=W,b+=64,w-=64}return b}function a(u){var h=new i;h.update(u);var l=h.digest();return h.clean(),l}t.hash=a})(eu);var L0={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=Zs,r=Ni;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function i(R){const k=new Float64Array(16);if(R)for(let H=0;H<R.length;H++)k[H]=R[H];return k}const n=new Uint8Array(32);n[0]=9;const s=i([56129,1]);function a(R){let k=1;for(let H=0;H<16;H++){let _=R[H]+k+65535;k=Math.floor(_/65536),R[H]=_-k*65536}R[0]+=k-1+37*(k-1)}function u(R,k,H){const _=~(H-1);for(let B=0;B<16;B++){const ee=_&(R[B]^k[B]);R[B]^=ee,k[B]^=ee}}function h(R,k){const H=i(),_=i();for(let B=0;B<16;B++)_[B]=k[B];a(_),a(_),a(_);for(let B=0;B<2;B++){H[0]=_[0]-65517;for(let ie=1;ie<15;ie++)H[ie]=_[ie]-65535-(H[ie-1]>>16&1),H[ie-1]&=65535;H[15]=_[15]-32767-(H[14]>>16&1);const ee=H[15]>>16&1;H[14]&=65535,u(_,H,1-ee)}for(let B=0;B<16;B++)R[2*B]=_[B]&255,R[2*B+1]=_[B]>>8}function l(R,k){for(let H=0;H<16;H++)R[H]=k[2*H]+(k[2*H+1]<<8);R[15]&=32767}function b(R,k,H){for(let _=0;_<16;_++)R[_]=k[_]+H[_]}function w(R,k,H){for(let _=0;_<16;_++)R[_]=k[_]-H[_]}function I(R,k,H){let _,B,ee=0,ie=0,L=0,y=0,f=0,d=0,v=0,E=0,C=0,O=0,M=0,g=0,m=0,N=0,X=0,ae=0,P=0,te=0,z=0,G=0,J=0,A=0,V=0,oe=0,ue=0,he=0,ye=0,we=0,Re=0,Xe=0,Oe=0,Ne=H[0],Me=H[1],be=H[2],Pe=H[3],Te=H[4],ve=H[5],$e=H[6],Se=H[7],me=H[8],Ue=H[9],Ce=H[10],_e=H[11],Ke=H[12],Ve=H[13],Ae=H[14],We=H[15];_=k[0],ee+=_*Ne,ie+=_*Me,L+=_*be,y+=_*Pe,f+=_*Te,d+=_*ve,v+=_*$e,E+=_*Se,C+=_*me,O+=_*Ue,M+=_*Ce,g+=_*_e,m+=_*Ke,N+=_*Ve,X+=_*Ae,ae+=_*We,_=k[1],ie+=_*Ne,L+=_*Me,y+=_*be,f+=_*Pe,d+=_*Te,v+=_*ve,E+=_*$e,C+=_*Se,O+=_*me,M+=_*Ue,g+=_*Ce,m+=_*_e,N+=_*Ke,X+=_*Ve,ae+=_*Ae,P+=_*We,_=k[2],L+=_*Ne,y+=_*Me,f+=_*be,d+=_*Pe,v+=_*Te,E+=_*ve,C+=_*$e,O+=_*Se,M+=_*me,g+=_*Ue,m+=_*Ce,N+=_*_e,X+=_*Ke,ae+=_*Ve,P+=_*Ae,te+=_*We,_=k[3],y+=_*Ne,f+=_*Me,d+=_*be,v+=_*Pe,E+=_*Te,C+=_*ve,O+=_*$e,M+=_*Se,g+=_*me,m+=_*Ue,N+=_*Ce,X+=_*_e,ae+=_*Ke,P+=_*Ve,te+=_*Ae,z+=_*We,_=k[4],f+=_*Ne,d+=_*Me,v+=_*be,E+=_*Pe,C+=_*Te,O+=_*ve,M+=_*$e,g+=_*Se,m+=_*me,N+=_*Ue,X+=_*Ce,ae+=_*_e,P+=_*Ke,te+=_*Ve,z+=_*Ae,G+=_*We,_=k[5],d+=_*Ne,v+=_*Me,E+=_*be,C+=_*Pe,O+=_*Te,M+=_*ve,g+=_*$e,m+=_*Se,N+=_*me,X+=_*Ue,ae+=_*Ce,P+=_*_e,te+=_*Ke,z+=_*Ve,G+=_*Ae,J+=_*We,_=k[6],v+=_*Ne,E+=_*Me,C+=_*be,O+=_*Pe,M+=_*Te,g+=_*ve,m+=_*$e,N+=_*Se,X+=_*me,ae+=_*Ue,P+=_*Ce,te+=_*_e,z+=_*Ke,G+=_*Ve,J+=_*Ae,A+=_*We,_=k[7],E+=_*Ne,C+=_*Me,O+=_*be,M+=_*Pe,g+=_*Te,m+=_*ve,N+=_*$e,X+=_*Se,ae+=_*me,P+=_*Ue,te+=_*Ce,z+=_*_e,G+=_*Ke,J+=_*Ve,A+=_*Ae,V+=_*We,_=k[8],C+=_*Ne,O+=_*Me,M+=_*be,g+=_*Pe,m+=_*Te,N+=_*ve,X+=_*$e,ae+=_*Se,P+=_*me,te+=_*Ue,z+=_*Ce,G+=_*_e,J+=_*Ke,A+=_*Ve,V+=_*Ae,oe+=_*We,_=k[9],O+=_*Ne,M+=_*Me,g+=_*be,m+=_*Pe,N+=_*Te,X+=_*ve,ae+=_*$e,P+=_*Se,te+=_*me,z+=_*Ue,G+=_*Ce,J+=_*_e,A+=_*Ke,V+=_*Ve,oe+=_*Ae,ue+=_*We,_=k[10],M+=_*Ne,g+=_*Me,m+=_*be,N+=_*Pe,X+=_*Te,ae+=_*ve,P+=_*$e,te+=_*Se,z+=_*me,G+=_*Ue,J+=_*Ce,A+=_*_e,V+=_*Ke,oe+=_*Ve,ue+=_*Ae,he+=_*We,_=k[11],g+=_*Ne,m+=_*Me,N+=_*be,X+=_*Pe,ae+=_*Te,P+=_*ve,te+=_*$e,z+=_*Se,G+=_*me,J+=_*Ue,A+=_*Ce,V+=_*_e,oe+=_*Ke,ue+=_*Ve,he+=_*Ae,ye+=_*We,_=k[12],m+=_*Ne,N+=_*Me,X+=_*be,ae+=_*Pe,P+=_*Te,te+=_*ve,z+=_*$e,G+=_*Se,J+=_*me,A+=_*Ue,V+=_*Ce,oe+=_*_e,ue+=_*Ke,he+=_*Ve,ye+=_*Ae,we+=_*We,_=k[13],N+=_*Ne,X+=_*Me,ae+=_*be,P+=_*Pe,te+=_*Te,z+=_*ve,G+=_*$e,J+=_*Se,A+=_*me,V+=_*Ue,oe+=_*Ce,ue+=_*_e,he+=_*Ke,ye+=_*Ve,we+=_*Ae,Re+=_*We,_=k[14],X+=_*Ne,ae+=_*Me,P+=_*be,te+=_*Pe,z+=_*Te,G+=_*ve,J+=_*$e,A+=_*Se,V+=_*me,oe+=_*Ue,ue+=_*Ce,he+=_*_e,ye+=_*Ke,we+=_*Ve,Re+=_*Ae,Xe+=_*We,_=k[15],ae+=_*Ne,P+=_*Me,te+=_*be,z+=_*Pe,G+=_*Te,J+=_*ve,A+=_*$e,V+=_*Se,oe+=_*me,ue+=_*Ue,he+=_*Ce,ye+=_*_e,we+=_*Ke,Re+=_*Ve,Xe+=_*Ae,Oe+=_*We,ee+=38*P,ie+=38*te,L+=38*z,y+=38*G,f+=38*J,d+=38*A,v+=38*V,E+=38*oe,C+=38*ue,O+=38*he,M+=38*ye,g+=38*we,m+=38*Re,N+=38*Xe,X+=38*Oe,B=1,_=ee+B+65535,B=Math.floor(_/65536),ee=_-B*65536,_=ie+B+65535,B=Math.floor(_/65536),ie=_-B*65536,_=L+B+65535,B=Math.floor(_/65536),L=_-B*65536,_=y+B+65535,B=Math.floor(_/65536),y=_-B*65536,_=f+B+65535,B=Math.floor(_/65536),f=_-B*65536,_=d+B+65535,B=Math.floor(_/65536),d=_-B*65536,_=v+B+65535,B=Math.floor(_/65536),v=_-B*65536,_=E+B+65535,B=Math.floor(_/65536),E=_-B*65536,_=C+B+65535,B=Math.floor(_/65536),C=_-B*65536,_=O+B+65535,B=Math.floor(_/65536),O=_-B*65536,_=M+B+65535,B=Math.floor(_/65536),M=_-B*65536,_=g+B+65535,B=Math.floor(_/65536),g=_-B*65536,_=m+B+65535,B=Math.floor(_/65536),m=_-B*65536,_=N+B+65535,B=Math.floor(_/65536),N=_-B*65536,_=X+B+65535,B=Math.floor(_/65536),X=_-B*65536,_=ae+B+65535,B=Math.floor(_/65536),ae=_-B*65536,ee+=B-1+37*(B-1),B=1,_=ee+B+65535,B=Math.floor(_/65536),ee=_-B*65536,_=ie+B+65535,B=Math.floor(_/65536),ie=_-B*65536,_=L+B+65535,B=Math.floor(_/65536),L=_-B*65536,_=y+B+65535,B=Math.floor(_/65536),y=_-B*65536,_=f+B+65535,B=Math.floor(_/65536),f=_-B*65536,_=d+B+65535,B=Math.floor(_/65536),d=_-B*65536,_=v+B+65535,B=Math.floor(_/65536),v=_-B*65536,_=E+B+65535,B=Math.floor(_/65536),E=_-B*65536,_=C+B+65535,B=Math.floor(_/65536),C=_-B*65536,_=O+B+65535,B=Math.floor(_/65536),O=_-B*65536,_=M+B+65535,B=Math.floor(_/65536),M=_-B*65536,_=g+B+65535,B=Math.floor(_/65536),g=_-B*65536,_=m+B+65535,B=Math.floor(_/65536),m=_-B*65536,_=N+B+65535,B=Math.floor(_/65536),N=_-B*65536,_=X+B+65535,B=Math.floor(_/65536),X=_-B*65536,_=ae+B+65535,B=Math.floor(_/65536),ae=_-B*65536,ee+=B-1+37*(B-1),R[0]=ee,R[1]=ie,R[2]=L,R[3]=y,R[4]=f,R[5]=d,R[6]=v,R[7]=E,R[8]=C,R[9]=O,R[10]=M,R[11]=g,R[12]=m,R[13]=N,R[14]=X,R[15]=ae}function S(R,k){I(R,k,k)}function D(R,k){const H=i();for(let _=0;_<16;_++)H[_]=k[_];for(let _=253;_>=0;_--)S(H,H),_!==2&&_!==4&&I(H,H,k);for(let _=0;_<16;_++)R[_]=H[_]}function T(R,k){const H=new Uint8Array(32),_=new Float64Array(80),B=i(),ee=i(),ie=i(),L=i(),y=i(),f=i();for(let C=0;C<31;C++)H[C]=R[C];H[31]=R[31]&127|64,H[0]&=248,l(_,k);for(let C=0;C<16;C++)ee[C]=_[C];B[0]=L[0]=1;for(let C=254;C>=0;--C){const O=H[C>>>3]>>>(C&7)&1;u(B,ee,O),u(ie,L,O),b(y,B,ie),w(B,B,ie),b(ie,ee,L),w(ee,ee,L),S(L,y),S(f,B),I(B,ie,B),I(ie,ee,y),b(y,B,ie),w(B,B,ie),S(ee,B),w(ie,L,f),I(B,ie,s),b(B,B,L),I(ie,ie,B),I(B,L,f),I(L,ee,_),S(ee,y),u(B,ee,O),u(ie,L,O)}for(let C=0;C<16;C++)_[C+16]=B[C],_[C+32]=ie[C],_[C+48]=ee[C],_[C+64]=L[C];const d=_.subarray(32),v=_.subarray(16);D(d,d),I(v,v,d);const E=new Uint8Array(32);return h(E,v),E}t.scalarMult=T;function q(R){return T(R,n)}t.scalarMultBase=q;function K(R){if(R.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const k=new Uint8Array(R);return{publicKey:q(k),secretKey:k}}t.generateKeyPairFromSeed=K;function F(R){const k=(0,e.randomBytes)(32,R),H=K(k);return(0,r.wipe)(k),H}t.generateKeyPair=F;function W(R,k,H=!1){if(R.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(k.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const _=T(R,k);if(H){let B=0;for(let ee=0;ee<_.length;ee++)B|=_[ee];if(B===0)throw new Error("X25519: invalid shared key")}return _}t.sharedKey=W})(L0);function Cv(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function B0(t,e){e||(e=t.reduce((n,s)=>n+s.length,0));const r=Cv(e);let i=0;for(const n of t)r.set(n,i),i+=n.length;return r}function W8(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i<r.length;i++)r[i]=255;for(var n=0;n<t.length;n++){var s=t.charAt(n),a=s.charCodeAt(0);if(r[a]!==255)throw new TypeError(s+" is ambiguous");r[a]=n}var u=t.length,h=t.charAt(0),l=Math.log(u)/Math.log(256),b=Math.log(256)/Math.log(u);function w(D){if(D instanceof Uint8Array||(ArrayBuffer.isView(D)?D=new Uint8Array(D.buffer,D.byteOffset,D.byteLength):Array.isArray(D)&&(D=Uint8Array.from(D))),!(D instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(D.length===0)return"";for(var T=0,q=0,K=0,F=D.length;K!==F&&D[K]===0;)K++,T++;for(var W=(F-K)*b+1>>>0,R=new Uint8Array(W);K!==F;){for(var k=D[K],H=0,_=W-1;(k!==0||H<q)&&_!==-1;_--,H++)k+=256*R[_]>>>0,R[_]=k%u>>>0,k=k/u>>>0;if(k!==0)throw new Error("Non-zero carry");q=H,K++}for(var B=W-q;B!==W&&R[B]===0;)B++;for(var ee=h.repeat(T);B<W;++B)ee+=t.charAt(R[B]);return ee}function I(D){if(typeof D!="string")throw new TypeError("Expected String");if(D.length===0)return new Uint8Array;var T=0;if(D[T]!==" "){for(var q=0,K=0;D[T]===h;)q++,T++;for(var F=(D.length-T)*l+1>>>0,W=new Uint8Array(F);D[T];){var R=r[D.charCodeAt(T)];if(R===255)return;for(var k=0,H=F-1;(R!==0||k<K)&&H!==-1;H--,k++)R+=u*W[H]>>>0,W[H]=R%256>>>0,R=R/256>>>0;if(R!==0)throw new Error("Non-zero carry");K=k,T++}if(D[T]!==" "){for(var _=F-K;_!==F&&W[_]===0;)_++;for(var B=new Uint8Array(q+(F-_)),ee=q;_!==F;)B[ee++]=W[_++];return B}}}function S(D){var T=I(D);if(T)return T;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:I,decode:S}}var V8=W8,G8=V8;const Dv=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},J8=t=>new TextEncoder().encode(t),Y8=t=>new TextDecoder().decode(t);class Q8{constructor(e,r,i){this.name=e,this.prefix=r,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Z8{constructor(e,r,i){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=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 Ov(this,e)}}class X8{constructor(e){this.decoders=e}or(e){return Ov(this,e)}decode(e){const r=e[0],i=this.decoders[r];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 Ov=(t,e)=>new X8({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class e7{constructor(e,r,i,n){this.name=e,this.prefix=r,this.baseEncode=i,this.baseDecode=n,this.encoder=new Q8(e,r,i),this.decoder=new Z8(e,r,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Tf=({name:t,prefix:e,encode:r,decode:i})=>new e7(t,e,r,i),tu=({prefix:t,name:e,alphabet:r})=>{const{encode:i,decode:n}=G8(r,e);return Tf({prefix:t,name:e,encode:i,decode:s=>Dv(n(s))})},t7=(t,e,r,i)=>{const n={};for(let b=0;b<e.length;++b)n[e[b]]=b;let s=t.length;for(;t[s-1]==="=";)--s;const a=new Uint8Array(s*r/8|0);let u=0,h=0,l=0;for(let b=0;b<s;++b){const w=n[t[b]];if(w===void 0)throw new SyntaxError(`Non-${i} character`);h=h<<r|w,u+=r,u>=8&&(u-=8,a[l++]=255&h>>u)}if(u>=r||255&h<<8-u)throw new SyntaxError("Unexpected end of data");return a},r7=(t,e,r)=>{const i=e[e.length-1]==="=",n=(1<<r)-1;let s="",a=0,u=0;for(let h=0;h<t.length;++h)for(u=u<<8|t[h],a+=8;a>r;)a-=r,s+=e[n&u>>a];if(a&&(s+=e[n&u<<r-a]),i)for(;s.length*r&7;)s+="=";return s},qr=({name:t,prefix:e,bitsPerChar:r,alphabet:i})=>Tf({prefix:e,name:t,encode(n){return r7(n,i,r)},decode(n){return t7(n,i,r,t)}}),i7=Tf({prefix:"\0",name:"identity",encode:t=>Y8(t),decode:t=>J8(t)});var n7=Object.freeze({__proto__:null,identity:i7});const s7=qr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var o7=Object.freeze({__proto__:null,base2:s7});const a7=qr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var c7=Object.freeze({__proto__:null,base8:a7});const u7=tu({prefix:"9",name:"base10",alphabet:"0123456789"});var f7=Object.freeze({__proto__:null,base10:u7});const h7=qr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),l7=qr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var d7=Object.freeze({__proto__:null,base16:h7,base16upper:l7});const p7=qr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),g7=qr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),v7=qr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),m7=qr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),b7=qr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),y7=qr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),w7=qr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),_7=qr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),E7=qr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var A7=Object.freeze({__proto__:null,base32:p7,base32upper:g7,base32pad:v7,base32padupper:m7,base32hex:b7,base32hexupper:y7,base32hexpad:w7,base32hexpadupper:_7,base32z:E7});const x7=tu({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),S7=tu({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var I7=Object.freeze({__proto__:null,base36:x7,base36upper:S7});const M7=tu({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),C7=tu({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var D7=Object.freeze({__proto__:null,base58btc:M7,base58flickr:C7});const O7=qr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),P7=qr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),$7=qr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),R7=qr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var N7=Object.freeze({__proto__:null,base64:O7,base64pad:P7,base64url:$7,base64urlpad:R7});const Pv=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}"),T7=Pv.reduce((t,e,r)=>(t[r]=e,t),[]),L7=Pv.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function B7(t){return t.reduce((e,r)=>(e+=T7[r],e),"")}function F7(t){const e=[];for(const r of t){const i=L7[r.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(i)}return new Uint8Array(e)}const U7=Tf({prefix:"\u{1F680}",name:"base256emoji",encode:B7,decode:F7});var k7=Object.freeze({__proto__:null,base256emoji:U7}),q7=Rv,$v=128,j7=127,z7=~j7,H7=Math.pow(2,31);function Rv(t,e,r){e=e||[],r=r||0;for(var i=r;t>=H7;)e[r++]=t&255|$v,t/=128;for(;t&z7;)e[r++]=t&255|$v,t>>>=7;return e[r]=t|0,Rv.bytes=r-i+1,e}var K7=F0,W7=128,Nv=127;function F0(t,i){var r=0,i=i||0,n=0,s=i,a,u=t.length;do{if(s>=u)throw F0.bytes=0,new RangeError("Could not decode varint");a=t[s++],r+=n<28?(a&Nv)<<n:(a&Nv)*Math.pow(2,n),n+=7}while(a>=W7);return F0.bytes=s-i,r}var V7=Math.pow(2,7),G7=Math.pow(2,14),J7=Math.pow(2,21),Y7=Math.pow(2,28),Q7=Math.pow(2,35),Z7=Math.pow(2,42),X7=Math.pow(2,49),e9=Math.pow(2,56),t9=Math.pow(2,63),r9=function(t){return t<V7?1:t<G7?2:t<J7?3:t<Y7?4:t<Q7?5:t<Z7?6:t<X7?7:t<e9?8:t<t9?9:10},i9={encode:q7,decode:K7,encodingLength:r9},Tv=i9;const Lv=(t,e,r=0)=>(Tv.encode(t,e,r),e),Bv=t=>Tv.encodingLength(t),U0=(t,e)=>{const r=e.byteLength,i=Bv(t),n=i+Bv(r),s=new Uint8Array(n+r);return Lv(t,s,0),Lv(r,s,i),s.set(e,n),new n9(t,r,e,s)};class n9{constructor(e,r,i,n){this.code=e,this.size=r,this.digest=i,this.bytes=n}}const Fv=({name:t,code:e,encode:r})=>new s9(t,e,r);class s9{constructor(e,r,i){this.name=e,this.code=r,this.encode=i}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?U0(this.code,r):r.then(i=>U0(this.code,i))}else throw Error("Unknown type, must be binary type")}}const Uv=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),o9=Fv({name:"sha2-256",code:18,encode:Uv("SHA-256")}),a9=Fv({name:"sha2-512",code:19,encode:Uv("SHA-512")});var c9=Object.freeze({__proto__:null,sha256:o9,sha512:a9});const kv=0,u9="identity",qv=Dv;var f9=Object.freeze({__proto__:null,identity:{code:kv,name:u9,encode:qv,digest:t=>U0(kv,qv(t))}});new TextEncoder,new TextDecoder;const Ra={...n7,...o7,...c7,...f7,...d7,...A7,...I7,...D7,...N7,...k7};({...c9,...f9});function jv(t,e,r,i){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:i}}}const zv=jv("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),k0=jv("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=Cv(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Hv={utf8:zv,"utf-8":zv,hex:Ra.base16,latin1:k0,ascii:k0,binary:k0,...Ra};function Gi(t,e="utf8"){const r=Hv[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):r.decoder.decode(`${r.prefix}${t}`)}function Ti(t,e="utf8"){const r=Hv[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}var Kv={},h9="elliptic",l9="6.5.7",d9="EC cryptography",p9="lib/elliptic.js",g9=["lib"],v9={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/"},m9={type:"git",url:"git@github.com:indutny/elliptic"},b9=["EC","Elliptic","curve","Cryptography"],y9="Fedor Indutny <fedor@indutny.com>",w9="MIT",_9={url:"https://github.com/indutny/elliptic/issues"},E9="https://github.com/indutny/elliptic",A9={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"},x9={"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"},S9={name:h9,version:l9,description:d9,main:p9,files:g9,scripts:v9,repository:m9,keywords:b9,author:y9,license:w9,bugs:_9,homepage:E9,devDependencies:A9,dependencies:x9},Li={},jn={exports:{}};(function(t){(function(e,r){function i(L,y){if(!L)throw new Error(y||"Assertion failed")}function n(L,y){L.super_=y;var f=function(){};f.prototype=y.prototype,L.prototype=new f,L.prototype.constructor=L}function s(L,y,f){if(s.isBN(L))return L;this.negative=0,this.words=null,this.length=0,this.red=null,L!==null&&((y==="le"||y==="be")&&(f=y,y=10),this._init(L||0,y||10,f||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=T0.Buffer}catch{}s.isBN=function(y){return y instanceof s?!0:y!==null&&typeof y=="object"&&y.constructor.wordSize===s.wordSize&&Array.isArray(y.words)},s.max=function(y,f){return y.cmp(f)>0?y:f},s.min=function(y,f){return y.cmp(f)<0?y:f},s.prototype._init=function(y,f,d){if(typeof y=="number")return this._initNumber(y,f,d);if(typeof y=="object")return this._initArray(y,f,d);f==="hex"&&(f=16),i(f===(f|0)&&f>=2&&f<=36),y=y.toString().replace(/\s+/g,"");var v=0;y[0]==="-"&&(v++,this.negative=1),v<y.length&&(f===16?this._parseHex(y,v,d):(this._parseBase(y,f,v),d==="le"&&this._initArray(this.toArray(),f,d)))},s.prototype._initNumber=function(y,f,d){y<0&&(this.negative=1,y=-y),y<67108864?(this.words=[y&67108863],this.length=1):y<4503599627370496?(this.words=[y&67108863,y/67108864&67108863],this.length=2):(i(y<9007199254740992),this.words=[y&67108863,y/67108864&67108863,1],this.length=3),d==="le"&&this._initArray(this.toArray(),f,d)},s.prototype._initArray=function(y,f,d){if(i(typeof y.length=="number"),y.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(y.length/3),this.words=new Array(this.length);for(var v=0;v<this.length;v++)this.words[v]=0;var E,C,O=0;if(d==="be")for(v=y.length-1,E=0;v>=0;v-=3)C=y[v]|y[v-1]<<8|y[v-2]<<16,this.words[E]|=C<<O&67108863,this.words[E+1]=C>>>26-O&67108863,O+=24,O>=26&&(O-=26,E++);else if(d==="le")for(v=0,E=0;v<y.length;v+=3)C=y[v]|y[v+1]<<8|y[v+2]<<16,this.words[E]|=C<<O&67108863,this.words[E+1]=C>>>26-O&67108863,O+=24,O>=26&&(O-=26,E++);return this.strip()};function u(L,y){var f=L.charCodeAt(y);return f>=65&&f<=70?f-55:f>=97&&f<=102?f-87:f-48&15}function h(L,y,f){var d=u(L,f);return f-1>=y&&(d|=u(L,f-1)<<4),d}s.prototype._parseHex=function(y,f,d){this.length=Math.ceil((y.length-f)/6),this.words=new Array(this.length);for(var v=0;v<this.length;v++)this.words[v]=0;var E=0,C=0,O;if(d==="be")for(v=y.length-1;v>=f;v-=2)O=h(y,f,v)<<E,this.words[C]|=O&67108863,E>=18?(E-=18,C+=1,this.words[C]|=O>>>26):E+=8;else{var M=y.length-f;for(v=M%2===0?f+1:f;v<y.length;v+=2)O=h(y,f,v)<<E,this.words[C]|=O&67108863,E>=18?(E-=18,C+=1,this.words[C]|=O>>>26):E+=8}this.strip()};function l(L,y,f,d){for(var v=0,E=Math.min(L.length,f),C=y;C<E;C++){var O=L.charCodeAt(C)-48;v*=d,O>=49?v+=O-49+10:O>=17?v+=O-17+10:v+=O}return v}s.prototype._parseBase=function(y,f,d){this.words=[0],this.length=1;for(var v=0,E=1;E<=67108863;E*=f)v++;v--,E=E/f|0;for(var C=y.length-d,O=C%v,M=Math.min(C,C-O)+d,g=0,m=d;m<M;m+=v)g=l(y,m,m+v,f),this.imuln(E),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g);if(O!==0){var N=1;for(g=l(y,m,y.length,f),m=0;m<O;m++)N*=f;this.imuln(N),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g)}this.strip()},s.prototype.copy=function(y){y.words=new Array(this.length);for(var f=0;f<this.length;f++)y.words[f]=this.words[f];y.length=this.length,y.negative=this.negative,y.red=this.red},s.prototype.clone=function(){var y=new s(null);return this.copy(y),y},s.prototype._expand=function(y){for(;this.length<y;)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 b=["","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],I=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(y,f){y=y||10,f=f|0||1;var d;if(y===16||y==="hex"){d="";for(var v=0,E=0,C=0;C<this.length;C++){var O=this.words[C],M=((O<<v|E)&16777215).toString(16);E=O>>>24-v&16777215,E!==0||C!==this.length-1?d=b[6-M.length]+M+d:d=M+d,v+=2,v>=26&&(v-=26,C--)}for(E!==0&&(d=E.toString(16)+d);d.length%f!==0;)d="0"+d;return this.negative!==0&&(d="-"+d),d}if(y===(y|0)&&y>=2&&y<=36){var g=w[y],m=I[y];d="";var N=this.clone();for(N.negative=0;!N.isZero();){var X=N.modn(m).toString(y);N=N.idivn(m),N.isZero()?d=X+d:d=b[g-X.length]+X+d}for(this.isZero()&&(d="0"+d);d.length%f!==0;)d="0"+d;return this.negative!==0&&(d="-"+d),d}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var y=this.words[0];return this.length===2?y+=this.words[1]*67108864:this.length===3&&this.words[2]===1?y+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-y:y},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(y,f){return i(typeof a<"u"),this.toArrayLike(a,y,f)},s.prototype.toArray=function(y,f){return this.toArrayLike(Array,y,f)},s.prototype.toArrayLike=function(y,f,d){var v=this.byteLength(),E=d||Math.max(1,v);i(v<=E,"byte array longer than desired length"),i(E>0,"Requested array length <= 0"),this.strip();var C=f==="le",O=new y(E),M,g,m=this.clone();if(C){for(g=0;!m.isZero();g++)M=m.andln(255),m.iushrn(8),O[g]=M;for(;g<E;g++)O[g]=0}else{for(g=0;g<E-v;g++)O[g]=0;for(g=0;!m.isZero();g++)M=m.andln(255),m.iushrn(8),O[E-g-1]=M}return O},Math.clz32?s.prototype._countBits=function(y){return 32-Math.clz32(y)}:s.prototype._countBits=function(y){var f=y,d=0;return f>=4096&&(d+=13,f>>>=13),f>=64&&(d+=7,f>>>=7),f>=8&&(d+=4,f>>>=4),f>=2&&(d+=2,f>>>=2),d+f},s.prototype._zeroBits=function(y){if(y===0)return 26;var f=y,d=0;return f&8191||(d+=13,f>>>=13),f&127||(d+=7,f>>>=7),f&15||(d+=4,f>>>=4),f&3||(d+=2,f>>>=2),f&1||d++,d},s.prototype.bitLength=function(){var y=this.words[this.length-1],f=this._countBits(y);return(this.length-1)*26+f};function S(L){for(var y=new Array(L.bitLength()),f=0;f<y.length;f++){var d=f/26|0,v=f%26;y[f]=(L.words[d]&1<<v)>>>v}return y}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var y=0,f=0;f<this.length;f++){var d=this._zeroBits(this.words[f]);if(y+=d,d!==26)break}return y},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(y){return this.negative!==0?this.abs().inotn(y).iaddn(1):this.clone()},s.prototype.fromTwos=function(y){return this.testn(y-1)?this.notn(y).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(y){for(;this.length<y.length;)this.words[this.length++]=0;for(var f=0;f<y.length;f++)this.words[f]=this.words[f]|y.words[f];return this.strip()},s.prototype.ior=function(y){return i((this.negative|y.negative)===0),this.iuor(y)},s.prototype.or=function(y){return this.length>y.length?this.clone().ior(y):y.clone().ior(this)},s.prototype.uor=function(y){return this.length>y.length?this.clone().iuor(y):y.clone().iuor(this)},s.prototype.iuand=function(y){var f;this.length>y.length?f=y:f=this;for(var d=0;d<f.length;d++)this.words[d]=this.words[d]&y.words[d];return this.length=f.length,this.strip()},s.prototype.iand=function(y){return i((this.negative|y.negative)===0),this.iuand(y)},s.prototype.and=function(y){return this.length>y.length?this.clone().iand(y):y.clone().iand(this)},s.prototype.uand=function(y){return this.length>y.length?this.clone().iuand(y):y.clone().iuand(this)},s.prototype.iuxor=function(y){var f,d;this.length>y.length?(f=this,d=y):(f=y,d=this);for(var v=0;v<d.length;v++)this.words[v]=f.words[v]^d.words[v];if(this!==f)for(;v<f.length;v++)this.words[v]=f.words[v];return this.length=f.length,this.strip()},s.prototype.ixor=function(y){return i((this.negative|y.negative)===0),this.iuxor(y)},s.prototype.xor=function(y){return this.length>y.length?this.clone().ixor(y):y.clone().ixor(this)},s.prototype.uxor=function(y){return this.length>y.length?this.clone().iuxor(y):y.clone().iuxor(this)},s.prototype.inotn=function(y){i(typeof y=="number"&&y>=0);var f=Math.ceil(y/26)|0,d=y%26;this._expand(f),d>0&&f--;for(var v=0;v<f;v++)this.words[v]=~this.words[v]&67108863;return d>0&&(this.words[v]=~this.words[v]&67108863>>26-d),this.strip()},s.prototype.notn=function(y){return this.clone().inotn(y)},s.prototype.setn=function(y,f){i(typeof y=="number"&&y>=0);var d=y/26|0,v=y%26;return this._expand(d+1),f?this.words[d]=this.words[d]|1<<v:this.words[d]=this.words[d]&~(1<<v),this.strip()},s.prototype.iadd=function(y){var f;if(this.negative!==0&&y.negative===0)return this.negative=0,f=this.isub(y),this.negative^=1,this._normSign();if(this.negative===0&&y.negative!==0)return y.negative=0,f=this.isub(y),y.negative=1,f._normSign();var d,v;this.length>y.length?(d=this,v=y):(d=y,v=this);for(var E=0,C=0;C<v.length;C++)f=(d.words[C]|0)+(v.words[C]|0)+E,this.words[C]=f&67108863,E=f>>>26;for(;E!==0&&C<d.length;C++)f=(d.words[C]|0)+E,this.words[C]=f&67108863,E=f>>>26;if(this.length=d.length,E!==0)this.words[this.length]=E,this.length++;else if(d!==this)for(;C<d.length;C++)this.words[C]=d.words[C];return this},s.prototype.add=function(y){var f;return y.negative!==0&&this.negative===0?(y.negative=0,f=this.sub(y),y.negative^=1,f):y.negative===0&&this.negative!==0?(this.negative=0,f=y.sub(this),this.negative=1,f):this.length>y.length?this.clone().iadd(y):y.clone().iadd(this)},s.prototype.isub=function(y){if(y.negative!==0){y.negative=0;var f=this.iadd(y);return y.negative=1,f._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(y),this.negative=1,this._normSign();var d=this.cmp(y);if(d===0)return this.negative=0,this.length=1,this.words[0]=0,this;var v,E;d>0?(v=this,E=y):(v=y,E=this);for(var C=0,O=0;O<E.length;O++)f=(v.words[O]|0)-(E.words[O]|0)+C,C=f>>26,this.words[O]=f&67108863;for(;C!==0&&O<v.length;O++)f=(v.words[O]|0)+C,C=f>>26,this.words[O]=f&67108863;if(C===0&&O<v.length&&v!==this)for(;O<v.length;O++)this.words[O]=v.words[O];return this.length=Math.max(this.length,O),v!==this&&(this.negative=1),this.strip()},s.prototype.sub=function(y){return this.clone().isub(y)};function D(L,y,f){f.negative=y.negative^L.negative;var d=L.length+y.length|0;f.length=d,d=d-1|0;var v=L.words[0]|0,E=y.words[0]|0,C=v*E,O=C&67108863,M=C/67108864|0;f.words[0]=O;for(var g=1;g<d;g++){for(var m=M>>>26,N=M&67108863,X=Math.min(g,y.length-1),ae=Math.max(0,g-L.length+1);ae<=X;ae++){var P=g-ae|0;v=L.words[P]|0,E=y.words[ae]|0,C=v*E+N,m+=C/67108864|0,N=C&67108863}f.words[g]=N|0,M=m|0}return M!==0?f.words[g]=M|0:f.length--,f.strip()}var T=function(y,f,d){var v=y.words,E=f.words,C=d.words,O=0,M,g,m,N=v[0]|0,X=N&8191,ae=N>>>13,P=v[1]|0,te=P&8191,z=P>>>13,G=v[2]|0,J=G&8191,A=G>>>13,V=v[3]|0,oe=V&8191,ue=V>>>13,he=v[4]|0,ye=he&8191,we=he>>>13,Re=v[5]|0,Xe=Re&8191,Oe=Re>>>13,Ne=v[6]|0,Me=Ne&8191,be=Ne>>>13,Pe=v[7]|0,Te=Pe&8191,ve=Pe>>>13,$e=v[8]|0,Se=$e&8191,me=$e>>>13,Ue=v[9]|0,Ce=Ue&8191,_e=Ue>>>13,Ke=E[0]|0,Ve=Ke&8191,Ae=Ke>>>13,We=E[1]|0,pt=We&8191,Ge=We>>>13,It=E[2]|0,gt=It&8191,Ye=It>>>13,Ot=E[3]|0,Tt=Ot&8191,Le=Ot>>>13,et=E[4]|0,it=et&8191,Be=et>>>13,rt=E[5]|0,tt=rt&8191,qe=rt>>>13,ht=E[6]|0,nt=ht&8191,je=ht>>>13,st=E[7]|0,at=st&8191,Fe=st>>>13,Ze=E[8]|0,lt=Ze&8191,ze=Ze>>>13,qt=E[9]|0,jt=qt&8191,ct=qt>>>13;d.negative=y.negative^f.negative,d.length=19,M=Math.imul(X,Ve),g=Math.imul(X,Ae),g=g+Math.imul(ae,Ve)|0,m=Math.imul(ae,Ae);var _t=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(_t>>>26)|0,_t&=67108863,M=Math.imul(te,Ve),g=Math.imul(te,Ae),g=g+Math.imul(z,Ve)|0,m=Math.imul(z,Ae),M=M+Math.imul(X,pt)|0,g=g+Math.imul(X,Ge)|0,g=g+Math.imul(ae,pt)|0,m=m+Math.imul(ae,Ge)|0;var Zr=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,M=Math.imul(J,Ve),g=Math.imul(J,Ae),g=g+Math.imul(A,Ve)|0,m=Math.imul(A,Ae),M=M+Math.imul(te,pt)|0,g=g+Math.imul(te,Ge)|0,g=g+Math.imul(z,pt)|0,m=m+Math.imul(z,Ge)|0,M=M+Math.imul(X,gt)|0,g=g+Math.imul(X,Ye)|0,g=g+Math.imul(ae,gt)|0,m=m+Math.imul(ae,Ye)|0;var Xr=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,M=Math.imul(oe,Ve),g=Math.imul(oe,Ae),g=g+Math.imul(ue,Ve)|0,m=Math.imul(ue,Ae),M=M+Math.imul(J,pt)|0,g=g+Math.imul(J,Ge)|0,g=g+Math.imul(A,pt)|0,m=m+Math.imul(A,Ge)|0,M=M+Math.imul(te,gt)|0,g=g+Math.imul(te,Ye)|0,g=g+Math.imul(z,gt)|0,m=m+Math.imul(z,Ye)|0,M=M+Math.imul(X,Tt)|0,g=g+Math.imul(X,Le)|0,g=g+Math.imul(ae,Tt)|0,m=m+Math.imul(ae,Le)|0;var ei=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(ei>>>26)|0,ei&=67108863,M=Math.imul(ye,Ve),g=Math.imul(ye,Ae),g=g+Math.imul(we,Ve)|0,m=Math.imul(we,Ae),M=M+Math.imul(oe,pt)|0,g=g+Math.imul(oe,Ge)|0,g=g+Math.imul(ue,pt)|0,m=m+Math.imul(ue,Ge)|0,M=M+Math.imul(J,gt)|0,g=g+Math.imul(J,Ye)|0,g=g+Math.imul(A,gt)|0,m=m+Math.imul(A,Ye)|0,M=M+Math.imul(te,Tt)|0,g=g+Math.imul(te,Le)|0,g=g+Math.imul(z,Tt)|0,m=m+Math.imul(z,Le)|0,M=M+Math.imul(X,it)|0,g=g+Math.imul(X,Be)|0,g=g+Math.imul(ae,it)|0,m=m+Math.imul(ae,Be)|0;var ti=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(ti>>>26)|0,ti&=67108863,M=Math.imul(Xe,Ve),g=Math.imul(Xe,Ae),g=g+Math.imul(Oe,Ve)|0,m=Math.imul(Oe,Ae),M=M+Math.imul(ye,pt)|0,g=g+Math.imul(ye,Ge)|0,g=g+Math.imul(we,pt)|0,m=m+Math.imul(we,Ge)|0,M=M+Math.imul(oe,gt)|0,g=g+Math.imul(oe,Ye)|0,g=g+Math.imul(ue,gt)|0,m=m+Math.imul(ue,Ye)|0,M=M+Math.imul(J,Tt)|0,g=g+Math.imul(J,Le)|0,g=g+Math.imul(A,Tt)|0,m=m+Math.imul(A,Le)|0,M=M+Math.imul(te,it)|0,g=g+Math.imul(te,Be)|0,g=g+Math.imul(z,it)|0,m=m+Math.imul(z,Be)|0,M=M+Math.imul(X,tt)|0,g=g+Math.imul(X,qe)|0,g=g+Math.imul(ae,tt)|0,m=m+Math.imul(ae,qe)|0;var ri=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(ri>>>26)|0,ri&=67108863,M=Math.imul(Me,Ve),g=Math.imul(Me,Ae),g=g+Math.imul(be,Ve)|0,m=Math.imul(be,Ae),M=M+Math.imul(Xe,pt)|0,g=g+Math.imul(Xe,Ge)|0,g=g+Math.imul(Oe,pt)|0,m=m+Math.imul(Oe,Ge)|0,M=M+Math.imul(ye,gt)|0,g=g+Math.imul(ye,Ye)|0,g=g+Math.imul(we,gt)|0,m=m+Math.imul(we,Ye)|0,M=M+Math.imul(oe,Tt)|0,g=g+Math.imul(oe,Le)|0,g=g+Math.imul(ue,Tt)|0,m=m+Math.imul(ue,Le)|0,M=M+Math.imul(J,it)|0,g=g+Math.imul(J,Be)|0,g=g+Math.imul(A,it)|0,m=m+Math.imul(A,Be)|0,M=M+Math.imul(te,tt)|0,g=g+Math.imul(te,qe)|0,g=g+Math.imul(z,tt)|0,m=m+Math.imul(z,qe)|0,M=M+Math.imul(X,nt)|0,g=g+Math.imul(X,je)|0,g=g+Math.imul(ae,nt)|0,m=m+Math.imul(ae,je)|0;var vr=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(vr>>>26)|0,vr&=67108863,M=Math.imul(Te,Ve),g=Math.imul(Te,Ae),g=g+Math.imul(ve,Ve)|0,m=Math.imul(ve,Ae),M=M+Math.imul(Me,pt)|0,g=g+Math.imul(Me,Ge)|0,g=g+Math.imul(be,pt)|0,m=m+Math.imul(be,Ge)|0,M=M+Math.imul(Xe,gt)|0,g=g+Math.imul(Xe,Ye)|0,g=g+Math.imul(Oe,gt)|0,m=m+Math.imul(Oe,Ye)|0,M=M+Math.imul(ye,Tt)|0,g=g+Math.imul(ye,Le)|0,g=g+Math.imul(we,Tt)|0,m=m+Math.imul(we,Le)|0,M=M+Math.imul(oe,it)|0,g=g+Math.imul(oe,Be)|0,g=g+Math.imul(ue,it)|0,m=m+Math.imul(ue,Be)|0,M=M+Math.imul(J,tt)|0,g=g+Math.imul(J,qe)|0,g=g+Math.imul(A,tt)|0,m=m+Math.imul(A,qe)|0,M=M+Math.imul(te,nt)|0,g=g+Math.imul(te,je)|0,g=g+Math.imul(z,nt)|0,m=m+Math.imul(z,je)|0,M=M+Math.imul(X,at)|0,g=g+Math.imul(X,Fe)|0,g=g+Math.imul(ae,at)|0,m=m+Math.imul(ae,Fe)|0;var Ii=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(Ii>>>26)|0,Ii&=67108863,M=Math.imul(Se,Ve),g=Math.imul(Se,Ae),g=g+Math.imul(me,Ve)|0,m=Math.imul(me,Ae),M=M+Math.imul(Te,pt)|0,g=g+Math.imul(Te,Ge)|0,g=g+Math.imul(ve,pt)|0,m=m+Math.imul(ve,Ge)|0,M=M+Math.imul(Me,gt)|0,g=g+Math.imul(Me,Ye)|0,g=g+Math.imul(be,gt)|0,m=m+Math.imul(be,Ye)|0,M=M+Math.imul(Xe,Tt)|0,g=g+Math.imul(Xe,Le)|0,g=g+Math.imul(Oe,Tt)|0,m=m+Math.imul(Oe,Le)|0,M=M+Math.imul(ye,it)|0,g=g+Math.imul(ye,Be)|0,g=g+Math.imul(we,it)|0,m=m+Math.imul(we,Be)|0,M=M+Math.imul(oe,tt)|0,g=g+Math.imul(oe,qe)|0,g=g+Math.imul(ue,tt)|0,m=m+Math.imul(ue,qe)|0,M=M+Math.imul(J,nt)|0,g=g+Math.imul(J,je)|0,g=g+Math.imul(A,nt)|0,m=m+Math.imul(A,je)|0,M=M+Math.imul(te,at)|0,g=g+Math.imul(te,Fe)|0,g=g+Math.imul(z,at)|0,m=m+Math.imul(z,Fe)|0,M=M+Math.imul(X,lt)|0,g=g+Math.imul(X,ze)|0,g=g+Math.imul(ae,lt)|0,m=m+Math.imul(ae,ze)|0;var On=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(On>>>26)|0,On&=67108863,M=Math.imul(Ce,Ve),g=Math.imul(Ce,Ae),g=g+Math.imul(_e,Ve)|0,m=Math.imul(_e,Ae),M=M+Math.imul(Se,pt)|0,g=g+Math.imul(Se,Ge)|0,g=g+Math.imul(me,pt)|0,m=m+Math.imul(me,Ge)|0,M=M+Math.imul(Te,gt)|0,g=g+Math.imul(Te,Ye)|0,g=g+Math.imul(ve,gt)|0,m=m+Math.imul(ve,Ye)|0,M=M+Math.imul(Me,Tt)|0,g=g+Math.imul(Me,Le)|0,g=g+Math.imul(be,Tt)|0,m=m+Math.imul(be,Le)|0,M=M+Math.imul(Xe,it)|0,g=g+Math.imul(Xe,Be)|0,g=g+Math.imul(Oe,it)|0,m=m+Math.imul(Oe,Be)|0,M=M+Math.imul(ye,tt)|0,g=g+Math.imul(ye,qe)|0,g=g+Math.imul(we,tt)|0,m=m+Math.imul(we,qe)|0,M=M+Math.imul(oe,nt)|0,g=g+Math.imul(oe,je)|0,g=g+Math.imul(ue,nt)|0,m=m+Math.imul(ue,je)|0,M=M+Math.imul(J,at)|0,g=g+Math.imul(J,Fe)|0,g=g+Math.imul(A,at)|0,m=m+Math.imul(A,Fe)|0,M=M+Math.imul(te,lt)|0,g=g+Math.imul(te,ze)|0,g=g+Math.imul(z,lt)|0,m=m+Math.imul(z,ze)|0,M=M+Math.imul(X,jt)|0,g=g+Math.imul(X,ct)|0,g=g+Math.imul(ae,jt)|0,m=m+Math.imul(ae,ct)|0;var Mi=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(Mi>>>26)|0,Mi&=67108863,M=Math.imul(Ce,pt),g=Math.imul(Ce,Ge),g=g+Math.imul(_e,pt)|0,m=Math.imul(_e,Ge),M=M+Math.imul(Se,gt)|0,g=g+Math.imul(Se,Ye)|0,g=g+Math.imul(me,gt)|0,m=m+Math.imul(me,Ye)|0,M=M+Math.imul(Te,Tt)|0,g=g+Math.imul(Te,Le)|0,g=g+Math.imul(ve,Tt)|0,m=m+Math.imul(ve,Le)|0,M=M+Math.imul(Me,it)|0,g=g+Math.imul(Me,Be)|0,g=g+Math.imul(be,it)|0,m=m+Math.imul(be,Be)|0,M=M+Math.imul(Xe,tt)|0,g=g+Math.imul(Xe,qe)|0,g=g+Math.imul(Oe,tt)|0,m=m+Math.imul(Oe,qe)|0,M=M+Math.imul(ye,nt)|0,g=g+Math.imul(ye,je)|0,g=g+Math.imul(we,nt)|0,m=m+Math.imul(we,je)|0,M=M+Math.imul(oe,at)|0,g=g+Math.imul(oe,Fe)|0,g=g+Math.imul(ue,at)|0,m=m+Math.imul(ue,Fe)|0,M=M+Math.imul(J,lt)|0,g=g+Math.imul(J,ze)|0,g=g+Math.imul(A,lt)|0,m=m+Math.imul(A,ze)|0,M=M+Math.imul(te,jt)|0,g=g+Math.imul(te,ct)|0,g=g+Math.imul(z,jt)|0,m=m+Math.imul(z,ct)|0;var Pn=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,M=Math.imul(Ce,gt),g=Math.imul(Ce,Ye),g=g+Math.imul(_e,gt)|0,m=Math.imul(_e,Ye),M=M+Math.imul(Se,Tt)|0,g=g+Math.imul(Se,Le)|0,g=g+Math.imul(me,Tt)|0,m=m+Math.imul(me,Le)|0,M=M+Math.imul(Te,it)|0,g=g+Math.imul(Te,Be)|0,g=g+Math.imul(ve,it)|0,m=m+Math.imul(ve,Be)|0,M=M+Math.imul(Me,tt)|0,g=g+Math.imul(Me,qe)|0,g=g+Math.imul(be,tt)|0,m=m+Math.imul(be,qe)|0,M=M+Math.imul(Xe,nt)|0,g=g+Math.imul(Xe,je)|0,g=g+Math.imul(Oe,nt)|0,m=m+Math.imul(Oe,je)|0,M=M+Math.imul(ye,at)|0,g=g+Math.imul(ye,Fe)|0,g=g+Math.imul(we,at)|0,m=m+Math.imul(we,Fe)|0,M=M+Math.imul(oe,lt)|0,g=g+Math.imul(oe,ze)|0,g=g+Math.imul(ue,lt)|0,m=m+Math.imul(ue,ze)|0,M=M+Math.imul(J,jt)|0,g=g+Math.imul(J,ct)|0,g=g+Math.imul(A,jt)|0,m=m+Math.imul(A,ct)|0;var $n=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+($n>>>26)|0,$n&=67108863,M=Math.imul(Ce,Tt),g=Math.imul(Ce,Le),g=g+Math.imul(_e,Tt)|0,m=Math.imul(_e,Le),M=M+Math.imul(Se,it)|0,g=g+Math.imul(Se,Be)|0,g=g+Math.imul(me,it)|0,m=m+Math.imul(me,Be)|0,M=M+Math.imul(Te,tt)|0,g=g+Math.imul(Te,qe)|0,g=g+Math.imul(ve,tt)|0,m=m+Math.imul(ve,qe)|0,M=M+Math.imul(Me,nt)|0,g=g+Math.imul(Me,je)|0,g=g+Math.imul(be,nt)|0,m=m+Math.imul(be,je)|0,M=M+Math.imul(Xe,at)|0,g=g+Math.imul(Xe,Fe)|0,g=g+Math.imul(Oe,at)|0,m=m+Math.imul(Oe,Fe)|0,M=M+Math.imul(ye,lt)|0,g=g+Math.imul(ye,ze)|0,g=g+Math.imul(we,lt)|0,m=m+Math.imul(we,ze)|0,M=M+Math.imul(oe,jt)|0,g=g+Math.imul(oe,ct)|0,g=g+Math.imul(ue,jt)|0,m=m+Math.imul(ue,ct)|0;var Ci=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(Ci>>>26)|0,Ci&=67108863,M=Math.imul(Ce,it),g=Math.imul(Ce,Be),g=g+Math.imul(_e,it)|0,m=Math.imul(_e,Be),M=M+Math.imul(Se,tt)|0,g=g+Math.imul(Se,qe)|0,g=g+Math.imul(me,tt)|0,m=m+Math.imul(me,qe)|0,M=M+Math.imul(Te,nt)|0,g=g+Math.imul(Te,je)|0,g=g+Math.imul(ve,nt)|0,m=m+Math.imul(ve,je)|0,M=M+Math.imul(Me,at)|0,g=g+Math.imul(Me,Fe)|0,g=g+Math.imul(be,at)|0,m=m+Math.imul(be,Fe)|0,M=M+Math.imul(Xe,lt)|0,g=g+Math.imul(Xe,ze)|0,g=g+Math.imul(Oe,lt)|0,m=m+Math.imul(Oe,ze)|0,M=M+Math.imul(ye,jt)|0,g=g+Math.imul(ye,ct)|0,g=g+Math.imul(we,jt)|0,m=m+Math.imul(we,ct)|0;var an=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(an>>>26)|0,an&=67108863,M=Math.imul(Ce,tt),g=Math.imul(Ce,qe),g=g+Math.imul(_e,tt)|0,m=Math.imul(_e,qe),M=M+Math.imul(Se,nt)|0,g=g+Math.imul(Se,je)|0,g=g+Math.imul(me,nt)|0,m=m+Math.imul(me,je)|0,M=M+Math.imul(Te,at)|0,g=g+Math.imul(Te,Fe)|0,g=g+Math.imul(ve,at)|0,m=m+Math.imul(ve,Fe)|0,M=M+Math.imul(Me,lt)|0,g=g+Math.imul(Me,ze)|0,g=g+Math.imul(be,lt)|0,m=m+Math.imul(be,ze)|0,M=M+Math.imul(Xe,jt)|0,g=g+Math.imul(Xe,ct)|0,g=g+Math.imul(Oe,jt)|0,m=m+Math.imul(Oe,ct)|0;var cn=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(cn>>>26)|0,cn&=67108863,M=Math.imul(Ce,nt),g=Math.imul(Ce,je),g=g+Math.imul(_e,nt)|0,m=Math.imul(_e,je),M=M+Math.imul(Se,at)|0,g=g+Math.imul(Se,Fe)|0,g=g+Math.imul(me,at)|0,m=m+Math.imul(me,Fe)|0,M=M+Math.imul(Te,lt)|0,g=g+Math.imul(Te,ze)|0,g=g+Math.imul(ve,lt)|0,m=m+Math.imul(ve,ze)|0,M=M+Math.imul(Me,jt)|0,g=g+Math.imul(Me,ct)|0,g=g+Math.imul(be,jt)|0,m=m+Math.imul(be,ct)|0;var Cr=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(Cr>>>26)|0,Cr&=67108863,M=Math.imul(Ce,at),g=Math.imul(Ce,Fe),g=g+Math.imul(_e,at)|0,m=Math.imul(_e,Fe),M=M+Math.imul(Se,lt)|0,g=g+Math.imul(Se,ze)|0,g=g+Math.imul(me,lt)|0,m=m+Math.imul(me,ze)|0,M=M+Math.imul(Te,jt)|0,g=g+Math.imul(Te,ct)|0,g=g+Math.imul(ve,jt)|0,m=m+Math.imul(ve,ct)|0;var Rn=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,M=Math.imul(Ce,lt),g=Math.imul(Ce,ze),g=g+Math.imul(_e,lt)|0,m=Math.imul(_e,ze),M=M+Math.imul(Se,jt)|0,g=g+Math.imul(Se,ct)|0,g=g+Math.imul(me,jt)|0,m=m+Math.imul(me,ct)|0;var Nn=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(Nn>>>26)|0,Nn&=67108863,M=Math.imul(Ce,jt),g=Math.imul(Ce,ct),g=g+Math.imul(_e,jt)|0,m=Math.imul(_e,ct);var Tn=(O+M|0)+((g&8191)<<13)|0;return O=(m+(g>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,C[0]=_t,C[1]=Zr,C[2]=Xr,C[3]=ei,C[4]=ti,C[5]=ri,C[6]=vr,C[7]=Ii,C[8]=On,C[9]=Mi,C[10]=Pn,C[11]=$n,C[12]=Ci,C[13]=an,C[14]=cn,C[15]=Cr,C[16]=Rn,C[17]=Nn,C[18]=Tn,O!==0&&(C[19]=O,d.length++),d};Math.imul||(T=D);function q(L,y,f){f.negative=y.negative^L.negative,f.length=L.length+y.length;for(var d=0,v=0,E=0;E<f.length-1;E++){var C=v;v=0;for(var O=d&67108863,M=Math.min(E,y.length-1),g=Math.max(0,E-L.length+1);g<=M;g++){var m=E-g,N=L.words[m]|0,X=y.words[g]|0,ae=N*X,P=ae&67108863;C=C+(ae/67108864|0)|0,P=P+O|0,O=P&67108863,C=C+(P>>>26)|0,v+=C>>>26,C&=67108863}f.words[E]=O,d=C,C=v}return d!==0?f.words[E]=d:f.length--,f.strip()}function K(L,y,f){var d=new F;return d.mulp(L,y,f)}s.prototype.mulTo=function(y,f){var d,v=this.length+y.length;return this.length===10&&y.length===10?d=T(this,y,f):v<63?d=D(this,y,f):v<1024?d=q(this,y,f):d=K(this,y,f),d};function F(L,y){this.x=L,this.y=y}F.prototype.makeRBT=function(y){for(var f=new Array(y),d=s.prototype._countBits(y)-1,v=0;v<y;v++)f[v]=this.revBin(v,d,y);return f},F.prototype.revBin=function(y,f,d){if(y===0||y===d-1)return y;for(var v=0,E=0;E<f;E++)v|=(y&1)<<f-E-1,y>>=1;return v},F.prototype.permute=function(y,f,d,v,E,C){for(var O=0;O<C;O++)v[O]=f[y[O]],E[O]=d[y[O]]},F.prototype.transform=function(y,f,d,v,E,C){this.permute(C,y,f,d,v,E);for(var O=1;O<E;O<<=1)for(var M=O<<1,g=Math.cos(2*Math.PI/M),m=Math.sin(2*Math.PI/M),N=0;N<E;N+=M)for(var X=g,ae=m,P=0;P<O;P++){var te=d[N+P],z=v[N+P],G=d[N+P+O],J=v[N+P+O],A=X*G-ae*J;J=X*J+ae*G,G=A,d[N+P]=te+G,v[N+P]=z+J,d[N+P+O]=te-G,v[N+P+O]=z-J,P!==M&&(A=g*X-m*ae,ae=g*ae+m*X,X=A)}},F.prototype.guessLen13b=function(y,f){var d=Math.max(f,y)|1,v=d&1,E=0;for(d=d/2|0;d;d=d>>>1)E++;return 1<<E+1+v},F.prototype.conjugate=function(y,f,d){if(!(d<=1))for(var v=0;v<d/2;v++){var E=y[v];y[v]=y[d-v-1],y[d-v-1]=E,E=f[v],f[v]=-f[d-v-1],f[d-v-1]=-E}},F.prototype.normalize13b=function(y,f){for(var d=0,v=0;v<f/2;v++){var E=Math.round(y[2*v+1]/f)*8192+Math.round(y[2*v]/f)+d;y[v]=E&67108863,E<67108864?d=0:d=E/67108864|0}return y},F.prototype.convert13b=function(y,f,d,v){for(var E=0,C=0;C<f;C++)E=E+(y[C]|0),d[2*C]=E&8191,E=E>>>13,d[2*C+1]=E&8191,E=E>>>13;for(C=2*f;C<v;++C)d[C]=0;i(E===0),i((E&-8192)===0)},F.prototype.stub=function(y){for(var f=new Array(y),d=0;d<y;d++)f[d]=0;return f},F.prototype.mulp=function(y,f,d){var v=2*this.guessLen13b(y.length,f.length),E=this.makeRBT(v),C=this.stub(v),O=new Array(v),M=new Array(v),g=new Array(v),m=new Array(v),N=new Array(v),X=new Array(v),ae=d.words;ae.length=v,this.convert13b(y.words,y.length,O,v),this.convert13b(f.words,f.length,m,v),this.transform(O,C,M,g,v,E),this.transform(m,C,N,X,v,E);for(var P=0;P<v;P++){var te=M[P]*N[P]-g[P]*X[P];g[P]=M[P]*X[P]+g[P]*N[P],M[P]=te}return this.conjugate(M,g,v),this.transform(M,g,ae,C,v,E),this.conjugate(ae,C,v),this.normalize13b(ae,v),d.negative=y.negative^f.negative,d.length=y.length+f.length,d.strip()},s.prototype.mul=function(y){var f=new s(null);return f.words=new Array(this.length+y.length),this.mulTo(y,f)},s.prototype.mulf=function(y){var f=new s(null);return f.words=new Array(this.length+y.length),K(this,y,f)},s.prototype.imul=function(y){return this.clone().mulTo(y,this)},s.prototype.imuln=function(y){i(typeof y=="number"),i(y<67108864);for(var f=0,d=0;d<this.length;d++){var v=(this.words[d]|0)*y,E=(v&67108863)+(f&67108863);f>>=26,f+=v/67108864|0,f+=E>>>26,this.words[d]=E&67108863}return f!==0&&(this.words[d]=f,this.length++),this},s.prototype.muln=function(y){return this.clone().imuln(y)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(y){var f=S(y);if(f.length===0)return new s(1);for(var d=this,v=0;v<f.length&&f[v]===0;v++,d=d.sqr());if(++v<f.length)for(var E=d.sqr();v<f.length;v++,E=E.sqr())f[v]!==0&&(d=d.mul(E));return d},s.prototype.iushln=function(y){i(typeof y=="number"&&y>=0);var f=y%26,d=(y-f)/26,v=67108863>>>26-f<<26-f,E;if(f!==0){var C=0;for(E=0;E<this.length;E++){var O=this.words[E]&v,M=(this.words[E]|0)-O<<f;this.words[E]=M|C,C=O>>>26-f}C&&(this.words[E]=C,this.length++)}if(d!==0){for(E=this.length-1;E>=0;E--)this.words[E+d]=this.words[E];for(E=0;E<d;E++)this.words[E]=0;this.length+=d}return this.strip()},s.prototype.ishln=function(y){return i(this.negative===0),this.iushln(y)},s.prototype.iushrn=function(y,f,d){i(typeof y=="number"&&y>=0);var v;f?v=(f-f%26)/26:v=0;var E=y%26,C=Math.min((y-E)/26,this.length),O=67108863^67108863>>>E<<E,M=d;if(v-=C,v=Math.max(0,v),M){for(var g=0;g<C;g++)M.words[g]=this.words[g];M.length=C}if(C!==0)if(this.length>C)for(this.length-=C,g=0;g<this.length;g++)this.words[g]=this.words[g+C];else this.words[0]=0,this.length=1;var m=0;for(g=this.length-1;g>=0&&(m!==0||g>=v);g--){var N=this.words[g]|0;this.words[g]=m<<26-E|N>>>E,m=N&O}return M&&m!==0&&(M.words[M.length++]=m),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(y,f,d){return i(this.negative===0),this.iushrn(y,f,d)},s.prototype.shln=function(y){return this.clone().ishln(y)},s.prototype.ushln=function(y){return this.clone().iushln(y)},s.prototype.shrn=function(y){return this.clone().ishrn(y)},s.prototype.ushrn=function(y){return this.clone().iushrn(y)},s.prototype.testn=function(y){i(typeof y=="number"&&y>=0);var f=y%26,d=(y-f)/26,v=1<<f;if(this.length<=d)return!1;var E=this.words[d];return!!(E&v)},s.prototype.imaskn=function(y){i(typeof y=="number"&&y>=0);var f=y%26,d=(y-f)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=d)return this;if(f!==0&&d++,this.length=Math.min(d,this.length),f!==0){var v=67108863^67108863>>>f<<f;this.words[this.length-1]&=v}return this.strip()},s.prototype.maskn=function(y){return this.clone().imaskn(y)},s.prototype.iaddn=function(y){return i(typeof y=="number"),i(y<67108864),y<0?this.isubn(-y):this.negative!==0?this.length===1&&(this.words[0]|0)<y?(this.words[0]=y-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(y),this.negative=1,this):this._iaddn(y)},s.prototype._iaddn=function(y){this.words[0]+=y;for(var f=0;f<this.length&&this.words[f]>=67108864;f++)this.words[f]-=67108864,f===this.length-1?this.words[f+1]=1:this.words[f+1]++;return this.length=Math.max(this.length,f+1),this},s.prototype.isubn=function(y){if(i(typeof y=="number"),i(y<67108864),y<0)return this.iaddn(-y);if(this.negative!==0)return this.negative=0,this.iaddn(y),this.negative=1,this;if(this.words[0]-=y,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var f=0;f<this.length&&this.words[f]<0;f++)this.words[f]+=67108864,this.words[f+1]-=1;return this.strip()},s.prototype.addn=function(y){return this.clone().iaddn(y)},s.prototype.subn=function(y){return this.clone().isubn(y)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(y,f,d){var v=y.length+d,E;this._expand(v);var C,O=0;for(E=0;E<y.length;E++){C=(this.words[E+d]|0)+O;var M=(y.words[E]|0)*f;C-=M&67108863,O=(C>>26)-(M/67108864|0),this.words[E+d]=C&67108863}for(;E<this.length-d;E++)C=(this.words[E+d]|0)+O,O=C>>26,this.words[E+d]=C&67108863;if(O===0)return this.strip();for(i(O===-1),O=0,E=0;E<this.length;E++)C=-(this.words[E]|0)+O,O=C>>26,this.words[E]=C&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(y,f){var d=this.length-y.length,v=this.clone(),E=y,C=E.words[E.length-1]|0,O=this._countBits(C);d=26-O,d!==0&&(E=E.ushln(d),v.iushln(d),C=E.words[E.length-1]|0);var M=v.length-E.length,g;if(f!=="mod"){g=new s(null),g.length=M+1,g.words=new Array(g.length);for(var m=0;m<g.length;m++)g.words[m]=0}var N=v.clone()._ishlnsubmul(E,1,M);N.negative===0&&(v=N,g&&(g.words[M]=1));for(var X=M-1;X>=0;X--){var ae=(v.words[E.length+X]|0)*67108864+(v.words[E.length+X-1]|0);for(ae=Math.min(ae/C|0,67108863),v._ishlnsubmul(E,ae,X);v.negative!==0;)ae--,v.negative=0,v._ishlnsubmul(E,1,X),v.isZero()||(v.negative^=1);g&&(g.words[X]=ae)}return g&&g.strip(),v.strip(),f!=="div"&&d!==0&&v.iushrn(d),{div:g||null,mod:v}},s.prototype.divmod=function(y,f,d){if(i(!y.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var v,E,C;return this.negative!==0&&y.negative===0?(C=this.neg().divmod(y,f),f!=="mod"&&(v=C.div.neg()),f!=="div"&&(E=C.mod.neg(),d&&E.negative!==0&&E.iadd(y)),{div:v,mod:E}):this.negative===0&&y.negative!==0?(C=this.divmod(y.neg(),f),f!=="mod"&&(v=C.div.neg()),{div:v,mod:C.mod}):this.negative&y.negative?(C=this.neg().divmod(y.neg(),f),f!=="div"&&(E=C.mod.neg(),d&&E.negative!==0&&E.isub(y)),{div:C.div,mod:E}):y.length>this.length||this.cmp(y)<0?{div:new s(0),mod:this}:y.length===1?f==="div"?{div:this.divn(y.words[0]),mod:null}:f==="mod"?{div:null,mod:new s(this.modn(y.words[0]))}:{div:this.divn(y.words[0]),mod:new s(this.modn(y.words[0]))}:this._wordDiv(y,f)},s.prototype.div=function(y){return this.divmod(y,"div",!1).div},s.prototype.mod=function(y){return this.divmod(y,"mod",!1).mod},s.prototype.umod=function(y){return this.divmod(y,"mod",!0).mod},s.prototype.divRound=function(y){var f=this.divmod(y);if(f.mod.isZero())return f.div;var d=f.div.negative!==0?f.mod.isub(y):f.mod,v=y.ushrn(1),E=y.andln(1),C=d.cmp(v);return C<0||E===1&&C===0?f.div:f.div.negative!==0?f.div.isubn(1):f.div.iaddn(1)},s.prototype.modn=function(y){i(y<=67108863);for(var f=(1<<26)%y,d=0,v=this.length-1;v>=0;v--)d=(f*d+(this.words[v]|0))%y;return d},s.prototype.idivn=function(y){i(y<=67108863);for(var f=0,d=this.length-1;d>=0;d--){var v=(this.words[d]|0)+f*67108864;this.words[d]=v/y|0,f=v%y}return this.strip()},s.prototype.divn=function(y){return this.clone().idivn(y)},s.prototype.egcd=function(y){i(y.negative===0),i(!y.isZero());var f=this,d=y.clone();f.negative!==0?f=f.umod(y):f=f.clone();for(var v=new s(1),E=new s(0),C=new s(0),O=new s(1),M=0;f.isEven()&&d.isEven();)f.iushrn(1),d.iushrn(1),++M;for(var g=d.clone(),m=f.clone();!f.isZero();){for(var N=0,X=1;!(f.words[0]&X)&&N<26;++N,X<<=1);if(N>0)for(f.iushrn(N);N-- >0;)(v.isOdd()||E.isOdd())&&(v.iadd(g),E.isub(m)),v.iushrn(1),E.iushrn(1);for(var ae=0,P=1;!(d.words[0]&P)&&ae<26;++ae,P<<=1);if(ae>0)for(d.iushrn(ae);ae-- >0;)(C.isOdd()||O.isOdd())&&(C.iadd(g),O.isub(m)),C.iushrn(1),O.iushrn(1);f.cmp(d)>=0?(f.isub(d),v.isub(C),E.isub(O)):(d.isub(f),C.isub(v),O.isub(E))}return{a:C,b:O,gcd:d.iushln(M)}},s.prototype._invmp=function(y){i(y.negative===0),i(!y.isZero());var f=this,d=y.clone();f.negative!==0?f=f.umod(y):f=f.clone();for(var v=new s(1),E=new s(0),C=d.clone();f.cmpn(1)>0&&d.cmpn(1)>0;){for(var O=0,M=1;!(f.words[0]&M)&&O<26;++O,M<<=1);if(O>0)for(f.iushrn(O);O-- >0;)v.isOdd()&&v.iadd(C),v.iushrn(1);for(var g=0,m=1;!(d.words[0]&m)&&g<26;++g,m<<=1);if(g>0)for(d.iushrn(g);g-- >0;)E.isOdd()&&E.iadd(C),E.iushrn(1);f.cmp(d)>=0?(f.isub(d),v.isub(E)):(d.isub(f),E.isub(v))}var N;return f.cmpn(1)===0?N=v:N=E,N.cmpn(0)<0&&N.iadd(y),N},s.prototype.gcd=function(y){if(this.isZero())return y.abs();if(y.isZero())return this.abs();var f=this.clone(),d=y.clone();f.negative=0,d.negative=0;for(var v=0;f.isEven()&&d.isEven();v++)f.iushrn(1),d.iushrn(1);do{for(;f.isEven();)f.iushrn(1);for(;d.isEven();)d.iushrn(1);var E=f.cmp(d);if(E<0){var C=f;f=d,d=C}else if(E===0||d.cmpn(1)===0)break;f.isub(d)}while(!0);return d.iushln(v)},s.prototype.invm=function(y){return this.egcd(y).a.umod(y)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(y){return this.words[0]&y},s.prototype.bincn=function(y){i(typeof y=="number");var f=y%26,d=(y-f)/26,v=1<<f;if(this.length<=d)return this._expand(d+1),this.words[d]|=v,this;for(var E=v,C=d;E!==0&&C<this.length;C++){var O=this.words[C]|0;O+=E,E=O>>>26,O&=67108863,this.words[C]=O}return E!==0&&(this.words[C]=E,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(y){var f=y<0;if(this.negative!==0&&!f)return-1;if(this.negative===0&&f)return 1;this.strip();var d;if(this.length>1)d=1;else{f&&(y=-y),i(y<=67108863,"Number is too big");var v=this.words[0]|0;d=v===y?0:v<y?-1:1}return this.negative!==0?-d|0:d},s.prototype.cmp=function(y){if(this.negative!==0&&y.negative===0)return-1;if(this.negative===0&&y.negative!==0)return 1;var f=this.ucmp(y);return this.negative!==0?-f|0:f},s.prototype.ucmp=function(y){if(this.length>y.length)return 1;if(this.length<y.length)return-1;for(var f=0,d=this.length-1;d>=0;d--){var v=this.words[d]|0,E=y.words[d]|0;if(v!==E){v<E?f=-1:v>E&&(f=1);break}}return f},s.prototype.gtn=function(y){return this.cmpn(y)===1},s.prototype.gt=function(y){return this.cmp(y)===1},s.prototype.gten=function(y){return this.cmpn(y)>=0},s.prototype.gte=function(y){return this.cmp(y)>=0},s.prototype.ltn=function(y){return this.cmpn(y)===-1},s.prototype.lt=function(y){return this.cmp(y)===-1},s.prototype.lten=function(y){return this.cmpn(y)<=0},s.prototype.lte=function(y){return this.cmp(y)<=0},s.prototype.eqn=function(y){return this.cmpn(y)===0},s.prototype.eq=function(y){return this.cmp(y)===0},s.red=function(y){return new ee(y)},s.prototype.toRed=function(y){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),y.convertTo(this)._forceRed(y)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(y){return this.red=y,this},s.prototype.forceRed=function(y){return i(!this.red,"Already a number in reduction context"),this._forceRed(y)},s.prototype.redAdd=function(y){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,y)},s.prototype.redIAdd=function(y){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,y)},s.prototype.redSub=function(y){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,y)},s.prototype.redISub=function(y){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,y)},s.prototype.redShl=function(y){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,y)},s.prototype.redMul=function(y){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,y),this.red.mul(this,y)},s.prototype.redIMul=function(y){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,y),this.red.imul(this,y)},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(y){return i(this.red&&!y.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,y)};var W={k256:null,p224:null,p192:null,p25519:null};function R(L,y){this.name=L,this.p=new s(y,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}R.prototype._tmp=function(){var y=new s(null);return y.words=new Array(Math.ceil(this.n/13)),y},R.prototype.ireduce=function(y){var f=y,d;do this.split(f,this.tmp),f=this.imulK(f),f=f.iadd(this.tmp),d=f.bitLength();while(d>this.n);var v=d<this.n?-1:f.ucmp(this.p);return v===0?(f.words[0]=0,f.length=1):v>0?f.isub(this.p):f.strip!==void 0?f.strip():f._strip(),f},R.prototype.split=function(y,f){y.iushrn(this.n,0,f)},R.prototype.imulK=function(y){return y.imul(this.k)};function k(){R.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(k,R),k.prototype.split=function(y,f){for(var d=4194303,v=Math.min(y.length,9),E=0;E<v;E++)f.words[E]=y.words[E];if(f.length=v,y.length<=9){y.words[0]=0,y.length=1;return}var C=y.words[9];for(f.words[f.length++]=C&d,E=10;E<y.length;E++){var O=y.words[E]|0;y.words[E-10]=(O&d)<<4|C>>>22,C=O}C>>>=22,y.words[E-10]=C,C===0&&y.length>10?y.length-=10:y.length-=9},k.prototype.imulK=function(y){y.words[y.length]=0,y.words[y.length+1]=0,y.length+=2;for(var f=0,d=0;d<y.length;d++){var v=y.words[d]|0;f+=v*977,y.words[d]=f&67108863,f=v*64+(f/67108864|0)}return y.words[y.length-1]===0&&(y.length--,y.words[y.length-1]===0&&y.length--),y};function H(){R.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(H,R);function _(){R.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(_,R);function B(){R.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(B,R),B.prototype.imulK=function(y){for(var f=0,d=0;d<y.length;d++){var v=(y.words[d]|0)*19+f,E=v&67108863;v>>>=26,y.words[d]=E,f=v}return f!==0&&(y.words[y.length++]=f),y},s._prime=function(y){if(W[y])return W[y];var f;if(y==="k256")f=new k;else if(y==="p224")f=new H;else if(y==="p192")f=new _;else if(y==="p25519")f=new B;else throw new Error("Unknown prime "+y);return W[y]=f,f};function ee(L){if(typeof L=="string"){var y=s._prime(L);this.m=y.p,this.prime=y}else i(L.gtn(1),"modulus must be greater than 1"),this.m=L,this.prime=null}ee.prototype._verify1=function(y){i(y.negative===0,"red works only with positives"),i(y.red,"red works only with red numbers")},ee.prototype._verify2=function(y,f){i((y.negative|f.negative)===0,"red works only with positives"),i(y.red&&y.red===f.red,"red works only with red numbers")},ee.prototype.imod=function(y){return this.prime?this.prime.ireduce(y)._forceRed(this):y.umod(this.m)._forceRed(this)},ee.prototype.neg=function(y){return y.isZero()?y.clone():this.m.sub(y)._forceRed(this)},ee.prototype.add=function(y,f){this._verify2(y,f);var d=y.add(f);return d.cmp(this.m)>=0&&d.isub(this.m),d._forceRed(this)},ee.prototype.iadd=function(y,f){this._verify2(y,f);var d=y.iadd(f);return d.cmp(this.m)>=0&&d.isub(this.m),d},ee.prototype.sub=function(y,f){this._verify2(y,f);var d=y.sub(f);return d.cmpn(0)<0&&d.iadd(this.m),d._forceRed(this)},ee.prototype.isub=function(y,f){this._verify2(y,f);var d=y.isub(f);return d.cmpn(0)<0&&d.iadd(this.m),d},ee.prototype.shl=function(y,f){return this._verify1(y),this.imod(y.ushln(f))},ee.prototype.imul=function(y,f){return this._verify2(y,f),this.imod(y.imul(f))},ee.prototype.mul=function(y,f){return this._verify2(y,f),this.imod(y.mul(f))},ee.prototype.isqr=function(y){return this.imul(y,y.clone())},ee.prototype.sqr=function(y){return this.mul(y,y)},ee.prototype.sqrt=function(y){if(y.isZero())return y.clone();var f=this.m.andln(3);if(i(f%2===1),f===3){var d=this.m.add(new s(1)).iushrn(2);return this.pow(y,d)}for(var v=this.m.subn(1),E=0;!v.isZero()&&v.andln(1)===0;)E++,v.iushrn(1);i(!v.isZero());var C=new s(1).toRed(this),O=C.redNeg(),M=this.m.subn(1).iushrn(1),g=this.m.bitLength();for(g=new s(2*g*g).toRed(this);this.pow(g,M).cmp(O)!==0;)g.redIAdd(O);for(var m=this.pow(g,v),N=this.pow(y,v.addn(1).iushrn(1)),X=this.pow(y,v),ae=E;X.cmp(C)!==0;){for(var P=X,te=0;P.cmp(C)!==0;te++)P=P.redSqr();i(te<ae);var z=this.pow(m,new s(1).iushln(ae-te-1));N=N.redMul(z),m=z.redSqr(),X=X.redMul(m),ae=te}return N},ee.prototype.invm=function(y){var f=y._invmp(this.m);return f.negative!==0?(f.negative=0,this.imod(f).redNeg()):this.imod(f)},ee.prototype.pow=function(y,f){if(f.isZero())return new s(1).toRed(this);if(f.cmpn(1)===0)return y.clone();var d=4,v=new Array(1<<d);v[0]=new s(1).toRed(this),v[1]=y;for(var E=2;E<v.length;E++)v[E]=this.mul(v[E-1],y);var C=v[0],O=0,M=0,g=f.bitLength()%26;for(g===0&&(g=26),E=f.length-1;E>=0;E--){for(var m=f.words[E],N=g-1;N>=0;N--){var X=m>>N&1;if(C!==v[0]&&(C=this.sqr(C)),X===0&&O===0){M=0;continue}O<<=1,O|=X,M++,!(M!==d&&(E!==0||N!==0))&&(C=this.mul(C,v[O]),M=0,O=0)}g=26}return C},ee.prototype.convertTo=function(y){var f=y.umod(this.m);return f===y?f.clone():f},ee.prototype.convertFrom=function(y){var f=y.clone();return f.red=null,f},s.mont=function(y){return new ie(y)};function ie(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(ie,ee),ie.prototype.convertTo=function(y){return this.imod(y.ushln(this.shift))},ie.prototype.convertFrom=function(y){var f=this.imod(y.mul(this.rinv));return f.red=null,f},ie.prototype.imul=function(y,f){if(y.isZero()||f.isZero())return y.words[0]=0,y.length=1,y;var d=y.imul(f),v=d.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=d.isub(v).iushrn(this.shift),C=E;return E.cmp(this.m)>=0?C=E.isub(this.m):E.cmpn(0)<0&&(C=E.iadd(this.m)),C._forceRed(this)},ie.prototype.mul=function(y,f){if(y.isZero()||f.isZero())return new s(0)._forceRed(this);var d=y.mul(f),v=d.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=d.isub(v).iushrn(this.shift),C=E;return E.cmp(this.m)>=0?C=E.isub(this.m):E.cmpn(0)<0&&(C=E.iadd(this.m)),C._forceRed(this)},ie.prototype.invm=function(y){var f=this.imod(y._invmp(this.m).mul(this.r2));return f._forceRed(this)}})(t,Vr)})(jn);var Lo=Wv;function Wv(t,e){if(!t)throw new Error(e||"Assertion failed")}Wv.equal=function(e,r,i){if(e!=r)throw new Error(i||"Assertion failed: "+e+" != "+r)};var q0={};(function(t){var e=t;function r(s,a){if(Array.isArray(s))return s.slice();if(!s)return[];var u=[];if(typeof s!="string"){for(var h=0;h<s.length;h++)u[h]=s[h]|0;return u}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)u.push(parseInt(s[h]+s[h+1],16))}else for(var h=0;h<s.length;h++){var l=s.charCodeAt(h),b=l>>8,w=l&255;b?u.push(b,w):u.push(w)}return u}e.toArray=r;function i(s){return s.length===1?"0"+s:s}e.zero2=i;function n(s){for(var a="",u=0;u<s.length;u++)a+=i(s[u].toString(16));return a}e.toHex=n,e.encode=function(a,u){return u==="hex"?n(a):a}})(q0),function(t){var e=t,r=jn.exports,i=Lo,n=q0;e.assert=i,e.toArray=n.toArray,e.zero2=n.zero2,e.toHex=n.toHex,e.encode=n.encode;function s(b,w,I){var S=new Array(Math.max(b.bitLength(),I)+1),D;for(D=0;D<S.length;D+=1)S[D]=0;var T=1<<w+1,q=b.clone();for(D=0;D<S.length;D++){var K,F=q.andln(T-1);q.isOdd()?(F>(T>>1)-1?K=(T>>1)-F:K=F,q.isubn(K)):K=0,S[D]=K,q.iushrn(1)}return S}e.getNAF=s;function a(b,w){var I=[[],[]];b=b.clone(),w=w.clone();for(var S=0,D=0,T;b.cmpn(-S)>0||w.cmpn(-D)>0;){var q=b.andln(3)+S&3,K=w.andln(3)+D&3;q===3&&(q=-1),K===3&&(K=-1);var F;q&1?(T=b.andln(7)+S&7,(T===3||T===5)&&K===2?F=-q:F=q):F=0,I[0].push(F);var W;K&1?(T=w.andln(7)+D&7,(T===3||T===5)&&q===2?W=-K:W=K):W=0,I[1].push(W),2*S===F+1&&(S=1-S),2*D===W+1&&(D=1-D),b.iushrn(1),w.iushrn(1)}return I}e.getJSF=a;function u(b,w,I){var S="_"+w;b.prototype[w]=function(){return this[S]!==void 0?this[S]:this[S]=I.call(this)}}e.cachedProperty=u;function h(b){return typeof b=="string"?e.toArray(b,"hex"):b}e.parseBytes=h;function l(b){return new r(b,"hex","le")}e.intFromLE=l}(Li);var Lf={exports:{}},j0;Lf.exports=function(e){return j0||(j0=new Xs(null)),j0.generate(e)};function Xs(t){this.rand=t}if(Lf.exports.Rand=Xs,Xs.prototype.generate=function(e){return this._rand(e)},Xs.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),i=0;i<r.length;i++)r[i]=this.rand.getByte();return r},typeof self=="object")self.crypto&&self.crypto.getRandomValues?Xs.prototype._rand=function(e){var r=new Uint8Array(e);return self.crypto.getRandomValues(r),r}:self.msCrypto&&self.msCrypto.getRandomValues?Xs.prototype._rand=function(e){var r=new Uint8Array(e);return self.msCrypto.getRandomValues(r),r}:typeof window=="object"&&(Xs.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var Vv=T0;if(typeof Vv.randomBytes!="function")throw new Error("Not supported");Xs.prototype._rand=function(e){return Vv.randomBytes(e)}}catch{}var z0={},Bo=jn.exports,ru=Li,Bf=ru.getNAF,I9=ru.getJSF,Ff=ru.assert;function eo(t,e){this.type=t,this.p=new Bo(e.p,16),this.red=e.prime?Bo.red(e.prime):Bo.mont(this.p),this.zero=new Bo(0).toRed(this.red),this.one=new Bo(1).toRed(this.red),this.two=new Bo(2).toRed(this.red),this.n=e.n&&new Bo(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Uf=eo;eo.prototype.point=function(){throw new Error("Not implemented")},eo.prototype.validate=function(){throw new Error("Not implemented")},eo.prototype._fixedNafMul=function(e,r){Ff(e.precomputed);var i=e._getDoubles(),n=Bf(r,1,this._bitLength),s=(1<<i.step+1)-(i.step%2===0?2:1);s/=3;var a=[],u,h;for(u=0;u<n.length;u+=i.step){h=0;for(var l=u+i.step-1;l>=u;l--)h=(h<<1)+n[l];a.push(h)}for(var b=this.jpoint(null,null,null),w=this.jpoint(null,null,null),I=s;I>0;I--){for(u=0;u<a.length;u++)h=a[u],h===I?w=w.mixedAdd(i.points[u]):h===-I&&(w=w.mixedAdd(i.points[u].neg()));b=b.add(w)}return b.toP()},eo.prototype._wnafMul=function(e,r){var i=4,n=e._getNAFPoints(i);i=n.wnd;for(var s=n.points,a=Bf(r,i,this._bitLength),u=this.jpoint(null,null,null),h=a.length-1;h>=0;h--){for(var l=0;h>=0&&a[h]===0;h--)l++;if(h>=0&&l++,u=u.dblp(l),h<0)break;var b=a[h];Ff(b!==0),e.type==="affine"?b>0?u=u.mixedAdd(s[b-1>>1]):u=u.mixedAdd(s[-b-1>>1].neg()):b>0?u=u.add(s[b-1>>1]):u=u.add(s[-b-1>>1].neg())}return e.type==="affine"?u.toP():u},eo.prototype._wnafMulAdd=function(e,r,i,n,s){var a=this._wnafT1,u=this._wnafT2,h=this._wnafT3,l=0,b,w,I;for(b=0;b<n;b++){I=r[b];var S=I._getNAFPoints(e);a[b]=S.wnd,u[b]=S.points}for(b=n-1;b>=1;b-=2){var D=b-1,T=b;if(a[D]!==1||a[T]!==1){h[D]=Bf(i[D],a[D],this._bitLength),h[T]=Bf(i[T],a[T],this._bitLength),l=Math.max(h[D].length,l),l=Math.max(h[T].length,l);continue}var q=[r[D],null,null,r[T]];r[D].y.cmp(r[T].y)===0?(q[1]=r[D].add(r[T]),q[2]=r[D].toJ().mixedAdd(r[T].neg())):r[D].y.cmp(r[T].y.redNeg())===0?(q[1]=r[D].toJ().mixedAdd(r[T]),q[2]=r[D].add(r[T].neg())):(q[1]=r[D].toJ().mixedAdd(r[T]),q[2]=r[D].toJ().mixedAdd(r[T].neg()));var K=[-3,-1,-5,-7,0,7,5,1,3],F=I9(i[D],i[T]);for(l=Math.max(F[0].length,l),h[D]=new Array(l),h[T]=new Array(l),w=0;w<l;w++){var W=F[0][w]|0,R=F[1][w]|0;h[D][w]=K[(W+1)*3+(R+1)],h[T][w]=0,u[D]=q}}var k=this.jpoint(null,null,null),H=this._wnafT4;for(b=l;b>=0;b--){for(var _=0;b>=0;){var B=!0;for(w=0;w<n;w++)H[w]=h[w][b]|0,H[w]!==0&&(B=!1);if(!B)break;_++,b--}if(b>=0&&_++,k=k.dblp(_),b<0)break;for(w=0;w<n;w++){var ee=H[w];ee!==0&&(ee>0?I=u[w][ee-1>>1]:ee<0&&(I=u[w][-ee-1>>1].neg()),I.type==="affine"?k=k.mixedAdd(I):k=k.add(I))}}for(b=0;b<n;b++)u[b]=null;return s?k:k.toP()};function Ji(t,e){this.curve=t,this.type=e,this.precomputed=null}eo.BasePoint=Ji,Ji.prototype.eq=function(){throw new Error("Not implemented")},Ji.prototype.validate=function(){return this.curve.validate(this)},eo.prototype.decodePoint=function(e,r){e=ru.toArray(e,r);var i=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*i){e[0]===6?Ff(e[e.length-1]%2===0):e[0]===7&&Ff(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 r=this.curve.p.byteLength(),i=this.getX().toArray("be",r);return e?[this.getY().isEven()?2:3].concat(i):[4].concat(i,this.getY().toArray("be",r))},Ji.prototype.encode=function(e,r){return ru.encode(this._encode(r),e)},Ji.prototype.precompute=function(e){if(this.precomputed)return this;var r={doubles:null,naf:null,beta:null};return r.naf=this._getNAFPoints(8),r.doubles=this._getDoubles(4,e),r.beta=this._getBeta(),this.precomputed=r,this},Ji.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var r=this.precomputed.doubles;return r?r.points.length>=Math.ceil((e.bitLength()+1)/r.step):!1},Ji.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],n=this,s=0;s<r;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 r=[this],i=(1<<e)-1,n=i===1?null:this.dbl(),s=1;s<i;s++)r[s]=r[s-1].add(n);return{wnd:e,points:r}},Ji.prototype._getBeta=function(){return null},Ji.prototype.dblp=function(e){for(var r=this,i=0;i<e;i++)r=r.dbl();return r};var Na={exports:{}};typeof Object.create=="function"?Na.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Na.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}};var M9=Li,lr=jn.exports,H0=Na.exports,Ta=Uf,C9=M9.assert;function Yi(t){Ta.call(this,"short",t),this.a=new lr(t.a,16).toRed(this.red),this.b=new lr(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}H0(Yi,Ta);var D9=Yi;Yi.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var r,i;if(e.beta)r=new lr(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);r=n[0].cmp(n[1])<0?n[0]:n[1],r=r.toRed(this.red)}if(e.lambda)i=new lr(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(r))===0?i=s[0]:(i=s[1],C9(this.g.mul(i).x.cmp(this.g.x.redMul(r))===0))}var a;return e.basis?a=e.basis.map(function(u){return{a:new lr(u.a,16),b:new lr(u.b,16)}}):a=this._getEndoBasis(i),{beta:r,lambda:i,basis:a}}},Yi.prototype._getEndoRoots=function(e){var r=e===this.p?this.red:lr.mont(e),i=new lr(2).toRed(r).redInvm(),n=i.redNeg(),s=new lr(3).toRed(r).redNeg().redSqrt().redMul(i),a=n.redAdd(s).fromRed(),u=n.redSub(s).fromRed();return[a,u]},Yi.prototype._getEndoBasis=function(e){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),i=e,n=this.n.clone(),s=new lr(1),a=new lr(0),u=new lr(0),h=new lr(1),l,b,w,I,S,D,T,q=0,K,F;i.cmpn(0)!==0;){var W=n.div(i);K=n.sub(W.mul(i)),F=u.sub(W.mul(s));var R=h.sub(W.mul(a));if(!w&&K.cmp(r)<0)l=T.neg(),b=s,w=K.neg(),I=F;else if(w&&++q===2)break;T=K,n=i,i=K,u=s,s=F,h=a,a=R}S=K.neg(),D=F;var k=w.sqr().add(I.sqr()),H=S.sqr().add(D.sqr());return H.cmp(k)>=0&&(S=l,D=b),w.negative&&(w=w.neg(),I=I.neg()),S.negative&&(S=S.neg(),D=D.neg()),[{a:w,b:I},{a:S,b:D}]},Yi.prototype._endoSplit=function(e){var r=this.endo.basis,i=r[0],n=r[1],s=n.b.mul(e).divRound(this.n),a=i.b.neg().mul(e).divRound(this.n),u=s.mul(i.a),h=a.mul(n.a),l=s.mul(i.b),b=a.mul(n.b),w=e.sub(u).sub(h),I=l.add(b).neg();return{k1:w,k2:I}},Yi.prototype.pointFromX=function(e,r){e=new lr(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(r&&!s||!r&&s)&&(n=n.redNeg()),this.point(e,n)},Yi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,i=e.y,n=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(n).redIAdd(this.b);return i.redSqr().redISub(s).cmpn(0)===0},Yi.prototype._endoWnafMulAdd=function(e,r,i){for(var n=this._endoWnafT1,s=this._endoWnafT2,a=0;a<e.length;a++){var u=this._endoSplit(r[a]),h=e[a],l=h._getBeta();u.k1.negative&&(u.k1.ineg(),h=h.neg(!0)),u.k2.negative&&(u.k2.ineg(),l=l.neg(!0)),n[a*2]=h,n[a*2+1]=l,s[a*2]=u.k1,s[a*2+1]=u.k2}for(var b=this._wnafMulAdd(1,n,s,a*2,i),w=0;w<a*2;w++)n[w]=null,s[w]=null;return b};function Pr(t,e,r,i){Ta.BasePoint.call(this,t,"affine"),e===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new lr(e,16),this.y=new lr(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}H0(Pr,Ta.BasePoint),Yi.prototype.point=function(e,r,i){return new Pr(this,e,r,i)},Yi.prototype.pointFromJSON=function(e,r){return Pr.fromJSON(this,e,r)},Pr.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var r=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=r,r.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 r}},Pr.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]},Pr.fromJSON=function(e,r,i){typeof r=="string"&&(r=JSON.parse(r));var n=e.point(r[0],r[1],i);if(!r[2])return n;function s(u){return e.point(u[0],u[1],i)}var a=r[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},Pr.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)+">"},Pr.prototype.isInfinity=function(){return this.inf},Pr.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 r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var i=r.redSqr().redISub(this.x).redISub(e.x),n=r.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)},Pr.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 r=this.curve.a,i=this.x.redSqr(),n=e.redInvm(),s=i.redAdd(i).redIAdd(i).redIAdd(r).redMul(n),a=s.redSqr().redISub(this.x.redAdd(this.x)),u=s.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,u)},Pr.prototype.getX=function(){return this.x.fromRed()},Pr.prototype.getY=function(){return this.y.fromRed()},Pr.prototype.mul=function(e){return e=new lr(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)},Pr.prototype.mulAdd=function(e,r,i){var n=[this,r],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s):this.curve._wnafMulAdd(1,n,s,2)},Pr.prototype.jmulAdd=function(e,r,i){var n=[this,r],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s,!0):this.curve._wnafMulAdd(1,n,s,2,!0)},Pr.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)},Pr.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,n=function(s){return s.neg()};r.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 r},Pr.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 jr(t,e,r,i){Ta.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new lr(0)):(this.x=new lr(e,16),this.y=new lr(r,16),this.z=new lr(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}H0(jr,Ta.BasePoint),Yi.prototype.jpoint=function(e,r,i){return new jr(this,e,r,i)},jr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),i=this.x.redMul(r),n=this.y.redMul(r).redMul(e);return this.curve.point(i,n)},jr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},jr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),i=this.z.redSqr(),n=this.x.redMul(r),s=e.x.redMul(i),a=this.y.redMul(r.redMul(e.z)),u=e.y.redMul(i.redMul(this.z)),h=n.redSub(s),l=a.redSub(u);if(h.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var b=h.redSqr(),w=b.redMul(h),I=n.redMul(b),S=l.redSqr().redIAdd(w).redISub(I).redISub(I),D=l.redMul(I.redISub(S)).redISub(a.redMul(w)),T=this.z.redMul(e.z).redMul(h);return this.curve.jpoint(S,D,T)},jr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),i=this.x,n=e.x.redMul(r),s=this.y,a=e.y.redMul(r).redMul(this.z),u=i.redSub(n),h=s.redSub(a);if(u.cmpn(0)===0)return h.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=u.redSqr(),b=l.redMul(u),w=i.redMul(l),I=h.redSqr().redIAdd(b).redISub(w).redISub(w),S=h.redMul(w.redISub(I)).redISub(s.redMul(b)),D=this.z.redMul(u);return this.curve.jpoint(I,S,D)},jr.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var i=this;for(r=0;r<e;r++)i=i.dbl();return i}var n=this.curve.a,s=this.curve.tinv,a=this.x,u=this.y,h=this.z,l=h.redSqr().redSqr(),b=u.redAdd(u);for(r=0;r<e;r++){var w=a.redSqr(),I=b.redSqr(),S=I.redSqr(),D=w.redAdd(w).redIAdd(w).redIAdd(n.redMul(l)),T=a.redMul(I),q=D.redSqr().redISub(T.redAdd(T)),K=T.redISub(q),F=D.redMul(K);F=F.redIAdd(F).redISub(S);var W=b.redMul(h);r+1<e&&(l=l.redMul(S)),a=q,h=W,b=F}return this.curve.jpoint(a,b.redMul(s),h)},jr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},jr.prototype._zeroDbl=function(){var e,r,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),u=this.x.redAdd(s).redSqr().redISub(n).redISub(a);u=u.redIAdd(u);var h=n.redAdd(n).redIAdd(n),l=h.redSqr().redISub(u).redISub(u),b=a.redIAdd(a);b=b.redIAdd(b),b=b.redIAdd(b),e=l,r=h.redMul(u.redISub(l)).redISub(b),i=this.y.redAdd(this.y)}else{var w=this.x.redSqr(),I=this.y.redSqr(),S=I.redSqr(),D=this.x.redAdd(I).redSqr().redISub(w).redISub(S);D=D.redIAdd(D);var T=w.redAdd(w).redIAdd(w),q=T.redSqr(),K=S.redIAdd(S);K=K.redIAdd(K),K=K.redIAdd(K),e=q.redISub(D).redISub(D),r=T.redMul(D.redISub(e)).redISub(K),i=this.y.redMul(this.z),i=i.redIAdd(i)}return this.curve.jpoint(e,r,i)},jr.prototype._threeDbl=function(){var e,r,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),u=this.x.redAdd(s).redSqr().redISub(n).redISub(a);u=u.redIAdd(u);var h=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),l=h.redSqr().redISub(u).redISub(u);e=l;var b=a.redIAdd(a);b=b.redIAdd(b),b=b.redIAdd(b),r=h.redMul(u.redISub(l)).redISub(b),i=this.y.redAdd(this.y)}else{var w=this.z.redSqr(),I=this.y.redSqr(),S=this.x.redMul(I),D=this.x.redSub(w).redMul(this.x.redAdd(w));D=D.redAdd(D).redIAdd(D);var T=S.redIAdd(S);T=T.redIAdd(T);var q=T.redAdd(T);e=D.redSqr().redISub(q),i=this.y.redAdd(this.z).redSqr().redISub(I).redISub(w);var K=I.redSqr();K=K.redIAdd(K),K=K.redIAdd(K),K=K.redIAdd(K),r=D.redMul(T.redISub(e)).redISub(K)}return this.curve.jpoint(e,r,i)},jr.prototype._dbl=function(){var e=this.curve.a,r=this.x,i=this.y,n=this.z,s=n.redSqr().redSqr(),a=r.redSqr(),u=i.redSqr(),h=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(s)),l=r.redAdd(r);l=l.redIAdd(l);var b=l.redMul(u),w=h.redSqr().redISub(b.redAdd(b)),I=b.redISub(w),S=u.redSqr();S=S.redIAdd(S),S=S.redIAdd(S),S=S.redIAdd(S);var D=h.redMul(I).redISub(S),T=i.redAdd(i).redMul(n);return this.curve.jpoint(w,D,T)},jr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),r=this.y.redSqr(),i=this.z.redSqr(),n=r.redSqr(),s=e.redAdd(e).redIAdd(e),a=s.redSqr(),u=this.x.redAdd(r).redSqr().redISub(e).redISub(n);u=u.redIAdd(u),u=u.redAdd(u).redIAdd(u),u=u.redISub(a);var h=u.redSqr(),l=n.redIAdd(n);l=l.redIAdd(l),l=l.redIAdd(l),l=l.redIAdd(l);var b=s.redIAdd(u).redSqr().redISub(a).redISub(h).redISub(l),w=r.redMul(b);w=w.redIAdd(w),w=w.redIAdd(w);var I=this.x.redMul(h).redISub(w);I=I.redIAdd(I),I=I.redIAdd(I);var S=this.y.redMul(b.redMul(l.redISub(b)).redISub(u.redMul(h)));S=S.redIAdd(S),S=S.redIAdd(S),S=S.redIAdd(S);var D=this.z.redAdd(u).redSqr().redISub(i).redISub(h);return this.curve.jpoint(I,S,D)},jr.prototype.mul=function(e,r){return e=new lr(e,r),this.curve._wnafMul(this,e)},jr.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var r=this.z.redSqr(),i=e.z.redSqr();if(this.x.redMul(i).redISub(e.x.redMul(r)).cmpn(0)!==0)return!1;var n=r.redMul(this.z),s=i.redMul(e.z);return this.y.redMul(s).redISub(e.y.redMul(n)).cmpn(0)===0},jr.prototype.eqXToP=function(e){var r=this.z.redSqr(),i=e.toRed(this.curve.red).redMul(r);if(this.x.cmp(i)===0)return!0;for(var n=e.clone(),s=this.curve.redN.redMul(r);;){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}},jr.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)+">"},jr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var La=jn.exports,Gv=Na.exports,kf=Uf,O9=Li;function Ba(t){kf.call(this,"mont",t),this.a=new La(t.a,16).toRed(this.red),this.b=new La(t.b,16).toRed(this.red),this.i4=new La(4).toRed(this.red).redInvm(),this.two=new La(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}Gv(Ba,kf);var P9=Ba;Ba.prototype.validate=function(e){var r=e.normalize().x,i=r.redSqr(),n=i.redMul(r).redAdd(i.redMul(this.a)).redAdd(r),s=n.redSqrt();return s.redSqr().cmp(n)===0};function $r(t,e,r){kf.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new La(e,16),this.z=new La(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}Gv($r,kf.BasePoint),Ba.prototype.decodePoint=function(e,r){return this.point(O9.toArray(e,r),1)},Ba.prototype.point=function(e,r){return new $r(this,e,r)},Ba.prototype.pointFromJSON=function(e){return $r.fromJSON(this,e)},$r.prototype.precompute=function(){},$r.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},$r.fromJSON=function(e,r){return new $r(e,r[0],r[1]||e.one)},$r.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)+">"},$r.prototype.isInfinity=function(){return this.z.cmpn(0)===0},$r.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),i=this.x.redSub(this.z),n=i.redSqr(),s=r.redSub(n),a=r.redMul(n),u=s.redMul(n.redAdd(this.curve.a24.redMul(s)));return this.curve.point(a,u)},$r.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},$r.prototype.diffAdd=function(e,r){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),u=a.redMul(i),h=s.redMul(n),l=r.z.redMul(u.redAdd(h).redSqr()),b=r.x.redMul(u.redISub(h).redSqr());return this.curve.point(l,b)},$r.prototype.mul=function(e){for(var r=e.clone(),i=this,n=this.curve.point(null,null),s=this,a=[];r.cmpn(0)!==0;r.iushrn(1))a.push(r.andln(1));for(var u=a.length-1;u>=0;u--)a[u]===0?(i=i.diffAdd(n,s),n=n.dbl()):(n=i.diffAdd(n,s),i=i.dbl());return n},$r.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},$r.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},$r.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},$r.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},$r.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var $9=Li,Ss=jn.exports,Jv=Na.exports,qf=Uf,R9=$9.assert;function zn(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,qf.call(this,"edwards",t),this.a=new Ss(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new Ss(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new Ss(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),R9(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}Jv(zn,qf);var N9=zn;zn.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},zn.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},zn.prototype.jpoint=function(e,r,i,n){return this.point(e,r,i,n)},zn.prototype.pointFromX=function(e,r){e=new Ss(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()),u=a.redSqrt();if(u.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");var h=u.fromRed().isOdd();return(r&&!h||!r&&h)&&(u=u.redNeg()),this.point(e,u)},zn.prototype.pointFromY=function(e,r){e=new Ss(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(r)throw new Error("invalid point");return this.point(this.zero,e)}var u=a.redSqrt();if(u.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");return u.fromRed().isOdd()!==r&&(u=u.redNeg()),this.point(u,e)},zn.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),i=e.y.redSqr(),n=r.redMul(this.a).redAdd(i),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(i)));return n.cmp(s)===0};function nr(t,e,r,i,n){qf.BasePoint.call(this,t,"projective"),e===null&&r===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 Ss(e,16),this.y=new Ss(r,16),this.z=i?new Ss(i,16):this.curve.one,this.t=n&&new Ss(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()))))}Jv(nr,qf.BasePoint),zn.prototype.pointFromJSON=function(e){return nr.fromJSON(this,e)},zn.prototype.point=function(e,r,i,n){return new nr(this,e,r,i,n)},nr.fromJSON=function(e,r){return new nr(e,r[0],r[1],r[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(),r=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(r),a=n.redAdd(r),u=a.redSub(i),h=n.redSub(r),l=s.redMul(u),b=a.redMul(h),w=s.redMul(h),I=u.redMul(a);return this.curve.point(l,b,I,w)},nr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),i=this.y.redSqr(),n,s,a,u,h,l;if(this.curve.twisted){u=this.curve._mulA(r);var b=u.redAdd(i);this.zOne?(n=e.redSub(r).redSub(i).redMul(b.redSub(this.curve.two)),s=b.redMul(u.redSub(i)),a=b.redSqr().redSub(b).redSub(b)):(h=this.z.redSqr(),l=b.redSub(h).redISub(h),n=e.redSub(r).redISub(i).redMul(l),s=b.redMul(u.redSub(i)),a=b.redMul(l))}else u=r.redAdd(i),h=this.curve._mulC(this.z).redSqr(),l=u.redSub(h).redSub(h),n=this.curve._mulC(e.redISub(u)).redMul(l),s=this.curve._mulC(u).redMul(r.redISub(i)),a=u.redMul(l);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 r=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(r),u=s.redSub(n),h=s.redAdd(n),l=i.redAdd(r),b=a.redMul(u),w=h.redMul(l),I=a.redMul(l),S=u.redMul(h);return this.curve.point(b,w,S,I)},nr.prototype._projAdd=function(e){var r=this.z.redMul(e.z),i=r.redSqr(),n=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(n).redMul(s),u=i.redSub(a),h=i.redAdd(a),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(n).redISub(s),b=r.redMul(u).redMul(l),w,I;return this.curve.twisted?(w=r.redMul(h).redMul(s.redSub(this.curve._mulA(n))),I=u.redMul(h)):(w=r.redMul(h).redMul(s.redSub(n)),I=this.curve._mulC(u).redMul(h)),this.curve.point(b,w,I)},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,r,i){return this.curve._wnafMulAdd(1,[this,r],[e,i],2,!1)},nr.prototype.jmulAdd=function(e,r,i){return this.curve._wnafMulAdd(1,[this,r],[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 r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===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(r.redIAdd(n),this.x.cmp(r)===0)return!0}},nr.prototype.toP=nr.prototype.normalize,nr.prototype.mixedAdd=nr.prototype.add,function(t){var e=t;e.base=Uf,e.short=D9,e.mont=P9,e.edwards=N9}(z0);var jf={},zf={},$t={},T9=Lo,L9=Na.exports;$t.inherits=L9;function B9(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function F9(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(var i=0,n=0;n<t.length;n++){var s=t.charCodeAt(n);s<128?r[i++]=s:s<2048?(r[i++]=s>>6|192,r[i++]=s&63|128):B9(t,n)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++n)&1023),r[i++]=s>>18|240,r[i++]=s>>12&63|128,r[i++]=s>>6&63|128,r[i++]=s&63|128):(r[i++]=s>>12|224,r[i++]=s>>6&63|128,r[i++]=s&63|128)}else for(n=0;n<t.length;n++)r[n]=t[n]|0;return r}$t.toArray=F9;function U9(t){for(var e="",r=0;r<t.length;r++)e+=Qv(t[r].toString(16));return e}$t.toHex=U9;function Yv(t){var e=t>>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}$t.htonl=Yv;function k9(t,e){for(var r="",i=0;i<t.length;i++){var n=t[i];e==="little"&&(n=Yv(n)),r+=Zv(n.toString(16))}return r}$t.toHex32=k9;function Qv(t){return t.length===1?"0"+t:t}$t.zero2=Qv;function Zv(t){return t.length===7?"0"+t:t.length===6?"00"+t:t.length===5?"000"+t:t.length===4?"0000"+t:t.length===3?"00000"+t:t.length===2?"000000"+t:t.length===1?"0000000"+t:t}$t.zero8=Zv;function q9(t,e,r,i){var n=r-e;T9(n%4===0);for(var s=new Array(n/4),a=0,u=e;a<s.length;a++,u+=4){var h;i==="big"?h=t[u]<<24|t[u+1]<<16|t[u+2]<<8|t[u+3]:h=t[u+3]<<24|t[u+2]<<16|t[u+1]<<8|t[u],s[a]=h>>>0}return s}$t.join32=q9;function j9(t,e){for(var r=new Array(t.length*4),i=0,n=0;i<t.length;i++,n+=4){var s=t[i];e==="big"?(r[n]=s>>>24,r[n+1]=s>>>16&255,r[n+2]=s>>>8&255,r[n+3]=s&255):(r[n+3]=s>>>24,r[n+2]=s>>>16&255,r[n+1]=s>>>8&255,r[n]=s&255)}return r}$t.split32=j9;function z9(t,e){return t>>>e|t<<32-e}$t.rotr32=z9;function H9(t,e){return t<<e|t>>>32-e}$t.rotl32=H9;function K9(t,e){return t+e>>>0}$t.sum32=K9;function W9(t,e,r){return t+e+r>>>0}$t.sum32_3=W9;function V9(t,e,r,i){return t+e+r+i>>>0}$t.sum32_4=V9;function G9(t,e,r,i,n){return t+e+r+i+n>>>0}$t.sum32_5=G9;function J9(t,e,r,i){var n=t[e],s=t[e+1],a=i+s>>>0,u=(a<i?1:0)+r+n;t[e]=u>>>0,t[e+1]=a}$t.sum64=J9;function Y9(t,e,r,i){var n=e+i>>>0,s=(n<e?1:0)+t+r;return s>>>0}$t.sum64_hi=Y9;function Q9(t,e,r,i){var n=e+i;return n>>>0}$t.sum64_lo=Q9;function Z9(t,e,r,i,n,s,a,u){var h=0,l=e;l=l+i>>>0,h+=l<e?1:0,l=l+s>>>0,h+=l<s?1:0,l=l+u>>>0,h+=l<u?1:0;var b=t+r+n+a+h;return b>>>0}$t.sum64_4_hi=Z9;function X9(t,e,r,i,n,s,a,u){var h=e+i+s+u;return h>>>0}$t.sum64_4_lo=X9;function e_(t,e,r,i,n,s,a,u,h,l){var b=0,w=e;w=w+i>>>0,b+=w<e?1:0,w=w+s>>>0,b+=w<s?1:0,w=w+u>>>0,b+=w<u?1:0,w=w+l>>>0,b+=w<l?1:0;var I=t+r+n+a+h+b;return I>>>0}$t.sum64_5_hi=e_;function t_(t,e,r,i,n,s,a,u,h,l){var b=e+i+s+u+l;return b>>>0}$t.sum64_5_lo=t_;function r_(t,e,r){var i=e<<32-r|t>>>r;return i>>>0}$t.rotr64_hi=r_;function i_(t,e,r){var i=t<<32-r|e>>>r;return i>>>0}$t.rotr64_lo=i_;function n_(t,e,r){return t>>>r}$t.shr64_hi=n_;function s_(t,e,r){var i=t<<32-r|e>>>r;return i>>>0}$t.shr64_lo=s_;var Fa={},Xv=$t,o_=Lo;function Hf(){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}Fa.BlockHash=Hf,Hf.prototype.update=function(e,r){if(e=Xv.toArray(e,r),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=Xv.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},Hf.prototype.digest=function(e){return this.update(this._pad()),o_(this.pending===null),this._digest(e)},Hf.prototype._pad=function(){var e=this.pendingTotal,r=this._delta8,i=r-(e+this.padLength)%r,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 Ua={},Hn={},a_=$t,Kn=a_.rotr32;function c_(t,e,r,i){if(t===0)return e2(e,r,i);if(t===1||t===3)return r2(e,r,i);if(t===2)return t2(e,r,i)}Hn.ft_1=c_;function e2(t,e,r){return t&e^~t&r}Hn.ch32=e2;function t2(t,e,r){return t&e^t&r^e&r}Hn.maj32=t2;function r2(t,e,r){return t^e^r}Hn.p32=r2;function u_(t){return Kn(t,2)^Kn(t,13)^Kn(t,22)}Hn.s0_256=u_;function f_(t){return Kn(t,6)^Kn(t,11)^Kn(t,25)}Hn.s1_256=f_;function h_(t){return Kn(t,7)^Kn(t,18)^t>>>3}Hn.g0_256=h_;function l_(t){return Kn(t,17)^Kn(t,19)^t>>>10}Hn.g1_256=l_;var ka=$t,d_=Fa,p_=Hn,K0=ka.rotl32,iu=ka.sum32,g_=ka.sum32_5,v_=p_.ft_1,i2=d_.BlockHash,m_=[1518500249,1859775393,2400959708,3395469782];function Wn(){if(!(this instanceof Wn))return new Wn;i2.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}ka.inherits(Wn,i2);var b_=Wn;Wn.blockSize=512,Wn.outSize=160,Wn.hmacStrength=80,Wn.padLength=64,Wn.prototype._update=function(e,r){for(var i=this.W,n=0;n<16;n++)i[n]=e[r+n];for(;n<i.length;n++)i[n]=K0(i[n-3]^i[n-8]^i[n-14]^i[n-16],1);var s=this.h[0],a=this.h[1],u=this.h[2],h=this.h[3],l=this.h[4];for(n=0;n<i.length;n++){var b=~~(n/20),w=g_(K0(s,5),v_(b,a,u,h),l,i[n],m_[b]);l=h,h=u,u=K0(a,30),a=s,s=w}this.h[0]=iu(this.h[0],s),this.h[1]=iu(this.h[1],a),this.h[2]=iu(this.h[2],u),this.h[3]=iu(this.h[3],h),this.h[4]=iu(this.h[4],l)},Wn.prototype._digest=function(e){return e==="hex"?ka.toHex32(this.h,"big"):ka.split32(this.h,"big")};var qa=$t,y_=Fa,ja=Hn,w_=Lo,bn=qa.sum32,__=qa.sum32_4,E_=qa.sum32_5,A_=ja.ch32,x_=ja.maj32,S_=ja.s0_256,I_=ja.s1_256,M_=ja.g0_256,C_=ja.g1_256,n2=y_.BlockHash,D_=[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 Vn(){if(!(this instanceof Vn))return new Vn;n2.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=D_,this.W=new Array(64)}qa.inherits(Vn,n2);var s2=Vn;Vn.blockSize=512,Vn.outSize=256,Vn.hmacStrength=192,Vn.padLength=64,Vn.prototype._update=function(e,r){for(var i=this.W,n=0;n<16;n++)i[n]=e[r+n];for(;n<i.length;n++)i[n]=__(C_(i[n-2]),i[n-7],M_(i[n-15]),i[n-16]);var s=this.h[0],a=this.h[1],u=this.h[2],h=this.h[3],l=this.h[4],b=this.h[5],w=this.h[6],I=this.h[7];for(w_(this.k.length===i.length),n=0;n<i.length;n++){var S=E_(I,I_(l),A_(l,b,w),this.k[n],i[n]),D=bn(S_(s),x_(s,a,u));I=w,w=b,b=l,l=bn(h,S),h=u,u=a,a=s,s=bn(S,D)}this.h[0]=bn(this.h[0],s),this.h[1]=bn(this.h[1],a),this.h[2]=bn(this.h[2],u),this.h[3]=bn(this.h[3],h),this.h[4]=bn(this.h[4],l),this.h[5]=bn(this.h[5],b),this.h[6]=bn(this.h[6],w),this.h[7]=bn(this.h[7],I)},Vn.prototype._digest=function(e){return e==="hex"?qa.toHex32(this.h,"big"):qa.split32(this.h,"big")};var W0=$t,o2=s2;function Is(){if(!(this instanceof Is))return new Is;o2.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}W0.inherits(Is,o2);var O_=Is;Is.blockSize=512,Is.outSize=224,Is.hmacStrength=192,Is.padLength=64,Is.prototype._digest=function(e){return e==="hex"?W0.toHex32(this.h.slice(0,7),"big"):W0.split32(this.h.slice(0,7),"big")};var mi=$t,P_=Fa,$_=Lo,Gn=mi.rotr64_hi,Jn=mi.rotr64_lo,a2=mi.shr64_hi,c2=mi.shr64_lo,to=mi.sum64,V0=mi.sum64_hi,G0=mi.sum64_lo,R_=mi.sum64_4_hi,N_=mi.sum64_4_lo,T_=mi.sum64_5_hi,L_=mi.sum64_5_lo,u2=P_.BlockHash,B_=[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 yn(){if(!(this instanceof yn))return new yn;u2.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=B_,this.W=new Array(160)}mi.inherits(yn,u2);var f2=yn;yn.blockSize=1024,yn.outSize=512,yn.hmacStrength=192,yn.padLength=128,yn.prototype._prepareBlock=function(e,r){for(var i=this.W,n=0;n<32;n++)i[n]=e[r+n];for(;n<i.length;n+=2){var s=G_(i[n-4],i[n-3]),a=J_(i[n-4],i[n-3]),u=i[n-14],h=i[n-13],l=W_(i[n-30],i[n-29]),b=V_(i[n-30],i[n-29]),w=i[n-32],I=i[n-31];i[n]=R_(s,a,u,h,l,b,w,I),i[n+1]=N_(s,a,u,h,l,b,w,I)}},yn.prototype._update=function(e,r){this._prepareBlock(e,r);var i=this.W,n=this.h[0],s=this.h[1],a=this.h[2],u=this.h[3],h=this.h[4],l=this.h[5],b=this.h[6],w=this.h[7],I=this.h[8],S=this.h[9],D=this.h[10],T=this.h[11],q=this.h[12],K=this.h[13],F=this.h[14],W=this.h[15];$_(this.k.length===i.length);for(var R=0;R<i.length;R+=2){var k=F,H=W,_=H_(I,S),B=K_(I,S),ee=F_(I,S,D,T,q),ie=U_(I,S,D,T,q,K),L=this.k[R],y=this.k[R+1],f=i[R],d=i[R+1],v=T_(k,H,_,B,ee,ie,L,y,f,d),E=L_(k,H,_,B,ee,ie,L,y,f,d);k=j_(n,s),H=z_(n,s),_=k_(n,s,a,u,h),B=q_(n,s,a,u,h,l);var C=V0(k,H,_,B),O=G0(k,H,_,B);F=q,W=K,q=D,K=T,D=I,T=S,I=V0(b,w,v,E),S=G0(w,w,v,E),b=h,w=l,h=a,l=u,a=n,u=s,n=V0(v,E,C,O),s=G0(v,E,C,O)}to(this.h,0,n,s),to(this.h,2,a,u),to(this.h,4,h,l),to(this.h,6,b,w),to(this.h,8,I,S),to(this.h,10,D,T),to(this.h,12,q,K),to(this.h,14,F,W)},yn.prototype._digest=function(e){return e==="hex"?mi.toHex32(this.h,"big"):mi.split32(this.h,"big")};function F_(t,e,r,i,n){var s=t&r^~t&n;return s<0&&(s+=4294967296),s}function U_(t,e,r,i,n,s){var a=e&i^~e&s;return a<0&&(a+=4294967296),a}function k_(t,e,r,i,n){var s=t&r^t&n^r&n;return s<0&&(s+=4294967296),s}function q_(t,e,r,i,n,s){var a=e&i^e&s^i&s;return a<0&&(a+=4294967296),a}function j_(t,e){var r=Gn(t,e,28),i=Gn(e,t,2),n=Gn(e,t,7),s=r^i^n;return s<0&&(s+=4294967296),s}function z_(t,e){var r=Jn(t,e,28),i=Jn(e,t,2),n=Jn(e,t,7),s=r^i^n;return s<0&&(s+=4294967296),s}function H_(t,e){var r=Gn(t,e,14),i=Gn(t,e,18),n=Gn(e,t,9),s=r^i^n;return s<0&&(s+=4294967296),s}function K_(t,e){var r=Jn(t,e,14),i=Jn(t,e,18),n=Jn(e,t,9),s=r^i^n;return s<0&&(s+=4294967296),s}function W_(t,e){var r=Gn(t,e,1),i=Gn(t,e,8),n=a2(t,e,7),s=r^i^n;return s<0&&(s+=4294967296),s}function V_(t,e){var r=Jn(t,e,1),i=Jn(t,e,8),n=c2(t,e,7),s=r^i^n;return s<0&&(s+=4294967296),s}function G_(t,e){var r=Gn(t,e,19),i=Gn(e,t,29),n=a2(t,e,6),s=r^i^n;return s<0&&(s+=4294967296),s}function J_(t,e){var r=Jn(t,e,19),i=Jn(e,t,29),n=c2(t,e,6),s=r^i^n;return s<0&&(s+=4294967296),s}var J0=$t,h2=f2;function Ms(){if(!(this instanceof Ms))return new Ms;h2.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}J0.inherits(Ms,h2);var Y_=Ms;Ms.blockSize=1024,Ms.outSize=384,Ms.hmacStrength=192,Ms.padLength=128,Ms.prototype._digest=function(e){return e==="hex"?J0.toHex32(this.h.slice(0,12),"big"):J0.split32(this.h.slice(0,12),"big")},Ua.sha1=b_,Ua.sha224=O_,Ua.sha256=s2,Ua.sha384=Y_,Ua.sha512=f2;var l2={},Fo=$t,Q_=Fa,Kf=Fo.rotl32,d2=Fo.sum32,nu=Fo.sum32_3,p2=Fo.sum32_4,g2=Q_.BlockHash;function Yn(){if(!(this instanceof Yn))return new Yn;g2.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Fo.inherits(Yn,g2),l2.ripemd160=Yn,Yn.blockSize=512,Yn.outSize=160,Yn.hmacStrength=192,Yn.padLength=64,Yn.prototype._update=function(e,r){for(var i=this.h[0],n=this.h[1],s=this.h[2],a=this.h[3],u=this.h[4],h=i,l=n,b=s,w=a,I=u,S=0;S<80;S++){var D=d2(Kf(p2(i,v2(S,n,s,a),e[eE[S]+r],Z_(S)),rE[S]),u);i=u,u=a,a=Kf(s,10),s=n,n=D,D=d2(Kf(p2(h,v2(79-S,l,b,w),e[tE[S]+r],X_(S)),iE[S]),I),h=I,I=w,w=Kf(b,10),b=l,l=D}D=nu(this.h[1],s,w),this.h[1]=nu(this.h[2],a,I),this.h[2]=nu(this.h[3],u,h),this.h[3]=nu(this.h[4],i,l),this.h[4]=nu(this.h[0],n,b),this.h[0]=D},Yn.prototype._digest=function(e){return e==="hex"?Fo.toHex32(this.h,"little"):Fo.split32(this.h,"little")};function v2(t,e,r,i){return t<=15?e^r^i:t<=31?e&r|~e&i:t<=47?(e|~r)^i:t<=63?e&i|r&~i:e^(r|~i)}function Z_(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function X_(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}var eE=[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],tE=[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],rE=[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],iE=[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],nE=$t,sE=Lo;function za(t,e,r){if(!(this instanceof za))return new za(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(nE.toArray(e,r))}var oE=za;za.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),sE(e.length<=this.blockSize);for(var r=e.length;r<this.blockSize;r++)e.push(0);for(r=0;r<e.length;r++)e[r]^=54;for(this.inner=new this.Hash().update(e),r=0;r<e.length;r++)e[r]^=106;this.outer=new this.Hash().update(e)},za.prototype.update=function(e,r){return this.inner.update(e,r),this},za.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},function(t){var e=t;e.utils=$t,e.common=Fa,e.sha=Ua,e.ripemd=l2,e.hmac=oE,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}(zf);var Y0,m2;function aE(){return m2||(m2=1,Y0={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"]]}}),Y0}(function(t){var e=t,r=zf,i=z0,n=Li,s=n.assert;function a(l){l.type==="short"?this.curve=new i.short(l):l.type==="edwards"?this.curve=new i.edwards(l):this.curve=new i.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=a;function u(l,b){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var w=new a(b);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:w}),w}})}u("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:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("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:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("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:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("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:r.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"]}),u("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:r.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"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),u("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:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var h;try{h=aE()}catch{h=void 0}u("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:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",h]})})(jf);var cE=zf,Uo=q0,b2=Lo;function ro(t){if(!(this instanceof ro))return new ro(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Uo.toArray(t.entropy,t.entropyEnc||"hex"),r=Uo.toArray(t.nonce,t.nonceEnc||"hex"),i=Uo.toArray(t.pers,t.persEnc||"hex");b2(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}var uE=ro;ro.prototype._init=function(e,r,i){var n=e.concat(r).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},ro.prototype._hmac=function(){return new cE.hmac(this.hash,this.K)},ro.prototype._update=function(e){var r=this._hmac().update(this.V).update([0]);e&&(r=r.update(e)),this.K=r.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())},ro.prototype.reseed=function(e,r,i,n){typeof r!="string"&&(n=i,i=r,r=null),e=Uo.toArray(e,r),i=Uo.toArray(i,n),b2(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this._reseed=1},ro.prototype.generate=function(e,r,i,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(n=i,i=r,r=null),i&&(i=Uo.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++,Uo.encode(a,r)};var fE=jn.exports,hE=Li,Q0=hE.assert;function Jr(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var lE=Jr;Jr.fromPublic=function(e,r,i){return r instanceof Jr?r:new Jr(e,{pub:r,pubEnc:i})},Jr.fromPrivate=function(e,r,i){return r instanceof Jr?r:new Jr(e,{priv:r,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,r){return typeof e=="string"&&(r=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),r?this.pub.encode(r,e):this.pub},Jr.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv},Jr.prototype._importPrivate=function(e,r){this.priv=new fE(e,r||16),this.priv=this.priv.umod(this.ec.curve.n)},Jr.prototype._importPublic=function(e,r){if(e.x||e.y){this.ec.curve.type==="mont"?Q0(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Q0(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,r)},Jr.prototype.derive=function(e){return e.validate()||Q0(e.validate(),"public point not validated"),e.mul(this.priv).getX()},Jr.prototype.sign=function(e,r,i){return this.ec.sign(e,this,r,i)},Jr.prototype.verify=function(e,r){return this.ec.verify(e,r,this)},Jr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var Wf=jn.exports,Z0=Li,dE=Z0.assert;function Vf(t,e){if(t instanceof Vf)return t;this._importDER(t,e)||(dE(t.r&&t.s,"Signature without r or s"),this.r=new Wf(t.r,16),this.s=new Wf(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var pE=Vf;function gE(){this.place=0}function X0(t,e){var r=t[e.place++];if(!(r&128))return r;var i=r&15;if(i===0||i>4||t[e.place]===0)return!1;for(var n=0,s=0,a=e.place;s<i;s++,a++)n<<=8,n|=t[a],n>>>=0;return n<=127?!1:(e.place=a,n)}function y2(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e<r;)e++;return e===0?t:t.slice(e)}Vf.prototype._importDER=function(e,r){e=Z0.toArray(e,r);var i=new gE;if(e[i.place++]!==48)return!1;var n=X0(e,i);if(n===!1||n+i.place!==e.length||e[i.place++]!==2)return!1;var s=X0(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 u=X0(e,i);if(u===!1||e.length!==u+i.place||e[i.place]&128)return!1;var h=e.slice(i.place,u+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 Wf(a),this.s=new Wf(h),this.recoveryParam=null,!0};function ed(t,e){if(e<128){t.push(e);return}var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Vf.prototype.toDER=function(e){var r=this.r.toArray(),i=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),i[0]&128&&(i=[0].concat(i)),r=y2(r),i=y2(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var n=[2];ed(n,r.length),n=n.concat(r),n.push(2),ed(n,i.length);var s=n.concat(i),a=[48];return ed(a,s.length),a=a.concat(s),Z0.encode(a,e)};var ko=jn.exports,w2=uE,vE=Li,td=jf,mE=Lf.exports,_2=vE.assert,rd=lE,Gf=pE;function Qi(t){if(!(this instanceof Qi))return new Qi(t);typeof t=="string"&&(_2(Object.prototype.hasOwnProperty.call(td,t),"Unknown curve "+t),t=td[t]),t instanceof td.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var bE=Qi;Qi.prototype.keyPair=function(e){return new rd(this,e)},Qi.prototype.keyFromPrivate=function(e,r){return rd.fromPrivate(this,e,r)},Qi.prototype.keyFromPublic=function(e,r){return rd.fromPublic(this,e,r)},Qi.prototype.genKeyPair=function(e){e||(e={});for(var r=new w2({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||mE(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),n=this.n.sub(new ko(2));;){var s=new ko(r.generate(i));if(!(s.cmp(n)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Qi.prototype._truncateToN=function(e,r){var i=e.byteLength()*8-this.n.bitLength();return i>0&&(e=e.ushrn(i)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Qi.prototype.sign=function(e,r,i,n){typeof i=="object"&&(n=i,i=null),n||(n={}),r=this.keyFromPrivate(r,i),e=this._truncateToN(new ko(e,16));for(var s=this.n.byteLength(),a=r.getPrivate().toArray("be",s),u=e.toArray("be",s),h=new w2({hash:this.hash,entropy:a,nonce:u,pers:n.pers,persEnc:n.persEnc||"utf8"}),l=this.n.sub(new ko(1)),b=0;;b++){var w=n.k?n.k(b):new ko(h.generate(this.n.byteLength()));if(w=this._truncateToN(w,!0),!(w.cmpn(1)<=0||w.cmp(l)>=0)){var I=this.g.mul(w);if(!I.isInfinity()){var S=I.getX(),D=S.umod(this.n);if(D.cmpn(0)!==0){var T=w.invm(this.n).mul(D.mul(r.getPrivate()).iadd(e));if(T=T.umod(this.n),T.cmpn(0)!==0){var q=(I.getY().isOdd()?1:0)|(S.cmp(D)!==0?2:0);return n.canonical&&T.cmp(this.nh)>0&&(T=this.n.sub(T),q^=1),new Gf({r:D,s:T,recoveryParam:q})}}}}}},Qi.prototype.verify=function(e,r,i,n){e=this._truncateToN(new ko(e,16)),i=this.keyFromPublic(i,n),r=new Gf(r,"hex");var s=r.r,a=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u=a.invm(this.n),h=u.mul(e).umod(this.n),l=u.mul(s).umod(this.n),b;return this.curve._maxwellTrick?(b=this.g.jmulAdd(h,i.getPublic(),l),b.isInfinity()?!1:b.eqXToP(s)):(b=this.g.mulAdd(h,i.getPublic(),l),b.isInfinity()?!1:b.getX().umod(this.n).cmp(s)===0)},Qi.prototype.recoverPubKey=function(t,e,r,i){_2((3&r)===r,"The recovery param is more than two bits"),e=new Gf(e,i);var n=this.n,s=new ko(t),a=e.r,u=e.s,h=r&1,l=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?a=this.curve.pointFromX(a.add(this.curve.n),h):a=this.curve.pointFromX(a,h);var b=e.r.invm(n),w=n.sub(s).mul(b).umod(n),I=u.mul(b).umod(n);return this.g.mulAdd(w,a,I)},Qi.prototype.getKeyRecoveryParam=function(t,e,r,i){if(e=new Gf(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(t,e,n)}catch{continue}if(s.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var su=Li,E2=su.assert,A2=su.parseBytes,Ha=su.cachedProperty;function Rr(t,e){this.eddsa=t,this._secret=A2(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=A2(e.pub)}Rr.fromPublic=function(e,r){return r instanceof Rr?r:new Rr(e,{pub:r})},Rr.fromSecret=function(e,r){return r instanceof Rr?r:new Rr(e,{secret:r})},Rr.prototype.secret=function(){return this._secret},Ha(Rr,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),Ha(Rr,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),Ha(Rr,"privBytes",function(){var e=this.eddsa,r=this.hash(),i=e.encodingLength-1,n=r.slice(0,e.encodingLength);return n[0]&=248,n[i]&=127,n[i]|=64,n}),Ha(Rr,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),Ha(Rr,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),Ha(Rr,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),Rr.prototype.sign=function(e){return E2(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Rr.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)},Rr.prototype.getSecret=function(e){return E2(this._secret,"KeyPair is public only"),su.encode(this.secret(),e)},Rr.prototype.getPublic=function(e){return su.encode(this.pubBytes(),e)};var yE=Rr,wE=jn.exports,Jf=Li,x2=Jf.assert,Yf=Jf.cachedProperty,_E=Jf.parseBytes;function qo(t,e){this.eddsa=t,typeof e!="object"&&(e=_E(e)),Array.isArray(e)&&(x2(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),x2(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof wE&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Yf(qo,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Yf(qo,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Yf(qo,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Yf(qo,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),qo.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},qo.prototype.toHex=function(){return Jf.encode(this.toBytes(),"hex").toUpperCase()};var EE=qo,AE=zf,xE=jf,Ka=Li,SE=Ka.assert,S2=Ka.parseBytes,I2=yE,M2=EE;function bi(t){if(SE(t==="ed25519","only tested with ed25519 so far"),!(this instanceof bi))return new bi(t);t=xE[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=AE.sha512}var IE=bi;bi.prototype.sign=function(e,r){e=S2(e);var i=this.keyFromSecret(r),n=this.hashInt(i.messagePrefix(),e),s=this.g.mul(n),a=this.encodePoint(s),u=this.hashInt(a,i.pubBytes(),e).mul(i.priv()),h=n.add(u).umod(this.curve.n);return this.makeSignature({R:s,S:h,Rencoded:a})},bi.prototype.verify=function(e,r,i){if(e=S2(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var n=this.keyFromPublic(i),s=this.hashInt(r.Rencoded(),n.pubBytes(),e),a=this.g.mul(r.S()),u=r.R().add(n.pub().mul(s));return u.eq(a)},bi.prototype.hashInt=function(){for(var e=this.hash(),r=0;r<arguments.length;r++)e.update(arguments[r]);return Ka.intFromLE(e.digest()).umod(this.curve.n)},bi.prototype.keyFromPublic=function(e){return I2.fromPublic(this,e)},bi.prototype.keyFromSecret=function(e){return I2.fromSecret(this,e)},bi.prototype.makeSignature=function(e){return e instanceof M2?e:new M2(this,e)},bi.prototype.encodePoint=function(e){var r=e.getY().toArray("le",this.encodingLength);return r[this.encodingLength-1]|=e.getX().isOdd()?128:0,r},bi.prototype.decodePoint=function(e){e=Ka.parseBytes(e);var r=e.length-1,i=e.slice(0,r).concat(e[r]&-129),n=(e[r]&128)!==0,s=Ka.intFromLE(i);return this.curve.pointFromY(s,n)},bi.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},bi.prototype.decodeInt=function(e){return Ka.intFromLE(e)},bi.prototype.isPoint=function(e){return e instanceof this.pointClass},function(t){var e=t;e.version=S9.version,e.utils=Li,e.rand=Lf.exports,e.curve=z0,e.curves=jf,e.ec=bE,e.eddsa=IE}(Kv);var id={},C2={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=wt,r=Ni;t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var i=function(){function u(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return u.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},u.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},u.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._tempHi),r.wipe(this._tempLo),this.reset()},u.prototype.update=function(h,l){if(l===void 0&&(l=h.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var b=0;if(this._bytesHashed+=l,this._bufferLength>0){for(;this._bufferLength<t.BLOCK_SIZE&&l>0;)this._buffer[this._bufferLength++]=h[b++],l--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(b=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,h,b,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=h[b++],l--;return this},u.prototype.finish=function(h){if(!this._finished){var l=this._bytesHashed,b=this._bufferLength,w=l/536870912|0,I=l<<3,S=l%128<112?128:256;this._buffer[b]=128;for(var D=b+1;D<S-8;D++)this._buffer[D]=0;e.writeUint32BE(w,this._buffer,S-8),e.writeUint32BE(I,this._buffer,S-4),s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,S),this._finished=!0}for(var D=0;D<this.digestLength/8;D++)e.writeUint32BE(this._stateHi[D],h,D*8),e.writeUint32BE(this._stateLo[D],h,D*8+4);return this},u.prototype.digest=function(){var h=new Uint8Array(this.digestLength);return this.finish(h),h},u.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},u.prototype.restoreState=function(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},u.prototype.cleanSavedState=function(h){r.wipe(h.stateHi),r.wipe(h.stateLo),h.buffer&&r.wipe(h.buffer),h.bufferLength=0,h.bytesHashed=0},u}();t.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(u,h,l,b,w,I,S){for(var D=l[0],T=l[1],q=l[2],K=l[3],F=l[4],W=l[5],R=l[6],k=l[7],H=b[0],_=b[1],B=b[2],ee=b[3],ie=b[4],L=b[5],y=b[6],f=b[7],d,v,E,C,O,M,g,m;S>=128;){for(var N=0;N<16;N++){var X=8*N+I;u[N]=e.readUint32BE(w,X),h[N]=e.readUint32BE(w,X+4)}for(var N=0;N<80;N++){var ae=D,P=T,te=q,z=K,G=F,J=W,A=R,V=k,oe=H,ue=_,he=B,ye=ee,we=ie,Re=L,Xe=y,Oe=f;if(d=k,v=f,O=v&65535,M=v>>>16,g=d&65535,m=d>>>16,d=(F>>>14|ie<<32-14)^(F>>>18|ie<<32-18)^(ie>>>41-32|F<<32-(41-32)),v=(ie>>>14|F<<32-14)^(ie>>>18|F<<32-18)^(F>>>41-32|ie<<32-(41-32)),O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,d=F&W^~F&R,v=ie&L^~ie&y,O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,d=n[N*2],v=n[N*2+1],O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,d=u[N%16],v=h[N%16],O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,M+=O>>>16,g+=M>>>16,m+=g>>>16,E=g&65535|m<<16,C=O&65535|M<<16,d=E,v=C,O=v&65535,M=v>>>16,g=d&65535,m=d>>>16,d=(D>>>28|H<<32-28)^(H>>>34-32|D<<32-(34-32))^(H>>>39-32|D<<32-(39-32)),v=(H>>>28|D<<32-28)^(D>>>34-32|H<<32-(34-32))^(D>>>39-32|H<<32-(39-32)),O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,d=D&T^D&q^T&q,v=H&_^H&B^_&B,O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,M+=O>>>16,g+=M>>>16,m+=g>>>16,V=g&65535|m<<16,Oe=O&65535|M<<16,d=z,v=ye,O=v&65535,M=v>>>16,g=d&65535,m=d>>>16,d=E,v=C,O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,M+=O>>>16,g+=M>>>16,m+=g>>>16,z=g&65535|m<<16,ye=O&65535|M<<16,T=ae,q=P,K=te,F=z,W=G,R=J,k=A,D=V,_=oe,B=ue,ee=he,ie=ye,L=we,y=Re,f=Xe,H=Oe,N%16===15)for(var X=0;X<16;X++)d=u[X],v=h[X],O=v&65535,M=v>>>16,g=d&65535,m=d>>>16,d=u[(X+9)%16],v=h[(X+9)%16],O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,E=u[(X+1)%16],C=h[(X+1)%16],d=(E>>>1|C<<32-1)^(E>>>8|C<<32-8)^E>>>7,v=(C>>>1|E<<32-1)^(C>>>8|E<<32-8)^(C>>>7|E<<32-7),O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,E=u[(X+14)%16],C=h[(X+14)%16],d=(E>>>19|C<<32-19)^(C>>>61-32|E<<32-(61-32))^E>>>6,v=(C>>>19|E<<32-19)^(E>>>61-32|C<<32-(61-32))^(C>>>6|E<<32-6),O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,M+=O>>>16,g+=M>>>16,m+=g>>>16,u[X]=g&65535|m<<16,h[X]=O&65535|M<<16}d=D,v=H,O=v&65535,M=v>>>16,g=d&65535,m=d>>>16,d=l[0],v=b[0],O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,M+=O>>>16,g+=M>>>16,m+=g>>>16,l[0]=D=g&65535|m<<16,b[0]=H=O&65535|M<<16,d=T,v=_,O=v&65535,M=v>>>16,g=d&65535,m=d>>>16,d=l[1],v=b[1],O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,M+=O>>>16,g+=M>>>16,m+=g>>>16,l[1]=T=g&65535|m<<16,b[1]=_=O&65535|M<<16,d=q,v=B,O=v&65535,M=v>>>16,g=d&65535,m=d>>>16,d=l[2],v=b[2],O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,M+=O>>>16,g+=M>>>16,m+=g>>>16,l[2]=q=g&65535|m<<16,b[2]=B=O&65535|M<<16,d=K,v=ee,O=v&65535,M=v>>>16,g=d&65535,m=d>>>16,d=l[3],v=b[3],O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,M+=O>>>16,g+=M>>>16,m+=g>>>16,l[3]=K=g&65535|m<<16,b[3]=ee=O&65535|M<<16,d=F,v=ie,O=v&65535,M=v>>>16,g=d&65535,m=d>>>16,d=l[4],v=b[4],O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,M+=O>>>16,g+=M>>>16,m+=g>>>16,l[4]=F=g&65535|m<<16,b[4]=ie=O&65535|M<<16,d=W,v=L,O=v&65535,M=v>>>16,g=d&65535,m=d>>>16,d=l[5],v=b[5],O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,M+=O>>>16,g+=M>>>16,m+=g>>>16,l[5]=W=g&65535|m<<16,b[5]=L=O&65535|M<<16,d=R,v=y,O=v&65535,M=v>>>16,g=d&65535,m=d>>>16,d=l[6],v=b[6],O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,M+=O>>>16,g+=M>>>16,m+=g>>>16,l[6]=R=g&65535|m<<16,b[6]=y=O&65535|M<<16,d=k,v=f,O=v&65535,M=v>>>16,g=d&65535,m=d>>>16,d=l[7],v=b[7],O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,M+=O>>>16,g+=M>>>16,m+=g>>>16,l[7]=k=g&65535|m<<16,b[7]=f=O&65535|M<<16,I+=128,S-=128}return I}function a(u){var h=new i;h.update(u);var l=h.digest();return h.clean(),l}t.hash=a})(C2),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=Zs,r=C2,i=Ni;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function n(z){const G=new Float64Array(16);if(z)for(let J=0;J<z.length;J++)G[J]=z[J];return G}const s=new Uint8Array(32);s[0]=9;const a=n(),u=n([1]),h=n([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),l=n([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),b=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]),I=n([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function S(z,G){for(let J=0;J<16;J++)z[J]=G[J]|0}function D(z){let G=1;for(let J=0;J<16;J++){let A=z[J]+G+65535;G=Math.floor(A/65536),z[J]=A-G*65536}z[0]+=G-1+37*(G-1)}function T(z,G,J){const A=~(J-1);for(let V=0;V<16;V++){const oe=A&(z[V]^G[V]);z[V]^=oe,G[V]^=oe}}function q(z,G){const J=n(),A=n();for(let V=0;V<16;V++)A[V]=G[V];D(A),D(A),D(A);for(let V=0;V<2;V++){J[0]=A[0]-65517;for(let ue=1;ue<15;ue++)J[ue]=A[ue]-65535-(J[ue-1]>>16&1),J[ue-1]&=65535;J[15]=A[15]-32767-(J[14]>>16&1);const oe=J[15]>>16&1;J[14]&=65535,T(A,J,1-oe)}for(let V=0;V<16;V++)z[2*V]=A[V]&255,z[2*V+1]=A[V]>>8}function K(z,G){let J=0;for(let A=0;A<32;A++)J|=z[A]^G[A];return(1&J-1>>>8)-1}function F(z,G){const J=new Uint8Array(32),A=new Uint8Array(32);return q(J,z),q(A,G),K(J,A)}function W(z){const G=new Uint8Array(32);return q(G,z),G[0]&1}function R(z,G){for(let J=0;J<16;J++)z[J]=G[2*J]+(G[2*J+1]<<8);z[15]&=32767}function k(z,G,J){for(let A=0;A<16;A++)z[A]=G[A]+J[A]}function H(z,G,J){for(let A=0;A<16;A++)z[A]=G[A]-J[A]}function _(z,G,J){let A,V,oe=0,ue=0,he=0,ye=0,we=0,Re=0,Xe=0,Oe=0,Ne=0,Me=0,be=0,Pe=0,Te=0,ve=0,$e=0,Se=0,me=0,Ue=0,Ce=0,_e=0,Ke=0,Ve=0,Ae=0,We=0,pt=0,Ge=0,It=0,gt=0,Ye=0,Ot=0,Tt=0,Le=J[0],et=J[1],it=J[2],Be=J[3],rt=J[4],tt=J[5],qe=J[6],ht=J[7],nt=J[8],je=J[9],st=J[10],at=J[11],Fe=J[12],Ze=J[13],lt=J[14],ze=J[15];A=G[0],oe+=A*Le,ue+=A*et,he+=A*it,ye+=A*Be,we+=A*rt,Re+=A*tt,Xe+=A*qe,Oe+=A*ht,Ne+=A*nt,Me+=A*je,be+=A*st,Pe+=A*at,Te+=A*Fe,ve+=A*Ze,$e+=A*lt,Se+=A*ze,A=G[1],ue+=A*Le,he+=A*et,ye+=A*it,we+=A*Be,Re+=A*rt,Xe+=A*tt,Oe+=A*qe,Ne+=A*ht,Me+=A*nt,be+=A*je,Pe+=A*st,Te+=A*at,ve+=A*Fe,$e+=A*Ze,Se+=A*lt,me+=A*ze,A=G[2],he+=A*Le,ye+=A*et,we+=A*it,Re+=A*Be,Xe+=A*rt,Oe+=A*tt,Ne+=A*qe,Me+=A*ht,be+=A*nt,Pe+=A*je,Te+=A*st,ve+=A*at,$e+=A*Fe,Se+=A*Ze,me+=A*lt,Ue+=A*ze,A=G[3],ye+=A*Le,we+=A*et,Re+=A*it,Xe+=A*Be,Oe+=A*rt,Ne+=A*tt,Me+=A*qe,be+=A*ht,Pe+=A*nt,Te+=A*je,ve+=A*st,$e+=A*at,Se+=A*Fe,me+=A*Ze,Ue+=A*lt,Ce+=A*ze,A=G[4],we+=A*Le,Re+=A*et,Xe+=A*it,Oe+=A*Be,Ne+=A*rt,Me+=A*tt,be+=A*qe,Pe+=A*ht,Te+=A*nt,ve+=A*je,$e+=A*st,Se+=A*at,me+=A*Fe,Ue+=A*Ze,Ce+=A*lt,_e+=A*ze,A=G[5],Re+=A*Le,Xe+=A*et,Oe+=A*it,Ne+=A*Be,Me+=A*rt,be+=A*tt,Pe+=A*qe,Te+=A*ht,ve+=A*nt,$e+=A*je,Se+=A*st,me+=A*at,Ue+=A*Fe,Ce+=A*Ze,_e+=A*lt,Ke+=A*ze,A=G[6],Xe+=A*Le,Oe+=A*et,Ne+=A*it,Me+=A*Be,be+=A*rt,Pe+=A*tt,Te+=A*qe,ve+=A*ht,$e+=A*nt,Se+=A*je,me+=A*st,Ue+=A*at,Ce+=A*Fe,_e+=A*Ze,Ke+=A*lt,Ve+=A*ze,A=G[7],Oe+=A*Le,Ne+=A*et,Me+=A*it,be+=A*Be,Pe+=A*rt,Te+=A*tt,ve+=A*qe,$e+=A*ht,Se+=A*nt,me+=A*je,Ue+=A*st,Ce+=A*at,_e+=A*Fe,Ke+=A*Ze,Ve+=A*lt,Ae+=A*ze,A=G[8],Ne+=A*Le,Me+=A*et,be+=A*it,Pe+=A*Be,Te+=A*rt,ve+=A*tt,$e+=A*qe,Se+=A*ht,me+=A*nt,Ue+=A*je,Ce+=A*st,_e+=A*at,Ke+=A*Fe,Ve+=A*Ze,Ae+=A*lt,We+=A*ze,A=G[9],Me+=A*Le,be+=A*et,Pe+=A*it,Te+=A*Be,ve+=A*rt,$e+=A*tt,Se+=A*qe,me+=A*ht,Ue+=A*nt,Ce+=A*je,_e+=A*st,Ke+=A*at,Ve+=A*Fe,Ae+=A*Ze,We+=A*lt,pt+=A*ze,A=G[10],be+=A*Le,Pe+=A*et,Te+=A*it,ve+=A*Be,$e+=A*rt,Se+=A*tt,me+=A*qe,Ue+=A*ht,Ce+=A*nt,_e+=A*je,Ke+=A*st,Ve+=A*at,Ae+=A*Fe,We+=A*Ze,pt+=A*lt,Ge+=A*ze,A=G[11],Pe+=A*Le,Te+=A*et,ve+=A*it,$e+=A*Be,Se+=A*rt,me+=A*tt,Ue+=A*qe,Ce+=A*ht,_e+=A*nt,Ke+=A*je,Ve+=A*st,Ae+=A*at,We+=A*Fe,pt+=A*Ze,Ge+=A*lt,It+=A*ze,A=G[12],Te+=A*Le,ve+=A*et,$e+=A*it,Se+=A*Be,me+=A*rt,Ue+=A*tt,Ce+=A*qe,_e+=A*ht,Ke+=A*nt,Ve+=A*je,Ae+=A*st,We+=A*at,pt+=A*Fe,Ge+=A*Ze,It+=A*lt,gt+=A*ze,A=G[13],ve+=A*Le,$e+=A*et,Se+=A*it,me+=A*Be,Ue+=A*rt,Ce+=A*tt,_e+=A*qe,Ke+=A*ht,Ve+=A*nt,Ae+=A*je,We+=A*st,pt+=A*at,Ge+=A*Fe,It+=A*Ze,gt+=A*lt,Ye+=A*ze,A=G[14],$e+=A*Le,Se+=A*et,me+=A*it,Ue+=A*Be,Ce+=A*rt,_e+=A*tt,Ke+=A*qe,Ve+=A*ht,Ae+=A*nt,We+=A*je,pt+=A*st,Ge+=A*at,It+=A*Fe,gt+=A*Ze,Ye+=A*lt,Ot+=A*ze,A=G[15],Se+=A*Le,me+=A*et,Ue+=A*it,Ce+=A*Be,_e+=A*rt,Ke+=A*tt,Ve+=A*qe,Ae+=A*ht,We+=A*nt,pt+=A*je,Ge+=A*st,It+=A*at,gt+=A*Fe,Ye+=A*Ze,Ot+=A*lt,Tt+=A*ze,oe+=38*me,ue+=38*Ue,he+=38*Ce,ye+=38*_e,we+=38*Ke,Re+=38*Ve,Xe+=38*Ae,Oe+=38*We,Ne+=38*pt,Me+=38*Ge,be+=38*It,Pe+=38*gt,Te+=38*Ye,ve+=38*Ot,$e+=38*Tt,V=1,A=oe+V+65535,V=Math.floor(A/65536),oe=A-V*65536,A=ue+V+65535,V=Math.floor(A/65536),ue=A-V*65536,A=he+V+65535,V=Math.floor(A/65536),he=A-V*65536,A=ye+V+65535,V=Math.floor(A/65536),ye=A-V*65536,A=we+V+65535,V=Math.floor(A/65536),we=A-V*65536,A=Re+V+65535,V=Math.floor(A/65536),Re=A-V*65536,A=Xe+V+65535,V=Math.floor(A/65536),Xe=A-V*65536,A=Oe+V+65535,V=Math.floor(A/65536),Oe=A-V*65536,A=Ne+V+65535,V=Math.floor(A/65536),Ne=A-V*65536,A=Me+V+65535,V=Math.floor(A/65536),Me=A-V*65536,A=be+V+65535,V=Math.floor(A/65536),be=A-V*65536,A=Pe+V+65535,V=Math.floor(A/65536),Pe=A-V*65536,A=Te+V+65535,V=Math.floor(A/65536),Te=A-V*65536,A=ve+V+65535,V=Math.floor(A/65536),ve=A-V*65536,A=$e+V+65535,V=Math.floor(A/65536),$e=A-V*65536,A=Se+V+65535,V=Math.floor(A/65536),Se=A-V*65536,oe+=V-1+37*(V-1),V=1,A=oe+V+65535,V=Math.floor(A/65536),oe=A-V*65536,A=ue+V+65535,V=Math.floor(A/65536),ue=A-V*65536,A=he+V+65535,V=Math.floor(A/65536),he=A-V*65536,A=ye+V+65535,V=Math.floor(A/65536),ye=A-V*65536,A=we+V+65535,V=Math.floor(A/65536),we=A-V*65536,A=Re+V+65535,V=Math.floor(A/65536),Re=A-V*65536,A=Xe+V+65535,V=Math.floor(A/65536),Xe=A-V*65536,A=Oe+V+65535,V=Math.floor(A/65536),Oe=A-V*65536,A=Ne+V+65535,V=Math.floor(A/65536),Ne=A-V*65536,A=Me+V+65535,V=Math.floor(A/65536),Me=A-V*65536,A=be+V+65535,V=Math.floor(A/65536),be=A-V*65536,A=Pe+V+65535,V=Math.floor(A/65536),Pe=A-V*65536,A=Te+V+65535,V=Math.floor(A/65536),Te=A-V*65536,A=ve+V+65535,V=Math.floor(A/65536),ve=A-V*65536,A=$e+V+65535,V=Math.floor(A/65536),$e=A-V*65536,A=Se+V+65535,V=Math.floor(A/65536),Se=A-V*65536,oe+=V-1+37*(V-1),z[0]=oe,z[1]=ue,z[2]=he,z[3]=ye,z[4]=we,z[5]=Re,z[6]=Xe,z[7]=Oe,z[8]=Ne,z[9]=Me,z[10]=be,z[11]=Pe,z[12]=Te,z[13]=ve,z[14]=$e,z[15]=Se}function B(z,G){_(z,G,G)}function ee(z,G){const J=n();let A;for(A=0;A<16;A++)J[A]=G[A];for(A=253;A>=0;A--)B(J,J),A!==2&&A!==4&&_(J,J,G);for(A=0;A<16;A++)z[A]=J[A]}function ie(z,G){const J=n();let A;for(A=0;A<16;A++)J[A]=G[A];for(A=250;A>=0;A--)B(J,J),A!==1&&_(J,J,G);for(A=0;A<16;A++)z[A]=J[A]}function L(z,G){const J=n(),A=n(),V=n(),oe=n(),ue=n(),he=n(),ye=n(),we=n(),Re=n();H(J,z[1],z[0]),H(Re,G[1],G[0]),_(J,J,Re),k(A,z[0],z[1]),k(Re,G[0],G[1]),_(A,A,Re),_(V,z[3],G[3]),_(V,V,l),_(oe,z[2],G[2]),k(oe,oe,oe),H(ue,A,J),H(he,oe,V),k(ye,oe,V),k(we,A,J),_(z[0],ue,he),_(z[1],we,ye),_(z[2],ye,he),_(z[3],ue,we)}function y(z,G,J){for(let A=0;A<4;A++)T(z[A],G[A],J)}function f(z,G){const J=n(),A=n(),V=n();ee(V,G[2]),_(J,G[0],V),_(A,G[1],V),q(z,A),z[31]^=W(J)<<7}function d(z,G,J){S(z[0],a),S(z[1],u),S(z[2],u),S(z[3],a);for(let A=255;A>=0;--A){const V=J[A/8|0]>>(A&7)&1;y(z,G,V),L(G,z),L(z,z),y(z,G,V)}}function v(z,G){const J=[n(),n(),n(),n()];S(J[0],b),S(J[1],w),S(J[2],u),_(J[3],b,w),d(z,J,G)}function E(z){if(z.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const G=(0,r.hash)(z);G[0]&=248,G[31]&=127,G[31]|=64;const J=new Uint8Array(32),A=[n(),n(),n(),n()];v(A,G),f(J,A);const V=new Uint8Array(64);return V.set(z),V.set(J,32),{publicKey:J,secretKey:V}}t.generateKeyPairFromSeed=E;function C(z){const G=(0,e.randomBytes)(32,z),J=E(G);return(0,i.wipe)(G),J}t.generateKeyPair=C;function O(z){if(z.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(z.subarray(32))}t.extractPublicKeyFromSecretKey=O;const M=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 g(z,G){let J,A,V,oe;for(A=63;A>=32;--A){for(J=0,V=A-32,oe=A-12;V<oe;++V)G[V]+=J-16*G[A]*M[V-(A-32)],J=Math.floor((G[V]+128)/256),G[V]-=J*256;G[V]+=J,G[A]=0}for(J=0,V=0;V<32;V++)G[V]+=J-(G[31]>>4)*M[V],J=G[V]>>8,G[V]&=255;for(V=0;V<32;V++)G[V]-=J*M[V];for(A=0;A<32;A++)G[A+1]+=G[A]>>8,z[A]=G[A]&255}function m(z){const G=new Float64Array(64);for(let J=0;J<64;J++)G[J]=z[J];for(let J=0;J<64;J++)z[J]=0;g(z,G)}function N(z,G){const J=new Float64Array(64),A=[n(),n(),n(),n()],V=(0,r.hash)(z.subarray(0,32));V[0]&=248,V[31]&=127,V[31]|=64;const oe=new Uint8Array(64);oe.set(V.subarray(32),32);const ue=new r.SHA512;ue.update(oe.subarray(32)),ue.update(G);const he=ue.digest();ue.clean(),m(he),v(A,he),f(oe,A),ue.reset(),ue.update(oe.subarray(0,32)),ue.update(z.subarray(32)),ue.update(G);const ye=ue.digest();m(ye);for(let we=0;we<32;we++)J[we]=he[we];for(let we=0;we<32;we++)for(let Re=0;Re<32;Re++)J[we+Re]+=ye[we]*V[Re];return g(oe.subarray(32),J),oe}t.sign=N;function X(z,G){const J=n(),A=n(),V=n(),oe=n(),ue=n(),he=n(),ye=n();return S(z[2],u),R(z[1],G),B(V,z[1]),_(oe,V,h),H(V,V,z[2]),k(oe,z[2],oe),B(ue,oe),B(he,ue),_(ye,he,ue),_(J,ye,V),_(J,J,oe),ie(J,J),_(J,J,V),_(J,J,oe),_(J,J,oe),_(z[0],J,oe),B(A,z[0]),_(A,A,oe),F(A,V)&&_(z[0],z[0],I),B(A,z[0]),_(A,A,oe),F(A,V)?-1:(W(z[0])===G[31]>>7&&H(z[0],a,z[0]),_(z[3],z[0],z[1]),0)}function ae(z,G,J){const A=new Uint8Array(32),V=[n(),n(),n(),n()],oe=[n(),n(),n(),n()];if(J.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(X(oe,z))return!1;const ue=new r.SHA512;ue.update(J.subarray(0,32)),ue.update(z),ue.update(G);const he=ue.digest();return m(he),d(V,oe,he),v(oe,J.subarray(32)),L(V,oe),f(A,V),!K(J,A)}t.verify=ae;function P(z){let G=[n(),n(),n(),n()];if(X(G,z))throw new Error("Ed25519: invalid public key");let J=n(),A=n(),V=G[1];k(J,u,V),H(A,u,V),ee(A,A),_(J,J,A);let oe=new Uint8Array(32);return q(oe,J),oe}t.convertPublicKeyToX25519=P;function te(z){const G=(0,r.hash)(z.subarray(0,32));G[0]&=248,G[31]&=127,G[31]|=64;const J=new Uint8Array(G.subarray(0,32));return(0,i.wipe)(G),J}t.convertSecretKeyToX25519=te}(id);const ME="EdDSA",CE="JWT",Qf=".",Zf="base64url",D2="utf8",O2="utf8",DE=":",OE="did",PE="key",P2="base58btc",$E="z",RE="K36",NE=32;function nd(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function $2(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?nd(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function TE(t,e){e||(e=t.reduce((n,s)=>n+s.length,0));const r=$2(e);let i=0;for(const n of t)r.set(n,i),i+=n.length;return nd(r)}function R2(t,e,r,i){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:i}}}const N2=R2("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),sd=R2("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=$2(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),T2={utf8:N2,"utf-8":N2,hex:Ra.base16,latin1:sd,ascii:sd,binary:sd,...Ra};function Xf(t,e="utf8"){const r=T2[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}function Wa(t,e="utf8"){const r=T2[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?nd(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}const LE=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),BE=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(i,n)=>typeof n=="string"&&n.match(/^\d+n$/)?BigInt(n.substring(0,n.length-1)):n)};function jo(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return BE(t)}catch{return t}}function Cs(t){return typeof t=="string"?t:LE(t)||""}function L2(t){return jo(Xf(Wa(t,Zf),D2))}function eh(t){return Xf(Wa(Cs(t),D2),Zf)}function B2(t){const e=Wa(RE,P2),r=$E+Xf(TE([e,t]),P2);return[OE,PE,r].join(DE)}function FE(t){return Xf(t,Zf)}function UE(t){return Wa(t,Zf)}function kE(t){return Wa([eh(t.header),eh(t.payload)].join(Qf),O2)}function qE(t){return[eh(t.header),eh(t.payload),FE(t.signature)].join(Qf)}function od(t){const e=t.split(Qf),r=L2(e[0]),i=L2(e[1]),n=UE(e[2]),s=Wa(e.slice(0,2).join(Qf),O2);return{header:r,payload:i,signature:n,data:s}}function F2(t=Zs.randomBytes(NE)){return id.generateKeyPairFromSeed(t)}async function jE(t,e,r,i,n=xe.fromMiliseconds(Date.now())){const s={alg:ME,typ:CE},a=B2(i.publicKey),u=n+r,h={iss:a,sub:t,aud:e,iat:n,exp:u},l=kE({header:s,payload:h}),b=id.sign(i.secretKey,l);return qE({header:s,payload:h,signature:b})}const zE={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"}},HE=":";function ou(t){const[e,r]=t.split(HE);return{namespace:e,reference:r}}function U2(t,e=[]){const r=[];return Object.keys(t).forEach(i=>{if(e.length&&!e.includes(i))return;const n=t[i];r.push(...n.accounts)}),r}function k2(t,e){return t.includes(":")?[t]:e.chains||[]}var KE=Object.defineProperty,q2=Object.getOwnPropertySymbols,WE=Object.prototype.hasOwnProperty,VE=Object.prototype.propertyIsEnumerable,j2=(t,e,r)=>e in t?KE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,z2=(t,e)=>{for(var r in e||(e={}))WE.call(e,r)&&j2(t,r,e[r]);if(q2)for(var r of q2(e))VE.call(e,r)&&j2(t,r,e[r]);return t};const GE="ReactNative",Bi={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},JE="js";function th(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Va(){return!Cf()&&!!S0()&&navigator.product===GE}function au(){return!th()&&!!S0()&&!!Cf()}function cu(){return Va()?Bi.reactNative:th()?Bi.node:au()?Bi.browser:Bi.unknown}function YE(){var t;try{return Va()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function QE(t,e){let r=Zc.parse(t);return r=z2(z2({},r),e),t=Zc.stringify(r),t}function ZE(){return uv()||{name:"",description:"",url:"",icons:[""]}}function XE(){if(cu()===Bi.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:i}=global.Platform;return[r,i].join("-")}const t=a4();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function eA(){var t;const e=cu();return e===Bi.browser?[e,((t=cv())==null?void 0:t.host)||"unknown"].join(":"):e}function H2(t,e,r){const i=XE(),n=eA();return[[t,e].join("-"),[JE,r].join("-"),i,n].join("/")}function tA({protocol:t,version:e,relayUrl:r,sdkVersion:i,auth:n,projectId:s,useOnCloseEvent:a,bundleId:u}){const h=r.split("?"),l=H2(t,e,i),b={auth:n,ua:l,projectId:s,useOnCloseEvent:a||void 0,origin:u||void 0},w=QE(h[1]||"",b);return h[0]+"?"+w}function zo(t,e){return t.filter(r=>e.includes(r)).length===t.length}function K2(t){return Object.fromEntries(t.entries())}function W2(t){return new Map(Object.entries(t))}function Ho(t=xe.FIVE_MINUTES,e){const r=xe.toMiliseconds(t||xe.FIVE_MINUTES);let i,n,s;return{resolve:a=>{s&&i&&(clearTimeout(s),i(a))},reject:a=>{s&&n&&(clearTimeout(s),n(a))},done:()=>new Promise((a,u)=>{s=setTimeout(()=>{u(new Error(e))},r),i=a,n=u})}}function Ga(t,e,r){return new Promise(async(i,n)=>{const s=setTimeout(()=>n(new Error(r)),e);try{const a=await t;i(a)}catch(a){n(a)}clearTimeout(s)})}function V2(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function rA(t){return V2("topic",t)}function iA(t){return V2("id",t)}function G2(t){const[e,r]=t.split(":"),i={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")i.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))i.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return i}function Ir(t,e){return xe.fromMiliseconds((e||Date.now())+xe.toMiliseconds(t))}function io(t){return Date.now()>=xe.toMiliseconds(t)}function Dt(t,e){return`${t}${e?`:${e}`:""}`}function rh(t=[],e=[]){return[...new Set([...t,...e])]}async function nA({id:t,topic:e,wcDeepLink:r}){var i;try{if(!r)return;const n=typeof r=="string"?JSON.parse(r):r;let s=n?.href;if(typeof s!="string")return;s.endsWith("/")&&(s=s.slice(0,-1));const a=`${s}/wc?requestId=${t}&sessionTopic=${e}`,u=cu();if(u===Bi.browser){if(!((i=Cf())!=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,"_self","noreferrer noopener")}else u===Bi.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(a)}catch(n){console.error(n)}}async function sA(t,e){try{return await t.getItem(e)||(au()?localStorage.getItem(e):void 0)}catch(r){console.error(r)}}function J2(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),i=r.indexOf(e);return r[i+2]}function Y2(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function ad(){return typeof process<"u"&&process.env.IS_VITEST==="true"}var Q2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function oA(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(r,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}),r}var Z2={exports:{}};/**
14
+ ***************************************************************************** */var b0=function(t,e){return b0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},b0(t,e)};function d4(t,e){b0(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var y0=function(){return y0=Object.assign||function(e){for(var r,i=1,n=arguments.length;i<n;i++){r=arguments[i];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},y0.apply(this,arguments)};function p4(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r}function g4(t,e,r,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,i);else for(var u=t.length-1;u>=0;u--)(a=t[u])&&(s=(n<3?a(s):n>3?a(e,r,s):a(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s}function v4(t,e){return function(r,i){e(r,i,t)}}function m4(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function b4(t,e,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function u(b){try{l(i.next(b))}catch(w){a(w)}}function h(b){try{l(i.throw(b))}catch(w){a(w)}}function l(b){b.done?s(b.value):n(b.value).then(u,h)}l((i=i.apply(t,e||[])).next())})}function y4(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(l){return function(b){return h([l,b])}}function h(l){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,n&&(s=l[0]&2?n.return:l[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,l[1])).done)return s;switch(n=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,n=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){r.label=l[1];break}if(l[0]===6&&r.label<s[1]){r.label=s[1],s=l;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(l);break}s[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(b){l=[6,b],n=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function w4(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}function _4(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function w0(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Qg(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var i=r.call(t),n,s=[],a;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(u){a={error:u}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(a)throw a.error}}return s}function E4(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Qg(arguments[e]));return t}function A4(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var i=Array(t),n=0,e=0;e<r;e++)for(var s=arguments[e],a=0,u=s.length;a<u;a++,n++)i[n]=s[a];return i}function Jc(t){return this instanceof Jc?(this.v=t,this):new Jc(t)}function x4(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=r.apply(t,e||[]),n,s=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(I){i[I]&&(n[I]=function(S){return new Promise(function(D,T){s.push([I,S,D,T])>1||u(I,S)})})}function u(I,S){try{h(i[I](S))}catch(D){w(s[0][3],D)}}function h(I){I.value instanceof Jc?Promise.resolve(I.value.v).then(l,b):w(s[0][2],I)}function l(I){u("next",I)}function b(I){u("throw",I)}function w(I,S){I(S),s.shift(),s.length&&u(s[0][0],s[0][1])}}function S4(t){var e,r;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]=t[n]?function(a){return(r=!r)?{value:Jc(t[n](a)),done:n==="return"}:s?s(a):a}:s}}function I4(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof w0=="function"?w0(t):t[Symbol.iterator](),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(s){r[s]=t[s]&&function(a){return new Promise(function(u,h){a=t[s](a),n(u,h,a.done,a.value)})}}function n(s,a,u,h){Promise.resolve(h).then(function(l){s({value:l,done:u})},a)}}function M4(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function C4(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function D4(t){return t&&t.__esModule?t:{default:t}}function O4(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function P4(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var $4=Object.freeze({__proto__:null,__extends:d4,get __assign(){return y0},__rest:p4,__decorate:g4,__param:v4,__metadata:m4,__awaiter:b4,__generator:y4,__createBinding:w4,__exportStar:_4,__values:w0,__read:Qg,__spread:E4,__spreadArrays:A4,__await:Jc,__asyncGenerator:x4,__asyncDelegator:S4,__asyncValues:I4,__makeTemplateObject:M4,__importStar:C4,__importDefault:D4,__classPrivateFieldGet:O4,__classPrivateFieldSet:P4}),Mf=m0($4),_0={},Yc={},Zg;function R4(){if(Zg)return Yc;Zg=1,Object.defineProperty(Yc,"__esModule",{value:!0}),Yc.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Yc.delay=t,Yc}var Ro={},E0={},No={},Xg;function N4(){return Xg||(Xg=1,Object.defineProperty(No,"__esModule",{value:!0}),No.ONE_THOUSAND=No.ONE_HUNDRED=void 0,No.ONE_HUNDRED=100,No.ONE_THOUSAND=1e3),No}var A0={},ev;function T4(){return ev||(ev=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(A0)),A0}var tv;function rv(){return tv||(tv=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Mf;e.__exportStar(N4(),t),e.__exportStar(T4(),t)}(E0)),E0}var iv;function L4(){if(iv)return Ro;iv=1,Object.defineProperty(Ro,"__esModule",{value:!0}),Ro.fromMiliseconds=Ro.toMiliseconds=void 0;const t=rv();function e(i){return i*t.ONE_THOUSAND}Ro.toMiliseconds=e;function r(i){return Math.floor(i/t.ONE_THOUSAND)}return Ro.fromMiliseconds=r,Ro}var nv;function B4(){return nv||(nv=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Mf;e.__exportStar(R4(),t),e.__exportStar(L4(),t)}(_0)),_0}var Pa={},sv;function F4(){if(sv)return Pa;sv=1,Object.defineProperty(Pa,"__esModule",{value:!0}),Pa.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const i=this.get(r);if(typeof i.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const n=Date.now()-i.started;this.timestamps.set(r,{started:i.started,elapsed:n})}get(r){const i=this.timestamps.get(r);if(typeof i>"u")throw new Error(`No timestamp found for label: ${r}`);return i}elapsed(r){const i=this.get(r);return i.elapsed||Date.now()-i.started}}return Pa.Watch=t,Pa.default=t,Pa}var x0={},Qc={},ov;function U4(){if(ov)return Qc;ov=1,Object.defineProperty(Qc,"__esModule",{value:!0}),Qc.IWatch=void 0;class t{}return Qc.IWatch=t,Qc}var av;function k4(){return av||(av=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Mf.__exportStar(U4(),t)}(x0)),x0}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Mf;e.__exportStar(B4(),t),e.__exportStar(F4(),t),e.__exportStar(k4(),t),e.__exportStar(rv(),t)})(xe);var ir={};Object.defineProperty(ir,"__esModule",{value:!0}),ir.getLocalStorage=ir.getLocalStorageOrThrow=ir.getCrypto=ir.getCryptoOrThrow=cv=ir.getLocation=ir.getLocationOrThrow=S0=ir.getNavigator=ir.getNavigatorOrThrow=Cf=ir.getDocument=ir.getDocumentOrThrow=ir.getFromWindowOrThrow=ir.getFromWindow=void 0;function To(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}ir.getFromWindow=To;function $a(t){const e=To(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}ir.getFromWindowOrThrow=$a;function q4(){return $a("document")}ir.getDocumentOrThrow=q4;function j4(){return To("document")}var Cf=ir.getDocument=j4;function z4(){return $a("navigator")}ir.getNavigatorOrThrow=z4;function H4(){return To("navigator")}var S0=ir.getNavigator=H4;function K4(){return $a("location")}ir.getLocationOrThrow=K4;function W4(){return To("location")}var cv=ir.getLocation=W4;function V4(){return $a("crypto")}ir.getCryptoOrThrow=V4;function G4(){return To("crypto")}ir.getCrypto=G4;function J4(){return $a("localStorage")}ir.getLocalStorageOrThrow=J4;function Y4(){return To("localStorage")}ir.getLocalStorage=Y4;var I0={};Object.defineProperty(I0,"__esModule",{value:!0});var uv=I0.getWindowMetadata=void 0;const fv=ir;function Q4(){let t,e;try{t=fv.getDocumentOrThrow(),e=fv.getLocationOrThrow()}catch{return null}function r(){const w=t.getElementsByTagName("link"),I=[];for(let S=0;S<w.length;S++){const D=w[S],T=D.getAttribute("rel");if(T&&T.toLowerCase().indexOf("icon")>-1){const q=D.getAttribute("href");if(q)if(q.toLowerCase().indexOf("https:")===-1&&q.toLowerCase().indexOf("http:")===-1&&q.indexOf("//")!==0){let K=e.protocol+"//"+e.host;if(q.indexOf("/")===0)K+=q;else{const F=e.pathname.split("/");F.pop();const W=F.join("/");K+=W+"/"+q}I.push(K)}else if(q.indexOf("//")===0){const K=e.protocol+q;I.push(K)}else I.push(q)}}return I}function i(...w){const I=t.getElementsByTagName("meta");for(let S=0;S<I.length;S++){const D=I[S],T=["itemprop","property","name"].map(q=>D.getAttribute(q)).filter(q=>q?w.includes(q):!1);if(T.length&&T){const q=D.getAttribute("content");if(q)return q}}return""}function n(){let w=i("name","og:site_name","og:title","twitter:title");return w||(w=t.title),w}function s(){return i("description","og:description","twitter:description","keywords")}const a=n(),u=s(),h=e.origin,l=r();return{description:u,url:h,icons:l,name:a}}uv=I0.getWindowMetadata=Q4;var Zc={},Z4=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),hv="%[a-f0-9]{2}",lv=new RegExp("("+hv+")|([^%]+?)","gi"),dv=new RegExp("("+hv+")+","gi");function M0(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),i=t.slice(e);return Array.prototype.concat.call([],M0(r),M0(i))}function X4(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(lv)||[],r=1;r<e.length;r++)t=M0(e,r).join(""),e=t.match(lv)||[];return t}}function e8(t){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},r=dv.exec(t);r;){try{e[r[0]]=decodeURIComponent(r[0])}catch{var i=X4(r[0]);i!==r[0]&&(e[r[0]]=i)}r=dv.exec(t)}e["%C2"]="\uFFFD";for(var n=Object.keys(e),s=0;s<n.length;s++){var a=n[s];t=t.replace(new RegExp(a,"g"),e[a])}return t}var t8=function(t){if(typeof t!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return e8(t)}},r8=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},i8=function(t,e){for(var r={},i=Object.keys(t),n=Array.isArray(e),s=0;s<i.length;s++){var a=i[s],u=t[a];(n?e.indexOf(a)!==-1:e(a,u,t))&&(r[a]=u)}return r};(function(t){const e=Z4,r=t8,i=r8,n=i8,s=F=>F==null,a=Symbol("encodeFragmentIdentifier");function u(F){switch(F.arrayFormat){case"index":return W=>(R,k)=>{const H=R.length;return k===void 0||F.skipNull&&k===null||F.skipEmptyString&&k===""?R:k===null?[...R,[b(W,F),"[",H,"]"].join("")]:[...R,[b(W,F),"[",b(H,F),"]=",b(k,F)].join("")]};case"bracket":return W=>(R,k)=>k===void 0||F.skipNull&&k===null||F.skipEmptyString&&k===""?R:k===null?[...R,[b(W,F),"[]"].join("")]:[...R,[b(W,F),"[]=",b(k,F)].join("")];case"colon-list-separator":return W=>(R,k)=>k===void 0||F.skipNull&&k===null||F.skipEmptyString&&k===""?R:k===null?[...R,[b(W,F),":list="].join("")]:[...R,[b(W,F),":list=",b(k,F)].join("")];case"comma":case"separator":case"bracket-separator":{const W=F.arrayFormat==="bracket-separator"?"[]=":"=";return R=>(k,H)=>H===void 0||F.skipNull&&H===null||F.skipEmptyString&&H===""?k:(H=H===null?"":H,k.length===0?[[b(R,F),W,b(H,F)].join("")]:[[k,b(H,F)].join(F.arrayFormatSeparator)])}default:return W=>(R,k)=>k===void 0||F.skipNull&&k===null||F.skipEmptyString&&k===""?R:k===null?[...R,b(W,F)]:[...R,[b(W,F),"=",b(k,F)].join("")]}}function h(F){let W;switch(F.arrayFormat){case"index":return(R,k,H)=>{if(W=/\[(\d*)\]$/.exec(R),R=R.replace(/\[\d*\]$/,""),!W){H[R]=k;return}H[R]===void 0&&(H[R]={}),H[R][W[1]]=k};case"bracket":return(R,k,H)=>{if(W=/(\[\])$/.exec(R),R=R.replace(/\[\]$/,""),!W){H[R]=k;return}if(H[R]===void 0){H[R]=[k];return}H[R]=[].concat(H[R],k)};case"colon-list-separator":return(R,k,H)=>{if(W=/(:list)$/.exec(R),R=R.replace(/:list$/,""),!W){H[R]=k;return}if(H[R]===void 0){H[R]=[k];return}H[R]=[].concat(H[R],k)};case"comma":case"separator":return(R,k,H)=>{const _=typeof k=="string"&&k.includes(F.arrayFormatSeparator),B=typeof k=="string"&&!_&&w(k,F).includes(F.arrayFormatSeparator);k=B?w(k,F):k;const ee=_||B?k.split(F.arrayFormatSeparator).map(ie=>w(ie,F)):k===null?k:w(k,F);H[R]=ee};case"bracket-separator":return(R,k,H)=>{const _=/(\[\])$/.test(R);if(R=R.replace(/\[\]$/,""),!_){H[R]=k&&w(k,F);return}const B=k===null?[]:k.split(F.arrayFormatSeparator).map(ee=>w(ee,F));if(H[R]===void 0){H[R]=B;return}H[R]=[].concat(H[R],B)};default:return(R,k,H)=>{if(H[R]===void 0){H[R]=k;return}H[R]=[].concat(H[R],k)}}}function l(F){if(typeof F!="string"||F.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function b(F,W){return W.encode?W.strict?e(F):encodeURIComponent(F):F}function w(F,W){return W.decode?r(F):F}function I(F){return Array.isArray(F)?F.sort():typeof F=="object"?I(Object.keys(F)).sort((W,R)=>Number(W)-Number(R)).map(W=>F[W]):F}function S(F){const W=F.indexOf("#");return W!==-1&&(F=F.slice(0,W)),F}function D(F){let W="";const R=F.indexOf("#");return R!==-1&&(W=F.slice(R)),W}function T(F){F=S(F);const W=F.indexOf("?");return W===-1?"":F.slice(W+1)}function q(F,W){return W.parseNumbers&&!Number.isNaN(Number(F))&&typeof F=="string"&&F.trim()!==""?F=Number(F):W.parseBooleans&&F!==null&&(F.toLowerCase()==="true"||F.toLowerCase()==="false")&&(F=F.toLowerCase()==="true"),F}function K(F,W){W=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},W),l(W.arrayFormatSeparator);const R=h(W),k=Object.create(null);if(typeof F!="string"||(F=F.trim().replace(/^[?#&]/,""),!F))return k;for(const H of F.split("&")){if(H==="")continue;let[_,B]=i(W.decode?H.replace(/\+/g," "):H,"=");B=B===void 0?null:["comma","separator","bracket-separator"].includes(W.arrayFormat)?B:w(B,W),R(w(_,W),B,k)}for(const H of Object.keys(k)){const _=k[H];if(typeof _=="object"&&_!==null)for(const B of Object.keys(_))_[B]=q(_[B],W);else k[H]=q(_,W)}return W.sort===!1?k:(W.sort===!0?Object.keys(k).sort():Object.keys(k).sort(W.sort)).reduce((H,_)=>{const B=k[_];return B&&typeof B=="object"&&!Array.isArray(B)?H[_]=I(B):H[_]=B,H},Object.create(null))}t.extract=T,t.parse=K,t.stringify=(F,W)=>{if(!F)return"";W=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},W),l(W.arrayFormatSeparator);const R=B=>W.skipNull&&s(F[B])||W.skipEmptyString&&F[B]==="",k=u(W),H={};for(const B of Object.keys(F))R(B)||(H[B]=F[B]);const _=Object.keys(H);return W.sort!==!1&&_.sort(W.sort),_.map(B=>{const ee=F[B];return ee===void 0?"":ee===null?b(B,W):Array.isArray(ee)?ee.length===0&&W.arrayFormat==="bracket-separator"?b(B,W)+"[]":ee.reduce(k(B),[]).join("&"):b(B,W)+"="+b(ee,W)}).filter(B=>B.length>0).join("&")},t.parseUrl=(F,W)=>{W=Object.assign({decode:!0},W);const[R,k]=i(F,"#");return Object.assign({url:R.split("?")[0]||"",query:K(T(F),W)},W&&W.parseFragmentIdentifier&&k?{fragmentIdentifier:w(k,W)}:{})},t.stringifyUrl=(F,W)=>{W=Object.assign({encode:!0,strict:!0,[a]:!0},W);const R=S(F.url).split("?")[0]||"",k=t.extract(F.url),H=t.parse(k,{sort:!1}),_=Object.assign(H,F.query);let B=t.stringify(_,W);B&&(B=`?${B}`);let ee=D(F.url);return F.fragmentIdentifier&&(ee=`#${W[a]?b(F.fragmentIdentifier,W):F.fragmentIdentifier}`),`${R}${B}${ee}`},t.pick=(F,W,R)=>{R=Object.assign({parseFragmentIdentifier:!0,[a]:!1},R);const{url:k,query:H,fragmentIdentifier:_}=t.parseUrl(F,R);return t.stringifyUrl({url:k,query:n(H,W),fragmentIdentifier:_},R)},t.exclude=(F,W,R)=>{const k=Array.isArray(W)?H=>!W.includes(H):(H,_)=>!W(H,_);return t.pick(F,k,R)}})(Zc);var C0={},Df={},wt={},pv={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});function e(u,h){var l=u>>>16&65535,b=u&65535,w=h>>>16&65535,I=h&65535;return b*I+(l*I+b*w<<16>>>0)|0}t.mul=Math.imul||e;function r(u,h){return u+h|0}t.add=r;function i(u,h){return u-h|0}t.sub=i;function n(u,h){return u<<h|u>>>32-h}t.rotl=n;function s(u,h){return u<<32-h|u>>>h}t.rotr=s;function a(u){return typeof u=="number"&&isFinite(u)&&Math.floor(u)===u}t.isInteger=Number.isInteger||a,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(u){return t.isInteger(u)&&u>=-t.MAX_SAFE_INTEGER&&u<=t.MAX_SAFE_INTEGER}})(pv),Object.defineProperty(wt,"__esModule",{value:!0});var gv=pv;function n8(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}wt.readInt16BE=n8;function s8(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}wt.readUint16BE=s8;function o8(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}wt.readInt16LE=o8;function a8(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}wt.readUint16LE=a8;function vv(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}wt.writeUint16BE=vv,wt.writeInt16BE=vv;function mv(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}wt.writeUint16LE=mv,wt.writeInt16LE=mv;function D0(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}wt.readInt32BE=D0;function O0(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}wt.readUint32BE=O0;function P0(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}wt.readInt32LE=P0;function $0(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}wt.readUint32LE=$0;function Of(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}wt.writeUint32BE=Of,wt.writeInt32BE=Of;function Pf(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}wt.writeUint32LE=Pf,wt.writeInt32LE=Pf;function c8(t,e){e===void 0&&(e=0);var r=D0(t,e),i=D0(t,e+4);return r*4294967296+i-(i>>31)*4294967296}wt.readInt64BE=c8;function u8(t,e){e===void 0&&(e=0);var r=O0(t,e),i=O0(t,e+4);return r*4294967296+i}wt.readUint64BE=u8;function f8(t,e){e===void 0&&(e=0);var r=P0(t,e),i=P0(t,e+4);return i*4294967296+r-(r>>31)*4294967296}wt.readInt64LE=f8;function h8(t,e){e===void 0&&(e=0);var r=$0(t,e),i=$0(t,e+4);return i*4294967296+r}wt.readUint64LE=h8;function bv(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Of(t/4294967296>>>0,e,r),Of(t>>>0,e,r+4),e}wt.writeUint64BE=bv,wt.writeInt64BE=bv;function yv(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Pf(t>>>0,e,r),Pf(t/4294967296>>>0,e,r+4),e}wt.writeUint64LE=yv,wt.writeInt64LE=yv;function l8(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,n=1,s=t/8+r-1;s>=r;s--)i+=e[s]*n,n*=256;return i}wt.readUintBE=l8;function d8(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,n=1,s=r;s<r+t/8;s++)i+=e[s]*n,n*=256;return i}wt.readUintLE=d8;function p8(t,e,r,i){if(r===void 0&&(r=new Uint8Array(t/8)),i===void 0&&(i=0),t%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!gv.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var n=1,s=t/8+i-1;s>=i;s--)r[s]=e/n&255,n*=256;return r}wt.writeUintBE=p8;function g8(t,e,r,i){if(r===void 0&&(r=new Uint8Array(t/8)),i===void 0&&(i=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!gv.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var n=1,s=i;s<i+t/8;s++)r[s]=e/n&255,n*=256;return r}wt.writeUintLE=g8;function v8(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e)}wt.readFloat32BE=v8;function m8(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e,!0)}wt.readFloat32LE=m8;function b8(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e)}wt.readFloat64BE=b8;function y8(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e,!0)}wt.readFloat64LE=y8;function w8(t,e,r){e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(r,t),e}wt.writeFloat32BE=w8;function _8(t,e,r){e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(r,t,!0),e}wt.writeFloat32LE=_8;function E8(t,e,r){e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(r,t),e}wt.writeFloat64BE=E8;function A8(t,e,r){e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(r,t,!0),e}wt.writeFloat64LE=A8;var Ni={};Object.defineProperty(Ni,"__esModule",{value:!0});function x8(t){for(var e=0;e<t.length;e++)t[e]=0;return t}Ni.wipe=x8,Object.defineProperty(Df,"__esModule",{value:!0});var Gr=wt,R0=Ni,S8=20;function I8(t,e,r){for(var i=1634760805,n=857760878,s=2036477234,a=1797285236,u=r[3]<<24|r[2]<<16|r[1]<<8|r[0],h=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],b=r[15]<<24|r[14]<<16|r[13]<<8|r[12],w=r[19]<<24|r[18]<<16|r[17]<<8|r[16],I=r[23]<<24|r[22]<<16|r[21]<<8|r[20],S=r[27]<<24|r[26]<<16|r[25]<<8|r[24],D=r[31]<<24|r[30]<<16|r[29]<<8|r[28],T=e[3]<<24|e[2]<<16|e[1]<<8|e[0],q=e[7]<<24|e[6]<<16|e[5]<<8|e[4],K=e[11]<<24|e[10]<<16|e[9]<<8|e[8],F=e[15]<<24|e[14]<<16|e[13]<<8|e[12],W=i,R=n,k=s,H=a,_=u,B=h,ee=l,ie=b,L=w,y=I,f=S,d=D,v=T,E=q,C=K,O=F,M=0;M<S8;M+=2)W=W+_|0,v^=W,v=v>>>32-16|v<<16,L=L+v|0,_^=L,_=_>>>32-12|_<<12,R=R+B|0,E^=R,E=E>>>32-16|E<<16,y=y+E|0,B^=y,B=B>>>32-12|B<<12,k=k+ee|0,C^=k,C=C>>>32-16|C<<16,f=f+C|0,ee^=f,ee=ee>>>32-12|ee<<12,H=H+ie|0,O^=H,O=O>>>32-16|O<<16,d=d+O|0,ie^=d,ie=ie>>>32-12|ie<<12,k=k+ee|0,C^=k,C=C>>>32-8|C<<8,f=f+C|0,ee^=f,ee=ee>>>32-7|ee<<7,H=H+ie|0,O^=H,O=O>>>32-8|O<<8,d=d+O|0,ie^=d,ie=ie>>>32-7|ie<<7,R=R+B|0,E^=R,E=E>>>32-8|E<<8,y=y+E|0,B^=y,B=B>>>32-7|B<<7,W=W+_|0,v^=W,v=v>>>32-8|v<<8,L=L+v|0,_^=L,_=_>>>32-7|_<<7,W=W+B|0,O^=W,O=O>>>32-16|O<<16,f=f+O|0,B^=f,B=B>>>32-12|B<<12,R=R+ee|0,v^=R,v=v>>>32-16|v<<16,d=d+v|0,ee^=d,ee=ee>>>32-12|ee<<12,k=k+ie|0,E^=k,E=E>>>32-16|E<<16,L=L+E|0,ie^=L,ie=ie>>>32-12|ie<<12,H=H+_|0,C^=H,C=C>>>32-16|C<<16,y=y+C|0,_^=y,_=_>>>32-12|_<<12,k=k+ie|0,E^=k,E=E>>>32-8|E<<8,L=L+E|0,ie^=L,ie=ie>>>32-7|ie<<7,H=H+_|0,C^=H,C=C>>>32-8|C<<8,y=y+C|0,_^=y,_=_>>>32-7|_<<7,R=R+ee|0,v^=R,v=v>>>32-8|v<<8,d=d+v|0,ee^=d,ee=ee>>>32-7|ee<<7,W=W+B|0,O^=W,O=O>>>32-8|O<<8,f=f+O|0,B^=f,B=B>>>32-7|B<<7;Gr.writeUint32LE(W+i|0,t,0),Gr.writeUint32LE(R+n|0,t,4),Gr.writeUint32LE(k+s|0,t,8),Gr.writeUint32LE(H+a|0,t,12),Gr.writeUint32LE(_+u|0,t,16),Gr.writeUint32LE(B+h|0,t,20),Gr.writeUint32LE(ee+l|0,t,24),Gr.writeUint32LE(ie+b|0,t,28),Gr.writeUint32LE(L+w|0,t,32),Gr.writeUint32LE(y+I|0,t,36),Gr.writeUint32LE(f+S|0,t,40),Gr.writeUint32LE(d+D|0,t,44),Gr.writeUint32LE(v+T|0,t,48),Gr.writeUint32LE(E+q|0,t,52),Gr.writeUint32LE(C+K|0,t,56),Gr.writeUint32LE(O+F|0,t,60)}function wv(t,e,r,i,n){if(n===void 0&&(n=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length<r.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 u=new Uint8Array(64),h=0;h<r.length;h+=64){I8(u,s,t);for(var l=h;l<h+64&&l<r.length;l++)i[l]=r[l]^u[l-h];C8(s,0,a)}return R0.wipe(u),n===0&&R0.wipe(s),i}Df.streamXOR=wv;function M8(t,e,r,i){return i===void 0&&(i=0),R0.wipe(r),wv(t,e,r,r,i)}Df.stream=M8;function C8(t,e,r){for(var i=1;r--;)i=i+(t[e]&255)|0,t[e]=i&255,i>>>=8,e++;if(i>0)throw new Error("ChaCha: counter overflow")}var _v={},Qs={};Object.defineProperty(Qs,"__esModule",{value:!0});function D8(t,e,r){return~(t-1)&e|t-1&r}Qs.select=D8;function O8(t,e){return(t|0)-(e|0)-1>>>31&1}Qs.lessOrEqual=O8;function Ev(t,e){if(t.length!==e.length)return 0;for(var r=0,i=0;i<t.length;i++)r|=t[i]^e[i];return 1&r-1>>>8}Qs.compare=Ev;function P8(t,e){return t.length===0||e.length===0?!1:Ev(t,e)!==0}Qs.equal=P8,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Qs,r=Ni;t.DIGEST_LENGTH=16;var i=function(){function a(u){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var h=u[0]|u[1]<<8;this._r[0]=h&8191;var l=u[2]|u[3]<<8;this._r[1]=(h>>>13|l<<3)&8191;var b=u[4]|u[5]<<8;this._r[2]=(l>>>10|b<<6)&7939;var w=u[6]|u[7]<<8;this._r[3]=(b>>>7|w<<9)&8191;var I=u[8]|u[9]<<8;this._r[4]=(w>>>4|I<<12)&255,this._r[5]=I>>>1&8190;var S=u[10]|u[11]<<8;this._r[6]=(I>>>14|S<<2)&8191;var D=u[12]|u[13]<<8;this._r[7]=(S>>>11|D<<5)&8065;var T=u[14]|u[15]<<8;this._r[8]=(D>>>8|T<<8)&8191,this._r[9]=T>>>5&127,this._pad[0]=u[16]|u[17]<<8,this._pad[1]=u[18]|u[19]<<8,this._pad[2]=u[20]|u[21]<<8,this._pad[3]=u[22]|u[23]<<8,this._pad[4]=u[24]|u[25]<<8,this._pad[5]=u[26]|u[27]<<8,this._pad[6]=u[28]|u[29]<<8,this._pad[7]=u[30]|u[31]<<8}return a.prototype._blocks=function(u,h,l){for(var b=this._fin?0:2048,w=this._h[0],I=this._h[1],S=this._h[2],D=this._h[3],T=this._h[4],q=this._h[5],K=this._h[6],F=this._h[7],W=this._h[8],R=this._h[9],k=this._r[0],H=this._r[1],_=this._r[2],B=this._r[3],ee=this._r[4],ie=this._r[5],L=this._r[6],y=this._r[7],f=this._r[8],d=this._r[9];l>=16;){var v=u[h+0]|u[h+1]<<8;w+=v&8191;var E=u[h+2]|u[h+3]<<8;I+=(v>>>13|E<<3)&8191;var C=u[h+4]|u[h+5]<<8;S+=(E>>>10|C<<6)&8191;var O=u[h+6]|u[h+7]<<8;D+=(C>>>7|O<<9)&8191;var M=u[h+8]|u[h+9]<<8;T+=(O>>>4|M<<12)&8191,q+=M>>>1&8191;var g=u[h+10]|u[h+11]<<8;K+=(M>>>14|g<<2)&8191;var m=u[h+12]|u[h+13]<<8;F+=(g>>>11|m<<5)&8191;var N=u[h+14]|u[h+15]<<8;W+=(m>>>8|N<<8)&8191,R+=N>>>5|b;var X=0,ae=X;ae+=w*k,ae+=I*(5*d),ae+=S*(5*f),ae+=D*(5*y),ae+=T*(5*L),X=ae>>>13,ae&=8191,ae+=q*(5*ie),ae+=K*(5*ee),ae+=F*(5*B),ae+=W*(5*_),ae+=R*(5*H),X+=ae>>>13,ae&=8191;var P=X;P+=w*H,P+=I*k,P+=S*(5*d),P+=D*(5*f),P+=T*(5*y),X=P>>>13,P&=8191,P+=q*(5*L),P+=K*(5*ie),P+=F*(5*ee),P+=W*(5*B),P+=R*(5*_),X+=P>>>13,P&=8191;var te=X;te+=w*_,te+=I*H,te+=S*k,te+=D*(5*d),te+=T*(5*f),X=te>>>13,te&=8191,te+=q*(5*y),te+=K*(5*L),te+=F*(5*ie),te+=W*(5*ee),te+=R*(5*B),X+=te>>>13,te&=8191;var z=X;z+=w*B,z+=I*_,z+=S*H,z+=D*k,z+=T*(5*d),X=z>>>13,z&=8191,z+=q*(5*f),z+=K*(5*y),z+=F*(5*L),z+=W*(5*ie),z+=R*(5*ee),X+=z>>>13,z&=8191;var G=X;G+=w*ee,G+=I*B,G+=S*_,G+=D*H,G+=T*k,X=G>>>13,G&=8191,G+=q*(5*d),G+=K*(5*f),G+=F*(5*y),G+=W*(5*L),G+=R*(5*ie),X+=G>>>13,G&=8191;var J=X;J+=w*ie,J+=I*ee,J+=S*B,J+=D*_,J+=T*H,X=J>>>13,J&=8191,J+=q*k,J+=K*(5*d),J+=F*(5*f),J+=W*(5*y),J+=R*(5*L),X+=J>>>13,J&=8191;var A=X;A+=w*L,A+=I*ie,A+=S*ee,A+=D*B,A+=T*_,X=A>>>13,A&=8191,A+=q*H,A+=K*k,A+=F*(5*d),A+=W*(5*f),A+=R*(5*y),X+=A>>>13,A&=8191;var V=X;V+=w*y,V+=I*L,V+=S*ie,V+=D*ee,V+=T*B,X=V>>>13,V&=8191,V+=q*_,V+=K*H,V+=F*k,V+=W*(5*d),V+=R*(5*f),X+=V>>>13,V&=8191;var oe=X;oe+=w*f,oe+=I*y,oe+=S*L,oe+=D*ie,oe+=T*ee,X=oe>>>13,oe&=8191,oe+=q*B,oe+=K*_,oe+=F*H,oe+=W*k,oe+=R*(5*d),X+=oe>>>13,oe&=8191;var ue=X;ue+=w*d,ue+=I*f,ue+=S*y,ue+=D*L,ue+=T*ie,X=ue>>>13,ue&=8191,ue+=q*ee,ue+=K*B,ue+=F*_,ue+=W*H,ue+=R*k,X+=ue>>>13,ue&=8191,X=(X<<2)+X|0,X=X+ae|0,ae=X&8191,X=X>>>13,P+=X,w=ae,I=P,S=te,D=z,T=G,q=J,K=A,F=V,W=oe,R=ue,h+=16,l-=16}this._h[0]=w,this._h[1]=I,this._h[2]=S,this._h[3]=D,this._h[4]=T,this._h[5]=q,this._h[6]=K,this._h[7]=F,this._h[8]=W,this._h[9]=R},a.prototype.finish=function(u,h){h===void 0&&(h=0);var l=new Uint16Array(10),b,w,I,S;if(this._leftover){for(S=this._leftover,this._buffer[S++]=1;S<16;S++)this._buffer[S]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(b=this._h[1]>>>13,this._h[1]&=8191,S=2;S<10;S++)this._h[S]+=b,b=this._h[S]>>>13,this._h[S]&=8191;for(this._h[0]+=b*5,b=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=b,b=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=b,l[0]=this._h[0]+5,b=l[0]>>>13,l[0]&=8191,S=1;S<10;S++)l[S]=this._h[S]+b,b=l[S]>>>13,l[S]&=8191;for(l[9]-=8192,w=(b^1)-1,S=0;S<10;S++)l[S]&=w;for(w=~w,S=0;S<10;S++)this._h[S]=this._h[S]&w|l[S];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,I=this._h[0]+this._pad[0],this._h[0]=I&65535,S=1;S<8;S++)I=(this._h[S]+this._pad[S]|0)+(I>>>16)|0,this._h[S]=I&65535;return u[h+0]=this._h[0]>>>0,u[h+1]=this._h[0]>>>8,u[h+2]=this._h[1]>>>0,u[h+3]=this._h[1]>>>8,u[h+4]=this._h[2]>>>0,u[h+5]=this._h[2]>>>8,u[h+6]=this._h[3]>>>0,u[h+7]=this._h[3]>>>8,u[h+8]=this._h[4]>>>0,u[h+9]=this._h[4]>>>8,u[h+10]=this._h[5]>>>0,u[h+11]=this._h[5]>>>8,u[h+12]=this._h[6]>>>0,u[h+13]=this._h[6]>>>8,u[h+14]=this._h[7]>>>0,u[h+15]=this._h[7]>>>8,this._finished=!0,this},a.prototype.update=function(u){var h=0,l=u.length,b;if(this._leftover){b=16-this._leftover,b>l&&(b=l);for(var w=0;w<b;w++)this._buffer[this._leftover+w]=u[h+w];if(l-=b,h+=b,this._leftover+=b,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(l>=16&&(b=l-l%16,this._blocks(u,h,b),h+=b,l-=b),l){for(var w=0;w<l;w++)this._buffer[this._leftover+w]=u[h+w];this._leftover+=l}return this},a.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var u=new Uint8Array(16);return this.finish(u),u},a.prototype.clean=function(){return r.wipe(this._buffer),r.wipe(this._r),r.wipe(this._h),r.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},a}();t.Poly1305=i;function n(a,u){var h=new i(a);h.update(u);var l=h.digest();return h.clean(),l}t.oneTimeAuth=n;function s(a,u){return a.length!==t.DIGEST_LENGTH||u.length!==t.DIGEST_LENGTH?!1:e.equal(a,u)}t.equal=s}(_v),function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Df,r=_v,i=Ni,n=wt,s=Qs;t.KEY_LENGTH=32,t.NONCE_LENGTH=12,t.TAG_LENGTH=16;var a=new Uint8Array(16),u=function(){function h(l){if(this.nonceLength=t.NONCE_LENGTH,this.tagLength=t.TAG_LENGTH,l.length!==t.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(l)}return h.prototype.seal=function(l,b,w,I){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var S=new Uint8Array(16);S.set(l,S.length-l.length);var D=new Uint8Array(32);e.stream(this._key,S,D,4);var T=b.length+this.tagLength,q;if(I){if(I.length!==T)throw new Error("ChaCha20Poly1305: incorrect destination length");q=I}else q=new Uint8Array(T);return e.streamXOR(this._key,S,b,q,4),this._authenticate(q.subarray(q.length-this.tagLength,q.length),D,q.subarray(0,q.length-this.tagLength),w),i.wipe(S),q},h.prototype.open=function(l,b,w,I){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(b.length<this.tagLength)return null;var S=new Uint8Array(16);S.set(l,S.length-l.length);var D=new Uint8Array(32);e.stream(this._key,S,D,4);var T=new Uint8Array(this.tagLength);if(this._authenticate(T,D,b.subarray(0,b.length-this.tagLength),w),!s.equal(T,b.subarray(b.length-this.tagLength,b.length)))return null;var q=b.length-this.tagLength,K;if(I){if(I.length!==q)throw new Error("ChaCha20Poly1305: incorrect destination length");K=I}else K=new Uint8Array(q);return e.streamXOR(this._key,S,b.subarray(0,b.length-this.tagLength),K,4),i.wipe(S),K},h.prototype.clean=function(){return i.wipe(this._key),this},h.prototype._authenticate=function(l,b,w,I){var S=new r.Poly1305(b);I&&(S.update(I),I.length%16>0&&S.update(a.subarray(I.length%16))),S.update(w),w.length%16>0&&S.update(a.subarray(w.length%16));var D=new Uint8Array(8);I&&n.writeUint64LE(I.length,D),S.update(D),n.writeUint64LE(w.length,D),S.update(D);for(var T=S.digest(),q=0;q<T.length;q++)l[q]=T[q];S.clean(),i.wipe(T),i.wipe(D)},h}();t.ChaCha20Poly1305=u}(C0);var Av={},Xc={},N0={};Object.defineProperty(N0,"__esModule",{value:!0});function $8(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}N0.isSerializableHash=$8,Object.defineProperty(Xc,"__esModule",{value:!0});var qn=N0,R8=Qs,N8=Ni,xv=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(i).clean():i.set(r);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),qn.isSerializableHash(this._inner)&&qn.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),N8.wipe(i)}return t.prototype.reset=function(){if(!qn.isSerializableHash(this._inner)||!qn.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.clean=function(){qn.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),qn.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},t.prototype.update=function(e){return this._inner.update(e),this},t.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},t.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},t.prototype.saveState=function(){if(!qn.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},t.prototype.restoreState=function(e){if(!qn.isSerializableHash(this._inner)||!qn.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.cleanSavedState=function(e){if(!qn.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},t}();Xc.HMAC=xv;function T8(t,e,r){var i=new xv(t,e);i.update(r);var n=i.digest();return i.clean(),n}Xc.hmac=T8,Xc.equal=R8.equal,Object.defineProperty(Av,"__esModule",{value:!0});var Sv=Xc,Iv=Ni,L8=function(){function t(e,r,i,n){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=n;var s=Sv.hmac(this._hash,i,r);this._hmac=new Sv.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),i=0;i<r.length;i++)this._bufpos===this._buffer.length&&this._fillBuffer(),r[i]=this._buffer[this._bufpos++];return r},t.prototype.clean=function(){this._hmac.clean(),Iv.wipe(this._buffer),Iv.wipe(this._counter),this._bufpos=0},t}(),B8=Av.HKDF=L8,Zs={},$f={},Rf={};Object.defineProperty(Rf,"__esModule",{value:!0}),Rf.BrowserRandomSource=void 0;const Mv=65536;class F8{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(e);for(let i=0;i<r.length;i+=Mv)this._crypto.getRandomValues(r.subarray(i,i+Math.min(r.length-i,Mv)));return r}}Rf.BrowserRandomSource=F8;function U8(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Nf={},k8={},q8=Object.freeze({__proto__:null,default:k8}),T0=m0(q8);Object.defineProperty(Nf,"__esModule",{value:!0}),Nf.NodeRandomSource=void 0;const j8=Ni;class z8{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof U8<"u"){const e=T0;e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let r=this._crypto.randomBytes(e);if(r.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]=r[n];return(0,j8.wipe)(r),i}}Nf.NodeRandomSource=z8,Object.defineProperty($f,"__esModule",{value:!0}),$f.SystemRandomSource=void 0;const H8=Rf,K8=Nf;class W8{constructor(){if(this.isAvailable=!1,this.name="",this._source=new H8.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new K8.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)}}$f.SystemRandomSource=W8,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const e=$f,r=wt,i=Ni;t.defaultRandomSource=new e.SystemRandomSource;function n(l,b=t.defaultRandomSource){return b.randomBytes(l)}t.randomBytes=n;function s(l=t.defaultRandomSource){const b=n(4,l),w=(0,r.readUint32LE)(b);return(0,i.wipe)(b),w}t.randomUint32=s;const a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function u(l,b=a,w=t.defaultRandomSource){if(b.length<2)throw new Error("randomString charset is too short");if(b.length>256)throw new Error("randomString charset is too long");let I="";const S=b.length,D=256-256%S;for(;l>0;){const T=n(Math.ceil(l*256/D),w);for(let q=0;q<T.length&&l>0;q++){const K=T[q];K<D&&(I+=b.charAt(K%S),l--)}(0,i.wipe)(T)}return I}t.randomString=u;function h(l,b=a,w=t.defaultRandomSource){const I=Math.ceil(l/(Math.log(b.length)/Math.LN2));return u(I,b,w)}t.randomStringForEntropy=h}(Zs);var eu={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=wt,r=Ni;t.DIGEST_LENGTH=32,t.BLOCK_SIZE=64;var i=function(){function u(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return u.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},u.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},u.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._temp),this.reset()},u.prototype.update=function(h,l){if(l===void 0&&(l=h.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var b=0;if(this._bytesHashed+=l,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&l>0;)this._buffer[this._bufferLength++]=h[b++],l--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(b=s(this._temp,this._state,h,b,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=h[b++],l--;return this},u.prototype.finish=function(h){if(!this._finished){var l=this._bytesHashed,b=this._bufferLength,w=l/536870912|0,I=l<<3,S=l%64<56?64:128;this._buffer[b]=128;for(var D=b+1;D<S-8;D++)this._buffer[D]=0;e.writeUint32BE(w,this._buffer,S-8),e.writeUint32BE(I,this._buffer,S-4),s(this._temp,this._state,this._buffer,0,S),this._finished=!0}for(var D=0;D<this.digestLength/4;D++)e.writeUint32BE(this._state[D],h,D*4);return this},u.prototype.digest=function(){var h=new Uint8Array(this.digestLength);return this.finish(h),h},u.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},u.prototype.restoreState=function(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},u.prototype.cleanSavedState=function(h){r.wipe(h.state),h.buffer&&r.wipe(h.buffer),h.bufferLength=0,h.bytesHashed=0},u}();t.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(u,h,l,b,w){for(;w>=64;){for(var I=h[0],S=h[1],D=h[2],T=h[3],q=h[4],K=h[5],F=h[6],W=h[7],R=0;R<16;R++){var k=b+R*4;u[R]=e.readUint32BE(l,k)}for(var R=16;R<64;R++){var H=u[R-2],_=(H>>>17|H<<32-17)^(H>>>19|H<<32-19)^H>>>10;H=u[R-15];var B=(H>>>7|H<<32-7)^(H>>>18|H<<32-18)^H>>>3;u[R]=(_+u[R-7]|0)+(B+u[R-16]|0)}for(var R=0;R<64;R++){var _=(((q>>>6|q<<26)^(q>>>11|q<<21)^(q>>>25|q<<7))+(q&K^~q&F)|0)+(W+(n[R]+u[R]|0)|0)|0,B=((I>>>2|I<<32-2)^(I>>>13|I<<32-13)^(I>>>22|I<<32-22))+(I&S^I&D^S&D)|0;W=F,F=K,K=q,q=T+_|0,T=D,D=S,S=I,I=_+B|0}h[0]+=I,h[1]+=S,h[2]+=D,h[3]+=T,h[4]+=q,h[5]+=K,h[6]+=F,h[7]+=W,b+=64,w-=64}return b}function a(u){var h=new i;h.update(u);var l=h.digest();return h.clean(),l}t.hash=a})(eu);var L0={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=Zs,r=Ni;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function i(R){const k=new Float64Array(16);if(R)for(let H=0;H<R.length;H++)k[H]=R[H];return k}const n=new Uint8Array(32);n[0]=9;const s=i([56129,1]);function a(R){let k=1;for(let H=0;H<16;H++){let _=R[H]+k+65535;k=Math.floor(_/65536),R[H]=_-k*65536}R[0]+=k-1+37*(k-1)}function u(R,k,H){const _=~(H-1);for(let B=0;B<16;B++){const ee=_&(R[B]^k[B]);R[B]^=ee,k[B]^=ee}}function h(R,k){const H=i(),_=i();for(let B=0;B<16;B++)_[B]=k[B];a(_),a(_),a(_);for(let B=0;B<2;B++){H[0]=_[0]-65517;for(let ie=1;ie<15;ie++)H[ie]=_[ie]-65535-(H[ie-1]>>16&1),H[ie-1]&=65535;H[15]=_[15]-32767-(H[14]>>16&1);const ee=H[15]>>16&1;H[14]&=65535,u(_,H,1-ee)}for(let B=0;B<16;B++)R[2*B]=_[B]&255,R[2*B+1]=_[B]>>8}function l(R,k){for(let H=0;H<16;H++)R[H]=k[2*H]+(k[2*H+1]<<8);R[15]&=32767}function b(R,k,H){for(let _=0;_<16;_++)R[_]=k[_]+H[_]}function w(R,k,H){for(let _=0;_<16;_++)R[_]=k[_]-H[_]}function I(R,k,H){let _,B,ee=0,ie=0,L=0,y=0,f=0,d=0,v=0,E=0,C=0,O=0,M=0,g=0,m=0,N=0,X=0,ae=0,P=0,te=0,z=0,G=0,J=0,A=0,V=0,oe=0,ue=0,he=0,ye=0,we=0,Re=0,Xe=0,Oe=0,Ne=H[0],Me=H[1],be=H[2],Pe=H[3],Te=H[4],ve=H[5],$e=H[6],Se=H[7],me=H[8],Ue=H[9],Ce=H[10],_e=H[11],Ke=H[12],Ve=H[13],Ae=H[14],We=H[15];_=k[0],ee+=_*Ne,ie+=_*Me,L+=_*be,y+=_*Pe,f+=_*Te,d+=_*ve,v+=_*$e,E+=_*Se,C+=_*me,O+=_*Ue,M+=_*Ce,g+=_*_e,m+=_*Ke,N+=_*Ve,X+=_*Ae,ae+=_*We,_=k[1],ie+=_*Ne,L+=_*Me,y+=_*be,f+=_*Pe,d+=_*Te,v+=_*ve,E+=_*$e,C+=_*Se,O+=_*me,M+=_*Ue,g+=_*Ce,m+=_*_e,N+=_*Ke,X+=_*Ve,ae+=_*Ae,P+=_*We,_=k[2],L+=_*Ne,y+=_*Me,f+=_*be,d+=_*Pe,v+=_*Te,E+=_*ve,C+=_*$e,O+=_*Se,M+=_*me,g+=_*Ue,m+=_*Ce,N+=_*_e,X+=_*Ke,ae+=_*Ve,P+=_*Ae,te+=_*We,_=k[3],y+=_*Ne,f+=_*Me,d+=_*be,v+=_*Pe,E+=_*Te,C+=_*ve,O+=_*$e,M+=_*Se,g+=_*me,m+=_*Ue,N+=_*Ce,X+=_*_e,ae+=_*Ke,P+=_*Ve,te+=_*Ae,z+=_*We,_=k[4],f+=_*Ne,d+=_*Me,v+=_*be,E+=_*Pe,C+=_*Te,O+=_*ve,M+=_*$e,g+=_*Se,m+=_*me,N+=_*Ue,X+=_*Ce,ae+=_*_e,P+=_*Ke,te+=_*Ve,z+=_*Ae,G+=_*We,_=k[5],d+=_*Ne,v+=_*Me,E+=_*be,C+=_*Pe,O+=_*Te,M+=_*ve,g+=_*$e,m+=_*Se,N+=_*me,X+=_*Ue,ae+=_*Ce,P+=_*_e,te+=_*Ke,z+=_*Ve,G+=_*Ae,J+=_*We,_=k[6],v+=_*Ne,E+=_*Me,C+=_*be,O+=_*Pe,M+=_*Te,g+=_*ve,m+=_*$e,N+=_*Se,X+=_*me,ae+=_*Ue,P+=_*Ce,te+=_*_e,z+=_*Ke,G+=_*Ve,J+=_*Ae,A+=_*We,_=k[7],E+=_*Ne,C+=_*Me,O+=_*be,M+=_*Pe,g+=_*Te,m+=_*ve,N+=_*$e,X+=_*Se,ae+=_*me,P+=_*Ue,te+=_*Ce,z+=_*_e,G+=_*Ke,J+=_*Ve,A+=_*Ae,V+=_*We,_=k[8],C+=_*Ne,O+=_*Me,M+=_*be,g+=_*Pe,m+=_*Te,N+=_*ve,X+=_*$e,ae+=_*Se,P+=_*me,te+=_*Ue,z+=_*Ce,G+=_*_e,J+=_*Ke,A+=_*Ve,V+=_*Ae,oe+=_*We,_=k[9],O+=_*Ne,M+=_*Me,g+=_*be,m+=_*Pe,N+=_*Te,X+=_*ve,ae+=_*$e,P+=_*Se,te+=_*me,z+=_*Ue,G+=_*Ce,J+=_*_e,A+=_*Ke,V+=_*Ve,oe+=_*Ae,ue+=_*We,_=k[10],M+=_*Ne,g+=_*Me,m+=_*be,N+=_*Pe,X+=_*Te,ae+=_*ve,P+=_*$e,te+=_*Se,z+=_*me,G+=_*Ue,J+=_*Ce,A+=_*_e,V+=_*Ke,oe+=_*Ve,ue+=_*Ae,he+=_*We,_=k[11],g+=_*Ne,m+=_*Me,N+=_*be,X+=_*Pe,ae+=_*Te,P+=_*ve,te+=_*$e,z+=_*Se,G+=_*me,J+=_*Ue,A+=_*Ce,V+=_*_e,oe+=_*Ke,ue+=_*Ve,he+=_*Ae,ye+=_*We,_=k[12],m+=_*Ne,N+=_*Me,X+=_*be,ae+=_*Pe,P+=_*Te,te+=_*ve,z+=_*$e,G+=_*Se,J+=_*me,A+=_*Ue,V+=_*Ce,oe+=_*_e,ue+=_*Ke,he+=_*Ve,ye+=_*Ae,we+=_*We,_=k[13],N+=_*Ne,X+=_*Me,ae+=_*be,P+=_*Pe,te+=_*Te,z+=_*ve,G+=_*$e,J+=_*Se,A+=_*me,V+=_*Ue,oe+=_*Ce,ue+=_*_e,he+=_*Ke,ye+=_*Ve,we+=_*Ae,Re+=_*We,_=k[14],X+=_*Ne,ae+=_*Me,P+=_*be,te+=_*Pe,z+=_*Te,G+=_*ve,J+=_*$e,A+=_*Se,V+=_*me,oe+=_*Ue,ue+=_*Ce,he+=_*_e,ye+=_*Ke,we+=_*Ve,Re+=_*Ae,Xe+=_*We,_=k[15],ae+=_*Ne,P+=_*Me,te+=_*be,z+=_*Pe,G+=_*Te,J+=_*ve,A+=_*$e,V+=_*Se,oe+=_*me,ue+=_*Ue,he+=_*Ce,ye+=_*_e,we+=_*Ke,Re+=_*Ve,Xe+=_*Ae,Oe+=_*We,ee+=38*P,ie+=38*te,L+=38*z,y+=38*G,f+=38*J,d+=38*A,v+=38*V,E+=38*oe,C+=38*ue,O+=38*he,M+=38*ye,g+=38*we,m+=38*Re,N+=38*Xe,X+=38*Oe,B=1,_=ee+B+65535,B=Math.floor(_/65536),ee=_-B*65536,_=ie+B+65535,B=Math.floor(_/65536),ie=_-B*65536,_=L+B+65535,B=Math.floor(_/65536),L=_-B*65536,_=y+B+65535,B=Math.floor(_/65536),y=_-B*65536,_=f+B+65535,B=Math.floor(_/65536),f=_-B*65536,_=d+B+65535,B=Math.floor(_/65536),d=_-B*65536,_=v+B+65535,B=Math.floor(_/65536),v=_-B*65536,_=E+B+65535,B=Math.floor(_/65536),E=_-B*65536,_=C+B+65535,B=Math.floor(_/65536),C=_-B*65536,_=O+B+65535,B=Math.floor(_/65536),O=_-B*65536,_=M+B+65535,B=Math.floor(_/65536),M=_-B*65536,_=g+B+65535,B=Math.floor(_/65536),g=_-B*65536,_=m+B+65535,B=Math.floor(_/65536),m=_-B*65536,_=N+B+65535,B=Math.floor(_/65536),N=_-B*65536,_=X+B+65535,B=Math.floor(_/65536),X=_-B*65536,_=ae+B+65535,B=Math.floor(_/65536),ae=_-B*65536,ee+=B-1+37*(B-1),B=1,_=ee+B+65535,B=Math.floor(_/65536),ee=_-B*65536,_=ie+B+65535,B=Math.floor(_/65536),ie=_-B*65536,_=L+B+65535,B=Math.floor(_/65536),L=_-B*65536,_=y+B+65535,B=Math.floor(_/65536),y=_-B*65536,_=f+B+65535,B=Math.floor(_/65536),f=_-B*65536,_=d+B+65535,B=Math.floor(_/65536),d=_-B*65536,_=v+B+65535,B=Math.floor(_/65536),v=_-B*65536,_=E+B+65535,B=Math.floor(_/65536),E=_-B*65536,_=C+B+65535,B=Math.floor(_/65536),C=_-B*65536,_=O+B+65535,B=Math.floor(_/65536),O=_-B*65536,_=M+B+65535,B=Math.floor(_/65536),M=_-B*65536,_=g+B+65535,B=Math.floor(_/65536),g=_-B*65536,_=m+B+65535,B=Math.floor(_/65536),m=_-B*65536,_=N+B+65535,B=Math.floor(_/65536),N=_-B*65536,_=X+B+65535,B=Math.floor(_/65536),X=_-B*65536,_=ae+B+65535,B=Math.floor(_/65536),ae=_-B*65536,ee+=B-1+37*(B-1),R[0]=ee,R[1]=ie,R[2]=L,R[3]=y,R[4]=f,R[5]=d,R[6]=v,R[7]=E,R[8]=C,R[9]=O,R[10]=M,R[11]=g,R[12]=m,R[13]=N,R[14]=X,R[15]=ae}function S(R,k){I(R,k,k)}function D(R,k){const H=i();for(let _=0;_<16;_++)H[_]=k[_];for(let _=253;_>=0;_--)S(H,H),_!==2&&_!==4&&I(H,H,k);for(let _=0;_<16;_++)R[_]=H[_]}function T(R,k){const H=new Uint8Array(32),_=new Float64Array(80),B=i(),ee=i(),ie=i(),L=i(),y=i(),f=i();for(let C=0;C<31;C++)H[C]=R[C];H[31]=R[31]&127|64,H[0]&=248,l(_,k);for(let C=0;C<16;C++)ee[C]=_[C];B[0]=L[0]=1;for(let C=254;C>=0;--C){const O=H[C>>>3]>>>(C&7)&1;u(B,ee,O),u(ie,L,O),b(y,B,ie),w(B,B,ie),b(ie,ee,L),w(ee,ee,L),S(L,y),S(f,B),I(B,ie,B),I(ie,ee,y),b(y,B,ie),w(B,B,ie),S(ee,B),w(ie,L,f),I(B,ie,s),b(B,B,L),I(ie,ie,B),I(B,L,f),I(L,ee,_),S(ee,y),u(B,ee,O),u(ie,L,O)}for(let C=0;C<16;C++)_[C+16]=B[C],_[C+32]=ie[C],_[C+48]=ee[C],_[C+64]=L[C];const d=_.subarray(32),v=_.subarray(16);D(d,d),I(v,v,d);const E=new Uint8Array(32);return h(E,v),E}t.scalarMult=T;function q(R){return T(R,n)}t.scalarMultBase=q;function K(R){if(R.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const k=new Uint8Array(R);return{publicKey:q(k),secretKey:k}}t.generateKeyPairFromSeed=K;function F(R){const k=(0,e.randomBytes)(32,R),H=K(k);return(0,r.wipe)(k),H}t.generateKeyPair=F;function W(R,k,H=!1){if(R.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(k.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const _=T(R,k);if(H){let B=0;for(let ee=0;ee<_.length;ee++)B|=_[ee];if(B===0)throw new Error("X25519: invalid shared key")}return _}t.sharedKey=W})(L0);function Cv(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function B0(t,e){e||(e=t.reduce((n,s)=>n+s.length,0));const r=Cv(e);let i=0;for(const n of t)r.set(n,i),i+=n.length;return r}function V8(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i<r.length;i++)r[i]=255;for(var n=0;n<t.length;n++){var s=t.charAt(n),a=s.charCodeAt(0);if(r[a]!==255)throw new TypeError(s+" is ambiguous");r[a]=n}var u=t.length,h=t.charAt(0),l=Math.log(u)/Math.log(256),b=Math.log(256)/Math.log(u);function w(D){if(D instanceof Uint8Array||(ArrayBuffer.isView(D)?D=new Uint8Array(D.buffer,D.byteOffset,D.byteLength):Array.isArray(D)&&(D=Uint8Array.from(D))),!(D instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(D.length===0)return"";for(var T=0,q=0,K=0,F=D.length;K!==F&&D[K]===0;)K++,T++;for(var W=(F-K)*b+1>>>0,R=new Uint8Array(W);K!==F;){for(var k=D[K],H=0,_=W-1;(k!==0||H<q)&&_!==-1;_--,H++)k+=256*R[_]>>>0,R[_]=k%u>>>0,k=k/u>>>0;if(k!==0)throw new Error("Non-zero carry");q=H,K++}for(var B=W-q;B!==W&&R[B]===0;)B++;for(var ee=h.repeat(T);B<W;++B)ee+=t.charAt(R[B]);return ee}function I(D){if(typeof D!="string")throw new TypeError("Expected String");if(D.length===0)return new Uint8Array;var T=0;if(D[T]!==" "){for(var q=0,K=0;D[T]===h;)q++,T++;for(var F=(D.length-T)*l+1>>>0,W=new Uint8Array(F);D[T];){var R=r[D.charCodeAt(T)];if(R===255)return;for(var k=0,H=F-1;(R!==0||k<K)&&H!==-1;H--,k++)R+=u*W[H]>>>0,W[H]=R%256>>>0,R=R/256>>>0;if(R!==0)throw new Error("Non-zero carry");K=k,T++}if(D[T]!==" "){for(var _=F-K;_!==F&&W[_]===0;)_++;for(var B=new Uint8Array(q+(F-_)),ee=q;_!==F;)B[ee++]=W[_++];return B}}}function S(D){var T=I(D);if(T)return T;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:I,decode:S}}var G8=V8,J8=G8;const Dv=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},Y8=t=>new TextEncoder().encode(t),Q8=t=>new TextDecoder().decode(t);class Z8{constructor(e,r,i){this.name=e,this.prefix=r,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class X8{constructor(e,r,i){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=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 Ov(this,e)}}class e7{constructor(e){this.decoders=e}or(e){return Ov(this,e)}decode(e){const r=e[0],i=this.decoders[r];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 Ov=(t,e)=>new e7({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class t7{constructor(e,r,i,n){this.name=e,this.prefix=r,this.baseEncode=i,this.baseDecode=n,this.encoder=new Z8(e,r,i),this.decoder=new X8(e,r,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Tf=({name:t,prefix:e,encode:r,decode:i})=>new t7(t,e,r,i),tu=({prefix:t,name:e,alphabet:r})=>{const{encode:i,decode:n}=J8(r,e);return Tf({prefix:t,name:e,encode:i,decode:s=>Dv(n(s))})},r7=(t,e,r,i)=>{const n={};for(let b=0;b<e.length;++b)n[e[b]]=b;let s=t.length;for(;t[s-1]==="=";)--s;const a=new Uint8Array(s*r/8|0);let u=0,h=0,l=0;for(let b=0;b<s;++b){const w=n[t[b]];if(w===void 0)throw new SyntaxError(`Non-${i} character`);h=h<<r|w,u+=r,u>=8&&(u-=8,a[l++]=255&h>>u)}if(u>=r||255&h<<8-u)throw new SyntaxError("Unexpected end of data");return a},i7=(t,e,r)=>{const i=e[e.length-1]==="=",n=(1<<r)-1;let s="",a=0,u=0;for(let h=0;h<t.length;++h)for(u=u<<8|t[h],a+=8;a>r;)a-=r,s+=e[n&u>>a];if(a&&(s+=e[n&u<<r-a]),i)for(;s.length*r&7;)s+="=";return s},qr=({name:t,prefix:e,bitsPerChar:r,alphabet:i})=>Tf({prefix:e,name:t,encode(n){return i7(n,i,r)},decode(n){return r7(n,i,r,t)}}),n7=Tf({prefix:"\0",name:"identity",encode:t=>Q8(t),decode:t=>Y8(t)});var s7=Object.freeze({__proto__:null,identity:n7});const o7=qr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var a7=Object.freeze({__proto__:null,base2:o7});const c7=qr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var u7=Object.freeze({__proto__:null,base8:c7});const f7=tu({prefix:"9",name:"base10",alphabet:"0123456789"});var h7=Object.freeze({__proto__:null,base10:f7});const l7=qr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),d7=qr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var p7=Object.freeze({__proto__:null,base16:l7,base16upper:d7});const g7=qr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),v7=qr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),m7=qr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),b7=qr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),y7=qr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),w7=qr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),_7=qr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),E7=qr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),A7=qr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var x7=Object.freeze({__proto__:null,base32:g7,base32upper:v7,base32pad:m7,base32padupper:b7,base32hex:y7,base32hexupper:w7,base32hexpad:_7,base32hexpadupper:E7,base32z:A7});const S7=tu({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),I7=tu({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var M7=Object.freeze({__proto__:null,base36:S7,base36upper:I7});const C7=tu({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),D7=tu({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var O7=Object.freeze({__proto__:null,base58btc:C7,base58flickr:D7});const P7=qr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),$7=qr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),R7=qr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),N7=qr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var T7=Object.freeze({__proto__:null,base64:P7,base64pad:$7,base64url:R7,base64urlpad:N7});const Pv=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}"),L7=Pv.reduce((t,e,r)=>(t[r]=e,t),[]),B7=Pv.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function F7(t){return t.reduce((e,r)=>(e+=L7[r],e),"")}function U7(t){const e=[];for(const r of t){const i=B7[r.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(i)}return new Uint8Array(e)}const k7=Tf({prefix:"\u{1F680}",name:"base256emoji",encode:F7,decode:U7});var q7=Object.freeze({__proto__:null,base256emoji:k7}),j7=Rv,$v=128,z7=127,H7=~z7,K7=Math.pow(2,31);function Rv(t,e,r){e=e||[],r=r||0;for(var i=r;t>=K7;)e[r++]=t&255|$v,t/=128;for(;t&H7;)e[r++]=t&255|$v,t>>>=7;return e[r]=t|0,Rv.bytes=r-i+1,e}var W7=F0,V7=128,Nv=127;function F0(t,i){var r=0,i=i||0,n=0,s=i,a,u=t.length;do{if(s>=u)throw F0.bytes=0,new RangeError("Could not decode varint");a=t[s++],r+=n<28?(a&Nv)<<n:(a&Nv)*Math.pow(2,n),n+=7}while(a>=V7);return F0.bytes=s-i,r}var G7=Math.pow(2,7),J7=Math.pow(2,14),Y7=Math.pow(2,21),Q7=Math.pow(2,28),Z7=Math.pow(2,35),X7=Math.pow(2,42),e9=Math.pow(2,49),t9=Math.pow(2,56),r9=Math.pow(2,63),i9=function(t){return t<G7?1:t<J7?2:t<Y7?3:t<Q7?4:t<Z7?5:t<X7?6:t<e9?7:t<t9?8:t<r9?9:10},n9={encode:j7,decode:W7,encodingLength:i9},Tv=n9;const Lv=(t,e,r=0)=>(Tv.encode(t,e,r),e),Bv=t=>Tv.encodingLength(t),U0=(t,e)=>{const r=e.byteLength,i=Bv(t),n=i+Bv(r),s=new Uint8Array(n+r);return Lv(t,s,0),Lv(r,s,i),s.set(e,n),new s9(t,r,e,s)};class s9{constructor(e,r,i,n){this.code=e,this.size=r,this.digest=i,this.bytes=n}}const Fv=({name:t,code:e,encode:r})=>new o9(t,e,r);class o9{constructor(e,r,i){this.name=e,this.code=r,this.encode=i}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?U0(this.code,r):r.then(i=>U0(this.code,i))}else throw Error("Unknown type, must be binary type")}}const Uv=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),a9=Fv({name:"sha2-256",code:18,encode:Uv("SHA-256")}),c9=Fv({name:"sha2-512",code:19,encode:Uv("SHA-512")});var u9=Object.freeze({__proto__:null,sha256:a9,sha512:c9});const kv=0,f9="identity",qv=Dv;var h9=Object.freeze({__proto__:null,identity:{code:kv,name:f9,encode:qv,digest:t=>U0(kv,qv(t))}});new TextEncoder,new TextDecoder;const Ra={...s7,...a7,...u7,...h7,...p7,...x7,...M7,...O7,...T7,...q7};({...u9,...h9});function jv(t,e,r,i){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:i}}}const zv=jv("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),k0=jv("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=Cv(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Hv={utf8:zv,"utf-8":zv,hex:Ra.base16,latin1:k0,ascii:k0,binary:k0,...Ra};function Gi(t,e="utf8"){const r=Hv[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):r.decoder.decode(`${r.prefix}${t}`)}function Ti(t,e="utf8"){const r=Hv[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}var Kv={},l9="elliptic",d9="6.5.7",p9="EC cryptography",g9="lib/elliptic.js",v9=["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/"},b9={type:"git",url:"git@github.com:indutny/elliptic"},y9=["EC","Elliptic","curve","Cryptography"],w9="Fedor Indutny <fedor@indutny.com>",_9="MIT",E9={url:"https://github.com/indutny/elliptic/issues"},A9="https://github.com/indutny/elliptic",x9={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"},S9={"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"},I9={name:l9,version:d9,description:p9,main:g9,files:v9,scripts:m9,repository:b9,keywords:y9,author:w9,license:_9,bugs:E9,homepage:A9,devDependencies:x9,dependencies:S9},Li={},jn={exports:{}};(function(t){(function(e,r){function i(L,y){if(!L)throw new Error(y||"Assertion failed")}function n(L,y){L.super_=y;var f=function(){};f.prototype=y.prototype,L.prototype=new f,L.prototype.constructor=L}function s(L,y,f){if(s.isBN(L))return L;this.negative=0,this.words=null,this.length=0,this.red=null,L!==null&&((y==="le"||y==="be")&&(f=y,y=10),this._init(L||0,y||10,f||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=T0.Buffer}catch{}s.isBN=function(y){return y instanceof s?!0:y!==null&&typeof y=="object"&&y.constructor.wordSize===s.wordSize&&Array.isArray(y.words)},s.max=function(y,f){return y.cmp(f)>0?y:f},s.min=function(y,f){return y.cmp(f)<0?y:f},s.prototype._init=function(y,f,d){if(typeof y=="number")return this._initNumber(y,f,d);if(typeof y=="object")return this._initArray(y,f,d);f==="hex"&&(f=16),i(f===(f|0)&&f>=2&&f<=36),y=y.toString().replace(/\s+/g,"");var v=0;y[0]==="-"&&(v++,this.negative=1),v<y.length&&(f===16?this._parseHex(y,v,d):(this._parseBase(y,f,v),d==="le"&&this._initArray(this.toArray(),f,d)))},s.prototype._initNumber=function(y,f,d){y<0&&(this.negative=1,y=-y),y<67108864?(this.words=[y&67108863],this.length=1):y<4503599627370496?(this.words=[y&67108863,y/67108864&67108863],this.length=2):(i(y<9007199254740992),this.words=[y&67108863,y/67108864&67108863,1],this.length=3),d==="le"&&this._initArray(this.toArray(),f,d)},s.prototype._initArray=function(y,f,d){if(i(typeof y.length=="number"),y.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(y.length/3),this.words=new Array(this.length);for(var v=0;v<this.length;v++)this.words[v]=0;var E,C,O=0;if(d==="be")for(v=y.length-1,E=0;v>=0;v-=3)C=y[v]|y[v-1]<<8|y[v-2]<<16,this.words[E]|=C<<O&67108863,this.words[E+1]=C>>>26-O&67108863,O+=24,O>=26&&(O-=26,E++);else if(d==="le")for(v=0,E=0;v<y.length;v+=3)C=y[v]|y[v+1]<<8|y[v+2]<<16,this.words[E]|=C<<O&67108863,this.words[E+1]=C>>>26-O&67108863,O+=24,O>=26&&(O-=26,E++);return this.strip()};function u(L,y){var f=L.charCodeAt(y);return f>=65&&f<=70?f-55:f>=97&&f<=102?f-87:f-48&15}function h(L,y,f){var d=u(L,f);return f-1>=y&&(d|=u(L,f-1)<<4),d}s.prototype._parseHex=function(y,f,d){this.length=Math.ceil((y.length-f)/6),this.words=new Array(this.length);for(var v=0;v<this.length;v++)this.words[v]=0;var E=0,C=0,O;if(d==="be")for(v=y.length-1;v>=f;v-=2)O=h(y,f,v)<<E,this.words[C]|=O&67108863,E>=18?(E-=18,C+=1,this.words[C]|=O>>>26):E+=8;else{var M=y.length-f;for(v=M%2===0?f+1:f;v<y.length;v+=2)O=h(y,f,v)<<E,this.words[C]|=O&67108863,E>=18?(E-=18,C+=1,this.words[C]|=O>>>26):E+=8}this.strip()};function l(L,y,f,d){for(var v=0,E=Math.min(L.length,f),C=y;C<E;C++){var O=L.charCodeAt(C)-48;v*=d,O>=49?v+=O-49+10:O>=17?v+=O-17+10:v+=O}return v}s.prototype._parseBase=function(y,f,d){this.words=[0],this.length=1;for(var v=0,E=1;E<=67108863;E*=f)v++;v--,E=E/f|0;for(var C=y.length-d,O=C%v,M=Math.min(C,C-O)+d,g=0,m=d;m<M;m+=v)g=l(y,m,m+v,f),this.imuln(E),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g);if(O!==0){var N=1;for(g=l(y,m,y.length,f),m=0;m<O;m++)N*=f;this.imuln(N),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g)}this.strip()},s.prototype.copy=function(y){y.words=new Array(this.length);for(var f=0;f<this.length;f++)y.words[f]=this.words[f];y.length=this.length,y.negative=this.negative,y.red=this.red},s.prototype.clone=function(){var y=new s(null);return this.copy(y),y},s.prototype._expand=function(y){for(;this.length<y;)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 b=["","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],I=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(y,f){y=y||10,f=f|0||1;var d;if(y===16||y==="hex"){d="";for(var v=0,E=0,C=0;C<this.length;C++){var O=this.words[C],M=((O<<v|E)&16777215).toString(16);E=O>>>24-v&16777215,E!==0||C!==this.length-1?d=b[6-M.length]+M+d:d=M+d,v+=2,v>=26&&(v-=26,C--)}for(E!==0&&(d=E.toString(16)+d);d.length%f!==0;)d="0"+d;return this.negative!==0&&(d="-"+d),d}if(y===(y|0)&&y>=2&&y<=36){var g=w[y],m=I[y];d="";var N=this.clone();for(N.negative=0;!N.isZero();){var X=N.modn(m).toString(y);N=N.idivn(m),N.isZero()?d=X+d:d=b[g-X.length]+X+d}for(this.isZero()&&(d="0"+d);d.length%f!==0;)d="0"+d;return this.negative!==0&&(d="-"+d),d}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var y=this.words[0];return this.length===2?y+=this.words[1]*67108864:this.length===3&&this.words[2]===1?y+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-y:y},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(y,f){return i(typeof a<"u"),this.toArrayLike(a,y,f)},s.prototype.toArray=function(y,f){return this.toArrayLike(Array,y,f)},s.prototype.toArrayLike=function(y,f,d){var v=this.byteLength(),E=d||Math.max(1,v);i(v<=E,"byte array longer than desired length"),i(E>0,"Requested array length <= 0"),this.strip();var C=f==="le",O=new y(E),M,g,m=this.clone();if(C){for(g=0;!m.isZero();g++)M=m.andln(255),m.iushrn(8),O[g]=M;for(;g<E;g++)O[g]=0}else{for(g=0;g<E-v;g++)O[g]=0;for(g=0;!m.isZero();g++)M=m.andln(255),m.iushrn(8),O[E-g-1]=M}return O},Math.clz32?s.prototype._countBits=function(y){return 32-Math.clz32(y)}:s.prototype._countBits=function(y){var f=y,d=0;return f>=4096&&(d+=13,f>>>=13),f>=64&&(d+=7,f>>>=7),f>=8&&(d+=4,f>>>=4),f>=2&&(d+=2,f>>>=2),d+f},s.prototype._zeroBits=function(y){if(y===0)return 26;var f=y,d=0;return f&8191||(d+=13,f>>>=13),f&127||(d+=7,f>>>=7),f&15||(d+=4,f>>>=4),f&3||(d+=2,f>>>=2),f&1||d++,d},s.prototype.bitLength=function(){var y=this.words[this.length-1],f=this._countBits(y);return(this.length-1)*26+f};function S(L){for(var y=new Array(L.bitLength()),f=0;f<y.length;f++){var d=f/26|0,v=f%26;y[f]=(L.words[d]&1<<v)>>>v}return y}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var y=0,f=0;f<this.length;f++){var d=this._zeroBits(this.words[f]);if(y+=d,d!==26)break}return y},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(y){return this.negative!==0?this.abs().inotn(y).iaddn(1):this.clone()},s.prototype.fromTwos=function(y){return this.testn(y-1)?this.notn(y).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(y){for(;this.length<y.length;)this.words[this.length++]=0;for(var f=0;f<y.length;f++)this.words[f]=this.words[f]|y.words[f];return this.strip()},s.prototype.ior=function(y){return i((this.negative|y.negative)===0),this.iuor(y)},s.prototype.or=function(y){return this.length>y.length?this.clone().ior(y):y.clone().ior(this)},s.prototype.uor=function(y){return this.length>y.length?this.clone().iuor(y):y.clone().iuor(this)},s.prototype.iuand=function(y){var f;this.length>y.length?f=y:f=this;for(var d=0;d<f.length;d++)this.words[d]=this.words[d]&y.words[d];return this.length=f.length,this.strip()},s.prototype.iand=function(y){return i((this.negative|y.negative)===0),this.iuand(y)},s.prototype.and=function(y){return this.length>y.length?this.clone().iand(y):y.clone().iand(this)},s.prototype.uand=function(y){return this.length>y.length?this.clone().iuand(y):y.clone().iuand(this)},s.prototype.iuxor=function(y){var f,d;this.length>y.length?(f=this,d=y):(f=y,d=this);for(var v=0;v<d.length;v++)this.words[v]=f.words[v]^d.words[v];if(this!==f)for(;v<f.length;v++)this.words[v]=f.words[v];return this.length=f.length,this.strip()},s.prototype.ixor=function(y){return i((this.negative|y.negative)===0),this.iuxor(y)},s.prototype.xor=function(y){return this.length>y.length?this.clone().ixor(y):y.clone().ixor(this)},s.prototype.uxor=function(y){return this.length>y.length?this.clone().iuxor(y):y.clone().iuxor(this)},s.prototype.inotn=function(y){i(typeof y=="number"&&y>=0);var f=Math.ceil(y/26)|0,d=y%26;this._expand(f),d>0&&f--;for(var v=0;v<f;v++)this.words[v]=~this.words[v]&67108863;return d>0&&(this.words[v]=~this.words[v]&67108863>>26-d),this.strip()},s.prototype.notn=function(y){return this.clone().inotn(y)},s.prototype.setn=function(y,f){i(typeof y=="number"&&y>=0);var d=y/26|0,v=y%26;return this._expand(d+1),f?this.words[d]=this.words[d]|1<<v:this.words[d]=this.words[d]&~(1<<v),this.strip()},s.prototype.iadd=function(y){var f;if(this.negative!==0&&y.negative===0)return this.negative=0,f=this.isub(y),this.negative^=1,this._normSign();if(this.negative===0&&y.negative!==0)return y.negative=0,f=this.isub(y),y.negative=1,f._normSign();var d,v;this.length>y.length?(d=this,v=y):(d=y,v=this);for(var E=0,C=0;C<v.length;C++)f=(d.words[C]|0)+(v.words[C]|0)+E,this.words[C]=f&67108863,E=f>>>26;for(;E!==0&&C<d.length;C++)f=(d.words[C]|0)+E,this.words[C]=f&67108863,E=f>>>26;if(this.length=d.length,E!==0)this.words[this.length]=E,this.length++;else if(d!==this)for(;C<d.length;C++)this.words[C]=d.words[C];return this},s.prototype.add=function(y){var f;return y.negative!==0&&this.negative===0?(y.negative=0,f=this.sub(y),y.negative^=1,f):y.negative===0&&this.negative!==0?(this.negative=0,f=y.sub(this),this.negative=1,f):this.length>y.length?this.clone().iadd(y):y.clone().iadd(this)},s.prototype.isub=function(y){if(y.negative!==0){y.negative=0;var f=this.iadd(y);return y.negative=1,f._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(y),this.negative=1,this._normSign();var d=this.cmp(y);if(d===0)return this.negative=0,this.length=1,this.words[0]=0,this;var v,E;d>0?(v=this,E=y):(v=y,E=this);for(var C=0,O=0;O<E.length;O++)f=(v.words[O]|0)-(E.words[O]|0)+C,C=f>>26,this.words[O]=f&67108863;for(;C!==0&&O<v.length;O++)f=(v.words[O]|0)+C,C=f>>26,this.words[O]=f&67108863;if(C===0&&O<v.length&&v!==this)for(;O<v.length;O++)this.words[O]=v.words[O];return this.length=Math.max(this.length,O),v!==this&&(this.negative=1),this.strip()},s.prototype.sub=function(y){return this.clone().isub(y)};function D(L,y,f){f.negative=y.negative^L.negative;var d=L.length+y.length|0;f.length=d,d=d-1|0;var v=L.words[0]|0,E=y.words[0]|0,C=v*E,O=C&67108863,M=C/67108864|0;f.words[0]=O;for(var g=1;g<d;g++){for(var m=M>>>26,N=M&67108863,X=Math.min(g,y.length-1),ae=Math.max(0,g-L.length+1);ae<=X;ae++){var P=g-ae|0;v=L.words[P]|0,E=y.words[ae]|0,C=v*E+N,m+=C/67108864|0,N=C&67108863}f.words[g]=N|0,M=m|0}return M!==0?f.words[g]=M|0:f.length--,f.strip()}var T=function(y,f,d){var v=y.words,E=f.words,C=d.words,O=0,M,g,m,N=v[0]|0,X=N&8191,ae=N>>>13,P=v[1]|0,te=P&8191,z=P>>>13,G=v[2]|0,J=G&8191,A=G>>>13,V=v[3]|0,oe=V&8191,ue=V>>>13,he=v[4]|0,ye=he&8191,we=he>>>13,Re=v[5]|0,Xe=Re&8191,Oe=Re>>>13,Ne=v[6]|0,Me=Ne&8191,be=Ne>>>13,Pe=v[7]|0,Te=Pe&8191,ve=Pe>>>13,$e=v[8]|0,Se=$e&8191,me=$e>>>13,Ue=v[9]|0,Ce=Ue&8191,_e=Ue>>>13,Ke=E[0]|0,Ve=Ke&8191,Ae=Ke>>>13,We=E[1]|0,pt=We&8191,Ge=We>>>13,It=E[2]|0,gt=It&8191,Ye=It>>>13,Ot=E[3]|0,Tt=Ot&8191,Le=Ot>>>13,et=E[4]|0,it=et&8191,Be=et>>>13,rt=E[5]|0,tt=rt&8191,qe=rt>>>13,ht=E[6]|0,nt=ht&8191,je=ht>>>13,st=E[7]|0,at=st&8191,Fe=st>>>13,Ze=E[8]|0,lt=Ze&8191,ze=Ze>>>13,qt=E[9]|0,jt=qt&8191,ct=qt>>>13;d.negative=y.negative^f.negative,d.length=19,M=Math.imul(X,Ve),g=Math.imul(X,Ae),g=g+Math.imul(ae,Ve)|0,m=Math.imul(ae,Ae);var _t=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(_t>>>26)|0,_t&=67108863,M=Math.imul(te,Ve),g=Math.imul(te,Ae),g=g+Math.imul(z,Ve)|0,m=Math.imul(z,Ae),M=M+Math.imul(X,pt)|0,g=g+Math.imul(X,Ge)|0,g=g+Math.imul(ae,pt)|0,m=m+Math.imul(ae,Ge)|0;var Zr=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,M=Math.imul(J,Ve),g=Math.imul(J,Ae),g=g+Math.imul(A,Ve)|0,m=Math.imul(A,Ae),M=M+Math.imul(te,pt)|0,g=g+Math.imul(te,Ge)|0,g=g+Math.imul(z,pt)|0,m=m+Math.imul(z,Ge)|0,M=M+Math.imul(X,gt)|0,g=g+Math.imul(X,Ye)|0,g=g+Math.imul(ae,gt)|0,m=m+Math.imul(ae,Ye)|0;var Xr=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,M=Math.imul(oe,Ve),g=Math.imul(oe,Ae),g=g+Math.imul(ue,Ve)|0,m=Math.imul(ue,Ae),M=M+Math.imul(J,pt)|0,g=g+Math.imul(J,Ge)|0,g=g+Math.imul(A,pt)|0,m=m+Math.imul(A,Ge)|0,M=M+Math.imul(te,gt)|0,g=g+Math.imul(te,Ye)|0,g=g+Math.imul(z,gt)|0,m=m+Math.imul(z,Ye)|0,M=M+Math.imul(X,Tt)|0,g=g+Math.imul(X,Le)|0,g=g+Math.imul(ae,Tt)|0,m=m+Math.imul(ae,Le)|0;var ei=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(ei>>>26)|0,ei&=67108863,M=Math.imul(ye,Ve),g=Math.imul(ye,Ae),g=g+Math.imul(we,Ve)|0,m=Math.imul(we,Ae),M=M+Math.imul(oe,pt)|0,g=g+Math.imul(oe,Ge)|0,g=g+Math.imul(ue,pt)|0,m=m+Math.imul(ue,Ge)|0,M=M+Math.imul(J,gt)|0,g=g+Math.imul(J,Ye)|0,g=g+Math.imul(A,gt)|0,m=m+Math.imul(A,Ye)|0,M=M+Math.imul(te,Tt)|0,g=g+Math.imul(te,Le)|0,g=g+Math.imul(z,Tt)|0,m=m+Math.imul(z,Le)|0,M=M+Math.imul(X,it)|0,g=g+Math.imul(X,Be)|0,g=g+Math.imul(ae,it)|0,m=m+Math.imul(ae,Be)|0;var ti=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(ti>>>26)|0,ti&=67108863,M=Math.imul(Xe,Ve),g=Math.imul(Xe,Ae),g=g+Math.imul(Oe,Ve)|0,m=Math.imul(Oe,Ae),M=M+Math.imul(ye,pt)|0,g=g+Math.imul(ye,Ge)|0,g=g+Math.imul(we,pt)|0,m=m+Math.imul(we,Ge)|0,M=M+Math.imul(oe,gt)|0,g=g+Math.imul(oe,Ye)|0,g=g+Math.imul(ue,gt)|0,m=m+Math.imul(ue,Ye)|0,M=M+Math.imul(J,Tt)|0,g=g+Math.imul(J,Le)|0,g=g+Math.imul(A,Tt)|0,m=m+Math.imul(A,Le)|0,M=M+Math.imul(te,it)|0,g=g+Math.imul(te,Be)|0,g=g+Math.imul(z,it)|0,m=m+Math.imul(z,Be)|0,M=M+Math.imul(X,tt)|0,g=g+Math.imul(X,qe)|0,g=g+Math.imul(ae,tt)|0,m=m+Math.imul(ae,qe)|0;var ri=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(ri>>>26)|0,ri&=67108863,M=Math.imul(Me,Ve),g=Math.imul(Me,Ae),g=g+Math.imul(be,Ve)|0,m=Math.imul(be,Ae),M=M+Math.imul(Xe,pt)|0,g=g+Math.imul(Xe,Ge)|0,g=g+Math.imul(Oe,pt)|0,m=m+Math.imul(Oe,Ge)|0,M=M+Math.imul(ye,gt)|0,g=g+Math.imul(ye,Ye)|0,g=g+Math.imul(we,gt)|0,m=m+Math.imul(we,Ye)|0,M=M+Math.imul(oe,Tt)|0,g=g+Math.imul(oe,Le)|0,g=g+Math.imul(ue,Tt)|0,m=m+Math.imul(ue,Le)|0,M=M+Math.imul(J,it)|0,g=g+Math.imul(J,Be)|0,g=g+Math.imul(A,it)|0,m=m+Math.imul(A,Be)|0,M=M+Math.imul(te,tt)|0,g=g+Math.imul(te,qe)|0,g=g+Math.imul(z,tt)|0,m=m+Math.imul(z,qe)|0,M=M+Math.imul(X,nt)|0,g=g+Math.imul(X,je)|0,g=g+Math.imul(ae,nt)|0,m=m+Math.imul(ae,je)|0;var vr=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(vr>>>26)|0,vr&=67108863,M=Math.imul(Te,Ve),g=Math.imul(Te,Ae),g=g+Math.imul(ve,Ve)|0,m=Math.imul(ve,Ae),M=M+Math.imul(Me,pt)|0,g=g+Math.imul(Me,Ge)|0,g=g+Math.imul(be,pt)|0,m=m+Math.imul(be,Ge)|0,M=M+Math.imul(Xe,gt)|0,g=g+Math.imul(Xe,Ye)|0,g=g+Math.imul(Oe,gt)|0,m=m+Math.imul(Oe,Ye)|0,M=M+Math.imul(ye,Tt)|0,g=g+Math.imul(ye,Le)|0,g=g+Math.imul(we,Tt)|0,m=m+Math.imul(we,Le)|0,M=M+Math.imul(oe,it)|0,g=g+Math.imul(oe,Be)|0,g=g+Math.imul(ue,it)|0,m=m+Math.imul(ue,Be)|0,M=M+Math.imul(J,tt)|0,g=g+Math.imul(J,qe)|0,g=g+Math.imul(A,tt)|0,m=m+Math.imul(A,qe)|0,M=M+Math.imul(te,nt)|0,g=g+Math.imul(te,je)|0,g=g+Math.imul(z,nt)|0,m=m+Math.imul(z,je)|0,M=M+Math.imul(X,at)|0,g=g+Math.imul(X,Fe)|0,g=g+Math.imul(ae,at)|0,m=m+Math.imul(ae,Fe)|0;var Ii=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(Ii>>>26)|0,Ii&=67108863,M=Math.imul(Se,Ve),g=Math.imul(Se,Ae),g=g+Math.imul(me,Ve)|0,m=Math.imul(me,Ae),M=M+Math.imul(Te,pt)|0,g=g+Math.imul(Te,Ge)|0,g=g+Math.imul(ve,pt)|0,m=m+Math.imul(ve,Ge)|0,M=M+Math.imul(Me,gt)|0,g=g+Math.imul(Me,Ye)|0,g=g+Math.imul(be,gt)|0,m=m+Math.imul(be,Ye)|0,M=M+Math.imul(Xe,Tt)|0,g=g+Math.imul(Xe,Le)|0,g=g+Math.imul(Oe,Tt)|0,m=m+Math.imul(Oe,Le)|0,M=M+Math.imul(ye,it)|0,g=g+Math.imul(ye,Be)|0,g=g+Math.imul(we,it)|0,m=m+Math.imul(we,Be)|0,M=M+Math.imul(oe,tt)|0,g=g+Math.imul(oe,qe)|0,g=g+Math.imul(ue,tt)|0,m=m+Math.imul(ue,qe)|0,M=M+Math.imul(J,nt)|0,g=g+Math.imul(J,je)|0,g=g+Math.imul(A,nt)|0,m=m+Math.imul(A,je)|0,M=M+Math.imul(te,at)|0,g=g+Math.imul(te,Fe)|0,g=g+Math.imul(z,at)|0,m=m+Math.imul(z,Fe)|0,M=M+Math.imul(X,lt)|0,g=g+Math.imul(X,ze)|0,g=g+Math.imul(ae,lt)|0,m=m+Math.imul(ae,ze)|0;var On=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(On>>>26)|0,On&=67108863,M=Math.imul(Ce,Ve),g=Math.imul(Ce,Ae),g=g+Math.imul(_e,Ve)|0,m=Math.imul(_e,Ae),M=M+Math.imul(Se,pt)|0,g=g+Math.imul(Se,Ge)|0,g=g+Math.imul(me,pt)|0,m=m+Math.imul(me,Ge)|0,M=M+Math.imul(Te,gt)|0,g=g+Math.imul(Te,Ye)|0,g=g+Math.imul(ve,gt)|0,m=m+Math.imul(ve,Ye)|0,M=M+Math.imul(Me,Tt)|0,g=g+Math.imul(Me,Le)|0,g=g+Math.imul(be,Tt)|0,m=m+Math.imul(be,Le)|0,M=M+Math.imul(Xe,it)|0,g=g+Math.imul(Xe,Be)|0,g=g+Math.imul(Oe,it)|0,m=m+Math.imul(Oe,Be)|0,M=M+Math.imul(ye,tt)|0,g=g+Math.imul(ye,qe)|0,g=g+Math.imul(we,tt)|0,m=m+Math.imul(we,qe)|0,M=M+Math.imul(oe,nt)|0,g=g+Math.imul(oe,je)|0,g=g+Math.imul(ue,nt)|0,m=m+Math.imul(ue,je)|0,M=M+Math.imul(J,at)|0,g=g+Math.imul(J,Fe)|0,g=g+Math.imul(A,at)|0,m=m+Math.imul(A,Fe)|0,M=M+Math.imul(te,lt)|0,g=g+Math.imul(te,ze)|0,g=g+Math.imul(z,lt)|0,m=m+Math.imul(z,ze)|0,M=M+Math.imul(X,jt)|0,g=g+Math.imul(X,ct)|0,g=g+Math.imul(ae,jt)|0,m=m+Math.imul(ae,ct)|0;var Mi=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(Mi>>>26)|0,Mi&=67108863,M=Math.imul(Ce,pt),g=Math.imul(Ce,Ge),g=g+Math.imul(_e,pt)|0,m=Math.imul(_e,Ge),M=M+Math.imul(Se,gt)|0,g=g+Math.imul(Se,Ye)|0,g=g+Math.imul(me,gt)|0,m=m+Math.imul(me,Ye)|0,M=M+Math.imul(Te,Tt)|0,g=g+Math.imul(Te,Le)|0,g=g+Math.imul(ve,Tt)|0,m=m+Math.imul(ve,Le)|0,M=M+Math.imul(Me,it)|0,g=g+Math.imul(Me,Be)|0,g=g+Math.imul(be,it)|0,m=m+Math.imul(be,Be)|0,M=M+Math.imul(Xe,tt)|0,g=g+Math.imul(Xe,qe)|0,g=g+Math.imul(Oe,tt)|0,m=m+Math.imul(Oe,qe)|0,M=M+Math.imul(ye,nt)|0,g=g+Math.imul(ye,je)|0,g=g+Math.imul(we,nt)|0,m=m+Math.imul(we,je)|0,M=M+Math.imul(oe,at)|0,g=g+Math.imul(oe,Fe)|0,g=g+Math.imul(ue,at)|0,m=m+Math.imul(ue,Fe)|0,M=M+Math.imul(J,lt)|0,g=g+Math.imul(J,ze)|0,g=g+Math.imul(A,lt)|0,m=m+Math.imul(A,ze)|0,M=M+Math.imul(te,jt)|0,g=g+Math.imul(te,ct)|0,g=g+Math.imul(z,jt)|0,m=m+Math.imul(z,ct)|0;var Pn=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,M=Math.imul(Ce,gt),g=Math.imul(Ce,Ye),g=g+Math.imul(_e,gt)|0,m=Math.imul(_e,Ye),M=M+Math.imul(Se,Tt)|0,g=g+Math.imul(Se,Le)|0,g=g+Math.imul(me,Tt)|0,m=m+Math.imul(me,Le)|0,M=M+Math.imul(Te,it)|0,g=g+Math.imul(Te,Be)|0,g=g+Math.imul(ve,it)|0,m=m+Math.imul(ve,Be)|0,M=M+Math.imul(Me,tt)|0,g=g+Math.imul(Me,qe)|0,g=g+Math.imul(be,tt)|0,m=m+Math.imul(be,qe)|0,M=M+Math.imul(Xe,nt)|0,g=g+Math.imul(Xe,je)|0,g=g+Math.imul(Oe,nt)|0,m=m+Math.imul(Oe,je)|0,M=M+Math.imul(ye,at)|0,g=g+Math.imul(ye,Fe)|0,g=g+Math.imul(we,at)|0,m=m+Math.imul(we,Fe)|0,M=M+Math.imul(oe,lt)|0,g=g+Math.imul(oe,ze)|0,g=g+Math.imul(ue,lt)|0,m=m+Math.imul(ue,ze)|0,M=M+Math.imul(J,jt)|0,g=g+Math.imul(J,ct)|0,g=g+Math.imul(A,jt)|0,m=m+Math.imul(A,ct)|0;var $n=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+($n>>>26)|0,$n&=67108863,M=Math.imul(Ce,Tt),g=Math.imul(Ce,Le),g=g+Math.imul(_e,Tt)|0,m=Math.imul(_e,Le),M=M+Math.imul(Se,it)|0,g=g+Math.imul(Se,Be)|0,g=g+Math.imul(me,it)|0,m=m+Math.imul(me,Be)|0,M=M+Math.imul(Te,tt)|0,g=g+Math.imul(Te,qe)|0,g=g+Math.imul(ve,tt)|0,m=m+Math.imul(ve,qe)|0,M=M+Math.imul(Me,nt)|0,g=g+Math.imul(Me,je)|0,g=g+Math.imul(be,nt)|0,m=m+Math.imul(be,je)|0,M=M+Math.imul(Xe,at)|0,g=g+Math.imul(Xe,Fe)|0,g=g+Math.imul(Oe,at)|0,m=m+Math.imul(Oe,Fe)|0,M=M+Math.imul(ye,lt)|0,g=g+Math.imul(ye,ze)|0,g=g+Math.imul(we,lt)|0,m=m+Math.imul(we,ze)|0,M=M+Math.imul(oe,jt)|0,g=g+Math.imul(oe,ct)|0,g=g+Math.imul(ue,jt)|0,m=m+Math.imul(ue,ct)|0;var Ci=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(Ci>>>26)|0,Ci&=67108863,M=Math.imul(Ce,it),g=Math.imul(Ce,Be),g=g+Math.imul(_e,it)|0,m=Math.imul(_e,Be),M=M+Math.imul(Se,tt)|0,g=g+Math.imul(Se,qe)|0,g=g+Math.imul(me,tt)|0,m=m+Math.imul(me,qe)|0,M=M+Math.imul(Te,nt)|0,g=g+Math.imul(Te,je)|0,g=g+Math.imul(ve,nt)|0,m=m+Math.imul(ve,je)|0,M=M+Math.imul(Me,at)|0,g=g+Math.imul(Me,Fe)|0,g=g+Math.imul(be,at)|0,m=m+Math.imul(be,Fe)|0,M=M+Math.imul(Xe,lt)|0,g=g+Math.imul(Xe,ze)|0,g=g+Math.imul(Oe,lt)|0,m=m+Math.imul(Oe,ze)|0,M=M+Math.imul(ye,jt)|0,g=g+Math.imul(ye,ct)|0,g=g+Math.imul(we,jt)|0,m=m+Math.imul(we,ct)|0;var an=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(an>>>26)|0,an&=67108863,M=Math.imul(Ce,tt),g=Math.imul(Ce,qe),g=g+Math.imul(_e,tt)|0,m=Math.imul(_e,qe),M=M+Math.imul(Se,nt)|0,g=g+Math.imul(Se,je)|0,g=g+Math.imul(me,nt)|0,m=m+Math.imul(me,je)|0,M=M+Math.imul(Te,at)|0,g=g+Math.imul(Te,Fe)|0,g=g+Math.imul(ve,at)|0,m=m+Math.imul(ve,Fe)|0,M=M+Math.imul(Me,lt)|0,g=g+Math.imul(Me,ze)|0,g=g+Math.imul(be,lt)|0,m=m+Math.imul(be,ze)|0,M=M+Math.imul(Xe,jt)|0,g=g+Math.imul(Xe,ct)|0,g=g+Math.imul(Oe,jt)|0,m=m+Math.imul(Oe,ct)|0;var cn=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(cn>>>26)|0,cn&=67108863,M=Math.imul(Ce,nt),g=Math.imul(Ce,je),g=g+Math.imul(_e,nt)|0,m=Math.imul(_e,je),M=M+Math.imul(Se,at)|0,g=g+Math.imul(Se,Fe)|0,g=g+Math.imul(me,at)|0,m=m+Math.imul(me,Fe)|0,M=M+Math.imul(Te,lt)|0,g=g+Math.imul(Te,ze)|0,g=g+Math.imul(ve,lt)|0,m=m+Math.imul(ve,ze)|0,M=M+Math.imul(Me,jt)|0,g=g+Math.imul(Me,ct)|0,g=g+Math.imul(be,jt)|0,m=m+Math.imul(be,ct)|0;var Cr=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(Cr>>>26)|0,Cr&=67108863,M=Math.imul(Ce,at),g=Math.imul(Ce,Fe),g=g+Math.imul(_e,at)|0,m=Math.imul(_e,Fe),M=M+Math.imul(Se,lt)|0,g=g+Math.imul(Se,ze)|0,g=g+Math.imul(me,lt)|0,m=m+Math.imul(me,ze)|0,M=M+Math.imul(Te,jt)|0,g=g+Math.imul(Te,ct)|0,g=g+Math.imul(ve,jt)|0,m=m+Math.imul(ve,ct)|0;var Rn=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,M=Math.imul(Ce,lt),g=Math.imul(Ce,ze),g=g+Math.imul(_e,lt)|0,m=Math.imul(_e,ze),M=M+Math.imul(Se,jt)|0,g=g+Math.imul(Se,ct)|0,g=g+Math.imul(me,jt)|0,m=m+Math.imul(me,ct)|0;var Nn=(O+M|0)+((g&8191)<<13)|0;O=(m+(g>>>13)|0)+(Nn>>>26)|0,Nn&=67108863,M=Math.imul(Ce,jt),g=Math.imul(Ce,ct),g=g+Math.imul(_e,jt)|0,m=Math.imul(_e,ct);var Tn=(O+M|0)+((g&8191)<<13)|0;return O=(m+(g>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,C[0]=_t,C[1]=Zr,C[2]=Xr,C[3]=ei,C[4]=ti,C[5]=ri,C[6]=vr,C[7]=Ii,C[8]=On,C[9]=Mi,C[10]=Pn,C[11]=$n,C[12]=Ci,C[13]=an,C[14]=cn,C[15]=Cr,C[16]=Rn,C[17]=Nn,C[18]=Tn,O!==0&&(C[19]=O,d.length++),d};Math.imul||(T=D);function q(L,y,f){f.negative=y.negative^L.negative,f.length=L.length+y.length;for(var d=0,v=0,E=0;E<f.length-1;E++){var C=v;v=0;for(var O=d&67108863,M=Math.min(E,y.length-1),g=Math.max(0,E-L.length+1);g<=M;g++){var m=E-g,N=L.words[m]|0,X=y.words[g]|0,ae=N*X,P=ae&67108863;C=C+(ae/67108864|0)|0,P=P+O|0,O=P&67108863,C=C+(P>>>26)|0,v+=C>>>26,C&=67108863}f.words[E]=O,d=C,C=v}return d!==0?f.words[E]=d:f.length--,f.strip()}function K(L,y,f){var d=new F;return d.mulp(L,y,f)}s.prototype.mulTo=function(y,f){var d,v=this.length+y.length;return this.length===10&&y.length===10?d=T(this,y,f):v<63?d=D(this,y,f):v<1024?d=q(this,y,f):d=K(this,y,f),d};function F(L,y){this.x=L,this.y=y}F.prototype.makeRBT=function(y){for(var f=new Array(y),d=s.prototype._countBits(y)-1,v=0;v<y;v++)f[v]=this.revBin(v,d,y);return f},F.prototype.revBin=function(y,f,d){if(y===0||y===d-1)return y;for(var v=0,E=0;E<f;E++)v|=(y&1)<<f-E-1,y>>=1;return v},F.prototype.permute=function(y,f,d,v,E,C){for(var O=0;O<C;O++)v[O]=f[y[O]],E[O]=d[y[O]]},F.prototype.transform=function(y,f,d,v,E,C){this.permute(C,y,f,d,v,E);for(var O=1;O<E;O<<=1)for(var M=O<<1,g=Math.cos(2*Math.PI/M),m=Math.sin(2*Math.PI/M),N=0;N<E;N+=M)for(var X=g,ae=m,P=0;P<O;P++){var te=d[N+P],z=v[N+P],G=d[N+P+O],J=v[N+P+O],A=X*G-ae*J;J=X*J+ae*G,G=A,d[N+P]=te+G,v[N+P]=z+J,d[N+P+O]=te-G,v[N+P+O]=z-J,P!==M&&(A=g*X-m*ae,ae=g*ae+m*X,X=A)}},F.prototype.guessLen13b=function(y,f){var d=Math.max(f,y)|1,v=d&1,E=0;for(d=d/2|0;d;d=d>>>1)E++;return 1<<E+1+v},F.prototype.conjugate=function(y,f,d){if(!(d<=1))for(var v=0;v<d/2;v++){var E=y[v];y[v]=y[d-v-1],y[d-v-1]=E,E=f[v],f[v]=-f[d-v-1],f[d-v-1]=-E}},F.prototype.normalize13b=function(y,f){for(var d=0,v=0;v<f/2;v++){var E=Math.round(y[2*v+1]/f)*8192+Math.round(y[2*v]/f)+d;y[v]=E&67108863,E<67108864?d=0:d=E/67108864|0}return y},F.prototype.convert13b=function(y,f,d,v){for(var E=0,C=0;C<f;C++)E=E+(y[C]|0),d[2*C]=E&8191,E=E>>>13,d[2*C+1]=E&8191,E=E>>>13;for(C=2*f;C<v;++C)d[C]=0;i(E===0),i((E&-8192)===0)},F.prototype.stub=function(y){for(var f=new Array(y),d=0;d<y;d++)f[d]=0;return f},F.prototype.mulp=function(y,f,d){var v=2*this.guessLen13b(y.length,f.length),E=this.makeRBT(v),C=this.stub(v),O=new Array(v),M=new Array(v),g=new Array(v),m=new Array(v),N=new Array(v),X=new Array(v),ae=d.words;ae.length=v,this.convert13b(y.words,y.length,O,v),this.convert13b(f.words,f.length,m,v),this.transform(O,C,M,g,v,E),this.transform(m,C,N,X,v,E);for(var P=0;P<v;P++){var te=M[P]*N[P]-g[P]*X[P];g[P]=M[P]*X[P]+g[P]*N[P],M[P]=te}return this.conjugate(M,g,v),this.transform(M,g,ae,C,v,E),this.conjugate(ae,C,v),this.normalize13b(ae,v),d.negative=y.negative^f.negative,d.length=y.length+f.length,d.strip()},s.prototype.mul=function(y){var f=new s(null);return f.words=new Array(this.length+y.length),this.mulTo(y,f)},s.prototype.mulf=function(y){var f=new s(null);return f.words=new Array(this.length+y.length),K(this,y,f)},s.prototype.imul=function(y){return this.clone().mulTo(y,this)},s.prototype.imuln=function(y){i(typeof y=="number"),i(y<67108864);for(var f=0,d=0;d<this.length;d++){var v=(this.words[d]|0)*y,E=(v&67108863)+(f&67108863);f>>=26,f+=v/67108864|0,f+=E>>>26,this.words[d]=E&67108863}return f!==0&&(this.words[d]=f,this.length++),this},s.prototype.muln=function(y){return this.clone().imuln(y)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(y){var f=S(y);if(f.length===0)return new s(1);for(var d=this,v=0;v<f.length&&f[v]===0;v++,d=d.sqr());if(++v<f.length)for(var E=d.sqr();v<f.length;v++,E=E.sqr())f[v]!==0&&(d=d.mul(E));return d},s.prototype.iushln=function(y){i(typeof y=="number"&&y>=0);var f=y%26,d=(y-f)/26,v=67108863>>>26-f<<26-f,E;if(f!==0){var C=0;for(E=0;E<this.length;E++){var O=this.words[E]&v,M=(this.words[E]|0)-O<<f;this.words[E]=M|C,C=O>>>26-f}C&&(this.words[E]=C,this.length++)}if(d!==0){for(E=this.length-1;E>=0;E--)this.words[E+d]=this.words[E];for(E=0;E<d;E++)this.words[E]=0;this.length+=d}return this.strip()},s.prototype.ishln=function(y){return i(this.negative===0),this.iushln(y)},s.prototype.iushrn=function(y,f,d){i(typeof y=="number"&&y>=0);var v;f?v=(f-f%26)/26:v=0;var E=y%26,C=Math.min((y-E)/26,this.length),O=67108863^67108863>>>E<<E,M=d;if(v-=C,v=Math.max(0,v),M){for(var g=0;g<C;g++)M.words[g]=this.words[g];M.length=C}if(C!==0)if(this.length>C)for(this.length-=C,g=0;g<this.length;g++)this.words[g]=this.words[g+C];else this.words[0]=0,this.length=1;var m=0;for(g=this.length-1;g>=0&&(m!==0||g>=v);g--){var N=this.words[g]|0;this.words[g]=m<<26-E|N>>>E,m=N&O}return M&&m!==0&&(M.words[M.length++]=m),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(y,f,d){return i(this.negative===0),this.iushrn(y,f,d)},s.prototype.shln=function(y){return this.clone().ishln(y)},s.prototype.ushln=function(y){return this.clone().iushln(y)},s.prototype.shrn=function(y){return this.clone().ishrn(y)},s.prototype.ushrn=function(y){return this.clone().iushrn(y)},s.prototype.testn=function(y){i(typeof y=="number"&&y>=0);var f=y%26,d=(y-f)/26,v=1<<f;if(this.length<=d)return!1;var E=this.words[d];return!!(E&v)},s.prototype.imaskn=function(y){i(typeof y=="number"&&y>=0);var f=y%26,d=(y-f)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=d)return this;if(f!==0&&d++,this.length=Math.min(d,this.length),f!==0){var v=67108863^67108863>>>f<<f;this.words[this.length-1]&=v}return this.strip()},s.prototype.maskn=function(y){return this.clone().imaskn(y)},s.prototype.iaddn=function(y){return i(typeof y=="number"),i(y<67108864),y<0?this.isubn(-y):this.negative!==0?this.length===1&&(this.words[0]|0)<y?(this.words[0]=y-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(y),this.negative=1,this):this._iaddn(y)},s.prototype._iaddn=function(y){this.words[0]+=y;for(var f=0;f<this.length&&this.words[f]>=67108864;f++)this.words[f]-=67108864,f===this.length-1?this.words[f+1]=1:this.words[f+1]++;return this.length=Math.max(this.length,f+1),this},s.prototype.isubn=function(y){if(i(typeof y=="number"),i(y<67108864),y<0)return this.iaddn(-y);if(this.negative!==0)return this.negative=0,this.iaddn(y),this.negative=1,this;if(this.words[0]-=y,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var f=0;f<this.length&&this.words[f]<0;f++)this.words[f]+=67108864,this.words[f+1]-=1;return this.strip()},s.prototype.addn=function(y){return this.clone().iaddn(y)},s.prototype.subn=function(y){return this.clone().isubn(y)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(y,f,d){var v=y.length+d,E;this._expand(v);var C,O=0;for(E=0;E<y.length;E++){C=(this.words[E+d]|0)+O;var M=(y.words[E]|0)*f;C-=M&67108863,O=(C>>26)-(M/67108864|0),this.words[E+d]=C&67108863}for(;E<this.length-d;E++)C=(this.words[E+d]|0)+O,O=C>>26,this.words[E+d]=C&67108863;if(O===0)return this.strip();for(i(O===-1),O=0,E=0;E<this.length;E++)C=-(this.words[E]|0)+O,O=C>>26,this.words[E]=C&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(y,f){var d=this.length-y.length,v=this.clone(),E=y,C=E.words[E.length-1]|0,O=this._countBits(C);d=26-O,d!==0&&(E=E.ushln(d),v.iushln(d),C=E.words[E.length-1]|0);var M=v.length-E.length,g;if(f!=="mod"){g=new s(null),g.length=M+1,g.words=new Array(g.length);for(var m=0;m<g.length;m++)g.words[m]=0}var N=v.clone()._ishlnsubmul(E,1,M);N.negative===0&&(v=N,g&&(g.words[M]=1));for(var X=M-1;X>=0;X--){var ae=(v.words[E.length+X]|0)*67108864+(v.words[E.length+X-1]|0);for(ae=Math.min(ae/C|0,67108863),v._ishlnsubmul(E,ae,X);v.negative!==0;)ae--,v.negative=0,v._ishlnsubmul(E,1,X),v.isZero()||(v.negative^=1);g&&(g.words[X]=ae)}return g&&g.strip(),v.strip(),f!=="div"&&d!==0&&v.iushrn(d),{div:g||null,mod:v}},s.prototype.divmod=function(y,f,d){if(i(!y.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var v,E,C;return this.negative!==0&&y.negative===0?(C=this.neg().divmod(y,f),f!=="mod"&&(v=C.div.neg()),f!=="div"&&(E=C.mod.neg(),d&&E.negative!==0&&E.iadd(y)),{div:v,mod:E}):this.negative===0&&y.negative!==0?(C=this.divmod(y.neg(),f),f!=="mod"&&(v=C.div.neg()),{div:v,mod:C.mod}):this.negative&y.negative?(C=this.neg().divmod(y.neg(),f),f!=="div"&&(E=C.mod.neg(),d&&E.negative!==0&&E.isub(y)),{div:C.div,mod:E}):y.length>this.length||this.cmp(y)<0?{div:new s(0),mod:this}:y.length===1?f==="div"?{div:this.divn(y.words[0]),mod:null}:f==="mod"?{div:null,mod:new s(this.modn(y.words[0]))}:{div:this.divn(y.words[0]),mod:new s(this.modn(y.words[0]))}:this._wordDiv(y,f)},s.prototype.div=function(y){return this.divmod(y,"div",!1).div},s.prototype.mod=function(y){return this.divmod(y,"mod",!1).mod},s.prototype.umod=function(y){return this.divmod(y,"mod",!0).mod},s.prototype.divRound=function(y){var f=this.divmod(y);if(f.mod.isZero())return f.div;var d=f.div.negative!==0?f.mod.isub(y):f.mod,v=y.ushrn(1),E=y.andln(1),C=d.cmp(v);return C<0||E===1&&C===0?f.div:f.div.negative!==0?f.div.isubn(1):f.div.iaddn(1)},s.prototype.modn=function(y){i(y<=67108863);for(var f=(1<<26)%y,d=0,v=this.length-1;v>=0;v--)d=(f*d+(this.words[v]|0))%y;return d},s.prototype.idivn=function(y){i(y<=67108863);for(var f=0,d=this.length-1;d>=0;d--){var v=(this.words[d]|0)+f*67108864;this.words[d]=v/y|0,f=v%y}return this.strip()},s.prototype.divn=function(y){return this.clone().idivn(y)},s.prototype.egcd=function(y){i(y.negative===0),i(!y.isZero());var f=this,d=y.clone();f.negative!==0?f=f.umod(y):f=f.clone();for(var v=new s(1),E=new s(0),C=new s(0),O=new s(1),M=0;f.isEven()&&d.isEven();)f.iushrn(1),d.iushrn(1),++M;for(var g=d.clone(),m=f.clone();!f.isZero();){for(var N=0,X=1;!(f.words[0]&X)&&N<26;++N,X<<=1);if(N>0)for(f.iushrn(N);N-- >0;)(v.isOdd()||E.isOdd())&&(v.iadd(g),E.isub(m)),v.iushrn(1),E.iushrn(1);for(var ae=0,P=1;!(d.words[0]&P)&&ae<26;++ae,P<<=1);if(ae>0)for(d.iushrn(ae);ae-- >0;)(C.isOdd()||O.isOdd())&&(C.iadd(g),O.isub(m)),C.iushrn(1),O.iushrn(1);f.cmp(d)>=0?(f.isub(d),v.isub(C),E.isub(O)):(d.isub(f),C.isub(v),O.isub(E))}return{a:C,b:O,gcd:d.iushln(M)}},s.prototype._invmp=function(y){i(y.negative===0),i(!y.isZero());var f=this,d=y.clone();f.negative!==0?f=f.umod(y):f=f.clone();for(var v=new s(1),E=new s(0),C=d.clone();f.cmpn(1)>0&&d.cmpn(1)>0;){for(var O=0,M=1;!(f.words[0]&M)&&O<26;++O,M<<=1);if(O>0)for(f.iushrn(O);O-- >0;)v.isOdd()&&v.iadd(C),v.iushrn(1);for(var g=0,m=1;!(d.words[0]&m)&&g<26;++g,m<<=1);if(g>0)for(d.iushrn(g);g-- >0;)E.isOdd()&&E.iadd(C),E.iushrn(1);f.cmp(d)>=0?(f.isub(d),v.isub(E)):(d.isub(f),E.isub(v))}var N;return f.cmpn(1)===0?N=v:N=E,N.cmpn(0)<0&&N.iadd(y),N},s.prototype.gcd=function(y){if(this.isZero())return y.abs();if(y.isZero())return this.abs();var f=this.clone(),d=y.clone();f.negative=0,d.negative=0;for(var v=0;f.isEven()&&d.isEven();v++)f.iushrn(1),d.iushrn(1);do{for(;f.isEven();)f.iushrn(1);for(;d.isEven();)d.iushrn(1);var E=f.cmp(d);if(E<0){var C=f;f=d,d=C}else if(E===0||d.cmpn(1)===0)break;f.isub(d)}while(!0);return d.iushln(v)},s.prototype.invm=function(y){return this.egcd(y).a.umod(y)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(y){return this.words[0]&y},s.prototype.bincn=function(y){i(typeof y=="number");var f=y%26,d=(y-f)/26,v=1<<f;if(this.length<=d)return this._expand(d+1),this.words[d]|=v,this;for(var E=v,C=d;E!==0&&C<this.length;C++){var O=this.words[C]|0;O+=E,E=O>>>26,O&=67108863,this.words[C]=O}return E!==0&&(this.words[C]=E,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(y){var f=y<0;if(this.negative!==0&&!f)return-1;if(this.negative===0&&f)return 1;this.strip();var d;if(this.length>1)d=1;else{f&&(y=-y),i(y<=67108863,"Number is too big");var v=this.words[0]|0;d=v===y?0:v<y?-1:1}return this.negative!==0?-d|0:d},s.prototype.cmp=function(y){if(this.negative!==0&&y.negative===0)return-1;if(this.negative===0&&y.negative!==0)return 1;var f=this.ucmp(y);return this.negative!==0?-f|0:f},s.prototype.ucmp=function(y){if(this.length>y.length)return 1;if(this.length<y.length)return-1;for(var f=0,d=this.length-1;d>=0;d--){var v=this.words[d]|0,E=y.words[d]|0;if(v!==E){v<E?f=-1:v>E&&(f=1);break}}return f},s.prototype.gtn=function(y){return this.cmpn(y)===1},s.prototype.gt=function(y){return this.cmp(y)===1},s.prototype.gten=function(y){return this.cmpn(y)>=0},s.prototype.gte=function(y){return this.cmp(y)>=0},s.prototype.ltn=function(y){return this.cmpn(y)===-1},s.prototype.lt=function(y){return this.cmp(y)===-1},s.prototype.lten=function(y){return this.cmpn(y)<=0},s.prototype.lte=function(y){return this.cmp(y)<=0},s.prototype.eqn=function(y){return this.cmpn(y)===0},s.prototype.eq=function(y){return this.cmp(y)===0},s.red=function(y){return new ee(y)},s.prototype.toRed=function(y){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),y.convertTo(this)._forceRed(y)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(y){return this.red=y,this},s.prototype.forceRed=function(y){return i(!this.red,"Already a number in reduction context"),this._forceRed(y)},s.prototype.redAdd=function(y){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,y)},s.prototype.redIAdd=function(y){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,y)},s.prototype.redSub=function(y){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,y)},s.prototype.redISub=function(y){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,y)},s.prototype.redShl=function(y){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,y)},s.prototype.redMul=function(y){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,y),this.red.mul(this,y)},s.prototype.redIMul=function(y){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,y),this.red.imul(this,y)},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(y){return i(this.red&&!y.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,y)};var W={k256:null,p224:null,p192:null,p25519:null};function R(L,y){this.name=L,this.p=new s(y,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}R.prototype._tmp=function(){var y=new s(null);return y.words=new Array(Math.ceil(this.n/13)),y},R.prototype.ireduce=function(y){var f=y,d;do this.split(f,this.tmp),f=this.imulK(f),f=f.iadd(this.tmp),d=f.bitLength();while(d>this.n);var v=d<this.n?-1:f.ucmp(this.p);return v===0?(f.words[0]=0,f.length=1):v>0?f.isub(this.p):f.strip!==void 0?f.strip():f._strip(),f},R.prototype.split=function(y,f){y.iushrn(this.n,0,f)},R.prototype.imulK=function(y){return y.imul(this.k)};function k(){R.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(k,R),k.prototype.split=function(y,f){for(var d=4194303,v=Math.min(y.length,9),E=0;E<v;E++)f.words[E]=y.words[E];if(f.length=v,y.length<=9){y.words[0]=0,y.length=1;return}var C=y.words[9];for(f.words[f.length++]=C&d,E=10;E<y.length;E++){var O=y.words[E]|0;y.words[E-10]=(O&d)<<4|C>>>22,C=O}C>>>=22,y.words[E-10]=C,C===0&&y.length>10?y.length-=10:y.length-=9},k.prototype.imulK=function(y){y.words[y.length]=0,y.words[y.length+1]=0,y.length+=2;for(var f=0,d=0;d<y.length;d++){var v=y.words[d]|0;f+=v*977,y.words[d]=f&67108863,f=v*64+(f/67108864|0)}return y.words[y.length-1]===0&&(y.length--,y.words[y.length-1]===0&&y.length--),y};function H(){R.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(H,R);function _(){R.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(_,R);function B(){R.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(B,R),B.prototype.imulK=function(y){for(var f=0,d=0;d<y.length;d++){var v=(y.words[d]|0)*19+f,E=v&67108863;v>>>=26,y.words[d]=E,f=v}return f!==0&&(y.words[y.length++]=f),y},s._prime=function(y){if(W[y])return W[y];var f;if(y==="k256")f=new k;else if(y==="p224")f=new H;else if(y==="p192")f=new _;else if(y==="p25519")f=new B;else throw new Error("Unknown prime "+y);return W[y]=f,f};function ee(L){if(typeof L=="string"){var y=s._prime(L);this.m=y.p,this.prime=y}else i(L.gtn(1),"modulus must be greater than 1"),this.m=L,this.prime=null}ee.prototype._verify1=function(y){i(y.negative===0,"red works only with positives"),i(y.red,"red works only with red numbers")},ee.prototype._verify2=function(y,f){i((y.negative|f.negative)===0,"red works only with positives"),i(y.red&&y.red===f.red,"red works only with red numbers")},ee.prototype.imod=function(y){return this.prime?this.prime.ireduce(y)._forceRed(this):y.umod(this.m)._forceRed(this)},ee.prototype.neg=function(y){return y.isZero()?y.clone():this.m.sub(y)._forceRed(this)},ee.prototype.add=function(y,f){this._verify2(y,f);var d=y.add(f);return d.cmp(this.m)>=0&&d.isub(this.m),d._forceRed(this)},ee.prototype.iadd=function(y,f){this._verify2(y,f);var d=y.iadd(f);return d.cmp(this.m)>=0&&d.isub(this.m),d},ee.prototype.sub=function(y,f){this._verify2(y,f);var d=y.sub(f);return d.cmpn(0)<0&&d.iadd(this.m),d._forceRed(this)},ee.prototype.isub=function(y,f){this._verify2(y,f);var d=y.isub(f);return d.cmpn(0)<0&&d.iadd(this.m),d},ee.prototype.shl=function(y,f){return this._verify1(y),this.imod(y.ushln(f))},ee.prototype.imul=function(y,f){return this._verify2(y,f),this.imod(y.imul(f))},ee.prototype.mul=function(y,f){return this._verify2(y,f),this.imod(y.mul(f))},ee.prototype.isqr=function(y){return this.imul(y,y.clone())},ee.prototype.sqr=function(y){return this.mul(y,y)},ee.prototype.sqrt=function(y){if(y.isZero())return y.clone();var f=this.m.andln(3);if(i(f%2===1),f===3){var d=this.m.add(new s(1)).iushrn(2);return this.pow(y,d)}for(var v=this.m.subn(1),E=0;!v.isZero()&&v.andln(1)===0;)E++,v.iushrn(1);i(!v.isZero());var C=new s(1).toRed(this),O=C.redNeg(),M=this.m.subn(1).iushrn(1),g=this.m.bitLength();for(g=new s(2*g*g).toRed(this);this.pow(g,M).cmp(O)!==0;)g.redIAdd(O);for(var m=this.pow(g,v),N=this.pow(y,v.addn(1).iushrn(1)),X=this.pow(y,v),ae=E;X.cmp(C)!==0;){for(var P=X,te=0;P.cmp(C)!==0;te++)P=P.redSqr();i(te<ae);var z=this.pow(m,new s(1).iushln(ae-te-1));N=N.redMul(z),m=z.redSqr(),X=X.redMul(m),ae=te}return N},ee.prototype.invm=function(y){var f=y._invmp(this.m);return f.negative!==0?(f.negative=0,this.imod(f).redNeg()):this.imod(f)},ee.prototype.pow=function(y,f){if(f.isZero())return new s(1).toRed(this);if(f.cmpn(1)===0)return y.clone();var d=4,v=new Array(1<<d);v[0]=new s(1).toRed(this),v[1]=y;for(var E=2;E<v.length;E++)v[E]=this.mul(v[E-1],y);var C=v[0],O=0,M=0,g=f.bitLength()%26;for(g===0&&(g=26),E=f.length-1;E>=0;E--){for(var m=f.words[E],N=g-1;N>=0;N--){var X=m>>N&1;if(C!==v[0]&&(C=this.sqr(C)),X===0&&O===0){M=0;continue}O<<=1,O|=X,M++,!(M!==d&&(E!==0||N!==0))&&(C=this.mul(C,v[O]),M=0,O=0)}g=26}return C},ee.prototype.convertTo=function(y){var f=y.umod(this.m);return f===y?f.clone():f},ee.prototype.convertFrom=function(y){var f=y.clone();return f.red=null,f},s.mont=function(y){return new ie(y)};function ie(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(ie,ee),ie.prototype.convertTo=function(y){return this.imod(y.ushln(this.shift))},ie.prototype.convertFrom=function(y){var f=this.imod(y.mul(this.rinv));return f.red=null,f},ie.prototype.imul=function(y,f){if(y.isZero()||f.isZero())return y.words[0]=0,y.length=1,y;var d=y.imul(f),v=d.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=d.isub(v).iushrn(this.shift),C=E;return E.cmp(this.m)>=0?C=E.isub(this.m):E.cmpn(0)<0&&(C=E.iadd(this.m)),C._forceRed(this)},ie.prototype.mul=function(y,f){if(y.isZero()||f.isZero())return new s(0)._forceRed(this);var d=y.mul(f),v=d.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=d.isub(v).iushrn(this.shift),C=E;return E.cmp(this.m)>=0?C=E.isub(this.m):E.cmpn(0)<0&&(C=E.iadd(this.m)),C._forceRed(this)},ie.prototype.invm=function(y){var f=this.imod(y._invmp(this.m).mul(this.r2));return f._forceRed(this)}})(t,Vr)})(jn);var Lo=Wv;function Wv(t,e){if(!t)throw new Error(e||"Assertion failed")}Wv.equal=function(e,r,i){if(e!=r)throw new Error(i||"Assertion failed: "+e+" != "+r)};var q0={};(function(t){var e=t;function r(s,a){if(Array.isArray(s))return s.slice();if(!s)return[];var u=[];if(typeof s!="string"){for(var h=0;h<s.length;h++)u[h]=s[h]|0;return u}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)u.push(parseInt(s[h]+s[h+1],16))}else for(var h=0;h<s.length;h++){var l=s.charCodeAt(h),b=l>>8,w=l&255;b?u.push(b,w):u.push(w)}return u}e.toArray=r;function i(s){return s.length===1?"0"+s:s}e.zero2=i;function n(s){for(var a="",u=0;u<s.length;u++)a+=i(s[u].toString(16));return a}e.toHex=n,e.encode=function(a,u){return u==="hex"?n(a):a}})(q0),function(t){var e=t,r=jn.exports,i=Lo,n=q0;e.assert=i,e.toArray=n.toArray,e.zero2=n.zero2,e.toHex=n.toHex,e.encode=n.encode;function s(b,w,I){var S=new Array(Math.max(b.bitLength(),I)+1),D;for(D=0;D<S.length;D+=1)S[D]=0;var T=1<<w+1,q=b.clone();for(D=0;D<S.length;D++){var K,F=q.andln(T-1);q.isOdd()?(F>(T>>1)-1?K=(T>>1)-F:K=F,q.isubn(K)):K=0,S[D]=K,q.iushrn(1)}return S}e.getNAF=s;function a(b,w){var I=[[],[]];b=b.clone(),w=w.clone();for(var S=0,D=0,T;b.cmpn(-S)>0||w.cmpn(-D)>0;){var q=b.andln(3)+S&3,K=w.andln(3)+D&3;q===3&&(q=-1),K===3&&(K=-1);var F;q&1?(T=b.andln(7)+S&7,(T===3||T===5)&&K===2?F=-q:F=q):F=0,I[0].push(F);var W;K&1?(T=w.andln(7)+D&7,(T===3||T===5)&&q===2?W=-K:W=K):W=0,I[1].push(W),2*S===F+1&&(S=1-S),2*D===W+1&&(D=1-D),b.iushrn(1),w.iushrn(1)}return I}e.getJSF=a;function u(b,w,I){var S="_"+w;b.prototype[w]=function(){return this[S]!==void 0?this[S]:this[S]=I.call(this)}}e.cachedProperty=u;function h(b){return typeof b=="string"?e.toArray(b,"hex"):b}e.parseBytes=h;function l(b){return new r(b,"hex","le")}e.intFromLE=l}(Li);var Lf={exports:{}},j0;Lf.exports=function(e){return j0||(j0=new Xs(null)),j0.generate(e)};function Xs(t){this.rand=t}if(Lf.exports.Rand=Xs,Xs.prototype.generate=function(e){return this._rand(e)},Xs.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),i=0;i<r.length;i++)r[i]=this.rand.getByte();return r},typeof self=="object")self.crypto&&self.crypto.getRandomValues?Xs.prototype._rand=function(e){var r=new Uint8Array(e);return self.crypto.getRandomValues(r),r}:self.msCrypto&&self.msCrypto.getRandomValues?Xs.prototype._rand=function(e){var r=new Uint8Array(e);return self.msCrypto.getRandomValues(r),r}:typeof window=="object"&&(Xs.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var Vv=T0;if(typeof Vv.randomBytes!="function")throw new Error("Not supported");Xs.prototype._rand=function(e){return Vv.randomBytes(e)}}catch{}var z0={},Bo=jn.exports,ru=Li,Bf=ru.getNAF,M9=ru.getJSF,Ff=ru.assert;function eo(t,e){this.type=t,this.p=new Bo(e.p,16),this.red=e.prime?Bo.red(e.prime):Bo.mont(this.p),this.zero=new Bo(0).toRed(this.red),this.one=new Bo(1).toRed(this.red),this.two=new Bo(2).toRed(this.red),this.n=e.n&&new Bo(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Uf=eo;eo.prototype.point=function(){throw new Error("Not implemented")},eo.prototype.validate=function(){throw new Error("Not implemented")},eo.prototype._fixedNafMul=function(e,r){Ff(e.precomputed);var i=e._getDoubles(),n=Bf(r,1,this._bitLength),s=(1<<i.step+1)-(i.step%2===0?2:1);s/=3;var a=[],u,h;for(u=0;u<n.length;u+=i.step){h=0;for(var l=u+i.step-1;l>=u;l--)h=(h<<1)+n[l];a.push(h)}for(var b=this.jpoint(null,null,null),w=this.jpoint(null,null,null),I=s;I>0;I--){for(u=0;u<a.length;u++)h=a[u],h===I?w=w.mixedAdd(i.points[u]):h===-I&&(w=w.mixedAdd(i.points[u].neg()));b=b.add(w)}return b.toP()},eo.prototype._wnafMul=function(e,r){var i=4,n=e._getNAFPoints(i);i=n.wnd;for(var s=n.points,a=Bf(r,i,this._bitLength),u=this.jpoint(null,null,null),h=a.length-1;h>=0;h--){for(var l=0;h>=0&&a[h]===0;h--)l++;if(h>=0&&l++,u=u.dblp(l),h<0)break;var b=a[h];Ff(b!==0),e.type==="affine"?b>0?u=u.mixedAdd(s[b-1>>1]):u=u.mixedAdd(s[-b-1>>1].neg()):b>0?u=u.add(s[b-1>>1]):u=u.add(s[-b-1>>1].neg())}return e.type==="affine"?u.toP():u},eo.prototype._wnafMulAdd=function(e,r,i,n,s){var a=this._wnafT1,u=this._wnafT2,h=this._wnafT3,l=0,b,w,I;for(b=0;b<n;b++){I=r[b];var S=I._getNAFPoints(e);a[b]=S.wnd,u[b]=S.points}for(b=n-1;b>=1;b-=2){var D=b-1,T=b;if(a[D]!==1||a[T]!==1){h[D]=Bf(i[D],a[D],this._bitLength),h[T]=Bf(i[T],a[T],this._bitLength),l=Math.max(h[D].length,l),l=Math.max(h[T].length,l);continue}var q=[r[D],null,null,r[T]];r[D].y.cmp(r[T].y)===0?(q[1]=r[D].add(r[T]),q[2]=r[D].toJ().mixedAdd(r[T].neg())):r[D].y.cmp(r[T].y.redNeg())===0?(q[1]=r[D].toJ().mixedAdd(r[T]),q[2]=r[D].add(r[T].neg())):(q[1]=r[D].toJ().mixedAdd(r[T]),q[2]=r[D].toJ().mixedAdd(r[T].neg()));var K=[-3,-1,-5,-7,0,7,5,1,3],F=M9(i[D],i[T]);for(l=Math.max(F[0].length,l),h[D]=new Array(l),h[T]=new Array(l),w=0;w<l;w++){var W=F[0][w]|0,R=F[1][w]|0;h[D][w]=K[(W+1)*3+(R+1)],h[T][w]=0,u[D]=q}}var k=this.jpoint(null,null,null),H=this._wnafT4;for(b=l;b>=0;b--){for(var _=0;b>=0;){var B=!0;for(w=0;w<n;w++)H[w]=h[w][b]|0,H[w]!==0&&(B=!1);if(!B)break;_++,b--}if(b>=0&&_++,k=k.dblp(_),b<0)break;for(w=0;w<n;w++){var ee=H[w];ee!==0&&(ee>0?I=u[w][ee-1>>1]:ee<0&&(I=u[w][-ee-1>>1].neg()),I.type==="affine"?k=k.mixedAdd(I):k=k.add(I))}}for(b=0;b<n;b++)u[b]=null;return s?k:k.toP()};function Ji(t,e){this.curve=t,this.type=e,this.precomputed=null}eo.BasePoint=Ji,Ji.prototype.eq=function(){throw new Error("Not implemented")},Ji.prototype.validate=function(){return this.curve.validate(this)},eo.prototype.decodePoint=function(e,r){e=ru.toArray(e,r);var i=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*i){e[0]===6?Ff(e[e.length-1]%2===0):e[0]===7&&Ff(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 r=this.curve.p.byteLength(),i=this.getX().toArray("be",r);return e?[this.getY().isEven()?2:3].concat(i):[4].concat(i,this.getY().toArray("be",r))},Ji.prototype.encode=function(e,r){return ru.encode(this._encode(r),e)},Ji.prototype.precompute=function(e){if(this.precomputed)return this;var r={doubles:null,naf:null,beta:null};return r.naf=this._getNAFPoints(8),r.doubles=this._getDoubles(4,e),r.beta=this._getBeta(),this.precomputed=r,this},Ji.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var r=this.precomputed.doubles;return r?r.points.length>=Math.ceil((e.bitLength()+1)/r.step):!1},Ji.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],n=this,s=0;s<r;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 r=[this],i=(1<<e)-1,n=i===1?null:this.dbl(),s=1;s<i;s++)r[s]=r[s-1].add(n);return{wnd:e,points:r}},Ji.prototype._getBeta=function(){return null},Ji.prototype.dblp=function(e){for(var r=this,i=0;i<e;i++)r=r.dbl();return r};var Na={exports:{}};typeof Object.create=="function"?Na.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Na.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}};var C9=Li,lr=jn.exports,H0=Na.exports,Ta=Uf,D9=C9.assert;function Yi(t){Ta.call(this,"short",t),this.a=new lr(t.a,16).toRed(this.red),this.b=new lr(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}H0(Yi,Ta);var O9=Yi;Yi.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var r,i;if(e.beta)r=new lr(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);r=n[0].cmp(n[1])<0?n[0]:n[1],r=r.toRed(this.red)}if(e.lambda)i=new lr(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(r))===0?i=s[0]:(i=s[1],D9(this.g.mul(i).x.cmp(this.g.x.redMul(r))===0))}var a;return e.basis?a=e.basis.map(function(u){return{a:new lr(u.a,16),b:new lr(u.b,16)}}):a=this._getEndoBasis(i),{beta:r,lambda:i,basis:a}}},Yi.prototype._getEndoRoots=function(e){var r=e===this.p?this.red:lr.mont(e),i=new lr(2).toRed(r).redInvm(),n=i.redNeg(),s=new lr(3).toRed(r).redNeg().redSqrt().redMul(i),a=n.redAdd(s).fromRed(),u=n.redSub(s).fromRed();return[a,u]},Yi.prototype._getEndoBasis=function(e){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),i=e,n=this.n.clone(),s=new lr(1),a=new lr(0),u=new lr(0),h=new lr(1),l,b,w,I,S,D,T,q=0,K,F;i.cmpn(0)!==0;){var W=n.div(i);K=n.sub(W.mul(i)),F=u.sub(W.mul(s));var R=h.sub(W.mul(a));if(!w&&K.cmp(r)<0)l=T.neg(),b=s,w=K.neg(),I=F;else if(w&&++q===2)break;T=K,n=i,i=K,u=s,s=F,h=a,a=R}S=K.neg(),D=F;var k=w.sqr().add(I.sqr()),H=S.sqr().add(D.sqr());return H.cmp(k)>=0&&(S=l,D=b),w.negative&&(w=w.neg(),I=I.neg()),S.negative&&(S=S.neg(),D=D.neg()),[{a:w,b:I},{a:S,b:D}]},Yi.prototype._endoSplit=function(e){var r=this.endo.basis,i=r[0],n=r[1],s=n.b.mul(e).divRound(this.n),a=i.b.neg().mul(e).divRound(this.n),u=s.mul(i.a),h=a.mul(n.a),l=s.mul(i.b),b=a.mul(n.b),w=e.sub(u).sub(h),I=l.add(b).neg();return{k1:w,k2:I}},Yi.prototype.pointFromX=function(e,r){e=new lr(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(r&&!s||!r&&s)&&(n=n.redNeg()),this.point(e,n)},Yi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,i=e.y,n=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(n).redIAdd(this.b);return i.redSqr().redISub(s).cmpn(0)===0},Yi.prototype._endoWnafMulAdd=function(e,r,i){for(var n=this._endoWnafT1,s=this._endoWnafT2,a=0;a<e.length;a++){var u=this._endoSplit(r[a]),h=e[a],l=h._getBeta();u.k1.negative&&(u.k1.ineg(),h=h.neg(!0)),u.k2.negative&&(u.k2.ineg(),l=l.neg(!0)),n[a*2]=h,n[a*2+1]=l,s[a*2]=u.k1,s[a*2+1]=u.k2}for(var b=this._wnafMulAdd(1,n,s,a*2,i),w=0;w<a*2;w++)n[w]=null,s[w]=null;return b};function Pr(t,e,r,i){Ta.BasePoint.call(this,t,"affine"),e===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new lr(e,16),this.y=new lr(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}H0(Pr,Ta.BasePoint),Yi.prototype.point=function(e,r,i){return new Pr(this,e,r,i)},Yi.prototype.pointFromJSON=function(e,r){return Pr.fromJSON(this,e,r)},Pr.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var r=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=r,r.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 r}},Pr.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]},Pr.fromJSON=function(e,r,i){typeof r=="string"&&(r=JSON.parse(r));var n=e.point(r[0],r[1],i);if(!r[2])return n;function s(u){return e.point(u[0],u[1],i)}var a=r[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},Pr.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)+">"},Pr.prototype.isInfinity=function(){return this.inf},Pr.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 r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var i=r.redSqr().redISub(this.x).redISub(e.x),n=r.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)},Pr.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 r=this.curve.a,i=this.x.redSqr(),n=e.redInvm(),s=i.redAdd(i).redIAdd(i).redIAdd(r).redMul(n),a=s.redSqr().redISub(this.x.redAdd(this.x)),u=s.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,u)},Pr.prototype.getX=function(){return this.x.fromRed()},Pr.prototype.getY=function(){return this.y.fromRed()},Pr.prototype.mul=function(e){return e=new lr(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)},Pr.prototype.mulAdd=function(e,r,i){var n=[this,r],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s):this.curve._wnafMulAdd(1,n,s,2)},Pr.prototype.jmulAdd=function(e,r,i){var n=[this,r],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s,!0):this.curve._wnafMulAdd(1,n,s,2,!0)},Pr.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)},Pr.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,n=function(s){return s.neg()};r.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 r},Pr.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 jr(t,e,r,i){Ta.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new lr(0)):(this.x=new lr(e,16),this.y=new lr(r,16),this.z=new lr(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}H0(jr,Ta.BasePoint),Yi.prototype.jpoint=function(e,r,i){return new jr(this,e,r,i)},jr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),i=this.x.redMul(r),n=this.y.redMul(r).redMul(e);return this.curve.point(i,n)},jr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},jr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),i=this.z.redSqr(),n=this.x.redMul(r),s=e.x.redMul(i),a=this.y.redMul(r.redMul(e.z)),u=e.y.redMul(i.redMul(this.z)),h=n.redSub(s),l=a.redSub(u);if(h.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var b=h.redSqr(),w=b.redMul(h),I=n.redMul(b),S=l.redSqr().redIAdd(w).redISub(I).redISub(I),D=l.redMul(I.redISub(S)).redISub(a.redMul(w)),T=this.z.redMul(e.z).redMul(h);return this.curve.jpoint(S,D,T)},jr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),i=this.x,n=e.x.redMul(r),s=this.y,a=e.y.redMul(r).redMul(this.z),u=i.redSub(n),h=s.redSub(a);if(u.cmpn(0)===0)return h.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=u.redSqr(),b=l.redMul(u),w=i.redMul(l),I=h.redSqr().redIAdd(b).redISub(w).redISub(w),S=h.redMul(w.redISub(I)).redISub(s.redMul(b)),D=this.z.redMul(u);return this.curve.jpoint(I,S,D)},jr.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var i=this;for(r=0;r<e;r++)i=i.dbl();return i}var n=this.curve.a,s=this.curve.tinv,a=this.x,u=this.y,h=this.z,l=h.redSqr().redSqr(),b=u.redAdd(u);for(r=0;r<e;r++){var w=a.redSqr(),I=b.redSqr(),S=I.redSqr(),D=w.redAdd(w).redIAdd(w).redIAdd(n.redMul(l)),T=a.redMul(I),q=D.redSqr().redISub(T.redAdd(T)),K=T.redISub(q),F=D.redMul(K);F=F.redIAdd(F).redISub(S);var W=b.redMul(h);r+1<e&&(l=l.redMul(S)),a=q,h=W,b=F}return this.curve.jpoint(a,b.redMul(s),h)},jr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},jr.prototype._zeroDbl=function(){var e,r,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),u=this.x.redAdd(s).redSqr().redISub(n).redISub(a);u=u.redIAdd(u);var h=n.redAdd(n).redIAdd(n),l=h.redSqr().redISub(u).redISub(u),b=a.redIAdd(a);b=b.redIAdd(b),b=b.redIAdd(b),e=l,r=h.redMul(u.redISub(l)).redISub(b),i=this.y.redAdd(this.y)}else{var w=this.x.redSqr(),I=this.y.redSqr(),S=I.redSqr(),D=this.x.redAdd(I).redSqr().redISub(w).redISub(S);D=D.redIAdd(D);var T=w.redAdd(w).redIAdd(w),q=T.redSqr(),K=S.redIAdd(S);K=K.redIAdd(K),K=K.redIAdd(K),e=q.redISub(D).redISub(D),r=T.redMul(D.redISub(e)).redISub(K),i=this.y.redMul(this.z),i=i.redIAdd(i)}return this.curve.jpoint(e,r,i)},jr.prototype._threeDbl=function(){var e,r,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),u=this.x.redAdd(s).redSqr().redISub(n).redISub(a);u=u.redIAdd(u);var h=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),l=h.redSqr().redISub(u).redISub(u);e=l;var b=a.redIAdd(a);b=b.redIAdd(b),b=b.redIAdd(b),r=h.redMul(u.redISub(l)).redISub(b),i=this.y.redAdd(this.y)}else{var w=this.z.redSqr(),I=this.y.redSqr(),S=this.x.redMul(I),D=this.x.redSub(w).redMul(this.x.redAdd(w));D=D.redAdd(D).redIAdd(D);var T=S.redIAdd(S);T=T.redIAdd(T);var q=T.redAdd(T);e=D.redSqr().redISub(q),i=this.y.redAdd(this.z).redSqr().redISub(I).redISub(w);var K=I.redSqr();K=K.redIAdd(K),K=K.redIAdd(K),K=K.redIAdd(K),r=D.redMul(T.redISub(e)).redISub(K)}return this.curve.jpoint(e,r,i)},jr.prototype._dbl=function(){var e=this.curve.a,r=this.x,i=this.y,n=this.z,s=n.redSqr().redSqr(),a=r.redSqr(),u=i.redSqr(),h=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(s)),l=r.redAdd(r);l=l.redIAdd(l);var b=l.redMul(u),w=h.redSqr().redISub(b.redAdd(b)),I=b.redISub(w),S=u.redSqr();S=S.redIAdd(S),S=S.redIAdd(S),S=S.redIAdd(S);var D=h.redMul(I).redISub(S),T=i.redAdd(i).redMul(n);return this.curve.jpoint(w,D,T)},jr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),r=this.y.redSqr(),i=this.z.redSqr(),n=r.redSqr(),s=e.redAdd(e).redIAdd(e),a=s.redSqr(),u=this.x.redAdd(r).redSqr().redISub(e).redISub(n);u=u.redIAdd(u),u=u.redAdd(u).redIAdd(u),u=u.redISub(a);var h=u.redSqr(),l=n.redIAdd(n);l=l.redIAdd(l),l=l.redIAdd(l),l=l.redIAdd(l);var b=s.redIAdd(u).redSqr().redISub(a).redISub(h).redISub(l),w=r.redMul(b);w=w.redIAdd(w),w=w.redIAdd(w);var I=this.x.redMul(h).redISub(w);I=I.redIAdd(I),I=I.redIAdd(I);var S=this.y.redMul(b.redMul(l.redISub(b)).redISub(u.redMul(h)));S=S.redIAdd(S),S=S.redIAdd(S),S=S.redIAdd(S);var D=this.z.redAdd(u).redSqr().redISub(i).redISub(h);return this.curve.jpoint(I,S,D)},jr.prototype.mul=function(e,r){return e=new lr(e,r),this.curve._wnafMul(this,e)},jr.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var r=this.z.redSqr(),i=e.z.redSqr();if(this.x.redMul(i).redISub(e.x.redMul(r)).cmpn(0)!==0)return!1;var n=r.redMul(this.z),s=i.redMul(e.z);return this.y.redMul(s).redISub(e.y.redMul(n)).cmpn(0)===0},jr.prototype.eqXToP=function(e){var r=this.z.redSqr(),i=e.toRed(this.curve.red).redMul(r);if(this.x.cmp(i)===0)return!0;for(var n=e.clone(),s=this.curve.redN.redMul(r);;){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}},jr.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)+">"},jr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var La=jn.exports,Gv=Na.exports,kf=Uf,P9=Li;function Ba(t){kf.call(this,"mont",t),this.a=new La(t.a,16).toRed(this.red),this.b=new La(t.b,16).toRed(this.red),this.i4=new La(4).toRed(this.red).redInvm(),this.two=new La(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}Gv(Ba,kf);var $9=Ba;Ba.prototype.validate=function(e){var r=e.normalize().x,i=r.redSqr(),n=i.redMul(r).redAdd(i.redMul(this.a)).redAdd(r),s=n.redSqrt();return s.redSqr().cmp(n)===0};function $r(t,e,r){kf.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new La(e,16),this.z=new La(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}Gv($r,kf.BasePoint),Ba.prototype.decodePoint=function(e,r){return this.point(P9.toArray(e,r),1)},Ba.prototype.point=function(e,r){return new $r(this,e,r)},Ba.prototype.pointFromJSON=function(e){return $r.fromJSON(this,e)},$r.prototype.precompute=function(){},$r.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},$r.fromJSON=function(e,r){return new $r(e,r[0],r[1]||e.one)},$r.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)+">"},$r.prototype.isInfinity=function(){return this.z.cmpn(0)===0},$r.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),i=this.x.redSub(this.z),n=i.redSqr(),s=r.redSub(n),a=r.redMul(n),u=s.redMul(n.redAdd(this.curve.a24.redMul(s)));return this.curve.point(a,u)},$r.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},$r.prototype.diffAdd=function(e,r){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),u=a.redMul(i),h=s.redMul(n),l=r.z.redMul(u.redAdd(h).redSqr()),b=r.x.redMul(u.redISub(h).redSqr());return this.curve.point(l,b)},$r.prototype.mul=function(e){for(var r=e.clone(),i=this,n=this.curve.point(null,null),s=this,a=[];r.cmpn(0)!==0;r.iushrn(1))a.push(r.andln(1));for(var u=a.length-1;u>=0;u--)a[u]===0?(i=i.diffAdd(n,s),n=n.dbl()):(n=i.diffAdd(n,s),i=i.dbl());return n},$r.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},$r.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},$r.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},$r.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},$r.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var R9=Li,Ss=jn.exports,Jv=Na.exports,qf=Uf,N9=R9.assert;function zn(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,qf.call(this,"edwards",t),this.a=new Ss(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new Ss(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new Ss(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),N9(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}Jv(zn,qf);var T9=zn;zn.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},zn.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},zn.prototype.jpoint=function(e,r,i,n){return this.point(e,r,i,n)},zn.prototype.pointFromX=function(e,r){e=new Ss(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()),u=a.redSqrt();if(u.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");var h=u.fromRed().isOdd();return(r&&!h||!r&&h)&&(u=u.redNeg()),this.point(e,u)},zn.prototype.pointFromY=function(e,r){e=new Ss(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(r)throw new Error("invalid point");return this.point(this.zero,e)}var u=a.redSqrt();if(u.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");return u.fromRed().isOdd()!==r&&(u=u.redNeg()),this.point(u,e)},zn.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),i=e.y.redSqr(),n=r.redMul(this.a).redAdd(i),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(i)));return n.cmp(s)===0};function nr(t,e,r,i,n){qf.BasePoint.call(this,t,"projective"),e===null&&r===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 Ss(e,16),this.y=new Ss(r,16),this.z=i?new Ss(i,16):this.curve.one,this.t=n&&new Ss(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()))))}Jv(nr,qf.BasePoint),zn.prototype.pointFromJSON=function(e){return nr.fromJSON(this,e)},zn.prototype.point=function(e,r,i,n){return new nr(this,e,r,i,n)},nr.fromJSON=function(e,r){return new nr(e,r[0],r[1],r[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(),r=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(r),a=n.redAdd(r),u=a.redSub(i),h=n.redSub(r),l=s.redMul(u),b=a.redMul(h),w=s.redMul(h),I=u.redMul(a);return this.curve.point(l,b,I,w)},nr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),i=this.y.redSqr(),n,s,a,u,h,l;if(this.curve.twisted){u=this.curve._mulA(r);var b=u.redAdd(i);this.zOne?(n=e.redSub(r).redSub(i).redMul(b.redSub(this.curve.two)),s=b.redMul(u.redSub(i)),a=b.redSqr().redSub(b).redSub(b)):(h=this.z.redSqr(),l=b.redSub(h).redISub(h),n=e.redSub(r).redISub(i).redMul(l),s=b.redMul(u.redSub(i)),a=b.redMul(l))}else u=r.redAdd(i),h=this.curve._mulC(this.z).redSqr(),l=u.redSub(h).redSub(h),n=this.curve._mulC(e.redISub(u)).redMul(l),s=this.curve._mulC(u).redMul(r.redISub(i)),a=u.redMul(l);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 r=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(r),u=s.redSub(n),h=s.redAdd(n),l=i.redAdd(r),b=a.redMul(u),w=h.redMul(l),I=a.redMul(l),S=u.redMul(h);return this.curve.point(b,w,S,I)},nr.prototype._projAdd=function(e){var r=this.z.redMul(e.z),i=r.redSqr(),n=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(n).redMul(s),u=i.redSub(a),h=i.redAdd(a),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(n).redISub(s),b=r.redMul(u).redMul(l),w,I;return this.curve.twisted?(w=r.redMul(h).redMul(s.redSub(this.curve._mulA(n))),I=u.redMul(h)):(w=r.redMul(h).redMul(s.redSub(n)),I=this.curve._mulC(u).redMul(h)),this.curve.point(b,w,I)},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,r,i){return this.curve._wnafMulAdd(1,[this,r],[e,i],2,!1)},nr.prototype.jmulAdd=function(e,r,i){return this.curve._wnafMulAdd(1,[this,r],[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 r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===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(r.redIAdd(n),this.x.cmp(r)===0)return!0}},nr.prototype.toP=nr.prototype.normalize,nr.prototype.mixedAdd=nr.prototype.add,function(t){var e=t;e.base=Uf,e.short=O9,e.mont=$9,e.edwards=T9}(z0);var jf={},zf={},$t={},L9=Lo,B9=Na.exports;$t.inherits=B9;function F9(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function U9(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(var i=0,n=0;n<t.length;n++){var s=t.charCodeAt(n);s<128?r[i++]=s:s<2048?(r[i++]=s>>6|192,r[i++]=s&63|128):F9(t,n)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++n)&1023),r[i++]=s>>18|240,r[i++]=s>>12&63|128,r[i++]=s>>6&63|128,r[i++]=s&63|128):(r[i++]=s>>12|224,r[i++]=s>>6&63|128,r[i++]=s&63|128)}else for(n=0;n<t.length;n++)r[n]=t[n]|0;return r}$t.toArray=U9;function k9(t){for(var e="",r=0;r<t.length;r++)e+=Qv(t[r].toString(16));return e}$t.toHex=k9;function Yv(t){var e=t>>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}$t.htonl=Yv;function q9(t,e){for(var r="",i=0;i<t.length;i++){var n=t[i];e==="little"&&(n=Yv(n)),r+=Zv(n.toString(16))}return r}$t.toHex32=q9;function Qv(t){return t.length===1?"0"+t:t}$t.zero2=Qv;function Zv(t){return t.length===7?"0"+t:t.length===6?"00"+t:t.length===5?"000"+t:t.length===4?"0000"+t:t.length===3?"00000"+t:t.length===2?"000000"+t:t.length===1?"0000000"+t:t}$t.zero8=Zv;function j9(t,e,r,i){var n=r-e;L9(n%4===0);for(var s=new Array(n/4),a=0,u=e;a<s.length;a++,u+=4){var h;i==="big"?h=t[u]<<24|t[u+1]<<16|t[u+2]<<8|t[u+3]:h=t[u+3]<<24|t[u+2]<<16|t[u+1]<<8|t[u],s[a]=h>>>0}return s}$t.join32=j9;function z9(t,e){for(var r=new Array(t.length*4),i=0,n=0;i<t.length;i++,n+=4){var s=t[i];e==="big"?(r[n]=s>>>24,r[n+1]=s>>>16&255,r[n+2]=s>>>8&255,r[n+3]=s&255):(r[n+3]=s>>>24,r[n+2]=s>>>16&255,r[n+1]=s>>>8&255,r[n]=s&255)}return r}$t.split32=z9;function H9(t,e){return t>>>e|t<<32-e}$t.rotr32=H9;function K9(t,e){return t<<e|t>>>32-e}$t.rotl32=K9;function W9(t,e){return t+e>>>0}$t.sum32=W9;function V9(t,e,r){return t+e+r>>>0}$t.sum32_3=V9;function G9(t,e,r,i){return t+e+r+i>>>0}$t.sum32_4=G9;function J9(t,e,r,i,n){return t+e+r+i+n>>>0}$t.sum32_5=J9;function Y9(t,e,r,i){var n=t[e],s=t[e+1],a=i+s>>>0,u=(a<i?1:0)+r+n;t[e]=u>>>0,t[e+1]=a}$t.sum64=Y9;function Q9(t,e,r,i){var n=e+i>>>0,s=(n<e?1:0)+t+r;return s>>>0}$t.sum64_hi=Q9;function Z9(t,e,r,i){var n=e+i;return n>>>0}$t.sum64_lo=Z9;function X9(t,e,r,i,n,s,a,u){var h=0,l=e;l=l+i>>>0,h+=l<e?1:0,l=l+s>>>0,h+=l<s?1:0,l=l+u>>>0,h+=l<u?1:0;var b=t+r+n+a+h;return b>>>0}$t.sum64_4_hi=X9;function e_(t,e,r,i,n,s,a,u){var h=e+i+s+u;return h>>>0}$t.sum64_4_lo=e_;function t_(t,e,r,i,n,s,a,u,h,l){var b=0,w=e;w=w+i>>>0,b+=w<e?1:0,w=w+s>>>0,b+=w<s?1:0,w=w+u>>>0,b+=w<u?1:0,w=w+l>>>0,b+=w<l?1:0;var I=t+r+n+a+h+b;return I>>>0}$t.sum64_5_hi=t_;function r_(t,e,r,i,n,s,a,u,h,l){var b=e+i+s+u+l;return b>>>0}$t.sum64_5_lo=r_;function i_(t,e,r){var i=e<<32-r|t>>>r;return i>>>0}$t.rotr64_hi=i_;function n_(t,e,r){var i=t<<32-r|e>>>r;return i>>>0}$t.rotr64_lo=n_;function s_(t,e,r){return t>>>r}$t.shr64_hi=s_;function o_(t,e,r){var i=t<<32-r|e>>>r;return i>>>0}$t.shr64_lo=o_;var Fa={},Xv=$t,a_=Lo;function Hf(){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}Fa.BlockHash=Hf,Hf.prototype.update=function(e,r){if(e=Xv.toArray(e,r),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=Xv.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},Hf.prototype.digest=function(e){return this.update(this._pad()),a_(this.pending===null),this._digest(e)},Hf.prototype._pad=function(){var e=this.pendingTotal,r=this._delta8,i=r-(e+this.padLength)%r,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 Ua={},Hn={},c_=$t,Kn=c_.rotr32;function u_(t,e,r,i){if(t===0)return e2(e,r,i);if(t===1||t===3)return r2(e,r,i);if(t===2)return t2(e,r,i)}Hn.ft_1=u_;function e2(t,e,r){return t&e^~t&r}Hn.ch32=e2;function t2(t,e,r){return t&e^t&r^e&r}Hn.maj32=t2;function r2(t,e,r){return t^e^r}Hn.p32=r2;function f_(t){return Kn(t,2)^Kn(t,13)^Kn(t,22)}Hn.s0_256=f_;function h_(t){return Kn(t,6)^Kn(t,11)^Kn(t,25)}Hn.s1_256=h_;function l_(t){return Kn(t,7)^Kn(t,18)^t>>>3}Hn.g0_256=l_;function d_(t){return Kn(t,17)^Kn(t,19)^t>>>10}Hn.g1_256=d_;var ka=$t,p_=Fa,g_=Hn,K0=ka.rotl32,iu=ka.sum32,v_=ka.sum32_5,m_=g_.ft_1,i2=p_.BlockHash,b_=[1518500249,1859775393,2400959708,3395469782];function Wn(){if(!(this instanceof Wn))return new Wn;i2.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}ka.inherits(Wn,i2);var y_=Wn;Wn.blockSize=512,Wn.outSize=160,Wn.hmacStrength=80,Wn.padLength=64,Wn.prototype._update=function(e,r){for(var i=this.W,n=0;n<16;n++)i[n]=e[r+n];for(;n<i.length;n++)i[n]=K0(i[n-3]^i[n-8]^i[n-14]^i[n-16],1);var s=this.h[0],a=this.h[1],u=this.h[2],h=this.h[3],l=this.h[4];for(n=0;n<i.length;n++){var b=~~(n/20),w=v_(K0(s,5),m_(b,a,u,h),l,i[n],b_[b]);l=h,h=u,u=K0(a,30),a=s,s=w}this.h[0]=iu(this.h[0],s),this.h[1]=iu(this.h[1],a),this.h[2]=iu(this.h[2],u),this.h[3]=iu(this.h[3],h),this.h[4]=iu(this.h[4],l)},Wn.prototype._digest=function(e){return e==="hex"?ka.toHex32(this.h,"big"):ka.split32(this.h,"big")};var qa=$t,w_=Fa,ja=Hn,__=Lo,bn=qa.sum32,E_=qa.sum32_4,A_=qa.sum32_5,x_=ja.ch32,S_=ja.maj32,I_=ja.s0_256,M_=ja.s1_256,C_=ja.g0_256,D_=ja.g1_256,n2=w_.BlockHash,O_=[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 Vn(){if(!(this instanceof Vn))return new Vn;n2.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=O_,this.W=new Array(64)}qa.inherits(Vn,n2);var s2=Vn;Vn.blockSize=512,Vn.outSize=256,Vn.hmacStrength=192,Vn.padLength=64,Vn.prototype._update=function(e,r){for(var i=this.W,n=0;n<16;n++)i[n]=e[r+n];for(;n<i.length;n++)i[n]=E_(D_(i[n-2]),i[n-7],C_(i[n-15]),i[n-16]);var s=this.h[0],a=this.h[1],u=this.h[2],h=this.h[3],l=this.h[4],b=this.h[5],w=this.h[6],I=this.h[7];for(__(this.k.length===i.length),n=0;n<i.length;n++){var S=A_(I,M_(l),x_(l,b,w),this.k[n],i[n]),D=bn(I_(s),S_(s,a,u));I=w,w=b,b=l,l=bn(h,S),h=u,u=a,a=s,s=bn(S,D)}this.h[0]=bn(this.h[0],s),this.h[1]=bn(this.h[1],a),this.h[2]=bn(this.h[2],u),this.h[3]=bn(this.h[3],h),this.h[4]=bn(this.h[4],l),this.h[5]=bn(this.h[5],b),this.h[6]=bn(this.h[6],w),this.h[7]=bn(this.h[7],I)},Vn.prototype._digest=function(e){return e==="hex"?qa.toHex32(this.h,"big"):qa.split32(this.h,"big")};var W0=$t,o2=s2;function Is(){if(!(this instanceof Is))return new Is;o2.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}W0.inherits(Is,o2);var P_=Is;Is.blockSize=512,Is.outSize=224,Is.hmacStrength=192,Is.padLength=64,Is.prototype._digest=function(e){return e==="hex"?W0.toHex32(this.h.slice(0,7),"big"):W0.split32(this.h.slice(0,7),"big")};var mi=$t,$_=Fa,R_=Lo,Gn=mi.rotr64_hi,Jn=mi.rotr64_lo,a2=mi.shr64_hi,c2=mi.shr64_lo,to=mi.sum64,V0=mi.sum64_hi,G0=mi.sum64_lo,N_=mi.sum64_4_hi,T_=mi.sum64_4_lo,L_=mi.sum64_5_hi,B_=mi.sum64_5_lo,u2=$_.BlockHash,F_=[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 yn(){if(!(this instanceof yn))return new yn;u2.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=F_,this.W=new Array(160)}mi.inherits(yn,u2);var f2=yn;yn.blockSize=1024,yn.outSize=512,yn.hmacStrength=192,yn.padLength=128,yn.prototype._prepareBlock=function(e,r){for(var i=this.W,n=0;n<32;n++)i[n]=e[r+n];for(;n<i.length;n+=2){var s=J_(i[n-4],i[n-3]),a=Y_(i[n-4],i[n-3]),u=i[n-14],h=i[n-13],l=V_(i[n-30],i[n-29]),b=G_(i[n-30],i[n-29]),w=i[n-32],I=i[n-31];i[n]=N_(s,a,u,h,l,b,w,I),i[n+1]=T_(s,a,u,h,l,b,w,I)}},yn.prototype._update=function(e,r){this._prepareBlock(e,r);var i=this.W,n=this.h[0],s=this.h[1],a=this.h[2],u=this.h[3],h=this.h[4],l=this.h[5],b=this.h[6],w=this.h[7],I=this.h[8],S=this.h[9],D=this.h[10],T=this.h[11],q=this.h[12],K=this.h[13],F=this.h[14],W=this.h[15];R_(this.k.length===i.length);for(var R=0;R<i.length;R+=2){var k=F,H=W,_=K_(I,S),B=W_(I,S),ee=U_(I,S,D,T,q),ie=k_(I,S,D,T,q,K),L=this.k[R],y=this.k[R+1],f=i[R],d=i[R+1],v=L_(k,H,_,B,ee,ie,L,y,f,d),E=B_(k,H,_,B,ee,ie,L,y,f,d);k=z_(n,s),H=H_(n,s),_=q_(n,s,a,u,h),B=j_(n,s,a,u,h,l);var C=V0(k,H,_,B),O=G0(k,H,_,B);F=q,W=K,q=D,K=T,D=I,T=S,I=V0(b,w,v,E),S=G0(w,w,v,E),b=h,w=l,h=a,l=u,a=n,u=s,n=V0(v,E,C,O),s=G0(v,E,C,O)}to(this.h,0,n,s),to(this.h,2,a,u),to(this.h,4,h,l),to(this.h,6,b,w),to(this.h,8,I,S),to(this.h,10,D,T),to(this.h,12,q,K),to(this.h,14,F,W)},yn.prototype._digest=function(e){return e==="hex"?mi.toHex32(this.h,"big"):mi.split32(this.h,"big")};function U_(t,e,r,i,n){var s=t&r^~t&n;return s<0&&(s+=4294967296),s}function k_(t,e,r,i,n,s){var a=e&i^~e&s;return a<0&&(a+=4294967296),a}function q_(t,e,r,i,n){var s=t&r^t&n^r&n;return s<0&&(s+=4294967296),s}function j_(t,e,r,i,n,s){var a=e&i^e&s^i&s;return a<0&&(a+=4294967296),a}function z_(t,e){var r=Gn(t,e,28),i=Gn(e,t,2),n=Gn(e,t,7),s=r^i^n;return s<0&&(s+=4294967296),s}function H_(t,e){var r=Jn(t,e,28),i=Jn(e,t,2),n=Jn(e,t,7),s=r^i^n;return s<0&&(s+=4294967296),s}function K_(t,e){var r=Gn(t,e,14),i=Gn(t,e,18),n=Gn(e,t,9),s=r^i^n;return s<0&&(s+=4294967296),s}function W_(t,e){var r=Jn(t,e,14),i=Jn(t,e,18),n=Jn(e,t,9),s=r^i^n;return s<0&&(s+=4294967296),s}function V_(t,e){var r=Gn(t,e,1),i=Gn(t,e,8),n=a2(t,e,7),s=r^i^n;return s<0&&(s+=4294967296),s}function G_(t,e){var r=Jn(t,e,1),i=Jn(t,e,8),n=c2(t,e,7),s=r^i^n;return s<0&&(s+=4294967296),s}function J_(t,e){var r=Gn(t,e,19),i=Gn(e,t,29),n=a2(t,e,6),s=r^i^n;return s<0&&(s+=4294967296),s}function Y_(t,e){var r=Jn(t,e,19),i=Jn(e,t,29),n=c2(t,e,6),s=r^i^n;return s<0&&(s+=4294967296),s}var J0=$t,h2=f2;function Ms(){if(!(this instanceof Ms))return new Ms;h2.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}J0.inherits(Ms,h2);var Q_=Ms;Ms.blockSize=1024,Ms.outSize=384,Ms.hmacStrength=192,Ms.padLength=128,Ms.prototype._digest=function(e){return e==="hex"?J0.toHex32(this.h.slice(0,12),"big"):J0.split32(this.h.slice(0,12),"big")},Ua.sha1=y_,Ua.sha224=P_,Ua.sha256=s2,Ua.sha384=Q_,Ua.sha512=f2;var l2={},Fo=$t,Z_=Fa,Kf=Fo.rotl32,d2=Fo.sum32,nu=Fo.sum32_3,p2=Fo.sum32_4,g2=Z_.BlockHash;function Yn(){if(!(this instanceof Yn))return new Yn;g2.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Fo.inherits(Yn,g2),l2.ripemd160=Yn,Yn.blockSize=512,Yn.outSize=160,Yn.hmacStrength=192,Yn.padLength=64,Yn.prototype._update=function(e,r){for(var i=this.h[0],n=this.h[1],s=this.h[2],a=this.h[3],u=this.h[4],h=i,l=n,b=s,w=a,I=u,S=0;S<80;S++){var D=d2(Kf(p2(i,v2(S,n,s,a),e[tE[S]+r],X_(S)),iE[S]),u);i=u,u=a,a=Kf(s,10),s=n,n=D,D=d2(Kf(p2(h,v2(79-S,l,b,w),e[rE[S]+r],eE(S)),nE[S]),I),h=I,I=w,w=Kf(b,10),b=l,l=D}D=nu(this.h[1],s,w),this.h[1]=nu(this.h[2],a,I),this.h[2]=nu(this.h[3],u,h),this.h[3]=nu(this.h[4],i,l),this.h[4]=nu(this.h[0],n,b),this.h[0]=D},Yn.prototype._digest=function(e){return e==="hex"?Fo.toHex32(this.h,"little"):Fo.split32(this.h,"little")};function v2(t,e,r,i){return t<=15?e^r^i:t<=31?e&r|~e&i:t<=47?(e|~r)^i:t<=63?e&i|r&~i:e^(r|~i)}function X_(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function eE(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}var tE=[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],rE=[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],iE=[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],nE=[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],sE=$t,oE=Lo;function za(t,e,r){if(!(this instanceof za))return new za(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(sE.toArray(e,r))}var aE=za;za.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),oE(e.length<=this.blockSize);for(var r=e.length;r<this.blockSize;r++)e.push(0);for(r=0;r<e.length;r++)e[r]^=54;for(this.inner=new this.Hash().update(e),r=0;r<e.length;r++)e[r]^=106;this.outer=new this.Hash().update(e)},za.prototype.update=function(e,r){return this.inner.update(e,r),this},za.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},function(t){var e=t;e.utils=$t,e.common=Fa,e.sha=Ua,e.ripemd=l2,e.hmac=aE,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}(zf);var Y0,m2;function cE(){return m2||(m2=1,Y0={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"]]}}),Y0}(function(t){var e=t,r=zf,i=z0,n=Li,s=n.assert;function a(l){l.type==="short"?this.curve=new i.short(l):l.type==="edwards"?this.curve=new i.edwards(l):this.curve=new i.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=a;function u(l,b){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var w=new a(b);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:w}),w}})}u("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:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("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:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("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:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("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:r.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"]}),u("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:r.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"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),u("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:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var h;try{h=cE()}catch{h=void 0}u("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:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",h]})})(jf);var uE=zf,Uo=q0,b2=Lo;function ro(t){if(!(this instanceof ro))return new ro(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Uo.toArray(t.entropy,t.entropyEnc||"hex"),r=Uo.toArray(t.nonce,t.nonceEnc||"hex"),i=Uo.toArray(t.pers,t.persEnc||"hex");b2(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}var fE=ro;ro.prototype._init=function(e,r,i){var n=e.concat(r).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},ro.prototype._hmac=function(){return new uE.hmac(this.hash,this.K)},ro.prototype._update=function(e){var r=this._hmac().update(this.V).update([0]);e&&(r=r.update(e)),this.K=r.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())},ro.prototype.reseed=function(e,r,i,n){typeof r!="string"&&(n=i,i=r,r=null),e=Uo.toArray(e,r),i=Uo.toArray(i,n),b2(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this._reseed=1},ro.prototype.generate=function(e,r,i,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(n=i,i=r,r=null),i&&(i=Uo.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++,Uo.encode(a,r)};var hE=jn.exports,lE=Li,Q0=lE.assert;function Jr(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var dE=Jr;Jr.fromPublic=function(e,r,i){return r instanceof Jr?r:new Jr(e,{pub:r,pubEnc:i})},Jr.fromPrivate=function(e,r,i){return r instanceof Jr?r:new Jr(e,{priv:r,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,r){return typeof e=="string"&&(r=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),r?this.pub.encode(r,e):this.pub},Jr.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv},Jr.prototype._importPrivate=function(e,r){this.priv=new hE(e,r||16),this.priv=this.priv.umod(this.ec.curve.n)},Jr.prototype._importPublic=function(e,r){if(e.x||e.y){this.ec.curve.type==="mont"?Q0(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Q0(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,r)},Jr.prototype.derive=function(e){return e.validate()||Q0(e.validate(),"public point not validated"),e.mul(this.priv).getX()},Jr.prototype.sign=function(e,r,i){return this.ec.sign(e,this,r,i)},Jr.prototype.verify=function(e,r){return this.ec.verify(e,r,this)},Jr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var Wf=jn.exports,Z0=Li,pE=Z0.assert;function Vf(t,e){if(t instanceof Vf)return t;this._importDER(t,e)||(pE(t.r&&t.s,"Signature without r or s"),this.r=new Wf(t.r,16),this.s=new Wf(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var gE=Vf;function vE(){this.place=0}function X0(t,e){var r=t[e.place++];if(!(r&128))return r;var i=r&15;if(i===0||i>4||t[e.place]===0)return!1;for(var n=0,s=0,a=e.place;s<i;s++,a++)n<<=8,n|=t[a],n>>>=0;return n<=127?!1:(e.place=a,n)}function y2(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e<r;)e++;return e===0?t:t.slice(e)}Vf.prototype._importDER=function(e,r){e=Z0.toArray(e,r);var i=new vE;if(e[i.place++]!==48)return!1;var n=X0(e,i);if(n===!1||n+i.place!==e.length||e[i.place++]!==2)return!1;var s=X0(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 u=X0(e,i);if(u===!1||e.length!==u+i.place||e[i.place]&128)return!1;var h=e.slice(i.place,u+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 Wf(a),this.s=new Wf(h),this.recoveryParam=null,!0};function ed(t,e){if(e<128){t.push(e);return}var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Vf.prototype.toDER=function(e){var r=this.r.toArray(),i=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),i[0]&128&&(i=[0].concat(i)),r=y2(r),i=y2(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var n=[2];ed(n,r.length),n=n.concat(r),n.push(2),ed(n,i.length);var s=n.concat(i),a=[48];return ed(a,s.length),a=a.concat(s),Z0.encode(a,e)};var ko=jn.exports,w2=fE,mE=Li,td=jf,bE=Lf.exports,_2=mE.assert,rd=dE,Gf=gE;function Qi(t){if(!(this instanceof Qi))return new Qi(t);typeof t=="string"&&(_2(Object.prototype.hasOwnProperty.call(td,t),"Unknown curve "+t),t=td[t]),t instanceof td.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var yE=Qi;Qi.prototype.keyPair=function(e){return new rd(this,e)},Qi.prototype.keyFromPrivate=function(e,r){return rd.fromPrivate(this,e,r)},Qi.prototype.keyFromPublic=function(e,r){return rd.fromPublic(this,e,r)},Qi.prototype.genKeyPair=function(e){e||(e={});for(var r=new w2({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||bE(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),n=this.n.sub(new ko(2));;){var s=new ko(r.generate(i));if(!(s.cmp(n)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Qi.prototype._truncateToN=function(e,r){var i=e.byteLength()*8-this.n.bitLength();return i>0&&(e=e.ushrn(i)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},Qi.prototype.sign=function(e,r,i,n){typeof i=="object"&&(n=i,i=null),n||(n={}),r=this.keyFromPrivate(r,i),e=this._truncateToN(new ko(e,16));for(var s=this.n.byteLength(),a=r.getPrivate().toArray("be",s),u=e.toArray("be",s),h=new w2({hash:this.hash,entropy:a,nonce:u,pers:n.pers,persEnc:n.persEnc||"utf8"}),l=this.n.sub(new ko(1)),b=0;;b++){var w=n.k?n.k(b):new ko(h.generate(this.n.byteLength()));if(w=this._truncateToN(w,!0),!(w.cmpn(1)<=0||w.cmp(l)>=0)){var I=this.g.mul(w);if(!I.isInfinity()){var S=I.getX(),D=S.umod(this.n);if(D.cmpn(0)!==0){var T=w.invm(this.n).mul(D.mul(r.getPrivate()).iadd(e));if(T=T.umod(this.n),T.cmpn(0)!==0){var q=(I.getY().isOdd()?1:0)|(S.cmp(D)!==0?2:0);return n.canonical&&T.cmp(this.nh)>0&&(T=this.n.sub(T),q^=1),new Gf({r:D,s:T,recoveryParam:q})}}}}}},Qi.prototype.verify=function(e,r,i,n){e=this._truncateToN(new ko(e,16)),i=this.keyFromPublic(i,n),r=new Gf(r,"hex");var s=r.r,a=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u=a.invm(this.n),h=u.mul(e).umod(this.n),l=u.mul(s).umod(this.n),b;return this.curve._maxwellTrick?(b=this.g.jmulAdd(h,i.getPublic(),l),b.isInfinity()?!1:b.eqXToP(s)):(b=this.g.mulAdd(h,i.getPublic(),l),b.isInfinity()?!1:b.getX().umod(this.n).cmp(s)===0)},Qi.prototype.recoverPubKey=function(t,e,r,i){_2((3&r)===r,"The recovery param is more than two bits"),e=new Gf(e,i);var n=this.n,s=new ko(t),a=e.r,u=e.s,h=r&1,l=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?a=this.curve.pointFromX(a.add(this.curve.n),h):a=this.curve.pointFromX(a,h);var b=e.r.invm(n),w=n.sub(s).mul(b).umod(n),I=u.mul(b).umod(n);return this.g.mulAdd(w,a,I)},Qi.prototype.getKeyRecoveryParam=function(t,e,r,i){if(e=new Gf(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(t,e,n)}catch{continue}if(s.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var su=Li,E2=su.assert,A2=su.parseBytes,Ha=su.cachedProperty;function Rr(t,e){this.eddsa=t,this._secret=A2(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=A2(e.pub)}Rr.fromPublic=function(e,r){return r instanceof Rr?r:new Rr(e,{pub:r})},Rr.fromSecret=function(e,r){return r instanceof Rr?r:new Rr(e,{secret:r})},Rr.prototype.secret=function(){return this._secret},Ha(Rr,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),Ha(Rr,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),Ha(Rr,"privBytes",function(){var e=this.eddsa,r=this.hash(),i=e.encodingLength-1,n=r.slice(0,e.encodingLength);return n[0]&=248,n[i]&=127,n[i]|=64,n}),Ha(Rr,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),Ha(Rr,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),Ha(Rr,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),Rr.prototype.sign=function(e){return E2(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Rr.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)},Rr.prototype.getSecret=function(e){return E2(this._secret,"KeyPair is public only"),su.encode(this.secret(),e)},Rr.prototype.getPublic=function(e){return su.encode(this.pubBytes(),e)};var wE=Rr,_E=jn.exports,Jf=Li,x2=Jf.assert,Yf=Jf.cachedProperty,EE=Jf.parseBytes;function qo(t,e){this.eddsa=t,typeof e!="object"&&(e=EE(e)),Array.isArray(e)&&(x2(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),x2(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof _E&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Yf(qo,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Yf(qo,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Yf(qo,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Yf(qo,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),qo.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},qo.prototype.toHex=function(){return Jf.encode(this.toBytes(),"hex").toUpperCase()};var AE=qo,xE=zf,SE=jf,Ka=Li,IE=Ka.assert,S2=Ka.parseBytes,I2=wE,M2=AE;function bi(t){if(IE(t==="ed25519","only tested with ed25519 so far"),!(this instanceof bi))return new bi(t);t=SE[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=xE.sha512}var ME=bi;bi.prototype.sign=function(e,r){e=S2(e);var i=this.keyFromSecret(r),n=this.hashInt(i.messagePrefix(),e),s=this.g.mul(n),a=this.encodePoint(s),u=this.hashInt(a,i.pubBytes(),e).mul(i.priv()),h=n.add(u).umod(this.curve.n);return this.makeSignature({R:s,S:h,Rencoded:a})},bi.prototype.verify=function(e,r,i){if(e=S2(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var n=this.keyFromPublic(i),s=this.hashInt(r.Rencoded(),n.pubBytes(),e),a=this.g.mul(r.S()),u=r.R().add(n.pub().mul(s));return u.eq(a)},bi.prototype.hashInt=function(){for(var e=this.hash(),r=0;r<arguments.length;r++)e.update(arguments[r]);return Ka.intFromLE(e.digest()).umod(this.curve.n)},bi.prototype.keyFromPublic=function(e){return I2.fromPublic(this,e)},bi.prototype.keyFromSecret=function(e){return I2.fromSecret(this,e)},bi.prototype.makeSignature=function(e){return e instanceof M2?e:new M2(this,e)},bi.prototype.encodePoint=function(e){var r=e.getY().toArray("le",this.encodingLength);return r[this.encodingLength-1]|=e.getX().isOdd()?128:0,r},bi.prototype.decodePoint=function(e){e=Ka.parseBytes(e);var r=e.length-1,i=e.slice(0,r).concat(e[r]&-129),n=(e[r]&128)!==0,s=Ka.intFromLE(i);return this.curve.pointFromY(s,n)},bi.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},bi.prototype.decodeInt=function(e){return Ka.intFromLE(e)},bi.prototype.isPoint=function(e){return e instanceof this.pointClass},function(t){var e=t;e.version=I9.version,e.utils=Li,e.rand=Lf.exports,e.curve=z0,e.curves=jf,e.ec=yE,e.eddsa=ME}(Kv);var id={},C2={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=wt,r=Ni;t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var i=function(){function u(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return u.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},u.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},u.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._tempHi),r.wipe(this._tempLo),this.reset()},u.prototype.update=function(h,l){if(l===void 0&&(l=h.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var b=0;if(this._bytesHashed+=l,this._bufferLength>0){for(;this._bufferLength<t.BLOCK_SIZE&&l>0;)this._buffer[this._bufferLength++]=h[b++],l--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(b=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,h,b,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=h[b++],l--;return this},u.prototype.finish=function(h){if(!this._finished){var l=this._bytesHashed,b=this._bufferLength,w=l/536870912|0,I=l<<3,S=l%128<112?128:256;this._buffer[b]=128;for(var D=b+1;D<S-8;D++)this._buffer[D]=0;e.writeUint32BE(w,this._buffer,S-8),e.writeUint32BE(I,this._buffer,S-4),s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,S),this._finished=!0}for(var D=0;D<this.digestLength/8;D++)e.writeUint32BE(this._stateHi[D],h,D*8),e.writeUint32BE(this._stateLo[D],h,D*8+4);return this},u.prototype.digest=function(){var h=new Uint8Array(this.digestLength);return this.finish(h),h},u.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},u.prototype.restoreState=function(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},u.prototype.cleanSavedState=function(h){r.wipe(h.stateHi),r.wipe(h.stateLo),h.buffer&&r.wipe(h.buffer),h.bufferLength=0,h.bytesHashed=0},u}();t.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(u,h,l,b,w,I,S){for(var D=l[0],T=l[1],q=l[2],K=l[3],F=l[4],W=l[5],R=l[6],k=l[7],H=b[0],_=b[1],B=b[2],ee=b[3],ie=b[4],L=b[5],y=b[6],f=b[7],d,v,E,C,O,M,g,m;S>=128;){for(var N=0;N<16;N++){var X=8*N+I;u[N]=e.readUint32BE(w,X),h[N]=e.readUint32BE(w,X+4)}for(var N=0;N<80;N++){var ae=D,P=T,te=q,z=K,G=F,J=W,A=R,V=k,oe=H,ue=_,he=B,ye=ee,we=ie,Re=L,Xe=y,Oe=f;if(d=k,v=f,O=v&65535,M=v>>>16,g=d&65535,m=d>>>16,d=(F>>>14|ie<<32-14)^(F>>>18|ie<<32-18)^(ie>>>41-32|F<<32-(41-32)),v=(ie>>>14|F<<32-14)^(ie>>>18|F<<32-18)^(F>>>41-32|ie<<32-(41-32)),O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,d=F&W^~F&R,v=ie&L^~ie&y,O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,d=n[N*2],v=n[N*2+1],O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,d=u[N%16],v=h[N%16],O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,M+=O>>>16,g+=M>>>16,m+=g>>>16,E=g&65535|m<<16,C=O&65535|M<<16,d=E,v=C,O=v&65535,M=v>>>16,g=d&65535,m=d>>>16,d=(D>>>28|H<<32-28)^(H>>>34-32|D<<32-(34-32))^(H>>>39-32|D<<32-(39-32)),v=(H>>>28|D<<32-28)^(D>>>34-32|H<<32-(34-32))^(D>>>39-32|H<<32-(39-32)),O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,d=D&T^D&q^T&q,v=H&_^H&B^_&B,O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,M+=O>>>16,g+=M>>>16,m+=g>>>16,V=g&65535|m<<16,Oe=O&65535|M<<16,d=z,v=ye,O=v&65535,M=v>>>16,g=d&65535,m=d>>>16,d=E,v=C,O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,M+=O>>>16,g+=M>>>16,m+=g>>>16,z=g&65535|m<<16,ye=O&65535|M<<16,T=ae,q=P,K=te,F=z,W=G,R=J,k=A,D=V,_=oe,B=ue,ee=he,ie=ye,L=we,y=Re,f=Xe,H=Oe,N%16===15)for(var X=0;X<16;X++)d=u[X],v=h[X],O=v&65535,M=v>>>16,g=d&65535,m=d>>>16,d=u[(X+9)%16],v=h[(X+9)%16],O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,E=u[(X+1)%16],C=h[(X+1)%16],d=(E>>>1|C<<32-1)^(E>>>8|C<<32-8)^E>>>7,v=(C>>>1|E<<32-1)^(C>>>8|E<<32-8)^(C>>>7|E<<32-7),O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,E=u[(X+14)%16],C=h[(X+14)%16],d=(E>>>19|C<<32-19)^(C>>>61-32|E<<32-(61-32))^E>>>6,v=(C>>>19|E<<32-19)^(E>>>61-32|C<<32-(61-32))^(C>>>6|E<<32-6),O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,M+=O>>>16,g+=M>>>16,m+=g>>>16,u[X]=g&65535|m<<16,h[X]=O&65535|M<<16}d=D,v=H,O=v&65535,M=v>>>16,g=d&65535,m=d>>>16,d=l[0],v=b[0],O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,M+=O>>>16,g+=M>>>16,m+=g>>>16,l[0]=D=g&65535|m<<16,b[0]=H=O&65535|M<<16,d=T,v=_,O=v&65535,M=v>>>16,g=d&65535,m=d>>>16,d=l[1],v=b[1],O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,M+=O>>>16,g+=M>>>16,m+=g>>>16,l[1]=T=g&65535|m<<16,b[1]=_=O&65535|M<<16,d=q,v=B,O=v&65535,M=v>>>16,g=d&65535,m=d>>>16,d=l[2],v=b[2],O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,M+=O>>>16,g+=M>>>16,m+=g>>>16,l[2]=q=g&65535|m<<16,b[2]=B=O&65535|M<<16,d=K,v=ee,O=v&65535,M=v>>>16,g=d&65535,m=d>>>16,d=l[3],v=b[3],O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,M+=O>>>16,g+=M>>>16,m+=g>>>16,l[3]=K=g&65535|m<<16,b[3]=ee=O&65535|M<<16,d=F,v=ie,O=v&65535,M=v>>>16,g=d&65535,m=d>>>16,d=l[4],v=b[4],O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,M+=O>>>16,g+=M>>>16,m+=g>>>16,l[4]=F=g&65535|m<<16,b[4]=ie=O&65535|M<<16,d=W,v=L,O=v&65535,M=v>>>16,g=d&65535,m=d>>>16,d=l[5],v=b[5],O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,M+=O>>>16,g+=M>>>16,m+=g>>>16,l[5]=W=g&65535|m<<16,b[5]=L=O&65535|M<<16,d=R,v=y,O=v&65535,M=v>>>16,g=d&65535,m=d>>>16,d=l[6],v=b[6],O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,M+=O>>>16,g+=M>>>16,m+=g>>>16,l[6]=R=g&65535|m<<16,b[6]=y=O&65535|M<<16,d=k,v=f,O=v&65535,M=v>>>16,g=d&65535,m=d>>>16,d=l[7],v=b[7],O+=v&65535,M+=v>>>16,g+=d&65535,m+=d>>>16,M+=O>>>16,g+=M>>>16,m+=g>>>16,l[7]=k=g&65535|m<<16,b[7]=f=O&65535|M<<16,I+=128,S-=128}return I}function a(u){var h=new i;h.update(u);var l=h.digest();return h.clean(),l}t.hash=a})(C2),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=Zs,r=C2,i=Ni;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function n(z){const G=new Float64Array(16);if(z)for(let J=0;J<z.length;J++)G[J]=z[J];return G}const s=new Uint8Array(32);s[0]=9;const a=n(),u=n([1]),h=n([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),l=n([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),b=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]),I=n([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function S(z,G){for(let J=0;J<16;J++)z[J]=G[J]|0}function D(z){let G=1;for(let J=0;J<16;J++){let A=z[J]+G+65535;G=Math.floor(A/65536),z[J]=A-G*65536}z[0]+=G-1+37*(G-1)}function T(z,G,J){const A=~(J-1);for(let V=0;V<16;V++){const oe=A&(z[V]^G[V]);z[V]^=oe,G[V]^=oe}}function q(z,G){const J=n(),A=n();for(let V=0;V<16;V++)A[V]=G[V];D(A),D(A),D(A);for(let V=0;V<2;V++){J[0]=A[0]-65517;for(let ue=1;ue<15;ue++)J[ue]=A[ue]-65535-(J[ue-1]>>16&1),J[ue-1]&=65535;J[15]=A[15]-32767-(J[14]>>16&1);const oe=J[15]>>16&1;J[14]&=65535,T(A,J,1-oe)}for(let V=0;V<16;V++)z[2*V]=A[V]&255,z[2*V+1]=A[V]>>8}function K(z,G){let J=0;for(let A=0;A<32;A++)J|=z[A]^G[A];return(1&J-1>>>8)-1}function F(z,G){const J=new Uint8Array(32),A=new Uint8Array(32);return q(J,z),q(A,G),K(J,A)}function W(z){const G=new Uint8Array(32);return q(G,z),G[0]&1}function R(z,G){for(let J=0;J<16;J++)z[J]=G[2*J]+(G[2*J+1]<<8);z[15]&=32767}function k(z,G,J){for(let A=0;A<16;A++)z[A]=G[A]+J[A]}function H(z,G,J){for(let A=0;A<16;A++)z[A]=G[A]-J[A]}function _(z,G,J){let A,V,oe=0,ue=0,he=0,ye=0,we=0,Re=0,Xe=0,Oe=0,Ne=0,Me=0,be=0,Pe=0,Te=0,ve=0,$e=0,Se=0,me=0,Ue=0,Ce=0,_e=0,Ke=0,Ve=0,Ae=0,We=0,pt=0,Ge=0,It=0,gt=0,Ye=0,Ot=0,Tt=0,Le=J[0],et=J[1],it=J[2],Be=J[3],rt=J[4],tt=J[5],qe=J[6],ht=J[7],nt=J[8],je=J[9],st=J[10],at=J[11],Fe=J[12],Ze=J[13],lt=J[14],ze=J[15];A=G[0],oe+=A*Le,ue+=A*et,he+=A*it,ye+=A*Be,we+=A*rt,Re+=A*tt,Xe+=A*qe,Oe+=A*ht,Ne+=A*nt,Me+=A*je,be+=A*st,Pe+=A*at,Te+=A*Fe,ve+=A*Ze,$e+=A*lt,Se+=A*ze,A=G[1],ue+=A*Le,he+=A*et,ye+=A*it,we+=A*Be,Re+=A*rt,Xe+=A*tt,Oe+=A*qe,Ne+=A*ht,Me+=A*nt,be+=A*je,Pe+=A*st,Te+=A*at,ve+=A*Fe,$e+=A*Ze,Se+=A*lt,me+=A*ze,A=G[2],he+=A*Le,ye+=A*et,we+=A*it,Re+=A*Be,Xe+=A*rt,Oe+=A*tt,Ne+=A*qe,Me+=A*ht,be+=A*nt,Pe+=A*je,Te+=A*st,ve+=A*at,$e+=A*Fe,Se+=A*Ze,me+=A*lt,Ue+=A*ze,A=G[3],ye+=A*Le,we+=A*et,Re+=A*it,Xe+=A*Be,Oe+=A*rt,Ne+=A*tt,Me+=A*qe,be+=A*ht,Pe+=A*nt,Te+=A*je,ve+=A*st,$e+=A*at,Se+=A*Fe,me+=A*Ze,Ue+=A*lt,Ce+=A*ze,A=G[4],we+=A*Le,Re+=A*et,Xe+=A*it,Oe+=A*Be,Ne+=A*rt,Me+=A*tt,be+=A*qe,Pe+=A*ht,Te+=A*nt,ve+=A*je,$e+=A*st,Se+=A*at,me+=A*Fe,Ue+=A*Ze,Ce+=A*lt,_e+=A*ze,A=G[5],Re+=A*Le,Xe+=A*et,Oe+=A*it,Ne+=A*Be,Me+=A*rt,be+=A*tt,Pe+=A*qe,Te+=A*ht,ve+=A*nt,$e+=A*je,Se+=A*st,me+=A*at,Ue+=A*Fe,Ce+=A*Ze,_e+=A*lt,Ke+=A*ze,A=G[6],Xe+=A*Le,Oe+=A*et,Ne+=A*it,Me+=A*Be,be+=A*rt,Pe+=A*tt,Te+=A*qe,ve+=A*ht,$e+=A*nt,Se+=A*je,me+=A*st,Ue+=A*at,Ce+=A*Fe,_e+=A*Ze,Ke+=A*lt,Ve+=A*ze,A=G[7],Oe+=A*Le,Ne+=A*et,Me+=A*it,be+=A*Be,Pe+=A*rt,Te+=A*tt,ve+=A*qe,$e+=A*ht,Se+=A*nt,me+=A*je,Ue+=A*st,Ce+=A*at,_e+=A*Fe,Ke+=A*Ze,Ve+=A*lt,Ae+=A*ze,A=G[8],Ne+=A*Le,Me+=A*et,be+=A*it,Pe+=A*Be,Te+=A*rt,ve+=A*tt,$e+=A*qe,Se+=A*ht,me+=A*nt,Ue+=A*je,Ce+=A*st,_e+=A*at,Ke+=A*Fe,Ve+=A*Ze,Ae+=A*lt,We+=A*ze,A=G[9],Me+=A*Le,be+=A*et,Pe+=A*it,Te+=A*Be,ve+=A*rt,$e+=A*tt,Se+=A*qe,me+=A*ht,Ue+=A*nt,Ce+=A*je,_e+=A*st,Ke+=A*at,Ve+=A*Fe,Ae+=A*Ze,We+=A*lt,pt+=A*ze,A=G[10],be+=A*Le,Pe+=A*et,Te+=A*it,ve+=A*Be,$e+=A*rt,Se+=A*tt,me+=A*qe,Ue+=A*ht,Ce+=A*nt,_e+=A*je,Ke+=A*st,Ve+=A*at,Ae+=A*Fe,We+=A*Ze,pt+=A*lt,Ge+=A*ze,A=G[11],Pe+=A*Le,Te+=A*et,ve+=A*it,$e+=A*Be,Se+=A*rt,me+=A*tt,Ue+=A*qe,Ce+=A*ht,_e+=A*nt,Ke+=A*je,Ve+=A*st,Ae+=A*at,We+=A*Fe,pt+=A*Ze,Ge+=A*lt,It+=A*ze,A=G[12],Te+=A*Le,ve+=A*et,$e+=A*it,Se+=A*Be,me+=A*rt,Ue+=A*tt,Ce+=A*qe,_e+=A*ht,Ke+=A*nt,Ve+=A*je,Ae+=A*st,We+=A*at,pt+=A*Fe,Ge+=A*Ze,It+=A*lt,gt+=A*ze,A=G[13],ve+=A*Le,$e+=A*et,Se+=A*it,me+=A*Be,Ue+=A*rt,Ce+=A*tt,_e+=A*qe,Ke+=A*ht,Ve+=A*nt,Ae+=A*je,We+=A*st,pt+=A*at,Ge+=A*Fe,It+=A*Ze,gt+=A*lt,Ye+=A*ze,A=G[14],$e+=A*Le,Se+=A*et,me+=A*it,Ue+=A*Be,Ce+=A*rt,_e+=A*tt,Ke+=A*qe,Ve+=A*ht,Ae+=A*nt,We+=A*je,pt+=A*st,Ge+=A*at,It+=A*Fe,gt+=A*Ze,Ye+=A*lt,Ot+=A*ze,A=G[15],Se+=A*Le,me+=A*et,Ue+=A*it,Ce+=A*Be,_e+=A*rt,Ke+=A*tt,Ve+=A*qe,Ae+=A*ht,We+=A*nt,pt+=A*je,Ge+=A*st,It+=A*at,gt+=A*Fe,Ye+=A*Ze,Ot+=A*lt,Tt+=A*ze,oe+=38*me,ue+=38*Ue,he+=38*Ce,ye+=38*_e,we+=38*Ke,Re+=38*Ve,Xe+=38*Ae,Oe+=38*We,Ne+=38*pt,Me+=38*Ge,be+=38*It,Pe+=38*gt,Te+=38*Ye,ve+=38*Ot,$e+=38*Tt,V=1,A=oe+V+65535,V=Math.floor(A/65536),oe=A-V*65536,A=ue+V+65535,V=Math.floor(A/65536),ue=A-V*65536,A=he+V+65535,V=Math.floor(A/65536),he=A-V*65536,A=ye+V+65535,V=Math.floor(A/65536),ye=A-V*65536,A=we+V+65535,V=Math.floor(A/65536),we=A-V*65536,A=Re+V+65535,V=Math.floor(A/65536),Re=A-V*65536,A=Xe+V+65535,V=Math.floor(A/65536),Xe=A-V*65536,A=Oe+V+65535,V=Math.floor(A/65536),Oe=A-V*65536,A=Ne+V+65535,V=Math.floor(A/65536),Ne=A-V*65536,A=Me+V+65535,V=Math.floor(A/65536),Me=A-V*65536,A=be+V+65535,V=Math.floor(A/65536),be=A-V*65536,A=Pe+V+65535,V=Math.floor(A/65536),Pe=A-V*65536,A=Te+V+65535,V=Math.floor(A/65536),Te=A-V*65536,A=ve+V+65535,V=Math.floor(A/65536),ve=A-V*65536,A=$e+V+65535,V=Math.floor(A/65536),$e=A-V*65536,A=Se+V+65535,V=Math.floor(A/65536),Se=A-V*65536,oe+=V-1+37*(V-1),V=1,A=oe+V+65535,V=Math.floor(A/65536),oe=A-V*65536,A=ue+V+65535,V=Math.floor(A/65536),ue=A-V*65536,A=he+V+65535,V=Math.floor(A/65536),he=A-V*65536,A=ye+V+65535,V=Math.floor(A/65536),ye=A-V*65536,A=we+V+65535,V=Math.floor(A/65536),we=A-V*65536,A=Re+V+65535,V=Math.floor(A/65536),Re=A-V*65536,A=Xe+V+65535,V=Math.floor(A/65536),Xe=A-V*65536,A=Oe+V+65535,V=Math.floor(A/65536),Oe=A-V*65536,A=Ne+V+65535,V=Math.floor(A/65536),Ne=A-V*65536,A=Me+V+65535,V=Math.floor(A/65536),Me=A-V*65536,A=be+V+65535,V=Math.floor(A/65536),be=A-V*65536,A=Pe+V+65535,V=Math.floor(A/65536),Pe=A-V*65536,A=Te+V+65535,V=Math.floor(A/65536),Te=A-V*65536,A=ve+V+65535,V=Math.floor(A/65536),ve=A-V*65536,A=$e+V+65535,V=Math.floor(A/65536),$e=A-V*65536,A=Se+V+65535,V=Math.floor(A/65536),Se=A-V*65536,oe+=V-1+37*(V-1),z[0]=oe,z[1]=ue,z[2]=he,z[3]=ye,z[4]=we,z[5]=Re,z[6]=Xe,z[7]=Oe,z[8]=Ne,z[9]=Me,z[10]=be,z[11]=Pe,z[12]=Te,z[13]=ve,z[14]=$e,z[15]=Se}function B(z,G){_(z,G,G)}function ee(z,G){const J=n();let A;for(A=0;A<16;A++)J[A]=G[A];for(A=253;A>=0;A--)B(J,J),A!==2&&A!==4&&_(J,J,G);for(A=0;A<16;A++)z[A]=J[A]}function ie(z,G){const J=n();let A;for(A=0;A<16;A++)J[A]=G[A];for(A=250;A>=0;A--)B(J,J),A!==1&&_(J,J,G);for(A=0;A<16;A++)z[A]=J[A]}function L(z,G){const J=n(),A=n(),V=n(),oe=n(),ue=n(),he=n(),ye=n(),we=n(),Re=n();H(J,z[1],z[0]),H(Re,G[1],G[0]),_(J,J,Re),k(A,z[0],z[1]),k(Re,G[0],G[1]),_(A,A,Re),_(V,z[3],G[3]),_(V,V,l),_(oe,z[2],G[2]),k(oe,oe,oe),H(ue,A,J),H(he,oe,V),k(ye,oe,V),k(we,A,J),_(z[0],ue,he),_(z[1],we,ye),_(z[2],ye,he),_(z[3],ue,we)}function y(z,G,J){for(let A=0;A<4;A++)T(z[A],G[A],J)}function f(z,G){const J=n(),A=n(),V=n();ee(V,G[2]),_(J,G[0],V),_(A,G[1],V),q(z,A),z[31]^=W(J)<<7}function d(z,G,J){S(z[0],a),S(z[1],u),S(z[2],u),S(z[3],a);for(let A=255;A>=0;--A){const V=J[A/8|0]>>(A&7)&1;y(z,G,V),L(G,z),L(z,z),y(z,G,V)}}function v(z,G){const J=[n(),n(),n(),n()];S(J[0],b),S(J[1],w),S(J[2],u),_(J[3],b,w),d(z,J,G)}function E(z){if(z.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const G=(0,r.hash)(z);G[0]&=248,G[31]&=127,G[31]|=64;const J=new Uint8Array(32),A=[n(),n(),n(),n()];v(A,G),f(J,A);const V=new Uint8Array(64);return V.set(z),V.set(J,32),{publicKey:J,secretKey:V}}t.generateKeyPairFromSeed=E;function C(z){const G=(0,e.randomBytes)(32,z),J=E(G);return(0,i.wipe)(G),J}t.generateKeyPair=C;function O(z){if(z.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(z.subarray(32))}t.extractPublicKeyFromSecretKey=O;const M=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 g(z,G){let J,A,V,oe;for(A=63;A>=32;--A){for(J=0,V=A-32,oe=A-12;V<oe;++V)G[V]+=J-16*G[A]*M[V-(A-32)],J=Math.floor((G[V]+128)/256),G[V]-=J*256;G[V]+=J,G[A]=0}for(J=0,V=0;V<32;V++)G[V]+=J-(G[31]>>4)*M[V],J=G[V]>>8,G[V]&=255;for(V=0;V<32;V++)G[V]-=J*M[V];for(A=0;A<32;A++)G[A+1]+=G[A]>>8,z[A]=G[A]&255}function m(z){const G=new Float64Array(64);for(let J=0;J<64;J++)G[J]=z[J];for(let J=0;J<64;J++)z[J]=0;g(z,G)}function N(z,G){const J=new Float64Array(64),A=[n(),n(),n(),n()],V=(0,r.hash)(z.subarray(0,32));V[0]&=248,V[31]&=127,V[31]|=64;const oe=new Uint8Array(64);oe.set(V.subarray(32),32);const ue=new r.SHA512;ue.update(oe.subarray(32)),ue.update(G);const he=ue.digest();ue.clean(),m(he),v(A,he),f(oe,A),ue.reset(),ue.update(oe.subarray(0,32)),ue.update(z.subarray(32)),ue.update(G);const ye=ue.digest();m(ye);for(let we=0;we<32;we++)J[we]=he[we];for(let we=0;we<32;we++)for(let Re=0;Re<32;Re++)J[we+Re]+=ye[we]*V[Re];return g(oe.subarray(32),J),oe}t.sign=N;function X(z,G){const J=n(),A=n(),V=n(),oe=n(),ue=n(),he=n(),ye=n();return S(z[2],u),R(z[1],G),B(V,z[1]),_(oe,V,h),H(V,V,z[2]),k(oe,z[2],oe),B(ue,oe),B(he,ue),_(ye,he,ue),_(J,ye,V),_(J,J,oe),ie(J,J),_(J,J,V),_(J,J,oe),_(J,J,oe),_(z[0],J,oe),B(A,z[0]),_(A,A,oe),F(A,V)&&_(z[0],z[0],I),B(A,z[0]),_(A,A,oe),F(A,V)?-1:(W(z[0])===G[31]>>7&&H(z[0],a,z[0]),_(z[3],z[0],z[1]),0)}function ae(z,G,J){const A=new Uint8Array(32),V=[n(),n(),n(),n()],oe=[n(),n(),n(),n()];if(J.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(X(oe,z))return!1;const ue=new r.SHA512;ue.update(J.subarray(0,32)),ue.update(z),ue.update(G);const he=ue.digest();return m(he),d(V,oe,he),v(oe,J.subarray(32)),L(V,oe),f(A,V),!K(J,A)}t.verify=ae;function P(z){let G=[n(),n(),n(),n()];if(X(G,z))throw new Error("Ed25519: invalid public key");let J=n(),A=n(),V=G[1];k(J,u,V),H(A,u,V),ee(A,A),_(J,J,A);let oe=new Uint8Array(32);return q(oe,J),oe}t.convertPublicKeyToX25519=P;function te(z){const G=(0,r.hash)(z.subarray(0,32));G[0]&=248,G[31]&=127,G[31]|=64;const J=new Uint8Array(G.subarray(0,32));return(0,i.wipe)(G),J}t.convertSecretKeyToX25519=te}(id);const CE="EdDSA",DE="JWT",Qf=".",Zf="base64url",D2="utf8",O2="utf8",OE=":",PE="did",$E="key",P2="base58btc",RE="z",NE="K36",TE=32;function nd(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function $2(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?nd(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function LE(t,e){e||(e=t.reduce((n,s)=>n+s.length,0));const r=$2(e);let i=0;for(const n of t)r.set(n,i),i+=n.length;return nd(r)}function R2(t,e,r,i){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:i}}}const N2=R2("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),sd=R2("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=$2(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),T2={utf8:N2,"utf-8":N2,hex:Ra.base16,latin1:sd,ascii:sd,binary:sd,...Ra};function Xf(t,e="utf8"){const r=T2[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}function Wa(t,e="utf8"){const r=T2[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?nd(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}const BE=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),FE=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(i,n)=>typeof n=="string"&&n.match(/^\d+n$/)?BigInt(n.substring(0,n.length-1)):n)};function jo(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return FE(t)}catch{return t}}function Cs(t){return typeof t=="string"?t:BE(t)||""}function L2(t){return jo(Xf(Wa(t,Zf),D2))}function eh(t){return Xf(Wa(Cs(t),D2),Zf)}function B2(t){const e=Wa(NE,P2),r=RE+Xf(LE([e,t]),P2);return[PE,$E,r].join(OE)}function UE(t){return Xf(t,Zf)}function kE(t){return Wa(t,Zf)}function qE(t){return Wa([eh(t.header),eh(t.payload)].join(Qf),O2)}function jE(t){return[eh(t.header),eh(t.payload),UE(t.signature)].join(Qf)}function od(t){const e=t.split(Qf),r=L2(e[0]),i=L2(e[1]),n=kE(e[2]),s=Wa(e.slice(0,2).join(Qf),O2);return{header:r,payload:i,signature:n,data:s}}function F2(t=Zs.randomBytes(TE)){return id.generateKeyPairFromSeed(t)}async function zE(t,e,r,i,n=xe.fromMiliseconds(Date.now())){const s={alg:CE,typ:DE},a=B2(i.publicKey),u=n+r,h={iss:a,sub:t,aud:e,iat:n,exp:u},l=qE({header:s,payload:h}),b=id.sign(i.secretKey,l);return jE({header:s,payload:h,signature:b})}const HE={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"}},KE=":";function ou(t){const[e,r]=t.split(KE);return{namespace:e,reference:r}}function U2(t,e=[]){const r=[];return Object.keys(t).forEach(i=>{if(e.length&&!e.includes(i))return;const n=t[i];r.push(...n.accounts)}),r}function k2(t,e){return t.includes(":")?[t]:e.chains||[]}var WE=Object.defineProperty,q2=Object.getOwnPropertySymbols,VE=Object.prototype.hasOwnProperty,GE=Object.prototype.propertyIsEnumerable,j2=(t,e,r)=>e in t?WE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,z2=(t,e)=>{for(var r in e||(e={}))VE.call(e,r)&&j2(t,r,e[r]);if(q2)for(var r of q2(e))GE.call(e,r)&&j2(t,r,e[r]);return t};const JE="ReactNative",Bi={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},YE="js";function th(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Va(){return!Cf()&&!!S0()&&navigator.product===JE}function au(){return!th()&&!!S0()&&!!Cf()}function cu(){return Va()?Bi.reactNative:th()?Bi.node:au()?Bi.browser:Bi.unknown}function QE(){var t;try{return Va()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function ZE(t,e){let r=Zc.parse(t);return r=z2(z2({},r),e),t=Zc.stringify(r),t}function H2(){return uv()||{name:"",description:"",url:"",icons:[""]}}function XE(){if(cu()===Bi.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:i}=global.Platform;return[r,i].join("-")}const t=c4();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function eA(){var t;const e=cu();return e===Bi.browser?[e,((t=cv())==null?void 0:t.host)||"unknown"].join(":"):e}function K2(t,e,r){const i=XE(),n=eA();return[[t,e].join("-"),[YE,r].join("-"),i,n].join("/")}function tA({protocol:t,version:e,relayUrl:r,sdkVersion:i,auth:n,projectId:s,useOnCloseEvent:a,bundleId:u}){const h=r.split("?"),l=K2(t,e,i),b={auth:n,ua:l,projectId:s,useOnCloseEvent:a||void 0,origin:u||void 0},w=ZE(h[1]||"",b);return h[0]+"?"+w}function zo(t,e){return t.filter(r=>e.includes(r)).length===t.length}function W2(t){return Object.fromEntries(t.entries())}function V2(t){return new Map(Object.entries(t))}function Ho(t=xe.FIVE_MINUTES,e){const r=xe.toMiliseconds(t||xe.FIVE_MINUTES);let i,n,s;return{resolve:a=>{s&&i&&(clearTimeout(s),i(a))},reject:a=>{s&&n&&(clearTimeout(s),n(a))},done:()=>new Promise((a,u)=>{s=setTimeout(()=>{u(new Error(e))},r),i=a,n=u})}}function Ga(t,e,r){return new Promise(async(i,n)=>{const s=setTimeout(()=>n(new Error(r)),e);try{const a=await t;i(a)}catch(a){n(a)}clearTimeout(s)})}function G2(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function rA(t){return G2("topic",t)}function iA(t){return G2("id",t)}function J2(t){const[e,r]=t.split(":"),i={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")i.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))i.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return i}function Ir(t,e){return xe.fromMiliseconds((e||Date.now())+xe.toMiliseconds(t))}function io(t){return Date.now()>=xe.toMiliseconds(t)}function Dt(t,e){return`${t}${e?`:${e}`:""}`}function rh(t=[],e=[]){return[...new Set([...t,...e])]}async function nA({id:t,topic:e,wcDeepLink:r}){var i;try{if(!r)return;const n=typeof r=="string"?JSON.parse(r):r;let s=n?.href;if(typeof s!="string")return;s.endsWith("/")&&(s=s.slice(0,-1));const a=`${s}/wc?requestId=${t}&sessionTopic=${e}`,u=cu();if(u===Bi.browser){if(!((i=Cf())!=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,"_self","noreferrer noopener")}else u===Bi.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(a)}catch(n){console.error(n)}}async function sA(t,e){try{return await t.getItem(e)||(au()?localStorage.getItem(e):void 0)}catch(r){console.error(r)}}function Y2(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),i=r.indexOf(e);return r[i+2]}function Q2(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function ad(){return typeof process<"u"&&process.env.IS_VITEST==="true"}var Z2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function oA(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(r,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}),r}var X2={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(t){(function(){var e="input is invalid type",r="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=Q2:s&&(n=self);var u=!n.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,h=!n.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",l="0123456789abcdef".split(""),b=[31,7936,2031616,520093696],w=[4,1024,262144,67108864],I=[1,256,65536,16777216],S=[6,1536,393216,100663296],D=[0,8,16,24],T=[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],K=[128,256],F=["hex","buffer","arrayBuffer","array","digest"],W={128:168,256:136};(n.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(P){return Object.prototype.toString.call(P)==="[object Array]"}),h&&(n.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(P){return typeof P=="object"&&P.buffer&&P.buffer.constructor===ArrayBuffer});for(var R=function(P,te,z){return function(G){return new N(P,te,P).update(G)[z]()}},k=function(P,te,z){return function(G,J){return new N(P,te,J).update(G)[z]()}},H=function(P,te,z){return function(G,J,A,V){return d["cshake"+P].update(G,J,A,V)[z]()}},_=function(P,te,z){return function(G,J,A,V){return d["kmac"+P].update(G,J,A,V)[z]()}},B=function(P,te,z,G){for(var J=0;J<F.length;++J){var A=F[J];P[A]=te(z,G,A)}return P},ee=function(P,te){var z=R(P,te,"hex");return z.create=function(){return new N(P,te,P)},z.update=function(G){return z.create().update(G)},B(z,R,P,te)},ie=function(P,te){var z=k(P,te,"hex");return z.create=function(G){return new N(P,te,G)},z.update=function(G,J){return z.create(J).update(G)},B(z,k,P,te)},L=function(P,te){var z=W[P],G=H(P,te,"hex");return G.create=function(J,A,V){return!A&&!V?d["shake"+P].create(J):new N(P,te,J).bytepad([A,V],z)},G.update=function(J,A,V,oe){return G.create(A,V,oe).update(J)},B(G,H,P,te)},y=function(P,te){var z=W[P],G=_(P,te,"hex");return G.create=function(J,A,V){return new X(P,te,A).bytepad(["KMAC",V],z).bytepad([J],z)},G.update=function(J,A,V,oe){return G.create(J,V,oe).update(A)},B(G,_,P,te)},f=[{name:"keccak",padding:I,bits:q,createMethod:ee},{name:"sha3",padding:S,bits:q,createMethod:ee},{name:"shake",padding:b,bits:K,createMethod:ie},{name:"cshake",padding:w,bits:K,createMethod:L},{name:"kmac",padding:w,bits:K,createMethod:y}],d={},v=[],E=0;E<f.length;++E)for(var C=f[E],O=C.bits,M=0;M<O.length;++M){var g=C.name+"_"+O[M];if(v.push(g),d[g]=C.createMethod(O[M],C.padding),C.name!=="sha3"){var m=C.name+O[M];v.push(m),d[m]=d[g]}}function N(P,te,z){this.blocks=[],this.s=[],this.padding=te,this.outputBits=z,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(P<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=z>>5,this.extraBytes=(z&31)>>3;for(var G=0;G<50;++G)this.s[G]=0}N.prototype.update=function(P){if(this.finalized)throw new Error(r);var te,z=typeof P;if(z!=="string"){if(z==="object"){if(P===null)throw new Error(e);if(h&&P.constructor===ArrayBuffer)P=new Uint8Array(P);else if(!Array.isArray(P)&&(!h||!ArrayBuffer.isView(P)))throw new Error(e)}else throw new Error(e);te=!0}for(var G=this.blocks,J=this.byteCount,A=P.length,V=this.blockCount,oe=0,ue=this.s,he,ye;oe<A;){if(this.reset)for(this.reset=!1,G[0]=this.block,he=1;he<V+1;++he)G[he]=0;if(te)for(he=this.start;oe<A&&he<J;++oe)G[he>>2]|=P[oe]<<D[he++&3];else for(he=this.start;oe<A&&he<J;++oe)ye=P.charCodeAt(oe),ye<128?G[he>>2]|=ye<<D[he++&3]:ye<2048?(G[he>>2]|=(192|ye>>6)<<D[he++&3],G[he>>2]|=(128|ye&63)<<D[he++&3]):ye<55296||ye>=57344?(G[he>>2]|=(224|ye>>12)<<D[he++&3],G[he>>2]|=(128|ye>>6&63)<<D[he++&3],G[he>>2]|=(128|ye&63)<<D[he++&3]):(ye=65536+((ye&1023)<<10|P.charCodeAt(++oe)&1023),G[he>>2]|=(240|ye>>18)<<D[he++&3],G[he>>2]|=(128|ye>>12&63)<<D[he++&3],G[he>>2]|=(128|ye>>6&63)<<D[he++&3],G[he>>2]|=(128|ye&63)<<D[he++&3]);if(this.lastByteIndex=he,he>=J){for(this.start=he-J,this.block=G[V],he=0;he<V;++he)ue[he]^=G[he];ae(ue),this.reset=!0}else this.start=he}return this},N.prototype.encode=function(P,te){var z=P&255,G=1,J=[z];for(P=P>>8,z=P&255;z>0;)J.unshift(z),P=P>>8,z=P&255,++G;return te?J.push(G):J.unshift(G),this.update(J),J.length},N.prototype.encodeString=function(P){var te,z=typeof P;if(z!=="string"){if(z==="object"){if(P===null)throw new Error(e);if(h&&P.constructor===ArrayBuffer)P=new Uint8Array(P);else if(!Array.isArray(P)&&(!h||!ArrayBuffer.isView(P)))throw new Error(e)}else throw new Error(e);te=!0}var G=0,J=P.length;if(te)G=J;else for(var A=0;A<P.length;++A){var V=P.charCodeAt(A);V<128?G+=1:V<2048?G+=2:V<55296||V>=57344?G+=3:(V=65536+((V&1023)<<10|P.charCodeAt(++A)&1023),G+=4)}return G+=this.encode(G*8),this.update(P),G},N.prototype.bytepad=function(P,te){for(var z=this.encode(te),G=0;G<P.length;++G)z+=this.encodeString(P[G]);var J=te-z%te,A=[];return A.length=J,this.update(A),this},N.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var P=this.blocks,te=this.lastByteIndex,z=this.blockCount,G=this.s;if(P[te>>2]|=this.padding[te&3],this.lastByteIndex===this.byteCount)for(P[0]=P[z],te=1;te<z+1;++te)P[te]=0;for(P[z-1]|=2147483648,te=0;te<z;++te)G[te]^=P[te];ae(G)}},N.prototype.toString=N.prototype.hex=function(){this.finalize();for(var P=this.blockCount,te=this.s,z=this.outputBlocks,G=this.extraBytes,J=0,A=0,V="",oe;A<z;){for(J=0;J<P&&A<z;++J,++A)oe=te[J],V+=l[oe>>4&15]+l[oe&15]+l[oe>>12&15]+l[oe>>8&15]+l[oe>>20&15]+l[oe>>16&15]+l[oe>>28&15]+l[oe>>24&15];A%P===0&&(ae(te),J=0)}return G&&(oe=te[J],V+=l[oe>>4&15]+l[oe&15],G>1&&(V+=l[oe>>12&15]+l[oe>>8&15]),G>2&&(V+=l[oe>>20&15]+l[oe>>16&15])),V},N.prototype.arrayBuffer=function(){this.finalize();var P=this.blockCount,te=this.s,z=this.outputBlocks,G=this.extraBytes,J=0,A=0,V=this.outputBits>>3,oe;G?oe=new ArrayBuffer(z+1<<2):oe=new ArrayBuffer(V);for(var ue=new Uint32Array(oe);A<z;){for(J=0;J<P&&A<z;++J,++A)ue[A]=te[J];A%P===0&&ae(te)}return G&&(ue[J]=te[J],oe=oe.slice(0,V)),oe},N.prototype.buffer=N.prototype.arrayBuffer,N.prototype.digest=N.prototype.array=function(){this.finalize();for(var P=this.blockCount,te=this.s,z=this.outputBlocks,G=this.extraBytes,J=0,A=0,V=[],oe,ue;A<z;){for(J=0;J<P&&A<z;++J,++A)oe=A<<2,ue=te[J],V[oe]=ue&255,V[oe+1]=ue>>8&255,V[oe+2]=ue>>16&255,V[oe+3]=ue>>24&255;A%P===0&&ae(te)}return G&&(oe=A<<2,ue=te[J],V[oe]=ue&255,G>1&&(V[oe+1]=ue>>8&255),G>2&&(V[oe+2]=ue>>16&255)),V};function X(P,te,z){N.call(this,P,te,z)}X.prototype=new N,X.prototype.finalize=function(){return this.encode(this.outputBits,!0),N.prototype.finalize.call(this)};var ae=function(P){var te,z,G,J,A,V,oe,ue,he,ye,we,Re,Xe,Oe,Ne,Me,be,Pe,Te,ve,$e,Se,me,Ue,Ce,_e,Ke,Ve,Ae,We,pt,Ge,It,gt,Ye,Ot,Tt,Le,et,it,Be,rt,tt,qe,ht,nt,je,st,at,Fe,Ze,lt,ze,qt,jt,ct,_t,Zr,Xr,ei,ti,ri,vr;for(G=0;G<48;G+=2)J=P[0]^P[10]^P[20]^P[30]^P[40],A=P[1]^P[11]^P[21]^P[31]^P[41],V=P[2]^P[12]^P[22]^P[32]^P[42],oe=P[3]^P[13]^P[23]^P[33]^P[43],ue=P[4]^P[14]^P[24]^P[34]^P[44],he=P[5]^P[15]^P[25]^P[35]^P[45],ye=P[6]^P[16]^P[26]^P[36]^P[46],we=P[7]^P[17]^P[27]^P[37]^P[47],Re=P[8]^P[18]^P[28]^P[38]^P[48],Xe=P[9]^P[19]^P[29]^P[39]^P[49],te=Re^(V<<1|oe>>>31),z=Xe^(oe<<1|V>>>31),P[0]^=te,P[1]^=z,P[10]^=te,P[11]^=z,P[20]^=te,P[21]^=z,P[30]^=te,P[31]^=z,P[40]^=te,P[41]^=z,te=J^(ue<<1|he>>>31),z=A^(he<<1|ue>>>31),P[2]^=te,P[3]^=z,P[12]^=te,P[13]^=z,P[22]^=te,P[23]^=z,P[32]^=te,P[33]^=z,P[42]^=te,P[43]^=z,te=V^(ye<<1|we>>>31),z=oe^(we<<1|ye>>>31),P[4]^=te,P[5]^=z,P[14]^=te,P[15]^=z,P[24]^=te,P[25]^=z,P[34]^=te,P[35]^=z,P[44]^=te,P[45]^=z,te=ue^(Re<<1|Xe>>>31),z=he^(Xe<<1|Re>>>31),P[6]^=te,P[7]^=z,P[16]^=te,P[17]^=z,P[26]^=te,P[27]^=z,P[36]^=te,P[37]^=z,P[46]^=te,P[47]^=z,te=ye^(J<<1|A>>>31),z=we^(A<<1|J>>>31),P[8]^=te,P[9]^=z,P[18]^=te,P[19]^=z,P[28]^=te,P[29]^=z,P[38]^=te,P[39]^=z,P[48]^=te,P[49]^=z,Oe=P[0],Ne=P[1],nt=P[11]<<4|P[10]>>>28,je=P[10]<<4|P[11]>>>28,Ve=P[20]<<3|P[21]>>>29,Ae=P[21]<<3|P[20]>>>29,ei=P[31]<<9|P[30]>>>23,ti=P[30]<<9|P[31]>>>23,rt=P[40]<<18|P[41]>>>14,tt=P[41]<<18|P[40]>>>14,gt=P[2]<<1|P[3]>>>31,Ye=P[3]<<1|P[2]>>>31,Me=P[13]<<12|P[12]>>>20,be=P[12]<<12|P[13]>>>20,st=P[22]<<10|P[23]>>>22,at=P[23]<<10|P[22]>>>22,We=P[33]<<13|P[32]>>>19,pt=P[32]<<13|P[33]>>>19,ri=P[42]<<2|P[43]>>>30,vr=P[43]<<2|P[42]>>>30,qt=P[5]<<30|P[4]>>>2,jt=P[4]<<30|P[5]>>>2,Ot=P[14]<<6|P[15]>>>26,Tt=P[15]<<6|P[14]>>>26,Pe=P[25]<<11|P[24]>>>21,Te=P[24]<<11|P[25]>>>21,Fe=P[34]<<15|P[35]>>>17,Ze=P[35]<<15|P[34]>>>17,Ge=P[45]<<29|P[44]>>>3,It=P[44]<<29|P[45]>>>3,Ue=P[6]<<28|P[7]>>>4,Ce=P[7]<<28|P[6]>>>4,ct=P[17]<<23|P[16]>>>9,_t=P[16]<<23|P[17]>>>9,Le=P[26]<<25|P[27]>>>7,et=P[27]<<25|P[26]>>>7,ve=P[36]<<21|P[37]>>>11,$e=P[37]<<21|P[36]>>>11,lt=P[47]<<24|P[46]>>>8,ze=P[46]<<24|P[47]>>>8,qe=P[8]<<27|P[9]>>>5,ht=P[9]<<27|P[8]>>>5,_e=P[18]<<20|P[19]>>>12,Ke=P[19]<<20|P[18]>>>12,Zr=P[29]<<7|P[28]>>>25,Xr=P[28]<<7|P[29]>>>25,it=P[38]<<8|P[39]>>>24,Be=P[39]<<8|P[38]>>>24,Se=P[48]<<14|P[49]>>>18,me=P[49]<<14|P[48]>>>18,P[0]=Oe^~Me&Pe,P[1]=Ne^~be&Te,P[10]=Ue^~_e&Ve,P[11]=Ce^~Ke&Ae,P[20]=gt^~Ot&Le,P[21]=Ye^~Tt&et,P[30]=qe^~nt&st,P[31]=ht^~je&at,P[40]=qt^~ct&Zr,P[41]=jt^~_t&Xr,P[2]=Me^~Pe&ve,P[3]=be^~Te&$e,P[12]=_e^~Ve&We,P[13]=Ke^~Ae&pt,P[22]=Ot^~Le&it,P[23]=Tt^~et&Be,P[32]=nt^~st&Fe,P[33]=je^~at&Ze,P[42]=ct^~Zr&ei,P[43]=_t^~Xr&ti,P[4]=Pe^~ve&Se,P[5]=Te^~$e&me,P[14]=Ve^~We&Ge,P[15]=Ae^~pt&It,P[24]=Le^~it&rt,P[25]=et^~Be&tt,P[34]=st^~Fe&lt,P[35]=at^~Ze&ze,P[44]=Zr^~ei&ri,P[45]=Xr^~ti&vr,P[6]=ve^~Se&Oe,P[7]=$e^~me&Ne,P[16]=We^~Ge&Ue,P[17]=pt^~It&Ce,P[26]=it^~rt&gt,P[27]=Be^~tt&Ye,P[36]=Fe^~lt&qe,P[37]=Ze^~ze&ht,P[46]=ei^~ri&qt,P[47]=ti^~vr&jt,P[8]=Se^~Oe&Me,P[9]=me^~Ne&be,P[18]=Ge^~Ue&_e,P[19]=It^~Ce&Ke,P[28]=rt^~gt&Ot,P[29]=tt^~Ye&Tt,P[38]=lt^~qe&nt,P[39]=ze^~ht&je,P[48]=ri^~qt&ct,P[49]=vr^~jt&_t,P[0]^=T[G],P[1]^=T[G+1]};if(u)t.exports=d;else for(E=0;E<v.length;++E)n[v[E]]=d[v[E]]})()})(Z2);var aA=Z2.exports;const cA="logger/5.7.0";let X2=!1,em=!1;const ih={debug:1,default:2,info:2,warning:3,error:4,off:5};let tm=ih.default,cd=null;function uA(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}const rm=uA();var ud;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(ud||(ud={}));var wn;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(wn||(wn={}));const im="0123456789abcdef";class Et{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const i=e.toLowerCase();ih[i]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(tm>ih[i])&&console.log.apply(console,r)}debug(...e){this._log(Et.levels.DEBUG,e)}info(...e){this._log(Et.levels.INFO,e)}warn(...e){this._log(Et.levels.WARNING,e)}makeError(e,r,i){if(em)return this.makeError("censored error",r,{});r||(r=Et.errors.UNKNOWN_ERROR),i||(i={});const n=[];Object.keys(i).forEach(h=>{const l=i[h];try{if(l instanceof Uint8Array){let b="";for(let w=0;w<l.length;w++)b+=im[l[w]>>4],b+=im[l[w]&15];n.push(h+"=Uint8Array(0x"+b+")")}else n.push(h+"="+JSON.stringify(l))}catch{n.push(h+"="+JSON.stringify(i[h].toString()))}}),n.push(`code=${r}`),n.push(`version=${this.version}`);const s=e;let a="";switch(r){case wn.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 wn.CALL_EXCEPTION:case wn.INSUFFICIENT_FUNDS:case wn.MISSING_NEW:case wn.NONCE_EXPIRED:case wn.REPLACEMENT_UNDERPRICED:case wn.TRANSACTION_REPLACED:case wn.UNPREDICTABLE_GAS_LIMIT:a=r;break}a&&(e+=" [ See: https://links.ethers.org/v5-errors-"+a+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const u=new Error(e);return u.reason=s,u.code=r,Object.keys(i).forEach(function(h){u[h]=i[h]}),u}throwError(e,r,i){throw this.makeError(e,r,i)}throwArgumentError(e,r,i){return this.throwError(e,Et.errors.INVALID_ARGUMENT,{argument:r,value:i})}assert(e,r,i,n){e||this.throwError(r,i,n)}assertArgument(e,r,i,n){e||this.throwArgumentError(r,i,n)}checkNormalize(e){rm&&this.throwError("platform missing String.prototype.normalize",Et.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:rm})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,Et.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,Et.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,i){i?i=": "+i:i="",e<r&&this.throwError("missing argument"+i,Et.errors.MISSING_ARGUMENT,{count:e,expectedCount:r}),e>r&&this.throwError("too many arguments"+i,Et.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",Et.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",Et.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Et.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return cd||(cd=new Et(cA)),cd}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",Et.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),X2){if(!e)return;this.globalLogger().throwError("error censorship permanent",Et.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}em=!!e,X2=!!r}static setLogLevel(e){const r=ih[e.toLowerCase()];if(r==null){Et.globalLogger().warn("invalid log level - "+e);return}tm=r}static from(e){return new Et(e)}}Et.errors=wn,Et.levels=ud;const fA="bytes/5.7.0",br=new Et(fA);function nm(t){return!!t.toHexString}function Ja(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Ja(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function hA(t){return Fi(t)&&!(t.length%2)||Ya(t)}function sm(t){return typeof t=="number"&&t==t&&t%1===0}function Ya(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!sm(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!sm(r)||r<0||r>=256)return!1}return!0}function dr(t,e){if(e||(e={}),typeof t=="number"){br.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),Ja(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),nm(t)&&(t=t.toHexString()),Fi(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":br.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let n=0;n<r.length;n+=2)i.push(parseInt(r.substring(n,n+2),16));return Ja(new Uint8Array(i))}return Ya(t)?Ja(new Uint8Array(t)):br.throwArgumentError("invalid arrayify value","value",t)}function lA(t){const e=t.map(n=>dr(n)),r=e.reduce((n,s)=>n+s.length,0),i=new Uint8Array(r);return e.reduce((n,s)=>(i.set(s,n),n+s.length),0),Ja(i)}function dA(t,e){t=dr(t),t.length>e&&br.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),Ja(r)}function Fi(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const fd="0123456789abcdef";function si(t,e){if(e||(e={}),typeof t=="number"){br.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=fd[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),nm(t))return t.toHexString();if(Fi(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":br.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Ya(t)){let r="0x";for(let i=0;i<t.length;i++){let n=t[i];r+=fd[(n&240)>>4]+fd[n&15]}return r}return br.throwArgumentError("invalid hexlify value","value",t)}function pA(t){if(typeof t!="string")t=si(t);else if(!Fi(t)||t.length%2)return null;return(t.length-2)/2}function om(t,e,r){return typeof t!="string"?t=si(t):(!Fi(t)||t.length%2)&&br.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function Qn(t,e){for(typeof t!="string"?t=si(t):Fi(t)||br.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&br.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function am(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(hA(t)){let r=dr(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=si(r.slice(0,32)),e.s=si(r.slice(32,64))):r.length===65?(e.r=si(r.slice(0,32)),e.s=si(r.slice(32,64)),e.v=r[64]):br.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:br.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=si(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const n=dA(dr(e._vs),32);e._vs=si(n);const s=n[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&br.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),n[0]&=127;const a=si(n);e.s==null?e.s=a:e.s!==a&&br.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?br.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const n=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==n&&br.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Fi(e.r)?br.throwArgumentError("signature missing or invalid r","signature",t):e.r=Qn(e.r,32),e.s==null||!Fi(e.s)?br.throwArgumentError("signature missing or invalid s","signature",t):e.s=Qn(e.s,32);const r=dr(e.s);r[0]>=128&&br.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const i=si(r);e._vs&&(Fi(e._vs)||br.throwArgumentError("signature invalid _vs","signature",t),e._vs=Qn(e._vs,32)),e._vs==null?e._vs=i:e._vs!==i&&br.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function hd(t){return"0x"+aA.keccak_256(dr(t))}var cm={exports:{}},gA={},vA=Object.freeze({__proto__:null,default:gA}),mA=oA(vA);(function(t){(function(e,r){function i(f,d){if(!f)throw new Error(d||"Assertion failed")}function n(f,d){f.super_=d;var v=function(){};v.prototype=d.prototype,f.prototype=new v,f.prototype.constructor=f}function s(f,d,v){if(s.isBN(f))return f;this.negative=0,this.words=null,this.length=0,this.red=null,f!==null&&((d==="le"||d==="be")&&(v=d,d=10),this._init(f||0,d||10,v||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=mA.Buffer}catch{}s.isBN=function(f){return f instanceof s?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===s.wordSize&&Array.isArray(f.words)},s.max=function(f,d){return f.cmp(d)>0?f:d},s.min=function(f,d){return f.cmp(d)<0?f:d},s.prototype._init=function(f,d,v){if(typeof f=="number")return this._initNumber(f,d,v);if(typeof f=="object")return this._initArray(f,d,v);d==="hex"&&(d=16),i(d===(d|0)&&d>=2&&d<=36),f=f.toString().replace(/\s+/g,"");var E=0;f[0]==="-"&&(E++,this.negative=1),E<f.length&&(d===16?this._parseHex(f,E,v):(this._parseBase(f,d,E),v==="le"&&this._initArray(this.toArray(),d,v)))},s.prototype._initNumber=function(f,d,v){f<0&&(this.negative=1,f=-f),f<67108864?(this.words=[f&67108863],this.length=1):f<4503599627370496?(this.words=[f&67108863,f/67108864&67108863],this.length=2):(i(f<9007199254740992),this.words=[f&67108863,f/67108864&67108863,1],this.length=3),v==="le"&&this._initArray(this.toArray(),d,v)},s.prototype._initArray=function(f,d,v){if(i(typeof f.length=="number"),f.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(f.length/3),this.words=new Array(this.length);for(var E=0;E<this.length;E++)this.words[E]=0;var C,O,M=0;if(v==="be")for(E=f.length-1,C=0;E>=0;E-=3)O=f[E]|f[E-1]<<8|f[E-2]<<16,this.words[C]|=O<<M&67108863,this.words[C+1]=O>>>26-M&67108863,M+=24,M>=26&&(M-=26,C++);else if(v==="le")for(E=0,C=0;E<f.length;E+=3)O=f[E]|f[E+1]<<8|f[E+2]<<16,this.words[C]|=O<<M&67108863,this.words[C+1]=O>>>26-M&67108863,M+=24,M>=26&&(M-=26,C++);return this._strip()};function u(f,d){var v=f.charCodeAt(d);if(v>=48&&v<=57)return v-48;if(v>=65&&v<=70)return v-55;if(v>=97&&v<=102)return v-87;i(!1,"Invalid character in "+f)}function h(f,d,v){var E=u(f,v);return v-1>=d&&(E|=u(f,v-1)<<4),E}s.prototype._parseHex=function(f,d,v){this.length=Math.ceil((f.length-d)/6),this.words=new Array(this.length);for(var E=0;E<this.length;E++)this.words[E]=0;var C=0,O=0,M;if(v==="be")for(E=f.length-1;E>=d;E-=2)M=h(f,d,E)<<C,this.words[O]|=M&67108863,C>=18?(C-=18,O+=1,this.words[O]|=M>>>26):C+=8;else{var g=f.length-d;for(E=g%2===0?d+1:d;E<f.length;E+=2)M=h(f,d,E)<<C,this.words[O]|=M&67108863,C>=18?(C-=18,O+=1,this.words[O]|=M>>>26):C+=8}this._strip()};function l(f,d,v,E){for(var C=0,O=0,M=Math.min(f.length,v),g=d;g<M;g++){var m=f.charCodeAt(g)-48;C*=E,m>=49?O=m-49+10:m>=17?O=m-17+10:O=m,i(m>=0&&O<E,"Invalid character"),C+=O}return C}s.prototype._parseBase=function(f,d,v){this.words=[0],this.length=1;for(var E=0,C=1;C<=67108863;C*=d)E++;E--,C=C/d|0;for(var O=f.length-v,M=O%E,g=Math.min(O,O-M)+v,m=0,N=v;N<g;N+=E)m=l(f,N,N+E,d),this.imuln(C),this.words[0]+m<67108864?this.words[0]+=m:this._iaddn(m);if(M!==0){var X=1;for(m=l(f,N,f.length,d),N=0;N<M;N++)X*=d;this.imuln(X),this.words[0]+m<67108864?this.words[0]+=m:this._iaddn(m)}this._strip()},s.prototype.copy=function(f){f.words=new Array(this.length);for(var d=0;d<this.length;d++)f.words[d]=this.words[d];f.length=this.length,f.negative=this.negative,f.red=this.red};function b(f,d){f.words=d.words,f.length=d.length,f.negative=d.negative,f.red=d.red}if(s.prototype._move=function(f){b(f,this)},s.prototype.clone=function(){var f=new s(null);return this.copy(f),f},s.prototype._expand=function(f){for(;this.length<f;)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 I=["","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"],S=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],D=[0,0,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(f,d){f=f||10,d=d|0||1;var v;if(f===16||f==="hex"){v="";for(var E=0,C=0,O=0;O<this.length;O++){var M=this.words[O],g=((M<<E|C)&16777215).toString(16);C=M>>>24-E&16777215,E+=2,E>=26&&(E-=26,O--),C!==0||O!==this.length-1?v=I[6-g.length]+g+v:v=g+v}for(C!==0&&(v=C.toString(16)+v);v.length%d!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(f===(f|0)&&f>=2&&f<=36){var m=S[f],N=D[f];v="";var X=this.clone();for(X.negative=0;!X.isZero();){var ae=X.modrn(N).toString(f);X=X.idivn(N),X.isZero()?v=ae+v:v=I[m-ae.length]+ae+v}for(this.isZero()&&(v="0"+v);v.length%d!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},s.prototype.toJSON=function(){return this.toString(16,2)},a&&(s.prototype.toBuffer=function(f,d){return this.toArrayLike(a,f,d)}),s.prototype.toArray=function(f,d){return this.toArrayLike(Array,f,d)};var T=function(f,d){return f.allocUnsafe?f.allocUnsafe(d):new f(d)};s.prototype.toArrayLike=function(f,d,v){this._strip();var E=this.byteLength(),C=v||Math.max(1,E);i(E<=C,"byte array longer than desired length"),i(C>0,"Requested array length <= 0");var O=T(f,C),M=d==="le"?"LE":"BE";return this["_toArrayLike"+M](O,E),O},s.prototype._toArrayLikeLE=function(f,d){for(var v=0,E=0,C=0,O=0;C<this.length;C++){var M=this.words[C]<<O|E;f[v++]=M&255,v<f.length&&(f[v++]=M>>8&255),v<f.length&&(f[v++]=M>>16&255),O===6?(v<f.length&&(f[v++]=M>>24&255),E=0,O=0):(E=M>>>24,O+=2)}if(v<f.length)for(f[v++]=E;v<f.length;)f[v++]=0},s.prototype._toArrayLikeBE=function(f,d){for(var v=f.length-1,E=0,C=0,O=0;C<this.length;C++){var M=this.words[C]<<O|E;f[v--]=M&255,v>=0&&(f[v--]=M>>8&255),v>=0&&(f[v--]=M>>16&255),O===6?(v>=0&&(f[v--]=M>>24&255),E=0,O=0):(E=M>>>24,O+=2)}if(v>=0)for(f[v--]=E;v>=0;)f[v--]=0},Math.clz32?s.prototype._countBits=function(f){return 32-Math.clz32(f)}:s.prototype._countBits=function(f){var d=f,v=0;return d>=4096&&(v+=13,d>>>=13),d>=64&&(v+=7,d>>>=7),d>=8&&(v+=4,d>>>=4),d>=2&&(v+=2,d>>>=2),v+d},s.prototype._zeroBits=function(f){if(f===0)return 26;var d=f,v=0;return d&8191||(v+=13,d>>>=13),d&127||(v+=7,d>>>=7),d&15||(v+=4,d>>>=4),d&3||(v+=2,d>>>=2),d&1||v++,v},s.prototype.bitLength=function(){var f=this.words[this.length-1],d=this._countBits(f);return(this.length-1)*26+d};function q(f){for(var d=new Array(f.bitLength()),v=0;v<d.length;v++){var E=v/26|0,C=v%26;d[v]=f.words[E]>>>C&1}return d}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,d=0;d<this.length;d++){var v=this._zeroBits(this.words[d]);if(f+=v,v!==26)break}return f},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(f){return this.negative!==0?this.abs().inotn(f).iaddn(1):this.clone()},s.prototype.fromTwos=function(f){return this.testn(f-1)?this.notn(f).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(f){for(;this.length<f.length;)this.words[this.length++]=0;for(var d=0;d<f.length;d++)this.words[d]=this.words[d]|f.words[d];return this._strip()},s.prototype.ior=function(f){return i((this.negative|f.negative)===0),this.iuor(f)},s.prototype.or=function(f){return this.length>f.length?this.clone().ior(f):f.clone().ior(this)},s.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},s.prototype.iuand=function(f){var d;this.length>f.length?d=f:d=this;for(var v=0;v<d.length;v++)this.words[v]=this.words[v]&f.words[v];return this.length=d.length,this._strip()},s.prototype.iand=function(f){return i((this.negative|f.negative)===0),this.iuand(f)},s.prototype.and=function(f){return this.length>f.length?this.clone().iand(f):f.clone().iand(this)},s.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},s.prototype.iuxor=function(f){var d,v;this.length>f.length?(d=this,v=f):(d=f,v=this);for(var E=0;E<v.length;E++)this.words[E]=d.words[E]^v.words[E];if(this!==d)for(;E<d.length;E++)this.words[E]=d.words[E];return this.length=d.length,this._strip()},s.prototype.ixor=function(f){return i((this.negative|f.negative)===0),this.iuxor(f)},s.prototype.xor=function(f){return this.length>f.length?this.clone().ixor(f):f.clone().ixor(this)},s.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},s.prototype.inotn=function(f){i(typeof f=="number"&&f>=0);var d=Math.ceil(f/26)|0,v=f%26;this._expand(d),v>0&&d--;for(var E=0;E<d;E++)this.words[E]=~this.words[E]&67108863;return v>0&&(this.words[E]=~this.words[E]&67108863>>26-v),this._strip()},s.prototype.notn=function(f){return this.clone().inotn(f)},s.prototype.setn=function(f,d){i(typeof f=="number"&&f>=0);var v=f/26|0,E=f%26;return this._expand(v+1),d?this.words[v]=this.words[v]|1<<E:this.words[v]=this.words[v]&~(1<<E),this._strip()},s.prototype.iadd=function(f){var d;if(this.negative!==0&&f.negative===0)return this.negative=0,d=this.isub(f),this.negative^=1,this._normSign();if(this.negative===0&&f.negative!==0)return f.negative=0,d=this.isub(f),f.negative=1,d._normSign();var v,E;this.length>f.length?(v=this,E=f):(v=f,E=this);for(var C=0,O=0;O<E.length;O++)d=(v.words[O]|0)+(E.words[O]|0)+C,this.words[O]=d&67108863,C=d>>>26;for(;C!==0&&O<v.length;O++)d=(v.words[O]|0)+C,this.words[O]=d&67108863,C=d>>>26;if(this.length=v.length,C!==0)this.words[this.length]=C,this.length++;else if(v!==this)for(;O<v.length;O++)this.words[O]=v.words[O];return this},s.prototype.add=function(f){var d;return f.negative!==0&&this.negative===0?(f.negative=0,d=this.sub(f),f.negative^=1,d):f.negative===0&&this.negative!==0?(this.negative=0,d=f.sub(this),this.negative=1,d):this.length>f.length?this.clone().iadd(f):f.clone().iadd(this)},s.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var d=this.iadd(f);return f.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var v=this.cmp(f);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var E,C;v>0?(E=this,C=f):(E=f,C=this);for(var O=0,M=0;M<C.length;M++)d=(E.words[M]|0)-(C.words[M]|0)+O,O=d>>26,this.words[M]=d&67108863;for(;O!==0&&M<E.length;M++)d=(E.words[M]|0)+O,O=d>>26,this.words[M]=d&67108863;if(O===0&&M<E.length&&E!==this)for(;M<E.length;M++)this.words[M]=E.words[M];return this.length=Math.max(this.length,M),E!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(f){return this.clone().isub(f)};function K(f,d,v){v.negative=d.negative^f.negative;var E=f.length+d.length|0;v.length=E,E=E-1|0;var C=f.words[0]|0,O=d.words[0]|0,M=C*O,g=M&67108863,m=M/67108864|0;v.words[0]=g;for(var N=1;N<E;N++){for(var X=m>>>26,ae=m&67108863,P=Math.min(N,d.length-1),te=Math.max(0,N-f.length+1);te<=P;te++){var z=N-te|0;C=f.words[z]|0,O=d.words[te]|0,M=C*O+ae,X+=M/67108864|0,ae=M&67108863}v.words[N]=ae|0,m=X|0}return m!==0?v.words[N]=m|0:v.length--,v._strip()}var F=function(f,d,v){var E=f.words,C=d.words,O=v.words,M=0,g,m,N,X=E[0]|0,ae=X&8191,P=X>>>13,te=E[1]|0,z=te&8191,G=te>>>13,J=E[2]|0,A=J&8191,V=J>>>13,oe=E[3]|0,ue=oe&8191,he=oe>>>13,ye=E[4]|0,we=ye&8191,Re=ye>>>13,Xe=E[5]|0,Oe=Xe&8191,Ne=Xe>>>13,Me=E[6]|0,be=Me&8191,Pe=Me>>>13,Te=E[7]|0,ve=Te&8191,$e=Te>>>13,Se=E[8]|0,me=Se&8191,Ue=Se>>>13,Ce=E[9]|0,_e=Ce&8191,Ke=Ce>>>13,Ve=C[0]|0,Ae=Ve&8191,We=Ve>>>13,pt=C[1]|0,Ge=pt&8191,It=pt>>>13,gt=C[2]|0,Ye=gt&8191,Ot=gt>>>13,Tt=C[3]|0,Le=Tt&8191,et=Tt>>>13,it=C[4]|0,Be=it&8191,rt=it>>>13,tt=C[5]|0,qe=tt&8191,ht=tt>>>13,nt=C[6]|0,je=nt&8191,st=nt>>>13,at=C[7]|0,Fe=at&8191,Ze=at>>>13,lt=C[8]|0,ze=lt&8191,qt=lt>>>13,jt=C[9]|0,ct=jt&8191,_t=jt>>>13;v.negative=f.negative^d.negative,v.length=19,g=Math.imul(ae,Ae),m=Math.imul(ae,We),m=m+Math.imul(P,Ae)|0,N=Math.imul(P,We);var Zr=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,g=Math.imul(z,Ae),m=Math.imul(z,We),m=m+Math.imul(G,Ae)|0,N=Math.imul(G,We),g=g+Math.imul(ae,Ge)|0,m=m+Math.imul(ae,It)|0,m=m+Math.imul(P,Ge)|0,N=N+Math.imul(P,It)|0;var Xr=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,g=Math.imul(A,Ae),m=Math.imul(A,We),m=m+Math.imul(V,Ae)|0,N=Math.imul(V,We),g=g+Math.imul(z,Ge)|0,m=m+Math.imul(z,It)|0,m=m+Math.imul(G,Ge)|0,N=N+Math.imul(G,It)|0,g=g+Math.imul(ae,Ye)|0,m=m+Math.imul(ae,Ot)|0,m=m+Math.imul(P,Ye)|0,N=N+Math.imul(P,Ot)|0;var ei=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(ei>>>26)|0,ei&=67108863,g=Math.imul(ue,Ae),m=Math.imul(ue,We),m=m+Math.imul(he,Ae)|0,N=Math.imul(he,We),g=g+Math.imul(A,Ge)|0,m=m+Math.imul(A,It)|0,m=m+Math.imul(V,Ge)|0,N=N+Math.imul(V,It)|0,g=g+Math.imul(z,Ye)|0,m=m+Math.imul(z,Ot)|0,m=m+Math.imul(G,Ye)|0,N=N+Math.imul(G,Ot)|0,g=g+Math.imul(ae,Le)|0,m=m+Math.imul(ae,et)|0,m=m+Math.imul(P,Le)|0,N=N+Math.imul(P,et)|0;var ti=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(ti>>>26)|0,ti&=67108863,g=Math.imul(we,Ae),m=Math.imul(we,We),m=m+Math.imul(Re,Ae)|0,N=Math.imul(Re,We),g=g+Math.imul(ue,Ge)|0,m=m+Math.imul(ue,It)|0,m=m+Math.imul(he,Ge)|0,N=N+Math.imul(he,It)|0,g=g+Math.imul(A,Ye)|0,m=m+Math.imul(A,Ot)|0,m=m+Math.imul(V,Ye)|0,N=N+Math.imul(V,Ot)|0,g=g+Math.imul(z,Le)|0,m=m+Math.imul(z,et)|0,m=m+Math.imul(G,Le)|0,N=N+Math.imul(G,et)|0,g=g+Math.imul(ae,Be)|0,m=m+Math.imul(ae,rt)|0,m=m+Math.imul(P,Be)|0,N=N+Math.imul(P,rt)|0;var ri=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(ri>>>26)|0,ri&=67108863,g=Math.imul(Oe,Ae),m=Math.imul(Oe,We),m=m+Math.imul(Ne,Ae)|0,N=Math.imul(Ne,We),g=g+Math.imul(we,Ge)|0,m=m+Math.imul(we,It)|0,m=m+Math.imul(Re,Ge)|0,N=N+Math.imul(Re,It)|0,g=g+Math.imul(ue,Ye)|0,m=m+Math.imul(ue,Ot)|0,m=m+Math.imul(he,Ye)|0,N=N+Math.imul(he,Ot)|0,g=g+Math.imul(A,Le)|0,m=m+Math.imul(A,et)|0,m=m+Math.imul(V,Le)|0,N=N+Math.imul(V,et)|0,g=g+Math.imul(z,Be)|0,m=m+Math.imul(z,rt)|0,m=m+Math.imul(G,Be)|0,N=N+Math.imul(G,rt)|0,g=g+Math.imul(ae,qe)|0,m=m+Math.imul(ae,ht)|0,m=m+Math.imul(P,qe)|0,N=N+Math.imul(P,ht)|0;var vr=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(vr>>>26)|0,vr&=67108863,g=Math.imul(be,Ae),m=Math.imul(be,We),m=m+Math.imul(Pe,Ae)|0,N=Math.imul(Pe,We),g=g+Math.imul(Oe,Ge)|0,m=m+Math.imul(Oe,It)|0,m=m+Math.imul(Ne,Ge)|0,N=N+Math.imul(Ne,It)|0,g=g+Math.imul(we,Ye)|0,m=m+Math.imul(we,Ot)|0,m=m+Math.imul(Re,Ye)|0,N=N+Math.imul(Re,Ot)|0,g=g+Math.imul(ue,Le)|0,m=m+Math.imul(ue,et)|0,m=m+Math.imul(he,Le)|0,N=N+Math.imul(he,et)|0,g=g+Math.imul(A,Be)|0,m=m+Math.imul(A,rt)|0,m=m+Math.imul(V,Be)|0,N=N+Math.imul(V,rt)|0,g=g+Math.imul(z,qe)|0,m=m+Math.imul(z,ht)|0,m=m+Math.imul(G,qe)|0,N=N+Math.imul(G,ht)|0,g=g+Math.imul(ae,je)|0,m=m+Math.imul(ae,st)|0,m=m+Math.imul(P,je)|0,N=N+Math.imul(P,st)|0;var Ii=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(Ii>>>26)|0,Ii&=67108863,g=Math.imul(ve,Ae),m=Math.imul(ve,We),m=m+Math.imul($e,Ae)|0,N=Math.imul($e,We),g=g+Math.imul(be,Ge)|0,m=m+Math.imul(be,It)|0,m=m+Math.imul(Pe,Ge)|0,N=N+Math.imul(Pe,It)|0,g=g+Math.imul(Oe,Ye)|0,m=m+Math.imul(Oe,Ot)|0,m=m+Math.imul(Ne,Ye)|0,N=N+Math.imul(Ne,Ot)|0,g=g+Math.imul(we,Le)|0,m=m+Math.imul(we,et)|0,m=m+Math.imul(Re,Le)|0,N=N+Math.imul(Re,et)|0,g=g+Math.imul(ue,Be)|0,m=m+Math.imul(ue,rt)|0,m=m+Math.imul(he,Be)|0,N=N+Math.imul(he,rt)|0,g=g+Math.imul(A,qe)|0,m=m+Math.imul(A,ht)|0,m=m+Math.imul(V,qe)|0,N=N+Math.imul(V,ht)|0,g=g+Math.imul(z,je)|0,m=m+Math.imul(z,st)|0,m=m+Math.imul(G,je)|0,N=N+Math.imul(G,st)|0,g=g+Math.imul(ae,Fe)|0,m=m+Math.imul(ae,Ze)|0,m=m+Math.imul(P,Fe)|0,N=N+Math.imul(P,Ze)|0;var On=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(On>>>26)|0,On&=67108863,g=Math.imul(me,Ae),m=Math.imul(me,We),m=m+Math.imul(Ue,Ae)|0,N=Math.imul(Ue,We),g=g+Math.imul(ve,Ge)|0,m=m+Math.imul(ve,It)|0,m=m+Math.imul($e,Ge)|0,N=N+Math.imul($e,It)|0,g=g+Math.imul(be,Ye)|0,m=m+Math.imul(be,Ot)|0,m=m+Math.imul(Pe,Ye)|0,N=N+Math.imul(Pe,Ot)|0,g=g+Math.imul(Oe,Le)|0,m=m+Math.imul(Oe,et)|0,m=m+Math.imul(Ne,Le)|0,N=N+Math.imul(Ne,et)|0,g=g+Math.imul(we,Be)|0,m=m+Math.imul(we,rt)|0,m=m+Math.imul(Re,Be)|0,N=N+Math.imul(Re,rt)|0,g=g+Math.imul(ue,qe)|0,m=m+Math.imul(ue,ht)|0,m=m+Math.imul(he,qe)|0,N=N+Math.imul(he,ht)|0,g=g+Math.imul(A,je)|0,m=m+Math.imul(A,st)|0,m=m+Math.imul(V,je)|0,N=N+Math.imul(V,st)|0,g=g+Math.imul(z,Fe)|0,m=m+Math.imul(z,Ze)|0,m=m+Math.imul(G,Fe)|0,N=N+Math.imul(G,Ze)|0,g=g+Math.imul(ae,ze)|0,m=m+Math.imul(ae,qt)|0,m=m+Math.imul(P,ze)|0,N=N+Math.imul(P,qt)|0;var Mi=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(Mi>>>26)|0,Mi&=67108863,g=Math.imul(_e,Ae),m=Math.imul(_e,We),m=m+Math.imul(Ke,Ae)|0,N=Math.imul(Ke,We),g=g+Math.imul(me,Ge)|0,m=m+Math.imul(me,It)|0,m=m+Math.imul(Ue,Ge)|0,N=N+Math.imul(Ue,It)|0,g=g+Math.imul(ve,Ye)|0,m=m+Math.imul(ve,Ot)|0,m=m+Math.imul($e,Ye)|0,N=N+Math.imul($e,Ot)|0,g=g+Math.imul(be,Le)|0,m=m+Math.imul(be,et)|0,m=m+Math.imul(Pe,Le)|0,N=N+Math.imul(Pe,et)|0,g=g+Math.imul(Oe,Be)|0,m=m+Math.imul(Oe,rt)|0,m=m+Math.imul(Ne,Be)|0,N=N+Math.imul(Ne,rt)|0,g=g+Math.imul(we,qe)|0,m=m+Math.imul(we,ht)|0,m=m+Math.imul(Re,qe)|0,N=N+Math.imul(Re,ht)|0,g=g+Math.imul(ue,je)|0,m=m+Math.imul(ue,st)|0,m=m+Math.imul(he,je)|0,N=N+Math.imul(he,st)|0,g=g+Math.imul(A,Fe)|0,m=m+Math.imul(A,Ze)|0,m=m+Math.imul(V,Fe)|0,N=N+Math.imul(V,Ze)|0,g=g+Math.imul(z,ze)|0,m=m+Math.imul(z,qt)|0,m=m+Math.imul(G,ze)|0,N=N+Math.imul(G,qt)|0,g=g+Math.imul(ae,ct)|0,m=m+Math.imul(ae,_t)|0,m=m+Math.imul(P,ct)|0,N=N+Math.imul(P,_t)|0;var Pn=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,g=Math.imul(_e,Ge),m=Math.imul(_e,It),m=m+Math.imul(Ke,Ge)|0,N=Math.imul(Ke,It),g=g+Math.imul(me,Ye)|0,m=m+Math.imul(me,Ot)|0,m=m+Math.imul(Ue,Ye)|0,N=N+Math.imul(Ue,Ot)|0,g=g+Math.imul(ve,Le)|0,m=m+Math.imul(ve,et)|0,m=m+Math.imul($e,Le)|0,N=N+Math.imul($e,et)|0,g=g+Math.imul(be,Be)|0,m=m+Math.imul(be,rt)|0,m=m+Math.imul(Pe,Be)|0,N=N+Math.imul(Pe,rt)|0,g=g+Math.imul(Oe,qe)|0,m=m+Math.imul(Oe,ht)|0,m=m+Math.imul(Ne,qe)|0,N=N+Math.imul(Ne,ht)|0,g=g+Math.imul(we,je)|0,m=m+Math.imul(we,st)|0,m=m+Math.imul(Re,je)|0,N=N+Math.imul(Re,st)|0,g=g+Math.imul(ue,Fe)|0,m=m+Math.imul(ue,Ze)|0,m=m+Math.imul(he,Fe)|0,N=N+Math.imul(he,Ze)|0,g=g+Math.imul(A,ze)|0,m=m+Math.imul(A,qt)|0,m=m+Math.imul(V,ze)|0,N=N+Math.imul(V,qt)|0,g=g+Math.imul(z,ct)|0,m=m+Math.imul(z,_t)|0,m=m+Math.imul(G,ct)|0,N=N+Math.imul(G,_t)|0;var $n=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+($n>>>26)|0,$n&=67108863,g=Math.imul(_e,Ye),m=Math.imul(_e,Ot),m=m+Math.imul(Ke,Ye)|0,N=Math.imul(Ke,Ot),g=g+Math.imul(me,Le)|0,m=m+Math.imul(me,et)|0,m=m+Math.imul(Ue,Le)|0,N=N+Math.imul(Ue,et)|0,g=g+Math.imul(ve,Be)|0,m=m+Math.imul(ve,rt)|0,m=m+Math.imul($e,Be)|0,N=N+Math.imul($e,rt)|0,g=g+Math.imul(be,qe)|0,m=m+Math.imul(be,ht)|0,m=m+Math.imul(Pe,qe)|0,N=N+Math.imul(Pe,ht)|0,g=g+Math.imul(Oe,je)|0,m=m+Math.imul(Oe,st)|0,m=m+Math.imul(Ne,je)|0,N=N+Math.imul(Ne,st)|0,g=g+Math.imul(we,Fe)|0,m=m+Math.imul(we,Ze)|0,m=m+Math.imul(Re,Fe)|0,N=N+Math.imul(Re,Ze)|0,g=g+Math.imul(ue,ze)|0,m=m+Math.imul(ue,qt)|0,m=m+Math.imul(he,ze)|0,N=N+Math.imul(he,qt)|0,g=g+Math.imul(A,ct)|0,m=m+Math.imul(A,_t)|0,m=m+Math.imul(V,ct)|0,N=N+Math.imul(V,_t)|0;var Ci=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(Ci>>>26)|0,Ci&=67108863,g=Math.imul(_e,Le),m=Math.imul(_e,et),m=m+Math.imul(Ke,Le)|0,N=Math.imul(Ke,et),g=g+Math.imul(me,Be)|0,m=m+Math.imul(me,rt)|0,m=m+Math.imul(Ue,Be)|0,N=N+Math.imul(Ue,rt)|0,g=g+Math.imul(ve,qe)|0,m=m+Math.imul(ve,ht)|0,m=m+Math.imul($e,qe)|0,N=N+Math.imul($e,ht)|0,g=g+Math.imul(be,je)|0,m=m+Math.imul(be,st)|0,m=m+Math.imul(Pe,je)|0,N=N+Math.imul(Pe,st)|0,g=g+Math.imul(Oe,Fe)|0,m=m+Math.imul(Oe,Ze)|0,m=m+Math.imul(Ne,Fe)|0,N=N+Math.imul(Ne,Ze)|0,g=g+Math.imul(we,ze)|0,m=m+Math.imul(we,qt)|0,m=m+Math.imul(Re,ze)|0,N=N+Math.imul(Re,qt)|0,g=g+Math.imul(ue,ct)|0,m=m+Math.imul(ue,_t)|0,m=m+Math.imul(he,ct)|0,N=N+Math.imul(he,_t)|0;var an=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(an>>>26)|0,an&=67108863,g=Math.imul(_e,Be),m=Math.imul(_e,rt),m=m+Math.imul(Ke,Be)|0,N=Math.imul(Ke,rt),g=g+Math.imul(me,qe)|0,m=m+Math.imul(me,ht)|0,m=m+Math.imul(Ue,qe)|0,N=N+Math.imul(Ue,ht)|0,g=g+Math.imul(ve,je)|0,m=m+Math.imul(ve,st)|0,m=m+Math.imul($e,je)|0,N=N+Math.imul($e,st)|0,g=g+Math.imul(be,Fe)|0,m=m+Math.imul(be,Ze)|0,m=m+Math.imul(Pe,Fe)|0,N=N+Math.imul(Pe,Ze)|0,g=g+Math.imul(Oe,ze)|0,m=m+Math.imul(Oe,qt)|0,m=m+Math.imul(Ne,ze)|0,N=N+Math.imul(Ne,qt)|0,g=g+Math.imul(we,ct)|0,m=m+Math.imul(we,_t)|0,m=m+Math.imul(Re,ct)|0,N=N+Math.imul(Re,_t)|0;var cn=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(cn>>>26)|0,cn&=67108863,g=Math.imul(_e,qe),m=Math.imul(_e,ht),m=m+Math.imul(Ke,qe)|0,N=Math.imul(Ke,ht),g=g+Math.imul(me,je)|0,m=m+Math.imul(me,st)|0,m=m+Math.imul(Ue,je)|0,N=N+Math.imul(Ue,st)|0,g=g+Math.imul(ve,Fe)|0,m=m+Math.imul(ve,Ze)|0,m=m+Math.imul($e,Fe)|0,N=N+Math.imul($e,Ze)|0,g=g+Math.imul(be,ze)|0,m=m+Math.imul(be,qt)|0,m=m+Math.imul(Pe,ze)|0,N=N+Math.imul(Pe,qt)|0,g=g+Math.imul(Oe,ct)|0,m=m+Math.imul(Oe,_t)|0,m=m+Math.imul(Ne,ct)|0,N=N+Math.imul(Ne,_t)|0;var Cr=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(Cr>>>26)|0,Cr&=67108863,g=Math.imul(_e,je),m=Math.imul(_e,st),m=m+Math.imul(Ke,je)|0,N=Math.imul(Ke,st),g=g+Math.imul(me,Fe)|0,m=m+Math.imul(me,Ze)|0,m=m+Math.imul(Ue,Fe)|0,N=N+Math.imul(Ue,Ze)|0,g=g+Math.imul(ve,ze)|0,m=m+Math.imul(ve,qt)|0,m=m+Math.imul($e,ze)|0,N=N+Math.imul($e,qt)|0,g=g+Math.imul(be,ct)|0,m=m+Math.imul(be,_t)|0,m=m+Math.imul(Pe,ct)|0,N=N+Math.imul(Pe,_t)|0;var Rn=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,g=Math.imul(_e,Fe),m=Math.imul(_e,Ze),m=m+Math.imul(Ke,Fe)|0,N=Math.imul(Ke,Ze),g=g+Math.imul(me,ze)|0,m=m+Math.imul(me,qt)|0,m=m+Math.imul(Ue,ze)|0,N=N+Math.imul(Ue,qt)|0,g=g+Math.imul(ve,ct)|0,m=m+Math.imul(ve,_t)|0,m=m+Math.imul($e,ct)|0,N=N+Math.imul($e,_t)|0;var Nn=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(Nn>>>26)|0,Nn&=67108863,g=Math.imul(_e,ze),m=Math.imul(_e,qt),m=m+Math.imul(Ke,ze)|0,N=Math.imul(Ke,qt),g=g+Math.imul(me,ct)|0,m=m+Math.imul(me,_t)|0,m=m+Math.imul(Ue,ct)|0,N=N+Math.imul(Ue,_t)|0;var Tn=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,g=Math.imul(_e,ct),m=Math.imul(_e,_t),m=m+Math.imul(Ke,ct)|0,N=Math.imul(Ke,_t);var va=(M+g|0)+((m&8191)<<13)|0;return M=(N+(m>>>13)|0)+(va>>>26)|0,va&=67108863,O[0]=Zr,O[1]=Xr,O[2]=ei,O[3]=ti,O[4]=ri,O[5]=vr,O[6]=Ii,O[7]=On,O[8]=Mi,O[9]=Pn,O[10]=$n,O[11]=Ci,O[12]=an,O[13]=cn,O[14]=Cr,O[15]=Rn,O[16]=Nn,O[17]=Tn,O[18]=va,M!==0&&(O[19]=M,v.length++),v};Math.imul||(F=K);function W(f,d,v){v.negative=d.negative^f.negative,v.length=f.length+d.length;for(var E=0,C=0,O=0;O<v.length-1;O++){var M=C;C=0;for(var g=E&67108863,m=Math.min(O,d.length-1),N=Math.max(0,O-f.length+1);N<=m;N++){var X=O-N,ae=f.words[X]|0,P=d.words[N]|0,te=ae*P,z=te&67108863;M=M+(te/67108864|0)|0,z=z+g|0,g=z&67108863,M=M+(z>>>26)|0,C+=M>>>26,M&=67108863}v.words[O]=g,E=M,M=C}return E!==0?v.words[O]=E:v.length--,v._strip()}function R(f,d,v){return W(f,d,v)}s.prototype.mulTo=function(f,d){var v,E=this.length+f.length;return this.length===10&&f.length===10?v=F(this,f,d):E<63?v=K(this,f,d):E<1024?v=W(this,f,d):v=R(this,f,d),v},s.prototype.mul=function(f){var d=new s(null);return d.words=new Array(this.length+f.length),this.mulTo(f,d)},s.prototype.mulf=function(f){var d=new s(null);return d.words=new Array(this.length+f.length),R(this,f,d)},s.prototype.imul=function(f){return this.clone().mulTo(f,this)},s.prototype.imuln=function(f){var d=f<0;d&&(f=-f),i(typeof f=="number"),i(f<67108864);for(var v=0,E=0;E<this.length;E++){var C=(this.words[E]|0)*f,O=(C&67108863)+(v&67108863);v>>=26,v+=C/67108864|0,v+=O>>>26,this.words[E]=O&67108863}return v!==0&&(this.words[E]=v,this.length++),d?this.ineg():this},s.prototype.muln=function(f){return this.clone().imuln(f)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(f){var d=q(f);if(d.length===0)return new s(1);for(var v=this,E=0;E<d.length&&d[E]===0;E++,v=v.sqr());if(++E<d.length)for(var C=v.sqr();E<d.length;E++,C=C.sqr())d[E]!==0&&(v=v.mul(C));return v},s.prototype.iushln=function(f){i(typeof f=="number"&&f>=0);var d=f%26,v=(f-d)/26,E=67108863>>>26-d<<26-d,C;if(d!==0){var O=0;for(C=0;C<this.length;C++){var M=this.words[C]&E,g=(this.words[C]|0)-M<<d;this.words[C]=g|O,O=M>>>26-d}O&&(this.words[C]=O,this.length++)}if(v!==0){for(C=this.length-1;C>=0;C--)this.words[C+v]=this.words[C];for(C=0;C<v;C++)this.words[C]=0;this.length+=v}return this._strip()},s.prototype.ishln=function(f){return i(this.negative===0),this.iushln(f)},s.prototype.iushrn=function(f,d,v){i(typeof f=="number"&&f>=0);var E;d?E=(d-d%26)/26:E=0;var C=f%26,O=Math.min((f-C)/26,this.length),M=67108863^67108863>>>C<<C,g=v;if(E-=O,E=Math.max(0,E),g){for(var m=0;m<O;m++)g.words[m]=this.words[m];g.length=O}if(O!==0)if(this.length>O)for(this.length-=O,m=0;m<this.length;m++)this.words[m]=this.words[m+O];else this.words[0]=0,this.length=1;var N=0;for(m=this.length-1;m>=0&&(N!==0||m>=E);m--){var X=this.words[m]|0;this.words[m]=N<<26-C|X>>>C,N=X&M}return g&&N!==0&&(g.words[g.length++]=N),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(f,d,v){return i(this.negative===0),this.iushrn(f,d,v)},s.prototype.shln=function(f){return this.clone().ishln(f)},s.prototype.ushln=function(f){return this.clone().iushln(f)},s.prototype.shrn=function(f){return this.clone().ishrn(f)},s.prototype.ushrn=function(f){return this.clone().iushrn(f)},s.prototype.testn=function(f){i(typeof f=="number"&&f>=0);var d=f%26,v=(f-d)/26,E=1<<d;if(this.length<=v)return!1;var C=this.words[v];return!!(C&E)},s.prototype.imaskn=function(f){i(typeof f=="number"&&f>=0);var d=f%26,v=(f-d)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(d!==0&&v++,this.length=Math.min(v,this.length),d!==0){var E=67108863^67108863>>>d<<d;this.words[this.length-1]&=E}return this._strip()},s.prototype.maskn=function(f){return this.clone().imaskn(f)},s.prototype.iaddn=function(f){return i(typeof f=="number"),i(f<67108864),f<0?this.isubn(-f):this.negative!==0?this.length===1&&(this.words[0]|0)<=f?(this.words[0]=f-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(f),this.negative=1,this):this._iaddn(f)},s.prototype._iaddn=function(f){this.words[0]+=f;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(f){if(i(typeof f=="number"),i(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,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(f){return this.clone().iaddn(f)},s.prototype.subn=function(f){return this.clone().isubn(f)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(f,d,v){var E=f.length+v,C;this._expand(E);var O,M=0;for(C=0;C<f.length;C++){O=(this.words[C+v]|0)+M;var g=(f.words[C]|0)*d;O-=g&67108863,M=(O>>26)-(g/67108864|0),this.words[C+v]=O&67108863}for(;C<this.length-v;C++)O=(this.words[C+v]|0)+M,M=O>>26,this.words[C+v]=O&67108863;if(M===0)return this._strip();for(i(M===-1),M=0,C=0;C<this.length;C++)O=-(this.words[C]|0)+M,M=O>>26,this.words[C]=O&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(f,d){var v=this.length-f.length,E=this.clone(),C=f,O=C.words[C.length-1]|0,M=this._countBits(O);v=26-M,v!==0&&(C=C.ushln(v),E.iushln(v),O=C.words[C.length-1]|0);var g=E.length-C.length,m;if(d!=="mod"){m=new s(null),m.length=g+1,m.words=new Array(m.length);for(var N=0;N<m.length;N++)m.words[N]=0}var X=E.clone()._ishlnsubmul(C,1,g);X.negative===0&&(E=X,m&&(m.words[g]=1));for(var ae=g-1;ae>=0;ae--){var P=(E.words[C.length+ae]|0)*67108864+(E.words[C.length+ae-1]|0);for(P=Math.min(P/O|0,67108863),E._ishlnsubmul(C,P,ae);E.negative!==0;)P--,E.negative=0,E._ishlnsubmul(C,1,ae),E.isZero()||(E.negative^=1);m&&(m.words[ae]=P)}return m&&m._strip(),E._strip(),d!=="div"&&v!==0&&E.iushrn(v),{div:m||null,mod:E}},s.prototype.divmod=function(f,d,v){if(i(!f.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var E,C,O;return this.negative!==0&&f.negative===0?(O=this.neg().divmod(f,d),d!=="mod"&&(E=O.div.neg()),d!=="div"&&(C=O.mod.neg(),v&&C.negative!==0&&C.iadd(f)),{div:E,mod:C}):this.negative===0&&f.negative!==0?(O=this.divmod(f.neg(),d),d!=="mod"&&(E=O.div.neg()),{div:E,mod:O.mod}):this.negative&f.negative?(O=this.neg().divmod(f.neg(),d),d!=="div"&&(C=O.mod.neg(),v&&C.negative!==0&&C.isub(f)),{div:O.div,mod:C}):f.length>this.length||this.cmp(f)<0?{div:new s(0),mod:this}:f.length===1?d==="div"?{div:this.divn(f.words[0]),mod:null}:d==="mod"?{div:null,mod:new s(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new s(this.modrn(f.words[0]))}:this._wordDiv(f,d)},s.prototype.div=function(f){return this.divmod(f,"div",!1).div},s.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},s.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},s.prototype.divRound=function(f){var d=this.divmod(f);if(d.mod.isZero())return d.div;var v=d.div.negative!==0?d.mod.isub(f):d.mod,E=f.ushrn(1),C=f.andln(1),O=v.cmp(E);return O<0||C===1&&O===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},s.prototype.modrn=function(f){var d=f<0;d&&(f=-f),i(f<=67108863);for(var v=(1<<26)%f,E=0,C=this.length-1;C>=0;C--)E=(v*E+(this.words[C]|0))%f;return d?-E:E},s.prototype.modn=function(f){return this.modrn(f)},s.prototype.idivn=function(f){var d=f<0;d&&(f=-f),i(f<=67108863);for(var v=0,E=this.length-1;E>=0;E--){var C=(this.words[E]|0)+v*67108864;this.words[E]=C/f|0,v=C%f}return this._strip(),d?this.ineg():this},s.prototype.divn=function(f){return this.clone().idivn(f)},s.prototype.egcd=function(f){i(f.negative===0),i(!f.isZero());var d=this,v=f.clone();d.negative!==0?d=d.umod(f):d=d.clone();for(var E=new s(1),C=new s(0),O=new s(0),M=new s(1),g=0;d.isEven()&&v.isEven();)d.iushrn(1),v.iushrn(1),++g;for(var m=v.clone(),N=d.clone();!d.isZero();){for(var X=0,ae=1;!(d.words[0]&ae)&&X<26;++X,ae<<=1);if(X>0)for(d.iushrn(X);X-- >0;)(E.isOdd()||C.isOdd())&&(E.iadd(m),C.isub(N)),E.iushrn(1),C.iushrn(1);for(var P=0,te=1;!(v.words[0]&te)&&P<26;++P,te<<=1);if(P>0)for(v.iushrn(P);P-- >0;)(O.isOdd()||M.isOdd())&&(O.iadd(m),M.isub(N)),O.iushrn(1),M.iushrn(1);d.cmp(v)>=0?(d.isub(v),E.isub(O),C.isub(M)):(v.isub(d),O.isub(E),M.isub(C))}return{a:O,b:M,gcd:v.iushln(g)}},s.prototype._invmp=function(f){i(f.negative===0),i(!f.isZero());var d=this,v=f.clone();d.negative!==0?d=d.umod(f):d=d.clone();for(var E=new s(1),C=new s(0),O=v.clone();d.cmpn(1)>0&&v.cmpn(1)>0;){for(var M=0,g=1;!(d.words[0]&g)&&M<26;++M,g<<=1);if(M>0)for(d.iushrn(M);M-- >0;)E.isOdd()&&E.iadd(O),E.iushrn(1);for(var m=0,N=1;!(v.words[0]&N)&&m<26;++m,N<<=1);if(m>0)for(v.iushrn(m);m-- >0;)C.isOdd()&&C.iadd(O),C.iushrn(1);d.cmp(v)>=0?(d.isub(v),E.isub(C)):(v.isub(d),C.isub(E))}var X;return d.cmpn(1)===0?X=E:X=C,X.cmpn(0)<0&&X.iadd(f),X},s.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var d=this.clone(),v=f.clone();d.negative=0,v.negative=0;for(var E=0;d.isEven()&&v.isEven();E++)d.iushrn(1),v.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;v.isEven();)v.iushrn(1);var C=d.cmp(v);if(C<0){var O=d;d=v,v=O}else if(C===0||v.cmpn(1)===0)break;d.isub(v)}while(!0);return v.iushln(E)},s.prototype.invm=function(f){return this.egcd(f).a.umod(f)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(f){return this.words[0]&f},s.prototype.bincn=function(f){i(typeof f=="number");var d=f%26,v=(f-d)/26,E=1<<d;if(this.length<=v)return this._expand(v+1),this.words[v]|=E,this;for(var C=E,O=v;C!==0&&O<this.length;O++){var M=this.words[O]|0;M+=C,C=M>>>26,M&=67108863,this.words[O]=M}return C!==0&&(this.words[O]=C,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(f){var d=f<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var v;if(this.length>1)v=1;else{d&&(f=-f),i(f<=67108863,"Number is too big");var E=this.words[0]|0;v=E===f?0:E<f?-1:1}return this.negative!==0?-v|0:v},s.prototype.cmp=function(f){if(this.negative!==0&&f.negative===0)return-1;if(this.negative===0&&f.negative!==0)return 1;var d=this.ucmp(f);return this.negative!==0?-d|0:d},s.prototype.ucmp=function(f){if(this.length>f.length)return 1;if(this.length<f.length)return-1;for(var d=0,v=this.length-1;v>=0;v--){var E=this.words[v]|0,C=f.words[v]|0;if(E!==C){E<C?d=-1:E>C&&(d=1);break}}return d},s.prototype.gtn=function(f){return this.cmpn(f)===1},s.prototype.gt=function(f){return this.cmp(f)===1},s.prototype.gten=function(f){return this.cmpn(f)>=0},s.prototype.gte=function(f){return this.cmp(f)>=0},s.prototype.ltn=function(f){return this.cmpn(f)===-1},s.prototype.lt=function(f){return this.cmp(f)===-1},s.prototype.lten=function(f){return this.cmpn(f)<=0},s.prototype.lte=function(f){return this.cmp(f)<=0},s.prototype.eqn=function(f){return this.cmpn(f)===0},s.prototype.eq=function(f){return this.cmp(f)===0},s.red=function(f){return new L(f)},s.prototype.toRed=function(f){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(f){return this.red=f,this},s.prototype.forceRed=function(f){return i(!this.red,"Already a number in reduction context"),this._forceRed(f)},s.prototype.redAdd=function(f){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},s.prototype.redIAdd=function(f){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},s.prototype.redSub=function(f){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},s.prototype.redISub=function(f){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},s.prototype.redShl=function(f){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},s.prototype.redMul=function(f){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},s.prototype.redIMul=function(f){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},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(f){return i(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var k={k256:null,p224:null,p192:null,p25519:null};function H(f,d){this.name=f,this.p=new s(d,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}H.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},H.prototype.ireduce=function(f){var d=f,v;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),v=d.bitLength();while(v>this.n);var E=v<this.n?-1:d.ucmp(this.p);return E===0?(d.words[0]=0,d.length=1):E>0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},H.prototype.split=function(f,d){f.iushrn(this.n,0,d)},H.prototype.imulK=function(f){return f.imul(this.k)};function _(){H.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(_,H),_.prototype.split=function(f,d){for(var v=4194303,E=Math.min(f.length,9),C=0;C<E;C++)d.words[C]=f.words[C];if(d.length=E,f.length<=9){f.words[0]=0,f.length=1;return}var O=f.words[9];for(d.words[d.length++]=O&v,C=10;C<f.length;C++){var M=f.words[C]|0;f.words[C-10]=(M&v)<<4|O>>>22,O=M}O>>>=22,f.words[C-10]=O,O===0&&f.length>10?f.length-=10:f.length-=9},_.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var d=0,v=0;v<f.length;v++){var E=f.words[v]|0;d+=E*977,f.words[v]=d&67108863,d=E*64+(d/67108864|0)}return f.words[f.length-1]===0&&(f.length--,f.words[f.length-1]===0&&f.length--),f};function B(){H.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(B,H);function ee(){H.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(ee,H);function ie(){H.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(ie,H),ie.prototype.imulK=function(f){for(var d=0,v=0;v<f.length;v++){var E=(f.words[v]|0)*19+d,C=E&67108863;E>>>=26,f.words[v]=C,d=E}return d!==0&&(f.words[f.length++]=d),f},s._prime=function(f){if(k[f])return k[f];var d;if(f==="k256")d=new _;else if(f==="p224")d=new B;else if(f==="p192")d=new ee;else if(f==="p25519")d=new ie;else throw new Error("Unknown prime "+f);return k[f]=d,d};function L(f){if(typeof f=="string"){var d=s._prime(f);this.m=d.p,this.prime=d}else i(f.gtn(1),"modulus must be greater than 1"),this.m=f,this.prime=null}L.prototype._verify1=function(f){i(f.negative===0,"red works only with positives"),i(f.red,"red works only with red numbers")},L.prototype._verify2=function(f,d){i((f.negative|d.negative)===0,"red works only with positives"),i(f.red&&f.red===d.red,"red works only with red numbers")},L.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(b(f,f.umod(this.m)._forceRed(this)),f)},L.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},L.prototype.add=function(f,d){this._verify2(f,d);var v=f.add(d);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},L.prototype.iadd=function(f,d){this._verify2(f,d);var v=f.iadd(d);return v.cmp(this.m)>=0&&v.isub(this.m),v},L.prototype.sub=function(f,d){this._verify2(f,d);var v=f.sub(d);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},L.prototype.isub=function(f,d){this._verify2(f,d);var v=f.isub(d);return v.cmpn(0)<0&&v.iadd(this.m),v},L.prototype.shl=function(f,d){return this._verify1(f),this.imod(f.ushln(d))},L.prototype.imul=function(f,d){return this._verify2(f,d),this.imod(f.imul(d))},L.prototype.mul=function(f,d){return this._verify2(f,d),this.imod(f.mul(d))},L.prototype.isqr=function(f){return this.imul(f,f.clone())},L.prototype.sqr=function(f){return this.mul(f,f)},L.prototype.sqrt=function(f){if(f.isZero())return f.clone();var d=this.m.andln(3);if(i(d%2===1),d===3){var v=this.m.add(new s(1)).iushrn(2);return this.pow(f,v)}for(var E=this.m.subn(1),C=0;!E.isZero()&&E.andln(1)===0;)C++,E.iushrn(1);i(!E.isZero());var O=new s(1).toRed(this),M=O.redNeg(),g=this.m.subn(1).iushrn(1),m=this.m.bitLength();for(m=new s(2*m*m).toRed(this);this.pow(m,g).cmp(M)!==0;)m.redIAdd(M);for(var N=this.pow(m,E),X=this.pow(f,E.addn(1).iushrn(1)),ae=this.pow(f,E),P=C;ae.cmp(O)!==0;){for(var te=ae,z=0;te.cmp(O)!==0;z++)te=te.redSqr();i(z<P);var G=this.pow(N,new s(1).iushln(P-z-1));X=X.redMul(G),N=G.redSqr(),ae=ae.redMul(N),P=z}return X},L.prototype.invm=function(f){var d=f._invmp(this.m);return d.negative!==0?(d.negative=0,this.imod(d).redNeg()):this.imod(d)},L.prototype.pow=function(f,d){if(d.isZero())return new s(1).toRed(this);if(d.cmpn(1)===0)return f.clone();var v=4,E=new Array(1<<v);E[0]=new s(1).toRed(this),E[1]=f;for(var C=2;C<E.length;C++)E[C]=this.mul(E[C-1],f);var O=E[0],M=0,g=0,m=d.bitLength()%26;for(m===0&&(m=26),C=d.length-1;C>=0;C--){for(var N=d.words[C],X=m-1;X>=0;X--){var ae=N>>X&1;if(O!==E[0]&&(O=this.sqr(O)),ae===0&&M===0){g=0;continue}M<<=1,M|=ae,g++,!(g!==v&&(C!==0||X!==0))&&(O=this.mul(O,E[M]),g=0,M=0)}m=26}return O},L.prototype.convertTo=function(f){var d=f.umod(this.m);return d===f?d.clone():d},L.prototype.convertFrom=function(f){var d=f.clone();return d.red=null,d},s.mont=function(f){return new y(f)};function y(f){L.call(this,f),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(y,L),y.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},y.prototype.convertFrom=function(f){var d=this.imod(f.mul(this.rinv));return d.red=null,d},y.prototype.imul=function(f,d){if(f.isZero()||d.isZero())return f.words[0]=0,f.length=1,f;var v=f.imul(d),E=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),C=v.isub(E).iushrn(this.shift),O=C;return C.cmp(this.m)>=0?O=C.isub(this.m):C.cmpn(0)<0&&(O=C.iadd(this.m)),O._forceRed(this)},y.prototype.mul=function(f,d){if(f.isZero()||d.isZero())return new s(0)._forceRed(this);var v=f.mul(d),E=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),C=v.isub(E).iushrn(this.shift),O=C;return C.cmp(this.m)>=0?O=C.isub(this.m):C.cmpn(0)<0&&(O=C.iadd(this.m)),O._forceRed(this)},y.prototype.invm=function(f){var d=this.imod(f._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(t,Q2)})(cm);var mt=cm.exports;const um="bignumber/5.7.0";var nh=mt.BN;const Ds=new Et(um),ld={},fm=9007199254740991;function bA(t){return t!=null&&(sr.isBigNumber(t)||typeof t=="number"&&t%1===0||typeof t=="string"&&!!t.match(/^-?[0-9]+$/)||Fi(t)||typeof t=="bigint"||Ya(t))}let hm=!1;class sr{constructor(e,r){e!==ld&&Ds.throwError("cannot call constructor directly; use BigNumber.from",Et.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return yi(Rt(this).fromTwos(e))}toTwos(e){return yi(Rt(this).toTwos(e))}abs(){return this._hex[0]==="-"?sr.from(this._hex.substring(1)):this}add(e){return yi(Rt(this).add(Rt(e)))}sub(e){return yi(Rt(this).sub(Rt(e)))}div(e){return sr.from(e).isZero()&&Zi("division-by-zero","div"),yi(Rt(this).div(Rt(e)))}mul(e){return yi(Rt(this).mul(Rt(e)))}mod(e){const r=Rt(e);return r.isNeg()&&Zi("division-by-zero","mod"),yi(Rt(this).umod(r))}pow(e){const r=Rt(e);return r.isNeg()&&Zi("negative-power","pow"),yi(Rt(this).pow(r))}and(e){const r=Rt(e);return(this.isNegative()||r.isNeg())&&Zi("unbound-bitwise-result","and"),yi(Rt(this).and(r))}or(e){const r=Rt(e);return(this.isNegative()||r.isNeg())&&Zi("unbound-bitwise-result","or"),yi(Rt(this).or(r))}xor(e){const r=Rt(e);return(this.isNegative()||r.isNeg())&&Zi("unbound-bitwise-result","xor"),yi(Rt(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&Zi("negative-width","mask"),yi(Rt(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Zi("negative-width","shl"),yi(Rt(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Zi("negative-width","shr"),yi(Rt(this).shrn(e))}eq(e){return Rt(this).eq(Rt(e))}lt(e){return Rt(this).lt(Rt(e))}lte(e){return Rt(this).lte(Rt(e))}gt(e){return Rt(this).gt(Rt(e))}gte(e){return Rt(this).gte(Rt(e))}isNegative(){return this._hex[0]==="-"}isZero(){return Rt(this).isZero()}toNumber(){try{return Rt(this).toNumber()}catch{Zi("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Ds.throwError("this platform does not support BigInt",Et.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?hm||(hm=!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()",Et.errors.UNEXPECTED_ARGUMENT,{}):Ds.throwError("BigNumber.toString does not accept parameters",Et.errors.UNEXPECTED_ARGUMENT,{})),Rt(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof sr)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new sr(ld,uu(e)):e.match(/^-?[0-9]+$/)?new sr(ld,uu(new nh(e))):Ds.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Zi("underflow","BigNumber.from",e),(e>=fm||e<=-fm)&&Zi("overflow","BigNumber.from",e),sr.from(String(e));const r=e;if(typeof r=="bigint")return sr.from(r.toString());if(Ya(r))return sr.from(si(r));if(r)if(r.toHexString){const i=r.toHexString();if(typeof i=="string")return sr.from(i)}else{let i=r._hex;if(i==null&&r.type==="BigNumber"&&(i=r.hex),typeof i=="string"&&(Fi(i)||i[0]==="-"&&Fi(i.substring(1))))return sr.from(i)}return Ds.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function uu(t){if(typeof t!="string")return uu(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&Ds.throwArgumentError("invalid hex","value",t),t=uu(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function yi(t){return sr.from(uu(t))}function Rt(t){const e=sr.from(t).toHexString();return e[0]==="-"?new nh("-"+e.substring(3),16):new nh(e.substring(2),16)}function Zi(t,e,r){const i={fault:t,operation:e};return r!=null&&(i.value=r),Ds.throwError(t,Et.errors.NUMERIC_FAULT,i)}function yA(t){return new nh(t,36).toString(16)}const oi=new Et(um),fu={},lm=sr.from(0),dm=sr.from(-1);function pm(t,e,r,i){const n={fault:e,operation:r};return i!==void 0&&(n.value=i),oi.throwError(t,Et.errors.NUMERIC_FAULT,n)}let hu="0";for(;hu.length<256;)hu+=hu;function dd(t){if(typeof t!="number")try{t=sr.from(t).toNumber()}catch{}return typeof t=="number"&&t>=0&&t<=256&&!(t%1)?"1"+hu.substring(0,t):oi.throwArgumentError("invalid decimal size","decimals",t)}function pd(t,e){e==null&&(e=0);const r=dd(e);t=sr.from(t);const i=t.lt(lm);i&&(t=t.mul(dm));let n=t.mod(r).toString();for(;n.length<r.length-1;)n="0"+n;n=n.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=t.div(r).toString();return r.length===1?t=s:t=s+"."+n,i&&(t="-"+t),t}function Os(t,e){e==null&&(e=0);const r=dd(e);(typeof t!="string"||!t.match(/^-?[0-9.]+$/))&&oi.throwArgumentError("invalid decimal value","value",t);const i=t.substring(0,1)==="-";i&&(t=t.substring(1)),t==="."&&oi.throwArgumentError("missing value","value",t);const n=t.split(".");n.length>2&&oi.throwArgumentError("too many decimal points","value",t);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>r.length-1&&pm("fractional component exceeds decimals","underflow","parseFixed"),a===""&&(a="0");a.length<r.length-1;)a+="0";const u=sr.from(s),h=sr.from(a);let l=u.mul(r).add(h);return i&&(l=l.mul(dm)),l}class Qa{constructor(e,r,i,n){e!==fu&&oi.throwError("cannot use FixedFormat constructor; use FixedFormat.from",Et.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=r,this.width=i,this.decimals=n,this.name=(r?"":"u")+"fixed"+String(i)+"x"+String(n),this._multiplier=dd(n),Object.freeze(this)}static from(e){if(e instanceof Qa)return e;typeof e=="number"&&(e=`fixed128x${e}`);let r=!0,i=128,n=18;if(typeof e=="string"){if(e!=="fixed")if(e==="ufixed")r=!1;else{const s=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);s||oi.throwArgumentError("invalid fixed format","format",e),r=s[1]!=="u",i=parseInt(s[2]),n=parseInt(s[3])}}else if(e){const s=(a,u,h)=>e[a]==null?h:(typeof e[a]!==u&&oi.throwArgumentError("invalid fixed format ("+a+" not "+u+")","format."+a,e[a]),e[a]);r=s("signed","boolean",r),i=s("width","number",i),n=s("decimals","number",n)}return i%8&&oi.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",i),n>80&&oi.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new Qa(fu,r,i,n)}}class zr{constructor(e,r,i,n){e!==fu&&oi.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Et.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=r,this._value=i,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&oi.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const r=Os(this._value,this.format.decimals),i=Os(e._value,e.format.decimals);return zr.fromValue(r.add(i),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const r=Os(this._value,this.format.decimals),i=Os(e._value,e.format.decimals);return zr.fromValue(r.sub(i),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const r=Os(this._value,this.format.decimals),i=Os(e._value,e.format.decimals);return zr.fromValue(r.mul(i).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const r=Os(this._value,this.format.decimals),i=Os(e._value,e.format.decimals);return zr.fromValue(r.mul(this.format._multiplier).div(i),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");e.length===1&&e.push("0");let r=zr.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return this.isNegative()&&i&&(r=r.subUnsafe(gm.toFormat(r.format))),r}ceiling(){const e=this.toString().split(".");e.length===1&&e.push("0");let r=zr.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return!this.isNegative()&&i&&(r=r.addUnsafe(gm.toFormat(r.format))),r}round(e){e==null&&(e=0);const r=this.toString().split(".");if(r.length===1&&r.push("0"),(e<0||e>80||e%1)&&oi.throwArgumentError("invalid decimal count","decimals",e),r[1].length<=e)return this;const i=zr.from("1"+hu.substring(0,e),this.format),n=wA.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&&oi.throwArgumentError("invalid byte width","width",e);const r=sr.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return Qn(r,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return zr.fromString(this._value,e)}static fromValue(e,r,i){return i==null&&r!=null&&!bA(r)&&(i=r,r=null),r==null&&(r=0),i==null&&(i="fixed"),zr.fromString(pd(e,r),Qa.from(i))}static fromString(e,r){r==null&&(r="fixed");const i=Qa.from(r),n=Os(e,i.decimals);!i.signed&&n.lt(lm)&&pm("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=pd(n,i.decimals);return new zr(fu,s,a,i)}static fromBytes(e,r){r==null&&(r="fixed");const i=Qa.from(r);if(dr(e).length>i.width/8)throw new Error("overflow");let n=sr.from(e);i.signed&&(n=n.fromTwos(i.width));const s=n.toTwos((i.signed?0:1)+i.width).toHexString(),a=pd(n,i.decimals);return new zr(fu,s,a,i)}static from(e,r){if(typeof e=="string")return zr.fromString(e,r);if(Ya(e))return zr.fromBytes(e,r);try{return zr.fromValue(e,0,r)}catch(i){if(i.code!==Et.errors.INVALID_ARGUMENT)throw i}return oi.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}}const gm=zr.from(1),wA=zr.from("0.5"),_A="strings/5.7.0",vm=new Et(_A);var sh;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(sh||(sh={}));var Za;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(Za||(Za={}));function EA(t,e,r,i,n){return vm.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)}function mm(t,e,r,i,n){if(t===Za.BAD_PREFIX||t===Za.UNEXPECTED_CONTINUE){let s=0;for(let a=e+1;a<r.length&&r[a]>>6===2;a++)s++;return s}return t===Za.OVERRUN?r.length-e-1:0}function AA(t,e,r,i,n){return t===Za.OVERLONG?(i.push(n),0):(i.push(65533),mm(t,e,r))}Object.freeze({error:EA,ignore:mm,replace:AA});function gd(t,e=sh.current){e!=sh.current&&(vm.checkNormalize(),t=t.normalize(e));let r=[];for(let i=0;i<t.length;i++){const n=t.charCodeAt(i);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(n&63|128);else if((n&64512)==55296){i++;const s=t.charCodeAt(i);if(i>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const a=65536+((n&1023)<<10)+(s&1023);r.push(a>>18|240),r.push(a>>12&63|128),r.push(a>>6&63|128),r.push(a&63|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(n&63|128)}return dr(r)}function xA(t){if(t.length%4!==0)throw new Error("bad data");let e=[];for(let r=0;r<t.length;r+=4)e.push(parseInt(t.substring(r,r+4),16));return e}function vd(t,e){e||(e=function(n){return[parseInt(n,16)]});let r=0,i={};return t.split(",").forEach(n=>{let s=n.split(":");r+=parseInt(s[0],16),i[r]=e(s[1])}),i}function bm(t){let e=0;return t.split(",").map(r=>{let i=r.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}})}bm("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(t=>parseInt(t,16)),vd("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"),vd("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"),vd("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",xA),bm("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 ym="hash/5.7.0";function SA(t){t=atob(t);const e=[];for(let r=0;r<t.length;r++)e.push(t.charCodeAt(r));return dr(e)}function wm(t,e){e==null&&(e=1);const r=[],i=r.forEach,n=function(s,a){i.call(s,function(u){a>0&&Array.isArray(u)?n(u,a-1):r.push(u)})};return n(t,e),r}function IA(t){const e={};for(let r=0;r<t.length;r++){const i=t[r];e[i[0]]=i[1]}return e}function MA(t){let e=0;function r(){return t[e++]<<8|t[e++]}let i=r(),n=1,s=[0,1];for(let k=1;k<i;k++)s.push(n+=r());let a=r(),u=e;e+=a;let h=0,l=0;function b(){return h==0&&(l=l<<8|t[e++],h=8),l>>--h&1}const w=31,I=Math.pow(2,w),S=I>>>1,D=S>>1,T=I-1;let q=0;for(let k=0;k<w;k++)q=q<<1|b();let K=[],F=0,W=I;for(;;){let k=Math.floor(((q-F+1)*n-1)/W),H=0,_=i;for(;_-H>1;){let ie=H+_>>>1;k<s[ie]?_=ie:H=ie}if(H==0)break;K.push(H);let B=F+Math.floor(W*s[H]/n),ee=F+Math.floor(W*s[H+1]/n)-1;for(;!((B^ee)&S);)q=q<<1&T|b(),B=B<<1&T,ee=ee<<1&T|1;for(;B&~ee&D;)q=q&S|q<<1&T>>>1|b(),B=B<<1^S,ee=(ee^S)<<1|S|1;F=B,W=1+ee-B}let R=i-4;return K.map(k=>{switch(k-R){case 3:return R+65792+(t[u++]<<16|t[u++]<<8|t[u++]);case 2:return R+256+(t[u++]<<8|t[u++]);case 1:return R+t[u++];default:return k-1}})}function CA(t){let e=0;return()=>t[e++]}function DA(t){return CA(MA(t))}function OA(t){return t&1?~t>>1:t>>1}function PA(t,e){let r=Array(t);for(let i=0;i<t;i++)r[i]=1+e();return r}function _m(t,e){let r=Array(t);for(let i=0,n=-1;i<t;i++)r[i]=n+=1+e();return r}function $A(t,e){let r=Array(t);for(let i=0,n=0;i<t;i++)r[i]=n+=OA(e());return r}function oh(t,e){let r=_m(t(),t),i=t(),n=_m(i,t),s=PA(i,t);for(let a=0;a<i;a++)for(let u=0;u<s[a];u++)r.push(n[a]+u);return e?r.map(a=>e[a]):r}function RA(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(TA(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(LA(r,t))}return IA(wm(e))}function NA(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function Em(t,e,r){let i=Array(t).fill(void 0).map(()=>[]);for(let n=0;n<e;n++)$A(t,r).forEach((s,a)=>i[a].push(s));return i}function TA(t,e){let r=1+e(),i=e(),n=NA(e),s=Em(n.length,1+t,e);return wm(s.map((a,u)=>{const h=a[0],l=a.slice(1);return Array(n[u]).fill(void 0).map((b,w)=>{let I=w*i;return[h+w*r,l.map(S=>S+I)]})}))}function LA(t,e){let r=1+e();return Em(r,1+t,e).map(i=>[i[0],i.slice(1)])}function BA(t){let e=oh(t).sort((i,n)=>i-n);return r();function r(){let i=[];for(;;){let l=oh(t,e);if(l.length==0)break;i.push({set:new Set(l),node:r()})}i.sort((l,b)=>b.set.size-l.set.size);let n=t(),s=n%3;n=n/3|0;let a=!!(n&1);n>>=1;let u=n==1,h=n==2;return{branches:i,valid:s,fe0f:a,save:u,check:h}}}function FA(){return DA(SA("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 ah=FA();new Set(oh(ah)),new Set(oh(ah)),RA(ah),BA(ah),new Et(ym),new Uint8Array(32).fill(0);const UA=`Ethereum Signed Message:
22
- `;function Am(t){return typeof t=="string"&&(t=gd(t)),hd(lA([gd(UA),gd(String(t.length)),t]))}const kA="rlp/5.7.0";new Et(kA);const qA="address/5.7.0",lu=new Et(qA);function xm(t){Fi(t,20)||lu.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let n=0;n<40;n++)r[n]=e[n].charCodeAt(0);const i=dr(hd(r));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 jA=9007199254740991;function zA(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const md={};for(let t=0;t<10;t++)md[String(t)]=String(t);for(let t=0;t<26;t++)md[String.fromCharCode(65+t)]=String(10+t);const Sm=Math.floor(zA(jA));function HA(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(i=>md[i]).join("");for(;e.length>=Sm;){let i=e.substring(0,Sm);e=parseInt(i,10)%97+e.substring(i.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function KA(t){let e=null;if(typeof t!="string"&&lu.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=xm(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&lu.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==HA(t)&&lu.throwArgumentError("bad icap checksum","address",t),e=yA(t.substring(4));e.length<40;)e="0"+e;e=xm("0x"+e)}else lu.throwArgumentError("invalid address","address",t);return e}const WA="properties/5.7.0";new Et(WA);function du(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}new Et(ym),new Uint8Array(32).fill(0),sr.from(-1);const VA=sr.from(0),GA=sr.from(1);sr.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Qn(GA.toHexString(),32),Qn(VA.toHexString(),32);var Zn={},Nt={},pu=Im;function Im(t,e){if(!t)throw new Error(e||"Assertion failed")}Im.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var bd={exports:{}};typeof Object.create=="function"?bd.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:bd.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}};var JA=pu,YA=bd.exports;Nt.inherits=YA;function QA(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function ZA(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(var i=0,n=0;n<t.length;n++){var s=t.charCodeAt(n);s<128?r[i++]=s:s<2048?(r[i++]=s>>6|192,r[i++]=s&63|128):QA(t,n)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++n)&1023),r[i++]=s>>18|240,r[i++]=s>>12&63|128,r[i++]=s>>6&63|128,r[i++]=s&63|128):(r[i++]=s>>12|224,r[i++]=s>>6&63|128,r[i++]=s&63|128)}else for(n=0;n<t.length;n++)r[n]=t[n]|0;return r}Nt.toArray=ZA;function XA(t){for(var e="",r=0;r<t.length;r++)e+=Cm(t[r].toString(16));return e}Nt.toHex=XA;function Mm(t){var e=t>>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}Nt.htonl=Mm;function ex(t,e){for(var r="",i=0;i<t.length;i++){var n=t[i];e==="little"&&(n=Mm(n)),r+=Dm(n.toString(16))}return r}Nt.toHex32=ex;function Cm(t){return t.length===1?"0"+t:t}Nt.zero2=Cm;function Dm(t){return t.length===7?"0"+t:t.length===6?"00"+t:t.length===5?"000"+t:t.length===4?"0000"+t:t.length===3?"00000"+t:t.length===2?"000000"+t:t.length===1?"0000000"+t:t}Nt.zero8=Dm;function tx(t,e,r,i){var n=r-e;JA(n%4===0);for(var s=new Array(n/4),a=0,u=e;a<s.length;a++,u+=4){var h;i==="big"?h=t[u]<<24|t[u+1]<<16|t[u+2]<<8|t[u+3]:h=t[u+3]<<24|t[u+2]<<16|t[u+1]<<8|t[u],s[a]=h>>>0}return s}Nt.join32=tx;function rx(t,e){for(var r=new Array(t.length*4),i=0,n=0;i<t.length;i++,n+=4){var s=t[i];e==="big"?(r[n]=s>>>24,r[n+1]=s>>>16&255,r[n+2]=s>>>8&255,r[n+3]=s&255):(r[n+3]=s>>>24,r[n+2]=s>>>16&255,r[n+1]=s>>>8&255,r[n]=s&255)}return r}Nt.split32=rx;function ix(t,e){return t>>>e|t<<32-e}Nt.rotr32=ix;function nx(t,e){return t<<e|t>>>32-e}Nt.rotl32=nx;function sx(t,e){return t+e>>>0}Nt.sum32=sx;function ox(t,e,r){return t+e+r>>>0}Nt.sum32_3=ox;function ax(t,e,r,i){return t+e+r+i>>>0}Nt.sum32_4=ax;function cx(t,e,r,i,n){return t+e+r+i+n>>>0}Nt.sum32_5=cx;function ux(t,e,r,i){var n=t[e],s=t[e+1],a=i+s>>>0,u=(a<i?1:0)+r+n;t[e]=u>>>0,t[e+1]=a}Nt.sum64=ux;function fx(t,e,r,i){var n=e+i>>>0,s=(n<e?1:0)+t+r;return s>>>0}Nt.sum64_hi=fx;function hx(t,e,r,i){var n=e+i;return n>>>0}Nt.sum64_lo=hx;function lx(t,e,r,i,n,s,a,u){var h=0,l=e;l=l+i>>>0,h+=l<e?1:0,l=l+s>>>0,h+=l<s?1:0,l=l+u>>>0,h+=l<u?1:0;var b=t+r+n+a+h;return b>>>0}Nt.sum64_4_hi=lx;function dx(t,e,r,i,n,s,a,u){var h=e+i+s+u;return h>>>0}Nt.sum64_4_lo=dx;function px(t,e,r,i,n,s,a,u,h,l){var b=0,w=e;w=w+i>>>0,b+=w<e?1:0,w=w+s>>>0,b+=w<s?1:0,w=w+u>>>0,b+=w<u?1:0,w=w+l>>>0,b+=w<l?1:0;var I=t+r+n+a+h+b;return I>>>0}Nt.sum64_5_hi=px;function gx(t,e,r,i,n,s,a,u,h,l){var b=e+i+s+u+l;return b>>>0}Nt.sum64_5_lo=gx;function vx(t,e,r){var i=e<<32-r|t>>>r;return i>>>0}Nt.rotr64_hi=vx;function mx(t,e,r){var i=t<<32-r|e>>>r;return i>>>0}Nt.rotr64_lo=mx;function bx(t,e,r){return t>>>r}Nt.shr64_hi=bx;function yx(t,e,r){var i=t<<32-r|e>>>r;return i>>>0}Nt.shr64_lo=yx;var Xa={},Om=Nt,wx=pu;function ch(){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}Xa.BlockHash=ch,ch.prototype.update=function(t,e){if(t=Om.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var r=t.length%this._delta8;this.pending=t.slice(t.length-r,t.length),this.pending.length===0&&(this.pending=null),t=Om.join32(t,0,t.length-r,this.endian);for(var i=0;i<t.length;i+=this._delta32)this._update(t,i,i+this._delta32)}return this},ch.prototype.digest=function(t){return this.update(this._pad()),wx(this.pending===null),this._digest(t)},ch.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,r=e-(t+this.padLength)%e,i=new Array(r+this.padLength);i[0]=128;for(var n=1;n<r;n++)i[n]=0;if(t<<=3,this.endian==="big"){for(var s=8;s<this.padLength;s++)i[n++]=0;i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=t>>>24&255,i[n++]=t>>>16&255,i[n++]=t>>>8&255,i[n++]=t&255}else for(i[n++]=t&255,i[n++]=t>>>8&255,i[n++]=t>>>16&255,i[n++]=t>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,s=8;s<this.padLength;s++)i[n++]=0;return i};var ec={},Xn={},_x=Nt,es=_x.rotr32;function Ex(t,e,r,i){if(t===0)return Pm(e,r,i);if(t===1||t===3)return Rm(e,r,i);if(t===2)return $m(e,r,i)}Xn.ft_1=Ex;function Pm(t,e,r){return t&e^~t&r}Xn.ch32=Pm;function $m(t,e,r){return t&e^t&r^e&r}Xn.maj32=$m;function Rm(t,e,r){return t^e^r}Xn.p32=Rm;function Ax(t){return es(t,2)^es(t,13)^es(t,22)}Xn.s0_256=Ax;function xx(t){return es(t,6)^es(t,11)^es(t,25)}Xn.s1_256=xx;function Sx(t){return es(t,7)^es(t,18)^t>>>3}Xn.g0_256=Sx;function Ix(t){return es(t,17)^es(t,19)^t>>>10}Xn.g1_256=Ix;var tc=Nt,Mx=Xa,Cx=Xn,yd=tc.rotl32,gu=tc.sum32,Dx=tc.sum32_5,Ox=Cx.ft_1,Nm=Mx.BlockHash,Px=[1518500249,1859775393,2400959708,3395469782];function ts(){if(!(this instanceof ts))return new ts;Nm.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}tc.inherits(ts,Nm);var $x=ts;ts.blockSize=512,ts.outSize=160,ts.hmacStrength=80,ts.padLength=64,ts.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i<r.length;i++)r[i]=yd(r[i-3]^r[i-8]^r[i-14]^r[i-16],1);var n=this.h[0],s=this.h[1],a=this.h[2],u=this.h[3],h=this.h[4];for(i=0;i<r.length;i++){var l=~~(i/20),b=Dx(yd(n,5),Ox(l,s,a,u),h,r[i],Px[l]);h=u,u=a,a=yd(s,30),s=n,n=b}this.h[0]=gu(this.h[0],n),this.h[1]=gu(this.h[1],s),this.h[2]=gu(this.h[2],a),this.h[3]=gu(this.h[3],u),this.h[4]=gu(this.h[4],h)},ts.prototype._digest=function(t){return t==="hex"?tc.toHex32(this.h,"big"):tc.split32(this.h,"big")};var rc=Nt,Rx=Xa,ic=Xn,Nx=pu,_n=rc.sum32,Tx=rc.sum32_4,Lx=rc.sum32_5,Bx=ic.ch32,Fx=ic.maj32,Ux=ic.s0_256,kx=ic.s1_256,qx=ic.g0_256,jx=ic.g1_256,Tm=Rx.BlockHash,zx=[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 rs(){if(!(this instanceof rs))return new rs;Tm.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=zx,this.W=new Array(64)}rc.inherits(rs,Tm);var Lm=rs;rs.blockSize=512,rs.outSize=256,rs.hmacStrength=192,rs.padLength=64,rs.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i<r.length;i++)r[i]=Tx(jx(r[i-2]),r[i-7],qx(r[i-15]),r[i-16]);var n=this.h[0],s=this.h[1],a=this.h[2],u=this.h[3],h=this.h[4],l=this.h[5],b=this.h[6],w=this.h[7];for(Nx(this.k.length===r.length),i=0;i<r.length;i++){var I=Lx(w,kx(h),Bx(h,l,b),this.k[i],r[i]),S=_n(Ux(n),Fx(n,s,a));w=b,b=l,l=h,h=_n(u,I),u=a,a=s,s=n,n=_n(I,S)}this.h[0]=_n(this.h[0],n),this.h[1]=_n(this.h[1],s),this.h[2]=_n(this.h[2],a),this.h[3]=_n(this.h[3],u),this.h[4]=_n(this.h[4],h),this.h[5]=_n(this.h[5],l),this.h[6]=_n(this.h[6],b),this.h[7]=_n(this.h[7],w)},rs.prototype._digest=function(t){return t==="hex"?rc.toHex32(this.h,"big"):rc.split32(this.h,"big")};var wd=Nt,Bm=Lm;function Ps(){if(!(this instanceof Ps))return new Ps;Bm.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}wd.inherits(Ps,Bm);var Hx=Ps;Ps.blockSize=512,Ps.outSize=224,Ps.hmacStrength=192,Ps.padLength=64,Ps.prototype._digest=function(t){return t==="hex"?wd.toHex32(this.h.slice(0,7),"big"):wd.split32(this.h.slice(0,7),"big")};var wi=Nt,Kx=Xa,Wx=pu,is=wi.rotr64_hi,ns=wi.rotr64_lo,Fm=wi.shr64_hi,Um=wi.shr64_lo,no=wi.sum64,_d=wi.sum64_hi,Ed=wi.sum64_lo,Vx=wi.sum64_4_hi,Gx=wi.sum64_4_lo,Jx=wi.sum64_5_hi,Yx=wi.sum64_5_lo,km=Kx.BlockHash,Qx=[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 En(){if(!(this instanceof En))return new En;km.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=Qx,this.W=new Array(160)}wi.inherits(En,km);var qm=En;En.blockSize=1024,En.outSize=512,En.hmacStrength=192,En.padLength=128,En.prototype._prepareBlock=function(t,e){for(var r=this.W,i=0;i<32;i++)r[i]=t[e+i];for(;i<r.length;i+=2){var n=cS(r[i-4],r[i-3]),s=uS(r[i-4],r[i-3]),a=r[i-14],u=r[i-13],h=oS(r[i-30],r[i-29]),l=aS(r[i-30],r[i-29]),b=r[i-32],w=r[i-31];r[i]=Vx(n,s,a,u,h,l,b,w),r[i+1]=Gx(n,s,a,u,h,l,b,w)}},En.prototype._update=function(t,e){this._prepareBlock(t,e);var r=this.W,i=this.h[0],n=this.h[1],s=this.h[2],a=this.h[3],u=this.h[4],h=this.h[5],l=this.h[6],b=this.h[7],w=this.h[8],I=this.h[9],S=this.h[10],D=this.h[11],T=this.h[12],q=this.h[13],K=this.h[14],F=this.h[15];Wx(this.k.length===r.length);for(var W=0;W<r.length;W+=2){var R=K,k=F,H=nS(w,I),_=sS(w,I),B=Zx(w,I,S,D,T),ee=Xx(w,I,S,D,T,q),ie=this.k[W],L=this.k[W+1],y=r[W],f=r[W+1],d=Jx(R,k,H,_,B,ee,ie,L,y,f),v=Yx(R,k,H,_,B,ee,ie,L,y,f);R=rS(i,n),k=iS(i,n),H=eS(i,n,s,a,u),_=tS(i,n,s,a,u,h);var E=_d(R,k,H,_),C=Ed(R,k,H,_);K=T,F=q,T=S,q=D,S=w,D=I,w=_d(l,b,d,v),I=Ed(b,b,d,v),l=u,b=h,u=s,h=a,s=i,a=n,i=_d(d,v,E,C),n=Ed(d,v,E,C)}no(this.h,0,i,n),no(this.h,2,s,a),no(this.h,4,u,h),no(this.h,6,l,b),no(this.h,8,w,I),no(this.h,10,S,D),no(this.h,12,T,q),no(this.h,14,K,F)},En.prototype._digest=function(t){return t==="hex"?wi.toHex32(this.h,"big"):wi.split32(this.h,"big")};function Zx(t,e,r,i,n){var s=t&r^~t&n;return s<0&&(s+=4294967296),s}function Xx(t,e,r,i,n,s){var a=e&i^~e&s;return a<0&&(a+=4294967296),a}function eS(t,e,r,i,n){var s=t&r^t&n^r&n;return s<0&&(s+=4294967296),s}function tS(t,e,r,i,n,s){var a=e&i^e&s^i&s;return a<0&&(a+=4294967296),a}function rS(t,e){var r=is(t,e,28),i=is(e,t,2),n=is(e,t,7),s=r^i^n;return s<0&&(s+=4294967296),s}function iS(t,e){var r=ns(t,e,28),i=ns(e,t,2),n=ns(e,t,7),s=r^i^n;return s<0&&(s+=4294967296),s}function nS(t,e){var r=is(t,e,14),i=is(t,e,18),n=is(e,t,9),s=r^i^n;return s<0&&(s+=4294967296),s}function sS(t,e){var r=ns(t,e,14),i=ns(t,e,18),n=ns(e,t,9),s=r^i^n;return s<0&&(s+=4294967296),s}function oS(t,e){var r=is(t,e,1),i=is(t,e,8),n=Fm(t,e,7),s=r^i^n;return s<0&&(s+=4294967296),s}function aS(t,e){var r=ns(t,e,1),i=ns(t,e,8),n=Um(t,e,7),s=r^i^n;return s<0&&(s+=4294967296),s}function cS(t,e){var r=is(t,e,19),i=is(e,t,29),n=Fm(t,e,6),s=r^i^n;return s<0&&(s+=4294967296),s}function uS(t,e){var r=ns(t,e,19),i=ns(e,t,29),n=Um(t,e,6),s=r^i^n;return s<0&&(s+=4294967296),s}var Ad=Nt,jm=qm;function $s(){if(!(this instanceof $s))return new $s;jm.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Ad.inherits($s,jm);var fS=$s;$s.blockSize=1024,$s.outSize=384,$s.hmacStrength=192,$s.padLength=128,$s.prototype._digest=function(t){return t==="hex"?Ad.toHex32(this.h.slice(0,12),"big"):Ad.split32(this.h.slice(0,12),"big")},ec.sha1=$x,ec.sha224=Hx,ec.sha256=Lm,ec.sha384=fS,ec.sha512=qm;var zm={},Ko=Nt,hS=Xa,uh=Ko.rotl32,Hm=Ko.sum32,vu=Ko.sum32_3,Km=Ko.sum32_4,Wm=hS.BlockHash;function ss(){if(!(this instanceof ss))return new ss;Wm.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Ko.inherits(ss,Wm),zm.ripemd160=ss,ss.blockSize=512,ss.outSize=160,ss.hmacStrength=192,ss.padLength=64,ss.prototype._update=function(t,e){for(var r=this.h[0],i=this.h[1],n=this.h[2],s=this.h[3],a=this.h[4],u=r,h=i,l=n,b=s,w=a,I=0;I<80;I++){var S=Hm(uh(Km(r,Vm(I,i,n,s),t[pS[I]+e],lS(I)),vS[I]),a);r=a,a=s,s=uh(n,10),n=i,i=S,S=Hm(uh(Km(u,Vm(79-I,h,l,b),t[gS[I]+e],dS(I)),mS[I]),w),u=w,w=b,b=uh(l,10),l=h,h=S}S=vu(this.h[1],n,b),this.h[1]=vu(this.h[2],s,w),this.h[2]=vu(this.h[3],a,u),this.h[3]=vu(this.h[4],r,h),this.h[4]=vu(this.h[0],i,l),this.h[0]=S},ss.prototype._digest=function(t){return t==="hex"?Ko.toHex32(this.h,"little"):Ko.split32(this.h,"little")};function Vm(t,e,r,i){return t<=15?e^r^i:t<=31?e&r|~e&i:t<=47?(e|~r)^i:t<=63?e&i|r&~i:e^(r|~i)}function lS(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function dS(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}var pS=[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],gS=[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],vS=[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],mS=[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],bS=Nt,yS=pu;function nc(t,e,r){if(!(this instanceof nc))return new nc(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(bS.toArray(e,r))}var wS=nc;nc.prototype._init=function(t){t.length>this.blockSize&&(t=new this.Hash().update(t).digest()),yS(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=new this.Hash().update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=new this.Hash().update(t)},nc.prototype.update=function(t,e){return this.inner.update(t,e),this},nc.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)},function(t){var e=t;e.utils=Nt,e.common=Xa,e.sha=ec,e.ripemd=zm,e.hmac=wS,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}(Zn);function sc(t,e,r){return r={path:e,exports:{},require:function(i,n){return _S(i,n??r.path)}},t(r,r.exports),r.exports}function _S(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var xd=Gm;function Gm(t,e){if(!t)throw new Error(e||"Assertion failed")}Gm.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var An=sc(function(t,e){var r=e;function i(a,u){if(Array.isArray(a))return a.slice();if(!a)return[];var h=[];if(typeof a!="string"){for(var l=0;l<a.length;l++)h[l]=a[l]|0;return h}if(u==="hex"){a=a.replace(/[^a-z0-9]+/ig,""),a.length%2!==0&&(a="0"+a);for(var l=0;l<a.length;l+=2)h.push(parseInt(a[l]+a[l+1],16))}else for(var l=0;l<a.length;l++){var b=a.charCodeAt(l),w=b>>8,I=b&255;w?h.push(w,I):h.push(I)}return h}r.toArray=i;function n(a){return a.length===1?"0"+a:a}r.zero2=n;function s(a){for(var u="",h=0;h<a.length;h++)u+=n(a[h].toString(16));return u}r.toHex=s,r.encode=function(a,u){return u==="hex"?s(a):a}}),Ui=sc(function(t,e){var r=e;r.assert=xd,r.toArray=An.toArray,r.zero2=An.zero2,r.toHex=An.toHex,r.encode=An.encode;function i(h,l,b){var w=new Array(Math.max(h.bitLength(),b)+1);w.fill(0);for(var I=1<<l+1,S=h.clone(),D=0;D<w.length;D++){var T,q=S.andln(I-1);S.isOdd()?(q>(I>>1)-1?T=(I>>1)-q:T=q,S.isubn(T)):T=0,w[D]=T,S.iushrn(1)}return w}r.getNAF=i;function n(h,l){var b=[[],[]];h=h.clone(),l=l.clone();for(var w=0,I=0,S;h.cmpn(-w)>0||l.cmpn(-I)>0;){var D=h.andln(3)+w&3,T=l.andln(3)+I&3;D===3&&(D=-1),T===3&&(T=-1);var q;D&1?(S=h.andln(7)+w&7,(S===3||S===5)&&T===2?q=-D:q=D):q=0,b[0].push(q);var K;T&1?(S=l.andln(7)+I&7,(S===3||S===5)&&D===2?K=-T:K=T):K=0,b[1].push(K),2*w===q+1&&(w=1-w),2*I===K+1&&(I=1-I),h.iushrn(1),l.iushrn(1)}return b}r.getJSF=n;function s(h,l,b){var w="_"+l;h.prototype[l]=function(){return this[w]!==void 0?this[w]:this[w]=b.call(this)}}r.cachedProperty=s;function a(h){return typeof h=="string"?r.toArray(h,"hex"):h}r.parseBytes=a;function u(h){return new mt(h,"hex","le")}r.intFromLE=u}),fh=Ui.getNAF,ES=Ui.getJSF,hh=Ui.assert;function so(t,e){this.type=t,this.p=new mt(e.p,16),this.red=e.prime?mt.red(e.prime):mt.mont(this.p),this.zero=new mt(0).toRed(this.red),this.one=new mt(1).toRed(this.red),this.two=new mt(2).toRed(this.red),this.n=e.n&&new mt(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Wo=so;so.prototype.point=function(){throw new Error("Not implemented")},so.prototype.validate=function(){throw new Error("Not implemented")},so.prototype._fixedNafMul=function(t,e){hh(t.precomputed);var r=t._getDoubles(),i=fh(e,1,this._bitLength),n=(1<<r.step+1)-(r.step%2===0?2:1);n/=3;var s=[],a,u;for(a=0;a<i.length;a+=r.step){u=0;for(var h=a+r.step-1;h>=a;h--)u=(u<<1)+i[h];s.push(u)}for(var l=this.jpoint(null,null,null),b=this.jpoint(null,null,null),w=n;w>0;w--){for(a=0;a<s.length;a++)u=s[a],u===w?b=b.mixedAdd(r.points[a]):u===-w&&(b=b.mixedAdd(r.points[a].neg()));l=l.add(b)}return l.toP()},so.prototype._wnafMul=function(t,e){var r=4,i=t._getNAFPoints(r);r=i.wnd;for(var n=i.points,s=fh(e,r,this._bitLength),a=this.jpoint(null,null,null),u=s.length-1;u>=0;u--){for(var h=0;u>=0&&s[u]===0;u--)h++;if(u>=0&&h++,a=a.dblp(h),u<0)break;var l=s[u];hh(l!==0),t.type==="affine"?l>0?a=a.mixedAdd(n[l-1>>1]):a=a.mixedAdd(n[-l-1>>1].neg()):l>0?a=a.add(n[l-1>>1]):a=a.add(n[-l-1>>1].neg())}return t.type==="affine"?a.toP():a},so.prototype._wnafMulAdd=function(t,e,r,i,n){var s=this._wnafT1,a=this._wnafT2,u=this._wnafT3,h=0,l,b,w;for(l=0;l<i;l++){w=e[l];var I=w._getNAFPoints(t);s[l]=I.wnd,a[l]=I.points}for(l=i-1;l>=1;l-=2){var S=l-1,D=l;if(s[S]!==1||s[D]!==1){u[S]=fh(r[S],s[S],this._bitLength),u[D]=fh(r[D],s[D],this._bitLength),h=Math.max(u[S].length,h),h=Math.max(u[D].length,h);continue}var T=[e[S],null,null,e[D]];e[S].y.cmp(e[D].y)===0?(T[1]=e[S].add(e[D]),T[2]=e[S].toJ().mixedAdd(e[D].neg())):e[S].y.cmp(e[D].y.redNeg())===0?(T[1]=e[S].toJ().mixedAdd(e[D]),T[2]=e[S].add(e[D].neg())):(T[1]=e[S].toJ().mixedAdd(e[D]),T[2]=e[S].toJ().mixedAdd(e[D].neg()));var q=[-3,-1,-5,-7,0,7,5,1,3],K=ES(r[S],r[D]);for(h=Math.max(K[0].length,h),u[S]=new Array(h),u[D]=new Array(h),b=0;b<h;b++){var F=K[0][b]|0,W=K[1][b]|0;u[S][b]=q[(F+1)*3+(W+1)],u[D][b]=0,a[S]=T}}var R=this.jpoint(null,null,null),k=this._wnafT4;for(l=h;l>=0;l--){for(var H=0;l>=0;){var _=!0;for(b=0;b<i;b++)k[b]=u[b][l]|0,k[b]!==0&&(_=!1);if(!_)break;H++,l--}if(l>=0&&H++,R=R.dblp(H),l<0)break;for(b=0;b<i;b++){var B=k[b];B!==0&&(B>0?w=a[b][B-1>>1]:B<0&&(w=a[b][-B-1>>1].neg()),w.type==="affine"?R=R.mixedAdd(w):R=R.add(w))}}for(l=0;l<i;l++)a[l]=null;return n?R:R.toP()};function Xi(t,e){this.curve=t,this.type=e,this.precomputed=null}so.BasePoint=Xi,Xi.prototype.eq=function(){throw new Error("Not implemented")},Xi.prototype.validate=function(){return this.curve.validate(this)},so.prototype.decodePoint=function(t,e){t=Ui.toArray(t,e);var r=this.p.byteLength();if((t[0]===4||t[0]===6||t[0]===7)&&t.length-1===2*r){t[0]===6?hh(t[t.length-1]%2===0):t[0]===7&&hh(t[t.length-1]%2===1);var i=this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));return i}else if((t[0]===2||t[0]===3)&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),t[0]===3);throw new Error("Unknown point format")},Xi.prototype.encodeCompressed=function(t){return this.encode(t,!0)},Xi.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},Xi.prototype.encode=function(t,e){return Ui.encode(this._encode(e),t)},Xi.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},Xi.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return e?e.points.length>=Math.ceil((t.bitLength()+1)/e.step):!1},Xi.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n<e;n+=t){for(var s=0;s<t;s++)i=i.dbl();r.push(i)}return{step:t,points:r}},Xi.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,i=r===1?null:this.dbl(),n=1;n<r;n++)e[n]=e[n-1].add(i);return{wnd:t,points:e}},Xi.prototype._getBeta=function(){return null},Xi.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e};var Sd=sc(function(t){typeof Object.create=="function"?t.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}}}),AS=Ui.assert;function en(t){Wo.call(this,"short",t),this.a=new mt(t.a,16).toRed(this.red),this.b=new mt(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Sd(en,Wo);var xS=en;en.prototype._getEndomorphism=function(t){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var e,r;if(t.beta)e=new mt(t.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);e=i[0].cmp(i[1])<0?i[0]:i[1],e=e.toRed(this.red)}if(t.lambda)r=new mt(t.lambda,16);else{var n=this._getEndoRoots(this.n);this.g.mul(n[0]).x.cmp(this.g.x.redMul(e))===0?r=n[0]:(r=n[1],AS(this.g.mul(r).x.cmp(this.g.x.redMul(e))===0))}var s;return t.basis?s=t.basis.map(function(a){return{a:new mt(a.a,16),b:new mt(a.b,16)}}):s=this._getEndoBasis(r),{beta:e,lambda:r,basis:s}}},en.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:mt.mont(t),r=new mt(2).toRed(e).redInvm(),i=r.redNeg(),n=new mt(3).toRed(e).redNeg().redSqrt().redMul(r),s=i.redAdd(n).fromRed(),a=i.redSub(n).fromRed();return[s,a]},en.prototype._getEndoBasis=function(t){for(var e=this.n.ushrn(Math.floor(this.n.bitLength()/2)),r=t,i=this.n.clone(),n=new mt(1),s=new mt(0),a=new mt(0),u=new mt(1),h,l,b,w,I,S,D,T=0,q,K;r.cmpn(0)!==0;){var F=i.div(r);q=i.sub(F.mul(r)),K=a.sub(F.mul(n));var W=u.sub(F.mul(s));if(!b&&q.cmp(e)<0)h=D.neg(),l=n,b=q.neg(),w=K;else if(b&&++T===2)break;D=q,i=r,r=q,a=n,n=K,u=s,s=W}I=q.neg(),S=K;var R=b.sqr().add(w.sqr()),k=I.sqr().add(S.sqr());return k.cmp(R)>=0&&(I=h,S=l),b.negative&&(b=b.neg(),w=w.neg()),I.negative&&(I=I.neg(),S=S.neg()),[{a:b,b:w},{a:I,b:S}]},en.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],i=e[1],n=i.b.mul(t).divRound(this.n),s=r.b.neg().mul(t).divRound(this.n),a=n.mul(r.a),u=s.mul(i.a),h=n.mul(r.b),l=s.mul(i.b),b=t.sub(a).sub(u),w=h.add(l).neg();return{k1:b,k2:w}},en.prototype.pointFromX=function(t,e){t=new mt(t,16),t.red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(i.redSqr().redSub(r).cmp(this.zero)!==0)throw new Error("invalid point");var n=i.fromRed().isOdd();return(e&&!n||!e&&n)&&(i=i.redNeg()),this.point(t,i)},en.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,i=this.a.redMul(e),n=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return r.redSqr().redISub(n).cmpn(0)===0},en.prototype._endoWnafMulAdd=function(t,e,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,s=0;s<t.length;s++){var a=this._endoSplit(e[s]),u=t[s],h=u._getBeta();a.k1.negative&&(a.k1.ineg(),u=u.neg(!0)),a.k2.negative&&(a.k2.ineg(),h=h.neg(!0)),i[s*2]=u,i[s*2+1]=h,n[s*2]=a.k1,n[s*2+1]=a.k2}for(var l=this._wnafMulAdd(1,i,n,s*2,r),b=0;b<s*2;b++)i[b]=null,n[b]=null;return l};function Nr(t,e,r,i){Wo.BasePoint.call(this,t,"affine"),e===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new mt(e,16),this.y=new mt(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}Sd(Nr,Wo.BasePoint),en.prototype.point=function(t,e,r){return new Nr(this,t,e,r)},en.prototype.pointFromJSON=function(t,e){return Nr.fromJSON(this,t,e)},Nr.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,i=function(n){return r.point(n.x.redMul(r.endo.beta),n.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(i)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(i)}}}return e}},Nr.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]},Nr.fromJSON=function(t,e,r){typeof e=="string"&&(e=JSON.parse(e));var i=t.point(e[0],e[1],r);if(!e[2])return i;function n(a){return t.point(a[0],a[1],r)}var s=e[2];return i.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[i].concat(s.doubles.points.map(n))},naf:s.naf&&{wnd:s.naf.wnd,points:[i].concat(s.naf.points.map(n))}},i},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)+">"},Nr.prototype.isInfinity=function(){return this.inf},Nr.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(this.x.cmp(t.x)===0)return this.curve.point(null,null);var e=this.y.redSub(t.y);e.cmpn(0)!==0&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),i=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},Nr.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(t.cmpn(0)===0)return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),i=t.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(i),s=n.redSqr().redISub(this.x.redAdd(this.x)),a=n.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,a)},Nr.prototype.getX=function(){return this.x.fromRed()},Nr.prototype.getY=function(){return this.y.fromRed()},Nr.prototype.mul=function(t){return t=new mt(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},Nr.prototype.mulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},Nr.prototype.jmulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},Nr.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||this.x.cmp(t.x)===0&&this.y.cmp(t.y)===0)},Nr.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,i=function(n){return n.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return e},Nr.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t};function Hr(t,e,r,i){Wo.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new mt(0)):(this.x=new mt(e,16),this.y=new mt(r,16),this.z=new mt(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}Sd(Hr,Wo.BasePoint),en.prototype.jpoint=function(t,e,r){return new Hr(this,t,e,r)},Hr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),i=this.y.redMul(e).redMul(t);return this.curve.point(r,i)},Hr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Hr.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(e),n=t.x.redMul(r),s=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(r.redMul(this.z)),u=i.redSub(n),h=s.redSub(a);if(u.cmpn(0)===0)return h.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=u.redSqr(),b=l.redMul(u),w=i.redMul(l),I=h.redSqr().redIAdd(b).redISub(w).redISub(w),S=h.redMul(w.redISub(I)).redISub(s.redMul(b)),D=this.z.redMul(t.z).redMul(u);return this.curve.jpoint(I,S,D)},Hr.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,i=t.x.redMul(e),n=this.y,s=t.y.redMul(e).redMul(this.z),a=r.redSub(i),u=n.redSub(s);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var h=a.redSqr(),l=h.redMul(a),b=r.redMul(h),w=u.redSqr().redIAdd(l).redISub(b).redISub(b),I=u.redMul(b.redISub(w)).redISub(n.redMul(l)),S=this.z.redMul(a);return this.curve.jpoint(w,I,S)},Hr.prototype.dblp=function(t){if(t===0)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<t;e++)r=r.dbl();return r}var i=this.curve.a,n=this.curve.tinv,s=this.x,a=this.y,u=this.z,h=u.redSqr().redSqr(),l=a.redAdd(a);for(e=0;e<t;e++){var b=s.redSqr(),w=l.redSqr(),I=w.redSqr(),S=b.redAdd(b).redIAdd(b).redIAdd(i.redMul(h)),D=s.redMul(w),T=S.redSqr().redISub(D.redAdd(D)),q=D.redISub(T),K=S.redMul(q);K=K.redIAdd(K).redISub(I);var F=l.redMul(u);e+1<t&&(h=h.redMul(I)),s=T,u=F,l=K}return this.curve.jpoint(s,l.redMul(n),u)},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 t,e,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),s=n.redSqr(),a=this.x.redAdd(n).redSqr().redISub(i).redISub(s);a=a.redIAdd(a);var u=i.redAdd(i).redIAdd(i),h=u.redSqr().redISub(a).redISub(a),l=s.redIAdd(s);l=l.redIAdd(l),l=l.redIAdd(l),t=h,e=u.redMul(a.redISub(h)).redISub(l),r=this.y.redAdd(this.y)}else{var b=this.x.redSqr(),w=this.y.redSqr(),I=w.redSqr(),S=this.x.redAdd(w).redSqr().redISub(b).redISub(I);S=S.redIAdd(S);var D=b.redAdd(b).redIAdd(b),T=D.redSqr(),q=I.redIAdd(I);q=q.redIAdd(q),q=q.redIAdd(q),t=T.redISub(S).redISub(S),e=D.redMul(S.redISub(t)).redISub(q),r=this.y.redMul(this.z),r=r.redIAdd(r)}return this.curve.jpoint(t,e,r)},Hr.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),s=n.redSqr(),a=this.x.redAdd(n).redSqr().redISub(i).redISub(s);a=a.redIAdd(a);var u=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),h=u.redSqr().redISub(a).redISub(a);t=h;var l=s.redIAdd(s);l=l.redIAdd(l),l=l.redIAdd(l),e=u.redMul(a.redISub(h)).redISub(l),r=this.y.redAdd(this.y)}else{var b=this.z.redSqr(),w=this.y.redSqr(),I=this.x.redMul(w),S=this.x.redSub(b).redMul(this.x.redAdd(b));S=S.redAdd(S).redIAdd(S);var D=I.redIAdd(I);D=D.redIAdd(D);var T=D.redAdd(D);t=S.redSqr().redISub(T),r=this.y.redAdd(this.z).redSqr().redISub(w).redISub(b);var q=w.redSqr();q=q.redIAdd(q),q=q.redIAdd(q),q=q.redIAdd(q),e=S.redMul(D.redISub(t)).redISub(q)}return this.curve.jpoint(t,e,r)},Hr.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,i=this.z,n=i.redSqr().redSqr(),s=e.redSqr(),a=r.redSqr(),u=s.redAdd(s).redIAdd(s).redIAdd(t.redMul(n)),h=e.redAdd(e);h=h.redIAdd(h);var l=h.redMul(a),b=u.redSqr().redISub(l.redAdd(l)),w=l.redISub(b),I=a.redSqr();I=I.redIAdd(I),I=I.redIAdd(I),I=I.redIAdd(I);var S=u.redMul(w).redISub(I),D=r.redAdd(r).redMul(i);return this.curve.jpoint(b,S,D)},Hr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),i=e.redSqr(),n=t.redAdd(t).redIAdd(t),s=n.redSqr(),a=this.x.redAdd(e).redSqr().redISub(t).redISub(i);a=a.redIAdd(a),a=a.redAdd(a).redIAdd(a),a=a.redISub(s);var u=a.redSqr(),h=i.redIAdd(i);h=h.redIAdd(h),h=h.redIAdd(h),h=h.redIAdd(h);var l=n.redIAdd(a).redSqr().redISub(s).redISub(u).redISub(h),b=e.redMul(l);b=b.redIAdd(b),b=b.redIAdd(b);var w=this.x.redMul(u).redISub(b);w=w.redIAdd(w),w=w.redIAdd(w);var I=this.y.redMul(l.redMul(h.redISub(l)).redISub(a.redMul(u)));I=I.redIAdd(I),I=I.redIAdd(I),I=I.redIAdd(I);var S=this.z.redAdd(a).redSqr().redISub(r).redISub(u);return this.curve.jpoint(w,I,S)},Hr.prototype.mul=function(t,e){return t=new mt(t,e),this.curve._wnafMul(this,t)},Hr.prototype.eq=function(t){if(t.type==="affine")return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0)!==0)return!1;var i=e.redMul(this.z),n=r.redMul(t.z);return this.y.redMul(n).redISub(t.y.redMul(i)).cmpn(0)===0},Hr.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(this.x.cmp(r)===0)return!0;for(var i=t.clone(),n=this.curve.redN.redMul(e);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),this.x.cmp(r)===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 lh=sc(function(t,e){var r=e;r.base=Wo,r.short=xS,r.mont=null,r.edwards=null}),dh=sc(function(t,e){var r=e,i=Ui.assert;function n(u){u.type==="short"?this.curve=new lh.short(u):u.type==="edwards"?this.curve=new lh.edwards(u):this.curve=new lh.mont(u),this.g=this.curve.g,this.n=this.curve.n,this.hash=u.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=n;function s(u,h){Object.defineProperty(r,u,{configurable:!0,enumerable:!0,get:function(){var l=new n(h);return Object.defineProperty(r,u,{configurable:!0,enumerable:!0,value:l}),l}})}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:Zn.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:Zn.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:Zn.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:Zn.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:Zn.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:Zn.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:Zn.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:Zn.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})});function oo(t){if(!(this instanceof oo))return new oo(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=An.toArray(t.entropy,t.entropyEnc||"hex"),r=An.toArray(t.nonce,t.nonceEnc||"hex"),i=An.toArray(t.pers,t.persEnc||"hex");xd(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}var Jm=oo;oo.prototype._init=function(t,e,r){var i=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n<this.V.length;n++)this.K[n]=0,this.V[n]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},oo.prototype._hmac=function(){return new Zn.hmac(this.hash,this.K)},oo.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},oo.prototype.reseed=function(t,e,r,i){typeof e!="string"&&(i=r,r=e,e=null),t=An.toArray(t,e),r=An.toArray(r,i),xd(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},oo.prototype.generate=function(t,e,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof e!="string"&&(i=r,r=e,e=null),r&&(r=An.toArray(r,i||"hex"),this._update(r));for(var n=[];n.length<t;)this.V=this._hmac().update(this.V).digest(),n=n.concat(this.V);var s=n.slice(0,t);return this._update(r),this._reseed++,An.encode(s,e)};var Id=Ui.assert;function Yr(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var Md=Yr;Yr.fromPublic=function(t,e,r){return e instanceof Yr?e:new Yr(t,{pub:e,pubEnc:r})},Yr.fromPrivate=function(t,e,r){return e instanceof Yr?e:new Yr(t,{priv:e,privEnc:r})},Yr.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},Yr.prototype.getPublic=function(t,e){return typeof t=="string"&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},Yr.prototype.getPrivate=function(t){return t==="hex"?this.priv.toString(16,2):this.priv},Yr.prototype._importPrivate=function(t,e){this.priv=new mt(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},Yr.prototype._importPublic=function(t,e){if(t.x||t.y){this.ec.curve.type==="mont"?Id(t.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Id(t.x&&t.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(t.x,t.y);return}this.pub=this.ec.curve.decodePoint(t,e)},Yr.prototype.derive=function(t){return t.validate()||Id(t.validate(),"public point not validated"),t.mul(this.priv).getX()},Yr.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},Yr.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},Yr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var SS=Ui.assert;function ph(t,e){if(t instanceof ph)return t;this._importDER(t,e)||(SS(t.r&&t.s,"Signature without r or s"),this.r=new mt(t.r,16),this.s=new mt(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var gh=ph;function IS(){this.place=0}function Cd(t,e){var r=t[e.place++];if(!(r&128))return r;var i=r&15;if(i===0||i>4)return!1;for(var n=0,s=0,a=e.place;s<i;s++,a++)n<<=8,n|=t[a],n>>>=0;return n<=127?!1:(e.place=a,n)}function Ym(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e<r;)e++;return e===0?t:t.slice(e)}ph.prototype._importDER=function(t,e){t=Ui.toArray(t,e);var r=new IS;if(t[r.place++]!==48)return!1;var i=Cd(t,r);if(i===!1||i+r.place!==t.length||t[r.place++]!==2)return!1;var n=Cd(t,r);if(n===!1)return!1;var s=t.slice(r.place,n+r.place);if(r.place+=n,t[r.place++]!==2)return!1;var a=Cd(t,r);if(a===!1||t.length!==a+r.place)return!1;var u=t.slice(r.place,a+r.place);if(s[0]===0)if(s[1]&128)s=s.slice(1);else return!1;if(u[0]===0)if(u[1]&128)u=u.slice(1);else return!1;return this.r=new mt(s),this.s=new mt(u),this.recoveryParam=null,!0};function Dd(t,e){if(e<128){t.push(e);return}var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}ph.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(e[0]&128&&(e=[0].concat(e)),r[0]&128&&(r=[0].concat(r)),e=Ym(e),r=Ym(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var i=[2];Dd(i,e.length),i=i.concat(e),i.push(2),Dd(i,r.length);var n=i.concat(r),s=[48];return Dd(s,n.length),s=s.concat(n),Ui.encode(s,t)};var MS=function(){throw new Error("unsupported")},Qm=Ui.assert;function tn(t){if(!(this instanceof tn))return new tn(t);typeof t=="string"&&(Qm(Object.prototype.hasOwnProperty.call(dh,t),"Unknown curve "+t),t=dh[t]),t instanceof dh.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var CS=tn;tn.prototype.keyPair=function(t){return new Md(this,t)},tn.prototype.keyFromPrivate=function(t,e){return Md.fromPrivate(this,t,e)},tn.prototype.keyFromPublic=function(t,e){return Md.fromPublic(this,t,e)},tn.prototype.genKeyPair=function(t){t||(t={});for(var e=new Jm({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||MS(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new mt(2));;){var n=new mt(e.generate(r));if(!(n.cmp(i)>0))return n.iaddn(1),this.keyFromPrivate(n)}},tn.prototype._truncateToN=function(t,e){var r=t.byteLength()*8-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},tn.prototype.sign=function(t,e,r,i){typeof r=="object"&&(i=r,r=null),i||(i={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new mt(t,16));for(var n=this.n.byteLength(),s=e.getPrivate().toArray("be",n),a=t.toArray("be",n),u=new Jm({hash:this.hash,entropy:s,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),h=this.n.sub(new mt(1)),l=0;;l++){var b=i.k?i.k(l):new mt(u.generate(this.n.byteLength()));if(b=this._truncateToN(b,!0),!(b.cmpn(1)<=0||b.cmp(h)>=0)){var w=this.g.mul(b);if(!w.isInfinity()){var I=w.getX(),S=I.umod(this.n);if(S.cmpn(0)!==0){var D=b.invm(this.n).mul(S.mul(e.getPrivate()).iadd(t));if(D=D.umod(this.n),D.cmpn(0)!==0){var T=(w.getY().isOdd()?1:0)|(I.cmp(S)!==0?2:0);return i.canonical&&D.cmp(this.nh)>0&&(D=this.n.sub(D),T^=1),new gh({r:S,s:D,recoveryParam:T})}}}}}},tn.prototype.verify=function(t,e,r,i){t=this._truncateToN(new mt(t,16)),r=this.keyFromPublic(r,i),e=new gh(e,"hex");var n=e.r,s=e.s;if(n.cmpn(1)<0||n.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a=s.invm(this.n),u=a.mul(t).umod(this.n),h=a.mul(n).umod(this.n),l;return this.curve._maxwellTrick?(l=this.g.jmulAdd(u,r.getPublic(),h),l.isInfinity()?!1:l.eqXToP(n)):(l=this.g.mulAdd(u,r.getPublic(),h),l.isInfinity()?!1:l.getX().umod(this.n).cmp(n)===0)},tn.prototype.recoverPubKey=function(t,e,r,i){Qm((3&r)===r,"The recovery param is more than two bits"),e=new gh(e,i);var n=this.n,s=new mt(t),a=e.r,u=e.s,h=r&1,l=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?a=this.curve.pointFromX(a.add(this.curve.n),h):a=this.curve.pointFromX(a,h);var b=e.r.invm(n),w=n.sub(s).mul(b).umod(n),I=u.mul(b).umod(n);return this.g.mulAdd(w,a,I)},tn.prototype.getKeyRecoveryParam=function(t,e,r,i){if(e=new gh(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(t,e,n)}catch{continue}if(s.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var DS=sc(function(t,e){var r=e;r.version="6.5.4",r.utils=Ui,r.rand=function(){throw new Error("unsupported")},r.curve=lh,r.curves=dh,r.ec=CS,r.eddsa=null}),OS=DS.ec;const PS="signing-key/5.7.0",Od=new Et(PS);let Pd=null;function os(){return Pd||(Pd=new OS("secp256k1")),Pd}class $S{constructor(e){du(this,"curve","secp256k1"),du(this,"privateKey",si(e)),pA(this.privateKey)!==32&&Od.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=os().keyFromPrivate(dr(this.privateKey));du(this,"publicKey","0x"+r.getPublic(!1,"hex")),du(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),du(this,"_isSigningKey",!0)}_addPoint(e){const r=os().keyFromPublic(dr(this.publicKey)),i=os().keyFromPublic(dr(e));return"0x"+r.pub.add(i.pub).encodeCompressed("hex")}signDigest(e){const r=os().keyFromPrivate(dr(this.privateKey)),i=dr(e);i.length!==32&&Od.throwArgumentError("bad digest length","digest",e);const n=r.sign(i,{canonical:!0});return am({recoveryParam:n.recoveryParam,r:Qn("0x"+n.r.toString(16),32),s:Qn("0x"+n.s.toString(16),32)})}computeSharedSecret(e){const r=os().keyFromPrivate(dr(this.privateKey)),i=os().keyFromPublic(dr(Zm(e)));return Qn("0x"+r.derive(i.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function RS(t,e){const r=am(e),i={r:dr(r.r),s:dr(r.s)};return"0x"+os().recoverPubKey(dr(t),i,r.recoveryParam).encode("hex",!1)}function Zm(t,e){const r=dr(t);if(r.length===32){const i=new $S(r);return e?"0x"+os().keyFromPrivate(r).getPublic(!0,"hex"):i.publicKey}else{if(r.length===33)return e?si(r):"0x"+os().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return e?"0x"+os().keyFromPublic(r).getPublic(!0,"hex"):si(r)}return Od.throwArgumentError("invalid public or private key","key","[REDACTED]")}const NS="transactions/5.7.0";new Et(NS);var Xm;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(Xm||(Xm={}));function TS(t){const e=Zm(t);return KA(om(hd(om(e,1)),12))}function LS(t,e){return TS(RS(dr(t),e))}const BS="https://rpc.walletconnect.com/v1";async function FS(t,e,r,i,n,s){switch(r.t){case"eip191":return US(t,e,r.s);case"eip1271":return await kS(t,e,r.s,i,n,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function US(t,e,r){return LS(Am(e),r).toLowerCase()===t.toLowerCase()}async function kS(t,e,r,i,n,s){try{const a="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",h="0000000000000000000000000000000000000000000000000000000000000041",l=r.substring(2),b=Am(e).substring(2),w=a+b+u+h+l,I=await fetch(`${s||BS}/?chainId=${i}&projectId=${n}`,{method:"POST",body:JSON.stringify({id:qS(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:w},"latest"]})}),{result:S}=await I.json();return S?S.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function qS(){return Date.now()+Math.floor(Math.random()*1e3)}var jS=Object.defineProperty,zS=Object.defineProperties,HS=Object.getOwnPropertyDescriptors,eb=Object.getOwnPropertySymbols,KS=Object.prototype.hasOwnProperty,WS=Object.prototype.propertyIsEnumerable,tb=(t,e,r)=>e in t?jS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,VS=(t,e)=>{for(var r in e||(e={}))KS.call(e,r)&&tb(t,r,e[r]);if(eb)for(var r of eb(e))WS.call(e,r)&&tb(t,r,e[r]);return t},GS=(t,e)=>zS(t,HS(e));const JS="did:pkh:",$d=t=>t?.split(":"),rb=t=>{const e=t&&$d(t);if(e)return t.includes(JS)?e[3]:e[1]},ib=t=>{const e=t&&$d(t);if(e)return e[2]+":"+e[3]},vh=t=>{const e=t&&$d(t);if(e)return e.pop()};async function nb(t){const{cacao:e,projectId:r}=t,{s:i,p:n}=e,s=sb(n,n.iss),a=vh(n.iss);return await FS(a,s,i,rb(n.iss),r)}const sb=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,i=vh(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let n=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,a=`Version: ${t.version}`,u=`Chain ID: ${rb(e)}`,h=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,b=t.exp?`Expiration Time: ${t.exp}`:void 0,w=t.nbf?`Not Before: ${t.nbf}`:void 0,I=t.requestId?`Request ID: ${t.requestId}`:void 0,S=t.resources?`Resources:${t.resources.map(T=>`
21
+ */(function(t){(function(){var e="input is invalid type",r="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=Z2:s&&(n=self);var u=!n.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,h=!n.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",l="0123456789abcdef".split(""),b=[31,7936,2031616,520093696],w=[4,1024,262144,67108864],I=[1,256,65536,16777216],S=[6,1536,393216,100663296],D=[0,8,16,24],T=[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],K=[128,256],F=["hex","buffer","arrayBuffer","array","digest"],W={128:168,256:136};(n.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(P){return Object.prototype.toString.call(P)==="[object Array]"}),h&&(n.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(P){return typeof P=="object"&&P.buffer&&P.buffer.constructor===ArrayBuffer});for(var R=function(P,te,z){return function(G){return new N(P,te,P).update(G)[z]()}},k=function(P,te,z){return function(G,J){return new N(P,te,J).update(G)[z]()}},H=function(P,te,z){return function(G,J,A,V){return d["cshake"+P].update(G,J,A,V)[z]()}},_=function(P,te,z){return function(G,J,A,V){return d["kmac"+P].update(G,J,A,V)[z]()}},B=function(P,te,z,G){for(var J=0;J<F.length;++J){var A=F[J];P[A]=te(z,G,A)}return P},ee=function(P,te){var z=R(P,te,"hex");return z.create=function(){return new N(P,te,P)},z.update=function(G){return z.create().update(G)},B(z,R,P,te)},ie=function(P,te){var z=k(P,te,"hex");return z.create=function(G){return new N(P,te,G)},z.update=function(G,J){return z.create(J).update(G)},B(z,k,P,te)},L=function(P,te){var z=W[P],G=H(P,te,"hex");return G.create=function(J,A,V){return!A&&!V?d["shake"+P].create(J):new N(P,te,J).bytepad([A,V],z)},G.update=function(J,A,V,oe){return G.create(A,V,oe).update(J)},B(G,H,P,te)},y=function(P,te){var z=W[P],G=_(P,te,"hex");return G.create=function(J,A,V){return new X(P,te,A).bytepad(["KMAC",V],z).bytepad([J],z)},G.update=function(J,A,V,oe){return G.create(J,V,oe).update(A)},B(G,_,P,te)},f=[{name:"keccak",padding:I,bits:q,createMethod:ee},{name:"sha3",padding:S,bits:q,createMethod:ee},{name:"shake",padding:b,bits:K,createMethod:ie},{name:"cshake",padding:w,bits:K,createMethod:L},{name:"kmac",padding:w,bits:K,createMethod:y}],d={},v=[],E=0;E<f.length;++E)for(var C=f[E],O=C.bits,M=0;M<O.length;++M){var g=C.name+"_"+O[M];if(v.push(g),d[g]=C.createMethod(O[M],C.padding),C.name!=="sha3"){var m=C.name+O[M];v.push(m),d[m]=d[g]}}function N(P,te,z){this.blocks=[],this.s=[],this.padding=te,this.outputBits=z,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(P<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=z>>5,this.extraBytes=(z&31)>>3;for(var G=0;G<50;++G)this.s[G]=0}N.prototype.update=function(P){if(this.finalized)throw new Error(r);var te,z=typeof P;if(z!=="string"){if(z==="object"){if(P===null)throw new Error(e);if(h&&P.constructor===ArrayBuffer)P=new Uint8Array(P);else if(!Array.isArray(P)&&(!h||!ArrayBuffer.isView(P)))throw new Error(e)}else throw new Error(e);te=!0}for(var G=this.blocks,J=this.byteCount,A=P.length,V=this.blockCount,oe=0,ue=this.s,he,ye;oe<A;){if(this.reset)for(this.reset=!1,G[0]=this.block,he=1;he<V+1;++he)G[he]=0;if(te)for(he=this.start;oe<A&&he<J;++oe)G[he>>2]|=P[oe]<<D[he++&3];else for(he=this.start;oe<A&&he<J;++oe)ye=P.charCodeAt(oe),ye<128?G[he>>2]|=ye<<D[he++&3]:ye<2048?(G[he>>2]|=(192|ye>>6)<<D[he++&3],G[he>>2]|=(128|ye&63)<<D[he++&3]):ye<55296||ye>=57344?(G[he>>2]|=(224|ye>>12)<<D[he++&3],G[he>>2]|=(128|ye>>6&63)<<D[he++&3],G[he>>2]|=(128|ye&63)<<D[he++&3]):(ye=65536+((ye&1023)<<10|P.charCodeAt(++oe)&1023),G[he>>2]|=(240|ye>>18)<<D[he++&3],G[he>>2]|=(128|ye>>12&63)<<D[he++&3],G[he>>2]|=(128|ye>>6&63)<<D[he++&3],G[he>>2]|=(128|ye&63)<<D[he++&3]);if(this.lastByteIndex=he,he>=J){for(this.start=he-J,this.block=G[V],he=0;he<V;++he)ue[he]^=G[he];ae(ue),this.reset=!0}else this.start=he}return this},N.prototype.encode=function(P,te){var z=P&255,G=1,J=[z];for(P=P>>8,z=P&255;z>0;)J.unshift(z),P=P>>8,z=P&255,++G;return te?J.push(G):J.unshift(G),this.update(J),J.length},N.prototype.encodeString=function(P){var te,z=typeof P;if(z!=="string"){if(z==="object"){if(P===null)throw new Error(e);if(h&&P.constructor===ArrayBuffer)P=new Uint8Array(P);else if(!Array.isArray(P)&&(!h||!ArrayBuffer.isView(P)))throw new Error(e)}else throw new Error(e);te=!0}var G=0,J=P.length;if(te)G=J;else for(var A=0;A<P.length;++A){var V=P.charCodeAt(A);V<128?G+=1:V<2048?G+=2:V<55296||V>=57344?G+=3:(V=65536+((V&1023)<<10|P.charCodeAt(++A)&1023),G+=4)}return G+=this.encode(G*8),this.update(P),G},N.prototype.bytepad=function(P,te){for(var z=this.encode(te),G=0;G<P.length;++G)z+=this.encodeString(P[G]);var J=te-z%te,A=[];return A.length=J,this.update(A),this},N.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var P=this.blocks,te=this.lastByteIndex,z=this.blockCount,G=this.s;if(P[te>>2]|=this.padding[te&3],this.lastByteIndex===this.byteCount)for(P[0]=P[z],te=1;te<z+1;++te)P[te]=0;for(P[z-1]|=2147483648,te=0;te<z;++te)G[te]^=P[te];ae(G)}},N.prototype.toString=N.prototype.hex=function(){this.finalize();for(var P=this.blockCount,te=this.s,z=this.outputBlocks,G=this.extraBytes,J=0,A=0,V="",oe;A<z;){for(J=0;J<P&&A<z;++J,++A)oe=te[J],V+=l[oe>>4&15]+l[oe&15]+l[oe>>12&15]+l[oe>>8&15]+l[oe>>20&15]+l[oe>>16&15]+l[oe>>28&15]+l[oe>>24&15];A%P===0&&(ae(te),J=0)}return G&&(oe=te[J],V+=l[oe>>4&15]+l[oe&15],G>1&&(V+=l[oe>>12&15]+l[oe>>8&15]),G>2&&(V+=l[oe>>20&15]+l[oe>>16&15])),V},N.prototype.arrayBuffer=function(){this.finalize();var P=this.blockCount,te=this.s,z=this.outputBlocks,G=this.extraBytes,J=0,A=0,V=this.outputBits>>3,oe;G?oe=new ArrayBuffer(z+1<<2):oe=new ArrayBuffer(V);for(var ue=new Uint32Array(oe);A<z;){for(J=0;J<P&&A<z;++J,++A)ue[A]=te[J];A%P===0&&ae(te)}return G&&(ue[J]=te[J],oe=oe.slice(0,V)),oe},N.prototype.buffer=N.prototype.arrayBuffer,N.prototype.digest=N.prototype.array=function(){this.finalize();for(var P=this.blockCount,te=this.s,z=this.outputBlocks,G=this.extraBytes,J=0,A=0,V=[],oe,ue;A<z;){for(J=0;J<P&&A<z;++J,++A)oe=A<<2,ue=te[J],V[oe]=ue&255,V[oe+1]=ue>>8&255,V[oe+2]=ue>>16&255,V[oe+3]=ue>>24&255;A%P===0&&ae(te)}return G&&(oe=A<<2,ue=te[J],V[oe]=ue&255,G>1&&(V[oe+1]=ue>>8&255),G>2&&(V[oe+2]=ue>>16&255)),V};function X(P,te,z){N.call(this,P,te,z)}X.prototype=new N,X.prototype.finalize=function(){return this.encode(this.outputBits,!0),N.prototype.finalize.call(this)};var ae=function(P){var te,z,G,J,A,V,oe,ue,he,ye,we,Re,Xe,Oe,Ne,Me,be,Pe,Te,ve,$e,Se,me,Ue,Ce,_e,Ke,Ve,Ae,We,pt,Ge,It,gt,Ye,Ot,Tt,Le,et,it,Be,rt,tt,qe,ht,nt,je,st,at,Fe,Ze,lt,ze,qt,jt,ct,_t,Zr,Xr,ei,ti,ri,vr;for(G=0;G<48;G+=2)J=P[0]^P[10]^P[20]^P[30]^P[40],A=P[1]^P[11]^P[21]^P[31]^P[41],V=P[2]^P[12]^P[22]^P[32]^P[42],oe=P[3]^P[13]^P[23]^P[33]^P[43],ue=P[4]^P[14]^P[24]^P[34]^P[44],he=P[5]^P[15]^P[25]^P[35]^P[45],ye=P[6]^P[16]^P[26]^P[36]^P[46],we=P[7]^P[17]^P[27]^P[37]^P[47],Re=P[8]^P[18]^P[28]^P[38]^P[48],Xe=P[9]^P[19]^P[29]^P[39]^P[49],te=Re^(V<<1|oe>>>31),z=Xe^(oe<<1|V>>>31),P[0]^=te,P[1]^=z,P[10]^=te,P[11]^=z,P[20]^=te,P[21]^=z,P[30]^=te,P[31]^=z,P[40]^=te,P[41]^=z,te=J^(ue<<1|he>>>31),z=A^(he<<1|ue>>>31),P[2]^=te,P[3]^=z,P[12]^=te,P[13]^=z,P[22]^=te,P[23]^=z,P[32]^=te,P[33]^=z,P[42]^=te,P[43]^=z,te=V^(ye<<1|we>>>31),z=oe^(we<<1|ye>>>31),P[4]^=te,P[5]^=z,P[14]^=te,P[15]^=z,P[24]^=te,P[25]^=z,P[34]^=te,P[35]^=z,P[44]^=te,P[45]^=z,te=ue^(Re<<1|Xe>>>31),z=he^(Xe<<1|Re>>>31),P[6]^=te,P[7]^=z,P[16]^=te,P[17]^=z,P[26]^=te,P[27]^=z,P[36]^=te,P[37]^=z,P[46]^=te,P[47]^=z,te=ye^(J<<1|A>>>31),z=we^(A<<1|J>>>31),P[8]^=te,P[9]^=z,P[18]^=te,P[19]^=z,P[28]^=te,P[29]^=z,P[38]^=te,P[39]^=z,P[48]^=te,P[49]^=z,Oe=P[0],Ne=P[1],nt=P[11]<<4|P[10]>>>28,je=P[10]<<4|P[11]>>>28,Ve=P[20]<<3|P[21]>>>29,Ae=P[21]<<3|P[20]>>>29,ei=P[31]<<9|P[30]>>>23,ti=P[30]<<9|P[31]>>>23,rt=P[40]<<18|P[41]>>>14,tt=P[41]<<18|P[40]>>>14,gt=P[2]<<1|P[3]>>>31,Ye=P[3]<<1|P[2]>>>31,Me=P[13]<<12|P[12]>>>20,be=P[12]<<12|P[13]>>>20,st=P[22]<<10|P[23]>>>22,at=P[23]<<10|P[22]>>>22,We=P[33]<<13|P[32]>>>19,pt=P[32]<<13|P[33]>>>19,ri=P[42]<<2|P[43]>>>30,vr=P[43]<<2|P[42]>>>30,qt=P[5]<<30|P[4]>>>2,jt=P[4]<<30|P[5]>>>2,Ot=P[14]<<6|P[15]>>>26,Tt=P[15]<<6|P[14]>>>26,Pe=P[25]<<11|P[24]>>>21,Te=P[24]<<11|P[25]>>>21,Fe=P[34]<<15|P[35]>>>17,Ze=P[35]<<15|P[34]>>>17,Ge=P[45]<<29|P[44]>>>3,It=P[44]<<29|P[45]>>>3,Ue=P[6]<<28|P[7]>>>4,Ce=P[7]<<28|P[6]>>>4,ct=P[17]<<23|P[16]>>>9,_t=P[16]<<23|P[17]>>>9,Le=P[26]<<25|P[27]>>>7,et=P[27]<<25|P[26]>>>7,ve=P[36]<<21|P[37]>>>11,$e=P[37]<<21|P[36]>>>11,lt=P[47]<<24|P[46]>>>8,ze=P[46]<<24|P[47]>>>8,qe=P[8]<<27|P[9]>>>5,ht=P[9]<<27|P[8]>>>5,_e=P[18]<<20|P[19]>>>12,Ke=P[19]<<20|P[18]>>>12,Zr=P[29]<<7|P[28]>>>25,Xr=P[28]<<7|P[29]>>>25,it=P[38]<<8|P[39]>>>24,Be=P[39]<<8|P[38]>>>24,Se=P[48]<<14|P[49]>>>18,me=P[49]<<14|P[48]>>>18,P[0]=Oe^~Me&Pe,P[1]=Ne^~be&Te,P[10]=Ue^~_e&Ve,P[11]=Ce^~Ke&Ae,P[20]=gt^~Ot&Le,P[21]=Ye^~Tt&et,P[30]=qe^~nt&st,P[31]=ht^~je&at,P[40]=qt^~ct&Zr,P[41]=jt^~_t&Xr,P[2]=Me^~Pe&ve,P[3]=be^~Te&$e,P[12]=_e^~Ve&We,P[13]=Ke^~Ae&pt,P[22]=Ot^~Le&it,P[23]=Tt^~et&Be,P[32]=nt^~st&Fe,P[33]=je^~at&Ze,P[42]=ct^~Zr&ei,P[43]=_t^~Xr&ti,P[4]=Pe^~ve&Se,P[5]=Te^~$e&me,P[14]=Ve^~We&Ge,P[15]=Ae^~pt&It,P[24]=Le^~it&rt,P[25]=et^~Be&tt,P[34]=st^~Fe&lt,P[35]=at^~Ze&ze,P[44]=Zr^~ei&ri,P[45]=Xr^~ti&vr,P[6]=ve^~Se&Oe,P[7]=$e^~me&Ne,P[16]=We^~Ge&Ue,P[17]=pt^~It&Ce,P[26]=it^~rt&gt,P[27]=Be^~tt&Ye,P[36]=Fe^~lt&qe,P[37]=Ze^~ze&ht,P[46]=ei^~ri&qt,P[47]=ti^~vr&jt,P[8]=Se^~Oe&Me,P[9]=me^~Ne&be,P[18]=Ge^~Ue&_e,P[19]=It^~Ce&Ke,P[28]=rt^~gt&Ot,P[29]=tt^~Ye&Tt,P[38]=lt^~qe&nt,P[39]=ze^~ht&je,P[48]=ri^~qt&ct,P[49]=vr^~jt&_t,P[0]^=T[G],P[1]^=T[G+1]};if(u)t.exports=d;else for(E=0;E<v.length;++E)n[v[E]]=d[v[E]]})()})(X2);var aA=X2.exports;const cA="logger/5.7.0";let em=!1,tm=!1;const ih={debug:1,default:2,info:2,warning:3,error:4,off:5};let rm=ih.default,cd=null;function uA(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}const im=uA();var ud;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(ud||(ud={}));var wn;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(wn||(wn={}));const nm="0123456789abcdef";class Et{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const i=e.toLowerCase();ih[i]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(rm>ih[i])&&console.log.apply(console,r)}debug(...e){this._log(Et.levels.DEBUG,e)}info(...e){this._log(Et.levels.INFO,e)}warn(...e){this._log(Et.levels.WARNING,e)}makeError(e,r,i){if(tm)return this.makeError("censored error",r,{});r||(r=Et.errors.UNKNOWN_ERROR),i||(i={});const n=[];Object.keys(i).forEach(h=>{const l=i[h];try{if(l instanceof Uint8Array){let b="";for(let w=0;w<l.length;w++)b+=nm[l[w]>>4],b+=nm[l[w]&15];n.push(h+"=Uint8Array(0x"+b+")")}else n.push(h+"="+JSON.stringify(l))}catch{n.push(h+"="+JSON.stringify(i[h].toString()))}}),n.push(`code=${r}`),n.push(`version=${this.version}`);const s=e;let a="";switch(r){case wn.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 wn.CALL_EXCEPTION:case wn.INSUFFICIENT_FUNDS:case wn.MISSING_NEW:case wn.NONCE_EXPIRED:case wn.REPLACEMENT_UNDERPRICED:case wn.TRANSACTION_REPLACED:case wn.UNPREDICTABLE_GAS_LIMIT:a=r;break}a&&(e+=" [ See: https://links.ethers.org/v5-errors-"+a+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const u=new Error(e);return u.reason=s,u.code=r,Object.keys(i).forEach(function(h){u[h]=i[h]}),u}throwError(e,r,i){throw this.makeError(e,r,i)}throwArgumentError(e,r,i){return this.throwError(e,Et.errors.INVALID_ARGUMENT,{argument:r,value:i})}assert(e,r,i,n){e||this.throwError(r,i,n)}assertArgument(e,r,i,n){e||this.throwArgumentError(r,i,n)}checkNormalize(e){im&&this.throwError("platform missing String.prototype.normalize",Et.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:im})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,Et.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,Et.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,i){i?i=": "+i:i="",e<r&&this.throwError("missing argument"+i,Et.errors.MISSING_ARGUMENT,{count:e,expectedCount:r}),e>r&&this.throwError("too many arguments"+i,Et.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",Et.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",Et.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Et.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return cd||(cd=new Et(cA)),cd}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",Et.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),em){if(!e)return;this.globalLogger().throwError("error censorship permanent",Et.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}tm=!!e,em=!!r}static setLogLevel(e){const r=ih[e.toLowerCase()];if(r==null){Et.globalLogger().warn("invalid log level - "+e);return}rm=r}static from(e){return new Et(e)}}Et.errors=wn,Et.levels=ud;const fA="bytes/5.7.0",br=new Et(fA);function sm(t){return!!t.toHexString}function Ja(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Ja(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function hA(t){return Fi(t)&&!(t.length%2)||Ya(t)}function om(t){return typeof t=="number"&&t==t&&t%1===0}function Ya(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!om(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!om(r)||r<0||r>=256)return!1}return!0}function dr(t,e){if(e||(e={}),typeof t=="number"){br.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),Ja(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),sm(t)&&(t=t.toHexString()),Fi(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":br.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let n=0;n<r.length;n+=2)i.push(parseInt(r.substring(n,n+2),16));return Ja(new Uint8Array(i))}return Ya(t)?Ja(new Uint8Array(t)):br.throwArgumentError("invalid arrayify value","value",t)}function lA(t){const e=t.map(n=>dr(n)),r=e.reduce((n,s)=>n+s.length,0),i=new Uint8Array(r);return e.reduce((n,s)=>(i.set(s,n),n+s.length),0),Ja(i)}function dA(t,e){t=dr(t),t.length>e&&br.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),Ja(r)}function Fi(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const fd="0123456789abcdef";function si(t,e){if(e||(e={}),typeof t=="number"){br.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=fd[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),sm(t))return t.toHexString();if(Fi(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":br.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Ya(t)){let r="0x";for(let i=0;i<t.length;i++){let n=t[i];r+=fd[(n&240)>>4]+fd[n&15]}return r}return br.throwArgumentError("invalid hexlify value","value",t)}function pA(t){if(typeof t!="string")t=si(t);else if(!Fi(t)||t.length%2)return null;return(t.length-2)/2}function am(t,e,r){return typeof t!="string"?t=si(t):(!Fi(t)||t.length%2)&&br.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function Qn(t,e){for(typeof t!="string"?t=si(t):Fi(t)||br.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&br.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function cm(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(hA(t)){let r=dr(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=si(r.slice(0,32)),e.s=si(r.slice(32,64))):r.length===65?(e.r=si(r.slice(0,32)),e.s=si(r.slice(32,64)),e.v=r[64]):br.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:br.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=si(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const n=dA(dr(e._vs),32);e._vs=si(n);const s=n[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&br.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),n[0]&=127;const a=si(n);e.s==null?e.s=a:e.s!==a&&br.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?br.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const n=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==n&&br.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Fi(e.r)?br.throwArgumentError("signature missing or invalid r","signature",t):e.r=Qn(e.r,32),e.s==null||!Fi(e.s)?br.throwArgumentError("signature missing or invalid s","signature",t):e.s=Qn(e.s,32);const r=dr(e.s);r[0]>=128&&br.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const i=si(r);e._vs&&(Fi(e._vs)||br.throwArgumentError("signature invalid _vs","signature",t),e._vs=Qn(e._vs,32)),e._vs==null?e._vs=i:e._vs!==i&&br.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function hd(t){return"0x"+aA.keccak_256(dr(t))}var um={exports:{}},gA={},vA=Object.freeze({__proto__:null,default:gA}),mA=oA(vA);(function(t){(function(e,r){function i(f,d){if(!f)throw new Error(d||"Assertion failed")}function n(f,d){f.super_=d;var v=function(){};v.prototype=d.prototype,f.prototype=new v,f.prototype.constructor=f}function s(f,d,v){if(s.isBN(f))return f;this.negative=0,this.words=null,this.length=0,this.red=null,f!==null&&((d==="le"||d==="be")&&(v=d,d=10),this._init(f||0,d||10,v||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=mA.Buffer}catch{}s.isBN=function(f){return f instanceof s?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===s.wordSize&&Array.isArray(f.words)},s.max=function(f,d){return f.cmp(d)>0?f:d},s.min=function(f,d){return f.cmp(d)<0?f:d},s.prototype._init=function(f,d,v){if(typeof f=="number")return this._initNumber(f,d,v);if(typeof f=="object")return this._initArray(f,d,v);d==="hex"&&(d=16),i(d===(d|0)&&d>=2&&d<=36),f=f.toString().replace(/\s+/g,"");var E=0;f[0]==="-"&&(E++,this.negative=1),E<f.length&&(d===16?this._parseHex(f,E,v):(this._parseBase(f,d,E),v==="le"&&this._initArray(this.toArray(),d,v)))},s.prototype._initNumber=function(f,d,v){f<0&&(this.negative=1,f=-f),f<67108864?(this.words=[f&67108863],this.length=1):f<4503599627370496?(this.words=[f&67108863,f/67108864&67108863],this.length=2):(i(f<9007199254740992),this.words=[f&67108863,f/67108864&67108863,1],this.length=3),v==="le"&&this._initArray(this.toArray(),d,v)},s.prototype._initArray=function(f,d,v){if(i(typeof f.length=="number"),f.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(f.length/3),this.words=new Array(this.length);for(var E=0;E<this.length;E++)this.words[E]=0;var C,O,M=0;if(v==="be")for(E=f.length-1,C=0;E>=0;E-=3)O=f[E]|f[E-1]<<8|f[E-2]<<16,this.words[C]|=O<<M&67108863,this.words[C+1]=O>>>26-M&67108863,M+=24,M>=26&&(M-=26,C++);else if(v==="le")for(E=0,C=0;E<f.length;E+=3)O=f[E]|f[E+1]<<8|f[E+2]<<16,this.words[C]|=O<<M&67108863,this.words[C+1]=O>>>26-M&67108863,M+=24,M>=26&&(M-=26,C++);return this._strip()};function u(f,d){var v=f.charCodeAt(d);if(v>=48&&v<=57)return v-48;if(v>=65&&v<=70)return v-55;if(v>=97&&v<=102)return v-87;i(!1,"Invalid character in "+f)}function h(f,d,v){var E=u(f,v);return v-1>=d&&(E|=u(f,v-1)<<4),E}s.prototype._parseHex=function(f,d,v){this.length=Math.ceil((f.length-d)/6),this.words=new Array(this.length);for(var E=0;E<this.length;E++)this.words[E]=0;var C=0,O=0,M;if(v==="be")for(E=f.length-1;E>=d;E-=2)M=h(f,d,E)<<C,this.words[O]|=M&67108863,C>=18?(C-=18,O+=1,this.words[O]|=M>>>26):C+=8;else{var g=f.length-d;for(E=g%2===0?d+1:d;E<f.length;E+=2)M=h(f,d,E)<<C,this.words[O]|=M&67108863,C>=18?(C-=18,O+=1,this.words[O]|=M>>>26):C+=8}this._strip()};function l(f,d,v,E){for(var C=0,O=0,M=Math.min(f.length,v),g=d;g<M;g++){var m=f.charCodeAt(g)-48;C*=E,m>=49?O=m-49+10:m>=17?O=m-17+10:O=m,i(m>=0&&O<E,"Invalid character"),C+=O}return C}s.prototype._parseBase=function(f,d,v){this.words=[0],this.length=1;for(var E=0,C=1;C<=67108863;C*=d)E++;E--,C=C/d|0;for(var O=f.length-v,M=O%E,g=Math.min(O,O-M)+v,m=0,N=v;N<g;N+=E)m=l(f,N,N+E,d),this.imuln(C),this.words[0]+m<67108864?this.words[0]+=m:this._iaddn(m);if(M!==0){var X=1;for(m=l(f,N,f.length,d),N=0;N<M;N++)X*=d;this.imuln(X),this.words[0]+m<67108864?this.words[0]+=m:this._iaddn(m)}this._strip()},s.prototype.copy=function(f){f.words=new Array(this.length);for(var d=0;d<this.length;d++)f.words[d]=this.words[d];f.length=this.length,f.negative=this.negative,f.red=this.red};function b(f,d){f.words=d.words,f.length=d.length,f.negative=d.negative,f.red=d.red}if(s.prototype._move=function(f){b(f,this)},s.prototype.clone=function(){var f=new s(null);return this.copy(f),f},s.prototype._expand=function(f){for(;this.length<f;)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 I=["","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"],S=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],D=[0,0,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(f,d){f=f||10,d=d|0||1;var v;if(f===16||f==="hex"){v="";for(var E=0,C=0,O=0;O<this.length;O++){var M=this.words[O],g=((M<<E|C)&16777215).toString(16);C=M>>>24-E&16777215,E+=2,E>=26&&(E-=26,O--),C!==0||O!==this.length-1?v=I[6-g.length]+g+v:v=g+v}for(C!==0&&(v=C.toString(16)+v);v.length%d!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(f===(f|0)&&f>=2&&f<=36){var m=S[f],N=D[f];v="";var X=this.clone();for(X.negative=0;!X.isZero();){var ae=X.modrn(N).toString(f);X=X.idivn(N),X.isZero()?v=ae+v:v=I[m-ae.length]+ae+v}for(this.isZero()&&(v="0"+v);v.length%d!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},s.prototype.toJSON=function(){return this.toString(16,2)},a&&(s.prototype.toBuffer=function(f,d){return this.toArrayLike(a,f,d)}),s.prototype.toArray=function(f,d){return this.toArrayLike(Array,f,d)};var T=function(f,d){return f.allocUnsafe?f.allocUnsafe(d):new f(d)};s.prototype.toArrayLike=function(f,d,v){this._strip();var E=this.byteLength(),C=v||Math.max(1,E);i(E<=C,"byte array longer than desired length"),i(C>0,"Requested array length <= 0");var O=T(f,C),M=d==="le"?"LE":"BE";return this["_toArrayLike"+M](O,E),O},s.prototype._toArrayLikeLE=function(f,d){for(var v=0,E=0,C=0,O=0;C<this.length;C++){var M=this.words[C]<<O|E;f[v++]=M&255,v<f.length&&(f[v++]=M>>8&255),v<f.length&&(f[v++]=M>>16&255),O===6?(v<f.length&&(f[v++]=M>>24&255),E=0,O=0):(E=M>>>24,O+=2)}if(v<f.length)for(f[v++]=E;v<f.length;)f[v++]=0},s.prototype._toArrayLikeBE=function(f,d){for(var v=f.length-1,E=0,C=0,O=0;C<this.length;C++){var M=this.words[C]<<O|E;f[v--]=M&255,v>=0&&(f[v--]=M>>8&255),v>=0&&(f[v--]=M>>16&255),O===6?(v>=0&&(f[v--]=M>>24&255),E=0,O=0):(E=M>>>24,O+=2)}if(v>=0)for(f[v--]=E;v>=0;)f[v--]=0},Math.clz32?s.prototype._countBits=function(f){return 32-Math.clz32(f)}:s.prototype._countBits=function(f){var d=f,v=0;return d>=4096&&(v+=13,d>>>=13),d>=64&&(v+=7,d>>>=7),d>=8&&(v+=4,d>>>=4),d>=2&&(v+=2,d>>>=2),v+d},s.prototype._zeroBits=function(f){if(f===0)return 26;var d=f,v=0;return d&8191||(v+=13,d>>>=13),d&127||(v+=7,d>>>=7),d&15||(v+=4,d>>>=4),d&3||(v+=2,d>>>=2),d&1||v++,v},s.prototype.bitLength=function(){var f=this.words[this.length-1],d=this._countBits(f);return(this.length-1)*26+d};function q(f){for(var d=new Array(f.bitLength()),v=0;v<d.length;v++){var E=v/26|0,C=v%26;d[v]=f.words[E]>>>C&1}return d}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,d=0;d<this.length;d++){var v=this._zeroBits(this.words[d]);if(f+=v,v!==26)break}return f},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(f){return this.negative!==0?this.abs().inotn(f).iaddn(1):this.clone()},s.prototype.fromTwos=function(f){return this.testn(f-1)?this.notn(f).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(f){for(;this.length<f.length;)this.words[this.length++]=0;for(var d=0;d<f.length;d++)this.words[d]=this.words[d]|f.words[d];return this._strip()},s.prototype.ior=function(f){return i((this.negative|f.negative)===0),this.iuor(f)},s.prototype.or=function(f){return this.length>f.length?this.clone().ior(f):f.clone().ior(this)},s.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},s.prototype.iuand=function(f){var d;this.length>f.length?d=f:d=this;for(var v=0;v<d.length;v++)this.words[v]=this.words[v]&f.words[v];return this.length=d.length,this._strip()},s.prototype.iand=function(f){return i((this.negative|f.negative)===0),this.iuand(f)},s.prototype.and=function(f){return this.length>f.length?this.clone().iand(f):f.clone().iand(this)},s.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},s.prototype.iuxor=function(f){var d,v;this.length>f.length?(d=this,v=f):(d=f,v=this);for(var E=0;E<v.length;E++)this.words[E]=d.words[E]^v.words[E];if(this!==d)for(;E<d.length;E++)this.words[E]=d.words[E];return this.length=d.length,this._strip()},s.prototype.ixor=function(f){return i((this.negative|f.negative)===0),this.iuxor(f)},s.prototype.xor=function(f){return this.length>f.length?this.clone().ixor(f):f.clone().ixor(this)},s.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},s.prototype.inotn=function(f){i(typeof f=="number"&&f>=0);var d=Math.ceil(f/26)|0,v=f%26;this._expand(d),v>0&&d--;for(var E=0;E<d;E++)this.words[E]=~this.words[E]&67108863;return v>0&&(this.words[E]=~this.words[E]&67108863>>26-v),this._strip()},s.prototype.notn=function(f){return this.clone().inotn(f)},s.prototype.setn=function(f,d){i(typeof f=="number"&&f>=0);var v=f/26|0,E=f%26;return this._expand(v+1),d?this.words[v]=this.words[v]|1<<E:this.words[v]=this.words[v]&~(1<<E),this._strip()},s.prototype.iadd=function(f){var d;if(this.negative!==0&&f.negative===0)return this.negative=0,d=this.isub(f),this.negative^=1,this._normSign();if(this.negative===0&&f.negative!==0)return f.negative=0,d=this.isub(f),f.negative=1,d._normSign();var v,E;this.length>f.length?(v=this,E=f):(v=f,E=this);for(var C=0,O=0;O<E.length;O++)d=(v.words[O]|0)+(E.words[O]|0)+C,this.words[O]=d&67108863,C=d>>>26;for(;C!==0&&O<v.length;O++)d=(v.words[O]|0)+C,this.words[O]=d&67108863,C=d>>>26;if(this.length=v.length,C!==0)this.words[this.length]=C,this.length++;else if(v!==this)for(;O<v.length;O++)this.words[O]=v.words[O];return this},s.prototype.add=function(f){var d;return f.negative!==0&&this.negative===0?(f.negative=0,d=this.sub(f),f.negative^=1,d):f.negative===0&&this.negative!==0?(this.negative=0,d=f.sub(this),this.negative=1,d):this.length>f.length?this.clone().iadd(f):f.clone().iadd(this)},s.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var d=this.iadd(f);return f.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var v=this.cmp(f);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var E,C;v>0?(E=this,C=f):(E=f,C=this);for(var O=0,M=0;M<C.length;M++)d=(E.words[M]|0)-(C.words[M]|0)+O,O=d>>26,this.words[M]=d&67108863;for(;O!==0&&M<E.length;M++)d=(E.words[M]|0)+O,O=d>>26,this.words[M]=d&67108863;if(O===0&&M<E.length&&E!==this)for(;M<E.length;M++)this.words[M]=E.words[M];return this.length=Math.max(this.length,M),E!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(f){return this.clone().isub(f)};function K(f,d,v){v.negative=d.negative^f.negative;var E=f.length+d.length|0;v.length=E,E=E-1|0;var C=f.words[0]|0,O=d.words[0]|0,M=C*O,g=M&67108863,m=M/67108864|0;v.words[0]=g;for(var N=1;N<E;N++){for(var X=m>>>26,ae=m&67108863,P=Math.min(N,d.length-1),te=Math.max(0,N-f.length+1);te<=P;te++){var z=N-te|0;C=f.words[z]|0,O=d.words[te]|0,M=C*O+ae,X+=M/67108864|0,ae=M&67108863}v.words[N]=ae|0,m=X|0}return m!==0?v.words[N]=m|0:v.length--,v._strip()}var F=function(f,d,v){var E=f.words,C=d.words,O=v.words,M=0,g,m,N,X=E[0]|0,ae=X&8191,P=X>>>13,te=E[1]|0,z=te&8191,G=te>>>13,J=E[2]|0,A=J&8191,V=J>>>13,oe=E[3]|0,ue=oe&8191,he=oe>>>13,ye=E[4]|0,we=ye&8191,Re=ye>>>13,Xe=E[5]|0,Oe=Xe&8191,Ne=Xe>>>13,Me=E[6]|0,be=Me&8191,Pe=Me>>>13,Te=E[7]|0,ve=Te&8191,$e=Te>>>13,Se=E[8]|0,me=Se&8191,Ue=Se>>>13,Ce=E[9]|0,_e=Ce&8191,Ke=Ce>>>13,Ve=C[0]|0,Ae=Ve&8191,We=Ve>>>13,pt=C[1]|0,Ge=pt&8191,It=pt>>>13,gt=C[2]|0,Ye=gt&8191,Ot=gt>>>13,Tt=C[3]|0,Le=Tt&8191,et=Tt>>>13,it=C[4]|0,Be=it&8191,rt=it>>>13,tt=C[5]|0,qe=tt&8191,ht=tt>>>13,nt=C[6]|0,je=nt&8191,st=nt>>>13,at=C[7]|0,Fe=at&8191,Ze=at>>>13,lt=C[8]|0,ze=lt&8191,qt=lt>>>13,jt=C[9]|0,ct=jt&8191,_t=jt>>>13;v.negative=f.negative^d.negative,v.length=19,g=Math.imul(ae,Ae),m=Math.imul(ae,We),m=m+Math.imul(P,Ae)|0,N=Math.imul(P,We);var Zr=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,g=Math.imul(z,Ae),m=Math.imul(z,We),m=m+Math.imul(G,Ae)|0,N=Math.imul(G,We),g=g+Math.imul(ae,Ge)|0,m=m+Math.imul(ae,It)|0,m=m+Math.imul(P,Ge)|0,N=N+Math.imul(P,It)|0;var Xr=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,g=Math.imul(A,Ae),m=Math.imul(A,We),m=m+Math.imul(V,Ae)|0,N=Math.imul(V,We),g=g+Math.imul(z,Ge)|0,m=m+Math.imul(z,It)|0,m=m+Math.imul(G,Ge)|0,N=N+Math.imul(G,It)|0,g=g+Math.imul(ae,Ye)|0,m=m+Math.imul(ae,Ot)|0,m=m+Math.imul(P,Ye)|0,N=N+Math.imul(P,Ot)|0;var ei=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(ei>>>26)|0,ei&=67108863,g=Math.imul(ue,Ae),m=Math.imul(ue,We),m=m+Math.imul(he,Ae)|0,N=Math.imul(he,We),g=g+Math.imul(A,Ge)|0,m=m+Math.imul(A,It)|0,m=m+Math.imul(V,Ge)|0,N=N+Math.imul(V,It)|0,g=g+Math.imul(z,Ye)|0,m=m+Math.imul(z,Ot)|0,m=m+Math.imul(G,Ye)|0,N=N+Math.imul(G,Ot)|0,g=g+Math.imul(ae,Le)|0,m=m+Math.imul(ae,et)|0,m=m+Math.imul(P,Le)|0,N=N+Math.imul(P,et)|0;var ti=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(ti>>>26)|0,ti&=67108863,g=Math.imul(we,Ae),m=Math.imul(we,We),m=m+Math.imul(Re,Ae)|0,N=Math.imul(Re,We),g=g+Math.imul(ue,Ge)|0,m=m+Math.imul(ue,It)|0,m=m+Math.imul(he,Ge)|0,N=N+Math.imul(he,It)|0,g=g+Math.imul(A,Ye)|0,m=m+Math.imul(A,Ot)|0,m=m+Math.imul(V,Ye)|0,N=N+Math.imul(V,Ot)|0,g=g+Math.imul(z,Le)|0,m=m+Math.imul(z,et)|0,m=m+Math.imul(G,Le)|0,N=N+Math.imul(G,et)|0,g=g+Math.imul(ae,Be)|0,m=m+Math.imul(ae,rt)|0,m=m+Math.imul(P,Be)|0,N=N+Math.imul(P,rt)|0;var ri=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(ri>>>26)|0,ri&=67108863,g=Math.imul(Oe,Ae),m=Math.imul(Oe,We),m=m+Math.imul(Ne,Ae)|0,N=Math.imul(Ne,We),g=g+Math.imul(we,Ge)|0,m=m+Math.imul(we,It)|0,m=m+Math.imul(Re,Ge)|0,N=N+Math.imul(Re,It)|0,g=g+Math.imul(ue,Ye)|0,m=m+Math.imul(ue,Ot)|0,m=m+Math.imul(he,Ye)|0,N=N+Math.imul(he,Ot)|0,g=g+Math.imul(A,Le)|0,m=m+Math.imul(A,et)|0,m=m+Math.imul(V,Le)|0,N=N+Math.imul(V,et)|0,g=g+Math.imul(z,Be)|0,m=m+Math.imul(z,rt)|0,m=m+Math.imul(G,Be)|0,N=N+Math.imul(G,rt)|0,g=g+Math.imul(ae,qe)|0,m=m+Math.imul(ae,ht)|0,m=m+Math.imul(P,qe)|0,N=N+Math.imul(P,ht)|0;var vr=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(vr>>>26)|0,vr&=67108863,g=Math.imul(be,Ae),m=Math.imul(be,We),m=m+Math.imul(Pe,Ae)|0,N=Math.imul(Pe,We),g=g+Math.imul(Oe,Ge)|0,m=m+Math.imul(Oe,It)|0,m=m+Math.imul(Ne,Ge)|0,N=N+Math.imul(Ne,It)|0,g=g+Math.imul(we,Ye)|0,m=m+Math.imul(we,Ot)|0,m=m+Math.imul(Re,Ye)|0,N=N+Math.imul(Re,Ot)|0,g=g+Math.imul(ue,Le)|0,m=m+Math.imul(ue,et)|0,m=m+Math.imul(he,Le)|0,N=N+Math.imul(he,et)|0,g=g+Math.imul(A,Be)|0,m=m+Math.imul(A,rt)|0,m=m+Math.imul(V,Be)|0,N=N+Math.imul(V,rt)|0,g=g+Math.imul(z,qe)|0,m=m+Math.imul(z,ht)|0,m=m+Math.imul(G,qe)|0,N=N+Math.imul(G,ht)|0,g=g+Math.imul(ae,je)|0,m=m+Math.imul(ae,st)|0,m=m+Math.imul(P,je)|0,N=N+Math.imul(P,st)|0;var Ii=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(Ii>>>26)|0,Ii&=67108863,g=Math.imul(ve,Ae),m=Math.imul(ve,We),m=m+Math.imul($e,Ae)|0,N=Math.imul($e,We),g=g+Math.imul(be,Ge)|0,m=m+Math.imul(be,It)|0,m=m+Math.imul(Pe,Ge)|0,N=N+Math.imul(Pe,It)|0,g=g+Math.imul(Oe,Ye)|0,m=m+Math.imul(Oe,Ot)|0,m=m+Math.imul(Ne,Ye)|0,N=N+Math.imul(Ne,Ot)|0,g=g+Math.imul(we,Le)|0,m=m+Math.imul(we,et)|0,m=m+Math.imul(Re,Le)|0,N=N+Math.imul(Re,et)|0,g=g+Math.imul(ue,Be)|0,m=m+Math.imul(ue,rt)|0,m=m+Math.imul(he,Be)|0,N=N+Math.imul(he,rt)|0,g=g+Math.imul(A,qe)|0,m=m+Math.imul(A,ht)|0,m=m+Math.imul(V,qe)|0,N=N+Math.imul(V,ht)|0,g=g+Math.imul(z,je)|0,m=m+Math.imul(z,st)|0,m=m+Math.imul(G,je)|0,N=N+Math.imul(G,st)|0,g=g+Math.imul(ae,Fe)|0,m=m+Math.imul(ae,Ze)|0,m=m+Math.imul(P,Fe)|0,N=N+Math.imul(P,Ze)|0;var On=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(On>>>26)|0,On&=67108863,g=Math.imul(me,Ae),m=Math.imul(me,We),m=m+Math.imul(Ue,Ae)|0,N=Math.imul(Ue,We),g=g+Math.imul(ve,Ge)|0,m=m+Math.imul(ve,It)|0,m=m+Math.imul($e,Ge)|0,N=N+Math.imul($e,It)|0,g=g+Math.imul(be,Ye)|0,m=m+Math.imul(be,Ot)|0,m=m+Math.imul(Pe,Ye)|0,N=N+Math.imul(Pe,Ot)|0,g=g+Math.imul(Oe,Le)|0,m=m+Math.imul(Oe,et)|0,m=m+Math.imul(Ne,Le)|0,N=N+Math.imul(Ne,et)|0,g=g+Math.imul(we,Be)|0,m=m+Math.imul(we,rt)|0,m=m+Math.imul(Re,Be)|0,N=N+Math.imul(Re,rt)|0,g=g+Math.imul(ue,qe)|0,m=m+Math.imul(ue,ht)|0,m=m+Math.imul(he,qe)|0,N=N+Math.imul(he,ht)|0,g=g+Math.imul(A,je)|0,m=m+Math.imul(A,st)|0,m=m+Math.imul(V,je)|0,N=N+Math.imul(V,st)|0,g=g+Math.imul(z,Fe)|0,m=m+Math.imul(z,Ze)|0,m=m+Math.imul(G,Fe)|0,N=N+Math.imul(G,Ze)|0,g=g+Math.imul(ae,ze)|0,m=m+Math.imul(ae,qt)|0,m=m+Math.imul(P,ze)|0,N=N+Math.imul(P,qt)|0;var Mi=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(Mi>>>26)|0,Mi&=67108863,g=Math.imul(_e,Ae),m=Math.imul(_e,We),m=m+Math.imul(Ke,Ae)|0,N=Math.imul(Ke,We),g=g+Math.imul(me,Ge)|0,m=m+Math.imul(me,It)|0,m=m+Math.imul(Ue,Ge)|0,N=N+Math.imul(Ue,It)|0,g=g+Math.imul(ve,Ye)|0,m=m+Math.imul(ve,Ot)|0,m=m+Math.imul($e,Ye)|0,N=N+Math.imul($e,Ot)|0,g=g+Math.imul(be,Le)|0,m=m+Math.imul(be,et)|0,m=m+Math.imul(Pe,Le)|0,N=N+Math.imul(Pe,et)|0,g=g+Math.imul(Oe,Be)|0,m=m+Math.imul(Oe,rt)|0,m=m+Math.imul(Ne,Be)|0,N=N+Math.imul(Ne,rt)|0,g=g+Math.imul(we,qe)|0,m=m+Math.imul(we,ht)|0,m=m+Math.imul(Re,qe)|0,N=N+Math.imul(Re,ht)|0,g=g+Math.imul(ue,je)|0,m=m+Math.imul(ue,st)|0,m=m+Math.imul(he,je)|0,N=N+Math.imul(he,st)|0,g=g+Math.imul(A,Fe)|0,m=m+Math.imul(A,Ze)|0,m=m+Math.imul(V,Fe)|0,N=N+Math.imul(V,Ze)|0,g=g+Math.imul(z,ze)|0,m=m+Math.imul(z,qt)|0,m=m+Math.imul(G,ze)|0,N=N+Math.imul(G,qt)|0,g=g+Math.imul(ae,ct)|0,m=m+Math.imul(ae,_t)|0,m=m+Math.imul(P,ct)|0,N=N+Math.imul(P,_t)|0;var Pn=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,g=Math.imul(_e,Ge),m=Math.imul(_e,It),m=m+Math.imul(Ke,Ge)|0,N=Math.imul(Ke,It),g=g+Math.imul(me,Ye)|0,m=m+Math.imul(me,Ot)|0,m=m+Math.imul(Ue,Ye)|0,N=N+Math.imul(Ue,Ot)|0,g=g+Math.imul(ve,Le)|0,m=m+Math.imul(ve,et)|0,m=m+Math.imul($e,Le)|0,N=N+Math.imul($e,et)|0,g=g+Math.imul(be,Be)|0,m=m+Math.imul(be,rt)|0,m=m+Math.imul(Pe,Be)|0,N=N+Math.imul(Pe,rt)|0,g=g+Math.imul(Oe,qe)|0,m=m+Math.imul(Oe,ht)|0,m=m+Math.imul(Ne,qe)|0,N=N+Math.imul(Ne,ht)|0,g=g+Math.imul(we,je)|0,m=m+Math.imul(we,st)|0,m=m+Math.imul(Re,je)|0,N=N+Math.imul(Re,st)|0,g=g+Math.imul(ue,Fe)|0,m=m+Math.imul(ue,Ze)|0,m=m+Math.imul(he,Fe)|0,N=N+Math.imul(he,Ze)|0,g=g+Math.imul(A,ze)|0,m=m+Math.imul(A,qt)|0,m=m+Math.imul(V,ze)|0,N=N+Math.imul(V,qt)|0,g=g+Math.imul(z,ct)|0,m=m+Math.imul(z,_t)|0,m=m+Math.imul(G,ct)|0,N=N+Math.imul(G,_t)|0;var $n=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+($n>>>26)|0,$n&=67108863,g=Math.imul(_e,Ye),m=Math.imul(_e,Ot),m=m+Math.imul(Ke,Ye)|0,N=Math.imul(Ke,Ot),g=g+Math.imul(me,Le)|0,m=m+Math.imul(me,et)|0,m=m+Math.imul(Ue,Le)|0,N=N+Math.imul(Ue,et)|0,g=g+Math.imul(ve,Be)|0,m=m+Math.imul(ve,rt)|0,m=m+Math.imul($e,Be)|0,N=N+Math.imul($e,rt)|0,g=g+Math.imul(be,qe)|0,m=m+Math.imul(be,ht)|0,m=m+Math.imul(Pe,qe)|0,N=N+Math.imul(Pe,ht)|0,g=g+Math.imul(Oe,je)|0,m=m+Math.imul(Oe,st)|0,m=m+Math.imul(Ne,je)|0,N=N+Math.imul(Ne,st)|0,g=g+Math.imul(we,Fe)|0,m=m+Math.imul(we,Ze)|0,m=m+Math.imul(Re,Fe)|0,N=N+Math.imul(Re,Ze)|0,g=g+Math.imul(ue,ze)|0,m=m+Math.imul(ue,qt)|0,m=m+Math.imul(he,ze)|0,N=N+Math.imul(he,qt)|0,g=g+Math.imul(A,ct)|0,m=m+Math.imul(A,_t)|0,m=m+Math.imul(V,ct)|0,N=N+Math.imul(V,_t)|0;var Ci=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(Ci>>>26)|0,Ci&=67108863,g=Math.imul(_e,Le),m=Math.imul(_e,et),m=m+Math.imul(Ke,Le)|0,N=Math.imul(Ke,et),g=g+Math.imul(me,Be)|0,m=m+Math.imul(me,rt)|0,m=m+Math.imul(Ue,Be)|0,N=N+Math.imul(Ue,rt)|0,g=g+Math.imul(ve,qe)|0,m=m+Math.imul(ve,ht)|0,m=m+Math.imul($e,qe)|0,N=N+Math.imul($e,ht)|0,g=g+Math.imul(be,je)|0,m=m+Math.imul(be,st)|0,m=m+Math.imul(Pe,je)|0,N=N+Math.imul(Pe,st)|0,g=g+Math.imul(Oe,Fe)|0,m=m+Math.imul(Oe,Ze)|0,m=m+Math.imul(Ne,Fe)|0,N=N+Math.imul(Ne,Ze)|0,g=g+Math.imul(we,ze)|0,m=m+Math.imul(we,qt)|0,m=m+Math.imul(Re,ze)|0,N=N+Math.imul(Re,qt)|0,g=g+Math.imul(ue,ct)|0,m=m+Math.imul(ue,_t)|0,m=m+Math.imul(he,ct)|0,N=N+Math.imul(he,_t)|0;var an=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(an>>>26)|0,an&=67108863,g=Math.imul(_e,Be),m=Math.imul(_e,rt),m=m+Math.imul(Ke,Be)|0,N=Math.imul(Ke,rt),g=g+Math.imul(me,qe)|0,m=m+Math.imul(me,ht)|0,m=m+Math.imul(Ue,qe)|0,N=N+Math.imul(Ue,ht)|0,g=g+Math.imul(ve,je)|0,m=m+Math.imul(ve,st)|0,m=m+Math.imul($e,je)|0,N=N+Math.imul($e,st)|0,g=g+Math.imul(be,Fe)|0,m=m+Math.imul(be,Ze)|0,m=m+Math.imul(Pe,Fe)|0,N=N+Math.imul(Pe,Ze)|0,g=g+Math.imul(Oe,ze)|0,m=m+Math.imul(Oe,qt)|0,m=m+Math.imul(Ne,ze)|0,N=N+Math.imul(Ne,qt)|0,g=g+Math.imul(we,ct)|0,m=m+Math.imul(we,_t)|0,m=m+Math.imul(Re,ct)|0,N=N+Math.imul(Re,_t)|0;var cn=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(cn>>>26)|0,cn&=67108863,g=Math.imul(_e,qe),m=Math.imul(_e,ht),m=m+Math.imul(Ke,qe)|0,N=Math.imul(Ke,ht),g=g+Math.imul(me,je)|0,m=m+Math.imul(me,st)|0,m=m+Math.imul(Ue,je)|0,N=N+Math.imul(Ue,st)|0,g=g+Math.imul(ve,Fe)|0,m=m+Math.imul(ve,Ze)|0,m=m+Math.imul($e,Fe)|0,N=N+Math.imul($e,Ze)|0,g=g+Math.imul(be,ze)|0,m=m+Math.imul(be,qt)|0,m=m+Math.imul(Pe,ze)|0,N=N+Math.imul(Pe,qt)|0,g=g+Math.imul(Oe,ct)|0,m=m+Math.imul(Oe,_t)|0,m=m+Math.imul(Ne,ct)|0,N=N+Math.imul(Ne,_t)|0;var Cr=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(Cr>>>26)|0,Cr&=67108863,g=Math.imul(_e,je),m=Math.imul(_e,st),m=m+Math.imul(Ke,je)|0,N=Math.imul(Ke,st),g=g+Math.imul(me,Fe)|0,m=m+Math.imul(me,Ze)|0,m=m+Math.imul(Ue,Fe)|0,N=N+Math.imul(Ue,Ze)|0,g=g+Math.imul(ve,ze)|0,m=m+Math.imul(ve,qt)|0,m=m+Math.imul($e,ze)|0,N=N+Math.imul($e,qt)|0,g=g+Math.imul(be,ct)|0,m=m+Math.imul(be,_t)|0,m=m+Math.imul(Pe,ct)|0,N=N+Math.imul(Pe,_t)|0;var Rn=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,g=Math.imul(_e,Fe),m=Math.imul(_e,Ze),m=m+Math.imul(Ke,Fe)|0,N=Math.imul(Ke,Ze),g=g+Math.imul(me,ze)|0,m=m+Math.imul(me,qt)|0,m=m+Math.imul(Ue,ze)|0,N=N+Math.imul(Ue,qt)|0,g=g+Math.imul(ve,ct)|0,m=m+Math.imul(ve,_t)|0,m=m+Math.imul($e,ct)|0,N=N+Math.imul($e,_t)|0;var Nn=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(Nn>>>26)|0,Nn&=67108863,g=Math.imul(_e,ze),m=Math.imul(_e,qt),m=m+Math.imul(Ke,ze)|0,N=Math.imul(Ke,qt),g=g+Math.imul(me,ct)|0,m=m+Math.imul(me,_t)|0,m=m+Math.imul(Ue,ct)|0,N=N+Math.imul(Ue,_t)|0;var Tn=(M+g|0)+((m&8191)<<13)|0;M=(N+(m>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,g=Math.imul(_e,ct),m=Math.imul(_e,_t),m=m+Math.imul(Ke,ct)|0,N=Math.imul(Ke,_t);var va=(M+g|0)+((m&8191)<<13)|0;return M=(N+(m>>>13)|0)+(va>>>26)|0,va&=67108863,O[0]=Zr,O[1]=Xr,O[2]=ei,O[3]=ti,O[4]=ri,O[5]=vr,O[6]=Ii,O[7]=On,O[8]=Mi,O[9]=Pn,O[10]=$n,O[11]=Ci,O[12]=an,O[13]=cn,O[14]=Cr,O[15]=Rn,O[16]=Nn,O[17]=Tn,O[18]=va,M!==0&&(O[19]=M,v.length++),v};Math.imul||(F=K);function W(f,d,v){v.negative=d.negative^f.negative,v.length=f.length+d.length;for(var E=0,C=0,O=0;O<v.length-1;O++){var M=C;C=0;for(var g=E&67108863,m=Math.min(O,d.length-1),N=Math.max(0,O-f.length+1);N<=m;N++){var X=O-N,ae=f.words[X]|0,P=d.words[N]|0,te=ae*P,z=te&67108863;M=M+(te/67108864|0)|0,z=z+g|0,g=z&67108863,M=M+(z>>>26)|0,C+=M>>>26,M&=67108863}v.words[O]=g,E=M,M=C}return E!==0?v.words[O]=E:v.length--,v._strip()}function R(f,d,v){return W(f,d,v)}s.prototype.mulTo=function(f,d){var v,E=this.length+f.length;return this.length===10&&f.length===10?v=F(this,f,d):E<63?v=K(this,f,d):E<1024?v=W(this,f,d):v=R(this,f,d),v},s.prototype.mul=function(f){var d=new s(null);return d.words=new Array(this.length+f.length),this.mulTo(f,d)},s.prototype.mulf=function(f){var d=new s(null);return d.words=new Array(this.length+f.length),R(this,f,d)},s.prototype.imul=function(f){return this.clone().mulTo(f,this)},s.prototype.imuln=function(f){var d=f<0;d&&(f=-f),i(typeof f=="number"),i(f<67108864);for(var v=0,E=0;E<this.length;E++){var C=(this.words[E]|0)*f,O=(C&67108863)+(v&67108863);v>>=26,v+=C/67108864|0,v+=O>>>26,this.words[E]=O&67108863}return v!==0&&(this.words[E]=v,this.length++),d?this.ineg():this},s.prototype.muln=function(f){return this.clone().imuln(f)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(f){var d=q(f);if(d.length===0)return new s(1);for(var v=this,E=0;E<d.length&&d[E]===0;E++,v=v.sqr());if(++E<d.length)for(var C=v.sqr();E<d.length;E++,C=C.sqr())d[E]!==0&&(v=v.mul(C));return v},s.prototype.iushln=function(f){i(typeof f=="number"&&f>=0);var d=f%26,v=(f-d)/26,E=67108863>>>26-d<<26-d,C;if(d!==0){var O=0;for(C=0;C<this.length;C++){var M=this.words[C]&E,g=(this.words[C]|0)-M<<d;this.words[C]=g|O,O=M>>>26-d}O&&(this.words[C]=O,this.length++)}if(v!==0){for(C=this.length-1;C>=0;C--)this.words[C+v]=this.words[C];for(C=0;C<v;C++)this.words[C]=0;this.length+=v}return this._strip()},s.prototype.ishln=function(f){return i(this.negative===0),this.iushln(f)},s.prototype.iushrn=function(f,d,v){i(typeof f=="number"&&f>=0);var E;d?E=(d-d%26)/26:E=0;var C=f%26,O=Math.min((f-C)/26,this.length),M=67108863^67108863>>>C<<C,g=v;if(E-=O,E=Math.max(0,E),g){for(var m=0;m<O;m++)g.words[m]=this.words[m];g.length=O}if(O!==0)if(this.length>O)for(this.length-=O,m=0;m<this.length;m++)this.words[m]=this.words[m+O];else this.words[0]=0,this.length=1;var N=0;for(m=this.length-1;m>=0&&(N!==0||m>=E);m--){var X=this.words[m]|0;this.words[m]=N<<26-C|X>>>C,N=X&M}return g&&N!==0&&(g.words[g.length++]=N),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(f,d,v){return i(this.negative===0),this.iushrn(f,d,v)},s.prototype.shln=function(f){return this.clone().ishln(f)},s.prototype.ushln=function(f){return this.clone().iushln(f)},s.prototype.shrn=function(f){return this.clone().ishrn(f)},s.prototype.ushrn=function(f){return this.clone().iushrn(f)},s.prototype.testn=function(f){i(typeof f=="number"&&f>=0);var d=f%26,v=(f-d)/26,E=1<<d;if(this.length<=v)return!1;var C=this.words[v];return!!(C&E)},s.prototype.imaskn=function(f){i(typeof f=="number"&&f>=0);var d=f%26,v=(f-d)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(d!==0&&v++,this.length=Math.min(v,this.length),d!==0){var E=67108863^67108863>>>d<<d;this.words[this.length-1]&=E}return this._strip()},s.prototype.maskn=function(f){return this.clone().imaskn(f)},s.prototype.iaddn=function(f){return i(typeof f=="number"),i(f<67108864),f<0?this.isubn(-f):this.negative!==0?this.length===1&&(this.words[0]|0)<=f?(this.words[0]=f-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(f),this.negative=1,this):this._iaddn(f)},s.prototype._iaddn=function(f){this.words[0]+=f;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(f){if(i(typeof f=="number"),i(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,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(f){return this.clone().iaddn(f)},s.prototype.subn=function(f){return this.clone().isubn(f)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(f,d,v){var E=f.length+v,C;this._expand(E);var O,M=0;for(C=0;C<f.length;C++){O=(this.words[C+v]|0)+M;var g=(f.words[C]|0)*d;O-=g&67108863,M=(O>>26)-(g/67108864|0),this.words[C+v]=O&67108863}for(;C<this.length-v;C++)O=(this.words[C+v]|0)+M,M=O>>26,this.words[C+v]=O&67108863;if(M===0)return this._strip();for(i(M===-1),M=0,C=0;C<this.length;C++)O=-(this.words[C]|0)+M,M=O>>26,this.words[C]=O&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(f,d){var v=this.length-f.length,E=this.clone(),C=f,O=C.words[C.length-1]|0,M=this._countBits(O);v=26-M,v!==0&&(C=C.ushln(v),E.iushln(v),O=C.words[C.length-1]|0);var g=E.length-C.length,m;if(d!=="mod"){m=new s(null),m.length=g+1,m.words=new Array(m.length);for(var N=0;N<m.length;N++)m.words[N]=0}var X=E.clone()._ishlnsubmul(C,1,g);X.negative===0&&(E=X,m&&(m.words[g]=1));for(var ae=g-1;ae>=0;ae--){var P=(E.words[C.length+ae]|0)*67108864+(E.words[C.length+ae-1]|0);for(P=Math.min(P/O|0,67108863),E._ishlnsubmul(C,P,ae);E.negative!==0;)P--,E.negative=0,E._ishlnsubmul(C,1,ae),E.isZero()||(E.negative^=1);m&&(m.words[ae]=P)}return m&&m._strip(),E._strip(),d!=="div"&&v!==0&&E.iushrn(v),{div:m||null,mod:E}},s.prototype.divmod=function(f,d,v){if(i(!f.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var E,C,O;return this.negative!==0&&f.negative===0?(O=this.neg().divmod(f,d),d!=="mod"&&(E=O.div.neg()),d!=="div"&&(C=O.mod.neg(),v&&C.negative!==0&&C.iadd(f)),{div:E,mod:C}):this.negative===0&&f.negative!==0?(O=this.divmod(f.neg(),d),d!=="mod"&&(E=O.div.neg()),{div:E,mod:O.mod}):this.negative&f.negative?(O=this.neg().divmod(f.neg(),d),d!=="div"&&(C=O.mod.neg(),v&&C.negative!==0&&C.isub(f)),{div:O.div,mod:C}):f.length>this.length||this.cmp(f)<0?{div:new s(0),mod:this}:f.length===1?d==="div"?{div:this.divn(f.words[0]),mod:null}:d==="mod"?{div:null,mod:new s(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new s(this.modrn(f.words[0]))}:this._wordDiv(f,d)},s.prototype.div=function(f){return this.divmod(f,"div",!1).div},s.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},s.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},s.prototype.divRound=function(f){var d=this.divmod(f);if(d.mod.isZero())return d.div;var v=d.div.negative!==0?d.mod.isub(f):d.mod,E=f.ushrn(1),C=f.andln(1),O=v.cmp(E);return O<0||C===1&&O===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},s.prototype.modrn=function(f){var d=f<0;d&&(f=-f),i(f<=67108863);for(var v=(1<<26)%f,E=0,C=this.length-1;C>=0;C--)E=(v*E+(this.words[C]|0))%f;return d?-E:E},s.prototype.modn=function(f){return this.modrn(f)},s.prototype.idivn=function(f){var d=f<0;d&&(f=-f),i(f<=67108863);for(var v=0,E=this.length-1;E>=0;E--){var C=(this.words[E]|0)+v*67108864;this.words[E]=C/f|0,v=C%f}return this._strip(),d?this.ineg():this},s.prototype.divn=function(f){return this.clone().idivn(f)},s.prototype.egcd=function(f){i(f.negative===0),i(!f.isZero());var d=this,v=f.clone();d.negative!==0?d=d.umod(f):d=d.clone();for(var E=new s(1),C=new s(0),O=new s(0),M=new s(1),g=0;d.isEven()&&v.isEven();)d.iushrn(1),v.iushrn(1),++g;for(var m=v.clone(),N=d.clone();!d.isZero();){for(var X=0,ae=1;!(d.words[0]&ae)&&X<26;++X,ae<<=1);if(X>0)for(d.iushrn(X);X-- >0;)(E.isOdd()||C.isOdd())&&(E.iadd(m),C.isub(N)),E.iushrn(1),C.iushrn(1);for(var P=0,te=1;!(v.words[0]&te)&&P<26;++P,te<<=1);if(P>0)for(v.iushrn(P);P-- >0;)(O.isOdd()||M.isOdd())&&(O.iadd(m),M.isub(N)),O.iushrn(1),M.iushrn(1);d.cmp(v)>=0?(d.isub(v),E.isub(O),C.isub(M)):(v.isub(d),O.isub(E),M.isub(C))}return{a:O,b:M,gcd:v.iushln(g)}},s.prototype._invmp=function(f){i(f.negative===0),i(!f.isZero());var d=this,v=f.clone();d.negative!==0?d=d.umod(f):d=d.clone();for(var E=new s(1),C=new s(0),O=v.clone();d.cmpn(1)>0&&v.cmpn(1)>0;){for(var M=0,g=1;!(d.words[0]&g)&&M<26;++M,g<<=1);if(M>0)for(d.iushrn(M);M-- >0;)E.isOdd()&&E.iadd(O),E.iushrn(1);for(var m=0,N=1;!(v.words[0]&N)&&m<26;++m,N<<=1);if(m>0)for(v.iushrn(m);m-- >0;)C.isOdd()&&C.iadd(O),C.iushrn(1);d.cmp(v)>=0?(d.isub(v),E.isub(C)):(v.isub(d),C.isub(E))}var X;return d.cmpn(1)===0?X=E:X=C,X.cmpn(0)<0&&X.iadd(f),X},s.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var d=this.clone(),v=f.clone();d.negative=0,v.negative=0;for(var E=0;d.isEven()&&v.isEven();E++)d.iushrn(1),v.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;v.isEven();)v.iushrn(1);var C=d.cmp(v);if(C<0){var O=d;d=v,v=O}else if(C===0||v.cmpn(1)===0)break;d.isub(v)}while(!0);return v.iushln(E)},s.prototype.invm=function(f){return this.egcd(f).a.umod(f)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(f){return this.words[0]&f},s.prototype.bincn=function(f){i(typeof f=="number");var d=f%26,v=(f-d)/26,E=1<<d;if(this.length<=v)return this._expand(v+1),this.words[v]|=E,this;for(var C=E,O=v;C!==0&&O<this.length;O++){var M=this.words[O]|0;M+=C,C=M>>>26,M&=67108863,this.words[O]=M}return C!==0&&(this.words[O]=C,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(f){var d=f<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var v;if(this.length>1)v=1;else{d&&(f=-f),i(f<=67108863,"Number is too big");var E=this.words[0]|0;v=E===f?0:E<f?-1:1}return this.negative!==0?-v|0:v},s.prototype.cmp=function(f){if(this.negative!==0&&f.negative===0)return-1;if(this.negative===0&&f.negative!==0)return 1;var d=this.ucmp(f);return this.negative!==0?-d|0:d},s.prototype.ucmp=function(f){if(this.length>f.length)return 1;if(this.length<f.length)return-1;for(var d=0,v=this.length-1;v>=0;v--){var E=this.words[v]|0,C=f.words[v]|0;if(E!==C){E<C?d=-1:E>C&&(d=1);break}}return d},s.prototype.gtn=function(f){return this.cmpn(f)===1},s.prototype.gt=function(f){return this.cmp(f)===1},s.prototype.gten=function(f){return this.cmpn(f)>=0},s.prototype.gte=function(f){return this.cmp(f)>=0},s.prototype.ltn=function(f){return this.cmpn(f)===-1},s.prototype.lt=function(f){return this.cmp(f)===-1},s.prototype.lten=function(f){return this.cmpn(f)<=0},s.prototype.lte=function(f){return this.cmp(f)<=0},s.prototype.eqn=function(f){return this.cmpn(f)===0},s.prototype.eq=function(f){return this.cmp(f)===0},s.red=function(f){return new L(f)},s.prototype.toRed=function(f){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(f){return this.red=f,this},s.prototype.forceRed=function(f){return i(!this.red,"Already a number in reduction context"),this._forceRed(f)},s.prototype.redAdd=function(f){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},s.prototype.redIAdd=function(f){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},s.prototype.redSub=function(f){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},s.prototype.redISub=function(f){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},s.prototype.redShl=function(f){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},s.prototype.redMul=function(f){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},s.prototype.redIMul=function(f){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},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(f){return i(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var k={k256:null,p224:null,p192:null,p25519:null};function H(f,d){this.name=f,this.p=new s(d,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}H.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},H.prototype.ireduce=function(f){var d=f,v;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),v=d.bitLength();while(v>this.n);var E=v<this.n?-1:d.ucmp(this.p);return E===0?(d.words[0]=0,d.length=1):E>0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},H.prototype.split=function(f,d){f.iushrn(this.n,0,d)},H.prototype.imulK=function(f){return f.imul(this.k)};function _(){H.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(_,H),_.prototype.split=function(f,d){for(var v=4194303,E=Math.min(f.length,9),C=0;C<E;C++)d.words[C]=f.words[C];if(d.length=E,f.length<=9){f.words[0]=0,f.length=1;return}var O=f.words[9];for(d.words[d.length++]=O&v,C=10;C<f.length;C++){var M=f.words[C]|0;f.words[C-10]=(M&v)<<4|O>>>22,O=M}O>>>=22,f.words[C-10]=O,O===0&&f.length>10?f.length-=10:f.length-=9},_.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var d=0,v=0;v<f.length;v++){var E=f.words[v]|0;d+=E*977,f.words[v]=d&67108863,d=E*64+(d/67108864|0)}return f.words[f.length-1]===0&&(f.length--,f.words[f.length-1]===0&&f.length--),f};function B(){H.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(B,H);function ee(){H.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(ee,H);function ie(){H.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(ie,H),ie.prototype.imulK=function(f){for(var d=0,v=0;v<f.length;v++){var E=(f.words[v]|0)*19+d,C=E&67108863;E>>>=26,f.words[v]=C,d=E}return d!==0&&(f.words[f.length++]=d),f},s._prime=function(f){if(k[f])return k[f];var d;if(f==="k256")d=new _;else if(f==="p224")d=new B;else if(f==="p192")d=new ee;else if(f==="p25519")d=new ie;else throw new Error("Unknown prime "+f);return k[f]=d,d};function L(f){if(typeof f=="string"){var d=s._prime(f);this.m=d.p,this.prime=d}else i(f.gtn(1),"modulus must be greater than 1"),this.m=f,this.prime=null}L.prototype._verify1=function(f){i(f.negative===0,"red works only with positives"),i(f.red,"red works only with red numbers")},L.prototype._verify2=function(f,d){i((f.negative|d.negative)===0,"red works only with positives"),i(f.red&&f.red===d.red,"red works only with red numbers")},L.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(b(f,f.umod(this.m)._forceRed(this)),f)},L.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},L.prototype.add=function(f,d){this._verify2(f,d);var v=f.add(d);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},L.prototype.iadd=function(f,d){this._verify2(f,d);var v=f.iadd(d);return v.cmp(this.m)>=0&&v.isub(this.m),v},L.prototype.sub=function(f,d){this._verify2(f,d);var v=f.sub(d);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},L.prototype.isub=function(f,d){this._verify2(f,d);var v=f.isub(d);return v.cmpn(0)<0&&v.iadd(this.m),v},L.prototype.shl=function(f,d){return this._verify1(f),this.imod(f.ushln(d))},L.prototype.imul=function(f,d){return this._verify2(f,d),this.imod(f.imul(d))},L.prototype.mul=function(f,d){return this._verify2(f,d),this.imod(f.mul(d))},L.prototype.isqr=function(f){return this.imul(f,f.clone())},L.prototype.sqr=function(f){return this.mul(f,f)},L.prototype.sqrt=function(f){if(f.isZero())return f.clone();var d=this.m.andln(3);if(i(d%2===1),d===3){var v=this.m.add(new s(1)).iushrn(2);return this.pow(f,v)}for(var E=this.m.subn(1),C=0;!E.isZero()&&E.andln(1)===0;)C++,E.iushrn(1);i(!E.isZero());var O=new s(1).toRed(this),M=O.redNeg(),g=this.m.subn(1).iushrn(1),m=this.m.bitLength();for(m=new s(2*m*m).toRed(this);this.pow(m,g).cmp(M)!==0;)m.redIAdd(M);for(var N=this.pow(m,E),X=this.pow(f,E.addn(1).iushrn(1)),ae=this.pow(f,E),P=C;ae.cmp(O)!==0;){for(var te=ae,z=0;te.cmp(O)!==0;z++)te=te.redSqr();i(z<P);var G=this.pow(N,new s(1).iushln(P-z-1));X=X.redMul(G),N=G.redSqr(),ae=ae.redMul(N),P=z}return X},L.prototype.invm=function(f){var d=f._invmp(this.m);return d.negative!==0?(d.negative=0,this.imod(d).redNeg()):this.imod(d)},L.prototype.pow=function(f,d){if(d.isZero())return new s(1).toRed(this);if(d.cmpn(1)===0)return f.clone();var v=4,E=new Array(1<<v);E[0]=new s(1).toRed(this),E[1]=f;for(var C=2;C<E.length;C++)E[C]=this.mul(E[C-1],f);var O=E[0],M=0,g=0,m=d.bitLength()%26;for(m===0&&(m=26),C=d.length-1;C>=0;C--){for(var N=d.words[C],X=m-1;X>=0;X--){var ae=N>>X&1;if(O!==E[0]&&(O=this.sqr(O)),ae===0&&M===0){g=0;continue}M<<=1,M|=ae,g++,!(g!==v&&(C!==0||X!==0))&&(O=this.mul(O,E[M]),g=0,M=0)}m=26}return O},L.prototype.convertTo=function(f){var d=f.umod(this.m);return d===f?d.clone():d},L.prototype.convertFrom=function(f){var d=f.clone();return d.red=null,d},s.mont=function(f){return new y(f)};function y(f){L.call(this,f),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(y,L),y.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},y.prototype.convertFrom=function(f){var d=this.imod(f.mul(this.rinv));return d.red=null,d},y.prototype.imul=function(f,d){if(f.isZero()||d.isZero())return f.words[0]=0,f.length=1,f;var v=f.imul(d),E=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),C=v.isub(E).iushrn(this.shift),O=C;return C.cmp(this.m)>=0?O=C.isub(this.m):C.cmpn(0)<0&&(O=C.iadd(this.m)),O._forceRed(this)},y.prototype.mul=function(f,d){if(f.isZero()||d.isZero())return new s(0)._forceRed(this);var v=f.mul(d),E=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),C=v.isub(E).iushrn(this.shift),O=C;return C.cmp(this.m)>=0?O=C.isub(this.m):C.cmpn(0)<0&&(O=C.iadd(this.m)),O._forceRed(this)},y.prototype.invm=function(f){var d=this.imod(f._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(t,Z2)})(um);var mt=um.exports;const fm="bignumber/5.7.0";var nh=mt.BN;const Ds=new Et(fm),ld={},hm=9007199254740991;function bA(t){return t!=null&&(sr.isBigNumber(t)||typeof t=="number"&&t%1===0||typeof t=="string"&&!!t.match(/^-?[0-9]+$/)||Fi(t)||typeof t=="bigint"||Ya(t))}let lm=!1;class sr{constructor(e,r){e!==ld&&Ds.throwError("cannot call constructor directly; use BigNumber.from",Et.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return yi(Rt(this).fromTwos(e))}toTwos(e){return yi(Rt(this).toTwos(e))}abs(){return this._hex[0]==="-"?sr.from(this._hex.substring(1)):this}add(e){return yi(Rt(this).add(Rt(e)))}sub(e){return yi(Rt(this).sub(Rt(e)))}div(e){return sr.from(e).isZero()&&Zi("division-by-zero","div"),yi(Rt(this).div(Rt(e)))}mul(e){return yi(Rt(this).mul(Rt(e)))}mod(e){const r=Rt(e);return r.isNeg()&&Zi("division-by-zero","mod"),yi(Rt(this).umod(r))}pow(e){const r=Rt(e);return r.isNeg()&&Zi("negative-power","pow"),yi(Rt(this).pow(r))}and(e){const r=Rt(e);return(this.isNegative()||r.isNeg())&&Zi("unbound-bitwise-result","and"),yi(Rt(this).and(r))}or(e){const r=Rt(e);return(this.isNegative()||r.isNeg())&&Zi("unbound-bitwise-result","or"),yi(Rt(this).or(r))}xor(e){const r=Rt(e);return(this.isNegative()||r.isNeg())&&Zi("unbound-bitwise-result","xor"),yi(Rt(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&Zi("negative-width","mask"),yi(Rt(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Zi("negative-width","shl"),yi(Rt(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Zi("negative-width","shr"),yi(Rt(this).shrn(e))}eq(e){return Rt(this).eq(Rt(e))}lt(e){return Rt(this).lt(Rt(e))}lte(e){return Rt(this).lte(Rt(e))}gt(e){return Rt(this).gt(Rt(e))}gte(e){return Rt(this).gte(Rt(e))}isNegative(){return this._hex[0]==="-"}isZero(){return Rt(this).isZero()}toNumber(){try{return Rt(this).toNumber()}catch{Zi("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Ds.throwError("this platform does not support BigInt",Et.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?lm||(lm=!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()",Et.errors.UNEXPECTED_ARGUMENT,{}):Ds.throwError("BigNumber.toString does not accept parameters",Et.errors.UNEXPECTED_ARGUMENT,{})),Rt(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof sr)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new sr(ld,uu(e)):e.match(/^-?[0-9]+$/)?new sr(ld,uu(new nh(e))):Ds.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Zi("underflow","BigNumber.from",e),(e>=hm||e<=-hm)&&Zi("overflow","BigNumber.from",e),sr.from(String(e));const r=e;if(typeof r=="bigint")return sr.from(r.toString());if(Ya(r))return sr.from(si(r));if(r)if(r.toHexString){const i=r.toHexString();if(typeof i=="string")return sr.from(i)}else{let i=r._hex;if(i==null&&r.type==="BigNumber"&&(i=r.hex),typeof i=="string"&&(Fi(i)||i[0]==="-"&&Fi(i.substring(1))))return sr.from(i)}return Ds.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function uu(t){if(typeof t!="string")return uu(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&Ds.throwArgumentError("invalid hex","value",t),t=uu(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function yi(t){return sr.from(uu(t))}function Rt(t){const e=sr.from(t).toHexString();return e[0]==="-"?new nh("-"+e.substring(3),16):new nh(e.substring(2),16)}function Zi(t,e,r){const i={fault:t,operation:e};return r!=null&&(i.value=r),Ds.throwError(t,Et.errors.NUMERIC_FAULT,i)}function yA(t){return new nh(t,36).toString(16)}const oi=new Et(fm),fu={},dm=sr.from(0),pm=sr.from(-1);function gm(t,e,r,i){const n={fault:e,operation:r};return i!==void 0&&(n.value=i),oi.throwError(t,Et.errors.NUMERIC_FAULT,n)}let hu="0";for(;hu.length<256;)hu+=hu;function dd(t){if(typeof t!="number")try{t=sr.from(t).toNumber()}catch{}return typeof t=="number"&&t>=0&&t<=256&&!(t%1)?"1"+hu.substring(0,t):oi.throwArgumentError("invalid decimal size","decimals",t)}function pd(t,e){e==null&&(e=0);const r=dd(e);t=sr.from(t);const i=t.lt(dm);i&&(t=t.mul(pm));let n=t.mod(r).toString();for(;n.length<r.length-1;)n="0"+n;n=n.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=t.div(r).toString();return r.length===1?t=s:t=s+"."+n,i&&(t="-"+t),t}function Os(t,e){e==null&&(e=0);const r=dd(e);(typeof t!="string"||!t.match(/^-?[0-9.]+$/))&&oi.throwArgumentError("invalid decimal value","value",t);const i=t.substring(0,1)==="-";i&&(t=t.substring(1)),t==="."&&oi.throwArgumentError("missing value","value",t);const n=t.split(".");n.length>2&&oi.throwArgumentError("too many decimal points","value",t);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>r.length-1&&gm("fractional component exceeds decimals","underflow","parseFixed"),a===""&&(a="0");a.length<r.length-1;)a+="0";const u=sr.from(s),h=sr.from(a);let l=u.mul(r).add(h);return i&&(l=l.mul(pm)),l}class Qa{constructor(e,r,i,n){e!==fu&&oi.throwError("cannot use FixedFormat constructor; use FixedFormat.from",Et.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=r,this.width=i,this.decimals=n,this.name=(r?"":"u")+"fixed"+String(i)+"x"+String(n),this._multiplier=dd(n),Object.freeze(this)}static from(e){if(e instanceof Qa)return e;typeof e=="number"&&(e=`fixed128x${e}`);let r=!0,i=128,n=18;if(typeof e=="string"){if(e!=="fixed")if(e==="ufixed")r=!1;else{const s=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);s||oi.throwArgumentError("invalid fixed format","format",e),r=s[1]!=="u",i=parseInt(s[2]),n=parseInt(s[3])}}else if(e){const s=(a,u,h)=>e[a]==null?h:(typeof e[a]!==u&&oi.throwArgumentError("invalid fixed format ("+a+" not "+u+")","format."+a,e[a]),e[a]);r=s("signed","boolean",r),i=s("width","number",i),n=s("decimals","number",n)}return i%8&&oi.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",i),n>80&&oi.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new Qa(fu,r,i,n)}}class zr{constructor(e,r,i,n){e!==fu&&oi.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Et.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=r,this._value=i,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&oi.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const r=Os(this._value,this.format.decimals),i=Os(e._value,e.format.decimals);return zr.fromValue(r.add(i),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const r=Os(this._value,this.format.decimals),i=Os(e._value,e.format.decimals);return zr.fromValue(r.sub(i),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const r=Os(this._value,this.format.decimals),i=Os(e._value,e.format.decimals);return zr.fromValue(r.mul(i).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const r=Os(this._value,this.format.decimals),i=Os(e._value,e.format.decimals);return zr.fromValue(r.mul(this.format._multiplier).div(i),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");e.length===1&&e.push("0");let r=zr.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return this.isNegative()&&i&&(r=r.subUnsafe(vm.toFormat(r.format))),r}ceiling(){const e=this.toString().split(".");e.length===1&&e.push("0");let r=zr.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return!this.isNegative()&&i&&(r=r.addUnsafe(vm.toFormat(r.format))),r}round(e){e==null&&(e=0);const r=this.toString().split(".");if(r.length===1&&r.push("0"),(e<0||e>80||e%1)&&oi.throwArgumentError("invalid decimal count","decimals",e),r[1].length<=e)return this;const i=zr.from("1"+hu.substring(0,e),this.format),n=wA.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&&oi.throwArgumentError("invalid byte width","width",e);const r=sr.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return Qn(r,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return zr.fromString(this._value,e)}static fromValue(e,r,i){return i==null&&r!=null&&!bA(r)&&(i=r,r=null),r==null&&(r=0),i==null&&(i="fixed"),zr.fromString(pd(e,r),Qa.from(i))}static fromString(e,r){r==null&&(r="fixed");const i=Qa.from(r),n=Os(e,i.decimals);!i.signed&&n.lt(dm)&&gm("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=pd(n,i.decimals);return new zr(fu,s,a,i)}static fromBytes(e,r){r==null&&(r="fixed");const i=Qa.from(r);if(dr(e).length>i.width/8)throw new Error("overflow");let n=sr.from(e);i.signed&&(n=n.fromTwos(i.width));const s=n.toTwos((i.signed?0:1)+i.width).toHexString(),a=pd(n,i.decimals);return new zr(fu,s,a,i)}static from(e,r){if(typeof e=="string")return zr.fromString(e,r);if(Ya(e))return zr.fromBytes(e,r);try{return zr.fromValue(e,0,r)}catch(i){if(i.code!==Et.errors.INVALID_ARGUMENT)throw i}return oi.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}}const vm=zr.from(1),wA=zr.from("0.5"),_A="strings/5.7.0",mm=new Et(_A);var sh;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(sh||(sh={}));var Za;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(Za||(Za={}));function EA(t,e,r,i,n){return mm.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)}function bm(t,e,r,i,n){if(t===Za.BAD_PREFIX||t===Za.UNEXPECTED_CONTINUE){let s=0;for(let a=e+1;a<r.length&&r[a]>>6===2;a++)s++;return s}return t===Za.OVERRUN?r.length-e-1:0}function AA(t,e,r,i,n){return t===Za.OVERLONG?(i.push(n),0):(i.push(65533),bm(t,e,r))}Object.freeze({error:EA,ignore:bm,replace:AA});function gd(t,e=sh.current){e!=sh.current&&(mm.checkNormalize(),t=t.normalize(e));let r=[];for(let i=0;i<t.length;i++){const n=t.charCodeAt(i);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(n&63|128);else if((n&64512)==55296){i++;const s=t.charCodeAt(i);if(i>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const a=65536+((n&1023)<<10)+(s&1023);r.push(a>>18|240),r.push(a>>12&63|128),r.push(a>>6&63|128),r.push(a&63|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(n&63|128)}return dr(r)}function xA(t){if(t.length%4!==0)throw new Error("bad data");let e=[];for(let r=0;r<t.length;r+=4)e.push(parseInt(t.substring(r,r+4),16));return e}function vd(t,e){e||(e=function(n){return[parseInt(n,16)]});let r=0,i={};return t.split(",").forEach(n=>{let s=n.split(":");r+=parseInt(s[0],16),i[r]=e(s[1])}),i}function ym(t){let e=0;return t.split(",").map(r=>{let i=r.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}})}ym("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(t=>parseInt(t,16)),vd("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"),vd("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"),vd("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",xA),ym("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 wm="hash/5.7.0";function SA(t){t=atob(t);const e=[];for(let r=0;r<t.length;r++)e.push(t.charCodeAt(r));return dr(e)}function _m(t,e){e==null&&(e=1);const r=[],i=r.forEach,n=function(s,a){i.call(s,function(u){a>0&&Array.isArray(u)?n(u,a-1):r.push(u)})};return n(t,e),r}function IA(t){const e={};for(let r=0;r<t.length;r++){const i=t[r];e[i[0]]=i[1]}return e}function MA(t){let e=0;function r(){return t[e++]<<8|t[e++]}let i=r(),n=1,s=[0,1];for(let k=1;k<i;k++)s.push(n+=r());let a=r(),u=e;e+=a;let h=0,l=0;function b(){return h==0&&(l=l<<8|t[e++],h=8),l>>--h&1}const w=31,I=Math.pow(2,w),S=I>>>1,D=S>>1,T=I-1;let q=0;for(let k=0;k<w;k++)q=q<<1|b();let K=[],F=0,W=I;for(;;){let k=Math.floor(((q-F+1)*n-1)/W),H=0,_=i;for(;_-H>1;){let ie=H+_>>>1;k<s[ie]?_=ie:H=ie}if(H==0)break;K.push(H);let B=F+Math.floor(W*s[H]/n),ee=F+Math.floor(W*s[H+1]/n)-1;for(;!((B^ee)&S);)q=q<<1&T|b(),B=B<<1&T,ee=ee<<1&T|1;for(;B&~ee&D;)q=q&S|q<<1&T>>>1|b(),B=B<<1^S,ee=(ee^S)<<1|S|1;F=B,W=1+ee-B}let R=i-4;return K.map(k=>{switch(k-R){case 3:return R+65792+(t[u++]<<16|t[u++]<<8|t[u++]);case 2:return R+256+(t[u++]<<8|t[u++]);case 1:return R+t[u++];default:return k-1}})}function CA(t){let e=0;return()=>t[e++]}function DA(t){return CA(MA(t))}function OA(t){return t&1?~t>>1:t>>1}function PA(t,e){let r=Array(t);for(let i=0;i<t;i++)r[i]=1+e();return r}function Em(t,e){let r=Array(t);for(let i=0,n=-1;i<t;i++)r[i]=n+=1+e();return r}function $A(t,e){let r=Array(t);for(let i=0,n=0;i<t;i++)r[i]=n+=OA(e());return r}function oh(t,e){let r=Em(t(),t),i=t(),n=Em(i,t),s=PA(i,t);for(let a=0;a<i;a++)for(let u=0;u<s[a];u++)r.push(n[a]+u);return e?r.map(a=>e[a]):r}function RA(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(TA(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(LA(r,t))}return IA(_m(e))}function NA(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function Am(t,e,r){let i=Array(t).fill(void 0).map(()=>[]);for(let n=0;n<e;n++)$A(t,r).forEach((s,a)=>i[a].push(s));return i}function TA(t,e){let r=1+e(),i=e(),n=NA(e),s=Am(n.length,1+t,e);return _m(s.map((a,u)=>{const h=a[0],l=a.slice(1);return Array(n[u]).fill(void 0).map((b,w)=>{let I=w*i;return[h+w*r,l.map(S=>S+I)]})}))}function LA(t,e){let r=1+e();return Am(r,1+t,e).map(i=>[i[0],i.slice(1)])}function BA(t){let e=oh(t).sort((i,n)=>i-n);return r();function r(){let i=[];for(;;){let l=oh(t,e);if(l.length==0)break;i.push({set:new Set(l),node:r()})}i.sort((l,b)=>b.set.size-l.set.size);let n=t(),s=n%3;n=n/3|0;let a=!!(n&1);n>>=1;let u=n==1,h=n==2;return{branches:i,valid:s,fe0f:a,save:u,check:h}}}function FA(){return DA(SA("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 ah=FA();new Set(oh(ah)),new Set(oh(ah)),RA(ah),BA(ah),new Et(wm),new Uint8Array(32).fill(0);const UA=`Ethereum Signed Message:
22
+ `;function xm(t){return typeof t=="string"&&(t=gd(t)),hd(lA([gd(UA),gd(String(t.length)),t]))}const kA="rlp/5.7.0";new Et(kA);const qA="address/5.7.0",lu=new Et(qA);function Sm(t){Fi(t,20)||lu.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let n=0;n<40;n++)r[n]=e[n].charCodeAt(0);const i=dr(hd(r));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 jA=9007199254740991;function zA(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const md={};for(let t=0;t<10;t++)md[String(t)]=String(t);for(let t=0;t<26;t++)md[String.fromCharCode(65+t)]=String(10+t);const Im=Math.floor(zA(jA));function HA(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(i=>md[i]).join("");for(;e.length>=Im;){let i=e.substring(0,Im);e=parseInt(i,10)%97+e.substring(i.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function KA(t){let e=null;if(typeof t!="string"&&lu.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=Sm(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&lu.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==HA(t)&&lu.throwArgumentError("bad icap checksum","address",t),e=yA(t.substring(4));e.length<40;)e="0"+e;e=Sm("0x"+e)}else lu.throwArgumentError("invalid address","address",t);return e}const WA="properties/5.7.0";new Et(WA);function du(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}new Et(wm),new Uint8Array(32).fill(0),sr.from(-1);const VA=sr.from(0),GA=sr.from(1);sr.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Qn(GA.toHexString(),32),Qn(VA.toHexString(),32);var Zn={},Nt={},pu=Mm;function Mm(t,e){if(!t)throw new Error(e||"Assertion failed")}Mm.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var bd={exports:{}};typeof Object.create=="function"?bd.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:bd.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}};var JA=pu,YA=bd.exports;Nt.inherits=YA;function QA(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function ZA(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(var i=0,n=0;n<t.length;n++){var s=t.charCodeAt(n);s<128?r[i++]=s:s<2048?(r[i++]=s>>6|192,r[i++]=s&63|128):QA(t,n)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++n)&1023),r[i++]=s>>18|240,r[i++]=s>>12&63|128,r[i++]=s>>6&63|128,r[i++]=s&63|128):(r[i++]=s>>12|224,r[i++]=s>>6&63|128,r[i++]=s&63|128)}else for(n=0;n<t.length;n++)r[n]=t[n]|0;return r}Nt.toArray=ZA;function XA(t){for(var e="",r=0;r<t.length;r++)e+=Dm(t[r].toString(16));return e}Nt.toHex=XA;function Cm(t){var e=t>>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}Nt.htonl=Cm;function ex(t,e){for(var r="",i=0;i<t.length;i++){var n=t[i];e==="little"&&(n=Cm(n)),r+=Om(n.toString(16))}return r}Nt.toHex32=ex;function Dm(t){return t.length===1?"0"+t:t}Nt.zero2=Dm;function Om(t){return t.length===7?"0"+t:t.length===6?"00"+t:t.length===5?"000"+t:t.length===4?"0000"+t:t.length===3?"00000"+t:t.length===2?"000000"+t:t.length===1?"0000000"+t:t}Nt.zero8=Om;function tx(t,e,r,i){var n=r-e;JA(n%4===0);for(var s=new Array(n/4),a=0,u=e;a<s.length;a++,u+=4){var h;i==="big"?h=t[u]<<24|t[u+1]<<16|t[u+2]<<8|t[u+3]:h=t[u+3]<<24|t[u+2]<<16|t[u+1]<<8|t[u],s[a]=h>>>0}return s}Nt.join32=tx;function rx(t,e){for(var r=new Array(t.length*4),i=0,n=0;i<t.length;i++,n+=4){var s=t[i];e==="big"?(r[n]=s>>>24,r[n+1]=s>>>16&255,r[n+2]=s>>>8&255,r[n+3]=s&255):(r[n+3]=s>>>24,r[n+2]=s>>>16&255,r[n+1]=s>>>8&255,r[n]=s&255)}return r}Nt.split32=rx;function ix(t,e){return t>>>e|t<<32-e}Nt.rotr32=ix;function nx(t,e){return t<<e|t>>>32-e}Nt.rotl32=nx;function sx(t,e){return t+e>>>0}Nt.sum32=sx;function ox(t,e,r){return t+e+r>>>0}Nt.sum32_3=ox;function ax(t,e,r,i){return t+e+r+i>>>0}Nt.sum32_4=ax;function cx(t,e,r,i,n){return t+e+r+i+n>>>0}Nt.sum32_5=cx;function ux(t,e,r,i){var n=t[e],s=t[e+1],a=i+s>>>0,u=(a<i?1:0)+r+n;t[e]=u>>>0,t[e+1]=a}Nt.sum64=ux;function fx(t,e,r,i){var n=e+i>>>0,s=(n<e?1:0)+t+r;return s>>>0}Nt.sum64_hi=fx;function hx(t,e,r,i){var n=e+i;return n>>>0}Nt.sum64_lo=hx;function lx(t,e,r,i,n,s,a,u){var h=0,l=e;l=l+i>>>0,h+=l<e?1:0,l=l+s>>>0,h+=l<s?1:0,l=l+u>>>0,h+=l<u?1:0;var b=t+r+n+a+h;return b>>>0}Nt.sum64_4_hi=lx;function dx(t,e,r,i,n,s,a,u){var h=e+i+s+u;return h>>>0}Nt.sum64_4_lo=dx;function px(t,e,r,i,n,s,a,u,h,l){var b=0,w=e;w=w+i>>>0,b+=w<e?1:0,w=w+s>>>0,b+=w<s?1:0,w=w+u>>>0,b+=w<u?1:0,w=w+l>>>0,b+=w<l?1:0;var I=t+r+n+a+h+b;return I>>>0}Nt.sum64_5_hi=px;function gx(t,e,r,i,n,s,a,u,h,l){var b=e+i+s+u+l;return b>>>0}Nt.sum64_5_lo=gx;function vx(t,e,r){var i=e<<32-r|t>>>r;return i>>>0}Nt.rotr64_hi=vx;function mx(t,e,r){var i=t<<32-r|e>>>r;return i>>>0}Nt.rotr64_lo=mx;function bx(t,e,r){return t>>>r}Nt.shr64_hi=bx;function yx(t,e,r){var i=t<<32-r|e>>>r;return i>>>0}Nt.shr64_lo=yx;var Xa={},Pm=Nt,wx=pu;function ch(){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}Xa.BlockHash=ch,ch.prototype.update=function(t,e){if(t=Pm.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var r=t.length%this._delta8;this.pending=t.slice(t.length-r,t.length),this.pending.length===0&&(this.pending=null),t=Pm.join32(t,0,t.length-r,this.endian);for(var i=0;i<t.length;i+=this._delta32)this._update(t,i,i+this._delta32)}return this},ch.prototype.digest=function(t){return this.update(this._pad()),wx(this.pending===null),this._digest(t)},ch.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,r=e-(t+this.padLength)%e,i=new Array(r+this.padLength);i[0]=128;for(var n=1;n<r;n++)i[n]=0;if(t<<=3,this.endian==="big"){for(var s=8;s<this.padLength;s++)i[n++]=0;i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=t>>>24&255,i[n++]=t>>>16&255,i[n++]=t>>>8&255,i[n++]=t&255}else for(i[n++]=t&255,i[n++]=t>>>8&255,i[n++]=t>>>16&255,i[n++]=t>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,s=8;s<this.padLength;s++)i[n++]=0;return i};var ec={},Xn={},_x=Nt,es=_x.rotr32;function Ex(t,e,r,i){if(t===0)return $m(e,r,i);if(t===1||t===3)return Nm(e,r,i);if(t===2)return Rm(e,r,i)}Xn.ft_1=Ex;function $m(t,e,r){return t&e^~t&r}Xn.ch32=$m;function Rm(t,e,r){return t&e^t&r^e&r}Xn.maj32=Rm;function Nm(t,e,r){return t^e^r}Xn.p32=Nm;function Ax(t){return es(t,2)^es(t,13)^es(t,22)}Xn.s0_256=Ax;function xx(t){return es(t,6)^es(t,11)^es(t,25)}Xn.s1_256=xx;function Sx(t){return es(t,7)^es(t,18)^t>>>3}Xn.g0_256=Sx;function Ix(t){return es(t,17)^es(t,19)^t>>>10}Xn.g1_256=Ix;var tc=Nt,Mx=Xa,Cx=Xn,yd=tc.rotl32,gu=tc.sum32,Dx=tc.sum32_5,Ox=Cx.ft_1,Tm=Mx.BlockHash,Px=[1518500249,1859775393,2400959708,3395469782];function ts(){if(!(this instanceof ts))return new ts;Tm.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}tc.inherits(ts,Tm);var $x=ts;ts.blockSize=512,ts.outSize=160,ts.hmacStrength=80,ts.padLength=64,ts.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i<r.length;i++)r[i]=yd(r[i-3]^r[i-8]^r[i-14]^r[i-16],1);var n=this.h[0],s=this.h[1],a=this.h[2],u=this.h[3],h=this.h[4];for(i=0;i<r.length;i++){var l=~~(i/20),b=Dx(yd(n,5),Ox(l,s,a,u),h,r[i],Px[l]);h=u,u=a,a=yd(s,30),s=n,n=b}this.h[0]=gu(this.h[0],n),this.h[1]=gu(this.h[1],s),this.h[2]=gu(this.h[2],a),this.h[3]=gu(this.h[3],u),this.h[4]=gu(this.h[4],h)},ts.prototype._digest=function(t){return t==="hex"?tc.toHex32(this.h,"big"):tc.split32(this.h,"big")};var rc=Nt,Rx=Xa,ic=Xn,Nx=pu,_n=rc.sum32,Tx=rc.sum32_4,Lx=rc.sum32_5,Bx=ic.ch32,Fx=ic.maj32,Ux=ic.s0_256,kx=ic.s1_256,qx=ic.g0_256,jx=ic.g1_256,Lm=Rx.BlockHash,zx=[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 rs(){if(!(this instanceof rs))return new rs;Lm.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=zx,this.W=new Array(64)}rc.inherits(rs,Lm);var Bm=rs;rs.blockSize=512,rs.outSize=256,rs.hmacStrength=192,rs.padLength=64,rs.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i<r.length;i++)r[i]=Tx(jx(r[i-2]),r[i-7],qx(r[i-15]),r[i-16]);var n=this.h[0],s=this.h[1],a=this.h[2],u=this.h[3],h=this.h[4],l=this.h[5],b=this.h[6],w=this.h[7];for(Nx(this.k.length===r.length),i=0;i<r.length;i++){var I=Lx(w,kx(h),Bx(h,l,b),this.k[i],r[i]),S=_n(Ux(n),Fx(n,s,a));w=b,b=l,l=h,h=_n(u,I),u=a,a=s,s=n,n=_n(I,S)}this.h[0]=_n(this.h[0],n),this.h[1]=_n(this.h[1],s),this.h[2]=_n(this.h[2],a),this.h[3]=_n(this.h[3],u),this.h[4]=_n(this.h[4],h),this.h[5]=_n(this.h[5],l),this.h[6]=_n(this.h[6],b),this.h[7]=_n(this.h[7],w)},rs.prototype._digest=function(t){return t==="hex"?rc.toHex32(this.h,"big"):rc.split32(this.h,"big")};var wd=Nt,Fm=Bm;function Ps(){if(!(this instanceof Ps))return new Ps;Fm.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}wd.inherits(Ps,Fm);var Hx=Ps;Ps.blockSize=512,Ps.outSize=224,Ps.hmacStrength=192,Ps.padLength=64,Ps.prototype._digest=function(t){return t==="hex"?wd.toHex32(this.h.slice(0,7),"big"):wd.split32(this.h.slice(0,7),"big")};var wi=Nt,Kx=Xa,Wx=pu,is=wi.rotr64_hi,ns=wi.rotr64_lo,Um=wi.shr64_hi,km=wi.shr64_lo,no=wi.sum64,_d=wi.sum64_hi,Ed=wi.sum64_lo,Vx=wi.sum64_4_hi,Gx=wi.sum64_4_lo,Jx=wi.sum64_5_hi,Yx=wi.sum64_5_lo,qm=Kx.BlockHash,Qx=[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 En(){if(!(this instanceof En))return new En;qm.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=Qx,this.W=new Array(160)}wi.inherits(En,qm);var jm=En;En.blockSize=1024,En.outSize=512,En.hmacStrength=192,En.padLength=128,En.prototype._prepareBlock=function(t,e){for(var r=this.W,i=0;i<32;i++)r[i]=t[e+i];for(;i<r.length;i+=2){var n=cS(r[i-4],r[i-3]),s=uS(r[i-4],r[i-3]),a=r[i-14],u=r[i-13],h=oS(r[i-30],r[i-29]),l=aS(r[i-30],r[i-29]),b=r[i-32],w=r[i-31];r[i]=Vx(n,s,a,u,h,l,b,w),r[i+1]=Gx(n,s,a,u,h,l,b,w)}},En.prototype._update=function(t,e){this._prepareBlock(t,e);var r=this.W,i=this.h[0],n=this.h[1],s=this.h[2],a=this.h[3],u=this.h[4],h=this.h[5],l=this.h[6],b=this.h[7],w=this.h[8],I=this.h[9],S=this.h[10],D=this.h[11],T=this.h[12],q=this.h[13],K=this.h[14],F=this.h[15];Wx(this.k.length===r.length);for(var W=0;W<r.length;W+=2){var R=K,k=F,H=nS(w,I),_=sS(w,I),B=Zx(w,I,S,D,T),ee=Xx(w,I,S,D,T,q),ie=this.k[W],L=this.k[W+1],y=r[W],f=r[W+1],d=Jx(R,k,H,_,B,ee,ie,L,y,f),v=Yx(R,k,H,_,B,ee,ie,L,y,f);R=rS(i,n),k=iS(i,n),H=eS(i,n,s,a,u),_=tS(i,n,s,a,u,h);var E=_d(R,k,H,_),C=Ed(R,k,H,_);K=T,F=q,T=S,q=D,S=w,D=I,w=_d(l,b,d,v),I=Ed(b,b,d,v),l=u,b=h,u=s,h=a,s=i,a=n,i=_d(d,v,E,C),n=Ed(d,v,E,C)}no(this.h,0,i,n),no(this.h,2,s,a),no(this.h,4,u,h),no(this.h,6,l,b),no(this.h,8,w,I),no(this.h,10,S,D),no(this.h,12,T,q),no(this.h,14,K,F)},En.prototype._digest=function(t){return t==="hex"?wi.toHex32(this.h,"big"):wi.split32(this.h,"big")};function Zx(t,e,r,i,n){var s=t&r^~t&n;return s<0&&(s+=4294967296),s}function Xx(t,e,r,i,n,s){var a=e&i^~e&s;return a<0&&(a+=4294967296),a}function eS(t,e,r,i,n){var s=t&r^t&n^r&n;return s<0&&(s+=4294967296),s}function tS(t,e,r,i,n,s){var a=e&i^e&s^i&s;return a<0&&(a+=4294967296),a}function rS(t,e){var r=is(t,e,28),i=is(e,t,2),n=is(e,t,7),s=r^i^n;return s<0&&(s+=4294967296),s}function iS(t,e){var r=ns(t,e,28),i=ns(e,t,2),n=ns(e,t,7),s=r^i^n;return s<0&&(s+=4294967296),s}function nS(t,e){var r=is(t,e,14),i=is(t,e,18),n=is(e,t,9),s=r^i^n;return s<0&&(s+=4294967296),s}function sS(t,e){var r=ns(t,e,14),i=ns(t,e,18),n=ns(e,t,9),s=r^i^n;return s<0&&(s+=4294967296),s}function oS(t,e){var r=is(t,e,1),i=is(t,e,8),n=Um(t,e,7),s=r^i^n;return s<0&&(s+=4294967296),s}function aS(t,e){var r=ns(t,e,1),i=ns(t,e,8),n=km(t,e,7),s=r^i^n;return s<0&&(s+=4294967296),s}function cS(t,e){var r=is(t,e,19),i=is(e,t,29),n=Um(t,e,6),s=r^i^n;return s<0&&(s+=4294967296),s}function uS(t,e){var r=ns(t,e,19),i=ns(e,t,29),n=km(t,e,6),s=r^i^n;return s<0&&(s+=4294967296),s}var Ad=Nt,zm=jm;function $s(){if(!(this instanceof $s))return new $s;zm.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Ad.inherits($s,zm);var fS=$s;$s.blockSize=1024,$s.outSize=384,$s.hmacStrength=192,$s.padLength=128,$s.prototype._digest=function(t){return t==="hex"?Ad.toHex32(this.h.slice(0,12),"big"):Ad.split32(this.h.slice(0,12),"big")},ec.sha1=$x,ec.sha224=Hx,ec.sha256=Bm,ec.sha384=fS,ec.sha512=jm;var Hm={},Ko=Nt,hS=Xa,uh=Ko.rotl32,Km=Ko.sum32,vu=Ko.sum32_3,Wm=Ko.sum32_4,Vm=hS.BlockHash;function ss(){if(!(this instanceof ss))return new ss;Vm.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Ko.inherits(ss,Vm),Hm.ripemd160=ss,ss.blockSize=512,ss.outSize=160,ss.hmacStrength=192,ss.padLength=64,ss.prototype._update=function(t,e){for(var r=this.h[0],i=this.h[1],n=this.h[2],s=this.h[3],a=this.h[4],u=r,h=i,l=n,b=s,w=a,I=0;I<80;I++){var S=Km(uh(Wm(r,Gm(I,i,n,s),t[pS[I]+e],lS(I)),vS[I]),a);r=a,a=s,s=uh(n,10),n=i,i=S,S=Km(uh(Wm(u,Gm(79-I,h,l,b),t[gS[I]+e],dS(I)),mS[I]),w),u=w,w=b,b=uh(l,10),l=h,h=S}S=vu(this.h[1],n,b),this.h[1]=vu(this.h[2],s,w),this.h[2]=vu(this.h[3],a,u),this.h[3]=vu(this.h[4],r,h),this.h[4]=vu(this.h[0],i,l),this.h[0]=S},ss.prototype._digest=function(t){return t==="hex"?Ko.toHex32(this.h,"little"):Ko.split32(this.h,"little")};function Gm(t,e,r,i){return t<=15?e^r^i:t<=31?e&r|~e&i:t<=47?(e|~r)^i:t<=63?e&i|r&~i:e^(r|~i)}function lS(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function dS(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}var pS=[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],gS=[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],vS=[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],mS=[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],bS=Nt,yS=pu;function nc(t,e,r){if(!(this instanceof nc))return new nc(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(bS.toArray(e,r))}var wS=nc;nc.prototype._init=function(t){t.length>this.blockSize&&(t=new this.Hash().update(t).digest()),yS(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=new this.Hash().update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=new this.Hash().update(t)},nc.prototype.update=function(t,e){return this.inner.update(t,e),this},nc.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)},function(t){var e=t;e.utils=Nt,e.common=Xa,e.sha=ec,e.ripemd=Hm,e.hmac=wS,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}(Zn);function sc(t,e,r){return r={path:e,exports:{},require:function(i,n){return _S(i,n??r.path)}},t(r,r.exports),r.exports}function _S(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var xd=Jm;function Jm(t,e){if(!t)throw new Error(e||"Assertion failed")}Jm.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var An=sc(function(t,e){var r=e;function i(a,u){if(Array.isArray(a))return a.slice();if(!a)return[];var h=[];if(typeof a!="string"){for(var l=0;l<a.length;l++)h[l]=a[l]|0;return h}if(u==="hex"){a=a.replace(/[^a-z0-9]+/ig,""),a.length%2!==0&&(a="0"+a);for(var l=0;l<a.length;l+=2)h.push(parseInt(a[l]+a[l+1],16))}else for(var l=0;l<a.length;l++){var b=a.charCodeAt(l),w=b>>8,I=b&255;w?h.push(w,I):h.push(I)}return h}r.toArray=i;function n(a){return a.length===1?"0"+a:a}r.zero2=n;function s(a){for(var u="",h=0;h<a.length;h++)u+=n(a[h].toString(16));return u}r.toHex=s,r.encode=function(a,u){return u==="hex"?s(a):a}}),Ui=sc(function(t,e){var r=e;r.assert=xd,r.toArray=An.toArray,r.zero2=An.zero2,r.toHex=An.toHex,r.encode=An.encode;function i(h,l,b){var w=new Array(Math.max(h.bitLength(),b)+1);w.fill(0);for(var I=1<<l+1,S=h.clone(),D=0;D<w.length;D++){var T,q=S.andln(I-1);S.isOdd()?(q>(I>>1)-1?T=(I>>1)-q:T=q,S.isubn(T)):T=0,w[D]=T,S.iushrn(1)}return w}r.getNAF=i;function n(h,l){var b=[[],[]];h=h.clone(),l=l.clone();for(var w=0,I=0,S;h.cmpn(-w)>0||l.cmpn(-I)>0;){var D=h.andln(3)+w&3,T=l.andln(3)+I&3;D===3&&(D=-1),T===3&&(T=-1);var q;D&1?(S=h.andln(7)+w&7,(S===3||S===5)&&T===2?q=-D:q=D):q=0,b[0].push(q);var K;T&1?(S=l.andln(7)+I&7,(S===3||S===5)&&D===2?K=-T:K=T):K=0,b[1].push(K),2*w===q+1&&(w=1-w),2*I===K+1&&(I=1-I),h.iushrn(1),l.iushrn(1)}return b}r.getJSF=n;function s(h,l,b){var w="_"+l;h.prototype[l]=function(){return this[w]!==void 0?this[w]:this[w]=b.call(this)}}r.cachedProperty=s;function a(h){return typeof h=="string"?r.toArray(h,"hex"):h}r.parseBytes=a;function u(h){return new mt(h,"hex","le")}r.intFromLE=u}),fh=Ui.getNAF,ES=Ui.getJSF,hh=Ui.assert;function so(t,e){this.type=t,this.p=new mt(e.p,16),this.red=e.prime?mt.red(e.prime):mt.mont(this.p),this.zero=new mt(0).toRed(this.red),this.one=new mt(1).toRed(this.red),this.two=new mt(2).toRed(this.red),this.n=e.n&&new mt(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Wo=so;so.prototype.point=function(){throw new Error("Not implemented")},so.prototype.validate=function(){throw new Error("Not implemented")},so.prototype._fixedNafMul=function(t,e){hh(t.precomputed);var r=t._getDoubles(),i=fh(e,1,this._bitLength),n=(1<<r.step+1)-(r.step%2===0?2:1);n/=3;var s=[],a,u;for(a=0;a<i.length;a+=r.step){u=0;for(var h=a+r.step-1;h>=a;h--)u=(u<<1)+i[h];s.push(u)}for(var l=this.jpoint(null,null,null),b=this.jpoint(null,null,null),w=n;w>0;w--){for(a=0;a<s.length;a++)u=s[a],u===w?b=b.mixedAdd(r.points[a]):u===-w&&(b=b.mixedAdd(r.points[a].neg()));l=l.add(b)}return l.toP()},so.prototype._wnafMul=function(t,e){var r=4,i=t._getNAFPoints(r);r=i.wnd;for(var n=i.points,s=fh(e,r,this._bitLength),a=this.jpoint(null,null,null),u=s.length-1;u>=0;u--){for(var h=0;u>=0&&s[u]===0;u--)h++;if(u>=0&&h++,a=a.dblp(h),u<0)break;var l=s[u];hh(l!==0),t.type==="affine"?l>0?a=a.mixedAdd(n[l-1>>1]):a=a.mixedAdd(n[-l-1>>1].neg()):l>0?a=a.add(n[l-1>>1]):a=a.add(n[-l-1>>1].neg())}return t.type==="affine"?a.toP():a},so.prototype._wnafMulAdd=function(t,e,r,i,n){var s=this._wnafT1,a=this._wnafT2,u=this._wnafT3,h=0,l,b,w;for(l=0;l<i;l++){w=e[l];var I=w._getNAFPoints(t);s[l]=I.wnd,a[l]=I.points}for(l=i-1;l>=1;l-=2){var S=l-1,D=l;if(s[S]!==1||s[D]!==1){u[S]=fh(r[S],s[S],this._bitLength),u[D]=fh(r[D],s[D],this._bitLength),h=Math.max(u[S].length,h),h=Math.max(u[D].length,h);continue}var T=[e[S],null,null,e[D]];e[S].y.cmp(e[D].y)===0?(T[1]=e[S].add(e[D]),T[2]=e[S].toJ().mixedAdd(e[D].neg())):e[S].y.cmp(e[D].y.redNeg())===0?(T[1]=e[S].toJ().mixedAdd(e[D]),T[2]=e[S].add(e[D].neg())):(T[1]=e[S].toJ().mixedAdd(e[D]),T[2]=e[S].toJ().mixedAdd(e[D].neg()));var q=[-3,-1,-5,-7,0,7,5,1,3],K=ES(r[S],r[D]);for(h=Math.max(K[0].length,h),u[S]=new Array(h),u[D]=new Array(h),b=0;b<h;b++){var F=K[0][b]|0,W=K[1][b]|0;u[S][b]=q[(F+1)*3+(W+1)],u[D][b]=0,a[S]=T}}var R=this.jpoint(null,null,null),k=this._wnafT4;for(l=h;l>=0;l--){for(var H=0;l>=0;){var _=!0;for(b=0;b<i;b++)k[b]=u[b][l]|0,k[b]!==0&&(_=!1);if(!_)break;H++,l--}if(l>=0&&H++,R=R.dblp(H),l<0)break;for(b=0;b<i;b++){var B=k[b];B!==0&&(B>0?w=a[b][B-1>>1]:B<0&&(w=a[b][-B-1>>1].neg()),w.type==="affine"?R=R.mixedAdd(w):R=R.add(w))}}for(l=0;l<i;l++)a[l]=null;return n?R:R.toP()};function Xi(t,e){this.curve=t,this.type=e,this.precomputed=null}so.BasePoint=Xi,Xi.prototype.eq=function(){throw new Error("Not implemented")},Xi.prototype.validate=function(){return this.curve.validate(this)},so.prototype.decodePoint=function(t,e){t=Ui.toArray(t,e);var r=this.p.byteLength();if((t[0]===4||t[0]===6||t[0]===7)&&t.length-1===2*r){t[0]===6?hh(t[t.length-1]%2===0):t[0]===7&&hh(t[t.length-1]%2===1);var i=this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));return i}else if((t[0]===2||t[0]===3)&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),t[0]===3);throw new Error("Unknown point format")},Xi.prototype.encodeCompressed=function(t){return this.encode(t,!0)},Xi.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},Xi.prototype.encode=function(t,e){return Ui.encode(this._encode(e),t)},Xi.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},Xi.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return e?e.points.length>=Math.ceil((t.bitLength()+1)/e.step):!1},Xi.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n<e;n+=t){for(var s=0;s<t;s++)i=i.dbl();r.push(i)}return{step:t,points:r}},Xi.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,i=r===1?null:this.dbl(),n=1;n<r;n++)e[n]=e[n-1].add(i);return{wnd:t,points:e}},Xi.prototype._getBeta=function(){return null},Xi.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e};var Sd=sc(function(t){typeof Object.create=="function"?t.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}}}),AS=Ui.assert;function en(t){Wo.call(this,"short",t),this.a=new mt(t.a,16).toRed(this.red),this.b=new mt(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Sd(en,Wo);var xS=en;en.prototype._getEndomorphism=function(t){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var e,r;if(t.beta)e=new mt(t.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);e=i[0].cmp(i[1])<0?i[0]:i[1],e=e.toRed(this.red)}if(t.lambda)r=new mt(t.lambda,16);else{var n=this._getEndoRoots(this.n);this.g.mul(n[0]).x.cmp(this.g.x.redMul(e))===0?r=n[0]:(r=n[1],AS(this.g.mul(r).x.cmp(this.g.x.redMul(e))===0))}var s;return t.basis?s=t.basis.map(function(a){return{a:new mt(a.a,16),b:new mt(a.b,16)}}):s=this._getEndoBasis(r),{beta:e,lambda:r,basis:s}}},en.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:mt.mont(t),r=new mt(2).toRed(e).redInvm(),i=r.redNeg(),n=new mt(3).toRed(e).redNeg().redSqrt().redMul(r),s=i.redAdd(n).fromRed(),a=i.redSub(n).fromRed();return[s,a]},en.prototype._getEndoBasis=function(t){for(var e=this.n.ushrn(Math.floor(this.n.bitLength()/2)),r=t,i=this.n.clone(),n=new mt(1),s=new mt(0),a=new mt(0),u=new mt(1),h,l,b,w,I,S,D,T=0,q,K;r.cmpn(0)!==0;){var F=i.div(r);q=i.sub(F.mul(r)),K=a.sub(F.mul(n));var W=u.sub(F.mul(s));if(!b&&q.cmp(e)<0)h=D.neg(),l=n,b=q.neg(),w=K;else if(b&&++T===2)break;D=q,i=r,r=q,a=n,n=K,u=s,s=W}I=q.neg(),S=K;var R=b.sqr().add(w.sqr()),k=I.sqr().add(S.sqr());return k.cmp(R)>=0&&(I=h,S=l),b.negative&&(b=b.neg(),w=w.neg()),I.negative&&(I=I.neg(),S=S.neg()),[{a:b,b:w},{a:I,b:S}]},en.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],i=e[1],n=i.b.mul(t).divRound(this.n),s=r.b.neg().mul(t).divRound(this.n),a=n.mul(r.a),u=s.mul(i.a),h=n.mul(r.b),l=s.mul(i.b),b=t.sub(a).sub(u),w=h.add(l).neg();return{k1:b,k2:w}},en.prototype.pointFromX=function(t,e){t=new mt(t,16),t.red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(i.redSqr().redSub(r).cmp(this.zero)!==0)throw new Error("invalid point");var n=i.fromRed().isOdd();return(e&&!n||!e&&n)&&(i=i.redNeg()),this.point(t,i)},en.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,i=this.a.redMul(e),n=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return r.redSqr().redISub(n).cmpn(0)===0},en.prototype._endoWnafMulAdd=function(t,e,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,s=0;s<t.length;s++){var a=this._endoSplit(e[s]),u=t[s],h=u._getBeta();a.k1.negative&&(a.k1.ineg(),u=u.neg(!0)),a.k2.negative&&(a.k2.ineg(),h=h.neg(!0)),i[s*2]=u,i[s*2+1]=h,n[s*2]=a.k1,n[s*2+1]=a.k2}for(var l=this._wnafMulAdd(1,i,n,s*2,r),b=0;b<s*2;b++)i[b]=null,n[b]=null;return l};function Nr(t,e,r,i){Wo.BasePoint.call(this,t,"affine"),e===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new mt(e,16),this.y=new mt(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}Sd(Nr,Wo.BasePoint),en.prototype.point=function(t,e,r){return new Nr(this,t,e,r)},en.prototype.pointFromJSON=function(t,e){return Nr.fromJSON(this,t,e)},Nr.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,i=function(n){return r.point(n.x.redMul(r.endo.beta),n.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(i)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(i)}}}return e}},Nr.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]},Nr.fromJSON=function(t,e,r){typeof e=="string"&&(e=JSON.parse(e));var i=t.point(e[0],e[1],r);if(!e[2])return i;function n(a){return t.point(a[0],a[1],r)}var s=e[2];return i.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[i].concat(s.doubles.points.map(n))},naf:s.naf&&{wnd:s.naf.wnd,points:[i].concat(s.naf.points.map(n))}},i},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)+">"},Nr.prototype.isInfinity=function(){return this.inf},Nr.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(this.x.cmp(t.x)===0)return this.curve.point(null,null);var e=this.y.redSub(t.y);e.cmpn(0)!==0&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),i=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},Nr.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(t.cmpn(0)===0)return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),i=t.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(i),s=n.redSqr().redISub(this.x.redAdd(this.x)),a=n.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,a)},Nr.prototype.getX=function(){return this.x.fromRed()},Nr.prototype.getY=function(){return this.y.fromRed()},Nr.prototype.mul=function(t){return t=new mt(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},Nr.prototype.mulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},Nr.prototype.jmulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},Nr.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||this.x.cmp(t.x)===0&&this.y.cmp(t.y)===0)},Nr.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,i=function(n){return n.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return e},Nr.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t};function Hr(t,e,r,i){Wo.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new mt(0)):(this.x=new mt(e,16),this.y=new mt(r,16),this.z=new mt(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}Sd(Hr,Wo.BasePoint),en.prototype.jpoint=function(t,e,r){return new Hr(this,t,e,r)},Hr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),i=this.y.redMul(e).redMul(t);return this.curve.point(r,i)},Hr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Hr.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(e),n=t.x.redMul(r),s=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(r.redMul(this.z)),u=i.redSub(n),h=s.redSub(a);if(u.cmpn(0)===0)return h.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=u.redSqr(),b=l.redMul(u),w=i.redMul(l),I=h.redSqr().redIAdd(b).redISub(w).redISub(w),S=h.redMul(w.redISub(I)).redISub(s.redMul(b)),D=this.z.redMul(t.z).redMul(u);return this.curve.jpoint(I,S,D)},Hr.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,i=t.x.redMul(e),n=this.y,s=t.y.redMul(e).redMul(this.z),a=r.redSub(i),u=n.redSub(s);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var h=a.redSqr(),l=h.redMul(a),b=r.redMul(h),w=u.redSqr().redIAdd(l).redISub(b).redISub(b),I=u.redMul(b.redISub(w)).redISub(n.redMul(l)),S=this.z.redMul(a);return this.curve.jpoint(w,I,S)},Hr.prototype.dblp=function(t){if(t===0)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<t;e++)r=r.dbl();return r}var i=this.curve.a,n=this.curve.tinv,s=this.x,a=this.y,u=this.z,h=u.redSqr().redSqr(),l=a.redAdd(a);for(e=0;e<t;e++){var b=s.redSqr(),w=l.redSqr(),I=w.redSqr(),S=b.redAdd(b).redIAdd(b).redIAdd(i.redMul(h)),D=s.redMul(w),T=S.redSqr().redISub(D.redAdd(D)),q=D.redISub(T),K=S.redMul(q);K=K.redIAdd(K).redISub(I);var F=l.redMul(u);e+1<t&&(h=h.redMul(I)),s=T,u=F,l=K}return this.curve.jpoint(s,l.redMul(n),u)},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 t,e,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),s=n.redSqr(),a=this.x.redAdd(n).redSqr().redISub(i).redISub(s);a=a.redIAdd(a);var u=i.redAdd(i).redIAdd(i),h=u.redSqr().redISub(a).redISub(a),l=s.redIAdd(s);l=l.redIAdd(l),l=l.redIAdd(l),t=h,e=u.redMul(a.redISub(h)).redISub(l),r=this.y.redAdd(this.y)}else{var b=this.x.redSqr(),w=this.y.redSqr(),I=w.redSqr(),S=this.x.redAdd(w).redSqr().redISub(b).redISub(I);S=S.redIAdd(S);var D=b.redAdd(b).redIAdd(b),T=D.redSqr(),q=I.redIAdd(I);q=q.redIAdd(q),q=q.redIAdd(q),t=T.redISub(S).redISub(S),e=D.redMul(S.redISub(t)).redISub(q),r=this.y.redMul(this.z),r=r.redIAdd(r)}return this.curve.jpoint(t,e,r)},Hr.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),s=n.redSqr(),a=this.x.redAdd(n).redSqr().redISub(i).redISub(s);a=a.redIAdd(a);var u=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),h=u.redSqr().redISub(a).redISub(a);t=h;var l=s.redIAdd(s);l=l.redIAdd(l),l=l.redIAdd(l),e=u.redMul(a.redISub(h)).redISub(l),r=this.y.redAdd(this.y)}else{var b=this.z.redSqr(),w=this.y.redSqr(),I=this.x.redMul(w),S=this.x.redSub(b).redMul(this.x.redAdd(b));S=S.redAdd(S).redIAdd(S);var D=I.redIAdd(I);D=D.redIAdd(D);var T=D.redAdd(D);t=S.redSqr().redISub(T),r=this.y.redAdd(this.z).redSqr().redISub(w).redISub(b);var q=w.redSqr();q=q.redIAdd(q),q=q.redIAdd(q),q=q.redIAdd(q),e=S.redMul(D.redISub(t)).redISub(q)}return this.curve.jpoint(t,e,r)},Hr.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,i=this.z,n=i.redSqr().redSqr(),s=e.redSqr(),a=r.redSqr(),u=s.redAdd(s).redIAdd(s).redIAdd(t.redMul(n)),h=e.redAdd(e);h=h.redIAdd(h);var l=h.redMul(a),b=u.redSqr().redISub(l.redAdd(l)),w=l.redISub(b),I=a.redSqr();I=I.redIAdd(I),I=I.redIAdd(I),I=I.redIAdd(I);var S=u.redMul(w).redISub(I),D=r.redAdd(r).redMul(i);return this.curve.jpoint(b,S,D)},Hr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),i=e.redSqr(),n=t.redAdd(t).redIAdd(t),s=n.redSqr(),a=this.x.redAdd(e).redSqr().redISub(t).redISub(i);a=a.redIAdd(a),a=a.redAdd(a).redIAdd(a),a=a.redISub(s);var u=a.redSqr(),h=i.redIAdd(i);h=h.redIAdd(h),h=h.redIAdd(h),h=h.redIAdd(h);var l=n.redIAdd(a).redSqr().redISub(s).redISub(u).redISub(h),b=e.redMul(l);b=b.redIAdd(b),b=b.redIAdd(b);var w=this.x.redMul(u).redISub(b);w=w.redIAdd(w),w=w.redIAdd(w);var I=this.y.redMul(l.redMul(h.redISub(l)).redISub(a.redMul(u)));I=I.redIAdd(I),I=I.redIAdd(I),I=I.redIAdd(I);var S=this.z.redAdd(a).redSqr().redISub(r).redISub(u);return this.curve.jpoint(w,I,S)},Hr.prototype.mul=function(t,e){return t=new mt(t,e),this.curve._wnafMul(this,t)},Hr.prototype.eq=function(t){if(t.type==="affine")return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0)!==0)return!1;var i=e.redMul(this.z),n=r.redMul(t.z);return this.y.redMul(n).redISub(t.y.redMul(i)).cmpn(0)===0},Hr.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(this.x.cmp(r)===0)return!0;for(var i=t.clone(),n=this.curve.redN.redMul(e);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),this.x.cmp(r)===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 lh=sc(function(t,e){var r=e;r.base=Wo,r.short=xS,r.mont=null,r.edwards=null}),dh=sc(function(t,e){var r=e,i=Ui.assert;function n(u){u.type==="short"?this.curve=new lh.short(u):u.type==="edwards"?this.curve=new lh.edwards(u):this.curve=new lh.mont(u),this.g=this.curve.g,this.n=this.curve.n,this.hash=u.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=n;function s(u,h){Object.defineProperty(r,u,{configurable:!0,enumerable:!0,get:function(){var l=new n(h);return Object.defineProperty(r,u,{configurable:!0,enumerable:!0,value:l}),l}})}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:Zn.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:Zn.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:Zn.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:Zn.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:Zn.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:Zn.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:Zn.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:Zn.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})});function oo(t){if(!(this instanceof oo))return new oo(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=An.toArray(t.entropy,t.entropyEnc||"hex"),r=An.toArray(t.nonce,t.nonceEnc||"hex"),i=An.toArray(t.pers,t.persEnc||"hex");xd(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}var Ym=oo;oo.prototype._init=function(t,e,r){var i=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n<this.V.length;n++)this.K[n]=0,this.V[n]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},oo.prototype._hmac=function(){return new Zn.hmac(this.hash,this.K)},oo.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},oo.prototype.reseed=function(t,e,r,i){typeof e!="string"&&(i=r,r=e,e=null),t=An.toArray(t,e),r=An.toArray(r,i),xd(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},oo.prototype.generate=function(t,e,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof e!="string"&&(i=r,r=e,e=null),r&&(r=An.toArray(r,i||"hex"),this._update(r));for(var n=[];n.length<t;)this.V=this._hmac().update(this.V).digest(),n=n.concat(this.V);var s=n.slice(0,t);return this._update(r),this._reseed++,An.encode(s,e)};var Id=Ui.assert;function Yr(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var Md=Yr;Yr.fromPublic=function(t,e,r){return e instanceof Yr?e:new Yr(t,{pub:e,pubEnc:r})},Yr.fromPrivate=function(t,e,r){return e instanceof Yr?e:new Yr(t,{priv:e,privEnc:r})},Yr.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},Yr.prototype.getPublic=function(t,e){return typeof t=="string"&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},Yr.prototype.getPrivate=function(t){return t==="hex"?this.priv.toString(16,2):this.priv},Yr.prototype._importPrivate=function(t,e){this.priv=new mt(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},Yr.prototype._importPublic=function(t,e){if(t.x||t.y){this.ec.curve.type==="mont"?Id(t.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Id(t.x&&t.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(t.x,t.y);return}this.pub=this.ec.curve.decodePoint(t,e)},Yr.prototype.derive=function(t){return t.validate()||Id(t.validate(),"public point not validated"),t.mul(this.priv).getX()},Yr.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},Yr.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},Yr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var SS=Ui.assert;function ph(t,e){if(t instanceof ph)return t;this._importDER(t,e)||(SS(t.r&&t.s,"Signature without r or s"),this.r=new mt(t.r,16),this.s=new mt(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var gh=ph;function IS(){this.place=0}function Cd(t,e){var r=t[e.place++];if(!(r&128))return r;var i=r&15;if(i===0||i>4)return!1;for(var n=0,s=0,a=e.place;s<i;s++,a++)n<<=8,n|=t[a],n>>>=0;return n<=127?!1:(e.place=a,n)}function Qm(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e<r;)e++;return e===0?t:t.slice(e)}ph.prototype._importDER=function(t,e){t=Ui.toArray(t,e);var r=new IS;if(t[r.place++]!==48)return!1;var i=Cd(t,r);if(i===!1||i+r.place!==t.length||t[r.place++]!==2)return!1;var n=Cd(t,r);if(n===!1)return!1;var s=t.slice(r.place,n+r.place);if(r.place+=n,t[r.place++]!==2)return!1;var a=Cd(t,r);if(a===!1||t.length!==a+r.place)return!1;var u=t.slice(r.place,a+r.place);if(s[0]===0)if(s[1]&128)s=s.slice(1);else return!1;if(u[0]===0)if(u[1]&128)u=u.slice(1);else return!1;return this.r=new mt(s),this.s=new mt(u),this.recoveryParam=null,!0};function Dd(t,e){if(e<128){t.push(e);return}var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}ph.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(e[0]&128&&(e=[0].concat(e)),r[0]&128&&(r=[0].concat(r)),e=Qm(e),r=Qm(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var i=[2];Dd(i,e.length),i=i.concat(e),i.push(2),Dd(i,r.length);var n=i.concat(r),s=[48];return Dd(s,n.length),s=s.concat(n),Ui.encode(s,t)};var MS=function(){throw new Error("unsupported")},Zm=Ui.assert;function tn(t){if(!(this instanceof tn))return new tn(t);typeof t=="string"&&(Zm(Object.prototype.hasOwnProperty.call(dh,t),"Unknown curve "+t),t=dh[t]),t instanceof dh.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var CS=tn;tn.prototype.keyPair=function(t){return new Md(this,t)},tn.prototype.keyFromPrivate=function(t,e){return Md.fromPrivate(this,t,e)},tn.prototype.keyFromPublic=function(t,e){return Md.fromPublic(this,t,e)},tn.prototype.genKeyPair=function(t){t||(t={});for(var e=new Ym({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||MS(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new mt(2));;){var n=new mt(e.generate(r));if(!(n.cmp(i)>0))return n.iaddn(1),this.keyFromPrivate(n)}},tn.prototype._truncateToN=function(t,e){var r=t.byteLength()*8-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},tn.prototype.sign=function(t,e,r,i){typeof r=="object"&&(i=r,r=null),i||(i={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new mt(t,16));for(var n=this.n.byteLength(),s=e.getPrivate().toArray("be",n),a=t.toArray("be",n),u=new Ym({hash:this.hash,entropy:s,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),h=this.n.sub(new mt(1)),l=0;;l++){var b=i.k?i.k(l):new mt(u.generate(this.n.byteLength()));if(b=this._truncateToN(b,!0),!(b.cmpn(1)<=0||b.cmp(h)>=0)){var w=this.g.mul(b);if(!w.isInfinity()){var I=w.getX(),S=I.umod(this.n);if(S.cmpn(0)!==0){var D=b.invm(this.n).mul(S.mul(e.getPrivate()).iadd(t));if(D=D.umod(this.n),D.cmpn(0)!==0){var T=(w.getY().isOdd()?1:0)|(I.cmp(S)!==0?2:0);return i.canonical&&D.cmp(this.nh)>0&&(D=this.n.sub(D),T^=1),new gh({r:S,s:D,recoveryParam:T})}}}}}},tn.prototype.verify=function(t,e,r,i){t=this._truncateToN(new mt(t,16)),r=this.keyFromPublic(r,i),e=new gh(e,"hex");var n=e.r,s=e.s;if(n.cmpn(1)<0||n.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a=s.invm(this.n),u=a.mul(t).umod(this.n),h=a.mul(n).umod(this.n),l;return this.curve._maxwellTrick?(l=this.g.jmulAdd(u,r.getPublic(),h),l.isInfinity()?!1:l.eqXToP(n)):(l=this.g.mulAdd(u,r.getPublic(),h),l.isInfinity()?!1:l.getX().umod(this.n).cmp(n)===0)},tn.prototype.recoverPubKey=function(t,e,r,i){Zm((3&r)===r,"The recovery param is more than two bits"),e=new gh(e,i);var n=this.n,s=new mt(t),a=e.r,u=e.s,h=r&1,l=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?a=this.curve.pointFromX(a.add(this.curve.n),h):a=this.curve.pointFromX(a,h);var b=e.r.invm(n),w=n.sub(s).mul(b).umod(n),I=u.mul(b).umod(n);return this.g.mulAdd(w,a,I)},tn.prototype.getKeyRecoveryParam=function(t,e,r,i){if(e=new gh(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(t,e,n)}catch{continue}if(s.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var DS=sc(function(t,e){var r=e;r.version="6.5.4",r.utils=Ui,r.rand=function(){throw new Error("unsupported")},r.curve=lh,r.curves=dh,r.ec=CS,r.eddsa=null}),OS=DS.ec;const PS="signing-key/5.7.0",Od=new Et(PS);let Pd=null;function os(){return Pd||(Pd=new OS("secp256k1")),Pd}class $S{constructor(e){du(this,"curve","secp256k1"),du(this,"privateKey",si(e)),pA(this.privateKey)!==32&&Od.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=os().keyFromPrivate(dr(this.privateKey));du(this,"publicKey","0x"+r.getPublic(!1,"hex")),du(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),du(this,"_isSigningKey",!0)}_addPoint(e){const r=os().keyFromPublic(dr(this.publicKey)),i=os().keyFromPublic(dr(e));return"0x"+r.pub.add(i.pub).encodeCompressed("hex")}signDigest(e){const r=os().keyFromPrivate(dr(this.privateKey)),i=dr(e);i.length!==32&&Od.throwArgumentError("bad digest length","digest",e);const n=r.sign(i,{canonical:!0});return cm({recoveryParam:n.recoveryParam,r:Qn("0x"+n.r.toString(16),32),s:Qn("0x"+n.s.toString(16),32)})}computeSharedSecret(e){const r=os().keyFromPrivate(dr(this.privateKey)),i=os().keyFromPublic(dr(Xm(e)));return Qn("0x"+r.derive(i.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function RS(t,e){const r=cm(e),i={r:dr(r.r),s:dr(r.s)};return"0x"+os().recoverPubKey(dr(t),i,r.recoveryParam).encode("hex",!1)}function Xm(t,e){const r=dr(t);if(r.length===32){const i=new $S(r);return e?"0x"+os().keyFromPrivate(r).getPublic(!0,"hex"):i.publicKey}else{if(r.length===33)return e?si(r):"0x"+os().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return e?"0x"+os().keyFromPublic(r).getPublic(!0,"hex"):si(r)}return Od.throwArgumentError("invalid public or private key","key","[REDACTED]")}const NS="transactions/5.7.0";new Et(NS);var eb;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(eb||(eb={}));function TS(t){const e=Xm(t);return KA(am(hd(am(e,1)),12))}function LS(t,e){return TS(RS(dr(t),e))}const BS="https://rpc.walletconnect.com/v1";async function FS(t,e,r,i,n,s){switch(r.t){case"eip191":return US(t,e,r.s);case"eip1271":return await kS(t,e,r.s,i,n,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function US(t,e,r){return LS(xm(e),r).toLowerCase()===t.toLowerCase()}async function kS(t,e,r,i,n,s){try{const a="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",h="0000000000000000000000000000000000000000000000000000000000000041",l=r.substring(2),b=xm(e).substring(2),w=a+b+u+h+l,I=await fetch(`${s||BS}/?chainId=${i}&projectId=${n}`,{method:"POST",body:JSON.stringify({id:qS(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:w},"latest"]})}),{result:S}=await I.json();return S?S.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function qS(){return Date.now()+Math.floor(Math.random()*1e3)}var jS=Object.defineProperty,zS=Object.defineProperties,HS=Object.getOwnPropertyDescriptors,tb=Object.getOwnPropertySymbols,KS=Object.prototype.hasOwnProperty,WS=Object.prototype.propertyIsEnumerable,rb=(t,e,r)=>e in t?jS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,VS=(t,e)=>{for(var r in e||(e={}))KS.call(e,r)&&rb(t,r,e[r]);if(tb)for(var r of tb(e))WS.call(e,r)&&rb(t,r,e[r]);return t},GS=(t,e)=>zS(t,HS(e));const JS="did:pkh:",$d=t=>t?.split(":"),ib=t=>{const e=t&&$d(t);if(e)return t.includes(JS)?e[3]:e[1]},nb=t=>{const e=t&&$d(t);if(e)return e[2]+":"+e[3]},vh=t=>{const e=t&&$d(t);if(e)return e.pop()};async function sb(t){const{cacao:e,projectId:r}=t,{s:i,p:n}=e,s=ob(n,n.iss),a=vh(n.iss);return await FS(a,s,i,ib(n.iss),r)}const ob=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,i=vh(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let n=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,a=`Version: ${t.version}`,u=`Chain ID: ${ib(e)}`,h=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,b=t.exp?`Expiration Time: ${t.exp}`:void 0,w=t.nbf?`Not Before: ${t.nbf}`:void 0,I=t.requestId?`Request ID: ${t.requestId}`:void 0,S=t.resources?`Resources:${t.resources.map(T=>`
23
23
  - ${T}`).join("")}`:void 0,D=mh(t.resources);if(D){const T=mu(D);n=nI(n,T)}return[r,i,"",n,"",s,a,u,h,l,b,w,I,S].filter(T=>T!=null).join(`
24
- `)};function YS(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function QS(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function Vo(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const i=t.att[r];if(Array.isArray(i))throw new Error(`Resource must be an object: ${r}`);if(typeof i!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(i).length)throw new Error(`Resource object is empty: ${r}`);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 ZS(t,e,r,i={}){return r?.sort((n,s)=>n.localeCompare(s)),{att:{[t]:XS(e,r,i)}}}function XS(t,e,r={}){e=e?.sort((n,s)=>n.localeCompare(s));const i=e.map(n=>({[`${t}/${n}`]:[r]}));return Object.assign({},...i)}function ob(t){return Vo(t),`urn:recap:${YS(t).replace(/=/g,"")}`}function mu(t){const e=QS(t.replace("urn:recap:",""));return Vo(e),e}function eI(t,e,r){const i=ZS(t,e,r);return ob(i)}function tI(t){return t&&t.includes("urn:recap:")}function rI(t,e){const r=mu(t),i=mu(e),n=iI(r,i);return ob(n)}function iI(t,e){Vo(t),Vo(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((n,s)=>n.localeCompare(s)),i={att:{}};return r.forEach(n=>{var s,a;Object.keys(((s=t.att)==null?void 0:s[n])||{}).concat(Object.keys(((a=e.att)==null?void 0:a[n])||{})).sort((u,h)=>u.localeCompare(h)).forEach(u=>{var h,l;i.att[n]=GS(VS({},i.att[n]),{[u]:((h=t.att[n])==null?void 0:h[u])||((l=e.att[n])==null?void 0:l[u])})})}),i}function nI(t="",e){Vo(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const i=[];let n=0;Object.keys(e.att).forEach(u=>{const h=Object.keys(e.att[u]).map(w=>({ability:w.split("/")[0],action:w.split("/")[1]}));h.sort((w,I)=>w.action.localeCompare(I.action));const l={};h.forEach(w=>{l[w.ability]||(l[w.ability]=[]),l[w.ability].push(w.action)});const b=Object.keys(l).map(w=>(n++,`(${n}) '${w}': '${l[w].join("', '")}' for '${u}'.`));i.push(b.join(", ").replace(".,","."))});const s=i.join(" "),a=`${r}${s}`;return`${t?t+" ":""}${a}`}function ab(t){var e;const r=mu(t);Vo(r);const i=(e=r.att)==null?void 0:e.eip155;return i?Object.keys(i).map(n=>n.split("/")[1]):[]}function cb(t){const e=mu(t);Vo(e);const r=[];return Object.values(e.att).forEach(i=>{Object.values(i).forEach(n=>{var s;(s=n?.[0])!=null&&s.chains&&r.push(n[0].chains)})}),[...new Set(r.flat())]}function mh(t){if(!t)return;const e=t?.[t.length-1];return tI(e)?e:void 0}const ub="base10",ai="base16",ao="base64pad",bu="base64url",yu="utf8",fb=0,Rs=1,wu=2,sI=0,hb=1,_u=12,Rd=32;function oI(){const t=L0.generateKeyPair();return{privateKey:Ti(t.secretKey,ai),publicKey:Ti(t.publicKey,ai)}}function Nd(){const t=Zs.randomBytes(Rd);return Ti(t,ai)}function aI(t,e){const r=L0.sharedKey(Gi(t,ai),Gi(e,ai),!0),i=new L8(eu.SHA256,r).expand(Rd);return Ti(i,ai)}function bh(t){const e=eu.hash(Gi(t,ai));return Ti(e,ai)}function Ns(t){const e=eu.hash(Gi(t,yu));return Ti(e,ai)}function lb(t){return Gi(`${t}`,ub)}function Go(t){return Number(Ti(t,ub))}function cI(t){const e=lb(typeof t.type<"u"?t.type:fb);if(Go(e)===Rs&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Gi(t.senderPublicKey,ai):void 0,i=typeof t.iv<"u"?Gi(t.iv,ai):Zs.randomBytes(_u),n=new C0.ChaCha20Poly1305(Gi(t.symKey,ai)).seal(i,Gi(t.message,yu));return db({type:e,sealed:n,iv:i,senderPublicKey:r,encoding:t.encoding})}function uI(t,e){const r=lb(wu),i=Zs.randomBytes(_u),n=Gi(t,yu);return db({type:r,sealed:n,iv:i,encoding:e})}function fI(t){const e=new C0.ChaCha20Poly1305(Gi(t.symKey,ai)),{sealed:r,iv:i}=Eu({encoded:t.encoded,encoding:t?.encoding}),n=e.open(i,r);if(n===null)throw new Error("Failed to decrypt");return Ti(n,yu)}function hI(t,e){const{sealed:r}=Eu({encoded:t,encoding:e});return Ti(r,yu)}function db(t){const{encoding:e=ao}=t;if(Go(t.type)===wu)return Ti(B0([t.type,t.sealed]),e);if(Go(t.type)===Rs){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Ti(B0([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return Ti(B0([t.type,t.iv,t.sealed]),e)}function Eu(t){const{encoded:e,encoding:r=ao}=t,i=Gi(e,r),n=i.slice(sI,hb),s=hb;if(Go(n)===Rs){const l=s+Rd,b=l+_u,w=i.slice(s,l),I=i.slice(l,b),S=i.slice(b);return{type:n,sealed:S,iv:I,senderPublicKey:w}}if(Go(n)===wu){const l=i.slice(s),b=Zs.randomBytes(_u);return{type:n,sealed:l,iv:b}}const a=s+_u,u=i.slice(s,a),h=i.slice(a);return{type:n,sealed:h,iv:u}}function lI(t,e){const r=Eu({encoded:t,encoding:e?.encoding});return pb({type:Go(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Ti(r.senderPublicKey,ai):void 0,receiverPublicKey:e?.receiverPublicKey})}function pb(t){const e=t?.type||fb;if(e===Rs){if(typeof t?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof t?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t?.senderPublicKey,receiverPublicKey:t?.receiverPublicKey}}function gb(t){return t.type===Rs&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function vb(t){return t.type===wu}function dI(t){return new Kv.ec("p256").keyFromPublic({x:Buffer.from(t.x,"base64").toString("hex"),y:Buffer.from(t.y,"base64").toString("hex")},"hex")}function pI(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function gI(t){return Buffer.from(pI(t),"base64")}function vI(t,e){const[r,i,n]=t.split("."),s=gI(n);if(s.length!==64)throw new Error("Invalid signature length");const a=s.slice(0,32).toString("hex"),u=s.slice(32,64).toString("hex"),h=`${r}.${i}`,l=new eu.SHA256().update(Buffer.from(h)).digest(),b=dI(e),w=Buffer.from(l).toString("hex");if(!b.verify(w,{r:a,s:u}))throw new Error("Invalid signature");return od(t).payload}const mI="irn";function Td(t){return t?.relay||{protocol:mI}}function Au(t){const e=zE[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var bI=Object.defineProperty,yI=Object.defineProperties,wI=Object.getOwnPropertyDescriptors,mb=Object.getOwnPropertySymbols,_I=Object.prototype.hasOwnProperty,EI=Object.prototype.propertyIsEnumerable,bb=(t,e,r)=>e in t?bI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,yb=(t,e)=>{for(var r in e||(e={}))_I.call(e,r)&&bb(t,r,e[r]);if(mb)for(var r of mb(e))EI.call(e,r)&&bb(t,r,e[r]);return t},AI=(t,e)=>yI(t,wI(e));function xI(t,e="-"){const r={},i="relay"+e;return Object.keys(t).forEach(n=>{if(n.startsWith(i)){const s=n.replace(i,""),a=t[n];r[s]=a}}),r}function wb(t){t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,i=t.substring(0,e),n=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",a=Zc.parse(s),u=typeof a.methods=="string"?a.methods.split(","):void 0;return{protocol:i,topic:SI(n[0]),version:parseInt(n[1],10),symKey:a.symKey,relay:xI(a),methods:u,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function SI(t){return t.startsWith("//")?t.substring(2):t}function II(t,e="-"){const r="relay",i={};return Object.keys(t).forEach(n=>{const s=r+e+n;t[n]&&(i[s]=t[n])}),i}function MI(t){return`${t.protocol}:${t.topic}@${t.version}?`+Zc.stringify(yb(AI(yb({symKey:t.symKey},II(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function yh(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}function oc(t){const e=[];return t.forEach(r=>{const[i,n]=r.split(":");e.push(`${i}:${n}`)}),e}function CI(t){const e=[];return Object.values(t).forEach(r=>{e.push(...oc(r.accounts))}),e}function DI(t,e){const r=[];return Object.values(t).forEach(i=>{oc(i.accounts).includes(e)&&r.push(...i.methods)}),r}function OI(t,e){const r=[];return Object.values(t).forEach(i=>{oc(i.accounts).includes(e)&&r.push(...i.events)}),r}function Ld(t){return t.includes(":")}function xu(t){return Ld(t)?t.split(":")[0]:t}function PI(t){const e={};return t?.forEach(r=>{const[i,n]=r.split(":");e[i]||(e[i]={accounts:[],chains:[],events:[]}),e[i].accounts.push(r),e[i].chains.push(`${i}:${n}`)}),e}function _b(t,e){e=e.map(i=>i.replace("did:pkh:",""));const r=PI(e);for(const[i,n]of Object.entries(r))n.methods?n.methods=rh(n.methods,t):n.methods=t,n.events=["chainChanged","accountsChanged"];return r}const $I={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}},RI={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 Ee(t,e){const{message:r,code:i}=RI[t];return{message:e?`${r} ${e}`:r,code:i}}function Gt(t,e){const{message:r,code:i}=$I[t];return{message:e?`${r} ${e}`:r,code:i}}function as(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function Su(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function ci(t){return typeof t>"u"}function yr(t,e){return e&&ci(t)?!0:typeof t=="string"&&!!t.trim().length}function Bd(t,e){return e&&ci(t)?!0:typeof t=="number"&&!isNaN(t)}function NI(t,e){const{requiredNamespaces:r}=e,i=Object.keys(t.namespaces),n=Object.keys(r);let s=!0;return zo(n,i)?(i.forEach(a=>{const{accounts:u,methods:h,events:l}=t.namespaces[a],b=oc(u),w=r[a];(!zo(k2(a,w),b)||!zo(w.methods,h)||!zo(w.events,l))&&(s=!1)}),s):!1}function wh(t){return yr(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function TI(t){if(yr(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&wh(r)}}return!1}function LI(t){if(yr(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function BI(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function FI(t){return t?.topic}function UI(t,e){let r=null;return yr(t?.publicKey,!1)||(r=Ee("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function Eb(t){let e=!0;return as(t)?t.length&&(e=t.every(r=>yr(r,!1))):e=!1,e}function kI(t,e,r){let i=null;return as(e)&&e.length?e.forEach(n=>{i||wh(n)||(i=Gt("UNSUPPORTED_CHAINS",`${r}, chain ${n} should be a string and conform to "namespace:chainId" format`))}):wh(t)||(i=Gt("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),i}function qI(t,e,r){let i=null;return Object.entries(t).forEach(([n,s])=>{if(i)return;const a=kI(n,k2(n,s),`${e} ${r}`);a&&(i=a)}),i}function jI(t,e){let r=null;return as(t)?t.forEach(i=>{r||TI(i)||(r=Gt("UNSUPPORTED_ACCOUNTS",`${e}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):r=Gt("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function zI(t,e){let r=null;return Object.values(t).forEach(i=>{if(r)return;const n=jI(i?.accounts,`${e} namespace`);n&&(r=n)}),r}function HI(t,e){let r=null;return Eb(t?.methods)?Eb(t?.events)||(r=Gt("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Gt("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function Ab(t,e){let r=null;return Object.values(t).forEach(i=>{if(r)return;const n=HI(i,`${e}, namespace`);n&&(r=n)}),r}function KI(t,e,r){let i=null;if(t&&Su(t)){const n=Ab(t,e);n&&(i=n);const s=qI(t,e,r);s&&(i=s)}else i=Ee("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return i}function Fd(t,e){let r=null;if(t&&Su(t)){const i=Ab(t,e);i&&(r=i);const n=zI(t,e);n&&(r=n)}else r=Ee("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function xb(t){return yr(t.protocol,!0)}function WI(t,e){let r=!1;return e&&!t?r=!0:t&&as(t)&&t.length&&t.forEach(i=>{r=xb(i)}),r}function VI(t){return typeof t=="number"}function _i(t){return typeof t<"u"&&typeof t!==null}function GI(t){return!(!t||typeof t!="object"||!t.code||!Bd(t.code,!1)||!t.message||!yr(t.message,!1))}function JI(t){return!(ci(t)||!yr(t.method,!1))}function YI(t){return!(ci(t)||ci(t.result)&&ci(t.error)||!Bd(t.id,!1)||!yr(t.jsonrpc,!1))}function QI(t){return!(ci(t)||!yr(t.name,!1))}function Sb(t,e){return!(!wh(e)||!CI(t).includes(e))}function ZI(t,e,r){return yr(r,!1)?DI(t,e).includes(r):!1}function XI(t,e,r){return yr(r,!1)?OI(t,e).includes(r):!1}function Ib(t,e,r){let i=null;const n=eM(t),s=tM(e),a=Object.keys(n),u=Object.keys(s),h=Mb(Object.keys(t)),l=Mb(Object.keys(e)),b=h.filter(w=>!l.includes(w));return b.length&&(i=Ee("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces.
24
+ `)};function YS(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function QS(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function Vo(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const i=t.att[r];if(Array.isArray(i))throw new Error(`Resource must be an object: ${r}`);if(typeof i!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(i).length)throw new Error(`Resource object is empty: ${r}`);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 ZS(t,e,r,i={}){return r?.sort((n,s)=>n.localeCompare(s)),{att:{[t]:XS(e,r,i)}}}function XS(t,e,r={}){e=e?.sort((n,s)=>n.localeCompare(s));const i=e.map(n=>({[`${t}/${n}`]:[r]}));return Object.assign({},...i)}function ab(t){return Vo(t),`urn:recap:${YS(t).replace(/=/g,"")}`}function mu(t){const e=QS(t.replace("urn:recap:",""));return Vo(e),e}function eI(t,e,r){const i=ZS(t,e,r);return ab(i)}function tI(t){return t&&t.includes("urn:recap:")}function rI(t,e){const r=mu(t),i=mu(e),n=iI(r,i);return ab(n)}function iI(t,e){Vo(t),Vo(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((n,s)=>n.localeCompare(s)),i={att:{}};return r.forEach(n=>{var s,a;Object.keys(((s=t.att)==null?void 0:s[n])||{}).concat(Object.keys(((a=e.att)==null?void 0:a[n])||{})).sort((u,h)=>u.localeCompare(h)).forEach(u=>{var h,l;i.att[n]=GS(VS({},i.att[n]),{[u]:((h=t.att[n])==null?void 0:h[u])||((l=e.att[n])==null?void 0:l[u])})})}),i}function nI(t="",e){Vo(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const i=[];let n=0;Object.keys(e.att).forEach(u=>{const h=Object.keys(e.att[u]).map(w=>({ability:w.split("/")[0],action:w.split("/")[1]}));h.sort((w,I)=>w.action.localeCompare(I.action));const l={};h.forEach(w=>{l[w.ability]||(l[w.ability]=[]),l[w.ability].push(w.action)});const b=Object.keys(l).map(w=>(n++,`(${n}) '${w}': '${l[w].join("', '")}' for '${u}'.`));i.push(b.join(", ").replace(".,","."))});const s=i.join(" "),a=`${r}${s}`;return`${t?t+" ":""}${a}`}function cb(t){var e;const r=mu(t);Vo(r);const i=(e=r.att)==null?void 0:e.eip155;return i?Object.keys(i).map(n=>n.split("/")[1]):[]}function ub(t){const e=mu(t);Vo(e);const r=[];return Object.values(e.att).forEach(i=>{Object.values(i).forEach(n=>{var s;(s=n?.[0])!=null&&s.chains&&r.push(n[0].chains)})}),[...new Set(r.flat())]}function mh(t){if(!t)return;const e=t?.[t.length-1];return tI(e)?e:void 0}const fb="base10",ai="base16",ao="base64pad",bu="base64url",yu="utf8",hb=0,Rs=1,wu=2,sI=0,lb=1,_u=12,Rd=32;function oI(){const t=L0.generateKeyPair();return{privateKey:Ti(t.secretKey,ai),publicKey:Ti(t.publicKey,ai)}}function Nd(){const t=Zs.randomBytes(Rd);return Ti(t,ai)}function aI(t,e){const r=L0.sharedKey(Gi(t,ai),Gi(e,ai),!0),i=new B8(eu.SHA256,r).expand(Rd);return Ti(i,ai)}function bh(t){const e=eu.hash(Gi(t,ai));return Ti(e,ai)}function Ns(t){const e=eu.hash(Gi(t,yu));return Ti(e,ai)}function db(t){return Gi(`${t}`,fb)}function Go(t){return Number(Ti(t,fb))}function cI(t){const e=db(typeof t.type<"u"?t.type:hb);if(Go(e)===Rs&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Gi(t.senderPublicKey,ai):void 0,i=typeof t.iv<"u"?Gi(t.iv,ai):Zs.randomBytes(_u),n=new C0.ChaCha20Poly1305(Gi(t.symKey,ai)).seal(i,Gi(t.message,yu));return pb({type:e,sealed:n,iv:i,senderPublicKey:r,encoding:t.encoding})}function uI(t,e){const r=db(wu),i=Zs.randomBytes(_u),n=Gi(t,yu);return pb({type:r,sealed:n,iv:i,encoding:e})}function fI(t){const e=new C0.ChaCha20Poly1305(Gi(t.symKey,ai)),{sealed:r,iv:i}=Eu({encoded:t.encoded,encoding:t?.encoding}),n=e.open(i,r);if(n===null)throw new Error("Failed to decrypt");return Ti(n,yu)}function hI(t,e){const{sealed:r}=Eu({encoded:t,encoding:e});return Ti(r,yu)}function pb(t){const{encoding:e=ao}=t;if(Go(t.type)===wu)return Ti(B0([t.type,t.sealed]),e);if(Go(t.type)===Rs){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Ti(B0([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return Ti(B0([t.type,t.iv,t.sealed]),e)}function Eu(t){const{encoded:e,encoding:r=ao}=t,i=Gi(e,r),n=i.slice(sI,lb),s=lb;if(Go(n)===Rs){const l=s+Rd,b=l+_u,w=i.slice(s,l),I=i.slice(l,b),S=i.slice(b);return{type:n,sealed:S,iv:I,senderPublicKey:w}}if(Go(n)===wu){const l=i.slice(s),b=Zs.randomBytes(_u);return{type:n,sealed:l,iv:b}}const a=s+_u,u=i.slice(s,a),h=i.slice(a);return{type:n,sealed:h,iv:u}}function lI(t,e){const r=Eu({encoded:t,encoding:e?.encoding});return gb({type:Go(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Ti(r.senderPublicKey,ai):void 0,receiverPublicKey:e?.receiverPublicKey})}function gb(t){const e=t?.type||hb;if(e===Rs){if(typeof t?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof t?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t?.senderPublicKey,receiverPublicKey:t?.receiverPublicKey}}function vb(t){return t.type===Rs&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function mb(t){return t.type===wu}function dI(t){return new Kv.ec("p256").keyFromPublic({x:Buffer.from(t.x,"base64").toString("hex"),y:Buffer.from(t.y,"base64").toString("hex")},"hex")}function pI(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function gI(t){return Buffer.from(pI(t),"base64")}function vI(t,e){const[r,i,n]=t.split("."),s=gI(n);if(s.length!==64)throw new Error("Invalid signature length");const a=s.slice(0,32).toString("hex"),u=s.slice(32,64).toString("hex"),h=`${r}.${i}`,l=new eu.SHA256().update(Buffer.from(h)).digest(),b=dI(e),w=Buffer.from(l).toString("hex");if(!b.verify(w,{r:a,s:u}))throw new Error("Invalid signature");return od(t).payload}const mI="irn";function Td(t){return t?.relay||{protocol:mI}}function Au(t){const e=HE[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var bI=Object.defineProperty,yI=Object.defineProperties,wI=Object.getOwnPropertyDescriptors,bb=Object.getOwnPropertySymbols,_I=Object.prototype.hasOwnProperty,EI=Object.prototype.propertyIsEnumerable,yb=(t,e,r)=>e in t?bI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wb=(t,e)=>{for(var r in e||(e={}))_I.call(e,r)&&yb(t,r,e[r]);if(bb)for(var r of bb(e))EI.call(e,r)&&yb(t,r,e[r]);return t},AI=(t,e)=>yI(t,wI(e));function xI(t,e="-"){const r={},i="relay"+e;return Object.keys(t).forEach(n=>{if(n.startsWith(i)){const s=n.replace(i,""),a=t[n];r[s]=a}}),r}function _b(t){t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,i=t.substring(0,e),n=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",a=Zc.parse(s),u=typeof a.methods=="string"?a.methods.split(","):void 0;return{protocol:i,topic:SI(n[0]),version:parseInt(n[1],10),symKey:a.symKey,relay:xI(a),methods:u,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function SI(t){return t.startsWith("//")?t.substring(2):t}function II(t,e="-"){const r="relay",i={};return Object.keys(t).forEach(n=>{const s=r+e+n;t[n]&&(i[s]=t[n])}),i}function MI(t){return`${t.protocol}:${t.topic}@${t.version}?`+Zc.stringify(wb(AI(wb({symKey:t.symKey},II(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function yh(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}function oc(t){const e=[];return t.forEach(r=>{const[i,n]=r.split(":");e.push(`${i}:${n}`)}),e}function CI(t){const e=[];return Object.values(t).forEach(r=>{e.push(...oc(r.accounts))}),e}function DI(t,e){const r=[];return Object.values(t).forEach(i=>{oc(i.accounts).includes(e)&&r.push(...i.methods)}),r}function OI(t,e){const r=[];return Object.values(t).forEach(i=>{oc(i.accounts).includes(e)&&r.push(...i.events)}),r}function Ld(t){return t.includes(":")}function xu(t){return Ld(t)?t.split(":")[0]:t}function PI(t){const e={};return t?.forEach(r=>{const[i,n]=r.split(":");e[i]||(e[i]={accounts:[],chains:[],events:[]}),e[i].accounts.push(r),e[i].chains.push(`${i}:${n}`)}),e}function Eb(t,e){e=e.map(i=>i.replace("did:pkh:",""));const r=PI(e);for(const[i,n]of Object.entries(r))n.methods?n.methods=rh(n.methods,t):n.methods=t,n.events=["chainChanged","accountsChanged"];return r}const $I={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}},RI={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 Ee(t,e){const{message:r,code:i}=RI[t];return{message:e?`${r} ${e}`:r,code:i}}function Gt(t,e){const{message:r,code:i}=$I[t];return{message:e?`${r} ${e}`:r,code:i}}function as(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function Su(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function ci(t){return typeof t>"u"}function yr(t,e){return e&&ci(t)?!0:typeof t=="string"&&!!t.trim().length}function Bd(t,e){return e&&ci(t)?!0:typeof t=="number"&&!isNaN(t)}function NI(t,e){const{requiredNamespaces:r}=e,i=Object.keys(t.namespaces),n=Object.keys(r);let s=!0;return zo(n,i)?(i.forEach(a=>{const{accounts:u,methods:h,events:l}=t.namespaces[a],b=oc(u),w=r[a];(!zo(k2(a,w),b)||!zo(w.methods,h)||!zo(w.events,l))&&(s=!1)}),s):!1}function wh(t){return yr(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function TI(t){if(yr(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&wh(r)}}return!1}function LI(t){if(yr(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function BI(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function FI(t){return t?.topic}function UI(t,e){let r=null;return yr(t?.publicKey,!1)||(r=Ee("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function Ab(t){let e=!0;return as(t)?t.length&&(e=t.every(r=>yr(r,!1))):e=!1,e}function kI(t,e,r){let i=null;return as(e)&&e.length?e.forEach(n=>{i||wh(n)||(i=Gt("UNSUPPORTED_CHAINS",`${r}, chain ${n} should be a string and conform to "namespace:chainId" format`))}):wh(t)||(i=Gt("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),i}function qI(t,e,r){let i=null;return Object.entries(t).forEach(([n,s])=>{if(i)return;const a=kI(n,k2(n,s),`${e} ${r}`);a&&(i=a)}),i}function jI(t,e){let r=null;return as(t)?t.forEach(i=>{r||TI(i)||(r=Gt("UNSUPPORTED_ACCOUNTS",`${e}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):r=Gt("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function zI(t,e){let r=null;return Object.values(t).forEach(i=>{if(r)return;const n=jI(i?.accounts,`${e} namespace`);n&&(r=n)}),r}function HI(t,e){let r=null;return Ab(t?.methods)?Ab(t?.events)||(r=Gt("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Gt("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function xb(t,e){let r=null;return Object.values(t).forEach(i=>{if(r)return;const n=HI(i,`${e}, namespace`);n&&(r=n)}),r}function KI(t,e,r){let i=null;if(t&&Su(t)){const n=xb(t,e);n&&(i=n);const s=qI(t,e,r);s&&(i=s)}else i=Ee("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return i}function Fd(t,e){let r=null;if(t&&Su(t)){const i=xb(t,e);i&&(r=i);const n=zI(t,e);n&&(r=n)}else r=Ee("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function Sb(t){return yr(t.protocol,!0)}function WI(t,e){let r=!1;return e&&!t?r=!0:t&&as(t)&&t.length&&t.forEach(i=>{r=Sb(i)}),r}function VI(t){return typeof t=="number"}function _i(t){return typeof t<"u"&&typeof t!==null}function GI(t){return!(!t||typeof t!="object"||!t.code||!Bd(t.code,!1)||!t.message||!yr(t.message,!1))}function JI(t){return!(ci(t)||!yr(t.method,!1))}function YI(t){return!(ci(t)||ci(t.result)&&ci(t.error)||!Bd(t.id,!1)||!yr(t.jsonrpc,!1))}function QI(t){return!(ci(t)||!yr(t.name,!1))}function Ib(t,e){return!(!wh(e)||!CI(t).includes(e))}function ZI(t,e,r){return yr(r,!1)?DI(t,e).includes(r):!1}function XI(t,e,r){return yr(r,!1)?OI(t,e).includes(r):!1}function Mb(t,e,r){let i=null;const n=eM(t),s=tM(e),a=Object.keys(n),u=Object.keys(s),h=Cb(Object.keys(t)),l=Cb(Object.keys(e)),b=h.filter(w=>!l.includes(w));return b.length&&(i=Ee("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces.
25
25
  Required: ${b.toString()}
26
26
  Received: ${Object.keys(e).toString()}`)),zo(a,u)||(i=Ee("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces.
27
27
  Required: ${a.toString()}
28
28
  Approved: ${u.toString()}`)),Object.keys(e).forEach(w=>{if(!w.includes(":")||i)return;const I=oc(e[w].accounts);I.includes(w)||(i=Ee("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${w}
29
29
  Required: ${w}
30
- Approved: ${I.toString()}`))}),a.forEach(w=>{i||(zo(n[w].methods,s[w].methods)?zo(n[w].events,s[w].events)||(i=Ee("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${w}`)):i=Ee("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${w}`))}),i}function eM(t){const e={};return Object.keys(t).forEach(r=>{var i;r.includes(":")?e[r]=t[r]:(i=t[r].chains)==null||i.forEach(n=>{e[n]={methods:t[r].methods,events:t[r].events}})}),e}function Mb(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function tM(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const i=oc(t[r].accounts);i?.forEach(n=>{e[n]={accounts:t[r].accounts.filter(s=>s.includes(`${n}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function rM(t,e){return Bd(t,!1)&&t<=e.max&&t>=e.min}function Cb(){const t=cu();return new Promise(e=>{switch(t){case Bi.browser:e(iM());break;case Bi.reactNative:e(nM());break;case Bi.node:e(sM());break;default:e(!0)}})}function iM(){return au()&&navigator?.onLine}async function nM(){if(Va()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t?.isConnected}return!0}function sM(){return!0}function oM(t){switch(cu()){case Bi.browser:aM(t);break;case Bi.reactNative:cM(t);break}}function aM(t){!Va()&&au()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function cM(t){Va()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>t(e?.isConnected))}const Ud={};class Iu{static get(e){return Ud[e]}static set(e,r){Ud[e]=r}static delete(e){delete Ud[e]}}const uM=/"(?:_|\\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*:/,fM=/"(?: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*:/,hM=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function lM(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){dM(t);return}return e}function dM(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function _h(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.at(-1)==='"'&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const i=r.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(!hM.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(uM.test(t)||fM.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,lM)}return JSON.parse(t)}catch(i){if(e.strict)throw i;return t}}function pM(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Tr(t,...e){try{return pM(t(...e))}catch(r){return Promise.reject(r)}}function gM(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function vM(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Eh(t){if(gM(t))return String(t);if(vM(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Eh(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function Db(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}const kd="base64:";function mM(t){if(typeof t=="string")return t;Db();const e=Buffer.from(t).toString("base64");return kd+e}function bM(t){return typeof t!="string"||!t.startsWith(kd)?t:(Db(),Buffer.from(t.slice(kd.length),"base64"))}function Ei(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function yM(...t){return Ei(t.join(":"))}function Ah(t){return t=Ei(t),t?t+":":""}function HH(t){return t}const wM="memory",_M=()=>{const t=new Map;return{name:wM,options:{},hasItem(e){return t.has(e)},getItem(e){return t.get(e)||null},getItemRaw(e){return t.get(e)||null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return Array.from(t.keys())},clear(){t.clear()},dispose(){t.clear()}}};function EM(t={}){const e={mounts:{"":t.driver||_M()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=l=>{for(const b of e.mountpoints)if(l.startsWith(b))return{base:b,relativeKey:l.slice(b.length),driver:e.mounts[b]};return{base:"",relativeKey:l,driver:e.mounts[""]}},i=(l,b)=>e.mountpoints.filter(w=>w.startsWith(l)||b&&l.startsWith(w)).map(w=>({relativeBase:l.length>w.length?l.slice(w.length):void 0,mountpoint:w,driver:e.mounts[w]})),n=(l,b)=>{if(e.watching){b=Ei(b);for(const w of e.watchListeners)w(l,b)}},s=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await Ob(e.mounts[l],n,l)}},a=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},u=(l,b,w)=>{const I=new Map,S=D=>{let T=I.get(D.base);return T||(T={driver:D.driver,base:D.base,items:[]},I.set(D.base,T)),T};for(const D of l){const T=typeof D=="string",q=Ei(T?D:D.key),K=T?void 0:D.value,F=T||!D.options?b:{...b,...D.options},W=r(q);S(W).items.push({key:q,value:K,relativeKey:W.relativeKey,options:F})}return Promise.all([...I.values()].map(D=>w(D))).then(D=>D.flat())},h={hasItem(l,b={}){l=Ei(l);const{relativeKey:w,driver:I}=r(l);return Tr(I.hasItem,w,b)},getItem(l,b={}){l=Ei(l);const{relativeKey:w,driver:I}=r(l);return Tr(I.getItem,w,b).then(S=>_h(S))},getItems(l,b){return u(l,b,w=>w.driver.getItems?Tr(w.driver.getItems,w.items.map(I=>({key:I.relativeKey,options:I.options})),b).then(I=>I.map(S=>({key:yM(w.base,S.key),value:_h(S.value)}))):Promise.all(w.items.map(I=>Tr(w.driver.getItem,I.relativeKey,I.options).then(S=>({key:I.key,value:_h(S)})))))},getItemRaw(l,b={}){l=Ei(l);const{relativeKey:w,driver:I}=r(l);return I.getItemRaw?Tr(I.getItemRaw,w,b):Tr(I.getItem,w,b).then(S=>bM(S))},async setItem(l,b,w={}){if(b===void 0)return h.removeItem(l);l=Ei(l);const{relativeKey:I,driver:S}=r(l);S.setItem&&(await Tr(S.setItem,I,Eh(b),w),S.watch||n("update",l))},async setItems(l,b){await u(l,b,async w=>{w.driver.setItems&&await Tr(w.driver.setItems,w.items.map(I=>({key:I.relativeKey,value:Eh(I.value),options:I.options})),b),w.driver.setItem&&await Promise.all(w.items.map(I=>Tr(w.driver.setItem,I.relativeKey,Eh(I.value),I.options)))})},async setItemRaw(l,b,w={}){if(b===void 0)return h.removeItem(l,w);l=Ei(l);const{relativeKey:I,driver:S}=r(l);if(S.setItemRaw)await Tr(S.setItemRaw,I,b,w);else if(S.setItem)await Tr(S.setItem,I,mM(b),w);else return;S.watch||n("update",l)},async removeItem(l,b={}){typeof b=="boolean"&&(b={removeMeta:b}),l=Ei(l);const{relativeKey:w,driver:I}=r(l);I.removeItem&&(await Tr(I.removeItem,w,b),(b.removeMeta||b.removeMata)&&await Tr(I.removeItem,w+"$",b),I.watch||n("remove",l))},async getMeta(l,b={}){typeof b=="boolean"&&(b={nativeOnly:b}),l=Ei(l);const{relativeKey:w,driver:I}=r(l),S=Object.create(null);if(I.getMeta&&Object.assign(S,await Tr(I.getMeta,w,b)),!b.nativeOnly){const D=await Tr(I.getItem,w+"$",b).then(T=>_h(T));D&&typeof D=="object"&&(typeof D.atime=="string"&&(D.atime=new Date(D.atime)),typeof D.mtime=="string"&&(D.mtime=new Date(D.mtime)),Object.assign(S,D))}return S},setMeta(l,b,w={}){return this.setItem(l+"$",b,w)},removeMeta(l,b={}){return this.removeItem(l+"$",b)},async getKeys(l,b={}){l=Ah(l);const w=i(l,!0);let I=[];const S=[];for(const D of w){const q=(await Tr(D.driver.getKeys,D.relativeBase,b)).map(K=>D.mountpoint+Ei(K)).filter(K=>!I.some(F=>K.startsWith(F)));S.push(...q),I=[D.mountpoint,...I.filter(K=>!K.startsWith(D.mountpoint))]}return l?S.filter(D=>D.startsWith(l)&&!D.endsWith("$")):S.filter(D=>!D.endsWith("$"))},async clear(l,b={}){l=Ah(l),await Promise.all(i(l,!1).map(async w=>{if(w.driver.clear)return Tr(w.driver.clear,w.relativeBase,b);if(w.driver.removeItem){const I=await w.driver.getKeys(w.relativeBase||"",b);return Promise.all(I.map(S=>w.driver.removeItem(S,b)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>Pb(l)))},async watch(l){return await s(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(b=>b!==l),e.watchListeners.length===0&&await a()}},async unwatch(){e.watchListeners=[],await a()},mount(l,b){if(l=Ah(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((w,I)=>I.length-w.length)),e.mounts[l]=b,e.watching&&Promise.resolve(Ob(b,n,l)).then(w=>{e.unwatch[l]=w}).catch(console.error),h},async unmount(l,b=!0){l=Ah(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&(e.unwatch[l](),delete e.unwatch[l]),b&&await Pb(e.mounts[l]),e.mountpoints=e.mountpoints.filter(w=>w!==l),delete e.mounts[l])},getMount(l=""){l=Ei(l)+":";const b=r(l);return{driver:b.driver,base:b.base}},getMounts(l="",b={}){return l=Ei(l),i(l,b.parents).map(I=>({driver:I.driver,base:I.mountpoint}))}};return h}function Ob(t,e,r){return t.watch?t.watch((i,n)=>e(i,r+n)):()=>{}}async function Pb(t){typeof t.dispose=="function"&&await Tr(t.dispose)}function Jo(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function $b(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const i=Jo(r);return(n,s)=>i.then(a=>s(a.transaction(e,n).objectStore(e)))}let qd;function Mu(){return qd||(qd=$b("keyval-store","keyval")),qd}function Rb(t,e=Mu()){return e("readonly",r=>Jo(r.get(t)))}function AM(t,e,r=Mu()){return r("readwrite",i=>(i.put(e,t),Jo(i.transaction)))}function xM(t,e=Mu()){return e("readwrite",r=>(r.delete(t),Jo(r.transaction)))}function SM(t=Mu()){return t("readwrite",e=>(e.clear(),Jo(e.transaction)))}function IM(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Jo(t.transaction)}function MM(t=Mu()){return t("readonly",e=>{if(e.getAllKeys)return Jo(e.getAllKeys());const r=[];return IM(e,i=>r.push(i.key)).then(()=>r)})}const CM="idb-keyval";var DM=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=n=>e+n;let i;return t.dbName&&t.storeName&&(i=$b(t.dbName,t.storeName)),{name:CM,options:t,async hasItem(n){return!(typeof await Rb(r(n),i)>"u")},async getItem(n){return await Rb(r(n),i)??null},setItem(n,s){return AM(r(n),s,i)},removeItem(n){return xM(r(n),i)},getKeys(){return MM(i)},clear(){return SM(i)}}};const OM="WALLET_CONNECT_V2_INDEXED_DB",PM="keyvaluestorage";class $M{constructor(){this.indexedDb=EM({driver:DM({dbName:OM,storeName:PM})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,Cs(r))}async removeItem(e){await this.indexedDb.removeItem(e)}}var jd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},xh={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,i){this[r]=String(i)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(i){r[i]=void 0,delete r[i]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof jd<"u"&&jd.localStorage?xh.exports=jd.localStorage:typeof window<"u"&&window.localStorage?xh.exports=window.localStorage:xh.exports=new e})();function RM(t){var e;return[t[0],jo((e=t[1])!=null?e:"")]}class NM{constructor(){this.localStorage=xh.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(RM)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return jo(r)}async setItem(e,r){this.localStorage.setItem(e,Cs(r))}async removeItem(e){this.localStorage.removeItem(e)}}const TM="wc_storage_version",Nb=1,LM=async(t,e,r)=>{const i=TM,n=await e.getItem(i);if(n&&n>=Nb){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const a=[];for(;s.length;){const u=s.shift();if(!u)continue;const h=u.toLowerCase();if(h.includes("wc@")||h.includes("walletconnect")||h.includes("wc_")||h.includes("wallet_connect")){const l=await t.getItem(u);await e.setItem(u,l),a.push(u)}}await e.setItem(i,Nb),r(e),BM(t,a)},BM=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};class FM{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new NM;this.storage=e;try{const r=new $M;LM(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}}class Yo{}class UM extends Yo{constructor(e){super()}}const Tb=xe.FIVE_SECONDS,ac={pulse:"heartbeat_pulse"};class zd extends UM{constructor(e){super(e),this.events=new kr.exports.EventEmitter,this.interval=Tb,this.interval=e?.interval||Tb}static async init(e){const r=new zd(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),xe.toMiliseconds(this.interval))}pulse(){this.events.emit(ac.pulse)}}function kM(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var qM=jM;function jM(t,e,r){var i=r&&r.stringify||kM,n=1;if(typeof t=="object"&&t!==null){var s=e.length+n;if(s===1)return t;var a=new Array(s);a[0]=i(t);for(var u=1;u<s;u++)a[u]=i(e[u]);return a.join(" ")}if(typeof t!="string")return t;var h=e.length;if(h===0)return t;for(var l="",b=1-n,w=-1,I=t&&t.length||0,S=0;S<I;){if(t.charCodeAt(S)===37&&S+1<I){switch(w=w>-1?w:0,t.charCodeAt(S+1)){case 100:case 102:if(b>=h||e[b]==null)break;w<S&&(l+=t.slice(w,S)),l+=Number(e[b]),w=S+2,S++;break;case 105:if(b>=h||e[b]==null)break;w<S&&(l+=t.slice(w,S)),l+=Math.floor(Number(e[b])),w=S+2,S++;break;case 79:case 111:case 106:if(b>=h||e[b]===void 0)break;w<S&&(l+=t.slice(w,S));var D=typeof e[b];if(D==="string"){l+="'"+e[b]+"'",w=S+2,S++;break}if(D==="function"){l+=e[b].name||"<anonymous>",w=S+2,S++;break}l+=i(e[b]),w=S+2,S++;break;case 115:if(b>=h)break;w<S&&(l+=t.slice(w,S)),l+=String(e[b]),w=S+2,S++;break;case 37:w<S&&(l+=t.slice(w,S)),l+="%",w=S+2,S++,b--;break}++b}++S}return w===-1?t:(w<I&&(l+=t.slice(w)),l)}const Lb=qM;var cs=us;const Cu=ZM().console||{},zM={mapHttpRequest:Ih,mapHttpResponse:Ih,wrapRequestSerializer:Kd,wrapResponseSerializer:Kd,wrapErrorSerializer:Kd,req:Ih,res:Ih,err:GM};function HM(t,e){return Array.isArray(t)?t.filter(function(i){return i!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function us(t){t=t||{},t.browser=t.browser||{};const e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");const r=t.browser.write||Cu;t.browser.write&&(t.browser.asObject=!0);const i=t.serializers||{},n=HM(t.browser.serialize,i);let s=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);const a=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const u=t.level||"info",h=Object.create(r);h.log||(h.log=Du),Object.defineProperty(h,"levelVal",{get:b}),Object.defineProperty(h,"level",{get:w,set:I});const l={transmit:e,serialize:n,asObject:t.browser.asObject,levels:a,timestamp:JM(t)};h.levels=us.levels,h.level=u,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=Du,h.serializers=i,h._serialize=n,h._stdErrSerialize=s,h.child=S,e&&(h._logEvent=Hd());function b(){return this.level==="silent"?1/0:this.levels.values[this.level]}function w(){return this._level}function I(D){if(D!=="silent"&&!this.levels.values[D])throw Error("unknown level "+D);this._level=D,cc(l,h,"error","log"),cc(l,h,"fatal","error"),cc(l,h,"warn","error"),cc(l,h,"info","log"),cc(l,h,"debug","log"),cc(l,h,"trace","log")}function S(D,T){if(!D)throw new Error("missing bindings for child Pino");T=T||{},n&&D.serializers&&(T.serializers=D.serializers);const q=T.serializers;if(n&&q){var K=Object.assign({},i,q),F=t.browser.serialize===!0?Object.keys(K):n;delete D.serializers,Sh([D],F,K,this._stdErrSerialize)}function W(R){this._childLevel=(R._childLevel|0)+1,this.error=uc(R,D,"error"),this.fatal=uc(R,D,"fatal"),this.warn=uc(R,D,"warn"),this.info=uc(R,D,"info"),this.debug=uc(R,D,"debug"),this.trace=uc(R,D,"trace"),K&&(this.serializers=K,this._serialize=F),e&&(this._logEvent=Hd([].concat(R._logEvent.bindings,D)))}return W.prototype=this,new W(this)}return h}us.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"}},us.stdSerializers=zM,us.stdTimeFunctions=Object.assign({},{nullTime:Bb,epochTime:Fb,unixTime:YM,isoTime:QM});function cc(t,e,r,i){const n=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Du:n[r]?n[r]:Cu[r]||Cu[i]||Du,KM(t,e,r)}function KM(t,e,r){!t.transmit&&e[r]===Du||(e[r]=function(i){return function(){const s=t.timestamp(),a=new Array(arguments.length),u=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Cu?Cu:this;for(var h=0;h<a.length;h++)a[h]=arguments[h];if(t.serialize&&!t.asObject&&Sh(a,this._serialize,this.serializers,this._stdErrSerialize),t.asObject?i.call(u,WM(this,r,a,s)):i.apply(u,a),t.transmit){const l=t.transmit.level||e.level,b=us.levels.values[l],w=us.levels.values[r];if(w<b)return;VM(this,{ts:s,methodLevel:r,methodValue:w,transmitLevel:l,transmitValue:us.levels.values[t.transmit.level||e.level],send:t.transmit.send,val:e.levelVal},a)}}}(e[r]))}function WM(t,e,r,i){t._serialize&&Sh(r,t._serialize,t.serializers,t._stdErrSerialize);const n=r.slice();let s=n[0];const a={};i&&(a.time=i),a.level=us.levels.values[e];let u=(t._childLevel|0)+1;if(u<1&&(u=1),s!==null&&typeof s=="object"){for(;u--&&typeof n[0]=="object";)Object.assign(a,n.shift());s=n.length?Lb(n.shift(),n):void 0}else typeof s=="string"&&(s=Lb(n.shift(),n));return s!==void 0&&(a.msg=s),a}function Sh(t,e,r,i){for(const n in t)if(i&&t[n]instanceof Error)t[n]=us.stdSerializers.err(t[n]);else if(typeof t[n]=="object"&&!Array.isArray(t[n]))for(const s in t[n])e&&e.indexOf(s)>-1&&s in r&&(t[n][s]=r[s](t[n][s]))}function uc(t,e,r){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 t[r].apply(this,i)}}function VM(t,e,r){const i=e.send,n=e.ts,s=e.methodLevel,a=e.methodValue,u=e.val,h=t._logEvent.bindings;Sh(r,t._serialize||Object.keys(t.serializers),t.serializers,t._stdErrSerialize===void 0?!0:t._stdErrSerialize),t._logEvent.ts=n,t._logEvent.messages=r.filter(function(l){return h.indexOf(l)===-1}),t._logEvent.level.label=s,t._logEvent.level.value=a,i(s,t._logEvent,u),t._logEvent=Hd(h)}function Hd(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function GM(t){const e={type:t.constructor.name,msg:t.message,stack:t.stack};for(const r in t)e[r]===void 0&&(e[r]=t[r]);return e}function JM(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?Bb:Fb}function Ih(){return{}}function Kd(t){return t}function Du(){}function Bb(){return!1}function Fb(){return Date.now()}function YM(){return Math.round(Date.now()/1e3)}function QM(){return new Date(Date.now()).toISOString()}function ZM(){function t(e){return typeof e<"u"&&e}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return t(self)||t(window)||t(this)||{}}}const XM={level:"info"},Ou="custom_context",Wd=1e3*1024;class eC{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 Ub{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const r=new eC(e);if(r.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}}class kb{constructor(e,r=Wd){this.level=e??"error",this.levelValue=cs.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new Ub(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===cs.levels.values.error?console.error(e):r===cs.levels.values.warn?console.warn(e):r===cs.levels.values.debug?console.debug(e):r===cs.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(Cs({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new Ub(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(Cs({extraMetadata:e})),new Blob(r,{type:"application/json"})}}class tC{constructor(e,r=Wd){this.baseChunkLogger=new kb(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),i=document.createElement("a");i.href=r,i.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)}}class rC{constructor(e,r=Wd){this.baseChunkLogger=new kb(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var iC=Object.defineProperty,nC=Object.defineProperties,sC=Object.getOwnPropertyDescriptors,qb=Object.getOwnPropertySymbols,oC=Object.prototype.hasOwnProperty,aC=Object.prototype.propertyIsEnumerable,jb=(t,e,r)=>e in t?iC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Mh=(t,e)=>{for(var r in e||(e={}))oC.call(e,r)&&jb(t,r,e[r]);if(qb)for(var r of qb(e))aC.call(e,r)&&jb(t,r,e[r]);return t},Ch=(t,e)=>nC(t,sC(e));function Dh(t){return Ch(Mh({},t),{level:t?.level||XM.level})}function cC(t,e=Ou){return t[e]||""}function uC(t,e,r=Ou){return t[r]=e,t}function Ai(t,e=Ou){let r="";return typeof t.bindings>"u"?r=cC(t,e):r=t.bindings().context||"",r}function fC(t,e,r=Ou){const i=Ai(t,r);return i.trim()?`${i}/${e}`:e}function ui(t,e,r=Ou){const i=fC(t,e,r),n=t.child({context:i});return uC(n,i,r)}function hC(t){var e,r;const i=new tC((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:cs(Ch(Mh({},t.opts),{level:"trace",browser:Ch(Mh({},(r=t.opts)==null?void 0:r.browser),{write:n=>i.write(n)})})),chunkLoggerController:i}}function lC(t){var e;const r=new rC((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:cs(Ch(Mh({},t.opts),{level:"trace"})),chunkLoggerController:r}}function dC(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?hC(t):lC(t)}class pC extends Yo{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class gC extends Yo{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}}class vC{constructor(e,r){this.logger=e,this.core=r}}class mC extends Yo{constructor(e,r){super(),this.relayer=e,this.logger=r}}class bC extends Yo{constructor(e){super()}}class yC{constructor(e,r,i,n){this.core=e,this.logger=r,this.name=i}}class wC extends Yo{constructor(e,r){super(),this.relayer=e,this.logger=r}}class _C extends Yo{constructor(e,r){super(),this.core=e,this.logger=r}}class EC{constructor(e,r,i){this.core=e,this.logger=r,this.store=i}}class AC{constructor(e,r){this.projectId=e,this.logger=r}}class xC{constructor(e,r,i){this.core=e,this.logger=r,this.telemetryEnabled=i}}class SC{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class IC{constructor(e){this.client=e}}function MC(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function zb(t,e,r,i){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:i}}}const Hb=zb("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Vd=zb("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=MC(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),CC={utf8:Hb,"utf-8":Hb,hex:Ra.base16,latin1:Vd,ascii:Vd,binary:Vd,...Ra};function DC(t,e="utf8"){const r=CC[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}const OC="PARSE_ERROR",PC="INVALID_REQUEST",$C="METHOD_NOT_FOUND",RC="INVALID_PARAMS",Kb="INTERNAL_ERROR",Gd="SERVER_ERROR",NC=[-32700,-32600,-32601,-32602,-32603],Pu={[OC]:{code:-32700,message:"Parse error"},[PC]:{code:-32600,message:"Invalid Request"},[$C]:{code:-32601,message:"Method not found"},[RC]:{code:-32602,message:"Invalid params"},[Kb]:{code:-32603,message:"Internal error"},[Gd]:{code:-32e3,message:"Server error"}},Wb=Gd;function TC(t){return NC.includes(t)}function Vb(t){return Object.keys(Pu).includes(t)?Pu[t]:Pu[Wb]}function LC(t){const e=Object.values(Pu).find(r=>r.code===t);return e||Pu[Wb]}function Gb(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var Jb={};/*! *****************************************************************************
30
+ Approved: ${I.toString()}`))}),a.forEach(w=>{i||(zo(n[w].methods,s[w].methods)?zo(n[w].events,s[w].events)||(i=Ee("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${w}`)):i=Ee("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${w}`))}),i}function eM(t){const e={};return Object.keys(t).forEach(r=>{var i;r.includes(":")?e[r]=t[r]:(i=t[r].chains)==null||i.forEach(n=>{e[n]={methods:t[r].methods,events:t[r].events}})}),e}function Cb(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function tM(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const i=oc(t[r].accounts);i?.forEach(n=>{e[n]={accounts:t[r].accounts.filter(s=>s.includes(`${n}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function rM(t,e){return Bd(t,!1)&&t<=e.max&&t>=e.min}function Db(){const t=cu();return new Promise(e=>{switch(t){case Bi.browser:e(iM());break;case Bi.reactNative:e(nM());break;case Bi.node:e(sM());break;default:e(!0)}})}function iM(){return au()&&navigator?.onLine}async function nM(){if(Va()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t?.isConnected}return!0}function sM(){return!0}function oM(t){switch(cu()){case Bi.browser:aM(t);break;case Bi.reactNative:cM(t);break}}function aM(t){!Va()&&au()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function cM(t){Va()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>t(e?.isConnected))}const Ud={};class Iu{static get(e){return Ud[e]}static set(e,r){Ud[e]=r}static delete(e){delete Ud[e]}}const uM=/"(?:_|\\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*:/,fM=/"(?: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*:/,hM=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function lM(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){dM(t);return}return e}function dM(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function _h(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.at(-1)==='"'&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const i=r.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(!hM.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(uM.test(t)||fM.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,lM)}return JSON.parse(t)}catch(i){if(e.strict)throw i;return t}}function pM(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Tr(t,...e){try{return pM(t(...e))}catch(r){return Promise.reject(r)}}function gM(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function vM(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Eh(t){if(gM(t))return String(t);if(vM(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Eh(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function Ob(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}const kd="base64:";function mM(t){if(typeof t=="string")return t;Ob();const e=Buffer.from(t).toString("base64");return kd+e}function bM(t){return typeof t!="string"||!t.startsWith(kd)?t:(Ob(),Buffer.from(t.slice(kd.length),"base64"))}function Ei(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function yM(...t){return Ei(t.join(":"))}function Ah(t){return t=Ei(t),t?t+":":""}function HH(t){return t}const wM="memory",_M=()=>{const t=new Map;return{name:wM,options:{},hasItem(e){return t.has(e)},getItem(e){return t.get(e)||null},getItemRaw(e){return t.get(e)||null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return Array.from(t.keys())},clear(){t.clear()},dispose(){t.clear()}}};function EM(t={}){const e={mounts:{"":t.driver||_M()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=l=>{for(const b of e.mountpoints)if(l.startsWith(b))return{base:b,relativeKey:l.slice(b.length),driver:e.mounts[b]};return{base:"",relativeKey:l,driver:e.mounts[""]}},i=(l,b)=>e.mountpoints.filter(w=>w.startsWith(l)||b&&l.startsWith(w)).map(w=>({relativeBase:l.length>w.length?l.slice(w.length):void 0,mountpoint:w,driver:e.mounts[w]})),n=(l,b)=>{if(e.watching){b=Ei(b);for(const w of e.watchListeners)w(l,b)}},s=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await Pb(e.mounts[l],n,l)}},a=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},u=(l,b,w)=>{const I=new Map,S=D=>{let T=I.get(D.base);return T||(T={driver:D.driver,base:D.base,items:[]},I.set(D.base,T)),T};for(const D of l){const T=typeof D=="string",q=Ei(T?D:D.key),K=T?void 0:D.value,F=T||!D.options?b:{...b,...D.options},W=r(q);S(W).items.push({key:q,value:K,relativeKey:W.relativeKey,options:F})}return Promise.all([...I.values()].map(D=>w(D))).then(D=>D.flat())},h={hasItem(l,b={}){l=Ei(l);const{relativeKey:w,driver:I}=r(l);return Tr(I.hasItem,w,b)},getItem(l,b={}){l=Ei(l);const{relativeKey:w,driver:I}=r(l);return Tr(I.getItem,w,b).then(S=>_h(S))},getItems(l,b){return u(l,b,w=>w.driver.getItems?Tr(w.driver.getItems,w.items.map(I=>({key:I.relativeKey,options:I.options})),b).then(I=>I.map(S=>({key:yM(w.base,S.key),value:_h(S.value)}))):Promise.all(w.items.map(I=>Tr(w.driver.getItem,I.relativeKey,I.options).then(S=>({key:I.key,value:_h(S)})))))},getItemRaw(l,b={}){l=Ei(l);const{relativeKey:w,driver:I}=r(l);return I.getItemRaw?Tr(I.getItemRaw,w,b):Tr(I.getItem,w,b).then(S=>bM(S))},async setItem(l,b,w={}){if(b===void 0)return h.removeItem(l);l=Ei(l);const{relativeKey:I,driver:S}=r(l);S.setItem&&(await Tr(S.setItem,I,Eh(b),w),S.watch||n("update",l))},async setItems(l,b){await u(l,b,async w=>{w.driver.setItems&&await Tr(w.driver.setItems,w.items.map(I=>({key:I.relativeKey,value:Eh(I.value),options:I.options})),b),w.driver.setItem&&await Promise.all(w.items.map(I=>Tr(w.driver.setItem,I.relativeKey,Eh(I.value),I.options)))})},async setItemRaw(l,b,w={}){if(b===void 0)return h.removeItem(l,w);l=Ei(l);const{relativeKey:I,driver:S}=r(l);if(S.setItemRaw)await Tr(S.setItemRaw,I,b,w);else if(S.setItem)await Tr(S.setItem,I,mM(b),w);else return;S.watch||n("update",l)},async removeItem(l,b={}){typeof b=="boolean"&&(b={removeMeta:b}),l=Ei(l);const{relativeKey:w,driver:I}=r(l);I.removeItem&&(await Tr(I.removeItem,w,b),(b.removeMeta||b.removeMata)&&await Tr(I.removeItem,w+"$",b),I.watch||n("remove",l))},async getMeta(l,b={}){typeof b=="boolean"&&(b={nativeOnly:b}),l=Ei(l);const{relativeKey:w,driver:I}=r(l),S=Object.create(null);if(I.getMeta&&Object.assign(S,await Tr(I.getMeta,w,b)),!b.nativeOnly){const D=await Tr(I.getItem,w+"$",b).then(T=>_h(T));D&&typeof D=="object"&&(typeof D.atime=="string"&&(D.atime=new Date(D.atime)),typeof D.mtime=="string"&&(D.mtime=new Date(D.mtime)),Object.assign(S,D))}return S},setMeta(l,b,w={}){return this.setItem(l+"$",b,w)},removeMeta(l,b={}){return this.removeItem(l+"$",b)},async getKeys(l,b={}){l=Ah(l);const w=i(l,!0);let I=[];const S=[];for(const D of w){const q=(await Tr(D.driver.getKeys,D.relativeBase,b)).map(K=>D.mountpoint+Ei(K)).filter(K=>!I.some(F=>K.startsWith(F)));S.push(...q),I=[D.mountpoint,...I.filter(K=>!K.startsWith(D.mountpoint))]}return l?S.filter(D=>D.startsWith(l)&&!D.endsWith("$")):S.filter(D=>!D.endsWith("$"))},async clear(l,b={}){l=Ah(l),await Promise.all(i(l,!1).map(async w=>{if(w.driver.clear)return Tr(w.driver.clear,w.relativeBase,b);if(w.driver.removeItem){const I=await w.driver.getKeys(w.relativeBase||"",b);return Promise.all(I.map(S=>w.driver.removeItem(S,b)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>$b(l)))},async watch(l){return await s(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(b=>b!==l),e.watchListeners.length===0&&await a()}},async unwatch(){e.watchListeners=[],await a()},mount(l,b){if(l=Ah(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((w,I)=>I.length-w.length)),e.mounts[l]=b,e.watching&&Promise.resolve(Pb(b,n,l)).then(w=>{e.unwatch[l]=w}).catch(console.error),h},async unmount(l,b=!0){l=Ah(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&(e.unwatch[l](),delete e.unwatch[l]),b&&await $b(e.mounts[l]),e.mountpoints=e.mountpoints.filter(w=>w!==l),delete e.mounts[l])},getMount(l=""){l=Ei(l)+":";const b=r(l);return{driver:b.driver,base:b.base}},getMounts(l="",b={}){return l=Ei(l),i(l,b.parents).map(I=>({driver:I.driver,base:I.mountpoint}))}};return h}function Pb(t,e,r){return t.watch?t.watch((i,n)=>e(i,r+n)):()=>{}}async function $b(t){typeof t.dispose=="function"&&await Tr(t.dispose)}function Jo(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function Rb(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const i=Jo(r);return(n,s)=>i.then(a=>s(a.transaction(e,n).objectStore(e)))}let qd;function Mu(){return qd||(qd=Rb("keyval-store","keyval")),qd}function Nb(t,e=Mu()){return e("readonly",r=>Jo(r.get(t)))}function AM(t,e,r=Mu()){return r("readwrite",i=>(i.put(e,t),Jo(i.transaction)))}function xM(t,e=Mu()){return e("readwrite",r=>(r.delete(t),Jo(r.transaction)))}function SM(t=Mu()){return t("readwrite",e=>(e.clear(),Jo(e.transaction)))}function IM(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Jo(t.transaction)}function MM(t=Mu()){return t("readonly",e=>{if(e.getAllKeys)return Jo(e.getAllKeys());const r=[];return IM(e,i=>r.push(i.key)).then(()=>r)})}const CM="idb-keyval";var DM=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=n=>e+n;let i;return t.dbName&&t.storeName&&(i=Rb(t.dbName,t.storeName)),{name:CM,options:t,async hasItem(n){return!(typeof await Nb(r(n),i)>"u")},async getItem(n){return await Nb(r(n),i)??null},setItem(n,s){return AM(r(n),s,i)},removeItem(n){return xM(r(n),i)},getKeys(){return MM(i)},clear(){return SM(i)}}};const OM="WALLET_CONNECT_V2_INDEXED_DB",PM="keyvaluestorage";class $M{constructor(){this.indexedDb=EM({driver:DM({dbName:OM,storeName:PM})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,Cs(r))}async removeItem(e){await this.indexedDb.removeItem(e)}}var jd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},xh={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,i){this[r]=String(i)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(i){r[i]=void 0,delete r[i]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof jd<"u"&&jd.localStorage?xh.exports=jd.localStorage:typeof window<"u"&&window.localStorage?xh.exports=window.localStorage:xh.exports=new e})();function RM(t){var e;return[t[0],jo((e=t[1])!=null?e:"")]}class NM{constructor(){this.localStorage=xh.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(RM)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return jo(r)}async setItem(e,r){this.localStorage.setItem(e,Cs(r))}async removeItem(e){this.localStorage.removeItem(e)}}const TM="wc_storage_version",Tb=1,LM=async(t,e,r)=>{const i=TM,n=await e.getItem(i);if(n&&n>=Tb){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const a=[];for(;s.length;){const u=s.shift();if(!u)continue;const h=u.toLowerCase();if(h.includes("wc@")||h.includes("walletconnect")||h.includes("wc_")||h.includes("wallet_connect")){const l=await t.getItem(u);await e.setItem(u,l),a.push(u)}}await e.setItem(i,Tb),r(e),BM(t,a)},BM=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};class FM{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new NM;this.storage=e;try{const r=new $M;LM(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}}class Yo{}class UM extends Yo{constructor(e){super()}}const Lb=xe.FIVE_SECONDS,ac={pulse:"heartbeat_pulse"};class zd extends UM{constructor(e){super(e),this.events=new kr.exports.EventEmitter,this.interval=Lb,this.interval=e?.interval||Lb}static async init(e){const r=new zd(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),xe.toMiliseconds(this.interval))}pulse(){this.events.emit(ac.pulse)}}function kM(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var qM=jM;function jM(t,e,r){var i=r&&r.stringify||kM,n=1;if(typeof t=="object"&&t!==null){var s=e.length+n;if(s===1)return t;var a=new Array(s);a[0]=i(t);for(var u=1;u<s;u++)a[u]=i(e[u]);return a.join(" ")}if(typeof t!="string")return t;var h=e.length;if(h===0)return t;for(var l="",b=1-n,w=-1,I=t&&t.length||0,S=0;S<I;){if(t.charCodeAt(S)===37&&S+1<I){switch(w=w>-1?w:0,t.charCodeAt(S+1)){case 100:case 102:if(b>=h||e[b]==null)break;w<S&&(l+=t.slice(w,S)),l+=Number(e[b]),w=S+2,S++;break;case 105:if(b>=h||e[b]==null)break;w<S&&(l+=t.slice(w,S)),l+=Math.floor(Number(e[b])),w=S+2,S++;break;case 79:case 111:case 106:if(b>=h||e[b]===void 0)break;w<S&&(l+=t.slice(w,S));var D=typeof e[b];if(D==="string"){l+="'"+e[b]+"'",w=S+2,S++;break}if(D==="function"){l+=e[b].name||"<anonymous>",w=S+2,S++;break}l+=i(e[b]),w=S+2,S++;break;case 115:if(b>=h)break;w<S&&(l+=t.slice(w,S)),l+=String(e[b]),w=S+2,S++;break;case 37:w<S&&(l+=t.slice(w,S)),l+="%",w=S+2,S++,b--;break}++b}++S}return w===-1?t:(w<I&&(l+=t.slice(w)),l)}const Bb=qM;var cs=us;const Cu=ZM().console||{},zM={mapHttpRequest:Ih,mapHttpResponse:Ih,wrapRequestSerializer:Kd,wrapResponseSerializer:Kd,wrapErrorSerializer:Kd,req:Ih,res:Ih,err:GM};function HM(t,e){return Array.isArray(t)?t.filter(function(i){return i!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function us(t){t=t||{},t.browser=t.browser||{};const e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");const r=t.browser.write||Cu;t.browser.write&&(t.browser.asObject=!0);const i=t.serializers||{},n=HM(t.browser.serialize,i);let s=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);const a=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const u=t.level||"info",h=Object.create(r);h.log||(h.log=Du),Object.defineProperty(h,"levelVal",{get:b}),Object.defineProperty(h,"level",{get:w,set:I});const l={transmit:e,serialize:n,asObject:t.browser.asObject,levels:a,timestamp:JM(t)};h.levels=us.levels,h.level=u,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=Du,h.serializers=i,h._serialize=n,h._stdErrSerialize=s,h.child=S,e&&(h._logEvent=Hd());function b(){return this.level==="silent"?1/0:this.levels.values[this.level]}function w(){return this._level}function I(D){if(D!=="silent"&&!this.levels.values[D])throw Error("unknown level "+D);this._level=D,cc(l,h,"error","log"),cc(l,h,"fatal","error"),cc(l,h,"warn","error"),cc(l,h,"info","log"),cc(l,h,"debug","log"),cc(l,h,"trace","log")}function S(D,T){if(!D)throw new Error("missing bindings for child Pino");T=T||{},n&&D.serializers&&(T.serializers=D.serializers);const q=T.serializers;if(n&&q){var K=Object.assign({},i,q),F=t.browser.serialize===!0?Object.keys(K):n;delete D.serializers,Sh([D],F,K,this._stdErrSerialize)}function W(R){this._childLevel=(R._childLevel|0)+1,this.error=uc(R,D,"error"),this.fatal=uc(R,D,"fatal"),this.warn=uc(R,D,"warn"),this.info=uc(R,D,"info"),this.debug=uc(R,D,"debug"),this.trace=uc(R,D,"trace"),K&&(this.serializers=K,this._serialize=F),e&&(this._logEvent=Hd([].concat(R._logEvent.bindings,D)))}return W.prototype=this,new W(this)}return h}us.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"}},us.stdSerializers=zM,us.stdTimeFunctions=Object.assign({},{nullTime:Fb,epochTime:Ub,unixTime:YM,isoTime:QM});function cc(t,e,r,i){const n=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Du:n[r]?n[r]:Cu[r]||Cu[i]||Du,KM(t,e,r)}function KM(t,e,r){!t.transmit&&e[r]===Du||(e[r]=function(i){return function(){const s=t.timestamp(),a=new Array(arguments.length),u=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Cu?Cu:this;for(var h=0;h<a.length;h++)a[h]=arguments[h];if(t.serialize&&!t.asObject&&Sh(a,this._serialize,this.serializers,this._stdErrSerialize),t.asObject?i.call(u,WM(this,r,a,s)):i.apply(u,a),t.transmit){const l=t.transmit.level||e.level,b=us.levels.values[l],w=us.levels.values[r];if(w<b)return;VM(this,{ts:s,methodLevel:r,methodValue:w,transmitLevel:l,transmitValue:us.levels.values[t.transmit.level||e.level],send:t.transmit.send,val:e.levelVal},a)}}}(e[r]))}function WM(t,e,r,i){t._serialize&&Sh(r,t._serialize,t.serializers,t._stdErrSerialize);const n=r.slice();let s=n[0];const a={};i&&(a.time=i),a.level=us.levels.values[e];let u=(t._childLevel|0)+1;if(u<1&&(u=1),s!==null&&typeof s=="object"){for(;u--&&typeof n[0]=="object";)Object.assign(a,n.shift());s=n.length?Bb(n.shift(),n):void 0}else typeof s=="string"&&(s=Bb(n.shift(),n));return s!==void 0&&(a.msg=s),a}function Sh(t,e,r,i){for(const n in t)if(i&&t[n]instanceof Error)t[n]=us.stdSerializers.err(t[n]);else if(typeof t[n]=="object"&&!Array.isArray(t[n]))for(const s in t[n])e&&e.indexOf(s)>-1&&s in r&&(t[n][s]=r[s](t[n][s]))}function uc(t,e,r){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 t[r].apply(this,i)}}function VM(t,e,r){const i=e.send,n=e.ts,s=e.methodLevel,a=e.methodValue,u=e.val,h=t._logEvent.bindings;Sh(r,t._serialize||Object.keys(t.serializers),t.serializers,t._stdErrSerialize===void 0?!0:t._stdErrSerialize),t._logEvent.ts=n,t._logEvent.messages=r.filter(function(l){return h.indexOf(l)===-1}),t._logEvent.level.label=s,t._logEvent.level.value=a,i(s,t._logEvent,u),t._logEvent=Hd(h)}function Hd(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function GM(t){const e={type:t.constructor.name,msg:t.message,stack:t.stack};for(const r in t)e[r]===void 0&&(e[r]=t[r]);return e}function JM(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?Fb:Ub}function Ih(){return{}}function Kd(t){return t}function Du(){}function Fb(){return!1}function Ub(){return Date.now()}function YM(){return Math.round(Date.now()/1e3)}function QM(){return new Date(Date.now()).toISOString()}function ZM(){function t(e){return typeof e<"u"&&e}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return t(self)||t(window)||t(this)||{}}}const XM={level:"info"},Ou="custom_context",Wd=1e3*1024;class eC{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 kb{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const r=new eC(e);if(r.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}}class qb{constructor(e,r=Wd){this.level=e??"error",this.levelValue=cs.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new kb(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===cs.levels.values.error?console.error(e):r===cs.levels.values.warn?console.warn(e):r===cs.levels.values.debug?console.debug(e):r===cs.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(Cs({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new kb(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(Cs({extraMetadata:e})),new Blob(r,{type:"application/json"})}}class tC{constructor(e,r=Wd){this.baseChunkLogger=new qb(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),i=document.createElement("a");i.href=r,i.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)}}class rC{constructor(e,r=Wd){this.baseChunkLogger=new qb(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var iC=Object.defineProperty,nC=Object.defineProperties,sC=Object.getOwnPropertyDescriptors,jb=Object.getOwnPropertySymbols,oC=Object.prototype.hasOwnProperty,aC=Object.prototype.propertyIsEnumerable,zb=(t,e,r)=>e in t?iC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Mh=(t,e)=>{for(var r in e||(e={}))oC.call(e,r)&&zb(t,r,e[r]);if(jb)for(var r of jb(e))aC.call(e,r)&&zb(t,r,e[r]);return t},Ch=(t,e)=>nC(t,sC(e));function Dh(t){return Ch(Mh({},t),{level:t?.level||XM.level})}function cC(t,e=Ou){return t[e]||""}function uC(t,e,r=Ou){return t[r]=e,t}function Ai(t,e=Ou){let r="";return typeof t.bindings>"u"?r=cC(t,e):r=t.bindings().context||"",r}function fC(t,e,r=Ou){const i=Ai(t,r);return i.trim()?`${i}/${e}`:e}function ui(t,e,r=Ou){const i=fC(t,e,r),n=t.child({context:i});return uC(n,i,r)}function hC(t){var e,r;const i=new tC((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:cs(Ch(Mh({},t.opts),{level:"trace",browser:Ch(Mh({},(r=t.opts)==null?void 0:r.browser),{write:n=>i.write(n)})})),chunkLoggerController:i}}function lC(t){var e;const r=new rC((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:cs(Ch(Mh({},t.opts),{level:"trace"})),chunkLoggerController:r}}function dC(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?hC(t):lC(t)}class pC extends Yo{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class gC extends Yo{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}}class vC{constructor(e,r){this.logger=e,this.core=r}}class mC extends Yo{constructor(e,r){super(),this.relayer=e,this.logger=r}}class bC extends Yo{constructor(e){super()}}class yC{constructor(e,r,i,n){this.core=e,this.logger=r,this.name=i}}class wC extends Yo{constructor(e,r){super(),this.relayer=e,this.logger=r}}class _C extends Yo{constructor(e,r){super(),this.core=e,this.logger=r}}class EC{constructor(e,r,i){this.core=e,this.logger=r,this.store=i}}class AC{constructor(e,r){this.projectId=e,this.logger=r}}class xC{constructor(e,r,i){this.core=e,this.logger=r,this.telemetryEnabled=i}}class SC{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class IC{constructor(e){this.client=e}}function MC(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function Hb(t,e,r,i){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:i}}}const Kb=Hb("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Vd=Hb("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=MC(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),CC={utf8:Kb,"utf-8":Kb,hex:Ra.base16,latin1:Vd,ascii:Vd,binary:Vd,...Ra};function DC(t,e="utf8"){const r=CC[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}const OC="PARSE_ERROR",PC="INVALID_REQUEST",$C="METHOD_NOT_FOUND",RC="INVALID_PARAMS",Wb="INTERNAL_ERROR",Gd="SERVER_ERROR",NC=[-32700,-32600,-32601,-32602,-32603],Pu={[OC]:{code:-32700,message:"Parse error"},[PC]:{code:-32600,message:"Invalid Request"},[$C]:{code:-32601,message:"Method not found"},[RC]:{code:-32602,message:"Invalid params"},[Wb]:{code:-32603,message:"Internal error"},[Gd]:{code:-32e3,message:"Server error"}},Vb=Gd;function TC(t){return NC.includes(t)}function Gb(t){return Object.keys(Pu).includes(t)?Pu[t]:Pu[Vb]}function LC(t){const e=Object.values(Pu).find(r=>r.code===t);return e||Pu[Vb]}function Jb(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var Yb={};/*! *****************************************************************************
31
31
  Copyright (c) Microsoft Corporation.
32
32
 
33
33
  Permission to use, copy, modify, and/or distribute this software for any
@@ -40,16 +40,16 @@
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 Jd=function(t,e){return Jd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},Jd(t,e)};function BC(t,e){Jd(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Yd=function(){return Yd=Object.assign||function(e){for(var r,i=1,n=arguments.length;i<n;i++){r=arguments[i];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Yd.apply(this,arguments)};function FC(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r}function UC(t,e,r,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,i);else for(var u=t.length-1;u>=0;u--)(a=t[u])&&(s=(n<3?a(s):n>3?a(e,r,s):a(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s}function kC(t,e){return function(r,i){e(r,i,t)}}function qC(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function jC(t,e,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function u(b){try{l(i.next(b))}catch(w){a(w)}}function h(b){try{l(i.throw(b))}catch(w){a(w)}}function l(b){b.done?s(b.value):n(b.value).then(u,h)}l((i=i.apply(t,e||[])).next())})}function zC(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(l){return function(b){return h([l,b])}}function h(l){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,n&&(s=l[0]&2?n.return:l[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,l[1])).done)return s;switch(n=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,n=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){r.label=l[1];break}if(l[0]===6&&r.label<s[1]){r.label=s[1],s=l;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(l);break}s[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(b){l=[6,b],n=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function HC(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}function KC(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Qd(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Yb(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var i=r.call(t),n,s=[],a;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(u){a={error:u}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(a)throw a.error}}return s}function WC(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Yb(arguments[e]));return t}function VC(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var i=Array(t),n=0,e=0;e<r;e++)for(var s=arguments[e],a=0,u=s.length;a<u;a++,n++)i[n]=s[a];return i}function $u(t){return this instanceof $u?(this.v=t,this):new $u(t)}function GC(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=r.apply(t,e||[]),n,s=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(I){i[I]&&(n[I]=function(S){return new Promise(function(D,T){s.push([I,S,D,T])>1||u(I,S)})})}function u(I,S){try{h(i[I](S))}catch(D){w(s[0][3],D)}}function h(I){I.value instanceof $u?Promise.resolve(I.value.v).then(l,b):w(s[0][2],I)}function l(I){u("next",I)}function b(I){u("throw",I)}function w(I,S){I(S),s.shift(),s.length&&u(s[0][0],s[0][1])}}function JC(t){var e,r;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]=t[n]?function(a){return(r=!r)?{value:$u(t[n](a)),done:n==="return"}:s?s(a):a}:s}}function YC(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Qd=="function"?Qd(t):t[Symbol.iterator](),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(s){r[s]=t[s]&&function(a){return new Promise(function(u,h){a=t[s](a),n(u,h,a.done,a.value)})}}function n(s,a,u,h){Promise.resolve(h).then(function(l){s({value:l,done:u})},a)}}function QC(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function ZC(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function XC(t){return t&&t.__esModule?t:{default:t}}function eD(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function tD(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var rD=Object.freeze({__proto__:null,__extends:BC,get __assign(){return Yd},__rest:FC,__decorate:UC,__param:kC,__metadata:qC,__awaiter:jC,__generator:zC,__createBinding:HC,__exportStar:KC,__values:Qd,__read:Yb,__spread:WC,__spreadArrays:VC,__await:$u,__asyncGenerator:GC,__asyncDelegator:JC,__asyncValues:YC,__makeTemplateObject:QC,__importStar:ZC,__importDefault:XC,__classPrivateFieldGet:eD,__classPrivateFieldSet:tD}),iD=m0(rD),Ts={},Qb;function nD(){if(Qb)return Ts;Qb=1,Object.defineProperty(Ts,"__esModule",{value:!0}),Ts.isBrowserCryptoAvailable=Ts.getSubtleCrypto=Ts.getBrowerCrypto=void 0;function t(){return Vr?.crypto||Vr?.msCrypto||{}}Ts.getBrowerCrypto=t;function e(){const i=t();return i.subtle||i.webkitSubtle}Ts.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Ts.isBrowserCryptoAvailable=r,Ts}var Ls={},Zb;function sD(){if(Zb)return Ls;Zb=1,Object.defineProperty(Ls,"__esModule",{value:!0}),Ls.isBrowser=Ls.isNode=Ls.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Ls.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Ls.isNode=e;function r(){return!t()&&!e()}return Ls.isBrowser=r,Ls}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=iD;e.__exportStar(nD(),t),e.__exportStar(sD(),t)})(Jb);function co(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function Qo(t=6){return BigInt(co(t))}function uo(t,e,r){return{id:r||co(),jsonrpc:"2.0",method:t,params:e}}function Oh(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Ph(t,e,r){return{id:t,jsonrpc:"2.0",error:oD(e,r)}}function oD(t,e){return typeof t>"u"?Vb(Kb):(typeof t=="string"&&(t=Object.assign(Object.assign({},Vb(Gd)),{message:t})),typeof e<"u"&&(t.data=e),TC(t.code)&&(t=LC(t.code)),t)}class aD{}class cD extends aD{constructor(){super()}}class uD extends cD{constructor(e){super()}}const fD="^https?:",hD="^wss?:";function lD(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function Xb(t,e){const r=lD(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function e3(t){return Xb(t,fD)}function t3(t){return Xb(t,hD)}function dD(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function r3(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function Zd(t){return r3(t)&&"method"in t}function $h(t){return r3(t)&&(fs(t)||rn(t))}function fs(t){return"result"in t}function rn(t){return"error"in t}class xn extends uD{constructor(e){super(e),this.events=new kr.exports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(uo(e.method,e.params||[],e.id||Qo().toString()),r)}async requestStrict(e,r){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,r)}catch(s){n(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),$h(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 pD=()=>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"),gD=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",i3=t=>t.split("?")[0],n3=10,vD=pD();class mD{constructor(e){if(this.url=e,this.events=new kr.exports.EventEmitter,this.registering=!1,!t3(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=i=>{this.onClose(i),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Cs(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!t3(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((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((r,i)=>{const n=new URLSearchParams(e).get("origin"),s=Jb.isReactNative()?{headers:{origin:n}}:{rejectUnauthorized:!dD(e)},a=new vD(e,[],s);gD()?a.onerror=u=>{const h=u;i(this.emitError(h.error))}:a.on("error",u=>{i(this.emitError(u))}),a.onopen=()=>{this.onOpen(a),r(a)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?jo(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const i=this.parseError(r),n=i.message||i.toString(),s=Ph(e,n);this.events.emit("payload",s)}parseError(e,r=this.url){return Gb(e,i3(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>n3&&this.events.setMaxListeners(n3)}emitError(e){const r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${i3(this.url)}`));return this.events.emit("register_error",r),r}}var Xd={exports:{}};(function(t,e){var r=200,i="__lodash_hash_undefined__",n=1,s=2,a=9007199254740991,u="[object Arguments]",h="[object Array]",l="[object AsyncFunction]",b="[object Boolean]",w="[object Date]",I="[object Error]",S="[object Function]",D="[object GeneratorFunction]",T="[object Map]",q="[object Number]",K="[object Null]",F="[object Object]",W="[object Promise]",R="[object Proxy]",k="[object RegExp]",H="[object Set]",_="[object String]",B="[object Symbol]",ee="[object Undefined]",ie="[object WeakMap]",L="[object ArrayBuffer]",y="[object DataView]",f="[object Float32Array]",d="[object Float64Array]",v="[object Int8Array]",E="[object Int16Array]",C="[object Int32Array]",O="[object Uint8Array]",M="[object Uint8ClampedArray]",g="[object Uint16Array]",m="[object Uint32Array]",N=/[\\^$.*+?()[\]{}|]/g,X=/^\[object .+?Constructor\]$/,ae=/^(?:0|[1-9]\d*)$/,P={};P[f]=P[d]=P[v]=P[E]=P[C]=P[O]=P[M]=P[g]=P[m]=!0,P[u]=P[h]=P[L]=P[b]=P[y]=P[w]=P[I]=P[S]=P[T]=P[q]=P[F]=P[k]=P[H]=P[_]=P[ie]=!1;var te=typeof Vr=="object"&&Vr&&Vr.Object===Object&&Vr,z=typeof self=="object"&&self&&self.Object===Object&&self,G=te||z||Function("return this")(),J=e&&!e.nodeType&&e,A=J&&!0&&t&&!t.nodeType&&t,V=A&&A.exports===J,oe=V&&te.process,ue=function(){try{return oe&&oe.binding&&oe.binding("util")}catch{}}(),he=ue&&ue.isTypedArray;function ye(Y,re){for(var pe=-1,ke=Y==null?0:Y.length,er=0,bt=[];++pe<ke;){var ar=Y[pe];re(ar,pe,Y)&&(bt[er++]=ar)}return bt}function we(Y,re){for(var pe=-1,ke=re.length,er=Y.length;++pe<ke;)Y[er+pe]=re[pe];return Y}function Re(Y,re){for(var pe=-1,ke=Y==null?0:Y.length;++pe<ke;)if(re(Y[pe],pe,Y))return!0;return!1}function Xe(Y,re){for(var pe=-1,ke=Array(Y);++pe<Y;)ke[pe]=re(pe);return ke}function Oe(Y){return function(re){return Y(re)}}function Ne(Y,re){return Y.has(re)}function Me(Y,re){return Y?.[re]}function be(Y){var re=-1,pe=Array(Y.size);return Y.forEach(function(ke,er){pe[++re]=[er,ke]}),pe}function Pe(Y,re){return function(pe){return Y(re(pe))}}function Te(Y){var re=-1,pe=Array(Y.size);return Y.forEach(function(ke){pe[++re]=ke}),pe}var ve=Array.prototype,$e=Function.prototype,Se=Object.prototype,me=G["__core-js_shared__"],Ue=$e.toString,Ce=Se.hasOwnProperty,_e=function(){var Y=/[^.]+$/.exec(me&&me.keys&&me.keys.IE_PROTO||"");return Y?"Symbol(src)_1."+Y:""}(),Ke=Se.toString,Ve=RegExp("^"+Ue.call(Ce).replace(N,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ae=V?G.Buffer:void 0,We=G.Symbol,pt=G.Uint8Array,Ge=Se.propertyIsEnumerable,It=ve.splice,gt=We?We.toStringTag:void 0,Ye=Object.getOwnPropertySymbols,Ot=Ae?Ae.isBuffer:void 0,Tt=Pe(Object.keys,Object),Le=ji(G,"DataView"),et=ji(G,"Map"),it=ji(G,"Promise"),Be=ji(G,"Set"),rt=ji(G,"WeakMap"),tt=ji(Object,"create"),qe=qs(Le),ht=qs(et),nt=qs(it),je=qs(Be),st=qs(rt),at=We?We.prototype:void 0,Fe=at?at.valueOf:void 0;function Ze(Y){var re=-1,pe=Y==null?0:Y.length;for(this.clear();++re<pe;){var ke=Y[re];this.set(ke[0],ke[1])}}function lt(){this.__data__=tt?tt(null):{},this.size=0}function ze(Y){var re=this.has(Y)&&delete this.__data__[Y];return this.size-=re?1:0,re}function qt(Y){var re=this.__data__;if(tt){var pe=re[Y];return pe===i?void 0:pe}return Ce.call(re,Y)?re[Y]:void 0}function jt(Y){var re=this.__data__;return tt?re[Y]!==void 0:Ce.call(re,Y)}function ct(Y,re){var pe=this.__data__;return this.size+=this.has(Y)?0:1,pe[Y]=tt&&re===void 0?i:re,this}Ze.prototype.clear=lt,Ze.prototype.delete=ze,Ze.prototype.get=qt,Ze.prototype.has=jt,Ze.prototype.set=ct;function _t(Y){var re=-1,pe=Y==null?0:Y.length;for(this.clear();++re<pe;){var ke=Y[re];this.set(ke[0],ke[1])}}function Zr(){this.__data__=[],this.size=0}function Xr(Y){var re=this.__data__,pe=ma(re,Y);if(pe<0)return!1;var ke=re.length-1;return pe==ke?re.pop():It.call(re,pe,1),--this.size,!0}function ei(Y){var re=this.__data__,pe=ma(re,Y);return pe<0?void 0:re[pe][1]}function ti(Y){return ma(this.__data__,Y)>-1}function ri(Y,re){var pe=this.__data__,ke=ma(pe,Y);return ke<0?(++this.size,pe.push([Y,re])):pe[ke][1]=re,this}_t.prototype.clear=Zr,_t.prototype.delete=Xr,_t.prototype.get=ei,_t.prototype.has=ti,_t.prototype.set=ri;function vr(Y){var re=-1,pe=Y==null?0:Y.length;for(this.clear();++re<pe;){var ke=Y[re];this.set(ke[0],ke[1])}}function Ii(){this.size=0,this.__data__={hash:new Ze,map:new(et||_t),string:new Ze}}function On(Y){var re=Ao(this,Y).delete(Y);return this.size-=re?1:0,re}function Mi(Y){return Ao(this,Y).get(Y)}function Pn(Y){return Ao(this,Y).has(Y)}function $n(Y,re){var pe=Ao(this,Y),ke=pe.size;return pe.set(Y,re),this.size+=pe.size==ke?0:1,this}vr.prototype.clear=Ii,vr.prototype.delete=On,vr.prototype.get=Mi,vr.prototype.has=Pn,vr.prototype.set=$n;function Ci(Y){var re=-1,pe=Y==null?0:Y.length;for(this.__data__=new vr;++re<pe;)this.add(Y[re])}function an(Y){return this.__data__.set(Y,i),this}function cn(Y){return this.__data__.has(Y)}Ci.prototype.add=Ci.prototype.push=an,Ci.prototype.has=cn;function Cr(Y){var re=this.__data__=new _t(Y);this.size=re.size}function Rn(){this.__data__=new _t,this.size=0}function Nn(Y){var re=this.__data__,pe=re.delete(Y);return this.size=re.size,pe}function Tn(Y){return this.__data__.get(Y)}function va(Y){return this.__data__.has(Y)}function gl(Y,re){var pe=this.__data__;if(pe instanceof _t){var ke=pe.__data__;if(!et||ke.length<r-1)return ke.push([Y,re]),this.size=++pe.size,this;pe=this.__data__=new vr(ke)}return pe.set(Y,re),this.size=pe.size,this}Cr.prototype.clear=Rn,Cr.prototype.delete=Nn,Cr.prototype.get=Tn,Cr.prototype.has=va,Cr.prototype.set=gl;function vl(Y,re){var pe=Nc(Y),ke=!pe&&Cl(Y),er=!pe&&!ke&&cf(Y),bt=!pe&&!ke&&!er&&Pl(Y),ar=pe||ke||er||bt,xr=ar?Xe(Y.length,String):[],Ft=xr.length;for(var tr in Y)(re||Ce.call(Y,tr))&&!(ar&&(tr=="length"||er&&(tr=="offset"||tr=="parent")||bt&&(tr=="buffer"||tr=="byteLength"||tr=="byteOffset")||Al(tr,Ft)))&&xr.push(tr);return xr}function ma(Y,re){for(var pe=Y.length;pe--;)if(Ml(Y[pe][0],re))return pe;return-1}function of(Y,re,pe){var ke=re(Y);return Nc(Y)?ke:we(ke,pe(Y))}function ba(Y){return Y==null?Y===void 0?ee:K:gt&&gt in Object(Y)?_l(Y):Op(Y)}function af(Y){return wa(Y)&&ba(Y)==u}function ya(Y,re,pe,ke,er){return Y===re?!0:Y==null||re==null||!wa(Y)&&!wa(re)?Y!==Y&&re!==re:ml(Y,re,pe,ke,ya,er)}function ml(Y,re,pe,ke,er,bt){var ar=Nc(Y),xr=Nc(re),Ft=ar?h:ws(Y),tr=xr?h:ws(re);Ft=Ft==u?F:Ft,tr=tr==u?F:tr;var _r=Ft==F,Di=tr==F,Sr=Ft==tr;if(Sr&&cf(Y)){if(!cf(re))return!1;ar=!0,_r=!1}if(Sr&&!_r)return bt||(bt=new Cr),ar||Pl(Y)?$c(Y,re,pe,ke,er,bt):Dp(Y,re,Ft,pe,ke,er,bt);if(!(pe&n)){var cr=_r&&Ce.call(Y,"__wrapped__"),di=Di&&Ce.call(re,"__wrapped__");if(cr||di){var Ln=cr?Y.value():Y,un=di?re.value():re;return bt||(bt=new Cr),er(Ln,un,pe,ke,bt)}}return Sr?(bt||(bt=new Cr),wl(Y,re,pe,ke,er,bt)):!1}function Cp(Y){if(!Ol(Y)||Sl(Y))return!1;var re=Tc(Y)?Ve:X;return re.test(qs(Y))}function bl(Y){return wa(Y)&&Dl(Y.length)&&!!P[ba(Y)]}function yl(Y){if(!Il(Y))return Tt(Y);var re=[];for(var pe in Object(Y))Ce.call(Y,pe)&&pe!="constructor"&&re.push(pe);return re}function $c(Y,re,pe,ke,er,bt){var ar=pe&n,xr=Y.length,Ft=re.length;if(xr!=Ft&&!(ar&&Ft>xr))return!1;var tr=bt.get(Y);if(tr&&bt.get(re))return tr==re;var _r=-1,Di=!0,Sr=pe&s?new Ci:void 0;for(bt.set(Y,re),bt.set(re,Y);++_r<xr;){var cr=Y[_r],di=re[_r];if(ke)var Ln=ar?ke(di,cr,_r,re,Y,bt):ke(cr,di,_r,Y,re,bt);if(Ln!==void 0){if(Ln)continue;Di=!1;break}if(Sr){if(!Re(re,function(un,_s){if(!Ne(Sr,_s)&&(cr===un||er(cr,un,pe,ke,bt)))return Sr.push(_s)})){Di=!1;break}}else if(!(cr===di||er(cr,di,pe,ke,bt))){Di=!1;break}}return bt.delete(Y),bt.delete(re),Di}function Dp(Y,re,pe,ke,er,bt,ar){switch(pe){case y:if(Y.byteLength!=re.byteLength||Y.byteOffset!=re.byteOffset)return!1;Y=Y.buffer,re=re.buffer;case L:return!(Y.byteLength!=re.byteLength||!bt(new pt(Y),new pt(re)));case b:case w:case q:return Ml(+Y,+re);case I:return Y.name==re.name&&Y.message==re.message;case k:case _:return Y==re+"";case T:var xr=be;case H:var Ft=ke&n;if(xr||(xr=Te),Y.size!=re.size&&!Ft)return!1;var tr=ar.get(Y);if(tr)return tr==re;ke|=s,ar.set(Y,re);var _r=$c(xr(Y),xr(re),ke,er,bt,ar);return ar.delete(Y),_r;case B:if(Fe)return Fe.call(Y)==Fe.call(re)}return!1}function wl(Y,re,pe,ke,er,bt){var ar=pe&n,xr=Rc(Y),Ft=xr.length,tr=Rc(re),_r=tr.length;if(Ft!=_r&&!ar)return!1;for(var Di=Ft;Di--;){var Sr=xr[Di];if(!(ar?Sr in re:Ce.call(re,Sr)))return!1}var cr=bt.get(Y);if(cr&&bt.get(re))return cr==re;var di=!0;bt.set(Y,re),bt.set(re,Y);for(var Ln=ar;++Di<Ft;){Sr=xr[Di];var un=Y[Sr],_s=re[Sr];if(ke)var uf=ar?ke(_s,un,Sr,re,Y,bt):ke(un,_s,Sr,Y,re,bt);if(!(uf===void 0?un===_s||er(un,_s,pe,ke,bt):uf)){di=!1;break}Ln||(Ln=Sr=="constructor")}if(di&&!Ln){var _a=Y.constructor,Fr=re.constructor;_a!=Fr&&"constructor"in Y&&"constructor"in re&&!(typeof _a=="function"&&_a instanceof _a&&typeof Fr=="function"&&Fr instanceof Fr)&&(di=!1)}return bt.delete(Y),bt.delete(re),di}function Rc(Y){return of(Y,Rp,El)}function Ao(Y,re){var pe=Y.__data__;return xl(re)?pe[typeof re=="string"?"string":"hash"]:pe.map}function ji(Y,re){var pe=Me(Y,re);return Cp(pe)?pe:void 0}function _l(Y){var re=Ce.call(Y,gt),pe=Y[gt];try{Y[gt]=void 0;var ke=!0}catch{}var er=Ke.call(Y);return ke&&(re?Y[gt]=pe:delete Y[gt]),er}var El=Ye?function(Y){return Y==null?[]:(Y=Object(Y),ye(Ye(Y),function(re){return Ge.call(Y,re)}))}:Xt,ws=ba;(Le&&ws(new Le(new ArrayBuffer(1)))!=y||et&&ws(new et)!=T||it&&ws(it.resolve())!=W||Be&&ws(new Be)!=H||rt&&ws(new rt)!=ie)&&(ws=function(Y){var re=ba(Y),pe=re==F?Y.constructor:void 0,ke=pe?qs(pe):"";if(ke)switch(ke){case qe:return y;case ht:return T;case nt:return W;case je:return H;case st:return ie}return re});function Al(Y,re){return re=re??a,!!re&&(typeof Y=="number"||ae.test(Y))&&Y>-1&&Y%1==0&&Y<re}function xl(Y){var re=typeof Y;return re=="string"||re=="number"||re=="symbol"||re=="boolean"?Y!=="__proto__":Y===null}function Sl(Y){return!!_e&&_e in Y}function Il(Y){var re=Y&&Y.constructor,pe=typeof re=="function"&&re.prototype||Se;return Y===pe}function Op(Y){return Ke.call(Y)}function qs(Y){if(Y!=null){try{return Ue.call(Y)}catch{}try{return Y+""}catch{}}return""}function Ml(Y,re){return Y===re||Y!==Y&&re!==re}var Cl=af(function(){return arguments}())?af:function(Y){return wa(Y)&&Ce.call(Y,"callee")&&!Ge.call(Y,"callee")},Nc=Array.isArray;function Pp(Y){return Y!=null&&Dl(Y.length)&&!Tc(Y)}var cf=Ot||Qt;function $p(Y,re){return ya(Y,re)}function Tc(Y){if(!Ol(Y))return!1;var re=ba(Y);return re==S||re==D||re==l||re==R}function Dl(Y){return typeof Y=="number"&&Y>-1&&Y%1==0&&Y<=a}function Ol(Y){var re=typeof Y;return Y!=null&&(re=="object"||re=="function")}function wa(Y){return Y!=null&&typeof Y=="object"}var Pl=he?Oe(he):bl;function Rp(Y){return Pp(Y)?vl(Y):yl(Y)}function Xt(){return[]}function Qt(){return!1}t.exports=$p})(Xd,Xd.exports);var bD=Xd.exports,yD=Object.defineProperty,s3=Object.getOwnPropertySymbols,wD=Object.prototype.hasOwnProperty,_D=Object.prototype.propertyIsEnumerable,o3=(t,e,r)=>e in t?yD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,fi=(t,e)=>{for(var r in e||(e={}))wD.call(e,r)&&o3(t,r,e[r]);if(s3)for(var r of s3(e))_D.call(e,r)&&o3(t,r,e[r]);return t};function ED(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i<r.length;i++)r[i]=255;for(var n=0;n<t.length;n++){var s=t.charAt(n),a=s.charCodeAt(0);if(r[a]!==255)throw new TypeError(s+" is ambiguous");r[a]=n}var u=t.length,h=t.charAt(0),l=Math.log(u)/Math.log(256),b=Math.log(256)/Math.log(u);function w(D){if(D instanceof Uint8Array||(ArrayBuffer.isView(D)?D=new Uint8Array(D.buffer,D.byteOffset,D.byteLength):Array.isArray(D)&&(D=Uint8Array.from(D))),!(D instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(D.length===0)return"";for(var T=0,q=0,K=0,F=D.length;K!==F&&D[K]===0;)K++,T++;for(var W=(F-K)*b+1>>>0,R=new Uint8Array(W);K!==F;){for(var k=D[K],H=0,_=W-1;(k!==0||H<q)&&_!==-1;_--,H++)k+=256*R[_]>>>0,R[_]=k%u>>>0,k=k/u>>>0;if(k!==0)throw new Error("Non-zero carry");q=H,K++}for(var B=W-q;B!==W&&R[B]===0;)B++;for(var ee=h.repeat(T);B<W;++B)ee+=t.charAt(R[B]);return ee}function I(D){if(typeof D!="string")throw new TypeError("Expected String");if(D.length===0)return new Uint8Array;var T=0;if(D[T]!==" "){for(var q=0,K=0;D[T]===h;)q++,T++;for(var F=(D.length-T)*l+1>>>0,W=new Uint8Array(F);D[T];){var R=r[D.charCodeAt(T)];if(R===255)return;for(var k=0,H=F-1;(R!==0||k<K)&&H!==-1;H--,k++)R+=u*W[H]>>>0,W[H]=R%256>>>0,R=R/256>>>0;if(R!==0)throw new Error("Non-zero carry");K=k,T++}if(D[T]!==" "){for(var _=F-K;_!==F&&W[_]===0;)_++;for(var B=new Uint8Array(q+(F-_)),ee=q;_!==F;)B[ee++]=W[_++];return B}}}function S(D){var T=I(D);if(T)return T;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:I,decode:S}}var AD=ED,xD=AD;const a3=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},SD=t=>new TextEncoder().encode(t),ID=t=>new TextDecoder().decode(t);class MD{constructor(e,r,i){this.name=e,this.prefix=r,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class CD{constructor(e,r,i){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=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 c3(this,e)}}class DD{constructor(e){this.decoders=e}or(e){return c3(this,e)}decode(e){const r=e[0],i=this.decoders[r];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 c3=(t,e)=>new DD(fi(fi({},t.decoders||{[t.prefix]:t}),e.decoders||{[e.prefix]:e}));class OD{constructor(e,r,i,n){this.name=e,this.prefix=r,this.baseEncode=i,this.baseDecode=n,this.encoder=new MD(e,r,i),this.decoder=new CD(e,r,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Rh=({name:t,prefix:e,encode:r,decode:i})=>new OD(t,e,r,i),Ru=({prefix:t,name:e,alphabet:r})=>{const{encode:i,decode:n}=xD(r,e);return Rh({prefix:t,name:e,encode:i,decode:s=>a3(n(s))})},PD=(t,e,r,i)=>{const n={};for(let b=0;b<e.length;++b)n[e[b]]=b;let s=t.length;for(;t[s-1]==="=";)--s;const a=new Uint8Array(s*r/8|0);let u=0,h=0,l=0;for(let b=0;b<s;++b){const w=n[t[b]];if(w===void 0)throw new SyntaxError(`Non-${i} character`);h=h<<r|w,u+=r,u>=8&&(u-=8,a[l++]=255&h>>u)}if(u>=r||255&h<<8-u)throw new SyntaxError("Unexpected end of data");return a},$D=(t,e,r)=>{const i=e[e.length-1]==="=",n=(1<<r)-1;let s="",a=0,u=0;for(let h=0;h<t.length;++h)for(u=u<<8|t[h],a+=8;a>r;)a-=r,s+=e[n&u>>a];if(a&&(s+=e[n&u<<r-a]),i)for(;s.length*r&7;)s+="=";return s},Kr=({name:t,prefix:e,bitsPerChar:r,alphabet:i})=>Rh({prefix:e,name:t,encode(n){return $D(n,i,r)},decode(n){return PD(n,i,r,t)}}),RD=Rh({prefix:"\0",name:"identity",encode:t=>ID(t),decode:t=>SD(t)});var ND=Object.freeze({__proto__:null,identity:RD});const TD=Kr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var LD=Object.freeze({__proto__:null,base2:TD});const BD=Kr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var FD=Object.freeze({__proto__:null,base8:BD});const UD=Ru({prefix:"9",name:"base10",alphabet:"0123456789"});var kD=Object.freeze({__proto__:null,base10:UD});const qD=Kr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),jD=Kr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var zD=Object.freeze({__proto__:null,base16:qD,base16upper:jD});const HD=Kr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),KD=Kr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),WD=Kr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),VD=Kr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),GD=Kr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),JD=Kr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),YD=Kr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),QD=Kr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ZD=Kr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var XD=Object.freeze({__proto__:null,base32:HD,base32upper:KD,base32pad:WD,base32padupper:VD,base32hex:GD,base32hexupper:JD,base32hexpad:YD,base32hexpadupper:QD,base32z:ZD});const eO=Ru({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),tO=Ru({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var rO=Object.freeze({__proto__:null,base36:eO,base36upper:tO});const iO=Ru({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),nO=Ru({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var sO=Object.freeze({__proto__:null,base58btc:iO,base58flickr:nO});const oO=Kr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),aO=Kr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),cO=Kr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),uO=Kr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var fO=Object.freeze({__proto__:null,base64:oO,base64pad:aO,base64url:cO,base64urlpad:uO});const u3=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}"),hO=u3.reduce((t,e,r)=>(t[r]=e,t),[]),lO=u3.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function dO(t){return t.reduce((e,r)=>(e+=hO[r],e),"")}function pO(t){const e=[];for(const r of t){const i=lO[r.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(i)}return new Uint8Array(e)}const gO=Rh({prefix:"\u{1F680}",name:"base256emoji",encode:dO,decode:pO});var vO=Object.freeze({__proto__:null,base256emoji:gO}),mO=h3,f3=128,bO=127,yO=~bO,wO=Math.pow(2,31);function h3(t,e,r){e=e||[],r=r||0;for(var i=r;t>=wO;)e[r++]=t&255|f3,t/=128;for(;t&yO;)e[r++]=t&255|f3,t>>>=7;return e[r]=t|0,h3.bytes=r-i+1,e}var _O=e1,EO=128,l3=127;function e1(t,i){var r=0,i=i||0,n=0,s=i,a,u=t.length;do{if(s>=u)throw e1.bytes=0,new RangeError("Could not decode varint");a=t[s++],r+=n<28?(a&l3)<<n:(a&l3)*Math.pow(2,n),n+=7}while(a>=EO);return e1.bytes=s-i,r}var AO=Math.pow(2,7),xO=Math.pow(2,14),SO=Math.pow(2,21),IO=Math.pow(2,28),MO=Math.pow(2,35),CO=Math.pow(2,42),DO=Math.pow(2,49),OO=Math.pow(2,56),PO=Math.pow(2,63),$O=function(t){return t<AO?1:t<xO?2:t<SO?3:t<IO?4:t<MO?5:t<CO?6:t<DO?7:t<OO?8:t<PO?9:10},RO={encode:mO,decode:_O,encodingLength:$O},d3=RO;const p3=(t,e,r=0)=>(d3.encode(t,e,r),e),g3=t=>d3.encodingLength(t),t1=(t,e)=>{const r=e.byteLength,i=g3(t),n=i+g3(r),s=new Uint8Array(n+r);return p3(t,s,0),p3(r,s,i),s.set(e,n),new NO(t,r,e,s)};class NO{constructor(e,r,i,n){this.code=e,this.size=r,this.digest=i,this.bytes=n}}const v3=({name:t,code:e,encode:r})=>new TO(t,e,r);class TO{constructor(e,r,i){this.name=e,this.code=r,this.encode=i}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?t1(this.code,r):r.then(i=>t1(this.code,i))}else throw Error("Unknown type, must be binary type")}}const m3=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),LO=v3({name:"sha2-256",code:18,encode:m3("SHA-256")}),BO=v3({name:"sha2-512",code:19,encode:m3("SHA-512")});var FO=Object.freeze({__proto__:null,sha256:LO,sha512:BO});const b3=0,UO="identity",y3=a3;var kO=Object.freeze({__proto__:null,identity:{code:b3,name:UO,encode:y3,digest:t=>t1(b3,y3(t))}});new TextEncoder,new TextDecoder;const w3=fi(fi(fi(fi(fi(fi(fi(fi(fi(fi({},ND),LD),FD),kD),zD),XD),rO),sO),fO),vO);fi(fi({},FO),kO);function qO(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function _3(t,e,r,i){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:i}}}const E3=_3("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),r1=_3("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=qO(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),jO=fi({utf8:E3,"utf-8":E3,hex:w3.base16,latin1:r1,ascii:r1,binary:r1},w3);function zO(t,e="utf8"){const r=jO[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):r.decoder.decode(`${r.prefix}${t}`)}const A3="wc",x3=2,i1="core",hs=`${A3}@2:${i1}:`,HO={name:i1,logger:"error"},KO={database:":memory:"},WO="crypto",S3="client_ed25519_seed",VO=xe.ONE_DAY,GO="keychain",JO="0.3",YO="messages",QO="0.3",ZO=xe.SIX_HOURS,XO="publisher",I3="irn",eP="error",M3="wss://relay.walletconnect.org",tP="relayer",hi={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"},rP="_subscription",nn={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},iP=.1,n1="2.16.2-rc-0",Zt={link_mode:"link_mode",relay:"relay"},nP="0.3",sP="WALLETCONNECT_CLIENT_ID",C3="WALLETCONNECT_LINK_MODE_APPS",ls={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},oP="subscription",aP="0.3",cP=xe.FIVE_SECONDS*1e3,uP="pairing",fP="0.3",Nu={wc_pairingDelete:{req:{ttl:xe.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:xe.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:xe.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:xe.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:xe.ONE_DAY,prompt:!1,tag:0},res:{ttl:xe.ONE_DAY,prompt:!1,tag:0}}},fc={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"},hP="history",lP="0.3",dP="expirer",sn={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},pP="0.3",gP="verify-api",vP="https://verify.walletconnect.com",D3="https://verify.walletconnect.org",Tu=D3,mP=`${Tu}/v3`,bP=[vP,D3],yP="echo",wP="https://echo.walletconnect.com",ds={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"},Bs={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"},Xo={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"},Lu={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"},_P=.1,EP="event-client",AP=86400,xP="https://pulse.walletconnect.com/batch";class SP{constructor(e,r){this.core=e,this.logger=r,this.keychain=new Map,this.name=GO,this.version=JO,this.initialized=!1,this.storagePrefix=hs,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}=Ee("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=ui(r,this.name)}get context(){return Ai(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,K2(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?W2(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=Ee("NOT_INITIALIZED",this.name);throw new Error(e)}}}class IP{constructor(e,r,i){this.core=e,this.logger=r,this.name=WO,this.randomSessionIdentifier=Nd(),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=F2(n);return B2(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const n=oI();return this.setPrivateKey(n.publicKey,n.privateKey)},this.signJWT=async n=>{this.isInitialized();const s=await this.getClientSeed(),a=F2(s),u=this.randomSessionIdentifier;return await jE(u,n,VO,a)},this.generateSharedKey=(n,s,a)=>{this.isInitialized();const u=this.getPrivateKey(n),h=aI(u,s);return this.setSymKey(h,a)},this.setSymKey=async(n,s)=>{this.isInitialized();const a=s||bh(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 u=pb(a),h=Cs(s);if(vb(u))return uI(h,a?.encoding);if(gb(u)){const I=u.senderPublicKey,S=u.receiverPublicKey;n=await this.generateSharedKey(I,S)}const l=this.getSymKey(n),{type:b,senderPublicKey:w}=u;return cI({type:b,symKey:l,message:h,senderPublicKey:w,encoding:a?.encoding})},this.decode=async(n,s,a)=>{this.isInitialized();const u=lI(s,a);if(vb(u)){const h=hI(s,a?.encoding);return jo(h)}if(gb(u)){const h=u.receiverPublicKey,l=u.senderPublicKey;n=await this.generateSharedKey(h,l)}try{const h=this.getSymKey(n),l=fI({symKey:h,encoded:s,encoding:a?.encoding});return jo(l)}catch(h){this.logger.error(`Failed to decode message from topic: '${n}', clientId: '${await this.getClientId()}'`),this.logger.error(h)}},this.getPayloadType=(n,s=ao)=>{const a=Eu({encoded:n,encoding:s});return Go(a.type)},this.getPayloadSenderPublicKey=(n,s=ao)=>{const a=Eu({encoded:n,encoding:s});return a.senderPublicKey?DC(a.senderPublicKey,ai):void 0},this.core=e,this.logger=ui(r,this.name),this.keychain=i||new SP(this.core,this.logger)}get context(){return Ai(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(S3)}catch{e=Nd(),await this.keychain.set(S3,e)}return zO(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=Ee("NOT_INITIALIZED",this.name);throw new Error(e)}}}class MP extends vC{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=YO,this.version=QO,this.initialized=!1,this.storagePrefix=hs,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=Ns(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=Ns(n);return typeof s[a]<"u"},this.del=async i=>{this.isInitialized(),this.messages.delete(i),await this.persist()},this.logger=ui(e,this.name),this.core=r}get context(){return Ai(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,K2(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?W2(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=Ee("NOT_INITIALIZED",this.name);throw new Error(e)}}}class CP extends mC{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new kr.exports.EventEmitter,this.name=XO,this.queue=new Map,this.publishTimeout=xe.toMiliseconds(xe.ONE_MINUTE),this.failedPublishTimeout=xe.toMiliseconds(xe.ONE_SECOND),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 u=s?.ttl||ZO,h=Td(s),l=s?.prompt||!1,b=s?.tag||0,w=s?.id||Qo().toString(),I={topic:i,message:n,opts:{ttl:u,relay:h,prompt:l,tag:b,id:w,attestation:s?.attestation}},S=`Failed to publish payload, please try again. id:${w} tag:${b}`,D=Date.now();let T,q=1;try{for(;T===void 0;){if(Date.now()-D>this.publishTimeout)throw new Error(S);this.logger.trace({id:w,attempts:q},`publisher.publish - attempt ${q}`),T=await await Ga(this.rpcPublish(i,n,u,h,l,b,w,s?.attestation).catch(K=>this.logger.warn(K)),this.publishTimeout,S),q++,T||await new Promise(K=>setTimeout(K,this.failedPublishTimeout))}this.relayer.events.emit(hi.publish,I),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:w,topic:i,message:n,opts:s}})}catch(K){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(K),(a=s?.internal)!=null&&a.throwOnFailedPublish)throw K;this.queue.set(w,I)}},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=ui(r,this.name),this.registerEventListeners()}get context(){return Ai(this.logger)}rpcPublish(e,r,i,n,s,a,u,h){var l,b,w,I;const S={method:Au(n.protocol).publish,params:{topic:e,message:r,ttl:i,prompt:s,tag:a,attestation:h},id:u};return ci((l=S.params)==null?void 0:l.prompt)&&((b=S.params)==null||delete b.prompt),ci((w=S.params)==null?void 0:w.tag)&&((I=S.params)==null||delete I.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:S}),this.relayer.request(S)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:i,opts:n}=e;await this.publish(r,i,n)})}registerEventListeners(){this.relayer.core.heartbeat.on(ac.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(hi.connection_stalled);return}this.checkQueue()}),this.relayer.on(hi.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class DP{constructor(){this.map=new Map,this.set=(e,r)=>{const i=this.get(e);this.exists(e,r)||this.map.set(e,[...i,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const i=this.get(e);if(!this.exists(e,r))return;const n=i.filter(s=>s!==r);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 OP=Object.defineProperty,PP=Object.defineProperties,$P=Object.getOwnPropertyDescriptors,O3=Object.getOwnPropertySymbols,RP=Object.prototype.hasOwnProperty,NP=Object.prototype.propertyIsEnumerable,P3=(t,e,r)=>e in t?OP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Bu=(t,e)=>{for(var r in e||(e={}))RP.call(e,r)&&P3(t,r,e[r]);if(O3)for(var r of O3(e))NP.call(e,r)&&P3(t,r,e[r]);return t},s1=(t,e)=>PP(t,$P(e));class TP extends wC{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new DP,this.events=new kr.exports.EventEmitter,this.name=oP,this.version=aP,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=hs,this.subscribeTimeout=xe.toMiliseconds(xe.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],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=Td(n),a={topic:i,relay:s,transportType:n?.transportType};this.pending.set(i,a);const u=await this.rpcSubscribe(i,s,n?.transportType);return typeof u=="string"&&(this.onSubscribe(u,a),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}})),u}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 u=new xe.Watch;u.start(n);const h=setInterval(()=>{!this.pending.has(i)&&this.topics.includes(i)&&(clearInterval(h),u.stop(n),s(!0)),u.elapsed(n)>=cP&&(clearInterval(h),u.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()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=ui(r,this.name),this.clientId=""}get context(){return Ai(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let i=!1;try{i=this.getSubscription(e).topic===r}catch{}return i}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const i=this.topicMap.get(e);await Promise.all(i.map(async n=>await this.unsubscribeById(e,n,r)))}async unsubscribeById(e,r,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:i}});try{const n=Td(i);await this.rpcUnsubscribe(e,r,n);const s=Gt("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:i}})}catch(n){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(n),n}}async rpcSubscribe(e,r,i=Zt.relay){i===Zt.relay&&await this.restartToComplete();const n={method:Au(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{const s=Ns(e+this.clientId);return i===Zt.link_mode?(setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(n).catch(a=>this.logger.warn(a))},xe.toMiliseconds(xe.ONE_SECOND)),s):await await Ga(this.relayer.request(n).catch(a=>this.logger.warn(a)),this.subscribeTimeout)?s:null}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(hi.connection_stalled)}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,i={method:Au(r.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{return await await Ga(this.relayer.request(i).catch(n=>this.logger.warn(n)),this.subscribeTimeout)}catch{this.relayer.events.emit(hi.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,i={method:Au(r.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 Ga(this.relayer.request(i).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(hi.connection_stalled)}return n}rpcUnsubscribe(e,r,i){const n={method:Au(i.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),this.relayer.request(n)}onSubscribe(e,r){this.setSubscription(e,s1(Bu({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Bu({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,i){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,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,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,Bu({},r)),this.topicMap.set(r.topic,e),this.events.emit(ls.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:i}=Ee("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const i=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(i.topic,e),this.events.emit(ls.deleted,s1(Bu({},i),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(ls.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r<e;r++){const i=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchFetchMessages(i),await this.batchSubscribe(i)}}this.events.emit(ls.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=Ee("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);as(r)&&this.onBatchSubscribe(r.map((i,n)=>s1(Bu({},e[n]),{id:i})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(ac.pulse,async()=>{await this.checkPending()}),this.events.on(ls.created,async e=>{const r=ls.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(ls.deleted,async e=>{const r=ls.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=Ee("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var LP=Object.defineProperty,$3=Object.getOwnPropertySymbols,BP=Object.prototype.hasOwnProperty,FP=Object.prototype.propertyIsEnumerable,R3=(t,e,r)=>e in t?LP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,UP=(t,e)=>{for(var r in e||(e={}))BP.call(e,r)&&R3(t,r,e[r]);if($3)for(var r of $3(e))FP.call(e,r)&&R3(t,r,e[r]);return t};class kP extends bC{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new kr.exports.EventEmitter,this.name=tP,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=xe.toMiliseconds(xe.THIRTY_SECONDS+xe.ONE_SECOND),this.request=async r=>{var i,n;this.logger.debug("Publishing Request Payload");const s=r.id||Qo().toString();await this.toEstablishConnection();try{const a=this.provider.request(r);this.requestsInFlight.set(s,{promise:a,request:r}),this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - attempt to publish...");const u=await new Promise(async(h,l)=>{const b=()=>{l(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(nn.disconnect,b);const w=await a;this.provider.off(nn.disconnect,b),h(w)});return this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - published"),u}catch(a){throw this.logger.debug(`Failed to Publish Request: ${s}`),a}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(th())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,i,n;(n=(i=(r=this.provider)==null?void 0:r.connection)==null?void 0:i.socket)==null||n.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(hi.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(hi.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(nn.payload,this.onPayloadHandler),this.provider.on(nn.connect,this.onConnectHandler),this.provider.on(nn.disconnect,this.onDisconnectHandler),this.provider.on(nn.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?ui(e.logger,this.name):cs(Dh({level:e.logger||eP})),this.messages=new MP(this.logger,e.core),this.subscriber=new TP(this,this.logger),this.publisher=new CP(this,this.logger),this.relayUrl=e?.relayUrl||M3,this.projectId=e.projectId,this.bundleId=YE(),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)}}get context(){return Ai(this.logger)}get connected(){var e,r,i;return((i=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:i.readyState)===1}get connecting(){var e,r,i;return((i=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:i.readyState)===0}async publish(e,r,i){this.isInitialized(),await this.publisher.publish(e,r,i),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:Zt.relay})}async subscribe(e,r){var i;this.isInitialized(),r?.transportType==="relay"&&await this.toEstablishConnection();let n=((i=this.subscriber.topicMap.get(e))==null?void 0:i[0])||"",s;const a=u=>{u.topic===e&&(this.subscriber.off(ls.created,a),s())};return await Promise.all([new Promise(u=>{s=u,this.subscriber.on(ls.created,a)}),new Promise(async u=>{n=await this.subscriber.subscribe(e,r)||n,u()})]),n}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.hasExperiencedNetworkDisruption||this.connected?await Ga(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,i)=>{const n=()=>{this.provider.off(nn.disconnect,n),i(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(nn.disconnect,n),await Ga(this.provider.connect(),xe.toMiliseconds(xe.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{i(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const i=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(i.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Cb())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 r=e.sort((i,n)=>i.publishedAt-n.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const i of r)try{await this.onMessageEvent(i)}catch(n){this.logger.warn(n)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:i}=e;if(!r.sessionExists){const n=Ir(xe.FIVE_MINUTES),s={topic:i,expiry:n,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(i,s)}this.events.emit(hi.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,i,n,s;if(th())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(n=(i=this.provider)==null?void 0:i.connection)==null?void 0:n.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(a){this.logger.warn(a)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new xn(new mD(tA({sdkVersion:n1,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:i}=e;await this.messages.set(r,i)}async shouldIgnoreMessageEvent(e){const{topic:r,message:i}=e;if(!i||i.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${i}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const n=this.messages.has(r,i);return n&&this.logger.debug(`Ignoring duplicate message: ${i}`),n}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),Zd(e)){if(!e.method.endsWith(rP))return;const r=e.params,{topic:i,message:n,publishedAt:s,attestation:a}=r.data,u={topic:i,message:n,publishedAt:s,transportType:Zt.relay,attestation:a};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(UP({type:"event",event:r.id},u)),this.events.emit(r.id,u),await this.acknowledgePayload(e),await this.onMessageEvent(u)}else $h(e)&&this.events.emit(hi.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(hi.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=Oh(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(nn.payload,this.onPayloadHandler),this.provider.off(nn.connect,this.onConnectHandler),this.provider.off(nn.disconnect,this.onDisconnectHandler),this.provider.off(nn.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await Cb();oM(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(i=>this.logger.error(i)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(hi.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},xe.toMiliseconds(iP))))}isInitialized(){if(!this.initialized){const{message:e}=Ee("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var qP=Object.defineProperty,N3=Object.getOwnPropertySymbols,jP=Object.prototype.hasOwnProperty,zP=Object.prototype.propertyIsEnumerable,T3=(t,e,r)=>e in t?qP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,L3=(t,e)=>{for(var r in e||(e={}))jP.call(e,r)&&T3(t,r,e[r]);if(N3)for(var r of N3(e))zP.call(e,r)&&T3(t,r,e[r]);return t};class ea extends yC{constructor(e,r,i,n=hs,s=void 0){super(e,r,i,n),this.core=e,this.logger=r,this.name=i,this.map=new Map,this.version=nP,this.cached=[],this.initialized=!1,this.storagePrefix=hs,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(a=>{this.getKey&&a!==null&&!ci(a)?this.map.set(this.getKey(a),a):BI(a)?this.map.set(a.id,a):FI(a)&&this.map.set(a.topic,a)}),this.cached=[],this.initialized=!0)},this.set=async(a,u)=>{this.isInitialized(),this.map.has(a)?await this.update(a,u):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:a,value:u}),this.map.set(a,u),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(u=>Object.keys(a).every(h=>bD(u[h],a[h]))):this.values),this.update=async(a,u)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:a,update:u});const h=L3(L3({},this.getData(a)),u);this.map.set(a,h),await this.persist()},this.delete=async(a,u)=>{this.isInitialized(),this.map.has(a)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:a,reason:u}),this.map.delete(a),this.addToRecentlyDeleted(a),await this.persist())},this.logger=ui(r,this.name),this.storagePrefix=n,this.getKey=s}get context(){return Ai(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:n}=Ee("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}const{message:i}=Ee("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=Ee("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=Ee("NOT_INITIALIZED",this.name);throw new Error(e)}}}class HP{constructor(e,r){this.core=e,this.logger=r,this.name=uP,this.version=fP,this.events=new kr.exports,this.initialized=!1,this.storagePrefix=hs,this.ignoredPayloadTypes=[Rs],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=Nd(),s=await this.core.crypto.setSymKey(n),a=Ir(xe.FIVE_MINUTES),u={protocol:I3},h={topic:s,expiry:a,relay:u,active:!1},l=MI({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:n,relay:u,expiryTimestamp:a,methods:i?.methods});return this.core.expirer.set(s,a),await this.pairings.set(s,h),await this.core.relayer.subscribe(s,{transportType:i?.transportType}),{topic:s,uri:l}},this.pair=async i=>{this.isInitialized();const n=this.core.eventClient.createEvent({properties:{topic:i?.uri,trace:[ds.pairing_started]}});this.isValidPair(i,n);const{topic:s,symKey:a,relay:u,expiryTimestamp:h,methods:l}=wb(i.uri);n.props.properties.topic=s,n.addTrace(ds.pairing_uri_validation_success),n.addTrace(ds.pairing_uri_not_expired);let b;if(this.pairings.keys.includes(s)){if(b=this.pairings.get(s),n.addTrace(ds.existing_pairing),b.active)throw n.setError(Bs.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);n.addTrace(ds.pairing_not_expired)}const w=h||Ir(xe.FIVE_MINUTES),I={topic:s,relay:u,expiry:w,active:!1,methods:l};this.core.expirer.set(s,w),await this.pairings.set(s,I),n.addTrace(ds.store_new_pairing),i.activatePairing&&await this.activate({topic:s}),this.events.emit(fc.create,I),n.addTrace(ds.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(a,s),n.addTrace(ds.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{n.setError(Bs.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:u})}catch(S){throw n.setError(Bs.subscribe_pairing_topic_failure),S}return n.addTrace(ds.subscribe_pairing_topic_success),I},this.activate=async({topic:i})=>{this.isInitialized();const n=Ir(xe.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:u,reject:h}=Ho();this.events.once(Dt("pairing_ping",s),({error:l})=>{l?h(l):u()}),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.sendRequest=async(i,n,s)=>{const a=uo(n,s),u=await this.core.crypto.encode(i,a),h=Nu[n].req;return this.core.history.set(i,a),this.core.relayer.publish(i,u,h),a.id},this.sendResult=async(i,n,s)=>{const a=Oh(i,s),u=await this.core.crypto.encode(n,a),h=await this.core.history.get(n,i),l=Nu[h.request.method].res;await this.core.relayer.publish(n,u,l),await this.core.history.resolve(a)},this.sendError=async(i,n,s)=>{const a=Ph(i,s),u=await this.core.crypto.encode(n,a),h=await this.core.history.get(n,i),l=Nu[h.request.method]?Nu[h.request.method].res:Nu.unregistered_method.res;await this.core.relayer.publish(n,u,l),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=>io(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(fc.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(()=>{fs(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(fc.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 u=Gt("WC_METHOD_UNSUPPORTED",a);await this.sendError(s,i,u),this.logger.error(u)}catch(u){await this.sendError(s,i,u),this.logger.error(u)}},this.onUnknownRpcMethodResponse=i=>{this.registeredMethods.includes(i)||this.logger.error(Gt("WC_METHOD_UNSUPPORTED",i))},this.isValidPair=(i,n)=>{var s;if(!_i(i)){const{message:u}=Ee("MISSING_OR_INVALID",`pair() params: ${i}`);throw n.setError(Bs.malformed_pairing_uri),new Error(u)}if(!LI(i.uri)){const{message:u}=Ee("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw n.setError(Bs.malformed_pairing_uri),new Error(u)}const a=wb(i?.uri);if(!((s=a?.relay)!=null&&s.protocol)){const{message:u}=Ee("MISSING_OR_INVALID","pair() uri#relay-protocol");throw n.setError(Bs.malformed_pairing_uri),new Error(u)}if(!(a!=null&&a.symKey)){const{message:u}=Ee("MISSING_OR_INVALID","pair() uri#symKey");throw n.setError(Bs.malformed_pairing_uri),new Error(u)}if(a!=null&&a.expiryTimestamp&&xe.toMiliseconds(a?.expiryTimestamp)<Date.now()){n.setError(Bs.pairing_expired);const{message:u}=Ee("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(u)}},this.isValidPing=async i=>{if(!_i(i)){const{message:s}=Ee("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(s)}const{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidDisconnect=async i=>{if(!_i(i)){const{message:s}=Ee("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(s)}const{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidPairingTopic=async i=>{if(!yr(i,!1)){const{message:n}=Ee("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(n)}if(!this.pairings.keys.includes(i)){const{message:n}=Ee("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(n)}if(io(this.pairings.get(i).expiry)){await this.deletePairing(i);const{message:n}=Ee("EXPIRED",`pairing topic: ${i}`);throw new Error(n)}},this.core=e,this.logger=ui(r,this.name),this.pairings=new ea(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Ai(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=Ee("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(hi.message,async e=>{const{topic:r,message:i,transportType:n}=e;if(!this.pairings.keys.includes(r)||n===Zt.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))return;const s=await this.core.crypto.decode(r,i);try{Zd(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):$h(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(a){this.logger.error(a)}})}registerExpirerEvents(){this.core.expirer.on(sn.expired,async e=>{const{topic:r}=G2(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(fc.expire,{topic:r}))})}}class KP extends gC{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new kr.exports.EventEmitter,this.name=hP,this.version=lP,this.cached=[],this.initialized=!1,this.storagePrefix=hs,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(xe.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=ui(r,this.name)}get context(){return Ai(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const i={topic:r.topic,request:uo(r.request.method,r.request.params,r.id),chainId:r.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 r=this.records.get(e);if(!r){const{message:i}=Ee("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return r}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:r}=Ee("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Sn.created,e=>{const r=Sn.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Sn.updated,e=>{const r=Sn.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Sn.deleted,e=>{const r=Sn.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(ac.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{xe.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(Sn.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=Ee("NOT_INITIALIZED",this.name);throw new Error(e)}}}class WP extends _C{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new kr.exports.EventEmitter,this.name=dP,this.version=pP,this.cached=[],this.initialized=!1,this.storagePrefix=hs,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(sn.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(sn.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=ui(r,this.name)}get context(){return Ai(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 rA(e);if(typeof e=="number")return iA(e);const{message:r}=Ee("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(sn.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=Ee("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:i}=Ee("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(i),new Error(i)}return r}checkExpiry(e,r){const{expiry:i}=r;xe.toMiliseconds(i)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(sn.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(ac.pulse,()=>this.checkExpirations()),this.events.on(sn.created,e=>{const r=sn.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(sn.expired,e=>{const r=sn.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(sn.deleted,e=>{const r=sn.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=Ee("NOT_INITIALIZED",this.name);throw new Error(e)}}}var or={};Object.defineProperty(or,"__esModule",{value:!0}),or.getLocalStorage=or.getLocalStorageOrThrow=or.getCrypto=or.getCryptoOrThrow=or.getLocation=or.getLocationOrThrow=or.getNavigator=or.getNavigatorOrThrow=B3=or.getDocument=or.getDocumentOrThrow=or.getFromWindowOrThrow=or.getFromWindow=void 0;function ta(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}or.getFromWindow=ta;function hc(t){const e=ta(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}or.getFromWindowOrThrow=hc;function VP(){return hc("document")}or.getDocumentOrThrow=VP;function GP(){return ta("document")}var B3=or.getDocument=GP;function JP(){return hc("navigator")}or.getNavigatorOrThrow=JP;function YP(){return ta("navigator")}or.getNavigator=YP;function QP(){return hc("location")}or.getLocationOrThrow=QP;function ZP(){return ta("location")}or.getLocation=ZP;function XP(){return hc("crypto")}or.getCryptoOrThrow=XP;function e$(){return ta("crypto")}or.getCrypto=e$;function t$(){return hc("localStorage")}or.getLocalStorageOrThrow=t$;function r$(){return ta("localStorage")}or.getLocalStorage=r$;class i$ extends EC{constructor(e,r,i){super(e,r,i),this.core=e,this.logger=r,this.store=i,this.name=gP,this.verifyUrlV3=mP,this.storagePrefix=hs,this.version=x3,this.init=async()=>{var n;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&xe.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(!au()||this.isDevEnv)return;const s=window.location.origin,{id:a,decryptedId:u}=n,h=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${a}&decryptedId=${u}`;try{const l=B3(),b=this.startAbortTimer(xe.ONE_SECOND*5),w=await new Promise((I,S)=>{const D=()=>{window.removeEventListener("message",q),l.body.removeChild(T),S("attestation aborted")};this.abortController.signal.addEventListener("abort",D);const T=l.createElement("iframe");T.src=h,T.style.display="none",T.addEventListener("error",D,{signal:this.abortController.signal});const q=K=>{if(!K.data)return;const F=JSON.parse(K.data);if(F.type==="verify_attestation"){if(od(F.attestation).payload.id!==a)return;clearInterval(b),l.body.removeChild(T),this.abortController.signal.removeEventListener("abort",D),window.removeEventListener("message",q),I(F.attestation===null?"":F.attestation)}};l.body.appendChild(T),window.addEventListener("message",q,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",w),w}catch(l){this.logger.warn(l)}return""},this.resolve=async n=>{if(this.isDevEnv)return"";const{attestationId:s,hash:a,encryptedId:u}=n;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(od(s).payload.id!==u)return;const l=await this.isValidJwtAttestation(s);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}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(xe.ONE_SECOND*5),u=await fetch(`${s}/attestation/${n}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(a),u.status===200?await u.json():void 0},this.getVerifyUrl=n=>{let s=n||Tu;return bP.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Tu}`),s=Tu),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const n=this.startAbortTimer(xe.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(u){this.logger.error(u),this.logger.warn("error validating attestation")}const a=await this.fetchAndPersistPublicKey();try{if(a)return this.validateAttestation(n,a)}catch(u){this.logger.error(u),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=vI(n,s.publicKey),u={hasExpired:xe.toMiliseconds(a.exp)<Date.now(),payload:a};if(u.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:u.payload.origin,isScam:u.payload.isScam,isVerified:u.payload.isVerified}},this.logger=ui(r,this.name),this.abortController=new AbortController,this.isDevEnv=ad(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return Ai(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),xe.toMiliseconds(e))}}class n$ extends AC{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=yP,this.registerDeviceToken=async i=>{const{clientId:n,token:s,notificationType:a,enableEncrypted:u=!1}=i,h=`${wP}/${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:u})})},this.logger=ui(r,this.context)}}var s$=Object.defineProperty,F3=Object.getOwnPropertySymbols,o$=Object.prototype.hasOwnProperty,a$=Object.prototype.propertyIsEnumerable,U3=(t,e,r)=>e in t?s$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Fu=(t,e)=>{for(var r in e||(e={}))o$.call(e,r)&&U3(t,r,e[r]);if(F3)for(var r of F3(e))a$.call(e,r)&&U3(t,r,e[r]);return t};class c$ extends xC{constructor(e,r,i=!0){super(e,r,i),this.core=e,this.logger=r,this.context=EP,this.storagePrefix=hs,this.storageVersion=_P,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!ad())try{const n={eventId:Y2(),timestamp:Date.now(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:H2(this.core.relayer.protocol,this.core.relayer.version,n1)}}};await this.sendEvent([n])}catch(n){this.logger.warn(n)}},this.createEvent=n=>{const{event:s="ERROR",type:a="",properties:{topic:u,trace:h}}=n,l=Y2(),b=this.core.projectId||"",w=Date.now(),I=Fu({eventId:l,bundleId:b,timestamp:w,props:{event:s,type:a,properties:{topic:u,trace:h}}},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,I),this.shouldPersist=!0),I},this.getEvent=n=>{const{eventId:s,topic:a}=n;if(s)return this.events.get(s);const u=Array.from(this.events.values()).find(h=>h.props.properties.topic===a);if(u)return Fu(Fu({},u),this.setMethods(u.eventId))},this.deleteEvent=n=>{const{eventId:s}=n;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(ac.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(n=>{xe.fromMiliseconds(Date.now())-xe.fromMiliseconds(n.timestamp)>AP&&(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,Fu(Fu({},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=>await fetch(`${xP}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${n1}`,{method:"POST",body:JSON.stringify(n)}),this.logger=ui(r,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 u$=Object.defineProperty,k3=Object.getOwnPropertySymbols,f$=Object.prototype.hasOwnProperty,h$=Object.prototype.propertyIsEnumerable,q3=(t,e,r)=>e in t?u$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,j3=(t,e)=>{for(var r in e||(e={}))f$.call(e,r)&&q3(t,r,e[r]);if(k3)for(var r of k3(e))h$.call(e,r)&&q3(t,r,e[r]);return t};class o1 extends pC{constructor(e){var r;super(e),this.protocol=A3,this.version=x3,this.name=i1,this.events=new kr.exports.EventEmitter,this.initialized=!1,this.on=(a,u)=>this.events.on(a,u),this.once=(a,u)=>this.events.once(a,u),this.off=(a,u)=>this.events.off(a,u),this.removeListener=(a,u)=>this.events.removeListener(a,u),this.dispatchEnvelope=({topic:a,message:u,sessionExists:h})=>{if(!a||!u)return;const l={topic:a,message:u,publishedAt:Date.now(),transportType:Zt.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:h})},this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||M3,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const i=Dh({level:typeof e?.logger=="string"&&e.logger?e.logger:HO.logger}),{logger:n,chunkLoggerController:s}=dC({opts:i,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var a,u;(a=this.logChunkController)!=null&&a.downloadLogsBlobInBrowser&&((u=this.logChunkController)==null||u.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ui(n,this.name),this.heartbeat=new zd,this.crypto=new IP(this,this.logger,e?.keychain),this.history=new KP(this,this.logger),this.expirer=new WP(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new FM(j3(j3({},KO),e?.storageOptions)),this.relayer=new kP({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new HP(this,this.logger),this.verify=new i$(this,this.logger,this.storage),this.echoClient=new n$(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new c$(this,this.logger,e?.telemetryEnabled)}static async init(e){const r=new o1(e);await r.initialize();const i=await r.crypto.getClientId();return await r.storage.setItem(sP,i),r}get context(){return Ai(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(C3,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.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(C3)||[],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 l$=o1,z3="wc",H3=2,K3="client",a1=`${z3}@${H3}:${K3}:`,c1={name:K3,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},W3="WALLETCONNECT_DEEPLINK_CHOICE",d$="proposal",V3="Proposal expired",p$="session",lc=xe.SEVEN_DAYS,g$="engine",Lr={wc_sessionPropose:{req:{ttl:xe.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:xe.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:xe.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:xe.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:xe.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:xe.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:xe.ONE_DAY,prompt:!1,tag:1104},res:{ttl:xe.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:xe.ONE_DAY,prompt:!1,tag:1106},res:{ttl:xe.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:xe.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:xe.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:xe.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:xe.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:xe.ONE_DAY,prompt:!1,tag:1112},res:{ttl:xe.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:xe.ONE_DAY,prompt:!1,tag:1114},res:{ttl:xe.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:xe.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:xe.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:xe.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:xe.FIVE_MINUTES,prompt:!1,tag:1119}}},u1={min:xe.FIVE_MINUTES,max:xe.SEVEN_DAYS},ps={idle:"IDLE",active:"ACTIVE"},v$="request",m$=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],b$="wc",y$="auth",w$="authKeys",_$="pairingTopics",E$="requests",Nh=`${b$}@${1.5}:${y$}:`,Th=`${Nh}:PUB_KEY`;var A$=Object.defineProperty,x$=Object.defineProperties,S$=Object.getOwnPropertyDescriptors,G3=Object.getOwnPropertySymbols,I$=Object.prototype.hasOwnProperty,M$=Object.prototype.propertyIsEnumerable,J3=(t,e,r)=>e in t?A$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,pr=(t,e)=>{for(var r in e||(e={}))I$.call(e,r)&&J3(t,r,e[r]);if(G3)for(var r of G3(e))M$.call(e,r)&&J3(t,r,e[r]);return t},Mn=(t,e)=>x$(t,S$(e));class C$ extends IC{constructor(e){super(e),this.name=g$,this.events=new kr.exports,this.initialized=!1,this.requestQueue={state:ps.idle,queue:[]},this.sessionRequestQueue={state:ps.idle,queue:[]},this.requestQueueDelay=xe.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(Lr)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},xe.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const i=Mn(pr({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(i);const{pairingTopic:n,requiredNamespaces:s,optionalNamespaces:a,sessionProperties:u,relays:h}=i;let l=n,b,w=!1;try{l&&(w=this.client.core.pairing.pairings.get(l).active)}catch(R){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),R}if(!l||!w){const{topic:R,uri:k}=await this.client.core.pairing.create();l=R,b=k}if(!l){const{message:R}=Ee("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(R)}const I=await this.client.core.crypto.generateKeyPair(),S=Lr.wc_sessionPropose.req.ttl||xe.FIVE_MINUTES,D=Ir(S),T=pr({requiredNamespaces:s,optionalNamespaces:a,relays:h??[{protocol:I3}],proposer:{publicKey:I,metadata:this.client.metadata},expiryTimestamp:D,pairingTopic:l},u&&{sessionProperties:u}),{reject:q,resolve:K,done:F}=Ho(S,V3);this.events.once(Dt("session_connect"),async({error:R,session:k})=>{if(R)q(R);else if(k){k.self.publicKey=I;const H=Mn(pr({},k),{pairingTopic:T.pairingTopic,requiredNamespaces:T.requiredNamespaces,optionalNamespaces:T.optionalNamespaces,transportType:Zt.relay});await this.client.session.set(k.topic,H),await this.setExpiry(k.topic,k.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:k.peer.metadata}),this.cleanupDuplicatePairings(H),K(H)}});const W=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:T,throwOnFailedPublish:!0});return await this.setProposal(W,pr({id:W},T)),{uri:b,approval:F}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(i){throw this.client.logger.error("pair() failed"),i}},this.approve=async r=>{var i,n,s;const a=this.client.core.eventClient.createEvent({properties:{topic:(i=r?.id)==null?void 0:i.toString(),trace:[In.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(B){throw a.setError(Zo.no_internet_connection),B}try{await this.isValidProposalId(r?.id)}catch(B){throw this.client.logger.error(`approve() -> proposal.get(${r?.id}) failed`),a.setError(Zo.proposal_not_found),B}try{await this.isValidApprove(r)}catch(B){throw this.client.logger.error("approve() -> isValidApprove() failed"),a.setError(Zo.session_approve_namespace_validation_failure),B}const{id:u,relayProtocol:h,namespaces:l,sessionProperties:b,sessionConfig:w}=r,I=this.client.proposal.get(u);this.client.core.eventClient.deleteEvent({eventId:a.eventId});const{pairingTopic:S,proposer:D,requiredNamespaces:T,optionalNamespaces:q}=I;let K=(n=this.client.core.eventClient)==null?void 0:n.getEvent({topic:S});K||(K=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:In.session_approve_started,properties:{topic:S,trace:[In.session_approve_started,In.session_namespaces_validation_success]}}));const F=await this.client.core.crypto.generateKeyPair(),W=D.publicKey,R=await this.client.core.crypto.generateSharedKey(F,W),k=pr(pr({relay:{protocol:h??"irn"},namespaces:l,controller:{publicKey:F,metadata:this.client.metadata},expiry:Ir(lc)},b&&{sessionProperties:b}),w&&{sessionConfig:w}),H=Zt.relay;K.addTrace(In.subscribing_session_topic);try{await this.client.core.relayer.subscribe(R,{transportType:H})}catch(B){throw K.setError(Zo.subscribe_session_topic_failure),B}K.addTrace(In.subscribe_session_topic_success);const _=Mn(pr({},k),{topic:R,requiredNamespaces:T,optionalNamespaces:q,pairingTopic:S,acknowledged:!1,self:k.controller,peer:{publicKey:D.publicKey,metadata:D.metadata},controller:F,transportType:Zt.relay});await this.client.session.set(R,_),K.addTrace(In.store_session);try{K.addTrace(In.publishing_session_settle),await this.sendRequest({topic:R,method:"wc_sessionSettle",params:k,throwOnFailedPublish:!0}).catch(B=>{throw K?.setError(Zo.session_settle_publish_failure),B}),K.addTrace(In.session_settle_publish_success),K.addTrace(In.publishing_session_approve),await this.sendResult({id:u,topic:S,result:{relay:{protocol:h??"irn"},responderPublicKey:F},throwOnFailedPublish:!0}).catch(B=>{throw K?.setError(Zo.session_approve_publish_failure),B}),K.addTrace(In.session_approve_publish_success)}catch(B){throw this.client.logger.error(B),this.client.session.delete(R,Gt("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(R),B}return this.client.core.eventClient.deleteEvent({eventId:K.eventId}),await this.client.core.pairing.updateMetadata({topic:S,metadata:D.metadata}),await this.client.proposal.delete(u,Gt("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:S}),await this.setExpiry(R,Ir(lc)),{topic:R,acknowledged:()=>Promise.resolve(this.client.session.get(R))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(a){throw this.client.logger.error("reject() -> isValidReject() failed"),a}const{id:i,reason:n}=r;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:Lr.wc_sessionPropose.reject}),await this.client.proposal.delete(i,Gt("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(w){throw this.client.logger.error("update() -> isValidUpdate() failed"),w}const{topic:i,namespaces:n}=r,{done:s,resolve:a,reject:u}=Ho(),h=co(),l=Qo().toString(),b=this.client.session.get(i).namespaces;return this.events.once(Dt("session_update",h),({error:w})=>{w?u(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:l}).catch(w=>{this.client.logger.error(w),this.client.session.update(i,{namespaces:b}),u(w)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(h){throw this.client.logger.error("extend() -> isValidExtend() failed"),h}const{topic:i}=r,n=co(),{done:s,resolve:a,reject:u}=Ho();return this.events.once(Dt("session_extend",n),({error:h})=>{h?u(h):a()}),await this.setExpiry(i,Ir(lc)),this.sendRequest({topic:i,method:"wc_sessionExtend",params:{},clientRpcId:n,throwOnFailedPublish:!0}).catch(h=>{u(h)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(D){throw this.client.logger.error("request() -> isValidRequest() failed"),D}const{chainId:i,request:n,topic:s,expiry:a=Lr.wc_sessionRequest.req.ttl}=r,u=this.client.session.get(s);u?.transportType===Zt.relay&&await this.confirmOnlineStateOrThrow();const h=co(),l=Qo().toString(),{done:b,resolve:w,reject:I}=Ho(a,"Request expired. Please try again.");this.events.once(Dt("session_request",h),({error:D,result:T})=>{D?I(D):w(T)});const S=this.getAppLinkIfEnabled(u.peer.metadata,u.transportType);return S?(await this.sendRequest({clientRpcId:h,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:Mn(pr({},n),{expiryTimestamp:Ir(a)}),chainId:i},expiry:a,throwOnFailedPublish:!0,appLink:S}).catch(D=>I(D)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:i,id:h}),await b()):await Promise.all([new Promise(async D=>{await this.sendRequest({clientRpcId:h,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:Mn(pr({},n),{expiryTimestamp:Ir(a)}),chainId:i},expiry:a,throwOnFailedPublish:!0}).catch(T=>I(T)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:i,id:h}),D()}),new Promise(async D=>{var T;if(!((T=u.sessionConfig)!=null&&T.disableDeepLink)){const q=await sA(this.client.core.storage,W3);nA({id:h,topic:s,wcDeepLink:q})}D()}),b()]).then(D=>D[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:i,response:n}=r,{id:s}=n,a=this.client.session.get(i);a.transportType===Zt.relay&&await this.confirmOnlineStateOrThrow();const u=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);fs(n)?await this.sendResult({id:s,topic:i,result:n.result,throwOnFailedPublish:!0,appLink:u}):rn(n)&&await this.sendError({id:s,topic:i,error:n.error,appLink:u}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(n){throw this.client.logger.error("ping() -> isValidPing() failed"),n}const{topic:i}=r;if(this.client.session.keys.includes(i)){const n=co(),s=Qo().toString(),{done:a,resolve:u,reject:h}=Ho();this.events.once(Dt("session_ping",n),({error:l})=>{l?h(l):u()}),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 r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:i,event:n,chainId:s}=r,a=Qo().toString();await this.sendRequest({topic:i,method:"wc_sessionEvent",params:{event:n,chainId:s},throwOnFailedPublish:!0,relayRpcId:a})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:i}=r;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}=Ee("MISMATCHED_TOPIC",`Session or pairing topic not found: ${i}`);throw new Error(n)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(i=>NI(i,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,i)=>{var n;this.isInitialized(),this.isValidAuthenticate(r);const s=i&&this.client.core.linkModeSupportedApps.includes(i)&&((n=this.client.metadata.redirect)==null?void 0:n.linkMode),a=s?Zt.link_mode:Zt.relay;a===Zt.relay&&await this.confirmOnlineStateOrThrow();const{chains:u,statement:h="",uri:l,domain:b,nonce:w,type:I,exp:S,nbf:D,methods:T=[],expiry:q}=r,K=[...r.resources||[]],{topic:F,uri:W}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:a});this.client.logger.info({message:"Generated new pairing",pairing:{topic:F,uri:W}});const R=await this.client.core.crypto.generateKeyPair(),k=bh(R);if(await Promise.all([this.client.auth.authKeys.set(Th,{responseTopic:k,publicKey:R}),this.client.auth.pairingTopics.set(k,{topic:k,pairingTopic:F})]),await this.client.core.relayer.subscribe(k,{transportType:a}),this.client.logger.info(`sending request to new pairing topic: ${F}`),T.length>0){const{namespace:O}=ou(u[0]);let M=eI(O,"request",T);mh(K)&&(M=rI(M,K.pop())),K.push(M)}const H=q&&q>Lr.wc_sessionAuthenticate.req.ttl?q:Lr.wc_sessionAuthenticate.req.ttl,_={authPayload:{type:I??"caip122",chains:u,statement:h,aud:l,domain:b,version:"1",nonce:w,iat:new Date().toISOString(),exp:S,nbf:D,resources:K},requester:{publicKey:R,metadata:this.client.metadata},expiryTimestamp:Ir(H)},B={eip155:{chains:u,methods:[...new Set(["personal_sign",...T])],events:["chainChanged","accountsChanged"]}},ee={requiredNamespaces:{},optionalNamespaces:B,relays:[{protocol:"irn"}],pairingTopic:F,proposer:{publicKey:R,metadata:this.client.metadata},expiryTimestamp:Ir(Lr.wc_sessionPropose.req.ttl)},{done:ie,resolve:L,reject:y}=Ho(H,"Request expired"),f=async({error:O,session:M})=>{if(this.events.off(Dt("session_request",v),d),O)y(O);else if(M){M.self.publicKey=R,await this.client.session.set(M.topic,M),await this.setExpiry(M.topic,M.expiry),F&&await this.client.core.pairing.updateMetadata({topic:F,metadata:M.peer.metadata});const g=this.client.session.get(M.topic);await this.deleteProposal(E),L({session:g})}},d=async O=>{var M,g,m;if(await this.deletePendingAuthRequest(v,{message:"fulfilled",code:0}),O.error){const G=Gt("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return O.error.code===G.code?void 0:(this.events.off(Dt("session_connect"),f),y(O.error.message))}await this.deleteProposal(E),this.events.off(Dt("session_connect"),f);const{cacaos:N,responder:X}=O.result,ae=[],P=[];for(const G of N){await nb({cacao:G,projectId:this.client.core.projectId})||(this.client.logger.error(G,"Signature verification failed"),y(Gt("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:J}=G,A=mh(J.resources),V=[ib(J.iss)],oe=vh(J.iss);if(A){const ue=ab(A),he=cb(A);ae.push(...ue),V.push(...he)}for(const ue of V)P.push(`${ue}:${oe}`)}const te=await this.client.core.crypto.generateSharedKey(R,X.publicKey);let z;ae.length>0&&(z={topic:te,acknowledged:!0,self:{publicKey:R,metadata:this.client.metadata},peer:X,controller:X.publicKey,expiry:Ir(lc),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:F,namespaces:_b([...new Set(ae)],[...new Set(P)]),transportType:a},await this.client.core.relayer.subscribe(te,{transportType:a}),await this.client.session.set(te,z),F&&await this.client.core.pairing.updateMetadata({topic:F,metadata:X.metadata}),z=this.client.session.get(te)),(M=this.client.metadata.redirect)!=null&&M.linkMode&&(g=X.metadata.redirect)!=null&&g.linkMode&&(m=X.metadata.redirect)!=null&&m.universal&&i&&(this.client.core.addLinkModeSupportedApp(X.metadata.redirect.universal),this.client.session.update(te,{transportType:Zt.link_mode})),L({auths:N,session:z})},v=co(),E=co();this.events.once(Dt("session_connect"),f),this.events.once(Dt("session_request",v),d);let C;try{if(s){const O=uo("wc_sessionAuthenticate",_,v);this.client.core.history.set(F,O);const M=await this.client.core.crypto.encode("",O,{type:wu,encoding:bu});C=yh(i,F,M)}else await Promise.all([this.sendRequest({topic:F,method:"wc_sessionAuthenticate",params:_,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:v}),this.sendRequest({topic:F,method:"wc_sessionPropose",params:ee,expiry:Lr.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:E})])}catch(O){throw this.events.off(Dt("session_connect"),f),this.events.off(Dt("session_request",v),d),O}return await this.setProposal(E,pr({id:E},ee)),await this.setAuthRequest(v,{request:Mn(pr({},_),{verifyContext:{}}),pairingTopic:F,transportType:a}),{uri:C??W,response:ie}},this.approveSessionAuthenticate=async r=>{const{id:i,auths:n}=r,s=this.client.core.eventClient.createEvent({properties:{topic:i.toString(),trace:[Xo.authenticated_session_approve_started]}});try{this.isInitialized()}catch(q){throw s.setError(Lu.no_internet_connection),q}const a=this.getPendingAuthRequest(i);if(!a)throw s.setError(Lu.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${i}`);const u=a.transportType||Zt.relay;u===Zt.relay&&await this.confirmOnlineStateOrThrow();const h=a.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),b=bh(h),w={type:Rs,receiverPublicKey:h,senderPublicKey:l},I=[],S=[];for(const q of n){if(!await nb({cacao:q,projectId:this.client.core.projectId})){s.setError(Lu.invalid_cacao);const k=Gt("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:i,topic:b,error:k,encodeOpts:w}),new Error(k.message)}s.addTrace(Xo.cacaos_verified);const{p:K}=q,F=mh(K.resources),W=[ib(K.iss)],R=vh(K.iss);if(F){const k=ab(F),H=cb(F);I.push(...k),W.push(...H)}for(const k of W)S.push(`${k}:${R}`)}const D=await this.client.core.crypto.generateSharedKey(l,h);s.addTrace(Xo.create_authenticated_session_topic);let T;if(I?.length>0){T={topic:D,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:h,metadata:a.requester.metadata},controller:h,expiry:Ir(lc),authentication:n,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:a.pairingTopic,namespaces:_b([...new Set(I)],[...new Set(S)]),transportType:u},s.addTrace(Xo.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(D,{transportType:u})}catch(q){throw s.setError(Lu.subscribe_authenticated_session_topic_failure),q}s.addTrace(Xo.subscribe_authenticated_session_topic_success),await this.client.session.set(D,T),s.addTrace(Xo.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:a.pairingTopic,metadata:a.requester.metadata})}s.addTrace(Xo.publishing_authenticated_session_approve);try{await this.sendResult({topic:b,id:i,result:{cacaos:n,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:w,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(a.requester.metadata,u)})}catch(q){throw s.setError(Lu.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:T}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:i,reason:n}=r,s=this.getPendingAuthRequest(i);if(!s)throw new Error(`Could not find pending auth request with id ${i}`);s.transportType===Zt.relay&&await this.confirmOnlineStateOrThrow();const a=s.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),h=bh(a),l={type:Rs,receiverPublicKey:a,senderPublicKey:u};await this.sendError({id:i,topic:h,error:n,encodeOpts:l,rpcOpts:Lr.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=r=>{this.isInitialized();const{request:i,iss:n}=r;return sb(i,n)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const i=this.client.core.pairing.pairings.get(r.pairingTopic),n=this.client.core.pairing.pairings.getAll().filter(s=>{var a,u;return((a=s.peerMetadata)==null?void 0:a.url)&&((u=s.peerMetadata)==null?void 0:u.url)===r.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 r=>{var i;const{topic:n,expirerHasDeleted:s=!1,emitEvent:a=!0,id:u=0}=r,{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(W3).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===n&&this.deletePendingSessionRequest(l.id,Gt("USER_DISCONNECTED"))}),n===((i=this.sessionRequestQueue.queue[0])==null?void 0:i.topic)&&(this.sessionRequestQueue.state=ps.idle),a&&this.client.events.emit("session_delete",{id:u,topic:n})},this.deleteProposal=async(r,i)=>{if(i)try{const n=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:n.pairingTopic});s?.setError(Zo.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,Gt("USER_DISCONNECTED")),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,i,n=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,i),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),n&&(this.sessionRequestQueue.state=ps.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,i,n=!1)=>{await Promise.all([this.client.auth.requests.delete(r,i),n?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,i)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,i),await this.client.session.update(r,{expiry:i}))},this.setProposal=async(r,i)=>{this.client.core.expirer.set(r,Ir(Lr.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,i)},this.setAuthRequest=async(r,i)=>{const{request:n,pairingTopic:s,transportType:a=Zt.relay}=i;this.client.core.expirer.set(r,n.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:n.authPayload,requester:n.requester,expiryTimestamp:n.expiryTimestamp,id:r,pairingTopic:s,verifyContext:n.verifyContext,transportType:a})},this.setPendingSessionRequest=async r=>{const{id:i,topic:n,params:s,verifyContext:a}=r,u=s.request.expiryTimestamp||Ir(Lr.wc_sessionRequest.req.ttl);this.client.core.expirer.set(i,u),await this.client.pendingRequest.set(i,{id:i,topic:n,params:s,verifyContext:a})},this.sendRequest=async r=>{const{topic:i,method:n,params:s,expiry:a,relayRpcId:u,clientRpcId:h,throwOnFailedPublish:l,appLink:b}=r,w=uo(n,s,h);let I;const S=!!b;try{const q=S?bu:ao;I=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 D;if(m$.includes(n)){const q=Ns(JSON.stringify(w)),K=Ns(I);D=await this.client.core.verify.register({id:K,decryptedId:q})}const T=Lr[n].req;if(T.attestation=D,a&&(T.ttl=a),u&&(T.id=u),this.client.core.history.set(i,w),S){const q=yh(b,i,I);await global.Linking.openURL(q,this.client.name)}else{const q=Lr[n].req;a&&(q.ttl=a),u&&(q.id=u),l?(q.internal=Mn(pr({},q.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,I,q)):this.client.core.relayer.publish(i,I,q).catch(K=>this.client.logger.error(K))}return w.id},this.sendResult=async r=>{const{id:i,topic:n,result:s,throwOnFailedPublish:a,encodeOpts:u,appLink:h}=r,l=Oh(i,s);let b;const w=h&&typeof(global==null?void 0:global.Linking)<"u";try{const S=w?bu:ao;b=await this.client.core.crypto.encode(n,l,Mn(pr({},u||{}),{encoding:S}))}catch(S){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${n} failed`),S}let I;try{I=await this.client.core.history.get(n,i)}catch(S){throw this.client.logger.error(`sendResult() -> history.get(${n}, ${i}) failed`),S}if(w){const S=yh(h,n,b);await global.Linking.openURL(S,this.client.name)}else{const S=Lr[I.request.method].res;a?(S.internal=Mn(pr({},S.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,b,S)):this.client.core.relayer.publish(n,b,S).catch(D=>this.client.logger.error(D))}await this.client.core.history.resolve(l)},this.sendError=async r=>{const{id:i,topic:n,error:s,encodeOpts:a,rpcOpts:u,appLink:h}=r,l=Ph(i,s);let b;const w=h&&typeof(global==null?void 0:global.Linking)<"u";try{const S=w?bu:ao;b=await this.client.core.crypto.encode(n,l,Mn(pr({},a||{}),{encoding:S}))}catch(S){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${n} failed`),S}let I;try{I=await this.client.core.history.get(n,i)}catch(S){throw this.client.logger.error(`sendError() -> history.get(${n}, ${i}) failed`),S}if(w){const S=yh(h,n,b);await global.Linking.openURL(S,this.client.name)}else{const S=u||Lr[I.request.method].res;this.client.core.relayer.publish(n,b,S)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],i=[];this.client.session.getAll().forEach(n=>{let s=!1;io(n.expiry)&&(s=!0),this.client.core.crypto.keychain.has(n.topic)||(s=!0),s&&r.push(n.topic)}),this.client.proposal.getAll().forEach(n=>{io(n.expiryTimestamp)&&i.push(n.id)}),await Promise.all([...r.map(n=>this.deleteSession({topic:n})),...i.map(n=>this.deleteProposal(n))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===ps.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=ps.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(i){this.client.logger.warn(i)}}this.requestQueue.state=ps.idle},this.processRequest=async r=>{const{topic:i,payload:n,attestation:s,transportType:a,encryptedId:u}=r,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:u});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:u,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:u,transportType:a});default:return this.client.logger.info(`Unsupported request method ${h}`)}},this.onRelayEventResponse=async r=>{const{topic:i,payload:n,transportType:s}=r,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=r=>{const{topic:i}=r,{message:n}=Ee("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=r=>{const{topic:i,requestMethod:n}=r,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 r=>{const{topic:i,payload:n,attestation:s,encryptedId:a}=r,{params:u,id:h}=n;try{const l=this.client.core.eventClient.getEvent({topic:i});this.isValidConnect(pr({},n.params));const b=u.expiryTimestamp||Ir(Lr.wc_sessionPropose.req.ttl),w=pr({id:h,pairingTopic:i,expiryTimestamp:b},u);await this.setProposal(h,w);const I=await this.getVerifyContext({attestationId:s,hash:Ns(JSON.stringify(n)),encryptedId:a,metadata:w.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l?.setError(Bs.proposal_listener_not_found)),l?.addTrace(ds.emit_session_proposal),this.client.events.emit("session_proposal",{id:h,params:w,verifyContext:I})}catch(l){await this.sendError({id:h,topic:i,error:l,rpcOpts:Lr.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(r,i,n)=>{const{id:s}=i;if(fs(i)){const{result:a}=i;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:a});const u=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:u});const h=u.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:h});const l=a.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const b=await this.client.core.crypto.generateSharedKey(h,l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:b});const w=await this.client.core.relayer.subscribe(b,{transportType:n});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:w}),await this.client.core.pairing.activate({topic:r})}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(r,i)=>{const{id:n,params:s}=i;try{this.isValidSessionSettleRequest(s);const{relay:a,controller:u,expiry:h,namespaces:l,sessionProperties:b,sessionConfig:w}=i.params,I=Mn(pr(pr({topic:r,relay:a,expiry:h,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:u.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:u.publicKey,metadata:u.metadata}},b&&{sessionProperties:b}),w&&{sessionConfig:w}),{transportType:Zt.relay}),S=Dt("session_connect");if(this.events.listenerCount(S)===0)throw new Error(`emitting ${S} without any listeners 997`);this.events.emit(Dt("session_connect"),{session:I}),await this.sendResult({id:i.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(a){await this.sendError({id:n,topic:r,error:a}),this.client.logger.error(a)}},this.onSessionSettleResponse=async(r,i)=>{const{id:n}=i;fs(i)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(Dt("session_approve",n),{})):rn(i)&&(await this.client.session.delete(r,Gt("USER_DISCONNECTED")),this.events.emit(Dt("session_approve",n),{error:i.error}))},this.onSessionUpdateRequest=async(r,i)=>{const{params:n,id:s}=i;try{const a=`${r}_session_update`,u=Iu.get(a);if(u&&this.isRequestOutOfSync(u,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:Gt("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(pr({topic:r},n));try{Iu.set(a,s),await this.client.session.update(r,{namespaces:n.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(h){throw Iu.delete(a),h}this.client.events.emit("session_update",{id:s,topic:r,params:n})}catch(a){await this.sendError({id:s,topic:r,error:a}),this.client.logger.error(a)}},this.isRequestOutOfSync=(r,i)=>parseInt(i.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,i)=>{const{id:n}=i,s=Dt("session_update",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);fs(i)?this.events.emit(Dt("session_update",n),{}):rn(i)&&this.events.emit(Dt("session_update",n),{error:i.error})},this.onSessionExtendRequest=async(r,i)=>{const{id:n}=i;try{this.isValidExtend({topic:r}),await this.setExpiry(r,Ir(lc)),await this.sendResult({id:n,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:n,topic:r})}catch(s){await this.sendError({id:n,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,i)=>{const{id:n}=i,s=Dt("session_extend",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);fs(i)?this.events.emit(Dt("session_extend",n),{}):rn(i)&&this.events.emit(Dt("session_extend",n),{error:i.error})},this.onSessionPingRequest=async(r,i)=>{const{id:n}=i;try{this.isValidPing({topic:r}),await this.sendResult({id:n,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:n,topic:r})}catch(s){await this.sendError({id:n,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,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(()=>{fs(i)?this.events.emit(Dt("session_ping",n),{}):rn(i)&&this.events.emit(Dt("session_ping",n),{error:i.error})},500)},this.onSessionDeleteRequest=async(r,i)=>{const{id:n}=i;try{this.isValidDisconnect({topic:r,reason:i.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(hi.publish,async()=>{s(await this.deleteSession({topic:r,id:n}))})}),this.sendResult({id:n,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:Gt("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var i,n,s;const{topic:a,payload:u,attestation:h,encryptedId:l,transportType:b}=r,{id:w,params:I}=u;try{await this.isValidRequest(pr({topic:a},I));const S=this.client.session.get(a),D=await this.getVerifyContext({attestationId:h,hash:Ns(JSON.stringify(uo("wc_sessionRequest",I,w))),encryptedId:l,metadata:S.peer.metadata,transportType:b}),T={id:w,topic:a,params:I,verifyContext:D};await this.setPendingSessionRequest(T),b===Zt.link_mode&&(i=S.peer.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp((n=S.peer.metadata.redirect)==null?void 0:n.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(T):(this.addSessionRequestToSessionRequestQueue(T),this.processSessionRequestQueue())}catch(S){await this.sendError({id:w,topic:a,error:S}),this.client.logger.error(S)}},this.onSessionRequestResponse=(r,i)=>{const{id:n}=i,s=Dt("session_request",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);fs(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(r,i)=>{const{id:n,params:s}=i;try{const a=`${r}_session_event_${s.event.name}`,u=Iu.get(a);if(u&&this.isRequestOutOfSync(u,n)){this.client.logger.info(`Discarding out of sync request - ${n}`);return}this.isValidEmit(pr({topic:r},s)),this.client.events.emit("session_event",{id:n,topic:r,params:s}),Iu.set(a,n)}catch(a){await this.sendError({id:n,topic:r,error:a}),this.client.logger.error(a)}},this.onSessionAuthenticateResponse=(r,i)=>{const{id:n}=i;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:i}),fs(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 r=>{var i;const{topic:n,payload:s,attestation:a,encryptedId:u,transportType:h}=r;try{const{requester:l,authPayload:b,expiryTimestamp:w}=s.params,I=await this.getVerifyContext({attestationId:a,hash:Ns(JSON.stringify(s)),encryptedId:u,metadata:l.metadata,transportType:h}),S={requester:l,pairingTopic:n,id:s.id,authPayload:b,verifyContext:I,expiryTimestamp:w};await this.setAuthRequest(s.id,{request:S,pairingTopic:n,transportType:h}),h===Zt.link_mode&&(i=l.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:n,params:s.params,id:s.id,verifyContext:I})}catch(l){this.client.logger.error(l);const b=s.params.requester.publicKey,w=await this.client.core.crypto.generateKeyPair(),I=this.getAppLinkIfEnabled(s.params.requester.metadata,h),S={type:Rs,receiverPublicKey:b,senderPublicKey:w};await this.sendError({id:s.id,topic:n,error:l,encodeOpts:S,rpcOpts:Lr.wc_sessionAuthenticate.autoReject,appLink:I})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=ps.idle,this.processSessionRequestQueue()},xe.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:i})=>{const n=this.client.core.history.pending;n.length>0&&n.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const a=s.request.id,u=Dt("session_request",a);if(this.events.listenerCount(u)===0)throw new Error(`emitting ${u} without any listeners`);this.events.emit(Dt("session_request",s.request.id),{error:i})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===ps.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=ps.active,this.emitSessionRequest(r)}catch(i){this.client.logger.error(i)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const i=this.client.proposal.getAll().find(n=>n.pairingTopic===r.topic);i&&this.onSessionProposeRequest({topic:r.topic,payload:uo("wc_sessionPropose",{requiredNamespaces:i.requiredNamespaces,optionalNamespaces:i.optionalNamespaces,relays:i.relays,proposer:i.proposer,sessionProperties:i.sessionProperties},i.id)})},this.isValidConnect=async r=>{if(!_i(r)){const{message:h}=Ee("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(h)}const{pairingTopic:i,requiredNamespaces:n,optionalNamespaces:s,sessionProperties:a,relays:u}=r;if(ci(i)||await this.isValidPairingTopic(i),!WI(u,!0)){const{message:h}=Ee("MISSING_OR_INVALID",`connect() relays: ${u}`);throw new Error(h)}!ci(n)&&Su(n)!==0&&this.validateNamespaces(n,"requiredNamespaces"),!ci(s)&&Su(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),ci(a)||this.validateSessionProps(a,"sessionProperties")},this.validateNamespaces=(r,i)=>{const n=KI(r,"connect()",i);if(n)throw new Error(n.message)},this.isValidApprove=async r=>{if(!_i(r))throw new Error(Ee("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:i,namespaces:n,relayProtocol:s,sessionProperties:a}=r;this.checkRecentlyDeleted(i),await this.isValidProposalId(i);const u=this.client.proposal.get(i),h=Fd(n,"approve()");if(h)throw new Error(h.message);const l=Ib(u.requiredNamespaces,n,"approve()");if(l)throw new Error(l.message);if(!yr(s,!0)){const{message:b}=Ee("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(b)}ci(a)||this.validateSessionProps(a,"sessionProperties")},this.isValidReject=async r=>{if(!_i(r)){const{message:s}=Ee("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:i,reason:n}=r;if(this.checkRecentlyDeleted(i),await this.isValidProposalId(i),!GI(n)){const{message:s}=Ee("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!_i(r)){const{message:l}=Ee("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}const{relay:i,controller:n,namespaces:s,expiry:a}=r;if(!xb(i)){const{message:l}=Ee("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const u=UI(n,"onSessionSettleRequest()");if(u)throw new Error(u.message);const h=Fd(s,"onSessionSettleRequest()");if(h)throw new Error(h.message);if(io(a)){const{message:l}=Ee("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!_i(r)){const{message:h}=Ee("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(h)}const{topic:i,namespaces:n}=r;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const s=this.client.session.get(i),a=Fd(n,"update()");if(a)throw new Error(a.message);const u=Ib(s.requiredNamespaces,n,"update()");if(u)throw new Error(u.message)},this.isValidExtend=async r=>{if(!_i(r)){const{message:n}=Ee("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(n)}const{topic:i}=r;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i)},this.isValidRequest=async r=>{if(!_i(r)){const{message:h}=Ee("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(h)}const{topic:i,request:n,chainId:s,expiry:a}=r;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const{namespaces:u}=this.client.session.get(i);if(!Sb(u,s)){const{message:h}=Ee("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(h)}if(!JI(n)){const{message:h}=Ee("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(h)}if(!ZI(u,s,n.method)){const{message:h}=Ee("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(h)}if(a&&!rM(a,u1)){const{message:h}=Ee("MISSING_OR_INVALID",`request() expiry: ${a}. Expiry must be a number (in seconds) between ${u1.min} and ${u1.max}`);throw new Error(h)}},this.isValidRespond=async r=>{var i;if(!_i(r)){const{message:a}=Ee("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(a)}const{topic:n,response:s}=r;try{await this.isValidSessionTopic(n)}catch(a){throw(i=r?.response)!=null&&i.id&&this.cleanupAfterResponse(r),a}if(!YI(s)){const{message:a}=Ee("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(a)}},this.isValidPing=async r=>{if(!_i(r)){const{message:n}=Ee("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(n)}const{topic:i}=r;await this.isValidSessionOrPairingTopic(i)},this.isValidEmit=async r=>{if(!_i(r)){const{message:u}=Ee("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(u)}const{topic:i,event:n,chainId:s}=r;await this.isValidSessionTopic(i);const{namespaces:a}=this.client.session.get(i);if(!Sb(a,s)){const{message:u}=Ee("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(u)}if(!QI(n)){const{message:u}=Ee("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(u)}if(!XI(a,s,n.name)){const{message:u}=Ee("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(u)}},this.isValidDisconnect=async r=>{if(!_i(r)){const{message:n}=Ee("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(n)}const{topic:i}=r;await this.isValidSessionOrPairingTopic(i)},this.isValidAuthenticate=r=>{const{chains:i,uri:n,domain:s,nonce:a}=r;if(!Array.isArray(i)||i.length===0)throw new Error("chains is required and must be a non-empty array");if(!yr(n,!1))throw new Error("uri is required parameter");if(!yr(s,!1))throw new Error("domain is required parameter");if(!yr(a,!1))throw new Error("nonce is required parameter");if([...new Set(i.map(h=>ou(h).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:u}=ou(i[0]);if(u!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:i,hash:n,encryptedId:s,metadata:a,transportType:u}=r,h={verified:{verifyUrl:a.verifyUrl||Tu,validation:"UNKNOWN",origin:a.url||""}};try{if(u===Zt.link_mode){const b=this.getAppLinkIfEnabled(a,u);return h.verified.validation=b&&new URL(b).origin===new URL(a.url).origin?"VALID":"INVALID",h}const l=await this.client.core.verify.resolve({attestationId:i,hash:n,encryptedId:s,verifyUrl:a.verifyUrl});l&&(h.verified.origin=l.origin,h.verified.isScam=l.isScam,h.verified.validation=l.origin===new URL(a.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(h)}`),h},this.validateSessionProps=(r,i)=>{Object.values(r).forEach(n=>{if(!yr(n,!1)){const{message:s}=Ee("MISSING_OR_INVALID",`${i} must be in Record<string, string> format. Received: ${JSON.stringify(n)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const i=this.client.auth.requests.get(r);return typeof i=="object"?i:void 0},this.addToRecentlyDeleted=(r,i)=>{if(this.recentlyDeletedMap.set(r,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=r=>{const i=this.recentlyDeletedMap.get(r);if(i){const{message:n}=Ee("MISSING_OR_INVALID",`Record was recently deleted - ${i}: ${r}`);throw new Error(n)}},this.isLinkModeEnabled=(r,i)=>{var n,s,a,u,h,l,b,w,I;return!r||i!==Zt.link_mode?!1:((s=(n=this.client.metadata)==null?void 0:n.redirect)==null?void 0:s.linkMode)===!0&&((u=(a=this.client.metadata)==null?void 0:a.redirect)==null?void 0:u.universal)!==void 0&&((l=(h=this.client.metadata)==null?void 0:h.redirect)==null?void 0:l.universal)!==""&&((b=r?.redirect)==null?void 0:b.universal)!==void 0&&((w=r?.redirect)==null?void 0:w.universal)!==""&&((I=r?.redirect)==null?void 0:I.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,i)=>{var n;return this.isLinkModeEnabled(r,i)?(n=r?.redirect)==null?void 0:n.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const i=J2(r,"topic")||"",n=decodeURIComponent(J2(r,"wc_ev")||""),s=this.client.session.keys.includes(i);s&&this.client.session.update(i,{transportType:Zt.link_mode}),this.client.core.dispatchEnvelope({topic:i,message:n,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(ad()||Va()&&(r=this.client.metadata.redirect)!=null&&r.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}=Ee("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(hi.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:i,attestation:n,transportType:s}=e,{publicKey:a}=this.client.auth.authKeys.keys.includes(Th)?this.client.auth.authKeys.get(Th):{responseTopic:void 0,publicKey:void 0},u=await this.client.core.crypto.decode(r,i,{receiverPublicKey:a,encoding:s===Zt.link_mode?bu:ao});try{Zd(u)?(this.client.core.history.set(r,u),this.onRelayEventRequest({topic:r,payload:u,attestation:n,transportType:s,encryptedId:Ns(i)})):$h(u)?(await this.client.core.history.resolve(u),await this.onRelayEventResponse({topic:r,payload:u,transportType:s}),this.client.core.history.delete(r,u.id)):this.onRelayEventUnknownPayload({topic:r,payload:u,transportType:s})}catch(h){this.client.logger.error(h)}}registerExpirerEvents(){this.client.core.expirer.on(sn.expired,async e=>{const{topic:r,id:i}=G2(e.target);if(i&&this.client.pendingRequest.keys.includes(i))return await this.deletePendingSessionRequest(i,Ee("EXPIRED"),!0);if(i&&this.client.auth.requests.keys.includes(i))return await this.deletePendingAuthRequest(i,Ee("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):i&&(await this.deleteProposal(i,!0),this.client.events.emit("proposal_expire",{id:i}))})}registerPairingEvents(){this.client.core.pairing.events.on(fc.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(fc.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!yr(e,!1)){const{message:r}=Ee("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=Ee("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(io(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=Ee("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!yr(e,!1)){const{message:r}=Ee("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=Ee("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(io(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=Ee("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=Ee("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(yr(e,!1)){const{message:r}=Ee("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=Ee("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!VI(e)){const{message:r}=Ee("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=Ee("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(io(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=Ee("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class D$ extends ea{constructor(e,r){super(e,r,d$,a1),this.core=e,this.logger=r}}class O$ extends ea{constructor(e,r){super(e,r,p$,a1),this.core=e,this.logger=r}}class P$ extends ea{constructor(e,r){super(e,r,v$,a1,i=>i.id),this.core=e,this.logger=r}}class $$ extends ea{constructor(e,r){super(e,r,w$,Nh,()=>Th),this.core=e,this.logger=r}}class R$ extends ea{constructor(e,r){super(e,r,_$,Nh),this.core=e,this.logger=r}}class N$ extends ea{constructor(e,r){super(e,r,E$,Nh,i=>i.id),this.core=e,this.logger=r}}class T${constructor(e,r){this.core=e,this.logger=r,this.authKeys=new $$(this.core,this.logger),this.pairingTopics=new R$(this.core,this.logger),this.requests=new N$(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class f1 extends SC{constructor(e){super(e),this.protocol=z3,this.version=H3,this.name=c1.name,this.events=new kr.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||c1.name,this.metadata=e?.metadata||ZE(),this.signConfig=e?.signConfig;const r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:cs(Dh({level:e?.logger||c1.logger}));this.core=e?.core||new l$(e),this.logger=ui(r,this.name),this.session=new O$(this.core,this.logger),this.proposal=new D$(this.core,this.logger),this.pendingRequest=new P$(this.core,this.logger),this.engine=new C$(this),this.auth=new T$(this.core,this.logger)}static async init(e){const r=new f1(e);return await r.initialize(),r}get context(){return Ai(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"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var h1={exports:{}};(function(t,e){var r=typeof self<"u"?self:Vr,i=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(a){var u={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(d){return d&&DataView.prototype.isPrototypeOf(d)}if(u.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],b=ArrayBuffer.isView||function(d){return d&&l.indexOf(Object.prototype.toString.call(d))>-1};function w(d){if(typeof d!="string"&&(d=String(d)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(d))throw new TypeError("Invalid character in header field name");return d.toLowerCase()}function I(d){return typeof d!="string"&&(d=String(d)),d}function S(d){var v={next:function(){var E=d.shift();return{done:E===void 0,value:E}}};return u.iterable&&(v[Symbol.iterator]=function(){return v}),v}function D(d){this.map={},d instanceof D?d.forEach(function(v,E){this.append(E,v)},this):Array.isArray(d)?d.forEach(function(v){this.append(v[0],v[1])},this):d&&Object.getOwnPropertyNames(d).forEach(function(v){this.append(v,d[v])},this)}D.prototype.append=function(d,v){d=w(d),v=I(v);var E=this.map[d];this.map[d]=E?E+", "+v:v},D.prototype.delete=function(d){delete this.map[w(d)]},D.prototype.get=function(d){return d=w(d),this.has(d)?this.map[d]:null},D.prototype.has=function(d){return this.map.hasOwnProperty(w(d))},D.prototype.set=function(d,v){this.map[w(d)]=I(v)},D.prototype.forEach=function(d,v){for(var E in this.map)this.map.hasOwnProperty(E)&&d.call(v,this.map[E],E,this)},D.prototype.keys=function(){var d=[];return this.forEach(function(v,E){d.push(E)}),S(d)},D.prototype.values=function(){var d=[];return this.forEach(function(v){d.push(v)}),S(d)},D.prototype.entries=function(){var d=[];return this.forEach(function(v,E){d.push([E,v])}),S(d)},u.iterable&&(D.prototype[Symbol.iterator]=D.prototype.entries);function T(d){if(d.bodyUsed)return Promise.reject(new TypeError("Already read"));d.bodyUsed=!0}function q(d){return new Promise(function(v,E){d.onload=function(){v(d.result)},d.onerror=function(){E(d.error)}})}function K(d){var v=new FileReader,E=q(v);return v.readAsArrayBuffer(d),E}function F(d){var v=new FileReader,E=q(v);return v.readAsText(d),E}function W(d){for(var v=new Uint8Array(d),E=new Array(v.length),C=0;C<v.length;C++)E[C]=String.fromCharCode(v[C]);return E.join("")}function R(d){if(d.slice)return d.slice(0);var v=new Uint8Array(d.byteLength);return v.set(new Uint8Array(d)),v.buffer}function k(){return this.bodyUsed=!1,this._initBody=function(d){this._bodyInit=d,d?typeof d=="string"?this._bodyText=d:u.blob&&Blob.prototype.isPrototypeOf(d)?this._bodyBlob=d:u.formData&&FormData.prototype.isPrototypeOf(d)?this._bodyFormData=d:u.searchParams&&URLSearchParams.prototype.isPrototypeOf(d)?this._bodyText=d.toString():u.arrayBuffer&&u.blob&&h(d)?(this._bodyArrayBuffer=R(d.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(d)||b(d))?this._bodyArrayBuffer=R(d):this._bodyText=d=Object.prototype.toString.call(d):this._bodyText="",this.headers.get("content-type")||(typeof d=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):u.searchParams&&URLSearchParams.prototype.isPrototypeOf(d)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u.blob&&(this.blob=function(){var d=T(this);if(d)return d;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?T(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(K)}),this.text=function(){var d=T(this);if(d)return d;if(this._bodyBlob)return F(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(W(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},u.formData&&(this.formData=function(){return this.text().then(ee)}),this.json=function(){return this.text().then(JSON.parse)},this}var H=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function _(d){var v=d.toUpperCase();return H.indexOf(v)>-1?v:d}function B(d,v){v=v||{};var E=v.body;if(d instanceof B){if(d.bodyUsed)throw new TypeError("Already read");this.url=d.url,this.credentials=d.credentials,v.headers||(this.headers=new D(d.headers)),this.method=d.method,this.mode=d.mode,this.signal=d.signal,!E&&d._bodyInit!=null&&(E=d._bodyInit,d.bodyUsed=!0)}else this.url=String(d);if(this.credentials=v.credentials||this.credentials||"same-origin",(v.headers||!this.headers)&&(this.headers=new D(v.headers)),this.method=_(v.method||this.method||"GET"),this.mode=v.mode||this.mode||null,this.signal=v.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&E)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(E)}B.prototype.clone=function(){return new B(this,{body:this._bodyInit})};function ee(d){var v=new FormData;return d.trim().split("&").forEach(function(E){if(E){var C=E.split("="),O=C.shift().replace(/\+/g," "),M=C.join("=").replace(/\+/g," ");v.append(decodeURIComponent(O),decodeURIComponent(M))}}),v}function ie(d){var v=new D,E=d.replace(/\r?\n[\t ]+/g," ");return E.split(/\r?\n/).forEach(function(C){var O=C.split(":"),M=O.shift().trim();if(M){var g=O.join(":").trim();v.append(M,g)}}),v}k.call(B.prototype);function L(d,v){v||(v={}),this.type="default",this.status=v.status===void 0?200:v.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in v?v.statusText:"OK",this.headers=new D(v.headers),this.url=v.url||"",this._initBody(d)}k.call(L.prototype),L.prototype.clone=function(){return new L(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new D(this.headers),url:this.url})},L.error=function(){var d=new L(null,{status:0,statusText:""});return d.type="error",d};var y=[301,302,303,307,308];L.redirect=function(d,v){if(y.indexOf(v)===-1)throw new RangeError("Invalid status code");return new L(null,{status:v,headers:{location:d}})},a.DOMException=s.DOMException;try{new a.DOMException}catch{a.DOMException=function(v,E){this.message=v,this.name=E;var C=Error(v);this.stack=C.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function f(d,v){return new Promise(function(E,C){var O=new B(d,v);if(O.signal&&O.signal.aborted)return C(new a.DOMException("Aborted","AbortError"));var M=new XMLHttpRequest;function g(){M.abort()}M.onload=function(){var m={status:M.status,statusText:M.statusText,headers:ie(M.getAllResponseHeaders()||"")};m.url="responseURL"in M?M.responseURL:m.headers.get("X-Request-URL");var N="response"in M?M.response:M.responseText;E(new L(N,m))},M.onerror=function(){C(new TypeError("Network request failed"))},M.ontimeout=function(){C(new TypeError("Network request failed"))},M.onabort=function(){C(new a.DOMException("Aborted","AbortError"))},M.open(O.method,O.url,!0),O.credentials==="include"?M.withCredentials=!0:O.credentials==="omit"&&(M.withCredentials=!1),"responseType"in M&&u.blob&&(M.responseType="blob"),O.headers.forEach(function(m,N){M.setRequestHeader(N,m)}),O.signal&&(O.signal.addEventListener("abort",g),M.onreadystatechange=function(){M.readyState===4&&O.signal.removeEventListener("abort",g)}),M.send(typeof O._bodyInit>"u"?null:O._bodyInit)})}return f.polyfill=!0,s.fetch||(s.fetch=f,s.Headers=D,s.Request=B,s.Response=L),a.Headers=D,a.Request=B,a.Response=L,a.fetch=f,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,t.exports=e})(h1,h1.exports);var Y3=W5(h1.exports),L$=Object.defineProperty,B$=Object.defineProperties,F$=Object.getOwnPropertyDescriptors,Q3=Object.getOwnPropertySymbols,U$=Object.prototype.hasOwnProperty,k$=Object.prototype.propertyIsEnumerable,Z3=(t,e,r)=>e in t?L$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,X3=(t,e)=>{for(var r in e||(e={}))U$.call(e,r)&&Z3(t,r,e[r]);if(Q3)for(var r of Q3(e))k$.call(e,r)&&Z3(t,r,e[r]);return t},e6=(t,e)=>B$(t,F$(e));const q$={Accept:"application/json","Content-Type":"application/json"},j$="POST",t6={headers:q$,method:j$},r6=10;class gs{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new kr.exports.EventEmitter,this.isAvailable=!1,this.registering=!1,!e3(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=Cs(e),i=await(await Y3(this.url,e6(X3({},t6),{body:r}))).json();this.onPayload({data:i})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!e3(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((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 r=Cs({id:1,jsonrpc:"2.0",method:"test",params:[]});await Y3(e,e6(X3({},t6),{body:r}))}this.onOpen()}catch(r){const i=this.parseError(r);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 r=typeof e.data=="string"?jo(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const i=this.parseError(r),n=i.message||i.toString(),s=Ph(e,n);this.events.emit("payload",s)}parseError(e,r=this.url){return Gb(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>r6&&this.events.setMaxListeners(r6)}}const i6="error",z$="wss://relay.walletconnect.com",H$="wc",K$="universal_provider",n6=`${H$}@2:${K$}:`,s6="https://rpc.walletconnect.com/v1/",dc="generic",W$=`${s6}bundler`,Cn={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Uu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},l1={exports:{}};/**
43
+ ***************************************************************************** */var Jd=function(t,e){return Jd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},Jd(t,e)};function BC(t,e){Jd(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Yd=function(){return Yd=Object.assign||function(e){for(var r,i=1,n=arguments.length;i<n;i++){r=arguments[i];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Yd.apply(this,arguments)};function FC(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r}function UC(t,e,r,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,i);else for(var u=t.length-1;u>=0;u--)(a=t[u])&&(s=(n<3?a(s):n>3?a(e,r,s):a(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s}function kC(t,e){return function(r,i){e(r,i,t)}}function qC(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function jC(t,e,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function u(b){try{l(i.next(b))}catch(w){a(w)}}function h(b){try{l(i.throw(b))}catch(w){a(w)}}function l(b){b.done?s(b.value):n(b.value).then(u,h)}l((i=i.apply(t,e||[])).next())})}function zC(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(l){return function(b){return h([l,b])}}function h(l){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,n&&(s=l[0]&2?n.return:l[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,l[1])).done)return s;switch(n=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,n=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){r.label=l[1];break}if(l[0]===6&&r.label<s[1]){r.label=s[1],s=l;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(l);break}s[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(b){l=[6,b],n=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function HC(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}function KC(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Qd(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Qb(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var i=r.call(t),n,s=[],a;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(u){a={error:u}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(a)throw a.error}}return s}function WC(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Qb(arguments[e]));return t}function VC(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var i=Array(t),n=0,e=0;e<r;e++)for(var s=arguments[e],a=0,u=s.length;a<u;a++,n++)i[n]=s[a];return i}function $u(t){return this instanceof $u?(this.v=t,this):new $u(t)}function GC(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=r.apply(t,e||[]),n,s=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(I){i[I]&&(n[I]=function(S){return new Promise(function(D,T){s.push([I,S,D,T])>1||u(I,S)})})}function u(I,S){try{h(i[I](S))}catch(D){w(s[0][3],D)}}function h(I){I.value instanceof $u?Promise.resolve(I.value.v).then(l,b):w(s[0][2],I)}function l(I){u("next",I)}function b(I){u("throw",I)}function w(I,S){I(S),s.shift(),s.length&&u(s[0][0],s[0][1])}}function JC(t){var e,r;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]=t[n]?function(a){return(r=!r)?{value:$u(t[n](a)),done:n==="return"}:s?s(a):a}:s}}function YC(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Qd=="function"?Qd(t):t[Symbol.iterator](),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(s){r[s]=t[s]&&function(a){return new Promise(function(u,h){a=t[s](a),n(u,h,a.done,a.value)})}}function n(s,a,u,h){Promise.resolve(h).then(function(l){s({value:l,done:u})},a)}}function QC(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function ZC(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function XC(t){return t&&t.__esModule?t:{default:t}}function eD(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function tD(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var rD=Object.freeze({__proto__:null,__extends:BC,get __assign(){return Yd},__rest:FC,__decorate:UC,__param:kC,__metadata:qC,__awaiter:jC,__generator:zC,__createBinding:HC,__exportStar:KC,__values:Qd,__read:Qb,__spread:WC,__spreadArrays:VC,__await:$u,__asyncGenerator:GC,__asyncDelegator:JC,__asyncValues:YC,__makeTemplateObject:QC,__importStar:ZC,__importDefault:XC,__classPrivateFieldGet:eD,__classPrivateFieldSet:tD}),iD=m0(rD),Ts={},Zb;function nD(){if(Zb)return Ts;Zb=1,Object.defineProperty(Ts,"__esModule",{value:!0}),Ts.isBrowserCryptoAvailable=Ts.getSubtleCrypto=Ts.getBrowerCrypto=void 0;function t(){return Vr?.crypto||Vr?.msCrypto||{}}Ts.getBrowerCrypto=t;function e(){const i=t();return i.subtle||i.webkitSubtle}Ts.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Ts.isBrowserCryptoAvailable=r,Ts}var Ls={},Xb;function sD(){if(Xb)return Ls;Xb=1,Object.defineProperty(Ls,"__esModule",{value:!0}),Ls.isBrowser=Ls.isNode=Ls.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Ls.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Ls.isNode=e;function r(){return!t()&&!e()}return Ls.isBrowser=r,Ls}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=iD;e.__exportStar(nD(),t),e.__exportStar(sD(),t)})(Yb);function co(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function Qo(t=6){return BigInt(co(t))}function uo(t,e,r){return{id:r||co(),jsonrpc:"2.0",method:t,params:e}}function Oh(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Ph(t,e,r){return{id:t,jsonrpc:"2.0",error:oD(e,r)}}function oD(t,e){return typeof t>"u"?Gb(Wb):(typeof t=="string"&&(t=Object.assign(Object.assign({},Gb(Gd)),{message:t})),typeof e<"u"&&(t.data=e),TC(t.code)&&(t=LC(t.code)),t)}class aD{}class cD extends aD{constructor(){super()}}class uD extends cD{constructor(e){super()}}const fD="^https?:",hD="^wss?:";function lD(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function e3(t,e){const r=lD(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function t3(t){return e3(t,fD)}function r3(t){return e3(t,hD)}function dD(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function i3(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function Zd(t){return i3(t)&&"method"in t}function $h(t){return i3(t)&&(fs(t)||rn(t))}function fs(t){return"result"in t}function rn(t){return"error"in t}class xn extends uD{constructor(e){super(e),this.events=new kr.exports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(uo(e.method,e.params||[],e.id||Qo().toString()),r)}async requestStrict(e,r){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,r)}catch(s){n(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),$h(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 pD=()=>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"),gD=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",n3=t=>t.split("?")[0],s3=10,vD=pD();class mD{constructor(e){if(this.url=e,this.events=new kr.exports.EventEmitter,this.registering=!1,!r3(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=i=>{this.onClose(i),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Cs(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!r3(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((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((r,i)=>{const n=new URLSearchParams(e).get("origin"),s=Yb.isReactNative()?{headers:{origin:n}}:{rejectUnauthorized:!dD(e)},a=new vD(e,[],s);gD()?a.onerror=u=>{const h=u;i(this.emitError(h.error))}:a.on("error",u=>{i(this.emitError(u))}),a.onopen=()=>{this.onOpen(a),r(a)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?jo(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const i=this.parseError(r),n=i.message||i.toString(),s=Ph(e,n);this.events.emit("payload",s)}parseError(e,r=this.url){return Jb(e,n3(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>s3&&this.events.setMaxListeners(s3)}emitError(e){const r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${n3(this.url)}`));return this.events.emit("register_error",r),r}}var Xd={exports:{}};(function(t,e){var r=200,i="__lodash_hash_undefined__",n=1,s=2,a=9007199254740991,u="[object Arguments]",h="[object Array]",l="[object AsyncFunction]",b="[object Boolean]",w="[object Date]",I="[object Error]",S="[object Function]",D="[object GeneratorFunction]",T="[object Map]",q="[object Number]",K="[object Null]",F="[object Object]",W="[object Promise]",R="[object Proxy]",k="[object RegExp]",H="[object Set]",_="[object String]",B="[object Symbol]",ee="[object Undefined]",ie="[object WeakMap]",L="[object ArrayBuffer]",y="[object DataView]",f="[object Float32Array]",d="[object Float64Array]",v="[object Int8Array]",E="[object Int16Array]",C="[object Int32Array]",O="[object Uint8Array]",M="[object Uint8ClampedArray]",g="[object Uint16Array]",m="[object Uint32Array]",N=/[\\^$.*+?()[\]{}|]/g,X=/^\[object .+?Constructor\]$/,ae=/^(?:0|[1-9]\d*)$/,P={};P[f]=P[d]=P[v]=P[E]=P[C]=P[O]=P[M]=P[g]=P[m]=!0,P[u]=P[h]=P[L]=P[b]=P[y]=P[w]=P[I]=P[S]=P[T]=P[q]=P[F]=P[k]=P[H]=P[_]=P[ie]=!1;var te=typeof Vr=="object"&&Vr&&Vr.Object===Object&&Vr,z=typeof self=="object"&&self&&self.Object===Object&&self,G=te||z||Function("return this")(),J=e&&!e.nodeType&&e,A=J&&!0&&t&&!t.nodeType&&t,V=A&&A.exports===J,oe=V&&te.process,ue=function(){try{return oe&&oe.binding&&oe.binding("util")}catch{}}(),he=ue&&ue.isTypedArray;function ye(Y,re){for(var pe=-1,ke=Y==null?0:Y.length,er=0,bt=[];++pe<ke;){var ar=Y[pe];re(ar,pe,Y)&&(bt[er++]=ar)}return bt}function we(Y,re){for(var pe=-1,ke=re.length,er=Y.length;++pe<ke;)Y[er+pe]=re[pe];return Y}function Re(Y,re){for(var pe=-1,ke=Y==null?0:Y.length;++pe<ke;)if(re(Y[pe],pe,Y))return!0;return!1}function Xe(Y,re){for(var pe=-1,ke=Array(Y);++pe<Y;)ke[pe]=re(pe);return ke}function Oe(Y){return function(re){return Y(re)}}function Ne(Y,re){return Y.has(re)}function Me(Y,re){return Y?.[re]}function be(Y){var re=-1,pe=Array(Y.size);return Y.forEach(function(ke,er){pe[++re]=[er,ke]}),pe}function Pe(Y,re){return function(pe){return Y(re(pe))}}function Te(Y){var re=-1,pe=Array(Y.size);return Y.forEach(function(ke){pe[++re]=ke}),pe}var ve=Array.prototype,$e=Function.prototype,Se=Object.prototype,me=G["__core-js_shared__"],Ue=$e.toString,Ce=Se.hasOwnProperty,_e=function(){var Y=/[^.]+$/.exec(me&&me.keys&&me.keys.IE_PROTO||"");return Y?"Symbol(src)_1."+Y:""}(),Ke=Se.toString,Ve=RegExp("^"+Ue.call(Ce).replace(N,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ae=V?G.Buffer:void 0,We=G.Symbol,pt=G.Uint8Array,Ge=Se.propertyIsEnumerable,It=ve.splice,gt=We?We.toStringTag:void 0,Ye=Object.getOwnPropertySymbols,Ot=Ae?Ae.isBuffer:void 0,Tt=Pe(Object.keys,Object),Le=ji(G,"DataView"),et=ji(G,"Map"),it=ji(G,"Promise"),Be=ji(G,"Set"),rt=ji(G,"WeakMap"),tt=ji(Object,"create"),qe=qs(Le),ht=qs(et),nt=qs(it),je=qs(Be),st=qs(rt),at=We?We.prototype:void 0,Fe=at?at.valueOf:void 0;function Ze(Y){var re=-1,pe=Y==null?0:Y.length;for(this.clear();++re<pe;){var ke=Y[re];this.set(ke[0],ke[1])}}function lt(){this.__data__=tt?tt(null):{},this.size=0}function ze(Y){var re=this.has(Y)&&delete this.__data__[Y];return this.size-=re?1:0,re}function qt(Y){var re=this.__data__;if(tt){var pe=re[Y];return pe===i?void 0:pe}return Ce.call(re,Y)?re[Y]:void 0}function jt(Y){var re=this.__data__;return tt?re[Y]!==void 0:Ce.call(re,Y)}function ct(Y,re){var pe=this.__data__;return this.size+=this.has(Y)?0:1,pe[Y]=tt&&re===void 0?i:re,this}Ze.prototype.clear=lt,Ze.prototype.delete=ze,Ze.prototype.get=qt,Ze.prototype.has=jt,Ze.prototype.set=ct;function _t(Y){var re=-1,pe=Y==null?0:Y.length;for(this.clear();++re<pe;){var ke=Y[re];this.set(ke[0],ke[1])}}function Zr(){this.__data__=[],this.size=0}function Xr(Y){var re=this.__data__,pe=ma(re,Y);if(pe<0)return!1;var ke=re.length-1;return pe==ke?re.pop():It.call(re,pe,1),--this.size,!0}function ei(Y){var re=this.__data__,pe=ma(re,Y);return pe<0?void 0:re[pe][1]}function ti(Y){return ma(this.__data__,Y)>-1}function ri(Y,re){var pe=this.__data__,ke=ma(pe,Y);return ke<0?(++this.size,pe.push([Y,re])):pe[ke][1]=re,this}_t.prototype.clear=Zr,_t.prototype.delete=Xr,_t.prototype.get=ei,_t.prototype.has=ti,_t.prototype.set=ri;function vr(Y){var re=-1,pe=Y==null?0:Y.length;for(this.clear();++re<pe;){var ke=Y[re];this.set(ke[0],ke[1])}}function Ii(){this.size=0,this.__data__={hash:new Ze,map:new(et||_t),string:new Ze}}function On(Y){var re=Ao(this,Y).delete(Y);return this.size-=re?1:0,re}function Mi(Y){return Ao(this,Y).get(Y)}function Pn(Y){return Ao(this,Y).has(Y)}function $n(Y,re){var pe=Ao(this,Y),ke=pe.size;return pe.set(Y,re),this.size+=pe.size==ke?0:1,this}vr.prototype.clear=Ii,vr.prototype.delete=On,vr.prototype.get=Mi,vr.prototype.has=Pn,vr.prototype.set=$n;function Ci(Y){var re=-1,pe=Y==null?0:Y.length;for(this.__data__=new vr;++re<pe;)this.add(Y[re])}function an(Y){return this.__data__.set(Y,i),this}function cn(Y){return this.__data__.has(Y)}Ci.prototype.add=Ci.prototype.push=an,Ci.prototype.has=cn;function Cr(Y){var re=this.__data__=new _t(Y);this.size=re.size}function Rn(){this.__data__=new _t,this.size=0}function Nn(Y){var re=this.__data__,pe=re.delete(Y);return this.size=re.size,pe}function Tn(Y){return this.__data__.get(Y)}function va(Y){return this.__data__.has(Y)}function gl(Y,re){var pe=this.__data__;if(pe instanceof _t){var ke=pe.__data__;if(!et||ke.length<r-1)return ke.push([Y,re]),this.size=++pe.size,this;pe=this.__data__=new vr(ke)}return pe.set(Y,re),this.size=pe.size,this}Cr.prototype.clear=Rn,Cr.prototype.delete=Nn,Cr.prototype.get=Tn,Cr.prototype.has=va,Cr.prototype.set=gl;function vl(Y,re){var pe=Nc(Y),ke=!pe&&Cl(Y),er=!pe&&!ke&&cf(Y),bt=!pe&&!ke&&!er&&Pl(Y),ar=pe||ke||er||bt,xr=ar?Xe(Y.length,String):[],Ft=xr.length;for(var tr in Y)(re||Ce.call(Y,tr))&&!(ar&&(tr=="length"||er&&(tr=="offset"||tr=="parent")||bt&&(tr=="buffer"||tr=="byteLength"||tr=="byteOffset")||Al(tr,Ft)))&&xr.push(tr);return xr}function ma(Y,re){for(var pe=Y.length;pe--;)if(Ml(Y[pe][0],re))return pe;return-1}function of(Y,re,pe){var ke=re(Y);return Nc(Y)?ke:we(ke,pe(Y))}function ba(Y){return Y==null?Y===void 0?ee:K:gt&&gt in Object(Y)?_l(Y):Op(Y)}function af(Y){return wa(Y)&&ba(Y)==u}function ya(Y,re,pe,ke,er){return Y===re?!0:Y==null||re==null||!wa(Y)&&!wa(re)?Y!==Y&&re!==re:ml(Y,re,pe,ke,ya,er)}function ml(Y,re,pe,ke,er,bt){var ar=Nc(Y),xr=Nc(re),Ft=ar?h:ws(Y),tr=xr?h:ws(re);Ft=Ft==u?F:Ft,tr=tr==u?F:tr;var _r=Ft==F,Di=tr==F,Sr=Ft==tr;if(Sr&&cf(Y)){if(!cf(re))return!1;ar=!0,_r=!1}if(Sr&&!_r)return bt||(bt=new Cr),ar||Pl(Y)?$c(Y,re,pe,ke,er,bt):Dp(Y,re,Ft,pe,ke,er,bt);if(!(pe&n)){var cr=_r&&Ce.call(Y,"__wrapped__"),di=Di&&Ce.call(re,"__wrapped__");if(cr||di){var Ln=cr?Y.value():Y,un=di?re.value():re;return bt||(bt=new Cr),er(Ln,un,pe,ke,bt)}}return Sr?(bt||(bt=new Cr),wl(Y,re,pe,ke,er,bt)):!1}function Cp(Y){if(!Ol(Y)||Sl(Y))return!1;var re=Tc(Y)?Ve:X;return re.test(qs(Y))}function bl(Y){return wa(Y)&&Dl(Y.length)&&!!P[ba(Y)]}function yl(Y){if(!Il(Y))return Tt(Y);var re=[];for(var pe in Object(Y))Ce.call(Y,pe)&&pe!="constructor"&&re.push(pe);return re}function $c(Y,re,pe,ke,er,bt){var ar=pe&n,xr=Y.length,Ft=re.length;if(xr!=Ft&&!(ar&&Ft>xr))return!1;var tr=bt.get(Y);if(tr&&bt.get(re))return tr==re;var _r=-1,Di=!0,Sr=pe&s?new Ci:void 0;for(bt.set(Y,re),bt.set(re,Y);++_r<xr;){var cr=Y[_r],di=re[_r];if(ke)var Ln=ar?ke(di,cr,_r,re,Y,bt):ke(cr,di,_r,Y,re,bt);if(Ln!==void 0){if(Ln)continue;Di=!1;break}if(Sr){if(!Re(re,function(un,_s){if(!Ne(Sr,_s)&&(cr===un||er(cr,un,pe,ke,bt)))return Sr.push(_s)})){Di=!1;break}}else if(!(cr===di||er(cr,di,pe,ke,bt))){Di=!1;break}}return bt.delete(Y),bt.delete(re),Di}function Dp(Y,re,pe,ke,er,bt,ar){switch(pe){case y:if(Y.byteLength!=re.byteLength||Y.byteOffset!=re.byteOffset)return!1;Y=Y.buffer,re=re.buffer;case L:return!(Y.byteLength!=re.byteLength||!bt(new pt(Y),new pt(re)));case b:case w:case q:return Ml(+Y,+re);case I:return Y.name==re.name&&Y.message==re.message;case k:case _:return Y==re+"";case T:var xr=be;case H:var Ft=ke&n;if(xr||(xr=Te),Y.size!=re.size&&!Ft)return!1;var tr=ar.get(Y);if(tr)return tr==re;ke|=s,ar.set(Y,re);var _r=$c(xr(Y),xr(re),ke,er,bt,ar);return ar.delete(Y),_r;case B:if(Fe)return Fe.call(Y)==Fe.call(re)}return!1}function wl(Y,re,pe,ke,er,bt){var ar=pe&n,xr=Rc(Y),Ft=xr.length,tr=Rc(re),_r=tr.length;if(Ft!=_r&&!ar)return!1;for(var Di=Ft;Di--;){var Sr=xr[Di];if(!(ar?Sr in re:Ce.call(re,Sr)))return!1}var cr=bt.get(Y);if(cr&&bt.get(re))return cr==re;var di=!0;bt.set(Y,re),bt.set(re,Y);for(var Ln=ar;++Di<Ft;){Sr=xr[Di];var un=Y[Sr],_s=re[Sr];if(ke)var uf=ar?ke(_s,un,Sr,re,Y,bt):ke(un,_s,Sr,Y,re,bt);if(!(uf===void 0?un===_s||er(un,_s,pe,ke,bt):uf)){di=!1;break}Ln||(Ln=Sr=="constructor")}if(di&&!Ln){var _a=Y.constructor,Fr=re.constructor;_a!=Fr&&"constructor"in Y&&"constructor"in re&&!(typeof _a=="function"&&_a instanceof _a&&typeof Fr=="function"&&Fr instanceof Fr)&&(di=!1)}return bt.delete(Y),bt.delete(re),di}function Rc(Y){return of(Y,Rp,El)}function Ao(Y,re){var pe=Y.__data__;return xl(re)?pe[typeof re=="string"?"string":"hash"]:pe.map}function ji(Y,re){var pe=Me(Y,re);return Cp(pe)?pe:void 0}function _l(Y){var re=Ce.call(Y,gt),pe=Y[gt];try{Y[gt]=void 0;var ke=!0}catch{}var er=Ke.call(Y);return ke&&(re?Y[gt]=pe:delete Y[gt]),er}var El=Ye?function(Y){return Y==null?[]:(Y=Object(Y),ye(Ye(Y),function(re){return Ge.call(Y,re)}))}:Xt,ws=ba;(Le&&ws(new Le(new ArrayBuffer(1)))!=y||et&&ws(new et)!=T||it&&ws(it.resolve())!=W||Be&&ws(new Be)!=H||rt&&ws(new rt)!=ie)&&(ws=function(Y){var re=ba(Y),pe=re==F?Y.constructor:void 0,ke=pe?qs(pe):"";if(ke)switch(ke){case qe:return y;case ht:return T;case nt:return W;case je:return H;case st:return ie}return re});function Al(Y,re){return re=re??a,!!re&&(typeof Y=="number"||ae.test(Y))&&Y>-1&&Y%1==0&&Y<re}function xl(Y){var re=typeof Y;return re=="string"||re=="number"||re=="symbol"||re=="boolean"?Y!=="__proto__":Y===null}function Sl(Y){return!!_e&&_e in Y}function Il(Y){var re=Y&&Y.constructor,pe=typeof re=="function"&&re.prototype||Se;return Y===pe}function Op(Y){return Ke.call(Y)}function qs(Y){if(Y!=null){try{return Ue.call(Y)}catch{}try{return Y+""}catch{}}return""}function Ml(Y,re){return Y===re||Y!==Y&&re!==re}var Cl=af(function(){return arguments}())?af:function(Y){return wa(Y)&&Ce.call(Y,"callee")&&!Ge.call(Y,"callee")},Nc=Array.isArray;function Pp(Y){return Y!=null&&Dl(Y.length)&&!Tc(Y)}var cf=Ot||Qt;function $p(Y,re){return ya(Y,re)}function Tc(Y){if(!Ol(Y))return!1;var re=ba(Y);return re==S||re==D||re==l||re==R}function Dl(Y){return typeof Y=="number"&&Y>-1&&Y%1==0&&Y<=a}function Ol(Y){var re=typeof Y;return Y!=null&&(re=="object"||re=="function")}function wa(Y){return Y!=null&&typeof Y=="object"}var Pl=he?Oe(he):bl;function Rp(Y){return Pp(Y)?vl(Y):yl(Y)}function Xt(){return[]}function Qt(){return!1}t.exports=$p})(Xd,Xd.exports);var bD=Xd.exports,yD=Object.defineProperty,o3=Object.getOwnPropertySymbols,wD=Object.prototype.hasOwnProperty,_D=Object.prototype.propertyIsEnumerable,a3=(t,e,r)=>e in t?yD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,fi=(t,e)=>{for(var r in e||(e={}))wD.call(e,r)&&a3(t,r,e[r]);if(o3)for(var r of o3(e))_D.call(e,r)&&a3(t,r,e[r]);return t};function ED(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i<r.length;i++)r[i]=255;for(var n=0;n<t.length;n++){var s=t.charAt(n),a=s.charCodeAt(0);if(r[a]!==255)throw new TypeError(s+" is ambiguous");r[a]=n}var u=t.length,h=t.charAt(0),l=Math.log(u)/Math.log(256),b=Math.log(256)/Math.log(u);function w(D){if(D instanceof Uint8Array||(ArrayBuffer.isView(D)?D=new Uint8Array(D.buffer,D.byteOffset,D.byteLength):Array.isArray(D)&&(D=Uint8Array.from(D))),!(D instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(D.length===0)return"";for(var T=0,q=0,K=0,F=D.length;K!==F&&D[K]===0;)K++,T++;for(var W=(F-K)*b+1>>>0,R=new Uint8Array(W);K!==F;){for(var k=D[K],H=0,_=W-1;(k!==0||H<q)&&_!==-1;_--,H++)k+=256*R[_]>>>0,R[_]=k%u>>>0,k=k/u>>>0;if(k!==0)throw new Error("Non-zero carry");q=H,K++}for(var B=W-q;B!==W&&R[B]===0;)B++;for(var ee=h.repeat(T);B<W;++B)ee+=t.charAt(R[B]);return ee}function I(D){if(typeof D!="string")throw new TypeError("Expected String");if(D.length===0)return new Uint8Array;var T=0;if(D[T]!==" "){for(var q=0,K=0;D[T]===h;)q++,T++;for(var F=(D.length-T)*l+1>>>0,W=new Uint8Array(F);D[T];){var R=r[D.charCodeAt(T)];if(R===255)return;for(var k=0,H=F-1;(R!==0||k<K)&&H!==-1;H--,k++)R+=u*W[H]>>>0,W[H]=R%256>>>0,R=R/256>>>0;if(R!==0)throw new Error("Non-zero carry");K=k,T++}if(D[T]!==" "){for(var _=F-K;_!==F&&W[_]===0;)_++;for(var B=new Uint8Array(q+(F-_)),ee=q;_!==F;)B[ee++]=W[_++];return B}}}function S(D){var T=I(D);if(T)return T;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:I,decode:S}}var AD=ED,xD=AD;const c3=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},SD=t=>new TextEncoder().encode(t),ID=t=>new TextDecoder().decode(t);class MD{constructor(e,r,i){this.name=e,this.prefix=r,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class CD{constructor(e,r,i){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=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 u3(this,e)}}class DD{constructor(e){this.decoders=e}or(e){return u3(this,e)}decode(e){const r=e[0],i=this.decoders[r];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 u3=(t,e)=>new DD(fi(fi({},t.decoders||{[t.prefix]:t}),e.decoders||{[e.prefix]:e}));class OD{constructor(e,r,i,n){this.name=e,this.prefix=r,this.baseEncode=i,this.baseDecode=n,this.encoder=new MD(e,r,i),this.decoder=new CD(e,r,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Rh=({name:t,prefix:e,encode:r,decode:i})=>new OD(t,e,r,i),Ru=({prefix:t,name:e,alphabet:r})=>{const{encode:i,decode:n}=xD(r,e);return Rh({prefix:t,name:e,encode:i,decode:s=>c3(n(s))})},PD=(t,e,r,i)=>{const n={};for(let b=0;b<e.length;++b)n[e[b]]=b;let s=t.length;for(;t[s-1]==="=";)--s;const a=new Uint8Array(s*r/8|0);let u=0,h=0,l=0;for(let b=0;b<s;++b){const w=n[t[b]];if(w===void 0)throw new SyntaxError(`Non-${i} character`);h=h<<r|w,u+=r,u>=8&&(u-=8,a[l++]=255&h>>u)}if(u>=r||255&h<<8-u)throw new SyntaxError("Unexpected end of data");return a},$D=(t,e,r)=>{const i=e[e.length-1]==="=",n=(1<<r)-1;let s="",a=0,u=0;for(let h=0;h<t.length;++h)for(u=u<<8|t[h],a+=8;a>r;)a-=r,s+=e[n&u>>a];if(a&&(s+=e[n&u<<r-a]),i)for(;s.length*r&7;)s+="=";return s},Kr=({name:t,prefix:e,bitsPerChar:r,alphabet:i})=>Rh({prefix:e,name:t,encode(n){return $D(n,i,r)},decode(n){return PD(n,i,r,t)}}),RD=Rh({prefix:"\0",name:"identity",encode:t=>ID(t),decode:t=>SD(t)});var ND=Object.freeze({__proto__:null,identity:RD});const TD=Kr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var LD=Object.freeze({__proto__:null,base2:TD});const BD=Kr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var FD=Object.freeze({__proto__:null,base8:BD});const UD=Ru({prefix:"9",name:"base10",alphabet:"0123456789"});var kD=Object.freeze({__proto__:null,base10:UD});const qD=Kr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),jD=Kr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var zD=Object.freeze({__proto__:null,base16:qD,base16upper:jD});const HD=Kr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),KD=Kr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),WD=Kr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),VD=Kr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),GD=Kr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),JD=Kr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),YD=Kr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),QD=Kr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ZD=Kr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var XD=Object.freeze({__proto__:null,base32:HD,base32upper:KD,base32pad:WD,base32padupper:VD,base32hex:GD,base32hexupper:JD,base32hexpad:YD,base32hexpadupper:QD,base32z:ZD});const eO=Ru({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),tO=Ru({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var rO=Object.freeze({__proto__:null,base36:eO,base36upper:tO});const iO=Ru({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),nO=Ru({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var sO=Object.freeze({__proto__:null,base58btc:iO,base58flickr:nO});const oO=Kr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),aO=Kr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),cO=Kr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),uO=Kr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var fO=Object.freeze({__proto__:null,base64:oO,base64pad:aO,base64url:cO,base64urlpad:uO});const f3=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}"),hO=f3.reduce((t,e,r)=>(t[r]=e,t),[]),lO=f3.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function dO(t){return t.reduce((e,r)=>(e+=hO[r],e),"")}function pO(t){const e=[];for(const r of t){const i=lO[r.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(i)}return new Uint8Array(e)}const gO=Rh({prefix:"\u{1F680}",name:"base256emoji",encode:dO,decode:pO});var vO=Object.freeze({__proto__:null,base256emoji:gO}),mO=l3,h3=128,bO=127,yO=~bO,wO=Math.pow(2,31);function l3(t,e,r){e=e||[],r=r||0;for(var i=r;t>=wO;)e[r++]=t&255|h3,t/=128;for(;t&yO;)e[r++]=t&255|h3,t>>>=7;return e[r]=t|0,l3.bytes=r-i+1,e}var _O=e1,EO=128,d3=127;function e1(t,i){var r=0,i=i||0,n=0,s=i,a,u=t.length;do{if(s>=u)throw e1.bytes=0,new RangeError("Could not decode varint");a=t[s++],r+=n<28?(a&d3)<<n:(a&d3)*Math.pow(2,n),n+=7}while(a>=EO);return e1.bytes=s-i,r}var AO=Math.pow(2,7),xO=Math.pow(2,14),SO=Math.pow(2,21),IO=Math.pow(2,28),MO=Math.pow(2,35),CO=Math.pow(2,42),DO=Math.pow(2,49),OO=Math.pow(2,56),PO=Math.pow(2,63),$O=function(t){return t<AO?1:t<xO?2:t<SO?3:t<IO?4:t<MO?5:t<CO?6:t<DO?7:t<OO?8:t<PO?9:10},RO={encode:mO,decode:_O,encodingLength:$O},p3=RO;const g3=(t,e,r=0)=>(p3.encode(t,e,r),e),v3=t=>p3.encodingLength(t),t1=(t,e)=>{const r=e.byteLength,i=v3(t),n=i+v3(r),s=new Uint8Array(n+r);return g3(t,s,0),g3(r,s,i),s.set(e,n),new NO(t,r,e,s)};class NO{constructor(e,r,i,n){this.code=e,this.size=r,this.digest=i,this.bytes=n}}const m3=({name:t,code:e,encode:r})=>new TO(t,e,r);class TO{constructor(e,r,i){this.name=e,this.code=r,this.encode=i}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?t1(this.code,r):r.then(i=>t1(this.code,i))}else throw Error("Unknown type, must be binary type")}}const b3=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),LO=m3({name:"sha2-256",code:18,encode:b3("SHA-256")}),BO=m3({name:"sha2-512",code:19,encode:b3("SHA-512")});var FO=Object.freeze({__proto__:null,sha256:LO,sha512:BO});const y3=0,UO="identity",w3=c3;var kO=Object.freeze({__proto__:null,identity:{code:y3,name:UO,encode:w3,digest:t=>t1(y3,w3(t))}});new TextEncoder,new TextDecoder;const _3=fi(fi(fi(fi(fi(fi(fi(fi(fi(fi({},ND),LD),FD),kD),zD),XD),rO),sO),fO),vO);fi(fi({},FO),kO);function qO(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function E3(t,e,r,i){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:i}}}const A3=E3("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),r1=E3("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=qO(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),jO=fi({utf8:A3,"utf-8":A3,hex:_3.base16,latin1:r1,ascii:r1,binary:r1},_3);function zO(t,e="utf8"){const r=jO[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):r.decoder.decode(`${r.prefix}${t}`)}const x3="wc",S3=2,i1="core",hs=`${x3}@2:${i1}:`,HO={name:i1,logger:"error"},KO={database:":memory:"},WO="crypto",I3="client_ed25519_seed",VO=xe.ONE_DAY,GO="keychain",JO="0.3",YO="messages",QO="0.3",ZO=xe.SIX_HOURS,XO="publisher",M3="irn",eP="error",C3="wss://relay.walletconnect.org",tP="relayer",hi={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"},rP="_subscription",nn={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},iP=.1,n1="2.16.2",Zt={link_mode:"link_mode",relay:"relay"},nP="0.3",sP="WALLETCONNECT_CLIENT_ID",D3="WALLETCONNECT_LINK_MODE_APPS",ls={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},oP="subscription",aP="0.3",cP=xe.FIVE_SECONDS*1e3,uP="pairing",fP="0.3",Nu={wc_pairingDelete:{req:{ttl:xe.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:xe.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:xe.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:xe.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:xe.ONE_DAY,prompt:!1,tag:0},res:{ttl:xe.ONE_DAY,prompt:!1,tag:0}}},fc={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"},hP="history",lP="0.3",dP="expirer",sn={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},pP="0.3",gP="verify-api",vP="https://verify.walletconnect.com",O3="https://verify.walletconnect.org",Tu=O3,mP=`${Tu}/v3`,bP=[vP,O3],yP="echo",wP="https://echo.walletconnect.com",ds={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"},Bs={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"},Xo={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"},Lu={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"},_P=.1,EP="event-client",AP=86400,xP="https://pulse.walletconnect.com/batch";class SP{constructor(e,r){this.core=e,this.logger=r,this.keychain=new Map,this.name=GO,this.version=JO,this.initialized=!1,this.storagePrefix=hs,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}=Ee("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=ui(r,this.name)}get context(){return Ai(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,W2(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?V2(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=Ee("NOT_INITIALIZED",this.name);throw new Error(e)}}}class IP{constructor(e,r,i){this.core=e,this.logger=r,this.name=WO,this.randomSessionIdentifier=Nd(),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=F2(n);return B2(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const n=oI();return this.setPrivateKey(n.publicKey,n.privateKey)},this.signJWT=async n=>{this.isInitialized();const s=await this.getClientSeed(),a=F2(s),u=this.randomSessionIdentifier;return await zE(u,n,VO,a)},this.generateSharedKey=(n,s,a)=>{this.isInitialized();const u=this.getPrivateKey(n),h=aI(u,s);return this.setSymKey(h,a)},this.setSymKey=async(n,s)=>{this.isInitialized();const a=s||bh(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 u=gb(a),h=Cs(s);if(mb(u))return uI(h,a?.encoding);if(vb(u)){const I=u.senderPublicKey,S=u.receiverPublicKey;n=await this.generateSharedKey(I,S)}const l=this.getSymKey(n),{type:b,senderPublicKey:w}=u;return cI({type:b,symKey:l,message:h,senderPublicKey:w,encoding:a?.encoding})},this.decode=async(n,s,a)=>{this.isInitialized();const u=lI(s,a);if(mb(u)){const h=hI(s,a?.encoding);return jo(h)}if(vb(u)){const h=u.receiverPublicKey,l=u.senderPublicKey;n=await this.generateSharedKey(h,l)}try{const h=this.getSymKey(n),l=fI({symKey:h,encoded:s,encoding:a?.encoding});return jo(l)}catch(h){this.logger.error(`Failed to decode message from topic: '${n}', clientId: '${await this.getClientId()}'`),this.logger.error(h)}},this.getPayloadType=(n,s=ao)=>{const a=Eu({encoded:n,encoding:s});return Go(a.type)},this.getPayloadSenderPublicKey=(n,s=ao)=>{const a=Eu({encoded:n,encoding:s});return a.senderPublicKey?DC(a.senderPublicKey,ai):void 0},this.core=e,this.logger=ui(r,this.name),this.keychain=i||new SP(this.core,this.logger)}get context(){return Ai(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(I3)}catch{e=Nd(),await this.keychain.set(I3,e)}return zO(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=Ee("NOT_INITIALIZED",this.name);throw new Error(e)}}}class MP extends vC{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=YO,this.version=QO,this.initialized=!1,this.storagePrefix=hs,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=Ns(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=Ns(n);return typeof s[a]<"u"},this.del=async i=>{this.isInitialized(),this.messages.delete(i),await this.persist()},this.logger=ui(e,this.name),this.core=r}get context(){return Ai(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,W2(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?V2(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=Ee("NOT_INITIALIZED",this.name);throw new Error(e)}}}class CP extends mC{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new kr.exports.EventEmitter,this.name=XO,this.queue=new Map,this.publishTimeout=xe.toMiliseconds(xe.ONE_MINUTE),this.failedPublishTimeout=xe.toMiliseconds(xe.ONE_SECOND),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 u=s?.ttl||ZO,h=Td(s),l=s?.prompt||!1,b=s?.tag||0,w=s?.id||Qo().toString(),I={topic:i,message:n,opts:{ttl:u,relay:h,prompt:l,tag:b,id:w,attestation:s?.attestation}},S=`Failed to publish payload, please try again. id:${w} tag:${b}`,D=Date.now();let T,q=1;try{for(;T===void 0;){if(Date.now()-D>this.publishTimeout)throw new Error(S);this.logger.trace({id:w,attempts:q},`publisher.publish - attempt ${q}`),T=await await Ga(this.rpcPublish(i,n,u,h,l,b,w,s?.attestation).catch(K=>this.logger.warn(K)),this.publishTimeout,S),q++,T||await new Promise(K=>setTimeout(K,this.failedPublishTimeout))}this.relayer.events.emit(hi.publish,I),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:w,topic:i,message:n,opts:s}})}catch(K){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(K),(a=s?.internal)!=null&&a.throwOnFailedPublish)throw K;this.queue.set(w,I)}},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=ui(r,this.name),this.registerEventListeners()}get context(){return Ai(this.logger)}rpcPublish(e,r,i,n,s,a,u,h){var l,b,w,I;const S={method:Au(n.protocol).publish,params:{topic:e,message:r,ttl:i,prompt:s,tag:a,attestation:h},id:u};return ci((l=S.params)==null?void 0:l.prompt)&&((b=S.params)==null||delete b.prompt),ci((w=S.params)==null?void 0:w.tag)&&((I=S.params)==null||delete I.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:S}),this.relayer.request(S)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:i,opts:n}=e;await this.publish(r,i,n)})}registerEventListeners(){this.relayer.core.heartbeat.on(ac.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(hi.connection_stalled);return}this.checkQueue()}),this.relayer.on(hi.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class DP{constructor(){this.map=new Map,this.set=(e,r)=>{const i=this.get(e);this.exists(e,r)||this.map.set(e,[...i,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const i=this.get(e);if(!this.exists(e,r))return;const n=i.filter(s=>s!==r);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 OP=Object.defineProperty,PP=Object.defineProperties,$P=Object.getOwnPropertyDescriptors,P3=Object.getOwnPropertySymbols,RP=Object.prototype.hasOwnProperty,NP=Object.prototype.propertyIsEnumerable,$3=(t,e,r)=>e in t?OP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Bu=(t,e)=>{for(var r in e||(e={}))RP.call(e,r)&&$3(t,r,e[r]);if(P3)for(var r of P3(e))NP.call(e,r)&&$3(t,r,e[r]);return t},s1=(t,e)=>PP(t,$P(e));class TP extends wC{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new DP,this.events=new kr.exports.EventEmitter,this.name=oP,this.version=aP,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=hs,this.subscribeTimeout=xe.toMiliseconds(xe.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],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=Td(n),a={topic:i,relay:s,transportType:n?.transportType};this.pending.set(i,a);const u=await this.rpcSubscribe(i,s,n?.transportType);return typeof u=="string"&&(this.onSubscribe(u,a),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}})),u}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 u=new xe.Watch;u.start(n);const h=setInterval(()=>{!this.pending.has(i)&&this.topics.includes(i)&&(clearInterval(h),u.stop(n),s(!0)),u.elapsed(n)>=cP&&(clearInterval(h),u.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()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=ui(r,this.name),this.clientId=""}get context(){return Ai(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let i=!1;try{i=this.getSubscription(e).topic===r}catch{}return i}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const i=this.topicMap.get(e);await Promise.all(i.map(async n=>await this.unsubscribeById(e,n,r)))}async unsubscribeById(e,r,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:i}});try{const n=Td(i);await this.rpcUnsubscribe(e,r,n);const s=Gt("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:i}})}catch(n){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(n),n}}async rpcSubscribe(e,r,i=Zt.relay){i===Zt.relay&&await this.restartToComplete();const n={method:Au(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{const s=Ns(e+this.clientId);return i===Zt.link_mode?(setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(n).catch(a=>this.logger.warn(a))},xe.toMiliseconds(xe.ONE_SECOND)),s):await await Ga(this.relayer.request(n).catch(a=>this.logger.warn(a)),this.subscribeTimeout)?s:null}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(hi.connection_stalled)}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,i={method:Au(r.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{return await await Ga(this.relayer.request(i).catch(n=>this.logger.warn(n)),this.subscribeTimeout)}catch{this.relayer.events.emit(hi.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,i={method:Au(r.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 Ga(this.relayer.request(i).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(hi.connection_stalled)}return n}rpcUnsubscribe(e,r,i){const n={method:Au(i.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),this.relayer.request(n)}onSubscribe(e,r){this.setSubscription(e,s1(Bu({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Bu({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,i){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,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,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,Bu({},r)),this.topicMap.set(r.topic,e),this.events.emit(ls.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:i}=Ee("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const i=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(i.topic,e),this.events.emit(ls.deleted,s1(Bu({},i),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(ls.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r<e;r++){const i=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchFetchMessages(i),await this.batchSubscribe(i)}}this.events.emit(ls.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=Ee("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);as(r)&&this.onBatchSubscribe(r.map((i,n)=>s1(Bu({},e[n]),{id:i})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(ac.pulse,async()=>{await this.checkPending()}),this.events.on(ls.created,async e=>{const r=ls.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(ls.deleted,async e=>{const r=ls.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=Ee("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var LP=Object.defineProperty,R3=Object.getOwnPropertySymbols,BP=Object.prototype.hasOwnProperty,FP=Object.prototype.propertyIsEnumerable,N3=(t,e,r)=>e in t?LP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,UP=(t,e)=>{for(var r in e||(e={}))BP.call(e,r)&&N3(t,r,e[r]);if(R3)for(var r of R3(e))FP.call(e,r)&&N3(t,r,e[r]);return t};class kP extends bC{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new kr.exports.EventEmitter,this.name=tP,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=xe.toMiliseconds(xe.THIRTY_SECONDS+xe.ONE_SECOND),this.request=async r=>{var i,n;this.logger.debug("Publishing Request Payload");const s=r.id||Qo().toString();await this.toEstablishConnection();try{const a=this.provider.request(r);this.requestsInFlight.set(s,{promise:a,request:r}),this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - attempt to publish...");const u=await new Promise(async(h,l)=>{const b=()=>{l(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(nn.disconnect,b);const w=await a;this.provider.off(nn.disconnect,b),h(w)});return this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - published"),u}catch(a){throw this.logger.debug(`Failed to Publish Request: ${s}`),a}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(th())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,i,n;(n=(i=(r=this.provider)==null?void 0:r.connection)==null?void 0:i.socket)==null||n.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(hi.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(hi.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(nn.payload,this.onPayloadHandler),this.provider.on(nn.connect,this.onConnectHandler),this.provider.on(nn.disconnect,this.onDisconnectHandler),this.provider.on(nn.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?ui(e.logger,this.name):cs(Dh({level:e.logger||eP})),this.messages=new MP(this.logger,e.core),this.subscriber=new TP(this,this.logger),this.publisher=new CP(this,this.logger),this.relayUrl=e?.relayUrl||C3,this.projectId=e.projectId,this.bundleId=QE(),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)}}get context(){return Ai(this.logger)}get connected(){var e,r,i;return((i=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:i.readyState)===1}get connecting(){var e,r,i;return((i=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:i.readyState)===0}async publish(e,r,i){this.isInitialized(),await this.publisher.publish(e,r,i),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:Zt.relay})}async subscribe(e,r){var i;this.isInitialized(),r?.transportType==="relay"&&await this.toEstablishConnection();let n=((i=this.subscriber.topicMap.get(e))==null?void 0:i[0])||"",s;const a=u=>{u.topic===e&&(this.subscriber.off(ls.created,a),s())};return await Promise.all([new Promise(u=>{s=u,this.subscriber.on(ls.created,a)}),new Promise(async u=>{n=await this.subscriber.subscribe(e,r)||n,u()})]),n}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.hasExperiencedNetworkDisruption||this.connected?await Ga(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,i)=>{const n=()=>{this.provider.off(nn.disconnect,n),i(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(nn.disconnect,n),await Ga(this.provider.connect(),xe.toMiliseconds(xe.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{i(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const i=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(i.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Db())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 r=e.sort((i,n)=>i.publishedAt-n.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const i of r)try{await this.onMessageEvent(i)}catch(n){this.logger.warn(n)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:i}=e;if(!r.sessionExists){const n=Ir(xe.FIVE_MINUTES),s={topic:i,expiry:n,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(i,s)}this.events.emit(hi.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,i,n,s;if(th())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(n=(i=this.provider)==null?void 0:i.connection)==null?void 0:n.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(a){this.logger.warn(a)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new xn(new mD(tA({sdkVersion:n1,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:i}=e;await this.messages.set(r,i)}async shouldIgnoreMessageEvent(e){const{topic:r,message:i}=e;if(!i||i.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${i}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const n=this.messages.has(r,i);return n&&this.logger.debug(`Ignoring duplicate message: ${i}`),n}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),Zd(e)){if(!e.method.endsWith(rP))return;const r=e.params,{topic:i,message:n,publishedAt:s,attestation:a}=r.data,u={topic:i,message:n,publishedAt:s,transportType:Zt.relay,attestation:a};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(UP({type:"event",event:r.id},u)),this.events.emit(r.id,u),await this.acknowledgePayload(e),await this.onMessageEvent(u)}else $h(e)&&this.events.emit(hi.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(hi.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=Oh(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(nn.payload,this.onPayloadHandler),this.provider.off(nn.connect,this.onConnectHandler),this.provider.off(nn.disconnect,this.onDisconnectHandler),this.provider.off(nn.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await Db();oM(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(i=>this.logger.error(i)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(hi.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},xe.toMiliseconds(iP))))}isInitialized(){if(!this.initialized){const{message:e}=Ee("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var qP=Object.defineProperty,T3=Object.getOwnPropertySymbols,jP=Object.prototype.hasOwnProperty,zP=Object.prototype.propertyIsEnumerable,L3=(t,e,r)=>e in t?qP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,B3=(t,e)=>{for(var r in e||(e={}))jP.call(e,r)&&L3(t,r,e[r]);if(T3)for(var r of T3(e))zP.call(e,r)&&L3(t,r,e[r]);return t};class ea extends yC{constructor(e,r,i,n=hs,s=void 0){super(e,r,i,n),this.core=e,this.logger=r,this.name=i,this.map=new Map,this.version=nP,this.cached=[],this.initialized=!1,this.storagePrefix=hs,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(a=>{this.getKey&&a!==null&&!ci(a)?this.map.set(this.getKey(a),a):BI(a)?this.map.set(a.id,a):FI(a)&&this.map.set(a.topic,a)}),this.cached=[],this.initialized=!0)},this.set=async(a,u)=>{this.isInitialized(),this.map.has(a)?await this.update(a,u):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:a,value:u}),this.map.set(a,u),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(u=>Object.keys(a).every(h=>bD(u[h],a[h]))):this.values),this.update=async(a,u)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:a,update:u});const h=B3(B3({},this.getData(a)),u);this.map.set(a,h),await this.persist()},this.delete=async(a,u)=>{this.isInitialized(),this.map.has(a)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:a,reason:u}),this.map.delete(a),this.addToRecentlyDeleted(a),await this.persist())},this.logger=ui(r,this.name),this.storagePrefix=n,this.getKey=s}get context(){return Ai(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:n}=Ee("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}const{message:i}=Ee("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=Ee("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=Ee("NOT_INITIALIZED",this.name);throw new Error(e)}}}class HP{constructor(e,r){this.core=e,this.logger=r,this.name=uP,this.version=fP,this.events=new kr.exports,this.initialized=!1,this.storagePrefix=hs,this.ignoredPayloadTypes=[Rs],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=Nd(),s=await this.core.crypto.setSymKey(n),a=Ir(xe.FIVE_MINUTES),u={protocol:M3},h={topic:s,expiry:a,relay:u,active:!1},l=MI({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:n,relay:u,expiryTimestamp:a,methods:i?.methods});return this.core.expirer.set(s,a),await this.pairings.set(s,h),await this.core.relayer.subscribe(s,{transportType:i?.transportType}),{topic:s,uri:l}},this.pair=async i=>{this.isInitialized();const n=this.core.eventClient.createEvent({properties:{topic:i?.uri,trace:[ds.pairing_started]}});this.isValidPair(i,n);const{topic:s,symKey:a,relay:u,expiryTimestamp:h,methods:l}=_b(i.uri);n.props.properties.topic=s,n.addTrace(ds.pairing_uri_validation_success),n.addTrace(ds.pairing_uri_not_expired);let b;if(this.pairings.keys.includes(s)){if(b=this.pairings.get(s),n.addTrace(ds.existing_pairing),b.active)throw n.setError(Bs.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);n.addTrace(ds.pairing_not_expired)}const w=h||Ir(xe.FIVE_MINUTES),I={topic:s,relay:u,expiry:w,active:!1,methods:l};this.core.expirer.set(s,w),await this.pairings.set(s,I),n.addTrace(ds.store_new_pairing),i.activatePairing&&await this.activate({topic:s}),this.events.emit(fc.create,I),n.addTrace(ds.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(a,s),n.addTrace(ds.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{n.setError(Bs.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:u})}catch(S){throw n.setError(Bs.subscribe_pairing_topic_failure),S}return n.addTrace(ds.subscribe_pairing_topic_success),I},this.activate=async({topic:i})=>{this.isInitialized();const n=Ir(xe.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:u,reject:h}=Ho();this.events.once(Dt("pairing_ping",s),({error:l})=>{l?h(l):u()}),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.sendRequest=async(i,n,s)=>{const a=uo(n,s),u=await this.core.crypto.encode(i,a),h=Nu[n].req;return this.core.history.set(i,a),this.core.relayer.publish(i,u,h),a.id},this.sendResult=async(i,n,s)=>{const a=Oh(i,s),u=await this.core.crypto.encode(n,a),h=await this.core.history.get(n,i),l=Nu[h.request.method].res;await this.core.relayer.publish(n,u,l),await this.core.history.resolve(a)},this.sendError=async(i,n,s)=>{const a=Ph(i,s),u=await this.core.crypto.encode(n,a),h=await this.core.history.get(n,i),l=Nu[h.request.method]?Nu[h.request.method].res:Nu.unregistered_method.res;await this.core.relayer.publish(n,u,l),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=>io(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(fc.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(()=>{fs(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(fc.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 u=Gt("WC_METHOD_UNSUPPORTED",a);await this.sendError(s,i,u),this.logger.error(u)}catch(u){await this.sendError(s,i,u),this.logger.error(u)}},this.onUnknownRpcMethodResponse=i=>{this.registeredMethods.includes(i)||this.logger.error(Gt("WC_METHOD_UNSUPPORTED",i))},this.isValidPair=(i,n)=>{var s;if(!_i(i)){const{message:u}=Ee("MISSING_OR_INVALID",`pair() params: ${i}`);throw n.setError(Bs.malformed_pairing_uri),new Error(u)}if(!LI(i.uri)){const{message:u}=Ee("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw n.setError(Bs.malformed_pairing_uri),new Error(u)}const a=_b(i?.uri);if(!((s=a?.relay)!=null&&s.protocol)){const{message:u}=Ee("MISSING_OR_INVALID","pair() uri#relay-protocol");throw n.setError(Bs.malformed_pairing_uri),new Error(u)}if(!(a!=null&&a.symKey)){const{message:u}=Ee("MISSING_OR_INVALID","pair() uri#symKey");throw n.setError(Bs.malformed_pairing_uri),new Error(u)}if(a!=null&&a.expiryTimestamp&&xe.toMiliseconds(a?.expiryTimestamp)<Date.now()){n.setError(Bs.pairing_expired);const{message:u}=Ee("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(u)}},this.isValidPing=async i=>{if(!_i(i)){const{message:s}=Ee("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(s)}const{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidDisconnect=async i=>{if(!_i(i)){const{message:s}=Ee("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(s)}const{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidPairingTopic=async i=>{if(!yr(i,!1)){const{message:n}=Ee("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(n)}if(!this.pairings.keys.includes(i)){const{message:n}=Ee("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(n)}if(io(this.pairings.get(i).expiry)){await this.deletePairing(i);const{message:n}=Ee("EXPIRED",`pairing topic: ${i}`);throw new Error(n)}},this.core=e,this.logger=ui(r,this.name),this.pairings=new ea(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Ai(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=Ee("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(hi.message,async e=>{const{topic:r,message:i,transportType:n}=e;if(!this.pairings.keys.includes(r)||n===Zt.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))return;const s=await this.core.crypto.decode(r,i);try{Zd(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):$h(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(a){this.logger.error(a)}})}registerExpirerEvents(){this.core.expirer.on(sn.expired,async e=>{const{topic:r}=J2(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(fc.expire,{topic:r}))})}}class KP extends gC{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new kr.exports.EventEmitter,this.name=hP,this.version=lP,this.cached=[],this.initialized=!1,this.storagePrefix=hs,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(xe.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=ui(r,this.name)}get context(){return Ai(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const i={topic:r.topic,request:uo(r.request.method,r.request.params,r.id),chainId:r.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 r=this.records.get(e);if(!r){const{message:i}=Ee("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return r}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:r}=Ee("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Sn.created,e=>{const r=Sn.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Sn.updated,e=>{const r=Sn.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Sn.deleted,e=>{const r=Sn.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(ac.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{xe.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(Sn.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=Ee("NOT_INITIALIZED",this.name);throw new Error(e)}}}class WP extends _C{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new kr.exports.EventEmitter,this.name=dP,this.version=pP,this.cached=[],this.initialized=!1,this.storagePrefix=hs,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(sn.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(sn.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=ui(r,this.name)}get context(){return Ai(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 rA(e);if(typeof e=="number")return iA(e);const{message:r}=Ee("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(sn.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=Ee("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:i}=Ee("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(i),new Error(i)}return r}checkExpiry(e,r){const{expiry:i}=r;xe.toMiliseconds(i)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(sn.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(ac.pulse,()=>this.checkExpirations()),this.events.on(sn.created,e=>{const r=sn.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(sn.expired,e=>{const r=sn.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(sn.deleted,e=>{const r=sn.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=Ee("NOT_INITIALIZED",this.name);throw new Error(e)}}}var or={};Object.defineProperty(or,"__esModule",{value:!0}),or.getLocalStorage=or.getLocalStorageOrThrow=or.getCrypto=or.getCryptoOrThrow=or.getLocation=or.getLocationOrThrow=or.getNavigator=or.getNavigatorOrThrow=F3=or.getDocument=or.getDocumentOrThrow=or.getFromWindowOrThrow=or.getFromWindow=void 0;function ta(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}or.getFromWindow=ta;function hc(t){const e=ta(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}or.getFromWindowOrThrow=hc;function VP(){return hc("document")}or.getDocumentOrThrow=VP;function GP(){return ta("document")}var F3=or.getDocument=GP;function JP(){return hc("navigator")}or.getNavigatorOrThrow=JP;function YP(){return ta("navigator")}or.getNavigator=YP;function QP(){return hc("location")}or.getLocationOrThrow=QP;function ZP(){return ta("location")}or.getLocation=ZP;function XP(){return hc("crypto")}or.getCryptoOrThrow=XP;function e$(){return ta("crypto")}or.getCrypto=e$;function t$(){return hc("localStorage")}or.getLocalStorageOrThrow=t$;function r$(){return ta("localStorage")}or.getLocalStorage=r$;class i$ extends EC{constructor(e,r,i){super(e,r,i),this.core=e,this.logger=r,this.store=i,this.name=gP,this.verifyUrlV3=mP,this.storagePrefix=hs,this.version=S3,this.init=async()=>{var n;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&xe.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(!au()||this.isDevEnv)return;const s=window.location.origin,{id:a,decryptedId:u}=n,h=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${a}&decryptedId=${u}`;try{const l=F3(),b=this.startAbortTimer(xe.ONE_SECOND*5),w=await new Promise((I,S)=>{const D=()=>{window.removeEventListener("message",q),l.body.removeChild(T),S("attestation aborted")};this.abortController.signal.addEventListener("abort",D);const T=l.createElement("iframe");T.src=h,T.style.display="none",T.addEventListener("error",D,{signal:this.abortController.signal});const q=K=>{if(!K.data)return;const F=JSON.parse(K.data);if(F.type==="verify_attestation"){if(od(F.attestation).payload.id!==a)return;clearInterval(b),l.body.removeChild(T),this.abortController.signal.removeEventListener("abort",D),window.removeEventListener("message",q),I(F.attestation===null?"":F.attestation)}};l.body.appendChild(T),window.addEventListener("message",q,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",w),w}catch(l){this.logger.warn(l)}return""},this.resolve=async n=>{if(this.isDevEnv)return"";const{attestationId:s,hash:a,encryptedId:u}=n;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(od(s).payload.id!==u)return;const l=await this.isValidJwtAttestation(s);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}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(xe.ONE_SECOND*5),u=await fetch(`${s}/attestation/${n}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(a),u.status===200?await u.json():void 0},this.getVerifyUrl=n=>{let s=n||Tu;return bP.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Tu}`),s=Tu),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const n=this.startAbortTimer(xe.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(u){this.logger.error(u),this.logger.warn("error validating attestation")}const a=await this.fetchAndPersistPublicKey();try{if(a)return this.validateAttestation(n,a)}catch(u){this.logger.error(u),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=vI(n,s.publicKey),u={hasExpired:xe.toMiliseconds(a.exp)<Date.now(),payload:a};if(u.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:u.payload.origin,isScam:u.payload.isScam,isVerified:u.payload.isVerified}},this.logger=ui(r,this.name),this.abortController=new AbortController,this.isDevEnv=ad(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return Ai(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),xe.toMiliseconds(e))}}class n$ extends AC{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=yP,this.registerDeviceToken=async i=>{const{clientId:n,token:s,notificationType:a,enableEncrypted:u=!1}=i,h=`${wP}/${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:u})})},this.logger=ui(r,this.context)}}var s$=Object.defineProperty,U3=Object.getOwnPropertySymbols,o$=Object.prototype.hasOwnProperty,a$=Object.prototype.propertyIsEnumerable,k3=(t,e,r)=>e in t?s$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Fu=(t,e)=>{for(var r in e||(e={}))o$.call(e,r)&&k3(t,r,e[r]);if(U3)for(var r of U3(e))a$.call(e,r)&&k3(t,r,e[r]);return t};class c$ extends xC{constructor(e,r,i=!0){super(e,r,i),this.core=e,this.logger=r,this.context=EP,this.storagePrefix=hs,this.storageVersion=_P,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!ad())try{const n={eventId:Q2(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:K2(this.core.relayer.protocol,this.core.relayer.version,n1)}}};await this.sendEvent([n])}catch(n){this.logger.warn(n)}},this.createEvent=n=>{const{event:s="ERROR",type:a="",properties:{topic:u,trace:h}}=n,l=Q2(),b=this.core.projectId||"",w=Date.now(),I=Fu({eventId:l,timestamp:w,props:{event:s,type:a,properties:{topic:u,trace:h}},bundleId:b,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,I),this.shouldPersist=!0),I},this.getEvent=n=>{const{eventId:s,topic:a}=n;if(s)return this.events.get(s);const u=Array.from(this.events.values()).find(h=>h.props.properties.topic===a);if(u)return Fu(Fu({},u),this.setMethods(u.eventId))},this.deleteEvent=n=>{const{eventId:s}=n;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(ac.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(n=>{xe.fromMiliseconds(Date.now())-xe.fromMiliseconds(n.timestamp)>AP&&(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,Fu(Fu({},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(`${xP}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${n1}${s}`,{method:"POST",body:JSON.stringify(n)})},this.getAppDomain=()=>H2().url,this.logger=ui(r,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 u$=Object.defineProperty,q3=Object.getOwnPropertySymbols,f$=Object.prototype.hasOwnProperty,h$=Object.prototype.propertyIsEnumerable,j3=(t,e,r)=>e in t?u$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,z3=(t,e)=>{for(var r in e||(e={}))f$.call(e,r)&&j3(t,r,e[r]);if(q3)for(var r of q3(e))h$.call(e,r)&&j3(t,r,e[r]);return t};class o1 extends pC{constructor(e){var r;super(e),this.protocol=x3,this.version=S3,this.name=i1,this.events=new kr.exports.EventEmitter,this.initialized=!1,this.on=(a,u)=>this.events.on(a,u),this.once=(a,u)=>this.events.once(a,u),this.off=(a,u)=>this.events.off(a,u),this.removeListener=(a,u)=>this.events.removeListener(a,u),this.dispatchEnvelope=({topic:a,message:u,sessionExists:h})=>{if(!a||!u)return;const l={topic:a,message:u,publishedAt:Date.now(),transportType:Zt.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:h})},this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||C3,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const i=Dh({level:typeof e?.logger=="string"&&e.logger?e.logger:HO.logger}),{logger:n,chunkLoggerController:s}=dC({opts:i,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var a,u;(a=this.logChunkController)!=null&&a.downloadLogsBlobInBrowser&&((u=this.logChunkController)==null||u.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ui(n,this.name),this.heartbeat=new zd,this.crypto=new IP(this,this.logger,e?.keychain),this.history=new KP(this,this.logger),this.expirer=new WP(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new FM(z3(z3({},KO),e?.storageOptions)),this.relayer=new kP({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new HP(this,this.logger),this.verify=new i$(this,this.logger,this.storage),this.echoClient=new n$(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new c$(this,this.logger,e?.telemetryEnabled)}static async init(e){const r=new o1(e);await r.initialize();const i=await r.crypto.getClientId();return await r.storage.setItem(sP,i),r}get context(){return Ai(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(D3,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.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(D3)||[],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 l$=o1,H3="wc",K3=2,W3="client",a1=`${H3}@${K3}:${W3}:`,c1={name:W3,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},V3="WALLETCONNECT_DEEPLINK_CHOICE",d$="proposal",G3="Proposal expired",p$="session",lc=xe.SEVEN_DAYS,g$="engine",Lr={wc_sessionPropose:{req:{ttl:xe.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:xe.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:xe.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:xe.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:xe.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:xe.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:xe.ONE_DAY,prompt:!1,tag:1104},res:{ttl:xe.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:xe.ONE_DAY,prompt:!1,tag:1106},res:{ttl:xe.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:xe.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:xe.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:xe.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:xe.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:xe.ONE_DAY,prompt:!1,tag:1112},res:{ttl:xe.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:xe.ONE_DAY,prompt:!1,tag:1114},res:{ttl:xe.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:xe.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:xe.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:xe.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:xe.FIVE_MINUTES,prompt:!1,tag:1119}}},u1={min:xe.FIVE_MINUTES,max:xe.SEVEN_DAYS},ps={idle:"IDLE",active:"ACTIVE"},v$="request",m$=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],b$="wc",y$="auth",w$="authKeys",_$="pairingTopics",E$="requests",Nh=`${b$}@${1.5}:${y$}:`,Th=`${Nh}:PUB_KEY`;var A$=Object.defineProperty,x$=Object.defineProperties,S$=Object.getOwnPropertyDescriptors,J3=Object.getOwnPropertySymbols,I$=Object.prototype.hasOwnProperty,M$=Object.prototype.propertyIsEnumerable,Y3=(t,e,r)=>e in t?A$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,pr=(t,e)=>{for(var r in e||(e={}))I$.call(e,r)&&Y3(t,r,e[r]);if(J3)for(var r of J3(e))M$.call(e,r)&&Y3(t,r,e[r]);return t},Mn=(t,e)=>x$(t,S$(e));class C$ extends IC{constructor(e){super(e),this.name=g$,this.events=new kr.exports,this.initialized=!1,this.requestQueue={state:ps.idle,queue:[]},this.sessionRequestQueue={state:ps.idle,queue:[]},this.requestQueueDelay=xe.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(Lr)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},xe.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const i=Mn(pr({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(i);const{pairingTopic:n,requiredNamespaces:s,optionalNamespaces:a,sessionProperties:u,relays:h}=i;let l=n,b,w=!1;try{l&&(w=this.client.core.pairing.pairings.get(l).active)}catch(R){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),R}if(!l||!w){const{topic:R,uri:k}=await this.client.core.pairing.create();l=R,b=k}if(!l){const{message:R}=Ee("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(R)}const I=await this.client.core.crypto.generateKeyPair(),S=Lr.wc_sessionPropose.req.ttl||xe.FIVE_MINUTES,D=Ir(S),T=pr({requiredNamespaces:s,optionalNamespaces:a,relays:h??[{protocol:M3}],proposer:{publicKey:I,metadata:this.client.metadata},expiryTimestamp:D,pairingTopic:l},u&&{sessionProperties:u}),{reject:q,resolve:K,done:F}=Ho(S,G3);this.events.once(Dt("session_connect"),async({error:R,session:k})=>{if(R)q(R);else if(k){k.self.publicKey=I;const H=Mn(pr({},k),{pairingTopic:T.pairingTopic,requiredNamespaces:T.requiredNamespaces,optionalNamespaces:T.optionalNamespaces,transportType:Zt.relay});await this.client.session.set(k.topic,H),await this.setExpiry(k.topic,k.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:k.peer.metadata}),this.cleanupDuplicatePairings(H),K(H)}});const W=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:T,throwOnFailedPublish:!0});return await this.setProposal(W,pr({id:W},T)),{uri:b,approval:F}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(i){throw this.client.logger.error("pair() failed"),i}},this.approve=async r=>{var i,n,s;const a=this.client.core.eventClient.createEvent({properties:{topic:(i=r?.id)==null?void 0:i.toString(),trace:[In.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(B){throw a.setError(Zo.no_internet_connection),B}try{await this.isValidProposalId(r?.id)}catch(B){throw this.client.logger.error(`approve() -> proposal.get(${r?.id}) failed`),a.setError(Zo.proposal_not_found),B}try{await this.isValidApprove(r)}catch(B){throw this.client.logger.error("approve() -> isValidApprove() failed"),a.setError(Zo.session_approve_namespace_validation_failure),B}const{id:u,relayProtocol:h,namespaces:l,sessionProperties:b,sessionConfig:w}=r,I=this.client.proposal.get(u);this.client.core.eventClient.deleteEvent({eventId:a.eventId});const{pairingTopic:S,proposer:D,requiredNamespaces:T,optionalNamespaces:q}=I;let K=(n=this.client.core.eventClient)==null?void 0:n.getEvent({topic:S});K||(K=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:In.session_approve_started,properties:{topic:S,trace:[In.session_approve_started,In.session_namespaces_validation_success]}}));const F=await this.client.core.crypto.generateKeyPair(),W=D.publicKey,R=await this.client.core.crypto.generateSharedKey(F,W),k=pr(pr({relay:{protocol:h??"irn"},namespaces:l,controller:{publicKey:F,metadata:this.client.metadata},expiry:Ir(lc)},b&&{sessionProperties:b}),w&&{sessionConfig:w}),H=Zt.relay;K.addTrace(In.subscribing_session_topic);try{await this.client.core.relayer.subscribe(R,{transportType:H})}catch(B){throw K.setError(Zo.subscribe_session_topic_failure),B}K.addTrace(In.subscribe_session_topic_success);const _=Mn(pr({},k),{topic:R,requiredNamespaces:T,optionalNamespaces:q,pairingTopic:S,acknowledged:!1,self:k.controller,peer:{publicKey:D.publicKey,metadata:D.metadata},controller:F,transportType:Zt.relay});await this.client.session.set(R,_),K.addTrace(In.store_session);try{K.addTrace(In.publishing_session_settle),await this.sendRequest({topic:R,method:"wc_sessionSettle",params:k,throwOnFailedPublish:!0}).catch(B=>{throw K?.setError(Zo.session_settle_publish_failure),B}),K.addTrace(In.session_settle_publish_success),K.addTrace(In.publishing_session_approve),await this.sendResult({id:u,topic:S,result:{relay:{protocol:h??"irn"},responderPublicKey:F},throwOnFailedPublish:!0}).catch(B=>{throw K?.setError(Zo.session_approve_publish_failure),B}),K.addTrace(In.session_approve_publish_success)}catch(B){throw this.client.logger.error(B),this.client.session.delete(R,Gt("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(R),B}return this.client.core.eventClient.deleteEvent({eventId:K.eventId}),await this.client.core.pairing.updateMetadata({topic:S,metadata:D.metadata}),await this.client.proposal.delete(u,Gt("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:S}),await this.setExpiry(R,Ir(lc)),{topic:R,acknowledged:()=>Promise.resolve(this.client.session.get(R))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(a){throw this.client.logger.error("reject() -> isValidReject() failed"),a}const{id:i,reason:n}=r;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:Lr.wc_sessionPropose.reject}),await this.client.proposal.delete(i,Gt("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(w){throw this.client.logger.error("update() -> isValidUpdate() failed"),w}const{topic:i,namespaces:n}=r,{done:s,resolve:a,reject:u}=Ho(),h=co(),l=Qo().toString(),b=this.client.session.get(i).namespaces;return this.events.once(Dt("session_update",h),({error:w})=>{w?u(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:l}).catch(w=>{this.client.logger.error(w),this.client.session.update(i,{namespaces:b}),u(w)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(h){throw this.client.logger.error("extend() -> isValidExtend() failed"),h}const{topic:i}=r,n=co(),{done:s,resolve:a,reject:u}=Ho();return this.events.once(Dt("session_extend",n),({error:h})=>{h?u(h):a()}),await this.setExpiry(i,Ir(lc)),this.sendRequest({topic:i,method:"wc_sessionExtend",params:{},clientRpcId:n,throwOnFailedPublish:!0}).catch(h=>{u(h)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(D){throw this.client.logger.error("request() -> isValidRequest() failed"),D}const{chainId:i,request:n,topic:s,expiry:a=Lr.wc_sessionRequest.req.ttl}=r,u=this.client.session.get(s);u?.transportType===Zt.relay&&await this.confirmOnlineStateOrThrow();const h=co(),l=Qo().toString(),{done:b,resolve:w,reject:I}=Ho(a,"Request expired. Please try again.");this.events.once(Dt("session_request",h),({error:D,result:T})=>{D?I(D):w(T)});const S=this.getAppLinkIfEnabled(u.peer.metadata,u.transportType);return S?(await this.sendRequest({clientRpcId:h,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:Mn(pr({},n),{expiryTimestamp:Ir(a)}),chainId:i},expiry:a,throwOnFailedPublish:!0,appLink:S}).catch(D=>I(D)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:i,id:h}),await b()):await Promise.all([new Promise(async D=>{await this.sendRequest({clientRpcId:h,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:Mn(pr({},n),{expiryTimestamp:Ir(a)}),chainId:i},expiry:a,throwOnFailedPublish:!0}).catch(T=>I(T)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:i,id:h}),D()}),new Promise(async D=>{var T;if(!((T=u.sessionConfig)!=null&&T.disableDeepLink)){const q=await sA(this.client.core.storage,V3);nA({id:h,topic:s,wcDeepLink:q})}D()}),b()]).then(D=>D[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:i,response:n}=r,{id:s}=n,a=this.client.session.get(i);a.transportType===Zt.relay&&await this.confirmOnlineStateOrThrow();const u=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);fs(n)?await this.sendResult({id:s,topic:i,result:n.result,throwOnFailedPublish:!0,appLink:u}):rn(n)&&await this.sendError({id:s,topic:i,error:n.error,appLink:u}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(n){throw this.client.logger.error("ping() -> isValidPing() failed"),n}const{topic:i}=r;if(this.client.session.keys.includes(i)){const n=co(),s=Qo().toString(),{done:a,resolve:u,reject:h}=Ho();this.events.once(Dt("session_ping",n),({error:l})=>{l?h(l):u()}),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 r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:i,event:n,chainId:s}=r,a=Qo().toString();await this.sendRequest({topic:i,method:"wc_sessionEvent",params:{event:n,chainId:s},throwOnFailedPublish:!0,relayRpcId:a})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:i}=r;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}=Ee("MISMATCHED_TOPIC",`Session or pairing topic not found: ${i}`);throw new Error(n)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(i=>NI(i,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,i)=>{var n;this.isInitialized(),this.isValidAuthenticate(r);const s=i&&this.client.core.linkModeSupportedApps.includes(i)&&((n=this.client.metadata.redirect)==null?void 0:n.linkMode),a=s?Zt.link_mode:Zt.relay;a===Zt.relay&&await this.confirmOnlineStateOrThrow();const{chains:u,statement:h="",uri:l,domain:b,nonce:w,type:I,exp:S,nbf:D,methods:T=[],expiry:q}=r,K=[...r.resources||[]],{topic:F,uri:W}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:a});this.client.logger.info({message:"Generated new pairing",pairing:{topic:F,uri:W}});const R=await this.client.core.crypto.generateKeyPair(),k=bh(R);if(await Promise.all([this.client.auth.authKeys.set(Th,{responseTopic:k,publicKey:R}),this.client.auth.pairingTopics.set(k,{topic:k,pairingTopic:F})]),await this.client.core.relayer.subscribe(k,{transportType:a}),this.client.logger.info(`sending request to new pairing topic: ${F}`),T.length>0){const{namespace:O}=ou(u[0]);let M=eI(O,"request",T);mh(K)&&(M=rI(M,K.pop())),K.push(M)}const H=q&&q>Lr.wc_sessionAuthenticate.req.ttl?q:Lr.wc_sessionAuthenticate.req.ttl,_={authPayload:{type:I??"caip122",chains:u,statement:h,aud:l,domain:b,version:"1",nonce:w,iat:new Date().toISOString(),exp:S,nbf:D,resources:K},requester:{publicKey:R,metadata:this.client.metadata},expiryTimestamp:Ir(H)},B={eip155:{chains:u,methods:[...new Set(["personal_sign",...T])],events:["chainChanged","accountsChanged"]}},ee={requiredNamespaces:{},optionalNamespaces:B,relays:[{protocol:"irn"}],pairingTopic:F,proposer:{publicKey:R,metadata:this.client.metadata},expiryTimestamp:Ir(Lr.wc_sessionPropose.req.ttl)},{done:ie,resolve:L,reject:y}=Ho(H,"Request expired"),f=async({error:O,session:M})=>{if(this.events.off(Dt("session_request",v),d),O)y(O);else if(M){M.self.publicKey=R,await this.client.session.set(M.topic,M),await this.setExpiry(M.topic,M.expiry),F&&await this.client.core.pairing.updateMetadata({topic:F,metadata:M.peer.metadata});const g=this.client.session.get(M.topic);await this.deleteProposal(E),L({session:g})}},d=async O=>{var M,g,m;if(await this.deletePendingAuthRequest(v,{message:"fulfilled",code:0}),O.error){const G=Gt("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return O.error.code===G.code?void 0:(this.events.off(Dt("session_connect"),f),y(O.error.message))}await this.deleteProposal(E),this.events.off(Dt("session_connect"),f);const{cacaos:N,responder:X}=O.result,ae=[],P=[];for(const G of N){await sb({cacao:G,projectId:this.client.core.projectId})||(this.client.logger.error(G,"Signature verification failed"),y(Gt("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:J}=G,A=mh(J.resources),V=[nb(J.iss)],oe=vh(J.iss);if(A){const ue=cb(A),he=ub(A);ae.push(...ue),V.push(...he)}for(const ue of V)P.push(`${ue}:${oe}`)}const te=await this.client.core.crypto.generateSharedKey(R,X.publicKey);let z;ae.length>0&&(z={topic:te,acknowledged:!0,self:{publicKey:R,metadata:this.client.metadata},peer:X,controller:X.publicKey,expiry:Ir(lc),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:F,namespaces:Eb([...new Set(ae)],[...new Set(P)]),transportType:a},await this.client.core.relayer.subscribe(te,{transportType:a}),await this.client.session.set(te,z),F&&await this.client.core.pairing.updateMetadata({topic:F,metadata:X.metadata}),z=this.client.session.get(te)),(M=this.client.metadata.redirect)!=null&&M.linkMode&&(g=X.metadata.redirect)!=null&&g.linkMode&&(m=X.metadata.redirect)!=null&&m.universal&&i&&(this.client.core.addLinkModeSupportedApp(X.metadata.redirect.universal),this.client.session.update(te,{transportType:Zt.link_mode})),L({auths:N,session:z})},v=co(),E=co();this.events.once(Dt("session_connect"),f),this.events.once(Dt("session_request",v),d);let C;try{if(s){const O=uo("wc_sessionAuthenticate",_,v);this.client.core.history.set(F,O);const M=await this.client.core.crypto.encode("",O,{type:wu,encoding:bu});C=yh(i,F,M)}else await Promise.all([this.sendRequest({topic:F,method:"wc_sessionAuthenticate",params:_,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:v}),this.sendRequest({topic:F,method:"wc_sessionPropose",params:ee,expiry:Lr.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:E})])}catch(O){throw this.events.off(Dt("session_connect"),f),this.events.off(Dt("session_request",v),d),O}return await this.setProposal(E,pr({id:E},ee)),await this.setAuthRequest(v,{request:Mn(pr({},_),{verifyContext:{}}),pairingTopic:F,transportType:a}),{uri:C??W,response:ie}},this.approveSessionAuthenticate=async r=>{const{id:i,auths:n}=r,s=this.client.core.eventClient.createEvent({properties:{topic:i.toString(),trace:[Xo.authenticated_session_approve_started]}});try{this.isInitialized()}catch(q){throw s.setError(Lu.no_internet_connection),q}const a=this.getPendingAuthRequest(i);if(!a)throw s.setError(Lu.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${i}`);const u=a.transportType||Zt.relay;u===Zt.relay&&await this.confirmOnlineStateOrThrow();const h=a.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),b=bh(h),w={type:Rs,receiverPublicKey:h,senderPublicKey:l},I=[],S=[];for(const q of n){if(!await sb({cacao:q,projectId:this.client.core.projectId})){s.setError(Lu.invalid_cacao);const k=Gt("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:i,topic:b,error:k,encodeOpts:w}),new Error(k.message)}s.addTrace(Xo.cacaos_verified);const{p:K}=q,F=mh(K.resources),W=[nb(K.iss)],R=vh(K.iss);if(F){const k=cb(F),H=ub(F);I.push(...k),W.push(...H)}for(const k of W)S.push(`${k}:${R}`)}const D=await this.client.core.crypto.generateSharedKey(l,h);s.addTrace(Xo.create_authenticated_session_topic);let T;if(I?.length>0){T={topic:D,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:h,metadata:a.requester.metadata},controller:h,expiry:Ir(lc),authentication:n,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:a.pairingTopic,namespaces:Eb([...new Set(I)],[...new Set(S)]),transportType:u},s.addTrace(Xo.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(D,{transportType:u})}catch(q){throw s.setError(Lu.subscribe_authenticated_session_topic_failure),q}s.addTrace(Xo.subscribe_authenticated_session_topic_success),await this.client.session.set(D,T),s.addTrace(Xo.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:a.pairingTopic,metadata:a.requester.metadata})}s.addTrace(Xo.publishing_authenticated_session_approve);try{await this.sendResult({topic:b,id:i,result:{cacaos:n,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:w,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(a.requester.metadata,u)})}catch(q){throw s.setError(Lu.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:T}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:i,reason:n}=r,s=this.getPendingAuthRequest(i);if(!s)throw new Error(`Could not find pending auth request with id ${i}`);s.transportType===Zt.relay&&await this.confirmOnlineStateOrThrow();const a=s.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),h=bh(a),l={type:Rs,receiverPublicKey:a,senderPublicKey:u};await this.sendError({id:i,topic:h,error:n,encodeOpts:l,rpcOpts:Lr.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=r=>{this.isInitialized();const{request:i,iss:n}=r;return ob(i,n)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const i=this.client.core.pairing.pairings.get(r.pairingTopic),n=this.client.core.pairing.pairings.getAll().filter(s=>{var a,u;return((a=s.peerMetadata)==null?void 0:a.url)&&((u=s.peerMetadata)==null?void 0:u.url)===r.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 r=>{var i;const{topic:n,expirerHasDeleted:s=!1,emitEvent:a=!0,id:u=0}=r,{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(V3).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===n&&this.deletePendingSessionRequest(l.id,Gt("USER_DISCONNECTED"))}),n===((i=this.sessionRequestQueue.queue[0])==null?void 0:i.topic)&&(this.sessionRequestQueue.state=ps.idle),a&&this.client.events.emit("session_delete",{id:u,topic:n})},this.deleteProposal=async(r,i)=>{if(i)try{const n=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:n.pairingTopic});s?.setError(Zo.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,Gt("USER_DISCONNECTED")),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,i,n=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,i),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),n&&(this.sessionRequestQueue.state=ps.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,i,n=!1)=>{await Promise.all([this.client.auth.requests.delete(r,i),n?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,i)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,i),await this.client.session.update(r,{expiry:i}))},this.setProposal=async(r,i)=>{this.client.core.expirer.set(r,Ir(Lr.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,i)},this.setAuthRequest=async(r,i)=>{const{request:n,pairingTopic:s,transportType:a=Zt.relay}=i;this.client.core.expirer.set(r,n.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:n.authPayload,requester:n.requester,expiryTimestamp:n.expiryTimestamp,id:r,pairingTopic:s,verifyContext:n.verifyContext,transportType:a})},this.setPendingSessionRequest=async r=>{const{id:i,topic:n,params:s,verifyContext:a}=r,u=s.request.expiryTimestamp||Ir(Lr.wc_sessionRequest.req.ttl);this.client.core.expirer.set(i,u),await this.client.pendingRequest.set(i,{id:i,topic:n,params:s,verifyContext:a})},this.sendRequest=async r=>{const{topic:i,method:n,params:s,expiry:a,relayRpcId:u,clientRpcId:h,throwOnFailedPublish:l,appLink:b}=r,w=uo(n,s,h);let I;const S=!!b;try{const q=S?bu:ao;I=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 D;if(m$.includes(n)){const q=Ns(JSON.stringify(w)),K=Ns(I);D=await this.client.core.verify.register({id:K,decryptedId:q})}const T=Lr[n].req;if(T.attestation=D,a&&(T.ttl=a),u&&(T.id=u),this.client.core.history.set(i,w),S){const q=yh(b,i,I);await global.Linking.openURL(q,this.client.name)}else{const q=Lr[n].req;a&&(q.ttl=a),u&&(q.id=u),l?(q.internal=Mn(pr({},q.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,I,q)):this.client.core.relayer.publish(i,I,q).catch(K=>this.client.logger.error(K))}return w.id},this.sendResult=async r=>{const{id:i,topic:n,result:s,throwOnFailedPublish:a,encodeOpts:u,appLink:h}=r,l=Oh(i,s);let b;const w=h&&typeof(global==null?void 0:global.Linking)<"u";try{const S=w?bu:ao;b=await this.client.core.crypto.encode(n,l,Mn(pr({},u||{}),{encoding:S}))}catch(S){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${n} failed`),S}let I;try{I=await this.client.core.history.get(n,i)}catch(S){throw this.client.logger.error(`sendResult() -> history.get(${n}, ${i}) failed`),S}if(w){const S=yh(h,n,b);await global.Linking.openURL(S,this.client.name)}else{const S=Lr[I.request.method].res;a?(S.internal=Mn(pr({},S.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,b,S)):this.client.core.relayer.publish(n,b,S).catch(D=>this.client.logger.error(D))}await this.client.core.history.resolve(l)},this.sendError=async r=>{const{id:i,topic:n,error:s,encodeOpts:a,rpcOpts:u,appLink:h}=r,l=Ph(i,s);let b;const w=h&&typeof(global==null?void 0:global.Linking)<"u";try{const S=w?bu:ao;b=await this.client.core.crypto.encode(n,l,Mn(pr({},a||{}),{encoding:S}))}catch(S){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${n} failed`),S}let I;try{I=await this.client.core.history.get(n,i)}catch(S){throw this.client.logger.error(`sendError() -> history.get(${n}, ${i}) failed`),S}if(w){const S=yh(h,n,b);await global.Linking.openURL(S,this.client.name)}else{const S=u||Lr[I.request.method].res;this.client.core.relayer.publish(n,b,S)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],i=[];this.client.session.getAll().forEach(n=>{let s=!1;io(n.expiry)&&(s=!0),this.client.core.crypto.keychain.has(n.topic)||(s=!0),s&&r.push(n.topic)}),this.client.proposal.getAll().forEach(n=>{io(n.expiryTimestamp)&&i.push(n.id)}),await Promise.all([...r.map(n=>this.deleteSession({topic:n})),...i.map(n=>this.deleteProposal(n))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===ps.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=ps.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(i){this.client.logger.warn(i)}}this.requestQueue.state=ps.idle},this.processRequest=async r=>{const{topic:i,payload:n,attestation:s,transportType:a,encryptedId:u}=r,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:u});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:u,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:u,transportType:a});default:return this.client.logger.info(`Unsupported request method ${h}`)}},this.onRelayEventResponse=async r=>{const{topic:i,payload:n,transportType:s}=r,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=r=>{const{topic:i}=r,{message:n}=Ee("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=r=>{const{topic:i,requestMethod:n}=r,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 r=>{const{topic:i,payload:n,attestation:s,encryptedId:a}=r,{params:u,id:h}=n;try{const l=this.client.core.eventClient.getEvent({topic:i});this.isValidConnect(pr({},n.params));const b=u.expiryTimestamp||Ir(Lr.wc_sessionPropose.req.ttl),w=pr({id:h,pairingTopic:i,expiryTimestamp:b},u);await this.setProposal(h,w);const I=await this.getVerifyContext({attestationId:s,hash:Ns(JSON.stringify(n)),encryptedId:a,metadata:w.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l?.setError(Bs.proposal_listener_not_found)),l?.addTrace(ds.emit_session_proposal),this.client.events.emit("session_proposal",{id:h,params:w,verifyContext:I})}catch(l){await this.sendError({id:h,topic:i,error:l,rpcOpts:Lr.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(r,i,n)=>{const{id:s}=i;if(fs(i)){const{result:a}=i;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:a});const u=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:u});const h=u.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:h});const l=a.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const b=await this.client.core.crypto.generateSharedKey(h,l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:b});const w=await this.client.core.relayer.subscribe(b,{transportType:n});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:w}),await this.client.core.pairing.activate({topic:r})}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(r,i)=>{const{id:n,params:s}=i;try{this.isValidSessionSettleRequest(s);const{relay:a,controller:u,expiry:h,namespaces:l,sessionProperties:b,sessionConfig:w}=i.params,I=Mn(pr(pr({topic:r,relay:a,expiry:h,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:u.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:u.publicKey,metadata:u.metadata}},b&&{sessionProperties:b}),w&&{sessionConfig:w}),{transportType:Zt.relay}),S=Dt("session_connect");if(this.events.listenerCount(S)===0)throw new Error(`emitting ${S} without any listeners 997`);this.events.emit(Dt("session_connect"),{session:I}),await this.sendResult({id:i.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(a){await this.sendError({id:n,topic:r,error:a}),this.client.logger.error(a)}},this.onSessionSettleResponse=async(r,i)=>{const{id:n}=i;fs(i)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(Dt("session_approve",n),{})):rn(i)&&(await this.client.session.delete(r,Gt("USER_DISCONNECTED")),this.events.emit(Dt("session_approve",n),{error:i.error}))},this.onSessionUpdateRequest=async(r,i)=>{const{params:n,id:s}=i;try{const a=`${r}_session_update`,u=Iu.get(a);if(u&&this.isRequestOutOfSync(u,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:Gt("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(pr({topic:r},n));try{Iu.set(a,s),await this.client.session.update(r,{namespaces:n.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(h){throw Iu.delete(a),h}this.client.events.emit("session_update",{id:s,topic:r,params:n})}catch(a){await this.sendError({id:s,topic:r,error:a}),this.client.logger.error(a)}},this.isRequestOutOfSync=(r,i)=>parseInt(i.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,i)=>{const{id:n}=i,s=Dt("session_update",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);fs(i)?this.events.emit(Dt("session_update",n),{}):rn(i)&&this.events.emit(Dt("session_update",n),{error:i.error})},this.onSessionExtendRequest=async(r,i)=>{const{id:n}=i;try{this.isValidExtend({topic:r}),await this.setExpiry(r,Ir(lc)),await this.sendResult({id:n,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:n,topic:r})}catch(s){await this.sendError({id:n,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,i)=>{const{id:n}=i,s=Dt("session_extend",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);fs(i)?this.events.emit(Dt("session_extend",n),{}):rn(i)&&this.events.emit(Dt("session_extend",n),{error:i.error})},this.onSessionPingRequest=async(r,i)=>{const{id:n}=i;try{this.isValidPing({topic:r}),await this.sendResult({id:n,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:n,topic:r})}catch(s){await this.sendError({id:n,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,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(()=>{fs(i)?this.events.emit(Dt("session_ping",n),{}):rn(i)&&this.events.emit(Dt("session_ping",n),{error:i.error})},500)},this.onSessionDeleteRequest=async(r,i)=>{const{id:n}=i;try{this.isValidDisconnect({topic:r,reason:i.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(hi.publish,async()=>{s(await this.deleteSession({topic:r,id:n}))})}),this.sendResult({id:n,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:Gt("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var i,n,s;const{topic:a,payload:u,attestation:h,encryptedId:l,transportType:b}=r,{id:w,params:I}=u;try{await this.isValidRequest(pr({topic:a},I));const S=this.client.session.get(a),D=await this.getVerifyContext({attestationId:h,hash:Ns(JSON.stringify(uo("wc_sessionRequest",I,w))),encryptedId:l,metadata:S.peer.metadata,transportType:b}),T={id:w,topic:a,params:I,verifyContext:D};await this.setPendingSessionRequest(T),b===Zt.link_mode&&(i=S.peer.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp((n=S.peer.metadata.redirect)==null?void 0:n.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(T):(this.addSessionRequestToSessionRequestQueue(T),this.processSessionRequestQueue())}catch(S){await this.sendError({id:w,topic:a,error:S}),this.client.logger.error(S)}},this.onSessionRequestResponse=(r,i)=>{const{id:n}=i,s=Dt("session_request",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);fs(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(r,i)=>{const{id:n,params:s}=i;try{const a=`${r}_session_event_${s.event.name}`,u=Iu.get(a);if(u&&this.isRequestOutOfSync(u,n)){this.client.logger.info(`Discarding out of sync request - ${n}`);return}this.isValidEmit(pr({topic:r},s)),this.client.events.emit("session_event",{id:n,topic:r,params:s}),Iu.set(a,n)}catch(a){await this.sendError({id:n,topic:r,error:a}),this.client.logger.error(a)}},this.onSessionAuthenticateResponse=(r,i)=>{const{id:n}=i;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:i}),fs(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 r=>{var i;const{topic:n,payload:s,attestation:a,encryptedId:u,transportType:h}=r;try{const{requester:l,authPayload:b,expiryTimestamp:w}=s.params,I=await this.getVerifyContext({attestationId:a,hash:Ns(JSON.stringify(s)),encryptedId:u,metadata:l.metadata,transportType:h}),S={requester:l,pairingTopic:n,id:s.id,authPayload:b,verifyContext:I,expiryTimestamp:w};await this.setAuthRequest(s.id,{request:S,pairingTopic:n,transportType:h}),h===Zt.link_mode&&(i=l.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:n,params:s.params,id:s.id,verifyContext:I})}catch(l){this.client.logger.error(l);const b=s.params.requester.publicKey,w=await this.client.core.crypto.generateKeyPair(),I=this.getAppLinkIfEnabled(s.params.requester.metadata,h),S={type:Rs,receiverPublicKey:b,senderPublicKey:w};await this.sendError({id:s.id,topic:n,error:l,encodeOpts:S,rpcOpts:Lr.wc_sessionAuthenticate.autoReject,appLink:I})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=ps.idle,this.processSessionRequestQueue()},xe.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:i})=>{const n=this.client.core.history.pending;n.length>0&&n.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const a=s.request.id,u=Dt("session_request",a);if(this.events.listenerCount(u)===0)throw new Error(`emitting ${u} without any listeners`);this.events.emit(Dt("session_request",s.request.id),{error:i})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===ps.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=ps.active,this.emitSessionRequest(r)}catch(i){this.client.logger.error(i)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const i=this.client.proposal.getAll().find(n=>n.pairingTopic===r.topic);i&&this.onSessionProposeRequest({topic:r.topic,payload:uo("wc_sessionPropose",{requiredNamespaces:i.requiredNamespaces,optionalNamespaces:i.optionalNamespaces,relays:i.relays,proposer:i.proposer,sessionProperties:i.sessionProperties},i.id)})},this.isValidConnect=async r=>{if(!_i(r)){const{message:h}=Ee("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(h)}const{pairingTopic:i,requiredNamespaces:n,optionalNamespaces:s,sessionProperties:a,relays:u}=r;if(ci(i)||await this.isValidPairingTopic(i),!WI(u,!0)){const{message:h}=Ee("MISSING_OR_INVALID",`connect() relays: ${u}`);throw new Error(h)}!ci(n)&&Su(n)!==0&&this.validateNamespaces(n,"requiredNamespaces"),!ci(s)&&Su(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),ci(a)||this.validateSessionProps(a,"sessionProperties")},this.validateNamespaces=(r,i)=>{const n=KI(r,"connect()",i);if(n)throw new Error(n.message)},this.isValidApprove=async r=>{if(!_i(r))throw new Error(Ee("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:i,namespaces:n,relayProtocol:s,sessionProperties:a}=r;this.checkRecentlyDeleted(i),await this.isValidProposalId(i);const u=this.client.proposal.get(i),h=Fd(n,"approve()");if(h)throw new Error(h.message);const l=Mb(u.requiredNamespaces,n,"approve()");if(l)throw new Error(l.message);if(!yr(s,!0)){const{message:b}=Ee("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(b)}ci(a)||this.validateSessionProps(a,"sessionProperties")},this.isValidReject=async r=>{if(!_i(r)){const{message:s}=Ee("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:i,reason:n}=r;if(this.checkRecentlyDeleted(i),await this.isValidProposalId(i),!GI(n)){const{message:s}=Ee("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!_i(r)){const{message:l}=Ee("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}const{relay:i,controller:n,namespaces:s,expiry:a}=r;if(!Sb(i)){const{message:l}=Ee("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const u=UI(n,"onSessionSettleRequest()");if(u)throw new Error(u.message);const h=Fd(s,"onSessionSettleRequest()");if(h)throw new Error(h.message);if(io(a)){const{message:l}=Ee("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!_i(r)){const{message:h}=Ee("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(h)}const{topic:i,namespaces:n}=r;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const s=this.client.session.get(i),a=Fd(n,"update()");if(a)throw new Error(a.message);const u=Mb(s.requiredNamespaces,n,"update()");if(u)throw new Error(u.message)},this.isValidExtend=async r=>{if(!_i(r)){const{message:n}=Ee("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(n)}const{topic:i}=r;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i)},this.isValidRequest=async r=>{if(!_i(r)){const{message:h}=Ee("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(h)}const{topic:i,request:n,chainId:s,expiry:a}=r;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const{namespaces:u}=this.client.session.get(i);if(!Ib(u,s)){const{message:h}=Ee("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(h)}if(!JI(n)){const{message:h}=Ee("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(h)}if(!ZI(u,s,n.method)){const{message:h}=Ee("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(h)}if(a&&!rM(a,u1)){const{message:h}=Ee("MISSING_OR_INVALID",`request() expiry: ${a}. Expiry must be a number (in seconds) between ${u1.min} and ${u1.max}`);throw new Error(h)}},this.isValidRespond=async r=>{var i;if(!_i(r)){const{message:a}=Ee("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(a)}const{topic:n,response:s}=r;try{await this.isValidSessionTopic(n)}catch(a){throw(i=r?.response)!=null&&i.id&&this.cleanupAfterResponse(r),a}if(!YI(s)){const{message:a}=Ee("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(a)}},this.isValidPing=async r=>{if(!_i(r)){const{message:n}=Ee("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(n)}const{topic:i}=r;await this.isValidSessionOrPairingTopic(i)},this.isValidEmit=async r=>{if(!_i(r)){const{message:u}=Ee("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(u)}const{topic:i,event:n,chainId:s}=r;await this.isValidSessionTopic(i);const{namespaces:a}=this.client.session.get(i);if(!Ib(a,s)){const{message:u}=Ee("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(u)}if(!QI(n)){const{message:u}=Ee("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(u)}if(!XI(a,s,n.name)){const{message:u}=Ee("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(u)}},this.isValidDisconnect=async r=>{if(!_i(r)){const{message:n}=Ee("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(n)}const{topic:i}=r;await this.isValidSessionOrPairingTopic(i)},this.isValidAuthenticate=r=>{const{chains:i,uri:n,domain:s,nonce:a}=r;if(!Array.isArray(i)||i.length===0)throw new Error("chains is required and must be a non-empty array");if(!yr(n,!1))throw new Error("uri is required parameter");if(!yr(s,!1))throw new Error("domain is required parameter");if(!yr(a,!1))throw new Error("nonce is required parameter");if([...new Set(i.map(h=>ou(h).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:u}=ou(i[0]);if(u!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:i,hash:n,encryptedId:s,metadata:a,transportType:u}=r,h={verified:{verifyUrl:a.verifyUrl||Tu,validation:"UNKNOWN",origin:a.url||""}};try{if(u===Zt.link_mode){const b=this.getAppLinkIfEnabled(a,u);return h.verified.validation=b&&new URL(b).origin===new URL(a.url).origin?"VALID":"INVALID",h}const l=await this.client.core.verify.resolve({attestationId:i,hash:n,encryptedId:s,verifyUrl:a.verifyUrl});l&&(h.verified.origin=l.origin,h.verified.isScam=l.isScam,h.verified.validation=l.origin===new URL(a.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(h)}`),h},this.validateSessionProps=(r,i)=>{Object.values(r).forEach(n=>{if(!yr(n,!1)){const{message:s}=Ee("MISSING_OR_INVALID",`${i} must be in Record<string, string> format. Received: ${JSON.stringify(n)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const i=this.client.auth.requests.get(r);return typeof i=="object"?i:void 0},this.addToRecentlyDeleted=(r,i)=>{if(this.recentlyDeletedMap.set(r,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=r=>{const i=this.recentlyDeletedMap.get(r);if(i){const{message:n}=Ee("MISSING_OR_INVALID",`Record was recently deleted - ${i}: ${r}`);throw new Error(n)}},this.isLinkModeEnabled=(r,i)=>{var n,s,a,u,h,l,b,w,I;return!r||i!==Zt.link_mode?!1:((s=(n=this.client.metadata)==null?void 0:n.redirect)==null?void 0:s.linkMode)===!0&&((u=(a=this.client.metadata)==null?void 0:a.redirect)==null?void 0:u.universal)!==void 0&&((l=(h=this.client.metadata)==null?void 0:h.redirect)==null?void 0:l.universal)!==""&&((b=r?.redirect)==null?void 0:b.universal)!==void 0&&((w=r?.redirect)==null?void 0:w.universal)!==""&&((I=r?.redirect)==null?void 0:I.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,i)=>{var n;return this.isLinkModeEnabled(r,i)?(n=r?.redirect)==null?void 0:n.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const i=Y2(r,"topic")||"",n=decodeURIComponent(Y2(r,"wc_ev")||""),s=this.client.session.keys.includes(i);s&&this.client.session.update(i,{transportType:Zt.link_mode}),this.client.core.dispatchEnvelope({topic:i,message:n,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(ad()||Va()&&(r=this.client.metadata.redirect)!=null&&r.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}=Ee("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(hi.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:i,attestation:n,transportType:s}=e,{publicKey:a}=this.client.auth.authKeys.keys.includes(Th)?this.client.auth.authKeys.get(Th):{responseTopic:void 0,publicKey:void 0},u=await this.client.core.crypto.decode(r,i,{receiverPublicKey:a,encoding:s===Zt.link_mode?bu:ao});try{Zd(u)?(this.client.core.history.set(r,u),this.onRelayEventRequest({topic:r,payload:u,attestation:n,transportType:s,encryptedId:Ns(i)})):$h(u)?(await this.client.core.history.resolve(u),await this.onRelayEventResponse({topic:r,payload:u,transportType:s}),this.client.core.history.delete(r,u.id)):this.onRelayEventUnknownPayload({topic:r,payload:u,transportType:s})}catch(h){this.client.logger.error(h)}}registerExpirerEvents(){this.client.core.expirer.on(sn.expired,async e=>{const{topic:r,id:i}=J2(e.target);if(i&&this.client.pendingRequest.keys.includes(i))return await this.deletePendingSessionRequest(i,Ee("EXPIRED"),!0);if(i&&this.client.auth.requests.keys.includes(i))return await this.deletePendingAuthRequest(i,Ee("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):i&&(await this.deleteProposal(i,!0),this.client.events.emit("proposal_expire",{id:i}))})}registerPairingEvents(){this.client.core.pairing.events.on(fc.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(fc.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!yr(e,!1)){const{message:r}=Ee("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=Ee("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(io(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=Ee("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!yr(e,!1)){const{message:r}=Ee("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=Ee("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(io(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=Ee("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=Ee("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(yr(e,!1)){const{message:r}=Ee("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=Ee("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!VI(e)){const{message:r}=Ee("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=Ee("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(io(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=Ee("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class D$ extends ea{constructor(e,r){super(e,r,d$,a1),this.core=e,this.logger=r}}class O$ extends ea{constructor(e,r){super(e,r,p$,a1),this.core=e,this.logger=r}}class P$ extends ea{constructor(e,r){super(e,r,v$,a1,i=>i.id),this.core=e,this.logger=r}}class $$ extends ea{constructor(e,r){super(e,r,w$,Nh,()=>Th),this.core=e,this.logger=r}}class R$ extends ea{constructor(e,r){super(e,r,_$,Nh),this.core=e,this.logger=r}}class N$ extends ea{constructor(e,r){super(e,r,E$,Nh,i=>i.id),this.core=e,this.logger=r}}class T${constructor(e,r){this.core=e,this.logger=r,this.authKeys=new $$(this.core,this.logger),this.pairingTopics=new R$(this.core,this.logger),this.requests=new N$(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class f1 extends SC{constructor(e){super(e),this.protocol=H3,this.version=K3,this.name=c1.name,this.events=new kr.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||c1.name,this.metadata=e?.metadata||H2(),this.signConfig=e?.signConfig;const r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:cs(Dh({level:e?.logger||c1.logger}));this.core=e?.core||new l$(e),this.logger=ui(r,this.name),this.session=new O$(this.core,this.logger),this.proposal=new D$(this.core,this.logger),this.pendingRequest=new P$(this.core,this.logger),this.engine=new C$(this),this.auth=new T$(this.core,this.logger)}static async init(e){const r=new f1(e);return await r.initialize(),r}get context(){return Ai(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"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var h1={exports:{}};(function(t,e){var r=typeof self<"u"?self:Vr,i=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(a){var u={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(d){return d&&DataView.prototype.isPrototypeOf(d)}if(u.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],b=ArrayBuffer.isView||function(d){return d&&l.indexOf(Object.prototype.toString.call(d))>-1};function w(d){if(typeof d!="string"&&(d=String(d)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(d))throw new TypeError("Invalid character in header field name");return d.toLowerCase()}function I(d){return typeof d!="string"&&(d=String(d)),d}function S(d){var v={next:function(){var E=d.shift();return{done:E===void 0,value:E}}};return u.iterable&&(v[Symbol.iterator]=function(){return v}),v}function D(d){this.map={},d instanceof D?d.forEach(function(v,E){this.append(E,v)},this):Array.isArray(d)?d.forEach(function(v){this.append(v[0],v[1])},this):d&&Object.getOwnPropertyNames(d).forEach(function(v){this.append(v,d[v])},this)}D.prototype.append=function(d,v){d=w(d),v=I(v);var E=this.map[d];this.map[d]=E?E+", "+v:v},D.prototype.delete=function(d){delete this.map[w(d)]},D.prototype.get=function(d){return d=w(d),this.has(d)?this.map[d]:null},D.prototype.has=function(d){return this.map.hasOwnProperty(w(d))},D.prototype.set=function(d,v){this.map[w(d)]=I(v)},D.prototype.forEach=function(d,v){for(var E in this.map)this.map.hasOwnProperty(E)&&d.call(v,this.map[E],E,this)},D.prototype.keys=function(){var d=[];return this.forEach(function(v,E){d.push(E)}),S(d)},D.prototype.values=function(){var d=[];return this.forEach(function(v){d.push(v)}),S(d)},D.prototype.entries=function(){var d=[];return this.forEach(function(v,E){d.push([E,v])}),S(d)},u.iterable&&(D.prototype[Symbol.iterator]=D.prototype.entries);function T(d){if(d.bodyUsed)return Promise.reject(new TypeError("Already read"));d.bodyUsed=!0}function q(d){return new Promise(function(v,E){d.onload=function(){v(d.result)},d.onerror=function(){E(d.error)}})}function K(d){var v=new FileReader,E=q(v);return v.readAsArrayBuffer(d),E}function F(d){var v=new FileReader,E=q(v);return v.readAsText(d),E}function W(d){for(var v=new Uint8Array(d),E=new Array(v.length),C=0;C<v.length;C++)E[C]=String.fromCharCode(v[C]);return E.join("")}function R(d){if(d.slice)return d.slice(0);var v=new Uint8Array(d.byteLength);return v.set(new Uint8Array(d)),v.buffer}function k(){return this.bodyUsed=!1,this._initBody=function(d){this._bodyInit=d,d?typeof d=="string"?this._bodyText=d:u.blob&&Blob.prototype.isPrototypeOf(d)?this._bodyBlob=d:u.formData&&FormData.prototype.isPrototypeOf(d)?this._bodyFormData=d:u.searchParams&&URLSearchParams.prototype.isPrototypeOf(d)?this._bodyText=d.toString():u.arrayBuffer&&u.blob&&h(d)?(this._bodyArrayBuffer=R(d.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(d)||b(d))?this._bodyArrayBuffer=R(d):this._bodyText=d=Object.prototype.toString.call(d):this._bodyText="",this.headers.get("content-type")||(typeof d=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):u.searchParams&&URLSearchParams.prototype.isPrototypeOf(d)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u.blob&&(this.blob=function(){var d=T(this);if(d)return d;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?T(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(K)}),this.text=function(){var d=T(this);if(d)return d;if(this._bodyBlob)return F(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(W(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},u.formData&&(this.formData=function(){return this.text().then(ee)}),this.json=function(){return this.text().then(JSON.parse)},this}var H=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function _(d){var v=d.toUpperCase();return H.indexOf(v)>-1?v:d}function B(d,v){v=v||{};var E=v.body;if(d instanceof B){if(d.bodyUsed)throw new TypeError("Already read");this.url=d.url,this.credentials=d.credentials,v.headers||(this.headers=new D(d.headers)),this.method=d.method,this.mode=d.mode,this.signal=d.signal,!E&&d._bodyInit!=null&&(E=d._bodyInit,d.bodyUsed=!0)}else this.url=String(d);if(this.credentials=v.credentials||this.credentials||"same-origin",(v.headers||!this.headers)&&(this.headers=new D(v.headers)),this.method=_(v.method||this.method||"GET"),this.mode=v.mode||this.mode||null,this.signal=v.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&E)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(E)}B.prototype.clone=function(){return new B(this,{body:this._bodyInit})};function ee(d){var v=new FormData;return d.trim().split("&").forEach(function(E){if(E){var C=E.split("="),O=C.shift().replace(/\+/g," "),M=C.join("=").replace(/\+/g," ");v.append(decodeURIComponent(O),decodeURIComponent(M))}}),v}function ie(d){var v=new D,E=d.replace(/\r?\n[\t ]+/g," ");return E.split(/\r?\n/).forEach(function(C){var O=C.split(":"),M=O.shift().trim();if(M){var g=O.join(":").trim();v.append(M,g)}}),v}k.call(B.prototype);function L(d,v){v||(v={}),this.type="default",this.status=v.status===void 0?200:v.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in v?v.statusText:"OK",this.headers=new D(v.headers),this.url=v.url||"",this._initBody(d)}k.call(L.prototype),L.prototype.clone=function(){return new L(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new D(this.headers),url:this.url})},L.error=function(){var d=new L(null,{status:0,statusText:""});return d.type="error",d};var y=[301,302,303,307,308];L.redirect=function(d,v){if(y.indexOf(v)===-1)throw new RangeError("Invalid status code");return new L(null,{status:v,headers:{location:d}})},a.DOMException=s.DOMException;try{new a.DOMException}catch{a.DOMException=function(v,E){this.message=v,this.name=E;var C=Error(v);this.stack=C.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function f(d,v){return new Promise(function(E,C){var O=new B(d,v);if(O.signal&&O.signal.aborted)return C(new a.DOMException("Aborted","AbortError"));var M=new XMLHttpRequest;function g(){M.abort()}M.onload=function(){var m={status:M.status,statusText:M.statusText,headers:ie(M.getAllResponseHeaders()||"")};m.url="responseURL"in M?M.responseURL:m.headers.get("X-Request-URL");var N="response"in M?M.response:M.responseText;E(new L(N,m))},M.onerror=function(){C(new TypeError("Network request failed"))},M.ontimeout=function(){C(new TypeError("Network request failed"))},M.onabort=function(){C(new a.DOMException("Aborted","AbortError"))},M.open(O.method,O.url,!0),O.credentials==="include"?M.withCredentials=!0:O.credentials==="omit"&&(M.withCredentials=!1),"responseType"in M&&u.blob&&(M.responseType="blob"),O.headers.forEach(function(m,N){M.setRequestHeader(N,m)}),O.signal&&(O.signal.addEventListener("abort",g),M.onreadystatechange=function(){M.readyState===4&&O.signal.removeEventListener("abort",g)}),M.send(typeof O._bodyInit>"u"?null:O._bodyInit)})}return f.polyfill=!0,s.fetch||(s.fetch=f,s.Headers=D,s.Request=B,s.Response=L),a.Headers=D,a.Request=B,a.Response=L,a.fetch=f,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,t.exports=e})(h1,h1.exports);var Q3=V5(h1.exports),L$=Object.defineProperty,B$=Object.defineProperties,F$=Object.getOwnPropertyDescriptors,Z3=Object.getOwnPropertySymbols,U$=Object.prototype.hasOwnProperty,k$=Object.prototype.propertyIsEnumerable,X3=(t,e,r)=>e in t?L$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,e6=(t,e)=>{for(var r in e||(e={}))U$.call(e,r)&&X3(t,r,e[r]);if(Z3)for(var r of Z3(e))k$.call(e,r)&&X3(t,r,e[r]);return t},t6=(t,e)=>B$(t,F$(e));const q$={Accept:"application/json","Content-Type":"application/json"},j$="POST",r6={headers:q$,method:j$},i6=10;class gs{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new kr.exports.EventEmitter,this.isAvailable=!1,this.registering=!1,!t3(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=Cs(e),i=await(await Q3(this.url,t6(e6({},r6),{body:r}))).json();this.onPayload({data:i})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!t3(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((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 r=Cs({id:1,jsonrpc:"2.0",method:"test",params:[]});await Q3(e,t6(e6({},r6),{body:r}))}this.onOpen()}catch(r){const i=this.parseError(r);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 r=typeof e.data=="string"?jo(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const i=this.parseError(r),n=i.message||i.toString(),s=Ph(e,n);this.events.emit("payload",s)}parseError(e,r=this.url){return Jb(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>i6&&this.events.setMaxListeners(i6)}}const n6="error",z$="wss://relay.walletconnect.com",H$="wc",K$="universal_provider",s6=`${H$}@2:${K$}:`,o6="https://rpc.walletconnect.com/v1/",dc="generic",W$=`${o6}bundler`,Cn={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Uu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},l1={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(t,e){(function(){var r,i="4.17.21",n=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",u="Invalid `variable` option passed into `_.template`",h="__lodash_hash_undefined__",l=500,b="__lodash_placeholder__",w=1,I=2,S=4,D=1,T=2,q=1,K=2,F=4,W=8,R=16,k=32,H=64,_=128,B=256,ee=512,ie=30,L="...",y=800,f=16,d=1,v=2,E=3,C=1/0,O=9007199254740991,M=17976931348623157e292,g=0/0,m=4294967295,N=m-1,X=m>>>1,ae=[["ary",_],["bind",q],["bindKey",K],["curry",W],["curryRight",R],["flip",ee],["partial",k],["partialRight",H],["rearg",B]],P="[object Arguments]",te="[object Array]",z="[object AsyncFunction]",G="[object Boolean]",J="[object Date]",A="[object DOMException]",V="[object Error]",oe="[object Function]",ue="[object GeneratorFunction]",he="[object Map]",ye="[object Number]",we="[object Null]",Re="[object Object]",Xe="[object Promise]",Oe="[object Proxy]",Ne="[object RegExp]",Me="[object Set]",be="[object String]",Pe="[object Symbol]",Te="[object Undefined]",ve="[object WeakMap]",$e="[object WeakSet]",Se="[object ArrayBuffer]",me="[object DataView]",Ue="[object Float32Array]",Ce="[object Float64Array]",_e="[object Int8Array]",Ke="[object Int16Array]",Ve="[object Int32Array]",Ae="[object Uint8Array]",We="[object Uint8ClampedArray]",pt="[object Uint16Array]",Ge="[object Uint32Array]",It=/\b__p \+= '';/g,gt=/\b(__p \+=) '' \+/g,Ye=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ot=/&(?:amp|lt|gt|quot|#39);/g,Tt=/[&<>"']/g,Le=RegExp(Ot.source),et=RegExp(Tt.source),it=/<%-([\s\S]+?)%>/g,Be=/<%([\s\S]+?)%>/g,rt=/<%=([\s\S]+?)%>/g,tt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,qe=/^\w*$/,ht=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nt=/[\\^$.*+?()[\]{}|]/g,je=RegExp(nt.source),st=/^\s+/,at=/\s/,Fe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ze=/\{\n\/\* \[wrapped with (.+)\] \*/,lt=/,? & /,ze=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,qt=/[()=,{}\[\]\/\s]/,jt=/\\(\\)?/g,ct=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,_t=/\w*$/,Zr=/^[-+]0x[0-9a-f]+$/i,Xr=/^0b[01]+$/i,ei=/^\[object .+?Constructor\]$/,ti=/^0o[0-7]+$/i,ri=/^(?:0|[1-9]\d*)$/,vr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ii=/($^)/,On=/['\n\r\u2028\u2029\\]/g,Mi="\\ud800-\\udfff",Pn="\\u0300-\\u036f",$n="\\ufe20-\\ufe2f",Ci="\\u20d0-\\u20ff",an=Pn+$n+Ci,cn="\\u2700-\\u27bf",Cr="a-z\\xdf-\\xf6\\xf8-\\xff",Rn="\\xac\\xb1\\xd7\\xf7",Nn="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Tn="\\u2000-\\u206f",va=" \\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",gl="A-Z\\xc0-\\xd6\\xd8-\\xde",vl="\\ufe0e\\ufe0f",ma=Rn+Nn+Tn+va,of="['\u2019]",ba="["+Mi+"]",af="["+ma+"]",ya="["+an+"]",ml="\\d+",Cp="["+cn+"]",bl="["+Cr+"]",yl="[^"+Mi+ma+ml+cn+Cr+gl+"]",$c="\\ud83c[\\udffb-\\udfff]",Dp="(?:"+ya+"|"+$c+")",wl="[^"+Mi+"]",Rc="(?:\\ud83c[\\udde6-\\uddff]){2}",Ao="[\\ud800-\\udbff][\\udc00-\\udfff]",ji="["+gl+"]",_l="\\u200d",El="(?:"+bl+"|"+yl+")",ws="(?:"+ji+"|"+yl+")",Al="(?:"+of+"(?:d|ll|m|re|s|t|ve))?",xl="(?:"+of+"(?:D|LL|M|RE|S|T|VE))?",Sl=Dp+"?",Il="["+vl+"]?",Op="(?:"+_l+"(?:"+[wl,Rc,Ao].join("|")+")"+Il+Sl+")*",qs="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ml="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Cl=Il+Sl+Op,Nc="(?:"+[Cp,Rc,Ao].join("|")+")"+Cl,Pp="(?:"+[wl+ya+"?",ya,Rc,Ao,ba].join("|")+")",cf=RegExp(of,"g"),$p=RegExp(ya,"g"),Tc=RegExp($c+"(?="+$c+")|"+Pp+Cl,"g"),Dl=RegExp([ji+"?"+bl+"+"+Al+"(?="+[af,ji,"$"].join("|")+")",ws+"+"+xl+"(?="+[af,ji+El,"$"].join("|")+")",ji+"?"+El+"+"+Al,ji+"+"+xl,Ml,qs,ml,Nc].join("|"),"g"),Ol=RegExp("["+_l+Mi+an+vl+"]"),wa=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Pl=["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"],Rp=-1,Xt={};Xt[Ue]=Xt[Ce]=Xt[_e]=Xt[Ke]=Xt[Ve]=Xt[Ae]=Xt[We]=Xt[pt]=Xt[Ge]=!0,Xt[P]=Xt[te]=Xt[Se]=Xt[G]=Xt[me]=Xt[J]=Xt[V]=Xt[oe]=Xt[he]=Xt[ye]=Xt[Re]=Xt[Ne]=Xt[Me]=Xt[be]=Xt[ve]=!1;var Qt={};Qt[P]=Qt[te]=Qt[Se]=Qt[me]=Qt[G]=Qt[J]=Qt[Ue]=Qt[Ce]=Qt[_e]=Qt[Ke]=Qt[Ve]=Qt[he]=Qt[ye]=Qt[Re]=Qt[Ne]=Qt[Me]=Qt[be]=Qt[Pe]=Qt[Ae]=Qt[We]=Qt[pt]=Qt[Ge]=!0,Qt[V]=Qt[oe]=Qt[ve]=!1;var Y={\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"},re={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},pe={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},ke={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},er=parseFloat,bt=parseInt,ar=typeof Uu=="object"&&Uu&&Uu.Object===Object&&Uu,xr=typeof self=="object"&&self&&self.Object===Object&&self,Ft=ar||xr||Function("return this")(),tr=e&&!e.nodeType&&e,_r=tr&&!0&&t&&!t.nodeType&&t,Di=_r&&_r.exports===tr,Sr=Di&&ar.process,cr=function(){try{var ne=_r&&_r.require&&_r.require("util").types;return ne||Sr&&Sr.binding&&Sr.binding("util")}catch{}}(),di=cr&&cr.isArrayBuffer,Ln=cr&&cr.isDate,un=cr&&cr.isMap,_s=cr&&cr.isRegExp,uf=cr&&cr.isSet,_a=cr&&cr.isTypedArray;function Fr(ne,fe,ce){switch(ce.length){case 0:return ne.call(fe);case 1:return ne.call(fe,ce[0]);case 2:return ne.call(fe,ce[0],ce[1]);case 3:return ne.call(fe,ce[0],ce[1],ce[2])}return ne.apply(fe,ce)}function uF(ne,fe,ce,He){for(var vt=-1,Ht=ne==null?0:ne.length;++vt<Ht;){var Dr=ne[vt];fe(He,Dr,ce(Dr),ne)}return He}function fn(ne,fe){for(var ce=-1,He=ne==null?0:ne.length;++ce<He&&fe(ne[ce],ce,ne)!==!1;);return ne}function fF(ne,fe){for(var ce=ne==null?0:ne.length;ce--&&fe(ne[ce],ce,ne)!==!1;);return ne}function Vy(ne,fe){for(var ce=-1,He=ne==null?0:ne.length;++ce<He;)if(!fe(ne[ce],ce,ne))return!1;return!0}function xo(ne,fe){for(var ce=-1,He=ne==null?0:ne.length,vt=0,Ht=[];++ce<He;){var Dr=ne[ce];fe(Dr,ce,ne)&&(Ht[vt++]=Dr)}return Ht}function $l(ne,fe){var ce=ne==null?0:ne.length;return!!ce&&Lc(ne,fe,0)>-1}function Np(ne,fe,ce){for(var He=-1,vt=ne==null?0:ne.length;++He<vt;)if(ce(fe,ne[He]))return!0;return!1}function ur(ne,fe){for(var ce=-1,He=ne==null?0:ne.length,vt=Array(He);++ce<He;)vt[ce]=fe(ne[ce],ce,ne);return vt}function So(ne,fe){for(var ce=-1,He=fe.length,vt=ne.length;++ce<He;)ne[vt+ce]=fe[ce];return ne}function Tp(ne,fe,ce,He){var vt=-1,Ht=ne==null?0:ne.length;for(He&&Ht&&(ce=ne[++vt]);++vt<Ht;)ce=fe(ce,ne[vt],vt,ne);return ce}function hF(ne,fe,ce,He){var vt=ne==null?0:ne.length;for(He&&vt&&(ce=ne[--vt]);vt--;)ce=fe(ce,ne[vt],vt,ne);return ce}function Lp(ne,fe){for(var ce=-1,He=ne==null?0:ne.length;++ce<He;)if(fe(ne[ce],ce,ne))return!0;return!1}var lF=Bp("length");function dF(ne){return ne.split("")}function pF(ne){return ne.match(ze)||[]}function Gy(ne,fe,ce){var He;return ce(ne,function(vt,Ht,Dr){if(fe(vt,Ht,Dr))return He=Ht,!1}),He}function Rl(ne,fe,ce,He){for(var vt=ne.length,Ht=ce+(He?1:-1);He?Ht--:++Ht<vt;)if(fe(ne[Ht],Ht,ne))return Ht;return-1}function Lc(ne,fe,ce){return fe===fe?IF(ne,fe,ce):Rl(ne,Jy,ce)}function gF(ne,fe,ce,He){for(var vt=ce-1,Ht=ne.length;++vt<Ht;)if(He(ne[vt],fe))return vt;return-1}function Jy(ne){return ne!==ne}function Yy(ne,fe){var ce=ne==null?0:ne.length;return ce?Up(ne,fe)/ce:g}function Bp(ne){return function(fe){return fe==null?r:fe[ne]}}function Fp(ne){return function(fe){return ne==null?r:ne[fe]}}function Qy(ne,fe,ce,He,vt){return vt(ne,function(Ht,Dr,rr){ce=He?(He=!1,Ht):fe(ce,Ht,Dr,rr)}),ce}function vF(ne,fe){var ce=ne.length;for(ne.sort(fe);ce--;)ne[ce]=ne[ce].value;return ne}function Up(ne,fe){for(var ce,He=-1,vt=ne.length;++He<vt;){var Ht=fe(ne[He]);Ht!==r&&(ce=ce===r?Ht:ce+Ht)}return ce}function kp(ne,fe){for(var ce=-1,He=Array(ne);++ce<ne;)He[ce]=fe(ce);return He}function mF(ne,fe){return ur(fe,function(ce){return[ce,ne[ce]]})}function Zy(ne){return ne&&ne.slice(0,rw(ne)+1).replace(st,"")}function zi(ne){return function(fe){return ne(fe)}}function qp(ne,fe){return ur(fe,function(ce){return ne[ce]})}function ff(ne,fe){return ne.has(fe)}function Xy(ne,fe){for(var ce=-1,He=ne.length;++ce<He&&Lc(fe,ne[ce],0)>-1;);return ce}function ew(ne,fe){for(var ce=ne.length;ce--&&Lc(fe,ne[ce],0)>-1;);return ce}function bF(ne,fe){for(var ce=ne.length,He=0;ce--;)ne[ce]===fe&&++He;return He}var yF=Fp(Y),wF=Fp(re);function _F(ne){return"\\"+ke[ne]}function EF(ne,fe){return ne==null?r:ne[fe]}function Bc(ne){return Ol.test(ne)}function AF(ne){return wa.test(ne)}function xF(ne){for(var fe,ce=[];!(fe=ne.next()).done;)ce.push(fe.value);return ce}function jp(ne){var fe=-1,ce=Array(ne.size);return ne.forEach(function(He,vt){ce[++fe]=[vt,He]}),ce}function tw(ne,fe){return function(ce){return ne(fe(ce))}}function Io(ne,fe){for(var ce=-1,He=ne.length,vt=0,Ht=[];++ce<He;){var Dr=ne[ce];(Dr===fe||Dr===b)&&(ne[ce]=b,Ht[vt++]=ce)}return Ht}function Nl(ne){var fe=-1,ce=Array(ne.size);return ne.forEach(function(He){ce[++fe]=He}),ce}function SF(ne){var fe=-1,ce=Array(ne.size);return ne.forEach(function(He){ce[++fe]=[He,He]}),ce}function IF(ne,fe,ce){for(var He=ce-1,vt=ne.length;++He<vt;)if(ne[He]===fe)return He;return-1}function MF(ne,fe,ce){for(var He=ce+1;He--;)if(ne[He]===fe)return He;return He}function Fc(ne){return Bc(ne)?DF(ne):lF(ne)}function Bn(ne){return Bc(ne)?OF(ne):dF(ne)}function rw(ne){for(var fe=ne.length;fe--&&at.test(ne.charAt(fe)););return fe}var CF=Fp(pe);function DF(ne){for(var fe=Tc.lastIndex=0;Tc.test(ne);)++fe;return fe}function OF(ne){return ne.match(Tc)||[]}function PF(ne){return ne.match(Dl)||[]}var $F=function ne(fe){fe=fe==null?Ft:Uc.defaults(Ft.Object(),fe,Uc.pick(Ft,Pl));var ce=fe.Array,He=fe.Date,vt=fe.Error,Ht=fe.Function,Dr=fe.Math,rr=fe.Object,zp=fe.RegExp,RF=fe.String,hn=fe.TypeError,Tl=ce.prototype,NF=Ht.prototype,kc=rr.prototype,Ll=fe["__core-js_shared__"],Bl=NF.toString,Jt=kc.hasOwnProperty,TF=0,iw=function(){var o=/[^.]+$/.exec(Ll&&Ll.keys&&Ll.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""}(),Fl=kc.toString,LF=Bl.call(rr),BF=Ft._,FF=zp("^"+Bl.call(Jt).replace(nt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ul=Di?fe.Buffer:r,Mo=fe.Symbol,kl=fe.Uint8Array,nw=Ul?Ul.allocUnsafe:r,ql=tw(rr.getPrototypeOf,rr),sw=rr.create,ow=kc.propertyIsEnumerable,jl=Tl.splice,aw=Mo?Mo.isConcatSpreadable:r,hf=Mo?Mo.iterator:r,Ea=Mo?Mo.toStringTag:r,zl=function(){try{var o=Ma(rr,"defineProperty");return o({},"",{}),o}catch{}}(),UF=fe.clearTimeout!==Ft.clearTimeout&&fe.clearTimeout,kF=He&&He.now!==Ft.Date.now&&He.now,qF=fe.setTimeout!==Ft.setTimeout&&fe.setTimeout,Hl=Dr.ceil,Kl=Dr.floor,Hp=rr.getOwnPropertySymbols,jF=Ul?Ul.isBuffer:r,cw=fe.isFinite,zF=Tl.join,HF=tw(rr.keys,rr),Or=Dr.max,ii=Dr.min,KF=He.now,WF=fe.parseInt,uw=Dr.random,VF=Tl.reverse,Kp=Ma(fe,"DataView"),lf=Ma(fe,"Map"),Wp=Ma(fe,"Promise"),qc=Ma(fe,"Set"),df=Ma(fe,"WeakMap"),pf=Ma(rr,"create"),Wl=df&&new df,jc={},GF=Ca(Kp),JF=Ca(lf),YF=Ca(Wp),QF=Ca(qc),ZF=Ca(df),Vl=Mo?Mo.prototype:r,gf=Vl?Vl.valueOf:r,fw=Vl?Vl.toString:r;function U(o){if(mr(o)&&!yt(o)&&!(o instanceof Lt)){if(o instanceof ln)return o;if(Jt.call(o,"__wrapped__"))return h5(o)}return new ln(o)}var zc=function(){function o(){}return function(c){if(!hr(c))return{};if(sw)return sw(c);o.prototype=c;var p=new o;return o.prototype=r,p}}();function Gl(){}function ln(o,c){this.__wrapped__=o,this.__actions__=[],this.__chain__=!!c,this.__index__=0,this.__values__=r}U.templateSettings={escape:it,evaluate:Be,interpolate:rt,variable:"",imports:{_:U}},U.prototype=Gl.prototype,U.prototype.constructor=U,ln.prototype=zc(Gl.prototype),ln.prototype.constructor=ln;function Lt(o){this.__wrapped__=o,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=m,this.__views__=[]}function XF(){var o=new Lt(this.__wrapped__);return o.__actions__=Oi(this.__actions__),o.__dir__=this.__dir__,o.__filtered__=this.__filtered__,o.__iteratees__=Oi(this.__iteratees__),o.__takeCount__=this.__takeCount__,o.__views__=Oi(this.__views__),o}function eU(){if(this.__filtered__){var o=new Lt(this);o.__dir__=-1,o.__filtered__=!0}else o=this.clone(),o.__dir__*=-1;return o}function tU(){var o=this.__wrapped__.value(),c=this.__dir__,p=yt(o),x=c<0,$=p?o.length:0,j=dk(0,$,this.__views__),Q=j.start,Z=j.end,se=Z-Q,le=x?Z:Q-1,de=this.__iteratees__,ge=de.length,De=0,Je=ii(se,this.__takeCount__);if(!p||!x&&$==se&&Je==se)return Nw(o,this.__actions__);var ut=[];e:for(;se--&&De<Je;){le+=c;for(var St=-1,ft=o[le];++St<ge;){var Pt=de[St],Ut=Pt.iteratee,Wi=Pt.type,vi=Ut(ft);if(Wi==v)ft=vi;else if(!vi){if(Wi==d)continue e;break e}}ut[De++]=ft}return ut}Lt.prototype=zc(Gl.prototype),Lt.prototype.constructor=Lt;function Aa(o){var c=-1,p=o==null?0:o.length;for(this.clear();++c<p;){var x=o[c];this.set(x[0],x[1])}}function rU(){this.__data__=pf?pf(null):{},this.size=0}function iU(o){var c=this.has(o)&&delete this.__data__[o];return this.size-=c?1:0,c}function nU(o){var c=this.__data__;if(pf){var p=c[o];return p===h?r:p}return Jt.call(c,o)?c[o]:r}function sU(o){var c=this.__data__;return pf?c[o]!==r:Jt.call(c,o)}function oU(o,c){var p=this.__data__;return this.size+=this.has(o)?0:1,p[o]=pf&&c===r?h:c,this}Aa.prototype.clear=rU,Aa.prototype.delete=iU,Aa.prototype.get=nU,Aa.prototype.has=sU,Aa.prototype.set=oU;function js(o){var c=-1,p=o==null?0:o.length;for(this.clear();++c<p;){var x=o[c];this.set(x[0],x[1])}}function aU(){this.__data__=[],this.size=0}function cU(o){var c=this.__data__,p=Jl(c,o);if(p<0)return!1;var x=c.length-1;return p==x?c.pop():jl.call(c,p,1),--this.size,!0}function uU(o){var c=this.__data__,p=Jl(c,o);return p<0?r:c[p][1]}function fU(o){return Jl(this.__data__,o)>-1}function hU(o,c){var p=this.__data__,x=Jl(p,o);return x<0?(++this.size,p.push([o,c])):p[x][1]=c,this}js.prototype.clear=aU,js.prototype.delete=cU,js.prototype.get=uU,js.prototype.has=fU,js.prototype.set=hU;function zs(o){var c=-1,p=o==null?0:o.length;for(this.clear();++c<p;){var x=o[c];this.set(x[0],x[1])}}function lU(){this.size=0,this.__data__={hash:new Aa,map:new(lf||js),string:new Aa}}function dU(o){var c=a0(this,o).delete(o);return this.size-=c?1:0,c}function pU(o){return a0(this,o).get(o)}function gU(o){return a0(this,o).has(o)}function vU(o,c){var p=a0(this,o),x=p.size;return p.set(o,c),this.size+=p.size==x?0:1,this}zs.prototype.clear=lU,zs.prototype.delete=dU,zs.prototype.get=pU,zs.prototype.has=gU,zs.prototype.set=vU;function xa(o){var c=-1,p=o==null?0:o.length;for(this.__data__=new zs;++c<p;)this.add(o[c])}function mU(o){return this.__data__.set(o,h),this}function bU(o){return this.__data__.has(o)}xa.prototype.add=xa.prototype.push=mU,xa.prototype.has=bU;function Fn(o){var c=this.__data__=new js(o);this.size=c.size}function yU(){this.__data__=new js,this.size=0}function wU(o){var c=this.__data__,p=c.delete(o);return this.size=c.size,p}function _U(o){return this.__data__.get(o)}function EU(o){return this.__data__.has(o)}function AU(o,c){var p=this.__data__;if(p instanceof js){var x=p.__data__;if(!lf||x.length<n-1)return x.push([o,c]),this.size=++p.size,this;p=this.__data__=new zs(x)}return p.set(o,c),this.size=p.size,this}Fn.prototype.clear=yU,Fn.prototype.delete=wU,Fn.prototype.get=_U,Fn.prototype.has=EU,Fn.prototype.set=AU;function hw(o,c){var p=yt(o),x=!p&&Da(o),$=!p&&!x&&$o(o),j=!p&&!x&&!$&&Vc(o),Q=p||x||$||j,Z=Q?kp(o.length,RF):[],se=Z.length;for(var le in o)(c||Jt.call(o,le))&&!(Q&&(le=="length"||$&&(le=="offset"||le=="parent")||j&&(le=="buffer"||le=="byteLength"||le=="byteOffset")||Vs(le,se)))&&Z.push(le);return Z}function lw(o){var c=o.length;return c?o[ig(0,c-1)]:r}function xU(o,c){return c0(Oi(o),Sa(c,0,o.length))}function SU(o){return c0(Oi(o))}function Vp(o,c,p){(p!==r&&!Un(o[c],p)||p===r&&!(c in o))&&Hs(o,c,p)}function vf(o,c,p){var x=o[c];(!(Jt.call(o,c)&&Un(x,p))||p===r&&!(c in o))&&Hs(o,c,p)}function Jl(o,c){for(var p=o.length;p--;)if(Un(o[p][0],c))return p;return-1}function IU(o,c,p,x){return Co(o,function($,j,Q){c(x,$,p($),Q)}),x}function dw(o,c){return o&&As(c,Ur(c),o)}function MU(o,c){return o&&As(c,$i(c),o)}function Hs(o,c,p){c=="__proto__"&&zl?zl(o,c,{configurable:!0,enumerable:!0,value:p,writable:!0}):o[c]=p}function Gp(o,c){for(var p=-1,x=c.length,$=ce(x),j=o==null;++p<x;)$[p]=j?r:Cg(o,c[p]);return $}function Sa(o,c,p){return o===o&&(p!==r&&(o=o<=p?o:p),c!==r&&(o=o>=c?o:c)),o}function dn(o,c,p,x,$,j){var Q,Z=c&w,se=c&I,le=c&S;if(p&&(Q=$?p(o,x,$,j):p(o)),Q!==r)return Q;if(!hr(o))return o;var de=yt(o);if(de){if(Q=gk(o),!Z)return Oi(o,Q)}else{var ge=ni(o),De=ge==oe||ge==ue;if($o(o))return Bw(o,Z);if(ge==Re||ge==P||De&&!$){if(Q=se||De?{}:r5(o),!Z)return se?nk(o,MU(Q,o)):ik(o,dw(Q,o))}else{if(!Qt[ge])return $?o:{};Q=vk(o,ge,Z)}}j||(j=new Fn);var Je=j.get(o);if(Je)return Je;j.set(o,Q),P5(o)?o.forEach(function(ft){Q.add(dn(ft,c,p,ft,o,j))}):D5(o)&&o.forEach(function(ft,Pt){Q.set(Pt,dn(ft,c,p,Pt,o,j))});var ut=le?se?pg:dg:se?$i:Ur,St=de?r:ut(o);return fn(St||o,function(ft,Pt){St&&(Pt=ft,ft=o[Pt]),vf(Q,Pt,dn(ft,c,p,Pt,o,j))}),Q}function CU(o){var c=Ur(o);return function(p){return pw(p,o,c)}}function pw(o,c,p){var x=p.length;if(o==null)return!x;for(o=rr(o);x--;){var $=p[x],j=c[$],Q=o[$];if(Q===r&&!($ in o)||!j(Q))return!1}return!0}function gw(o,c,p){if(typeof o!="function")throw new hn(a);return Af(function(){o.apply(r,p)},c)}function mf(o,c,p,x){var $=-1,j=$l,Q=!0,Z=o.length,se=[],le=c.length;if(!Z)return se;p&&(c=ur(c,zi(p))),x?(j=Np,Q=!1):c.length>=n&&(j=ff,Q=!1,c=new xa(c));e:for(;++$<Z;){var de=o[$],ge=p==null?de:p(de);if(de=x||de!==0?de:0,Q&&ge===ge){for(var De=le;De--;)if(c[De]===ge)continue e;se.push(de)}else j(c,ge,x)||se.push(de)}return se}var Co=jw(Es),vw=jw(Yp,!0);function DU(o,c){var p=!0;return Co(o,function(x,$,j){return p=!!c(x,$,j),p}),p}function Yl(o,c,p){for(var x=-1,$=o.length;++x<$;){var j=o[x],Q=c(j);if(Q!=null&&(Z===r?Q===Q&&!Ki(Q):p(Q,Z)))var Z=Q,se=j}return se}function OU(o,c,p,x){var $=o.length;for(p=xt(p),p<0&&(p=-p>$?0:$+p),x=x===r||x>$?$:xt(x),x<0&&(x+=$),x=p>x?0:R5(x);p<x;)o[p++]=c;return o}function mw(o,c){var p=[];return Co(o,function(x,$,j){c(x,$,j)&&p.push(x)}),p}function Wr(o,c,p,x,$){var j=-1,Q=o.length;for(p||(p=bk),$||($=[]);++j<Q;){var Z=o[j];c>0&&p(Z)?c>1?Wr(Z,c-1,p,x,$):So($,Z):x||($[$.length]=Z)}return $}var Jp=zw(),bw=zw(!0);function Es(o,c){return o&&Jp(o,c,Ur)}function Yp(o,c){return o&&bw(o,c,Ur)}function Ql(o,c){return xo(c,function(p){return Gs(o[p])})}function Ia(o,c){c=Oo(c,o);for(var p=0,x=c.length;o!=null&&p<x;)o=o[xs(c[p++])];return p&&p==x?o:r}function yw(o,c,p){var x=c(o);return yt(o)?x:So(x,p(o))}function pi(o){return o==null?o===r?Te:we:Ea&&Ea in rr(o)?lk(o):Sk(o)}function Qp(o,c){return o>c}function PU(o,c){return o!=null&&Jt.call(o,c)}function $U(o,c){return o!=null&&c in rr(o)}function RU(o,c,p){return o>=ii(c,p)&&o<Or(c,p)}function Zp(o,c,p){for(var x=p?Np:$l,$=o[0].length,j=o.length,Q=j,Z=ce(j),se=1/0,le=[];Q--;){var de=o[Q];Q&&c&&(de=ur(de,zi(c))),se=ii(de.length,se),Z[Q]=!p&&(c||$>=120&&de.length>=120)?new xa(Q&&de):r}de=o[0];var ge=-1,De=Z[0];e:for(;++ge<$&&le.length<se;){var Je=de[ge],ut=c?c(Je):Je;if(Je=p||Je!==0?Je:0,!(De?ff(De,ut):x(le,ut,p))){for(Q=j;--Q;){var St=Z[Q];if(!(St?ff(St,ut):x(o[Q],ut,p)))continue e}De&&De.push(ut),le.push(Je)}}return le}function NU(o,c,p,x){return Es(o,function($,j,Q){c(x,p($),j,Q)}),x}function bf(o,c,p){c=Oo(c,o),o=o5(o,c);var x=o==null?o:o[xs(gn(c))];return x==null?r:Fr(x,o,p)}function ww(o){return mr(o)&&pi(o)==P}function TU(o){return mr(o)&&pi(o)==Se}function LU(o){return mr(o)&&pi(o)==J}function yf(o,c,p,x,$){return o===c?!0:o==null||c==null||!mr(o)&&!mr(c)?o!==o&&c!==c:BU(o,c,p,x,yf,$)}function BU(o,c,p,x,$,j){var Q=yt(o),Z=yt(c),se=Q?te:ni(o),le=Z?te:ni(c);se=se==P?Re:se,le=le==P?Re:le;var de=se==Re,ge=le==Re,De=se==le;if(De&&$o(o)){if(!$o(c))return!1;Q=!0,de=!1}if(De&&!de)return j||(j=new Fn),Q||Vc(o)?Xw(o,c,p,x,$,j):fk(o,c,se,p,x,$,j);if(!(p&D)){var Je=de&&Jt.call(o,"__wrapped__"),ut=ge&&Jt.call(c,"__wrapped__");if(Je||ut){var St=Je?o.value():o,ft=ut?c.value():c;return j||(j=new Fn),$(St,ft,p,x,j)}}return De?(j||(j=new Fn),hk(o,c,p,x,$,j)):!1}function FU(o){return mr(o)&&ni(o)==he}function Xp(o,c,p,x){var $=p.length,j=$,Q=!x;if(o==null)return!j;for(o=rr(o);$--;){var Z=p[$];if(Q&&Z[2]?Z[1]!==o[Z[0]]:!(Z[0]in o))return!1}for(;++$<j;){Z=p[$];var se=Z[0],le=o[se],de=Z[1];if(Q&&Z[2]){if(le===r&&!(se in o))return!1}else{var ge=new Fn;if(x)var De=x(le,de,se,o,c,ge);if(!(De===r?yf(de,le,D|T,x,ge):De))return!1}}return!0}function _w(o){if(!hr(o)||wk(o))return!1;var c=Gs(o)?FF:ei;return c.test(Ca(o))}function UU(o){return mr(o)&&pi(o)==Ne}function kU(o){return mr(o)&&ni(o)==Me}function qU(o){return mr(o)&&p0(o.length)&&!!Xt[pi(o)]}function Ew(o){return typeof o=="function"?o:o==null?Ri:typeof o=="object"?yt(o)?Sw(o[0],o[1]):xw(o):H5(o)}function eg(o){if(!Ef(o))return HF(o);var c=[];for(var p in rr(o))Jt.call(o,p)&&p!="constructor"&&c.push(p);return c}function jU(o){if(!hr(o))return xk(o);var c=Ef(o),p=[];for(var x in o)x=="constructor"&&(c||!Jt.call(o,x))||p.push(x);return p}function tg(o,c){return o<c}function Aw(o,c){var p=-1,x=Pi(o)?ce(o.length):[];return Co(o,function($,j,Q){x[++p]=c($,j,Q)}),x}function xw(o){var c=vg(o);return c.length==1&&c[0][2]?n5(c[0][0],c[0][1]):function(p){return p===o||Xp(p,o,c)}}function Sw(o,c){return bg(o)&&i5(c)?n5(xs(o),c):function(p){var x=Cg(p,o);return x===r&&x===c?Dg(p,o):yf(c,x,D|T)}}function Zl(o,c,p,x,$){o!==c&&Jp(c,function(j,Q){if($||($=new Fn),hr(j))zU(o,c,Q,p,Zl,x,$);else{var Z=x?x(wg(o,Q),j,Q+"",o,c,$):r;Z===r&&(Z=j),Vp(o,Q,Z)}},$i)}function zU(o,c,p,x,$,j,Q){var Z=wg(o,p),se=wg(c,p),le=Q.get(se);if(le){Vp(o,p,le);return}var de=j?j(Z,se,p+"",o,c,Q):r,ge=de===r;if(ge){var De=yt(se),Je=!De&&$o(se),ut=!De&&!Je&&Vc(se);de=se,De||Je||ut?yt(Z)?de=Z:Er(Z)?de=Oi(Z):Je?(ge=!1,de=Bw(se,!0)):ut?(ge=!1,de=Fw(se,!0)):de=[]:xf(se)||Da(se)?(de=Z,Da(Z)?de=N5(Z):(!hr(Z)||Gs(Z))&&(de=r5(se))):ge=!1}ge&&(Q.set(se,de),$(de,se,x,j,Q),Q.delete(se)),Vp(o,p,de)}function Iw(o,c){var p=o.length;if(p)return c+=c<0?p:0,Vs(c,p)?o[c]:r}function Mw(o,c,p){c.length?c=ur(c,function(j){return yt(j)?function(Q){return Ia(Q,j.length===1?j[0]:j)}:j}):c=[Ri];var x=-1;c=ur(c,zi(ot()));var $=Aw(o,function(j,Q,Z){var se=ur(c,function(le){return le(j)});return{criteria:se,index:++x,value:j}});return vF($,function(j,Q){return rk(j,Q,p)})}function HU(o,c){return Cw(o,c,function(p,x){return Dg(o,x)})}function Cw(o,c,p){for(var x=-1,$=c.length,j={};++x<$;){var Q=c[x],Z=Ia(o,Q);p(Z,Q)&&wf(j,Oo(Q,o),Z)}return j}function KU(o){return function(c){return Ia(c,o)}}function rg(o,c,p,x){var $=x?gF:Lc,j=-1,Q=c.length,Z=o;for(o===c&&(c=Oi(c)),p&&(Z=ur(o,zi(p)));++j<Q;)for(var se=0,le=c[j],de=p?p(le):le;(se=$(Z,de,se,x))>-1;)Z!==o&&jl.call(Z,se,1),jl.call(o,se,1);return o}function Dw(o,c){for(var p=o?c.length:0,x=p-1;p--;){var $=c[p];if(p==x||$!==j){var j=$;Vs($)?jl.call(o,$,1):og(o,$)}}return o}function ig(o,c){return o+Kl(uw()*(c-o+1))}function WU(o,c,p,x){for(var $=-1,j=Or(Hl((c-o)/(p||1)),0),Q=ce(j);j--;)Q[x?j:++$]=o,o+=p;return Q}function ng(o,c){var p="";if(!o||c<1||c>O)return p;do c%2&&(p+=o),c=Kl(c/2),c&&(o+=o);while(c);return p}function Mt(o,c){return _g(s5(o,c,Ri),o+"")}function VU(o){return lw(Gc(o))}function GU(o,c){var p=Gc(o);return c0(p,Sa(c,0,p.length))}function wf(o,c,p,x){if(!hr(o))return o;c=Oo(c,o);for(var $=-1,j=c.length,Q=j-1,Z=o;Z!=null&&++$<j;){var se=xs(c[$]),le=p;if(se==="__proto__"||se==="constructor"||se==="prototype")return o;if($!=Q){var de=Z[se];le=x?x(de,se,Z):r,le===r&&(le=hr(de)?de:Vs(c[$+1])?[]:{})}vf(Z,se,le),Z=Z[se]}return o}var Ow=Wl?function(o,c){return Wl.set(o,c),o}:Ri,JU=zl?function(o,c){return zl(o,"toString",{configurable:!0,enumerable:!1,value:Pg(c),writable:!0})}:Ri;function YU(o){return c0(Gc(o))}function pn(o,c,p){var x=-1,$=o.length;c<0&&(c=-c>$?0:$+c),p=p>$?$:p,p<0&&(p+=$),$=c>p?0:p-c>>>0,c>>>=0;for(var j=ce($);++x<$;)j[x]=o[x+c];return j}function QU(o,c){var p;return Co(o,function(x,$,j){return p=c(x,$,j),!p}),!!p}function Xl(o,c,p){var x=0,$=o==null?x:o.length;if(typeof c=="number"&&c===c&&$<=X){for(;x<$;){var j=x+$>>>1,Q=o[j];Q!==null&&!Ki(Q)&&(p?Q<=c:Q<c)?x=j+1:$=j}return $}return sg(o,c,Ri,p)}function sg(o,c,p,x){var $=0,j=o==null?0:o.length;if(j===0)return 0;c=p(c);for(var Q=c!==c,Z=c===null,se=Ki(c),le=c===r;$<j;){var de=Kl(($+j)/2),ge=p(o[de]),De=ge!==r,Je=ge===null,ut=ge===ge,St=Ki(ge);if(Q)var ft=x||ut;else le?ft=ut&&(x||De):Z?ft=ut&&De&&(x||!Je):se?ft=ut&&De&&!Je&&(x||!St):Je||St?ft=!1:ft=x?ge<=c:ge<c;ft?$=de+1:j=de}return ii(j,N)}function Pw(o,c){for(var p=-1,x=o.length,$=0,j=[];++p<x;){var Q=o[p],Z=c?c(Q):Q;if(!p||!Un(Z,se)){var se=Z;j[$++]=Q===0?0:Q}}return j}function $w(o){return typeof o=="number"?o:Ki(o)?g:+o}function Hi(o){if(typeof o=="string")return o;if(yt(o))return ur(o,Hi)+"";if(Ki(o))return fw?fw.call(o):"";var c=o+"";return c=="0"&&1/o==-C?"-0":c}function Do(o,c,p){var x=-1,$=$l,j=o.length,Q=!0,Z=[],se=Z;if(p)Q=!1,$=Np;else if(j>=n){var le=c?null:ck(o);if(le)return Nl(le);Q=!1,$=ff,se=new xa}else se=c?[]:Z;e:for(;++x<j;){var de=o[x],ge=c?c(de):de;if(de=p||de!==0?de:0,Q&&ge===ge){for(var De=se.length;De--;)if(se[De]===ge)continue e;c&&se.push(ge),Z.push(de)}else $(se,ge,p)||(se!==Z&&se.push(ge),Z.push(de))}return Z}function og(o,c){return c=Oo(c,o),o=o5(o,c),o==null||delete o[xs(gn(c))]}function Rw(o,c,p,x){return wf(o,c,p(Ia(o,c)),x)}function e0(o,c,p,x){for(var $=o.length,j=x?$:-1;(x?j--:++j<$)&&c(o[j],j,o););return p?pn(o,x?0:j,x?j+1:$):pn(o,x?j+1:0,x?$:j)}function Nw(o,c){var p=o;return p instanceof Lt&&(p=p.value()),Tp(c,function(x,$){return $.func.apply($.thisArg,So([x],$.args))},p)}function ag(o,c,p){var x=o.length;if(x<2)return x?Do(o[0]):[];for(var $=-1,j=ce(x);++$<x;)for(var Q=o[$],Z=-1;++Z<x;)Z!=$&&(j[$]=mf(j[$]||Q,o[Z],c,p));return Do(Wr(j,1),c,p)}function Tw(o,c,p){for(var x=-1,$=o.length,j=c.length,Q={};++x<$;){var Z=x<j?c[x]:r;p(Q,o[x],Z)}return Q}function cg(o){return Er(o)?o:[]}function ug(o){return typeof o=="function"?o:Ri}function Oo(o,c){return yt(o)?o:bg(o,c)?[o]:f5(Vt(o))}var ZU=Mt;function Po(o,c,p){var x=o.length;return p=p===r?x:p,!c&&p>=x?o:pn(o,c,p)}var Lw=UF||function(o){return Ft.clearTimeout(o)};function Bw(o,c){if(c)return o.slice();var p=o.length,x=nw?nw(p):new o.constructor(p);return o.copy(x),x}function fg(o){var c=new o.constructor(o.byteLength);return new kl(c).set(new kl(o)),c}function XU(o,c){var p=c?fg(o.buffer):o.buffer;return new o.constructor(p,o.byteOffset,o.byteLength)}function ek(o){var c=new o.constructor(o.source,_t.exec(o));return c.lastIndex=o.lastIndex,c}function tk(o){return gf?rr(gf.call(o)):{}}function Fw(o,c){var p=c?fg(o.buffer):o.buffer;return new o.constructor(p,o.byteOffset,o.length)}function Uw(o,c){if(o!==c){var p=o!==r,x=o===null,$=o===o,j=Ki(o),Q=c!==r,Z=c===null,se=c===c,le=Ki(c);if(!Z&&!le&&!j&&o>c||j&&Q&&se&&!Z&&!le||x&&Q&&se||!p&&se||!$)return 1;if(!x&&!j&&!le&&o<c||le&&p&&$&&!x&&!j||Z&&p&&$||!Q&&$||!se)return-1}return 0}function rk(o,c,p){for(var x=-1,$=o.criteria,j=c.criteria,Q=$.length,Z=p.length;++x<Q;){var se=Uw($[x],j[x]);if(se){if(x>=Z)return se;var le=p[x];return se*(le=="desc"?-1:1)}}return o.index-c.index}function kw(o,c,p,x){for(var $=-1,j=o.length,Q=p.length,Z=-1,se=c.length,le=Or(j-Q,0),de=ce(se+le),ge=!x;++Z<se;)de[Z]=c[Z];for(;++$<Q;)(ge||$<j)&&(de[p[$]]=o[$]);for(;le--;)de[Z++]=o[$++];return de}function qw(o,c,p,x){for(var $=-1,j=o.length,Q=-1,Z=p.length,se=-1,le=c.length,de=Or(j-Z,0),ge=ce(de+le),De=!x;++$<de;)ge[$]=o[$];for(var Je=$;++se<le;)ge[Je+se]=c[se];for(;++Q<Z;)(De||$<j)&&(ge[Je+p[Q]]=o[$++]);return ge}function Oi(o,c){var p=-1,x=o.length;for(c||(c=ce(x));++p<x;)c[p]=o[p];return c}function As(o,c,p,x){var $=!p;p||(p={});for(var j=-1,Q=c.length;++j<Q;){var Z=c[j],se=x?x(p[Z],o[Z],Z,p,o):r;se===r&&(se=o[Z]),$?Hs(p,Z,se):vf(p,Z,se)}return p}function ik(o,c){return As(o,mg(o),c)}function nk(o,c){return As(o,e5(o),c)}function t0(o,c){return function(p,x){var $=yt(p)?uF:IU,j=c?c():{};return $(p,o,ot(x,2),j)}}function Hc(o){return Mt(function(c,p){var x=-1,$=p.length,j=$>1?p[$-1]:r,Q=$>2?p[2]:r;for(j=o.length>3&&typeof j=="function"?($--,j):r,Q&&gi(p[0],p[1],Q)&&(j=$<3?r:j,$=1),c=rr(c);++x<$;){var Z=p[x];Z&&o(c,Z,x,j)}return c})}function jw(o,c){return function(p,x){if(p==null)return p;if(!Pi(p))return o(p,x);for(var $=p.length,j=c?$:-1,Q=rr(p);(c?j--:++j<$)&&x(Q[j],j,Q)!==!1;);return p}}function zw(o){return function(c,p,x){for(var $=-1,j=rr(c),Q=x(c),Z=Q.length;Z--;){var se=Q[o?Z:++$];if(p(j[se],se,j)===!1)break}return c}}function sk(o,c,p){var x=c&q,$=_f(o);function j(){var Q=this&&this!==Ft&&this instanceof j?$:o;return Q.apply(x?p:this,arguments)}return j}function Hw(o){return function(c){c=Vt(c);var p=Bc(c)?Bn(c):r,x=p?p[0]:c.charAt(0),$=p?Po(p,1).join(""):c.slice(1);return x[o]()+$}}function Kc(o){return function(c){return Tp(j5(q5(c).replace(cf,"")),o,"")}}function _f(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=zc(o.prototype),x=o.apply(p,c);return hr(x)?x:p}}function ok(o,c,p){var x=_f(o);function $(){for(var j=arguments.length,Q=ce(j),Z=j,se=Wc($);Z--;)Q[Z]=arguments[Z];var le=j<3&&Q[0]!==se&&Q[j-1]!==se?[]:Io(Q,se);if(j-=le.length,j<p)return Jw(o,c,r0,$.placeholder,r,Q,le,r,r,p-j);var de=this&&this!==Ft&&this instanceof $?x:o;return Fr(de,this,Q)}return $}function Kw(o){return function(c,p,x){var $=rr(c);if(!Pi(c)){var j=ot(p,3);c=Ur(c),p=function(Z){return j($[Z],Z,$)}}var Q=o(c,p,x);return Q>-1?$[j?c[Q]:Q]:r}}function Ww(o){return Ws(function(c){var p=c.length,x=p,$=ln.prototype.thru;for(o&&c.reverse();x--;){var j=c[x];if(typeof j!="function")throw new hn(a);if($&&!Q&&o0(j)=="wrapper")var Q=new ln([],!0)}for(x=Q?x:p;++x<p;){j=c[x];var Z=o0(j),se=Z=="wrapper"?gg(j):r;se&&yg(se[0])&&se[1]==(_|W|k|B)&&!se[4].length&&se[9]==1?Q=Q[o0(se[0])].apply(Q,se[3]):Q=j.length==1&&yg(j)?Q[Z]():Q.thru(j)}return function(){var le=arguments,de=le[0];if(Q&&le.length==1&&yt(de))return Q.plant(de).value();for(var ge=0,De=p?c[ge].apply(this,le):de;++ge<p;)De=c[ge].call(this,De);return De}})}function r0(o,c,p,x,$,j,Q,Z,se,le){var de=c&_,ge=c&q,De=c&K,Je=c&(W|R),ut=c&ee,St=De?r:_f(o);function ft(){for(var Pt=arguments.length,Ut=ce(Pt),Wi=Pt;Wi--;)Ut[Wi]=arguments[Wi];if(Je)var vi=Wc(ft),Vi=bF(Ut,vi);if(x&&(Ut=kw(Ut,x,$,Je)),j&&(Ut=qw(Ut,j,Q,Je)),Pt-=Vi,Je&&Pt<le){var Ar=Io(Ut,vi);return Jw(o,c,r0,ft.placeholder,p,Ut,Ar,Z,se,le-Pt)}var kn=ge?p:this,Ys=De?kn[o]:o;return Pt=Ut.length,Z?Ut=Ik(Ut,Z):ut&&Pt>1&&Ut.reverse(),de&&se<Pt&&(Ut.length=se),this&&this!==Ft&&this instanceof ft&&(Ys=St||_f(Ys)),Ys.apply(kn,Ut)}return ft}function Vw(o,c){return function(p,x){return NU(p,o,c(x),{})}}function i0(o,c){return function(p,x){var $;if(p===r&&x===r)return c;if(p!==r&&($=p),x!==r){if($===r)return x;typeof p=="string"||typeof x=="string"?(p=Hi(p),x=Hi(x)):(p=$w(p),x=$w(x)),$=o(p,x)}return $}}function hg(o){return Ws(function(c){return c=ur(c,zi(ot())),Mt(function(p){var x=this;return o(c,function($){return Fr($,x,p)})})})}function n0(o,c){c=c===r?" ":Hi(c);var p=c.length;if(p<2)return p?ng(c,o):c;var x=ng(c,Hl(o/Fc(c)));return Bc(c)?Po(Bn(x),0,o).join(""):x.slice(0,o)}function ak(o,c,p,x){var $=c&q,j=_f(o);function Q(){for(var Z=-1,se=arguments.length,le=-1,de=x.length,ge=ce(de+se),De=this&&this!==Ft&&this instanceof Q?j:o;++le<de;)ge[le]=x[le];for(;se--;)ge[le++]=arguments[++Z];return Fr(De,$?p:this,ge)}return Q}function Gw(o){return function(c,p,x){return x&&typeof x!="number"&&gi(c,p,x)&&(p=x=r),c=Js(c),p===r?(p=c,c=0):p=Js(p),x=x===r?c<p?1:-1:Js(x),WU(c,p,x,o)}}function s0(o){return function(c,p){return typeof c=="string"&&typeof p=="string"||(c=vn(c),p=vn(p)),o(c,p)}}function Jw(o,c,p,x,$,j,Q,Z,se,le){var de=c&W,ge=de?Q:r,De=de?r:Q,Je=de?j:r,ut=de?r:j;c|=de?k:H,c&=~(de?H:k),c&F||(c&=~(q|K));var St=[o,c,$,Je,ge,ut,De,Z,se,le],ft=p.apply(r,St);return yg(o)&&a5(ft,St),ft.placeholder=x,c5(ft,o,c)}function lg(o){var c=Dr[o];return function(p,x){if(p=vn(p),x=x==null?0:ii(xt(x),292),x&&cw(p)){var $=(Vt(p)+"e").split("e"),j=c($[0]+"e"+(+$[1]+x));return $=(Vt(j)+"e").split("e"),+($[0]+"e"+(+$[1]-x))}return c(p)}}var ck=qc&&1/Nl(new qc([,-0]))[1]==C?function(o){return new qc(o)}:Ng;function Yw(o){return function(c){var p=ni(c);return p==he?jp(c):p==Me?SF(c):mF(c,o(c))}}function Ks(o,c,p,x,$,j,Q,Z){var se=c&K;if(!se&&typeof o!="function")throw new hn(a);var le=x?x.length:0;if(le||(c&=~(k|H),x=$=r),Q=Q===r?Q:Or(xt(Q),0),Z=Z===r?Z:xt(Z),le-=$?$.length:0,c&H){var de=x,ge=$;x=$=r}var De=se?r:gg(o),Je=[o,c,p,x,$,de,ge,j,Q,Z];if(De&&Ak(Je,De),o=Je[0],c=Je[1],p=Je[2],x=Je[3],$=Je[4],Z=Je[9]=Je[9]===r?se?0:o.length:Or(Je[9]-le,0),!Z&&c&(W|R)&&(c&=~(W|R)),!c||c==q)var ut=sk(o,c,p);else c==W||c==R?ut=ok(o,c,Z):(c==k||c==(q|k))&&!$.length?ut=ak(o,c,p,x):ut=r0.apply(r,Je);var St=De?Ow:a5;return c5(St(ut,Je),o,c)}function Qw(o,c,p,x){return o===r||Un(o,kc[p])&&!Jt.call(x,p)?c:o}function Zw(o,c,p,x,$,j){return hr(o)&&hr(c)&&(j.set(c,o),Zl(o,c,r,Zw,j),j.delete(c)),o}function uk(o){return xf(o)?r:o}function Xw(o,c,p,x,$,j){var Q=p&D,Z=o.length,se=c.length;if(Z!=se&&!(Q&&se>Z))return!1;var le=j.get(o),de=j.get(c);if(le&&de)return le==c&&de==o;var ge=-1,De=!0,Je=p&T?new xa:r;for(j.set(o,c),j.set(c,o);++ge<Z;){var ut=o[ge],St=c[ge];if(x)var ft=Q?x(St,ut,ge,c,o,j):x(ut,St,ge,o,c,j);if(ft!==r){if(ft)continue;De=!1;break}if(Je){if(!Lp(c,function(Pt,Ut){if(!ff(Je,Ut)&&(ut===Pt||$(ut,Pt,p,x,j)))return Je.push(Ut)})){De=!1;break}}else if(!(ut===St||$(ut,St,p,x,j))){De=!1;break}}return j.delete(o),j.delete(c),De}function fk(o,c,p,x,$,j,Q){switch(p){case me:if(o.byteLength!=c.byteLength||o.byteOffset!=c.byteOffset)return!1;o=o.buffer,c=c.buffer;case Se:return!(o.byteLength!=c.byteLength||!j(new kl(o),new kl(c)));case G:case J:case ye:return Un(+o,+c);case V:return o.name==c.name&&o.message==c.message;case Ne:case be:return o==c+"";case he:var Z=jp;case Me:var se=x&D;if(Z||(Z=Nl),o.size!=c.size&&!se)return!1;var le=Q.get(o);if(le)return le==c;x|=T,Q.set(o,c);var de=Xw(Z(o),Z(c),x,$,j,Q);return Q.delete(o),de;case Pe:if(gf)return gf.call(o)==gf.call(c)}return!1}function hk(o,c,p,x,$,j){var Q=p&D,Z=dg(o),se=Z.length,le=dg(c),de=le.length;if(se!=de&&!Q)return!1;for(var ge=se;ge--;){var De=Z[ge];if(!(Q?De in c:Jt.call(c,De)))return!1}var Je=j.get(o),ut=j.get(c);if(Je&&ut)return Je==c&&ut==o;var St=!0;j.set(o,c),j.set(c,o);for(var ft=Q;++ge<se;){De=Z[ge];var Pt=o[De],Ut=c[De];if(x)var Wi=Q?x(Ut,Pt,De,c,o,j):x(Pt,Ut,De,o,c,j);if(!(Wi===r?Pt===Ut||$(Pt,Ut,p,x,j):Wi)){St=!1;break}ft||(ft=De=="constructor")}if(St&&!ft){var vi=o.constructor,Vi=c.constructor;vi!=Vi&&"constructor"in o&&"constructor"in c&&!(typeof vi=="function"&&vi instanceof vi&&typeof Vi=="function"&&Vi instanceof Vi)&&(St=!1)}return j.delete(o),j.delete(c),St}function Ws(o){return _g(s5(o,r,p5),o+"")}function dg(o){return yw(o,Ur,mg)}function pg(o){return yw(o,$i,e5)}var gg=Wl?function(o){return Wl.get(o)}:Ng;function o0(o){for(var c=o.name+"",p=jc[c],x=Jt.call(jc,c)?p.length:0;x--;){var $=p[x],j=$.func;if(j==null||j==o)return $.name}return c}function Wc(o){var c=Jt.call(U,"placeholder")?U:o;return c.placeholder}function ot(){var o=U.iteratee||$g;return o=o===$g?Ew:o,arguments.length?o(arguments[0],arguments[1]):o}function a0(o,c){var p=o.__data__;return yk(c)?p[typeof c=="string"?"string":"hash"]:p.map}function vg(o){for(var c=Ur(o),p=c.length;p--;){var x=c[p],$=o[x];c[p]=[x,$,i5($)]}return c}function Ma(o,c){var p=EF(o,c);return _w(p)?p:r}function lk(o){var c=Jt.call(o,Ea),p=o[Ea];try{o[Ea]=r;var x=!0}catch{}var $=Fl.call(o);return x&&(c?o[Ea]=p:delete o[Ea]),$}var mg=Hp?function(o){return o==null?[]:(o=rr(o),xo(Hp(o),function(c){return ow.call(o,c)}))}:Tg,e5=Hp?function(o){for(var c=[];o;)So(c,mg(o)),o=ql(o);return c}:Tg,ni=pi;(Kp&&ni(new Kp(new ArrayBuffer(1)))!=me||lf&&ni(new lf)!=he||Wp&&ni(Wp.resolve())!=Xe||qc&&ni(new qc)!=Me||df&&ni(new df)!=ve)&&(ni=function(o){var c=pi(o),p=c==Re?o.constructor:r,x=p?Ca(p):"";if(x)switch(x){case GF:return me;case JF:return he;case YF:return Xe;case QF:return Me;case ZF:return ve}return c});function dk(o,c,p){for(var x=-1,$=p.length;++x<$;){var j=p[x],Q=j.size;switch(j.type){case"drop":o+=Q;break;case"dropRight":c-=Q;break;case"take":c=ii(c,o+Q);break;case"takeRight":o=Or(o,c-Q);break}}return{start:o,end:c}}function pk(o){var c=o.match(Ze);return c?c[1].split(lt):[]}function t5(o,c,p){c=Oo(c,o);for(var x=-1,$=c.length,j=!1;++x<$;){var Q=xs(c[x]);if(!(j=o!=null&&p(o,Q)))break;o=o[Q]}return j||++x!=$?j:($=o==null?0:o.length,!!$&&p0($)&&Vs(Q,$)&&(yt(o)||Da(o)))}function gk(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 r5(o){return typeof o.constructor=="function"&&!Ef(o)?zc(ql(o)):{}}function vk(o,c,p){var x=o.constructor;switch(c){case Se:return fg(o);case G:case J:return new x(+o);case me:return XU(o,p);case Ue:case Ce:case _e:case Ke:case Ve:case Ae:case We:case pt:case Ge:return Fw(o,p);case he:return new x;case ye:case be:return new x(o);case Ne:return ek(o);case Me:return new x;case Pe:return tk(o)}}function mk(o,c){var p=c.length;if(!p)return o;var x=p-1;return c[x]=(p>1?"& ":"")+c[x],c=c.join(p>2?", ":" "),o.replace(Fe,`{
50
+ */(function(t,e){(function(){var r,i="4.17.21",n=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",u="Invalid `variable` option passed into `_.template`",h="__lodash_hash_undefined__",l=500,b="__lodash_placeholder__",w=1,I=2,S=4,D=1,T=2,q=1,K=2,F=4,W=8,R=16,k=32,H=64,_=128,B=256,ee=512,ie=30,L="...",y=800,f=16,d=1,v=2,E=3,C=1/0,O=9007199254740991,M=17976931348623157e292,g=0/0,m=4294967295,N=m-1,X=m>>>1,ae=[["ary",_],["bind",q],["bindKey",K],["curry",W],["curryRight",R],["flip",ee],["partial",k],["partialRight",H],["rearg",B]],P="[object Arguments]",te="[object Array]",z="[object AsyncFunction]",G="[object Boolean]",J="[object Date]",A="[object DOMException]",V="[object Error]",oe="[object Function]",ue="[object GeneratorFunction]",he="[object Map]",ye="[object Number]",we="[object Null]",Re="[object Object]",Xe="[object Promise]",Oe="[object Proxy]",Ne="[object RegExp]",Me="[object Set]",be="[object String]",Pe="[object Symbol]",Te="[object Undefined]",ve="[object WeakMap]",$e="[object WeakSet]",Se="[object ArrayBuffer]",me="[object DataView]",Ue="[object Float32Array]",Ce="[object Float64Array]",_e="[object Int8Array]",Ke="[object Int16Array]",Ve="[object Int32Array]",Ae="[object Uint8Array]",We="[object Uint8ClampedArray]",pt="[object Uint16Array]",Ge="[object Uint32Array]",It=/\b__p \+= '';/g,gt=/\b(__p \+=) '' \+/g,Ye=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ot=/&(?:amp|lt|gt|quot|#39);/g,Tt=/[&<>"']/g,Le=RegExp(Ot.source),et=RegExp(Tt.source),it=/<%-([\s\S]+?)%>/g,Be=/<%([\s\S]+?)%>/g,rt=/<%=([\s\S]+?)%>/g,tt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,qe=/^\w*$/,ht=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nt=/[\\^$.*+?()[\]{}|]/g,je=RegExp(nt.source),st=/^\s+/,at=/\s/,Fe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ze=/\{\n\/\* \[wrapped with (.+)\] \*/,lt=/,? & /,ze=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,qt=/[()=,{}\[\]\/\s]/,jt=/\\(\\)?/g,ct=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,_t=/\w*$/,Zr=/^[-+]0x[0-9a-f]+$/i,Xr=/^0b[01]+$/i,ei=/^\[object .+?Constructor\]$/,ti=/^0o[0-7]+$/i,ri=/^(?:0|[1-9]\d*)$/,vr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ii=/($^)/,On=/['\n\r\u2028\u2029\\]/g,Mi="\\ud800-\\udfff",Pn="\\u0300-\\u036f",$n="\\ufe20-\\ufe2f",Ci="\\u20d0-\\u20ff",an=Pn+$n+Ci,cn="\\u2700-\\u27bf",Cr="a-z\\xdf-\\xf6\\xf8-\\xff",Rn="\\xac\\xb1\\xd7\\xf7",Nn="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Tn="\\u2000-\\u206f",va=" \\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",gl="A-Z\\xc0-\\xd6\\xd8-\\xde",vl="\\ufe0e\\ufe0f",ma=Rn+Nn+Tn+va,of="['\u2019]",ba="["+Mi+"]",af="["+ma+"]",ya="["+an+"]",ml="\\d+",Cp="["+cn+"]",bl="["+Cr+"]",yl="[^"+Mi+ma+ml+cn+Cr+gl+"]",$c="\\ud83c[\\udffb-\\udfff]",Dp="(?:"+ya+"|"+$c+")",wl="[^"+Mi+"]",Rc="(?:\\ud83c[\\udde6-\\uddff]){2}",Ao="[\\ud800-\\udbff][\\udc00-\\udfff]",ji="["+gl+"]",_l="\\u200d",El="(?:"+bl+"|"+yl+")",ws="(?:"+ji+"|"+yl+")",Al="(?:"+of+"(?:d|ll|m|re|s|t|ve))?",xl="(?:"+of+"(?:D|LL|M|RE|S|T|VE))?",Sl=Dp+"?",Il="["+vl+"]?",Op="(?:"+_l+"(?:"+[wl,Rc,Ao].join("|")+")"+Il+Sl+")*",qs="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ml="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Cl=Il+Sl+Op,Nc="(?:"+[Cp,Rc,Ao].join("|")+")"+Cl,Pp="(?:"+[wl+ya+"?",ya,Rc,Ao,ba].join("|")+")",cf=RegExp(of,"g"),$p=RegExp(ya,"g"),Tc=RegExp($c+"(?="+$c+")|"+Pp+Cl,"g"),Dl=RegExp([ji+"?"+bl+"+"+Al+"(?="+[af,ji,"$"].join("|")+")",ws+"+"+xl+"(?="+[af,ji+El,"$"].join("|")+")",ji+"?"+El+"+"+Al,ji+"+"+xl,Ml,qs,ml,Nc].join("|"),"g"),Ol=RegExp("["+_l+Mi+an+vl+"]"),wa=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Pl=["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"],Rp=-1,Xt={};Xt[Ue]=Xt[Ce]=Xt[_e]=Xt[Ke]=Xt[Ve]=Xt[Ae]=Xt[We]=Xt[pt]=Xt[Ge]=!0,Xt[P]=Xt[te]=Xt[Se]=Xt[G]=Xt[me]=Xt[J]=Xt[V]=Xt[oe]=Xt[he]=Xt[ye]=Xt[Re]=Xt[Ne]=Xt[Me]=Xt[be]=Xt[ve]=!1;var Qt={};Qt[P]=Qt[te]=Qt[Se]=Qt[me]=Qt[G]=Qt[J]=Qt[Ue]=Qt[Ce]=Qt[_e]=Qt[Ke]=Qt[Ve]=Qt[he]=Qt[ye]=Qt[Re]=Qt[Ne]=Qt[Me]=Qt[be]=Qt[Pe]=Qt[Ae]=Qt[We]=Qt[pt]=Qt[Ge]=!0,Qt[V]=Qt[oe]=Qt[ve]=!1;var Y={\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"},re={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},pe={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},ke={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},er=parseFloat,bt=parseInt,ar=typeof Uu=="object"&&Uu&&Uu.Object===Object&&Uu,xr=typeof self=="object"&&self&&self.Object===Object&&self,Ft=ar||xr||Function("return this")(),tr=e&&!e.nodeType&&e,_r=tr&&!0&&t&&!t.nodeType&&t,Di=_r&&_r.exports===tr,Sr=Di&&ar.process,cr=function(){try{var ne=_r&&_r.require&&_r.require("util").types;return ne||Sr&&Sr.binding&&Sr.binding("util")}catch{}}(),di=cr&&cr.isArrayBuffer,Ln=cr&&cr.isDate,un=cr&&cr.isMap,_s=cr&&cr.isRegExp,uf=cr&&cr.isSet,_a=cr&&cr.isTypedArray;function Fr(ne,fe,ce){switch(ce.length){case 0:return ne.call(fe);case 1:return ne.call(fe,ce[0]);case 2:return ne.call(fe,ce[0],ce[1]);case 3:return ne.call(fe,ce[0],ce[1],ce[2])}return ne.apply(fe,ce)}function uF(ne,fe,ce,He){for(var vt=-1,Ht=ne==null?0:ne.length;++vt<Ht;){var Dr=ne[vt];fe(He,Dr,ce(Dr),ne)}return He}function fn(ne,fe){for(var ce=-1,He=ne==null?0:ne.length;++ce<He&&fe(ne[ce],ce,ne)!==!1;);return ne}function fF(ne,fe){for(var ce=ne==null?0:ne.length;ce--&&fe(ne[ce],ce,ne)!==!1;);return ne}function Gy(ne,fe){for(var ce=-1,He=ne==null?0:ne.length;++ce<He;)if(!fe(ne[ce],ce,ne))return!1;return!0}function xo(ne,fe){for(var ce=-1,He=ne==null?0:ne.length,vt=0,Ht=[];++ce<He;){var Dr=ne[ce];fe(Dr,ce,ne)&&(Ht[vt++]=Dr)}return Ht}function $l(ne,fe){var ce=ne==null?0:ne.length;return!!ce&&Lc(ne,fe,0)>-1}function Np(ne,fe,ce){for(var He=-1,vt=ne==null?0:ne.length;++He<vt;)if(ce(fe,ne[He]))return!0;return!1}function ur(ne,fe){for(var ce=-1,He=ne==null?0:ne.length,vt=Array(He);++ce<He;)vt[ce]=fe(ne[ce],ce,ne);return vt}function So(ne,fe){for(var ce=-1,He=fe.length,vt=ne.length;++ce<He;)ne[vt+ce]=fe[ce];return ne}function Tp(ne,fe,ce,He){var vt=-1,Ht=ne==null?0:ne.length;for(He&&Ht&&(ce=ne[++vt]);++vt<Ht;)ce=fe(ce,ne[vt],vt,ne);return ce}function hF(ne,fe,ce,He){var vt=ne==null?0:ne.length;for(He&&vt&&(ce=ne[--vt]);vt--;)ce=fe(ce,ne[vt],vt,ne);return ce}function Lp(ne,fe){for(var ce=-1,He=ne==null?0:ne.length;++ce<He;)if(fe(ne[ce],ce,ne))return!0;return!1}var lF=Bp("length");function dF(ne){return ne.split("")}function pF(ne){return ne.match(ze)||[]}function Jy(ne,fe,ce){var He;return ce(ne,function(vt,Ht,Dr){if(fe(vt,Ht,Dr))return He=Ht,!1}),He}function Rl(ne,fe,ce,He){for(var vt=ne.length,Ht=ce+(He?1:-1);He?Ht--:++Ht<vt;)if(fe(ne[Ht],Ht,ne))return Ht;return-1}function Lc(ne,fe,ce){return fe===fe?IF(ne,fe,ce):Rl(ne,Yy,ce)}function gF(ne,fe,ce,He){for(var vt=ce-1,Ht=ne.length;++vt<Ht;)if(He(ne[vt],fe))return vt;return-1}function Yy(ne){return ne!==ne}function Qy(ne,fe){var ce=ne==null?0:ne.length;return ce?Up(ne,fe)/ce:g}function Bp(ne){return function(fe){return fe==null?r:fe[ne]}}function Fp(ne){return function(fe){return ne==null?r:ne[fe]}}function Zy(ne,fe,ce,He,vt){return vt(ne,function(Ht,Dr,rr){ce=He?(He=!1,Ht):fe(ce,Ht,Dr,rr)}),ce}function vF(ne,fe){var ce=ne.length;for(ne.sort(fe);ce--;)ne[ce]=ne[ce].value;return ne}function Up(ne,fe){for(var ce,He=-1,vt=ne.length;++He<vt;){var Ht=fe(ne[He]);Ht!==r&&(ce=ce===r?Ht:ce+Ht)}return ce}function kp(ne,fe){for(var ce=-1,He=Array(ne);++ce<ne;)He[ce]=fe(ce);return He}function mF(ne,fe){return ur(fe,function(ce){return[ce,ne[ce]]})}function Xy(ne){return ne&&ne.slice(0,iw(ne)+1).replace(st,"")}function zi(ne){return function(fe){return ne(fe)}}function qp(ne,fe){return ur(fe,function(ce){return ne[ce]})}function ff(ne,fe){return ne.has(fe)}function ew(ne,fe){for(var ce=-1,He=ne.length;++ce<He&&Lc(fe,ne[ce],0)>-1;);return ce}function tw(ne,fe){for(var ce=ne.length;ce--&&Lc(fe,ne[ce],0)>-1;);return ce}function bF(ne,fe){for(var ce=ne.length,He=0;ce--;)ne[ce]===fe&&++He;return He}var yF=Fp(Y),wF=Fp(re);function _F(ne){return"\\"+ke[ne]}function EF(ne,fe){return ne==null?r:ne[fe]}function Bc(ne){return Ol.test(ne)}function AF(ne){return wa.test(ne)}function xF(ne){for(var fe,ce=[];!(fe=ne.next()).done;)ce.push(fe.value);return ce}function jp(ne){var fe=-1,ce=Array(ne.size);return ne.forEach(function(He,vt){ce[++fe]=[vt,He]}),ce}function rw(ne,fe){return function(ce){return ne(fe(ce))}}function Io(ne,fe){for(var ce=-1,He=ne.length,vt=0,Ht=[];++ce<He;){var Dr=ne[ce];(Dr===fe||Dr===b)&&(ne[ce]=b,Ht[vt++]=ce)}return Ht}function Nl(ne){var fe=-1,ce=Array(ne.size);return ne.forEach(function(He){ce[++fe]=He}),ce}function SF(ne){var fe=-1,ce=Array(ne.size);return ne.forEach(function(He){ce[++fe]=[He,He]}),ce}function IF(ne,fe,ce){for(var He=ce-1,vt=ne.length;++He<vt;)if(ne[He]===fe)return He;return-1}function MF(ne,fe,ce){for(var He=ce+1;He--;)if(ne[He]===fe)return He;return He}function Fc(ne){return Bc(ne)?DF(ne):lF(ne)}function Bn(ne){return Bc(ne)?OF(ne):dF(ne)}function iw(ne){for(var fe=ne.length;fe--&&at.test(ne.charAt(fe)););return fe}var CF=Fp(pe);function DF(ne){for(var fe=Tc.lastIndex=0;Tc.test(ne);)++fe;return fe}function OF(ne){return ne.match(Tc)||[]}function PF(ne){return ne.match(Dl)||[]}var $F=function ne(fe){fe=fe==null?Ft:Uc.defaults(Ft.Object(),fe,Uc.pick(Ft,Pl));var ce=fe.Array,He=fe.Date,vt=fe.Error,Ht=fe.Function,Dr=fe.Math,rr=fe.Object,zp=fe.RegExp,RF=fe.String,hn=fe.TypeError,Tl=ce.prototype,NF=Ht.prototype,kc=rr.prototype,Ll=fe["__core-js_shared__"],Bl=NF.toString,Jt=kc.hasOwnProperty,TF=0,nw=function(){var o=/[^.]+$/.exec(Ll&&Ll.keys&&Ll.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""}(),Fl=kc.toString,LF=Bl.call(rr),BF=Ft._,FF=zp("^"+Bl.call(Jt).replace(nt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ul=Di?fe.Buffer:r,Mo=fe.Symbol,kl=fe.Uint8Array,sw=Ul?Ul.allocUnsafe:r,ql=rw(rr.getPrototypeOf,rr),ow=rr.create,aw=kc.propertyIsEnumerable,jl=Tl.splice,cw=Mo?Mo.isConcatSpreadable:r,hf=Mo?Mo.iterator:r,Ea=Mo?Mo.toStringTag:r,zl=function(){try{var o=Ma(rr,"defineProperty");return o({},"",{}),o}catch{}}(),UF=fe.clearTimeout!==Ft.clearTimeout&&fe.clearTimeout,kF=He&&He.now!==Ft.Date.now&&He.now,qF=fe.setTimeout!==Ft.setTimeout&&fe.setTimeout,Hl=Dr.ceil,Kl=Dr.floor,Hp=rr.getOwnPropertySymbols,jF=Ul?Ul.isBuffer:r,uw=fe.isFinite,zF=Tl.join,HF=rw(rr.keys,rr),Or=Dr.max,ii=Dr.min,KF=He.now,WF=fe.parseInt,fw=Dr.random,VF=Tl.reverse,Kp=Ma(fe,"DataView"),lf=Ma(fe,"Map"),Wp=Ma(fe,"Promise"),qc=Ma(fe,"Set"),df=Ma(fe,"WeakMap"),pf=Ma(rr,"create"),Wl=df&&new df,jc={},GF=Ca(Kp),JF=Ca(lf),YF=Ca(Wp),QF=Ca(qc),ZF=Ca(df),Vl=Mo?Mo.prototype:r,gf=Vl?Vl.valueOf:r,hw=Vl?Vl.toString:r;function U(o){if(mr(o)&&!yt(o)&&!(o instanceof Lt)){if(o instanceof ln)return o;if(Jt.call(o,"__wrapped__"))return l5(o)}return new ln(o)}var zc=function(){function o(){}return function(c){if(!hr(c))return{};if(ow)return ow(c);o.prototype=c;var p=new o;return o.prototype=r,p}}();function Gl(){}function ln(o,c){this.__wrapped__=o,this.__actions__=[],this.__chain__=!!c,this.__index__=0,this.__values__=r}U.templateSettings={escape:it,evaluate:Be,interpolate:rt,variable:"",imports:{_:U}},U.prototype=Gl.prototype,U.prototype.constructor=U,ln.prototype=zc(Gl.prototype),ln.prototype.constructor=ln;function Lt(o){this.__wrapped__=o,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=m,this.__views__=[]}function XF(){var o=new Lt(this.__wrapped__);return o.__actions__=Oi(this.__actions__),o.__dir__=this.__dir__,o.__filtered__=this.__filtered__,o.__iteratees__=Oi(this.__iteratees__),o.__takeCount__=this.__takeCount__,o.__views__=Oi(this.__views__),o}function eU(){if(this.__filtered__){var o=new Lt(this);o.__dir__=-1,o.__filtered__=!0}else o=this.clone(),o.__dir__*=-1;return o}function tU(){var o=this.__wrapped__.value(),c=this.__dir__,p=yt(o),x=c<0,$=p?o.length:0,j=dk(0,$,this.__views__),Q=j.start,Z=j.end,se=Z-Q,le=x?Z:Q-1,de=this.__iteratees__,ge=de.length,De=0,Je=ii(se,this.__takeCount__);if(!p||!x&&$==se&&Je==se)return Tw(o,this.__actions__);var ut=[];e:for(;se--&&De<Je;){le+=c;for(var St=-1,ft=o[le];++St<ge;){var Pt=de[St],Ut=Pt.iteratee,Wi=Pt.type,vi=Ut(ft);if(Wi==v)ft=vi;else if(!vi){if(Wi==d)continue e;break e}}ut[De++]=ft}return ut}Lt.prototype=zc(Gl.prototype),Lt.prototype.constructor=Lt;function Aa(o){var c=-1,p=o==null?0:o.length;for(this.clear();++c<p;){var x=o[c];this.set(x[0],x[1])}}function rU(){this.__data__=pf?pf(null):{},this.size=0}function iU(o){var c=this.has(o)&&delete this.__data__[o];return this.size-=c?1:0,c}function nU(o){var c=this.__data__;if(pf){var p=c[o];return p===h?r:p}return Jt.call(c,o)?c[o]:r}function sU(o){var c=this.__data__;return pf?c[o]!==r:Jt.call(c,o)}function oU(o,c){var p=this.__data__;return this.size+=this.has(o)?0:1,p[o]=pf&&c===r?h:c,this}Aa.prototype.clear=rU,Aa.prototype.delete=iU,Aa.prototype.get=nU,Aa.prototype.has=sU,Aa.prototype.set=oU;function js(o){var c=-1,p=o==null?0:o.length;for(this.clear();++c<p;){var x=o[c];this.set(x[0],x[1])}}function aU(){this.__data__=[],this.size=0}function cU(o){var c=this.__data__,p=Jl(c,o);if(p<0)return!1;var x=c.length-1;return p==x?c.pop():jl.call(c,p,1),--this.size,!0}function uU(o){var c=this.__data__,p=Jl(c,o);return p<0?r:c[p][1]}function fU(o){return Jl(this.__data__,o)>-1}function hU(o,c){var p=this.__data__,x=Jl(p,o);return x<0?(++this.size,p.push([o,c])):p[x][1]=c,this}js.prototype.clear=aU,js.prototype.delete=cU,js.prototype.get=uU,js.prototype.has=fU,js.prototype.set=hU;function zs(o){var c=-1,p=o==null?0:o.length;for(this.clear();++c<p;){var x=o[c];this.set(x[0],x[1])}}function lU(){this.size=0,this.__data__={hash:new Aa,map:new(lf||js),string:new Aa}}function dU(o){var c=a0(this,o).delete(o);return this.size-=c?1:0,c}function pU(o){return a0(this,o).get(o)}function gU(o){return a0(this,o).has(o)}function vU(o,c){var p=a0(this,o),x=p.size;return p.set(o,c),this.size+=p.size==x?0:1,this}zs.prototype.clear=lU,zs.prototype.delete=dU,zs.prototype.get=pU,zs.prototype.has=gU,zs.prototype.set=vU;function xa(o){var c=-1,p=o==null?0:o.length;for(this.__data__=new zs;++c<p;)this.add(o[c])}function mU(o){return this.__data__.set(o,h),this}function bU(o){return this.__data__.has(o)}xa.prototype.add=xa.prototype.push=mU,xa.prototype.has=bU;function Fn(o){var c=this.__data__=new js(o);this.size=c.size}function yU(){this.__data__=new js,this.size=0}function wU(o){var c=this.__data__,p=c.delete(o);return this.size=c.size,p}function _U(o){return this.__data__.get(o)}function EU(o){return this.__data__.has(o)}function AU(o,c){var p=this.__data__;if(p instanceof js){var x=p.__data__;if(!lf||x.length<n-1)return x.push([o,c]),this.size=++p.size,this;p=this.__data__=new zs(x)}return p.set(o,c),this.size=p.size,this}Fn.prototype.clear=yU,Fn.prototype.delete=wU,Fn.prototype.get=_U,Fn.prototype.has=EU,Fn.prototype.set=AU;function lw(o,c){var p=yt(o),x=!p&&Da(o),$=!p&&!x&&$o(o),j=!p&&!x&&!$&&Vc(o),Q=p||x||$||j,Z=Q?kp(o.length,RF):[],se=Z.length;for(var le in o)(c||Jt.call(o,le))&&!(Q&&(le=="length"||$&&(le=="offset"||le=="parent")||j&&(le=="buffer"||le=="byteLength"||le=="byteOffset")||Vs(le,se)))&&Z.push(le);return Z}function dw(o){var c=o.length;return c?o[ig(0,c-1)]:r}function xU(o,c){return c0(Oi(o),Sa(c,0,o.length))}function SU(o){return c0(Oi(o))}function Vp(o,c,p){(p!==r&&!Un(o[c],p)||p===r&&!(c in o))&&Hs(o,c,p)}function vf(o,c,p){var x=o[c];(!(Jt.call(o,c)&&Un(x,p))||p===r&&!(c in o))&&Hs(o,c,p)}function Jl(o,c){for(var p=o.length;p--;)if(Un(o[p][0],c))return p;return-1}function IU(o,c,p,x){return Co(o,function($,j,Q){c(x,$,p($),Q)}),x}function pw(o,c){return o&&As(c,Ur(c),o)}function MU(o,c){return o&&As(c,$i(c),o)}function Hs(o,c,p){c=="__proto__"&&zl?zl(o,c,{configurable:!0,enumerable:!0,value:p,writable:!0}):o[c]=p}function Gp(o,c){for(var p=-1,x=c.length,$=ce(x),j=o==null;++p<x;)$[p]=j?r:Cg(o,c[p]);return $}function Sa(o,c,p){return o===o&&(p!==r&&(o=o<=p?o:p),c!==r&&(o=o>=c?o:c)),o}function dn(o,c,p,x,$,j){var Q,Z=c&w,se=c&I,le=c&S;if(p&&(Q=$?p(o,x,$,j):p(o)),Q!==r)return Q;if(!hr(o))return o;var de=yt(o);if(de){if(Q=gk(o),!Z)return Oi(o,Q)}else{var ge=ni(o),De=ge==oe||ge==ue;if($o(o))return Fw(o,Z);if(ge==Re||ge==P||De&&!$){if(Q=se||De?{}:i5(o),!Z)return se?nk(o,MU(Q,o)):ik(o,pw(Q,o))}else{if(!Qt[ge])return $?o:{};Q=vk(o,ge,Z)}}j||(j=new Fn);var Je=j.get(o);if(Je)return Je;j.set(o,Q),$5(o)?o.forEach(function(ft){Q.add(dn(ft,c,p,ft,o,j))}):O5(o)&&o.forEach(function(ft,Pt){Q.set(Pt,dn(ft,c,p,Pt,o,j))});var ut=le?se?pg:dg:se?$i:Ur,St=de?r:ut(o);return fn(St||o,function(ft,Pt){St&&(Pt=ft,ft=o[Pt]),vf(Q,Pt,dn(ft,c,p,Pt,o,j))}),Q}function CU(o){var c=Ur(o);return function(p){return gw(p,o,c)}}function gw(o,c,p){var x=p.length;if(o==null)return!x;for(o=rr(o);x--;){var $=p[x],j=c[$],Q=o[$];if(Q===r&&!($ in o)||!j(Q))return!1}return!0}function vw(o,c,p){if(typeof o!="function")throw new hn(a);return Af(function(){o.apply(r,p)},c)}function mf(o,c,p,x){var $=-1,j=$l,Q=!0,Z=o.length,se=[],le=c.length;if(!Z)return se;p&&(c=ur(c,zi(p))),x?(j=Np,Q=!1):c.length>=n&&(j=ff,Q=!1,c=new xa(c));e:for(;++$<Z;){var de=o[$],ge=p==null?de:p(de);if(de=x||de!==0?de:0,Q&&ge===ge){for(var De=le;De--;)if(c[De]===ge)continue e;se.push(de)}else j(c,ge,x)||se.push(de)}return se}var Co=zw(Es),mw=zw(Yp,!0);function DU(o,c){var p=!0;return Co(o,function(x,$,j){return p=!!c(x,$,j),p}),p}function Yl(o,c,p){for(var x=-1,$=o.length;++x<$;){var j=o[x],Q=c(j);if(Q!=null&&(Z===r?Q===Q&&!Ki(Q):p(Q,Z)))var Z=Q,se=j}return se}function OU(o,c,p,x){var $=o.length;for(p=xt(p),p<0&&(p=-p>$?0:$+p),x=x===r||x>$?$:xt(x),x<0&&(x+=$),x=p>x?0:N5(x);p<x;)o[p++]=c;return o}function bw(o,c){var p=[];return Co(o,function(x,$,j){c(x,$,j)&&p.push(x)}),p}function Wr(o,c,p,x,$){var j=-1,Q=o.length;for(p||(p=bk),$||($=[]);++j<Q;){var Z=o[j];c>0&&p(Z)?c>1?Wr(Z,c-1,p,x,$):So($,Z):x||($[$.length]=Z)}return $}var Jp=Hw(),yw=Hw(!0);function Es(o,c){return o&&Jp(o,c,Ur)}function Yp(o,c){return o&&yw(o,c,Ur)}function Ql(o,c){return xo(c,function(p){return Gs(o[p])})}function Ia(o,c){c=Oo(c,o);for(var p=0,x=c.length;o!=null&&p<x;)o=o[xs(c[p++])];return p&&p==x?o:r}function ww(o,c,p){var x=c(o);return yt(o)?x:So(x,p(o))}function pi(o){return o==null?o===r?Te:we:Ea&&Ea in rr(o)?lk(o):Sk(o)}function Qp(o,c){return o>c}function PU(o,c){return o!=null&&Jt.call(o,c)}function $U(o,c){return o!=null&&c in rr(o)}function RU(o,c,p){return o>=ii(c,p)&&o<Or(c,p)}function Zp(o,c,p){for(var x=p?Np:$l,$=o[0].length,j=o.length,Q=j,Z=ce(j),se=1/0,le=[];Q--;){var de=o[Q];Q&&c&&(de=ur(de,zi(c))),se=ii(de.length,se),Z[Q]=!p&&(c||$>=120&&de.length>=120)?new xa(Q&&de):r}de=o[0];var ge=-1,De=Z[0];e:for(;++ge<$&&le.length<se;){var Je=de[ge],ut=c?c(Je):Je;if(Je=p||Je!==0?Je:0,!(De?ff(De,ut):x(le,ut,p))){for(Q=j;--Q;){var St=Z[Q];if(!(St?ff(St,ut):x(o[Q],ut,p)))continue e}De&&De.push(ut),le.push(Je)}}return le}function NU(o,c,p,x){return Es(o,function($,j,Q){c(x,p($),j,Q)}),x}function bf(o,c,p){c=Oo(c,o),o=a5(o,c);var x=o==null?o:o[xs(gn(c))];return x==null?r:Fr(x,o,p)}function _w(o){return mr(o)&&pi(o)==P}function TU(o){return mr(o)&&pi(o)==Se}function LU(o){return mr(o)&&pi(o)==J}function yf(o,c,p,x,$){return o===c?!0:o==null||c==null||!mr(o)&&!mr(c)?o!==o&&c!==c:BU(o,c,p,x,yf,$)}function BU(o,c,p,x,$,j){var Q=yt(o),Z=yt(c),se=Q?te:ni(o),le=Z?te:ni(c);se=se==P?Re:se,le=le==P?Re:le;var de=se==Re,ge=le==Re,De=se==le;if(De&&$o(o)){if(!$o(c))return!1;Q=!0,de=!1}if(De&&!de)return j||(j=new Fn),Q||Vc(o)?e5(o,c,p,x,$,j):fk(o,c,se,p,x,$,j);if(!(p&D)){var Je=de&&Jt.call(o,"__wrapped__"),ut=ge&&Jt.call(c,"__wrapped__");if(Je||ut){var St=Je?o.value():o,ft=ut?c.value():c;return j||(j=new Fn),$(St,ft,p,x,j)}}return De?(j||(j=new Fn),hk(o,c,p,x,$,j)):!1}function FU(o){return mr(o)&&ni(o)==he}function Xp(o,c,p,x){var $=p.length,j=$,Q=!x;if(o==null)return!j;for(o=rr(o);$--;){var Z=p[$];if(Q&&Z[2]?Z[1]!==o[Z[0]]:!(Z[0]in o))return!1}for(;++$<j;){Z=p[$];var se=Z[0],le=o[se],de=Z[1];if(Q&&Z[2]){if(le===r&&!(se in o))return!1}else{var ge=new Fn;if(x)var De=x(le,de,se,o,c,ge);if(!(De===r?yf(de,le,D|T,x,ge):De))return!1}}return!0}function Ew(o){if(!hr(o)||wk(o))return!1;var c=Gs(o)?FF:ei;return c.test(Ca(o))}function UU(o){return mr(o)&&pi(o)==Ne}function kU(o){return mr(o)&&ni(o)==Me}function qU(o){return mr(o)&&p0(o.length)&&!!Xt[pi(o)]}function Aw(o){return typeof o=="function"?o:o==null?Ri:typeof o=="object"?yt(o)?Iw(o[0],o[1]):Sw(o):K5(o)}function eg(o){if(!Ef(o))return HF(o);var c=[];for(var p in rr(o))Jt.call(o,p)&&p!="constructor"&&c.push(p);return c}function jU(o){if(!hr(o))return xk(o);var c=Ef(o),p=[];for(var x in o)x=="constructor"&&(c||!Jt.call(o,x))||p.push(x);return p}function tg(o,c){return o<c}function xw(o,c){var p=-1,x=Pi(o)?ce(o.length):[];return Co(o,function($,j,Q){x[++p]=c($,j,Q)}),x}function Sw(o){var c=vg(o);return c.length==1&&c[0][2]?s5(c[0][0],c[0][1]):function(p){return p===o||Xp(p,o,c)}}function Iw(o,c){return bg(o)&&n5(c)?s5(xs(o),c):function(p){var x=Cg(p,o);return x===r&&x===c?Dg(p,o):yf(c,x,D|T)}}function Zl(o,c,p,x,$){o!==c&&Jp(c,function(j,Q){if($||($=new Fn),hr(j))zU(o,c,Q,p,Zl,x,$);else{var Z=x?x(wg(o,Q),j,Q+"",o,c,$):r;Z===r&&(Z=j),Vp(o,Q,Z)}},$i)}function zU(o,c,p,x,$,j,Q){var Z=wg(o,p),se=wg(c,p),le=Q.get(se);if(le){Vp(o,p,le);return}var de=j?j(Z,se,p+"",o,c,Q):r,ge=de===r;if(ge){var De=yt(se),Je=!De&&$o(se),ut=!De&&!Je&&Vc(se);de=se,De||Je||ut?yt(Z)?de=Z:Er(Z)?de=Oi(Z):Je?(ge=!1,de=Fw(se,!0)):ut?(ge=!1,de=Uw(se,!0)):de=[]:xf(se)||Da(se)?(de=Z,Da(Z)?de=T5(Z):(!hr(Z)||Gs(Z))&&(de=i5(se))):ge=!1}ge&&(Q.set(se,de),$(de,se,x,j,Q),Q.delete(se)),Vp(o,p,de)}function Mw(o,c){var p=o.length;if(p)return c+=c<0?p:0,Vs(c,p)?o[c]:r}function Cw(o,c,p){c.length?c=ur(c,function(j){return yt(j)?function(Q){return Ia(Q,j.length===1?j[0]:j)}:j}):c=[Ri];var x=-1;c=ur(c,zi(ot()));var $=xw(o,function(j,Q,Z){var se=ur(c,function(le){return le(j)});return{criteria:se,index:++x,value:j}});return vF($,function(j,Q){return rk(j,Q,p)})}function HU(o,c){return Dw(o,c,function(p,x){return Dg(o,x)})}function Dw(o,c,p){for(var x=-1,$=c.length,j={};++x<$;){var Q=c[x],Z=Ia(o,Q);p(Z,Q)&&wf(j,Oo(Q,o),Z)}return j}function KU(o){return function(c){return Ia(c,o)}}function rg(o,c,p,x){var $=x?gF:Lc,j=-1,Q=c.length,Z=o;for(o===c&&(c=Oi(c)),p&&(Z=ur(o,zi(p)));++j<Q;)for(var se=0,le=c[j],de=p?p(le):le;(se=$(Z,de,se,x))>-1;)Z!==o&&jl.call(Z,se,1),jl.call(o,se,1);return o}function Ow(o,c){for(var p=o?c.length:0,x=p-1;p--;){var $=c[p];if(p==x||$!==j){var j=$;Vs($)?jl.call(o,$,1):og(o,$)}}return o}function ig(o,c){return o+Kl(fw()*(c-o+1))}function WU(o,c,p,x){for(var $=-1,j=Or(Hl((c-o)/(p||1)),0),Q=ce(j);j--;)Q[x?j:++$]=o,o+=p;return Q}function ng(o,c){var p="";if(!o||c<1||c>O)return p;do c%2&&(p+=o),c=Kl(c/2),c&&(o+=o);while(c);return p}function Mt(o,c){return _g(o5(o,c,Ri),o+"")}function VU(o){return dw(Gc(o))}function GU(o,c){var p=Gc(o);return c0(p,Sa(c,0,p.length))}function wf(o,c,p,x){if(!hr(o))return o;c=Oo(c,o);for(var $=-1,j=c.length,Q=j-1,Z=o;Z!=null&&++$<j;){var se=xs(c[$]),le=p;if(se==="__proto__"||se==="constructor"||se==="prototype")return o;if($!=Q){var de=Z[se];le=x?x(de,se,Z):r,le===r&&(le=hr(de)?de:Vs(c[$+1])?[]:{})}vf(Z,se,le),Z=Z[se]}return o}var Pw=Wl?function(o,c){return Wl.set(o,c),o}:Ri,JU=zl?function(o,c){return zl(o,"toString",{configurable:!0,enumerable:!1,value:Pg(c),writable:!0})}:Ri;function YU(o){return c0(Gc(o))}function pn(o,c,p){var x=-1,$=o.length;c<0&&(c=-c>$?0:$+c),p=p>$?$:p,p<0&&(p+=$),$=c>p?0:p-c>>>0,c>>>=0;for(var j=ce($);++x<$;)j[x]=o[x+c];return j}function QU(o,c){var p;return Co(o,function(x,$,j){return p=c(x,$,j),!p}),!!p}function Xl(o,c,p){var x=0,$=o==null?x:o.length;if(typeof c=="number"&&c===c&&$<=X){for(;x<$;){var j=x+$>>>1,Q=o[j];Q!==null&&!Ki(Q)&&(p?Q<=c:Q<c)?x=j+1:$=j}return $}return sg(o,c,Ri,p)}function sg(o,c,p,x){var $=0,j=o==null?0:o.length;if(j===0)return 0;c=p(c);for(var Q=c!==c,Z=c===null,se=Ki(c),le=c===r;$<j;){var de=Kl(($+j)/2),ge=p(o[de]),De=ge!==r,Je=ge===null,ut=ge===ge,St=Ki(ge);if(Q)var ft=x||ut;else le?ft=ut&&(x||De):Z?ft=ut&&De&&(x||!Je):se?ft=ut&&De&&!Je&&(x||!St):Je||St?ft=!1:ft=x?ge<=c:ge<c;ft?$=de+1:j=de}return ii(j,N)}function $w(o,c){for(var p=-1,x=o.length,$=0,j=[];++p<x;){var Q=o[p],Z=c?c(Q):Q;if(!p||!Un(Z,se)){var se=Z;j[$++]=Q===0?0:Q}}return j}function Rw(o){return typeof o=="number"?o:Ki(o)?g:+o}function Hi(o){if(typeof o=="string")return o;if(yt(o))return ur(o,Hi)+"";if(Ki(o))return hw?hw.call(o):"";var c=o+"";return c=="0"&&1/o==-C?"-0":c}function Do(o,c,p){var x=-1,$=$l,j=o.length,Q=!0,Z=[],se=Z;if(p)Q=!1,$=Np;else if(j>=n){var le=c?null:ck(o);if(le)return Nl(le);Q=!1,$=ff,se=new xa}else se=c?[]:Z;e:for(;++x<j;){var de=o[x],ge=c?c(de):de;if(de=p||de!==0?de:0,Q&&ge===ge){for(var De=se.length;De--;)if(se[De]===ge)continue e;c&&se.push(ge),Z.push(de)}else $(se,ge,p)||(se!==Z&&se.push(ge),Z.push(de))}return Z}function og(o,c){return c=Oo(c,o),o=a5(o,c),o==null||delete o[xs(gn(c))]}function Nw(o,c,p,x){return wf(o,c,p(Ia(o,c)),x)}function e0(o,c,p,x){for(var $=o.length,j=x?$:-1;(x?j--:++j<$)&&c(o[j],j,o););return p?pn(o,x?0:j,x?j+1:$):pn(o,x?j+1:0,x?$:j)}function Tw(o,c){var p=o;return p instanceof Lt&&(p=p.value()),Tp(c,function(x,$){return $.func.apply($.thisArg,So([x],$.args))},p)}function ag(o,c,p){var x=o.length;if(x<2)return x?Do(o[0]):[];for(var $=-1,j=ce(x);++$<x;)for(var Q=o[$],Z=-1;++Z<x;)Z!=$&&(j[$]=mf(j[$]||Q,o[Z],c,p));return Do(Wr(j,1),c,p)}function Lw(o,c,p){for(var x=-1,$=o.length,j=c.length,Q={};++x<$;){var Z=x<j?c[x]:r;p(Q,o[x],Z)}return Q}function cg(o){return Er(o)?o:[]}function ug(o){return typeof o=="function"?o:Ri}function Oo(o,c){return yt(o)?o:bg(o,c)?[o]:h5(Vt(o))}var ZU=Mt;function Po(o,c,p){var x=o.length;return p=p===r?x:p,!c&&p>=x?o:pn(o,c,p)}var Bw=UF||function(o){return Ft.clearTimeout(o)};function Fw(o,c){if(c)return o.slice();var p=o.length,x=sw?sw(p):new o.constructor(p);return o.copy(x),x}function fg(o){var c=new o.constructor(o.byteLength);return new kl(c).set(new kl(o)),c}function XU(o,c){var p=c?fg(o.buffer):o.buffer;return new o.constructor(p,o.byteOffset,o.byteLength)}function ek(o){var c=new o.constructor(o.source,_t.exec(o));return c.lastIndex=o.lastIndex,c}function tk(o){return gf?rr(gf.call(o)):{}}function Uw(o,c){var p=c?fg(o.buffer):o.buffer;return new o.constructor(p,o.byteOffset,o.length)}function kw(o,c){if(o!==c){var p=o!==r,x=o===null,$=o===o,j=Ki(o),Q=c!==r,Z=c===null,se=c===c,le=Ki(c);if(!Z&&!le&&!j&&o>c||j&&Q&&se&&!Z&&!le||x&&Q&&se||!p&&se||!$)return 1;if(!x&&!j&&!le&&o<c||le&&p&&$&&!x&&!j||Z&&p&&$||!Q&&$||!se)return-1}return 0}function rk(o,c,p){for(var x=-1,$=o.criteria,j=c.criteria,Q=$.length,Z=p.length;++x<Q;){var se=kw($[x],j[x]);if(se){if(x>=Z)return se;var le=p[x];return se*(le=="desc"?-1:1)}}return o.index-c.index}function qw(o,c,p,x){for(var $=-1,j=o.length,Q=p.length,Z=-1,se=c.length,le=Or(j-Q,0),de=ce(se+le),ge=!x;++Z<se;)de[Z]=c[Z];for(;++$<Q;)(ge||$<j)&&(de[p[$]]=o[$]);for(;le--;)de[Z++]=o[$++];return de}function jw(o,c,p,x){for(var $=-1,j=o.length,Q=-1,Z=p.length,se=-1,le=c.length,de=Or(j-Z,0),ge=ce(de+le),De=!x;++$<de;)ge[$]=o[$];for(var Je=$;++se<le;)ge[Je+se]=c[se];for(;++Q<Z;)(De||$<j)&&(ge[Je+p[Q]]=o[$++]);return ge}function Oi(o,c){var p=-1,x=o.length;for(c||(c=ce(x));++p<x;)c[p]=o[p];return c}function As(o,c,p,x){var $=!p;p||(p={});for(var j=-1,Q=c.length;++j<Q;){var Z=c[j],se=x?x(p[Z],o[Z],Z,p,o):r;se===r&&(se=o[Z]),$?Hs(p,Z,se):vf(p,Z,se)}return p}function ik(o,c){return As(o,mg(o),c)}function nk(o,c){return As(o,t5(o),c)}function t0(o,c){return function(p,x){var $=yt(p)?uF:IU,j=c?c():{};return $(p,o,ot(x,2),j)}}function Hc(o){return Mt(function(c,p){var x=-1,$=p.length,j=$>1?p[$-1]:r,Q=$>2?p[2]:r;for(j=o.length>3&&typeof j=="function"?($--,j):r,Q&&gi(p[0],p[1],Q)&&(j=$<3?r:j,$=1),c=rr(c);++x<$;){var Z=p[x];Z&&o(c,Z,x,j)}return c})}function zw(o,c){return function(p,x){if(p==null)return p;if(!Pi(p))return o(p,x);for(var $=p.length,j=c?$:-1,Q=rr(p);(c?j--:++j<$)&&x(Q[j],j,Q)!==!1;);return p}}function Hw(o){return function(c,p,x){for(var $=-1,j=rr(c),Q=x(c),Z=Q.length;Z--;){var se=Q[o?Z:++$];if(p(j[se],se,j)===!1)break}return c}}function sk(o,c,p){var x=c&q,$=_f(o);function j(){var Q=this&&this!==Ft&&this instanceof j?$:o;return Q.apply(x?p:this,arguments)}return j}function Kw(o){return function(c){c=Vt(c);var p=Bc(c)?Bn(c):r,x=p?p[0]:c.charAt(0),$=p?Po(p,1).join(""):c.slice(1);return x[o]()+$}}function Kc(o){return function(c){return Tp(z5(j5(c).replace(cf,"")),o,"")}}function _f(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=zc(o.prototype),x=o.apply(p,c);return hr(x)?x:p}}function ok(o,c,p){var x=_f(o);function $(){for(var j=arguments.length,Q=ce(j),Z=j,se=Wc($);Z--;)Q[Z]=arguments[Z];var le=j<3&&Q[0]!==se&&Q[j-1]!==se?[]:Io(Q,se);if(j-=le.length,j<p)return Yw(o,c,r0,$.placeholder,r,Q,le,r,r,p-j);var de=this&&this!==Ft&&this instanceof $?x:o;return Fr(de,this,Q)}return $}function Ww(o){return function(c,p,x){var $=rr(c);if(!Pi(c)){var j=ot(p,3);c=Ur(c),p=function(Z){return j($[Z],Z,$)}}var Q=o(c,p,x);return Q>-1?$[j?c[Q]:Q]:r}}function Vw(o){return Ws(function(c){var p=c.length,x=p,$=ln.prototype.thru;for(o&&c.reverse();x--;){var j=c[x];if(typeof j!="function")throw new hn(a);if($&&!Q&&o0(j)=="wrapper")var Q=new ln([],!0)}for(x=Q?x:p;++x<p;){j=c[x];var Z=o0(j),se=Z=="wrapper"?gg(j):r;se&&yg(se[0])&&se[1]==(_|W|k|B)&&!se[4].length&&se[9]==1?Q=Q[o0(se[0])].apply(Q,se[3]):Q=j.length==1&&yg(j)?Q[Z]():Q.thru(j)}return function(){var le=arguments,de=le[0];if(Q&&le.length==1&&yt(de))return Q.plant(de).value();for(var ge=0,De=p?c[ge].apply(this,le):de;++ge<p;)De=c[ge].call(this,De);return De}})}function r0(o,c,p,x,$,j,Q,Z,se,le){var de=c&_,ge=c&q,De=c&K,Je=c&(W|R),ut=c&ee,St=De?r:_f(o);function ft(){for(var Pt=arguments.length,Ut=ce(Pt),Wi=Pt;Wi--;)Ut[Wi]=arguments[Wi];if(Je)var vi=Wc(ft),Vi=bF(Ut,vi);if(x&&(Ut=qw(Ut,x,$,Je)),j&&(Ut=jw(Ut,j,Q,Je)),Pt-=Vi,Je&&Pt<le){var Ar=Io(Ut,vi);return Yw(o,c,r0,ft.placeholder,p,Ut,Ar,Z,se,le-Pt)}var kn=ge?p:this,Ys=De?kn[o]:o;return Pt=Ut.length,Z?Ut=Ik(Ut,Z):ut&&Pt>1&&Ut.reverse(),de&&se<Pt&&(Ut.length=se),this&&this!==Ft&&this instanceof ft&&(Ys=St||_f(Ys)),Ys.apply(kn,Ut)}return ft}function Gw(o,c){return function(p,x){return NU(p,o,c(x),{})}}function i0(o,c){return function(p,x){var $;if(p===r&&x===r)return c;if(p!==r&&($=p),x!==r){if($===r)return x;typeof p=="string"||typeof x=="string"?(p=Hi(p),x=Hi(x)):(p=Rw(p),x=Rw(x)),$=o(p,x)}return $}}function hg(o){return Ws(function(c){return c=ur(c,zi(ot())),Mt(function(p){var x=this;return o(c,function($){return Fr($,x,p)})})})}function n0(o,c){c=c===r?" ":Hi(c);var p=c.length;if(p<2)return p?ng(c,o):c;var x=ng(c,Hl(o/Fc(c)));return Bc(c)?Po(Bn(x),0,o).join(""):x.slice(0,o)}function ak(o,c,p,x){var $=c&q,j=_f(o);function Q(){for(var Z=-1,se=arguments.length,le=-1,de=x.length,ge=ce(de+se),De=this&&this!==Ft&&this instanceof Q?j:o;++le<de;)ge[le]=x[le];for(;se--;)ge[le++]=arguments[++Z];return Fr(De,$?p:this,ge)}return Q}function Jw(o){return function(c,p,x){return x&&typeof x!="number"&&gi(c,p,x)&&(p=x=r),c=Js(c),p===r?(p=c,c=0):p=Js(p),x=x===r?c<p?1:-1:Js(x),WU(c,p,x,o)}}function s0(o){return function(c,p){return typeof c=="string"&&typeof p=="string"||(c=vn(c),p=vn(p)),o(c,p)}}function Yw(o,c,p,x,$,j,Q,Z,se,le){var de=c&W,ge=de?Q:r,De=de?r:Q,Je=de?j:r,ut=de?r:j;c|=de?k:H,c&=~(de?H:k),c&F||(c&=~(q|K));var St=[o,c,$,Je,ge,ut,De,Z,se,le],ft=p.apply(r,St);return yg(o)&&c5(ft,St),ft.placeholder=x,u5(ft,o,c)}function lg(o){var c=Dr[o];return function(p,x){if(p=vn(p),x=x==null?0:ii(xt(x),292),x&&uw(p)){var $=(Vt(p)+"e").split("e"),j=c($[0]+"e"+(+$[1]+x));return $=(Vt(j)+"e").split("e"),+($[0]+"e"+(+$[1]-x))}return c(p)}}var ck=qc&&1/Nl(new qc([,-0]))[1]==C?function(o){return new qc(o)}:Ng;function Qw(o){return function(c){var p=ni(c);return p==he?jp(c):p==Me?SF(c):mF(c,o(c))}}function Ks(o,c,p,x,$,j,Q,Z){var se=c&K;if(!se&&typeof o!="function")throw new hn(a);var le=x?x.length:0;if(le||(c&=~(k|H),x=$=r),Q=Q===r?Q:Or(xt(Q),0),Z=Z===r?Z:xt(Z),le-=$?$.length:0,c&H){var de=x,ge=$;x=$=r}var De=se?r:gg(o),Je=[o,c,p,x,$,de,ge,j,Q,Z];if(De&&Ak(Je,De),o=Je[0],c=Je[1],p=Je[2],x=Je[3],$=Je[4],Z=Je[9]=Je[9]===r?se?0:o.length:Or(Je[9]-le,0),!Z&&c&(W|R)&&(c&=~(W|R)),!c||c==q)var ut=sk(o,c,p);else c==W||c==R?ut=ok(o,c,Z):(c==k||c==(q|k))&&!$.length?ut=ak(o,c,p,x):ut=r0.apply(r,Je);var St=De?Pw:c5;return u5(St(ut,Je),o,c)}function Zw(o,c,p,x){return o===r||Un(o,kc[p])&&!Jt.call(x,p)?c:o}function Xw(o,c,p,x,$,j){return hr(o)&&hr(c)&&(j.set(c,o),Zl(o,c,r,Xw,j),j.delete(c)),o}function uk(o){return xf(o)?r:o}function e5(o,c,p,x,$,j){var Q=p&D,Z=o.length,se=c.length;if(Z!=se&&!(Q&&se>Z))return!1;var le=j.get(o),de=j.get(c);if(le&&de)return le==c&&de==o;var ge=-1,De=!0,Je=p&T?new xa:r;for(j.set(o,c),j.set(c,o);++ge<Z;){var ut=o[ge],St=c[ge];if(x)var ft=Q?x(St,ut,ge,c,o,j):x(ut,St,ge,o,c,j);if(ft!==r){if(ft)continue;De=!1;break}if(Je){if(!Lp(c,function(Pt,Ut){if(!ff(Je,Ut)&&(ut===Pt||$(ut,Pt,p,x,j)))return Je.push(Ut)})){De=!1;break}}else if(!(ut===St||$(ut,St,p,x,j))){De=!1;break}}return j.delete(o),j.delete(c),De}function fk(o,c,p,x,$,j,Q){switch(p){case me:if(o.byteLength!=c.byteLength||o.byteOffset!=c.byteOffset)return!1;o=o.buffer,c=c.buffer;case Se:return!(o.byteLength!=c.byteLength||!j(new kl(o),new kl(c)));case G:case J:case ye:return Un(+o,+c);case V:return o.name==c.name&&o.message==c.message;case Ne:case be:return o==c+"";case he:var Z=jp;case Me:var se=x&D;if(Z||(Z=Nl),o.size!=c.size&&!se)return!1;var le=Q.get(o);if(le)return le==c;x|=T,Q.set(o,c);var de=e5(Z(o),Z(c),x,$,j,Q);return Q.delete(o),de;case Pe:if(gf)return gf.call(o)==gf.call(c)}return!1}function hk(o,c,p,x,$,j){var Q=p&D,Z=dg(o),se=Z.length,le=dg(c),de=le.length;if(se!=de&&!Q)return!1;for(var ge=se;ge--;){var De=Z[ge];if(!(Q?De in c:Jt.call(c,De)))return!1}var Je=j.get(o),ut=j.get(c);if(Je&&ut)return Je==c&&ut==o;var St=!0;j.set(o,c),j.set(c,o);for(var ft=Q;++ge<se;){De=Z[ge];var Pt=o[De],Ut=c[De];if(x)var Wi=Q?x(Ut,Pt,De,c,o,j):x(Pt,Ut,De,o,c,j);if(!(Wi===r?Pt===Ut||$(Pt,Ut,p,x,j):Wi)){St=!1;break}ft||(ft=De=="constructor")}if(St&&!ft){var vi=o.constructor,Vi=c.constructor;vi!=Vi&&"constructor"in o&&"constructor"in c&&!(typeof vi=="function"&&vi instanceof vi&&typeof Vi=="function"&&Vi instanceof Vi)&&(St=!1)}return j.delete(o),j.delete(c),St}function Ws(o){return _g(o5(o,r,g5),o+"")}function dg(o){return ww(o,Ur,mg)}function pg(o){return ww(o,$i,t5)}var gg=Wl?function(o){return Wl.get(o)}:Ng;function o0(o){for(var c=o.name+"",p=jc[c],x=Jt.call(jc,c)?p.length:0;x--;){var $=p[x],j=$.func;if(j==null||j==o)return $.name}return c}function Wc(o){var c=Jt.call(U,"placeholder")?U:o;return c.placeholder}function ot(){var o=U.iteratee||$g;return o=o===$g?Aw:o,arguments.length?o(arguments[0],arguments[1]):o}function a0(o,c){var p=o.__data__;return yk(c)?p[typeof c=="string"?"string":"hash"]:p.map}function vg(o){for(var c=Ur(o),p=c.length;p--;){var x=c[p],$=o[x];c[p]=[x,$,n5($)]}return c}function Ma(o,c){var p=EF(o,c);return Ew(p)?p:r}function lk(o){var c=Jt.call(o,Ea),p=o[Ea];try{o[Ea]=r;var x=!0}catch{}var $=Fl.call(o);return x&&(c?o[Ea]=p:delete o[Ea]),$}var mg=Hp?function(o){return o==null?[]:(o=rr(o),xo(Hp(o),function(c){return aw.call(o,c)}))}:Tg,t5=Hp?function(o){for(var c=[];o;)So(c,mg(o)),o=ql(o);return c}:Tg,ni=pi;(Kp&&ni(new Kp(new ArrayBuffer(1)))!=me||lf&&ni(new lf)!=he||Wp&&ni(Wp.resolve())!=Xe||qc&&ni(new qc)!=Me||df&&ni(new df)!=ve)&&(ni=function(o){var c=pi(o),p=c==Re?o.constructor:r,x=p?Ca(p):"";if(x)switch(x){case GF:return me;case JF:return he;case YF:return Xe;case QF:return Me;case ZF:return ve}return c});function dk(o,c,p){for(var x=-1,$=p.length;++x<$;){var j=p[x],Q=j.size;switch(j.type){case"drop":o+=Q;break;case"dropRight":c-=Q;break;case"take":c=ii(c,o+Q);break;case"takeRight":o=Or(o,c-Q);break}}return{start:o,end:c}}function pk(o){var c=o.match(Ze);return c?c[1].split(lt):[]}function r5(o,c,p){c=Oo(c,o);for(var x=-1,$=c.length,j=!1;++x<$;){var Q=xs(c[x]);if(!(j=o!=null&&p(o,Q)))break;o=o[Q]}return j||++x!=$?j:($=o==null?0:o.length,!!$&&p0($)&&Vs(Q,$)&&(yt(o)||Da(o)))}function gk(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 i5(o){return typeof o.constructor=="function"&&!Ef(o)?zc(ql(o)):{}}function vk(o,c,p){var x=o.constructor;switch(c){case Se:return fg(o);case G:case J:return new x(+o);case me:return XU(o,p);case Ue:case Ce:case _e:case Ke:case Ve:case Ae:case We:case pt:case Ge:return Uw(o,p);case he:return new x;case ye:case be:return new x(o);case Ne:return ek(o);case Me:return new x;case Pe:return tk(o)}}function mk(o,c){var p=c.length;if(!p)return o;var x=p-1;return c[x]=(p>1?"& ":"")+c[x],c=c.join(p>2?", ":" "),o.replace(Fe,`{
51
51
  /* [wrapped with `+c+`] */
52
- `)}function bk(o){return yt(o)||Da(o)||!!(aw&&o&&o[aw])}function Vs(o,c){var p=typeof o;return c=c??O,!!c&&(p=="number"||p!="symbol"&&ri.test(o))&&o>-1&&o%1==0&&o<c}function gi(o,c,p){if(!hr(p))return!1;var x=typeof c;return(x=="number"?Pi(p)&&Vs(c,p.length):x=="string"&&c in p)?Un(p[c],o):!1}function bg(o,c){if(yt(o))return!1;var p=typeof o;return p=="number"||p=="symbol"||p=="boolean"||o==null||Ki(o)?!0:qe.test(o)||!tt.test(o)||c!=null&&o in rr(c)}function yk(o){var c=typeof o;return c=="string"||c=="number"||c=="symbol"||c=="boolean"?o!=="__proto__":o===null}function yg(o){var c=o0(o),p=U[c];if(typeof p!="function"||!(c in Lt.prototype))return!1;if(o===p)return!0;var x=gg(p);return!!x&&o===x[0]}function wk(o){return!!iw&&iw in o}var _k=Ll?Gs:Lg;function Ef(o){var c=o&&o.constructor,p=typeof c=="function"&&c.prototype||kc;return o===p}function i5(o){return o===o&&!hr(o)}function n5(o,c){return function(p){return p==null?!1:p[o]===c&&(c!==r||o in rr(p))}}function Ek(o){var c=l0(o,function(x){return p.size===l&&p.clear(),x}),p=c.cache;return c}function Ak(o,c){var p=o[1],x=c[1],$=p|x,j=$<(q|K|_),Q=x==_&&p==W||x==_&&p==B&&o[7].length<=c[8]||x==(_|B)&&c[7].length<=c[8]&&p==W;if(!(j||Q))return o;x&q&&(o[2]=c[2],$|=p&q?0:F);var Z=c[3];if(Z){var se=o[3];o[3]=se?kw(se,Z,c[4]):Z,o[4]=se?Io(o[3],b):c[4]}return Z=c[5],Z&&(se=o[5],o[5]=se?qw(se,Z,c[6]):Z,o[6]=se?Io(o[5],b):c[6]),Z=c[7],Z&&(o[7]=Z),x&_&&(o[8]=o[8]==null?c[8]:ii(o[8],c[8])),o[9]==null&&(o[9]=c[9]),o[0]=c[0],o[1]=$,o}function xk(o){var c=[];if(o!=null)for(var p in rr(o))c.push(p);return c}function Sk(o){return Fl.call(o)}function s5(o,c,p){return c=Or(c===r?o.length-1:c,0),function(){for(var x=arguments,$=-1,j=Or(x.length-c,0),Q=ce(j);++$<j;)Q[$]=x[c+$];$=-1;for(var Z=ce(c+1);++$<c;)Z[$]=x[$];return Z[c]=p(Q),Fr(o,this,Z)}}function o5(o,c){return c.length<2?o:Ia(o,pn(c,0,-1))}function Ik(o,c){for(var p=o.length,x=ii(c.length,p),$=Oi(o);x--;){var j=c[x];o[x]=Vs(j,p)?$[j]:r}return o}function wg(o,c){if(!(c==="constructor"&&typeof o[c]=="function")&&c!="__proto__")return o[c]}var a5=u5(Ow),Af=qF||function(o,c){return Ft.setTimeout(o,c)},_g=u5(JU);function c5(o,c,p){var x=c+"";return _g(o,mk(x,Mk(pk(x),p)))}function u5(o){var c=0,p=0;return function(){var x=KF(),$=f-(x-p);if(p=x,$>0){if(++c>=y)return arguments[0]}else c=0;return o.apply(r,arguments)}}function c0(o,c){var p=-1,x=o.length,$=x-1;for(c=c===r?x:c;++p<c;){var j=ig(p,$),Q=o[j];o[j]=o[p],o[p]=Q}return o.length=c,o}var f5=Ek(function(o){var c=[];return o.charCodeAt(0)===46&&c.push(""),o.replace(ht,function(p,x,$,j){c.push($?j.replace(jt,"$1"):x||p)}),c});function xs(o){if(typeof o=="string"||Ki(o))return o;var c=o+"";return c=="0"&&1/o==-C?"-0":c}function Ca(o){if(o!=null){try{return Bl.call(o)}catch{}try{return o+""}catch{}}return""}function Mk(o,c){return fn(ae,function(p){var x="_."+p[0];c&p[1]&&!$l(o,x)&&o.push(x)}),o.sort()}function h5(o){if(o instanceof Lt)return o.clone();var c=new ln(o.__wrapped__,o.__chain__);return c.__actions__=Oi(o.__actions__),c.__index__=o.__index__,c.__values__=o.__values__,c}function Ck(o,c,p){(p?gi(o,c,p):c===r)?c=1:c=Or(xt(c),0);var x=o==null?0:o.length;if(!x||c<1)return[];for(var $=0,j=0,Q=ce(Hl(x/c));$<x;)Q[j++]=pn(o,$,$+=c);return Q}function Dk(o){for(var c=-1,p=o==null?0:o.length,x=0,$=[];++c<p;){var j=o[c];j&&($[x++]=j)}return $}function Ok(){var o=arguments.length;if(!o)return[];for(var c=ce(o-1),p=arguments[0],x=o;x--;)c[x-1]=arguments[x];return So(yt(p)?Oi(p):[p],Wr(c,1))}var Pk=Mt(function(o,c){return Er(o)?mf(o,Wr(c,1,Er,!0)):[]}),$k=Mt(function(o,c){var p=gn(c);return Er(p)&&(p=r),Er(o)?mf(o,Wr(c,1,Er,!0),ot(p,2)):[]}),Rk=Mt(function(o,c){var p=gn(c);return Er(p)&&(p=r),Er(o)?mf(o,Wr(c,1,Er,!0),r,p):[]});function Nk(o,c,p){var x=o==null?0:o.length;return x?(c=p||c===r?1:xt(c),pn(o,c<0?0:c,x)):[]}function Tk(o,c,p){var x=o==null?0:o.length;return x?(c=p||c===r?1:xt(c),c=x-c,pn(o,0,c<0?0:c)):[]}function Lk(o,c){return o&&o.length?e0(o,ot(c,3),!0,!0):[]}function Bk(o,c){return o&&o.length?e0(o,ot(c,3),!0):[]}function Fk(o,c,p,x){var $=o==null?0:o.length;return $?(p&&typeof p!="number"&&gi(o,c,p)&&(p=0,x=$),OU(o,c,p,x)):[]}function l5(o,c,p){var x=o==null?0:o.length;if(!x)return-1;var $=p==null?0:xt(p);return $<0&&($=Or(x+$,0)),Rl(o,ot(c,3),$)}function d5(o,c,p){var x=o==null?0:o.length;if(!x)return-1;var $=x-1;return p!==r&&($=xt(p),$=p<0?Or(x+$,0):ii($,x-1)),Rl(o,ot(c,3),$,!0)}function p5(o){var c=o==null?0:o.length;return c?Wr(o,1):[]}function Uk(o){var c=o==null?0:o.length;return c?Wr(o,C):[]}function kk(o,c){var p=o==null?0:o.length;return p?(c=c===r?1:xt(c),Wr(o,c)):[]}function qk(o){for(var c=-1,p=o==null?0:o.length,x={};++c<p;){var $=o[c];x[$[0]]=$[1]}return x}function g5(o){return o&&o.length?o[0]:r}function jk(o,c,p){var x=o==null?0:o.length;if(!x)return-1;var $=p==null?0:xt(p);return $<0&&($=Or(x+$,0)),Lc(o,c,$)}function zk(o){var c=o==null?0:o.length;return c?pn(o,0,-1):[]}var Hk=Mt(function(o){var c=ur(o,cg);return c.length&&c[0]===o[0]?Zp(c):[]}),Kk=Mt(function(o){var c=gn(o),p=ur(o,cg);return c===gn(p)?c=r:p.pop(),p.length&&p[0]===o[0]?Zp(p,ot(c,2)):[]}),Wk=Mt(function(o){var c=gn(o),p=ur(o,cg);return c=typeof c=="function"?c:r,c&&p.pop(),p.length&&p[0]===o[0]?Zp(p,r,c):[]});function Vk(o,c){return o==null?"":zF.call(o,c)}function gn(o){var c=o==null?0:o.length;return c?o[c-1]:r}function Gk(o,c,p){var x=o==null?0:o.length;if(!x)return-1;var $=x;return p!==r&&($=xt(p),$=$<0?Or(x+$,0):ii($,x-1)),c===c?MF(o,c,$):Rl(o,Jy,$,!0)}function Jk(o,c){return o&&o.length?Iw(o,xt(c)):r}var Yk=Mt(v5);function v5(o,c){return o&&o.length&&c&&c.length?rg(o,c):o}function Qk(o,c,p){return o&&o.length&&c&&c.length?rg(o,c,ot(p,2)):o}function Zk(o,c,p){return o&&o.length&&c&&c.length?rg(o,c,r,p):o}var Xk=Ws(function(o,c){var p=o==null?0:o.length,x=Gp(o,c);return Dw(o,ur(c,function($){return Vs($,p)?+$:$}).sort(Uw)),x});function eq(o,c){var p=[];if(!(o&&o.length))return p;var x=-1,$=[],j=o.length;for(c=ot(c,3);++x<j;){var Q=o[x];c(Q,x,o)&&(p.push(Q),$.push(x))}return Dw(o,$),p}function Eg(o){return o==null?o:VF.call(o)}function tq(o,c,p){var x=o==null?0:o.length;return x?(p&&typeof p!="number"&&gi(o,c,p)?(c=0,p=x):(c=c==null?0:xt(c),p=p===r?x:xt(p)),pn(o,c,p)):[]}function rq(o,c){return Xl(o,c)}function iq(o,c,p){return sg(o,c,ot(p,2))}function nq(o,c){var p=o==null?0:o.length;if(p){var x=Xl(o,c);if(x<p&&Un(o[x],c))return x}return-1}function sq(o,c){return Xl(o,c,!0)}function oq(o,c,p){return sg(o,c,ot(p,2),!0)}function aq(o,c){var p=o==null?0:o.length;if(p){var x=Xl(o,c,!0)-1;if(Un(o[x],c))return x}return-1}function cq(o){return o&&o.length?Pw(o):[]}function uq(o,c){return o&&o.length?Pw(o,ot(c,2)):[]}function fq(o){var c=o==null?0:o.length;return c?pn(o,1,c):[]}function hq(o,c,p){return o&&o.length?(c=p||c===r?1:xt(c),pn(o,0,c<0?0:c)):[]}function lq(o,c,p){var x=o==null?0:o.length;return x?(c=p||c===r?1:xt(c),c=x-c,pn(o,c<0?0:c,x)):[]}function dq(o,c){return o&&o.length?e0(o,ot(c,3),!1,!0):[]}function pq(o,c){return o&&o.length?e0(o,ot(c,3)):[]}var gq=Mt(function(o){return Do(Wr(o,1,Er,!0))}),vq=Mt(function(o){var c=gn(o);return Er(c)&&(c=r),Do(Wr(o,1,Er,!0),ot(c,2))}),mq=Mt(function(o){var c=gn(o);return c=typeof c=="function"?c:r,Do(Wr(o,1,Er,!0),r,c)});function bq(o){return o&&o.length?Do(o):[]}function yq(o,c){return o&&o.length?Do(o,ot(c,2)):[]}function wq(o,c){return c=typeof c=="function"?c:r,o&&o.length?Do(o,r,c):[]}function Ag(o){if(!(o&&o.length))return[];var c=0;return o=xo(o,function(p){if(Er(p))return c=Or(p.length,c),!0}),kp(c,function(p){return ur(o,Bp(p))})}function m5(o,c){if(!(o&&o.length))return[];var p=Ag(o);return c==null?p:ur(p,function(x){return Fr(c,r,x)})}var _q=Mt(function(o,c){return Er(o)?mf(o,c):[]}),Eq=Mt(function(o){return ag(xo(o,Er))}),Aq=Mt(function(o){var c=gn(o);return Er(c)&&(c=r),ag(xo(o,Er),ot(c,2))}),xq=Mt(function(o){var c=gn(o);return c=typeof c=="function"?c:r,ag(xo(o,Er),r,c)}),Sq=Mt(Ag);function Iq(o,c){return Tw(o||[],c||[],vf)}function Mq(o,c){return Tw(o||[],c||[],wf)}var Cq=Mt(function(o){var c=o.length,p=c>1?o[c-1]:r;return p=typeof p=="function"?(o.pop(),p):r,m5(o,p)});function b5(o){var c=U(o);return c.__chain__=!0,c}function Dq(o,c){return c(o),o}function u0(o,c){return c(o)}var Oq=Ws(function(o){var c=o.length,p=c?o[0]:0,x=this.__wrapped__,$=function(j){return Gp(j,o)};return c>1||this.__actions__.length||!(x instanceof Lt)||!Vs(p)?this.thru($):(x=x.slice(p,+p+(c?1:0)),x.__actions__.push({func:u0,args:[$],thisArg:r}),new ln(x,this.__chain__).thru(function(j){return c&&!j.length&&j.push(r),j}))});function Pq(){return b5(this)}function $q(){return new ln(this.value(),this.__chain__)}function Rq(){this.__values__===r&&(this.__values__=$5(this.value()));var o=this.__index__>=this.__values__.length,c=o?r:this.__values__[this.__index__++];return{done:o,value:c}}function Nq(){return this}function Tq(o){for(var c,p=this;p instanceof Gl;){var x=h5(p);x.__index__=0,x.__values__=r,c?$.__wrapped__=x:c=x;var $=x;p=p.__wrapped__}return $.__wrapped__=o,c}function Lq(){var o=this.__wrapped__;if(o instanceof Lt){var c=o;return this.__actions__.length&&(c=new Lt(this)),c=c.reverse(),c.__actions__.push({func:u0,args:[Eg],thisArg:r}),new ln(c,this.__chain__)}return this.thru(Eg)}function Bq(){return Nw(this.__wrapped__,this.__actions__)}var Fq=t0(function(o,c,p){Jt.call(o,p)?++o[p]:Hs(o,p,1)});function Uq(o,c,p){var x=yt(o)?Vy:DU;return p&&gi(o,c,p)&&(c=r),x(o,ot(c,3))}function kq(o,c){var p=yt(o)?xo:mw;return p(o,ot(c,3))}var qq=Kw(l5),jq=Kw(d5);function zq(o,c){return Wr(f0(o,c),1)}function Hq(o,c){return Wr(f0(o,c),C)}function Kq(o,c,p){return p=p===r?1:xt(p),Wr(f0(o,c),p)}function y5(o,c){var p=yt(o)?fn:Co;return p(o,ot(c,3))}function w5(o,c){var p=yt(o)?fF:vw;return p(o,ot(c,3))}var Wq=t0(function(o,c,p){Jt.call(o,p)?o[p].push(c):Hs(o,p,[c])});function Vq(o,c,p,x){o=Pi(o)?o:Gc(o),p=p&&!x?xt(p):0;var $=o.length;return p<0&&(p=Or($+p,0)),g0(o)?p<=$&&o.indexOf(c,p)>-1:!!$&&Lc(o,c,p)>-1}var Gq=Mt(function(o,c,p){var x=-1,$=typeof c=="function",j=Pi(o)?ce(o.length):[];return Co(o,function(Q){j[++x]=$?Fr(c,Q,p):bf(Q,c,p)}),j}),Jq=t0(function(o,c,p){Hs(o,p,c)});function f0(o,c){var p=yt(o)?ur:Aw;return p(o,ot(c,3))}function Yq(o,c,p,x){return o==null?[]:(yt(c)||(c=c==null?[]:[c]),p=x?r:p,yt(p)||(p=p==null?[]:[p]),Mw(o,c,p))}var Qq=t0(function(o,c,p){o[p?0:1].push(c)},function(){return[[],[]]});function Zq(o,c,p){var x=yt(o)?Tp:Qy,$=arguments.length<3;return x(o,ot(c,4),p,$,Co)}function Xq(o,c,p){var x=yt(o)?hF:Qy,$=arguments.length<3;return x(o,ot(c,4),p,$,vw)}function ej(o,c){var p=yt(o)?xo:mw;return p(o,d0(ot(c,3)))}function tj(o){var c=yt(o)?lw:VU;return c(o)}function rj(o,c,p){(p?gi(o,c,p):c===r)?c=1:c=xt(c);var x=yt(o)?xU:GU;return x(o,c)}function ij(o){var c=yt(o)?SU:YU;return c(o)}function nj(o){if(o==null)return 0;if(Pi(o))return g0(o)?Fc(o):o.length;var c=ni(o);return c==he||c==Me?o.size:eg(o).length}function sj(o,c,p){var x=yt(o)?Lp:QU;return p&&gi(o,c,p)&&(c=r),x(o,ot(c,3))}var oj=Mt(function(o,c){if(o==null)return[];var p=c.length;return p>1&&gi(o,c[0],c[1])?c=[]:p>2&&gi(c[0],c[1],c[2])&&(c=[c[0]]),Mw(o,Wr(c,1),[])}),h0=kF||function(){return Ft.Date.now()};function aj(o,c){if(typeof c!="function")throw new hn(a);return o=xt(o),function(){if(--o<1)return c.apply(this,arguments)}}function _5(o,c,p){return c=p?r:c,c=o&&c==null?o.length:c,Ks(o,_,r,r,r,r,c)}function E5(o,c){var p;if(typeof c!="function")throw new hn(a);return o=xt(o),function(){return--o>0&&(p=c.apply(this,arguments)),o<=1&&(c=r),p}}var xg=Mt(function(o,c,p){var x=q;if(p.length){var $=Io(p,Wc(xg));x|=k}return Ks(o,x,c,p,$)}),A5=Mt(function(o,c,p){var x=q|K;if(p.length){var $=Io(p,Wc(A5));x|=k}return Ks(c,x,o,p,$)});function x5(o,c,p){c=p?r:c;var x=Ks(o,W,r,r,r,r,r,c);return x.placeholder=x5.placeholder,x}function S5(o,c,p){c=p?r:c;var x=Ks(o,R,r,r,r,r,r,c);return x.placeholder=S5.placeholder,x}function I5(o,c,p){var x,$,j,Q,Z,se,le=0,de=!1,ge=!1,De=!0;if(typeof o!="function")throw new hn(a);c=vn(c)||0,hr(p)&&(de=!!p.leading,ge="maxWait"in p,j=ge?Or(vn(p.maxWait)||0,c):j,De="trailing"in p?!!p.trailing:De);function Je(Ar){var kn=x,Ys=$;return x=$=r,le=Ar,Q=o.apply(Ys,kn),Q}function ut(Ar){return le=Ar,Z=Af(Pt,c),de?Je(Ar):Q}function St(Ar){var kn=Ar-se,Ys=Ar-le,K5=c-kn;return ge?ii(K5,j-Ys):K5}function ft(Ar){var kn=Ar-se,Ys=Ar-le;return se===r||kn>=c||kn<0||ge&&Ys>=j}function Pt(){var Ar=h0();if(ft(Ar))return Ut(Ar);Z=Af(Pt,St(Ar))}function Ut(Ar){return Z=r,De&&x?Je(Ar):(x=$=r,Q)}function Wi(){Z!==r&&Lw(Z),le=0,x=se=$=Z=r}function vi(){return Z===r?Q:Ut(h0())}function Vi(){var Ar=h0(),kn=ft(Ar);if(x=arguments,$=this,se=Ar,kn){if(Z===r)return ut(se);if(ge)return Lw(Z),Z=Af(Pt,c),Je(se)}return Z===r&&(Z=Af(Pt,c)),Q}return Vi.cancel=Wi,Vi.flush=vi,Vi}var cj=Mt(function(o,c){return gw(o,1,c)}),uj=Mt(function(o,c,p){return gw(o,vn(c)||0,p)});function fj(o){return Ks(o,ee)}function l0(o,c){if(typeof o!="function"||c!=null&&typeof c!="function")throw new hn(a);var p=function(){var x=arguments,$=c?c.apply(this,x):x[0],j=p.cache;if(j.has($))return j.get($);var Q=o.apply(this,x);return p.cache=j.set($,Q)||j,Q};return p.cache=new(l0.Cache||zs),p}l0.Cache=zs;function d0(o){if(typeof o!="function")throw new hn(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 hj(o){return E5(2,o)}var lj=ZU(function(o,c){c=c.length==1&&yt(c[0])?ur(c[0],zi(ot())):ur(Wr(c,1),zi(ot()));var p=c.length;return Mt(function(x){for(var $=-1,j=ii(x.length,p);++$<j;)x[$]=c[$].call(this,x[$]);return Fr(o,this,x)})}),Sg=Mt(function(o,c){var p=Io(c,Wc(Sg));return Ks(o,k,r,c,p)}),M5=Mt(function(o,c){var p=Io(c,Wc(M5));return Ks(o,H,r,c,p)}),dj=Ws(function(o,c){return Ks(o,B,r,r,r,c)});function pj(o,c){if(typeof o!="function")throw new hn(a);return c=c===r?c:xt(c),Mt(o,c)}function gj(o,c){if(typeof o!="function")throw new hn(a);return c=c==null?0:Or(xt(c),0),Mt(function(p){var x=p[c],$=Po(p,0,c);return x&&So($,x),Fr(o,this,$)})}function vj(o,c,p){var x=!0,$=!0;if(typeof o!="function")throw new hn(a);return hr(p)&&(x="leading"in p?!!p.leading:x,$="trailing"in p?!!p.trailing:$),I5(o,c,{leading:x,maxWait:c,trailing:$})}function mj(o){return _5(o,1)}function bj(o,c){return Sg(ug(c),o)}function yj(){if(!arguments.length)return[];var o=arguments[0];return yt(o)?o:[o]}function wj(o){return dn(o,S)}function _j(o,c){return c=typeof c=="function"?c:r,dn(o,S,c)}function Ej(o){return dn(o,w|S)}function Aj(o,c){return c=typeof c=="function"?c:r,dn(o,w|S,c)}function xj(o,c){return c==null||pw(o,c,Ur(c))}function Un(o,c){return o===c||o!==o&&c!==c}var Sj=s0(Qp),Ij=s0(function(o,c){return o>=c}),Da=ww(function(){return arguments}())?ww:function(o){return mr(o)&&Jt.call(o,"callee")&&!ow.call(o,"callee")},yt=ce.isArray,Mj=di?zi(di):TU;function Pi(o){return o!=null&&p0(o.length)&&!Gs(o)}function Er(o){return mr(o)&&Pi(o)}function Cj(o){return o===!0||o===!1||mr(o)&&pi(o)==G}var $o=jF||Lg,Dj=Ln?zi(Ln):LU;function Oj(o){return mr(o)&&o.nodeType===1&&!xf(o)}function Pj(o){if(o==null)return!0;if(Pi(o)&&(yt(o)||typeof o=="string"||typeof o.splice=="function"||$o(o)||Vc(o)||Da(o)))return!o.length;var c=ni(o);if(c==he||c==Me)return!o.size;if(Ef(o))return!eg(o).length;for(var p in o)if(Jt.call(o,p))return!1;return!0}function $j(o,c){return yf(o,c)}function Rj(o,c,p){p=typeof p=="function"?p:r;var x=p?p(o,c):r;return x===r?yf(o,c,r,p):!!x}function Ig(o){if(!mr(o))return!1;var c=pi(o);return c==V||c==A||typeof o.message=="string"&&typeof o.name=="string"&&!xf(o)}function Nj(o){return typeof o=="number"&&cw(o)}function Gs(o){if(!hr(o))return!1;var c=pi(o);return c==oe||c==ue||c==z||c==Oe}function C5(o){return typeof o=="number"&&o==xt(o)}function p0(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=O}function hr(o){var c=typeof o;return o!=null&&(c=="object"||c=="function")}function mr(o){return o!=null&&typeof o=="object"}var D5=un?zi(un):FU;function Tj(o,c){return o===c||Xp(o,c,vg(c))}function Lj(o,c,p){return p=typeof p=="function"?p:r,Xp(o,c,vg(c),p)}function Bj(o){return O5(o)&&o!=+o}function Fj(o){if(_k(o))throw new vt(s);return _w(o)}function Uj(o){return o===null}function kj(o){return o==null}function O5(o){return typeof o=="number"||mr(o)&&pi(o)==ye}function xf(o){if(!mr(o)||pi(o)!=Re)return!1;var c=ql(o);if(c===null)return!0;var p=Jt.call(c,"constructor")&&c.constructor;return typeof p=="function"&&p instanceof p&&Bl.call(p)==LF}var Mg=_s?zi(_s):UU;function qj(o){return C5(o)&&o>=-O&&o<=O}var P5=uf?zi(uf):kU;function g0(o){return typeof o=="string"||!yt(o)&&mr(o)&&pi(o)==be}function Ki(o){return typeof o=="symbol"||mr(o)&&pi(o)==Pe}var Vc=_a?zi(_a):qU;function jj(o){return o===r}function zj(o){return mr(o)&&ni(o)==ve}function Hj(o){return mr(o)&&pi(o)==$e}var Kj=s0(tg),Wj=s0(function(o,c){return o<=c});function $5(o){if(!o)return[];if(Pi(o))return g0(o)?Bn(o):Oi(o);if(hf&&o[hf])return xF(o[hf]());var c=ni(o),p=c==he?jp:c==Me?Nl:Gc;return p(o)}function Js(o){if(!o)return o===0?o:0;if(o=vn(o),o===C||o===-C){var c=o<0?-1:1;return c*M}return o===o?o:0}function xt(o){var c=Js(o),p=c%1;return c===c?p?c-p:c:0}function R5(o){return o?Sa(xt(o),0,m):0}function vn(o){if(typeof o=="number")return o;if(Ki(o))return g;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=Zy(o);var p=Xr.test(o);return p||ti.test(o)?bt(o.slice(2),p?2:8):Zr.test(o)?g:+o}function N5(o){return As(o,$i(o))}function Vj(o){return o?Sa(xt(o),-O,O):o===0?o:0}function Vt(o){return o==null?"":Hi(o)}var Gj=Hc(function(o,c){if(Ef(c)||Pi(c)){As(c,Ur(c),o);return}for(var p in c)Jt.call(c,p)&&vf(o,p,c[p])}),T5=Hc(function(o,c){As(c,$i(c),o)}),v0=Hc(function(o,c,p,x){As(c,$i(c),o,x)}),Jj=Hc(function(o,c,p,x){As(c,Ur(c),o,x)}),Yj=Ws(Gp);function Qj(o,c){var p=zc(o);return c==null?p:dw(p,c)}var Zj=Mt(function(o,c){o=rr(o);var p=-1,x=c.length,$=x>2?c[2]:r;for($&&gi(c[0],c[1],$)&&(x=1);++p<x;)for(var j=c[p],Q=$i(j),Z=-1,se=Q.length;++Z<se;){var le=Q[Z],de=o[le];(de===r||Un(de,kc[le])&&!Jt.call(o,le))&&(o[le]=j[le])}return o}),Xj=Mt(function(o){return o.push(r,Zw),Fr(L5,r,o)});function ez(o,c){return Gy(o,ot(c,3),Es)}function tz(o,c){return Gy(o,ot(c,3),Yp)}function rz(o,c){return o==null?o:Jp(o,ot(c,3),$i)}function iz(o,c){return o==null?o:bw(o,ot(c,3),$i)}function nz(o,c){return o&&Es(o,ot(c,3))}function sz(o,c){return o&&Yp(o,ot(c,3))}function oz(o){return o==null?[]:Ql(o,Ur(o))}function az(o){return o==null?[]:Ql(o,$i(o))}function Cg(o,c,p){var x=o==null?r:Ia(o,c);return x===r?p:x}function cz(o,c){return o!=null&&t5(o,c,PU)}function Dg(o,c){return o!=null&&t5(o,c,$U)}var uz=Vw(function(o,c,p){c!=null&&typeof c.toString!="function"&&(c=Fl.call(c)),o[c]=p},Pg(Ri)),fz=Vw(function(o,c,p){c!=null&&typeof c.toString!="function"&&(c=Fl.call(c)),Jt.call(o,c)?o[c].push(p):o[c]=[p]},ot),hz=Mt(bf);function Ur(o){return Pi(o)?hw(o):eg(o)}function $i(o){return Pi(o)?hw(o,!0):jU(o)}function lz(o,c){var p={};return c=ot(c,3),Es(o,function(x,$,j){Hs(p,c(x,$,j),x)}),p}function dz(o,c){var p={};return c=ot(c,3),Es(o,function(x,$,j){Hs(p,$,c(x,$,j))}),p}var pz=Hc(function(o,c,p){Zl(o,c,p)}),L5=Hc(function(o,c,p,x){Zl(o,c,p,x)}),gz=Ws(function(o,c){var p={};if(o==null)return p;var x=!1;c=ur(c,function(j){return j=Oo(j,o),x||(x=j.length>1),j}),As(o,pg(o),p),x&&(p=dn(p,w|I|S,uk));for(var $=c.length;$--;)og(p,c[$]);return p});function vz(o,c){return B5(o,d0(ot(c)))}var mz=Ws(function(o,c){return o==null?{}:HU(o,c)});function B5(o,c){if(o==null)return{};var p=ur(pg(o),function(x){return[x]});return c=ot(c),Cw(o,p,function(x,$){return c(x,$[0])})}function bz(o,c,p){c=Oo(c,o);var x=-1,$=c.length;for($||($=1,o=r);++x<$;){var j=o==null?r:o[xs(c[x])];j===r&&(x=$,j=p),o=Gs(j)?j.call(o):j}return o}function yz(o,c,p){return o==null?o:wf(o,c,p)}function wz(o,c,p,x){return x=typeof x=="function"?x:r,o==null?o:wf(o,c,p,x)}var F5=Yw(Ur),U5=Yw($i);function _z(o,c,p){var x=yt(o),$=x||$o(o)||Vc(o);if(c=ot(c,4),p==null){var j=o&&o.constructor;$?p=x?new j:[]:hr(o)?p=Gs(j)?zc(ql(o)):{}:p={}}return($?fn:Es)(o,function(Q,Z,se){return c(p,Q,Z,se)}),p}function Ez(o,c){return o==null?!0:og(o,c)}function Az(o,c,p){return o==null?o:Rw(o,c,ug(p))}function xz(o,c,p,x){return x=typeof x=="function"?x:r,o==null?o:Rw(o,c,ug(p),x)}function Gc(o){return o==null?[]:qp(o,Ur(o))}function Sz(o){return o==null?[]:qp(o,$i(o))}function Iz(o,c,p){return p===r&&(p=c,c=r),p!==r&&(p=vn(p),p=p===p?p:0),c!==r&&(c=vn(c),c=c===c?c:0),Sa(vn(o),c,p)}function Mz(o,c,p){return c=Js(c),p===r?(p=c,c=0):p=Js(p),o=vn(o),RU(o,c,p)}function Cz(o,c,p){if(p&&typeof p!="boolean"&&gi(o,c,p)&&(c=p=r),p===r&&(typeof c=="boolean"?(p=c,c=r):typeof o=="boolean"&&(p=o,o=r)),o===r&&c===r?(o=0,c=1):(o=Js(o),c===r?(c=o,o=0):c=Js(c)),o>c){var x=o;o=c,c=x}if(p||o%1||c%1){var $=uw();return ii(o+$*(c-o+er("1e-"+(($+"").length-1))),c)}return ig(o,c)}var Dz=Kc(function(o,c,p){return c=c.toLowerCase(),o+(p?k5(c):c)});function k5(o){return Og(Vt(o).toLowerCase())}function q5(o){return o=Vt(o),o&&o.replace(vr,yF).replace($p,"")}function Oz(o,c,p){o=Vt(o),c=Hi(c);var x=o.length;p=p===r?x:Sa(xt(p),0,x);var $=p;return p-=c.length,p>=0&&o.slice(p,$)==c}function Pz(o){return o=Vt(o),o&&et.test(o)?o.replace(Tt,wF):o}function $z(o){return o=Vt(o),o&&je.test(o)?o.replace(nt,"\\$&"):o}var Rz=Kc(function(o,c,p){return o+(p?"-":"")+c.toLowerCase()}),Nz=Kc(function(o,c,p){return o+(p?" ":"")+c.toLowerCase()}),Tz=Hw("toLowerCase");function Lz(o,c,p){o=Vt(o),c=xt(c);var x=c?Fc(o):0;if(!c||x>=c)return o;var $=(c-x)/2;return n0(Kl($),p)+o+n0(Hl($),p)}function Bz(o,c,p){o=Vt(o),c=xt(c);var x=c?Fc(o):0;return c&&x<c?o+n0(c-x,p):o}function Fz(o,c,p){o=Vt(o),c=xt(c);var x=c?Fc(o):0;return c&&x<c?n0(c-x,p)+o:o}function Uz(o,c,p){return p||c==null?c=0:c&&(c=+c),WF(Vt(o).replace(st,""),c||0)}function kz(o,c,p){return(p?gi(o,c,p):c===r)?c=1:c=xt(c),ng(Vt(o),c)}function qz(){var o=arguments,c=Vt(o[0]);return o.length<3?c:c.replace(o[1],o[2])}var jz=Kc(function(o,c,p){return o+(p?"_":"")+c.toLowerCase()});function zz(o,c,p){return p&&typeof p!="number"&&gi(o,c,p)&&(c=p=r),p=p===r?m:p>>>0,p?(o=Vt(o),o&&(typeof c=="string"||c!=null&&!Mg(c))&&(c=Hi(c),!c&&Bc(o))?Po(Bn(o),0,p):o.split(c,p)):[]}var Hz=Kc(function(o,c,p){return o+(p?" ":"")+Og(c)});function Kz(o,c,p){return o=Vt(o),p=p==null?0:Sa(xt(p),0,o.length),c=Hi(c),o.slice(p,p+c.length)==c}function Wz(o,c,p){var x=U.templateSettings;p&&gi(o,c,p)&&(c=r),o=Vt(o),c=v0({},c,x,Qw);var $=v0({},c.imports,x.imports,Qw),j=Ur($),Q=qp($,j),Z,se,le=0,de=c.interpolate||Ii,ge="__p += '",De=zp((c.escape||Ii).source+"|"+de.source+"|"+(de===rt?ct:Ii).source+"|"+(c.evaluate||Ii).source+"|$","g"),Je="//# sourceURL="+(Jt.call(c,"sourceURL")?(c.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Rp+"]")+`
52
+ `)}function bk(o){return yt(o)||Da(o)||!!(cw&&o&&o[cw])}function Vs(o,c){var p=typeof o;return c=c??O,!!c&&(p=="number"||p!="symbol"&&ri.test(o))&&o>-1&&o%1==0&&o<c}function gi(o,c,p){if(!hr(p))return!1;var x=typeof c;return(x=="number"?Pi(p)&&Vs(c,p.length):x=="string"&&c in p)?Un(p[c],o):!1}function bg(o,c){if(yt(o))return!1;var p=typeof o;return p=="number"||p=="symbol"||p=="boolean"||o==null||Ki(o)?!0:qe.test(o)||!tt.test(o)||c!=null&&o in rr(c)}function yk(o){var c=typeof o;return c=="string"||c=="number"||c=="symbol"||c=="boolean"?o!=="__proto__":o===null}function yg(o){var c=o0(o),p=U[c];if(typeof p!="function"||!(c in Lt.prototype))return!1;if(o===p)return!0;var x=gg(p);return!!x&&o===x[0]}function wk(o){return!!nw&&nw in o}var _k=Ll?Gs:Lg;function Ef(o){var c=o&&o.constructor,p=typeof c=="function"&&c.prototype||kc;return o===p}function n5(o){return o===o&&!hr(o)}function s5(o,c){return function(p){return p==null?!1:p[o]===c&&(c!==r||o in rr(p))}}function Ek(o){var c=l0(o,function(x){return p.size===l&&p.clear(),x}),p=c.cache;return c}function Ak(o,c){var p=o[1],x=c[1],$=p|x,j=$<(q|K|_),Q=x==_&&p==W||x==_&&p==B&&o[7].length<=c[8]||x==(_|B)&&c[7].length<=c[8]&&p==W;if(!(j||Q))return o;x&q&&(o[2]=c[2],$|=p&q?0:F);var Z=c[3];if(Z){var se=o[3];o[3]=se?qw(se,Z,c[4]):Z,o[4]=se?Io(o[3],b):c[4]}return Z=c[5],Z&&(se=o[5],o[5]=se?jw(se,Z,c[6]):Z,o[6]=se?Io(o[5],b):c[6]),Z=c[7],Z&&(o[7]=Z),x&_&&(o[8]=o[8]==null?c[8]:ii(o[8],c[8])),o[9]==null&&(o[9]=c[9]),o[0]=c[0],o[1]=$,o}function xk(o){var c=[];if(o!=null)for(var p in rr(o))c.push(p);return c}function Sk(o){return Fl.call(o)}function o5(o,c,p){return c=Or(c===r?o.length-1:c,0),function(){for(var x=arguments,$=-1,j=Or(x.length-c,0),Q=ce(j);++$<j;)Q[$]=x[c+$];$=-1;for(var Z=ce(c+1);++$<c;)Z[$]=x[$];return Z[c]=p(Q),Fr(o,this,Z)}}function a5(o,c){return c.length<2?o:Ia(o,pn(c,0,-1))}function Ik(o,c){for(var p=o.length,x=ii(c.length,p),$=Oi(o);x--;){var j=c[x];o[x]=Vs(j,p)?$[j]:r}return o}function wg(o,c){if(!(c==="constructor"&&typeof o[c]=="function")&&c!="__proto__")return o[c]}var c5=f5(Pw),Af=qF||function(o,c){return Ft.setTimeout(o,c)},_g=f5(JU);function u5(o,c,p){var x=c+"";return _g(o,mk(x,Mk(pk(x),p)))}function f5(o){var c=0,p=0;return function(){var x=KF(),$=f-(x-p);if(p=x,$>0){if(++c>=y)return arguments[0]}else c=0;return o.apply(r,arguments)}}function c0(o,c){var p=-1,x=o.length,$=x-1;for(c=c===r?x:c;++p<c;){var j=ig(p,$),Q=o[j];o[j]=o[p],o[p]=Q}return o.length=c,o}var h5=Ek(function(o){var c=[];return o.charCodeAt(0)===46&&c.push(""),o.replace(ht,function(p,x,$,j){c.push($?j.replace(jt,"$1"):x||p)}),c});function xs(o){if(typeof o=="string"||Ki(o))return o;var c=o+"";return c=="0"&&1/o==-C?"-0":c}function Ca(o){if(o!=null){try{return Bl.call(o)}catch{}try{return o+""}catch{}}return""}function Mk(o,c){return fn(ae,function(p){var x="_."+p[0];c&p[1]&&!$l(o,x)&&o.push(x)}),o.sort()}function l5(o){if(o instanceof Lt)return o.clone();var c=new ln(o.__wrapped__,o.__chain__);return c.__actions__=Oi(o.__actions__),c.__index__=o.__index__,c.__values__=o.__values__,c}function Ck(o,c,p){(p?gi(o,c,p):c===r)?c=1:c=Or(xt(c),0);var x=o==null?0:o.length;if(!x||c<1)return[];for(var $=0,j=0,Q=ce(Hl(x/c));$<x;)Q[j++]=pn(o,$,$+=c);return Q}function Dk(o){for(var c=-1,p=o==null?0:o.length,x=0,$=[];++c<p;){var j=o[c];j&&($[x++]=j)}return $}function Ok(){var o=arguments.length;if(!o)return[];for(var c=ce(o-1),p=arguments[0],x=o;x--;)c[x-1]=arguments[x];return So(yt(p)?Oi(p):[p],Wr(c,1))}var Pk=Mt(function(o,c){return Er(o)?mf(o,Wr(c,1,Er,!0)):[]}),$k=Mt(function(o,c){var p=gn(c);return Er(p)&&(p=r),Er(o)?mf(o,Wr(c,1,Er,!0),ot(p,2)):[]}),Rk=Mt(function(o,c){var p=gn(c);return Er(p)&&(p=r),Er(o)?mf(o,Wr(c,1,Er,!0),r,p):[]});function Nk(o,c,p){var x=o==null?0:o.length;return x?(c=p||c===r?1:xt(c),pn(o,c<0?0:c,x)):[]}function Tk(o,c,p){var x=o==null?0:o.length;return x?(c=p||c===r?1:xt(c),c=x-c,pn(o,0,c<0?0:c)):[]}function Lk(o,c){return o&&o.length?e0(o,ot(c,3),!0,!0):[]}function Bk(o,c){return o&&o.length?e0(o,ot(c,3),!0):[]}function Fk(o,c,p,x){var $=o==null?0:o.length;return $?(p&&typeof p!="number"&&gi(o,c,p)&&(p=0,x=$),OU(o,c,p,x)):[]}function d5(o,c,p){var x=o==null?0:o.length;if(!x)return-1;var $=p==null?0:xt(p);return $<0&&($=Or(x+$,0)),Rl(o,ot(c,3),$)}function p5(o,c,p){var x=o==null?0:o.length;if(!x)return-1;var $=x-1;return p!==r&&($=xt(p),$=p<0?Or(x+$,0):ii($,x-1)),Rl(o,ot(c,3),$,!0)}function g5(o){var c=o==null?0:o.length;return c?Wr(o,1):[]}function Uk(o){var c=o==null?0:o.length;return c?Wr(o,C):[]}function kk(o,c){var p=o==null?0:o.length;return p?(c=c===r?1:xt(c),Wr(o,c)):[]}function qk(o){for(var c=-1,p=o==null?0:o.length,x={};++c<p;){var $=o[c];x[$[0]]=$[1]}return x}function v5(o){return o&&o.length?o[0]:r}function jk(o,c,p){var x=o==null?0:o.length;if(!x)return-1;var $=p==null?0:xt(p);return $<0&&($=Or(x+$,0)),Lc(o,c,$)}function zk(o){var c=o==null?0:o.length;return c?pn(o,0,-1):[]}var Hk=Mt(function(o){var c=ur(o,cg);return c.length&&c[0]===o[0]?Zp(c):[]}),Kk=Mt(function(o){var c=gn(o),p=ur(o,cg);return c===gn(p)?c=r:p.pop(),p.length&&p[0]===o[0]?Zp(p,ot(c,2)):[]}),Wk=Mt(function(o){var c=gn(o),p=ur(o,cg);return c=typeof c=="function"?c:r,c&&p.pop(),p.length&&p[0]===o[0]?Zp(p,r,c):[]});function Vk(o,c){return o==null?"":zF.call(o,c)}function gn(o){var c=o==null?0:o.length;return c?o[c-1]:r}function Gk(o,c,p){var x=o==null?0:o.length;if(!x)return-1;var $=x;return p!==r&&($=xt(p),$=$<0?Or(x+$,0):ii($,x-1)),c===c?MF(o,c,$):Rl(o,Yy,$,!0)}function Jk(o,c){return o&&o.length?Mw(o,xt(c)):r}var Yk=Mt(m5);function m5(o,c){return o&&o.length&&c&&c.length?rg(o,c):o}function Qk(o,c,p){return o&&o.length&&c&&c.length?rg(o,c,ot(p,2)):o}function Zk(o,c,p){return o&&o.length&&c&&c.length?rg(o,c,r,p):o}var Xk=Ws(function(o,c){var p=o==null?0:o.length,x=Gp(o,c);return Ow(o,ur(c,function($){return Vs($,p)?+$:$}).sort(kw)),x});function eq(o,c){var p=[];if(!(o&&o.length))return p;var x=-1,$=[],j=o.length;for(c=ot(c,3);++x<j;){var Q=o[x];c(Q,x,o)&&(p.push(Q),$.push(x))}return Ow(o,$),p}function Eg(o){return o==null?o:VF.call(o)}function tq(o,c,p){var x=o==null?0:o.length;return x?(p&&typeof p!="number"&&gi(o,c,p)?(c=0,p=x):(c=c==null?0:xt(c),p=p===r?x:xt(p)),pn(o,c,p)):[]}function rq(o,c){return Xl(o,c)}function iq(o,c,p){return sg(o,c,ot(p,2))}function nq(o,c){var p=o==null?0:o.length;if(p){var x=Xl(o,c);if(x<p&&Un(o[x],c))return x}return-1}function sq(o,c){return Xl(o,c,!0)}function oq(o,c,p){return sg(o,c,ot(p,2),!0)}function aq(o,c){var p=o==null?0:o.length;if(p){var x=Xl(o,c,!0)-1;if(Un(o[x],c))return x}return-1}function cq(o){return o&&o.length?$w(o):[]}function uq(o,c){return o&&o.length?$w(o,ot(c,2)):[]}function fq(o){var c=o==null?0:o.length;return c?pn(o,1,c):[]}function hq(o,c,p){return o&&o.length?(c=p||c===r?1:xt(c),pn(o,0,c<0?0:c)):[]}function lq(o,c,p){var x=o==null?0:o.length;return x?(c=p||c===r?1:xt(c),c=x-c,pn(o,c<0?0:c,x)):[]}function dq(o,c){return o&&o.length?e0(o,ot(c,3),!1,!0):[]}function pq(o,c){return o&&o.length?e0(o,ot(c,3)):[]}var gq=Mt(function(o){return Do(Wr(o,1,Er,!0))}),vq=Mt(function(o){var c=gn(o);return Er(c)&&(c=r),Do(Wr(o,1,Er,!0),ot(c,2))}),mq=Mt(function(o){var c=gn(o);return c=typeof c=="function"?c:r,Do(Wr(o,1,Er,!0),r,c)});function bq(o){return o&&o.length?Do(o):[]}function yq(o,c){return o&&o.length?Do(o,ot(c,2)):[]}function wq(o,c){return c=typeof c=="function"?c:r,o&&o.length?Do(o,r,c):[]}function Ag(o){if(!(o&&o.length))return[];var c=0;return o=xo(o,function(p){if(Er(p))return c=Or(p.length,c),!0}),kp(c,function(p){return ur(o,Bp(p))})}function b5(o,c){if(!(o&&o.length))return[];var p=Ag(o);return c==null?p:ur(p,function(x){return Fr(c,r,x)})}var _q=Mt(function(o,c){return Er(o)?mf(o,c):[]}),Eq=Mt(function(o){return ag(xo(o,Er))}),Aq=Mt(function(o){var c=gn(o);return Er(c)&&(c=r),ag(xo(o,Er),ot(c,2))}),xq=Mt(function(o){var c=gn(o);return c=typeof c=="function"?c:r,ag(xo(o,Er),r,c)}),Sq=Mt(Ag);function Iq(o,c){return Lw(o||[],c||[],vf)}function Mq(o,c){return Lw(o||[],c||[],wf)}var Cq=Mt(function(o){var c=o.length,p=c>1?o[c-1]:r;return p=typeof p=="function"?(o.pop(),p):r,b5(o,p)});function y5(o){var c=U(o);return c.__chain__=!0,c}function Dq(o,c){return c(o),o}function u0(o,c){return c(o)}var Oq=Ws(function(o){var c=o.length,p=c?o[0]:0,x=this.__wrapped__,$=function(j){return Gp(j,o)};return c>1||this.__actions__.length||!(x instanceof Lt)||!Vs(p)?this.thru($):(x=x.slice(p,+p+(c?1:0)),x.__actions__.push({func:u0,args:[$],thisArg:r}),new ln(x,this.__chain__).thru(function(j){return c&&!j.length&&j.push(r),j}))});function Pq(){return y5(this)}function $q(){return new ln(this.value(),this.__chain__)}function Rq(){this.__values__===r&&(this.__values__=R5(this.value()));var o=this.__index__>=this.__values__.length,c=o?r:this.__values__[this.__index__++];return{done:o,value:c}}function Nq(){return this}function Tq(o){for(var c,p=this;p instanceof Gl;){var x=l5(p);x.__index__=0,x.__values__=r,c?$.__wrapped__=x:c=x;var $=x;p=p.__wrapped__}return $.__wrapped__=o,c}function Lq(){var o=this.__wrapped__;if(o instanceof Lt){var c=o;return this.__actions__.length&&(c=new Lt(this)),c=c.reverse(),c.__actions__.push({func:u0,args:[Eg],thisArg:r}),new ln(c,this.__chain__)}return this.thru(Eg)}function Bq(){return Tw(this.__wrapped__,this.__actions__)}var Fq=t0(function(o,c,p){Jt.call(o,p)?++o[p]:Hs(o,p,1)});function Uq(o,c,p){var x=yt(o)?Gy:DU;return p&&gi(o,c,p)&&(c=r),x(o,ot(c,3))}function kq(o,c){var p=yt(o)?xo:bw;return p(o,ot(c,3))}var qq=Ww(d5),jq=Ww(p5);function zq(o,c){return Wr(f0(o,c),1)}function Hq(o,c){return Wr(f0(o,c),C)}function Kq(o,c,p){return p=p===r?1:xt(p),Wr(f0(o,c),p)}function w5(o,c){var p=yt(o)?fn:Co;return p(o,ot(c,3))}function _5(o,c){var p=yt(o)?fF:mw;return p(o,ot(c,3))}var Wq=t0(function(o,c,p){Jt.call(o,p)?o[p].push(c):Hs(o,p,[c])});function Vq(o,c,p,x){o=Pi(o)?o:Gc(o),p=p&&!x?xt(p):0;var $=o.length;return p<0&&(p=Or($+p,0)),g0(o)?p<=$&&o.indexOf(c,p)>-1:!!$&&Lc(o,c,p)>-1}var Gq=Mt(function(o,c,p){var x=-1,$=typeof c=="function",j=Pi(o)?ce(o.length):[];return Co(o,function(Q){j[++x]=$?Fr(c,Q,p):bf(Q,c,p)}),j}),Jq=t0(function(o,c,p){Hs(o,p,c)});function f0(o,c){var p=yt(o)?ur:xw;return p(o,ot(c,3))}function Yq(o,c,p,x){return o==null?[]:(yt(c)||(c=c==null?[]:[c]),p=x?r:p,yt(p)||(p=p==null?[]:[p]),Cw(o,c,p))}var Qq=t0(function(o,c,p){o[p?0:1].push(c)},function(){return[[],[]]});function Zq(o,c,p){var x=yt(o)?Tp:Zy,$=arguments.length<3;return x(o,ot(c,4),p,$,Co)}function Xq(o,c,p){var x=yt(o)?hF:Zy,$=arguments.length<3;return x(o,ot(c,4),p,$,mw)}function ej(o,c){var p=yt(o)?xo:bw;return p(o,d0(ot(c,3)))}function tj(o){var c=yt(o)?dw:VU;return c(o)}function rj(o,c,p){(p?gi(o,c,p):c===r)?c=1:c=xt(c);var x=yt(o)?xU:GU;return x(o,c)}function ij(o){var c=yt(o)?SU:YU;return c(o)}function nj(o){if(o==null)return 0;if(Pi(o))return g0(o)?Fc(o):o.length;var c=ni(o);return c==he||c==Me?o.size:eg(o).length}function sj(o,c,p){var x=yt(o)?Lp:QU;return p&&gi(o,c,p)&&(c=r),x(o,ot(c,3))}var oj=Mt(function(o,c){if(o==null)return[];var p=c.length;return p>1&&gi(o,c[0],c[1])?c=[]:p>2&&gi(c[0],c[1],c[2])&&(c=[c[0]]),Cw(o,Wr(c,1),[])}),h0=kF||function(){return Ft.Date.now()};function aj(o,c){if(typeof c!="function")throw new hn(a);return o=xt(o),function(){if(--o<1)return c.apply(this,arguments)}}function E5(o,c,p){return c=p?r:c,c=o&&c==null?o.length:c,Ks(o,_,r,r,r,r,c)}function A5(o,c){var p;if(typeof c!="function")throw new hn(a);return o=xt(o),function(){return--o>0&&(p=c.apply(this,arguments)),o<=1&&(c=r),p}}var xg=Mt(function(o,c,p){var x=q;if(p.length){var $=Io(p,Wc(xg));x|=k}return Ks(o,x,c,p,$)}),x5=Mt(function(o,c,p){var x=q|K;if(p.length){var $=Io(p,Wc(x5));x|=k}return Ks(c,x,o,p,$)});function S5(o,c,p){c=p?r:c;var x=Ks(o,W,r,r,r,r,r,c);return x.placeholder=S5.placeholder,x}function I5(o,c,p){c=p?r:c;var x=Ks(o,R,r,r,r,r,r,c);return x.placeholder=I5.placeholder,x}function M5(o,c,p){var x,$,j,Q,Z,se,le=0,de=!1,ge=!1,De=!0;if(typeof o!="function")throw new hn(a);c=vn(c)||0,hr(p)&&(de=!!p.leading,ge="maxWait"in p,j=ge?Or(vn(p.maxWait)||0,c):j,De="trailing"in p?!!p.trailing:De);function Je(Ar){var kn=x,Ys=$;return x=$=r,le=Ar,Q=o.apply(Ys,kn),Q}function ut(Ar){return le=Ar,Z=Af(Pt,c),de?Je(Ar):Q}function St(Ar){var kn=Ar-se,Ys=Ar-le,W5=c-kn;return ge?ii(W5,j-Ys):W5}function ft(Ar){var kn=Ar-se,Ys=Ar-le;return se===r||kn>=c||kn<0||ge&&Ys>=j}function Pt(){var Ar=h0();if(ft(Ar))return Ut(Ar);Z=Af(Pt,St(Ar))}function Ut(Ar){return Z=r,De&&x?Je(Ar):(x=$=r,Q)}function Wi(){Z!==r&&Bw(Z),le=0,x=se=$=Z=r}function vi(){return Z===r?Q:Ut(h0())}function Vi(){var Ar=h0(),kn=ft(Ar);if(x=arguments,$=this,se=Ar,kn){if(Z===r)return ut(se);if(ge)return Bw(Z),Z=Af(Pt,c),Je(se)}return Z===r&&(Z=Af(Pt,c)),Q}return Vi.cancel=Wi,Vi.flush=vi,Vi}var cj=Mt(function(o,c){return vw(o,1,c)}),uj=Mt(function(o,c,p){return vw(o,vn(c)||0,p)});function fj(o){return Ks(o,ee)}function l0(o,c){if(typeof o!="function"||c!=null&&typeof c!="function")throw new hn(a);var p=function(){var x=arguments,$=c?c.apply(this,x):x[0],j=p.cache;if(j.has($))return j.get($);var Q=o.apply(this,x);return p.cache=j.set($,Q)||j,Q};return p.cache=new(l0.Cache||zs),p}l0.Cache=zs;function d0(o){if(typeof o!="function")throw new hn(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 hj(o){return A5(2,o)}var lj=ZU(function(o,c){c=c.length==1&&yt(c[0])?ur(c[0],zi(ot())):ur(Wr(c,1),zi(ot()));var p=c.length;return Mt(function(x){for(var $=-1,j=ii(x.length,p);++$<j;)x[$]=c[$].call(this,x[$]);return Fr(o,this,x)})}),Sg=Mt(function(o,c){var p=Io(c,Wc(Sg));return Ks(o,k,r,c,p)}),C5=Mt(function(o,c){var p=Io(c,Wc(C5));return Ks(o,H,r,c,p)}),dj=Ws(function(o,c){return Ks(o,B,r,r,r,c)});function pj(o,c){if(typeof o!="function")throw new hn(a);return c=c===r?c:xt(c),Mt(o,c)}function gj(o,c){if(typeof o!="function")throw new hn(a);return c=c==null?0:Or(xt(c),0),Mt(function(p){var x=p[c],$=Po(p,0,c);return x&&So($,x),Fr(o,this,$)})}function vj(o,c,p){var x=!0,$=!0;if(typeof o!="function")throw new hn(a);return hr(p)&&(x="leading"in p?!!p.leading:x,$="trailing"in p?!!p.trailing:$),M5(o,c,{leading:x,maxWait:c,trailing:$})}function mj(o){return E5(o,1)}function bj(o,c){return Sg(ug(c),o)}function yj(){if(!arguments.length)return[];var o=arguments[0];return yt(o)?o:[o]}function wj(o){return dn(o,S)}function _j(o,c){return c=typeof c=="function"?c:r,dn(o,S,c)}function Ej(o){return dn(o,w|S)}function Aj(o,c){return c=typeof c=="function"?c:r,dn(o,w|S,c)}function xj(o,c){return c==null||gw(o,c,Ur(c))}function Un(o,c){return o===c||o!==o&&c!==c}var Sj=s0(Qp),Ij=s0(function(o,c){return o>=c}),Da=_w(function(){return arguments}())?_w:function(o){return mr(o)&&Jt.call(o,"callee")&&!aw.call(o,"callee")},yt=ce.isArray,Mj=di?zi(di):TU;function Pi(o){return o!=null&&p0(o.length)&&!Gs(o)}function Er(o){return mr(o)&&Pi(o)}function Cj(o){return o===!0||o===!1||mr(o)&&pi(o)==G}var $o=jF||Lg,Dj=Ln?zi(Ln):LU;function Oj(o){return mr(o)&&o.nodeType===1&&!xf(o)}function Pj(o){if(o==null)return!0;if(Pi(o)&&(yt(o)||typeof o=="string"||typeof o.splice=="function"||$o(o)||Vc(o)||Da(o)))return!o.length;var c=ni(o);if(c==he||c==Me)return!o.size;if(Ef(o))return!eg(o).length;for(var p in o)if(Jt.call(o,p))return!1;return!0}function $j(o,c){return yf(o,c)}function Rj(o,c,p){p=typeof p=="function"?p:r;var x=p?p(o,c):r;return x===r?yf(o,c,r,p):!!x}function Ig(o){if(!mr(o))return!1;var c=pi(o);return c==V||c==A||typeof o.message=="string"&&typeof o.name=="string"&&!xf(o)}function Nj(o){return typeof o=="number"&&uw(o)}function Gs(o){if(!hr(o))return!1;var c=pi(o);return c==oe||c==ue||c==z||c==Oe}function D5(o){return typeof o=="number"&&o==xt(o)}function p0(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=O}function hr(o){var c=typeof o;return o!=null&&(c=="object"||c=="function")}function mr(o){return o!=null&&typeof o=="object"}var O5=un?zi(un):FU;function Tj(o,c){return o===c||Xp(o,c,vg(c))}function Lj(o,c,p){return p=typeof p=="function"?p:r,Xp(o,c,vg(c),p)}function Bj(o){return P5(o)&&o!=+o}function Fj(o){if(_k(o))throw new vt(s);return Ew(o)}function Uj(o){return o===null}function kj(o){return o==null}function P5(o){return typeof o=="number"||mr(o)&&pi(o)==ye}function xf(o){if(!mr(o)||pi(o)!=Re)return!1;var c=ql(o);if(c===null)return!0;var p=Jt.call(c,"constructor")&&c.constructor;return typeof p=="function"&&p instanceof p&&Bl.call(p)==LF}var Mg=_s?zi(_s):UU;function qj(o){return D5(o)&&o>=-O&&o<=O}var $5=uf?zi(uf):kU;function g0(o){return typeof o=="string"||!yt(o)&&mr(o)&&pi(o)==be}function Ki(o){return typeof o=="symbol"||mr(o)&&pi(o)==Pe}var Vc=_a?zi(_a):qU;function jj(o){return o===r}function zj(o){return mr(o)&&ni(o)==ve}function Hj(o){return mr(o)&&pi(o)==$e}var Kj=s0(tg),Wj=s0(function(o,c){return o<=c});function R5(o){if(!o)return[];if(Pi(o))return g0(o)?Bn(o):Oi(o);if(hf&&o[hf])return xF(o[hf]());var c=ni(o),p=c==he?jp:c==Me?Nl:Gc;return p(o)}function Js(o){if(!o)return o===0?o:0;if(o=vn(o),o===C||o===-C){var c=o<0?-1:1;return c*M}return o===o?o:0}function xt(o){var c=Js(o),p=c%1;return c===c?p?c-p:c:0}function N5(o){return o?Sa(xt(o),0,m):0}function vn(o){if(typeof o=="number")return o;if(Ki(o))return g;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=Xy(o);var p=Xr.test(o);return p||ti.test(o)?bt(o.slice(2),p?2:8):Zr.test(o)?g:+o}function T5(o){return As(o,$i(o))}function Vj(o){return o?Sa(xt(o),-O,O):o===0?o:0}function Vt(o){return o==null?"":Hi(o)}var Gj=Hc(function(o,c){if(Ef(c)||Pi(c)){As(c,Ur(c),o);return}for(var p in c)Jt.call(c,p)&&vf(o,p,c[p])}),L5=Hc(function(o,c){As(c,$i(c),o)}),v0=Hc(function(o,c,p,x){As(c,$i(c),o,x)}),Jj=Hc(function(o,c,p,x){As(c,Ur(c),o,x)}),Yj=Ws(Gp);function Qj(o,c){var p=zc(o);return c==null?p:pw(p,c)}var Zj=Mt(function(o,c){o=rr(o);var p=-1,x=c.length,$=x>2?c[2]:r;for($&&gi(c[0],c[1],$)&&(x=1);++p<x;)for(var j=c[p],Q=$i(j),Z=-1,se=Q.length;++Z<se;){var le=Q[Z],de=o[le];(de===r||Un(de,kc[le])&&!Jt.call(o,le))&&(o[le]=j[le])}return o}),Xj=Mt(function(o){return o.push(r,Xw),Fr(B5,r,o)});function ez(o,c){return Jy(o,ot(c,3),Es)}function tz(o,c){return Jy(o,ot(c,3),Yp)}function rz(o,c){return o==null?o:Jp(o,ot(c,3),$i)}function iz(o,c){return o==null?o:yw(o,ot(c,3),$i)}function nz(o,c){return o&&Es(o,ot(c,3))}function sz(o,c){return o&&Yp(o,ot(c,3))}function oz(o){return o==null?[]:Ql(o,Ur(o))}function az(o){return o==null?[]:Ql(o,$i(o))}function Cg(o,c,p){var x=o==null?r:Ia(o,c);return x===r?p:x}function cz(o,c){return o!=null&&r5(o,c,PU)}function Dg(o,c){return o!=null&&r5(o,c,$U)}var uz=Gw(function(o,c,p){c!=null&&typeof c.toString!="function"&&(c=Fl.call(c)),o[c]=p},Pg(Ri)),fz=Gw(function(o,c,p){c!=null&&typeof c.toString!="function"&&(c=Fl.call(c)),Jt.call(o,c)?o[c].push(p):o[c]=[p]},ot),hz=Mt(bf);function Ur(o){return Pi(o)?lw(o):eg(o)}function $i(o){return Pi(o)?lw(o,!0):jU(o)}function lz(o,c){var p={};return c=ot(c,3),Es(o,function(x,$,j){Hs(p,c(x,$,j),x)}),p}function dz(o,c){var p={};return c=ot(c,3),Es(o,function(x,$,j){Hs(p,$,c(x,$,j))}),p}var pz=Hc(function(o,c,p){Zl(o,c,p)}),B5=Hc(function(o,c,p,x){Zl(o,c,p,x)}),gz=Ws(function(o,c){var p={};if(o==null)return p;var x=!1;c=ur(c,function(j){return j=Oo(j,o),x||(x=j.length>1),j}),As(o,pg(o),p),x&&(p=dn(p,w|I|S,uk));for(var $=c.length;$--;)og(p,c[$]);return p});function vz(o,c){return F5(o,d0(ot(c)))}var mz=Ws(function(o,c){return o==null?{}:HU(o,c)});function F5(o,c){if(o==null)return{};var p=ur(pg(o),function(x){return[x]});return c=ot(c),Dw(o,p,function(x,$){return c(x,$[0])})}function bz(o,c,p){c=Oo(c,o);var x=-1,$=c.length;for($||($=1,o=r);++x<$;){var j=o==null?r:o[xs(c[x])];j===r&&(x=$,j=p),o=Gs(j)?j.call(o):j}return o}function yz(o,c,p){return o==null?o:wf(o,c,p)}function wz(o,c,p,x){return x=typeof x=="function"?x:r,o==null?o:wf(o,c,p,x)}var U5=Qw(Ur),k5=Qw($i);function _z(o,c,p){var x=yt(o),$=x||$o(o)||Vc(o);if(c=ot(c,4),p==null){var j=o&&o.constructor;$?p=x?new j:[]:hr(o)?p=Gs(j)?zc(ql(o)):{}:p={}}return($?fn:Es)(o,function(Q,Z,se){return c(p,Q,Z,se)}),p}function Ez(o,c){return o==null?!0:og(o,c)}function Az(o,c,p){return o==null?o:Nw(o,c,ug(p))}function xz(o,c,p,x){return x=typeof x=="function"?x:r,o==null?o:Nw(o,c,ug(p),x)}function Gc(o){return o==null?[]:qp(o,Ur(o))}function Sz(o){return o==null?[]:qp(o,$i(o))}function Iz(o,c,p){return p===r&&(p=c,c=r),p!==r&&(p=vn(p),p=p===p?p:0),c!==r&&(c=vn(c),c=c===c?c:0),Sa(vn(o),c,p)}function Mz(o,c,p){return c=Js(c),p===r?(p=c,c=0):p=Js(p),o=vn(o),RU(o,c,p)}function Cz(o,c,p){if(p&&typeof p!="boolean"&&gi(o,c,p)&&(c=p=r),p===r&&(typeof c=="boolean"?(p=c,c=r):typeof o=="boolean"&&(p=o,o=r)),o===r&&c===r?(o=0,c=1):(o=Js(o),c===r?(c=o,o=0):c=Js(c)),o>c){var x=o;o=c,c=x}if(p||o%1||c%1){var $=fw();return ii(o+$*(c-o+er("1e-"+(($+"").length-1))),c)}return ig(o,c)}var Dz=Kc(function(o,c,p){return c=c.toLowerCase(),o+(p?q5(c):c)});function q5(o){return Og(Vt(o).toLowerCase())}function j5(o){return o=Vt(o),o&&o.replace(vr,yF).replace($p,"")}function Oz(o,c,p){o=Vt(o),c=Hi(c);var x=o.length;p=p===r?x:Sa(xt(p),0,x);var $=p;return p-=c.length,p>=0&&o.slice(p,$)==c}function Pz(o){return o=Vt(o),o&&et.test(o)?o.replace(Tt,wF):o}function $z(o){return o=Vt(o),o&&je.test(o)?o.replace(nt,"\\$&"):o}var Rz=Kc(function(o,c,p){return o+(p?"-":"")+c.toLowerCase()}),Nz=Kc(function(o,c,p){return o+(p?" ":"")+c.toLowerCase()}),Tz=Kw("toLowerCase");function Lz(o,c,p){o=Vt(o),c=xt(c);var x=c?Fc(o):0;if(!c||x>=c)return o;var $=(c-x)/2;return n0(Kl($),p)+o+n0(Hl($),p)}function Bz(o,c,p){o=Vt(o),c=xt(c);var x=c?Fc(o):0;return c&&x<c?o+n0(c-x,p):o}function Fz(o,c,p){o=Vt(o),c=xt(c);var x=c?Fc(o):0;return c&&x<c?n0(c-x,p)+o:o}function Uz(o,c,p){return p||c==null?c=0:c&&(c=+c),WF(Vt(o).replace(st,""),c||0)}function kz(o,c,p){return(p?gi(o,c,p):c===r)?c=1:c=xt(c),ng(Vt(o),c)}function qz(){var o=arguments,c=Vt(o[0]);return o.length<3?c:c.replace(o[1],o[2])}var jz=Kc(function(o,c,p){return o+(p?"_":"")+c.toLowerCase()});function zz(o,c,p){return p&&typeof p!="number"&&gi(o,c,p)&&(c=p=r),p=p===r?m:p>>>0,p?(o=Vt(o),o&&(typeof c=="string"||c!=null&&!Mg(c))&&(c=Hi(c),!c&&Bc(o))?Po(Bn(o),0,p):o.split(c,p)):[]}var Hz=Kc(function(o,c,p){return o+(p?" ":"")+Og(c)});function Kz(o,c,p){return o=Vt(o),p=p==null?0:Sa(xt(p),0,o.length),c=Hi(c),o.slice(p,p+c.length)==c}function Wz(o,c,p){var x=U.templateSettings;p&&gi(o,c,p)&&(c=r),o=Vt(o),c=v0({},c,x,Zw);var $=v0({},c.imports,x.imports,Zw),j=Ur($),Q=qp($,j),Z,se,le=0,de=c.interpolate||Ii,ge="__p += '",De=zp((c.escape||Ii).source+"|"+de.source+"|"+(de===rt?ct:Ii).source+"|"+(c.evaluate||Ii).source+"|$","g"),Je="//# sourceURL="+(Jt.call(c,"sourceURL")?(c.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Rp+"]")+`
53
53
  `;o.replace(De,function(ft,Pt,Ut,Wi,vi,Vi){return Ut||(Ut=Wi),ge+=o.slice(le,Vi).replace(On,_F),Pt&&(Z=!0,ge+=`' +
54
54
  __e(`+Pt+`) +
55
55
  '`),vi&&(se=!0,ge+=`';
@@ -66,25 +66,25 @@ __p += '`),Ut&&(ge+=`' +
66
66
  function print() { __p += __j.call(arguments, '') }
67
67
  `:`;
68
68
  `)+ge+`return __p
69
- }`;var St=z5(function(){return Ht(j,Je+"return "+ge).apply(r,Q)});if(St.source=ge,Ig(St))throw St;return St}function Vz(o){return Vt(o).toLowerCase()}function Gz(o){return Vt(o).toUpperCase()}function Jz(o,c,p){if(o=Vt(o),o&&(p||c===r))return Zy(o);if(!o||!(c=Hi(c)))return o;var x=Bn(o),$=Bn(c),j=Xy(x,$),Q=ew(x,$)+1;return Po(x,j,Q).join("")}function Yz(o,c,p){if(o=Vt(o),o&&(p||c===r))return o.slice(0,rw(o)+1);if(!o||!(c=Hi(c)))return o;var x=Bn(o),$=ew(x,Bn(c))+1;return Po(x,0,$).join("")}function Qz(o,c,p){if(o=Vt(o),o&&(p||c===r))return o.replace(st,"");if(!o||!(c=Hi(c)))return o;var x=Bn(o),$=Xy(x,Bn(c));return Po(x,$).join("")}function Zz(o,c){var p=ie,x=L;if(hr(c)){var $="separator"in c?c.separator:$;p="length"in c?xt(c.length):p,x="omission"in c?Hi(c.omission):x}o=Vt(o);var j=o.length;if(Bc(o)){var Q=Bn(o);j=Q.length}if(p>=j)return o;var Z=p-Fc(x);if(Z<1)return x;var se=Q?Po(Q,0,Z).join(""):o.slice(0,Z);if($===r)return se+x;if(Q&&(Z+=se.length-Z),Mg($)){if(o.slice(Z).search($)){var le,de=se;for($.global||($=zp($.source,Vt(_t.exec($))+"g")),$.lastIndex=0;le=$.exec(de);)var ge=le.index;se=se.slice(0,ge===r?Z:ge)}}else if(o.indexOf(Hi($),Z)!=Z){var De=se.lastIndexOf($);De>-1&&(se=se.slice(0,De))}return se+x}function Xz(o){return o=Vt(o),o&&Le.test(o)?o.replace(Ot,CF):o}var eH=Kc(function(o,c,p){return o+(p?" ":"")+c.toUpperCase()}),Og=Hw("toUpperCase");function j5(o,c,p){return o=Vt(o),c=p?r:c,c===r?AF(o)?PF(o):pF(o):o.match(c)||[]}var z5=Mt(function(o,c){try{return Fr(o,r,c)}catch(p){return Ig(p)?p:new vt(p)}}),tH=Ws(function(o,c){return fn(c,function(p){p=xs(p),Hs(o,p,xg(o[p],o))}),o});function rH(o){var c=o==null?0:o.length,p=ot();return o=c?ur(o,function(x){if(typeof x[1]!="function")throw new hn(a);return[p(x[0]),x[1]]}):[],Mt(function(x){for(var $=-1;++$<c;){var j=o[$];if(Fr(j[0],this,x))return Fr(j[1],this,x)}})}function iH(o){return CU(dn(o,w))}function Pg(o){return function(){return o}}function nH(o,c){return o==null||o!==o?c:o}var sH=Ww(),oH=Ww(!0);function Ri(o){return o}function $g(o){return Ew(typeof o=="function"?o:dn(o,w))}function aH(o){return xw(dn(o,w))}function cH(o,c){return Sw(o,dn(c,w))}var uH=Mt(function(o,c){return function(p){return bf(p,o,c)}}),fH=Mt(function(o,c){return function(p){return bf(o,p,c)}});function Rg(o,c,p){var x=Ur(c),$=Ql(c,x);p==null&&!(hr(c)&&($.length||!x.length))&&(p=c,c=o,o=this,$=Ql(c,Ur(c)));var j=!(hr(p)&&"chain"in p)||!!p.chain,Q=Gs(o);return fn($,function(Z){var se=c[Z];o[Z]=se,Q&&(o.prototype[Z]=function(){var le=this.__chain__;if(j||le){var de=o(this.__wrapped__),ge=de.__actions__=Oi(this.__actions__);return ge.push({func:se,args:arguments,thisArg:o}),de.__chain__=le,de}return se.apply(o,So([this.value()],arguments))})}),o}function hH(){return Ft._===this&&(Ft._=BF),this}function Ng(){}function lH(o){return o=xt(o),Mt(function(c){return Iw(c,o)})}var dH=hg(ur),pH=hg(Vy),gH=hg(Lp);function H5(o){return bg(o)?Bp(xs(o)):KU(o)}function vH(o){return function(c){return o==null?r:Ia(o,c)}}var mH=Gw(),bH=Gw(!0);function Tg(){return[]}function Lg(){return!1}function yH(){return{}}function wH(){return""}function _H(){return!0}function EH(o,c){if(o=xt(o),o<1||o>O)return[];var p=m,x=ii(o,m);c=ot(c),o-=m;for(var $=kp(x,c);++p<o;)c(p);return $}function AH(o){return yt(o)?ur(o,xs):Ki(o)?[o]:Oi(f5(Vt(o)))}function xH(o){var c=++TF;return Vt(o)+c}var SH=i0(function(o,c){return o+c},0),IH=lg("ceil"),MH=i0(function(o,c){return o/c},1),CH=lg("floor");function DH(o){return o&&o.length?Yl(o,Ri,Qp):r}function OH(o,c){return o&&o.length?Yl(o,ot(c,2),Qp):r}function PH(o){return Yy(o,Ri)}function $H(o,c){return Yy(o,ot(c,2))}function RH(o){return o&&o.length?Yl(o,Ri,tg):r}function NH(o,c){return o&&o.length?Yl(o,ot(c,2),tg):r}var TH=i0(function(o,c){return o*c},1),LH=lg("round"),BH=i0(function(o,c){return o-c},0);function FH(o){return o&&o.length?Up(o,Ri):0}function UH(o,c){return o&&o.length?Up(o,ot(c,2)):0}return U.after=aj,U.ary=_5,U.assign=Gj,U.assignIn=T5,U.assignInWith=v0,U.assignWith=Jj,U.at=Yj,U.before=E5,U.bind=xg,U.bindAll=tH,U.bindKey=A5,U.castArray=yj,U.chain=b5,U.chunk=Ck,U.compact=Dk,U.concat=Ok,U.cond=rH,U.conforms=iH,U.constant=Pg,U.countBy=Fq,U.create=Qj,U.curry=x5,U.curryRight=S5,U.debounce=I5,U.defaults=Zj,U.defaultsDeep=Xj,U.defer=cj,U.delay=uj,U.difference=Pk,U.differenceBy=$k,U.differenceWith=Rk,U.drop=Nk,U.dropRight=Tk,U.dropRightWhile=Lk,U.dropWhile=Bk,U.fill=Fk,U.filter=kq,U.flatMap=zq,U.flatMapDeep=Hq,U.flatMapDepth=Kq,U.flatten=p5,U.flattenDeep=Uk,U.flattenDepth=kk,U.flip=fj,U.flow=sH,U.flowRight=oH,U.fromPairs=qk,U.functions=oz,U.functionsIn=az,U.groupBy=Wq,U.initial=zk,U.intersection=Hk,U.intersectionBy=Kk,U.intersectionWith=Wk,U.invert=uz,U.invertBy=fz,U.invokeMap=Gq,U.iteratee=$g,U.keyBy=Jq,U.keys=Ur,U.keysIn=$i,U.map=f0,U.mapKeys=lz,U.mapValues=dz,U.matches=aH,U.matchesProperty=cH,U.memoize=l0,U.merge=pz,U.mergeWith=L5,U.method=uH,U.methodOf=fH,U.mixin=Rg,U.negate=d0,U.nthArg=lH,U.omit=gz,U.omitBy=vz,U.once=hj,U.orderBy=Yq,U.over=dH,U.overArgs=lj,U.overEvery=pH,U.overSome=gH,U.partial=Sg,U.partialRight=M5,U.partition=Qq,U.pick=mz,U.pickBy=B5,U.property=H5,U.propertyOf=vH,U.pull=Yk,U.pullAll=v5,U.pullAllBy=Qk,U.pullAllWith=Zk,U.pullAt=Xk,U.range=mH,U.rangeRight=bH,U.rearg=dj,U.reject=ej,U.remove=eq,U.rest=pj,U.reverse=Eg,U.sampleSize=rj,U.set=yz,U.setWith=wz,U.shuffle=ij,U.slice=tq,U.sortBy=oj,U.sortedUniq=cq,U.sortedUniqBy=uq,U.split=zz,U.spread=gj,U.tail=fq,U.take=hq,U.takeRight=lq,U.takeRightWhile=dq,U.takeWhile=pq,U.tap=Dq,U.throttle=vj,U.thru=u0,U.toArray=$5,U.toPairs=F5,U.toPairsIn=U5,U.toPath=AH,U.toPlainObject=N5,U.transform=_z,U.unary=mj,U.union=gq,U.unionBy=vq,U.unionWith=mq,U.uniq=bq,U.uniqBy=yq,U.uniqWith=wq,U.unset=Ez,U.unzip=Ag,U.unzipWith=m5,U.update=Az,U.updateWith=xz,U.values=Gc,U.valuesIn=Sz,U.without=_q,U.words=j5,U.wrap=bj,U.xor=Eq,U.xorBy=Aq,U.xorWith=xq,U.zip=Sq,U.zipObject=Iq,U.zipObjectDeep=Mq,U.zipWith=Cq,U.entries=F5,U.entriesIn=U5,U.extend=T5,U.extendWith=v0,Rg(U,U),U.add=SH,U.attempt=z5,U.camelCase=Dz,U.capitalize=k5,U.ceil=IH,U.clamp=Iz,U.clone=wj,U.cloneDeep=Ej,U.cloneDeepWith=Aj,U.cloneWith=_j,U.conformsTo=xj,U.deburr=q5,U.defaultTo=nH,U.divide=MH,U.endsWith=Oz,U.eq=Un,U.escape=Pz,U.escapeRegExp=$z,U.every=Uq,U.find=qq,U.findIndex=l5,U.findKey=ez,U.findLast=jq,U.findLastIndex=d5,U.findLastKey=tz,U.floor=CH,U.forEach=y5,U.forEachRight=w5,U.forIn=rz,U.forInRight=iz,U.forOwn=nz,U.forOwnRight=sz,U.get=Cg,U.gt=Sj,U.gte=Ij,U.has=cz,U.hasIn=Dg,U.head=g5,U.identity=Ri,U.includes=Vq,U.indexOf=jk,U.inRange=Mz,U.invoke=hz,U.isArguments=Da,U.isArray=yt,U.isArrayBuffer=Mj,U.isArrayLike=Pi,U.isArrayLikeObject=Er,U.isBoolean=Cj,U.isBuffer=$o,U.isDate=Dj,U.isElement=Oj,U.isEmpty=Pj,U.isEqual=$j,U.isEqualWith=Rj,U.isError=Ig,U.isFinite=Nj,U.isFunction=Gs,U.isInteger=C5,U.isLength=p0,U.isMap=D5,U.isMatch=Tj,U.isMatchWith=Lj,U.isNaN=Bj,U.isNative=Fj,U.isNil=kj,U.isNull=Uj,U.isNumber=O5,U.isObject=hr,U.isObjectLike=mr,U.isPlainObject=xf,U.isRegExp=Mg,U.isSafeInteger=qj,U.isSet=P5,U.isString=g0,U.isSymbol=Ki,U.isTypedArray=Vc,U.isUndefined=jj,U.isWeakMap=zj,U.isWeakSet=Hj,U.join=Vk,U.kebabCase=Rz,U.last=gn,U.lastIndexOf=Gk,U.lowerCase=Nz,U.lowerFirst=Tz,U.lt=Kj,U.lte=Wj,U.max=DH,U.maxBy=OH,U.mean=PH,U.meanBy=$H,U.min=RH,U.minBy=NH,U.stubArray=Tg,U.stubFalse=Lg,U.stubObject=yH,U.stubString=wH,U.stubTrue=_H,U.multiply=TH,U.nth=Jk,U.noConflict=hH,U.noop=Ng,U.now=h0,U.pad=Lz,U.padEnd=Bz,U.padStart=Fz,U.parseInt=Uz,U.random=Cz,U.reduce=Zq,U.reduceRight=Xq,U.repeat=kz,U.replace=qz,U.result=bz,U.round=LH,U.runInContext=ne,U.sample=tj,U.size=nj,U.snakeCase=jz,U.some=sj,U.sortedIndex=rq,U.sortedIndexBy=iq,U.sortedIndexOf=nq,U.sortedLastIndex=sq,U.sortedLastIndexBy=oq,U.sortedLastIndexOf=aq,U.startCase=Hz,U.startsWith=Kz,U.subtract=BH,U.sum=FH,U.sumBy=UH,U.template=Wz,U.times=EH,U.toFinite=Js,U.toInteger=xt,U.toLength=R5,U.toLower=Vz,U.toNumber=vn,U.toSafeInteger=Vj,U.toString=Vt,U.toUpper=Gz,U.trim=Jz,U.trimEnd=Yz,U.trimStart=Qz,U.truncate=Zz,U.unescape=Xz,U.uniqueId=xH,U.upperCase=eH,U.upperFirst=Og,U.each=y5,U.eachRight=w5,U.first=g5,Rg(U,function(){var o={};return Es(U,function(c,p){Jt.call(U.prototype,p)||(o[p]=c)}),o}(),{chain:!1}),U.VERSION=i,fn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){U[o].placeholder=U}),fn(["drop","take"],function(o,c){Lt.prototype[o]=function(p){p=p===r?1:Or(xt(p),0);var x=this.__filtered__&&!c?new Lt(this):this.clone();return x.__filtered__?x.__takeCount__=ii(p,x.__takeCount__):x.__views__.push({size:ii(p,m),type:o+(x.__dir__<0?"Right":"")}),x},Lt.prototype[o+"Right"]=function(p){return this.reverse()[o](p).reverse()}}),fn(["filter","map","takeWhile"],function(o,c){var p=c+1,x=p==d||p==E;Lt.prototype[o]=function($){var j=this.clone();return j.__iteratees__.push({iteratee:ot($,3),type:p}),j.__filtered__=j.__filtered__||x,j}}),fn(["head","last"],function(o,c){var p="take"+(c?"Right":"");Lt.prototype[o]=function(){return this[p](1).value()[0]}}),fn(["initial","tail"],function(o,c){var p="drop"+(c?"":"Right");Lt.prototype[o]=function(){return this.__filtered__?new Lt(this):this[p](1)}}),Lt.prototype.compact=function(){return this.filter(Ri)},Lt.prototype.find=function(o){return this.filter(o).head()},Lt.prototype.findLast=function(o){return this.reverse().find(o)},Lt.prototype.invokeMap=Mt(function(o,c){return typeof o=="function"?new Lt(this):this.map(function(p){return bf(p,o,c)})}),Lt.prototype.reject=function(o){return this.filter(d0(ot(o)))},Lt.prototype.slice=function(o,c){o=xt(o);var p=this;return p.__filtered__&&(o>0||c<0)?new Lt(p):(o<0?p=p.takeRight(-o):o&&(p=p.drop(o)),c!==r&&(c=xt(c),p=c<0?p.dropRight(-c):p.take(c-o)),p)},Lt.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},Lt.prototype.toArray=function(){return this.take(m)},Es(Lt.prototype,function(o,c){var p=/^(?:filter|find|map|reject)|While$/.test(c),x=/^(?:head|last)$/.test(c),$=U[x?"take"+(c=="last"?"Right":""):c],j=x||/^find/.test(c);$&&(U.prototype[c]=function(){var Q=this.__wrapped__,Z=x?[1]:arguments,se=Q instanceof Lt,le=Z[0],de=se||yt(Q),ge=function(Pt){var Ut=$.apply(U,So([Pt],Z));return x&&De?Ut[0]:Ut};de&&p&&typeof le=="function"&&le.length!=1&&(se=de=!1);var De=this.__chain__,Je=!!this.__actions__.length,ut=j&&!De,St=se&&!Je;if(!j&&de){Q=St?Q:new Lt(this);var ft=o.apply(Q,Z);return ft.__actions__.push({func:u0,args:[ge],thisArg:r}),new ln(ft,De)}return ut&&St?o.apply(this,Z):(ft=this.thru(ge),ut?x?ft.value()[0]:ft.value():ft)})}),fn(["pop","push","shift","sort","splice","unshift"],function(o){var c=Tl[o],p=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",x=/^(?:pop|shift)$/.test(o);U.prototype[o]=function(){var $=arguments;if(x&&!this.__chain__){var j=this.value();return c.apply(yt(j)?j:[],$)}return this[p](function(Q){return c.apply(yt(Q)?Q:[],$)})}}),Es(Lt.prototype,function(o,c){var p=U[c];if(p){var x=p.name+"";Jt.call(jc,x)||(jc[x]=[]),jc[x].push({name:c,func:p})}}),jc[r0(r,K).name]=[{name:"wrapper",func:r}],Lt.prototype.clone=XF,Lt.prototype.reverse=eU,Lt.prototype.value=tU,U.prototype.at=Oq,U.prototype.chain=Pq,U.prototype.commit=$q,U.prototype.next=Rq,U.prototype.plant=Tq,U.prototype.reverse=Lq,U.prototype.toJSON=U.prototype.valueOf=U.prototype.value=Bq,U.prototype.first=U.prototype.head,hf&&(U.prototype[hf]=Nq),U},Uc=$F();_r?((_r.exports=Uc)._=Uc,tr._=Uc):Ft._=Uc}).call(Uu)})(l1,l1.exports);var V$=Object.defineProperty,G$=Object.defineProperties,J$=Object.getOwnPropertyDescriptors,o6=Object.getOwnPropertySymbols,Y$=Object.prototype.hasOwnProperty,Q$=Object.prototype.propertyIsEnumerable,a6=(t,e,r)=>e in t?V$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Lh=(t,e)=>{for(var r in e||(e={}))Y$.call(e,r)&&a6(t,r,e[r]);if(o6)for(var r of o6(e))Q$.call(e,r)&&a6(t,r,e[r]);return t},Z$=(t,e)=>G$(t,J$(e));function Dn(t,e,r){var i;const n=ou(t);return((i=e.rpcMap)==null?void 0:i[n.reference])||`${s6}?chainId=${n.namespace}:${n.reference}&projectId=${r}`}function ra(t){return t.includes(":")?t.split(":")[1]:t}function c6(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function X$(t,e){const r=Object.keys(e.namespaces).filter(n=>n.includes(t));if(!r.length)return[];const i=[];return r.forEach(n=>{const s=e.namespaces[n].accounts;i.push(...s)}),i}function d1(t={},e={}){const r=u6(t),i=u6(e);return l1.exports.merge(r,i)}function u6(t){var e,r,i,n;const s={};if(!Su(t))return s;for(const[a,u]of Object.entries(t)){const h=Ld(a)?[a]:u.chains,l=u.methods||[],b=u.events||[],w=u.rpcMap||{},I=xu(a);s[I]=Z$(Lh(Lh({},s[I]),u),{chains:rh(h,(e=s[I])==null?void 0:e.chains),methods:rh(l,(r=s[I])==null?void 0:r.methods),events:rh(b,(i=s[I])==null?void 0:i.events),rpcMap:Lh(Lh({},w),(n=s[I])==null?void 0:n.rpcMap)})}return s}function eR(t){return t.includes(":")?t.split(":")[2]:t}function f6(t){const e={};for(const[r,i]of Object.entries(t)){const n=i.methods||[],s=i.events||[],a=i.accounts||[],u=Ld(r)?[r]:i.chains?i.chains:c6(i.accounts);e[r]={chains:u,methods:n,events:s,accounts:a}}return e}function p1(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const h6={},Kt=t=>h6[t],g1=(t,e)=>{h6[t]=e};class tR{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Kt("events"),this.client=Kt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Cn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var i;const n=ra(r);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){const i=r||Dn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new xn(new gs(i,Kt("disableProviderPing")))}}var rR=Object.defineProperty,iR=Object.defineProperties,nR=Object.getOwnPropertyDescriptors,l6=Object.getOwnPropertySymbols,sR=Object.prototype.hasOwnProperty,oR=Object.prototype.propertyIsEnumerable,d6=(t,e,r)=>e in t?rR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,p6=(t,e)=>{for(var r in e||(e={}))sR.call(e,r)&&d6(t,r,e[r]);if(l6)for(var r of l6(e))oR.call(e,r)&&d6(t,r,e[r]);return t},g6=(t,e)=>iR(t,nR(e));class aR{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Kt("events"),this.client=Kt("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,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(Cn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const i=r||Dn(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new xn(new gs(i,Kt("disableProviderPing")))}setHttpProvider(e,r){const i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var i;const n=parseInt(ra(r));e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,i;let n=e.request.params?(r=e.request.params[0])==null?void 0:r.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 r,i,n;const s=(i=(r=e.request)==null?void 0:r.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),u=((n=a?.sessionProperties)==null?void 0:n.capabilities)||{};if(u!=null&&u[s])return u?.[s];const h=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:g6(p6({},a.sessionProperties||{}),{capabilities:g6(p6({},u||{}),{[s]:h})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return h}async getCallStatus(e){var r,i;const n=this.client.session.get(e.topic),s=(r=n.sessionProperties)==null?void 0:r.bundler_name;if(s){const u=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(u,e)}catch(h){console.warn("Failed to fetch call status from bundler",h,u)}}const a=(i=n.sessionProperties)==null?void 0:i.bundler_url;if(a)try{return await this.getUserOperationReceipt(a,e)}catch(u){console.warn("Failed to fetch call status from custom bundler",u,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,r){var i;const n=new URL(e),s=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(uo("eth_getUserOperationReceipt",[(i=r.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,r){return`${W$}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class cR{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Kt("events"),this.client=Kt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Cn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var i;const n=ra(r);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){const i=r||Dn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new xn(new gs(i,Kt("disableProviderPing")))}}class uR{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Kt("events"),this.client=Kt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Cn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var i;const n=ra(r);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){const i=r||Dn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new xn(new gs(i,Kt("disableProviderPing")))}}class fR{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Kt("events"),this.client=Kt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const i=r||Dn(`${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(Cn.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(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var i;e[r]=this.createHttpProvider(r,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){const i=r||Dn(e,this.namespace,this.client.core.projectId);return typeof i>"u"?void 0:new xn(new gs(i,Kt("disableProviderPing")))}}class hR{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Kt("events"),this.client=Kt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Cn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const i=this.getCardanoRPCUrl(r),n=ra(r);e[n]=this.createHttpProvider(n,i)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){const i=r||this.getCardanoRPCUrl(e);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new xn(new gs(i,Kt("disableProviderPing")))}}class lR{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Kt("events"),this.client=Kt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Cn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var i;const n=ra(r);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){const i=r||Dn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new xn(new gs(i,Kt("disableProviderPing")))}}class dR{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Kt("events"),this.client=Kt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Cn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var i;const n=ra(r);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){const i=r||Dn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new xn(new gs(i,Kt("disableProviderPing")))}}class pR{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Kt("events"),this.client=Kt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const i=r||Dn(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(Cn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var i;e[r]=this.createHttpProvider(r,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){const i=r||Dn(e,this.namespace);return typeof i>"u"?void 0:new xn(new gs(i,Kt("disableProviderPing")))}}class gR{constructor(e){this.name=dc,this.namespace=e.namespace,this.events=Kt("events"),this.client=Kt("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,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Cn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const i={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(n=>{const s=ou(n);i[`${s.namespace}:${s.reference}`]=this.createHttpProvider(n)}),i}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){const i=r||Dn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new xn(new gs(i,Kt("disableProviderPing")))}}var vR=Object.defineProperty,mR=Object.defineProperties,bR=Object.getOwnPropertyDescriptors,v6=Object.getOwnPropertySymbols,yR=Object.prototype.hasOwnProperty,wR=Object.prototype.propertyIsEnumerable,m6=(t,e,r)=>e in t?vR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Bh=(t,e)=>{for(var r in e||(e={}))yR.call(e,r)&&m6(t,r,e[r]);if(v6)for(var r of v6(e))wR.call(e,r)&&m6(t,r,e[r]);return t},v1=(t,e)=>mR(t,bR(e));class m1{constructor(e){this.events=new kr.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:cs(Dh({level:e?.logger||i6})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){const r=new m1(e);return await r.initialize(),r}async request(e,r,i){const[n,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:Bh({},e),chainId:`${n}:${s}`,topic:this.session.topic,expiry:i})}sendAsync(e,r,i,n){const s=new Date().getTime();this.request(e,i,n).then(a=>r(null,Oh(s,a))).catch(a=>r(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,r){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,r);i&&(this.uri=i,this.events.emit("display_uri",i));const s=await n();if(this.session=s.session,this.session){const a=f6(this.session.namespaces);this.namespaces=d1(this.namespaces,a),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri: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=f6(s.namespaces);this.namespaces=d1(this.namespaces,a),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==V3)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[i,n]=this.validateChain(e),s=this.getProvider(i);s.name===dc?s.setDefaultChain(`${i}:${n}`,r):s.setDefaultChain(n,r)}catch(i){if(!/Please call connect/.test(i.message))throw i}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(as(r)){for(const i of r)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: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await f1.init({core:this.providerOpts.core,logger:this.providerOpts.logger||i6,relayUrl:this.providerOpts.relayUrl||z$,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(r=>xu(r)))];g1("client",this.client),g1("events",this.events),g1("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const i=X$(r,this.session),n=c6(i),s=d1(this.namespaces,this.optionalNamespaces),a=v1(Bh({},s[r]),{accounts:i,chains:n});switch(r){case"eip155":this.rpcProviders[r]=new aR({namespace:a});break;case"algorand":this.rpcProviders[r]=new fR({namespace:a});break;case"solana":this.rpcProviders[r]=new cR({namespace:a});break;case"cosmos":this.rpcProviders[r]=new uR({namespace:a});break;case"polkadot":this.rpcProviders[r]=new tR({namespace:a});break;case"cip34":this.rpcProviders[r]=new hR({namespace:a});break;case"elrond":this.rpcProviders[r]=new lR({namespace:a});break;case"multiversx":this.rpcProviders[r]=new dR({namespace:a});break;case"near":this.rpcProviders[r]=new pR({namespace:a});break;default:this.rpcProviders[dc]?this.rpcProviders[dc].updateNamespace(a):this.rpcProviders[dc]=new gR({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:r}=e,{event:i}=r;if(i.name==="accountsChanged"){const n=i.data;n&&as(n)&&this.events.emit("accountsChanged",n.map(eR))}else if(i.name==="chainChanged"){const n=r.chainId,s=r.event.data,a=xu(n),u=p1(n)!==p1(s)?`${a}:${p1(s)}`:n;this.onChainChanged(u)}else this.events.emit(i.name,i.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var i;const{namespaces:n}=r,s=(i=this.client)==null?void 0:i.session.get(e);this.session=v1(Bh({},s),{namespaces:n}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",v1(Bh({},Gt("USER_DISCONNECTED")),{data:e.topic}))}),this.on(Cn.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[dc]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:i,sessionProperties:n}=e;r&&Object.keys(r).length&&(this.namespaces=r),i&&Object.keys(i).length&&(this.optionalNamespaces=i),this.sessionProperties=n,this.persist("namespaces",r),this.persist("optionalNamespaces",i)}validateChain(e){const[r,i]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,i];if(r&&!Object.keys(this.namespaces||{}).map(a=>xu(a)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&i)return[r,i];const n=xu(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,r=!1){if(!this.namespaces)return;const[i,n]=this.validateChain(e);n&&(r||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,r){this.client.core.storage.setItem(`${n6}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${n6}/${e}`)}}const _R=m1,ER="wc",AR="ethereum_provider",xR=`${ER}@2:${AR}:`,SR="https://rpc.walletconnect.com/v1/",Fh=["eth_sendTransaction","personal_sign"],b6=["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"],y6=["chainChanged","accountsChanged","message","disconnect","connect"];var IR=Object.defineProperty,MR=Object.defineProperties,CR=Object.getOwnPropertyDescriptors,w6=Object.getOwnPropertySymbols,DR=Object.prototype.hasOwnProperty,OR=Object.prototype.propertyIsEnumerable,_6=(t,e,r)=>e in t?IR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,pc=(t,e)=>{for(var r in e||(e={}))DR.call(e,r)&&_6(t,r,e[r]);if(w6)for(var r of w6(e))OR.call(e,r)&&_6(t,r,e[r]);return t},b1=(t,e)=>MR(t,CR(e));function kh(t){return Number(t[0].split(":")[1])}function qh(t){return`0x${t.toString(16)}`}function PR(t){const{chains:e,optionalChains:r,methods:i,optionalMethods:n,events:s,optionalEvents:a,rpcMap:u}=t;if(!as(e))throw new Error("Invalid chains");const h={chains:e,methods:i||Fh,events:s||Uh,rpcMap:pc({},e.length?{[kh(e)]:u[kh(e)]}:{})},l=s?.filter(S=>!Uh.includes(S)),b=i?.filter(S=>!Fh.includes(S));if(!r&&!a&&!n&&!(l!=null&&l.length)&&!(b!=null&&b.length))return{required:e.length?h:void 0};const w=l?.length&&b?.length||!r,I={chains:[...new Set(w?h.chains.concat(r||[]):r)],methods:[...new Set(h.methods.concat(n!=null&&n.length?n:b6))],events:[...new Set(h.events.concat(a!=null&&a.length?a:y6))],rpcMap:u};return{required:e.length?h:void 0,optional:r.length?I:void 0}}class jh{constructor(){this.events=new kr.exports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=xR,this.on=(e,r)=>(this.events.on(e,r),this),this.once=(e,r)=>(this.events.once(e,r),this),this.removeListener=(e,r)=>(this.events.removeListener(e,r),this),this.off=(e,r)=>(this.events.off(e,r),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const r=new jh;return await r.initialize(e),r}async request(e,r){return await this.signer.request(e,this.formatChainId(this.chainId),r)}sendAsync(e,r,i){this.signer.sendAsync(e,r,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:r,optional:i}=PR(this.rpc);try{const n=await new Promise(async(a,u)=>{var h;this.rpc.showQrModal&&((h=this.modal)==null||h.subscribeModal(l=>{!l.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),u(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(b1(pc({namespaces:pc({},r&&{[this.namespace]:r})},i&&{optionalNamespaces:{[this.namespace]:i}}),{pairingTopic:e?.pairingTopic})).then(l=>{a(l)}).catch(l=>{u(new Error(l.message))})});if(!n)return;const s=U2(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:qh(this.chainId)})}catch(n){throw this.signer.logger.error(n),n}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,r){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 u;this.rpc.showQrModal&&((u=this.modal)==null||u.subscribeModal(h=>{!h.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(b1(pc({},e),{chains:this.rpc.chains}),r).then(h=>{s(h)}).catch(h=>{a(new Error(h.message))})}),n=i.session;if(n){const s=U2(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:qh(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:r}=e,{event:i}=r;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 r=parseInt(e);this.chainId=r,this.events.emit("chainChanged",qh(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",b1(pc({},Gt("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var r,i;this.rpc.showQrModal&&((r=this.modal)==null||r.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 r=e.filter(i=>this.isCompatibleChainId(i)).map(i=>this.parseChainId(i));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",qh(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const r=this.parseChainId(e);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(e){const[r,i,n]=e.split(":");return{chainId:`${r}:${i}`,address:n}}setAccounts(e){this.accounts=e.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var r,i;const n=(r=e?.chains)!=null?r:[],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 u=n.length?e?.methods||Fh:[],h=n.length?e?.events||Uh:[],l=e?.optionalMethods||[],b=e?.optionalEvents||[],w=e?.rpcMap||this.buildRpcMap(a,e.projectId),I=e?.qrModalOptions||void 0;return{chains:n?.map(S=>this.formatChainId(S)),optionalChains:s.map(S=>this.formatChainId(S)),methods:u,events:h,optionalMethods:l,optionalEvents:b,rpcMap:w,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:I,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,r){const i={};return e.forEach(n=>{i[n]=this.getRpcUrl(n,r)}),i}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?kh(this.rpc.chains):kh(this.rpc.optionalChains),this.signer=await _R.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:i}=await Promise.resolve().then(function(){return eN});r=i}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(pc({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:r,optionalChains:i,rpcMap:n}=e;r&&as(r)&&(this.rpc.chains=r.map(s=>this.formatChainId(s)),r.forEach(s=>{this.rpc.rpcMap[s]=n?.[s]||this.getRpcUrl(s)})),i&&as(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,r){var i;return((i=this.rpc.rpcMap)==null?void 0:i[e])||`${SR}?chainId=eip155:${e}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:r?.accounts),this.setAccounts(r?.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(r=>this.signer.logger.warn(r))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(r=>this.parseAccount(r))}}const $R=jh,RR=Symbol(),E6=Object.getPrototypeOf,y1=new WeakMap,NR=t=>t&&(y1.has(t)?y1.get(t):E6(t)===Object.prototype||E6(t)===Array.prototype),TR=t=>NR(t)&&t[RR]||null,A6=(t,e=!0)=>{y1.set(t,e)},w1=t=>typeof t=="object"&&t!==null,fo=new WeakMap,zh=new WeakSet,LR=(t=Object.is,e=(l,b)=>new Proxy(l,b),r=l=>w1(l)&&!zh.has(l)&&(Array.isArray(l)||!(Symbol.iterator in l))&&!(l instanceof WeakMap)&&!(l instanceof WeakSet)&&!(l instanceof Error)&&!(l instanceof Number)&&!(l instanceof Date)&&!(l instanceof String)&&!(l instanceof RegExp)&&!(l instanceof ArrayBuffer),i=l=>{switch(l.status){case"fulfilled":return l.value;case"rejected":throw l.reason;default:throw l}},n=new WeakMap,s=(l,b,w=i)=>{const I=n.get(l);if(I?.[0]===b)return I[1];const S=Array.isArray(l)?[]:Object.create(Object.getPrototypeOf(l));return A6(S,!0),n.set(l,[b,S]),Reflect.ownKeys(l).forEach(D=>{if(Object.getOwnPropertyDescriptor(S,D))return;const T=Reflect.get(l,D),q={value:T,enumerable:!0,configurable:!0};if(zh.has(T))A6(T,!1);else if(T instanceof Promise)delete q.value,q.get=()=>w(T);else if(fo.has(T)){const[K,F]=fo.get(T);q.value=s(K,F(),w)}Object.defineProperty(S,D,q)}),Object.preventExtensions(S)},a=new WeakMap,u=[1,1],h=l=>{if(!w1(l))throw new Error("object required");const b=a.get(l);if(b)return b;let w=u[0];const I=new Set,S=(ee,ie=++u[0])=>{w!==ie&&(w=ie,I.forEach(L=>L(ee,ie)))};let D=u[1];const T=(ee=++u[1])=>(D!==ee&&!I.size&&(D=ee,K.forEach(([ie])=>{const L=ie[1](ee);L>w&&(w=L)})),w),q=ee=>(ie,L)=>{const y=[...ie];y[1]=[ee,...y[1]],S(y,L)},K=new Map,F=(ee,ie)=>{if(K.has(ee))throw new Error("prop listener already exists");if(I.size){const L=ie[3](q(ee));K.set(ee,[ie,L])}else K.set(ee,[ie])},W=ee=>{var ie;const L=K.get(ee);L&&(K.delete(ee),(ie=L[1])==null||ie.call(L))},R=ee=>(I.add(ee),I.size===1&&K.forEach(([L,y],f)=>{if(y)throw new Error("remove already exists");const d=L[3](q(f));K.set(f,[L,d])}),()=>{I.delete(ee),I.size===0&&K.forEach(([L,y],f)=>{y&&(y(),K.set(f,[L]))})}),k=Array.isArray(l)?[]:Object.create(Object.getPrototypeOf(l)),_=e(k,{deleteProperty(ee,ie){const L=Reflect.get(ee,ie);W(ie);const y=Reflect.deleteProperty(ee,ie);return y&&S(["delete",[ie],L]),y},set(ee,ie,L,y){const f=Reflect.has(ee,ie),d=Reflect.get(ee,ie,y);if(f&&(t(d,L)||a.has(L)&&t(d,a.get(L))))return!0;W(ie),w1(L)&&(L=TR(L)||L);let v=L;if(L instanceof Promise)L.then(E=>{L.status="fulfilled",L.value=E,S(["resolve",[ie],E])}).catch(E=>{L.status="rejected",L.reason=E,S(["reject",[ie],E])});else{!fo.has(L)&&r(L)&&(v=h(L));const E=!zh.has(v)&&fo.get(v);E&&F(ie,E)}return Reflect.set(ee,ie,v,y),S(["set",[ie],L,d]),!0}});a.set(l,_);const B=[k,T,s,R];return fo.set(_,B),Reflect.ownKeys(l).forEach(ee=>{const ie=Object.getOwnPropertyDescriptor(l,ee);"value"in ie&&(_[ee]=l[ee],delete ie.value,delete ie.writable),Object.defineProperty(k,ee,ie)}),_})=>[h,fo,zh,t,e,r,i,n,s,a,u],[BR]=LR();function ho(t={}){return BR(t)}function ia(t,e,r){const i=fo.get(t);i||console.warn("Please use proxy object");let n;const s=[],a=i[3];let u=!1;const l=a(b=>{if(s.push(b),r){e(s.splice(0));return}n||(n=Promise.resolve().then(()=>{n=void 0,u&&e(s.splice(0))}))});return u=!0,()=>{u=!1,l()}}function FR(t,e){const r=fo.get(t);r||console.warn("Please use proxy object");const[i,n,s]=r;return s(i,n(),e)}const Br=ho({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),fr={state:Br,subscribe(t){return ia(Br,()=>t(Br))},push(t,e){t!==Br.view&&(Br.view=t,e&&(Br.data=e),Br.history.push(t))},reset(t){Br.view=t,Br.history=[t]},replace(t){Br.history.length>1&&(Br.history[Br.history.length-1]=t,Br.view=t)},goBack(){if(Br.history.length>1){Br.history.pop();const[t]=Br.history.slice(-1);Br.view=t}},setData(t){Br.data=t}},Qe={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 Qe.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const t=navigator.userAgent.toLowerCase();return Qe.isMobile()&&(t.includes("iphone")||t.includes("ipad"))},isHttpUrl(t){return t.startsWith("http://")||t.startsWith("https://")},isArray(t){return Array.isArray(t)&&t.length>0},formatNativeUrl(t,e,r){if(Qe.isHttpUrl(t))return this.formatUniversalUrl(t,e,r);let i=t;i.includes("://")||(i=t.replaceAll("/","").replaceAll(":",""),i=`${i}://`),i.endsWith("/")||(i=`${i}/`),this.setWalletConnectDeepLink(i,r);const n=encodeURIComponent(e);return`${i}wc?uri=${n}`},formatUniversalUrl(t,e,r){if(!Qe.isHttpUrl(t))return this.formatNativeUrl(t,e,r);let i=t;i.endsWith("/")||(i=`${i}/`),this.setWalletConnectDeepLink(i,r);const n=encodeURIComponent(e);return`${i}wc?uri=${n}`},async wait(t){return new Promise(e=>{setTimeout(e,t)})},openHref(t,e){window.open(t,e,"noreferrer noopener")},setWalletConnectDeepLink(t,e){try{localStorage.setItem(Qe.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:e}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(t){try{const[e]=t.split("?");localStorage.setItem(Qe.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(Qe.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(Qe.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var t;const e=(t=fr.state.data)==null?void 0:t.Wallet;if(!e)throw new Error('Missing "Wallet" view data');return e}},UR=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),Qr=ho({enabled:UR,userSessionId:"",events:[],connectedWalletId:void 0}),x6={state:Qr,subscribe(t){return ia(Qr.events,()=>t(FR(Qr.events[Qr.events.length-1])))},initialize(){Qr.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(Qr.userSessionId=crypto.randomUUID())},setConnectedWalletId(t){Qr.connectedWalletId=t},click(t){if(Qr.enabled){const e={type:"CLICK",name:t.name,userSessionId:Qr.userSessionId,timestamp:Date.now(),data:t};Qr.events.push(e)}},track(t){if(Qr.enabled){const e={type:"TRACK",name:t.name,userSessionId:Qr.userSessionId,timestamp:Date.now(),data:t};Qr.events.push(e)}},view(t){if(Qr.enabled){const e={type:"VIEW",name:t.name,userSessionId:Qr.userSessionId,timestamp:Date.now(),data:t};Qr.events.push(e)}}},vs=ho({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),wr={state:vs,subscribe(t){return ia(vs,()=>t(vs))},setChains(t){vs.chains=t},setWalletConnectUri(t){vs.walletConnectUri=t},setIsCustomDesktop(t){vs.isCustomDesktop=t},setIsCustomMobile(t){vs.isCustomMobile=t},setIsDataLoaded(t){vs.isDataLoaded=t},setIsUiLoaded(t){vs.isUiLoaded=t},setIsAuth(t){vs.isAuth=t}},Hh=ho({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}),ki={state:Hh,subscribe(t){return ia(Hh,()=>t(Hh))},setConfig(t){var e,r;x6.initialize(),wr.setChains(t.chains),wr.setIsAuth(!!t.enableAuthMode),wr.setIsCustomMobile(!!((e=t.mobileWallets)!=null&&e.length)),wr.setIsCustomDesktop(!!((r=t.desktopWallets)!=null&&r.length)),Qe.setModalVersionInStorage(),Object.assign(Hh,t)}};var kR=Object.defineProperty,S6=Object.getOwnPropertySymbols,qR=Object.prototype.hasOwnProperty,jR=Object.prototype.propertyIsEnumerable,I6=(t,e,r)=>e in t?kR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,zR=(t,e)=>{for(var r in e||(e={}))qR.call(e,r)&&I6(t,r,e[r]);if(S6)for(var r of S6(e))jR.call(e,r)&&I6(t,r,e[r]);return t};const _1="https://explorer-api.walletconnect.com",E1="wcm",A1="js-2.6.2";async function Kh(t,e){const r=zR({sdkType:E1,sdkVersion:A1},e),i=new URL(t,_1);return i.searchParams.append("projectId",ki.state.projectId),Object.entries(r).forEach(([n,s])=>{s&&i.searchParams.append(n,String(s))}),(await fetch(i)).json()}const na={async getDesktopListings(t){return Kh("/w3m/v1/getDesktopListings",t)},async getMobileListings(t){return Kh("/w3m/v1/getMobileListings",t)},async getInjectedListings(t){return Kh("/w3m/v1/getInjectedListings",t)},async getAllListings(t){return Kh("/w3m/v1/getAllListings",t)},getWalletImageUrl(t){return`${_1}/w3m/v1/getWalletImage/${t}?projectId=${ki.state.projectId}&sdkType=${E1}&sdkVersion=${A1}`},getAssetImageUrl(t){return`${_1}/w3m/v1/getAssetImage/${t}?projectId=${ki.state.projectId}&sdkType=${E1}&sdkVersion=${A1}`}};var HR=Object.defineProperty,M6=Object.getOwnPropertySymbols,KR=Object.prototype.hasOwnProperty,WR=Object.prototype.propertyIsEnumerable,C6=(t,e,r)=>e in t?HR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,VR=(t,e)=>{for(var r in e||(e={}))KR.call(e,r)&&C6(t,r,e[r]);if(M6)for(var r of M6(e))WR.call(e,r)&&C6(t,r,e[r]);return t};const D6=Qe.isMobile(),ms=ho({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),xi={state:ms,async getRecomendedWallets(){const{explorerRecommendedWalletIds:t,explorerExcludedWalletIds:e}=ki.state;if(t==="NONE"||e==="ALL"&&!t)return ms.recomendedWallets;if(Qe.isArray(t)){const r={recommendedIds:t.join(",")},{listings:i}=await na.getAllListings(r),n=Object.values(i);n.sort((s,a)=>{const u=t.indexOf(s.id),h=t.indexOf(a.id);return u-h}),ms.recomendedWallets=n}else{const{chains:r,isAuth:i}=wr.state,n=r?.join(","),s=Qe.isArray(e),a={page:1,sdks:i?"auth_v1":void 0,entries:Qe.RECOMMENDED_WALLET_AMOUNT,chains:n,version:2,excludedIds:s?e.join(","):void 0},{listings:u}=D6?await na.getMobileListings(a):await na.getDesktopListings(a);ms.recomendedWallets=Object.values(u)}return ms.recomendedWallets},async getWallets(t){const e=VR({},t),{explorerRecommendedWalletIds:r,explorerExcludedWalletIds:i}=ki.state,{recomendedWallets:n}=ms;if(i==="ALL")return ms.wallets;n.length?e.excludedIds=n.map(w=>w.id).join(","):Qe.isArray(r)&&(e.excludedIds=r.join(",")),Qe.isArray(i)&&(e.excludedIds=[e.excludedIds,i].filter(Boolean).join(",")),wr.state.isAuth&&(e.sdks="auth_v1");const{page:s,search:a}=t,{listings:u,total:h}=D6?await na.getMobileListings(e):await na.getDesktopListings(e),l=Object.values(u),b=a?"search":"wallets";return ms[b]={listings:[...ms[b].listings,...l],total:h,page:s??1},{listings:l,total:h}},getWalletImageUrl(t){return na.getWalletImageUrl(t)},getAssetImageUrl(t){return na.getAssetImageUrl(t)},resetSearch(){ms.search={listings:[],total:0,page:1}}},gc=ho({open:!1}),sa={state:gc,subscribe(t){return ia(gc,()=>t(gc))},async open(t){return new Promise(e=>{const{isUiLoaded:r,isDataLoaded:i}=wr.state;if(Qe.removeWalletConnectDeepLink(),wr.setWalletConnectUri(t?.uri),wr.setChains(t?.chains),fr.reset("ConnectWallet"),r&&i)gc.open=!0,e();else{const n=setInterval(()=>{const s=wr.state;s.isUiLoaded&&s.isDataLoaded&&(clearInterval(n),gc.open=!0,e())},200)}})},close(){gc.open=!1}};var GR=Object.defineProperty,O6=Object.getOwnPropertySymbols,JR=Object.prototype.hasOwnProperty,YR=Object.prototype.propertyIsEnumerable,P6=(t,e,r)=>e in t?GR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,QR=(t,e)=>{for(var r in e||(e={}))JR.call(e,r)&&P6(t,r,e[r]);if(O6)for(var r of O6(e))YR.call(e,r)&&P6(t,r,e[r]);return t};function ZR(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const ku=ho({themeMode:ZR()?"dark":"light"}),lo={state:ku,subscribe(t){return ia(ku,()=>t(ku))},setThemeConfig(t){const{themeMode:e,themeVariables:r}=t;e&&(ku.themeMode=e),r&&(ku.themeVariables=QR({},r))}},oa=ho({open:!1,message:"",variant:"success"}),po={state:oa,subscribe(t){return ia(oa,()=>t(oa))},openToast(t,e){oa.open=!0,oa.message=t,oa.variant=e},closeToast(){oa.open=!1}};class XR{constructor(e){this.openModal=sa.open,this.closeModal=sa.close,this.subscribeModal=sa.subscribe,this.setTheme=lo.setThemeConfig,lo.setThemeConfig(e),ki.setConfig(e),this.initUi()}async initUi(){if(typeof window<"u"){await Promise.resolve().then(function(){return cF});const e=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",e),wr.setIsUiLoaded(!0)}}}var eN=Object.freeze({__proto__:null,WalletConnectModal:XR});/**
69
+ }`;var St=H5(function(){return Ht(j,Je+"return "+ge).apply(r,Q)});if(St.source=ge,Ig(St))throw St;return St}function Vz(o){return Vt(o).toLowerCase()}function Gz(o){return Vt(o).toUpperCase()}function Jz(o,c,p){if(o=Vt(o),o&&(p||c===r))return Xy(o);if(!o||!(c=Hi(c)))return o;var x=Bn(o),$=Bn(c),j=ew(x,$),Q=tw(x,$)+1;return Po(x,j,Q).join("")}function Yz(o,c,p){if(o=Vt(o),o&&(p||c===r))return o.slice(0,iw(o)+1);if(!o||!(c=Hi(c)))return o;var x=Bn(o),$=tw(x,Bn(c))+1;return Po(x,0,$).join("")}function Qz(o,c,p){if(o=Vt(o),o&&(p||c===r))return o.replace(st,"");if(!o||!(c=Hi(c)))return o;var x=Bn(o),$=ew(x,Bn(c));return Po(x,$).join("")}function Zz(o,c){var p=ie,x=L;if(hr(c)){var $="separator"in c?c.separator:$;p="length"in c?xt(c.length):p,x="omission"in c?Hi(c.omission):x}o=Vt(o);var j=o.length;if(Bc(o)){var Q=Bn(o);j=Q.length}if(p>=j)return o;var Z=p-Fc(x);if(Z<1)return x;var se=Q?Po(Q,0,Z).join(""):o.slice(0,Z);if($===r)return se+x;if(Q&&(Z+=se.length-Z),Mg($)){if(o.slice(Z).search($)){var le,de=se;for($.global||($=zp($.source,Vt(_t.exec($))+"g")),$.lastIndex=0;le=$.exec(de);)var ge=le.index;se=se.slice(0,ge===r?Z:ge)}}else if(o.indexOf(Hi($),Z)!=Z){var De=se.lastIndexOf($);De>-1&&(se=se.slice(0,De))}return se+x}function Xz(o){return o=Vt(o),o&&Le.test(o)?o.replace(Ot,CF):o}var eH=Kc(function(o,c,p){return o+(p?" ":"")+c.toUpperCase()}),Og=Kw("toUpperCase");function z5(o,c,p){return o=Vt(o),c=p?r:c,c===r?AF(o)?PF(o):pF(o):o.match(c)||[]}var H5=Mt(function(o,c){try{return Fr(o,r,c)}catch(p){return Ig(p)?p:new vt(p)}}),tH=Ws(function(o,c){return fn(c,function(p){p=xs(p),Hs(o,p,xg(o[p],o))}),o});function rH(o){var c=o==null?0:o.length,p=ot();return o=c?ur(o,function(x){if(typeof x[1]!="function")throw new hn(a);return[p(x[0]),x[1]]}):[],Mt(function(x){for(var $=-1;++$<c;){var j=o[$];if(Fr(j[0],this,x))return Fr(j[1],this,x)}})}function iH(o){return CU(dn(o,w))}function Pg(o){return function(){return o}}function nH(o,c){return o==null||o!==o?c:o}var sH=Vw(),oH=Vw(!0);function Ri(o){return o}function $g(o){return Aw(typeof o=="function"?o:dn(o,w))}function aH(o){return Sw(dn(o,w))}function cH(o,c){return Iw(o,dn(c,w))}var uH=Mt(function(o,c){return function(p){return bf(p,o,c)}}),fH=Mt(function(o,c){return function(p){return bf(o,p,c)}});function Rg(o,c,p){var x=Ur(c),$=Ql(c,x);p==null&&!(hr(c)&&($.length||!x.length))&&(p=c,c=o,o=this,$=Ql(c,Ur(c)));var j=!(hr(p)&&"chain"in p)||!!p.chain,Q=Gs(o);return fn($,function(Z){var se=c[Z];o[Z]=se,Q&&(o.prototype[Z]=function(){var le=this.__chain__;if(j||le){var de=o(this.__wrapped__),ge=de.__actions__=Oi(this.__actions__);return ge.push({func:se,args:arguments,thisArg:o}),de.__chain__=le,de}return se.apply(o,So([this.value()],arguments))})}),o}function hH(){return Ft._===this&&(Ft._=BF),this}function Ng(){}function lH(o){return o=xt(o),Mt(function(c){return Mw(c,o)})}var dH=hg(ur),pH=hg(Gy),gH=hg(Lp);function K5(o){return bg(o)?Bp(xs(o)):KU(o)}function vH(o){return function(c){return o==null?r:Ia(o,c)}}var mH=Jw(),bH=Jw(!0);function Tg(){return[]}function Lg(){return!1}function yH(){return{}}function wH(){return""}function _H(){return!0}function EH(o,c){if(o=xt(o),o<1||o>O)return[];var p=m,x=ii(o,m);c=ot(c),o-=m;for(var $=kp(x,c);++p<o;)c(p);return $}function AH(o){return yt(o)?ur(o,xs):Ki(o)?[o]:Oi(h5(Vt(o)))}function xH(o){var c=++TF;return Vt(o)+c}var SH=i0(function(o,c){return o+c},0),IH=lg("ceil"),MH=i0(function(o,c){return o/c},1),CH=lg("floor");function DH(o){return o&&o.length?Yl(o,Ri,Qp):r}function OH(o,c){return o&&o.length?Yl(o,ot(c,2),Qp):r}function PH(o){return Qy(o,Ri)}function $H(o,c){return Qy(o,ot(c,2))}function RH(o){return o&&o.length?Yl(o,Ri,tg):r}function NH(o,c){return o&&o.length?Yl(o,ot(c,2),tg):r}var TH=i0(function(o,c){return o*c},1),LH=lg("round"),BH=i0(function(o,c){return o-c},0);function FH(o){return o&&o.length?Up(o,Ri):0}function UH(o,c){return o&&o.length?Up(o,ot(c,2)):0}return U.after=aj,U.ary=E5,U.assign=Gj,U.assignIn=L5,U.assignInWith=v0,U.assignWith=Jj,U.at=Yj,U.before=A5,U.bind=xg,U.bindAll=tH,U.bindKey=x5,U.castArray=yj,U.chain=y5,U.chunk=Ck,U.compact=Dk,U.concat=Ok,U.cond=rH,U.conforms=iH,U.constant=Pg,U.countBy=Fq,U.create=Qj,U.curry=S5,U.curryRight=I5,U.debounce=M5,U.defaults=Zj,U.defaultsDeep=Xj,U.defer=cj,U.delay=uj,U.difference=Pk,U.differenceBy=$k,U.differenceWith=Rk,U.drop=Nk,U.dropRight=Tk,U.dropRightWhile=Lk,U.dropWhile=Bk,U.fill=Fk,U.filter=kq,U.flatMap=zq,U.flatMapDeep=Hq,U.flatMapDepth=Kq,U.flatten=g5,U.flattenDeep=Uk,U.flattenDepth=kk,U.flip=fj,U.flow=sH,U.flowRight=oH,U.fromPairs=qk,U.functions=oz,U.functionsIn=az,U.groupBy=Wq,U.initial=zk,U.intersection=Hk,U.intersectionBy=Kk,U.intersectionWith=Wk,U.invert=uz,U.invertBy=fz,U.invokeMap=Gq,U.iteratee=$g,U.keyBy=Jq,U.keys=Ur,U.keysIn=$i,U.map=f0,U.mapKeys=lz,U.mapValues=dz,U.matches=aH,U.matchesProperty=cH,U.memoize=l0,U.merge=pz,U.mergeWith=B5,U.method=uH,U.methodOf=fH,U.mixin=Rg,U.negate=d0,U.nthArg=lH,U.omit=gz,U.omitBy=vz,U.once=hj,U.orderBy=Yq,U.over=dH,U.overArgs=lj,U.overEvery=pH,U.overSome=gH,U.partial=Sg,U.partialRight=C5,U.partition=Qq,U.pick=mz,U.pickBy=F5,U.property=K5,U.propertyOf=vH,U.pull=Yk,U.pullAll=m5,U.pullAllBy=Qk,U.pullAllWith=Zk,U.pullAt=Xk,U.range=mH,U.rangeRight=bH,U.rearg=dj,U.reject=ej,U.remove=eq,U.rest=pj,U.reverse=Eg,U.sampleSize=rj,U.set=yz,U.setWith=wz,U.shuffle=ij,U.slice=tq,U.sortBy=oj,U.sortedUniq=cq,U.sortedUniqBy=uq,U.split=zz,U.spread=gj,U.tail=fq,U.take=hq,U.takeRight=lq,U.takeRightWhile=dq,U.takeWhile=pq,U.tap=Dq,U.throttle=vj,U.thru=u0,U.toArray=R5,U.toPairs=U5,U.toPairsIn=k5,U.toPath=AH,U.toPlainObject=T5,U.transform=_z,U.unary=mj,U.union=gq,U.unionBy=vq,U.unionWith=mq,U.uniq=bq,U.uniqBy=yq,U.uniqWith=wq,U.unset=Ez,U.unzip=Ag,U.unzipWith=b5,U.update=Az,U.updateWith=xz,U.values=Gc,U.valuesIn=Sz,U.without=_q,U.words=z5,U.wrap=bj,U.xor=Eq,U.xorBy=Aq,U.xorWith=xq,U.zip=Sq,U.zipObject=Iq,U.zipObjectDeep=Mq,U.zipWith=Cq,U.entries=U5,U.entriesIn=k5,U.extend=L5,U.extendWith=v0,Rg(U,U),U.add=SH,U.attempt=H5,U.camelCase=Dz,U.capitalize=q5,U.ceil=IH,U.clamp=Iz,U.clone=wj,U.cloneDeep=Ej,U.cloneDeepWith=Aj,U.cloneWith=_j,U.conformsTo=xj,U.deburr=j5,U.defaultTo=nH,U.divide=MH,U.endsWith=Oz,U.eq=Un,U.escape=Pz,U.escapeRegExp=$z,U.every=Uq,U.find=qq,U.findIndex=d5,U.findKey=ez,U.findLast=jq,U.findLastIndex=p5,U.findLastKey=tz,U.floor=CH,U.forEach=w5,U.forEachRight=_5,U.forIn=rz,U.forInRight=iz,U.forOwn=nz,U.forOwnRight=sz,U.get=Cg,U.gt=Sj,U.gte=Ij,U.has=cz,U.hasIn=Dg,U.head=v5,U.identity=Ri,U.includes=Vq,U.indexOf=jk,U.inRange=Mz,U.invoke=hz,U.isArguments=Da,U.isArray=yt,U.isArrayBuffer=Mj,U.isArrayLike=Pi,U.isArrayLikeObject=Er,U.isBoolean=Cj,U.isBuffer=$o,U.isDate=Dj,U.isElement=Oj,U.isEmpty=Pj,U.isEqual=$j,U.isEqualWith=Rj,U.isError=Ig,U.isFinite=Nj,U.isFunction=Gs,U.isInteger=D5,U.isLength=p0,U.isMap=O5,U.isMatch=Tj,U.isMatchWith=Lj,U.isNaN=Bj,U.isNative=Fj,U.isNil=kj,U.isNull=Uj,U.isNumber=P5,U.isObject=hr,U.isObjectLike=mr,U.isPlainObject=xf,U.isRegExp=Mg,U.isSafeInteger=qj,U.isSet=$5,U.isString=g0,U.isSymbol=Ki,U.isTypedArray=Vc,U.isUndefined=jj,U.isWeakMap=zj,U.isWeakSet=Hj,U.join=Vk,U.kebabCase=Rz,U.last=gn,U.lastIndexOf=Gk,U.lowerCase=Nz,U.lowerFirst=Tz,U.lt=Kj,U.lte=Wj,U.max=DH,U.maxBy=OH,U.mean=PH,U.meanBy=$H,U.min=RH,U.minBy=NH,U.stubArray=Tg,U.stubFalse=Lg,U.stubObject=yH,U.stubString=wH,U.stubTrue=_H,U.multiply=TH,U.nth=Jk,U.noConflict=hH,U.noop=Ng,U.now=h0,U.pad=Lz,U.padEnd=Bz,U.padStart=Fz,U.parseInt=Uz,U.random=Cz,U.reduce=Zq,U.reduceRight=Xq,U.repeat=kz,U.replace=qz,U.result=bz,U.round=LH,U.runInContext=ne,U.sample=tj,U.size=nj,U.snakeCase=jz,U.some=sj,U.sortedIndex=rq,U.sortedIndexBy=iq,U.sortedIndexOf=nq,U.sortedLastIndex=sq,U.sortedLastIndexBy=oq,U.sortedLastIndexOf=aq,U.startCase=Hz,U.startsWith=Kz,U.subtract=BH,U.sum=FH,U.sumBy=UH,U.template=Wz,U.times=EH,U.toFinite=Js,U.toInteger=xt,U.toLength=N5,U.toLower=Vz,U.toNumber=vn,U.toSafeInteger=Vj,U.toString=Vt,U.toUpper=Gz,U.trim=Jz,U.trimEnd=Yz,U.trimStart=Qz,U.truncate=Zz,U.unescape=Xz,U.uniqueId=xH,U.upperCase=eH,U.upperFirst=Og,U.each=w5,U.eachRight=_5,U.first=v5,Rg(U,function(){var o={};return Es(U,function(c,p){Jt.call(U.prototype,p)||(o[p]=c)}),o}(),{chain:!1}),U.VERSION=i,fn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){U[o].placeholder=U}),fn(["drop","take"],function(o,c){Lt.prototype[o]=function(p){p=p===r?1:Or(xt(p),0);var x=this.__filtered__&&!c?new Lt(this):this.clone();return x.__filtered__?x.__takeCount__=ii(p,x.__takeCount__):x.__views__.push({size:ii(p,m),type:o+(x.__dir__<0?"Right":"")}),x},Lt.prototype[o+"Right"]=function(p){return this.reverse()[o](p).reverse()}}),fn(["filter","map","takeWhile"],function(o,c){var p=c+1,x=p==d||p==E;Lt.prototype[o]=function($){var j=this.clone();return j.__iteratees__.push({iteratee:ot($,3),type:p}),j.__filtered__=j.__filtered__||x,j}}),fn(["head","last"],function(o,c){var p="take"+(c?"Right":"");Lt.prototype[o]=function(){return this[p](1).value()[0]}}),fn(["initial","tail"],function(o,c){var p="drop"+(c?"":"Right");Lt.prototype[o]=function(){return this.__filtered__?new Lt(this):this[p](1)}}),Lt.prototype.compact=function(){return this.filter(Ri)},Lt.prototype.find=function(o){return this.filter(o).head()},Lt.prototype.findLast=function(o){return this.reverse().find(o)},Lt.prototype.invokeMap=Mt(function(o,c){return typeof o=="function"?new Lt(this):this.map(function(p){return bf(p,o,c)})}),Lt.prototype.reject=function(o){return this.filter(d0(ot(o)))},Lt.prototype.slice=function(o,c){o=xt(o);var p=this;return p.__filtered__&&(o>0||c<0)?new Lt(p):(o<0?p=p.takeRight(-o):o&&(p=p.drop(o)),c!==r&&(c=xt(c),p=c<0?p.dropRight(-c):p.take(c-o)),p)},Lt.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},Lt.prototype.toArray=function(){return this.take(m)},Es(Lt.prototype,function(o,c){var p=/^(?:filter|find|map|reject)|While$/.test(c),x=/^(?:head|last)$/.test(c),$=U[x?"take"+(c=="last"?"Right":""):c],j=x||/^find/.test(c);$&&(U.prototype[c]=function(){var Q=this.__wrapped__,Z=x?[1]:arguments,se=Q instanceof Lt,le=Z[0],de=se||yt(Q),ge=function(Pt){var Ut=$.apply(U,So([Pt],Z));return x&&De?Ut[0]:Ut};de&&p&&typeof le=="function"&&le.length!=1&&(se=de=!1);var De=this.__chain__,Je=!!this.__actions__.length,ut=j&&!De,St=se&&!Je;if(!j&&de){Q=St?Q:new Lt(this);var ft=o.apply(Q,Z);return ft.__actions__.push({func:u0,args:[ge],thisArg:r}),new ln(ft,De)}return ut&&St?o.apply(this,Z):(ft=this.thru(ge),ut?x?ft.value()[0]:ft.value():ft)})}),fn(["pop","push","shift","sort","splice","unshift"],function(o){var c=Tl[o],p=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",x=/^(?:pop|shift)$/.test(o);U.prototype[o]=function(){var $=arguments;if(x&&!this.__chain__){var j=this.value();return c.apply(yt(j)?j:[],$)}return this[p](function(Q){return c.apply(yt(Q)?Q:[],$)})}}),Es(Lt.prototype,function(o,c){var p=U[c];if(p){var x=p.name+"";Jt.call(jc,x)||(jc[x]=[]),jc[x].push({name:c,func:p})}}),jc[r0(r,K).name]=[{name:"wrapper",func:r}],Lt.prototype.clone=XF,Lt.prototype.reverse=eU,Lt.prototype.value=tU,U.prototype.at=Oq,U.prototype.chain=Pq,U.prototype.commit=$q,U.prototype.next=Rq,U.prototype.plant=Tq,U.prototype.reverse=Lq,U.prototype.toJSON=U.prototype.valueOf=U.prototype.value=Bq,U.prototype.first=U.prototype.head,hf&&(U.prototype[hf]=Nq),U},Uc=$F();_r?((_r.exports=Uc)._=Uc,tr._=Uc):Ft._=Uc}).call(Uu)})(l1,l1.exports);var V$=Object.defineProperty,G$=Object.defineProperties,J$=Object.getOwnPropertyDescriptors,a6=Object.getOwnPropertySymbols,Y$=Object.prototype.hasOwnProperty,Q$=Object.prototype.propertyIsEnumerable,c6=(t,e,r)=>e in t?V$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Lh=(t,e)=>{for(var r in e||(e={}))Y$.call(e,r)&&c6(t,r,e[r]);if(a6)for(var r of a6(e))Q$.call(e,r)&&c6(t,r,e[r]);return t},Z$=(t,e)=>G$(t,J$(e));function Dn(t,e,r){var i;const n=ou(t);return((i=e.rpcMap)==null?void 0:i[n.reference])||`${o6}?chainId=${n.namespace}:${n.reference}&projectId=${r}`}function ra(t){return t.includes(":")?t.split(":")[1]:t}function u6(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function X$(t,e){const r=Object.keys(e.namespaces).filter(n=>n.includes(t));if(!r.length)return[];const i=[];return r.forEach(n=>{const s=e.namespaces[n].accounts;i.push(...s)}),i}function d1(t={},e={}){const r=f6(t),i=f6(e);return l1.exports.merge(r,i)}function f6(t){var e,r,i,n;const s={};if(!Su(t))return s;for(const[a,u]of Object.entries(t)){const h=Ld(a)?[a]:u.chains,l=u.methods||[],b=u.events||[],w=u.rpcMap||{},I=xu(a);s[I]=Z$(Lh(Lh({},s[I]),u),{chains:rh(h,(e=s[I])==null?void 0:e.chains),methods:rh(l,(r=s[I])==null?void 0:r.methods),events:rh(b,(i=s[I])==null?void 0:i.events),rpcMap:Lh(Lh({},w),(n=s[I])==null?void 0:n.rpcMap)})}return s}function eR(t){return t.includes(":")?t.split(":")[2]:t}function h6(t){const e={};for(const[r,i]of Object.entries(t)){const n=i.methods||[],s=i.events||[],a=i.accounts||[],u=Ld(r)?[r]:i.chains?i.chains:u6(i.accounts);e[r]={chains:u,methods:n,events:s,accounts:a}}return e}function p1(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const l6={},Kt=t=>l6[t],g1=(t,e)=>{l6[t]=e};class tR{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Kt("events"),this.client=Kt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Cn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var i;const n=ra(r);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){const i=r||Dn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new xn(new gs(i,Kt("disableProviderPing")))}}var rR=Object.defineProperty,iR=Object.defineProperties,nR=Object.getOwnPropertyDescriptors,d6=Object.getOwnPropertySymbols,sR=Object.prototype.hasOwnProperty,oR=Object.prototype.propertyIsEnumerable,p6=(t,e,r)=>e in t?rR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,g6=(t,e)=>{for(var r in e||(e={}))sR.call(e,r)&&p6(t,r,e[r]);if(d6)for(var r of d6(e))oR.call(e,r)&&p6(t,r,e[r]);return t},v6=(t,e)=>iR(t,nR(e));class aR{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Kt("events"),this.client=Kt("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,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(Cn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const i=r||Dn(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new xn(new gs(i,Kt("disableProviderPing")))}setHttpProvider(e,r){const i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var i;const n=parseInt(ra(r));e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,i;let n=e.request.params?(r=e.request.params[0])==null?void 0:r.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 r,i,n;const s=(i=(r=e.request)==null?void 0:r.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),u=((n=a?.sessionProperties)==null?void 0:n.capabilities)||{};if(u!=null&&u[s])return u?.[s];const h=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:v6(g6({},a.sessionProperties||{}),{capabilities:v6(g6({},u||{}),{[s]:h})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return h}async getCallStatus(e){var r,i;const n=this.client.session.get(e.topic),s=(r=n.sessionProperties)==null?void 0:r.bundler_name;if(s){const u=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(u,e)}catch(h){console.warn("Failed to fetch call status from bundler",h,u)}}const a=(i=n.sessionProperties)==null?void 0:i.bundler_url;if(a)try{return await this.getUserOperationReceipt(a,e)}catch(u){console.warn("Failed to fetch call status from custom bundler",u,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,r){var i;const n=new URL(e),s=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(uo("eth_getUserOperationReceipt",[(i=r.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,r){return`${W$}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class cR{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Kt("events"),this.client=Kt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Cn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var i;const n=ra(r);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){const i=r||Dn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new xn(new gs(i,Kt("disableProviderPing")))}}class uR{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Kt("events"),this.client=Kt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Cn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var i;const n=ra(r);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){const i=r||Dn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new xn(new gs(i,Kt("disableProviderPing")))}}class fR{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Kt("events"),this.client=Kt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const i=r||Dn(`${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(Cn.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(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var i;e[r]=this.createHttpProvider(r,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){const i=r||Dn(e,this.namespace,this.client.core.projectId);return typeof i>"u"?void 0:new xn(new gs(i,Kt("disableProviderPing")))}}class hR{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Kt("events"),this.client=Kt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Cn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const i=this.getCardanoRPCUrl(r),n=ra(r);e[n]=this.createHttpProvider(n,i)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){const i=r||this.getCardanoRPCUrl(e);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new xn(new gs(i,Kt("disableProviderPing")))}}class lR{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Kt("events"),this.client=Kt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Cn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var i;const n=ra(r);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){const i=r||Dn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new xn(new gs(i,Kt("disableProviderPing")))}}class dR{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Kt("events"),this.client=Kt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Cn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var i;const n=ra(r);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){const i=r||Dn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new xn(new gs(i,Kt("disableProviderPing")))}}class pR{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Kt("events"),this.client=Kt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const i=r||Dn(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(Cn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var i;e[r]=this.createHttpProvider(r,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){const i=r||Dn(e,this.namespace);return typeof i>"u"?void 0:new xn(new gs(i,Kt("disableProviderPing")))}}class gR{constructor(e){this.name=dc,this.namespace=e.namespace,this.events=Kt("events"),this.client=Kt("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,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Cn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const i={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(n=>{const s=ou(n);i[`${s.namespace}:${s.reference}`]=this.createHttpProvider(n)}),i}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){const i=r||Dn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new xn(new gs(i,Kt("disableProviderPing")))}}var vR=Object.defineProperty,mR=Object.defineProperties,bR=Object.getOwnPropertyDescriptors,m6=Object.getOwnPropertySymbols,yR=Object.prototype.hasOwnProperty,wR=Object.prototype.propertyIsEnumerable,b6=(t,e,r)=>e in t?vR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Bh=(t,e)=>{for(var r in e||(e={}))yR.call(e,r)&&b6(t,r,e[r]);if(m6)for(var r of m6(e))wR.call(e,r)&&b6(t,r,e[r]);return t},v1=(t,e)=>mR(t,bR(e));class m1{constructor(e){this.events=new kr.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:cs(Dh({level:e?.logger||n6})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){const r=new m1(e);return await r.initialize(),r}async request(e,r,i){const[n,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:Bh({},e),chainId:`${n}:${s}`,topic:this.session.topic,expiry:i})}sendAsync(e,r,i,n){const s=new Date().getTime();this.request(e,i,n).then(a=>r(null,Oh(s,a))).catch(a=>r(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,r){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,r);i&&(this.uri=i,this.events.emit("display_uri",i));const s=await n();if(this.session=s.session,this.session){const a=h6(this.session.namespaces);this.namespaces=d1(this.namespaces,a),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri: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=h6(s.namespaces);this.namespaces=d1(this.namespaces,a),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==G3)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[i,n]=this.validateChain(e),s=this.getProvider(i);s.name===dc?s.setDefaultChain(`${i}:${n}`,r):s.setDefaultChain(n,r)}catch(i){if(!/Please call connect/.test(i.message))throw i}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(as(r)){for(const i of r)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: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await f1.init({core:this.providerOpts.core,logger:this.providerOpts.logger||n6,relayUrl:this.providerOpts.relayUrl||z$,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(r=>xu(r)))];g1("client",this.client),g1("events",this.events),g1("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const i=X$(r,this.session),n=u6(i),s=d1(this.namespaces,this.optionalNamespaces),a=v1(Bh({},s[r]),{accounts:i,chains:n});switch(r){case"eip155":this.rpcProviders[r]=new aR({namespace:a});break;case"algorand":this.rpcProviders[r]=new fR({namespace:a});break;case"solana":this.rpcProviders[r]=new cR({namespace:a});break;case"cosmos":this.rpcProviders[r]=new uR({namespace:a});break;case"polkadot":this.rpcProviders[r]=new tR({namespace:a});break;case"cip34":this.rpcProviders[r]=new hR({namespace:a});break;case"elrond":this.rpcProviders[r]=new lR({namespace:a});break;case"multiversx":this.rpcProviders[r]=new dR({namespace:a});break;case"near":this.rpcProviders[r]=new pR({namespace:a});break;default:this.rpcProviders[dc]?this.rpcProviders[dc].updateNamespace(a):this.rpcProviders[dc]=new gR({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:r}=e,{event:i}=r;if(i.name==="accountsChanged"){const n=i.data;n&&as(n)&&this.events.emit("accountsChanged",n.map(eR))}else if(i.name==="chainChanged"){const n=r.chainId,s=r.event.data,a=xu(n),u=p1(n)!==p1(s)?`${a}:${p1(s)}`:n;this.onChainChanged(u)}else this.events.emit(i.name,i.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var i;const{namespaces:n}=r,s=(i=this.client)==null?void 0:i.session.get(e);this.session=v1(Bh({},s),{namespaces:n}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",v1(Bh({},Gt("USER_DISCONNECTED")),{data:e.topic}))}),this.on(Cn.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[dc]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:i,sessionProperties:n}=e;r&&Object.keys(r).length&&(this.namespaces=r),i&&Object.keys(i).length&&(this.optionalNamespaces=i),this.sessionProperties=n,this.persist("namespaces",r),this.persist("optionalNamespaces",i)}validateChain(e){const[r,i]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,i];if(r&&!Object.keys(this.namespaces||{}).map(a=>xu(a)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&i)return[r,i];const n=xu(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,r=!1){if(!this.namespaces)return;const[i,n]=this.validateChain(e);n&&(r||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,r){this.client.core.storage.setItem(`${s6}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${s6}/${e}`)}}const _R=m1,ER="wc",AR="ethereum_provider",xR=`${ER}@2:${AR}:`,SR="https://rpc.walletconnect.com/v1/",Fh=["eth_sendTransaction","personal_sign"],y6=["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"],w6=["chainChanged","accountsChanged","message","disconnect","connect"];var IR=Object.defineProperty,MR=Object.defineProperties,CR=Object.getOwnPropertyDescriptors,_6=Object.getOwnPropertySymbols,DR=Object.prototype.hasOwnProperty,OR=Object.prototype.propertyIsEnumerable,E6=(t,e,r)=>e in t?IR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,pc=(t,e)=>{for(var r in e||(e={}))DR.call(e,r)&&E6(t,r,e[r]);if(_6)for(var r of _6(e))OR.call(e,r)&&E6(t,r,e[r]);return t},b1=(t,e)=>MR(t,CR(e));function kh(t){return Number(t[0].split(":")[1])}function qh(t){return`0x${t.toString(16)}`}function PR(t){const{chains:e,optionalChains:r,methods:i,optionalMethods:n,events:s,optionalEvents:a,rpcMap:u}=t;if(!as(e))throw new Error("Invalid chains");const h={chains:e,methods:i||Fh,events:s||Uh,rpcMap:pc({},e.length?{[kh(e)]:u[kh(e)]}:{})},l=s?.filter(S=>!Uh.includes(S)),b=i?.filter(S=>!Fh.includes(S));if(!r&&!a&&!n&&!(l!=null&&l.length)&&!(b!=null&&b.length))return{required:e.length?h:void 0};const w=l?.length&&b?.length||!r,I={chains:[...new Set(w?h.chains.concat(r||[]):r)],methods:[...new Set(h.methods.concat(n!=null&&n.length?n:y6))],events:[...new Set(h.events.concat(a!=null&&a.length?a:w6))],rpcMap:u};return{required:e.length?h:void 0,optional:r.length?I:void 0}}class jh{constructor(){this.events=new kr.exports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=xR,this.on=(e,r)=>(this.events.on(e,r),this),this.once=(e,r)=>(this.events.once(e,r),this),this.removeListener=(e,r)=>(this.events.removeListener(e,r),this),this.off=(e,r)=>(this.events.off(e,r),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const r=new jh;return await r.initialize(e),r}async request(e,r){return await this.signer.request(e,this.formatChainId(this.chainId),r)}sendAsync(e,r,i){this.signer.sendAsync(e,r,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:r,optional:i}=PR(this.rpc);try{const n=await new Promise(async(a,u)=>{var h;this.rpc.showQrModal&&((h=this.modal)==null||h.subscribeModal(l=>{!l.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),u(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(b1(pc({namespaces:pc({},r&&{[this.namespace]:r})},i&&{optionalNamespaces:{[this.namespace]:i}}),{pairingTopic:e?.pairingTopic})).then(l=>{a(l)}).catch(l=>{u(new Error(l.message))})});if(!n)return;const s=U2(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:qh(this.chainId)})}catch(n){throw this.signer.logger.error(n),n}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,r){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 u;this.rpc.showQrModal&&((u=this.modal)==null||u.subscribeModal(h=>{!h.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(b1(pc({},e),{chains:this.rpc.chains}),r).then(h=>{s(h)}).catch(h=>{a(new Error(h.message))})}),n=i.session;if(n){const s=U2(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:qh(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:r}=e,{event:i}=r;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 r=parseInt(e);this.chainId=r,this.events.emit("chainChanged",qh(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",b1(pc({},Gt("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var r,i;this.rpc.showQrModal&&((r=this.modal)==null||r.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 r=e.filter(i=>this.isCompatibleChainId(i)).map(i=>this.parseChainId(i));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",qh(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const r=this.parseChainId(e);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(e){const[r,i,n]=e.split(":");return{chainId:`${r}:${i}`,address:n}}setAccounts(e){this.accounts=e.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var r,i;const n=(r=e?.chains)!=null?r:[],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 u=n.length?e?.methods||Fh:[],h=n.length?e?.events||Uh:[],l=e?.optionalMethods||[],b=e?.optionalEvents||[],w=e?.rpcMap||this.buildRpcMap(a,e.projectId),I=e?.qrModalOptions||void 0;return{chains:n?.map(S=>this.formatChainId(S)),optionalChains:s.map(S=>this.formatChainId(S)),methods:u,events:h,optionalMethods:l,optionalEvents:b,rpcMap:w,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:I,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,r){const i={};return e.forEach(n=>{i[n]=this.getRpcUrl(n,r)}),i}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?kh(this.rpc.chains):kh(this.rpc.optionalChains),this.signer=await _R.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:i}=await Promise.resolve().then(function(){return eN});r=i}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(pc({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:r,optionalChains:i,rpcMap:n}=e;r&&as(r)&&(this.rpc.chains=r.map(s=>this.formatChainId(s)),r.forEach(s=>{this.rpc.rpcMap[s]=n?.[s]||this.getRpcUrl(s)})),i&&as(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,r){var i;return((i=this.rpc.rpcMap)==null?void 0:i[e])||`${SR}?chainId=eip155:${e}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:r?.accounts),this.setAccounts(r?.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(r=>this.signer.logger.warn(r))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(r=>this.parseAccount(r))}}const $R=jh,RR=Symbol(),A6=Object.getPrototypeOf,y1=new WeakMap,NR=t=>t&&(y1.has(t)?y1.get(t):A6(t)===Object.prototype||A6(t)===Array.prototype),TR=t=>NR(t)&&t[RR]||null,x6=(t,e=!0)=>{y1.set(t,e)},w1=t=>typeof t=="object"&&t!==null,fo=new WeakMap,zh=new WeakSet,LR=(t=Object.is,e=(l,b)=>new Proxy(l,b),r=l=>w1(l)&&!zh.has(l)&&(Array.isArray(l)||!(Symbol.iterator in l))&&!(l instanceof WeakMap)&&!(l instanceof WeakSet)&&!(l instanceof Error)&&!(l instanceof Number)&&!(l instanceof Date)&&!(l instanceof String)&&!(l instanceof RegExp)&&!(l instanceof ArrayBuffer),i=l=>{switch(l.status){case"fulfilled":return l.value;case"rejected":throw l.reason;default:throw l}},n=new WeakMap,s=(l,b,w=i)=>{const I=n.get(l);if(I?.[0]===b)return I[1];const S=Array.isArray(l)?[]:Object.create(Object.getPrototypeOf(l));return x6(S,!0),n.set(l,[b,S]),Reflect.ownKeys(l).forEach(D=>{if(Object.getOwnPropertyDescriptor(S,D))return;const T=Reflect.get(l,D),q={value:T,enumerable:!0,configurable:!0};if(zh.has(T))x6(T,!1);else if(T instanceof Promise)delete q.value,q.get=()=>w(T);else if(fo.has(T)){const[K,F]=fo.get(T);q.value=s(K,F(),w)}Object.defineProperty(S,D,q)}),Object.preventExtensions(S)},a=new WeakMap,u=[1,1],h=l=>{if(!w1(l))throw new Error("object required");const b=a.get(l);if(b)return b;let w=u[0];const I=new Set,S=(ee,ie=++u[0])=>{w!==ie&&(w=ie,I.forEach(L=>L(ee,ie)))};let D=u[1];const T=(ee=++u[1])=>(D!==ee&&!I.size&&(D=ee,K.forEach(([ie])=>{const L=ie[1](ee);L>w&&(w=L)})),w),q=ee=>(ie,L)=>{const y=[...ie];y[1]=[ee,...y[1]],S(y,L)},K=new Map,F=(ee,ie)=>{if(K.has(ee))throw new Error("prop listener already exists");if(I.size){const L=ie[3](q(ee));K.set(ee,[ie,L])}else K.set(ee,[ie])},W=ee=>{var ie;const L=K.get(ee);L&&(K.delete(ee),(ie=L[1])==null||ie.call(L))},R=ee=>(I.add(ee),I.size===1&&K.forEach(([L,y],f)=>{if(y)throw new Error("remove already exists");const d=L[3](q(f));K.set(f,[L,d])}),()=>{I.delete(ee),I.size===0&&K.forEach(([L,y],f)=>{y&&(y(),K.set(f,[L]))})}),k=Array.isArray(l)?[]:Object.create(Object.getPrototypeOf(l)),_=e(k,{deleteProperty(ee,ie){const L=Reflect.get(ee,ie);W(ie);const y=Reflect.deleteProperty(ee,ie);return y&&S(["delete",[ie],L]),y},set(ee,ie,L,y){const f=Reflect.has(ee,ie),d=Reflect.get(ee,ie,y);if(f&&(t(d,L)||a.has(L)&&t(d,a.get(L))))return!0;W(ie),w1(L)&&(L=TR(L)||L);let v=L;if(L instanceof Promise)L.then(E=>{L.status="fulfilled",L.value=E,S(["resolve",[ie],E])}).catch(E=>{L.status="rejected",L.reason=E,S(["reject",[ie],E])});else{!fo.has(L)&&r(L)&&(v=h(L));const E=!zh.has(v)&&fo.get(v);E&&F(ie,E)}return Reflect.set(ee,ie,v,y),S(["set",[ie],L,d]),!0}});a.set(l,_);const B=[k,T,s,R];return fo.set(_,B),Reflect.ownKeys(l).forEach(ee=>{const ie=Object.getOwnPropertyDescriptor(l,ee);"value"in ie&&(_[ee]=l[ee],delete ie.value,delete ie.writable),Object.defineProperty(k,ee,ie)}),_})=>[h,fo,zh,t,e,r,i,n,s,a,u],[BR]=LR();function ho(t={}){return BR(t)}function ia(t,e,r){const i=fo.get(t);i||console.warn("Please use proxy object");let n;const s=[],a=i[3];let u=!1;const l=a(b=>{if(s.push(b),r){e(s.splice(0));return}n||(n=Promise.resolve().then(()=>{n=void 0,u&&e(s.splice(0))}))});return u=!0,()=>{u=!1,l()}}function FR(t,e){const r=fo.get(t);r||console.warn("Please use proxy object");const[i,n,s]=r;return s(i,n(),e)}const Br=ho({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),fr={state:Br,subscribe(t){return ia(Br,()=>t(Br))},push(t,e){t!==Br.view&&(Br.view=t,e&&(Br.data=e),Br.history.push(t))},reset(t){Br.view=t,Br.history=[t]},replace(t){Br.history.length>1&&(Br.history[Br.history.length-1]=t,Br.view=t)},goBack(){if(Br.history.length>1){Br.history.pop();const[t]=Br.history.slice(-1);Br.view=t}},setData(t){Br.data=t}},Qe={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 Qe.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const t=navigator.userAgent.toLowerCase();return Qe.isMobile()&&(t.includes("iphone")||t.includes("ipad"))},isHttpUrl(t){return t.startsWith("http://")||t.startsWith("https://")},isArray(t){return Array.isArray(t)&&t.length>0},formatNativeUrl(t,e,r){if(Qe.isHttpUrl(t))return this.formatUniversalUrl(t,e,r);let i=t;i.includes("://")||(i=t.replaceAll("/","").replaceAll(":",""),i=`${i}://`),i.endsWith("/")||(i=`${i}/`),this.setWalletConnectDeepLink(i,r);const n=encodeURIComponent(e);return`${i}wc?uri=${n}`},formatUniversalUrl(t,e,r){if(!Qe.isHttpUrl(t))return this.formatNativeUrl(t,e,r);let i=t;i.endsWith("/")||(i=`${i}/`),this.setWalletConnectDeepLink(i,r);const n=encodeURIComponent(e);return`${i}wc?uri=${n}`},async wait(t){return new Promise(e=>{setTimeout(e,t)})},openHref(t,e){window.open(t,e,"noreferrer noopener")},setWalletConnectDeepLink(t,e){try{localStorage.setItem(Qe.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:e}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(t){try{const[e]=t.split("?");localStorage.setItem(Qe.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(Qe.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(Qe.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var t;const e=(t=fr.state.data)==null?void 0:t.Wallet;if(!e)throw new Error('Missing "Wallet" view data');return e}},UR=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),Qr=ho({enabled:UR,userSessionId:"",events:[],connectedWalletId:void 0}),S6={state:Qr,subscribe(t){return ia(Qr.events,()=>t(FR(Qr.events[Qr.events.length-1])))},initialize(){Qr.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(Qr.userSessionId=crypto.randomUUID())},setConnectedWalletId(t){Qr.connectedWalletId=t},click(t){if(Qr.enabled){const e={type:"CLICK",name:t.name,userSessionId:Qr.userSessionId,timestamp:Date.now(),data:t};Qr.events.push(e)}},track(t){if(Qr.enabled){const e={type:"TRACK",name:t.name,userSessionId:Qr.userSessionId,timestamp:Date.now(),data:t};Qr.events.push(e)}},view(t){if(Qr.enabled){const e={type:"VIEW",name:t.name,userSessionId:Qr.userSessionId,timestamp:Date.now(),data:t};Qr.events.push(e)}}},vs=ho({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),wr={state:vs,subscribe(t){return ia(vs,()=>t(vs))},setChains(t){vs.chains=t},setWalletConnectUri(t){vs.walletConnectUri=t},setIsCustomDesktop(t){vs.isCustomDesktop=t},setIsCustomMobile(t){vs.isCustomMobile=t},setIsDataLoaded(t){vs.isDataLoaded=t},setIsUiLoaded(t){vs.isUiLoaded=t},setIsAuth(t){vs.isAuth=t}},Hh=ho({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}),ki={state:Hh,subscribe(t){return ia(Hh,()=>t(Hh))},setConfig(t){var e,r;S6.initialize(),wr.setChains(t.chains),wr.setIsAuth(!!t.enableAuthMode),wr.setIsCustomMobile(!!((e=t.mobileWallets)!=null&&e.length)),wr.setIsCustomDesktop(!!((r=t.desktopWallets)!=null&&r.length)),Qe.setModalVersionInStorage(),Object.assign(Hh,t)}};var kR=Object.defineProperty,I6=Object.getOwnPropertySymbols,qR=Object.prototype.hasOwnProperty,jR=Object.prototype.propertyIsEnumerable,M6=(t,e,r)=>e in t?kR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,zR=(t,e)=>{for(var r in e||(e={}))qR.call(e,r)&&M6(t,r,e[r]);if(I6)for(var r of I6(e))jR.call(e,r)&&M6(t,r,e[r]);return t};const _1="https://explorer-api.walletconnect.com",E1="wcm",A1="js-2.6.2";async function Kh(t,e){const r=zR({sdkType:E1,sdkVersion:A1},e),i=new URL(t,_1);return i.searchParams.append("projectId",ki.state.projectId),Object.entries(r).forEach(([n,s])=>{s&&i.searchParams.append(n,String(s))}),(await fetch(i)).json()}const na={async getDesktopListings(t){return Kh("/w3m/v1/getDesktopListings",t)},async getMobileListings(t){return Kh("/w3m/v1/getMobileListings",t)},async getInjectedListings(t){return Kh("/w3m/v1/getInjectedListings",t)},async getAllListings(t){return Kh("/w3m/v1/getAllListings",t)},getWalletImageUrl(t){return`${_1}/w3m/v1/getWalletImage/${t}?projectId=${ki.state.projectId}&sdkType=${E1}&sdkVersion=${A1}`},getAssetImageUrl(t){return`${_1}/w3m/v1/getAssetImage/${t}?projectId=${ki.state.projectId}&sdkType=${E1}&sdkVersion=${A1}`}};var HR=Object.defineProperty,C6=Object.getOwnPropertySymbols,KR=Object.prototype.hasOwnProperty,WR=Object.prototype.propertyIsEnumerable,D6=(t,e,r)=>e in t?HR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,VR=(t,e)=>{for(var r in e||(e={}))KR.call(e,r)&&D6(t,r,e[r]);if(C6)for(var r of C6(e))WR.call(e,r)&&D6(t,r,e[r]);return t};const O6=Qe.isMobile(),ms=ho({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),xi={state:ms,async getRecomendedWallets(){const{explorerRecommendedWalletIds:t,explorerExcludedWalletIds:e}=ki.state;if(t==="NONE"||e==="ALL"&&!t)return ms.recomendedWallets;if(Qe.isArray(t)){const r={recommendedIds:t.join(",")},{listings:i}=await na.getAllListings(r),n=Object.values(i);n.sort((s,a)=>{const u=t.indexOf(s.id),h=t.indexOf(a.id);return u-h}),ms.recomendedWallets=n}else{const{chains:r,isAuth:i}=wr.state,n=r?.join(","),s=Qe.isArray(e),a={page:1,sdks:i?"auth_v1":void 0,entries:Qe.RECOMMENDED_WALLET_AMOUNT,chains:n,version:2,excludedIds:s?e.join(","):void 0},{listings:u}=O6?await na.getMobileListings(a):await na.getDesktopListings(a);ms.recomendedWallets=Object.values(u)}return ms.recomendedWallets},async getWallets(t){const e=VR({},t),{explorerRecommendedWalletIds:r,explorerExcludedWalletIds:i}=ki.state,{recomendedWallets:n}=ms;if(i==="ALL")return ms.wallets;n.length?e.excludedIds=n.map(w=>w.id).join(","):Qe.isArray(r)&&(e.excludedIds=r.join(",")),Qe.isArray(i)&&(e.excludedIds=[e.excludedIds,i].filter(Boolean).join(",")),wr.state.isAuth&&(e.sdks="auth_v1");const{page:s,search:a}=t,{listings:u,total:h}=O6?await na.getMobileListings(e):await na.getDesktopListings(e),l=Object.values(u),b=a?"search":"wallets";return ms[b]={listings:[...ms[b].listings,...l],total:h,page:s??1},{listings:l,total:h}},getWalletImageUrl(t){return na.getWalletImageUrl(t)},getAssetImageUrl(t){return na.getAssetImageUrl(t)},resetSearch(){ms.search={listings:[],total:0,page:1}}},gc=ho({open:!1}),sa={state:gc,subscribe(t){return ia(gc,()=>t(gc))},async open(t){return new Promise(e=>{const{isUiLoaded:r,isDataLoaded:i}=wr.state;if(Qe.removeWalletConnectDeepLink(),wr.setWalletConnectUri(t?.uri),wr.setChains(t?.chains),fr.reset("ConnectWallet"),r&&i)gc.open=!0,e();else{const n=setInterval(()=>{const s=wr.state;s.isUiLoaded&&s.isDataLoaded&&(clearInterval(n),gc.open=!0,e())},200)}})},close(){gc.open=!1}};var GR=Object.defineProperty,P6=Object.getOwnPropertySymbols,JR=Object.prototype.hasOwnProperty,YR=Object.prototype.propertyIsEnumerable,$6=(t,e,r)=>e in t?GR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,QR=(t,e)=>{for(var r in e||(e={}))JR.call(e,r)&&$6(t,r,e[r]);if(P6)for(var r of P6(e))YR.call(e,r)&&$6(t,r,e[r]);return t};function ZR(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const ku=ho({themeMode:ZR()?"dark":"light"}),lo={state:ku,subscribe(t){return ia(ku,()=>t(ku))},setThemeConfig(t){const{themeMode:e,themeVariables:r}=t;e&&(ku.themeMode=e),r&&(ku.themeVariables=QR({},r))}},oa=ho({open:!1,message:"",variant:"success"}),po={state:oa,subscribe(t){return ia(oa,()=>t(oa))},openToast(t,e){oa.open=!0,oa.message=t,oa.variant=e},closeToast(){oa.open=!1}};class XR{constructor(e){this.openModal=sa.open,this.closeModal=sa.close,this.subscribeModal=sa.subscribe,this.setTheme=lo.setThemeConfig,lo.setThemeConfig(e),ki.setConfig(e),this.initUi()}async initUi(){if(typeof window<"u"){await Promise.resolve().then(function(){return cF});const e=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",e),wr.setIsUiLoaded(!0)}}}var eN=Object.freeze({__proto__:null,WalletConnectModal:XR});/**
70
70
  * @license
71
71
  * Copyright 2019 Google LLC
72
72
  * SPDX-License-Identifier: BSD-3-Clause
73
- */const Wh=window,x1=Wh.ShadowRoot&&(Wh.ShadyCSS===void 0||Wh.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,S1=Symbol(),$6=new WeakMap;class R6{constructor(e,r,i){if(this._$cssResult$=!0,i!==S1)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=r}get styleSheet(){let e=this.o;const r=this.t;if(x1&&e===void 0){const i=r!==void 0&&r.length===1;i&&(e=$6.get(r)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&$6.set(r,e))}return e}toString(){return this.cssText}}const tN=t=>new R6(typeof t=="string"?t:t+"",void 0,S1),zt=(t,...e)=>{const r=t.length===1?t[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)+t[s+1],t[0]);return new R6(r,t,S1)},rN=(t,e)=>{x1?t.adoptedStyleSheets=e.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet):e.forEach(r=>{const i=document.createElement("style"),n=Wh.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=r.cssText,t.appendChild(i)})},N6=x1?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let r="";for(const i of e.cssRules)r+=i.cssText;return tN(r)})(t):t;/**
73
+ */const Wh=window,x1=Wh.ShadowRoot&&(Wh.ShadyCSS===void 0||Wh.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,S1=Symbol(),R6=new WeakMap;class N6{constructor(e,r,i){if(this._$cssResult$=!0,i!==S1)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=r}get styleSheet(){let e=this.o;const r=this.t;if(x1&&e===void 0){const i=r!==void 0&&r.length===1;i&&(e=R6.get(r)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&R6.set(r,e))}return e}toString(){return this.cssText}}const tN=t=>new N6(typeof t=="string"?t:t+"",void 0,S1),zt=(t,...e)=>{const r=t.length===1?t[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)+t[s+1],t[0]);return new N6(r,t,S1)},rN=(t,e)=>{x1?t.adoptedStyleSheets=e.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet):e.forEach(r=>{const i=document.createElement("style"),n=Wh.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=r.cssText,t.appendChild(i)})},T6=x1?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let r="";for(const i of e.cssRules)r+=i.cssText;return tN(r)})(t):t;/**
74
74
  * @license
75
75
  * Copyright 2017 Google LLC
76
76
  * SPDX-License-Identifier: BSD-3-Clause
77
- */var I1;const Vh=window,T6=Vh.trustedTypes,iN=T6?T6.emptyScript:"",L6=Vh.reactiveElementPolyfillSupport,M1={toAttribute(t,e){switch(e){case Boolean:t=t?iN:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=t!==null;break;case Number:r=t===null?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch{r=null}}return r}},B6=(t,e)=>e!==t&&(e==e||t==t),C1={attribute:!0,type:String,converter:M1,reflect:!1,hasChanged:B6},D1="finalized";class vc extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var r;this.finalize(),((r=this.h)!==null&&r!==void 0?r:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach((r,i)=>{const n=this._$Ep(i,r);n!==void 0&&(this._$Ev.set(n,i),e.push(n))}),e}static createProperty(e,r=C1){if(r.state&&(r.attribute=!1),this.finalize(),this.elementProperties.set(e,r),!r.noAccessor&&!this.prototype.hasOwnProperty(e)){const i=typeof e=="symbol"?Symbol():"__"+e,n=this.getPropertyDescriptor(e,i,r);n!==void 0&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,r,i){return{get(){return this[r]},set(n){const s=this[e];this[r]=n,this.requestUpdate(e,s,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||C1}static finalize(){if(this.hasOwnProperty(D1))return!1;this[D1]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const r=this.properties,i=[...Object.getOwnPropertyNames(r),...Object.getOwnPropertySymbols(r)];for(const n of i)this.createProperty(n,r[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const r=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const n of i)r.unshift(N6(n))}else e!==void 0&&r.push(N6(e));return r}static _$Ep(e,r){const i=r.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(r=>this.enableUpdating=r),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(r=>r(this))}addController(e){var r,i;((r=this._$ES)!==null&&r!==void 0?r:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((i=e.hostConnected)===null||i===void 0||i.call(e))}removeController(e){var r;(r=this._$ES)===null||r===void 0||r.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,r)=>{this.hasOwnProperty(r)&&(this._$Ei.set(r,this[r]),delete this[r])})}createRenderRoot(){var e;const r=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return rN(r,this.constructor.elementStyles),r}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(r=>{var i;return(i=r.hostConnected)===null||i===void 0?void 0:i.call(r)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(r=>{var i;return(i=r.hostDisconnected)===null||i===void 0?void 0:i.call(r)})}attributeChangedCallback(e,r,i){this._$AK(e,i)}_$EO(e,r,i=C1){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:M1).toAttribute(r,i.type);this._$El=e,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._$El=null}}_$AK(e,r){var i;const n=this.constructor,s=n._$Ev.get(e);if(s!==void 0&&this._$El!==s){const a=n.getPropertyOptions(s),u=typeof a.converter=="function"?{fromAttribute:a.converter}:((i=a.converter)===null||i===void 0?void 0:i.fromAttribute)!==void 0?a.converter:M1;this._$El=s,this[s]=u.fromAttribute(r,a.type),this._$El=null}}requestUpdate(e,r,i){let n=!0;e!==void 0&&(((i=i||this.constructor.getPropertyOptions(e)).hasChanged||B6)(this[e],r)?(this._$AL.has(e)||this._$AL.set(e,r),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(r){Promise.reject(r)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((n,s)=>this[s]=n),this._$Ei=void 0);let r=!1;const i=this._$AL;try{r=this.shouldUpdate(i),r?(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 r=!1,this._$Ek(),n}r&&this._$AE(i)}willUpdate(e){}_$AE(e){var r;(r=this._$ES)===null||r===void 0||r.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((r,i)=>this._$EO(i,this[i],r)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}vc[D1]=!0,vc.elementProperties=new Map,vc.elementStyles=[],vc.shadowRootOptions={mode:"open"},L6?.({ReactiveElement:vc}),((I1=Vh.reactiveElementVersions)!==null&&I1!==void 0?I1:Vh.reactiveElementVersions=[]).push("1.6.3");/**
77
+ */var I1;const Vh=window,L6=Vh.trustedTypes,iN=L6?L6.emptyScript:"",B6=Vh.reactiveElementPolyfillSupport,M1={toAttribute(t,e){switch(e){case Boolean:t=t?iN:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=t!==null;break;case Number:r=t===null?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch{r=null}}return r}},F6=(t,e)=>e!==t&&(e==e||t==t),C1={attribute:!0,type:String,converter:M1,reflect:!1,hasChanged:F6},D1="finalized";class vc extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var r;this.finalize(),((r=this.h)!==null&&r!==void 0?r:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach((r,i)=>{const n=this._$Ep(i,r);n!==void 0&&(this._$Ev.set(n,i),e.push(n))}),e}static createProperty(e,r=C1){if(r.state&&(r.attribute=!1),this.finalize(),this.elementProperties.set(e,r),!r.noAccessor&&!this.prototype.hasOwnProperty(e)){const i=typeof e=="symbol"?Symbol():"__"+e,n=this.getPropertyDescriptor(e,i,r);n!==void 0&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,r,i){return{get(){return this[r]},set(n){const s=this[e];this[r]=n,this.requestUpdate(e,s,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||C1}static finalize(){if(this.hasOwnProperty(D1))return!1;this[D1]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const r=this.properties,i=[...Object.getOwnPropertyNames(r),...Object.getOwnPropertySymbols(r)];for(const n of i)this.createProperty(n,r[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const r=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const n of i)r.unshift(T6(n))}else e!==void 0&&r.push(T6(e));return r}static _$Ep(e,r){const i=r.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(r=>this.enableUpdating=r),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(r=>r(this))}addController(e){var r,i;((r=this._$ES)!==null&&r!==void 0?r:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((i=e.hostConnected)===null||i===void 0||i.call(e))}removeController(e){var r;(r=this._$ES)===null||r===void 0||r.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,r)=>{this.hasOwnProperty(r)&&(this._$Ei.set(r,this[r]),delete this[r])})}createRenderRoot(){var e;const r=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return rN(r,this.constructor.elementStyles),r}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(r=>{var i;return(i=r.hostConnected)===null||i===void 0?void 0:i.call(r)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(r=>{var i;return(i=r.hostDisconnected)===null||i===void 0?void 0:i.call(r)})}attributeChangedCallback(e,r,i){this._$AK(e,i)}_$EO(e,r,i=C1){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:M1).toAttribute(r,i.type);this._$El=e,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._$El=null}}_$AK(e,r){var i;const n=this.constructor,s=n._$Ev.get(e);if(s!==void 0&&this._$El!==s){const a=n.getPropertyOptions(s),u=typeof a.converter=="function"?{fromAttribute:a.converter}:((i=a.converter)===null||i===void 0?void 0:i.fromAttribute)!==void 0?a.converter:M1;this._$El=s,this[s]=u.fromAttribute(r,a.type),this._$El=null}}requestUpdate(e,r,i){let n=!0;e!==void 0&&(((i=i||this.constructor.getPropertyOptions(e)).hasChanged||F6)(this[e],r)?(this._$AL.has(e)||this._$AL.set(e,r),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(r){Promise.reject(r)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((n,s)=>this[s]=n),this._$Ei=void 0);let r=!1;const i=this._$AL;try{r=this.shouldUpdate(i),r?(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 r=!1,this._$Ek(),n}r&&this._$AE(i)}willUpdate(e){}_$AE(e){var r;(r=this._$ES)===null||r===void 0||r.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((r,i)=>this._$EO(i,this[i],r)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}vc[D1]=!0,vc.elementProperties=new Map,vc.elementStyles=[],vc.shadowRootOptions={mode:"open"},B6?.({ReactiveElement:vc}),((I1=Vh.reactiveElementVersions)!==null&&I1!==void 0?I1:Vh.reactiveElementVersions=[]).push("1.6.3");/**
78
78
  * @license
79
79
  * Copyright 2017 Google LLC
80
80
  * SPDX-License-Identifier: BSD-3-Clause
81
- */var O1;const Gh=window,mc=Gh.trustedTypes,F6=mc?mc.createPolicy("lit-html",{createHTML:t=>t}):void 0,P1="$lit$",go=`lit$${(Math.random()+"").slice(9)}$`,U6="?"+go,nN=`<${U6}>`,aa=document,qu=()=>aa.createComment(""),ju=t=>t===null||typeof t!="object"&&typeof t!="function",k6=Array.isArray,sN=t=>k6(t)||typeof t?.[Symbol.iterator]=="function",$1=`[
82
- \f\r]`,zu=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,q6=/-->/g,j6=/>/g,ca=RegExp(`>|${$1}(?:([^\\s"'>=/]+)(${$1}*=${$1}*(?:[^
83
- \f\r"'\`<>=]|("|')|))|$)`,"g"),z6=/'/g,H6=/"/g,K6=/^(?:script|style|textarea|title)$/i,W6=t=>(e,...r)=>({_$litType$:t,strings:e,values:r}),Ie=W6(1),gr=W6(2),ua=Symbol.for("lit-noChange"),Mr=Symbol.for("lit-nothing"),V6=new WeakMap,fa=aa.createTreeWalker(aa,129,null,!1);function G6(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return F6!==void 0?F6.createHTML(e):e}const oN=(t,e)=>{const r=t.length-1,i=[];let n,s=e===2?"<svg>":"",a=zu;for(let u=0;u<r;u++){const h=t[u];let l,b,w=-1,I=0;for(;I<h.length&&(a.lastIndex=I,b=a.exec(h),b!==null);)I=a.lastIndex,a===zu?b[1]==="!--"?a=q6:b[1]!==void 0?a=j6:b[2]!==void 0?(K6.test(b[2])&&(n=RegExp("</"+b[2],"g")),a=ca):b[3]!==void 0&&(a=ca):a===ca?b[0]===">"?(a=n??zu,w=-1):b[1]===void 0?w=-2:(w=a.lastIndex-b[2].length,l=b[1],a=b[3]===void 0?ca:b[3]==='"'?H6:z6):a===H6||a===z6?a=ca:a===q6||a===j6?a=zu:(a=ca,n=void 0);const S=a===ca&&t[u+1].startsWith("/>")?" ":"";s+=a===zu?h+nN:w>=0?(i.push(l),h.slice(0,w)+P1+h.slice(w)+go+S):h+go+(w===-2?(i.push(void 0),u):S)}return[G6(t,s+(t[r]||"<?>")+(e===2?"</svg>":"")),i]};class Hu{constructor({strings:e,_$litType$:r},i){let n;this.parts=[];let s=0,a=0;const u=e.length-1,h=this.parts,[l,b]=oN(e,r);if(this.el=Hu.createElement(l,i),fa.currentNode=this.el.content,r===2){const w=this.el.content,I=w.firstChild;I.remove(),w.append(...I.childNodes)}for(;(n=fa.nextNode())!==null&&h.length<u;){if(n.nodeType===1){if(n.hasAttributes()){const w=[];for(const I of n.getAttributeNames())if(I.endsWith(P1)||I.startsWith(go)){const S=b[a++];if(w.push(I),S!==void 0){const D=n.getAttribute(S.toLowerCase()+P1).split(go),T=/([.?@])?(.*)/.exec(S);h.push({type:1,index:s,name:T[2],strings:D,ctor:T[1]==="."?cN:T[1]==="?"?fN:T[1]==="@"?hN:Jh})}else h.push({type:6,index:s})}for(const I of w)n.removeAttribute(I)}if(K6.test(n.tagName)){const w=n.textContent.split(go),I=w.length-1;if(I>0){n.textContent=mc?mc.emptyScript:"";for(let S=0;S<I;S++)n.append(w[S],qu()),fa.nextNode(),h.push({type:2,index:++s});n.append(w[I],qu())}}}else if(n.nodeType===8)if(n.data===U6)h.push({type:2,index:s});else{let w=-1;for(;(w=n.data.indexOf(go,w+1))!==-1;)h.push({type:7,index:s}),w+=go.length-1}s++}}static createElement(e,r){const i=aa.createElement("template");return i.innerHTML=e,i}}function bc(t,e,r=t,i){var n,s,a,u;if(e===ua)return e;let h=i!==void 0?(n=r._$Co)===null||n===void 0?void 0:n[i]:r._$Cl;const l=ju(e)?void 0:e._$litDirective$;return h?.constructor!==l&&((s=h?._$AO)===null||s===void 0||s.call(h,!1),l===void 0?h=void 0:(h=new l(t),h._$AT(t,r,i)),i!==void 0?((a=(u=r)._$Co)!==null&&a!==void 0?a:u._$Co=[])[i]=h:r._$Cl=h),h!==void 0&&(e=bc(t,h._$AS(t,e.values),h,i)),e}class aN{constructor(e,r){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=r}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var r;const{el:{content:i},parts:n}=this._$AD,s=((r=e?.creationScope)!==null&&r!==void 0?r:aa).importNode(i,!0);fa.currentNode=s;let a=fa.nextNode(),u=0,h=0,l=n[0];for(;l!==void 0;){if(u===l.index){let b;l.type===2?b=new Ku(a,a.nextSibling,this,e):l.type===1?b=new l.ctor(a,l.name,l.strings,this,e):l.type===6&&(b=new lN(a,this,e)),this._$AV.push(b),l=n[++h]}u!==l?.index&&(a=fa.nextNode(),u++)}return fa.currentNode=aa,s}v(e){let r=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,r),r+=i.strings.length-2):i._$AI(e[r])),r++}}class Ku{constructor(e,r,i,n){var s;this.type=2,this._$AH=Mr,this._$AN=void 0,this._$AA=e,this._$AB=r,this._$AM=i,this.options=n,this._$Cp=(s=n?.isConnected)===null||s===void 0||s}get _$AU(){var e,r;return(r=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&r!==void 0?r:this._$Cp}get parentNode(){let e=this._$AA.parentNode;const r=this._$AM;return r!==void 0&&e?.nodeType===11&&(e=r.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,r=this){e=bc(this,e,r),ju(e)?e===Mr||e==null||e===""?(this._$AH!==Mr&&this._$AR(),this._$AH=Mr):e!==this._$AH&&e!==ua&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):sN(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&&ju(this._$AH)?this._$AA.nextSibling.data=e:this.$(aa.createTextNode(e)),this._$AH=e}g(e){var r;const{values:i,_$litType$:n}=e,s=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=Hu.createElement(G6(n.h,n.h[0]),this.options)),n);if(((r=this._$AH)===null||r===void 0?void 0:r._$AD)===s)this._$AH.v(i);else{const a=new aN(s,this),u=a.u(this.options);a.v(i),this.$(u),this._$AH=a}}_$AC(e){let r=V6.get(e.strings);return r===void 0&&V6.set(e.strings,r=new Hu(e)),r}T(e){k6(this._$AH)||(this._$AH=[],this._$AR());const r=this._$AH;let i,n=0;for(const s of e)n===r.length?r.push(i=new Ku(this.k(qu()),this.k(qu()),this,this.options)):i=r[n],i._$AI(s),n++;n<r.length&&(this._$AR(i&&i._$AB.nextSibling,n),r.length=n)}_$AR(e=this._$AA.nextSibling,r){var i;for((i=this._$AP)===null||i===void 0||i.call(this,!1,!0,r);e&&e!==this._$AB;){const n=e.nextSibling;e.remove(),e=n}}setConnected(e){var r;this._$AM===void 0&&(this._$Cp=e,(r=this._$AP)===null||r===void 0||r.call(this,e))}}class Jh{constructor(e,r,i,n,s){this.type=1,this._$AH=Mr,this._$AN=void 0,this.element=e,this.name=r,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,r=this,i,n){const s=this.strings;let a=!1;if(s===void 0)e=bc(this,e,r,0),a=!ju(e)||e!==this._$AH&&e!==ua,a&&(this._$AH=e);else{const u=e;let h,l;for(e=s[0],h=0;h<s.length-1;h++)l=bc(this,u[i+h],r,h),l===ua&&(l=this._$AH[h]),a||(a=!ju(l)||l!==this._$AH[h]),l===Mr?e=Mr:e!==Mr&&(e+=(l??"")+s[h+1]),this._$AH[h]=l}a&&!n&&this.j(e)}j(e){e===Mr?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class cN extends Jh{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Mr?void 0:e}}const uN=mc?mc.emptyScript:"";class fN extends Jh{constructor(){super(...arguments),this.type=4}j(e){e&&e!==Mr?this.element.setAttribute(this.name,uN):this.element.removeAttribute(this.name)}}class hN extends Jh{constructor(e,r,i,n,s){super(e,r,i,n,s),this.type=5}_$AI(e,r=this){var i;if((e=(i=bc(this,e,r,0))!==null&&i!==void 0?i:Mr)===ua)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 r,i;typeof this._$AH=="function"?this._$AH.call((i=(r=this.options)===null||r===void 0?void 0:r.host)!==null&&i!==void 0?i:this.element,e):this._$AH.handleEvent(e)}}class lN{constructor(e,r,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=r,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){bc(this,e)}}const J6=Gh.litHtmlPolyfillSupport;J6?.(Hu,Ku),((O1=Gh.litHtmlVersions)!==null&&O1!==void 0?O1:Gh.litHtmlVersions=[]).push("2.8.0");const dN=(t,e,r)=>{var i,n;const s=(i=r?.renderBefore)!==null&&i!==void 0?i:e;let a=s._$litPart$;if(a===void 0){const u=(n=r?.renderBefore)!==null&&n!==void 0?n:null;s._$litPart$=a=new Ku(e.insertBefore(qu(),u),u,void 0,r??{})}return a._$AI(t),a};/**
81
+ */var O1;const Gh=window,mc=Gh.trustedTypes,U6=mc?mc.createPolicy("lit-html",{createHTML:t=>t}):void 0,P1="$lit$",go=`lit$${(Math.random()+"").slice(9)}$`,k6="?"+go,nN=`<${k6}>`,aa=document,qu=()=>aa.createComment(""),ju=t=>t===null||typeof t!="object"&&typeof t!="function",q6=Array.isArray,sN=t=>q6(t)||typeof t?.[Symbol.iterator]=="function",$1=`[
82
+ \f\r]`,zu=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,j6=/-->/g,z6=/>/g,ca=RegExp(`>|${$1}(?:([^\\s"'>=/]+)(${$1}*=${$1}*(?:[^
83
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),H6=/'/g,K6=/"/g,W6=/^(?:script|style|textarea|title)$/i,V6=t=>(e,...r)=>({_$litType$:t,strings:e,values:r}),Ie=V6(1),gr=V6(2),ua=Symbol.for("lit-noChange"),Mr=Symbol.for("lit-nothing"),G6=new WeakMap,fa=aa.createTreeWalker(aa,129,null,!1);function J6(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return U6!==void 0?U6.createHTML(e):e}const oN=(t,e)=>{const r=t.length-1,i=[];let n,s=e===2?"<svg>":"",a=zu;for(let u=0;u<r;u++){const h=t[u];let l,b,w=-1,I=0;for(;I<h.length&&(a.lastIndex=I,b=a.exec(h),b!==null);)I=a.lastIndex,a===zu?b[1]==="!--"?a=j6:b[1]!==void 0?a=z6:b[2]!==void 0?(W6.test(b[2])&&(n=RegExp("</"+b[2],"g")),a=ca):b[3]!==void 0&&(a=ca):a===ca?b[0]===">"?(a=n??zu,w=-1):b[1]===void 0?w=-2:(w=a.lastIndex-b[2].length,l=b[1],a=b[3]===void 0?ca:b[3]==='"'?K6:H6):a===K6||a===H6?a=ca:a===j6||a===z6?a=zu:(a=ca,n=void 0);const S=a===ca&&t[u+1].startsWith("/>")?" ":"";s+=a===zu?h+nN:w>=0?(i.push(l),h.slice(0,w)+P1+h.slice(w)+go+S):h+go+(w===-2?(i.push(void 0),u):S)}return[J6(t,s+(t[r]||"<?>")+(e===2?"</svg>":"")),i]};class Hu{constructor({strings:e,_$litType$:r},i){let n;this.parts=[];let s=0,a=0;const u=e.length-1,h=this.parts,[l,b]=oN(e,r);if(this.el=Hu.createElement(l,i),fa.currentNode=this.el.content,r===2){const w=this.el.content,I=w.firstChild;I.remove(),w.append(...I.childNodes)}for(;(n=fa.nextNode())!==null&&h.length<u;){if(n.nodeType===1){if(n.hasAttributes()){const w=[];for(const I of n.getAttributeNames())if(I.endsWith(P1)||I.startsWith(go)){const S=b[a++];if(w.push(I),S!==void 0){const D=n.getAttribute(S.toLowerCase()+P1).split(go),T=/([.?@])?(.*)/.exec(S);h.push({type:1,index:s,name:T[2],strings:D,ctor:T[1]==="."?cN:T[1]==="?"?fN:T[1]==="@"?hN:Jh})}else h.push({type:6,index:s})}for(const I of w)n.removeAttribute(I)}if(W6.test(n.tagName)){const w=n.textContent.split(go),I=w.length-1;if(I>0){n.textContent=mc?mc.emptyScript:"";for(let S=0;S<I;S++)n.append(w[S],qu()),fa.nextNode(),h.push({type:2,index:++s});n.append(w[I],qu())}}}else if(n.nodeType===8)if(n.data===k6)h.push({type:2,index:s});else{let w=-1;for(;(w=n.data.indexOf(go,w+1))!==-1;)h.push({type:7,index:s}),w+=go.length-1}s++}}static createElement(e,r){const i=aa.createElement("template");return i.innerHTML=e,i}}function bc(t,e,r=t,i){var n,s,a,u;if(e===ua)return e;let h=i!==void 0?(n=r._$Co)===null||n===void 0?void 0:n[i]:r._$Cl;const l=ju(e)?void 0:e._$litDirective$;return h?.constructor!==l&&((s=h?._$AO)===null||s===void 0||s.call(h,!1),l===void 0?h=void 0:(h=new l(t),h._$AT(t,r,i)),i!==void 0?((a=(u=r)._$Co)!==null&&a!==void 0?a:u._$Co=[])[i]=h:r._$Cl=h),h!==void 0&&(e=bc(t,h._$AS(t,e.values),h,i)),e}class aN{constructor(e,r){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=r}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var r;const{el:{content:i},parts:n}=this._$AD,s=((r=e?.creationScope)!==null&&r!==void 0?r:aa).importNode(i,!0);fa.currentNode=s;let a=fa.nextNode(),u=0,h=0,l=n[0];for(;l!==void 0;){if(u===l.index){let b;l.type===2?b=new Ku(a,a.nextSibling,this,e):l.type===1?b=new l.ctor(a,l.name,l.strings,this,e):l.type===6&&(b=new lN(a,this,e)),this._$AV.push(b),l=n[++h]}u!==l?.index&&(a=fa.nextNode(),u++)}return fa.currentNode=aa,s}v(e){let r=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,r),r+=i.strings.length-2):i._$AI(e[r])),r++}}class Ku{constructor(e,r,i,n){var s;this.type=2,this._$AH=Mr,this._$AN=void 0,this._$AA=e,this._$AB=r,this._$AM=i,this.options=n,this._$Cp=(s=n?.isConnected)===null||s===void 0||s}get _$AU(){var e,r;return(r=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&r!==void 0?r:this._$Cp}get parentNode(){let e=this._$AA.parentNode;const r=this._$AM;return r!==void 0&&e?.nodeType===11&&(e=r.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,r=this){e=bc(this,e,r),ju(e)?e===Mr||e==null||e===""?(this._$AH!==Mr&&this._$AR(),this._$AH=Mr):e!==this._$AH&&e!==ua&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):sN(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&&ju(this._$AH)?this._$AA.nextSibling.data=e:this.$(aa.createTextNode(e)),this._$AH=e}g(e){var r;const{values:i,_$litType$:n}=e,s=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=Hu.createElement(J6(n.h,n.h[0]),this.options)),n);if(((r=this._$AH)===null||r===void 0?void 0:r._$AD)===s)this._$AH.v(i);else{const a=new aN(s,this),u=a.u(this.options);a.v(i),this.$(u),this._$AH=a}}_$AC(e){let r=G6.get(e.strings);return r===void 0&&G6.set(e.strings,r=new Hu(e)),r}T(e){q6(this._$AH)||(this._$AH=[],this._$AR());const r=this._$AH;let i,n=0;for(const s of e)n===r.length?r.push(i=new Ku(this.k(qu()),this.k(qu()),this,this.options)):i=r[n],i._$AI(s),n++;n<r.length&&(this._$AR(i&&i._$AB.nextSibling,n),r.length=n)}_$AR(e=this._$AA.nextSibling,r){var i;for((i=this._$AP)===null||i===void 0||i.call(this,!1,!0,r);e&&e!==this._$AB;){const n=e.nextSibling;e.remove(),e=n}}setConnected(e){var r;this._$AM===void 0&&(this._$Cp=e,(r=this._$AP)===null||r===void 0||r.call(this,e))}}class Jh{constructor(e,r,i,n,s){this.type=1,this._$AH=Mr,this._$AN=void 0,this.element=e,this.name=r,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,r=this,i,n){const s=this.strings;let a=!1;if(s===void 0)e=bc(this,e,r,0),a=!ju(e)||e!==this._$AH&&e!==ua,a&&(this._$AH=e);else{const u=e;let h,l;for(e=s[0],h=0;h<s.length-1;h++)l=bc(this,u[i+h],r,h),l===ua&&(l=this._$AH[h]),a||(a=!ju(l)||l!==this._$AH[h]),l===Mr?e=Mr:e!==Mr&&(e+=(l??"")+s[h+1]),this._$AH[h]=l}a&&!n&&this.j(e)}j(e){e===Mr?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class cN extends Jh{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Mr?void 0:e}}const uN=mc?mc.emptyScript:"";class fN extends Jh{constructor(){super(...arguments),this.type=4}j(e){e&&e!==Mr?this.element.setAttribute(this.name,uN):this.element.removeAttribute(this.name)}}class hN extends Jh{constructor(e,r,i,n,s){super(e,r,i,n,s),this.type=5}_$AI(e,r=this){var i;if((e=(i=bc(this,e,r,0))!==null&&i!==void 0?i:Mr)===ua)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 r,i;typeof this._$AH=="function"?this._$AH.call((i=(r=this.options)===null||r===void 0?void 0:r.host)!==null&&i!==void 0?i:this.element,e):this._$AH.handleEvent(e)}}class lN{constructor(e,r,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=r,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){bc(this,e)}}const Y6=Gh.litHtmlPolyfillSupport;Y6?.(Hu,Ku),((O1=Gh.litHtmlVersions)!==null&&O1!==void 0?O1:Gh.litHtmlVersions=[]).push("2.8.0");const dN=(t,e,r)=>{var i,n;const s=(i=r?.renderBefore)!==null&&i!==void 0?i:e;let a=s._$litPart$;if(a===void 0){const u=(n=r?.renderBefore)!==null&&n!==void 0?n:null;s._$litPart$=a=new Ku(e.insertBefore(qu(),u),u,void 0,r??{})}return a._$AI(t),a};/**
84
84
  * @license
85
85
  * Copyright 2017 Google LLC
86
86
  * SPDX-License-Identifier: BSD-3-Clause
87
- */var R1,N1;class Ct extends vc{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,r;const i=super.createRenderRoot();return(e=(r=this.renderOptions).renderBefore)!==null&&e!==void 0||(r.renderBefore=i.firstChild),i}update(e){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=dN(r,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return ua}}Ct.finalized=!0,Ct._$litElement$=!0,(R1=globalThis.litElementHydrateSupport)===null||R1===void 0||R1.call(globalThis,{LitElement:Ct});const Y6=globalThis.litElementPolyfillSupport;Y6?.({LitElement:Ct}),((N1=globalThis.litElementVersions)!==null&&N1!==void 0?N1:globalThis.litElementVersions=[]).push("3.3.3");/**
87
+ */var R1,N1;class Ct extends vc{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,r;const i=super.createRenderRoot();return(e=(r=this.renderOptions).renderBefore)!==null&&e!==void 0||(r.renderBefore=i.firstChild),i}update(e){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=dN(r,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return ua}}Ct.finalized=!0,Ct._$litElement$=!0,(R1=globalThis.litElementHydrateSupport)===null||R1===void 0||R1.call(globalThis,{LitElement:Ct});const Q6=globalThis.litElementPolyfillSupport;Q6?.({LitElement:Ct}),((N1=globalThis.litElementVersions)!==null&&N1!==void 0?N1:globalThis.litElementVersions=[]).push("3.3.3");/**
88
88
  * @license
89
89
  * Copyright 2017 Google LLC
90
90
  * SPDX-License-Identifier: BSD-3-Clause
@@ -108,16 +108,16 @@ function print() { __p += __j.call(arguments, '') }
108
108
  * @license
109
109
  * Copyright 2018 Google LLC
110
110
  * SPDX-License-Identifier: BSD-3-Clause
111
- */const Fs=mN(class extends bN{constructor(t){var e;if(super(t),t.type!==vN.ATTRIBUTE||t.name!=="class"||((e=t.strings)===null||e===void 0?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter(e=>t[e]).join(" ")+" "}update(t,[e]){var r,i;if(this.it===void 0){this.it=new Set,t.strings!==void 0&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter(s=>s!=="")));for(const s in e)e[s]&&!(!((r=this.nt)===null||r===void 0)&&r.has(s))&&this.it.add(s);return this.render(e)}const n=t.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 ua}});function yN(t,e){t.indexOf(e)===-1&&t.push(e)}const Q6=(t,e,r)=>Math.min(Math.max(r,t),e),on={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},Yh=t=>typeof t=="number",yc=t=>Array.isArray(t)&&!Yh(t[0]),wN=(t,e,r)=>{const i=e-t;return((r-t)%i+i)%i+t};function _N(t,e){return yc(t)?t[wN(0,t.length,e)]:t}const Z6=(t,e,r)=>-r*t+r*e+t,X6=()=>{},vo=t=>t,L1=(t,e,r)=>e-t===0?1:(r-t)/(e-t);function ey(t,e){const r=t[t.length-1];for(let i=1;i<=e;i++){const n=L1(0,e,i);t.push(Z6(r,1,n))}}function EN(t){const e=[0];return ey(e,t-1),e}function AN(t,e=EN(t.length),r=vo){const i=t.length,n=i-e.length;return n>0&&ey(e,n),s=>{let a=0;for(;a<i-2&&!(s<e[a+1]);a++);let u=Q6(0,1,L1(e[a],e[a+1],s));return u=_N(r,a)(u),Z6(t[a],t[a+1],u)}}const ty=t=>Array.isArray(t)&&Yh(t[0]),B1=t=>typeof t=="object"&&!!t.createAnimation,ha=t=>typeof t=="function",xN=t=>typeof t=="string",Wu={ms:t=>t*1e3,s:t=>t/1e3},ry=(t,e,r)=>(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,SN=1e-7,IN=12;function MN(t,e,r,i,n){let s,a,u=0;do a=e+(r-e)/2,s=ry(a,i,n)-t,s>0?r=a:e=a;while(Math.abs(s)>SN&&++u<IN);return a}function Vu(t,e,r,i){if(t===e&&r===i)return vo;const n=s=>MN(s,0,1,t,r);return s=>s===0||s===1?s:ry(n(s),e,i)}const CN=(t,e="end")=>r=>{r=e==="end"?Math.min(r,.999):Math.max(r,.001);const i=r*t,n=e==="end"?Math.floor(i):Math.ceil(i);return Q6(0,1,n/t)},iy={ease:Vu(.25,.1,.25,1),"ease-in":Vu(.42,0,1,1),"ease-in-out":Vu(.42,0,.58,1),"ease-out":Vu(0,0,.58,1)},DN=/\((.*?)\)/;function ny(t){if(ha(t))return t;if(ty(t))return Vu(...t);if(iy[t])return iy[t];if(t.startsWith("steps")){const e=DN.exec(t);if(e){const r=e[1].split(",");return CN(parseFloat(r[0]),r[1].trim())}}return vo}class sy{constructor(e,r=[0,1],{easing:i,duration:n=on.duration,delay:s=on.delay,endDelay:a=on.endDelay,repeat:u=on.repeat,offset:h,direction:l="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=vo,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise((w,I)=>{this.resolve=w,this.reject=I}),i=i||on.easing,B1(i)){const w=i.createAnimation(r);i=w.easing,r=w.keyframes||r,n=w.duration||n}this.repeat=u,this.easing=yc(i)?vo:ny(i),this.updateDuration(n);const b=AN(r,h,yc(i)?i.map(ny):vo);this.tick=w=>{var I;s=s;let S=0;this.pauseTime!==void 0?S=this.pauseTime:S=(w-this.startTime)*this.rate,this.t=S,S/=1e3,S=Math.max(S-s,0),this.playState==="finished"&&this.pauseTime===void 0&&(S=this.totalDuration);const D=S/this.duration;let T=Math.floor(D),q=D%1;!q&&D>=1&&(q=1),q===1&&T--;const K=T%2;(l==="reverse"||l==="alternate"&&K||l==="alternate-reverse"&&!K)&&(q=1-q);const F=S>=this.totalDuration?1:Math.min(q,1),W=b(this.easing(F));e(W),this.pauseTime===void 0&&(this.playState==="finished"||S>=this.totalDuration+a)?(this.playState="finished",(I=this.resolve)===null||I===void 0||I.call(this,W)):this.playState!=="idle"&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){const e=performance.now();this.playState="running",this.pauseTime!==void 0?this.startTime=e-this.pauseTime:this.startTime||(this.startTime=e),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var e;this.playState="idle",this.frameRequestId!==void 0&&cancelAnimationFrame(this.frameRequestId),(e=this.reject)===null||e===void 0||e.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(e){this.duration=e,this.totalDuration=e*(this.repeat+1)}get currentTime(){return this.t}set currentTime(e){this.pauseTime!==void 0||this.rate===0?this.pauseTime=e:this.startTime=performance.now()-e/this.rate}get playbackRate(){return this.rate}set playbackRate(e){this.rate=e}}var F1=function(){};process.env.NODE_ENV!=="production"&&(F1=function(t,e){if(!t)throw new Error(e)});class ON{setAnimation(e){this.animation=e,e?.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}const U1=new WeakMap;function oy(t){return U1.has(t)||U1.set(t,{transforms:[],values:new Map}),U1.get(t)}function PN(t,e){return t.has(e)||t.set(e,new ON),t.get(e)}const $N=["","X","Y","Z"],RN=["translate","scale","rotate","skew"],Qh={x:"translateX",y:"translateY",z:"translateZ"},ay={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},NN={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:ay,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:vo},skew:ay},Gu=new Map,k1=t=>`--motion-${t}`,Zh=["x","y","z"];RN.forEach(t=>{$N.forEach(e=>{Zh.push(t+e),Gu.set(k1(t+e),NN[t])})});const TN=(t,e)=>Zh.indexOf(t)-Zh.indexOf(e),LN=new Set(Zh),cy=t=>LN.has(t),BN=(t,e)=>{Qh[e]&&(e=Qh[e]);const{transforms:r}=oy(t);yN(r,e),t.style.transform=FN(r)},FN=t=>t.sort(TN).reduce(UN,"").trim(),UN=(t,e)=>`${t} ${e}(var(${k1(e)}))`,q1=t=>t.startsWith("--"),uy=new Set;function kN(t){if(!uy.has(t)){uy.add(t);try{const{syntax:e,initialValue:r}=Gu.has(t)?Gu.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:r})}catch{}}}const j1=(t,e)=>document.createElement("div").animate(t,e),fy={cssRegisterProperty:()=>typeof CSS<"u"&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{j1({opacity:[1]})}catch{return!1}return!0},finished:()=>!!j1({opacity:[0,1]},{duration:.001}).finished,linearEasing:()=>{try{j1({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0}},z1={},wc={};for(const t in fy)wc[t]=()=>(z1[t]===void 0&&(z1[t]=fy[t]()),z1[t]);const qN=.015,jN=(t,e)=>{let r="";const i=Math.round(e/qN);for(let n=0;n<i;n++)r+=t(L1(0,i-1,n))+", ";return r.substring(0,r.length-2)},hy=(t,e)=>ha(t)?wc.linearEasing()?`linear(${jN(t,e)})`:on.easing:ty(t)?zN(t):t,zN=([t,e,r,i])=>`cubic-bezier(${t}, ${e}, ${r}, ${i})`;function HN(t,e){for(let r=0;r<t.length;r++)t[r]===null&&(t[r]=r?t[r-1]:e());return t}const KN=t=>Array.isArray(t)?t:[t];function H1(t){return Qh[t]&&(t=Qh[t]),cy(t)?k1(t):t}const Xh={get:(t,e)=>{e=H1(e);let r=q1(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!r&&r!==0){const i=Gu.get(e);i&&(r=i.initialValue)}return r},set:(t,e,r)=>{e=H1(e),q1(e)?t.style.setProperty(e,r):t.style[e]=r}};function ly(t,e=!0){if(!(!t||t.playState==="finished"))try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch{}}function WN(t,e){var r;let i=e?.toDefaultUnit||vo;const n=t[t.length-1];if(xN(n)){const s=((r=n.match(/(-?[\d.]+)([a-z%]*)/))===null||r===void 0?void 0:r[2])||"";s&&(i=a=>a+s)}return i}function VN(){return window.__MOTION_DEV_TOOLS_RECORD}function GN(t,e,r,i={},n){const s=VN(),a=i.record!==!1&&s;let u,{duration:h=on.duration,delay:l=on.delay,endDelay:b=on.endDelay,repeat:w=on.repeat,easing:I=on.easing,persist:S=!1,direction:D,offset:T,allowWebkitAcceleration:q=!1}=i;const K=oy(t),F=cy(e);let W=wc.waapi();F&&BN(t,e);const R=H1(e),k=PN(K.values,R),H=Gu.get(R);return ly(k.animation,!(B1(I)&&k.generator)&&i.record!==!1),()=>{const _=()=>{var ie,L;return(L=(ie=Xh.get(t,R))!==null&&ie!==void 0?ie:H?.initialValue)!==null&&L!==void 0?L:0};let B=HN(KN(r),_);const ee=WN(B,H);if(B1(I)){const ie=I.createAnimation(B,e!=="opacity",_,R,k);I=ie.easing,B=ie.keyframes||B,h=ie.duration||h}if(q1(R)&&(wc.cssRegisterProperty()?kN(R):W=!1),F&&!wc.linearEasing()&&(ha(I)||yc(I)&&I.some(ha))&&(W=!1),W){H&&(B=B.map(y=>Yh(y)?H.toDefaultUnit(y):y)),B.length===1&&(!wc.partialKeyframes()||a)&&B.unshift(_());const ie={delay:Wu.ms(l),duration:Wu.ms(h),endDelay:Wu.ms(b),easing:yc(I)?void 0:hy(I,h),direction:D,iterations:w+1,fill:"both"};u=t.animate({[R]:B,offset:T,easing:yc(I)?I.map(y=>hy(y,h)):void 0},ie),u.finished||(u.finished=new Promise((y,f)=>{u.onfinish=y,u.oncancel=f}));const L=B[B.length-1];u.finished.then(()=>{S||(Xh.set(t,R,L),u.cancel())}).catch(X6),q||(u.playbackRate=1.000001)}else if(n&&F)B=B.map(ie=>typeof ie=="string"?parseFloat(ie):ie),B.length===1&&B.unshift(parseFloat(_())),u=new n(ie=>{Xh.set(t,R,ee?ee(ie):ie)},B,Object.assign(Object.assign({},i),{duration:h,easing:I}));else{const ie=B[B.length-1];Xh.set(t,R,H&&Yh(ie)?H.toDefaultUnit(ie):ie)}return a&&s(t,e,B,{duration:h,delay:l,easing:I,repeat:w,offset:T},"motion-one"),k.setAnimation(u),u}}const JN=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function dy(t,e){var r;return typeof t=="string"?e?((r=e[t])!==null&&r!==void 0||(e[t]=document.querySelectorAll(t)),t=e[t]):t=document.querySelectorAll(t):t instanceof Element&&(t=[t]),Array.from(t||[])}const YN=t=>t(),py=(t,e,r=on.duration)=>new Proxy({animations:t.map(YN).filter(Boolean),duration:r,options:e},ZN),QN=t=>t.animations[0],ZN={get:(t,e)=>{const r=QN(t);switch(e){case"duration":return t.duration;case"currentTime":return Wu.s(r?.[e]||0);case"playbackRate":case"playState":return r?.[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(XN)).catch(X6)),t.finished;case"stop":return()=>{t.animations.forEach(i=>ly(i))};case"forEachNative":return i=>{t.animations.forEach(n=>i(n,t))};default:return typeof r?.[e]>"u"?void 0:()=>t.animations.forEach(i=>i[e]())}},set:(t,e,r)=>{switch(e){case"currentTime":r=Wu.ms(r);case"playbackRate":for(let i=0;i<t.animations.length;i++)t.animations[i][e]=r;return!0}return!1}},XN=t=>t.finished;function eT(t,e,r){return ha(t)?t(e,r):t}function tT(t){return function(r,i,n={}){r=dy(r);const s=r.length;F1(!!s,"No valid element provided."),F1(!!i,"No keyframes defined.");const a=[];for(let u=0;u<s;u++){const h=r[u];for(const l in i){const b=JN(n,l);b.delay=eT(b.delay,u,s);const w=GN(h,l,i[l],b,t);a.push(w)}}return py(a,n,n.duration)}}const rT=tT(sy);function iT(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r}typeof SuppressedError=="function"&&SuppressedError;const nT={any:0,all:1};function sT(t,e,{root:r,margin:i,amount:n="any"}={}){if(typeof IntersectionObserver>"u")return()=>{};const s=dy(t),a=new WeakMap,u=l=>{l.forEach(b=>{const w=a.get(b.target);if(b.isIntersecting!==!!w)if(b.isIntersecting){const I=e(b);ha(I)?a.set(b.target,I):h.unobserve(b.target)}else w&&(w(b),a.delete(b.target))})},h=new IntersectionObserver(u,{root:r,rootMargin:i,threshold:typeof n=="number"?n:nT[n]});return s.forEach(l=>h.observe(l)),()=>h.disconnect()}function K1(t,e,r){t.dispatchEvent(new CustomEvent(e,{detail:{originalEvent:r}}))}function gy(t,e,r){t.dispatchEvent(new CustomEvent(e,{detail:{originalEntry:r}}))}const oT={isActive:t=>!!t.inView,subscribe:(t,{enable:e,disable:r},{inViewOptions:i={}})=>{const{once:n}=i,s=iT(i,["once"]);return sT(t,a=>{if(e(),gy(t,"viewenter",a),!n)return u=>{r(),gy(t,"viewleave",u)}},s)}},vy=(t,e,r)=>i=>{i.pointerType&&i.pointerType!=="mouse"||(r(),K1(t,e,i))};[...Object.keys({inView:oT,hover:{isActive:t=>!!t.hover,subscribe:(t,{enable:e,disable:r})=>{const i=vy(t,"hoverstart",e),n=vy(t,"hoverend",r);return t.addEventListener("pointerenter",i),t.addEventListener("pointerleave",n),()=>{t.removeEventListener("pointerenter",i),t.removeEventListener("pointerleave",n)}}},press:{isActive:t=>!!t.press,subscribe:(t,{enable:e,disable:r})=>{const i=s=>{r(),K1(t,"pressend",s),window.removeEventListener("pointerup",i)},n=s=>{e(),K1(t,"pressstart",s),window.addEventListener("pointerup",i)};return t.addEventListener("pointerdown",n),()=>{t.removeEventListener("pointerdown",n),window.removeEventListener("pointerup",i)}}}})];function aT(t,e={}){return py([()=>{const r=new sy(t,[0,1],e);return r.finished.catch(()=>{}),r}],e,e.duration)}function la(t,e,r){return(ha(t)?aT:rT)(t,e,r)}/**
111
+ */const Fs=mN(class extends bN{constructor(t){var e;if(super(t),t.type!==vN.ATTRIBUTE||t.name!=="class"||((e=t.strings)===null||e===void 0?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter(e=>t[e]).join(" ")+" "}update(t,[e]){var r,i;if(this.it===void 0){this.it=new Set,t.strings!==void 0&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter(s=>s!=="")));for(const s in e)e[s]&&!(!((r=this.nt)===null||r===void 0)&&r.has(s))&&this.it.add(s);return this.render(e)}const n=t.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 ua}});function yN(t,e){t.indexOf(e)===-1&&t.push(e)}const Z6=(t,e,r)=>Math.min(Math.max(r,t),e),on={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},Yh=t=>typeof t=="number",yc=t=>Array.isArray(t)&&!Yh(t[0]),wN=(t,e,r)=>{const i=e-t;return((r-t)%i+i)%i+t};function _N(t,e){return yc(t)?t[wN(0,t.length,e)]:t}const X6=(t,e,r)=>-r*t+r*e+t,ey=()=>{},vo=t=>t,L1=(t,e,r)=>e-t===0?1:(r-t)/(e-t);function ty(t,e){const r=t[t.length-1];for(let i=1;i<=e;i++){const n=L1(0,e,i);t.push(X6(r,1,n))}}function EN(t){const e=[0];return ty(e,t-1),e}function AN(t,e=EN(t.length),r=vo){const i=t.length,n=i-e.length;return n>0&&ty(e,n),s=>{let a=0;for(;a<i-2&&!(s<e[a+1]);a++);let u=Z6(0,1,L1(e[a],e[a+1],s));return u=_N(r,a)(u),X6(t[a],t[a+1],u)}}const ry=t=>Array.isArray(t)&&Yh(t[0]),B1=t=>typeof t=="object"&&!!t.createAnimation,ha=t=>typeof t=="function",xN=t=>typeof t=="string",Wu={ms:t=>t*1e3,s:t=>t/1e3},iy=(t,e,r)=>(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,SN=1e-7,IN=12;function MN(t,e,r,i,n){let s,a,u=0;do a=e+(r-e)/2,s=iy(a,i,n)-t,s>0?r=a:e=a;while(Math.abs(s)>SN&&++u<IN);return a}function Vu(t,e,r,i){if(t===e&&r===i)return vo;const n=s=>MN(s,0,1,t,r);return s=>s===0||s===1?s:iy(n(s),e,i)}const CN=(t,e="end")=>r=>{r=e==="end"?Math.min(r,.999):Math.max(r,.001);const i=r*t,n=e==="end"?Math.floor(i):Math.ceil(i);return Z6(0,1,n/t)},ny={ease:Vu(.25,.1,.25,1),"ease-in":Vu(.42,0,1,1),"ease-in-out":Vu(.42,0,.58,1),"ease-out":Vu(0,0,.58,1)},DN=/\((.*?)\)/;function sy(t){if(ha(t))return t;if(ry(t))return Vu(...t);if(ny[t])return ny[t];if(t.startsWith("steps")){const e=DN.exec(t);if(e){const r=e[1].split(",");return CN(parseFloat(r[0]),r[1].trim())}}return vo}class oy{constructor(e,r=[0,1],{easing:i,duration:n=on.duration,delay:s=on.delay,endDelay:a=on.endDelay,repeat:u=on.repeat,offset:h,direction:l="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=vo,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise((w,I)=>{this.resolve=w,this.reject=I}),i=i||on.easing,B1(i)){const w=i.createAnimation(r);i=w.easing,r=w.keyframes||r,n=w.duration||n}this.repeat=u,this.easing=yc(i)?vo:sy(i),this.updateDuration(n);const b=AN(r,h,yc(i)?i.map(sy):vo);this.tick=w=>{var I;s=s;let S=0;this.pauseTime!==void 0?S=this.pauseTime:S=(w-this.startTime)*this.rate,this.t=S,S/=1e3,S=Math.max(S-s,0),this.playState==="finished"&&this.pauseTime===void 0&&(S=this.totalDuration);const D=S/this.duration;let T=Math.floor(D),q=D%1;!q&&D>=1&&(q=1),q===1&&T--;const K=T%2;(l==="reverse"||l==="alternate"&&K||l==="alternate-reverse"&&!K)&&(q=1-q);const F=S>=this.totalDuration?1:Math.min(q,1),W=b(this.easing(F));e(W),this.pauseTime===void 0&&(this.playState==="finished"||S>=this.totalDuration+a)?(this.playState="finished",(I=this.resolve)===null||I===void 0||I.call(this,W)):this.playState!=="idle"&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){const e=performance.now();this.playState="running",this.pauseTime!==void 0?this.startTime=e-this.pauseTime:this.startTime||(this.startTime=e),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var e;this.playState="idle",this.frameRequestId!==void 0&&cancelAnimationFrame(this.frameRequestId),(e=this.reject)===null||e===void 0||e.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(e){this.duration=e,this.totalDuration=e*(this.repeat+1)}get currentTime(){return this.t}set currentTime(e){this.pauseTime!==void 0||this.rate===0?this.pauseTime=e:this.startTime=performance.now()-e/this.rate}get playbackRate(){return this.rate}set playbackRate(e){this.rate=e}}var F1=function(){};process.env.NODE_ENV!=="production"&&(F1=function(t,e){if(!t)throw new Error(e)});class ON{setAnimation(e){this.animation=e,e?.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}const U1=new WeakMap;function ay(t){return U1.has(t)||U1.set(t,{transforms:[],values:new Map}),U1.get(t)}function PN(t,e){return t.has(e)||t.set(e,new ON),t.get(e)}const $N=["","X","Y","Z"],RN=["translate","scale","rotate","skew"],Qh={x:"translateX",y:"translateY",z:"translateZ"},cy={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},NN={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:cy,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:vo},skew:cy},Gu=new Map,k1=t=>`--motion-${t}`,Zh=["x","y","z"];RN.forEach(t=>{$N.forEach(e=>{Zh.push(t+e),Gu.set(k1(t+e),NN[t])})});const TN=(t,e)=>Zh.indexOf(t)-Zh.indexOf(e),LN=new Set(Zh),uy=t=>LN.has(t),BN=(t,e)=>{Qh[e]&&(e=Qh[e]);const{transforms:r}=ay(t);yN(r,e),t.style.transform=FN(r)},FN=t=>t.sort(TN).reduce(UN,"").trim(),UN=(t,e)=>`${t} ${e}(var(${k1(e)}))`,q1=t=>t.startsWith("--"),fy=new Set;function kN(t){if(!fy.has(t)){fy.add(t);try{const{syntax:e,initialValue:r}=Gu.has(t)?Gu.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:r})}catch{}}}const j1=(t,e)=>document.createElement("div").animate(t,e),hy={cssRegisterProperty:()=>typeof CSS<"u"&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{j1({opacity:[1]})}catch{return!1}return!0},finished:()=>!!j1({opacity:[0,1]},{duration:.001}).finished,linearEasing:()=>{try{j1({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0}},z1={},wc={};for(const t in hy)wc[t]=()=>(z1[t]===void 0&&(z1[t]=hy[t]()),z1[t]);const qN=.015,jN=(t,e)=>{let r="";const i=Math.round(e/qN);for(let n=0;n<i;n++)r+=t(L1(0,i-1,n))+", ";return r.substring(0,r.length-2)},ly=(t,e)=>ha(t)?wc.linearEasing()?`linear(${jN(t,e)})`:on.easing:ry(t)?zN(t):t,zN=([t,e,r,i])=>`cubic-bezier(${t}, ${e}, ${r}, ${i})`;function HN(t,e){for(let r=0;r<t.length;r++)t[r]===null&&(t[r]=r?t[r-1]:e());return t}const KN=t=>Array.isArray(t)?t:[t];function H1(t){return Qh[t]&&(t=Qh[t]),uy(t)?k1(t):t}const Xh={get:(t,e)=>{e=H1(e);let r=q1(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!r&&r!==0){const i=Gu.get(e);i&&(r=i.initialValue)}return r},set:(t,e,r)=>{e=H1(e),q1(e)?t.style.setProperty(e,r):t.style[e]=r}};function dy(t,e=!0){if(!(!t||t.playState==="finished"))try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch{}}function WN(t,e){var r;let i=e?.toDefaultUnit||vo;const n=t[t.length-1];if(xN(n)){const s=((r=n.match(/(-?[\d.]+)([a-z%]*)/))===null||r===void 0?void 0:r[2])||"";s&&(i=a=>a+s)}return i}function VN(){return window.__MOTION_DEV_TOOLS_RECORD}function GN(t,e,r,i={},n){const s=VN(),a=i.record!==!1&&s;let u,{duration:h=on.duration,delay:l=on.delay,endDelay:b=on.endDelay,repeat:w=on.repeat,easing:I=on.easing,persist:S=!1,direction:D,offset:T,allowWebkitAcceleration:q=!1}=i;const K=ay(t),F=uy(e);let W=wc.waapi();F&&BN(t,e);const R=H1(e),k=PN(K.values,R),H=Gu.get(R);return dy(k.animation,!(B1(I)&&k.generator)&&i.record!==!1),()=>{const _=()=>{var ie,L;return(L=(ie=Xh.get(t,R))!==null&&ie!==void 0?ie:H?.initialValue)!==null&&L!==void 0?L:0};let B=HN(KN(r),_);const ee=WN(B,H);if(B1(I)){const ie=I.createAnimation(B,e!=="opacity",_,R,k);I=ie.easing,B=ie.keyframes||B,h=ie.duration||h}if(q1(R)&&(wc.cssRegisterProperty()?kN(R):W=!1),F&&!wc.linearEasing()&&(ha(I)||yc(I)&&I.some(ha))&&(W=!1),W){H&&(B=B.map(y=>Yh(y)?H.toDefaultUnit(y):y)),B.length===1&&(!wc.partialKeyframes()||a)&&B.unshift(_());const ie={delay:Wu.ms(l),duration:Wu.ms(h),endDelay:Wu.ms(b),easing:yc(I)?void 0:ly(I,h),direction:D,iterations:w+1,fill:"both"};u=t.animate({[R]:B,offset:T,easing:yc(I)?I.map(y=>ly(y,h)):void 0},ie),u.finished||(u.finished=new Promise((y,f)=>{u.onfinish=y,u.oncancel=f}));const L=B[B.length-1];u.finished.then(()=>{S||(Xh.set(t,R,L),u.cancel())}).catch(ey),q||(u.playbackRate=1.000001)}else if(n&&F)B=B.map(ie=>typeof ie=="string"?parseFloat(ie):ie),B.length===1&&B.unshift(parseFloat(_())),u=new n(ie=>{Xh.set(t,R,ee?ee(ie):ie)},B,Object.assign(Object.assign({},i),{duration:h,easing:I}));else{const ie=B[B.length-1];Xh.set(t,R,H&&Yh(ie)?H.toDefaultUnit(ie):ie)}return a&&s(t,e,B,{duration:h,delay:l,easing:I,repeat:w,offset:T},"motion-one"),k.setAnimation(u),u}}const JN=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function py(t,e){var r;return typeof t=="string"?e?((r=e[t])!==null&&r!==void 0||(e[t]=document.querySelectorAll(t)),t=e[t]):t=document.querySelectorAll(t):t instanceof Element&&(t=[t]),Array.from(t||[])}const YN=t=>t(),gy=(t,e,r=on.duration)=>new Proxy({animations:t.map(YN).filter(Boolean),duration:r,options:e},ZN),QN=t=>t.animations[0],ZN={get:(t,e)=>{const r=QN(t);switch(e){case"duration":return t.duration;case"currentTime":return Wu.s(r?.[e]||0);case"playbackRate":case"playState":return r?.[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(XN)).catch(ey)),t.finished;case"stop":return()=>{t.animations.forEach(i=>dy(i))};case"forEachNative":return i=>{t.animations.forEach(n=>i(n,t))};default:return typeof r?.[e]>"u"?void 0:()=>t.animations.forEach(i=>i[e]())}},set:(t,e,r)=>{switch(e){case"currentTime":r=Wu.ms(r);case"playbackRate":for(let i=0;i<t.animations.length;i++)t.animations[i][e]=r;return!0}return!1}},XN=t=>t.finished;function eT(t,e,r){return ha(t)?t(e,r):t}function tT(t){return function(r,i,n={}){r=py(r);const s=r.length;F1(!!s,"No valid element provided."),F1(!!i,"No keyframes defined.");const a=[];for(let u=0;u<s;u++){const h=r[u];for(const l in i){const b=JN(n,l);b.delay=eT(b.delay,u,s);const w=GN(h,l,i[l],b,t);a.push(w)}}return gy(a,n,n.duration)}}const rT=tT(oy);function iT(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r}typeof SuppressedError=="function"&&SuppressedError;const nT={any:0,all:1};function sT(t,e,{root:r,margin:i,amount:n="any"}={}){if(typeof IntersectionObserver>"u")return()=>{};const s=py(t),a=new WeakMap,u=l=>{l.forEach(b=>{const w=a.get(b.target);if(b.isIntersecting!==!!w)if(b.isIntersecting){const I=e(b);ha(I)?a.set(b.target,I):h.unobserve(b.target)}else w&&(w(b),a.delete(b.target))})},h=new IntersectionObserver(u,{root:r,rootMargin:i,threshold:typeof n=="number"?n:nT[n]});return s.forEach(l=>h.observe(l)),()=>h.disconnect()}function K1(t,e,r){t.dispatchEvent(new CustomEvent(e,{detail:{originalEvent:r}}))}function vy(t,e,r){t.dispatchEvent(new CustomEvent(e,{detail:{originalEntry:r}}))}const oT={isActive:t=>!!t.inView,subscribe:(t,{enable:e,disable:r},{inViewOptions:i={}})=>{const{once:n}=i,s=iT(i,["once"]);return sT(t,a=>{if(e(),vy(t,"viewenter",a),!n)return u=>{r(),vy(t,"viewleave",u)}},s)}},my=(t,e,r)=>i=>{i.pointerType&&i.pointerType!=="mouse"||(r(),K1(t,e,i))};[...Object.keys({inView:oT,hover:{isActive:t=>!!t.hover,subscribe:(t,{enable:e,disable:r})=>{const i=my(t,"hoverstart",e),n=my(t,"hoverend",r);return t.addEventListener("pointerenter",i),t.addEventListener("pointerleave",n),()=>{t.removeEventListener("pointerenter",i),t.removeEventListener("pointerleave",n)}}},press:{isActive:t=>!!t.press,subscribe:(t,{enable:e,disable:r})=>{const i=s=>{r(),K1(t,"pressend",s),window.removeEventListener("pointerup",i)},n=s=>{e(),K1(t,"pressstart",s),window.addEventListener("pointerup",i)};return t.addEventListener("pointerdown",n),()=>{t.removeEventListener("pointerdown",n),window.removeEventListener("pointerup",i)}}}})];function aT(t,e={}){return gy([()=>{const r=new oy(t,[0,1],e);return r.finished.catch(()=>{}),r}],e,e.duration)}function la(t,e,r){return(ha(t)?aT:rT)(t,e,r)}/**
112
112
  * @license
113
113
  * Copyright 2018 Google LLC
114
114
  * SPDX-License-Identifier: BSD-3-Clause
115
- */const li=t=>t??Mr;var Ju={},cT=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},my={},qi={};let W1;const uT=[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];qi.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},qi.getSymbolTotalCodewords=function(e){return uT[e]},qi.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e},qi.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');W1=e},qi.isKanjiModeEnabled=function(){return typeof W1<"u"},qi.toSJIS=function(e){return W1(e)};var el={};(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function e(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+r)}}t.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},t.from=function(i,n){if(t.isValid(i))return i;try{return e(i)}catch{return n}}})(el);function by(){this.buffer=[],this.length=0}by.prototype={get:function(t){const e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let r=0;r<e;r++)this.putBit((t>>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var fT=by;function Yu(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}Yu.prototype.set=function(t,e,r,i){const n=t*this.size+e;this.data[n]=r,i&&(this.reservedBit[n]=!0)},Yu.prototype.get=function(t,e){return this.data[t*this.size+e]},Yu.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r},Yu.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var hT=Yu,yy={};(function(t){const e=qi.getSymbolSize;t.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,u=[s-7];for(let h=1;h<n-1;h++)u[h]=u[h-1]-a;return u.push(6),u.reverse()},t.getPositions=function(i){const n=[],s=t.getRowColCoords(i),a=s.length;for(let u=0;u<a;u++)for(let h=0;h<a;h++)u===0&&h===0||u===0&&h===a-1||u===a-1&&h===0||n.push([s[u],s[h]]);return n}})(yy);var wy={};const lT=qi.getSymbolSize,_y=7;wy.getPositions=function(e){const r=lT(e);return[[0,0],[r-_y,0],[0,r-_y]]};var Ey={};(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const e={N1:3,N2:3,N3:40,N4:10};t.isValid=function(n){return n!=null&&n!==""&&!isNaN(n)&&n>=0&&n<=7},t.from=function(n){return t.isValid(n)?parseInt(n,10):void 0},t.getPenaltyN1=function(n){const s=n.size;let a=0,u=0,h=0,l=null,b=null;for(let w=0;w<s;w++){u=h=0,l=b=null;for(let I=0;I<s;I++){let S=n.get(w,I);S===l?u++:(u>=5&&(a+=e.N1+(u-5)),l=S,u=1),S=n.get(I,w),S===b?h++:(h>=5&&(a+=e.N1+(h-5)),b=S,h=1)}u>=5&&(a+=e.N1+(u-5)),h>=5&&(a+=e.N1+(h-5))}return a},t.getPenaltyN2=function(n){const s=n.size;let a=0;for(let u=0;u<s-1;u++)for(let h=0;h<s-1;h++){const l=n.get(u,h)+n.get(u,h+1)+n.get(u+1,h)+n.get(u+1,h+1);(l===4||l===0)&&a++}return a*e.N2},t.getPenaltyN3=function(n){const s=n.size;let a=0,u=0,h=0;for(let l=0;l<s;l++){u=h=0;for(let b=0;b<s;b++)u=u<<1&2047|n.get(l,b),b>=10&&(u===1488||u===93)&&a++,h=h<<1&2047|n.get(b,l),b>=10&&(h===1488||h===93)&&a++}return a*e.N3},t.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 r(i,n,s){switch(i){case t.Patterns.PATTERN000:return(n+s)%2===0;case t.Patterns.PATTERN001:return n%2===0;case t.Patterns.PATTERN010:return s%3===0;case t.Patterns.PATTERN011:return(n+s)%3===0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(s/3))%2===0;case t.Patterns.PATTERN101:return n*s%2+n*s%3===0;case t.Patterns.PATTERN110:return(n*s%2+n*s%3)%2===0;case t.Patterns.PATTERN111:return(n*s%3+(n+s)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}t.applyMask=function(n,s){const a=s.size;for(let u=0;u<a;u++)for(let h=0;h<a;h++)s.isReserved(h,u)||s.xor(h,u,r(n,h,u))},t.getBestMask=function(n,s){const a=Object.keys(t.Patterns).length;let u=0,h=1/0;for(let l=0;l<a;l++){s(l),t.applyMask(l,n);const b=t.getPenaltyN1(n)+t.getPenaltyN2(n)+t.getPenaltyN3(n)+t.getPenaltyN4(n);t.applyMask(l,n),b<h&&(h=b,u=l)}return u}})(Ey);var tl={};const mo=el,rl=[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],il=[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];tl.getBlocksCount=function(e,r){switch(r){case mo.L:return rl[(e-1)*4+0];case mo.M:return rl[(e-1)*4+1];case mo.Q:return rl[(e-1)*4+2];case mo.H:return rl[(e-1)*4+3];default:return}},tl.getTotalCodewordsCount=function(e,r){switch(r){case mo.L:return il[(e-1)*4+0];case mo.M:return il[(e-1)*4+1];case mo.Q:return il[(e-1)*4+2];case mo.H:return il[(e-1)*4+3];default:return}};var Ay={},nl={};const Qu=new Uint8Array(512),sl=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)Qu[r]=e,sl[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)Qu[r]=Qu[r-255]})(),nl.log=function(e){if(e<1)throw new Error("log("+e+")");return sl[e]},nl.exp=function(e){return Qu[e]},nl.mul=function(e,r){return e===0||r===0?0:Qu[sl[e]+sl[r]]},function(t){const e=nl;t.mul=function(i,n){const s=new Uint8Array(i.length+n.length-1);for(let a=0;a<i.length;a++)for(let u=0;u<n.length;u++)s[a+u]^=e.mul(i[a],n[u]);return s},t.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 u=0;for(;u<s.length&&s[u]===0;)u++;s=s.slice(u)}return s},t.generateECPolynomial=function(i){let n=new Uint8Array([1]);for(let s=0;s<i;s++)n=t.mul(n,new Uint8Array([1,e.exp(s)]));return n}}(Ay);const xy=Ay;function V1(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}V1.prototype.initialize=function(e){this.degree=e,this.genPoly=xy.generateECPolynomial(this.degree)},V1.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const r=new Uint8Array(e.length+this.degree);r.set(e);const i=xy.mod(r,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 dT=V1,Sy={},bo={},G1={};G1.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40};var bs={};const Iy="[0-9]+",pT="[A-Z $%*+\\-./:]+";let Zu="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Zu=Zu.replace(/u/g,"\\u");const gT="(?:(?![A-Z0-9 $%*+\\-./:]|"+Zu+`)(?:.|[\r
116
- ]))+`;bs.KANJI=new RegExp(Zu,"g"),bs.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),bs.BYTE=new RegExp(gT,"g"),bs.NUMERIC=new RegExp(Iy,"g"),bs.ALPHANUMERIC=new RegExp(pT,"g");const vT=new RegExp("^"+Zu+"$"),mT=new RegExp("^"+Iy+"$"),bT=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");bs.testKanji=function(e){return vT.test(e)},bs.testNumeric=function(e){return mT.test(e)},bs.testAlphanumeric=function(e){return bT.test(e)},function(t){const e=G1,r=bs;t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(s,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]},t.getBestModeForData=function(s){return r.testNumeric(s)?t.NUMERIC:r.testAlphanumeric(s)?t.ALPHANUMERIC:r.testKanji(s)?t.KANJI:t.BYTE},t.toString=function(s){if(s&&s.id)return s.id;throw new Error("Invalid mode")},t.isValid=function(s){return s&&s.bit&&s.ccBits};function i(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+n)}}t.from=function(s,a){if(t.isValid(s))return s;try{return i(s)}catch{return a}}}(bo),function(t){const e=qi,r=tl,i=el,n=bo,s=G1,a=7973,u=e.getBCHDigit(a);function h(I,S,D){for(let T=1;T<=40;T++)if(S<=t.getCapacity(T,D,I))return T}function l(I,S){return n.getCharCountIndicator(I,S)+4}function b(I,S){let D=0;return I.forEach(function(T){const q=l(T.mode,S);D+=q+T.getBitsLength()}),D}function w(I,S){for(let D=1;D<=40;D++)if(b(I,D)<=t.getCapacity(D,S,n.MIXED))return D}t.from=function(S,D){return s.isValid(S)?parseInt(S,10):D},t.getCapacity=function(S,D,T){if(!s.isValid(S))throw new Error("Invalid QR Code version");typeof T>"u"&&(T=n.BYTE);const q=e.getSymbolTotalCodewords(S),K=r.getTotalCodewordsCount(S,D),F=(q-K)*8;if(T===n.MIXED)return F;const W=F-l(T,S);switch(T){case n.NUMERIC:return Math.floor(W/10*3);case n.ALPHANUMERIC:return Math.floor(W/11*2);case n.KANJI:return Math.floor(W/13);case n.BYTE:default:return Math.floor(W/8)}},t.getBestVersionForData=function(S,D){let T;const q=i.from(D,i.M);if(Array.isArray(S)){if(S.length>1)return w(S,q);if(S.length===0)return 1;T=S[0]}else T=S;return h(T.mode,T.getLength(),q)},t.getEncodedBits=function(S){if(!s.isValid(S)||S<7)throw new Error("Invalid QR Code version");let D=S<<12;for(;e.getBCHDigit(D)-u>=0;)D^=a<<e.getBCHDigit(D)-u;return S<<12|D}}(Sy);var My={};const J1=qi,Cy=1335,yT=21522,Dy=J1.getBCHDigit(Cy);My.getEncodedBits=function(e,r){const i=e.bit<<3|r;let n=i<<10;for(;J1.getBCHDigit(n)-Dy>=0;)n^=Cy<<J1.getBCHDigit(n)-Dy;return(i<<10|n)^yT};var Oy={};const wT=bo;function _c(t){this.mode=wT.NUMERIC,this.data=t.toString()}_c.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},_c.prototype.getLength=function(){return this.data.length},_c.prototype.getBitsLength=function(){return _c.getBitsLength(this.data.length)},_c.prototype.write=function(e){let r,i,n;for(r=0;r+3<=this.data.length;r+=3)i=this.data.substr(r,3),n=parseInt(i,10),e.put(n,10);const s=this.data.length-r;s>0&&(i=this.data.substr(r),n=parseInt(i,10),e.put(n,s*3+1))};var _T=_c;const ET=bo,Y1=["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 Ec(t){this.mode=ET.ALPHANUMERIC,this.data=t}Ec.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)},Ec.prototype.getLength=function(){return this.data.length},Ec.prototype.getBitsLength=function(){return Ec.getBitsLength(this.data.length)},Ec.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let i=Y1.indexOf(this.data[r])*45;i+=Y1.indexOf(this.data[r+1]),e.put(i,11)}this.data.length%2&&e.put(Y1.indexOf(this.data[r]),6)};var AT=Ec,xT=function(e){for(var r=[],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){r.push(s);continue}if(s<2048){r.push(s>>6|192),r.push(s&63|128);continue}if(s<55296||s>=57344&&s<65536){r.push(s>>12|224),r.push(s>>6&63|128),r.push(s&63|128);continue}if(s>=65536&&s<=1114111){r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128);continue}r.push(239,191,189)}return new Uint8Array(r).buffer};const ST=xT,IT=bo;function Ac(t){this.mode=IT.BYTE,typeof t=="string"&&(t=ST(t)),this.data=new Uint8Array(t)}Ac.getBitsLength=function(e){return e*8},Ac.prototype.getLength=function(){return this.data.length},Ac.prototype.getBitsLength=function(){return Ac.getBitsLength(this.data.length)},Ac.prototype.write=function(t){for(let e=0,r=this.data.length;e<r;e++)t.put(this.data[e],8)};var MT=Ac;const CT=bo,DT=qi;function xc(t){this.mode=CT.KANJI,this.data=t}xc.getBitsLength=function(e){return e*13},xc.prototype.getLength=function(){return this.data.length},xc.prototype.getBitsLength=function(){return xc.getBitsLength(this.data.length)},xc.prototype.write=function(t){let e;for(e=0;e<this.data.length;e++){let r=DT.toSJIS(this.data[e]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
117
- Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),t.put(r,13)}};var OT=xc,Py={exports:{}};(function(t){var e={single_source_shortest_paths:function(r,i,n){var s={},a={};a[i]=0;var u=e.PriorityQueue.make();u.push(i,0);for(var h,l,b,w,I,S,D,T,q;!u.empty();){h=u.pop(),l=h.value,w=h.cost,I=r[l]||{};for(b in I)I.hasOwnProperty(b)&&(S=I[b],D=w+S,T=a[b],q=typeof a[b]>"u",(q||T>D)&&(a[b]=D,u.push(b,D),s[b]=l))}if(typeof n<"u"&&typeof a[n]>"u"){var K=["Could not find a path from ",i," to ",n,"."].join("");throw new Error(K)}return s},extract_shortest_path_from_predecessor_list:function(r,i){for(var n=[],s=i;s;)n.push(s),r[s],s=r[s];return n.reverse(),n},find_path:function(r,i,n){var s=e.single_source_shortest_paths(r,i,n);return e.extract_shortest_path_from_predecessor_list(s,n)},PriorityQueue:{make:function(r){var i=e.PriorityQueue,n={},s;r=r||{};for(s in i)i.hasOwnProperty(s)&&(n[s]=i[s]);return n.queue=[],n.sorter=r.sorter||i.default_sorter,n},default_sorter:function(r,i){return r.cost-i.cost},push:function(r,i){var n={value:r,cost:i};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t.exports=e})(Py),function(t){const e=bo,r=_T,i=AT,n=MT,s=OT,a=bs,u=qi,h=Py.exports;function l(K){return unescape(encodeURIComponent(K)).length}function b(K,F,W){const R=[];let k;for(;(k=K.exec(W))!==null;)R.push({data:k[0],index:k.index,mode:F,length:k[0].length});return R}function w(K){const F=b(a.NUMERIC,e.NUMERIC,K),W=b(a.ALPHANUMERIC,e.ALPHANUMERIC,K);let R,k;return u.isKanjiModeEnabled()?(R=b(a.BYTE,e.BYTE,K),k=b(a.KANJI,e.KANJI,K)):(R=b(a.BYTE_KANJI,e.BYTE,K),k=[]),F.concat(W,R,k).sort(function(_,B){return _.index-B.index}).map(function(_){return{data:_.data,mode:_.mode,length:_.length}})}function I(K,F){switch(F){case e.NUMERIC:return r.getBitsLength(K);case e.ALPHANUMERIC:return i.getBitsLength(K);case e.KANJI:return s.getBitsLength(K);case e.BYTE:return n.getBitsLength(K)}}function S(K){return K.reduce(function(F,W){const R=F.length-1>=0?F[F.length-1]:null;return R&&R.mode===W.mode?(F[F.length-1].data+=W.data,F):(F.push(W),F)},[])}function D(K){const F=[];for(let W=0;W<K.length;W++){const R=K[W];switch(R.mode){case e.NUMERIC:F.push([R,{data:R.data,mode:e.ALPHANUMERIC,length:R.length},{data:R.data,mode:e.BYTE,length:R.length}]);break;case e.ALPHANUMERIC:F.push([R,{data:R.data,mode:e.BYTE,length:R.length}]);break;case e.KANJI:F.push([R,{data:R.data,mode:e.BYTE,length:l(R.data)}]);break;case e.BYTE:F.push([{data:R.data,mode:e.BYTE,length:l(R.data)}])}}return F}function T(K,F){const W={},R={start:{}};let k=["start"];for(let H=0;H<K.length;H++){const _=K[H],B=[];for(let ee=0;ee<_.length;ee++){const ie=_[ee],L=""+H+ee;B.push(L),W[L]={node:ie,lastCount:0},R[L]={};for(let y=0;y<k.length;y++){const f=k[y];W[f]&&W[f].node.mode===ie.mode?(R[f][L]=I(W[f].lastCount+ie.length,ie.mode)-I(W[f].lastCount,ie.mode),W[f].lastCount+=ie.length):(W[f]&&(W[f].lastCount=ie.length),R[f][L]=I(ie.length,ie.mode)+4+e.getCharCountIndicator(ie.mode,F))}}k=B}for(let H=0;H<k.length;H++)R[k[H]].end=0;return{map:R,table:W}}function q(K,F){let W;const R=e.getBestModeForData(K);if(W=e.from(F,R),W!==e.BYTE&&W.bit<R.bit)throw new Error('"'+K+'" cannot be encoded with mode '+e.toString(W)+`.
118
- Suggested mode is: `+e.toString(R));switch(W===e.KANJI&&!u.isKanjiModeEnabled()&&(W=e.BYTE),W){case e.NUMERIC:return new r(K);case e.ALPHANUMERIC:return new i(K);case e.KANJI:return new s(K);case e.BYTE:return new n(K)}}t.fromArray=function(F){return F.reduce(function(W,R){return typeof R=="string"?W.push(q(R,null)):R.data&&W.push(q(R.data,R.mode)),W},[])},t.fromString=function(F,W){const R=w(F,u.isKanjiModeEnabled()),k=D(R),H=T(k,W),_=h.find_path(H.map,"start","end"),B=[];for(let ee=1;ee<_.length-1;ee++)B.push(H.table[_[ee]].node);return t.fromArray(S(B))},t.rawSplit=function(F){return t.fromArray(w(F,u.isKanjiModeEnabled()))}}(Oy);const ol=qi,Q1=el,PT=fT,$T=hT,RT=yy,NT=wy,Z1=Ey,X1=tl,TT=dT,al=Sy,LT=My,BT=bo,ep=Oy;function FT(t,e){const r=t.size,i=NT.getPositions(e);for(let n=0;n<i.length;n++){const s=i[n][0],a=i[n][1];for(let u=-1;u<=7;u++)if(!(s+u<=-1||r<=s+u))for(let h=-1;h<=7;h++)a+h<=-1||r<=a+h||(u>=0&&u<=6&&(h===0||h===6)||h>=0&&h<=6&&(u===0||u===6)||u>=2&&u<=4&&h>=2&&h<=4?t.set(s+u,a+h,!0,!0):t.set(s+u,a+h,!1,!0))}}function UT(t){const e=t.size;for(let r=8;r<e-8;r++){const i=r%2===0;t.set(r,6,i,!0),t.set(6,r,i,!0)}}function kT(t,e){const r=RT.getPositions(e);for(let i=0;i<r.length;i++){const n=r[i][0],s=r[i][1];for(let a=-2;a<=2;a++)for(let u=-2;u<=2;u++)a===-2||a===2||u===-2||u===2||a===0&&u===0?t.set(n+a,s+u,!0,!0):t.set(n+a,s+u,!1,!0)}}function qT(t,e){const r=t.size,i=al.getEncodedBits(e);let n,s,a;for(let u=0;u<18;u++)n=Math.floor(u/3),s=u%3+r-8-3,a=(i>>u&1)===1,t.set(n,s,a,!0),t.set(s,n,a,!0)}function tp(t,e,r){const i=t.size,n=LT.getEncodedBits(e,r);let s,a;for(s=0;s<15;s++)a=(n>>s&1)===1,s<6?t.set(s,8,a,!0):s<8?t.set(s+1,8,a,!0):t.set(i-15+s,8,a,!0),s<8?t.set(8,i-s-1,a,!0):s<9?t.set(8,15-s-1+1,a,!0):t.set(8,15-s-1,a,!0);t.set(i-8,8,1,!0)}function jT(t,e){const r=t.size;let i=-1,n=r-1,s=7,a=0;for(let u=r-1;u>0;u-=2)for(u===6&&u--;;){for(let h=0;h<2;h++)if(!t.isReserved(n,u-h)){let l=!1;a<e.length&&(l=(e[a]>>>s&1)===1),t.set(n,u-h,l),s--,s===-1&&(a++,s=7)}if(n+=i,n<0||r<=n){n-=i,i=-i;break}}}function zT(t,e,r){const i=new PT;r.forEach(function(h){i.put(h.mode.bit,4),i.put(h.getLength(),BT.getCharCountIndicator(h.mode,t)),h.write(i)});const n=ol.getSymbolTotalCodewords(t),s=X1.getTotalCodewordsCount(t,e),a=(n-s)*8;for(i.getLengthInBits()+4<=a&&i.put(0,4);i.getLengthInBits()%8!==0;)i.putBit(0);const u=(a-i.getLengthInBits())/8;for(let h=0;h<u;h++)i.put(h%2?17:236,8);return HT(i,t,e)}function HT(t,e,r){const i=ol.getSymbolTotalCodewords(e),n=X1.getTotalCodewordsCount(e,r),s=i-n,a=X1.getBlocksCount(e,r),u=i%a,h=a-u,l=Math.floor(i/a),b=Math.floor(s/a),w=b+1,I=l-b,S=new TT(I);let D=0;const T=new Array(a),q=new Array(a);let K=0;const F=new Uint8Array(t.buffer);for(let _=0;_<a;_++){const B=_<h?b:w;T[_]=F.slice(D,D+B),q[_]=S.encode(T[_]),D+=B,K=Math.max(K,B)}const W=new Uint8Array(i);let R=0,k,H;for(k=0;k<K;k++)for(H=0;H<a;H++)k<T[H].length&&(W[R++]=T[H][k]);for(k=0;k<I;k++)for(H=0;H<a;H++)W[R++]=q[H][k];return W}function KT(t,e,r,i){let n;if(Array.isArray(t))n=ep.fromArray(t);else if(typeof t=="string"){let l=e;if(!l){const b=ep.rawSplit(t);l=al.getBestVersionForData(b,r)}n=ep.fromString(t,l||40)}else throw new Error("Invalid data");const s=al.getBestVersionForData(n,r);if(!s)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=s;else if(e<s)throw new Error(`
115
+ */const li=t=>t??Mr;var Ju={},cT=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},by={},qi={};let W1;const uT=[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];qi.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},qi.getSymbolTotalCodewords=function(e){return uT[e]},qi.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e},qi.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');W1=e},qi.isKanjiModeEnabled=function(){return typeof W1<"u"},qi.toSJIS=function(e){return W1(e)};var el={};(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function e(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+r)}}t.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},t.from=function(i,n){if(t.isValid(i))return i;try{return e(i)}catch{return n}}})(el);function yy(){this.buffer=[],this.length=0}yy.prototype={get:function(t){const e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let r=0;r<e;r++)this.putBit((t>>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var fT=yy;function Yu(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}Yu.prototype.set=function(t,e,r,i){const n=t*this.size+e;this.data[n]=r,i&&(this.reservedBit[n]=!0)},Yu.prototype.get=function(t,e){return this.data[t*this.size+e]},Yu.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r},Yu.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var hT=Yu,wy={};(function(t){const e=qi.getSymbolSize;t.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,u=[s-7];for(let h=1;h<n-1;h++)u[h]=u[h-1]-a;return u.push(6),u.reverse()},t.getPositions=function(i){const n=[],s=t.getRowColCoords(i),a=s.length;for(let u=0;u<a;u++)for(let h=0;h<a;h++)u===0&&h===0||u===0&&h===a-1||u===a-1&&h===0||n.push([s[u],s[h]]);return n}})(wy);var _y={};const lT=qi.getSymbolSize,Ey=7;_y.getPositions=function(e){const r=lT(e);return[[0,0],[r-Ey,0],[0,r-Ey]]};var Ay={};(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const e={N1:3,N2:3,N3:40,N4:10};t.isValid=function(n){return n!=null&&n!==""&&!isNaN(n)&&n>=0&&n<=7},t.from=function(n){return t.isValid(n)?parseInt(n,10):void 0},t.getPenaltyN1=function(n){const s=n.size;let a=0,u=0,h=0,l=null,b=null;for(let w=0;w<s;w++){u=h=0,l=b=null;for(let I=0;I<s;I++){let S=n.get(w,I);S===l?u++:(u>=5&&(a+=e.N1+(u-5)),l=S,u=1),S=n.get(I,w),S===b?h++:(h>=5&&(a+=e.N1+(h-5)),b=S,h=1)}u>=5&&(a+=e.N1+(u-5)),h>=5&&(a+=e.N1+(h-5))}return a},t.getPenaltyN2=function(n){const s=n.size;let a=0;for(let u=0;u<s-1;u++)for(let h=0;h<s-1;h++){const l=n.get(u,h)+n.get(u,h+1)+n.get(u+1,h)+n.get(u+1,h+1);(l===4||l===0)&&a++}return a*e.N2},t.getPenaltyN3=function(n){const s=n.size;let a=0,u=0,h=0;for(let l=0;l<s;l++){u=h=0;for(let b=0;b<s;b++)u=u<<1&2047|n.get(l,b),b>=10&&(u===1488||u===93)&&a++,h=h<<1&2047|n.get(b,l),b>=10&&(h===1488||h===93)&&a++}return a*e.N3},t.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 r(i,n,s){switch(i){case t.Patterns.PATTERN000:return(n+s)%2===0;case t.Patterns.PATTERN001:return n%2===0;case t.Patterns.PATTERN010:return s%3===0;case t.Patterns.PATTERN011:return(n+s)%3===0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(s/3))%2===0;case t.Patterns.PATTERN101:return n*s%2+n*s%3===0;case t.Patterns.PATTERN110:return(n*s%2+n*s%3)%2===0;case t.Patterns.PATTERN111:return(n*s%3+(n+s)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}t.applyMask=function(n,s){const a=s.size;for(let u=0;u<a;u++)for(let h=0;h<a;h++)s.isReserved(h,u)||s.xor(h,u,r(n,h,u))},t.getBestMask=function(n,s){const a=Object.keys(t.Patterns).length;let u=0,h=1/0;for(let l=0;l<a;l++){s(l),t.applyMask(l,n);const b=t.getPenaltyN1(n)+t.getPenaltyN2(n)+t.getPenaltyN3(n)+t.getPenaltyN4(n);t.applyMask(l,n),b<h&&(h=b,u=l)}return u}})(Ay);var tl={};const mo=el,rl=[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],il=[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];tl.getBlocksCount=function(e,r){switch(r){case mo.L:return rl[(e-1)*4+0];case mo.M:return rl[(e-1)*4+1];case mo.Q:return rl[(e-1)*4+2];case mo.H:return rl[(e-1)*4+3];default:return}},tl.getTotalCodewordsCount=function(e,r){switch(r){case mo.L:return il[(e-1)*4+0];case mo.M:return il[(e-1)*4+1];case mo.Q:return il[(e-1)*4+2];case mo.H:return il[(e-1)*4+3];default:return}};var xy={},nl={};const Qu=new Uint8Array(512),sl=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)Qu[r]=e,sl[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)Qu[r]=Qu[r-255]})(),nl.log=function(e){if(e<1)throw new Error("log("+e+")");return sl[e]},nl.exp=function(e){return Qu[e]},nl.mul=function(e,r){return e===0||r===0?0:Qu[sl[e]+sl[r]]},function(t){const e=nl;t.mul=function(i,n){const s=new Uint8Array(i.length+n.length-1);for(let a=0;a<i.length;a++)for(let u=0;u<n.length;u++)s[a+u]^=e.mul(i[a],n[u]);return s},t.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 u=0;for(;u<s.length&&s[u]===0;)u++;s=s.slice(u)}return s},t.generateECPolynomial=function(i){let n=new Uint8Array([1]);for(let s=0;s<i;s++)n=t.mul(n,new Uint8Array([1,e.exp(s)]));return n}}(xy);const Sy=xy;function V1(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}V1.prototype.initialize=function(e){this.degree=e,this.genPoly=Sy.generateECPolynomial(this.degree)},V1.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const r=new Uint8Array(e.length+this.degree);r.set(e);const i=Sy.mod(r,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 dT=V1,Iy={},bo={},G1={};G1.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40};var bs={};const My="[0-9]+",pT="[A-Z $%*+\\-./:]+";let Zu="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Zu=Zu.replace(/u/g,"\\u");const gT="(?:(?![A-Z0-9 $%*+\\-./:]|"+Zu+`)(?:.|[\r
116
+ ]))+`;bs.KANJI=new RegExp(Zu,"g"),bs.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),bs.BYTE=new RegExp(gT,"g"),bs.NUMERIC=new RegExp(My,"g"),bs.ALPHANUMERIC=new RegExp(pT,"g");const vT=new RegExp("^"+Zu+"$"),mT=new RegExp("^"+My+"$"),bT=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");bs.testKanji=function(e){return vT.test(e)},bs.testNumeric=function(e){return mT.test(e)},bs.testAlphanumeric=function(e){return bT.test(e)},function(t){const e=G1,r=bs;t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(s,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]},t.getBestModeForData=function(s){return r.testNumeric(s)?t.NUMERIC:r.testAlphanumeric(s)?t.ALPHANUMERIC:r.testKanji(s)?t.KANJI:t.BYTE},t.toString=function(s){if(s&&s.id)return s.id;throw new Error("Invalid mode")},t.isValid=function(s){return s&&s.bit&&s.ccBits};function i(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+n)}}t.from=function(s,a){if(t.isValid(s))return s;try{return i(s)}catch{return a}}}(bo),function(t){const e=qi,r=tl,i=el,n=bo,s=G1,a=7973,u=e.getBCHDigit(a);function h(I,S,D){for(let T=1;T<=40;T++)if(S<=t.getCapacity(T,D,I))return T}function l(I,S){return n.getCharCountIndicator(I,S)+4}function b(I,S){let D=0;return I.forEach(function(T){const q=l(T.mode,S);D+=q+T.getBitsLength()}),D}function w(I,S){for(let D=1;D<=40;D++)if(b(I,D)<=t.getCapacity(D,S,n.MIXED))return D}t.from=function(S,D){return s.isValid(S)?parseInt(S,10):D},t.getCapacity=function(S,D,T){if(!s.isValid(S))throw new Error("Invalid QR Code version");typeof T>"u"&&(T=n.BYTE);const q=e.getSymbolTotalCodewords(S),K=r.getTotalCodewordsCount(S,D),F=(q-K)*8;if(T===n.MIXED)return F;const W=F-l(T,S);switch(T){case n.NUMERIC:return Math.floor(W/10*3);case n.ALPHANUMERIC:return Math.floor(W/11*2);case n.KANJI:return Math.floor(W/13);case n.BYTE:default:return Math.floor(W/8)}},t.getBestVersionForData=function(S,D){let T;const q=i.from(D,i.M);if(Array.isArray(S)){if(S.length>1)return w(S,q);if(S.length===0)return 1;T=S[0]}else T=S;return h(T.mode,T.getLength(),q)},t.getEncodedBits=function(S){if(!s.isValid(S)||S<7)throw new Error("Invalid QR Code version");let D=S<<12;for(;e.getBCHDigit(D)-u>=0;)D^=a<<e.getBCHDigit(D)-u;return S<<12|D}}(Iy);var Cy={};const J1=qi,Dy=1335,yT=21522,Oy=J1.getBCHDigit(Dy);Cy.getEncodedBits=function(e,r){const i=e.bit<<3|r;let n=i<<10;for(;J1.getBCHDigit(n)-Oy>=0;)n^=Dy<<J1.getBCHDigit(n)-Oy;return(i<<10|n)^yT};var Py={};const wT=bo;function _c(t){this.mode=wT.NUMERIC,this.data=t.toString()}_c.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},_c.prototype.getLength=function(){return this.data.length},_c.prototype.getBitsLength=function(){return _c.getBitsLength(this.data.length)},_c.prototype.write=function(e){let r,i,n;for(r=0;r+3<=this.data.length;r+=3)i=this.data.substr(r,3),n=parseInt(i,10),e.put(n,10);const s=this.data.length-r;s>0&&(i=this.data.substr(r),n=parseInt(i,10),e.put(n,s*3+1))};var _T=_c;const ET=bo,Y1=["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 Ec(t){this.mode=ET.ALPHANUMERIC,this.data=t}Ec.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)},Ec.prototype.getLength=function(){return this.data.length},Ec.prototype.getBitsLength=function(){return Ec.getBitsLength(this.data.length)},Ec.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let i=Y1.indexOf(this.data[r])*45;i+=Y1.indexOf(this.data[r+1]),e.put(i,11)}this.data.length%2&&e.put(Y1.indexOf(this.data[r]),6)};var AT=Ec,xT=function(e){for(var r=[],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){r.push(s);continue}if(s<2048){r.push(s>>6|192),r.push(s&63|128);continue}if(s<55296||s>=57344&&s<65536){r.push(s>>12|224),r.push(s>>6&63|128),r.push(s&63|128);continue}if(s>=65536&&s<=1114111){r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128);continue}r.push(239,191,189)}return new Uint8Array(r).buffer};const ST=xT,IT=bo;function Ac(t){this.mode=IT.BYTE,typeof t=="string"&&(t=ST(t)),this.data=new Uint8Array(t)}Ac.getBitsLength=function(e){return e*8},Ac.prototype.getLength=function(){return this.data.length},Ac.prototype.getBitsLength=function(){return Ac.getBitsLength(this.data.length)},Ac.prototype.write=function(t){for(let e=0,r=this.data.length;e<r;e++)t.put(this.data[e],8)};var MT=Ac;const CT=bo,DT=qi;function xc(t){this.mode=CT.KANJI,this.data=t}xc.getBitsLength=function(e){return e*13},xc.prototype.getLength=function(){return this.data.length},xc.prototype.getBitsLength=function(){return xc.getBitsLength(this.data.length)},xc.prototype.write=function(t){let e;for(e=0;e<this.data.length;e++){let r=DT.toSJIS(this.data[e]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
117
+ Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),t.put(r,13)}};var OT=xc,$y={exports:{}};(function(t){var e={single_source_shortest_paths:function(r,i,n){var s={},a={};a[i]=0;var u=e.PriorityQueue.make();u.push(i,0);for(var h,l,b,w,I,S,D,T,q;!u.empty();){h=u.pop(),l=h.value,w=h.cost,I=r[l]||{};for(b in I)I.hasOwnProperty(b)&&(S=I[b],D=w+S,T=a[b],q=typeof a[b]>"u",(q||T>D)&&(a[b]=D,u.push(b,D),s[b]=l))}if(typeof n<"u"&&typeof a[n]>"u"){var K=["Could not find a path from ",i," to ",n,"."].join("");throw new Error(K)}return s},extract_shortest_path_from_predecessor_list:function(r,i){for(var n=[],s=i;s;)n.push(s),r[s],s=r[s];return n.reverse(),n},find_path:function(r,i,n){var s=e.single_source_shortest_paths(r,i,n);return e.extract_shortest_path_from_predecessor_list(s,n)},PriorityQueue:{make:function(r){var i=e.PriorityQueue,n={},s;r=r||{};for(s in i)i.hasOwnProperty(s)&&(n[s]=i[s]);return n.queue=[],n.sorter=r.sorter||i.default_sorter,n},default_sorter:function(r,i){return r.cost-i.cost},push:function(r,i){var n={value:r,cost:i};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t.exports=e})($y),function(t){const e=bo,r=_T,i=AT,n=MT,s=OT,a=bs,u=qi,h=$y.exports;function l(K){return unescape(encodeURIComponent(K)).length}function b(K,F,W){const R=[];let k;for(;(k=K.exec(W))!==null;)R.push({data:k[0],index:k.index,mode:F,length:k[0].length});return R}function w(K){const F=b(a.NUMERIC,e.NUMERIC,K),W=b(a.ALPHANUMERIC,e.ALPHANUMERIC,K);let R,k;return u.isKanjiModeEnabled()?(R=b(a.BYTE,e.BYTE,K),k=b(a.KANJI,e.KANJI,K)):(R=b(a.BYTE_KANJI,e.BYTE,K),k=[]),F.concat(W,R,k).sort(function(_,B){return _.index-B.index}).map(function(_){return{data:_.data,mode:_.mode,length:_.length}})}function I(K,F){switch(F){case e.NUMERIC:return r.getBitsLength(K);case e.ALPHANUMERIC:return i.getBitsLength(K);case e.KANJI:return s.getBitsLength(K);case e.BYTE:return n.getBitsLength(K)}}function S(K){return K.reduce(function(F,W){const R=F.length-1>=0?F[F.length-1]:null;return R&&R.mode===W.mode?(F[F.length-1].data+=W.data,F):(F.push(W),F)},[])}function D(K){const F=[];for(let W=0;W<K.length;W++){const R=K[W];switch(R.mode){case e.NUMERIC:F.push([R,{data:R.data,mode:e.ALPHANUMERIC,length:R.length},{data:R.data,mode:e.BYTE,length:R.length}]);break;case e.ALPHANUMERIC:F.push([R,{data:R.data,mode:e.BYTE,length:R.length}]);break;case e.KANJI:F.push([R,{data:R.data,mode:e.BYTE,length:l(R.data)}]);break;case e.BYTE:F.push([{data:R.data,mode:e.BYTE,length:l(R.data)}])}}return F}function T(K,F){const W={},R={start:{}};let k=["start"];for(let H=0;H<K.length;H++){const _=K[H],B=[];for(let ee=0;ee<_.length;ee++){const ie=_[ee],L=""+H+ee;B.push(L),W[L]={node:ie,lastCount:0},R[L]={};for(let y=0;y<k.length;y++){const f=k[y];W[f]&&W[f].node.mode===ie.mode?(R[f][L]=I(W[f].lastCount+ie.length,ie.mode)-I(W[f].lastCount,ie.mode),W[f].lastCount+=ie.length):(W[f]&&(W[f].lastCount=ie.length),R[f][L]=I(ie.length,ie.mode)+4+e.getCharCountIndicator(ie.mode,F))}}k=B}for(let H=0;H<k.length;H++)R[k[H]].end=0;return{map:R,table:W}}function q(K,F){let W;const R=e.getBestModeForData(K);if(W=e.from(F,R),W!==e.BYTE&&W.bit<R.bit)throw new Error('"'+K+'" cannot be encoded with mode '+e.toString(W)+`.
118
+ Suggested mode is: `+e.toString(R));switch(W===e.KANJI&&!u.isKanjiModeEnabled()&&(W=e.BYTE),W){case e.NUMERIC:return new r(K);case e.ALPHANUMERIC:return new i(K);case e.KANJI:return new s(K);case e.BYTE:return new n(K)}}t.fromArray=function(F){return F.reduce(function(W,R){return typeof R=="string"?W.push(q(R,null)):R.data&&W.push(q(R.data,R.mode)),W},[])},t.fromString=function(F,W){const R=w(F,u.isKanjiModeEnabled()),k=D(R),H=T(k,W),_=h.find_path(H.map,"start","end"),B=[];for(let ee=1;ee<_.length-1;ee++)B.push(H.table[_[ee]].node);return t.fromArray(S(B))},t.rawSplit=function(F){return t.fromArray(w(F,u.isKanjiModeEnabled()))}}(Py);const ol=qi,Q1=el,PT=fT,$T=hT,RT=wy,NT=_y,Z1=Ay,X1=tl,TT=dT,al=Iy,LT=Cy,BT=bo,ep=Py;function FT(t,e){const r=t.size,i=NT.getPositions(e);for(let n=0;n<i.length;n++){const s=i[n][0],a=i[n][1];for(let u=-1;u<=7;u++)if(!(s+u<=-1||r<=s+u))for(let h=-1;h<=7;h++)a+h<=-1||r<=a+h||(u>=0&&u<=6&&(h===0||h===6)||h>=0&&h<=6&&(u===0||u===6)||u>=2&&u<=4&&h>=2&&h<=4?t.set(s+u,a+h,!0,!0):t.set(s+u,a+h,!1,!0))}}function UT(t){const e=t.size;for(let r=8;r<e-8;r++){const i=r%2===0;t.set(r,6,i,!0),t.set(6,r,i,!0)}}function kT(t,e){const r=RT.getPositions(e);for(let i=0;i<r.length;i++){const n=r[i][0],s=r[i][1];for(let a=-2;a<=2;a++)for(let u=-2;u<=2;u++)a===-2||a===2||u===-2||u===2||a===0&&u===0?t.set(n+a,s+u,!0,!0):t.set(n+a,s+u,!1,!0)}}function qT(t,e){const r=t.size,i=al.getEncodedBits(e);let n,s,a;for(let u=0;u<18;u++)n=Math.floor(u/3),s=u%3+r-8-3,a=(i>>u&1)===1,t.set(n,s,a,!0),t.set(s,n,a,!0)}function tp(t,e,r){const i=t.size,n=LT.getEncodedBits(e,r);let s,a;for(s=0;s<15;s++)a=(n>>s&1)===1,s<6?t.set(s,8,a,!0):s<8?t.set(s+1,8,a,!0):t.set(i-15+s,8,a,!0),s<8?t.set(8,i-s-1,a,!0):s<9?t.set(8,15-s-1+1,a,!0):t.set(8,15-s-1,a,!0);t.set(i-8,8,1,!0)}function jT(t,e){const r=t.size;let i=-1,n=r-1,s=7,a=0;for(let u=r-1;u>0;u-=2)for(u===6&&u--;;){for(let h=0;h<2;h++)if(!t.isReserved(n,u-h)){let l=!1;a<e.length&&(l=(e[a]>>>s&1)===1),t.set(n,u-h,l),s--,s===-1&&(a++,s=7)}if(n+=i,n<0||r<=n){n-=i,i=-i;break}}}function zT(t,e,r){const i=new PT;r.forEach(function(h){i.put(h.mode.bit,4),i.put(h.getLength(),BT.getCharCountIndicator(h.mode,t)),h.write(i)});const n=ol.getSymbolTotalCodewords(t),s=X1.getTotalCodewordsCount(t,e),a=(n-s)*8;for(i.getLengthInBits()+4<=a&&i.put(0,4);i.getLengthInBits()%8!==0;)i.putBit(0);const u=(a-i.getLengthInBits())/8;for(let h=0;h<u;h++)i.put(h%2?17:236,8);return HT(i,t,e)}function HT(t,e,r){const i=ol.getSymbolTotalCodewords(e),n=X1.getTotalCodewordsCount(e,r),s=i-n,a=X1.getBlocksCount(e,r),u=i%a,h=a-u,l=Math.floor(i/a),b=Math.floor(s/a),w=b+1,I=l-b,S=new TT(I);let D=0;const T=new Array(a),q=new Array(a);let K=0;const F=new Uint8Array(t.buffer);for(let _=0;_<a;_++){const B=_<h?b:w;T[_]=F.slice(D,D+B),q[_]=S.encode(T[_]),D+=B,K=Math.max(K,B)}const W=new Uint8Array(i);let R=0,k,H;for(k=0;k<K;k++)for(H=0;H<a;H++)k<T[H].length&&(W[R++]=T[H][k]);for(k=0;k<I;k++)for(H=0;H<a;H++)W[R++]=q[H][k];return W}function KT(t,e,r,i){let n;if(Array.isArray(t))n=ep.fromArray(t);else if(typeof t=="string"){let l=e;if(!l){const b=ep.rawSplit(t);l=al.getBestVersionForData(b,r)}n=ep.fromString(t,l||40)}else throw new Error("Invalid data");const s=al.getBestVersionForData(n,r);if(!s)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=s;else if(e<s)throw new Error(`
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=zT(e,r,n),u=ol.getSymbolSize(e),h=new $T(u);return FT(h,e),UT(h),kT(h,e),tp(h,r,0),e>=7&&qT(h,e),jT(h,a),isNaN(i)&&(i=Z1.getBestMask(h,tp.bind(null,h,r))),Z1.applyMask(i,h),tp(h,r,i),{modules:h,version:e,errorCorrectionLevel:r,maskPattern:i,segments:n}}my.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let i=Q1.M,n,s;return typeof r<"u"&&(i=Q1.from(r.errorCorrectionLevel,Q1.M),n=al.from(r.version),s=Z1.from(r.maskPattern),r.toSJISFunc&&ol.setToSJISFunction(r.toSJISFunc)),KT(e,n,i,s)};var $y={},rp={};(function(t){function e(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let i=r.slice().replace("#","").split("");if(i.length<3||i.length===5||i.length>8)throw new Error("Invalid hex color: "+r);(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("")}}t.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||{}}},t.getScale=function(i,n){return n.width&&n.width>=i+n.margin*2?n.width/(i+n.margin*2):n.scale},t.getImageWidth=function(i,n){const s=t.getScale(i,n);return Math.floor((i+n.margin*2)*s)},t.qrToImageData=function(i,n,s){const a=n.modules.size,u=n.modules.data,h=t.getScale(a,s),l=Math.floor((a+s.margin*2)*h),b=s.margin*h,w=[s.color.light,s.color.dark];for(let I=0;I<l;I++)for(let S=0;S<l;S++){let D=(I*l+S)*4,T=s.color.light;if(I>=b&&S>=b&&I<l-b&&S<l-b){const q=Math.floor((I-b)/h),K=Math.floor((S-b)/h);T=w[u[q*a+K]?1:0]}i[D++]=T.r,i[D++]=T.g,i[D++]=T.b,i[D]=T.a}}})(rp),function(t){const e=rp;function r(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")}}t.render=function(s,a,u){let h=u,l=a;typeof h>"u"&&(!a||!a.getContext)&&(h=a,a=void 0),a||(l=i()),h=e.getOptions(h);const b=e.getImageWidth(s.modules.size,h),w=l.getContext("2d"),I=w.createImageData(b,b);return e.qrToImageData(I.data,s,h),r(w,l,b),w.putImageData(I,0,0),l},t.renderToDataURL=function(s,a,u){let h=u;typeof h>"u"&&(!a||!a.getContext)&&(h=a,a=void 0),h||(h={});const l=t.render(s,a,h),b=h.type||"image/png",w=h.rendererOpts||{};return l.toDataURL(b,w.quality)}}($y);var Ry={};const WT=rp;function Ny(t,e){const r=t.a/255,i=e+'="'+t.hex+'"';return r<1?i+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':i}function ip(t,e,r){let i=t+e;return typeof r<"u"&&(i+=" "+r),i}function VT(t,e,r){let i="",n=0,s=!1,a=0;for(let u=0;u<t.length;u++){const h=Math.floor(u%e),l=Math.floor(u/e);!h&&!s&&(s=!0),t[u]?(a++,u>0&&h>0&&t[u-1]||(i+=s?ip("M",h+r,.5+l+r):ip("m",n,0),n=0,s=!1),h+1<e&&t[u+1]||(i+=ip("h",a),a=0)):n++}return i}Ry.render=function(e,r,i){const n=WT.getOptions(r),s=e.modules.size,a=e.modules.data,u=s+n.margin*2,h=n.color.light.a?"<path "+Ny(n.color.light,"fill")+' d="M0 0h'+u+"v"+u+'H0z"/>':"",l="<path "+Ny(n.color.dark,"stroke")+' d="'+VT(a,s,n.margin)+'"/>',b='viewBox="0 0 '+u+" "+u+'"',I='<svg xmlns="http://www.w3.org/2000/svg" '+(n.width?'width="'+n.width+'" height="'+n.width+'" ':"")+b+' shape-rendering="crispEdges">'+h+l+`</svg>
122
- `;return typeof i=="function"&&i(null,I),I};const GT=cT,np=my,Ty=$y,JT=Ry;function sp(t,e,r,i,n){const s=[].slice.call(arguments,1),a=s.length,u=typeof s[a-1]=="function";if(!u&&!GT())throw new Error("Callback required as last argument");if(u){if(a<2)throw new Error("Too few arguments provided");a===2?(n=r,r=e,e=i=void 0):a===3&&(e.getContext&&typeof n>"u"?(n=i,i=void 0):(n=i,i=r,r=e,e=void 0))}else{if(a<1)throw new Error("Too few arguments provided");return a===1?(r=e,e=i=void 0):a===2&&!e.getContext&&(i=r,r=e,e=void 0),new Promise(function(h,l){try{const b=np.create(r,i);h(t(b,e,i))}catch(b){l(b)}})}try{const h=np.create(r,i);n(null,t(h,e,i))}catch(h){n(h)}}Ju.create=np.create,Ju.toCanvas=sp.bind(null,Ty.render),Ju.toDataURL=sp.bind(null,Ty.renderToDataURL),Ju.toString=sp.bind(null,function(t,e,r){return JT.render(t,r)});var YT=Object.defineProperty,Ly=Object.getOwnPropertySymbols,QT=Object.prototype.hasOwnProperty,ZT=Object.prototype.propertyIsEnumerable,By=(t,e,r)=>e in t?YT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,op=(t,e)=>{for(var r in e||(e={}))QT.call(e,r)&&By(t,r,e[r]);if(Ly)for(var r of Ly(e))ZT.call(e,r)&&By(t,r,e[r]);return t};function XT(){var t;const e=(t=lo.state.themeMode)!=null?t:"dark",r={light:{foreground:{1:"rgb(20,20,20)",2:"rgb(121,134,134)",3:"rgb(158,169,169)"},background:{1:"rgb(255,255,255)",2:"rgb(241,243,243)",3:"rgb(228,231,231)"},overlay:"rgba(0,0,0,0.1)"},dark:{foreground:{1:"rgb(228,231,231)",2:"rgb(148,158,158)",3:"rgb(110,119,119)"},background:{1:"rgb(20,20,20)",2:"rgb(39,42,42)",3:"rgb(59,64,64)"},overlay:"rgba(255,255,255,0.1)"}}[e];return{"--wcm-color-fg-1":r.foreground[1],"--wcm-color-fg-2":r.foreground[2],"--wcm-color-fg-3":r.foreground[3],"--wcm-color-bg-1":r.background[1],"--wcm-color-bg-2":r.background[2],"--wcm-color-bg-3":r.background[3],"--wcm-color-overlay":r.overlay}}function Fy(){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 Bt={getPreset(t){return Fy()[t]},setTheme(){const t=document.querySelector(":root"),{themeVariables:e}=lo.state;if(t){const r=op(op(op({},XT()),Fy()),e);Object.entries(r).forEach(([i,n])=>t.style.setProperty(i,n))}},globalCss:zt`*,::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)}`},eL=zt`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 tL=Object.defineProperty,rL=Object.getOwnPropertyDescriptor,Sc=(t,e,r,i)=>{for(var n=i>1?void 0:i?rL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&tL(e,r,n),n};let yo=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 t={"wcm-icon-left":this.iconLeft!==void 0,"wcm-icon-right":this.iconRight!==void 0,"wcm-ghost":this.variant==="ghost","wcm-outline":this.variant==="outline"};let e="inverse";return this.variant==="ghost"&&(e="secondary"),this.variant==="outline"&&(e="accent"),Ie`<button class="${Fs(t)}" ?disabled="${this.disabled}" @click="${this.onClick}">${this.iconLeft}<wcm-text variant="small-regular" color="${e}"><slot></slot></wcm-text>${this.iconRight}</button>`}};yo.styles=[Bt.globalCss,eL],Sc([At({type:Boolean})],yo.prototype,"disabled",2),Sc([At()],yo.prototype,"iconLeft",2),Sc([At()],yo.prototype,"iconRight",2),Sc([At()],yo.prototype,"onClick",2),Sc([At()],yo.prototype,"variant",2),yo=Sc([kt("wcm-button")],yo);const iL=zt`: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 nL=Object.defineProperty,sL=Object.getOwnPropertyDescriptor,ap=(t,e,r,i)=>{for(var n=i>1?void 0:i?sL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&nL(e,r,n),n};let Xu=class extends Ct{constructor(){super(...arguments),this.disabled=!1,this.variant="primary"}render(){const t={"wcm-secondary":this.variant==="secondary"};return Ie`<button ?disabled="${this.disabled}" class="${Fs(t)}"><slot></slot></button>`}};Xu.styles=[Bt.globalCss,iL],ap([At({type:Boolean})],Xu.prototype,"disabled",2),ap([At()],Xu.prototype,"variant",2),Xu=ap([kt("wcm-button-big")],Xu);const oL=zt`: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 aL=Object.defineProperty,cL=Object.getOwnPropertyDescriptor,uL=(t,e,r,i)=>{for(var n=i>1?void 0:i?cL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&aL(e,r,n),n};let cp=class extends Ct{render(){return Ie`<div><slot></slot></div>`}};cp.styles=[Bt.globalCss,oL],cp=uL([kt("wcm-info-footer")],cp);const Wt={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>`},fL=zt`.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 hL=Object.defineProperty,lL=Object.getOwnPropertyDescriptor,dL=(t,e,r,i)=>{for(var n=i>1?void 0:i?lL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&hL(e,r,n),n};let up=class extends Ct{render(){return Ie`<div class="wcm-toolbar-placeholder"></div><div class="wcm-toolbar">${Wt.WALLET_CONNECT_LOGO} <button @click="${sa.close}">${Wt.CROSS_ICON}</button></div>`}};up.styles=[Bt.globalCss,fL],up=dL([kt("wcm-modal-backcard")],up);const pL=zt`main{padding:20px;padding-top:0;width:100%}`;var gL=Object.defineProperty,vL=Object.getOwnPropertyDescriptor,mL=(t,e,r,i)=>{for(var n=i>1?void 0:i?vL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&gL(e,r,n),n};let fp=class extends Ct{render(){return Ie`<main><slot></slot></main>`}};fp.styles=[Bt.globalCss,pL],fp=mL([kt("wcm-modal-content")],fp);const bL=zt`footer{padding:10px;display:flex;flex-direction:column;align-items:inherit;justify-content:inherit;border-top:1px solid var(--wcm-color-bg-2)}`;var yL=Object.defineProperty,wL=Object.getOwnPropertyDescriptor,_L=(t,e,r,i)=>{for(var n=i>1?void 0:i?wL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&yL(e,r,n),n};let hp=class extends Ct{render(){return Ie`<footer><slot></slot></footer>`}};hp.styles=[Bt.globalCss,bL],hp=_L([kt("wcm-modal-footer")],hp);const EL=zt`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 AL=Object.defineProperty,xL=Object.getOwnPropertyDescriptor,ef=(t,e,r,i)=>{for(var n=i>1?void 0:i?xL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&AL(e,r,n),n};let da=class extends Ct{constructor(){super(...arguments),this.title="",this.onAction=void 0,this.actionIcon=void 0,this.border=!1}backBtnTemplate(){return Ie`<button class="wcm-back-btn" @click="${fr.goBack}">${Wt.BACK_ICON}</button>`}actionBtnTemplate(){return Ie`<button class="wcm-action-btn" @click="${this.onAction}">${this.actionIcon}</button>`}render(){const t={"wcm-border":this.border},e=fr.state.history.length>1,r=this.title?Ie`<wcm-text variant="big-bold">${this.title}</wcm-text>`:Ie`<slot></slot>`;return Ie`<header class="${Fs(t)}">${e?this.backBtnTemplate():null} ${r} ${this.onAction?this.actionBtnTemplate():null}</header>`}};da.styles=[Bt.globalCss,EL],ef([At()],da.prototype,"title",2),ef([At()],da.prototype,"onAction",2),ef([At()],da.prototype,"actionIcon",2),ef([At({type:Boolean})],da.prototype,"border",2),da=ef([kt("wcm-modal-header")],da);const dt={MOBILE_BREAKPOINT:600,WCM_RECENT_WALLET_DATA:"WCM_RECENT_WALLET_DATA",EXPLORER_WALLET_URL:"https://explorer.walletconnect.com/?type=wallet",getShadowRootElement(t,e){const r=t.renderRoot.querySelector(e);if(!r)throw new Error(`${e} not found`);return r},getWalletIcon({id:t,image_id:e}){const{walletImages:r}=ki.state;return r!=null&&r[t]?r[t]:e?xi.getWalletImageUrl(e):""},getWalletName(t,e=!1){return e&&t.length>8?`${t.substring(0,8)}..`:t},isMobileAnimation(){return window.innerWidth<=dt.MOBILE_BREAKPOINT},async preloadImage(t){const e=new Promise((r,i)=>{const n=new Image;n.onload=r,n.onerror=i,n.crossOrigin="anonymous",n.src=t});return Promise.race([e,Qe.wait(3e3)])},getErrorMessage(t){return t instanceof Error?t.message:"Unknown Error"},debounce(t,e=500){let r;return(...i)=>{function n(){t(...i)}r&&clearTimeout(r),r=setTimeout(n,e)}},handleMobileLinking(t){const{walletConnectUri:e}=wr.state,{mobile:r,name:i}=t,n=r?.native,s=r?.universal;dt.setRecentWallet(t);function a(u){let h="";n?h=Qe.formatUniversalUrl(n,u,i):s&&(h=Qe.formatNativeUrl(s,u,i)),Qe.openHref(h,"_self")}e&&a(e)},handleAndroidLinking(){const{walletConnectUri:t}=wr.state;t&&(Qe.setWalletConnectAndroidDeepLink(t),Qe.openHref(t,"_self"))},async handleUriCopy(){const{walletConnectUri:t}=wr.state;if(t)try{await navigator.clipboard.writeText(t),po.openToast("Link copied","success")}catch{po.openToast("Failed to copy","error")}},getCustomImageUrls(){const{walletImages:t}=ki.state,e=Object.values(t??{});return Object.values(e)},truncate(t,e=8){return t.length<=e?t:`${t.substring(0,4)}...${t.substring(t.length-4)}`},setRecentWallet(t){try{localStorage.setItem(dt.WCM_RECENT_WALLET_DATA,JSON.stringify(t))}catch{console.info("Unable to set recent wallet")}},getRecentWallet(){try{const t=localStorage.getItem(dt.WCM_RECENT_WALLET_DATA);return t?JSON.parse(t):void 0}catch{console.info("Unable to get recent wallet")}},caseSafeIncludes(t,e){return t.toUpperCase().includes(e.toUpperCase())},openWalletExplorerUrl(){Qe.openHref(dt.EXPLORER_WALLET_URL,"_blank")},getCachedRouterWalletPlatforms(){const{desktop:t,mobile:e}=Qe.getWalletRouterData(),r=!!t?.native,i=!!t?.universal,n=!!e?.native||!!e?.universal;return{isDesktop:r,isMobile:n,isWeb:i}},goToConnectingView(t){fr.setData({Wallet:t});const e=Qe.isMobile(),{isDesktop:r,isWeb:i,isMobile:n}=dt.getCachedRouterWalletPlatforms();e?n?fr.push("MobileConnecting"):i?fr.push("WebConnecting"):fr.push("InstallWallet"):r?fr.push("DesktopConnecting"):i?fr.push("WebConnecting"):n?fr.push("MobileQrcodeConnecting"):fr.push("InstallWallet")}},SL=zt`.wcm-router{overflow:hidden;will-change:transform}.wcm-content{display:flex;flex-direction:column}`;var IL=Object.defineProperty,ML=Object.getOwnPropertyDescriptor,lp=(t,e,r,i)=>{for(var n=i>1?void 0:i?ML(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&IL(e,r,n),n};let tf=class extends Ct{constructor(){super(),this.view=fr.state.view,this.prevView=fr.state.view,this.unsubscribe=void 0,this.oldHeight="0px",this.resizeObserver=void 0,this.unsubscribe=fr.subscribe(t=>{this.view!==t.view&&this.onChangeRoute()})}firstUpdated(){this.resizeObserver=new ResizeObserver(([t])=>{const e=`${t.contentRect.height}px`;this.oldHeight!=="0px"&&la(this.routerEl,{height:[this.oldHeight,e]},{duration:.2}),this.oldHeight=e}),this.resizeObserver.observe(this.contentEl)}disconnectedCallback(){var t,e;(t=this.unsubscribe)==null||t.call(this),(e=this.resizeObserver)==null||e.disconnect()}get routerEl(){return dt.getShadowRootElement(this,".wcm-router")}get contentEl(){return dt.getShadowRootElement(this,".wcm-content")}viewTemplate(){switch(this.view){case"ConnectWallet":return Ie`<wcm-connect-wallet-view></wcm-connect-wallet-view>`;case"DesktopConnecting":return Ie`<wcm-desktop-connecting-view></wcm-desktop-connecting-view>`;case"MobileConnecting":return Ie`<wcm-mobile-connecting-view></wcm-mobile-connecting-view>`;case"WebConnecting":return Ie`<wcm-web-connecting-view></wcm-web-connecting-view>`;case"MobileQrcodeConnecting":return Ie`<wcm-mobile-qr-connecting-view></wcm-mobile-qr-connecting-view>`;case"WalletExplorer":return Ie`<wcm-wallet-explorer-view></wcm-wallet-explorer-view>`;case"Qrcode":return Ie`<wcm-qrcode-view></wcm-qrcode-view>`;case"InstallWallet":return Ie`<wcm-install-wallet-view></wcm-install-wallet-view>`;default:return Ie`<div>Not Found</div>`}}async onChangeRoute(){await la(this.routerEl,{opacity:[1,0],scale:[1,1.02]},{duration:.15,delay:.1}).finished,this.view=fr.state.view,la(this.routerEl,{opacity:[0,1],scale:[.99,1]},{duration:.37,delay:.05})}render(){return Ie`<div class="wcm-router"><div class="wcm-content">${this.viewTemplate()}</div></div>`}};tf.styles=[Bt.globalCss,SL],lp([Si()],tf.prototype,"view",2),lp([Si()],tf.prototype,"prevView",2),tf=lp([kt("wcm-modal-router")],tf);const CL=zt`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 DL=Object.defineProperty,OL=Object.getOwnPropertyDescriptor,Uy=(t,e,r,i)=>{for(var n=i>1?void 0:i?OL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&DL(e,r,n),n};let cl=class extends Ct{constructor(){super(),this.open=!1,this.unsubscribe=void 0,this.timeout=void 0,this.unsubscribe=po.subscribe(t=>{t.open?(this.open=!0,this.timeout=setTimeout(()=>po.closeToast(),2200)):(this.open=!1,clearTimeout(this.timeout))})}disconnectedCallback(){var t;(t=this.unsubscribe)==null||t.call(this),clearTimeout(this.timeout),po.closeToast()}render(){const{message:t,variant:e}=po.state,r={"wcm-success":e==="success","wcm-error":e==="error"};return this.open?Ie`<div class="${Fs(r)}">${e==="success"?Wt.CHECKMARK_ICON:null} ${e==="error"?Wt.CROSS_ICON:null}<wcm-text variant="small-regular">${t}</wcm-text></div>`:null}};cl.styles=[Bt.globalCss,CL],Uy([Si()],cl.prototype,"open",2),cl=Uy([kt("wcm-modal-toast")],cl);const PL=.1,ky=2.5,Us=7;function dp(t,e,r){return t===e?!1:(t-e<0?e-t:t-e)<=r+PL}function $L(t,e){const r=Array.prototype.slice.call(Ju.create(t,{errorCorrectionLevel:e}).modules.data,0),i=Math.sqrt(r.length);return r.reduce((n,s,a)=>(a%i===0?n.push([s]):n[n.length-1].push(s))&&n,[])}const RL={generate(t,e,r){const i="#141414",n="#ffffff",s=[],a=$L(t,"Q"),u=e/a.length,h=[{x:0,y:0},{x:1,y:0},{x:0,y:1}];h.forEach(({x:D,y:T})=>{const q=(a.length-Us)*u*D,K=(a.length-Us)*u*T,F=.45;for(let W=0;W<h.length;W+=1){const R=u*(Us-W*2);s.push(gr`<rect fill="${W%2===0?i:n}" height="${R}" rx="${R*F}" ry="${R*F}" width="${R}" x="${q+u*W}" y="${K+u*W}">`)}});const l=Math.floor((r+25)/u),b=a.length/2-l/2,w=a.length/2+l/2-1,I=[];a.forEach((D,T)=>{D.forEach((q,K)=>{if(a[T][K]&&!(T<Us&&K<Us||T>a.length-(Us+1)&&K<Us||T<Us&&K>a.length-(Us+1))&&!(T>b&&T<w&&K>b&&K<w)){const F=T*u+u/2,W=K*u+u/2;I.push([F,W])}})});const S={};return I.forEach(([D,T])=>{S[D]?S[D].push(T):S[D]=[T]}),Object.entries(S).map(([D,T])=>{const q=T.filter(K=>T.every(F=>!dp(K,F,u)));return[Number(D),q]}).forEach(([D,T])=>{T.forEach(q=>{s.push(gr`<circle cx="${D}" cy="${q}" fill="${i}" r="${u/ky}">`)})}),Object.entries(S).filter(([D,T])=>T.length>1).map(([D,T])=>{const q=T.filter(K=>T.some(F=>dp(K,F,u)));return[Number(D),q]}).map(([D,T])=>{T.sort((K,F)=>K<F?-1:1);const q=[];for(const K of T){const F=q.find(W=>W.some(R=>dp(K,R,u)));F?F.push(K):q.push([K])}return[D,q.map(K=>[K[0],K[K.length-1]])]}).forEach(([D,T])=>{T.forEach(([q,K])=>{s.push(gr`<line x1="${D}" x2="${D}" y1="${q}" y2="${K}" stroke="${i}" stroke-width="${u/(ky/2)}" stroke-linecap="round">`)})}),s}},NL=zt`@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 TL=Object.defineProperty,LL=Object.getOwnPropertyDescriptor,Ic=(t,e,r,i)=>{for(var n=i>1?void 0:i?LL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&TL(e,r,n),n};let ks=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 t=lo.state.themeMode==="light"?this.size:this.size-36;return gr`<svg height="${t}" width="${t}">${RL.generate(this.uri,t,t/4)}</svg>`}render(){const t={"wcm-dark":lo.state.themeMode==="dark"};return Ie`<div style="${`width: ${this.size}px`}" class="${Fs(t)}">${this.walletId||this.imageUrl?Ie`<wcm-wallet-image walletId="${li(this.walletId)}" imageId="${li(this.imageId)}" imageUrl="${li(this.imageUrl)}"></wcm-wallet-image>`:Wt.WALLET_CONNECT_ICON_COLORED} ${this.svgTemplate()}</div>`}};ks.styles=[Bt.globalCss,NL],Ic([At()],ks.prototype,"uri",2),Ic([At({type:Number})],ks.prototype,"size",2),Ic([At()],ks.prototype,"imageId",2),Ic([At()],ks.prototype,"walletId",2),Ic([At()],ks.prototype,"imageUrl",2),ks=Ic([kt("wcm-qrcode")],ks);const BL=zt`: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 FL=Object.defineProperty,UL=Object.getOwnPropertyDescriptor,qy=(t,e,r,i)=>{for(var n=i>1?void 0:i?UL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&FL(e,r,n),n};let ul=class extends Ct{constructor(){super(...arguments),this.onChange=()=>null}render(){return Ie`<input type="text" @input="${this.onChange}" placeholder="Search wallets"> ${Wt.SEARCH_ICON}`}};ul.styles=[Bt.globalCss,BL],qy([At()],ul.prototype,"onChange",2),ul=qy([kt("wcm-search-input")],ul);const kL=zt`@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 qL=Object.defineProperty,jL=Object.getOwnPropertyDescriptor,zL=(t,e,r,i)=>{for(var n=i>1?void 0:i?jL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&qL(e,r,n),n};let pp=class extends Ct{render(){return Ie`<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>`}};pp.styles=[Bt.globalCss,kL],pp=zL([kt("wcm-spinner")],pp);const HL=zt`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 KL=Object.defineProperty,WL=Object.getOwnPropertyDescriptor,gp=(t,e,r,i)=>{for(var n=i>1?void 0:i?WL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&KL(e,r,n),n};let rf=class extends Ct{constructor(){super(...arguments),this.variant="medium-regular",this.color="primary"}render(){const t={"wcm-big-bold":this.variant==="big-bold","wcm-medium-regular":this.variant==="medium-regular","wcm-small-regular":this.variant==="small-regular","wcm-small-thin":this.variant==="small-thin","wcm-xsmall-regular":this.variant==="xsmall-regular","wcm-xsmall-bold":this.variant==="xsmall-bold","wcm-color-primary":this.color==="primary","wcm-color-secondary":this.color==="secondary","wcm-color-tertiary":this.color==="tertiary","wcm-color-inverse":this.color==="inverse","wcm-color-accnt":this.color==="accent","wcm-color-error":this.color==="error"};return Ie`<span><slot class="${Fs(t)}"></slot></span>`}};rf.styles=[Bt.globalCss,HL],gp([At()],rf.prototype,"variant",2),gp([At()],rf.prototype,"color",2),rf=gp([kt("wcm-text")],rf);const VL=zt`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 GL=Object.defineProperty,JL=Object.getOwnPropertyDescriptor,wo=(t,e,r,i)=>{for(var n=i>1?void 0:i?JL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&GL(e,r,n),n};let ys=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?Ie`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">RECENT</wcm-text>`:this.installed?Ie`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">INSTALLED</wcm-text>`:null}handleClick(){x6.click({name:"WALLET_BUTTON",walletId:this.walletId}),this.onClick()}render(){var t;return Ie`<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">${(t=this.label)!=null?t:dt.getWalletName(this.name,!0)}</wcm-text>${this.sublabelTemplate()}</div></button>`}};ys.styles=[Bt.globalCss,VL],wo([At()],ys.prototype,"onClick",2),wo([At()],ys.prototype,"name",2),wo([At()],ys.prototype,"walletId",2),wo([At()],ys.prototype,"label",2),wo([At()],ys.prototype,"imageId",2),wo([At({type:Boolean})],ys.prototype,"installed",2),wo([At({type:Boolean})],ys.prototype,"recent",2),ys=wo([kt("wcm-wallet-button")],ys);const YL=zt`: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 QL=Object.defineProperty,ZL=Object.getOwnPropertyDescriptor,fl=(t,e,r,i)=>{for(var n=i>1?void 0:i?ZL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&QL(e,r,n),n};let Mc=class extends Ct{constructor(){super(...arguments),this.walletId="",this.imageId=void 0,this.imageUrl=void 0}render(){var t;const e=(t=this.imageUrl)!=null&&t.length?this.imageUrl:dt.getWalletIcon({id:this.walletId,image_id:this.imageId});return Ie`${e.length?Ie`<div><img crossorigin="anonymous" src="${e}" alt="${this.id}"></div>`:Wt.WALLET_PLACEHOLDER}`}};Mc.styles=[Bt.globalCss,YL],fl([At()],Mc.prototype,"walletId",2),fl([At()],Mc.prototype,"imageId",2),fl([At()],Mc.prototype,"imageUrl",2),Mc=fl([kt("wcm-wallet-image")],Mc);var XL=Object.defineProperty,eB=Object.getOwnPropertyDescriptor,jy=(t,e,r,i)=>{for(var n=i>1?void 0:i?eB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&XL(e,r,n),n};let vp=class extends Ct{constructor(){super(),this.preload=!0,this.preloadData()}async loadImages(t){try{t!=null&&t.length&&await Promise.all(t.map(async e=>dt.preloadImage(e)))}catch{console.info("Unsuccessful attempt at preloading some images",t)}}async preloadListings(){if(ki.state.enableExplorer){await xi.getRecomendedWallets(),wr.setIsDataLoaded(!0);const{recomendedWallets:t}=xi.state,e=t.map(r=>dt.getWalletIcon(r));await this.loadImages(e)}else wr.setIsDataLoaded(!0)}async preloadCustomImages(){const t=dt.getCustomImageUrls();await this.loadImages(t)}async preloadData(){try{this.preload&&(this.preload=!1,await Promise.all([this.preloadListings(),this.preloadCustomImages()]))}catch(t){console.error(t),po.openToast("Failed preloading","error")}}};jy([Si()],vp.prototype,"preload",2),vp=jy([kt("wcm-explorer-context")],vp);var tB=Object.defineProperty,rB=Object.getOwnPropertyDescriptor,iB=(t,e,r,i)=>{for(var n=i>1?void 0:i?rB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&tB(e,r,n),n};let zy=class extends Ct{constructor(){super(),this.unsubscribeTheme=void 0,Bt.setTheme(),this.unsubscribeTheme=lo.subscribe(Bt.setTheme)}disconnectedCallback(){var t;(t=this.unsubscribeTheme)==null||t.call(this)}};zy=iB([kt("wcm-theme-context")],zy);const nB=zt`@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 sB=Object.defineProperty,oB=Object.getOwnPropertyDescriptor,aB=(t,e,r,i)=>{for(var n=i>1?void 0:i?oB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&sB(e,r,n),n};let mp=class extends Ct{onGoToQrcode(){fr.push("Qrcode")}render(){const{recomendedWallets:t}=xi.state,e=[...t,...t],r=Qe.RECOMMENDED_WALLET_AMOUNT*2;return Ie`<wcm-modal-header title="Connect your wallet" .onAction="${this.onGoToQrcode}" .actionIcon="${Wt.QRCODE_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-title">${Wt.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">WalletConnect</wcm-text></div><div class="wcm-slider"><div class="wcm-track">${[...Array(r)].map((i,n)=>{const s=e[n%e.length];return s?Ie`<wcm-wallet-image walletId="${s.id}" imageId="${s.image_id}"></wcm-wallet-image>`:Wt.WALLET_PLACEHOLDER})}</div><wcm-button-big @click="${dt.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>`}};mp.styles=[Bt.globalCss,nB],mp=aB([kt("wcm-android-wallet-selection")],mp);const cB=zt`@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 uB=Object.defineProperty,fB=Object.getOwnPropertyDescriptor,Cc=(t,e,r,i)=>{for(var n=i>1?void 0:i?fB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&uB(e,r,n),n};let _o=class extends Ct{constructor(){super(...arguments),this.walletId=void 0,this.imageId=void 0,this.isError=!1,this.isStale=!1,this.label=""}svgLoaderTemplate(){var t,e;const r=(e=(t=lo.state.themeVariables)==null?void 0:t["--wcm-wallet-icon-large-border-radius"])!=null?e:Bt.getPreset("--wcm-wallet-icon-large-border-radius");let i=0;r.includes("%")?i=88/100*parseInt(r,10):i=parseInt(r,10),i*=1.17;const n=317-i*1.57,s=425-i*1.8;return Ie`<svg viewBox="0 0 110 110" width="110" height="110"><rect id="wcm-loader" x="2" y="2" width="106" height="106" rx="${i}"/><use xlink:href="#wcm-loader" stroke-dasharray="106 ${n}" stroke-dashoffset="${s}"></use></svg>`}render(){const t={"wcm-error":this.isError,"wcm-stale":this.isStale};return Ie`<div class="${Fs(t)}">${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>`}};_o.styles=[Bt.globalCss,cB],Cc([At()],_o.prototype,"walletId",2),Cc([At()],_o.prototype,"imageId",2),Cc([At({type:Boolean})],_o.prototype,"isError",2),Cc([At({type:Boolean})],_o.prototype,"isStale",2),Cc([At()],_o.prototype,"label",2),_o=Cc([kt("wcm-connector-waiting")],_o);const Dc={manualWallets(){var t,e;const{mobileWallets:r,desktopWallets:i}=ki.state,n=(t=Dc.recentWallet())==null?void 0:t.id,s=Qe.isMobile()?r:i,a=s?.filter(u=>n!==u.id);return(e=Qe.isMobile()?a?.map(({id:u,name:h,links:l})=>({id:u,name:h,mobile:l,links:l})):a?.map(({id:u,name:h,links:l})=>({id:u,name:h,desktop:l,links:l})))!=null?e:[]},recentWallet(){return dt.getRecentWallet()},recomendedWallets(t=!1){var e;const r=t||(e=Dc.recentWallet())==null?void 0:e.id,{recomendedWallets:i}=xi.state;return i.filter(n=>r!==n.id)}},Eo={onConnecting(t){dt.goToConnectingView(t)},manualWalletsTemplate(){return Dc.manualWallets().map(t=>Ie`<wcm-wallet-button walletId="${t.id}" name="${t.name}" .onClick="${()=>this.onConnecting(t)}"></wcm-wallet-button>`)},recomendedWalletsTemplate(t=!1){return Dc.recomendedWallets(t).map(e=>Ie`<wcm-wallet-button name="${e.name}" walletId="${e.id}" imageId="${e.image_id}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`)},recentWalletTemplate(){const t=Dc.recentWallet();if(t)return Ie`<wcm-wallet-button name="${t.name}" walletId="${t.id}" imageId="${li(t.image_id)}" .recent="${!0}" .onClick="${()=>this.onConnecting(t)}"></wcm-wallet-button>`}},hB=zt`.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 lB=Object.defineProperty,dB=Object.getOwnPropertyDescriptor,pB=(t,e,r,i)=>{for(var n=i>1?void 0:i?dB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&lB(e,r,n),n};let bp=class extends Ct{render(){const{explorerExcludedWalletIds:t,enableExplorer:e}=ki.state,r=t!=="ALL"&&e,i=Eo.manualWalletsTemplate(),n=Eo.recomendedWalletsTemplate();let s=[Eo.recentWalletTemplate(),...i,...n];s=s.filter(Boolean);const a=s.length>4||r;let u=[];a?u=s.slice(0,3):u=s;const h=!!u.length;return Ie`<wcm-modal-header .border="${!0}" title="Connect your wallet" .onAction="${dt.handleUriCopy}" .actionIcon="${Wt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-mobile-title"><div class="wcm-subtitle">${Wt.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">Mobile</wcm-text></div><div class="wcm-subtitle">${Wt.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>${h?Ie`<wcm-modal-footer><div class="wcm-desktop-title">${Wt.DESKTOP_ICON}<wcm-text variant="small-regular" color="accent">Desktop</wcm-text></div><div class="wcm-grid">${u} ${a?Ie`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-footer>`:null}`}};bp.styles=[Bt.globalCss,hB],bp=pB([kt("wcm-desktop-wallet-selection")],bp);const gB=zt`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 vB=Object.defineProperty,mB=Object.getOwnPropertyDescriptor,bB=(t,e,r,i)=>{for(var n=i>1?void 0:i?mB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&vB(e,r,n),n};let yp=class extends Ct{render(){const{termsOfServiceUrl:t,privacyPolicyUrl:e}=ki.state;return t??e?Ie`<div><wcm-text variant="small-regular" color="secondary">By connecting your wallet to this app, you agree to the app's ${t?Ie`<a href="${t}" target="_blank" rel="noopener noreferrer">Terms of Service</a>`:null} ${t&&e?"and":null} ${e?Ie`<a href="${e}" target="_blank" rel="noopener noreferrer">Privacy Policy</a>`:null}</wcm-text></div>`:null}};yp.styles=[Bt.globalCss,gB],yp=bB([kt("wcm-legal-notice")],yp);const yB=zt`div{display:grid;grid-template-columns:repeat(4,80px);margin:0 -10px;justify-content:space-between;row-gap:10px}`;var wB=Object.defineProperty,_B=Object.getOwnPropertyDescriptor,EB=(t,e,r,i)=>{for(var n=i>1?void 0:i?_B(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&wB(e,r,n),n};let wp=class extends Ct{onQrcode(){fr.push("Qrcode")}render(){const{explorerExcludedWalletIds:t,enableExplorer:e}=ki.state,r=t!=="ALL"&&e,i=Eo.manualWalletsTemplate(),n=Eo.recomendedWalletsTemplate();let s=[Eo.recentWalletTemplate(),...i,...n];s=s.filter(Boolean);const a=s.length>8||r;let u=[];a?u=s.slice(0,7):u=s;const h=!!u.length;return Ie`<wcm-modal-header title="Connect your wallet" .onAction="${this.onQrcode}" .actionIcon="${Wt.QRCODE_ICON}"></wcm-modal-header>${h?Ie`<wcm-modal-content><div>${u} ${a?Ie`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-content>`:null}`}};wp.styles=[Bt.globalCss,yB],wp=EB([kt("wcm-mobile-wallet-selection")],wp);const AB=zt`: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 xB=Object.defineProperty,SB=Object.getOwnPropertyDescriptor,_p=(t,e,r,i)=>{for(var n=i>1?void 0:i?SB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&xB(e,r,n),n};let Oc=class extends Ct{constructor(){super(),this.open=!1,this.active=!1,this.unsubscribeModal=void 0,this.abortController=void 0,this.unsubscribeModal=sa.subscribe(t=>{t.open?this.onOpenModalEvent():this.onCloseModalEvent()})}disconnectedCallback(){var t;(t=this.unsubscribeModal)==null||t.call(this)}get overlayEl(){return dt.getShadowRootElement(this,".wcm-overlay")}get containerEl(){return dt.getShadowRootElement(this,".wcm-container")}toggleBodyScroll(t){document.querySelector("body")&&(t?document.getElementById("wcm-styles")?.remove():document.head.insertAdjacentHTML("beforeend",'<style id="wcm-styles">html,body{touch-action:none;overflow:hidden;overscroll-behavior:contain;}</style>'))}onCloseModal(t){t.target===t.currentTarget&&sa.close()}onOpenModalEvent(){this.toggleBodyScroll(!1),this.addKeyboardEvents(),this.open=!0,setTimeout(async()=>{const t=dt.isMobileAnimation()?{y:["50vh","0vh"]}:{scale:[.98,1]},e=.1,r=.2;await Promise.all([la(this.overlayEl,{opacity:[0,1]},{delay:e,duration:r}).finished,la(this.containerEl,t,{delay:e,duration:r}).finished]),this.active=!0},0)}async onCloseModalEvent(){this.toggleBodyScroll(!0),this.removeKeyboardEvents();const t=dt.isMobileAnimation()?{y:["0vh","50vh"]}:{scale:[1,.98]},e=.2;await Promise.all([la(this.overlayEl,{opacity:[1,0]},{duration:e}).finished,la(this.containerEl,t,{duration:e}).finished]),this.containerEl.removeAttribute("style"),this.active=!1,this.open=!1}addKeyboardEvents(){this.abortController=new AbortController,window.addEventListener("keydown",t=>{var e;t.key==="Escape"?sa.close():t.key==="Tab"&&((e=t.target)!=null&&e.tagName.includes("wcm-")||this.containerEl.focus())},this.abortController),this.containerEl.focus()}removeKeyboardEvents(){var t;(t=this.abortController)==null||t.abort(),this.abortController=void 0}render(){const t={"wcm-overlay":!0,"wcm-active":this.active};return Ie`<wcm-explorer-context></wcm-explorer-context><wcm-theme-context></wcm-theme-context><div id="wcm-modal" class="${Fs(t)}" @click="${this.onCloseModal}" role="alertdialog" aria-modal="true"><div class="wcm-container" tabindex="0">${this.open?Ie`<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>`}};Oc.styles=[Bt.globalCss,AB],_p([Si()],Oc.prototype,"open",2),_p([Si()],Oc.prototype,"active",2),Oc=_p([kt("wcm-modal")],Oc);const IB=zt`div{display:flex;margin-top:15px}slot{display:inline-block;margin:0 5px}wcm-button{margin:0 5px}`;var MB=Object.defineProperty,CB=Object.getOwnPropertyDescriptor,nf=(t,e,r,i)=>{for(var n=i>1?void 0:i?CB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&MB(e,r,n),n};let pa=class extends Ct{constructor(){super(...arguments),this.isMobile=!1,this.isDesktop=!1,this.isWeb=!1,this.isRetry=!1}onMobile(){Qe.isMobile()?fr.replace("MobileConnecting"):fr.replace("MobileQrcodeConnecting")}onDesktop(){fr.replace("DesktopConnecting")}onWeb(){fr.replace("WebConnecting")}render(){return Ie`<div>${this.isRetry?Ie`<slot></slot>`:null} ${this.isMobile?Ie`<wcm-button .onClick="${this.onMobile}" .iconLeft="${Wt.MOBILE_ICON}" variant="outline">Mobile</wcm-button>`:null} ${this.isDesktop?Ie`<wcm-button .onClick="${this.onDesktop}" .iconLeft="${Wt.DESKTOP_ICON}" variant="outline">Desktop</wcm-button>`:null} ${this.isWeb?Ie`<wcm-button .onClick="${this.onWeb}" .iconLeft="${Wt.GLOBE_ICON}" variant="outline">Web</wcm-button>`:null}</div>`}};pa.styles=[Bt.globalCss,IB],nf([At({type:Boolean})],pa.prototype,"isMobile",2),nf([At({type:Boolean})],pa.prototype,"isDesktop",2),nf([At({type:Boolean})],pa.prototype,"isWeb",2),nf([At({type:Boolean})],pa.prototype,"isRetry",2),pa=nf([kt("wcm-platform-selection")],pa);const DB=zt`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 OB=Object.defineProperty,PB=Object.getOwnPropertyDescriptor,$B=(t,e,r,i)=>{for(var n=i>1?void 0:i?PB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&OB(e,r,n),n};let Ep=class extends Ct{onClick(){fr.push("WalletExplorer")}render(){const{recomendedWallets:t}=xi.state,e=Dc.manualWallets(),r=[...t,...e].reverse().slice(0,4);return Ie`<button @click="${this.onClick}"><div class="wcm-icons">${r.map(i=>{const n=dt.getWalletIcon(i);if(n)return Ie`<img crossorigin="anonymous" src="${n}">`;const s=dt.getWalletIcon({id:i.id});return s?Ie`<img crossorigin="anonymous" src="${s}">`:Wt.WALLET_PLACEHOLDER})} ${[...Array(4-r.length)].map(()=>Wt.WALLET_PLACEHOLDER)}</div><wcm-text variant="xsmall-regular">View All</wcm-text></button>`}};Ep.styles=[Bt.globalCss,DB],Ep=$B([kt("wcm-view-all-wallets-button")],Ep);const RB=zt`.wcm-qr-container{width:100%;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1}`;var NB=Object.defineProperty,TB=Object.getOwnPropertyDescriptor,hl=(t,e,r,i)=>{for(var n=i>1?void 0:i?TB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&NB(e,r,n),n};let Pc=class extends Ct{constructor(){super(),this.walletId="",this.imageId="",this.uri="",setTimeout(()=>{const{walletConnectUri:t}=wr.state;this.uri=t},0)}get overlayEl(){return dt.getShadowRootElement(this,".wcm-qr-container")}render(){return Ie`<div class="wcm-qr-container">${this.uri?Ie`<wcm-qrcode size="${this.overlayEl.offsetWidth}" uri="${this.uri}" walletId="${li(this.walletId)}" imageId="${li(this.imageId)}"></wcm-qrcode>`:Ie`<wcm-spinner></wcm-spinner>`}</div>`}};Pc.styles=[Bt.globalCss,RB],hl([At()],Pc.prototype,"walletId",2),hl([At()],Pc.prototype,"imageId",2),hl([Si()],Pc.prototype,"uri",2),Pc=hl([kt("wcm-walletconnect-qr")],Pc);var LB=Object.defineProperty,BB=Object.getOwnPropertyDescriptor,FB=(t,e,r,i)=>{for(var n=i>1?void 0:i?BB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&LB(e,r,n),n};let Ap=class extends Ct{viewTemplate(){return Qe.isAndroid()?Ie`<wcm-android-wallet-selection></wcm-android-wallet-selection>`:Qe.isMobile()?Ie`<wcm-mobile-wallet-selection></wcm-mobile-wallet-selection>`:Ie`<wcm-desktop-wallet-selection></wcm-desktop-wallet-selection>`}render(){return Ie`${this.viewTemplate()}<wcm-legal-notice></wcm-legal-notice>`}};Ap.styles=[Bt.globalCss],Ap=FB([kt("wcm-connect-wallet-view")],Ap);const UB=zt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var kB=Object.defineProperty,qB=Object.getOwnPropertyDescriptor,Hy=(t,e,r,i)=>{for(var n=i>1?void 0:i?qB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&kB(e,r,n),n};let ll=class extends Ct{constructor(){super(),this.isError=!1,this.openDesktopApp()}onFormatAndRedirect(t){const{desktop:e,name:r}=Qe.getWalletRouterData(),i=e?.native;if(i){const n=Qe.formatNativeUrl(i,t,r);Qe.openHref(n,"_self")}}openDesktopApp(){const{walletConnectUri:t}=wr.state,e=Qe.getWalletRouterData();dt.setRecentWallet(e),t&&this.onFormatAndRedirect(t)}render(){const{name:t,id:e,image_id:r}=Qe.getWalletRouterData(),{isMobile:i,isWeb:n}=dt.getCachedRouterWalletPlatforms();return Ie`<wcm-modal-header title="${t}" .onAction="${dt.handleUriCopy}" .actionIcon="${Wt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${li(r)}" label="${`Continue in ${t}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Connection can continue loading if ${t} is not installed on your device`}</wcm-text><wcm-platform-selection .isMobile="${i}" .isWeb="${n}" .isRetry="${!0}"><wcm-button .onClick="${this.openDesktopApp.bind(this)}" .iconRight="${Wt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};ll.styles=[Bt.globalCss,UB],Hy([Si()],ll.prototype,"isError",2),ll=Hy([kt("wcm-desktop-connecting-view")],ll);const jB=zt`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 zB=Object.defineProperty,HB=Object.getOwnPropertyDescriptor,KB=(t,e,r,i)=>{for(var n=i>1?void 0:i?HB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&zB(e,r,n),n};let xp=class extends Ct{onInstall(t){t&&Qe.openHref(t,"_blank")}render(){const{name:t,id:e,image_id:r,homepage:i}=Qe.getWalletRouterData();return Ie`<wcm-modal-header title="${t}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${li(r)}" label="Not Detected" .isStale="${!0}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Download ${t} to continue. If multiple browser extensions are installed, disable non ${t} ones and try again`}</wcm-text><wcm-button .onClick="${()=>this.onInstall(i)}" .iconLeft="${Wt.ARROW_DOWN_ICON}">Download</wcm-button></wcm-info-footer>`}};xp.styles=[Bt.globalCss,jB],xp=KB([kt("wcm-install-wallet-view")],xp);const WB=zt`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 VB=Object.defineProperty,GB=Object.getOwnPropertyDescriptor,Ky=(t,e,r,i)=>{for(var n=i>1?void 0:i?GB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&VB(e,r,n),n};let dl=class extends Ct{constructor(){super(),this.isError=!1,this.openMobileApp()}onFormatAndRedirect(t,e=!1){const{mobile:r,name:i}=Qe.getWalletRouterData(),n=r?.native,s=r?.universal;if(n&&!e){const a=Qe.formatNativeUrl(n,t,i);Qe.openHref(a,"_self")}else if(s){const a=Qe.formatUniversalUrl(s,t,i);Qe.openHref(a,"_self")}}openMobileApp(t=!1){const{walletConnectUri:e}=wr.state,r=Qe.getWalletRouterData();dt.setRecentWallet(r),e&&this.onFormatAndRedirect(e,t)}onGoToAppStore(t){t&&Qe.openHref(t,"_blank")}render(){const{name:t,id:e,image_id:r,app:i,mobile:n}=Qe.getWalletRouterData(),{isWeb:s}=dt.getCachedRouterWalletPlatforms(),a=i?.ios,u=n?.universal;return Ie`<wcm-modal-header title="${t}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${li(r)}" label="Tap 'Open' to continue…" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer class="wcm-note"><wcm-platform-selection .isWeb="${s}" .isRetry="${!0}"><wcm-button .onClick="${()=>this.openMobileApp(!1)}" .iconRight="${Wt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection>${u?Ie`<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(r)}"></wcm-wallet-image><wcm-text>${`Get ${t}`}</wcm-text></div><wcm-button .iconRight="${Wt.ARROW_RIGHT_ICON}" .onClick="${()=>this.onGoToAppStore(a)}" variant="ghost">App Store</wcm-button></wcm-info-footer>`}};dl.styles=[Bt.globalCss,WB],Ky([Si()],dl.prototype,"isError",2),dl=Ky([kt("wcm-mobile-connecting-view")],dl);const JB=zt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var YB=Object.defineProperty,QB=Object.getOwnPropertyDescriptor,ZB=(t,e,r,i)=>{for(var n=i>1?void 0:i?QB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&YB(e,r,n),n};let Sp=class extends Ct{render(){const{name:t,id:e,image_id:r}=Qe.getWalletRouterData(),{isDesktop:i,isWeb:n}=dt.getCachedRouterWalletPlatforms();return Ie`<wcm-modal-header title="${t}" .onAction="${dt.handleUriCopy}" .actionIcon="${Wt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr walletId="${e}" imageId="${li(r)}"></wcm-walletconnect-qr></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Scan this QR Code with your phone's camera or inside ${t} app`}</wcm-text><wcm-platform-selection .isDesktop="${i}" .isWeb="${n}"></wcm-platform-selection></wcm-info-footer>`}};Sp.styles=[Bt.globalCss,JB],Sp=ZB([kt("wcm-mobile-qr-connecting-view")],Sp);var XB=Object.defineProperty,eF=Object.getOwnPropertyDescriptor,tF=(t,e,r,i)=>{for(var n=i>1?void 0:i?eF(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&XB(e,r,n),n};let Ip=class extends Ct{render(){return Ie`<wcm-modal-header title="Scan the code" .onAction="${dt.handleUriCopy}" .actionIcon="${Wt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>`}};Ip.styles=[Bt.globalCss],Ip=tF([kt("wcm-qrcode-view")],Ip);const rF=zt`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 iF=Object.defineProperty,nF=Object.getOwnPropertyDescriptor,sf=(t,e,r,i)=>{for(var n=i>1?void 0:i?nF(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&iF(e,r,n),n};const Mp=40;let ga=class extends Ct{constructor(){super(...arguments),this.loading=!xi.state.wallets.listings.length,this.firstFetch=!xi.state.wallets.listings.length,this.search="",this.endReached=!1,this.intersectionObserver=void 0,this.searchDebounce=dt.debounce(t=>{t.length>=1?(this.firstFetch=!0,this.endReached=!1,this.search=t,xi.resetSearch(),this.fetchWallets()):this.search&&(this.search="",this.endReached=this.isLastPage(),xi.resetSearch())})}firstUpdated(){this.createPaginationObserver()}disconnectedCallback(){var t;(t=this.intersectionObserver)==null||t.disconnect()}get placeholderEl(){return dt.getShadowRootElement(this,".wcm-placeholder-block")}createPaginationObserver(){this.intersectionObserver=new IntersectionObserver(([t])=>{t.isIntersecting&&!(this.search&&this.firstFetch)&&this.fetchWallets()}),this.intersectionObserver.observe(this.placeholderEl)}isLastPage(){const{wallets:t,search:e}=xi.state,{listings:r,total:i}=this.search?e:t;return i<=Mp||r.length>=i}async fetchWallets(){var t;const{wallets:e,search:r}=xi.state,{listings:i,total:n,page:s}=this.search?r:e;if(!this.endReached&&(this.firstFetch||n>Mp&&i.length<n))try{this.loading=!0;const a=(t=wr.state.chains)==null?void 0:t.join(","),{listings:u}=await xi.getWallets({page:this.firstFetch?1:s+1,entries:Mp,search:this.search,version:2,chains:a}),h=u.map(l=>dt.getWalletIcon(l));await Promise.all([...h.map(async l=>dt.preloadImage(l)),Qe.wait(300)]),this.endReached=this.isLastPage()}catch(a){console.error(a),po.openToast(dt.getErrorMessage(a),"error")}finally{this.loading=!1,this.firstFetch=!1}}onConnect(t){Qe.isAndroid()?dt.handleMobileLinking(t):dt.goToConnectingView(t)}onSearchChange(t){const{value:e}=t.target;this.searchDebounce(e)}render(){const{wallets:t,search:e}=xi.state,{listings:r}=this.search?e:t,i=this.loading&&!r.length,n=this.search.length>=3;let s=Eo.manualWalletsTemplate(),a=Eo.recomendedWalletsTemplate(!0);n&&(s=s.filter(({values:l})=>dt.caseSafeIncludes(l[0],this.search)),a=a.filter(({values:l})=>dt.caseSafeIncludes(l[0],this.search)));const u=!this.loading&&!r.length&&!a.length,h={"wcm-loading":i,"wcm-end-reached":this.endReached||!this.loading,"wcm-empty":u};return Ie`<wcm-modal-header><wcm-search-input .onChange="${this.onSearchChange.bind(this)}"></wcm-search-input></wcm-modal-header><wcm-modal-content class="${Fs(h)}"><div class="wcm-grid">${i?null:s} ${i?null:a} ${i?null:r.map(l=>Ie`${l?Ie`<wcm-wallet-button imageId="${l.image_id}" name="${l.name}" walletId="${l.id}" .onClick="${()=>this.onConnect(l)}"></wcm-wallet-button>`:null}`)}</div><div class="wcm-placeholder-block">${u?Ie`<wcm-text variant="big-bold" color="secondary">No results found</wcm-text>`:null} ${!u&&this.loading?Ie`<wcm-spinner></wcm-spinner>`:null}</div></wcm-modal-content>`}};ga.styles=[Bt.globalCss,rF],sf([Si()],ga.prototype,"loading",2),sf([Si()],ga.prototype,"firstFetch",2),sf([Si()],ga.prototype,"search",2),sf([Si()],ga.prototype,"endReached",2),ga=sf([kt("wcm-wallet-explorer-view")],ga);const sF=zt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var oF=Object.defineProperty,aF=Object.getOwnPropertyDescriptor,Wy=(t,e,r,i)=>{for(var n=i>1?void 0:i?aF(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&oF(e,r,n),n};let pl=class extends Ct{constructor(){super(),this.isError=!1,this.openWebWallet()}onFormatAndRedirect(t){const{desktop:e,name:r}=Qe.getWalletRouterData(),i=e?.universal;if(i){const n=Qe.formatUniversalUrl(i,t,r);Qe.openHref(n,"_blank")}}openWebWallet(){const{walletConnectUri:t}=wr.state,e=Qe.getWalletRouterData();dt.setRecentWallet(e),t&&this.onFormatAndRedirect(t)}render(){const{name:t,id:e,image_id:r}=Qe.getWalletRouterData(),{isMobile:i,isDesktop:n}=dt.getCachedRouterWalletPlatforms(),s=Qe.isMobile();return Ie`<wcm-modal-header title="${t}" .onAction="${dt.handleUriCopy}" .actionIcon="${Wt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${li(r)}" label="${`Continue in ${t}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`${t} web app has opened in a new tab. Go there, accept the connection, and come back`}</wcm-text><wcm-platform-selection .isMobile="${i}" .isDesktop="${s?!1:n}" .isRetry="${!0}"><wcm-button .onClick="${this.openWebWallet.bind(this)}" .iconRight="${Wt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};pl.styles=[Bt.globalCss,sF],Wy([Si()],pl.prototype,"isError",2),pl=Wy([kt("wcm-web-connecting-view")],pl);var cF=Object.freeze({__proto__:null,get WcmModal(){return Oc},get WcmQrCode(){return ks}});mn.EthereumProvider=$R,mn.OPTIONAL_EVENTS=y6,mn.OPTIONAL_METHODS=b6,mn.REQUIRED_EVENTS=Uh,mn.REQUIRED_METHODS=Fh,mn.default=jh,Object.defineProperty(mn,"__esModule",{value:!0})});
121
+ `);const a=zT(e,r,n),u=ol.getSymbolSize(e),h=new $T(u);return FT(h,e),UT(h),kT(h,e),tp(h,r,0),e>=7&&qT(h,e),jT(h,a),isNaN(i)&&(i=Z1.getBestMask(h,tp.bind(null,h,r))),Z1.applyMask(i,h),tp(h,r,i),{modules:h,version:e,errorCorrectionLevel:r,maskPattern:i,segments:n}}by.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let i=Q1.M,n,s;return typeof r<"u"&&(i=Q1.from(r.errorCorrectionLevel,Q1.M),n=al.from(r.version),s=Z1.from(r.maskPattern),r.toSJISFunc&&ol.setToSJISFunction(r.toSJISFunc)),KT(e,n,i,s)};var Ry={},rp={};(function(t){function e(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let i=r.slice().replace("#","").split("");if(i.length<3||i.length===5||i.length>8)throw new Error("Invalid hex color: "+r);(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("")}}t.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||{}}},t.getScale=function(i,n){return n.width&&n.width>=i+n.margin*2?n.width/(i+n.margin*2):n.scale},t.getImageWidth=function(i,n){const s=t.getScale(i,n);return Math.floor((i+n.margin*2)*s)},t.qrToImageData=function(i,n,s){const a=n.modules.size,u=n.modules.data,h=t.getScale(a,s),l=Math.floor((a+s.margin*2)*h),b=s.margin*h,w=[s.color.light,s.color.dark];for(let I=0;I<l;I++)for(let S=0;S<l;S++){let D=(I*l+S)*4,T=s.color.light;if(I>=b&&S>=b&&I<l-b&&S<l-b){const q=Math.floor((I-b)/h),K=Math.floor((S-b)/h);T=w[u[q*a+K]?1:0]}i[D++]=T.r,i[D++]=T.g,i[D++]=T.b,i[D]=T.a}}})(rp),function(t){const e=rp;function r(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")}}t.render=function(s,a,u){let h=u,l=a;typeof h>"u"&&(!a||!a.getContext)&&(h=a,a=void 0),a||(l=i()),h=e.getOptions(h);const b=e.getImageWidth(s.modules.size,h),w=l.getContext("2d"),I=w.createImageData(b,b);return e.qrToImageData(I.data,s,h),r(w,l,b),w.putImageData(I,0,0),l},t.renderToDataURL=function(s,a,u){let h=u;typeof h>"u"&&(!a||!a.getContext)&&(h=a,a=void 0),h||(h={});const l=t.render(s,a,h),b=h.type||"image/png",w=h.rendererOpts||{};return l.toDataURL(b,w.quality)}}(Ry);var Ny={};const WT=rp;function Ty(t,e){const r=t.a/255,i=e+'="'+t.hex+'"';return r<1?i+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':i}function ip(t,e,r){let i=t+e;return typeof r<"u"&&(i+=" "+r),i}function VT(t,e,r){let i="",n=0,s=!1,a=0;for(let u=0;u<t.length;u++){const h=Math.floor(u%e),l=Math.floor(u/e);!h&&!s&&(s=!0),t[u]?(a++,u>0&&h>0&&t[u-1]||(i+=s?ip("M",h+r,.5+l+r):ip("m",n,0),n=0,s=!1),h+1<e&&t[u+1]||(i+=ip("h",a),a=0)):n++}return i}Ny.render=function(e,r,i){const n=WT.getOptions(r),s=e.modules.size,a=e.modules.data,u=s+n.margin*2,h=n.color.light.a?"<path "+Ty(n.color.light,"fill")+' d="M0 0h'+u+"v"+u+'H0z"/>':"",l="<path "+Ty(n.color.dark,"stroke")+' d="'+VT(a,s,n.margin)+'"/>',b='viewBox="0 0 '+u+" "+u+'"',I='<svg xmlns="http://www.w3.org/2000/svg" '+(n.width?'width="'+n.width+'" height="'+n.width+'" ':"")+b+' shape-rendering="crispEdges">'+h+l+`</svg>
122
+ `;return typeof i=="function"&&i(null,I),I};const GT=cT,np=by,Ly=Ry,JT=Ny;function sp(t,e,r,i,n){const s=[].slice.call(arguments,1),a=s.length,u=typeof s[a-1]=="function";if(!u&&!GT())throw new Error("Callback required as last argument");if(u){if(a<2)throw new Error("Too few arguments provided");a===2?(n=r,r=e,e=i=void 0):a===3&&(e.getContext&&typeof n>"u"?(n=i,i=void 0):(n=i,i=r,r=e,e=void 0))}else{if(a<1)throw new Error("Too few arguments provided");return a===1?(r=e,e=i=void 0):a===2&&!e.getContext&&(i=r,r=e,e=void 0),new Promise(function(h,l){try{const b=np.create(r,i);h(t(b,e,i))}catch(b){l(b)}})}try{const h=np.create(r,i);n(null,t(h,e,i))}catch(h){n(h)}}Ju.create=np.create,Ju.toCanvas=sp.bind(null,Ly.render),Ju.toDataURL=sp.bind(null,Ly.renderToDataURL),Ju.toString=sp.bind(null,function(t,e,r){return JT.render(t,r)});var YT=Object.defineProperty,By=Object.getOwnPropertySymbols,QT=Object.prototype.hasOwnProperty,ZT=Object.prototype.propertyIsEnumerable,Fy=(t,e,r)=>e in t?YT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,op=(t,e)=>{for(var r in e||(e={}))QT.call(e,r)&&Fy(t,r,e[r]);if(By)for(var r of By(e))ZT.call(e,r)&&Fy(t,r,e[r]);return t};function XT(){var t;const e=(t=lo.state.themeMode)!=null?t:"dark",r={light:{foreground:{1:"rgb(20,20,20)",2:"rgb(121,134,134)",3:"rgb(158,169,169)"},background:{1:"rgb(255,255,255)",2:"rgb(241,243,243)",3:"rgb(228,231,231)"},overlay:"rgba(0,0,0,0.1)"},dark:{foreground:{1:"rgb(228,231,231)",2:"rgb(148,158,158)",3:"rgb(110,119,119)"},background:{1:"rgb(20,20,20)",2:"rgb(39,42,42)",3:"rgb(59,64,64)"},overlay:"rgba(255,255,255,0.1)"}}[e];return{"--wcm-color-fg-1":r.foreground[1],"--wcm-color-fg-2":r.foreground[2],"--wcm-color-fg-3":r.foreground[3],"--wcm-color-bg-1":r.background[1],"--wcm-color-bg-2":r.background[2],"--wcm-color-bg-3":r.background[3],"--wcm-color-overlay":r.overlay}}function Uy(){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 Bt={getPreset(t){return Uy()[t]},setTheme(){const t=document.querySelector(":root"),{themeVariables:e}=lo.state;if(t){const r=op(op(op({},XT()),Uy()),e);Object.entries(r).forEach(([i,n])=>t.style.setProperty(i,n))}},globalCss:zt`*,::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)}`},eL=zt`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 tL=Object.defineProperty,rL=Object.getOwnPropertyDescriptor,Sc=(t,e,r,i)=>{for(var n=i>1?void 0:i?rL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&tL(e,r,n),n};let yo=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 t={"wcm-icon-left":this.iconLeft!==void 0,"wcm-icon-right":this.iconRight!==void 0,"wcm-ghost":this.variant==="ghost","wcm-outline":this.variant==="outline"};let e="inverse";return this.variant==="ghost"&&(e="secondary"),this.variant==="outline"&&(e="accent"),Ie`<button class="${Fs(t)}" ?disabled="${this.disabled}" @click="${this.onClick}">${this.iconLeft}<wcm-text variant="small-regular" color="${e}"><slot></slot></wcm-text>${this.iconRight}</button>`}};yo.styles=[Bt.globalCss,eL],Sc([At({type:Boolean})],yo.prototype,"disabled",2),Sc([At()],yo.prototype,"iconLeft",2),Sc([At()],yo.prototype,"iconRight",2),Sc([At()],yo.prototype,"onClick",2),Sc([At()],yo.prototype,"variant",2),yo=Sc([kt("wcm-button")],yo);const iL=zt`: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 nL=Object.defineProperty,sL=Object.getOwnPropertyDescriptor,ap=(t,e,r,i)=>{for(var n=i>1?void 0:i?sL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&nL(e,r,n),n};let Xu=class extends Ct{constructor(){super(...arguments),this.disabled=!1,this.variant="primary"}render(){const t={"wcm-secondary":this.variant==="secondary"};return Ie`<button ?disabled="${this.disabled}" class="${Fs(t)}"><slot></slot></button>`}};Xu.styles=[Bt.globalCss,iL],ap([At({type:Boolean})],Xu.prototype,"disabled",2),ap([At()],Xu.prototype,"variant",2),Xu=ap([kt("wcm-button-big")],Xu);const oL=zt`: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 aL=Object.defineProperty,cL=Object.getOwnPropertyDescriptor,uL=(t,e,r,i)=>{for(var n=i>1?void 0:i?cL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&aL(e,r,n),n};let cp=class extends Ct{render(){return Ie`<div><slot></slot></div>`}};cp.styles=[Bt.globalCss,oL],cp=uL([kt("wcm-info-footer")],cp);const Wt={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>`},fL=zt`.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 hL=Object.defineProperty,lL=Object.getOwnPropertyDescriptor,dL=(t,e,r,i)=>{for(var n=i>1?void 0:i?lL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&hL(e,r,n),n};let up=class extends Ct{render(){return Ie`<div class="wcm-toolbar-placeholder"></div><div class="wcm-toolbar">${Wt.WALLET_CONNECT_LOGO} <button @click="${sa.close}">${Wt.CROSS_ICON}</button></div>`}};up.styles=[Bt.globalCss,fL],up=dL([kt("wcm-modal-backcard")],up);const pL=zt`main{padding:20px;padding-top:0;width:100%}`;var gL=Object.defineProperty,vL=Object.getOwnPropertyDescriptor,mL=(t,e,r,i)=>{for(var n=i>1?void 0:i?vL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&gL(e,r,n),n};let fp=class extends Ct{render(){return Ie`<main><slot></slot></main>`}};fp.styles=[Bt.globalCss,pL],fp=mL([kt("wcm-modal-content")],fp);const bL=zt`footer{padding:10px;display:flex;flex-direction:column;align-items:inherit;justify-content:inherit;border-top:1px solid var(--wcm-color-bg-2)}`;var yL=Object.defineProperty,wL=Object.getOwnPropertyDescriptor,_L=(t,e,r,i)=>{for(var n=i>1?void 0:i?wL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&yL(e,r,n),n};let hp=class extends Ct{render(){return Ie`<footer><slot></slot></footer>`}};hp.styles=[Bt.globalCss,bL],hp=_L([kt("wcm-modal-footer")],hp);const EL=zt`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 AL=Object.defineProperty,xL=Object.getOwnPropertyDescriptor,ef=(t,e,r,i)=>{for(var n=i>1?void 0:i?xL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&AL(e,r,n),n};let da=class extends Ct{constructor(){super(...arguments),this.title="",this.onAction=void 0,this.actionIcon=void 0,this.border=!1}backBtnTemplate(){return Ie`<button class="wcm-back-btn" @click="${fr.goBack}">${Wt.BACK_ICON}</button>`}actionBtnTemplate(){return Ie`<button class="wcm-action-btn" @click="${this.onAction}">${this.actionIcon}</button>`}render(){const t={"wcm-border":this.border},e=fr.state.history.length>1,r=this.title?Ie`<wcm-text variant="big-bold">${this.title}</wcm-text>`:Ie`<slot></slot>`;return Ie`<header class="${Fs(t)}">${e?this.backBtnTemplate():null} ${r} ${this.onAction?this.actionBtnTemplate():null}</header>`}};da.styles=[Bt.globalCss,EL],ef([At()],da.prototype,"title",2),ef([At()],da.prototype,"onAction",2),ef([At()],da.prototype,"actionIcon",2),ef([At({type:Boolean})],da.prototype,"border",2),da=ef([kt("wcm-modal-header")],da);const dt={MOBILE_BREAKPOINT:600,WCM_RECENT_WALLET_DATA:"WCM_RECENT_WALLET_DATA",EXPLORER_WALLET_URL:"https://explorer.walletconnect.com/?type=wallet",getShadowRootElement(t,e){const r=t.renderRoot.querySelector(e);if(!r)throw new Error(`${e} not found`);return r},getWalletIcon({id:t,image_id:e}){const{walletImages:r}=ki.state;return r!=null&&r[t]?r[t]:e?xi.getWalletImageUrl(e):""},getWalletName(t,e=!1){return e&&t.length>8?`${t.substring(0,8)}..`:t},isMobileAnimation(){return window.innerWidth<=dt.MOBILE_BREAKPOINT},async preloadImage(t){const e=new Promise((r,i)=>{const n=new Image;n.onload=r,n.onerror=i,n.crossOrigin="anonymous",n.src=t});return Promise.race([e,Qe.wait(3e3)])},getErrorMessage(t){return t instanceof Error?t.message:"Unknown Error"},debounce(t,e=500){let r;return(...i)=>{function n(){t(...i)}r&&clearTimeout(r),r=setTimeout(n,e)}},handleMobileLinking(t){const{walletConnectUri:e}=wr.state,{mobile:r,name:i}=t,n=r?.native,s=r?.universal;dt.setRecentWallet(t);function a(u){let h="";n?h=Qe.formatUniversalUrl(n,u,i):s&&(h=Qe.formatNativeUrl(s,u,i)),Qe.openHref(h,"_self")}e&&a(e)},handleAndroidLinking(){const{walletConnectUri:t}=wr.state;t&&(Qe.setWalletConnectAndroidDeepLink(t),Qe.openHref(t,"_self"))},async handleUriCopy(){const{walletConnectUri:t}=wr.state;if(t)try{await navigator.clipboard.writeText(t),po.openToast("Link copied","success")}catch{po.openToast("Failed to copy","error")}},getCustomImageUrls(){const{walletImages:t}=ki.state,e=Object.values(t??{});return Object.values(e)},truncate(t,e=8){return t.length<=e?t:`${t.substring(0,4)}...${t.substring(t.length-4)}`},setRecentWallet(t){try{localStorage.setItem(dt.WCM_RECENT_WALLET_DATA,JSON.stringify(t))}catch{console.info("Unable to set recent wallet")}},getRecentWallet(){try{const t=localStorage.getItem(dt.WCM_RECENT_WALLET_DATA);return t?JSON.parse(t):void 0}catch{console.info("Unable to get recent wallet")}},caseSafeIncludes(t,e){return t.toUpperCase().includes(e.toUpperCase())},openWalletExplorerUrl(){Qe.openHref(dt.EXPLORER_WALLET_URL,"_blank")},getCachedRouterWalletPlatforms(){const{desktop:t,mobile:e}=Qe.getWalletRouterData(),r=!!t?.native,i=!!t?.universal,n=!!e?.native||!!e?.universal;return{isDesktop:r,isMobile:n,isWeb:i}},goToConnectingView(t){fr.setData({Wallet:t});const e=Qe.isMobile(),{isDesktop:r,isWeb:i,isMobile:n}=dt.getCachedRouterWalletPlatforms();e?n?fr.push("MobileConnecting"):i?fr.push("WebConnecting"):fr.push("InstallWallet"):r?fr.push("DesktopConnecting"):i?fr.push("WebConnecting"):n?fr.push("MobileQrcodeConnecting"):fr.push("InstallWallet")}},SL=zt`.wcm-router{overflow:hidden;will-change:transform}.wcm-content{display:flex;flex-direction:column}`;var IL=Object.defineProperty,ML=Object.getOwnPropertyDescriptor,lp=(t,e,r,i)=>{for(var n=i>1?void 0:i?ML(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&IL(e,r,n),n};let tf=class extends Ct{constructor(){super(),this.view=fr.state.view,this.prevView=fr.state.view,this.unsubscribe=void 0,this.oldHeight="0px",this.resizeObserver=void 0,this.unsubscribe=fr.subscribe(t=>{this.view!==t.view&&this.onChangeRoute()})}firstUpdated(){this.resizeObserver=new ResizeObserver(([t])=>{const e=`${t.contentRect.height}px`;this.oldHeight!=="0px"&&la(this.routerEl,{height:[this.oldHeight,e]},{duration:.2}),this.oldHeight=e}),this.resizeObserver.observe(this.contentEl)}disconnectedCallback(){var t,e;(t=this.unsubscribe)==null||t.call(this),(e=this.resizeObserver)==null||e.disconnect()}get routerEl(){return dt.getShadowRootElement(this,".wcm-router")}get contentEl(){return dt.getShadowRootElement(this,".wcm-content")}viewTemplate(){switch(this.view){case"ConnectWallet":return Ie`<wcm-connect-wallet-view></wcm-connect-wallet-view>`;case"DesktopConnecting":return Ie`<wcm-desktop-connecting-view></wcm-desktop-connecting-view>`;case"MobileConnecting":return Ie`<wcm-mobile-connecting-view></wcm-mobile-connecting-view>`;case"WebConnecting":return Ie`<wcm-web-connecting-view></wcm-web-connecting-view>`;case"MobileQrcodeConnecting":return Ie`<wcm-mobile-qr-connecting-view></wcm-mobile-qr-connecting-view>`;case"WalletExplorer":return Ie`<wcm-wallet-explorer-view></wcm-wallet-explorer-view>`;case"Qrcode":return Ie`<wcm-qrcode-view></wcm-qrcode-view>`;case"InstallWallet":return Ie`<wcm-install-wallet-view></wcm-install-wallet-view>`;default:return Ie`<div>Not Found</div>`}}async onChangeRoute(){await la(this.routerEl,{opacity:[1,0],scale:[1,1.02]},{duration:.15,delay:.1}).finished,this.view=fr.state.view,la(this.routerEl,{opacity:[0,1],scale:[.99,1]},{duration:.37,delay:.05})}render(){return Ie`<div class="wcm-router"><div class="wcm-content">${this.viewTemplate()}</div></div>`}};tf.styles=[Bt.globalCss,SL],lp([Si()],tf.prototype,"view",2),lp([Si()],tf.prototype,"prevView",2),tf=lp([kt("wcm-modal-router")],tf);const CL=zt`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 DL=Object.defineProperty,OL=Object.getOwnPropertyDescriptor,ky=(t,e,r,i)=>{for(var n=i>1?void 0:i?OL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&DL(e,r,n),n};let cl=class extends Ct{constructor(){super(),this.open=!1,this.unsubscribe=void 0,this.timeout=void 0,this.unsubscribe=po.subscribe(t=>{t.open?(this.open=!0,this.timeout=setTimeout(()=>po.closeToast(),2200)):(this.open=!1,clearTimeout(this.timeout))})}disconnectedCallback(){var t;(t=this.unsubscribe)==null||t.call(this),clearTimeout(this.timeout),po.closeToast()}render(){const{message:t,variant:e}=po.state,r={"wcm-success":e==="success","wcm-error":e==="error"};return this.open?Ie`<div class="${Fs(r)}">${e==="success"?Wt.CHECKMARK_ICON:null} ${e==="error"?Wt.CROSS_ICON:null}<wcm-text variant="small-regular">${t}</wcm-text></div>`:null}};cl.styles=[Bt.globalCss,CL],ky([Si()],cl.prototype,"open",2),cl=ky([kt("wcm-modal-toast")],cl);const PL=.1,qy=2.5,Us=7;function dp(t,e,r){return t===e?!1:(t-e<0?e-t:t-e)<=r+PL}function $L(t,e){const r=Array.prototype.slice.call(Ju.create(t,{errorCorrectionLevel:e}).modules.data,0),i=Math.sqrt(r.length);return r.reduce((n,s,a)=>(a%i===0?n.push([s]):n[n.length-1].push(s))&&n,[])}const RL={generate(t,e,r){const i="#141414",n="#ffffff",s=[],a=$L(t,"Q"),u=e/a.length,h=[{x:0,y:0},{x:1,y:0},{x:0,y:1}];h.forEach(({x:D,y:T})=>{const q=(a.length-Us)*u*D,K=(a.length-Us)*u*T,F=.45;for(let W=0;W<h.length;W+=1){const R=u*(Us-W*2);s.push(gr`<rect fill="${W%2===0?i:n}" height="${R}" rx="${R*F}" ry="${R*F}" width="${R}" x="${q+u*W}" y="${K+u*W}">`)}});const l=Math.floor((r+25)/u),b=a.length/2-l/2,w=a.length/2+l/2-1,I=[];a.forEach((D,T)=>{D.forEach((q,K)=>{if(a[T][K]&&!(T<Us&&K<Us||T>a.length-(Us+1)&&K<Us||T<Us&&K>a.length-(Us+1))&&!(T>b&&T<w&&K>b&&K<w)){const F=T*u+u/2,W=K*u+u/2;I.push([F,W])}})});const S={};return I.forEach(([D,T])=>{S[D]?S[D].push(T):S[D]=[T]}),Object.entries(S).map(([D,T])=>{const q=T.filter(K=>T.every(F=>!dp(K,F,u)));return[Number(D),q]}).forEach(([D,T])=>{T.forEach(q=>{s.push(gr`<circle cx="${D}" cy="${q}" fill="${i}" r="${u/qy}">`)})}),Object.entries(S).filter(([D,T])=>T.length>1).map(([D,T])=>{const q=T.filter(K=>T.some(F=>dp(K,F,u)));return[Number(D),q]}).map(([D,T])=>{T.sort((K,F)=>K<F?-1:1);const q=[];for(const K of T){const F=q.find(W=>W.some(R=>dp(K,R,u)));F?F.push(K):q.push([K])}return[D,q.map(K=>[K[0],K[K.length-1]])]}).forEach(([D,T])=>{T.forEach(([q,K])=>{s.push(gr`<line x1="${D}" x2="${D}" y1="${q}" y2="${K}" stroke="${i}" stroke-width="${u/(qy/2)}" stroke-linecap="round">`)})}),s}},NL=zt`@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 TL=Object.defineProperty,LL=Object.getOwnPropertyDescriptor,Ic=(t,e,r,i)=>{for(var n=i>1?void 0:i?LL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&TL(e,r,n),n};let ks=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 t=lo.state.themeMode==="light"?this.size:this.size-36;return gr`<svg height="${t}" width="${t}">${RL.generate(this.uri,t,t/4)}</svg>`}render(){const t={"wcm-dark":lo.state.themeMode==="dark"};return Ie`<div style="${`width: ${this.size}px`}" class="${Fs(t)}">${this.walletId||this.imageUrl?Ie`<wcm-wallet-image walletId="${li(this.walletId)}" imageId="${li(this.imageId)}" imageUrl="${li(this.imageUrl)}"></wcm-wallet-image>`:Wt.WALLET_CONNECT_ICON_COLORED} ${this.svgTemplate()}</div>`}};ks.styles=[Bt.globalCss,NL],Ic([At()],ks.prototype,"uri",2),Ic([At({type:Number})],ks.prototype,"size",2),Ic([At()],ks.prototype,"imageId",2),Ic([At()],ks.prototype,"walletId",2),Ic([At()],ks.prototype,"imageUrl",2),ks=Ic([kt("wcm-qrcode")],ks);const BL=zt`: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 FL=Object.defineProperty,UL=Object.getOwnPropertyDescriptor,jy=(t,e,r,i)=>{for(var n=i>1?void 0:i?UL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&FL(e,r,n),n};let ul=class extends Ct{constructor(){super(...arguments),this.onChange=()=>null}render(){return Ie`<input type="text" @input="${this.onChange}" placeholder="Search wallets"> ${Wt.SEARCH_ICON}`}};ul.styles=[Bt.globalCss,BL],jy([At()],ul.prototype,"onChange",2),ul=jy([kt("wcm-search-input")],ul);const kL=zt`@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 qL=Object.defineProperty,jL=Object.getOwnPropertyDescriptor,zL=(t,e,r,i)=>{for(var n=i>1?void 0:i?jL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&qL(e,r,n),n};let pp=class extends Ct{render(){return Ie`<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>`}};pp.styles=[Bt.globalCss,kL],pp=zL([kt("wcm-spinner")],pp);const HL=zt`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 KL=Object.defineProperty,WL=Object.getOwnPropertyDescriptor,gp=(t,e,r,i)=>{for(var n=i>1?void 0:i?WL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&KL(e,r,n),n};let rf=class extends Ct{constructor(){super(...arguments),this.variant="medium-regular",this.color="primary"}render(){const t={"wcm-big-bold":this.variant==="big-bold","wcm-medium-regular":this.variant==="medium-regular","wcm-small-regular":this.variant==="small-regular","wcm-small-thin":this.variant==="small-thin","wcm-xsmall-regular":this.variant==="xsmall-regular","wcm-xsmall-bold":this.variant==="xsmall-bold","wcm-color-primary":this.color==="primary","wcm-color-secondary":this.color==="secondary","wcm-color-tertiary":this.color==="tertiary","wcm-color-inverse":this.color==="inverse","wcm-color-accnt":this.color==="accent","wcm-color-error":this.color==="error"};return Ie`<span><slot class="${Fs(t)}"></slot></span>`}};rf.styles=[Bt.globalCss,HL],gp([At()],rf.prototype,"variant",2),gp([At()],rf.prototype,"color",2),rf=gp([kt("wcm-text")],rf);const VL=zt`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 GL=Object.defineProperty,JL=Object.getOwnPropertyDescriptor,wo=(t,e,r,i)=>{for(var n=i>1?void 0:i?JL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&GL(e,r,n),n};let ys=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?Ie`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">RECENT</wcm-text>`:this.installed?Ie`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">INSTALLED</wcm-text>`:null}handleClick(){S6.click({name:"WALLET_BUTTON",walletId:this.walletId}),this.onClick()}render(){var t;return Ie`<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">${(t=this.label)!=null?t:dt.getWalletName(this.name,!0)}</wcm-text>${this.sublabelTemplate()}</div></button>`}};ys.styles=[Bt.globalCss,VL],wo([At()],ys.prototype,"onClick",2),wo([At()],ys.prototype,"name",2),wo([At()],ys.prototype,"walletId",2),wo([At()],ys.prototype,"label",2),wo([At()],ys.prototype,"imageId",2),wo([At({type:Boolean})],ys.prototype,"installed",2),wo([At({type:Boolean})],ys.prototype,"recent",2),ys=wo([kt("wcm-wallet-button")],ys);const YL=zt`: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 QL=Object.defineProperty,ZL=Object.getOwnPropertyDescriptor,fl=(t,e,r,i)=>{for(var n=i>1?void 0:i?ZL(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&QL(e,r,n),n};let Mc=class extends Ct{constructor(){super(...arguments),this.walletId="",this.imageId=void 0,this.imageUrl=void 0}render(){var t;const e=(t=this.imageUrl)!=null&&t.length?this.imageUrl:dt.getWalletIcon({id:this.walletId,image_id:this.imageId});return Ie`${e.length?Ie`<div><img crossorigin="anonymous" src="${e}" alt="${this.id}"></div>`:Wt.WALLET_PLACEHOLDER}`}};Mc.styles=[Bt.globalCss,YL],fl([At()],Mc.prototype,"walletId",2),fl([At()],Mc.prototype,"imageId",2),fl([At()],Mc.prototype,"imageUrl",2),Mc=fl([kt("wcm-wallet-image")],Mc);var XL=Object.defineProperty,eB=Object.getOwnPropertyDescriptor,zy=(t,e,r,i)=>{for(var n=i>1?void 0:i?eB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&XL(e,r,n),n};let vp=class extends Ct{constructor(){super(),this.preload=!0,this.preloadData()}async loadImages(t){try{t!=null&&t.length&&await Promise.all(t.map(async e=>dt.preloadImage(e)))}catch{console.info("Unsuccessful attempt at preloading some images",t)}}async preloadListings(){if(ki.state.enableExplorer){await xi.getRecomendedWallets(),wr.setIsDataLoaded(!0);const{recomendedWallets:t}=xi.state,e=t.map(r=>dt.getWalletIcon(r));await this.loadImages(e)}else wr.setIsDataLoaded(!0)}async preloadCustomImages(){const t=dt.getCustomImageUrls();await this.loadImages(t)}async preloadData(){try{this.preload&&(this.preload=!1,await Promise.all([this.preloadListings(),this.preloadCustomImages()]))}catch(t){console.error(t),po.openToast("Failed preloading","error")}}};zy([Si()],vp.prototype,"preload",2),vp=zy([kt("wcm-explorer-context")],vp);var tB=Object.defineProperty,rB=Object.getOwnPropertyDescriptor,iB=(t,e,r,i)=>{for(var n=i>1?void 0:i?rB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&tB(e,r,n),n};let Hy=class extends Ct{constructor(){super(),this.unsubscribeTheme=void 0,Bt.setTheme(),this.unsubscribeTheme=lo.subscribe(Bt.setTheme)}disconnectedCallback(){var t;(t=this.unsubscribeTheme)==null||t.call(this)}};Hy=iB([kt("wcm-theme-context")],Hy);const nB=zt`@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 sB=Object.defineProperty,oB=Object.getOwnPropertyDescriptor,aB=(t,e,r,i)=>{for(var n=i>1?void 0:i?oB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&sB(e,r,n),n};let mp=class extends Ct{onGoToQrcode(){fr.push("Qrcode")}render(){const{recomendedWallets:t}=xi.state,e=[...t,...t],r=Qe.RECOMMENDED_WALLET_AMOUNT*2;return Ie`<wcm-modal-header title="Connect your wallet" .onAction="${this.onGoToQrcode}" .actionIcon="${Wt.QRCODE_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-title">${Wt.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">WalletConnect</wcm-text></div><div class="wcm-slider"><div class="wcm-track">${[...Array(r)].map((i,n)=>{const s=e[n%e.length];return s?Ie`<wcm-wallet-image walletId="${s.id}" imageId="${s.image_id}"></wcm-wallet-image>`:Wt.WALLET_PLACEHOLDER})}</div><wcm-button-big @click="${dt.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>`}};mp.styles=[Bt.globalCss,nB],mp=aB([kt("wcm-android-wallet-selection")],mp);const cB=zt`@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 uB=Object.defineProperty,fB=Object.getOwnPropertyDescriptor,Cc=(t,e,r,i)=>{for(var n=i>1?void 0:i?fB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&uB(e,r,n),n};let _o=class extends Ct{constructor(){super(...arguments),this.walletId=void 0,this.imageId=void 0,this.isError=!1,this.isStale=!1,this.label=""}svgLoaderTemplate(){var t,e;const r=(e=(t=lo.state.themeVariables)==null?void 0:t["--wcm-wallet-icon-large-border-radius"])!=null?e:Bt.getPreset("--wcm-wallet-icon-large-border-radius");let i=0;r.includes("%")?i=88/100*parseInt(r,10):i=parseInt(r,10),i*=1.17;const n=317-i*1.57,s=425-i*1.8;return Ie`<svg viewBox="0 0 110 110" width="110" height="110"><rect id="wcm-loader" x="2" y="2" width="106" height="106" rx="${i}"/><use xlink:href="#wcm-loader" stroke-dasharray="106 ${n}" stroke-dashoffset="${s}"></use></svg>`}render(){const t={"wcm-error":this.isError,"wcm-stale":this.isStale};return Ie`<div class="${Fs(t)}">${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>`}};_o.styles=[Bt.globalCss,cB],Cc([At()],_o.prototype,"walletId",2),Cc([At()],_o.prototype,"imageId",2),Cc([At({type:Boolean})],_o.prototype,"isError",2),Cc([At({type:Boolean})],_o.prototype,"isStale",2),Cc([At()],_o.prototype,"label",2),_o=Cc([kt("wcm-connector-waiting")],_o);const Dc={manualWallets(){var t,e;const{mobileWallets:r,desktopWallets:i}=ki.state,n=(t=Dc.recentWallet())==null?void 0:t.id,s=Qe.isMobile()?r:i,a=s?.filter(u=>n!==u.id);return(e=Qe.isMobile()?a?.map(({id:u,name:h,links:l})=>({id:u,name:h,mobile:l,links:l})):a?.map(({id:u,name:h,links:l})=>({id:u,name:h,desktop:l,links:l})))!=null?e:[]},recentWallet(){return dt.getRecentWallet()},recomendedWallets(t=!1){var e;const r=t||(e=Dc.recentWallet())==null?void 0:e.id,{recomendedWallets:i}=xi.state;return i.filter(n=>r!==n.id)}},Eo={onConnecting(t){dt.goToConnectingView(t)},manualWalletsTemplate(){return Dc.manualWallets().map(t=>Ie`<wcm-wallet-button walletId="${t.id}" name="${t.name}" .onClick="${()=>this.onConnecting(t)}"></wcm-wallet-button>`)},recomendedWalletsTemplate(t=!1){return Dc.recomendedWallets(t).map(e=>Ie`<wcm-wallet-button name="${e.name}" walletId="${e.id}" imageId="${e.image_id}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`)},recentWalletTemplate(){const t=Dc.recentWallet();if(t)return Ie`<wcm-wallet-button name="${t.name}" walletId="${t.id}" imageId="${li(t.image_id)}" .recent="${!0}" .onClick="${()=>this.onConnecting(t)}"></wcm-wallet-button>`}},hB=zt`.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 lB=Object.defineProperty,dB=Object.getOwnPropertyDescriptor,pB=(t,e,r,i)=>{for(var n=i>1?void 0:i?dB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&lB(e,r,n),n};let bp=class extends Ct{render(){const{explorerExcludedWalletIds:t,enableExplorer:e}=ki.state,r=t!=="ALL"&&e,i=Eo.manualWalletsTemplate(),n=Eo.recomendedWalletsTemplate();let s=[Eo.recentWalletTemplate(),...i,...n];s=s.filter(Boolean);const a=s.length>4||r;let u=[];a?u=s.slice(0,3):u=s;const h=!!u.length;return Ie`<wcm-modal-header .border="${!0}" title="Connect your wallet" .onAction="${dt.handleUriCopy}" .actionIcon="${Wt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-mobile-title"><div class="wcm-subtitle">${Wt.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">Mobile</wcm-text></div><div class="wcm-subtitle">${Wt.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>${h?Ie`<wcm-modal-footer><div class="wcm-desktop-title">${Wt.DESKTOP_ICON}<wcm-text variant="small-regular" color="accent">Desktop</wcm-text></div><div class="wcm-grid">${u} ${a?Ie`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-footer>`:null}`}};bp.styles=[Bt.globalCss,hB],bp=pB([kt("wcm-desktop-wallet-selection")],bp);const gB=zt`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 vB=Object.defineProperty,mB=Object.getOwnPropertyDescriptor,bB=(t,e,r,i)=>{for(var n=i>1?void 0:i?mB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&vB(e,r,n),n};let yp=class extends Ct{render(){const{termsOfServiceUrl:t,privacyPolicyUrl:e}=ki.state;return t??e?Ie`<div><wcm-text variant="small-regular" color="secondary">By connecting your wallet to this app, you agree to the app's ${t?Ie`<a href="${t}" target="_blank" rel="noopener noreferrer">Terms of Service</a>`:null} ${t&&e?"and":null} ${e?Ie`<a href="${e}" target="_blank" rel="noopener noreferrer">Privacy Policy</a>`:null}</wcm-text></div>`:null}};yp.styles=[Bt.globalCss,gB],yp=bB([kt("wcm-legal-notice")],yp);const yB=zt`div{display:grid;grid-template-columns:repeat(4,80px);margin:0 -10px;justify-content:space-between;row-gap:10px}`;var wB=Object.defineProperty,_B=Object.getOwnPropertyDescriptor,EB=(t,e,r,i)=>{for(var n=i>1?void 0:i?_B(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&wB(e,r,n),n};let wp=class extends Ct{onQrcode(){fr.push("Qrcode")}render(){const{explorerExcludedWalletIds:t,enableExplorer:e}=ki.state,r=t!=="ALL"&&e,i=Eo.manualWalletsTemplate(),n=Eo.recomendedWalletsTemplate();let s=[Eo.recentWalletTemplate(),...i,...n];s=s.filter(Boolean);const a=s.length>8||r;let u=[];a?u=s.slice(0,7):u=s;const h=!!u.length;return Ie`<wcm-modal-header title="Connect your wallet" .onAction="${this.onQrcode}" .actionIcon="${Wt.QRCODE_ICON}"></wcm-modal-header>${h?Ie`<wcm-modal-content><div>${u} ${a?Ie`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-content>`:null}`}};wp.styles=[Bt.globalCss,yB],wp=EB([kt("wcm-mobile-wallet-selection")],wp);const AB=zt`: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 xB=Object.defineProperty,SB=Object.getOwnPropertyDescriptor,_p=(t,e,r,i)=>{for(var n=i>1?void 0:i?SB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&xB(e,r,n),n};let Oc=class extends Ct{constructor(){super(),this.open=!1,this.active=!1,this.unsubscribeModal=void 0,this.abortController=void 0,this.unsubscribeModal=sa.subscribe(t=>{t.open?this.onOpenModalEvent():this.onCloseModalEvent()})}disconnectedCallback(){var t;(t=this.unsubscribeModal)==null||t.call(this)}get overlayEl(){return dt.getShadowRootElement(this,".wcm-overlay")}get containerEl(){return dt.getShadowRootElement(this,".wcm-container")}toggleBodyScroll(t){document.querySelector("body")&&(t?document.getElementById("wcm-styles")?.remove():document.head.insertAdjacentHTML("beforeend",'<style id="wcm-styles">html,body{touch-action:none;overflow:hidden;overscroll-behavior:contain;}</style>'))}onCloseModal(t){t.target===t.currentTarget&&sa.close()}onOpenModalEvent(){this.toggleBodyScroll(!1),this.addKeyboardEvents(),this.open=!0,setTimeout(async()=>{const t=dt.isMobileAnimation()?{y:["50vh","0vh"]}:{scale:[.98,1]},e=.1,r=.2;await Promise.all([la(this.overlayEl,{opacity:[0,1]},{delay:e,duration:r}).finished,la(this.containerEl,t,{delay:e,duration:r}).finished]),this.active=!0},0)}async onCloseModalEvent(){this.toggleBodyScroll(!0),this.removeKeyboardEvents();const t=dt.isMobileAnimation()?{y:["0vh","50vh"]}:{scale:[1,.98]},e=.2;await Promise.all([la(this.overlayEl,{opacity:[1,0]},{duration:e}).finished,la(this.containerEl,t,{duration:e}).finished]),this.containerEl.removeAttribute("style"),this.active=!1,this.open=!1}addKeyboardEvents(){this.abortController=new AbortController,window.addEventListener("keydown",t=>{var e;t.key==="Escape"?sa.close():t.key==="Tab"&&((e=t.target)!=null&&e.tagName.includes("wcm-")||this.containerEl.focus())},this.abortController),this.containerEl.focus()}removeKeyboardEvents(){var t;(t=this.abortController)==null||t.abort(),this.abortController=void 0}render(){const t={"wcm-overlay":!0,"wcm-active":this.active};return Ie`<wcm-explorer-context></wcm-explorer-context><wcm-theme-context></wcm-theme-context><div id="wcm-modal" class="${Fs(t)}" @click="${this.onCloseModal}" role="alertdialog" aria-modal="true"><div class="wcm-container" tabindex="0">${this.open?Ie`<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>`}};Oc.styles=[Bt.globalCss,AB],_p([Si()],Oc.prototype,"open",2),_p([Si()],Oc.prototype,"active",2),Oc=_p([kt("wcm-modal")],Oc);const IB=zt`div{display:flex;margin-top:15px}slot{display:inline-block;margin:0 5px}wcm-button{margin:0 5px}`;var MB=Object.defineProperty,CB=Object.getOwnPropertyDescriptor,nf=(t,e,r,i)=>{for(var n=i>1?void 0:i?CB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&MB(e,r,n),n};let pa=class extends Ct{constructor(){super(...arguments),this.isMobile=!1,this.isDesktop=!1,this.isWeb=!1,this.isRetry=!1}onMobile(){Qe.isMobile()?fr.replace("MobileConnecting"):fr.replace("MobileQrcodeConnecting")}onDesktop(){fr.replace("DesktopConnecting")}onWeb(){fr.replace("WebConnecting")}render(){return Ie`<div>${this.isRetry?Ie`<slot></slot>`:null} ${this.isMobile?Ie`<wcm-button .onClick="${this.onMobile}" .iconLeft="${Wt.MOBILE_ICON}" variant="outline">Mobile</wcm-button>`:null} ${this.isDesktop?Ie`<wcm-button .onClick="${this.onDesktop}" .iconLeft="${Wt.DESKTOP_ICON}" variant="outline">Desktop</wcm-button>`:null} ${this.isWeb?Ie`<wcm-button .onClick="${this.onWeb}" .iconLeft="${Wt.GLOBE_ICON}" variant="outline">Web</wcm-button>`:null}</div>`}};pa.styles=[Bt.globalCss,IB],nf([At({type:Boolean})],pa.prototype,"isMobile",2),nf([At({type:Boolean})],pa.prototype,"isDesktop",2),nf([At({type:Boolean})],pa.prototype,"isWeb",2),nf([At({type:Boolean})],pa.prototype,"isRetry",2),pa=nf([kt("wcm-platform-selection")],pa);const DB=zt`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 OB=Object.defineProperty,PB=Object.getOwnPropertyDescriptor,$B=(t,e,r,i)=>{for(var n=i>1?void 0:i?PB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&OB(e,r,n),n};let Ep=class extends Ct{onClick(){fr.push("WalletExplorer")}render(){const{recomendedWallets:t}=xi.state,e=Dc.manualWallets(),r=[...t,...e].reverse().slice(0,4);return Ie`<button @click="${this.onClick}"><div class="wcm-icons">${r.map(i=>{const n=dt.getWalletIcon(i);if(n)return Ie`<img crossorigin="anonymous" src="${n}">`;const s=dt.getWalletIcon({id:i.id});return s?Ie`<img crossorigin="anonymous" src="${s}">`:Wt.WALLET_PLACEHOLDER})} ${[...Array(4-r.length)].map(()=>Wt.WALLET_PLACEHOLDER)}</div><wcm-text variant="xsmall-regular">View All</wcm-text></button>`}};Ep.styles=[Bt.globalCss,DB],Ep=$B([kt("wcm-view-all-wallets-button")],Ep);const RB=zt`.wcm-qr-container{width:100%;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1}`;var NB=Object.defineProperty,TB=Object.getOwnPropertyDescriptor,hl=(t,e,r,i)=>{for(var n=i>1?void 0:i?TB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&NB(e,r,n),n};let Pc=class extends Ct{constructor(){super(),this.walletId="",this.imageId="",this.uri="",setTimeout(()=>{const{walletConnectUri:t}=wr.state;this.uri=t},0)}get overlayEl(){return dt.getShadowRootElement(this,".wcm-qr-container")}render(){return Ie`<div class="wcm-qr-container">${this.uri?Ie`<wcm-qrcode size="${this.overlayEl.offsetWidth}" uri="${this.uri}" walletId="${li(this.walletId)}" imageId="${li(this.imageId)}"></wcm-qrcode>`:Ie`<wcm-spinner></wcm-spinner>`}</div>`}};Pc.styles=[Bt.globalCss,RB],hl([At()],Pc.prototype,"walletId",2),hl([At()],Pc.prototype,"imageId",2),hl([Si()],Pc.prototype,"uri",2),Pc=hl([kt("wcm-walletconnect-qr")],Pc);var LB=Object.defineProperty,BB=Object.getOwnPropertyDescriptor,FB=(t,e,r,i)=>{for(var n=i>1?void 0:i?BB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&LB(e,r,n),n};let Ap=class extends Ct{viewTemplate(){return Qe.isAndroid()?Ie`<wcm-android-wallet-selection></wcm-android-wallet-selection>`:Qe.isMobile()?Ie`<wcm-mobile-wallet-selection></wcm-mobile-wallet-selection>`:Ie`<wcm-desktop-wallet-selection></wcm-desktop-wallet-selection>`}render(){return Ie`${this.viewTemplate()}<wcm-legal-notice></wcm-legal-notice>`}};Ap.styles=[Bt.globalCss],Ap=FB([kt("wcm-connect-wallet-view")],Ap);const UB=zt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var kB=Object.defineProperty,qB=Object.getOwnPropertyDescriptor,Ky=(t,e,r,i)=>{for(var n=i>1?void 0:i?qB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&kB(e,r,n),n};let ll=class extends Ct{constructor(){super(),this.isError=!1,this.openDesktopApp()}onFormatAndRedirect(t){const{desktop:e,name:r}=Qe.getWalletRouterData(),i=e?.native;if(i){const n=Qe.formatNativeUrl(i,t,r);Qe.openHref(n,"_self")}}openDesktopApp(){const{walletConnectUri:t}=wr.state,e=Qe.getWalletRouterData();dt.setRecentWallet(e),t&&this.onFormatAndRedirect(t)}render(){const{name:t,id:e,image_id:r}=Qe.getWalletRouterData(),{isMobile:i,isWeb:n}=dt.getCachedRouterWalletPlatforms();return Ie`<wcm-modal-header title="${t}" .onAction="${dt.handleUriCopy}" .actionIcon="${Wt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${li(r)}" label="${`Continue in ${t}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Connection can continue loading if ${t} is not installed on your device`}</wcm-text><wcm-platform-selection .isMobile="${i}" .isWeb="${n}" .isRetry="${!0}"><wcm-button .onClick="${this.openDesktopApp.bind(this)}" .iconRight="${Wt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};ll.styles=[Bt.globalCss,UB],Ky([Si()],ll.prototype,"isError",2),ll=Ky([kt("wcm-desktop-connecting-view")],ll);const jB=zt`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 zB=Object.defineProperty,HB=Object.getOwnPropertyDescriptor,KB=(t,e,r,i)=>{for(var n=i>1?void 0:i?HB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&zB(e,r,n),n};let xp=class extends Ct{onInstall(t){t&&Qe.openHref(t,"_blank")}render(){const{name:t,id:e,image_id:r,homepage:i}=Qe.getWalletRouterData();return Ie`<wcm-modal-header title="${t}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${li(r)}" label="Not Detected" .isStale="${!0}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Download ${t} to continue. If multiple browser extensions are installed, disable non ${t} ones and try again`}</wcm-text><wcm-button .onClick="${()=>this.onInstall(i)}" .iconLeft="${Wt.ARROW_DOWN_ICON}">Download</wcm-button></wcm-info-footer>`}};xp.styles=[Bt.globalCss,jB],xp=KB([kt("wcm-install-wallet-view")],xp);const WB=zt`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 VB=Object.defineProperty,GB=Object.getOwnPropertyDescriptor,Wy=(t,e,r,i)=>{for(var n=i>1?void 0:i?GB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&VB(e,r,n),n};let dl=class extends Ct{constructor(){super(),this.isError=!1,this.openMobileApp()}onFormatAndRedirect(t,e=!1){const{mobile:r,name:i}=Qe.getWalletRouterData(),n=r?.native,s=r?.universal;if(n&&!e){const a=Qe.formatNativeUrl(n,t,i);Qe.openHref(a,"_self")}else if(s){const a=Qe.formatUniversalUrl(s,t,i);Qe.openHref(a,"_self")}}openMobileApp(t=!1){const{walletConnectUri:e}=wr.state,r=Qe.getWalletRouterData();dt.setRecentWallet(r),e&&this.onFormatAndRedirect(e,t)}onGoToAppStore(t){t&&Qe.openHref(t,"_blank")}render(){const{name:t,id:e,image_id:r,app:i,mobile:n}=Qe.getWalletRouterData(),{isWeb:s}=dt.getCachedRouterWalletPlatforms(),a=i?.ios,u=n?.universal;return Ie`<wcm-modal-header title="${t}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${li(r)}" label="Tap 'Open' to continue…" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer class="wcm-note"><wcm-platform-selection .isWeb="${s}" .isRetry="${!0}"><wcm-button .onClick="${()=>this.openMobileApp(!1)}" .iconRight="${Wt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection>${u?Ie`<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(r)}"></wcm-wallet-image><wcm-text>${`Get ${t}`}</wcm-text></div><wcm-button .iconRight="${Wt.ARROW_RIGHT_ICON}" .onClick="${()=>this.onGoToAppStore(a)}" variant="ghost">App Store</wcm-button></wcm-info-footer>`}};dl.styles=[Bt.globalCss,WB],Wy([Si()],dl.prototype,"isError",2),dl=Wy([kt("wcm-mobile-connecting-view")],dl);const JB=zt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var YB=Object.defineProperty,QB=Object.getOwnPropertyDescriptor,ZB=(t,e,r,i)=>{for(var n=i>1?void 0:i?QB(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&YB(e,r,n),n};let Sp=class extends Ct{render(){const{name:t,id:e,image_id:r}=Qe.getWalletRouterData(),{isDesktop:i,isWeb:n}=dt.getCachedRouterWalletPlatforms();return Ie`<wcm-modal-header title="${t}" .onAction="${dt.handleUriCopy}" .actionIcon="${Wt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr walletId="${e}" imageId="${li(r)}"></wcm-walletconnect-qr></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Scan this QR Code with your phone's camera or inside ${t} app`}</wcm-text><wcm-platform-selection .isDesktop="${i}" .isWeb="${n}"></wcm-platform-selection></wcm-info-footer>`}};Sp.styles=[Bt.globalCss,JB],Sp=ZB([kt("wcm-mobile-qr-connecting-view")],Sp);var XB=Object.defineProperty,eF=Object.getOwnPropertyDescriptor,tF=(t,e,r,i)=>{for(var n=i>1?void 0:i?eF(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&XB(e,r,n),n};let Ip=class extends Ct{render(){return Ie`<wcm-modal-header title="Scan the code" .onAction="${dt.handleUriCopy}" .actionIcon="${Wt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>`}};Ip.styles=[Bt.globalCss],Ip=tF([kt("wcm-qrcode-view")],Ip);const rF=zt`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 iF=Object.defineProperty,nF=Object.getOwnPropertyDescriptor,sf=(t,e,r,i)=>{for(var n=i>1?void 0:i?nF(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&iF(e,r,n),n};const Mp=40;let ga=class extends Ct{constructor(){super(...arguments),this.loading=!xi.state.wallets.listings.length,this.firstFetch=!xi.state.wallets.listings.length,this.search="",this.endReached=!1,this.intersectionObserver=void 0,this.searchDebounce=dt.debounce(t=>{t.length>=1?(this.firstFetch=!0,this.endReached=!1,this.search=t,xi.resetSearch(),this.fetchWallets()):this.search&&(this.search="",this.endReached=this.isLastPage(),xi.resetSearch())})}firstUpdated(){this.createPaginationObserver()}disconnectedCallback(){var t;(t=this.intersectionObserver)==null||t.disconnect()}get placeholderEl(){return dt.getShadowRootElement(this,".wcm-placeholder-block")}createPaginationObserver(){this.intersectionObserver=new IntersectionObserver(([t])=>{t.isIntersecting&&!(this.search&&this.firstFetch)&&this.fetchWallets()}),this.intersectionObserver.observe(this.placeholderEl)}isLastPage(){const{wallets:t,search:e}=xi.state,{listings:r,total:i}=this.search?e:t;return i<=Mp||r.length>=i}async fetchWallets(){var t;const{wallets:e,search:r}=xi.state,{listings:i,total:n,page:s}=this.search?r:e;if(!this.endReached&&(this.firstFetch||n>Mp&&i.length<n))try{this.loading=!0;const a=(t=wr.state.chains)==null?void 0:t.join(","),{listings:u}=await xi.getWallets({page:this.firstFetch?1:s+1,entries:Mp,search:this.search,version:2,chains:a}),h=u.map(l=>dt.getWalletIcon(l));await Promise.all([...h.map(async l=>dt.preloadImage(l)),Qe.wait(300)]),this.endReached=this.isLastPage()}catch(a){console.error(a),po.openToast(dt.getErrorMessage(a),"error")}finally{this.loading=!1,this.firstFetch=!1}}onConnect(t){Qe.isAndroid()?dt.handleMobileLinking(t):dt.goToConnectingView(t)}onSearchChange(t){const{value:e}=t.target;this.searchDebounce(e)}render(){const{wallets:t,search:e}=xi.state,{listings:r}=this.search?e:t,i=this.loading&&!r.length,n=this.search.length>=3;let s=Eo.manualWalletsTemplate(),a=Eo.recomendedWalletsTemplate(!0);n&&(s=s.filter(({values:l})=>dt.caseSafeIncludes(l[0],this.search)),a=a.filter(({values:l})=>dt.caseSafeIncludes(l[0],this.search)));const u=!this.loading&&!r.length&&!a.length,h={"wcm-loading":i,"wcm-end-reached":this.endReached||!this.loading,"wcm-empty":u};return Ie`<wcm-modal-header><wcm-search-input .onChange="${this.onSearchChange.bind(this)}"></wcm-search-input></wcm-modal-header><wcm-modal-content class="${Fs(h)}"><div class="wcm-grid">${i?null:s} ${i?null:a} ${i?null:r.map(l=>Ie`${l?Ie`<wcm-wallet-button imageId="${l.image_id}" name="${l.name}" walletId="${l.id}" .onClick="${()=>this.onConnect(l)}"></wcm-wallet-button>`:null}`)}</div><div class="wcm-placeholder-block">${u?Ie`<wcm-text variant="big-bold" color="secondary">No results found</wcm-text>`:null} ${!u&&this.loading?Ie`<wcm-spinner></wcm-spinner>`:null}</div></wcm-modal-content>`}};ga.styles=[Bt.globalCss,rF],sf([Si()],ga.prototype,"loading",2),sf([Si()],ga.prototype,"firstFetch",2),sf([Si()],ga.prototype,"search",2),sf([Si()],ga.prototype,"endReached",2),ga=sf([kt("wcm-wallet-explorer-view")],ga);const sF=zt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var oF=Object.defineProperty,aF=Object.getOwnPropertyDescriptor,Vy=(t,e,r,i)=>{for(var n=i>1?void 0:i?aF(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(i?a(e,r,n):a(n))||n);return i&&n&&oF(e,r,n),n};let pl=class extends Ct{constructor(){super(),this.isError=!1,this.openWebWallet()}onFormatAndRedirect(t){const{desktop:e,name:r}=Qe.getWalletRouterData(),i=e?.universal;if(i){const n=Qe.formatUniversalUrl(i,t,r);Qe.openHref(n,"_blank")}}openWebWallet(){const{walletConnectUri:t}=wr.state,e=Qe.getWalletRouterData();dt.setRecentWallet(e),t&&this.onFormatAndRedirect(t)}render(){const{name:t,id:e,image_id:r}=Qe.getWalletRouterData(),{isMobile:i,isDesktop:n}=dt.getCachedRouterWalletPlatforms(),s=Qe.isMobile();return Ie`<wcm-modal-header title="${t}" .onAction="${dt.handleUriCopy}" .actionIcon="${Wt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${li(r)}" label="${`Continue in ${t}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`${t} web app has opened in a new tab. Go there, accept the connection, and come back`}</wcm-text><wcm-platform-selection .isMobile="${i}" .isDesktop="${s?!1:n}" .isRetry="${!0}"><wcm-button .onClick="${this.openWebWallet.bind(this)}" .iconRight="${Wt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};pl.styles=[Bt.globalCss,sF],Vy([Si()],pl.prototype,"isError",2),pl=Vy([kt("wcm-web-connecting-view")],pl);var cF=Object.freeze({__proto__:null,get WcmModal(){return Oc},get WcmQrCode(){return ks}});mn.EthereumProvider=$R,mn.OPTIONAL_EVENTS=w6,mn.OPTIONAL_METHODS=y6,mn.REQUIRED_EVENTS=Uh,mn.REQUIRED_METHODS=Fh,mn.default=jh,Object.defineProperty(mn,"__esModule",{value:!0})});
123
123
  //# sourceMappingURL=index.umd.js.map