@dcl/vesting-dashboard 3.5.1 → 3.5.2-14671134199.commit-a8bba8d
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/assets/{fortmatic-c3020796.js → fortmatic-ace6f38a.js} +1 -1
- package/assets/index-0e9d1da0.js +1069 -0
- package/assets/index-133cb7bf.js +1 -0
- package/assets/{index-5e7ee73d.js → index-9ed30a77.js} +5 -5
- package/assets/index-aea9b88e.js +5 -0
- package/assets/{index-a0af7e8f.css → index-ba83088b.css} +7 -7
- package/assets/index-fb5ebb1f.js +1 -0
- package/assets/index.es-a7ed056e.js +4850 -0
- package/assets/man-default1-6c97f8cc.png +0 -0
- package/assets/secp256k1-1698c990.js +1 -0
- package/index.html +4 -4
- package/package.json +3 -3
- package/assets/index-09f330a8.js +0 -1
- package/assets/index-2be79e9f.js +0 -572
- package/assets/index-4e853dd7.js +0 -54
- package/assets/index-5cc94cfd.js +0 -14
- package/assets/index-ea8e4214.js +0 -5
- package/assets/index-eb7b778e.js +0 -1
- package/assets/index.es-0516976f.js +0 -49
- /package/assets/{man-default-5d829f5a.png → 805322223c96be40-5d829f5a.png} +0 -0
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import{t as dh,k as Jw,c as Yw,p as Di,g as Xw,a as Zw,r as Qw,b as e2,d as _r,m as t2,u as r2,i as ru,h as qp,e as Up,f as i2,j as Fe,B as Ai,l as n2,n as ui,o as Bp,q as iu,s as Il,_ as s2}from"./index-2be79e9f.js";const a2=`Ethereum Signed Message:
|
|
2
|
-
`;function zp(r){return typeof r=="string"&&(r=dh(r)),Jw(Yw([dh(a2),dh(String(r.length)),r]))}var Dl=globalThis&&globalThis.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var n=0,s=e.length,o;n<s;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))},o2=function(){function r(e,t,n){this.name=e,this.version=t,this.os=n,this.type="browser"}return r}(),c2=function(){function r(e){this.version=e,this.type="node",this.name="node",this.os=Di.platform}return r}(),f2=function(){function r(e,t,n,s){this.name=e,this.version=t,this.os=n,this.bot=s,this.type="bot-device"}return r}(),h2=function(){function r(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return r}(),u2=function(){function r(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return r}(),d2=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,l2=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Al=3,p2=[["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",d2]],Pl=[["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 g2(r){return r?Ml(r):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new u2:typeof navigator<"u"?Ml(navigator.userAgent):m2()}function b2(r){return r!==""&&p2.reduce(function(e,t){var n=t[0],s=t[1];if(e)return e;var o=s.exec(r);return!!o&&[n,o]},!1)}function Ml(r){var e=b2(r);if(!e)return null;var t=e[0],n=e[1];if(t==="searchbot")return new h2;var s=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);s?s.length<Al&&(s=Dl(Dl([],s,!0),y2(Al-s.length),!0)):s=[];var o=s.join("."),f=v2(r),h=l2.exec(r);return h&&h[1]?new f2(t,o,f,h[1]):new o2(t,o,f)}function v2(r){for(var e=0,t=Pl.length;e<t;e++){var n=Pl[e],s=n[0],o=n[1],f=o.exec(r);if(f)return s}return null}function m2(){var r=typeof Di<"u"&&Di.version;return r?new c2(Di.version.slice(1)):null}function y2(r){for(var e=[],t=0;t<r;t++)e.push("0");return e}var pe={};/*! *****************************************************************************
|
|
3
|
-
Copyright (c) Microsoft Corporation.
|
|
4
|
-
|
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
purpose with or without fee is hereby granted.
|
|
7
|
-
|
|
8
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */var Lh=function(r,e){return Lh=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var s in n)n.hasOwnProperty(s)&&(t[s]=n[s])},Lh(r,e)};function w2(r,e){Lh(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Fh=function(){return Fh=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Fh.apply(this,arguments)};function _2(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t}function E2(r,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var h=r.length-1;h>=0;h--)(f=r[h])&&(o=(s<3?f(o):s>3?f(e,t,o):f(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o}function S2(r,e){return function(t,n){e(t,n,r)}}function x2(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function I2(r,e,t,n){function s(o){return o instanceof t?o:new t(function(f){f(o)})}return new(t||(t=Promise))(function(o,f){function h(m){try{l(n.next(m))}catch(_){f(_)}}function p(m){try{l(n.throw(m))}catch(_){f(_)}}function l(m){m.done?o(m.value):s(m.value).then(h,p)}l((n=n.apply(r,e||[])).next())})}function D2(r,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,s,o,f;return f={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function h(l){return function(m){return p([l,m])}}function p(l){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,s&&(o=l[0]&2?s.return:l[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,l[1])).done)return o;switch(s=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return t.label++,{value:l[1],done:!1};case 5:t.label++,s=l[1],l=[0];continue;case 7:l=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){t.label=l[1];break}if(l[0]===6&&t.label<o[1]){t.label=o[1],o=l;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(l);break}o[2]&&t.ops.pop(),t.trys.pop();continue}l=e.call(r,t)}catch(m){l=[6,m],s=0}finally{n=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function A2(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}function P2(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function qh(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Hp(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),s,o=[],f;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)o.push(s.value)}catch(h){f={error:h}}finally{try{s&&!s.done&&(t=n.return)&&t.call(n)}finally{if(f)throw f.error}}return o}function M2(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(Hp(arguments[e]));return r}function O2(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var o=arguments[e],f=0,h=o.length;f<h;f++,s++)n[s]=o[f];return n}function Ra(r){return this instanceof Ra?(this.v=r,this):new Ra(r)}function C2(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),s,o=[];return s={},f("next"),f("throw"),f("return"),s[Symbol.asyncIterator]=function(){return this},s;function f(D){n[D]&&(s[D]=function(I){return new Promise(function(M,H){o.push([D,I,M,H])>1||h(D,I)})})}function h(D,I){try{p(n[D](I))}catch(M){_(o[0][3],M)}}function p(D){D.value instanceof Ra?Promise.resolve(D.value.v).then(l,m):_(o[0][2],D)}function l(D){h("next",D)}function m(D){h("throw",D)}function _(D,I){D(I),o.shift(),o.length&&h(o[0][0],o[0][1])}}function R2(r){var e,t;return e={},n("next"),n("throw",function(s){throw s}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(s,o){e[s]=r[s]?function(f){return(t=!t)?{value:Ra(r[s](f)),done:s==="return"}:o?o(f):f}:o}}function T2(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof qh=="function"?qh(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(o){t[o]=r[o]&&function(f){return new Promise(function(h,p){f=r[o](f),s(h,p,f.done,f.value)})}}function s(o,f,h,p){Promise.resolve(p).then(function(l){o({value:l,done:h})},f)}}function N2(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function $2(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function L2(r){return r&&r.__esModule?r:{default:r}}function F2(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function q2(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}const U2=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Fh},__asyncDelegator:R2,__asyncGenerator:C2,__asyncValues:T2,__await:Ra,__awaiter:I2,__classPrivateFieldGet:F2,__classPrivateFieldSet:q2,__createBinding:A2,__decorate:E2,__exportStar:P2,__extends:w2,__generator:D2,__importDefault:L2,__importStar:$2,__makeTemplateObject:N2,__metadata:x2,__param:S2,__read:Hp,__rest:_2,__spread:M2,__spreadArrays:O2,__values:qh},Symbol.toStringTag,{value:"Module"})),Ua=Xw(U2);var lh={},ya={},Ol;function B2(){if(Ol)return ya;Ol=1,Object.defineProperty(ya,"__esModule",{value:!0}),ya.delay=void 0;function r(e){return new Promise(t=>{setTimeout(()=>{t(!0)},e)})}return ya.delay=r,ya}var ts={},ph={},rs={},Cl;function z2(){return Cl||(Cl=1,Object.defineProperty(rs,"__esModule",{value:!0}),rs.ONE_THOUSAND=rs.ONE_HUNDRED=void 0,rs.ONE_HUNDRED=100,rs.ONE_THOUSAND=1e3),rs}var gh={},Rl;function H2(){return Rl||(Rl=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.ONE_YEAR=r.FOUR_WEEKS=r.THREE_WEEKS=r.TWO_WEEKS=r.ONE_WEEK=r.THIRTY_DAYS=r.SEVEN_DAYS=r.FIVE_DAYS=r.THREE_DAYS=r.ONE_DAY=r.TWENTY_FOUR_HOURS=r.TWELVE_HOURS=r.SIX_HOURS=r.THREE_HOURS=r.ONE_HOUR=r.SIXTY_MINUTES=r.THIRTY_MINUTES=r.TEN_MINUTES=r.FIVE_MINUTES=r.ONE_MINUTE=r.SIXTY_SECONDS=r.THIRTY_SECONDS=r.TEN_SECONDS=r.FIVE_SECONDS=r.ONE_SECOND=void 0,r.ONE_SECOND=1,r.FIVE_SECONDS=5,r.TEN_SECONDS=10,r.THIRTY_SECONDS=30,r.SIXTY_SECONDS=60,r.ONE_MINUTE=r.SIXTY_SECONDS,r.FIVE_MINUTES=r.ONE_MINUTE*5,r.TEN_MINUTES=r.ONE_MINUTE*10,r.THIRTY_MINUTES=r.ONE_MINUTE*30,r.SIXTY_MINUTES=r.ONE_MINUTE*60,r.ONE_HOUR=r.SIXTY_MINUTES,r.THREE_HOURS=r.ONE_HOUR*3,r.SIX_HOURS=r.ONE_HOUR*6,r.TWELVE_HOURS=r.ONE_HOUR*12,r.TWENTY_FOUR_HOURS=r.ONE_HOUR*24,r.ONE_DAY=r.TWENTY_FOUR_HOURS,r.THREE_DAYS=r.ONE_DAY*3,r.FIVE_DAYS=r.ONE_DAY*5,r.SEVEN_DAYS=r.ONE_DAY*7,r.THIRTY_DAYS=r.ONE_DAY*30,r.ONE_WEEK=r.SEVEN_DAYS,r.TWO_WEEKS=r.ONE_WEEK*2,r.THREE_WEEKS=r.ONE_WEEK*3,r.FOUR_WEEKS=r.ONE_WEEK*4,r.ONE_YEAR=r.ONE_DAY*365}(gh)),gh}var Tl;function jp(){return Tl||(Tl=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Ua;e.__exportStar(z2(),r),e.__exportStar(H2(),r)}(ph)),ph}var Nl;function j2(){if(Nl)return ts;Nl=1,Object.defineProperty(ts,"__esModule",{value:!0}),ts.fromMiliseconds=ts.toMiliseconds=void 0;const r=jp();function e(n){return n*r.ONE_THOUSAND}ts.toMiliseconds=e;function t(n){return Math.floor(n/r.ONE_THOUSAND)}return ts.fromMiliseconds=t,ts}var $l;function K2(){return $l||($l=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Ua;e.__exportStar(B2(),r),e.__exportStar(j2(),r)}(lh)),lh}var qs={},Ll;function k2(){if(Ll)return qs;Ll=1,Object.defineProperty(qs,"__esModule",{value:!0}),qs.Watch=void 0;class r{constructor(){this.timestamps=new Map}start(t){if(this.timestamps.has(t))throw new Error(`Watch already started for label: ${t}`);this.timestamps.set(t,{started:Date.now()})}stop(t){const n=this.get(t);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${t}`);const s=Date.now()-n.started;this.timestamps.set(t,{started:n.started,elapsed:s})}get(t){const n=this.timestamps.get(t);if(typeof n>"u")throw new Error(`No timestamp found for label: ${t}`);return n}elapsed(t){const n=this.get(t);return n.elapsed||Date.now()-n.started}}return qs.Watch=r,qs.default=r,qs}var bh={},wa={},Fl;function W2(){if(Fl)return wa;Fl=1,Object.defineProperty(wa,"__esModule",{value:!0}),wa.IWatch=void 0;class r{}return wa.IWatch=r,wa}var ql;function V2(){return ql||(ql=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),Ua.__exportStar(W2(),r)}(bh)),bh}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Ua;e.__exportStar(K2(),r),e.__exportStar(k2(),r),e.__exportStar(V2(),r),e.__exportStar(jp(),r)})(pe);var $t={};Object.defineProperty($t,"__esModule",{value:!0});$t.getLocalStorage=$t.getLocalStorageOrThrow=$t.getCrypto=$t.getCryptoOrThrow=Kp=$t.getLocation=$t.getLocationOrThrow=nu=$t.getNavigator=$t.getNavigatorOrThrow=Ba=$t.getDocument=$t.getDocumentOrThrow=$t.getFromWindowOrThrow=$t.getFromWindow=void 0;function ps(r){let e;return typeof window<"u"&&typeof window[r]<"u"&&(e=window[r]),e}$t.getFromWindow=ps;function Gs(r){const e=ps(r);if(!e)throw new Error(`${r} is not defined in Window`);return e}$t.getFromWindowOrThrow=Gs;function G2(){return Gs("document")}$t.getDocumentOrThrow=G2;function J2(){return ps("document")}var Ba=$t.getDocument=J2;function Y2(){return Gs("navigator")}$t.getNavigatorOrThrow=Y2;function X2(){return ps("navigator")}var nu=$t.getNavigator=X2;function Z2(){return Gs("location")}$t.getLocationOrThrow=Z2;function Q2(){return ps("location")}var Kp=$t.getLocation=Q2;function e6(){return Gs("crypto")}$t.getCryptoOrThrow=e6;function t6(){return ps("crypto")}$t.getCrypto=t6;function r6(){return Gs("localStorage")}$t.getLocalStorageOrThrow=r6;function i6(){return ps("localStorage")}$t.getLocalStorage=i6;var su={};Object.defineProperty(su,"__esModule",{value:!0});var kp=su.getWindowMetadata=void 0;const Ul=$t;function n6(){let r,e;try{r=Ul.getDocumentOrThrow(),e=Ul.getLocationOrThrow()}catch{return null}function t(){const _=r.getElementsByTagName("link"),D=[];for(let I=0;I<_.length;I++){const M=_[I],H=M.getAttribute("rel");if(H&&H.toLowerCase().indexOf("icon")>-1){const k=M.getAttribute("href");if(k)if(k.toLowerCase().indexOf("https:")===-1&&k.toLowerCase().indexOf("http:")===-1&&k.indexOf("//")!==0){let X=e.protocol+"//"+e.host;if(k.indexOf("/")===0)X+=k;else{const F=e.pathname.split("/");F.pop();const V=F.join("/");X+=V+"/"+k}D.push(X)}else if(k.indexOf("//")===0){const X=e.protocol+k;D.push(X)}else D.push(k)}}return D}function n(..._){const D=r.getElementsByTagName("meta");for(let I=0;I<D.length;I++){const M=D[I],H=["itemprop","property","name"].map(k=>M.getAttribute(k)).filter(k=>k?_.includes(k):!1);if(H.length&&H){const k=M.getAttribute("content");if(k)return k}}return""}function s(){let _=n("name","og:site_name","og:title","twitter:title");return _||(_=r.title),_}function o(){return n("description","og:description","twitter:description","keywords")}const f=s(),h=o(),p=e.origin,l=t();return{description:h,url:p,icons:l,name:f}}kp=su.getWindowMetadata=n6;var Ta={},s6=r=>encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Wp="%[a-f0-9]{2}",Bl=new RegExp("("+Wp+")|([^%]+?)","gi"),zl=new RegExp("("+Wp+")+","gi");function Uh(r,e){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;e=e||1;var t=r.slice(0,e),n=r.slice(e);return Array.prototype.concat.call([],Uh(t),Uh(n))}function a6(r){try{return decodeURIComponent(r)}catch{for(var e=r.match(Bl)||[],t=1;t<e.length;t++)r=Uh(e,t).join(""),e=r.match(Bl)||[];return r}}function o6(r){for(var e={"%FE%FF":"��","%FF%FE":"��"},t=zl.exec(r);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch{var n=a6(t[0]);n!==t[0]&&(e[t[0]]=n)}t=zl.exec(r)}e["%C2"]="�";for(var s=Object.keys(e),o=0;o<s.length;o++){var f=s[o];r=r.replace(new RegExp(f,"g"),e[f])}return r}var c6=function(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return r=r.replace(/\+/g," "),decodeURIComponent(r)}catch{return o6(r)}},f6=(r,e)=>{if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[r];const t=r.indexOf(e);return t===-1?[r]:[r.slice(0,t),r.slice(t+e.length)]},h6=function(r,e){for(var t={},n=Object.keys(r),s=Array.isArray(e),o=0;o<n.length;o++){var f=n[o],h=r[f];(s?e.indexOf(f)!==-1:e(f,h,r))&&(t[f]=h)}return t};(function(r){const e=s6,t=c6,n=f6,s=h6,o=F=>F==null,f=Symbol("encodeFragmentIdentifier");function h(F){switch(F.arrayFormat){case"index":return V=>($,U)=>{const z=$.length;return U===void 0||F.skipNull&&U===null||F.skipEmptyString&&U===""?$:U===null?[...$,[m(V,F),"[",z,"]"].join("")]:[...$,[m(V,F),"[",m(z,F),"]=",m(U,F)].join("")]};case"bracket":return V=>($,U)=>U===void 0||F.skipNull&&U===null||F.skipEmptyString&&U===""?$:U===null?[...$,[m(V,F),"[]"].join("")]:[...$,[m(V,F),"[]=",m(U,F)].join("")];case"colon-list-separator":return V=>($,U)=>U===void 0||F.skipNull&&U===null||F.skipEmptyString&&U===""?$:U===null?[...$,[m(V,F),":list="].join("")]:[...$,[m(V,F),":list=",m(U,F)].join("")];case"comma":case"separator":case"bracket-separator":{const V=F.arrayFormat==="bracket-separator"?"[]=":"=";return $=>(U,z)=>z===void 0||F.skipNull&&z===null||F.skipEmptyString&&z===""?U:(z=z===null?"":z,U.length===0?[[m($,F),V,m(z,F)].join("")]:[[U,m(z,F)].join(F.arrayFormatSeparator)])}default:return V=>($,U)=>U===void 0||F.skipNull&&U===null||F.skipEmptyString&&U===""?$:U===null?[...$,m(V,F)]:[...$,[m(V,F),"=",m(U,F)].join("")]}}function p(F){let V;switch(F.arrayFormat){case"index":return($,U,z)=>{if(V=/\[(\d*)\]$/.exec($),$=$.replace(/\[\d*\]$/,""),!V){z[$]=U;return}z[$]===void 0&&(z[$]={}),z[$][V[1]]=U};case"bracket":return($,U,z)=>{if(V=/(\[\])$/.exec($),$=$.replace(/\[\]$/,""),!V){z[$]=U;return}if(z[$]===void 0){z[$]=[U];return}z[$]=[].concat(z[$],U)};case"colon-list-separator":return($,U,z)=>{if(V=/(:list)$/.exec($),$=$.replace(/:list$/,""),!V){z[$]=U;return}if(z[$]===void 0){z[$]=[U];return}z[$]=[].concat(z[$],U)};case"comma":case"separator":return($,U,z)=>{const b=typeof U=="string"&&U.includes(F.arrayFormatSeparator),T=typeof U=="string"&&!b&&_(U,F).includes(F.arrayFormatSeparator);U=T?_(U,F):U;const re=b||T?U.split(F.arrayFormatSeparator).map(de=>_(de,F)):U===null?U:_(U,F);z[$]=re};case"bracket-separator":return($,U,z)=>{const b=/(\[\])$/.test($);if($=$.replace(/\[\]$/,""),!b){z[$]=U&&_(U,F);return}const T=U===null?[]:U.split(F.arrayFormatSeparator).map(re=>_(re,F));if(z[$]===void 0){z[$]=T;return}z[$]=[].concat(z[$],T)};default:return($,U,z)=>{if(z[$]===void 0){z[$]=U;return}z[$]=[].concat(z[$],U)}}}function l(F){if(typeof F!="string"||F.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function m(F,V){return V.encode?V.strict?e(F):encodeURIComponent(F):F}function _(F,V){return V.decode?t(F):F}function D(F){return Array.isArray(F)?F.sort():typeof F=="object"?D(Object.keys(F)).sort((V,$)=>Number(V)-Number($)).map(V=>F[V]):F}function I(F){const V=F.indexOf("#");return V!==-1&&(F=F.slice(0,V)),F}function M(F){let V="";const $=F.indexOf("#");return $!==-1&&(V=F.slice($)),V}function H(F){F=I(F);const V=F.indexOf("?");return V===-1?"":F.slice(V+1)}function k(F,V){return V.parseNumbers&&!Number.isNaN(Number(F))&&typeof F=="string"&&F.trim()!==""?F=Number(F):V.parseBooleans&&F!==null&&(F.toLowerCase()==="true"||F.toLowerCase()==="false")&&(F=F.toLowerCase()==="true"),F}function X(F,V){V=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},V),l(V.arrayFormatSeparator);const $=p(V),U=Object.create(null);if(typeof F!="string"||(F=F.trim().replace(/^[?#&]/,""),!F))return U;for(const z of F.split("&")){if(z==="")continue;let[b,T]=n(V.decode?z.replace(/\+/g," "):z,"=");T=T===void 0?null:["comma","separator","bracket-separator"].includes(V.arrayFormat)?T:_(T,V),$(_(b,V),T,U)}for(const z of Object.keys(U)){const b=U[z];if(typeof b=="object"&&b!==null)for(const T of Object.keys(b))b[T]=k(b[T],V);else U[z]=k(b,V)}return V.sort===!1?U:(V.sort===!0?Object.keys(U).sort():Object.keys(U).sort(V.sort)).reduce((z,b)=>{const T=U[b];return T&&typeof T=="object"&&!Array.isArray(T)?z[b]=D(T):z[b]=T,z},Object.create(null))}r.extract=H,r.parse=X,r.stringify=(F,V)=>{if(!F)return"";V=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},V),l(V.arrayFormatSeparator);const $=T=>V.skipNull&&o(F[T])||V.skipEmptyString&&F[T]==="",U=h(V),z={};for(const T of Object.keys(F))$(T)||(z[T]=F[T]);const b=Object.keys(z);return V.sort!==!1&&b.sort(V.sort),b.map(T=>{const re=F[T];return re===void 0?"":re===null?m(T,V):Array.isArray(re)?re.length===0&&V.arrayFormat==="bracket-separator"?m(T,V)+"[]":re.reduce(U(T),[]).join("&"):m(T,V)+"="+m(re,V)}).filter(T=>T.length>0).join("&")},r.parseUrl=(F,V)=>{V=Object.assign({decode:!0},V);const[$,U]=n(F,"#");return Object.assign({url:$.split("?")[0]||"",query:X(H(F),V)},V&&V.parseFragmentIdentifier&&U?{fragmentIdentifier:_(U,V)}:{})},r.stringifyUrl=(F,V)=>{V=Object.assign({encode:!0,strict:!0,[f]:!0},V);const $=I(F.url).split("?")[0]||"",U=r.extract(F.url),z=r.parse(U,{sort:!1}),b=Object.assign(z,F.query);let T=r.stringify(b,V);T&&(T=`?${T}`);let re=M(F.url);return F.fragmentIdentifier&&(re=`#${V[f]?m(F.fragmentIdentifier,V):F.fragmentIdentifier}`),`${$}${T}${re}`},r.pick=(F,V,$)=>{$=Object.assign({parseFragmentIdentifier:!0,[f]:!1},$);const{url:U,query:z,fragmentIdentifier:b}=r.parseUrl(F,$);return r.stringifyUrl({url:U,query:s(z,V),fragmentIdentifier:b},$)},r.exclude=(F,V,$)=>{const U=Array.isArray(V)?z=>!V.includes(z):(z,b)=>!V(z,b);return r.pick(F,U,$)}})(Ta);var au={},Nc={},tt={},Vp={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});function e(h,p){var l=h>>>16&65535,m=h&65535,_=p>>>16&65535,D=p&65535;return m*D+(l*D+m*_<<16>>>0)|0}r.mul=Math.imul||e;function t(h,p){return h+p|0}r.add=t;function n(h,p){return h-p|0}r.sub=n;function s(h,p){return h<<p|h>>>32-p}r.rotl=s;function o(h,p){return h<<32-p|h>>>p}r.rotr=o;function f(h){return typeof h=="number"&&isFinite(h)&&Math.floor(h)===h}r.isInteger=Number.isInteger||f,r.MAX_SAFE_INTEGER=9007199254740991,r.isSafeInteger=function(h){return r.isInteger(h)&&h>=-r.MAX_SAFE_INTEGER&&h<=r.MAX_SAFE_INTEGER}})(Vp);Object.defineProperty(tt,"__esModule",{value:!0});var Gp=Vp;function u6(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])<<16>>16}tt.readInt16BE=u6;function d6(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])>>>0}tt.readUint16BE=d6;function l6(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])<<16>>16}tt.readInt16LE=l6;function p6(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])>>>0}tt.readUint16LE=p6;function Jp(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>8,e[t+1]=r>>>0,e}tt.writeUint16BE=Jp;tt.writeInt16BE=Jp;function Yp(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e}tt.writeUint16LE=Yp;tt.writeInt16LE=Yp;function Bh(r,e){return e===void 0&&(e=0),r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}tt.readInt32BE=Bh;function zh(r,e){return e===void 0&&(e=0),(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}tt.readUint32BE=zh;function Hh(r,e){return e===void 0&&(e=0),r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e]}tt.readInt32LE=Hh;function jh(r,e){return e===void 0&&(e=0),(r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e])>>>0}tt.readUint32LE=jh;function vc(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>24,e[t+1]=r>>>16,e[t+2]=r>>>8,e[t+3]=r>>>0,e}tt.writeUint32BE=vc;tt.writeInt32BE=vc;function mc(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e[t+2]=r>>>16,e[t+3]=r>>>24,e}tt.writeUint32LE=mc;tt.writeInt32LE=mc;function g6(r,e){e===void 0&&(e=0);var t=Bh(r,e),n=Bh(r,e+4);return t*4294967296+n-(n>>31)*4294967296}tt.readInt64BE=g6;function b6(r,e){e===void 0&&(e=0);var t=zh(r,e),n=zh(r,e+4);return t*4294967296+n}tt.readUint64BE=b6;function v6(r,e){e===void 0&&(e=0);var t=Hh(r,e),n=Hh(r,e+4);return n*4294967296+t-(t>>31)*4294967296}tt.readInt64LE=v6;function m6(r,e){e===void 0&&(e=0);var t=jh(r,e),n=jh(r,e+4);return n*4294967296+t}tt.readUint64LE=m6;function Xp(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),vc(r/4294967296>>>0,e,t),vc(r>>>0,e,t+4),e}tt.writeUint64BE=Xp;tt.writeInt64BE=Xp;function Zp(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),mc(r>>>0,e,t),mc(r/4294967296>>>0,e,t+4),e}tt.writeUint64LE=Zp;tt.writeInt64LE=Zp;function y6(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,s=1,o=r/8+t-1;o>=t;o--)n+=e[o]*s,s*=256;return n}tt.readUintBE=y6;function w6(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,s=1,o=t;o<t+r/8;o++)n+=e[o]*s,s*=256;return n}tt.readUintLE=w6;function _6(r,e,t,n){if(t===void 0&&(t=new Uint8Array(r/8)),n===void 0&&(n=0),r%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!Gp.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var s=1,o=r/8+n-1;o>=n;o--)t[o]=e/s&255,s*=256;return t}tt.writeUintBE=_6;function E6(r,e,t,n){if(t===void 0&&(t=new Uint8Array(r/8)),n===void 0&&(n=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Gp.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var s=1,o=n;o<n+r/8;o++)t[o]=e/s&255,s*=256;return t}tt.writeUintLE=E6;function S6(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e)}tt.readFloat32BE=S6;function x6(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e,!0)}tt.readFloat32LE=x6;function I6(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e)}tt.readFloat64BE=I6;function D6(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e,!0)}tt.readFloat64LE=D6;function A6(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(t,r),e}tt.writeFloat32BE=A6;function P6(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(t,r,!0),e}tt.writeFloat32LE=P6;function M6(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(t,r),e}tt.writeFloat64BE=M6;function O6(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(t,r,!0),e}tt.writeFloat64LE=O6;var Xr={};Object.defineProperty(Xr,"__esModule",{value:!0});function C6(r){for(var e=0;e<r.length;e++)r[e]=0;return r}Xr.wipe=C6;Object.defineProperty(Nc,"__esModule",{value:!0});var wr=tt,Kh=Xr,R6=20;function T6(r,e,t){for(var n=1634760805,s=857760878,o=2036477234,f=1797285236,h=t[3]<<24|t[2]<<16|t[1]<<8|t[0],p=t[7]<<24|t[6]<<16|t[5]<<8|t[4],l=t[11]<<24|t[10]<<16|t[9]<<8|t[8],m=t[15]<<24|t[14]<<16|t[13]<<8|t[12],_=t[19]<<24|t[18]<<16|t[17]<<8|t[16],D=t[23]<<24|t[22]<<16|t[21]<<8|t[20],I=t[27]<<24|t[26]<<16|t[25]<<8|t[24],M=t[31]<<24|t[30]<<16|t[29]<<8|t[28],H=e[3]<<24|e[2]<<16|e[1]<<8|e[0],k=e[7]<<24|e[6]<<16|e[5]<<8|e[4],X=e[11]<<24|e[10]<<16|e[9]<<8|e[8],F=e[15]<<24|e[14]<<16|e[13]<<8|e[12],V=n,$=s,U=o,z=f,b=h,T=p,re=l,de=m,L=_,u=D,y=I,w=M,E=H,O=k,N=X,R=F,x=0;x<R6;x+=2)V=V+b|0,E^=V,E=E>>>32-16|E<<16,L=L+E|0,b^=L,b=b>>>32-12|b<<12,$=$+T|0,O^=$,O=O>>>32-16|O<<16,u=u+O|0,T^=u,T=T>>>32-12|T<<12,U=U+re|0,N^=U,N=N>>>32-16|N<<16,y=y+N|0,re^=y,re=re>>>32-12|re<<12,z=z+de|0,R^=z,R=R>>>32-16|R<<16,w=w+R|0,de^=w,de=de>>>32-12|de<<12,U=U+re|0,N^=U,N=N>>>32-8|N<<8,y=y+N|0,re^=y,re=re>>>32-7|re<<7,z=z+de|0,R^=z,R=R>>>32-8|R<<8,w=w+R|0,de^=w,de=de>>>32-7|de<<7,$=$+T|0,O^=$,O=O>>>32-8|O<<8,u=u+O|0,T^=u,T=T>>>32-7|T<<7,V=V+b|0,E^=V,E=E>>>32-8|E<<8,L=L+E|0,b^=L,b=b>>>32-7|b<<7,V=V+T|0,R^=V,R=R>>>32-16|R<<16,y=y+R|0,T^=y,T=T>>>32-12|T<<12,$=$+re|0,E^=$,E=E>>>32-16|E<<16,w=w+E|0,re^=w,re=re>>>32-12|re<<12,U=U+de|0,O^=U,O=O>>>32-16|O<<16,L=L+O|0,de^=L,de=de>>>32-12|de<<12,z=z+b|0,N^=z,N=N>>>32-16|N<<16,u=u+N|0,b^=u,b=b>>>32-12|b<<12,U=U+de|0,O^=U,O=O>>>32-8|O<<8,L=L+O|0,de^=L,de=de>>>32-7|de<<7,z=z+b|0,N^=z,N=N>>>32-8|N<<8,u=u+N|0,b^=u,b=b>>>32-7|b<<7,$=$+re|0,E^=$,E=E>>>32-8|E<<8,w=w+E|0,re^=w,re=re>>>32-7|re<<7,V=V+T|0,R^=V,R=R>>>32-8|R<<8,y=y+R|0,T^=y,T=T>>>32-7|T<<7;wr.writeUint32LE(V+n|0,r,0),wr.writeUint32LE($+s|0,r,4),wr.writeUint32LE(U+o|0,r,8),wr.writeUint32LE(z+f|0,r,12),wr.writeUint32LE(b+h|0,r,16),wr.writeUint32LE(T+p|0,r,20),wr.writeUint32LE(re+l|0,r,24),wr.writeUint32LE(de+m|0,r,28),wr.writeUint32LE(L+_|0,r,32),wr.writeUint32LE(u+D|0,r,36),wr.writeUint32LE(y+I|0,r,40),wr.writeUint32LE(w+M|0,r,44),wr.writeUint32LE(E+H|0,r,48),wr.writeUint32LE(O+k|0,r,52),wr.writeUint32LE(N+X|0,r,56),wr.writeUint32LE(R+F|0,r,60)}function Qp(r,e,t,n,s){if(s===void 0&&(s=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length<t.length)throw new Error("ChaCha: destination is shorter than source");var o,f;if(s===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");o=new Uint8Array(16),f=o.length-e.length,o.set(e,f)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");o=e,f=s}for(var h=new Uint8Array(64),p=0;p<t.length;p+=64){T6(h,o,r);for(var l=p;l<p+64&&l<t.length;l++)n[l]=t[l]^h[l-p];$6(o,0,f)}return Kh.wipe(h),s===0&&Kh.wipe(o),n}Nc.streamXOR=Qp;function N6(r,e,t,n){return n===void 0&&(n=0),Kh.wipe(t),Qp(r,e,t,t,n)}Nc.stream=N6;function $6(r,e,t){for(var n=1;t--;)n=n+(r[e]&255)|0,r[e]=n&255,n>>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var e1={},An={};Object.defineProperty(An,"__esModule",{value:!0});function L6(r,e,t){return~(r-1)&e|r-1&t}An.select=L6;function F6(r,e){return(r|0)-(e|0)-1>>>31&1}An.lessOrEqual=F6;function t1(r,e){if(r.length!==e.length)return 0;for(var t=0,n=0;n<r.length;n++)t|=r[n]^e[n];return 1&t-1>>>8}An.compare=t1;function q6(r,e){return r.length===0||e.length===0?!1:t1(r,e)!==0}An.equal=q6;(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=An,t=Xr;r.DIGEST_LENGTH=16;var n=function(){function f(h){this.digestLength=r.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var p=h[0]|h[1]<<8;this._r[0]=p&8191;var l=h[2]|h[3]<<8;this._r[1]=(p>>>13|l<<3)&8191;var m=h[4]|h[5]<<8;this._r[2]=(l>>>10|m<<6)&7939;var _=h[6]|h[7]<<8;this._r[3]=(m>>>7|_<<9)&8191;var D=h[8]|h[9]<<8;this._r[4]=(_>>>4|D<<12)&255,this._r[5]=D>>>1&8190;var I=h[10]|h[11]<<8;this._r[6]=(D>>>14|I<<2)&8191;var M=h[12]|h[13]<<8;this._r[7]=(I>>>11|M<<5)&8065;var H=h[14]|h[15]<<8;this._r[8]=(M>>>8|H<<8)&8191,this._r[9]=H>>>5&127,this._pad[0]=h[16]|h[17]<<8,this._pad[1]=h[18]|h[19]<<8,this._pad[2]=h[20]|h[21]<<8,this._pad[3]=h[22]|h[23]<<8,this._pad[4]=h[24]|h[25]<<8,this._pad[5]=h[26]|h[27]<<8,this._pad[6]=h[28]|h[29]<<8,this._pad[7]=h[30]|h[31]<<8}return f.prototype._blocks=function(h,p,l){for(var m=this._fin?0:2048,_=this._h[0],D=this._h[1],I=this._h[2],M=this._h[3],H=this._h[4],k=this._h[5],X=this._h[6],F=this._h[7],V=this._h[8],$=this._h[9],U=this._r[0],z=this._r[1],b=this._r[2],T=this._r[3],re=this._r[4],de=this._r[5],L=this._r[6],u=this._r[7],y=this._r[8],w=this._r[9];l>=16;){var E=h[p+0]|h[p+1]<<8;_+=E&8191;var O=h[p+2]|h[p+3]<<8;D+=(E>>>13|O<<3)&8191;var N=h[p+4]|h[p+5]<<8;I+=(O>>>10|N<<6)&8191;var R=h[p+6]|h[p+7]<<8;M+=(N>>>7|R<<9)&8191;var x=h[p+8]|h[p+9]<<8;H+=(R>>>4|x<<12)&8191,k+=x>>>1&8191;var d=h[p+10]|h[p+11]<<8;X+=(x>>>14|d<<2)&8191;var A=h[p+12]|h[p+13]<<8;F+=(d>>>11|A<<5)&8191;var fe=h[p+14]|h[p+15]<<8;V+=(A>>>8|fe<<8)&8191,$+=fe>>>5|m;var ee=0,he=ee;he+=_*U,he+=D*(5*w),he+=I*(5*y),he+=M*(5*u),he+=H*(5*L),ee=he>>>13,he&=8191,he+=k*(5*de),he+=X*(5*re),he+=F*(5*T),he+=V*(5*b),he+=$*(5*z),ee+=he>>>13,he&=8191;var ne=ee;ne+=_*z,ne+=D*U,ne+=I*(5*w),ne+=M*(5*y),ne+=H*(5*u),ee=ne>>>13,ne&=8191,ne+=k*(5*L),ne+=X*(5*de),ne+=F*(5*re),ne+=V*(5*T),ne+=$*(5*b),ee+=ne>>>13,ne&=8191;var be=ee;be+=_*b,be+=D*z,be+=I*U,be+=M*(5*w),be+=H*(5*y),ee=be>>>13,be&=8191,be+=k*(5*u),be+=X*(5*L),be+=F*(5*de),be+=V*(5*re),be+=$*(5*T),ee+=be>>>13,be&=8191;var G=ee;G+=_*T,G+=D*b,G+=I*z,G+=M*U,G+=H*(5*w),ee=G>>>13,G&=8191,G+=k*(5*y),G+=X*(5*u),G+=F*(5*L),G+=V*(5*de),G+=$*(5*re),ee+=G>>>13,G&=8191;var Z=ee;Z+=_*re,Z+=D*T,Z+=I*b,Z+=M*z,Z+=H*U,ee=Z>>>13,Z&=8191,Z+=k*(5*w),Z+=X*(5*y),Z+=F*(5*u),Z+=V*(5*L),Z+=$*(5*de),ee+=Z>>>13,Z&=8191;var K=ee;K+=_*de,K+=D*re,K+=I*T,K+=M*b,K+=H*z,ee=K>>>13,K&=8191,K+=k*U,K+=X*(5*w),K+=F*(5*y),K+=V*(5*u),K+=$*(5*L),ee+=K>>>13,K&=8191;var v=ee;v+=_*L,v+=D*de,v+=I*re,v+=M*T,v+=H*b,ee=v>>>13,v&=8191,v+=k*z,v+=X*U,v+=F*(5*w),v+=V*(5*y),v+=$*(5*u),ee+=v>>>13,v&=8191;var j=ee;j+=_*u,j+=D*L,j+=I*de,j+=M*re,j+=H*T,ee=j>>>13,j&=8191,j+=k*b,j+=X*z,j+=F*U,j+=V*(5*w),j+=$*(5*y),ee+=j>>>13,j&=8191;var oe=ee;oe+=_*y,oe+=D*u,oe+=I*L,oe+=M*de,oe+=H*re,ee=oe>>>13,oe&=8191,oe+=k*T,oe+=X*b,oe+=F*z,oe+=V*U,oe+=$*(5*w),ee+=oe>>>13,oe&=8191;var le=ee;le+=_*w,le+=D*y,le+=I*u,le+=M*L,le+=H*de,ee=le>>>13,le&=8191,le+=k*re,le+=X*T,le+=F*b,le+=V*z,le+=$*U,ee+=le>>>13,le&=8191,ee=(ee<<2)+ee|0,ee=ee+he|0,he=ee&8191,ee=ee>>>13,ne+=ee,_=he,D=ne,I=be,M=G,H=Z,k=K,X=v,F=j,V=oe,$=le,p+=16,l-=16}this._h[0]=_,this._h[1]=D,this._h[2]=I,this._h[3]=M,this._h[4]=H,this._h[5]=k,this._h[6]=X,this._h[7]=F,this._h[8]=V,this._h[9]=$},f.prototype.finish=function(h,p){p===void 0&&(p=0);var l=new Uint16Array(10),m,_,D,I;if(this._leftover){for(I=this._leftover,this._buffer[I++]=1;I<16;I++)this._buffer[I]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(m=this._h[1]>>>13,this._h[1]&=8191,I=2;I<10;I++)this._h[I]+=m,m=this._h[I]>>>13,this._h[I]&=8191;for(this._h[0]+=m*5,m=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=m,m=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=m,l[0]=this._h[0]+5,m=l[0]>>>13,l[0]&=8191,I=1;I<10;I++)l[I]=this._h[I]+m,m=l[I]>>>13,l[I]&=8191;for(l[9]-=8192,_=(m^1)-1,I=0;I<10;I++)l[I]&=_;for(_=~_,I=0;I<10;I++)this._h[I]=this._h[I]&_|l[I];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,D=this._h[0]+this._pad[0],this._h[0]=D&65535,I=1;I<8;I++)D=(this._h[I]+this._pad[I]|0)+(D>>>16)|0,this._h[I]=D&65535;return h[p+0]=this._h[0]>>>0,h[p+1]=this._h[0]>>>8,h[p+2]=this._h[1]>>>0,h[p+3]=this._h[1]>>>8,h[p+4]=this._h[2]>>>0,h[p+5]=this._h[2]>>>8,h[p+6]=this._h[3]>>>0,h[p+7]=this._h[3]>>>8,h[p+8]=this._h[4]>>>0,h[p+9]=this._h[4]>>>8,h[p+10]=this._h[5]>>>0,h[p+11]=this._h[5]>>>8,h[p+12]=this._h[6]>>>0,h[p+13]=this._h[6]>>>8,h[p+14]=this._h[7]>>>0,h[p+15]=this._h[7]>>>8,this._finished=!0,this},f.prototype.update=function(h){var p=0,l=h.length,m;if(this._leftover){m=16-this._leftover,m>l&&(m=l);for(var _=0;_<m;_++)this._buffer[this._leftover+_]=h[p+_];if(l-=m,p+=m,this._leftover+=m,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(l>=16&&(m=l-l%16,this._blocks(h,p,m),p+=m,l-=m),l){for(var _=0;_<l;_++)this._buffer[this._leftover+_]=h[p+_];this._leftover+=l}return this},f.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var h=new Uint8Array(16);return this.finish(h),h},f.prototype.clean=function(){return t.wipe(this._buffer),t.wipe(this._r),t.wipe(this._h),t.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},f}();r.Poly1305=n;function s(f,h){var p=new n(f);p.update(h);var l=p.digest();return p.clean(),l}r.oneTimeAuth=s;function o(f,h){return f.length!==r.DIGEST_LENGTH||h.length!==r.DIGEST_LENGTH?!1:e.equal(f,h)}r.equal=o})(e1);(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=Nc,t=e1,n=Xr,s=tt,o=An;r.KEY_LENGTH=32,r.NONCE_LENGTH=12,r.TAG_LENGTH=16;var f=new Uint8Array(16),h=function(){function p(l){if(this.nonceLength=r.NONCE_LENGTH,this.tagLength=r.TAG_LENGTH,l.length!==r.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(l)}return p.prototype.seal=function(l,m,_,D){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var I=new Uint8Array(16);I.set(l,I.length-l.length);var M=new Uint8Array(32);e.stream(this._key,I,M,4);var H=m.length+this.tagLength,k;if(D){if(D.length!==H)throw new Error("ChaCha20Poly1305: incorrect destination length");k=D}else k=new Uint8Array(H);return e.streamXOR(this._key,I,m,k,4),this._authenticate(k.subarray(k.length-this.tagLength,k.length),M,k.subarray(0,k.length-this.tagLength),_),n.wipe(I),k},p.prototype.open=function(l,m,_,D){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(m.length<this.tagLength)return null;var I=new Uint8Array(16);I.set(l,I.length-l.length);var M=new Uint8Array(32);e.stream(this._key,I,M,4);var H=new Uint8Array(this.tagLength);if(this._authenticate(H,M,m.subarray(0,m.length-this.tagLength),_),!o.equal(H,m.subarray(m.length-this.tagLength,m.length)))return null;var k=m.length-this.tagLength,X;if(D){if(D.length!==k)throw new Error("ChaCha20Poly1305: incorrect destination length");X=D}else X=new Uint8Array(k);return e.streamXOR(this._key,I,m.subarray(0,m.length-this.tagLength),X,4),n.wipe(I),X},p.prototype.clean=function(){return n.wipe(this._key),this},p.prototype._authenticate=function(l,m,_,D){var I=new t.Poly1305(m);D&&(I.update(D),D.length%16>0&&I.update(f.subarray(D.length%16))),I.update(_),_.length%16>0&&I.update(f.subarray(_.length%16));var M=new Uint8Array(8);D&&s.writeUint64LE(D.length,M),I.update(M),s.writeUint64LE(_.length,M),I.update(M);for(var H=I.digest(),k=0;k<H.length;k++)l[k]=H[k];I.clean(),n.wipe(H),n.wipe(M)},p}();r.ChaCha20Poly1305=h})(au);var r1={},za={},ou={};Object.defineProperty(ou,"__esModule",{value:!0});function U6(r){return typeof r.saveState<"u"&&typeof r.restoreState<"u"&&typeof r.cleanSavedState<"u"}ou.isSerializableHash=U6;Object.defineProperty(za,"__esModule",{value:!0});var Fi=ou,B6=An,z6=Xr,i1=function(){function r(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(n).clean():n.set(t);for(var s=0;s<n.length;s++)n[s]^=54;this._inner.update(n);for(var s=0;s<n.length;s++)n[s]^=106;this._outer.update(n),Fi.isSerializableHash(this._inner)&&Fi.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),z6.wipe(n)}return r.prototype.reset=function(){if(!Fi.isSerializableHash(this._inner)||!Fi.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.clean=function(){Fi.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),Fi.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},r.prototype.update=function(e){return this._inner.update(e),this},r.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},r.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},r.prototype.saveState=function(){if(!Fi.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},r.prototype.restoreState=function(e){if(!Fi.isSerializableHash(this._inner)||!Fi.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.cleanSavedState=function(e){if(!Fi.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},r}();za.HMAC=i1;function H6(r,e,t){var n=new i1(r,e);n.update(t);var s=n.digest();return n.clean(),s}za.hmac=H6;za.equal=B6.equal;Object.defineProperty(r1,"__esModule",{value:!0});var Hl=za,jl=Xr,j6=function(){function r(e,t,n,s){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=s;var o=Hl.hmac(this._hash,n,t);this._hmac=new Hl.HMAC(e,o),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return r.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},r.prototype.expand=function(e){for(var t=new Uint8Array(e),n=0;n<t.length;n++)this._bufpos===this._buffer.length&&this._fillBuffer(),t[n]=this._buffer[this._bufpos++];return t},r.prototype.clean=function(){this._hmac.clean(),jl.wipe(this._buffer),jl.wipe(this._counter),this._bufpos=0},r}(),K6=r1.HKDF=j6,Pn={},$c={},Lc={};Object.defineProperty(Lc,"__esModule",{value:!0});Lc.BrowserRandomSource=void 0;const Kl=65536;class k6{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const t=new Uint8Array(e);for(let n=0;n<t.length;n+=Kl)this._crypto.getRandomValues(t.subarray(n,n+Math.min(t.length-n,Kl)));return t}}Lc.BrowserRandomSource=k6;var Fc={};Object.defineProperty(Fc,"__esModule",{value:!0});Fc.NodeRandomSource=void 0;const W6=Xr;class V6{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof Zw<"u"){const e=Qw();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const n=new Uint8Array(e);for(let s=0;s<n.length;s++)n[s]=t[s];return(0,W6.wipe)(t),n}}Fc.NodeRandomSource=V6;Object.defineProperty($c,"__esModule",{value:!0});$c.SystemRandomSource=void 0;const G6=Lc,J6=Fc;class Y6{constructor(){if(this.isAvailable=!1,this.name="",this._source=new G6.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new J6.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)}}$c.SystemRandomSource=Y6;(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.randomStringForEntropy=r.randomString=r.randomUint32=r.randomBytes=r.defaultRandomSource=void 0;const e=$c,t=tt,n=Xr;r.defaultRandomSource=new e.SystemRandomSource;function s(l,m=r.defaultRandomSource){return m.randomBytes(l)}r.randomBytes=s;function o(l=r.defaultRandomSource){const m=s(4,l),_=(0,t.readUint32LE)(m);return(0,n.wipe)(m),_}r.randomUint32=o;const f="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function h(l,m=f,_=r.defaultRandomSource){if(m.length<2)throw new Error("randomString charset is too short");if(m.length>256)throw new Error("randomString charset is too long");let D="";const I=m.length,M=256-256%I;for(;l>0;){const H=s(Math.ceil(l*256/M),_);for(let k=0;k<H.length&&l>0;k++){const X=H[k];X<M&&(D+=m.charAt(X%I),l--)}(0,n.wipe)(H)}return D}r.randomString=h;function p(l,m=f,_=r.defaultRandomSource){const D=Math.ceil(l/(Math.log(m.length)/Math.LN2));return h(D,m,_)}r.randomStringForEntropy=p})(Pn);var Ha={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=tt,t=Xr;r.DIGEST_LENGTH=32,r.BLOCK_SIZE=64;var n=function(){function h(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return h.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},h.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},h.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._temp),this.reset()},h.prototype.update=function(p,l){if(l===void 0&&(l=p.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var m=0;if(this._bytesHashed+=l,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&l>0;)this._buffer[this._bufferLength++]=p[m++],l--;this._bufferLength===this.blockSize&&(o(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(m=o(this._temp,this._state,p,m,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=p[m++],l--;return this},h.prototype.finish=function(p){if(!this._finished){var l=this._bytesHashed,m=this._bufferLength,_=l/536870912|0,D=l<<3,I=l%64<56?64:128;this._buffer[m]=128;for(var M=m+1;M<I-8;M++)this._buffer[M]=0;e.writeUint32BE(_,this._buffer,I-8),e.writeUint32BE(D,this._buffer,I-4),o(this._temp,this._state,this._buffer,0,I),this._finished=!0}for(var M=0;M<this.digestLength/4;M++)e.writeUint32BE(this._state[M],p,M*4);return this},h.prototype.digest=function(){var p=new Uint8Array(this.digestLength);return this.finish(p),p},h.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}},h.prototype.restoreState=function(p){return this._state.set(p.state),this._bufferLength=p.bufferLength,p.buffer&&this._buffer.set(p.buffer),this._bytesHashed=p.bytesHashed,this._finished=!1,this},h.prototype.cleanSavedState=function(p){t.wipe(p.state),p.buffer&&t.wipe(p.buffer),p.bufferLength=0,p.bytesHashed=0},h}();r.SHA256=n;var s=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 o(h,p,l,m,_){for(;_>=64;){for(var D=p[0],I=p[1],M=p[2],H=p[3],k=p[4],X=p[5],F=p[6],V=p[7],$=0;$<16;$++){var U=m+$*4;h[$]=e.readUint32BE(l,U)}for(var $=16;$<64;$++){var z=h[$-2],b=(z>>>17|z<<32-17)^(z>>>19|z<<32-19)^z>>>10;z=h[$-15];var T=(z>>>7|z<<32-7)^(z>>>18|z<<32-18)^z>>>3;h[$]=(b+h[$-7]|0)+(T+h[$-16]|0)}for(var $=0;$<64;$++){var b=(((k>>>6|k<<26)^(k>>>11|k<<21)^(k>>>25|k<<7))+(k&X^~k&F)|0)+(V+(s[$]+h[$]|0)|0)|0,T=((D>>>2|D<<32-2)^(D>>>13|D<<32-13)^(D>>>22|D<<32-22))+(D&I^D&M^I&M)|0;V=F,F=X,X=k,k=H+b|0,H=M,M=I,I=D,D=b+T|0}p[0]+=D,p[1]+=I,p[2]+=M,p[3]+=H,p[4]+=k,p[5]+=X,p[6]+=F,p[7]+=V,m+=64,_-=64}return m}function f(h){var p=new n;p.update(h);var l=p.digest();return p.clean(),l}r.hash=f})(Ha);var cu={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.sharedKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.scalarMultBase=r.scalarMult=r.SHARED_KEY_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=void 0;const e=Pn,t=Xr;r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=32,r.SHARED_KEY_LENGTH=32;function n($){const U=new Float64Array(16);if($)for(let z=0;z<$.length;z++)U[z]=$[z];return U}const s=new Uint8Array(32);s[0]=9;const o=n([56129,1]);function f($){let U=1;for(let z=0;z<16;z++){let b=$[z]+U+65535;U=Math.floor(b/65536),$[z]=b-U*65536}$[0]+=U-1+37*(U-1)}function h($,U,z){const b=~(z-1);for(let T=0;T<16;T++){const re=b&($[T]^U[T]);$[T]^=re,U[T]^=re}}function p($,U){const z=n(),b=n();for(let T=0;T<16;T++)b[T]=U[T];f(b),f(b),f(b);for(let T=0;T<2;T++){z[0]=b[0]-65517;for(let de=1;de<15;de++)z[de]=b[de]-65535-(z[de-1]>>16&1),z[de-1]&=65535;z[15]=b[15]-32767-(z[14]>>16&1);const re=z[15]>>16&1;z[14]&=65535,h(b,z,1-re)}for(let T=0;T<16;T++)$[2*T]=b[T]&255,$[2*T+1]=b[T]>>8}function l($,U){for(let z=0;z<16;z++)$[z]=U[2*z]+(U[2*z+1]<<8);$[15]&=32767}function m($,U,z){for(let b=0;b<16;b++)$[b]=U[b]+z[b]}function _($,U,z){for(let b=0;b<16;b++)$[b]=U[b]-z[b]}function D($,U,z){let b,T,re=0,de=0,L=0,u=0,y=0,w=0,E=0,O=0,N=0,R=0,x=0,d=0,A=0,fe=0,ee=0,he=0,ne=0,be=0,G=0,Z=0,K=0,v=0,j=0,oe=0,le=0,Te=0,Ae=0,Me=0,je=0,qe=0,Ue=0,ke=z[0],ye=z[1],Ie=z[2],Be=z[3],De=z[4],Se=z[5],ze=z[6],me=z[7],xe=z[8],Qe=z[9],_e=z[10],Oe=z[11],ct=z[12],Ce=z[13],Re=z[14],ht=z[15];b=U[0],re+=b*ke,de+=b*ye,L+=b*Ie,u+=b*Be,y+=b*De,w+=b*Se,E+=b*ze,O+=b*me,N+=b*xe,R+=b*Qe,x+=b*_e,d+=b*Oe,A+=b*ct,fe+=b*Ce,ee+=b*Re,he+=b*ht,b=U[1],de+=b*ke,L+=b*ye,u+=b*Ie,y+=b*Be,w+=b*De,E+=b*Se,O+=b*ze,N+=b*me,R+=b*xe,x+=b*Qe,d+=b*_e,A+=b*Oe,fe+=b*ct,ee+=b*Ce,he+=b*Re,ne+=b*ht,b=U[2],L+=b*ke,u+=b*ye,y+=b*Ie,w+=b*Be,E+=b*De,O+=b*Se,N+=b*ze,R+=b*me,x+=b*xe,d+=b*Qe,A+=b*_e,fe+=b*Oe,ee+=b*ct,he+=b*Ce,ne+=b*Re,be+=b*ht,b=U[3],u+=b*ke,y+=b*ye,w+=b*Ie,E+=b*Be,O+=b*De,N+=b*Se,R+=b*ze,x+=b*me,d+=b*xe,A+=b*Qe,fe+=b*_e,ee+=b*Oe,he+=b*ct,ne+=b*Ce,be+=b*Re,G+=b*ht,b=U[4],y+=b*ke,w+=b*ye,E+=b*Ie,O+=b*Be,N+=b*De,R+=b*Se,x+=b*ze,d+=b*me,A+=b*xe,fe+=b*Qe,ee+=b*_e,he+=b*Oe,ne+=b*ct,be+=b*Ce,G+=b*Re,Z+=b*ht,b=U[5],w+=b*ke,E+=b*ye,O+=b*Ie,N+=b*Be,R+=b*De,x+=b*Se,d+=b*ze,A+=b*me,fe+=b*xe,ee+=b*Qe,he+=b*_e,ne+=b*Oe,be+=b*ct,G+=b*Ce,Z+=b*Re,K+=b*ht,b=U[6],E+=b*ke,O+=b*ye,N+=b*Ie,R+=b*Be,x+=b*De,d+=b*Se,A+=b*ze,fe+=b*me,ee+=b*xe,he+=b*Qe,ne+=b*_e,be+=b*Oe,G+=b*ct,Z+=b*Ce,K+=b*Re,v+=b*ht,b=U[7],O+=b*ke,N+=b*ye,R+=b*Ie,x+=b*Be,d+=b*De,A+=b*Se,fe+=b*ze,ee+=b*me,he+=b*xe,ne+=b*Qe,be+=b*_e,G+=b*Oe,Z+=b*ct,K+=b*Ce,v+=b*Re,j+=b*ht,b=U[8],N+=b*ke,R+=b*ye,x+=b*Ie,d+=b*Be,A+=b*De,fe+=b*Se,ee+=b*ze,he+=b*me,ne+=b*xe,be+=b*Qe,G+=b*_e,Z+=b*Oe,K+=b*ct,v+=b*Ce,j+=b*Re,oe+=b*ht,b=U[9],R+=b*ke,x+=b*ye,d+=b*Ie,A+=b*Be,fe+=b*De,ee+=b*Se,he+=b*ze,ne+=b*me,be+=b*xe,G+=b*Qe,Z+=b*_e,K+=b*Oe,v+=b*ct,j+=b*Ce,oe+=b*Re,le+=b*ht,b=U[10],x+=b*ke,d+=b*ye,A+=b*Ie,fe+=b*Be,ee+=b*De,he+=b*Se,ne+=b*ze,be+=b*me,G+=b*xe,Z+=b*Qe,K+=b*_e,v+=b*Oe,j+=b*ct,oe+=b*Ce,le+=b*Re,Te+=b*ht,b=U[11],d+=b*ke,A+=b*ye,fe+=b*Ie,ee+=b*Be,he+=b*De,ne+=b*Se,be+=b*ze,G+=b*me,Z+=b*xe,K+=b*Qe,v+=b*_e,j+=b*Oe,oe+=b*ct,le+=b*Ce,Te+=b*Re,Ae+=b*ht,b=U[12],A+=b*ke,fe+=b*ye,ee+=b*Ie,he+=b*Be,ne+=b*De,be+=b*Se,G+=b*ze,Z+=b*me,K+=b*xe,v+=b*Qe,j+=b*_e,oe+=b*Oe,le+=b*ct,Te+=b*Ce,Ae+=b*Re,Me+=b*ht,b=U[13],fe+=b*ke,ee+=b*ye,he+=b*Ie,ne+=b*Be,be+=b*De,G+=b*Se,Z+=b*ze,K+=b*me,v+=b*xe,j+=b*Qe,oe+=b*_e,le+=b*Oe,Te+=b*ct,Ae+=b*Ce,Me+=b*Re,je+=b*ht,b=U[14],ee+=b*ke,he+=b*ye,ne+=b*Ie,be+=b*Be,G+=b*De,Z+=b*Se,K+=b*ze,v+=b*me,j+=b*xe,oe+=b*Qe,le+=b*_e,Te+=b*Oe,Ae+=b*ct,Me+=b*Ce,je+=b*Re,qe+=b*ht,b=U[15],he+=b*ke,ne+=b*ye,be+=b*Ie,G+=b*Be,Z+=b*De,K+=b*Se,v+=b*ze,j+=b*me,oe+=b*xe,le+=b*Qe,Te+=b*_e,Ae+=b*Oe,Me+=b*ct,je+=b*Ce,qe+=b*Re,Ue+=b*ht,re+=38*ne,de+=38*be,L+=38*G,u+=38*Z,y+=38*K,w+=38*v,E+=38*j,O+=38*oe,N+=38*le,R+=38*Te,x+=38*Ae,d+=38*Me,A+=38*je,fe+=38*qe,ee+=38*Ue,T=1,b=re+T+65535,T=Math.floor(b/65536),re=b-T*65536,b=de+T+65535,T=Math.floor(b/65536),de=b-T*65536,b=L+T+65535,T=Math.floor(b/65536),L=b-T*65536,b=u+T+65535,T=Math.floor(b/65536),u=b-T*65536,b=y+T+65535,T=Math.floor(b/65536),y=b-T*65536,b=w+T+65535,T=Math.floor(b/65536),w=b-T*65536,b=E+T+65535,T=Math.floor(b/65536),E=b-T*65536,b=O+T+65535,T=Math.floor(b/65536),O=b-T*65536,b=N+T+65535,T=Math.floor(b/65536),N=b-T*65536,b=R+T+65535,T=Math.floor(b/65536),R=b-T*65536,b=x+T+65535,T=Math.floor(b/65536),x=b-T*65536,b=d+T+65535,T=Math.floor(b/65536),d=b-T*65536,b=A+T+65535,T=Math.floor(b/65536),A=b-T*65536,b=fe+T+65535,T=Math.floor(b/65536),fe=b-T*65536,b=ee+T+65535,T=Math.floor(b/65536),ee=b-T*65536,b=he+T+65535,T=Math.floor(b/65536),he=b-T*65536,re+=T-1+37*(T-1),T=1,b=re+T+65535,T=Math.floor(b/65536),re=b-T*65536,b=de+T+65535,T=Math.floor(b/65536),de=b-T*65536,b=L+T+65535,T=Math.floor(b/65536),L=b-T*65536,b=u+T+65535,T=Math.floor(b/65536),u=b-T*65536,b=y+T+65535,T=Math.floor(b/65536),y=b-T*65536,b=w+T+65535,T=Math.floor(b/65536),w=b-T*65536,b=E+T+65535,T=Math.floor(b/65536),E=b-T*65536,b=O+T+65535,T=Math.floor(b/65536),O=b-T*65536,b=N+T+65535,T=Math.floor(b/65536),N=b-T*65536,b=R+T+65535,T=Math.floor(b/65536),R=b-T*65536,b=x+T+65535,T=Math.floor(b/65536),x=b-T*65536,b=d+T+65535,T=Math.floor(b/65536),d=b-T*65536,b=A+T+65535,T=Math.floor(b/65536),A=b-T*65536,b=fe+T+65535,T=Math.floor(b/65536),fe=b-T*65536,b=ee+T+65535,T=Math.floor(b/65536),ee=b-T*65536,b=he+T+65535,T=Math.floor(b/65536),he=b-T*65536,re+=T-1+37*(T-1),$[0]=re,$[1]=de,$[2]=L,$[3]=u,$[4]=y,$[5]=w,$[6]=E,$[7]=O,$[8]=N,$[9]=R,$[10]=x,$[11]=d,$[12]=A,$[13]=fe,$[14]=ee,$[15]=he}function I($,U){D($,U,U)}function M($,U){const z=n();for(let b=0;b<16;b++)z[b]=U[b];for(let b=253;b>=0;b--)I(z,z),b!==2&&b!==4&&D(z,z,U);for(let b=0;b<16;b++)$[b]=z[b]}function H($,U){const z=new Uint8Array(32),b=new Float64Array(80),T=n(),re=n(),de=n(),L=n(),u=n(),y=n();for(let N=0;N<31;N++)z[N]=$[N];z[31]=$[31]&127|64,z[0]&=248,l(b,U);for(let N=0;N<16;N++)re[N]=b[N];T[0]=L[0]=1;for(let N=254;N>=0;--N){const R=z[N>>>3]>>>(N&7)&1;h(T,re,R),h(de,L,R),m(u,T,de),_(T,T,de),m(de,re,L),_(re,re,L),I(L,u),I(y,T),D(T,de,T),D(de,re,u),m(u,T,de),_(T,T,de),I(re,T),_(de,L,y),D(T,de,o),m(T,T,L),D(de,de,T),D(T,L,y),D(L,re,b),I(re,u),h(T,re,R),h(de,L,R)}for(let N=0;N<16;N++)b[N+16]=T[N],b[N+32]=de[N],b[N+48]=re[N],b[N+64]=L[N];const w=b.subarray(32),E=b.subarray(16);M(w,w),D(E,E,w);const O=new Uint8Array(32);return p(O,E),O}r.scalarMult=H;function k($){return H($,s)}r.scalarMultBase=k;function X($){if($.length!==r.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${r.SECRET_KEY_LENGTH} bytes`);const U=new Uint8Array($);return{publicKey:k(U),secretKey:U}}r.generateKeyPairFromSeed=X;function F($){const U=(0,e.randomBytes)(32,$),z=X(U);return(0,t.wipe)(U),z}r.generateKeyPair=F;function V($,U,z=!1){if($.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(U.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const b=H($,U);if(z){let T=0;for(let re=0;re<b.length;re++)T|=b[re];if(T===0)throw new Error("X25519: invalid shared key")}return b}r.sharedKey=V})(cu);function n1(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function hc(r,e){e||(e=r.reduce((s,o)=>s+o.length,0));const t=n1(e);let n=0;for(const s of r)t.set(s,n),n+=s.length;return t}function X6(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var s=0;s<r.length;s++){var o=r.charAt(s),f=o.charCodeAt(0);if(t[f]!==255)throw new TypeError(o+" is ambiguous");t[f]=s}var h=r.length,p=r.charAt(0),l=Math.log(h)/Math.log(256),m=Math.log(256)/Math.log(h);function _(M){if(M instanceof Uint8Array||(ArrayBuffer.isView(M)?M=new Uint8Array(M.buffer,M.byteOffset,M.byteLength):Array.isArray(M)&&(M=Uint8Array.from(M))),!(M instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(M.length===0)return"";for(var H=0,k=0,X=0,F=M.length;X!==F&&M[X]===0;)X++,H++;for(var V=(F-X)*m+1>>>0,$=new Uint8Array(V);X!==F;){for(var U=M[X],z=0,b=V-1;(U!==0||z<k)&&b!==-1;b--,z++)U+=256*$[b]>>>0,$[b]=U%h>>>0,U=U/h>>>0;if(U!==0)throw new Error("Non-zero carry");k=z,X++}for(var T=V-k;T!==V&&$[T]===0;)T++;for(var re=p.repeat(H);T<V;++T)re+=r.charAt($[T]);return re}function D(M){if(typeof M!="string")throw new TypeError("Expected String");if(M.length===0)return new Uint8Array;var H=0;if(M[H]!==" "){for(var k=0,X=0;M[H]===p;)k++,H++;for(var F=(M.length-H)*l+1>>>0,V=new Uint8Array(F);M[H];){var $=t[M.charCodeAt(H)];if($===255)return;for(var U=0,z=F-1;($!==0||U<X)&&z!==-1;z--,U++)$+=h*V[z]>>>0,V[z]=$%256>>>0,$=$/256>>>0;if($!==0)throw new Error("Non-zero carry");X=U,H++}if(M[H]!==" "){for(var b=F-X;b!==F&&V[b]===0;)b++;for(var T=new Uint8Array(k+(F-b)),re=k;b!==F;)T[re++]=V[b++];return T}}}function I(M){var H=D(M);if(H)return H;throw new Error(`Non-${e} character`)}return{encode:_,decodeUnsafe:D,decode:I}}var Z6=X6,Q6=Z6;const e_=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},t_=r=>new TextEncoder().encode(r),r_=r=>new TextDecoder().decode(r);class i_{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class n_{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return s1(this,e)}}class s_{constructor(e){this.decoders=e}or(e){return s1(this,e)}decode(e){const t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const s1=(r,e)=>new s_({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});class a_{constructor(e,t,n,s){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=s,this.encoder=new i_(e,t,n),this.decoder=new n_(e,t,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const qc=({name:r,prefix:e,encode:t,decode:n})=>new a_(r,e,t,n),ja=({prefix:r,name:e,alphabet:t})=>{const{encode:n,decode:s}=Q6(t,e);return qc({prefix:r,name:e,encode:n,decode:o=>e_(s(o))})},o_=(r,e,t,n)=>{const s={};for(let m=0;m<e.length;++m)s[e[m]]=m;let o=r.length;for(;r[o-1]==="=";)--o;const f=new Uint8Array(o*t/8|0);let h=0,p=0,l=0;for(let m=0;m<o;++m){const _=s[r[m]];if(_===void 0)throw new SyntaxError(`Non-${n} character`);p=p<<t|_,h+=t,h>=8&&(h-=8,f[l++]=255&p>>h)}if(h>=t||255&p<<8-h)throw new SyntaxError("Unexpected end of data");return f},c_=(r,e,t)=>{const n=e[e.length-1]==="=",s=(1<<t)-1;let o="",f=0,h=0;for(let p=0;p<r.length;++p)for(h=h<<8|r[p],f+=8;f>t;)f-=t,o+=e[s&h>>f];if(f&&(o+=e[s&h<<t-f]),n)for(;o.length*t&7;)o+="=";return o},pr=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>qc({prefix:e,name:r,encode(s){return c_(s,n,t)},decode(s){return o_(s,n,t,r)}}),f_=qc({prefix:"\0",name:"identity",encode:r=>r_(r),decode:r=>t_(r)}),h_=Object.freeze(Object.defineProperty({__proto__:null,identity:f_},Symbol.toStringTag,{value:"Module"})),u_=pr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),d_=Object.freeze(Object.defineProperty({__proto__:null,base2:u_},Symbol.toStringTag,{value:"Module"})),l_=pr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),p_=Object.freeze(Object.defineProperty({__proto__:null,base8:l_},Symbol.toStringTag,{value:"Module"})),g_=ja({prefix:"9",name:"base10",alphabet:"0123456789"}),b_=Object.freeze(Object.defineProperty({__proto__:null,base10:g_},Symbol.toStringTag,{value:"Module"})),v_=pr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),m_=pr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),y_=Object.freeze(Object.defineProperty({__proto__:null,base16:v_,base16upper:m_},Symbol.toStringTag,{value:"Module"})),w_=pr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),__=pr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),E_=pr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),S_=pr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),x_=pr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),I_=pr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),D_=pr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),A_=pr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),P_=pr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),M_=Object.freeze(Object.defineProperty({__proto__:null,base32:w_,base32hex:x_,base32hexpad:D_,base32hexpadupper:A_,base32hexupper:I_,base32pad:E_,base32padupper:S_,base32upper:__,base32z:P_},Symbol.toStringTag,{value:"Module"})),O_=ja({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),C_=ja({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),R_=Object.freeze(Object.defineProperty({__proto__:null,base36:O_,base36upper:C_},Symbol.toStringTag,{value:"Module"})),T_=ja({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),N_=ja({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),$_=Object.freeze(Object.defineProperty({__proto__:null,base58btc:T_,base58flickr:N_},Symbol.toStringTag,{value:"Module"})),L_=pr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),F_=pr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),q_=pr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),U_=pr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),B_=Object.freeze(Object.defineProperty({__proto__:null,base64:L_,base64pad:F_,base64url:q_,base64urlpad:U_},Symbol.toStringTag,{value:"Module"})),a1=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),z_=a1.reduce((r,e,t)=>(r[t]=e,r),[]),H_=a1.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function j_(r){return r.reduce((e,t)=>(e+=z_[t],e),"")}function K_(r){const e=[];for(const t of r){const n=H_[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}const k_=qc({prefix:"🚀",name:"base256emoji",encode:j_,decode:K_}),W_=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:k_},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const kl={...h_,...d_,...p_,...b_,...y_,...M_,...R_,...$_,...B_,...W_};function o1(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}const Wl=o1("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),vh=o1("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=n1(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),c1={utf8:Wl,"utf-8":Wl,hex:kl.base16,latin1:vh,ascii:vh,binary:vh,...kl};function cr(r,e="utf8"){const t=c1[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):t.decoder.decode(`${t.prefix}${r}`)}function fr(r,e="utf8"){const t=c1[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}var f1={};const V_="elliptic",G_="6.6.1",J_="EC cryptography",Y_="lib/elliptic.js",X_=["lib"],Z_={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/"},Q_={type:"git",url:"git@github.com:indutny/elliptic"},e5=["EC","Elliptic","curve","Cryptography"],t5="Fedor Indutny <fedor@indutny.com>",r5="MIT",i5={url:"https://github.com/indutny/elliptic/issues"},n5="https://github.com/indutny/elliptic",s5={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"},a5={"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"},o5={name:V_,version:G_,description:J_,main:Y_,files:X_,scripts:Z_,repository:Q_,keywords:e5,author:t5,license:r5,bugs:i5,homepage:n5,devDependencies:s5,dependencies:a5};var Zr={},fu={exports:{}};fu.exports;(function(r){(function(e,t){function n(L,u){if(!L)throw new Error(u||"Assertion failed")}function s(L,u){L.super_=u;var y=function(){};y.prototype=u.prototype,L.prototype=new y,L.prototype.constructor=L}function o(L,u,y){if(o.isBN(L))return L;this.negative=0,this.words=null,this.length=0,this.red=null,L!==null&&((u==="le"||u==="be")&&(y=u,u=10),this._init(L||0,u||10,y||"be"))}typeof e=="object"?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;var f;try{typeof window<"u"&&typeof window.Buffer<"u"?f=window.Buffer:f=e2.Buffer}catch{}o.isBN=function(u){return u instanceof o?!0:u!==null&&typeof u=="object"&&u.constructor.wordSize===o.wordSize&&Array.isArray(u.words)},o.max=function(u,y){return u.cmp(y)>0?u:y},o.min=function(u,y){return u.cmp(y)<0?u:y},o.prototype._init=function(u,y,w){if(typeof u=="number")return this._initNumber(u,y,w);if(typeof u=="object")return this._initArray(u,y,w);y==="hex"&&(y=16),n(y===(y|0)&&y>=2&&y<=36),u=u.toString().replace(/\s+/g,"");var E=0;u[0]==="-"&&(E++,this.negative=1),E<u.length&&(y===16?this._parseHex(u,E,w):(this._parseBase(u,y,E),w==="le"&&this._initArray(this.toArray(),y,w)))},o.prototype._initNumber=function(u,y,w){u<0&&(this.negative=1,u=-u),u<67108864?(this.words=[u&67108863],this.length=1):u<4503599627370496?(this.words=[u&67108863,u/67108864&67108863],this.length=2):(n(u<9007199254740992),this.words=[u&67108863,u/67108864&67108863,1],this.length=3),w==="le"&&this._initArray(this.toArray(),y,w)},o.prototype._initArray=function(u,y,w){if(n(typeof u.length=="number"),u.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(u.length/3),this.words=new Array(this.length);for(var E=0;E<this.length;E++)this.words[E]=0;var O,N,R=0;if(w==="be")for(E=u.length-1,O=0;E>=0;E-=3)N=u[E]|u[E-1]<<8|u[E-2]<<16,this.words[O]|=N<<R&67108863,this.words[O+1]=N>>>26-R&67108863,R+=24,R>=26&&(R-=26,O++);else if(w==="le")for(E=0,O=0;E<u.length;E+=3)N=u[E]|u[E+1]<<8|u[E+2]<<16,this.words[O]|=N<<R&67108863,this.words[O+1]=N>>>26-R&67108863,R+=24,R>=26&&(R-=26,O++);return this.strip()};function h(L,u){var y=L.charCodeAt(u);return y>=65&&y<=70?y-55:y>=97&&y<=102?y-87:y-48&15}function p(L,u,y){var w=h(L,y);return y-1>=u&&(w|=h(L,y-1)<<4),w}o.prototype._parseHex=function(u,y,w){this.length=Math.ceil((u.length-y)/6),this.words=new Array(this.length);for(var E=0;E<this.length;E++)this.words[E]=0;var O=0,N=0,R;if(w==="be")for(E=u.length-1;E>=y;E-=2)R=p(u,y,E)<<O,this.words[N]|=R&67108863,O>=18?(O-=18,N+=1,this.words[N]|=R>>>26):O+=8;else{var x=u.length-y;for(E=x%2===0?y+1:y;E<u.length;E+=2)R=p(u,y,E)<<O,this.words[N]|=R&67108863,O>=18?(O-=18,N+=1,this.words[N]|=R>>>26):O+=8}this.strip()};function l(L,u,y,w){for(var E=0,O=Math.min(L.length,y),N=u;N<O;N++){var R=L.charCodeAt(N)-48;E*=w,R>=49?E+=R-49+10:R>=17?E+=R-17+10:E+=R}return E}o.prototype._parseBase=function(u,y,w){this.words=[0],this.length=1;for(var E=0,O=1;O<=67108863;O*=y)E++;E--,O=O/y|0;for(var N=u.length-w,R=N%E,x=Math.min(N,N-R)+w,d=0,A=w;A<x;A+=E)d=l(u,A,A+E,y),this.imuln(O),this.words[0]+d<67108864?this.words[0]+=d:this._iaddn(d);if(R!==0){var fe=1;for(d=l(u,A,u.length,y),A=0;A<R;A++)fe*=y;this.imuln(fe),this.words[0]+d<67108864?this.words[0]+=d:this._iaddn(d)}this.strip()},o.prototype.copy=function(u){u.words=new Array(this.length);for(var y=0;y<this.length;y++)u.words[y]=this.words[y];u.length=this.length,u.negative=this.negative,u.red=this.red},o.prototype.clone=function(){var u=new o(null);return this.copy(u),u},o.prototype._expand=function(u){for(;this.length<u;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var m=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],_=[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];o.prototype.toString=function(u,y){u=u||10,y=y|0||1;var w;if(u===16||u==="hex"){w="";for(var E=0,O=0,N=0;N<this.length;N++){var R=this.words[N],x=((R<<E|O)&16777215).toString(16);O=R>>>24-E&16777215,E+=2,E>=26&&(E-=26,N--),O!==0||N!==this.length-1?w=m[6-x.length]+x+w:w=x+w}for(O!==0&&(w=O.toString(16)+w);w.length%y!==0;)w="0"+w;return this.negative!==0&&(w="-"+w),w}if(u===(u|0)&&u>=2&&u<=36){var d=_[u],A=D[u];w="";var fe=this.clone();for(fe.negative=0;!fe.isZero();){var ee=fe.modn(A).toString(u);fe=fe.idivn(A),fe.isZero()?w=ee+w:w=m[d-ee.length]+ee+w}for(this.isZero()&&(w="0"+w);w.length%y!==0;)w="0"+w;return this.negative!==0&&(w="-"+w),w}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var u=this.words[0];return this.length===2?u+=this.words[1]*67108864:this.length===3&&this.words[2]===1?u+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-u:u},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(u,y){return n(typeof f<"u"),this.toArrayLike(f,u,y)},o.prototype.toArray=function(u,y){return this.toArrayLike(Array,u,y)},o.prototype.toArrayLike=function(u,y,w){var E=this.byteLength(),O=w||Math.max(1,E);n(E<=O,"byte array longer than desired length"),n(O>0,"Requested array length <= 0"),this.strip();var N=y==="le",R=new u(O),x,d,A=this.clone();if(N){for(d=0;!A.isZero();d++)x=A.andln(255),A.iushrn(8),R[d]=x;for(;d<O;d++)R[d]=0}else{for(d=0;d<O-E;d++)R[d]=0;for(d=0;!A.isZero();d++)x=A.andln(255),A.iushrn(8),R[O-d-1]=x}return R},Math.clz32?o.prototype._countBits=function(u){return 32-Math.clz32(u)}:o.prototype._countBits=function(u){var y=u,w=0;return y>=4096&&(w+=13,y>>>=13),y>=64&&(w+=7,y>>>=7),y>=8&&(w+=4,y>>>=4),y>=2&&(w+=2,y>>>=2),w+y},o.prototype._zeroBits=function(u){if(u===0)return 26;var y=u,w=0;return y&8191||(w+=13,y>>>=13),y&127||(w+=7,y>>>=7),y&15||(w+=4,y>>>=4),y&3||(w+=2,y>>>=2),y&1||w++,w},o.prototype.bitLength=function(){var u=this.words[this.length-1],y=this._countBits(u);return(this.length-1)*26+y};function I(L){for(var u=new Array(L.bitLength()),y=0;y<u.length;y++){var w=y/26|0,E=y%26;u[y]=(L.words[w]&1<<E)>>>E}return u}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var u=0,y=0;y<this.length;y++){var w=this._zeroBits(this.words[y]);if(u+=w,w!==26)break}return u},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(u){return this.negative!==0?this.abs().inotn(u).iaddn(1):this.clone()},o.prototype.fromTwos=function(u){return this.testn(u-1)?this.notn(u).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return this.negative!==0},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(u){for(;this.length<u.length;)this.words[this.length++]=0;for(var y=0;y<u.length;y++)this.words[y]=this.words[y]|u.words[y];return this.strip()},o.prototype.ior=function(u){return n((this.negative|u.negative)===0),this.iuor(u)},o.prototype.or=function(u){return this.length>u.length?this.clone().ior(u):u.clone().ior(this)},o.prototype.uor=function(u){return this.length>u.length?this.clone().iuor(u):u.clone().iuor(this)},o.prototype.iuand=function(u){var y;this.length>u.length?y=u:y=this;for(var w=0;w<y.length;w++)this.words[w]=this.words[w]&u.words[w];return this.length=y.length,this.strip()},o.prototype.iand=function(u){return n((this.negative|u.negative)===0),this.iuand(u)},o.prototype.and=function(u){return this.length>u.length?this.clone().iand(u):u.clone().iand(this)},o.prototype.uand=function(u){return this.length>u.length?this.clone().iuand(u):u.clone().iuand(this)},o.prototype.iuxor=function(u){var y,w;this.length>u.length?(y=this,w=u):(y=u,w=this);for(var E=0;E<w.length;E++)this.words[E]=y.words[E]^w.words[E];if(this!==y)for(;E<y.length;E++)this.words[E]=y.words[E];return this.length=y.length,this.strip()},o.prototype.ixor=function(u){return n((this.negative|u.negative)===0),this.iuxor(u)},o.prototype.xor=function(u){return this.length>u.length?this.clone().ixor(u):u.clone().ixor(this)},o.prototype.uxor=function(u){return this.length>u.length?this.clone().iuxor(u):u.clone().iuxor(this)},o.prototype.inotn=function(u){n(typeof u=="number"&&u>=0);var y=Math.ceil(u/26)|0,w=u%26;this._expand(y),w>0&&y--;for(var E=0;E<y;E++)this.words[E]=~this.words[E]&67108863;return w>0&&(this.words[E]=~this.words[E]&67108863>>26-w),this.strip()},o.prototype.notn=function(u){return this.clone().inotn(u)},o.prototype.setn=function(u,y){n(typeof u=="number"&&u>=0);var w=u/26|0,E=u%26;return this._expand(w+1),y?this.words[w]=this.words[w]|1<<E:this.words[w]=this.words[w]&~(1<<E),this.strip()},o.prototype.iadd=function(u){var y;if(this.negative!==0&&u.negative===0)return this.negative=0,y=this.isub(u),this.negative^=1,this._normSign();if(this.negative===0&&u.negative!==0)return u.negative=0,y=this.isub(u),u.negative=1,y._normSign();var w,E;this.length>u.length?(w=this,E=u):(w=u,E=this);for(var O=0,N=0;N<E.length;N++)y=(w.words[N]|0)+(E.words[N]|0)+O,this.words[N]=y&67108863,O=y>>>26;for(;O!==0&&N<w.length;N++)y=(w.words[N]|0)+O,this.words[N]=y&67108863,O=y>>>26;if(this.length=w.length,O!==0)this.words[this.length]=O,this.length++;else if(w!==this)for(;N<w.length;N++)this.words[N]=w.words[N];return this},o.prototype.add=function(u){var y;return u.negative!==0&&this.negative===0?(u.negative=0,y=this.sub(u),u.negative^=1,y):u.negative===0&&this.negative!==0?(this.negative=0,y=u.sub(this),this.negative=1,y):this.length>u.length?this.clone().iadd(u):u.clone().iadd(this)},o.prototype.isub=function(u){if(u.negative!==0){u.negative=0;var y=this.iadd(u);return u.negative=1,y._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(u),this.negative=1,this._normSign();var w=this.cmp(u);if(w===0)return this.negative=0,this.length=1,this.words[0]=0,this;var E,O;w>0?(E=this,O=u):(E=u,O=this);for(var N=0,R=0;R<O.length;R++)y=(E.words[R]|0)-(O.words[R]|0)+N,N=y>>26,this.words[R]=y&67108863;for(;N!==0&&R<E.length;R++)y=(E.words[R]|0)+N,N=y>>26,this.words[R]=y&67108863;if(N===0&&R<E.length&&E!==this)for(;R<E.length;R++)this.words[R]=E.words[R];return this.length=Math.max(this.length,R),E!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(u){return this.clone().isub(u)};function M(L,u,y){y.negative=u.negative^L.negative;var w=L.length+u.length|0;y.length=w,w=w-1|0;var E=L.words[0]|0,O=u.words[0]|0,N=E*O,R=N&67108863,x=N/67108864|0;y.words[0]=R;for(var d=1;d<w;d++){for(var A=x>>>26,fe=x&67108863,ee=Math.min(d,u.length-1),he=Math.max(0,d-L.length+1);he<=ee;he++){var ne=d-he|0;E=L.words[ne]|0,O=u.words[he]|0,N=E*O+fe,A+=N/67108864|0,fe=N&67108863}y.words[d]=fe|0,x=A|0}return x!==0?y.words[d]=x|0:y.length--,y.strip()}var H=function(u,y,w){var E=u.words,O=y.words,N=w.words,R=0,x,d,A,fe=E[0]|0,ee=fe&8191,he=fe>>>13,ne=E[1]|0,be=ne&8191,G=ne>>>13,Z=E[2]|0,K=Z&8191,v=Z>>>13,j=E[3]|0,oe=j&8191,le=j>>>13,Te=E[4]|0,Ae=Te&8191,Me=Te>>>13,je=E[5]|0,qe=je&8191,Ue=je>>>13,ke=E[6]|0,ye=ke&8191,Ie=ke>>>13,Be=E[7]|0,De=Be&8191,Se=Be>>>13,ze=E[8]|0,me=ze&8191,xe=ze>>>13,Qe=E[9]|0,_e=Qe&8191,Oe=Qe>>>13,ct=O[0]|0,Ce=ct&8191,Re=ct>>>13,ht=O[1]|0,lt=ht&8191,bt=ht>>>13,Br=O[2]|0,pt=Br&8191,_t=Br>>>13,bi=O[3]|0,Dt=bi&8191,We=bi>>>13,Pt=O[4]|0,Ve=Pt&8191,Ge=Pt>>>13,Tt=O[5]|0,He=Tt&8191,rt=Tt>>>13,jt=O[6]|0,Je=jt&8191,it=jt>>>13,Ft=O[7]|0,et=Ft&8191,Ye=Ft>>>13,St=O[8]|0,nt=St&8191,st=St>>>13,ws=O[9]|0,Bt=ws&8191,zt=ws>>>13;w.negative=u.negative^y.negative,w.length=19,x=Math.imul(ee,Ce),d=Math.imul(ee,Re),d=d+Math.imul(he,Ce)|0,A=Math.imul(he,Re);var vr=(R+x|0)+((d&8191)<<13)|0;R=(A+(d>>>13)|0)+(vr>>>26)|0,vr&=67108863,x=Math.imul(be,Ce),d=Math.imul(be,Re),d=d+Math.imul(G,Ce)|0,A=Math.imul(G,Re),x=x+Math.imul(ee,lt)|0,d=d+Math.imul(ee,bt)|0,d=d+Math.imul(he,lt)|0,A=A+Math.imul(he,bt)|0;var Cn=(R+x|0)+((d&8191)<<13)|0;R=(A+(d>>>13)|0)+(Cn>>>26)|0,Cn&=67108863,x=Math.imul(K,Ce),d=Math.imul(K,Re),d=d+Math.imul(v,Ce)|0,A=Math.imul(v,Re),x=x+Math.imul(be,lt)|0,d=d+Math.imul(be,bt)|0,d=d+Math.imul(G,lt)|0,A=A+Math.imul(G,bt)|0,x=x+Math.imul(ee,pt)|0,d=d+Math.imul(ee,_t)|0,d=d+Math.imul(he,pt)|0,A=A+Math.imul(he,_t)|0;var Rn=(R+x|0)+((d&8191)<<13)|0;R=(A+(d>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,x=Math.imul(oe,Ce),d=Math.imul(oe,Re),d=d+Math.imul(le,Ce)|0,A=Math.imul(le,Re),x=x+Math.imul(K,lt)|0,d=d+Math.imul(K,bt)|0,d=d+Math.imul(v,lt)|0,A=A+Math.imul(v,bt)|0,x=x+Math.imul(be,pt)|0,d=d+Math.imul(be,_t)|0,d=d+Math.imul(G,pt)|0,A=A+Math.imul(G,_t)|0,x=x+Math.imul(ee,Dt)|0,d=d+Math.imul(ee,We)|0,d=d+Math.imul(he,Dt)|0,A=A+Math.imul(he,We)|0;var Tn=(R+x|0)+((d&8191)<<13)|0;R=(A+(d>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,x=Math.imul(Ae,Ce),d=Math.imul(Ae,Re),d=d+Math.imul(Me,Ce)|0,A=Math.imul(Me,Re),x=x+Math.imul(oe,lt)|0,d=d+Math.imul(oe,bt)|0,d=d+Math.imul(le,lt)|0,A=A+Math.imul(le,bt)|0,x=x+Math.imul(K,pt)|0,d=d+Math.imul(K,_t)|0,d=d+Math.imul(v,pt)|0,A=A+Math.imul(v,_t)|0,x=x+Math.imul(be,Dt)|0,d=d+Math.imul(be,We)|0,d=d+Math.imul(G,Dt)|0,A=A+Math.imul(G,We)|0,x=x+Math.imul(ee,Ve)|0,d=d+Math.imul(ee,Ge)|0,d=d+Math.imul(he,Ve)|0,A=A+Math.imul(he,Ge)|0;var Nn=(R+x|0)+((d&8191)<<13)|0;R=(A+(d>>>13)|0)+(Nn>>>26)|0,Nn&=67108863,x=Math.imul(qe,Ce),d=Math.imul(qe,Re),d=d+Math.imul(Ue,Ce)|0,A=Math.imul(Ue,Re),x=x+Math.imul(Ae,lt)|0,d=d+Math.imul(Ae,bt)|0,d=d+Math.imul(Me,lt)|0,A=A+Math.imul(Me,bt)|0,x=x+Math.imul(oe,pt)|0,d=d+Math.imul(oe,_t)|0,d=d+Math.imul(le,pt)|0,A=A+Math.imul(le,_t)|0,x=x+Math.imul(K,Dt)|0,d=d+Math.imul(K,We)|0,d=d+Math.imul(v,Dt)|0,A=A+Math.imul(v,We)|0,x=x+Math.imul(be,Ve)|0,d=d+Math.imul(be,Ge)|0,d=d+Math.imul(G,Ve)|0,A=A+Math.imul(G,Ge)|0,x=x+Math.imul(ee,He)|0,d=d+Math.imul(ee,rt)|0,d=d+Math.imul(he,He)|0,A=A+Math.imul(he,rt)|0;var $n=(R+x|0)+((d&8191)<<13)|0;R=(A+(d>>>13)|0)+($n>>>26)|0,$n&=67108863,x=Math.imul(ye,Ce),d=Math.imul(ye,Re),d=d+Math.imul(Ie,Ce)|0,A=Math.imul(Ie,Re),x=x+Math.imul(qe,lt)|0,d=d+Math.imul(qe,bt)|0,d=d+Math.imul(Ue,lt)|0,A=A+Math.imul(Ue,bt)|0,x=x+Math.imul(Ae,pt)|0,d=d+Math.imul(Ae,_t)|0,d=d+Math.imul(Me,pt)|0,A=A+Math.imul(Me,_t)|0,x=x+Math.imul(oe,Dt)|0,d=d+Math.imul(oe,We)|0,d=d+Math.imul(le,Dt)|0,A=A+Math.imul(le,We)|0,x=x+Math.imul(K,Ve)|0,d=d+Math.imul(K,Ge)|0,d=d+Math.imul(v,Ve)|0,A=A+Math.imul(v,Ge)|0,x=x+Math.imul(be,He)|0,d=d+Math.imul(be,rt)|0,d=d+Math.imul(G,He)|0,A=A+Math.imul(G,rt)|0,x=x+Math.imul(ee,Je)|0,d=d+Math.imul(ee,it)|0,d=d+Math.imul(he,Je)|0,A=A+Math.imul(he,it)|0;var zr=(R+x|0)+((d&8191)<<13)|0;R=(A+(d>>>13)|0)+(zr>>>26)|0,zr&=67108863,x=Math.imul(De,Ce),d=Math.imul(De,Re),d=d+Math.imul(Se,Ce)|0,A=Math.imul(Se,Re),x=x+Math.imul(ye,lt)|0,d=d+Math.imul(ye,bt)|0,d=d+Math.imul(Ie,lt)|0,A=A+Math.imul(Ie,bt)|0,x=x+Math.imul(qe,pt)|0,d=d+Math.imul(qe,_t)|0,d=d+Math.imul(Ue,pt)|0,A=A+Math.imul(Ue,_t)|0,x=x+Math.imul(Ae,Dt)|0,d=d+Math.imul(Ae,We)|0,d=d+Math.imul(Me,Dt)|0,A=A+Math.imul(Me,We)|0,x=x+Math.imul(oe,Ve)|0,d=d+Math.imul(oe,Ge)|0,d=d+Math.imul(le,Ve)|0,A=A+Math.imul(le,Ge)|0,x=x+Math.imul(K,He)|0,d=d+Math.imul(K,rt)|0,d=d+Math.imul(v,He)|0,A=A+Math.imul(v,rt)|0,x=x+Math.imul(be,Je)|0,d=d+Math.imul(be,it)|0,d=d+Math.imul(G,Je)|0,A=A+Math.imul(G,it)|0,x=x+Math.imul(ee,et)|0,d=d+Math.imul(ee,Ye)|0,d=d+Math.imul(he,et)|0,A=A+Math.imul(he,Ye)|0;var Mi=(R+x|0)+((d&8191)<<13)|0;R=(A+(d>>>13)|0)+(Mi>>>26)|0,Mi&=67108863,x=Math.imul(me,Ce),d=Math.imul(me,Re),d=d+Math.imul(xe,Ce)|0,A=Math.imul(xe,Re),x=x+Math.imul(De,lt)|0,d=d+Math.imul(De,bt)|0,d=d+Math.imul(Se,lt)|0,A=A+Math.imul(Se,bt)|0,x=x+Math.imul(ye,pt)|0,d=d+Math.imul(ye,_t)|0,d=d+Math.imul(Ie,pt)|0,A=A+Math.imul(Ie,_t)|0,x=x+Math.imul(qe,Dt)|0,d=d+Math.imul(qe,We)|0,d=d+Math.imul(Ue,Dt)|0,A=A+Math.imul(Ue,We)|0,x=x+Math.imul(Ae,Ve)|0,d=d+Math.imul(Ae,Ge)|0,d=d+Math.imul(Me,Ve)|0,A=A+Math.imul(Me,Ge)|0,x=x+Math.imul(oe,He)|0,d=d+Math.imul(oe,rt)|0,d=d+Math.imul(le,He)|0,A=A+Math.imul(le,rt)|0,x=x+Math.imul(K,Je)|0,d=d+Math.imul(K,it)|0,d=d+Math.imul(v,Je)|0,A=A+Math.imul(v,it)|0,x=x+Math.imul(be,et)|0,d=d+Math.imul(be,Ye)|0,d=d+Math.imul(G,et)|0,A=A+Math.imul(G,Ye)|0,x=x+Math.imul(ee,nt)|0,d=d+Math.imul(ee,st)|0,d=d+Math.imul(he,nt)|0,A=A+Math.imul(he,st)|0;var Ln=(R+x|0)+((d&8191)<<13)|0;R=(A+(d>>>13)|0)+(Ln>>>26)|0,Ln&=67108863,x=Math.imul(_e,Ce),d=Math.imul(_e,Re),d=d+Math.imul(Oe,Ce)|0,A=Math.imul(Oe,Re),x=x+Math.imul(me,lt)|0,d=d+Math.imul(me,bt)|0,d=d+Math.imul(xe,lt)|0,A=A+Math.imul(xe,bt)|0,x=x+Math.imul(De,pt)|0,d=d+Math.imul(De,_t)|0,d=d+Math.imul(Se,pt)|0,A=A+Math.imul(Se,_t)|0,x=x+Math.imul(ye,Dt)|0,d=d+Math.imul(ye,We)|0,d=d+Math.imul(Ie,Dt)|0,A=A+Math.imul(Ie,We)|0,x=x+Math.imul(qe,Ve)|0,d=d+Math.imul(qe,Ge)|0,d=d+Math.imul(Ue,Ve)|0,A=A+Math.imul(Ue,Ge)|0,x=x+Math.imul(Ae,He)|0,d=d+Math.imul(Ae,rt)|0,d=d+Math.imul(Me,He)|0,A=A+Math.imul(Me,rt)|0,x=x+Math.imul(oe,Je)|0,d=d+Math.imul(oe,it)|0,d=d+Math.imul(le,Je)|0,A=A+Math.imul(le,it)|0,x=x+Math.imul(K,et)|0,d=d+Math.imul(K,Ye)|0,d=d+Math.imul(v,et)|0,A=A+Math.imul(v,Ye)|0,x=x+Math.imul(be,nt)|0,d=d+Math.imul(be,st)|0,d=d+Math.imul(G,nt)|0,A=A+Math.imul(G,st)|0,x=x+Math.imul(ee,Bt)|0,d=d+Math.imul(ee,zt)|0,d=d+Math.imul(he,Bt)|0,A=A+Math.imul(he,zt)|0;var Oi=(R+x|0)+((d&8191)<<13)|0;R=(A+(d>>>13)|0)+(Oi>>>26)|0,Oi&=67108863,x=Math.imul(_e,lt),d=Math.imul(_e,bt),d=d+Math.imul(Oe,lt)|0,A=Math.imul(Oe,bt),x=x+Math.imul(me,pt)|0,d=d+Math.imul(me,_t)|0,d=d+Math.imul(xe,pt)|0,A=A+Math.imul(xe,_t)|0,x=x+Math.imul(De,Dt)|0,d=d+Math.imul(De,We)|0,d=d+Math.imul(Se,Dt)|0,A=A+Math.imul(Se,We)|0,x=x+Math.imul(ye,Ve)|0,d=d+Math.imul(ye,Ge)|0,d=d+Math.imul(Ie,Ve)|0,A=A+Math.imul(Ie,Ge)|0,x=x+Math.imul(qe,He)|0,d=d+Math.imul(qe,rt)|0,d=d+Math.imul(Ue,He)|0,A=A+Math.imul(Ue,rt)|0,x=x+Math.imul(Ae,Je)|0,d=d+Math.imul(Ae,it)|0,d=d+Math.imul(Me,Je)|0,A=A+Math.imul(Me,it)|0,x=x+Math.imul(oe,et)|0,d=d+Math.imul(oe,Ye)|0,d=d+Math.imul(le,et)|0,A=A+Math.imul(le,Ye)|0,x=x+Math.imul(K,nt)|0,d=d+Math.imul(K,st)|0,d=d+Math.imul(v,nt)|0,A=A+Math.imul(v,st)|0,x=x+Math.imul(be,Bt)|0,d=d+Math.imul(be,zt)|0,d=d+Math.imul(G,Bt)|0,A=A+Math.imul(G,zt)|0;var Fn=(R+x|0)+((d&8191)<<13)|0;R=(A+(d>>>13)|0)+(Fn>>>26)|0,Fn&=67108863,x=Math.imul(_e,pt),d=Math.imul(_e,_t),d=d+Math.imul(Oe,pt)|0,A=Math.imul(Oe,_t),x=x+Math.imul(me,Dt)|0,d=d+Math.imul(me,We)|0,d=d+Math.imul(xe,Dt)|0,A=A+Math.imul(xe,We)|0,x=x+Math.imul(De,Ve)|0,d=d+Math.imul(De,Ge)|0,d=d+Math.imul(Se,Ve)|0,A=A+Math.imul(Se,Ge)|0,x=x+Math.imul(ye,He)|0,d=d+Math.imul(ye,rt)|0,d=d+Math.imul(Ie,He)|0,A=A+Math.imul(Ie,rt)|0,x=x+Math.imul(qe,Je)|0,d=d+Math.imul(qe,it)|0,d=d+Math.imul(Ue,Je)|0,A=A+Math.imul(Ue,it)|0,x=x+Math.imul(Ae,et)|0,d=d+Math.imul(Ae,Ye)|0,d=d+Math.imul(Me,et)|0,A=A+Math.imul(Me,Ye)|0,x=x+Math.imul(oe,nt)|0,d=d+Math.imul(oe,st)|0,d=d+Math.imul(le,nt)|0,A=A+Math.imul(le,st)|0,x=x+Math.imul(K,Bt)|0,d=d+Math.imul(K,zt)|0,d=d+Math.imul(v,Bt)|0,A=A+Math.imul(v,zt)|0;var qn=(R+x|0)+((d&8191)<<13)|0;R=(A+(d>>>13)|0)+(qn>>>26)|0,qn&=67108863,x=Math.imul(_e,Dt),d=Math.imul(_e,We),d=d+Math.imul(Oe,Dt)|0,A=Math.imul(Oe,We),x=x+Math.imul(me,Ve)|0,d=d+Math.imul(me,Ge)|0,d=d+Math.imul(xe,Ve)|0,A=A+Math.imul(xe,Ge)|0,x=x+Math.imul(De,He)|0,d=d+Math.imul(De,rt)|0,d=d+Math.imul(Se,He)|0,A=A+Math.imul(Se,rt)|0,x=x+Math.imul(ye,Je)|0,d=d+Math.imul(ye,it)|0,d=d+Math.imul(Ie,Je)|0,A=A+Math.imul(Ie,it)|0,x=x+Math.imul(qe,et)|0,d=d+Math.imul(qe,Ye)|0,d=d+Math.imul(Ue,et)|0,A=A+Math.imul(Ue,Ye)|0,x=x+Math.imul(Ae,nt)|0,d=d+Math.imul(Ae,st)|0,d=d+Math.imul(Me,nt)|0,A=A+Math.imul(Me,st)|0,x=x+Math.imul(oe,Bt)|0,d=d+Math.imul(oe,zt)|0,d=d+Math.imul(le,Bt)|0,A=A+Math.imul(le,zt)|0;var Ci=(R+x|0)+((d&8191)<<13)|0;R=(A+(d>>>13)|0)+(Ci>>>26)|0,Ci&=67108863,x=Math.imul(_e,Ve),d=Math.imul(_e,Ge),d=d+Math.imul(Oe,Ve)|0,A=Math.imul(Oe,Ge),x=x+Math.imul(me,He)|0,d=d+Math.imul(me,rt)|0,d=d+Math.imul(xe,He)|0,A=A+Math.imul(xe,rt)|0,x=x+Math.imul(De,Je)|0,d=d+Math.imul(De,it)|0,d=d+Math.imul(Se,Je)|0,A=A+Math.imul(Se,it)|0,x=x+Math.imul(ye,et)|0,d=d+Math.imul(ye,Ye)|0,d=d+Math.imul(Ie,et)|0,A=A+Math.imul(Ie,Ye)|0,x=x+Math.imul(qe,nt)|0,d=d+Math.imul(qe,st)|0,d=d+Math.imul(Ue,nt)|0,A=A+Math.imul(Ue,st)|0,x=x+Math.imul(Ae,Bt)|0,d=d+Math.imul(Ae,zt)|0,d=d+Math.imul(Me,Bt)|0,A=A+Math.imul(Me,zt)|0;var un=(R+x|0)+((d&8191)<<13)|0;R=(A+(d>>>13)|0)+(un>>>26)|0,un&=67108863,x=Math.imul(_e,He),d=Math.imul(_e,rt),d=d+Math.imul(Oe,He)|0,A=Math.imul(Oe,rt),x=x+Math.imul(me,Je)|0,d=d+Math.imul(me,it)|0,d=d+Math.imul(xe,Je)|0,A=A+Math.imul(xe,it)|0,x=x+Math.imul(De,et)|0,d=d+Math.imul(De,Ye)|0,d=d+Math.imul(Se,et)|0,A=A+Math.imul(Se,Ye)|0,x=x+Math.imul(ye,nt)|0,d=d+Math.imul(ye,st)|0,d=d+Math.imul(Ie,nt)|0,A=A+Math.imul(Ie,st)|0,x=x+Math.imul(qe,Bt)|0,d=d+Math.imul(qe,zt)|0,d=d+Math.imul(Ue,Bt)|0,A=A+Math.imul(Ue,zt)|0;var dn=(R+x|0)+((d&8191)<<13)|0;R=(A+(d>>>13)|0)+(dn>>>26)|0,dn&=67108863,x=Math.imul(_e,Je),d=Math.imul(_e,it),d=d+Math.imul(Oe,Je)|0,A=Math.imul(Oe,it),x=x+Math.imul(me,et)|0,d=d+Math.imul(me,Ye)|0,d=d+Math.imul(xe,et)|0,A=A+Math.imul(xe,Ye)|0,x=x+Math.imul(De,nt)|0,d=d+Math.imul(De,st)|0,d=d+Math.imul(Se,nt)|0,A=A+Math.imul(Se,st)|0,x=x+Math.imul(ye,Bt)|0,d=d+Math.imul(ye,zt)|0,d=d+Math.imul(Ie,Bt)|0,A=A+Math.imul(Ie,zt)|0;var Sr=(R+x|0)+((d&8191)<<13)|0;R=(A+(d>>>13)|0)+(Sr>>>26)|0,Sr&=67108863,x=Math.imul(_e,et),d=Math.imul(_e,Ye),d=d+Math.imul(Oe,et)|0,A=Math.imul(Oe,Ye),x=x+Math.imul(me,nt)|0,d=d+Math.imul(me,st)|0,d=d+Math.imul(xe,nt)|0,A=A+Math.imul(xe,st)|0,x=x+Math.imul(De,Bt)|0,d=d+Math.imul(De,zt)|0,d=d+Math.imul(Se,Bt)|0,A=A+Math.imul(Se,zt)|0;var Un=(R+x|0)+((d&8191)<<13)|0;R=(A+(d>>>13)|0)+(Un>>>26)|0,Un&=67108863,x=Math.imul(_e,nt),d=Math.imul(_e,st),d=d+Math.imul(Oe,nt)|0,A=Math.imul(Oe,st),x=x+Math.imul(me,Bt)|0,d=d+Math.imul(me,zt)|0,d=d+Math.imul(xe,Bt)|0,A=A+Math.imul(xe,zt)|0;var Bn=(R+x|0)+((d&8191)<<13)|0;R=(A+(d>>>13)|0)+(Bn>>>26)|0,Bn&=67108863,x=Math.imul(_e,Bt),d=Math.imul(_e,zt),d=d+Math.imul(Oe,Bt)|0,A=Math.imul(Oe,zt);var zn=(R+x|0)+((d&8191)<<13)|0;return R=(A+(d>>>13)|0)+(zn>>>26)|0,zn&=67108863,N[0]=vr,N[1]=Cn,N[2]=Rn,N[3]=Tn,N[4]=Nn,N[5]=$n,N[6]=zr,N[7]=Mi,N[8]=Ln,N[9]=Oi,N[10]=Fn,N[11]=qn,N[12]=Ci,N[13]=un,N[14]=dn,N[15]=Sr,N[16]=Un,N[17]=Bn,N[18]=zn,R!==0&&(N[19]=R,w.length++),w};Math.imul||(H=M);function k(L,u,y){y.negative=u.negative^L.negative,y.length=L.length+u.length;for(var w=0,E=0,O=0;O<y.length-1;O++){var N=E;E=0;for(var R=w&67108863,x=Math.min(O,u.length-1),d=Math.max(0,O-L.length+1);d<=x;d++){var A=O-d,fe=L.words[A]|0,ee=u.words[d]|0,he=fe*ee,ne=he&67108863;N=N+(he/67108864|0)|0,ne=ne+R|0,R=ne&67108863,N=N+(ne>>>26)|0,E+=N>>>26,N&=67108863}y.words[O]=R,w=N,N=E}return w!==0?y.words[O]=w:y.length--,y.strip()}function X(L,u,y){var w=new F;return w.mulp(L,u,y)}o.prototype.mulTo=function(u,y){var w,E=this.length+u.length;return this.length===10&&u.length===10?w=H(this,u,y):E<63?w=M(this,u,y):E<1024?w=k(this,u,y):w=X(this,u,y),w};function F(L,u){this.x=L,this.y=u}F.prototype.makeRBT=function(u){for(var y=new Array(u),w=o.prototype._countBits(u)-1,E=0;E<u;E++)y[E]=this.revBin(E,w,u);return y},F.prototype.revBin=function(u,y,w){if(u===0||u===w-1)return u;for(var E=0,O=0;O<y;O++)E|=(u&1)<<y-O-1,u>>=1;return E},F.prototype.permute=function(u,y,w,E,O,N){for(var R=0;R<N;R++)E[R]=y[u[R]],O[R]=w[u[R]]},F.prototype.transform=function(u,y,w,E,O,N){this.permute(N,u,y,w,E,O);for(var R=1;R<O;R<<=1)for(var x=R<<1,d=Math.cos(2*Math.PI/x),A=Math.sin(2*Math.PI/x),fe=0;fe<O;fe+=x)for(var ee=d,he=A,ne=0;ne<R;ne++){var be=w[fe+ne],G=E[fe+ne],Z=w[fe+ne+R],K=E[fe+ne+R],v=ee*Z-he*K;K=ee*K+he*Z,Z=v,w[fe+ne]=be+Z,E[fe+ne]=G+K,w[fe+ne+R]=be-Z,E[fe+ne+R]=G-K,ne!==x&&(v=d*ee-A*he,he=d*he+A*ee,ee=v)}},F.prototype.guessLen13b=function(u,y){var w=Math.max(y,u)|1,E=w&1,O=0;for(w=w/2|0;w;w=w>>>1)O++;return 1<<O+1+E},F.prototype.conjugate=function(u,y,w){if(!(w<=1))for(var E=0;E<w/2;E++){var O=u[E];u[E]=u[w-E-1],u[w-E-1]=O,O=y[E],y[E]=-y[w-E-1],y[w-E-1]=-O}},F.prototype.normalize13b=function(u,y){for(var w=0,E=0;E<y/2;E++){var O=Math.round(u[2*E+1]/y)*8192+Math.round(u[2*E]/y)+w;u[E]=O&67108863,O<67108864?w=0:w=O/67108864|0}return u},F.prototype.convert13b=function(u,y,w,E){for(var O=0,N=0;N<y;N++)O=O+(u[N]|0),w[2*N]=O&8191,O=O>>>13,w[2*N+1]=O&8191,O=O>>>13;for(N=2*y;N<E;++N)w[N]=0;n(O===0),n((O&-8192)===0)},F.prototype.stub=function(u){for(var y=new Array(u),w=0;w<u;w++)y[w]=0;return y},F.prototype.mulp=function(u,y,w){var E=2*this.guessLen13b(u.length,y.length),O=this.makeRBT(E),N=this.stub(E),R=new Array(E),x=new Array(E),d=new Array(E),A=new Array(E),fe=new Array(E),ee=new Array(E),he=w.words;he.length=E,this.convert13b(u.words,u.length,R,E),this.convert13b(y.words,y.length,A,E),this.transform(R,N,x,d,E,O),this.transform(A,N,fe,ee,E,O);for(var ne=0;ne<E;ne++){var be=x[ne]*fe[ne]-d[ne]*ee[ne];d[ne]=x[ne]*ee[ne]+d[ne]*fe[ne],x[ne]=be}return this.conjugate(x,d,E),this.transform(x,d,he,N,E,O),this.conjugate(he,N,E),this.normalize13b(he,E),w.negative=u.negative^y.negative,w.length=u.length+y.length,w.strip()},o.prototype.mul=function(u){var y=new o(null);return y.words=new Array(this.length+u.length),this.mulTo(u,y)},o.prototype.mulf=function(u){var y=new o(null);return y.words=new Array(this.length+u.length),X(this,u,y)},o.prototype.imul=function(u){return this.clone().mulTo(u,this)},o.prototype.imuln=function(u){n(typeof u=="number"),n(u<67108864);for(var y=0,w=0;w<this.length;w++){var E=(this.words[w]|0)*u,O=(E&67108863)+(y&67108863);y>>=26,y+=E/67108864|0,y+=O>>>26,this.words[w]=O&67108863}return y!==0&&(this.words[w]=y,this.length++),this},o.prototype.muln=function(u){return this.clone().imuln(u)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(u){var y=I(u);if(y.length===0)return new o(1);for(var w=this,E=0;E<y.length&&y[E]===0;E++,w=w.sqr());if(++E<y.length)for(var O=w.sqr();E<y.length;E++,O=O.sqr())y[E]!==0&&(w=w.mul(O));return w},o.prototype.iushln=function(u){n(typeof u=="number"&&u>=0);var y=u%26,w=(u-y)/26,E=67108863>>>26-y<<26-y,O;if(y!==0){var N=0;for(O=0;O<this.length;O++){var R=this.words[O]&E,x=(this.words[O]|0)-R<<y;this.words[O]=x|N,N=R>>>26-y}N&&(this.words[O]=N,this.length++)}if(w!==0){for(O=this.length-1;O>=0;O--)this.words[O+w]=this.words[O];for(O=0;O<w;O++)this.words[O]=0;this.length+=w}return this.strip()},o.prototype.ishln=function(u){return n(this.negative===0),this.iushln(u)},o.prototype.iushrn=function(u,y,w){n(typeof u=="number"&&u>=0);var E;y?E=(y-y%26)/26:E=0;var O=u%26,N=Math.min((u-O)/26,this.length),R=67108863^67108863>>>O<<O,x=w;if(E-=N,E=Math.max(0,E),x){for(var d=0;d<N;d++)x.words[d]=this.words[d];x.length=N}if(N!==0)if(this.length>N)for(this.length-=N,d=0;d<this.length;d++)this.words[d]=this.words[d+N];else this.words[0]=0,this.length=1;var A=0;for(d=this.length-1;d>=0&&(A!==0||d>=E);d--){var fe=this.words[d]|0;this.words[d]=A<<26-O|fe>>>O,A=fe&R}return x&&A!==0&&(x.words[x.length++]=A),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(u,y,w){return n(this.negative===0),this.iushrn(u,y,w)},o.prototype.shln=function(u){return this.clone().ishln(u)},o.prototype.ushln=function(u){return this.clone().iushln(u)},o.prototype.shrn=function(u){return this.clone().ishrn(u)},o.prototype.ushrn=function(u){return this.clone().iushrn(u)},o.prototype.testn=function(u){n(typeof u=="number"&&u>=0);var y=u%26,w=(u-y)/26,E=1<<y;if(this.length<=w)return!1;var O=this.words[w];return!!(O&E)},o.prototype.imaskn=function(u){n(typeof u=="number"&&u>=0);var y=u%26,w=(u-y)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=w)return this;if(y!==0&&w++,this.length=Math.min(w,this.length),y!==0){var E=67108863^67108863>>>y<<y;this.words[this.length-1]&=E}return this.strip()},o.prototype.maskn=function(u){return this.clone().imaskn(u)},o.prototype.iaddn=function(u){return n(typeof u=="number"),n(u<67108864),u<0?this.isubn(-u):this.negative!==0?this.length===1&&(this.words[0]|0)<u?(this.words[0]=u-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(u),this.negative=1,this):this._iaddn(u)},o.prototype._iaddn=function(u){this.words[0]+=u;for(var y=0;y<this.length&&this.words[y]>=67108864;y++)this.words[y]-=67108864,y===this.length-1?this.words[y+1]=1:this.words[y+1]++;return this.length=Math.max(this.length,y+1),this},o.prototype.isubn=function(u){if(n(typeof u=="number"),n(u<67108864),u<0)return this.iaddn(-u);if(this.negative!==0)return this.negative=0,this.iaddn(u),this.negative=1,this;if(this.words[0]-=u,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var y=0;y<this.length&&this.words[y]<0;y++)this.words[y]+=67108864,this.words[y+1]-=1;return this.strip()},o.prototype.addn=function(u){return this.clone().iaddn(u)},o.prototype.subn=function(u){return this.clone().isubn(u)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(u,y,w){var E=u.length+w,O;this._expand(E);var N,R=0;for(O=0;O<u.length;O++){N=(this.words[O+w]|0)+R;var x=(u.words[O]|0)*y;N-=x&67108863,R=(N>>26)-(x/67108864|0),this.words[O+w]=N&67108863}for(;O<this.length-w;O++)N=(this.words[O+w]|0)+R,R=N>>26,this.words[O+w]=N&67108863;if(R===0)return this.strip();for(n(R===-1),R=0,O=0;O<this.length;O++)N=-(this.words[O]|0)+R,R=N>>26,this.words[O]=N&67108863;return this.negative=1,this.strip()},o.prototype._wordDiv=function(u,y){var w=this.length-u.length,E=this.clone(),O=u,N=O.words[O.length-1]|0,R=this._countBits(N);w=26-R,w!==0&&(O=O.ushln(w),E.iushln(w),N=O.words[O.length-1]|0);var x=E.length-O.length,d;if(y!=="mod"){d=new o(null),d.length=x+1,d.words=new Array(d.length);for(var A=0;A<d.length;A++)d.words[A]=0}var fe=E.clone()._ishlnsubmul(O,1,x);fe.negative===0&&(E=fe,d&&(d.words[x]=1));for(var ee=x-1;ee>=0;ee--){var he=(E.words[O.length+ee]|0)*67108864+(E.words[O.length+ee-1]|0);for(he=Math.min(he/N|0,67108863),E._ishlnsubmul(O,he,ee);E.negative!==0;)he--,E.negative=0,E._ishlnsubmul(O,1,ee),E.isZero()||(E.negative^=1);d&&(d.words[ee]=he)}return d&&d.strip(),E.strip(),y!=="div"&&w!==0&&E.iushrn(w),{div:d||null,mod:E}},o.prototype.divmod=function(u,y,w){if(n(!u.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var E,O,N;return this.negative!==0&&u.negative===0?(N=this.neg().divmod(u,y),y!=="mod"&&(E=N.div.neg()),y!=="div"&&(O=N.mod.neg(),w&&O.negative!==0&&O.iadd(u)),{div:E,mod:O}):this.negative===0&&u.negative!==0?(N=this.divmod(u.neg(),y),y!=="mod"&&(E=N.div.neg()),{div:E,mod:N.mod}):this.negative&u.negative?(N=this.neg().divmod(u.neg(),y),y!=="div"&&(O=N.mod.neg(),w&&O.negative!==0&&O.isub(u)),{div:N.div,mod:O}):u.length>this.length||this.cmp(u)<0?{div:new o(0),mod:this}:u.length===1?y==="div"?{div:this.divn(u.words[0]),mod:null}:y==="mod"?{div:null,mod:new o(this.modn(u.words[0]))}:{div:this.divn(u.words[0]),mod:new o(this.modn(u.words[0]))}:this._wordDiv(u,y)},o.prototype.div=function(u){return this.divmod(u,"div",!1).div},o.prototype.mod=function(u){return this.divmod(u,"mod",!1).mod},o.prototype.umod=function(u){return this.divmod(u,"mod",!0).mod},o.prototype.divRound=function(u){var y=this.divmod(u);if(y.mod.isZero())return y.div;var w=y.div.negative!==0?y.mod.isub(u):y.mod,E=u.ushrn(1),O=u.andln(1),N=w.cmp(E);return N<0||O===1&&N===0?y.div:y.div.negative!==0?y.div.isubn(1):y.div.iaddn(1)},o.prototype.modn=function(u){n(u<=67108863);for(var y=(1<<26)%u,w=0,E=this.length-1;E>=0;E--)w=(y*w+(this.words[E]|0))%u;return w},o.prototype.idivn=function(u){n(u<=67108863);for(var y=0,w=this.length-1;w>=0;w--){var E=(this.words[w]|0)+y*67108864;this.words[w]=E/u|0,y=E%u}return this.strip()},o.prototype.divn=function(u){return this.clone().idivn(u)},o.prototype.egcd=function(u){n(u.negative===0),n(!u.isZero());var y=this,w=u.clone();y.negative!==0?y=y.umod(u):y=y.clone();for(var E=new o(1),O=new o(0),N=new o(0),R=new o(1),x=0;y.isEven()&&w.isEven();)y.iushrn(1),w.iushrn(1),++x;for(var d=w.clone(),A=y.clone();!y.isZero();){for(var fe=0,ee=1;!(y.words[0]&ee)&&fe<26;++fe,ee<<=1);if(fe>0)for(y.iushrn(fe);fe-- >0;)(E.isOdd()||O.isOdd())&&(E.iadd(d),O.isub(A)),E.iushrn(1),O.iushrn(1);for(var he=0,ne=1;!(w.words[0]&ne)&&he<26;++he,ne<<=1);if(he>0)for(w.iushrn(he);he-- >0;)(N.isOdd()||R.isOdd())&&(N.iadd(d),R.isub(A)),N.iushrn(1),R.iushrn(1);y.cmp(w)>=0?(y.isub(w),E.isub(N),O.isub(R)):(w.isub(y),N.isub(E),R.isub(O))}return{a:N,b:R,gcd:w.iushln(x)}},o.prototype._invmp=function(u){n(u.negative===0),n(!u.isZero());var y=this,w=u.clone();y.negative!==0?y=y.umod(u):y=y.clone();for(var E=new o(1),O=new o(0),N=w.clone();y.cmpn(1)>0&&w.cmpn(1)>0;){for(var R=0,x=1;!(y.words[0]&x)&&R<26;++R,x<<=1);if(R>0)for(y.iushrn(R);R-- >0;)E.isOdd()&&E.iadd(N),E.iushrn(1);for(var d=0,A=1;!(w.words[0]&A)&&d<26;++d,A<<=1);if(d>0)for(w.iushrn(d);d-- >0;)O.isOdd()&&O.iadd(N),O.iushrn(1);y.cmp(w)>=0?(y.isub(w),E.isub(O)):(w.isub(y),O.isub(E))}var fe;return y.cmpn(1)===0?fe=E:fe=O,fe.cmpn(0)<0&&fe.iadd(u),fe},o.prototype.gcd=function(u){if(this.isZero())return u.abs();if(u.isZero())return this.abs();var y=this.clone(),w=u.clone();y.negative=0,w.negative=0;for(var E=0;y.isEven()&&w.isEven();E++)y.iushrn(1),w.iushrn(1);do{for(;y.isEven();)y.iushrn(1);for(;w.isEven();)w.iushrn(1);var O=y.cmp(w);if(O<0){var N=y;y=w,w=N}else if(O===0||w.cmpn(1)===0)break;y.isub(w)}while(!0);return w.iushln(E)},o.prototype.invm=function(u){return this.egcd(u).a.umod(u)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(u){return this.words[0]&u},o.prototype.bincn=function(u){n(typeof u=="number");var y=u%26,w=(u-y)/26,E=1<<y;if(this.length<=w)return this._expand(w+1),this.words[w]|=E,this;for(var O=E,N=w;O!==0&&N<this.length;N++){var R=this.words[N]|0;R+=O,O=R>>>26,R&=67108863,this.words[N]=R}return O!==0&&(this.words[N]=O,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(u){var y=u<0;if(this.negative!==0&&!y)return-1;if(this.negative===0&&y)return 1;this.strip();var w;if(this.length>1)w=1;else{y&&(u=-u),n(u<=67108863,"Number is too big");var E=this.words[0]|0;w=E===u?0:E<u?-1:1}return this.negative!==0?-w|0:w},o.prototype.cmp=function(u){if(this.negative!==0&&u.negative===0)return-1;if(this.negative===0&&u.negative!==0)return 1;var y=this.ucmp(u);return this.negative!==0?-y|0:y},o.prototype.ucmp=function(u){if(this.length>u.length)return 1;if(this.length<u.length)return-1;for(var y=0,w=this.length-1;w>=0;w--){var E=this.words[w]|0,O=u.words[w]|0;if(E!==O){E<O?y=-1:E>O&&(y=1);break}}return y},o.prototype.gtn=function(u){return this.cmpn(u)===1},o.prototype.gt=function(u){return this.cmp(u)===1},o.prototype.gten=function(u){return this.cmpn(u)>=0},o.prototype.gte=function(u){return this.cmp(u)>=0},o.prototype.ltn=function(u){return this.cmpn(u)===-1},o.prototype.lt=function(u){return this.cmp(u)===-1},o.prototype.lten=function(u){return this.cmpn(u)<=0},o.prototype.lte=function(u){return this.cmp(u)<=0},o.prototype.eqn=function(u){return this.cmpn(u)===0},o.prototype.eq=function(u){return this.cmp(u)===0},o.red=function(u){return new re(u)},o.prototype.toRed=function(u){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),u.convertTo(this)._forceRed(u)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(u){return this.red=u,this},o.prototype.forceRed=function(u){return n(!this.red,"Already a number in reduction context"),this._forceRed(u)},o.prototype.redAdd=function(u){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,u)},o.prototype.redIAdd=function(u){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,u)},o.prototype.redSub=function(u){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,u)},o.prototype.redISub=function(u){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,u)},o.prototype.redShl=function(u){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,u)},o.prototype.redMul=function(u){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.mul(this,u)},o.prototype.redIMul=function(u){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.imul(this,u)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(u){return n(this.red&&!u.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,u)};var V={k256:null,p224:null,p192:null,p25519:null};function $(L,u){this.name=L,this.p=new o(u,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}$.prototype._tmp=function(){var u=new o(null);return u.words=new Array(Math.ceil(this.n/13)),u},$.prototype.ireduce=function(u){var y=u,w;do this.split(y,this.tmp),y=this.imulK(y),y=y.iadd(this.tmp),w=y.bitLength();while(w>this.n);var E=w<this.n?-1:y.ucmp(this.p);return E===0?(y.words[0]=0,y.length=1):E>0?y.isub(this.p):y.strip!==void 0?y.strip():y._strip(),y},$.prototype.split=function(u,y){u.iushrn(this.n,0,y)},$.prototype.imulK=function(u){return u.imul(this.k)};function U(){$.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(U,$),U.prototype.split=function(u,y){for(var w=4194303,E=Math.min(u.length,9),O=0;O<E;O++)y.words[O]=u.words[O];if(y.length=E,u.length<=9){u.words[0]=0,u.length=1;return}var N=u.words[9];for(y.words[y.length++]=N&w,O=10;O<u.length;O++){var R=u.words[O]|0;u.words[O-10]=(R&w)<<4|N>>>22,N=R}N>>>=22,u.words[O-10]=N,N===0&&u.length>10?u.length-=10:u.length-=9},U.prototype.imulK=function(u){u.words[u.length]=0,u.words[u.length+1]=0,u.length+=2;for(var y=0,w=0;w<u.length;w++){var E=u.words[w]|0;y+=E*977,u.words[w]=y&67108863,y=E*64+(y/67108864|0)}return u.words[u.length-1]===0&&(u.length--,u.words[u.length-1]===0&&u.length--),u};function z(){$.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(z,$);function b(){$.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(b,$);function T(){$.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(T,$),T.prototype.imulK=function(u){for(var y=0,w=0;w<u.length;w++){var E=(u.words[w]|0)*19+y,O=E&67108863;E>>>=26,u.words[w]=O,y=E}return y!==0&&(u.words[u.length++]=y),u},o._prime=function(u){if(V[u])return V[u];var y;if(u==="k256")y=new U;else if(u==="p224")y=new z;else if(u==="p192")y=new b;else if(u==="p25519")y=new T;else throw new Error("Unknown prime "+u);return V[u]=y,y};function re(L){if(typeof L=="string"){var u=o._prime(L);this.m=u.p,this.prime=u}else n(L.gtn(1),"modulus must be greater than 1"),this.m=L,this.prime=null}re.prototype._verify1=function(u){n(u.negative===0,"red works only with positives"),n(u.red,"red works only with red numbers")},re.prototype._verify2=function(u,y){n((u.negative|y.negative)===0,"red works only with positives"),n(u.red&&u.red===y.red,"red works only with red numbers")},re.prototype.imod=function(u){return this.prime?this.prime.ireduce(u)._forceRed(this):u.umod(this.m)._forceRed(this)},re.prototype.neg=function(u){return u.isZero()?u.clone():this.m.sub(u)._forceRed(this)},re.prototype.add=function(u,y){this._verify2(u,y);var w=u.add(y);return w.cmp(this.m)>=0&&w.isub(this.m),w._forceRed(this)},re.prototype.iadd=function(u,y){this._verify2(u,y);var w=u.iadd(y);return w.cmp(this.m)>=0&&w.isub(this.m),w},re.prototype.sub=function(u,y){this._verify2(u,y);var w=u.sub(y);return w.cmpn(0)<0&&w.iadd(this.m),w._forceRed(this)},re.prototype.isub=function(u,y){this._verify2(u,y);var w=u.isub(y);return w.cmpn(0)<0&&w.iadd(this.m),w},re.prototype.shl=function(u,y){return this._verify1(u),this.imod(u.ushln(y))},re.prototype.imul=function(u,y){return this._verify2(u,y),this.imod(u.imul(y))},re.prototype.mul=function(u,y){return this._verify2(u,y),this.imod(u.mul(y))},re.prototype.isqr=function(u){return this.imul(u,u.clone())},re.prototype.sqr=function(u){return this.mul(u,u)},re.prototype.sqrt=function(u){if(u.isZero())return u.clone();var y=this.m.andln(3);if(n(y%2===1),y===3){var w=this.m.add(new o(1)).iushrn(2);return this.pow(u,w)}for(var E=this.m.subn(1),O=0;!E.isZero()&&E.andln(1)===0;)O++,E.iushrn(1);n(!E.isZero());var N=new o(1).toRed(this),R=N.redNeg(),x=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new o(2*d*d).toRed(this);this.pow(d,x).cmp(R)!==0;)d.redIAdd(R);for(var A=this.pow(d,E),fe=this.pow(u,E.addn(1).iushrn(1)),ee=this.pow(u,E),he=O;ee.cmp(N)!==0;){for(var ne=ee,be=0;ne.cmp(N)!==0;be++)ne=ne.redSqr();n(be<he);var G=this.pow(A,new o(1).iushln(he-be-1));fe=fe.redMul(G),A=G.redSqr(),ee=ee.redMul(A),he=be}return fe},re.prototype.invm=function(u){var y=u._invmp(this.m);return y.negative!==0?(y.negative=0,this.imod(y).redNeg()):this.imod(y)},re.prototype.pow=function(u,y){if(y.isZero())return new o(1).toRed(this);if(y.cmpn(1)===0)return u.clone();var w=4,E=new Array(1<<w);E[0]=new o(1).toRed(this),E[1]=u;for(var O=2;O<E.length;O++)E[O]=this.mul(E[O-1],u);var N=E[0],R=0,x=0,d=y.bitLength()%26;for(d===0&&(d=26),O=y.length-1;O>=0;O--){for(var A=y.words[O],fe=d-1;fe>=0;fe--){var ee=A>>fe&1;if(N!==E[0]&&(N=this.sqr(N)),ee===0&&R===0){x=0;continue}R<<=1,R|=ee,x++,!(x!==w&&(O!==0||fe!==0))&&(N=this.mul(N,E[R]),x=0,R=0)}d=26}return N},re.prototype.convertTo=function(u){var y=u.umod(this.m);return y===u?y.clone():y},re.prototype.convertFrom=function(u){var y=u.clone();return y.red=null,y},o.mont=function(u){return new de(u)};function de(L){re.call(this,L),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(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)}s(de,re),de.prototype.convertTo=function(u){return this.imod(u.ushln(this.shift))},de.prototype.convertFrom=function(u){var y=this.imod(u.mul(this.rinv));return y.red=null,y},de.prototype.imul=function(u,y){if(u.isZero()||y.isZero())return u.words[0]=0,u.length=1,u;var w=u.imul(y),E=w.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=w.isub(E).iushrn(this.shift),N=O;return O.cmp(this.m)>=0?N=O.isub(this.m):O.cmpn(0)<0&&(N=O.iadd(this.m)),N._forceRed(this)},de.prototype.mul=function(u,y){if(u.isZero()||y.isZero())return new o(0)._forceRed(this);var w=u.mul(y),E=w.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=w.isub(E).iushrn(this.shift),N=O;return O.cmp(this.m)>=0?N=O.isub(this.m):O.cmpn(0)<0&&(N=O.iadd(this.m)),N._forceRed(this)},de.prototype.invm=function(u){var y=this.imod(u._invmp(this.m).mul(this.r2));return y._forceRed(this)}})(r,_r)})(fu);var hn=fu.exports;(function(r){var e=r,t=hn,n=t2,s=r2;e.assert=n,e.toArray=s.toArray,e.zero2=s.zero2,e.toHex=s.toHex,e.encode=s.encode;function o(m,_,D){var I=new Array(Math.max(m.bitLength(),D)+1),M;for(M=0;M<I.length;M+=1)I[M]=0;var H=1<<_+1,k=m.clone();for(M=0;M<I.length;M++){var X,F=k.andln(H-1);k.isOdd()?(F>(H>>1)-1?X=(H>>1)-F:X=F,k.isubn(X)):X=0,I[M]=X,k.iushrn(1)}return I}e.getNAF=o;function f(m,_){var D=[[],[]];m=m.clone(),_=_.clone();for(var I=0,M=0,H;m.cmpn(-I)>0||_.cmpn(-M)>0;){var k=m.andln(3)+I&3,X=_.andln(3)+M&3;k===3&&(k=-1),X===3&&(X=-1);var F;k&1?(H=m.andln(7)+I&7,(H===3||H===5)&&X===2?F=-k:F=k):F=0,D[0].push(F);var V;X&1?(H=_.andln(7)+M&7,(H===3||H===5)&&k===2?V=-X:V=X):V=0,D[1].push(V),2*I===F+1&&(I=1-I),2*M===V+1&&(M=1-M),m.iushrn(1),_.iushrn(1)}return D}e.getJSF=f;function h(m,_,D){var I="_"+_;m.prototype[_]=function(){return this[I]!==void 0?this[I]:this[I]=D.call(this)}}e.cachedProperty=h;function p(m){return typeof m=="string"?e.toArray(m,"hex"):m}e.parseBytes=p;function l(m){return new t(m,"hex","le")}e.intFromLE=l})(Zr);var hu={},is=hn,Ka=Zr,yc=Ka.getNAF,c5=Ka.getJSF,wc=Ka.assert;function Mn(r,e){this.type=r,this.p=new is(e.p,16),this.red=e.prime?is.red(e.prime):is.mont(this.p),this.zero=new is(0).toRed(this.red),this.one=new is(1).toRed(this.red),this.two=new is(2).toRed(this.red),this.n=e.n&&new is(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Uc=Mn;Mn.prototype.point=function(){throw new Error("Not implemented")};Mn.prototype.validate=function(){throw new Error("Not implemented")};Mn.prototype._fixedNafMul=function(e,t){wc(e.precomputed);var n=e._getDoubles(),s=yc(t,1,this._bitLength),o=(1<<n.step+1)-(n.step%2===0?2:1);o/=3;var f=[],h,p;for(h=0;h<s.length;h+=n.step){p=0;for(var l=h+n.step-1;l>=h;l--)p=(p<<1)+s[l];f.push(p)}for(var m=this.jpoint(null,null,null),_=this.jpoint(null,null,null),D=o;D>0;D--){for(h=0;h<f.length;h++)p=f[h],p===D?_=_.mixedAdd(n.points[h]):p===-D&&(_=_.mixedAdd(n.points[h].neg()));m=m.add(_)}return m.toP()};Mn.prototype._wnafMul=function(e,t){var n=4,s=e._getNAFPoints(n);n=s.wnd;for(var o=s.points,f=yc(t,n,this._bitLength),h=this.jpoint(null,null,null),p=f.length-1;p>=0;p--){for(var l=0;p>=0&&f[p]===0;p--)l++;if(p>=0&&l++,h=h.dblp(l),p<0)break;var m=f[p];wc(m!==0),e.type==="affine"?m>0?h=h.mixedAdd(o[m-1>>1]):h=h.mixedAdd(o[-m-1>>1].neg()):m>0?h=h.add(o[m-1>>1]):h=h.add(o[-m-1>>1].neg())}return e.type==="affine"?h.toP():h};Mn.prototype._wnafMulAdd=function(e,t,n,s,o){var f=this._wnafT1,h=this._wnafT2,p=this._wnafT3,l=0,m,_,D;for(m=0;m<s;m++){D=t[m];var I=D._getNAFPoints(e);f[m]=I.wnd,h[m]=I.points}for(m=s-1;m>=1;m-=2){var M=m-1,H=m;if(f[M]!==1||f[H]!==1){p[M]=yc(n[M],f[M],this._bitLength),p[H]=yc(n[H],f[H],this._bitLength),l=Math.max(p[M].length,l),l=Math.max(p[H].length,l);continue}var k=[t[M],null,null,t[H]];t[M].y.cmp(t[H].y)===0?(k[1]=t[M].add(t[H]),k[2]=t[M].toJ().mixedAdd(t[H].neg())):t[M].y.cmp(t[H].y.redNeg())===0?(k[1]=t[M].toJ().mixedAdd(t[H]),k[2]=t[M].add(t[H].neg())):(k[1]=t[M].toJ().mixedAdd(t[H]),k[2]=t[M].toJ().mixedAdd(t[H].neg()));var X=[-3,-1,-5,-7,0,7,5,1,3],F=c5(n[M],n[H]);for(l=Math.max(F[0].length,l),p[M]=new Array(l),p[H]=new Array(l),_=0;_<l;_++){var V=F[0][_]|0,$=F[1][_]|0;p[M][_]=X[(V+1)*3+($+1)],p[H][_]=0,h[M]=k}}var U=this.jpoint(null,null,null),z=this._wnafT4;for(m=l;m>=0;m--){for(var b=0;m>=0;){var T=!0;for(_=0;_<s;_++)z[_]=p[_][m]|0,z[_]!==0&&(T=!1);if(!T)break;b++,m--}if(m>=0&&b++,U=U.dblp(b),m<0)break;for(_=0;_<s;_++){var re=z[_];re!==0&&(re>0?D=h[_][re-1>>1]:re<0&&(D=h[_][-re-1>>1].neg()),D.type==="affine"?U=U.mixedAdd(D):U=U.add(D))}}for(m=0;m<s;m++)h[m]=null;return o?U:U.toP()};function di(r,e){this.curve=r,this.type=e,this.precomputed=null}Mn.BasePoint=di;di.prototype.eq=function(){throw new Error("Not implemented")};di.prototype.validate=function(){return this.curve.validate(this)};Mn.prototype.decodePoint=function(e,t){e=Ka.toArray(e,t);var n=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*n){e[0]===6?wc(e[e.length-1]%2===0):e[0]===7&&wc(e[e.length-1]%2===1);var s=this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));return s}else if((e[0]===2||e[0]===3)&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),e[0]===3);throw new Error("Unknown point format")};di.prototype.encodeCompressed=function(e){return this.encode(e,!0)};di.prototype._encode=function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",t))};di.prototype.encode=function(e,t){return Ka.encode(this._encode(t),e)};di.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this};di.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((e.bitLength()+1)/t.step):!1};di.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],s=this,o=0;o<t;o+=e){for(var f=0;f<e;f++)s=s.dbl();n.push(s)}return{step:e,points:n}};di.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,s=n===1?null:this.dbl(),o=1;o<n;o++)t[o]=t[o-1].add(s);return{wnd:e,points:t}};di.prototype._getBeta=function(){return null};di.prototype.dblp=function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t};var f5=Zr,Vt=hn,uu=ru,Js=Uc,h5=f5.assert;function li(r){Js.call(this,"short",r),this.a=new Vt(r.a,16).toRed(this.red),this.b=new Vt(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}uu(li,Js);var u5=li;li.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,n;if(e.beta)t=new Vt(e.beta,16).toRed(this.red);else{var s=this._getEndoRoots(this.p);t=s[0].cmp(s[1])<0?s[0]:s[1],t=t.toRed(this.red)}if(e.lambda)n=new Vt(e.lambda,16);else{var o=this._getEndoRoots(this.n);this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))===0?n=o[0]:(n=o[1],h5(this.g.mul(n).x.cmp(this.g.x.redMul(t))===0))}var f;return e.basis?f=e.basis.map(function(h){return{a:new Vt(h.a,16),b:new Vt(h.b,16)}}):f=this._getEndoBasis(n),{beta:t,lambda:n,basis:f}}};li.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:Vt.mont(e),n=new Vt(2).toRed(t).redInvm(),s=n.redNeg(),o=new Vt(3).toRed(t).redNeg().redSqrt().redMul(n),f=s.redAdd(o).fromRed(),h=s.redSub(o).fromRed();return[f,h]};li.prototype._getEndoBasis=function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=e,s=this.n.clone(),o=new Vt(1),f=new Vt(0),h=new Vt(0),p=new Vt(1),l,m,_,D,I,M,H,k=0,X,F;n.cmpn(0)!==0;){var V=s.div(n);X=s.sub(V.mul(n)),F=h.sub(V.mul(o));var $=p.sub(V.mul(f));if(!_&&X.cmp(t)<0)l=H.neg(),m=o,_=X.neg(),D=F;else if(_&&++k===2)break;H=X,s=n,n=X,h=o,o=F,p=f,f=$}I=X.neg(),M=F;var U=_.sqr().add(D.sqr()),z=I.sqr().add(M.sqr());return z.cmp(U)>=0&&(I=l,M=m),_.negative&&(_=_.neg(),D=D.neg()),I.negative&&(I=I.neg(),M=M.neg()),[{a:_,b:D},{a:I,b:M}]};li.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],s=t[1],o=s.b.mul(e).divRound(this.n),f=n.b.neg().mul(e).divRound(this.n),h=o.mul(n.a),p=f.mul(s.a),l=o.mul(n.b),m=f.mul(s.b),_=e.sub(h).sub(p),D=l.add(m).neg();return{k1:_,k2:D}};li.prototype.pointFromX=function(e,t){e=new Vt(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),s=n.redSqrt();if(s.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var o=s.fromRed().isOdd();return(t&&!o||!t&&o)&&(s=s.redNeg()),this.point(e,s)};li.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,s=this.a.redMul(t),o=t.redSqr().redMul(t).redIAdd(s).redIAdd(this.b);return n.redSqr().redISub(o).cmpn(0)===0};li.prototype._endoWnafMulAdd=function(e,t,n){for(var s=this._endoWnafT1,o=this._endoWnafT2,f=0;f<e.length;f++){var h=this._endoSplit(t[f]),p=e[f],l=p._getBeta();h.k1.negative&&(h.k1.ineg(),p=p.neg(!0)),h.k2.negative&&(h.k2.ineg(),l=l.neg(!0)),s[f*2]=p,s[f*2+1]=l,o[f*2]=h.k1,o[f*2+1]=h.k2}for(var m=this._wnafMulAdd(1,s,o,f*2,n),_=0;_<f*2;_++)s[_]=null,o[_]=null;return m};function dr(r,e,t,n){Js.BasePoint.call(this,r,"affine"),e===null&&t===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new Vt(e,16),this.y=new Vt(t,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}uu(dr,Js.BasePoint);li.prototype.point=function(e,t,n){return new dr(this,e,t,n)};li.prototype.pointFromJSON=function(e,t){return dr.fromJSON(this,e,t)};dr.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var n=this.curve,s=function(o){return n.point(o.x.redMul(n.endo.beta),o.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(s)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(s)}}}return t}};dr.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]};dr.fromJSON=function(e,t,n){typeof t=="string"&&(t=JSON.parse(t));var s=e.point(t[0],t[1],n);if(!t[2])return s;function o(h){return e.point(h[0],h[1],n)}var f=t[2];return s.precomputed={beta:null,doubles:f.doubles&&{step:f.doubles.step,points:[s].concat(f.doubles.points.map(o))},naf:f.naf&&{wnd:f.naf.wnd,points:[s].concat(f.naf.points.map(o))}},s};dr.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)+">"};dr.prototype.isInfinity=function(){return this.inf};dr.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),s=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,s)};dr.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),s=e.redInvm(),o=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(s),f=o.redSqr().redISub(this.x.redAdd(this.x)),h=o.redMul(this.x.redSub(f)).redISub(this.y);return this.curve.point(f,h)};dr.prototype.getX=function(){return this.x.fromRed()};dr.prototype.getY=function(){return this.y.fromRed()};dr.prototype.mul=function(e){return e=new Vt(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};dr.prototype.mulAdd=function(e,t,n){var s=[this,t],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(s,o):this.curve._wnafMulAdd(1,s,o,2)};dr.prototype.jmulAdd=function(e,t,n){var s=[this,t],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(s,o,!0):this.curve._wnafMulAdd(1,s,o,2,!0)};dr.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)};dr.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,s=function(o){return o.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(s)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(s)}}}return t};dr.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 gr(r,e,t,n){Js.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Vt(0)):(this.x=new Vt(e,16),this.y=new Vt(t,16),this.z=new Vt(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}uu(gr,Js.BasePoint);li.prototype.jpoint=function(e,t,n){return new gr(this,e,t,n)};gr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),s=this.y.redMul(t).redMul(e);return this.curve.point(n,s)};gr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};gr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),s=this.x.redMul(t),o=e.x.redMul(n),f=this.y.redMul(t.redMul(e.z)),h=e.y.redMul(n.redMul(this.z)),p=s.redSub(o),l=f.redSub(h);if(p.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var m=p.redSqr(),_=m.redMul(p),D=s.redMul(m),I=l.redSqr().redIAdd(_).redISub(D).redISub(D),M=l.redMul(D.redISub(I)).redISub(f.redMul(_)),H=this.z.redMul(e.z).redMul(p);return this.curve.jpoint(I,M,H)};gr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,s=e.x.redMul(t),o=this.y,f=e.y.redMul(t).redMul(this.z),h=n.redSub(s),p=o.redSub(f);if(h.cmpn(0)===0)return p.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=h.redSqr(),m=l.redMul(h),_=n.redMul(l),D=p.redSqr().redIAdd(m).redISub(_).redISub(_),I=p.redMul(_.redISub(D)).redISub(o.redMul(m)),M=this.z.redMul(h);return this.curve.jpoint(D,I,M)};gr.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t<e;t++)n=n.dbl();return n}var s=this.curve.a,o=this.curve.tinv,f=this.x,h=this.y,p=this.z,l=p.redSqr().redSqr(),m=h.redAdd(h);for(t=0;t<e;t++){var _=f.redSqr(),D=m.redSqr(),I=D.redSqr(),M=_.redAdd(_).redIAdd(_).redIAdd(s.redMul(l)),H=f.redMul(D),k=M.redSqr().redISub(H.redAdd(H)),X=H.redISub(k),F=M.redMul(X);F=F.redIAdd(F).redISub(I);var V=m.redMul(p);t+1<e&&(l=l.redMul(I)),f=k,p=V,m=F}return this.curve.jpoint(f,m.redMul(o),p)};gr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()};gr.prototype._zeroDbl=function(){var e,t,n;if(this.zOne){var s=this.x.redSqr(),o=this.y.redSqr(),f=o.redSqr(),h=this.x.redAdd(o).redSqr().redISub(s).redISub(f);h=h.redIAdd(h);var p=s.redAdd(s).redIAdd(s),l=p.redSqr().redISub(h).redISub(h),m=f.redIAdd(f);m=m.redIAdd(m),m=m.redIAdd(m),e=l,t=p.redMul(h.redISub(l)).redISub(m),n=this.y.redAdd(this.y)}else{var _=this.x.redSqr(),D=this.y.redSqr(),I=D.redSqr(),M=this.x.redAdd(D).redSqr().redISub(_).redISub(I);M=M.redIAdd(M);var H=_.redAdd(_).redIAdd(_),k=H.redSqr(),X=I.redIAdd(I);X=X.redIAdd(X),X=X.redIAdd(X),e=k.redISub(M).redISub(M),t=H.redMul(M.redISub(e)).redISub(X),n=this.y.redMul(this.z),n=n.redIAdd(n)}return this.curve.jpoint(e,t,n)};gr.prototype._threeDbl=function(){var e,t,n;if(this.zOne){var s=this.x.redSqr(),o=this.y.redSqr(),f=o.redSqr(),h=this.x.redAdd(o).redSqr().redISub(s).redISub(f);h=h.redIAdd(h);var p=s.redAdd(s).redIAdd(s).redIAdd(this.curve.a),l=p.redSqr().redISub(h).redISub(h);e=l;var m=f.redIAdd(f);m=m.redIAdd(m),m=m.redIAdd(m),t=p.redMul(h.redISub(l)).redISub(m),n=this.y.redAdd(this.y)}else{var _=this.z.redSqr(),D=this.y.redSqr(),I=this.x.redMul(D),M=this.x.redSub(_).redMul(this.x.redAdd(_));M=M.redAdd(M).redIAdd(M);var H=I.redIAdd(I);H=H.redIAdd(H);var k=H.redAdd(H);e=M.redSqr().redISub(k),n=this.y.redAdd(this.z).redSqr().redISub(D).redISub(_);var X=D.redSqr();X=X.redIAdd(X),X=X.redIAdd(X),X=X.redIAdd(X),t=M.redMul(H.redISub(e)).redISub(X)}return this.curve.jpoint(e,t,n)};gr.prototype._dbl=function(){var e=this.curve.a,t=this.x,n=this.y,s=this.z,o=s.redSqr().redSqr(),f=t.redSqr(),h=n.redSqr(),p=f.redAdd(f).redIAdd(f).redIAdd(e.redMul(o)),l=t.redAdd(t);l=l.redIAdd(l);var m=l.redMul(h),_=p.redSqr().redISub(m.redAdd(m)),D=m.redISub(_),I=h.redSqr();I=I.redIAdd(I),I=I.redIAdd(I),I=I.redIAdd(I);var M=p.redMul(D).redISub(I),H=n.redAdd(n).redMul(s);return this.curve.jpoint(_,M,H)};gr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr(),s=t.redSqr(),o=e.redAdd(e).redIAdd(e),f=o.redSqr(),h=this.x.redAdd(t).redSqr().redISub(e).redISub(s);h=h.redIAdd(h),h=h.redAdd(h).redIAdd(h),h=h.redISub(f);var p=h.redSqr(),l=s.redIAdd(s);l=l.redIAdd(l),l=l.redIAdd(l),l=l.redIAdd(l);var m=o.redIAdd(h).redSqr().redISub(f).redISub(p).redISub(l),_=t.redMul(m);_=_.redIAdd(_),_=_.redIAdd(_);var D=this.x.redMul(p).redISub(_);D=D.redIAdd(D),D=D.redIAdd(D);var I=this.y.redMul(m.redMul(l.redISub(m)).redISub(h.redMul(p)));I=I.redIAdd(I),I=I.redIAdd(I),I=I.redIAdd(I);var M=this.z.redAdd(h).redSqr().redISub(n).redISub(p);return this.curve.jpoint(D,I,M)};gr.prototype.mul=function(e,t){return e=new Vt(e,t),this.curve._wnafMul(this,e)};gr.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),n=e.z.redSqr();if(this.x.redMul(n).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var s=t.redMul(this.z),o=n.redMul(e.z);return this.y.redMul(o).redISub(e.y.redMul(s)).cmpn(0)===0};gr.prototype.eqXToP=function(e){var t=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(n)===0)return!0;for(var s=e.clone(),o=this.curve.redN.redMul(t);;){if(s.iadd(this.curve.n),s.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(o),this.x.cmp(n)===0)return!0}};gr.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)+">"};gr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var ks=hn,h1=ru,Bc=Uc,d5=Zr;function Ys(r){Bc.call(this,"mont",r),this.a=new ks(r.a,16).toRed(this.red),this.b=new ks(r.b,16).toRed(this.red),this.i4=new ks(4).toRed(this.red).redInvm(),this.two=new ks(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}h1(Ys,Bc);var l5=Ys;Ys.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),s=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t),o=s.redSqrt();return o.redSqr().cmp(s)===0};function ur(r,e,t){Bc.BasePoint.call(this,r,"projective"),e===null&&t===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new ks(e,16),this.z=new ks(t,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}h1(ur,Bc.BasePoint);Ys.prototype.decodePoint=function(e,t){return this.point(d5.toArray(e,t),1)};Ys.prototype.point=function(e,t){return new ur(this,e,t)};Ys.prototype.pointFromJSON=function(e){return ur.fromJSON(this,e)};ur.prototype.precompute=function(){};ur.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};ur.fromJSON=function(e,t){return new ur(e,t[0],t[1]||e.one)};ur.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)+">"};ur.prototype.isInfinity=function(){return this.z.cmpn(0)===0};ur.prototype.dbl=function(){var e=this.x.redAdd(this.z),t=e.redSqr(),n=this.x.redSub(this.z),s=n.redSqr(),o=t.redSub(s),f=t.redMul(s),h=o.redMul(s.redAdd(this.curve.a24.redMul(o)));return this.curve.point(f,h)};ur.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};ur.prototype.diffAdd=function(e,t){var n=this.x.redAdd(this.z),s=this.x.redSub(this.z),o=e.x.redAdd(e.z),f=e.x.redSub(e.z),h=f.redMul(n),p=o.redMul(s),l=t.z.redMul(h.redAdd(p).redSqr()),m=t.x.redMul(h.redISub(p).redSqr());return this.curve.point(l,m)};ur.prototype.mul=function(e){for(var t=e.clone(),n=this,s=this.curve.point(null,null),o=this,f=[];t.cmpn(0)!==0;t.iushrn(1))f.push(t.andln(1));for(var h=f.length-1;h>=0;h--)f[h]===0?(n=n.diffAdd(s,o),s=s.dbl()):(s=n.diffAdd(s,o),n=n.dbl());return s};ur.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};ur.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};ur.prototype.eq=function(e){return this.getX().cmp(e.getX())===0};ur.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};ur.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var p5=Zr,an=hn,u1=ru,zc=Uc,g5=p5.assert;function ji(r){this.twisted=(r.a|0)!==1,this.mOneA=this.twisted&&(r.a|0)===-1,this.extended=this.mOneA,zc.call(this,"edwards",r),this.a=new an(r.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new an(r.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new an(r.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),g5(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(r.c|0)===1}u1(ji,zc);var b5=ji;ji.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)};ji.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)};ji.prototype.jpoint=function(e,t,n,s){return this.point(e,t,n,s)};ji.prototype.pointFromX=function(e,t){e=new an(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),s=this.c2.redSub(this.a.redMul(n)),o=this.one.redSub(this.c2.redMul(this.d).redMul(n)),f=s.redMul(o.redInvm()),h=f.redSqrt();if(h.redSqr().redSub(f).cmp(this.zero)!==0)throw new Error("invalid point");var p=h.fromRed().isOdd();return(t&&!p||!t&&p)&&(h=h.redNeg()),this.point(e,h)};ji.prototype.pointFromY=function(e,t){e=new an(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),s=n.redSub(this.c2),o=n.redMul(this.d).redMul(this.c2).redSub(this.a),f=s.redMul(o.redInvm());if(f.cmp(this.zero)===0){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var h=f.redSqrt();if(h.redSqr().redSub(f).cmp(this.zero)!==0)throw new Error("invalid point");return h.fromRed().isOdd()!==t&&(h=h.redNeg()),this.point(h,e)};ji.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),n=e.y.redSqr(),s=t.redMul(this.a).redAdd(n),o=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(n)));return s.cmp(o)===0};function Lt(r,e,t,n,s){zc.BasePoint.call(this,r,"projective"),e===null&&t===null&&n===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 an(e,16),this.y=new an(t,16),this.z=n?new an(n,16):this.curve.one,this.t=s&&new an(s,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()))))}u1(Lt,zc.BasePoint);ji.prototype.pointFromJSON=function(e){return Lt.fromJSON(this,e)};ji.prototype.point=function(e,t,n,s){return new Lt(this,e,t,n,s)};Lt.fromJSON=function(e,t){return new Lt(e,t[0],t[1],t[2])};Lt.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)+">"};Lt.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};Lt.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var s=this.curve._mulA(e),o=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),f=s.redAdd(t),h=f.redSub(n),p=s.redSub(t),l=o.redMul(h),m=f.redMul(p),_=o.redMul(p),D=h.redMul(f);return this.curve.point(l,m,D,_)};Lt.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),t=this.x.redSqr(),n=this.y.redSqr(),s,o,f,h,p,l;if(this.curve.twisted){h=this.curve._mulA(t);var m=h.redAdd(n);this.zOne?(s=e.redSub(t).redSub(n).redMul(m.redSub(this.curve.two)),o=m.redMul(h.redSub(n)),f=m.redSqr().redSub(m).redSub(m)):(p=this.z.redSqr(),l=m.redSub(p).redISub(p),s=e.redSub(t).redISub(n).redMul(l),o=m.redMul(h.redSub(n)),f=m.redMul(l))}else h=t.redAdd(n),p=this.curve._mulC(this.z).redSqr(),l=h.redSub(p).redSub(p),s=this.curve._mulC(e.redISub(h)).redMul(l),o=this.curve._mulC(h).redMul(t.redISub(n)),f=h.redMul(l);return this.curve.point(s,o,f)};Lt.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};Lt.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),s=this.t.redMul(this.curve.dd).redMul(e.t),o=this.z.redMul(e.z.redAdd(e.z)),f=n.redSub(t),h=o.redSub(s),p=o.redAdd(s),l=n.redAdd(t),m=f.redMul(h),_=p.redMul(l),D=f.redMul(l),I=h.redMul(p);return this.curve.point(m,_,I,D)};Lt.prototype._projAdd=function(e){var t=this.z.redMul(e.z),n=t.redSqr(),s=this.x.redMul(e.x),o=this.y.redMul(e.y),f=this.curve.d.redMul(s).redMul(o),h=n.redSub(f),p=n.redAdd(f),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(s).redISub(o),m=t.redMul(h).redMul(l),_,D;return this.curve.twisted?(_=t.redMul(p).redMul(o.redSub(this.curve._mulA(s))),D=h.redMul(p)):(_=t.redMul(p).redMul(o.redSub(s)),D=this.curve._mulC(h).redMul(p)),this.curve.point(m,_,D)};Lt.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)};Lt.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)};Lt.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)};Lt.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)};Lt.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};Lt.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Lt.prototype.getX=function(){return this.normalize(),this.x.fromRed()};Lt.prototype.getY=function(){return this.normalize(),this.y.fromRed()};Lt.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0};Lt.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(t)===0)return!0;for(var n=e.clone(),s=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(s),this.x.cmp(t)===0)return!0}};Lt.prototype.toP=Lt.prototype.normalize;Lt.prototype.mixedAdd=Lt.prototype.add;(function(r){var e=r;e.base=Uc,e.short=u5,e.mont=l5,e.edwards=b5})(hu);var Hc={},mh,Vl;function v5(){return Vl||(Vl=1,mh={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"]]}}),mh}(function(r){var e=r,t=qp,n=hu,s=Zr,o=s.assert;function f(l){l.type==="short"?this.curve=new n.short(l):l.type==="edwards"?this.curve=new n.edwards(l):this.curve=new n.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,o(this.g.validate(),"Invalid curve"),o(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=f;function h(l,m){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var _=new f(m);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:_}),_}})}h("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:t.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),h("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:t.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),h("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:t.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),h("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:t.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),h("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:t.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),h("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:t.sha256,gRed:!1,g:["9"]}),h("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:t.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var p;try{p=v5()}catch{p=void 0}h("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:t.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",p]})})(Hc);var m5=hn,y5=Zr,kh=y5.assert;function Er(r,e){this.ec=r,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var w5=Er;Er.fromPublic=function(e,t,n){return t instanceof Er?t:new Er(e,{pub:t,pubEnc:n})};Er.fromPrivate=function(e,t,n){return t instanceof Er?t:new Er(e,{priv:t,privEnc:n})};Er.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"}};Er.prototype.getPublic=function(e,t){return typeof e=="string"&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub};Er.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv};Er.prototype._importPrivate=function(e,t){this.priv=new m5(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)};Er.prototype._importPublic=function(e,t){if(e.x||e.y){this.ec.curve.type==="mont"?kh(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&kh(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)};Er.prototype.derive=function(e){return e.validate()||kh(e.validate(),"public point not validated"),e.mul(this.priv).getX()};Er.prototype.sign=function(e,t,n){return this.ec.sign(e,this,t,n)};Er.prototype.verify=function(e,t,n){return this.ec.verify(e,t,this,void 0,n)};Er.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var _c=hn,du=Zr,_5=du.assert;function jc(r,e){if(r instanceof jc)return r;this._importDER(r,e)||(_5(r.r&&r.s,"Signature without r or s"),this.r=new _c(r.r,16),this.s=new _c(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}var E5=jc;function S5(){this.place=0}function yh(r,e){var t=r[e.place++];if(!(t&128))return t;var n=t&15;if(n===0||n>4||r[e.place]===0)return!1;for(var s=0,o=0,f=e.place;o<n;o++,f++)s<<=8,s|=r[f],s>>>=0;return s<=127?!1:(e.place=f,s)}function Gl(r){for(var e=0,t=r.length-1;!r[e]&&!(r[e+1]&128)&&e<t;)e++;return e===0?r:r.slice(e)}jc.prototype._importDER=function(e,t){e=du.toArray(e,t);var n=new S5;if(e[n.place++]!==48)return!1;var s=yh(e,n);if(s===!1||s+n.place!==e.length||e[n.place++]!==2)return!1;var o=yh(e,n);if(o===!1||e[n.place]&128)return!1;var f=e.slice(n.place,o+n.place);if(n.place+=o,e[n.place++]!==2)return!1;var h=yh(e,n);if(h===!1||e.length!==h+n.place||e[n.place]&128)return!1;var p=e.slice(n.place,h+n.place);if(f[0]===0)if(f[1]&128)f=f.slice(1);else return!1;if(p[0]===0)if(p[1]&128)p=p.slice(1);else return!1;return this.r=new _c(f),this.s=new _c(p),this.recoveryParam=null,!0};function wh(r,e){if(e<128){r.push(e);return}var t=1+(Math.log(e)/Math.LN2>>>3);for(r.push(t|128);--t;)r.push(e>>>(t<<3)&255);r.push(e)}jc.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),n[0]&128&&(n=[0].concat(n)),t=Gl(t),n=Gl(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var s=[2];wh(s,t.length),s=s.concat(t),s.push(2),wh(s,n.length);var o=s.concat(n),f=[48];return wh(f,o.length),f=f.concat(o),du.encode(f,e)};var Ii=hn,d1=i2,x5=Zr,_h=Hc,I5=Up(),os=x5.assert,lu=w5,Kc=E5;function hi(r){if(!(this instanceof hi))return new hi(r);typeof r=="string"&&(os(Object.prototype.hasOwnProperty.call(_h,r),"Unknown curve "+r),r=_h[r]),r instanceof _h.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}var D5=hi;hi.prototype.keyPair=function(e){return new lu(this,e)};hi.prototype.keyFromPrivate=function(e,t){return lu.fromPrivate(this,e,t)};hi.prototype.keyFromPublic=function(e,t){return lu.fromPublic(this,e,t)};hi.prototype.genKeyPair=function(e){e||(e={});for(var t=new d1({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||I5(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),s=this.n.sub(new Ii(2));;){var o=new Ii(t.generate(n));if(!(o.cmp(s)>0))return o.iaddn(1),this.keyFromPrivate(o)}};hi.prototype._truncateToN=function(e,t,n){var s;if(Ii.isBN(e)||typeof e=="number")e=new Ii(e,16),s=e.byteLength();else if(typeof e=="object")s=e.length,e=new Ii(e,16);else{var o=e.toString();s=o.length+1>>>1,e=new Ii(o,16)}typeof n!="number"&&(n=s*8);var f=n-this.n.bitLength();return f>0&&(e=e.ushrn(f)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e};hi.prototype.sign=function(e,t,n,s){if(typeof n=="object"&&(s=n,n=null),s||(s={}),typeof e!="string"&&typeof e!="number"&&!Ii.isBN(e)){os(typeof e=="object"&&e&&typeof e.length=="number","Expected message to be an array-like, a hex string, or a BN instance"),os(e.length>>>0===e.length);for(var o=0;o<e.length;o++)os((e[o]&255)===e[o])}t=this.keyFromPrivate(t,n),e=this._truncateToN(e,!1,s.msgBitLength),os(!e.isNeg(),"Can not sign a negative message");var f=this.n.byteLength(),h=t.getPrivate().toArray("be",f),p=e.toArray("be",f);os(new Ii(p).eq(e),"Can not sign message");for(var l=new d1({hash:this.hash,entropy:h,nonce:p,pers:s.pers,persEnc:s.persEnc||"utf8"}),m=this.n.sub(new Ii(1)),_=0;;_++){var D=s.k?s.k(_):new Ii(l.generate(this.n.byteLength()));if(D=this._truncateToN(D,!0),!(D.cmpn(1)<=0||D.cmp(m)>=0)){var I=this.g.mul(D);if(!I.isInfinity()){var M=I.getX(),H=M.umod(this.n);if(H.cmpn(0)!==0){var k=D.invm(this.n).mul(H.mul(t.getPrivate()).iadd(e));if(k=k.umod(this.n),k.cmpn(0)!==0){var X=(I.getY().isOdd()?1:0)|(M.cmp(H)!==0?2:0);return s.canonical&&k.cmp(this.nh)>0&&(k=this.n.sub(k),X^=1),new Kc({r:H,s:k,recoveryParam:X})}}}}}};hi.prototype.verify=function(e,t,n,s,o){o||(o={}),e=this._truncateToN(e,!1,o.msgBitLength),n=this.keyFromPublic(n,s),t=new Kc(t,"hex");var f=t.r,h=t.s;if(f.cmpn(1)<0||f.cmp(this.n)>=0||h.cmpn(1)<0||h.cmp(this.n)>=0)return!1;var p=h.invm(this.n),l=p.mul(e).umod(this.n),m=p.mul(f).umod(this.n),_;return this.curve._maxwellTrick?(_=this.g.jmulAdd(l,n.getPublic(),m),_.isInfinity()?!1:_.eqXToP(f)):(_=this.g.mulAdd(l,n.getPublic(),m),_.isInfinity()?!1:_.getX().umod(this.n).cmp(f)===0)};hi.prototype.recoverPubKey=function(r,e,t,n){os((3&t)===t,"The recovery param is more than two bits"),e=new Kc(e,n);var s=this.n,o=new Ii(r),f=e.r,h=e.s,p=t&1,l=t>>1;if(f.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?f=this.curve.pointFromX(f.add(this.curve.n),p):f=this.curve.pointFromX(f,p);var m=e.r.invm(s),_=s.sub(o).mul(m).umod(s),D=h.mul(m).umod(s);return this.g.mulAdd(_,f,D)};hi.prototype.getKeyRecoveryParam=function(r,e,t,n){if(e=new Kc(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var s=0;s<4;s++){var o;try{o=this.recoverPubKey(r,e,s)}catch{continue}if(o.eq(t))return s}throw new Error("Unable to find valid recovery factor")};var ka=Zr,l1=ka.assert,Jl=ka.parseBytes,Xs=ka.cachedProperty;function hr(r,e){this.eddsa=r,this._secret=Jl(e.secret),r.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=Jl(e.pub)}hr.fromPublic=function(e,t){return t instanceof hr?t:new hr(e,{pub:t})};hr.fromSecret=function(e,t){return t instanceof hr?t:new hr(e,{secret:t})};hr.prototype.secret=function(){return this._secret};Xs(hr,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});Xs(hr,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});Xs(hr,"privBytes",function(){var e=this.eddsa,t=this.hash(),n=e.encodingLength-1,s=t.slice(0,e.encodingLength);return s[0]&=248,s[n]&=127,s[n]|=64,s});Xs(hr,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});Xs(hr,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});Xs(hr,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});hr.prototype.sign=function(e){return l1(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)};hr.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)};hr.prototype.getSecret=function(e){return l1(this._secret,"KeyPair is public only"),ka.encode(this.secret(),e)};hr.prototype.getPublic=function(e){return ka.encode(this.pubBytes(),e)};var A5=hr,P5=hn,kc=Zr,Yl=kc.assert,Wc=kc.cachedProperty,M5=kc.parseBytes;function gs(r,e){this.eddsa=r,typeof e!="object"&&(e=M5(e)),Array.isArray(e)&&(Yl(e.length===r.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,r.encodingLength),S:e.slice(r.encodingLength)}),Yl(e.R&&e.S,"Signature without R or S"),r.isPoint(e.R)&&(this._R=e.R),e.S instanceof P5&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Wc(gs,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});Wc(gs,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});Wc(gs,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});Wc(gs,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});gs.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};gs.prototype.toHex=function(){return kc.encode(this.toBytes(),"hex").toUpperCase()};var O5=gs,C5=qp,R5=Hc,Vs=Zr,T5=Vs.assert,p1=Vs.parseBytes,g1=A5,Xl=O5;function qr(r){if(T5(r==="ed25519","only tested with ed25519 so far"),!(this instanceof qr))return new qr(r);r=R5[r].curve,this.curve=r,this.g=r.g,this.g.precompute(r.n.bitLength()+1),this.pointClass=r.point().constructor,this.encodingLength=Math.ceil(r.n.bitLength()/8),this.hash=C5.sha512}var N5=qr;qr.prototype.sign=function(e,t){e=p1(e);var n=this.keyFromSecret(t),s=this.hashInt(n.messagePrefix(),e),o=this.g.mul(s),f=this.encodePoint(o),h=this.hashInt(f,n.pubBytes(),e).mul(n.priv()),p=s.add(h).umod(this.curve.n);return this.makeSignature({R:o,S:p,Rencoded:f})};qr.prototype.verify=function(e,t,n){if(e=p1(e),t=this.makeSignature(t),t.S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var s=this.keyFromPublic(n),o=this.hashInt(t.Rencoded(),s.pubBytes(),e),f=this.g.mul(t.S()),h=t.R().add(s.pub().mul(o));return h.eq(f)};qr.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return Vs.intFromLE(e.digest()).umod(this.curve.n)};qr.prototype.keyFromPublic=function(e){return g1.fromPublic(this,e)};qr.prototype.keyFromSecret=function(e){return g1.fromSecret(this,e)};qr.prototype.makeSignature=function(e){return e instanceof Xl?e:new Xl(this,e)};qr.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t};qr.prototype.decodePoint=function(e){e=Vs.parseBytes(e);var t=e.length-1,n=e.slice(0,t).concat(e[t]&-129),s=(e[t]&128)!==0,o=Vs.intFromLE(n);return this.curve.pointFromY(o,s)};qr.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)};qr.prototype.decodeInt=function(e){return Vs.intFromLE(e)};qr.prototype.isPoint=function(e){return e instanceof this.pointClass};(function(r){var e=r;e.version=o5.version,e.utils=Zr,e.rand=Up(),e.curve=hu,e.curves=Hc,e.ec=D5,e.eddsa=N5})(f1);var pu={},b1={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=tt,t=Xr;r.DIGEST_LENGTH=64,r.BLOCK_SIZE=128;var n=function(){function h(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return h.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},h.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},h.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._tempHi),t.wipe(this._tempLo),this.reset()},h.prototype.update=function(p,l){if(l===void 0&&(l=p.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var m=0;if(this._bytesHashed+=l,this._bufferLength>0){for(;this._bufferLength<r.BLOCK_SIZE&&l>0;)this._buffer[this._bufferLength++]=p[m++],l--;this._bufferLength===this.blockSize&&(o(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(m=o(this._tempHi,this._tempLo,this._stateHi,this._stateLo,p,m,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=p[m++],l--;return this},h.prototype.finish=function(p){if(!this._finished){var l=this._bytesHashed,m=this._bufferLength,_=l/536870912|0,D=l<<3,I=l%128<112?128:256;this._buffer[m]=128;for(var M=m+1;M<I-8;M++)this._buffer[M]=0;e.writeUint32BE(_,this._buffer,I-8),e.writeUint32BE(D,this._buffer,I-4),o(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,I),this._finished=!0}for(var M=0;M<this.digestLength/8;M++)e.writeUint32BE(this._stateHi[M],p,M*8),e.writeUint32BE(this._stateLo[M],p,M*8+4);return this},h.prototype.digest=function(){var p=new Uint8Array(this.digestLength);return this.finish(p),p},h.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}},h.prototype.restoreState=function(p){return this._stateHi.set(p.stateHi),this._stateLo.set(p.stateLo),this._bufferLength=p.bufferLength,p.buffer&&this._buffer.set(p.buffer),this._bytesHashed=p.bytesHashed,this._finished=!1,this},h.prototype.cleanSavedState=function(p){t.wipe(p.stateHi),t.wipe(p.stateLo),p.buffer&&t.wipe(p.buffer),p.bufferLength=0,p.bytesHashed=0},h}();r.SHA512=n;var s=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 o(h,p,l,m,_,D,I){for(var M=l[0],H=l[1],k=l[2],X=l[3],F=l[4],V=l[5],$=l[6],U=l[7],z=m[0],b=m[1],T=m[2],re=m[3],de=m[4],L=m[5],u=m[6],y=m[7],w,E,O,N,R,x,d,A;I>=128;){for(var fe=0;fe<16;fe++){var ee=8*fe+D;h[fe]=e.readUint32BE(_,ee),p[fe]=e.readUint32BE(_,ee+4)}for(var fe=0;fe<80;fe++){var he=M,ne=H,be=k,G=X,Z=F,K=V,v=$,j=U,oe=z,le=b,Te=T,Ae=re,Me=de,je=L,qe=u,Ue=y;if(w=U,E=y,R=E&65535,x=E>>>16,d=w&65535,A=w>>>16,w=(F>>>14|de<<32-14)^(F>>>18|de<<32-18)^(de>>>41-32|F<<32-(41-32)),E=(de>>>14|F<<32-14)^(de>>>18|F<<32-18)^(F>>>41-32|de<<32-(41-32)),R+=E&65535,x+=E>>>16,d+=w&65535,A+=w>>>16,w=F&V^~F&$,E=de&L^~de&u,R+=E&65535,x+=E>>>16,d+=w&65535,A+=w>>>16,w=s[fe*2],E=s[fe*2+1],R+=E&65535,x+=E>>>16,d+=w&65535,A+=w>>>16,w=h[fe%16],E=p[fe%16],R+=E&65535,x+=E>>>16,d+=w&65535,A+=w>>>16,x+=R>>>16,d+=x>>>16,A+=d>>>16,O=d&65535|A<<16,N=R&65535|x<<16,w=O,E=N,R=E&65535,x=E>>>16,d=w&65535,A=w>>>16,w=(M>>>28|z<<32-28)^(z>>>34-32|M<<32-(34-32))^(z>>>39-32|M<<32-(39-32)),E=(z>>>28|M<<32-28)^(M>>>34-32|z<<32-(34-32))^(M>>>39-32|z<<32-(39-32)),R+=E&65535,x+=E>>>16,d+=w&65535,A+=w>>>16,w=M&H^M&k^H&k,E=z&b^z&T^b&T,R+=E&65535,x+=E>>>16,d+=w&65535,A+=w>>>16,x+=R>>>16,d+=x>>>16,A+=d>>>16,j=d&65535|A<<16,Ue=R&65535|x<<16,w=G,E=Ae,R=E&65535,x=E>>>16,d=w&65535,A=w>>>16,w=O,E=N,R+=E&65535,x+=E>>>16,d+=w&65535,A+=w>>>16,x+=R>>>16,d+=x>>>16,A+=d>>>16,G=d&65535|A<<16,Ae=R&65535|x<<16,H=he,k=ne,X=be,F=G,V=Z,$=K,U=v,M=j,b=oe,T=le,re=Te,de=Ae,L=Me,u=je,y=qe,z=Ue,fe%16===15)for(var ee=0;ee<16;ee++)w=h[ee],E=p[ee],R=E&65535,x=E>>>16,d=w&65535,A=w>>>16,w=h[(ee+9)%16],E=p[(ee+9)%16],R+=E&65535,x+=E>>>16,d+=w&65535,A+=w>>>16,O=h[(ee+1)%16],N=p[(ee+1)%16],w=(O>>>1|N<<32-1)^(O>>>8|N<<32-8)^O>>>7,E=(N>>>1|O<<32-1)^(N>>>8|O<<32-8)^(N>>>7|O<<32-7),R+=E&65535,x+=E>>>16,d+=w&65535,A+=w>>>16,O=h[(ee+14)%16],N=p[(ee+14)%16],w=(O>>>19|N<<32-19)^(N>>>61-32|O<<32-(61-32))^O>>>6,E=(N>>>19|O<<32-19)^(O>>>61-32|N<<32-(61-32))^(N>>>6|O<<32-6),R+=E&65535,x+=E>>>16,d+=w&65535,A+=w>>>16,x+=R>>>16,d+=x>>>16,A+=d>>>16,h[ee]=d&65535|A<<16,p[ee]=R&65535|x<<16}w=M,E=z,R=E&65535,x=E>>>16,d=w&65535,A=w>>>16,w=l[0],E=m[0],R+=E&65535,x+=E>>>16,d+=w&65535,A+=w>>>16,x+=R>>>16,d+=x>>>16,A+=d>>>16,l[0]=M=d&65535|A<<16,m[0]=z=R&65535|x<<16,w=H,E=b,R=E&65535,x=E>>>16,d=w&65535,A=w>>>16,w=l[1],E=m[1],R+=E&65535,x+=E>>>16,d+=w&65535,A+=w>>>16,x+=R>>>16,d+=x>>>16,A+=d>>>16,l[1]=H=d&65535|A<<16,m[1]=b=R&65535|x<<16,w=k,E=T,R=E&65535,x=E>>>16,d=w&65535,A=w>>>16,w=l[2],E=m[2],R+=E&65535,x+=E>>>16,d+=w&65535,A+=w>>>16,x+=R>>>16,d+=x>>>16,A+=d>>>16,l[2]=k=d&65535|A<<16,m[2]=T=R&65535|x<<16,w=X,E=re,R=E&65535,x=E>>>16,d=w&65535,A=w>>>16,w=l[3],E=m[3],R+=E&65535,x+=E>>>16,d+=w&65535,A+=w>>>16,x+=R>>>16,d+=x>>>16,A+=d>>>16,l[3]=X=d&65535|A<<16,m[3]=re=R&65535|x<<16,w=F,E=de,R=E&65535,x=E>>>16,d=w&65535,A=w>>>16,w=l[4],E=m[4],R+=E&65535,x+=E>>>16,d+=w&65535,A+=w>>>16,x+=R>>>16,d+=x>>>16,A+=d>>>16,l[4]=F=d&65535|A<<16,m[4]=de=R&65535|x<<16,w=V,E=L,R=E&65535,x=E>>>16,d=w&65535,A=w>>>16,w=l[5],E=m[5],R+=E&65535,x+=E>>>16,d+=w&65535,A+=w>>>16,x+=R>>>16,d+=x>>>16,A+=d>>>16,l[5]=V=d&65535|A<<16,m[5]=L=R&65535|x<<16,w=$,E=u,R=E&65535,x=E>>>16,d=w&65535,A=w>>>16,w=l[6],E=m[6],R+=E&65535,x+=E>>>16,d+=w&65535,A+=w>>>16,x+=R>>>16,d+=x>>>16,A+=d>>>16,l[6]=$=d&65535|A<<16,m[6]=u=R&65535|x<<16,w=U,E=y,R=E&65535,x=E>>>16,d=w&65535,A=w>>>16,w=l[7],E=m[7],R+=E&65535,x+=E>>>16,d+=w&65535,A+=w>>>16,x+=R>>>16,d+=x>>>16,A+=d>>>16,l[7]=U=d&65535|A<<16,m[7]=y=R&65535|x<<16,D+=128,I-=128}return D}function f(h){var p=new n;p.update(h);var l=p.digest();return p.clean(),l}r.hash=f})(b1);(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertSecretKeyToX25519=r.convertPublicKeyToX25519=r.verify=r.sign=r.extractPublicKeyFromSecretKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.SEED_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=r.SIGNATURE_LENGTH=void 0;const e=Pn,t=b1,n=Xr;r.SIGNATURE_LENGTH=64,r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=64,r.SEED_LENGTH=32;function s(G){const Z=new Float64Array(16);if(G)for(let K=0;K<G.length;K++)Z[K]=G[K];return Z}const o=new Uint8Array(32);o[0]=9;const f=s(),h=s([1]),p=s([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),l=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),m=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),_=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),D=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function I(G,Z){for(let K=0;K<16;K++)G[K]=Z[K]|0}function M(G){let Z=1;for(let K=0;K<16;K++){let v=G[K]+Z+65535;Z=Math.floor(v/65536),G[K]=v-Z*65536}G[0]+=Z-1+37*(Z-1)}function H(G,Z,K){const v=~(K-1);for(let j=0;j<16;j++){const oe=v&(G[j]^Z[j]);G[j]^=oe,Z[j]^=oe}}function k(G,Z){const K=s(),v=s();for(let j=0;j<16;j++)v[j]=Z[j];M(v),M(v),M(v);for(let j=0;j<2;j++){K[0]=v[0]-65517;for(let le=1;le<15;le++)K[le]=v[le]-65535-(K[le-1]>>16&1),K[le-1]&=65535;K[15]=v[15]-32767-(K[14]>>16&1);const oe=K[15]>>16&1;K[14]&=65535,H(v,K,1-oe)}for(let j=0;j<16;j++)G[2*j]=v[j]&255,G[2*j+1]=v[j]>>8}function X(G,Z){let K=0;for(let v=0;v<32;v++)K|=G[v]^Z[v];return(1&K-1>>>8)-1}function F(G,Z){const K=new Uint8Array(32),v=new Uint8Array(32);return k(K,G),k(v,Z),X(K,v)}function V(G){const Z=new Uint8Array(32);return k(Z,G),Z[0]&1}function $(G,Z){for(let K=0;K<16;K++)G[K]=Z[2*K]+(Z[2*K+1]<<8);G[15]&=32767}function U(G,Z,K){for(let v=0;v<16;v++)G[v]=Z[v]+K[v]}function z(G,Z,K){for(let v=0;v<16;v++)G[v]=Z[v]-K[v]}function b(G,Z,K){let v,j,oe=0,le=0,Te=0,Ae=0,Me=0,je=0,qe=0,Ue=0,ke=0,ye=0,Ie=0,Be=0,De=0,Se=0,ze=0,me=0,xe=0,Qe=0,_e=0,Oe=0,ct=0,Ce=0,Re=0,ht=0,lt=0,bt=0,Br=0,pt=0,_t=0,bi=0,Dt=0,We=K[0],Pt=K[1],Ve=K[2],Ge=K[3],Tt=K[4],He=K[5],rt=K[6],jt=K[7],Je=K[8],it=K[9],Ft=K[10],et=K[11],Ye=K[12],St=K[13],nt=K[14],st=K[15];v=Z[0],oe+=v*We,le+=v*Pt,Te+=v*Ve,Ae+=v*Ge,Me+=v*Tt,je+=v*He,qe+=v*rt,Ue+=v*jt,ke+=v*Je,ye+=v*it,Ie+=v*Ft,Be+=v*et,De+=v*Ye,Se+=v*St,ze+=v*nt,me+=v*st,v=Z[1],le+=v*We,Te+=v*Pt,Ae+=v*Ve,Me+=v*Ge,je+=v*Tt,qe+=v*He,Ue+=v*rt,ke+=v*jt,ye+=v*Je,Ie+=v*it,Be+=v*Ft,De+=v*et,Se+=v*Ye,ze+=v*St,me+=v*nt,xe+=v*st,v=Z[2],Te+=v*We,Ae+=v*Pt,Me+=v*Ve,je+=v*Ge,qe+=v*Tt,Ue+=v*He,ke+=v*rt,ye+=v*jt,Ie+=v*Je,Be+=v*it,De+=v*Ft,Se+=v*et,ze+=v*Ye,me+=v*St,xe+=v*nt,Qe+=v*st,v=Z[3],Ae+=v*We,Me+=v*Pt,je+=v*Ve,qe+=v*Ge,Ue+=v*Tt,ke+=v*He,ye+=v*rt,Ie+=v*jt,Be+=v*Je,De+=v*it,Se+=v*Ft,ze+=v*et,me+=v*Ye,xe+=v*St,Qe+=v*nt,_e+=v*st,v=Z[4],Me+=v*We,je+=v*Pt,qe+=v*Ve,Ue+=v*Ge,ke+=v*Tt,ye+=v*He,Ie+=v*rt,Be+=v*jt,De+=v*Je,Se+=v*it,ze+=v*Ft,me+=v*et,xe+=v*Ye,Qe+=v*St,_e+=v*nt,Oe+=v*st,v=Z[5],je+=v*We,qe+=v*Pt,Ue+=v*Ve,ke+=v*Ge,ye+=v*Tt,Ie+=v*He,Be+=v*rt,De+=v*jt,Se+=v*Je,ze+=v*it,me+=v*Ft,xe+=v*et,Qe+=v*Ye,_e+=v*St,Oe+=v*nt,ct+=v*st,v=Z[6],qe+=v*We,Ue+=v*Pt,ke+=v*Ve,ye+=v*Ge,Ie+=v*Tt,Be+=v*He,De+=v*rt,Se+=v*jt,ze+=v*Je,me+=v*it,xe+=v*Ft,Qe+=v*et,_e+=v*Ye,Oe+=v*St,ct+=v*nt,Ce+=v*st,v=Z[7],Ue+=v*We,ke+=v*Pt,ye+=v*Ve,Ie+=v*Ge,Be+=v*Tt,De+=v*He,Se+=v*rt,ze+=v*jt,me+=v*Je,xe+=v*it,Qe+=v*Ft,_e+=v*et,Oe+=v*Ye,ct+=v*St,Ce+=v*nt,Re+=v*st,v=Z[8],ke+=v*We,ye+=v*Pt,Ie+=v*Ve,Be+=v*Ge,De+=v*Tt,Se+=v*He,ze+=v*rt,me+=v*jt,xe+=v*Je,Qe+=v*it,_e+=v*Ft,Oe+=v*et,ct+=v*Ye,Ce+=v*St,Re+=v*nt,ht+=v*st,v=Z[9],ye+=v*We,Ie+=v*Pt,Be+=v*Ve,De+=v*Ge,Se+=v*Tt,ze+=v*He,me+=v*rt,xe+=v*jt,Qe+=v*Je,_e+=v*it,Oe+=v*Ft,ct+=v*et,Ce+=v*Ye,Re+=v*St,ht+=v*nt,lt+=v*st,v=Z[10],Ie+=v*We,Be+=v*Pt,De+=v*Ve,Se+=v*Ge,ze+=v*Tt,me+=v*He,xe+=v*rt,Qe+=v*jt,_e+=v*Je,Oe+=v*it,ct+=v*Ft,Ce+=v*et,Re+=v*Ye,ht+=v*St,lt+=v*nt,bt+=v*st,v=Z[11],Be+=v*We,De+=v*Pt,Se+=v*Ve,ze+=v*Ge,me+=v*Tt,xe+=v*He,Qe+=v*rt,_e+=v*jt,Oe+=v*Je,ct+=v*it,Ce+=v*Ft,Re+=v*et,ht+=v*Ye,lt+=v*St,bt+=v*nt,Br+=v*st,v=Z[12],De+=v*We,Se+=v*Pt,ze+=v*Ve,me+=v*Ge,xe+=v*Tt,Qe+=v*He,_e+=v*rt,Oe+=v*jt,ct+=v*Je,Ce+=v*it,Re+=v*Ft,ht+=v*et,lt+=v*Ye,bt+=v*St,Br+=v*nt,pt+=v*st,v=Z[13],Se+=v*We,ze+=v*Pt,me+=v*Ve,xe+=v*Ge,Qe+=v*Tt,_e+=v*He,Oe+=v*rt,ct+=v*jt,Ce+=v*Je,Re+=v*it,ht+=v*Ft,lt+=v*et,bt+=v*Ye,Br+=v*St,pt+=v*nt,_t+=v*st,v=Z[14],ze+=v*We,me+=v*Pt,xe+=v*Ve,Qe+=v*Ge,_e+=v*Tt,Oe+=v*He,ct+=v*rt,Ce+=v*jt,Re+=v*Je,ht+=v*it,lt+=v*Ft,bt+=v*et,Br+=v*Ye,pt+=v*St,_t+=v*nt,bi+=v*st,v=Z[15],me+=v*We,xe+=v*Pt,Qe+=v*Ve,_e+=v*Ge,Oe+=v*Tt,ct+=v*He,Ce+=v*rt,Re+=v*jt,ht+=v*Je,lt+=v*it,bt+=v*Ft,Br+=v*et,pt+=v*Ye,_t+=v*St,bi+=v*nt,Dt+=v*st,oe+=38*xe,le+=38*Qe,Te+=38*_e,Ae+=38*Oe,Me+=38*ct,je+=38*Ce,qe+=38*Re,Ue+=38*ht,ke+=38*lt,ye+=38*bt,Ie+=38*Br,Be+=38*pt,De+=38*_t,Se+=38*bi,ze+=38*Dt,j=1,v=oe+j+65535,j=Math.floor(v/65536),oe=v-j*65536,v=le+j+65535,j=Math.floor(v/65536),le=v-j*65536,v=Te+j+65535,j=Math.floor(v/65536),Te=v-j*65536,v=Ae+j+65535,j=Math.floor(v/65536),Ae=v-j*65536,v=Me+j+65535,j=Math.floor(v/65536),Me=v-j*65536,v=je+j+65535,j=Math.floor(v/65536),je=v-j*65536,v=qe+j+65535,j=Math.floor(v/65536),qe=v-j*65536,v=Ue+j+65535,j=Math.floor(v/65536),Ue=v-j*65536,v=ke+j+65535,j=Math.floor(v/65536),ke=v-j*65536,v=ye+j+65535,j=Math.floor(v/65536),ye=v-j*65536,v=Ie+j+65535,j=Math.floor(v/65536),Ie=v-j*65536,v=Be+j+65535,j=Math.floor(v/65536),Be=v-j*65536,v=De+j+65535,j=Math.floor(v/65536),De=v-j*65536,v=Se+j+65535,j=Math.floor(v/65536),Se=v-j*65536,v=ze+j+65535,j=Math.floor(v/65536),ze=v-j*65536,v=me+j+65535,j=Math.floor(v/65536),me=v-j*65536,oe+=j-1+37*(j-1),j=1,v=oe+j+65535,j=Math.floor(v/65536),oe=v-j*65536,v=le+j+65535,j=Math.floor(v/65536),le=v-j*65536,v=Te+j+65535,j=Math.floor(v/65536),Te=v-j*65536,v=Ae+j+65535,j=Math.floor(v/65536),Ae=v-j*65536,v=Me+j+65535,j=Math.floor(v/65536),Me=v-j*65536,v=je+j+65535,j=Math.floor(v/65536),je=v-j*65536,v=qe+j+65535,j=Math.floor(v/65536),qe=v-j*65536,v=Ue+j+65535,j=Math.floor(v/65536),Ue=v-j*65536,v=ke+j+65535,j=Math.floor(v/65536),ke=v-j*65536,v=ye+j+65535,j=Math.floor(v/65536),ye=v-j*65536,v=Ie+j+65535,j=Math.floor(v/65536),Ie=v-j*65536,v=Be+j+65535,j=Math.floor(v/65536),Be=v-j*65536,v=De+j+65535,j=Math.floor(v/65536),De=v-j*65536,v=Se+j+65535,j=Math.floor(v/65536),Se=v-j*65536,v=ze+j+65535,j=Math.floor(v/65536),ze=v-j*65536,v=me+j+65535,j=Math.floor(v/65536),me=v-j*65536,oe+=j-1+37*(j-1),G[0]=oe,G[1]=le,G[2]=Te,G[3]=Ae,G[4]=Me,G[5]=je,G[6]=qe,G[7]=Ue,G[8]=ke,G[9]=ye,G[10]=Ie,G[11]=Be,G[12]=De,G[13]=Se,G[14]=ze,G[15]=me}function T(G,Z){b(G,Z,Z)}function re(G,Z){const K=s();let v;for(v=0;v<16;v++)K[v]=Z[v];for(v=253;v>=0;v--)T(K,K),v!==2&&v!==4&&b(K,K,Z);for(v=0;v<16;v++)G[v]=K[v]}function de(G,Z){const K=s();let v;for(v=0;v<16;v++)K[v]=Z[v];for(v=250;v>=0;v--)T(K,K),v!==1&&b(K,K,Z);for(v=0;v<16;v++)G[v]=K[v]}function L(G,Z){const K=s(),v=s(),j=s(),oe=s(),le=s(),Te=s(),Ae=s(),Me=s(),je=s();z(K,G[1],G[0]),z(je,Z[1],Z[0]),b(K,K,je),U(v,G[0],G[1]),U(je,Z[0],Z[1]),b(v,v,je),b(j,G[3],Z[3]),b(j,j,l),b(oe,G[2],Z[2]),U(oe,oe,oe),z(le,v,K),z(Te,oe,j),U(Ae,oe,j),U(Me,v,K),b(G[0],le,Te),b(G[1],Me,Ae),b(G[2],Ae,Te),b(G[3],le,Me)}function u(G,Z,K){for(let v=0;v<4;v++)H(G[v],Z[v],K)}function y(G,Z){const K=s(),v=s(),j=s();re(j,Z[2]),b(K,Z[0],j),b(v,Z[1],j),k(G,v),G[31]^=V(K)<<7}function w(G,Z,K){I(G[0],f),I(G[1],h),I(G[2],h),I(G[3],f);for(let v=255;v>=0;--v){const j=K[v/8|0]>>(v&7)&1;u(G,Z,j),L(Z,G),L(G,G),u(G,Z,j)}}function E(G,Z){const K=[s(),s(),s(),s()];I(K[0],m),I(K[1],_),I(K[2],h),b(K[3],m,_),w(G,K,Z)}function O(G){if(G.length!==r.SEED_LENGTH)throw new Error(`ed25519: seed must be ${r.SEED_LENGTH} bytes`);const Z=(0,t.hash)(G);Z[0]&=248,Z[31]&=127,Z[31]|=64;const K=new Uint8Array(32),v=[s(),s(),s(),s()];E(v,Z),y(K,v);const j=new Uint8Array(64);return j.set(G),j.set(K,32),{publicKey:K,secretKey:j}}r.generateKeyPairFromSeed=O;function N(G){const Z=(0,e.randomBytes)(32,G),K=O(Z);return(0,n.wipe)(Z),K}r.generateKeyPair=N;function R(G){if(G.length!==r.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${r.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(G.subarray(32))}r.extractPublicKeyFromSecretKey=R;const x=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 d(G,Z){let K,v,j,oe;for(v=63;v>=32;--v){for(K=0,j=v-32,oe=v-12;j<oe;++j)Z[j]+=K-16*Z[v]*x[j-(v-32)],K=Math.floor((Z[j]+128)/256),Z[j]-=K*256;Z[j]+=K,Z[v]=0}for(K=0,j=0;j<32;j++)Z[j]+=K-(Z[31]>>4)*x[j],K=Z[j]>>8,Z[j]&=255;for(j=0;j<32;j++)Z[j]-=K*x[j];for(v=0;v<32;v++)Z[v+1]+=Z[v]>>8,G[v]=Z[v]&255}function A(G){const Z=new Float64Array(64);for(let K=0;K<64;K++)Z[K]=G[K];for(let K=0;K<64;K++)G[K]=0;d(G,Z)}function fe(G,Z){const K=new Float64Array(64),v=[s(),s(),s(),s()],j=(0,t.hash)(G.subarray(0,32));j[0]&=248,j[31]&=127,j[31]|=64;const oe=new Uint8Array(64);oe.set(j.subarray(32),32);const le=new t.SHA512;le.update(oe.subarray(32)),le.update(Z);const Te=le.digest();le.clean(),A(Te),E(v,Te),y(oe,v),le.reset(),le.update(oe.subarray(0,32)),le.update(G.subarray(32)),le.update(Z);const Ae=le.digest();A(Ae);for(let Me=0;Me<32;Me++)K[Me]=Te[Me];for(let Me=0;Me<32;Me++)for(let je=0;je<32;je++)K[Me+je]+=Ae[Me]*j[je];return d(oe.subarray(32),K),oe}r.sign=fe;function ee(G,Z){const K=s(),v=s(),j=s(),oe=s(),le=s(),Te=s(),Ae=s();return I(G[2],h),$(G[1],Z),T(j,G[1]),b(oe,j,p),z(j,j,G[2]),U(oe,G[2],oe),T(le,oe),T(Te,le),b(Ae,Te,le),b(K,Ae,j),b(K,K,oe),de(K,K),b(K,K,j),b(K,K,oe),b(K,K,oe),b(G[0],K,oe),T(v,G[0]),b(v,v,oe),F(v,j)&&b(G[0],G[0],D),T(v,G[0]),b(v,v,oe),F(v,j)?-1:(V(G[0])===Z[31]>>7&&z(G[0],f,G[0]),b(G[3],G[0],G[1]),0)}function he(G,Z,K){const v=new Uint8Array(32),j=[s(),s(),s(),s()],oe=[s(),s(),s(),s()];if(K.length!==r.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${r.SIGNATURE_LENGTH} bytes`);if(ee(oe,G))return!1;const le=new t.SHA512;le.update(K.subarray(0,32)),le.update(G),le.update(Z);const Te=le.digest();return A(Te),w(j,oe,Te),E(oe,K.subarray(32)),L(j,oe),y(v,j),!X(K,v)}r.verify=he;function ne(G){let Z=[s(),s(),s(),s()];if(ee(Z,G))throw new Error("Ed25519: invalid public key");let K=s(),v=s(),j=Z[1];U(K,h,j),z(v,h,j),re(v,v),b(K,K,v);let oe=new Uint8Array(32);return k(oe,K),oe}r.convertPublicKeyToX25519=ne;function be(G){const Z=(0,t.hash)(G.subarray(0,32));Z[0]&=248,Z[31]&=127,Z[31]|=64;const K=new Uint8Array(Z.subarray(0,32));return(0,n.wipe)(Z),K}r.convertSecretKeyToX25519=be})(pu);const $5="EdDSA",L5="JWT",Ec=".",Vc="base64url",v1="utf8",m1="utf8",F5=":",q5="did",U5="key",Zl="base58btc",B5="z",z5="K36",H5=32,j5=r=>JSON.stringify(r,(e,t)=>typeof t=="bigint"?t.toString()+"n":t),K5=r=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,t=r.replace(e,'$1"$2n"$3');return JSON.parse(t,(n,s)=>typeof s=="string"&&s.match(/^\d+n$/)?BigInt(s.substring(0,s.length-1)):s)};function us(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return K5(r)}catch{return r}}function cn(r){return typeof r=="string"?r:j5(r)||""}function Ql(r){return us(fr(cr(r,Vc),v1))}function Sc(r){return fr(cr(cn(r),v1),Vc)}function y1(r){const e=cr(z5,Zl),t=B5+fr(hc([e,r]),Zl);return[q5,U5,t].join(F5)}function k5(r){return fr(r,Vc)}function W5(r){return cr(r,Vc)}function V5(r){return cr([Sc(r.header),Sc(r.payload)].join(Ec),m1)}function G5(r){return[Sc(r.header),Sc(r.payload),k5(r.signature)].join(Ec)}function Wh(r){const e=r.split(Ec),t=Ql(e[0]),n=Ql(e[1]),s=W5(e[2]),o=cr(e.slice(0,2).join(Ec),m1);return{header:t,payload:n,signature:s,data:o}}function e0(r=Pn.randomBytes(H5)){return pu.generateKeyPairFromSeed(r)}async function J5(r,e,t,n,s=pe.fromMiliseconds(Date.now())){const o={alg:$5,typ:L5},f=y1(n.publicKey),h=s+t,p={iss:f,sub:r,aud:e,iat:s,exp:h},l=V5({header:o,payload:p}),m=pu.sign(n.secretKey,l);return G5({header:o,payload:p,signature:m})}const Y5={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"}},X5=":";function Ws(r){const[e,t]=r.split(X5);return{namespace:e,reference:t}}function t0(r,e=[]){const t=[];return Object.keys(r).forEach(n=>{if(e.length&&!e.includes(n))return;const s=r[n];t.push(...s.accounts)}),t}function w1(r,e){return r.includes(":")?[r]:e.chains||[]}var Z5=Object.defineProperty,r0=Object.getOwnPropertySymbols,Q5=Object.prototype.hasOwnProperty,e8=Object.prototype.propertyIsEnumerable,i0=(r,e,t)=>e in r?Z5(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,n0=(r,e)=>{for(var t in e||(e={}))Q5.call(e,t)&&i0(r,t,e[t]);if(r0)for(var t of r0(e))e8.call(e,t)&&i0(r,t,e[t]);return r};const t8="ReactNative",Jr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},r8="js";function xc(){return typeof Di<"u"&&typeof Di.versions<"u"&&typeof Di.versions.node<"u"}function On(){return!Ba()&&!!nu()&&navigator.product===t8}function i8(){return On()&&typeof Fe<"u"&&typeof(Fe==null?void 0:Fe.Platform)<"u"&&(Fe==null?void 0:Fe.Platform.OS)==="android"}function n8(){return On()&&typeof Fe<"u"&&typeof(Fe==null?void 0:Fe.Platform)<"u"&&(Fe==null?void 0:Fe.Platform.OS)==="ios"}function Wa(){return!xc()&&!!nu()&&!!Ba()}function Va(){return On()?Jr.reactNative:xc()?Jr.node:Wa()?Jr.browser:Jr.unknown}function s0(){var r;try{return On()&&typeof Fe<"u"&&typeof(Fe==null?void 0:Fe.Application)<"u"?(r=Fe.Application)==null?void 0:r.applicationId:void 0}catch{return}}function s8(r,e){let t=Ta.parse(r);return t=n0(n0({},t),e),r=Ta.stringify(t),r}function _1(){return kp()||{name:"",description:"",url:"",icons:[""]}}function a8(){if(Va()===Jr.reactNative&&typeof Fe<"u"&&typeof(Fe==null?void 0:Fe.Platform)<"u"){const{OS:t,Version:n}=Fe.Platform;return[t,n].join("-")}const r=g2();if(r===null)return"unknown";const e=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[e,r.name,r.version].join("-"):[e,r.version].join("-")}function o8(){var r;const e=Va();return e===Jr.browser?[e,((r=Kp())==null?void 0:r.host)||"unknown"].join(":"):e}function E1(r,e,t){const n=a8(),s=o8();return[[r,e].join("-"),[r8,t].join("-"),n,s].join("/")}function c8({protocol:r,version:e,relayUrl:t,sdkVersion:n,auth:s,projectId:o,useOnCloseEvent:f,bundleId:h,packageName:p}){const l=t.split("?"),m=E1(r,e,n),_={auth:s,ua:m,projectId:o,useOnCloseEvent:f||void 0,packageName:p||void 0,bundleId:h||void 0},D=s8(l[1]||"",_);return l[0]+"?"+D}function fs(r,e){return r.filter(t=>e.includes(t)).length===r.length}function S1(r){return Object.fromEntries(r.entries())}function x1(r){return new Map(Object.entries(r))}function as(r=pe.FIVE_MINUTES,e){const t=pe.toMiliseconds(r||pe.FIVE_MINUTES);let n,s,o,f;return{resolve:h=>{o&&n&&(clearTimeout(o),n(h),f=Promise.resolve(h))},reject:h=>{o&&s&&(clearTimeout(o),s(h))},done:()=>new Promise((h,p)=>{if(f)return h(f);o=setTimeout(()=>{const l=new Error(e);f=Promise.reject(l),p(l)},t),n=h,s=p})}}function xn(r,e,t){return new Promise(async(n,s)=>{const o=setTimeout(()=>s(new Error(t)),e);try{const f=await r;n(f)}catch(f){s(f)}clearTimeout(o)})}function I1(r,e){if(typeof e=="string"&&e.startsWith(`${r}:`))return e;if(r.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(r.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${r}`)}function f8(r){return I1("topic",r)}function h8(r){return I1("id",r)}function D1(r){const[e,t]=r.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof t=="string")n.topic=t;else if(e==="id"&&Number.isInteger(Number(t)))n.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${t}`);return n}function rr(r,e){return pe.fromMiliseconds((e||Date.now())+pe.toMiliseconds(r))}function Sn(r){return Date.now()>=pe.toMiliseconds(r)}function dt(r,e){return`${r}${e?`:${e}`:""}`}function uc(r=[],e=[]){return[...new Set([...r,...e])]}async function u8({id:r,topic:e,wcDeepLink:t}){var n;try{if(!t)return;const s=typeof t=="string"?JSON.parse(t):t,o=s==null?void 0:s.href;if(typeof o!="string")return;const f=d8(o,r,e),h=Va();if(h===Jr.browser){if(!((n=Ba())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}f.startsWith("https://")||f.startsWith("http://")?window.open(f,"_blank","noreferrer noopener"):window.open(f,p8()?"_blank":"_self","noreferrer noopener")}else h===Jr.reactNative&&typeof(Fe==null?void 0:Fe.Linking)<"u"&&await Fe.Linking.openURL(f)}catch(s){console.error(s)}}function d8(r,e,t){const n=`requestId=${e}&sessionTopic=${t}`;r.endsWith("/")&&(r=r.slice(0,-1));let s=`${r}`;if(r.startsWith("https://t.me")){const o=r.includes("?")?"&startapp=":"?startapp=";s=`${s}${o}${g8(n,!0)}`}else s=`${s}/wc?${n}`;return s}async function l8(r,e){let t="";try{if(Wa()&&(t=localStorage.getItem(e),t))return t;t=await r.getItem(e)}catch(n){console.error(n)}return t}function a0(r,e){if(!r.includes(e))return null;const t=r.split(/([&,?,=])/),n=t.indexOf(e);return t[n+2]}function o0(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,r=>{const e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)})}function gu(){return typeof Di<"u"&&{}.IS_VITEST==="true"}function p8(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function g8(r,e=!1){const t=Ai.from(r).toString("base64");return e?t.replace(/[=]/g,""):t}function A1(r){return Ai.from(r,"base64").toString("utf-8")}function b8(r){return new Promise(e=>setTimeout(e,r))}const v8="https://rpc.walletconnect.org/v1";async function m8(r,e,t,n,s,o){switch(t.t){case"eip191":return y8(r,e,t.s);case"eip1271":return await w8(r,e,t.s,n,s,o);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${t.t}`)}}function y8(r,e,t){return n2(zp(e),t).toLowerCase()===r.toLowerCase()}async function w8(r,e,t,n,s,o){const f=Ws(n);if(!f.namespace||!f.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const h="0x1626ba7e",p="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",m=t.substring(2),_=zp(e).substring(2),D=h+_+p+l+m,I=await fetch(`${o||v8}/?chainId=${n}&projectId=${s}`,{method:"POST",body:JSON.stringify({id:_8(),jsonrpc:"2.0",method:"eth_call",params:[{to:r,data:D},"latest"]})}),{result:M}=await I.json();return M?M.slice(0,h.length).toLowerCase()===h.toLowerCase():!1}catch(h){return console.error("isValidEip1271Signature: ",h),!1}}function _8(){return Date.now()+Math.floor(Math.random()*1e3)}var E8=Object.defineProperty,S8=Object.defineProperties,x8=Object.getOwnPropertyDescriptors,c0=Object.getOwnPropertySymbols,I8=Object.prototype.hasOwnProperty,D8=Object.prototype.propertyIsEnumerable,f0=(r,e,t)=>e in r?E8(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,A8=(r,e)=>{for(var t in e||(e={}))I8.call(e,t)&&f0(r,t,e[t]);if(c0)for(var t of c0(e))D8.call(e,t)&&f0(r,t,e[t]);return r},P8=(r,e)=>S8(r,x8(e));const M8="did:pkh:",bu=r=>r==null?void 0:r.split(":"),O8=r=>{const e=r&&bu(r);if(e)return r.includes(M8)?e[3]:e[1]},Vh=r=>{const e=r&&bu(r);if(e)return e[2]+":"+e[3]},Ic=r=>{const e=r&&bu(r);if(e)return e.pop()};async function h0(r){const{cacao:e,projectId:t}=r,{s:n,p:s}=e,o=P1(s,s.iss),f=Ic(s.iss);return await m8(f,o,n,Vh(s.iss),t)}const P1=(r,e)=>{const t=`${r.domain} wants you to sign in with your Ethereum account:`,n=Ic(e);if(!r.aud&&!r.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let s=r.statement||void 0;const o=`URI: ${r.aud||r.uri}`,f=`Version: ${r.version}`,h=`Chain ID: ${O8(e)}`,p=`Nonce: ${r.nonce}`,l=`Issued At: ${r.iat}`,m=r.exp?`Expiration Time: ${r.exp}`:void 0,_=r.nbf?`Not Before: ${r.nbf}`:void 0,D=r.requestId?`Request ID: ${r.requestId}`:void 0,I=r.resources?`Resources:${r.resources.map(H=>`
|
|
16
|
-
- ${H}`).join("")}`:void 0,M=dc(r.resources);if(M){const H=Na(M);s=U8(s,H)}return[t,n,"",s,"",o,f,h,p,l,m,_,D,I].filter(H=>H!=null).join(`
|
|
17
|
-
`)};function C8(r){return Ai.from(JSON.stringify(r)).toString("base64")}function R8(r){return JSON.parse(Ai.from(r,"base64").toString("utf-8"))}function ds(r){if(!r)throw new Error("No recap provided, value is undefined");if(!r.att)throw new Error("No `att` property found");const e=Object.keys(r.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(t=>{const n=r.att[t];if(Array.isArray(n))throw new Error(`Resource must be an object: ${t}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${t}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${t}`);Object.keys(n).forEach(s=>{const o=n[s];if(!Array.isArray(o))throw new Error(`Ability limits ${s} must be an array of objects, found: ${o}`);if(!o.length)throw new Error(`Value of ${s} is empty array, must be an array with objects`);o.forEach(f=>{if(typeof f!="object")throw new Error(`Ability limits (${s}) must be an array of objects, found: ${f}`)})})})}function T8(r,e,t,n={}){return t==null||t.sort((s,o)=>s.localeCompare(o)),{att:{[r]:N8(e,t,n)}}}function N8(r,e,t={}){e=e==null?void 0:e.sort((s,o)=>s.localeCompare(o));const n=e.map(s=>({[`${r}/${s}`]:[t]}));return Object.assign({},...n)}function M1(r){return ds(r),`urn:recap:${C8(r).replace(/=/g,"")}`}function Na(r){const e=R8(r.replace("urn:recap:",""));return ds(e),e}function $8(r,e,t){const n=T8(r,e,t);return M1(n)}function L8(r){return r&&r.includes("urn:recap:")}function F8(r,e){const t=Na(r),n=Na(e),s=q8(t,n);return M1(s)}function q8(r,e){ds(r),ds(e);const t=Object.keys(r.att).concat(Object.keys(e.att)).sort((s,o)=>s.localeCompare(o)),n={att:{}};return t.forEach(s=>{var o,f;Object.keys(((o=r.att)==null?void 0:o[s])||{}).concat(Object.keys(((f=e.att)==null?void 0:f[s])||{})).sort((h,p)=>h.localeCompare(p)).forEach(h=>{var p,l;n.att[s]=P8(A8({},n.att[s]),{[h]:((p=r.att[s])==null?void 0:p[h])||((l=e.att[s])==null?void 0:l[h])})})}),n}function U8(r="",e){ds(e);const t="I further authorize the stated URI to perform the following actions on my behalf: ";if(r.includes(t))return r;const n=[];let s=0;Object.keys(e.att).forEach(h=>{const p=Object.keys(e.att[h]).map(_=>({ability:_.split("/")[0],action:_.split("/")[1]}));p.sort((_,D)=>_.action.localeCompare(D.action));const l={};p.forEach(_=>{l[_.ability]||(l[_.ability]=[]),l[_.ability].push(_.action)});const m=Object.keys(l).map(_=>(s++,`(${s}) '${_}': '${l[_].join("', '")}' for '${h}'.`));n.push(m.join(", ").replace(".,","."))});const o=n.join(" "),f=`${t}${o}`;return`${r?r+" ":""}${f}`}function u0(r){var e;const t=Na(r);ds(t);const n=(e=t.att)==null?void 0:e.eip155;return n?Object.keys(n).map(s=>s.split("/")[1]):[]}function d0(r){const e=Na(r);ds(e);const t=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(s=>{var o;(o=s==null?void 0:s[0])!=null&&o.chains&&t.push(s[0].chains)})}),[...new Set(t.flat())]}function dc(r){if(!r)return;const e=r==null?void 0:r[r.length-1];return L8(e)?e:void 0}const O1="base10",Mr="base16",In="base64pad",_a="base64url",Ga="utf8",C1=0,on=1,Ja=2,B8=0,l0=1,Ma=12,vu=32;function z8(){const r=cu.generateKeyPair();return{privateKey:fr(r.secretKey,Mr),publicKey:fr(r.publicKey,Mr)}}function Gh(){const r=Pn.randomBytes(vu);return fr(r,Mr)}function H8(r,e){const t=cu.sharedKey(cr(r,Mr),cr(e,Mr),!0),n=new K6(Ha.SHA256,t).expand(vu);return fr(n,Mr)}function lc(r){const e=Ha.hash(cr(r,Mr));return fr(e,Mr)}function sn(r){const e=Ha.hash(cr(r,Ga));return fr(e,Mr)}function R1(r){return cr(`${r}`,O1)}function ls(r){return Number(fr(r,O1))}function j8(r){const e=R1(typeof r.type<"u"?r.type:C1);if(ls(e)===on&&typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const t=typeof r.senderPublicKey<"u"?cr(r.senderPublicKey,Mr):void 0,n=typeof r.iv<"u"?cr(r.iv,Mr):Pn.randomBytes(Ma),s=new au.ChaCha20Poly1305(cr(r.symKey,Mr)).seal(n,cr(r.message,Ga));return T1({type:e,sealed:s,iv:n,senderPublicKey:t,encoding:r.encoding})}function K8(r,e){const t=R1(Ja),n=Pn.randomBytes(Ma),s=cr(r,Ga);return T1({type:t,sealed:s,iv:n,encoding:e})}function k8(r){const e=new au.ChaCha20Poly1305(cr(r.symKey,Mr)),{sealed:t,iv:n}=$a({encoded:r.encoded,encoding:r==null?void 0:r.encoding}),s=e.open(n,t);if(s===null)throw new Error("Failed to decrypt");return fr(s,Ga)}function W8(r,e){const{sealed:t}=$a({encoded:r,encoding:e});return fr(t,Ga)}function T1(r){const{encoding:e=In}=r;if(ls(r.type)===Ja)return fr(hc([r.type,r.sealed]),e);if(ls(r.type)===on){if(typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return fr(hc([r.type,r.senderPublicKey,r.iv,r.sealed]),e)}return fr(hc([r.type,r.iv,r.sealed]),e)}function $a(r){const{encoded:e,encoding:t=In}=r,n=cr(e,t),s=n.slice(B8,l0),o=l0;if(ls(s)===on){const l=o+vu,m=l+Ma,_=n.slice(o,l),D=n.slice(l,m),I=n.slice(m);return{type:s,sealed:I,iv:D,senderPublicKey:_}}if(ls(s)===Ja){const l=n.slice(o),m=Pn.randomBytes(Ma);return{type:s,sealed:l,iv:m}}const f=o+Ma,h=n.slice(o,f),p=n.slice(f);return{type:s,sealed:p,iv:h}}function V8(r,e){const t=$a({encoded:r,encoding:e==null?void 0:e.encoding});return N1({type:ls(t.type),senderPublicKey:typeof t.senderPublicKey<"u"?fr(t.senderPublicKey,Mr):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function N1(r){const e=(r==null?void 0:r.type)||C1;if(e===on){if(typeof(r==null?void 0:r.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(r==null?void 0:r.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:r==null?void 0:r.senderPublicKey,receiverPublicKey:r==null?void 0:r.receiverPublicKey}}function p0(r){return r.type===on&&typeof r.senderPublicKey=="string"&&typeof r.receiverPublicKey=="string"}function g0(r){return r.type===Ja}function G8(r){return new f1.ec("p256").keyFromPublic({x:Ai.from(r.x,"base64").toString("hex"),y:Ai.from(r.y,"base64").toString("hex")},"hex")}function J8(r){let e=r.replace(/-/g,"+").replace(/_/g,"/");const t=e.length%4;return t>0&&(e+="=".repeat(4-t)),e}function Y8(r){return Ai.from(J8(r),"base64")}function X8(r,e){const[t,n,s]=r.split("."),o=Y8(s);if(o.length!==64)throw new Error("Invalid signature length");const f=o.slice(0,32).toString("hex"),h=o.slice(32,64).toString("hex"),p=`${t}.${n}`,l=new Ha.SHA256().update(Ai.from(p)).digest(),m=G8(e),_=Ai.from(l).toString("hex");if(!m.verify(_,{r:f,s:h}))throw new Error("Invalid signature");return Wh(r).payload}const Z8="irn";function Dc(r){return(r==null?void 0:r.relay)||{protocol:Z8}}function Aa(r){const e=Y5[r];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${r}`);return e}var Q8=Object.defineProperty,e4=Object.defineProperties,t4=Object.getOwnPropertyDescriptors,b0=Object.getOwnPropertySymbols,r4=Object.prototype.hasOwnProperty,i4=Object.prototype.propertyIsEnumerable,v0=(r,e,t)=>e in r?Q8(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,m0=(r,e)=>{for(var t in e||(e={}))r4.call(e,t)&&v0(r,t,e[t]);if(b0)for(var t of b0(e))i4.call(e,t)&&v0(r,t,e[t]);return r},n4=(r,e)=>e4(r,t4(e));function s4(r,e="-"){const t={},n="relay"+e;return Object.keys(r).forEach(s=>{if(s.startsWith(n)){const o=s.replace(n,""),f=r[s];t[o]=f}}),t}function y0(r){if(!r.includes("wc:")){const p=A1(r);p!=null&&p.includes("wc:")&&(r=p)}r=r.includes("wc://")?r.replace("wc://",""):r,r=r.includes("wc:")?r.replace("wc:",""):r;const e=r.indexOf(":"),t=r.indexOf("?")!==-1?r.indexOf("?"):void 0,n=r.substring(0,e),s=r.substring(e+1,t).split("@"),o=typeof t<"u"?r.substring(t):"",f=Ta.parse(o),h=typeof f.methods=="string"?f.methods.split(","):void 0;return{protocol:n,topic:a4(s[0]),version:parseInt(s[1],10),symKey:f.symKey,relay:s4(f),methods:h,expiryTimestamp:f.expiryTimestamp?parseInt(f.expiryTimestamp,10):void 0}}function a4(r){return r.startsWith("//")?r.substring(2):r}function o4(r,e="-"){const t="relay",n={};return Object.keys(r).forEach(s=>{const o=t+e+s;r[s]&&(n[o]=r[s])}),n}function w0(r){return`${r.protocol}:${r.topic}@${r.version}?`+Ta.stringify(m0(n4(m0({symKey:r.symKey},o4(r.relay)),{expiryTimestamp:r.expiryTimestamp}),r.methods?{methods:r.methods.join(",")}:{}))}function ic(r,e,t){return`${r}?wc_ev=${t}&topic=${e}`}function Zs(r){const e=[];return r.forEach(t=>{const[n,s]=t.split(":");e.push(`${n}:${s}`)}),e}function c4(r){const e=[];return Object.values(r).forEach(t=>{e.push(...Zs(t.accounts))}),e}function f4(r,e){const t=[];return Object.values(r).forEach(n=>{Zs(n.accounts).includes(e)&&t.push(...n.methods)}),t}function h4(r,e){const t=[];return Object.values(r).forEach(n=>{Zs(n.accounts).includes(e)&&t.push(...n.events)}),t}function mu(r){return r.includes(":")}function Pa(r){return mu(r)?r.split(":")[0]:r}function u4(r){const e={};return r==null||r.forEach(t=>{const[n,s]=t.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(t),e[n].chains.push(`${n}:${s}`)}),e}function _0(r,e){e=e.map(n=>n.replace("did:pkh:",""));const t=u4(e);for(const[n,s]of Object.entries(t))s.methods?s.methods=uc(s.methods,r):s.methods=r,s.events=["chainChanged","accountsChanged"];return t}const d4={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}},l4={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 ge(r,e){const{message:t,code:n}=l4[r];return{message:e?`${t} ${e}`:t,code:n}}function It(r,e){const{message:t,code:n}=d4[r];return{message:e?`${t} ${e}`:t,code:n}}function fn(r,e){return Array.isArray(r)?typeof e<"u"&&r.length?r.every(e):!0:!1}function La(r){return Object.getPrototypeOf(r)===Object.prototype&&Object.keys(r).length}function Pr(r){return typeof r>"u"}function Xt(r,e){return e&&Pr(r)?!0:typeof r=="string"&&!!r.trim().length}function yu(r,e){return e&&Pr(r)?!0:typeof r=="number"&&!isNaN(r)}function p4(r,e){const{requiredNamespaces:t}=e,n=Object.keys(r.namespaces),s=Object.keys(t);let o=!0;return fs(s,n)?(n.forEach(f=>{const{accounts:h,methods:p,events:l}=r.namespaces[f],m=Zs(h),_=t[f];(!fs(w1(f,_),m)||!fs(_.methods,p)||!fs(_.events,l))&&(o=!1)}),o):!1}function Ac(r){return Xt(r,!1)&&r.includes(":")?r.split(":").length===2:!1}function g4(r){if(Xt(r,!1)&&r.includes(":")){const e=r.split(":");if(e.length===3){const t=e[0]+":"+e[1];return!!e[2]&&Ac(t)}}return!1}function b4(r){function e(t){try{return typeof new URL(t)<"u"}catch{return!1}}try{if(Xt(r,!1)){if(e(r))return!0;const t=A1(r);return e(t)}}catch{}return!1}function v4(r){var e;return(e=r==null?void 0:r.proposer)==null?void 0:e.publicKey}function m4(r){return r==null?void 0:r.topic}function y4(r,e){let t=null;return Xt(r==null?void 0:r.publicKey,!1)||(t=ge("MISSING_OR_INVALID",`${e} controller public key should be a string`)),t}function E0(r){let e=!0;return fn(r)?r.length&&(e=r.every(t=>Xt(t,!1))):e=!1,e}function w4(r,e,t){let n=null;return fn(e)&&e.length?e.forEach(s=>{n||Ac(s)||(n=It("UNSUPPORTED_CHAINS",`${t}, chain ${s} should be a string and conform to "namespace:chainId" format`))}):Ac(r)||(n=It("UNSUPPORTED_CHAINS",`${t}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function _4(r,e,t){let n=null;return Object.entries(r).forEach(([s,o])=>{if(n)return;const f=w4(s,w1(s,o),`${e} ${t}`);f&&(n=f)}),n}function E4(r,e){let t=null;return fn(r)?r.forEach(n=>{t||g4(n)||(t=It("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):t=It("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),t}function S4(r,e){let t=null;return Object.values(r).forEach(n=>{if(t)return;const s=E4(n==null?void 0:n.accounts,`${e} namespace`);s&&(t=s)}),t}function x4(r,e){let t=null;return E0(r==null?void 0:r.methods)?E0(r==null?void 0:r.events)||(t=It("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):t=It("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),t}function $1(r,e){let t=null;return Object.values(r).forEach(n=>{if(t)return;const s=x4(n,`${e}, namespace`);s&&(t=s)}),t}function I4(r,e,t){let n=null;if(r&&La(r)){const s=$1(r,e);s&&(n=s);const o=_4(r,e,t);o&&(n=o)}else n=ge("MISSING_OR_INVALID",`${e}, ${t} should be an object with data`);return n}function Eh(r,e){let t=null;if(r&&La(r)){const n=$1(r,e);n&&(t=n);const s=S4(r,e);s&&(t=s)}else t=ge("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return t}function L1(r){return Xt(r.protocol,!0)}function D4(r,e){let t=!1;return e&&!r?t=!0:r&&fn(r)&&r.length&&r.forEach(n=>{t=L1(n)}),t}function A4(r){return typeof r=="number"}function Fr(r){return typeof r<"u"&&typeof r!==null}function P4(r){return!(!r||typeof r!="object"||!r.code||!yu(r.code,!1)||!r.message||!Xt(r.message,!1))}function M4(r){return!(Pr(r)||!Xt(r.method,!1))}function O4(r){return!(Pr(r)||Pr(r.result)&&Pr(r.error)||!yu(r.id,!1)||!Xt(r.jsonrpc,!1))}function C4(r){return!(Pr(r)||!Xt(r.name,!1))}function S0(r,e){return!(!Ac(e)||!c4(r).includes(e))}function R4(r,e,t){return Xt(t,!1)?f4(r,e).includes(t):!1}function T4(r,e,t){return Xt(t,!1)?h4(r,e).includes(t):!1}function x0(r,e,t){let n=null;const s=N4(r),o=$4(e),f=Object.keys(s),h=Object.keys(o),p=I0(Object.keys(r)),l=I0(Object.keys(e)),m=p.filter(_=>!l.includes(_));return m.length&&(n=ge("NON_CONFORMING_NAMESPACES",`${t} namespaces keys don't satisfy requiredNamespaces.
|
|
18
|
-
Required: ${m.toString()}
|
|
19
|
-
Received: ${Object.keys(e).toString()}`)),fs(f,h)||(n=ge("NON_CONFORMING_NAMESPACES",`${t} namespaces chains don't satisfy required namespaces.
|
|
20
|
-
Required: ${f.toString()}
|
|
21
|
-
Approved: ${h.toString()}`)),Object.keys(e).forEach(_=>{if(!_.includes(":")||n)return;const D=Zs(e[_].accounts);D.includes(_)||(n=ge("NON_CONFORMING_NAMESPACES",`${t} namespaces accounts don't satisfy namespace accounts for ${_}
|
|
22
|
-
Required: ${_}
|
|
23
|
-
Approved: ${D.toString()}`))}),f.forEach(_=>{n||(fs(s[_].methods,o[_].methods)?fs(s[_].events,o[_].events)||(n=ge("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy namespace events for ${_}`)):n=ge("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy namespace methods for ${_}`))}),n}function N4(r){const e={};return Object.keys(r).forEach(t=>{var n;t.includes(":")?e[t]=r[t]:(n=r[t].chains)==null||n.forEach(s=>{e[s]={methods:r[t].methods,events:r[t].events}})}),e}function I0(r){return[...new Set(r.map(e=>e.includes(":")?e.split(":")[0]:e))]}function $4(r){const e={};return Object.keys(r).forEach(t=>{if(t.includes(":"))e[t]=r[t];else{const n=Zs(r[t].accounts);n==null||n.forEach(s=>{e[s]={accounts:r[t].accounts.filter(o=>o.includes(`${s}:`)),methods:r[t].methods,events:r[t].events}})}}),e}function L4(r,e){return yu(r,!1)&&r<=e.max&&r>=e.min}function D0(){const r=Va();return new Promise(e=>{switch(r){case Jr.browser:e(F4());break;case Jr.reactNative:e(q4());break;case Jr.node:e(U4());break;default:e(!0)}})}function F4(){return Wa()&&(navigator==null?void 0:navigator.onLine)}async function q4(){if(On()&&typeof Fe<"u"&&Fe!=null&&Fe.NetInfo){const r=await(Fe==null?void 0:Fe.NetInfo.fetch());return r==null?void 0:r.isConnected}return!0}function U4(){return!0}function B4(r){switch(Va()){case Jr.browser:z4(r);break;case Jr.reactNative:H4(r);break}}function z4(r){!On()&&Wa()&&(window.addEventListener("online",()=>r(!0)),window.addEventListener("offline",()=>r(!1)))}function H4(r){var e;On()&&typeof Fe<"u"&&Fe!=null&&Fe.NetInfo&&((e=Fe)==null||e.NetInfo.addEventListener(t=>r(t==null?void 0:t.isConnected)))}const Sh={};class Ea{static get(e){return Sh[e]}static set(e,t){Sh[e]=t}static delete(e){delete Sh[e]}}class bs{}let j4=class extends bs{constructor(e){super()}};const A0=pe.FIVE_SECONDS,Qs={pulse:"heartbeat_pulse"};let K4=class F1 extends j4{constructor(e){super(e),this.events=new ui.EventEmitter,this.interval=A0,this.interval=(e==null?void 0:e.interval)||A0}static async init(e){const t=new F1(e);return await t.init(),t}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),pe.toMiliseconds(this.interval))}pulse(){this.events.emit(Qs.pulse)}};const k4=/"(?:_|\\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*:/,W4=/"(?: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*:/,V4=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function G4(r,e){if(r==="__proto__"||r==="constructor"&&e&&typeof e=="object"&&"prototype"in e){J4(r);return}return e}function J4(r){console.warn(`[destr] Dropping "${r}" key to prevent prototype pollution.`)}function nc(r,e={}){if(typeof r!="string")return r;const t=r.trim();if(r[0]==='"'&&r.endsWith('"')&&!r.includes("\\"))return t.slice(1,-1);if(t.length<=9){const n=t.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!V4.test(r)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return r}try{if(k4.test(r)||W4.test(r)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(r,G4)}return JSON.parse(r)}catch(n){if(e.strict)throw n;return r}}function Y4(r){return!r||typeof r.then!="function"?Promise.resolve(r):r}function ar(r,...e){try{return Y4(r(...e))}catch(t){return Promise.reject(t)}}function X4(r){const e=typeof r;return r===null||e!=="object"&&e!=="function"}function Z4(r){const e=Object.getPrototypeOf(r);return!e||e.isPrototypeOf(Object)}function pc(r){if(X4(r))return String(r);if(Z4(r)||Array.isArray(r))return JSON.stringify(r);if(typeof r.toJSON=="function")return pc(r.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const Jh="base64:";function Q4(r){return typeof r=="string"?r:Jh+r9(r)}function e9(r){return typeof r!="string"||!r.startsWith(Jh)?r:t9(r.slice(Jh.length))}function t9(r){return globalThis.Buffer?Ai.from(r,"base64"):Uint8Array.from(globalThis.atob(r),e=>e.codePointAt(0))}function r9(r){return globalThis.Buffer?Ai.from(r).toString("base64"):globalThis.btoa(String.fromCodePoint(...r))}function Lr(r){var e;return r&&((e=r.split("?")[0])==null?void 0:e.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function i9(...r){return Lr(r.join(":"))}function sc(r){return r=Lr(r),r?r+":":""}const n9="memory",s9=()=>{const r=new Map;return{name:n9,getInstance:()=>r,hasItem(e){return r.has(e)},getItem(e){return r.get(e)??null},getItemRaw(e){return r.get(e)??null},setItem(e,t){r.set(e,t)},setItemRaw(e,t){r.set(e,t)},removeItem(e){r.delete(e)},getKeys(){return[...r.keys()]},clear(){r.clear()},dispose(){r.clear()}}};function a9(r={}){const e={mounts:{"":r.driver||s9()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},t=l=>{for(const m of e.mountpoints)if(l.startsWith(m))return{base:m,relativeKey:l.slice(m.length),driver:e.mounts[m]};return{base:"",relativeKey:l,driver:e.mounts[""]}},n=(l,m)=>e.mountpoints.filter(_=>_.startsWith(l)||m&&l.startsWith(_)).map(_=>({relativeBase:l.length>_.length?l.slice(_.length):void 0,mountpoint:_,driver:e.mounts[_]})),s=(l,m)=>{if(e.watching){m=Lr(m);for(const _ of e.watchListeners)_(l,m)}},o=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await P0(e.mounts[l],s,l)}},f=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},h=(l,m,_)=>{const D=new Map,I=M=>{let H=D.get(M.base);return H||(H={driver:M.driver,base:M.base,items:[]},D.set(M.base,H)),H};for(const M of l){const H=typeof M=="string",k=Lr(H?M:M.key),X=H?void 0:M.value,F=H||!M.options?m:{...m,...M.options},V=t(k);I(V).items.push({key:k,value:X,relativeKey:V.relativeKey,options:F})}return Promise.all([...D.values()].map(M=>_(M))).then(M=>M.flat())},p={hasItem(l,m={}){l=Lr(l);const{relativeKey:_,driver:D}=t(l);return ar(D.hasItem,_,m)},getItem(l,m={}){l=Lr(l);const{relativeKey:_,driver:D}=t(l);return ar(D.getItem,_,m).then(I=>nc(I))},getItems(l,m={}){return h(l,m,_=>_.driver.getItems?ar(_.driver.getItems,_.items.map(D=>({key:D.relativeKey,options:D.options})),m).then(D=>D.map(I=>({key:i9(_.base,I.key),value:nc(I.value)}))):Promise.all(_.items.map(D=>ar(_.driver.getItem,D.relativeKey,D.options).then(I=>({key:D.key,value:nc(I)})))))},getItemRaw(l,m={}){l=Lr(l);const{relativeKey:_,driver:D}=t(l);return D.getItemRaw?ar(D.getItemRaw,_,m):ar(D.getItem,_,m).then(I=>e9(I))},async setItem(l,m,_={}){if(m===void 0)return p.removeItem(l);l=Lr(l);const{relativeKey:D,driver:I}=t(l);I.setItem&&(await ar(I.setItem,D,pc(m),_),I.watch||s("update",l))},async setItems(l,m){await h(l,m,async _=>{if(_.driver.setItems)return ar(_.driver.setItems,_.items.map(D=>({key:D.relativeKey,value:pc(D.value),options:D.options})),m);_.driver.setItem&&await Promise.all(_.items.map(D=>ar(_.driver.setItem,D.relativeKey,pc(D.value),D.options)))})},async setItemRaw(l,m,_={}){if(m===void 0)return p.removeItem(l,_);l=Lr(l);const{relativeKey:D,driver:I}=t(l);if(I.setItemRaw)await ar(I.setItemRaw,D,m,_);else if(I.setItem)await ar(I.setItem,D,Q4(m),_);else return;I.watch||s("update",l)},async removeItem(l,m={}){typeof m=="boolean"&&(m={removeMeta:m}),l=Lr(l);const{relativeKey:_,driver:D}=t(l);D.removeItem&&(await ar(D.removeItem,_,m),(m.removeMeta||m.removeMata)&&await ar(D.removeItem,_+"$",m),D.watch||s("remove",l))},async getMeta(l,m={}){typeof m=="boolean"&&(m={nativeOnly:m}),l=Lr(l);const{relativeKey:_,driver:D}=t(l),I=Object.create(null);if(D.getMeta&&Object.assign(I,await ar(D.getMeta,_,m)),!m.nativeOnly){const M=await ar(D.getItem,_+"$",m).then(H=>nc(H));M&&typeof M=="object"&&(typeof M.atime=="string"&&(M.atime=new Date(M.atime)),typeof M.mtime=="string"&&(M.mtime=new Date(M.mtime)),Object.assign(I,M))}return I},setMeta(l,m,_={}){return this.setItem(l+"$",m,_)},removeMeta(l,m={}){return this.removeItem(l+"$",m)},async getKeys(l,m={}){l=sc(l);const _=n(l,!0);let D=[];const I=[];for(const M of _){const H=await ar(M.driver.getKeys,M.relativeBase,m);for(const k of H){const X=M.mountpoint+Lr(k);D.some(F=>X.startsWith(F))||I.push(X)}D=[M.mountpoint,...D.filter(k=>!k.startsWith(M.mountpoint))]}return l?I.filter(M=>M.startsWith(l)&&M[M.length-1]!=="$"):I.filter(M=>M[M.length-1]!=="$")},async clear(l,m={}){l=sc(l),await Promise.all(n(l,!1).map(async _=>{if(_.driver.clear)return ar(_.driver.clear,_.relativeBase,m);if(_.driver.removeItem){const D=await _.driver.getKeys(_.relativeBase||"",m);return Promise.all(D.map(I=>_.driver.removeItem(I,m)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>M0(l)))},async watch(l){return await o(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(m=>m!==l),e.watchListeners.length===0&&await f()}},async unwatch(){e.watchListeners=[],await f()},mount(l,m){if(l=sc(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((_,D)=>D.length-_.length)),e.mounts[l]=m,e.watching&&Promise.resolve(P0(m,s,l)).then(_=>{e.unwatch[l]=_}).catch(console.error),p},async unmount(l,m=!0){var _,D;l=sc(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&((D=(_=e.unwatch)[l])==null||D.call(_),delete e.unwatch[l]),m&&await M0(e.mounts[l]),e.mountpoints=e.mountpoints.filter(I=>I!==l),delete e.mounts[l])},getMount(l=""){l=Lr(l)+":";const m=t(l);return{driver:m.driver,base:m.base}},getMounts(l="",m={}){return l=Lr(l),n(l,m.parents).map(D=>({driver:D.driver,base:D.mountpoint}))},keys:(l,m={})=>p.getKeys(l,m),get:(l,m={})=>p.getItem(l,m),set:(l,m,_={})=>p.setItem(l,m,_),has:(l,m={})=>p.hasItem(l,m),del:(l,m={})=>p.removeItem(l,m),remove:(l,m={})=>p.removeItem(l,m)};return p}function P0(r,e,t){return r.watch?r.watch((n,s)=>e(n,t+s)):()=>{}}async function M0(r){typeof r.dispose=="function"&&await ar(r.dispose)}function vs(r){return new Promise((e,t)=>{r.oncomplete=r.onsuccess=()=>e(r.result),r.onabort=r.onerror=()=>t(r.error)})}function q1(r,e){const t=indexedDB.open(r);t.onupgradeneeded=()=>t.result.createObjectStore(e);const n=vs(t);return(s,o)=>n.then(f=>o(f.transaction(e,s).objectStore(e)))}let xh;function Ya(){return xh||(xh=q1("keyval-store","keyval")),xh}function O0(r,e=Ya()){return e("readonly",t=>vs(t.get(r)))}function o9(r,e,t=Ya()){return t("readwrite",n=>(n.put(e,r),vs(n.transaction)))}function c9(r,e=Ya()){return e("readwrite",t=>(t.delete(r),vs(t.transaction)))}function f9(r=Ya()){return r("readwrite",e=>(e.clear(),vs(e.transaction)))}function h9(r,e){return r.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},vs(r.transaction)}function u9(r=Ya()){return r("readonly",e=>{if(e.getAllKeys)return vs(e.getAllKeys());const t=[];return h9(e,n=>t.push(n.key)).then(()=>t)})}const d9="idb-keyval";var l9=(r={})=>{const e=r.base&&r.base.length>0?`${r.base}:`:"",t=s=>e+s;let n;return r.dbName&&r.storeName&&(n=q1(r.dbName,r.storeName)),{name:d9,options:r,async hasItem(s){return!(typeof await O0(t(s),n)>"u")},async getItem(s){return await O0(t(s),n)??null},setItem(s,o){return o9(t(s),o,n)},removeItem(s){return c9(t(s),n)},getKeys(){return u9(n)},clear(){return f9(n)}}};const p9="WALLET_CONNECT_V2_INDEXED_DB",g9="keyvaluestorage";let b9=class{constructor(){this.indexedDb=a9({driver:l9({dbName:p9,storeName:g9})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const t=await this.indexedDb.getItem(e);if(t!==null)return t}async setItem(e,t){await this.indexedDb.setItem(e,cn(t))}async removeItem(e){await this.indexedDb.removeItem(e)}};var Ih=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Fe<"u"?Fe:typeof self<"u"?self:{},gc={exports:{}};(function(){let r;function e(){}r=e,r.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},r.prototype.setItem=function(t,n){this[t]=String(n)},r.prototype.removeItem=function(t){delete this[t]},r.prototype.clear=function(){const t=this;Object.keys(t).forEach(function(n){t[n]=void 0,delete t[n]})},r.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Ih<"u"&&Ih.localStorage?gc.exports=Ih.localStorage:typeof window<"u"&&window.localStorage?gc.exports=window.localStorage:gc.exports=new e})();function v9(r){var e;return[r[0],us((e=r[1])!=null?e:"")]}let m9=class{constructor(){this.localStorage=gc.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(v9)}async getItem(e){const t=this.localStorage.getItem(e);if(t!==null)return us(t)}async setItem(e,t){this.localStorage.setItem(e,cn(t))}async removeItem(e){this.localStorage.removeItem(e)}};const y9="wc_storage_version",C0=1,w9=async(r,e,t)=>{const n=y9,s=await e.getItem(n);if(s&&s>=C0){t(e);return}const o=await r.getKeys();if(!o.length){t(e);return}const f=[];for(;o.length;){const h=o.shift();if(!h)continue;const p=h.toLowerCase();if(p.includes("wc@")||p.includes("walletconnect")||p.includes("wc_")||p.includes("wallet_connect")){const l=await r.getItem(h);await e.setItem(h,l),f.push(h)}}await e.setItem(n,C0),t(e),_9(r,f)},_9=async(r,e)=>{e.length&&e.forEach(async t=>{await r.removeItem(t)})};let E9=class{constructor(){this.initialized=!1,this.setInitialized=t=>{this.storage=t,this.initialized=!0};const e=new m9;this.storage=e;try{const t=new b9;w9(e,t,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const t=setInterval(()=>{this.initialized&&(clearInterval(t),e())},20)})}};function S9(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}var x9=I9;function I9(r,e,t){var n=t&&t.stringify||S9,s=1;if(typeof r=="object"&&r!==null){var o=e.length+s;if(o===1)return r;var f=new Array(o);f[0]=n(r);for(var h=1;h<o;h++)f[h]=n(e[h]);return f.join(" ")}if(typeof r!="string")return r;var p=e.length;if(p===0)return r;for(var l="",m=1-s,_=-1,D=r&&r.length||0,I=0;I<D;){if(r.charCodeAt(I)===37&&I+1<D){switch(_=_>-1?_:0,r.charCodeAt(I+1)){case 100:case 102:if(m>=p||e[m]==null)break;_<I&&(l+=r.slice(_,I)),l+=Number(e[m]),_=I+2,I++;break;case 105:if(m>=p||e[m]==null)break;_<I&&(l+=r.slice(_,I)),l+=Math.floor(Number(e[m])),_=I+2,I++;break;case 79:case 111:case 106:if(m>=p||e[m]===void 0)break;_<I&&(l+=r.slice(_,I));var M=typeof e[m];if(M==="string"){l+="'"+e[m]+"'",_=I+2,I++;break}if(M==="function"){l+=e[m].name||"<anonymous>",_=I+2,I++;break}l+=n(e[m]),_=I+2,I++;break;case 115:if(m>=p)break;_<I&&(l+=r.slice(_,I)),l+=String(e[m]),_=I+2,I++;break;case 37:_<I&&(l+=r.slice(_,I)),l+="%",_=I+2,I++,m--;break}++m}++I}return _===-1?r:(_<D&&(l+=r.slice(_)),l)}const R0=x9;var Hs=zi;const Fa=$9().console||{},D9={mapHttpRequest:ac,mapHttpResponse:ac,wrapRequestSerializer:Dh,wrapResponseSerializer:Dh,wrapErrorSerializer:Dh,req:ac,res:ac,err:C9};function A9(r,e){return Array.isArray(r)?r.filter(function(n){return n!=="!stdSerializers.err"}):r===!0?Object.keys(e):!1}function zi(r){r=r||{},r.browser=r.browser||{};const e=r.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");const t=r.browser.write||Fa;r.browser.write&&(r.browser.asObject=!0);const n=r.serializers||{},s=A9(r.browser.serialize,n);let o=r.browser.serialize;Array.isArray(r.browser.serialize)&&r.browser.serialize.indexOf("!stdSerializers.err")>-1&&(o=!1);const f=["error","fatal","warn","info","debug","trace"];typeof t=="function"&&(t.error=t.fatal=t.warn=t.info=t.debug=t.trace=t),r.enabled===!1&&(r.level="silent");const h=r.level||"info",p=Object.create(t);p.log||(p.log=qa),Object.defineProperty(p,"levelVal",{get:m}),Object.defineProperty(p,"level",{get:_,set:D});const l={transmit:e,serialize:s,asObject:r.browser.asObject,levels:f,timestamp:R9(r)};p.levels=zi.levels,p.level=h,p.setMaxListeners=p.getMaxListeners=p.emit=p.addListener=p.on=p.prependListener=p.once=p.prependOnceListener=p.removeListener=p.removeAllListeners=p.listeners=p.listenerCount=p.eventNames=p.write=p.flush=qa,p.serializers=n,p._serialize=s,p._stdErrSerialize=o,p.child=I,e&&(p._logEvent=Yh());function m(){return this.level==="silent"?1/0:this.levels.values[this.level]}function _(){return this._level}function D(M){if(M!=="silent"&&!this.levels.values[M])throw Error("unknown level "+M);this._level=M,Us(l,p,"error","log"),Us(l,p,"fatal","error"),Us(l,p,"warn","error"),Us(l,p,"info","log"),Us(l,p,"debug","log"),Us(l,p,"trace","log")}function I(M,H){if(!M)throw new Error("missing bindings for child Pino");H=H||{},s&&M.serializers&&(H.serializers=M.serializers);const k=H.serializers;if(s&&k){var X=Object.assign({},n,k),F=r.browser.serialize===!0?Object.keys(X):s;delete M.serializers,Gc([M],F,X,this._stdErrSerialize)}function V($){this._childLevel=($._childLevel|0)+1,this.error=Bs($,M,"error"),this.fatal=Bs($,M,"fatal"),this.warn=Bs($,M,"warn"),this.info=Bs($,M,"info"),this.debug=Bs($,M,"debug"),this.trace=Bs($,M,"trace"),X&&(this.serializers=X,this._serialize=F),e&&(this._logEvent=Yh([].concat($._logEvent.bindings,M)))}return V.prototype=this,new V(this)}return p}zi.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"}};zi.stdSerializers=D9;zi.stdTimeFunctions=Object.assign({},{nullTime:U1,epochTime:B1,unixTime:T9,isoTime:N9});function Us(r,e,t,n){const s=Object.getPrototypeOf(e);e[t]=e.levelVal>e.levels.values[t]?qa:s[t]?s[t]:Fa[t]||Fa[n]||qa,P9(r,e,t)}function P9(r,e,t){!r.transmit&&e[t]===qa||(e[t]=function(n){return function(){const o=r.timestamp(),f=new Array(arguments.length),h=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Fa?Fa:this;for(var p=0;p<f.length;p++)f[p]=arguments[p];if(r.serialize&&!r.asObject&&Gc(f,this._serialize,this.serializers,this._stdErrSerialize),r.asObject?n.call(h,M9(this,t,f,o)):n.apply(h,f),r.transmit){const l=r.transmit.level||e.level,m=zi.levels.values[l],_=zi.levels.values[t];if(_<m)return;O9(this,{ts:o,methodLevel:t,methodValue:_,transmitLevel:l,transmitValue:zi.levels.values[r.transmit.level||e.level],send:r.transmit.send,val:e.levelVal},f)}}}(e[t]))}function M9(r,e,t,n){r._serialize&&Gc(t,r._serialize,r.serializers,r._stdErrSerialize);const s=t.slice();let o=s[0];const f={};n&&(f.time=n),f.level=zi.levels.values[e];let h=(r._childLevel|0)+1;if(h<1&&(h=1),o!==null&&typeof o=="object"){for(;h--&&typeof s[0]=="object";)Object.assign(f,s.shift());o=s.length?R0(s.shift(),s):void 0}else typeof o=="string"&&(o=R0(s.shift(),s));return o!==void 0&&(f.msg=o),f}function Gc(r,e,t,n){for(const s in r)if(n&&r[s]instanceof Error)r[s]=zi.stdSerializers.err(r[s]);else if(typeof r[s]=="object"&&!Array.isArray(r[s]))for(const o in r[s])e&&e.indexOf(o)>-1&&o in t&&(r[s][o]=t[o](r[s][o]))}function Bs(r,e,t){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var s=1;s<n.length;s++)n[s]=arguments[s-1];return r[t].apply(this,n)}}function O9(r,e,t){const n=e.send,s=e.ts,o=e.methodLevel,f=e.methodValue,h=e.val,p=r._logEvent.bindings;Gc(t,r._serialize||Object.keys(r.serializers),r.serializers,r._stdErrSerialize===void 0?!0:r._stdErrSerialize),r._logEvent.ts=s,r._logEvent.messages=t.filter(function(l){return p.indexOf(l)===-1}),r._logEvent.level.label=o,r._logEvent.level.value=f,n(o,r._logEvent,h),r._logEvent=Yh(p)}function Yh(r){return{ts:0,messages:[],bindings:r||[],level:{label:"",value:0}}}function C9(r){const e={type:r.constructor.name,msg:r.message,stack:r.stack};for(const t in r)e[t]===void 0&&(e[t]=r[t]);return e}function R9(r){return typeof r.timestamp=="function"?r.timestamp:r.timestamp===!1?U1:B1}function ac(){return{}}function Dh(r){return r}function qa(){}function U1(){return!1}function B1(){return Date.now()}function T9(){return Math.round(Date.now()/1e3)}function N9(){return new Date(Date.now()).toISOString()}function $9(){function r(e){return typeof e<"u"&&e}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return r(self)||r(window)||r(this)||{}}}const Xa=Bp(Hs),L9={level:"info"},Za="custom_context",wu=1e3*1024;let F9=class{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}},T0=class{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const t=new F9(e);if(t.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let t=this.head;for(;t!==null;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}},z1=class{constructor(e,t=wu){this.level=e??"error",this.levelValue=Hs.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new T0(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===Hs.levels.values.error?console.error(e):t===Hs.levels.values.warn?console.warn(e):t===Hs.levels.values.debug?console.debug(e):t===Hs.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(cn({timestamp:new Date().toISOString(),log:e}));const t=typeof e=="string"?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new T0(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const t=this.getLogArray();return t.push(cn({extraMetadata:e})),new Blob(t,{type:"application/json"})}},q9=class{constructor(e,t=wu){this.baseChunkLogger=new z1(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=t,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}};class U9{constructor(e,t=wu){this.baseChunkLogger=new z1(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var B9=Object.defineProperty,z9=Object.defineProperties,H9=Object.getOwnPropertyDescriptors,N0=Object.getOwnPropertySymbols,j9=Object.prototype.hasOwnProperty,K9=Object.prototype.propertyIsEnumerable,$0=(r,e,t)=>e in r?B9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Pc=(r,e)=>{for(var t in e||(e={}))j9.call(e,t)&&$0(r,t,e[t]);if(N0)for(var t of N0(e))K9.call(e,t)&&$0(r,t,e[t]);return r},Mc=(r,e)=>z9(r,H9(e));function Jc(r){return Mc(Pc({},r),{level:(r==null?void 0:r.level)||L9.level})}function k9(r,e=Za){return r[e]||""}function W9(r,e,t=Za){return r[t]=e,r}function Ur(r,e=Za){let t="";return typeof r.bindings>"u"?t=k9(r,e):t=r.bindings().context||"",t}function V9(r,e,t=Za){const n=Ur(r,t);return n.trim()?`${n}/${e}`:e}function Or(r,e,t=Za){const n=V9(r,e,t),s=r.child({context:n});return W9(s,n,t)}function G9(r){var e,t;const n=new q9((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:Xa(Mc(Pc({},r.opts),{level:"trace",browser:Mc(Pc({},(t=r.opts)==null?void 0:t.browser),{write:s=>n.write(s)})})),chunkLoggerController:n}}function J9(r){var e;const t=new U9((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:Xa(Mc(Pc({},r.opts),{level:"trace"}),t),chunkLoggerController:t}}function Y9(r){return typeof r.loggerOverride<"u"&&typeof r.loggerOverride!="string"?{logger:r.loggerOverride,chunkLoggerController:null}:typeof window<"u"?G9(r):J9(r)}let X9=class extends bs{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},Z9=class extends bs{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}};class Q9{constructor(e,t){this.logger=e,this.core=t}}let e7=class extends bs{constructor(e,t){super(),this.relayer=e,this.logger=t}},t7=class extends bs{constructor(e){super()}},r7=class{constructor(e,t,n,s){this.core=e,this.logger=t,this.name=n}},i7=class extends bs{constructor(e,t){super(),this.relayer=e,this.logger=t}},n7=class extends bs{constructor(e,t){super(),this.core=e,this.logger=t}},s7=class{constructor(e,t,n){this.core=e,this.logger=t,this.store=n}},a7=class{constructor(e,t){this.projectId=e,this.logger=t}},o7=class{constructor(e,t,n){this.core=e,this.logger=t,this.telemetryEnabled=n}},c7=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},f7=class{constructor(e){this.client=e}};const h7="PARSE_ERROR",u7="INVALID_REQUEST",d7="METHOD_NOT_FOUND",l7="INVALID_PARAMS",H1="INTERNAL_ERROR",_u="SERVER_ERROR",p7=[-32700,-32600,-32601,-32602,-32603],Oa={[h7]:{code:-32700,message:"Parse error"},[u7]:{code:-32600,message:"Invalid Request"},[d7]:{code:-32601,message:"Method not found"},[l7]:{code:-32602,message:"Invalid params"},[H1]:{code:-32603,message:"Internal error"},[_u]:{code:-32e3,message:"Server error"}},j1=_u;function g7(r){return p7.includes(r)}function L0(r){return Object.keys(Oa).includes(r)?Oa[r]:Oa[j1]}function b7(r){const e=Object.values(Oa).find(t=>t.code===r);return e||Oa[j1]}function K1(r,e,t){return r.message.includes("getaddrinfo ENOTFOUND")||r.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${t} RPC url at ${e}`):r}var k1={},en={},F0;function v7(){if(F0)return en;F0=1,Object.defineProperty(en,"__esModule",{value:!0}),en.isBrowserCryptoAvailable=en.getSubtleCrypto=en.getBrowerCrypto=void 0;function r(){return(_r===null||_r===void 0?void 0:_r.crypto)||(_r===null||_r===void 0?void 0:_r.msCrypto)||{}}en.getBrowerCrypto=r;function e(){const n=r();return n.subtle||n.webkitSubtle}en.getSubtleCrypto=e;function t(){return!!r()&&!!e()}return en.isBrowserCryptoAvailable=t,en}var tn={},q0;function m7(){if(q0)return tn;q0=1,Object.defineProperty(tn,"__esModule",{value:!0}),tn.isBrowser=tn.isNode=tn.isReactNative=void 0;function r(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}tn.isReactNative=r;function e(){return typeof Di<"u"&&typeof Di.versions<"u"&&typeof Di.versions.node<"u"}tn.isNode=e;function t(){return!r()&&!e()}return tn.isBrowser=t,tn}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Ua;e.__exportStar(v7(),r),e.__exportStar(m7(),r)})(k1);function nn(r=3){const e=Date.now()*Math.pow(10,r),t=Math.floor(Math.random()*Math.pow(10,r));return e+t}function hs(r=6){return BigInt(nn(r))}function Dn(r,e,t){return{id:t||nn(),jsonrpc:"2.0",method:r,params:e}}function Yc(r,e){return{id:r,jsonrpc:"2.0",result:e}}function Xc(r,e,t){return{id:r,jsonrpc:"2.0",error:y7(e,t)}}function y7(r,e){return typeof r>"u"?L0(H1):(typeof r=="string"&&(r=Object.assign(Object.assign({},L0(_u)),{message:r})),typeof e<"u"&&(r.data=e),g7(r.code)&&(r=b7(r.code)),r)}class w7{}class _7 extends w7{constructor(){super()}}class E7 extends _7{constructor(e){super()}}const S7="^https?:",x7="^wss?:";function I7(r){const e=r.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function W1(r,e){const t=I7(r);return typeof t>"u"?!1:new RegExp(e).test(t)}function U0(r){return W1(r,S7)}function B0(r){return W1(r,x7)}function D7(r){return new RegExp("wss?://localhost(:d{2,5})?").test(r)}function V1(r){return typeof r=="object"&&"id"in r&&"jsonrpc"in r&&r.jsonrpc==="2.0"}function Eu(r){return V1(r)&&"method"in r}function Zc(r){return V1(r)&&(Bi(r)||fi(r))}function Bi(r){return"result"in r}function fi(r){return"error"in r}let pi=class extends E7{constructor(e){super(e),this.events=new ui.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(Dn(e.method,e.params||[],e.id||hs().toString()),t)}async requestStrict(e,t){return new Promise(async(n,s)=>{if(!this.connection.connected)try{await this.open()}catch(o){s(o)}this.events.on(`${e.id}`,o=>{fi(o)?s(o.error):n(o.result)});try{await this.connection.send(e,t)}catch(o){s(o)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Zc(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 A7=()=>typeof WebSocket<"u"?WebSocket:typeof Fe<"u"&&typeof Fe.WebSocket<"u"?Fe.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),P7=()=>typeof WebSocket<"u"||typeof Fe<"u"&&typeof Fe.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",z0=r=>r.split("?")[0],H0=10,M7=A7();let O7=class{constructor(e){if(this.url=e,this.events=new ui.EventEmitter,this.registering=!1,!B0(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,t)=>{if(typeof this.socket>"u"){t(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(cn(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!B0(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((n,s)=>{this.events.once("register_error",o=>{this.resetMaxListeners(),s(o)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return s(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,n)=>{const s=k1.isReactNative()?void 0:{rejectUnauthorized:!D7(e)},o=new M7(e,[],s);P7()?o.onerror=f=>{const h=f;n(this.emitError(h.error))}:o.on("error",f=>{n(this.emitError(f))}),o.onopen=()=>{this.onOpen(o),t(o)}})}onOpen(e){e.onmessage=t=>this.onPayload(t),e.onclose=t=>this.onClose(t),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?us(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const n=this.parseError(t),s=n.message||n.toString(),o=Xc(e,s);this.events.emit("payload",o)}parseError(e,t=this.url){return K1(e,z0(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>H0&&this.events.setMaxListeners(H0)}emitError(e){const t=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${z0(this.url)}`));return this.events.emit("register_error",t),t}};var Oc={exports:{}};Oc.exports;(function(r,e){var t=200,n="__lodash_hash_undefined__",s=1,o=2,f=9007199254740991,h="[object Arguments]",p="[object Array]",l="[object AsyncFunction]",m="[object Boolean]",_="[object Date]",D="[object Error]",I="[object Function]",M="[object GeneratorFunction]",H="[object Map]",k="[object Number]",X="[object Null]",F="[object Object]",V="[object Promise]",$="[object Proxy]",U="[object RegExp]",z="[object Set]",b="[object String]",T="[object Symbol]",re="[object Undefined]",de="[object WeakMap]",L="[object ArrayBuffer]",u="[object DataView]",y="[object Float32Array]",w="[object Float64Array]",E="[object Int8Array]",O="[object Int16Array]",N="[object Int32Array]",R="[object Uint8Array]",x="[object Uint8ClampedArray]",d="[object Uint16Array]",A="[object Uint32Array]",fe=/[\\^$.*+?()[\]{}|]/g,ee=/^\[object .+?Constructor\]$/,he=/^(?:0|[1-9]\d*)$/,ne={};ne[y]=ne[w]=ne[E]=ne[O]=ne[N]=ne[R]=ne[x]=ne[d]=ne[A]=!0,ne[h]=ne[p]=ne[L]=ne[m]=ne[u]=ne[_]=ne[D]=ne[I]=ne[H]=ne[k]=ne[F]=ne[U]=ne[z]=ne[b]=ne[de]=!1;var be=typeof _r=="object"&&_r&&_r.Object===Object&&_r,G=typeof self=="object"&&self&&self.Object===Object&&self,Z=be||G||Function("return this")(),K=e&&!e.nodeType&&e,v=K&&!0&&r&&!r.nodeType&&r,j=v&&v.exports===K,oe=j&&be.process,le=function(){try{return oe&&oe.binding&&oe.binding("util")}catch{}}(),Te=le&&le.isTypedArray;function Ae(q,Y){for(var ce=-1,we=q==null?0:q.length,Ot=0,Xe=[];++ce<we;){var qt=q[ce];Y(qt,ce,q)&&(Xe[Ot++]=qt)}return Xe}function Me(q,Y){for(var ce=-1,we=Y.length,Ot=q.length;++ce<we;)q[Ot+ce]=Y[ce];return q}function je(q,Y){for(var ce=-1,we=q==null?0:q.length;++ce<we;)if(Y(q[ce],ce,q))return!0;return!1}function qe(q,Y){for(var ce=-1,we=Array(q);++ce<q;)we[ce]=Y(ce);return we}function Ue(q){return function(Y){return q(Y)}}function ke(q,Y){return q.has(Y)}function ye(q,Y){return q==null?void 0:q[Y]}function Ie(q){var Y=-1,ce=Array(q.size);return q.forEach(function(we,Ot){ce[++Y]=[Ot,we]}),ce}function Be(q,Y){return function(ce){return q(Y(ce))}}function De(q){var Y=-1,ce=Array(q.size);return q.forEach(function(we){ce[++Y]=we}),ce}var Se=Array.prototype,ze=Function.prototype,me=Object.prototype,xe=Z["__core-js_shared__"],Qe=ze.toString,_e=me.hasOwnProperty,Oe=function(){var q=/[^.]+$/.exec(xe&&xe.keys&&xe.keys.IE_PROTO||"");return q?"Symbol(src)_1."+q:""}(),ct=me.toString,Ce=RegExp("^"+Qe.call(_e).replace(fe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Re=j?Z.Buffer:void 0,ht=Z.Symbol,lt=Z.Uint8Array,bt=me.propertyIsEnumerable,Br=Se.splice,pt=ht?ht.toStringTag:void 0,_t=Object.getOwnPropertySymbols,bi=Re?Re.isBuffer:void 0,Dt=Be(Object.keys,Object),We=Hr(Z,"DataView"),Pt=Hr(Z,"Map"),Ve=Hr(Z,"Promise"),Ge=Hr(Z,"Set"),Tt=Hr(Z,"WeakMap"),He=Hr(Object,"create"),rt=Ki(We),jt=Ki(Pt),Je=Ki(Ve),it=Ki(Ge),Ft=Ki(Tt),et=ht?ht.prototype:void 0,Ye=et?et.valueOf:void 0;function St(q){var Y=-1,ce=q==null?0:q.length;for(this.clear();++Y<ce;){var we=q[Y];this.set(we[0],we[1])}}function nt(){this.__data__=He?He(null):{},this.size=0}function st(q){var Y=this.has(q)&&delete this.__data__[q];return this.size-=Y?1:0,Y}function ws(q){var Y=this.__data__;if(He){var ce=Y[q];return ce===n?void 0:ce}return _e.call(Y,q)?Y[q]:void 0}function Bt(q){var Y=this.__data__;return He?Y[q]!==void 0:_e.call(Y,q)}function zt(q,Y){var ce=this.__data__;return this.size+=this.has(q)?0:1,ce[q]=He&&Y===void 0?n:Y,this}St.prototype.clear=nt,St.prototype.delete=st,St.prototype.get=ws,St.prototype.has=Bt,St.prototype.set=zt;function vr(q){var Y=-1,ce=q==null?0:q.length;for(this.clear();++Y<ce;){var we=q[Y];this.set(we[0],we[1])}}function Cn(){this.__data__=[],this.size=0}function Rn(q){var Y=this.__data__,ce=Hn(Y,q);if(ce<0)return!1;var we=Y.length-1;return ce==we?Y.pop():Br.call(Y,ce,1),--this.size,!0}function Tn(q){var Y=this.__data__,ce=Hn(Y,q);return ce<0?void 0:Y[ce][1]}function Nn(q){return Hn(this.__data__,q)>-1}function $n(q,Y){var ce=this.__data__,we=Hn(ce,q);return we<0?(++this.size,ce.push([q,Y])):ce[we][1]=Y,this}vr.prototype.clear=Cn,vr.prototype.delete=Rn,vr.prototype.get=Tn,vr.prototype.has=Nn,vr.prototype.set=$n;function zr(q){var Y=-1,ce=q==null?0:q.length;for(this.clear();++Y<ce;){var we=q[Y];this.set(we[0],we[1])}}function Mi(){this.size=0,this.__data__={hash:new St,map:new(Pt||vr),string:new St}}function Ln(q){var Y=ln(this,q).delete(q);return this.size-=Y?1:0,Y}function Oi(q){return ln(this,q).get(q)}function Fn(q){return ln(this,q).has(q)}function qn(q,Y){var ce=ln(this,q),we=ce.size;return ce.set(q,Y),this.size+=ce.size==we?0:1,this}zr.prototype.clear=Mi,zr.prototype.delete=Ln,zr.prototype.get=Oi,zr.prototype.has=Fn,zr.prototype.set=qn;function Ci(q){var Y=-1,ce=q==null?0:q.length;for(this.__data__=new zr;++Y<ce;)this.add(q[Y])}function un(q){return this.__data__.set(q,n),this}function dn(q){return this.__data__.has(q)}Ci.prototype.add=Ci.prototype.push=un,Ci.prototype.has=dn;function Sr(q){var Y=this.__data__=new vr(q);this.size=Y.size}function Un(){this.__data__=new vr,this.size=0}function Bn(q){var Y=this.__data__,ce=Y.delete(q);return this.size=Y.size,ce}function zn(q){return this.__data__.get(q)}function tf(q){return this.__data__.has(q)}function eo(q,Y){var ce=this.__data__;if(ce instanceof vr){var we=ce.__data__;if(!Pt||we.length<t-1)return we.push([q,Y]),this.size=++ce.size,this;ce=this.__data__=new zr(we)}return ce.set(q,Y),this.size=ce.size,this}Sr.prototype.clear=Un,Sr.prototype.delete=Bn,Sr.prototype.get=zn,Sr.prototype.has=tf,Sr.prototype.set=eo;function to(q,Y){var ce=Ss(q),we=!ce&&po(q),Ot=!ce&&!we&&ra(q),Xe=!ce&&!we&&!Ot&&vo(q),qt=ce||we||Ot||Xe,Zt=qt?qe(q.length,String):[],vt=Zt.length;for(var Ct in q)(Y||_e.call(q,Ct))&&!(qt&&(Ct=="length"||Ot&&(Ct=="offset"||Ct=="parent")||Xe&&(Ct=="buffer"||Ct=="byteLength"||Ct=="byteOffset")||co(Ct,vt)))&&Zt.push(Ct);return Zt}function Hn(q,Y){for(var ce=q.length;ce--;)if(lo(q[ce][0],Y))return ce;return-1}function ea(q,Y,ce){var we=Y(q);return Ss(q)?we:Me(we,ce(q))}function jn(q){return q==null?q===void 0?re:X:pt&&pt in Object(q)?ao(q):sf(q)}function ta(q){return kn(q)&&jn(q)==h}function Kn(q,Y,ce,we,Ot){return q===Y?!0:q==null||Y==null||!kn(q)&&!kn(Y)?q!==q&&Y!==Y:ro(q,Y,ce,we,Kn,Ot)}function ro(q,Y,ce,we,Ot,Xe){var qt=Ss(q),Zt=Ss(Y),vt=qt?p:Ri(q),Ct=Zt?p:Ri(Y);vt=vt==h?F:vt,Ct=Ct==h?F:Ct;var Gt=vt==F,Cr=Ct==F,Qt=vt==Ct;if(Qt&&ra(q)){if(!ra(Y))return!1;qt=!0,Gt=!1}if(Qt&&!Gt)return Xe||(Xe=new Sr),qt||vo(q)?_s(q,Y,ce,we,Ot,Xe):nf(q,Y,vt,ce,we,Ot,Xe);if(!(ce&s)){var Ut=Gt&&_e.call(q,"__wrapped__"),xr=Cr&&_e.call(Y,"__wrapped__");if(Ut||xr){var vi=Ut?q.value():q,Qr=xr?Y.value():Y;return Xe||(Xe=new Sr),Ot(vi,Qr,ce,we,Xe)}}return Qt?(Xe||(Xe=new Sr),so(q,Y,ce,we,Ot,Xe)):!1}function rf(q){if(!bo(q)||ho(q))return!1;var Y=xs(q)?Ce:ee;return Y.test(Ki(q))}function io(q){return kn(q)&&go(q.length)&&!!ne[jn(q)]}function no(q){if(!uo(q))return Dt(q);var Y=[];for(var ce in Object(q))_e.call(q,ce)&&ce!="constructor"&&Y.push(ce);return Y}function _s(q,Y,ce,we,Ot,Xe){var qt=ce&s,Zt=q.length,vt=Y.length;if(Zt!=vt&&!(qt&&vt>Zt))return!1;var Ct=Xe.get(q);if(Ct&&Xe.get(Y))return Ct==Y;var Gt=-1,Cr=!0,Qt=ce&o?new Ci:void 0;for(Xe.set(q,Y),Xe.set(Y,q);++Gt<Zt;){var Ut=q[Gt],xr=Y[Gt];if(we)var vi=qt?we(xr,Ut,Gt,Y,q,Xe):we(Ut,xr,Gt,q,Y,Xe);if(vi!==void 0){if(vi)continue;Cr=!1;break}if(Qt){if(!je(Y,function(Qr,Ti){if(!ke(Qt,Ti)&&(Ut===Qr||Ot(Ut,Qr,ce,we,Xe)))return Qt.push(Ti)})){Cr=!1;break}}else if(!(Ut===xr||Ot(Ut,xr,ce,we,Xe))){Cr=!1;break}}return Xe.delete(q),Xe.delete(Y),Cr}function nf(q,Y,ce,we,Ot,Xe,qt){switch(ce){case u:if(q.byteLength!=Y.byteLength||q.byteOffset!=Y.byteOffset)return!1;q=q.buffer,Y=Y.buffer;case L:return!(q.byteLength!=Y.byteLength||!Xe(new lt(q),new lt(Y)));case m:case _:case k:return lo(+q,+Y);case D:return q.name==Y.name&&q.message==Y.message;case U:case b:return q==Y+"";case H:var Zt=Ie;case z:var vt=we&s;if(Zt||(Zt=De),q.size!=Y.size&&!vt)return!1;var Ct=qt.get(q);if(Ct)return Ct==Y;we|=o,qt.set(q,Y);var Gt=_s(Zt(q),Zt(Y),we,Ot,Xe,qt);return qt.delete(q),Gt;case T:if(Ye)return Ye.call(q)==Ye.call(Y)}return!1}function so(q,Y,ce,we,Ot,Xe){var qt=ce&s,Zt=Es(q),vt=Zt.length,Ct=Es(Y),Gt=Ct.length;if(vt!=Gt&&!qt)return!1;for(var Cr=vt;Cr--;){var Qt=Zt[Cr];if(!(qt?Qt in Y:_e.call(Y,Qt)))return!1}var Ut=Xe.get(q);if(Ut&&Xe.get(Y))return Ut==Y;var xr=!0;Xe.set(q,Y),Xe.set(Y,q);for(var vi=qt;++Cr<vt;){Qt=Zt[Cr];var Qr=q[Qt],Ti=Y[Qt];if(we)var ia=qt?we(Ti,Qr,Qt,Y,q,Xe):we(Qr,Ti,Qt,q,Y,Xe);if(!(ia===void 0?Qr===Ti||Ot(Qr,Ti,ce,we,Xe):ia)){xr=!1;break}vi||(vi=Qt=="constructor")}if(xr&&!vi){var Wn=q.constructor,ir=Y.constructor;Wn!=ir&&"constructor"in q&&"constructor"in Y&&!(typeof Wn=="function"&&Wn instanceof Wn&&typeof ir=="function"&&ir instanceof ir)&&(xr=!1)}return Xe.delete(q),Xe.delete(Y),xr}function Es(q){return ea(q,cf,oo)}function ln(q,Y){var ce=q.__data__;return fo(Y)?ce[typeof Y=="string"?"string":"hash"]:ce.map}function Hr(q,Y){var ce=ye(q,Y);return rf(ce)?ce:void 0}function ao(q){var Y=_e.call(q,pt),ce=q[pt];try{q[pt]=void 0;var we=!0}catch{}var Ot=ct.call(q);return we&&(Y?q[pt]=ce:delete q[pt]),Ot}var oo=_t?function(q){return q==null?[]:(q=Object(q),Ae(_t(q),function(Y){return bt.call(q,Y)}))}:Mt,Ri=jn;(We&&Ri(new We(new ArrayBuffer(1)))!=u||Pt&&Ri(new Pt)!=H||Ve&&Ri(Ve.resolve())!=V||Ge&&Ri(new Ge)!=z||Tt&&Ri(new Tt)!=de)&&(Ri=function(q){var Y=jn(q),ce=Y==F?q.constructor:void 0,we=ce?Ki(ce):"";if(we)switch(we){case rt:return u;case jt:return H;case Je:return V;case it:return z;case Ft:return de}return Y});function co(q,Y){return Y=Y??f,!!Y&&(typeof q=="number"||he.test(q))&&q>-1&&q%1==0&&q<Y}function fo(q){var Y=typeof q;return Y=="string"||Y=="number"||Y=="symbol"||Y=="boolean"?q!=="__proto__":q===null}function ho(q){return!!Oe&&Oe in q}function uo(q){var Y=q&&q.constructor,ce=typeof Y=="function"&&Y.prototype||me;return q===ce}function sf(q){return ct.call(q)}function Ki(q){if(q!=null){try{return Qe.call(q)}catch{}try{return q+""}catch{}}return""}function lo(q,Y){return q===Y||q!==q&&Y!==Y}var po=ta(function(){return arguments}())?ta:function(q){return kn(q)&&_e.call(q,"callee")&&!bt.call(q,"callee")},Ss=Array.isArray;function af(q){return q!=null&&go(q.length)&&!xs(q)}var ra=bi||At;function of(q,Y){return Kn(q,Y)}function xs(q){if(!bo(q))return!1;var Y=jn(q);return Y==I||Y==M||Y==l||Y==$}function go(q){return typeof q=="number"&&q>-1&&q%1==0&&q<=f}function bo(q){var Y=typeof q;return q!=null&&(Y=="object"||Y=="function")}function kn(q){return q!=null&&typeof q=="object"}var vo=Te?Ue(Te):io;function cf(q){return af(q)?to(q):no(q)}function Mt(){return[]}function At(){return!1}r.exports=of})(Oc,Oc.exports);var C7=Oc.exports;const R7=Bp(C7),G1="wc",J1=2,Cc="core",Hi=`${G1}@2:${Cc}:`,T7={name:Cc,logger:"error"},N7={database:":memory:"},$7="crypto",j0="client_ed25519_seed",L7=pe.ONE_DAY,F7="keychain",q7="0.3",U7="messages",B7="0.3",K0=pe.SIX_HOURS,z7="publisher",Y1="irn",H7="error",X1="wss://relay.walletconnect.org",j7="relayer",or={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"},K7="_subscription",oi={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},k7=.1,Xh="2.17.3",Nt={link_mode:"link_mode",relay:"relay"},W7="0.3",V7="WALLETCONNECT_CLIENT_ID",k0="WALLETCONNECT_LINK_MODE_APPS",Gr={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},G7="subscription",J7="0.3",Y7=pe.FIVE_SECONDS*1e3,X7="pairing",Z7="0.3",Sa={wc_pairingDelete:{req:{ttl:pe.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:pe.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:pe.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:pe.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:pe.ONE_DAY,prompt:!1,tag:0},res:{ttl:pe.ONE_DAY,prompt:!1,tag:0}}},cs={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},Ei={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},Q7="history",eE="0.3",tE="expirer",ci={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},rE="0.3",iE="verify-api",nE="https://verify.walletconnect.com",Z1="https://verify.walletconnect.org",Ca=Z1,sE=`${Ca}/v3`,aE=[nE,Z1],oE="echo",cE="https://echo.walletconnect.com",Ui={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"},rn={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"},Si={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"},ns={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"},ss={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"},xa={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"},fE=.1,hE="event-client",uE=86400,dE="https://pulse.walletconnect.org/batch";function lE(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var s=0;s<r.length;s++){var o=r.charAt(s),f=o.charCodeAt(0);if(t[f]!==255)throw new TypeError(o+" is ambiguous");t[f]=s}var h=r.length,p=r.charAt(0),l=Math.log(h)/Math.log(256),m=Math.log(256)/Math.log(h);function _(M){if(M instanceof Uint8Array||(ArrayBuffer.isView(M)?M=new Uint8Array(M.buffer,M.byteOffset,M.byteLength):Array.isArray(M)&&(M=Uint8Array.from(M))),!(M instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(M.length===0)return"";for(var H=0,k=0,X=0,F=M.length;X!==F&&M[X]===0;)X++,H++;for(var V=(F-X)*m+1>>>0,$=new Uint8Array(V);X!==F;){for(var U=M[X],z=0,b=V-1;(U!==0||z<k)&&b!==-1;b--,z++)U+=256*$[b]>>>0,$[b]=U%h>>>0,U=U/h>>>0;if(U!==0)throw new Error("Non-zero carry");k=z,X++}for(var T=V-k;T!==V&&$[T]===0;)T++;for(var re=p.repeat(H);T<V;++T)re+=r.charAt($[T]);return re}function D(M){if(typeof M!="string")throw new TypeError("Expected String");if(M.length===0)return new Uint8Array;var H=0;if(M[H]!==" "){for(var k=0,X=0;M[H]===p;)k++,H++;for(var F=(M.length-H)*l+1>>>0,V=new Uint8Array(F);M[H];){var $=t[M.charCodeAt(H)];if($===255)return;for(var U=0,z=F-1;($!==0||U<X)&&z!==-1;z--,U++)$+=h*V[z]>>>0,V[z]=$%256>>>0,$=$/256>>>0;if($!==0)throw new Error("Non-zero carry");X=U,H++}if(M[H]!==" "){for(var b=F-X;b!==F&&V[b]===0;)b++;for(var T=new Uint8Array(k+(F-b)),re=k;b!==F;)T[re++]=V[b++];return T}}}function I(M){var H=D(M);if(H)return H;throw new Error(`Non-${e} character`)}return{encode:_,decodeUnsafe:D,decode:I}}var pE=lE,gE=pE;const Q1=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},bE=r=>new TextEncoder().encode(r),vE=r=>new TextDecoder().decode(r);class mE{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class yE{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return eg(this,e)}}class wE{constructor(e){this.decoders=e}or(e){return eg(this,e)}decode(e){const t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const eg=(r,e)=>new wE({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});class _E{constructor(e,t,n,s){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=s,this.encoder=new mE(e,t,n),this.decoder=new yE(e,t,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Qc=({name:r,prefix:e,encode:t,decode:n})=>new _E(r,e,t,n),Qa=({prefix:r,name:e,alphabet:t})=>{const{encode:n,decode:s}=gE(t,e);return Qc({prefix:r,name:e,encode:n,decode:o=>Q1(s(o))})},EE=(r,e,t,n)=>{const s={};for(let m=0;m<e.length;++m)s[e[m]]=m;let o=r.length;for(;r[o-1]==="=";)--o;const f=new Uint8Array(o*t/8|0);let h=0,p=0,l=0;for(let m=0;m<o;++m){const _=s[r[m]];if(_===void 0)throw new SyntaxError(`Non-${n} character`);p=p<<t|_,h+=t,h>=8&&(h-=8,f[l++]=255&p>>h)}if(h>=t||255&p<<8-h)throw new SyntaxError("Unexpected end of data");return f},SE=(r,e,t)=>{const n=e[e.length-1]==="=",s=(1<<t)-1;let o="",f=0,h=0;for(let p=0;p<r.length;++p)for(h=h<<8|r[p],f+=8;f>t;)f-=t,o+=e[s&h>>f];if(f&&(o+=e[s&h<<t-f]),n)for(;o.length*t&7;)o+="=";return o},br=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>Qc({prefix:e,name:r,encode(s){return SE(s,n,t)},decode(s){return EE(s,n,t,r)}}),xE=Qc({prefix:"\0",name:"identity",encode:r=>vE(r),decode:r=>bE(r)});var IE=Object.freeze({__proto__:null,identity:xE});const DE=br({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var AE=Object.freeze({__proto__:null,base2:DE});const PE=br({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var ME=Object.freeze({__proto__:null,base8:PE});const OE=Qa({prefix:"9",name:"base10",alphabet:"0123456789"});var CE=Object.freeze({__proto__:null,base10:OE});const RE=br({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),TE=br({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var NE=Object.freeze({__proto__:null,base16:RE,base16upper:TE});const $E=br({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),LE=br({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),FE=br({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),qE=br({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),UE=br({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),BE=br({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),zE=br({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),HE=br({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),jE=br({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var KE=Object.freeze({__proto__:null,base32:$E,base32upper:LE,base32pad:FE,base32padupper:qE,base32hex:UE,base32hexupper:BE,base32hexpad:zE,base32hexpadupper:HE,base32z:jE});const kE=Qa({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),WE=Qa({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var VE=Object.freeze({__proto__:null,base36:kE,base36upper:WE});const GE=Qa({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),JE=Qa({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var YE=Object.freeze({__proto__:null,base58btc:GE,base58flickr:JE});const XE=br({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),ZE=br({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),QE=br({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),eS=br({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var tS=Object.freeze({__proto__:null,base64:XE,base64pad:ZE,base64url:QE,base64urlpad:eS});const tg=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),rS=tg.reduce((r,e,t)=>(r[t]=e,r),[]),iS=tg.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function nS(r){return r.reduce((e,t)=>(e+=rS[t],e),"")}function sS(r){const e=[];for(const t of r){const n=iS[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}const aS=Qc({prefix:"🚀",name:"base256emoji",encode:nS,decode:sS});var oS=Object.freeze({__proto__:null,base256emoji:aS}),cS=rg,W0=128,fS=127,hS=~fS,uS=Math.pow(2,31);function rg(r,e,t){e=e||[],t=t||0;for(var n=t;r>=uS;)e[t++]=r&255|W0,r/=128;for(;r&hS;)e[t++]=r&255|W0,r>>>=7;return e[t]=r|0,rg.bytes=t-n+1,e}var dS=Zh,lS=128,V0=127;function Zh(r,n){var t=0,n=n||0,s=0,o=n,f,h=r.length;do{if(o>=h)throw Zh.bytes=0,new RangeError("Could not decode varint");f=r[o++],t+=s<28?(f&V0)<<s:(f&V0)*Math.pow(2,s),s+=7}while(f>=lS);return Zh.bytes=o-n,t}var pS=Math.pow(2,7),gS=Math.pow(2,14),bS=Math.pow(2,21),vS=Math.pow(2,28),mS=Math.pow(2,35),yS=Math.pow(2,42),wS=Math.pow(2,49),_S=Math.pow(2,56),ES=Math.pow(2,63),SS=function(r){return r<pS?1:r<gS?2:r<bS?3:r<vS?4:r<mS?5:r<yS?6:r<wS?7:r<_S?8:r<ES?9:10},xS={encode:cS,decode:dS,encodingLength:SS},ig=xS;const G0=(r,e,t=0)=>(ig.encode(r,e,t),e),J0=r=>ig.encodingLength(r),Qh=(r,e)=>{const t=e.byteLength,n=J0(r),s=n+J0(t),o=new Uint8Array(s+t);return G0(r,o,0),G0(t,o,n),o.set(e,s),new IS(r,t,e,o)};class IS{constructor(e,t,n,s){this.code=e,this.size=t,this.digest=n,this.bytes=s}}const ng=({name:r,code:e,encode:t})=>new DS(r,e,t);class DS{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Qh(this.code,t):t.then(n=>Qh(this.code,n))}else throw Error("Unknown type, must be binary type")}}const sg=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),AS=ng({name:"sha2-256",code:18,encode:sg("SHA-256")}),PS=ng({name:"sha2-512",code:19,encode:sg("SHA-512")});var MS=Object.freeze({__proto__:null,sha256:AS,sha512:PS});const ag=0,OS="identity",og=Q1,CS=r=>Qh(ag,og(r)),RS={code:ag,name:OS,encode:og,digest:CS};var TS=Object.freeze({__proto__:null,identity:RS});new TextEncoder,new TextDecoder;const Y0={...IE,...AE,...ME,...CE,...NE,...KE,...VE,...YE,...tS,...oS};({...MS,...TS});function NS(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function cg(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}const X0=cg("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Ah=cg("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=NS(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),$S={utf8:X0,"utf-8":X0,hex:Y0.base16,latin1:Ah,ascii:Ah,binary:Ah,...Y0};function LS(r,e="utf8"){const t=$S[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):t.decoder.decode(`${t.prefix}${r}`)}let FS=class{constructor(e,t){this.core=e,this.logger=t,this.keychain=new Map,this.name=F7,this.version=q7,this.initialized=!1,this.storagePrefix=Hi,this.init=async()=>{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,s)=>{this.isInitialized(),this.keychain.set(n,s),await this.persist()},this.get=n=>{this.isInitialized();const s=this.keychain.get(n);if(typeof s>"u"){const{message:o}=ge("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(o)}return s},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=Or(t,this.name)}get context(){return Ur(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,S1(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?x1(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=ge("NOT_INITIALIZED",this.name);throw new Error(e)}}};class qS{constructor(e,t,n){this.core=e,this.logger=t,this.name=$7,this.randomSessionIdentifier=Gh(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=s=>(this.isInitialized(),this.keychain.has(s)),this.getClientId=async()=>{this.isInitialized();const s=await this.getClientSeed(),o=e0(s);return y1(o.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const s=z8();return this.setPrivateKey(s.publicKey,s.privateKey)},this.signJWT=async s=>{this.isInitialized();const o=await this.getClientSeed(),f=e0(o),h=this.randomSessionIdentifier;return await J5(h,s,L7,f)},this.generateSharedKey=(s,o,f)=>{this.isInitialized();const h=this.getPrivateKey(s),p=H8(h,o);return this.setSymKey(p,f)},this.setSymKey=async(s,o)=>{this.isInitialized();const f=o||lc(s);return await this.keychain.set(f,s),f},this.deleteKeyPair=async s=>{this.isInitialized(),await this.keychain.del(s)},this.deleteSymKey=async s=>{this.isInitialized(),await this.keychain.del(s)},this.encode=async(s,o,f)=>{this.isInitialized();const h=N1(f),p=cn(o);if(g0(h))return K8(p,f==null?void 0:f.encoding);if(p0(h)){const D=h.senderPublicKey,I=h.receiverPublicKey;s=await this.generateSharedKey(D,I)}const l=this.getSymKey(s),{type:m,senderPublicKey:_}=h;return j8({type:m,symKey:l,message:p,senderPublicKey:_,encoding:f==null?void 0:f.encoding})},this.decode=async(s,o,f)=>{this.isInitialized();const h=V8(o,f);if(g0(h)){const p=W8(o,f==null?void 0:f.encoding);return us(p)}if(p0(h)){const p=h.receiverPublicKey,l=h.senderPublicKey;s=await this.generateSharedKey(p,l)}try{const p=this.getSymKey(s),l=k8({symKey:p,encoded:o,encoding:f==null?void 0:f.encoding});return us(l)}catch(p){this.logger.error(`Failed to decode message from topic: '${s}', clientId: '${await this.getClientId()}'`),this.logger.error(p)}},this.getPayloadType=(s,o=In)=>{const f=$a({encoded:s,encoding:o});return ls(f.type)},this.getPayloadSenderPublicKey=(s,o=In)=>{const f=$a({encoded:s,encoding:o});return f.senderPublicKey?fr(f.senderPublicKey,Mr):void 0},this.core=e,this.logger=Or(t,this.name),this.keychain=n||new FS(this.core,this.logger)}get context(){return Ur(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(j0)}catch{e=Gh(),await this.keychain.set(j0,e)}return LS(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=ge("NOT_INITIALIZED",this.name);throw new Error(e)}}}class US extends Q9{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=U7,this.version=B7,this.initialized=!1,this.storagePrefix=Hi,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,s)=>{this.isInitialized();const o=sn(s);let f=this.messages.get(n);return typeof f>"u"&&(f={}),typeof f[o]<"u"||(f[o]=s,this.messages.set(n,f),await this.persist()),o},this.get=n=>{this.isInitialized();let s=this.messages.get(n);return typeof s>"u"&&(s={}),s},this.has=(n,s)=>{this.isInitialized();const o=this.get(n),f=sn(s);return typeof o[f]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=Or(e,this.name),this.core=t}get context(){return Ur(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,S1(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?x1(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=ge("NOT_INITIALIZED",this.name);throw new Error(e)}}}var BS=Object.defineProperty,zS=Object.defineProperties,HS=Object.getOwnPropertyDescriptors,Z0=Object.getOwnPropertySymbols,jS=Object.prototype.hasOwnProperty,KS=Object.prototype.propertyIsEnumerable,Q0=(r,e,t)=>e in r?BS(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ep=(r,e)=>{for(var t in e||(e={}))jS.call(e,t)&&Q0(r,t,e[t]);if(Z0)for(var t of Z0(e))KS.call(e,t)&&Q0(r,t,e[t]);return r},tp=(r,e)=>zS(r,HS(e));class kS extends e7{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new ui.EventEmitter,this.name=z7,this.queue=new Map,this.publishTimeout=pe.toMiliseconds(pe.ONE_MINUTE),this.initialPublishTimeout=pe.toMiliseconds(pe.ONE_SECOND*15),this.needsTransportRestart=!1,this.publish=async(n,s,o)=>{var f;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:s,opts:o}});const h=(o==null?void 0:o.ttl)||K0,p=Dc(o),l=(o==null?void 0:o.prompt)||!1,m=(o==null?void 0:o.tag)||0,_=(o==null?void 0:o.id)||hs().toString(),D={topic:n,message:s,opts:{ttl:h,relay:p,prompt:l,tag:m,id:_,attestation:o==null?void 0:o.attestation}},I=`Failed to publish payload, please try again. id:${_} tag:${m}`;try{const M=new Promise(async H=>{const k=({id:F})=>{D.opts.id===F&&(this.removeRequestFromQueue(F),this.relayer.events.removeListener(or.publish,k),H(D))};this.relayer.events.on(or.publish,k);const X=xn(new Promise((F,V)=>{this.rpcPublish({topic:n,message:s,ttl:h,prompt:l,tag:m,id:_,attestation:o==null?void 0:o.attestation}).then(F).catch($=>{this.logger.warn($,$==null?void 0:$.message),V($)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${_} tag:${m}`);try{await X,this.events.removeListener(or.publish,k)}catch(F){this.queue.set(_,tp(ep({},D),{attempt:1})),this.logger.warn(F,F==null?void 0:F.message)}});this.logger.trace({type:"method",method:"publish",params:{id:_,topic:n,message:s,opts:o}}),await xn(M,this.publishTimeout,I)}catch(M){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(M),(f=o==null?void 0:o.internal)!=null&&f.throwOnFailedPublish)throw M}finally{this.queue.delete(_)}},this.on=(n,s)=>{this.events.on(n,s)},this.once=(n,s)=>{this.events.once(n,s)},this.off=(n,s)=>{this.events.off(n,s)},this.removeListener=(n,s)=>{this.events.removeListener(n,s)},this.relayer=e,this.logger=Or(t,this.name),this.registerEventListeners()}get context(){return Ur(this.logger)}async rpcPublish(e){var t,n,s,o;const{topic:f,message:h,ttl:p=K0,prompt:l,tag:m,id:_,attestation:D}=e,I={method:Aa(Dc().protocol).publish,params:{topic:f,message:h,ttl:p,prompt:l,tag:m,attestation:D},id:_};Pr((t=I.params)==null?void 0:t.prompt)&&((n=I.params)==null||delete n.prompt),Pr((s=I.params)==null?void 0:s.tag)&&((o=I.params)==null||delete o.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:I});const M=await this.relayer.request(I);return this.relayer.events.emit(or.publish,e),this.logger.debug("Successfully Published Payload"),M}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async(e,t)=>{const n=e.attempt+1;this.queue.set(t,tp(ep({},e),{attempt:n}));const{topic:s,message:o,opts:f,attestation:h}=e;this.logger.warn({},`Publisher: queue->publishing: ${e.opts.id}, tag: ${e.opts.tag}, attempt: ${n}`),await this.rpcPublish({topic:s,message:o,ttl:f.ttl,prompt:f.prompt,tag:f.tag,id:f.id,attestation:h}),this.logger.warn({},`Publisher: queue->published: ${e.opts.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(Qs.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(or.connection_stalled);return}this.checkQueue()}),this.relayer.on(or.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class WS{constructor(){this.map=new Map,this.set=(e,t)=>{const n=this.get(e);this.exists(e,t)||this.map.set(e,[...n,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,t))return;const s=n.filter(o=>o!==t);if(!s.length){this.map.delete(e);return}this.map.set(e,s)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var VS=Object.defineProperty,GS=Object.defineProperties,JS=Object.getOwnPropertyDescriptors,rp=Object.getOwnPropertySymbols,YS=Object.prototype.hasOwnProperty,XS=Object.prototype.propertyIsEnumerable,ip=(r,e,t)=>e in r?VS(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ia=(r,e)=>{for(var t in e||(e={}))YS.call(e,t)&&ip(r,t,e[t]);if(rp)for(var t of rp(e))XS.call(e,t)&&ip(r,t,e[t]);return r},Ph=(r,e)=>GS(r,JS(e));class ZS extends i7{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new WS,this.events=new ui.EventEmitter,this.name=G7,this.version=J7,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Hi,this.subscribeTimeout=pe.toMiliseconds(pe.ONE_MINUTE),this.initialSubscribeTimeout=pe.toMiliseconds(pe.ONE_SECOND*15),this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,s)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:s}});try{const o=Dc(s),f={topic:n,relay:o,transportType:s==null?void 0:s.transportType};this.pending.set(n,f);const h=await this.rpcSubscribe(n,o,s);return typeof h=="string"&&(this.onSubscribe(h,f),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:s}})),h}catch(o){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(o),o}},this.unsubscribe=async(n,s)=>{await this.restartToComplete(),this.isInitialized(),typeof(s==null?void 0:s.id)<"u"?await this.unsubscribeById(n,s.id,s):await this.unsubscribeByTopic(n,s)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const s=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((o,f)=>{const h=new pe.Watch;h.start(s);const p=setInterval(()=>{(!this.pending.has(n)&&this.topics.includes(n)||this.cached.some(l=>l.topic===n))&&(clearInterval(p),h.stop(s),o(!0)),h.elapsed(s)>=Y7&&(clearInterval(p),h.stop(s),f(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,s)=>{this.events.on(n,s)},this.once=(n,s)=>{this.events.once(n,s)},this.off=(n,s)=>{this.events.off(n,s)},this.removeListener=(n,s)=>{this.events.removeListener(n,s)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{await this.restore(),await this.onRestart()},this.checkPending=async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const n=[];this.pending.forEach(s=>{n.push(s)}),await this.batchSubscribe(n)},this.registerEventListeners=()=>{this.relayer.core.heartbeat.on(Qs.pulse,async()=>{await this.checkPending()}),this.events.on(Gr.created,async n=>{const s=Gr.created;this.logger.info(`Emitting ${s}`),this.logger.debug({type:"event",event:s,data:n}),await this.persist()}),this.events.on(Gr.deleted,async n=>{const s=Gr.deleted;this.logger.info(`Emitting ${s}`),this.logger.debug({type:"event",event:s,data:n}),await this.persist()})},this.relayer=e,this.logger=Or(t,this.name),this.clientId=""}get context(){return Ur(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let n=!1;try{n=this.getSubscription(e).topic===t}catch{}return n}reset(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const n=this.topicMap.get(e);await Promise.all(n.map(async s=>await this.unsubscribeById(e,s,t)))}async unsubscribeById(e,t,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:n}});try{const s=Dc(n);await this.rpcUnsubscribe(e,t,s);const o=It("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,o),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:n}})}catch(s){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(s),s}}async rpcSubscribe(e,t,n){var s;(n==null?void 0:n.transportType)===Nt.relay&&await this.restartToComplete();const o={method:Aa(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:o});const f=(s=n==null?void 0:n.internal)==null?void 0:s.throwOnFailedPublish;try{const h=this.getSubscriptionId(e);if((n==null?void 0:n.transportType)===Nt.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(o).catch(m=>this.logger.warn(m))},pe.toMiliseconds(pe.ONE_SECOND)),h;const p=new Promise(async m=>{const _=D=>{D.topic===e&&(this.events.removeListener(Gr.created,_),m(D.id))};this.events.on(Gr.created,_);try{const D=await xn(new Promise((I,M)=>{this.relayer.request(o).catch(H=>{this.logger.warn(H,H==null?void 0:H.message),M(H)}).then(I)}),this.initialSubscribeTimeout,`Subscribing to ${e} failed, please try again`);this.events.removeListener(Gr.created,_),m(D)}catch{}}),l=await xn(p,this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!l&&f)throw new Error(`Subscribing to ${e} failed, please try again`);return l?h:null}catch(h){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(or.connection_stalled),f)throw h}return null}async rpcBatchSubscribe(e){if(!e.length)return;const t=e[0].relay,n={method:Aa(t.protocol).batchSubscribe,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await xn(new Promise(s=>{this.relayer.request(n).catch(o=>this.logger.warn(o)).then(s)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(or.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const t=e[0].relay,n={method:Aa(t.protocol).batchFetchMessages,params:{topics:e.map(o=>o.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let s;try{s=await await xn(new Promise((o,f)=>{this.relayer.request(n).catch(h=>{this.logger.warn(h),f(h)}).then(o)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(or.connection_stalled)}return s}rpcUnsubscribe(e,t,n){const s={method:Aa(n.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s}),this.relayer.request(s)}onSubscribe(e,t){this.setSubscription(e,Ph(Ia({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach(t=>{this.setSubscription(t.id,Ia({},t)),this.pending.delete(t.topic)})}async onUnsubscribe(e,t,n){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t)}addSubscription(e,t){this.subscriptions.set(e,Ia({},t)),this.topicMap.set(t.topic,e),this.events.emit(Gr.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:n}=ge("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Gr.deleted,Ph(Ia({},n),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Gr.sync)}async onRestart(){if(this.cached.length){const e=[...this.cached],t=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let n=0;n<t;n++){const s=e.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(s)}}this.events.emit(Gr.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:t}=ge("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){e.length&&(await this.rpcBatchSubscribe(e),this.onBatchSubscribe(e.map(t=>Ph(Ia({},t),{id:this.getSubscriptionId(t.topic)}))))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const t=await this.rpcBatchFetchMessages(e);t&&t.messages&&(await b8(pe.toMiliseconds(pe.ONE_SECOND)),await this.relayer.handleBatchMessageEvents(t.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:e}=ge("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen()}getSubscriptionId(e){return sn(e+this.clientId)}}var QS=Object.defineProperty,np=Object.getOwnPropertySymbols,ex=Object.prototype.hasOwnProperty,tx=Object.prototype.propertyIsEnumerable,sp=(r,e,t)=>e in r?QS(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ap=(r,e)=>{for(var t in e||(e={}))ex.call(e,t)&&sp(r,t,e[t]);if(np)for(var t of np(e))tx.call(e,t)&&sp(r,t,e[t]);return r};class rx extends t7{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new ui.EventEmitter,this.name=j7,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1,this.heartBeatTimeout=pe.toMiliseconds(pe.THIRTY_SECONDS+pe.FIVE_SECONDS),this.requestsInFlight=[],this.connectTimeout=pe.toMiliseconds(pe.ONE_SECOND*15),this.request=async t=>{var n,s;this.logger.debug("Publishing Request Payload");const o=t.id||hs().toString();await this.toEstablishConnection();try{this.logger.trace({id:o,method:t.method,topic:(n=t.params)==null?void 0:n.topic},"relayer.request - publishing...");const f=`${o}:${((s=t.params)==null?void 0:s.tag)||""}`;this.requestsInFlight.push(f);const h=await this.provider.request(t);return this.requestsInFlight=this.requestsInFlight.filter(p=>p!==f),h}catch(f){throw this.logger.debug(`Failed to Publish Request: ${o}`),f}},this.resetPingTimeout=()=>{if(xc())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var t,n,s;this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(s=(n=(t=this.provider)==null?void 0:t.connection)==null?void 0:n.socket)==null||s.terminate()},this.heartBeatTimeout)}catch(t){this.logger.warn(t,t==null?void 0:t.message)}},this.onPayloadHandler=t=>{this.onProviderPayload(t),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.warn({},"Relayer connected 🛜"),this.startPingTimeout(),this.events.emit(or.connect)},this.onDisconnectHandler=()=>{this.logger.warn({},"Relayer disconnected 🛑"),this.requestsInFlight=[],this.onProviderDisconnect()},this.onProviderErrorHandler=t=>{this.logger.fatal(t,`Fatal socket error: ${t==null?void 0:t.message}`),this.events.emit(or.error,t),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(oi.payload,this.onPayloadHandler),this.provider.on(oi.connect,this.onConnectHandler),this.provider.on(oi.disconnect,this.onDisconnectHandler),this.provider.on(oi.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Or(e.logger,this.name):Xa(Jc({level:e.logger||H7})),this.messages=new US(this.logger,e.core),this.subscriber=new ZS(this,this.logger),this.publisher=new kS(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||X1,this.projectId=e.projectId,i8()?this.packageName=s0():n8()&&(this.bundleId=s0()),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e,e==null?void 0:e.message)}}get context(){return Ur(this.logger)}get connected(){var e,t,n;return((n=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:n.readyState)===1}get connecting(){var e,t,n;return((n=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:n.readyState)===0}async publish(e,t,n){this.isInitialized(),await this.publisher.publish(e,t,n),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now(),transportType:Nt.relay})}async subscribe(e,t){var n,s,o;this.isInitialized(),(!(t!=null&&t.transportType)||(t==null?void 0:t.transportType)==="relay")&&await this.toEstablishConnection();const f=typeof((n=t==null?void 0:t.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(s=t==null?void 0:t.internal)==null?void 0:s.throwOnFailedPublish;let h=((o=this.subscriber.topicMap.get(e))==null?void 0:o[0])||"",p;const l=m=>{m.topic===e&&(this.subscriber.off(Gr.created,l),p())};return await Promise.all([new Promise(m=>{p=m,this.subscriber.on(Gr.created,l)}),new Promise(async(m,_)=>{h=await this.subscriber.subscribe(e,ap({internal:{throwOnFailedPublish:f}},t)).catch(D=>{f&&_(D)})||h,m()})]),h}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await xn(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise(async(t,n)=>{await this.connect(e).then(t).catch(n).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw new Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(e){this.logger.debug({},"Restarting transport..."),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await D0())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const t=e.sort((n,s)=>n.publishedAt-s.publishedAt);this.logger.debug(`Batch of ${t.length} message events sorted`);for(const n of t)try{await this.onMessageEvent(n)}catch(s){this.logger.warn(s,"Error while processing batch message event: "+(s==null?void 0:s.message))}this.logger.trace(`Batch of ${t.length} message events processed`)}async onLinkMessageEvent(e,t){const{topic:n}=e;if(!t.sessionExists){const s=rr(pe.FIVE_MINUTES),o={topic:n,expiry:s,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,o)}this.events.emit(or.message,e),await this.recordMessageEvent(e)}async connect(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let t=1;for(;t<6;){try{this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${t}...`),await this.createProvider(),await new Promise(async(n,s)=>{const o=()=>{s(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(oi.disconnect,o),await xn(new Promise((f,h)=>{this.provider.connect().then(f).catch(h)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(f=>{s(f)}).finally(()=>{this.provider.off(oi.disconnect,o),clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),await new Promise(async(f,h)=>{const p=()=>{h(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(oi.disconnect,p),await this.subscriber.start().then(f).catch(h).finally(()=>{this.provider.off(oi.disconnect,p)})}),this.hasExperiencedNetworkDisruption=!1,n()})}catch(n){await this.subscriber.stop();const s=n;this.logger.warn({},s.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${t}`);break}await new Promise(n=>setTimeout(n,pe.toMiliseconds(t*1))),t++}}startPingTimeout(){var e,t,n,s,o;if(xc())try{(t=(e=this.provider)==null?void 0:e.connection)!=null&&t.socket&&((o=(s=(n=this.provider)==null?void 0:n.connection)==null?void 0:s.socket)==null||o.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(f){this.logger.warn(f,f==null?void 0:f.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new pi(new O7(c8({sdkVersion:Xh,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:t,message:n}=e;await this.messages.set(t,n)}async shouldIgnoreMessageEvent(e){const{topic:t,message:n}=e;if(!n||n.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.warn(`Ignoring message for non-subscribed topic ${t}`),!0;const s=this.messages.has(t,n);return s&&this.logger.warn(`Ignoring duplicate message: ${n}`),s}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),Eu(e)){if(!e.method.endsWith(K7))return;const t=e.params,{topic:n,message:s,publishedAt:o,attestation:f}=t.data,h={topic:n,message:s,publishedAt:o,transportType:Nt.relay,attestation:f};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(ap({type:"event",event:t.id},h)),this.events.emit(t.id,h),await this.acknowledgePayload(e),await this.onMessageEvent(h)}else Zc(e)&&this.events.emit(or.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(or.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const t=Yc(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(oi.payload,this.onPayloadHandler),this.provider.off(oi.connect,this.onConnectHandler),this.provider.off(oi.disconnect,this.onDisconnectHandler),this.provider.off(oi.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await D0();B4(async t=>{e!==t&&(e=t,t?await this.transportOpen().catch(n=>this.logger.error(n,n==null?void 0:n.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),clearTimeout(this.pingTimeout),this.events.emit(or.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||this.connectPromise||(this.reconnectTimeout=setTimeout(async()=>{clearTimeout(this.reconnectTimeout),await this.transportOpen().catch(e=>this.logger.error(e,e==null?void 0:e.message))},pe.toMiliseconds(k7))))}isInitialized(){if(!this.initialized){const{message:e}=ge("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&await this.transportOpen()}}var ix=Object.defineProperty,op=Object.getOwnPropertySymbols,nx=Object.prototype.hasOwnProperty,sx=Object.prototype.propertyIsEnumerable,cp=(r,e,t)=>e in r?ix(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,fp=(r,e)=>{for(var t in e||(e={}))nx.call(e,t)&&cp(r,t,e[t]);if(op)for(var t of op(e))sx.call(e,t)&&cp(r,t,e[t]);return r};class ms extends r7{constructor(e,t,n,s=Hi,o=void 0){super(e,t,n,s),this.core=e,this.logger=t,this.name=n,this.map=new Map,this.version=W7,this.cached=[],this.initialized=!1,this.storagePrefix=Hi,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(f=>{this.getKey&&f!==null&&!Pr(f)?this.map.set(this.getKey(f),f):v4(f)?this.map.set(f.id,f):m4(f)&&this.map.set(f.topic,f)}),this.cached=[],this.initialized=!0)},this.set=async(f,h)=>{this.isInitialized(),this.map.has(f)?await this.update(f,h):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:f,value:h}),this.map.set(f,h),await this.persist())},this.get=f=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:f}),this.getData(f)),this.getAll=f=>(this.isInitialized(),f?this.values.filter(h=>Object.keys(f).every(p=>R7(h[p],f[p]))):this.values),this.update=async(f,h)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:f,update:h});const p=fp(fp({},this.getData(f)),h);this.map.set(f,p),await this.persist()},this.delete=async(f,h)=>{this.isInitialized(),this.map.has(f)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:f,reason:h}),this.map.delete(f),this.addToRecentlyDeleted(f),await this.persist())},this.logger=Or(t,this.name),this.storagePrefix=s,this.getKey=o}get context(){return Ur(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){const{message:s}=ge("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(s),new Error(s)}const{message:n}=ge("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:t}=ge("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=ge("NOT_INITIALIZED",this.name);throw new Error(e)}}}class ax{constructor(e,t){this.core=e,this.logger=t,this.name=X7,this.version=Z7,this.events=new iu,this.initialized=!1,this.storagePrefix=Hi,this.ignoredPayloadTypes=[on],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const s=Gh(),o=await this.core.crypto.setSymKey(s),f=rr(pe.FIVE_MINUTES),h={protocol:Y1},p={topic:o,expiry:f,relay:h,active:!1,methods:n==null?void 0:n.methods},l=w0({protocol:this.core.protocol,version:this.core.version,topic:o,symKey:s,relay:h,expiryTimestamp:f,methods:n==null?void 0:n.methods});return this.events.emit(cs.create,p),this.core.expirer.set(o,f),await this.pairings.set(o,p),await this.core.relayer.subscribe(o,{transportType:n==null?void 0:n.transportType}),{topic:o,uri:l}},this.pair=async n=>{this.isInitialized();const s=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[Ui.pairing_started]}});this.isValidPair(n,s);const{topic:o,symKey:f,relay:h,expiryTimestamp:p,methods:l}=y0(n.uri);s.props.properties.topic=o,s.addTrace(Ui.pairing_uri_validation_success),s.addTrace(Ui.pairing_uri_not_expired);let m;if(this.pairings.keys.includes(o)){if(m=this.pairings.get(o),s.addTrace(Ui.existing_pairing),m.active)throw s.setError(rn.active_pairing_already_exists),new Error(`Pairing already exists: ${o}. Please try again with a new connection URI.`);s.addTrace(Ui.pairing_not_expired)}const _=p||rr(pe.FIVE_MINUTES),D={topic:o,relay:h,expiry:_,active:!1,methods:l};this.core.expirer.set(o,_),await this.pairings.set(o,D),s.addTrace(Ui.store_new_pairing),n.activatePairing&&await this.activate({topic:o}),this.events.emit(cs.create,D),s.addTrace(Ui.emit_inactive_pairing),this.core.crypto.keychain.has(o)||await this.core.crypto.setSymKey(f,o),s.addTrace(Ui.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{s.setError(rn.no_internet_connection)}try{await this.core.relayer.subscribe(o,{relay:h})}catch(I){throw s.setError(rn.subscribe_pairing_topic_failure),I}return s.addTrace(Ui.subscribe_pairing_topic_success),D},this.activate=async({topic:n})=>{this.isInitialized();const s=rr(pe.THIRTY_DAYS);this.core.expirer.set(n,s),await this.pairings.update(n,{active:!0,expiry:s})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:s}=n;if(this.pairings.keys.includes(s)){const o=await this.sendRequest(s,"wc_pairingPing",{}),{done:f,resolve:h,reject:p}=as();this.events.once(dt("pairing_ping",o),({error:l})=>{l?p(l):h()}),await f()}},this.updateExpiry=async({topic:n,expiry:s})=>{this.isInitialized(),await this.pairings.update(n,{expiry:s})},this.updateMetadata=async({topic:n,metadata:s})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:s})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:s}=n;this.pairings.keys.includes(s)&&(await this.sendRequest(s,"wc_pairingDelete",It("USER_DISCONNECTED")),await this.deletePairing(s))},this.formatUriFromPairing=n=>{this.isInitialized();const{topic:s,relay:o,expiry:f,methods:h}=n,p=this.core.crypto.keychain.get(s);return w0({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:p,relay:o,expiryTimestamp:f,methods:h})},this.sendRequest=async(n,s,o)=>{const f=Dn(s,o),h=await this.core.crypto.encode(n,f),p=Sa[s].req;return this.core.history.set(n,f),this.core.relayer.publish(n,h,p),f.id},this.sendResult=async(n,s,o)=>{const f=Yc(n,o),h=await this.core.crypto.encode(s,f),p=await this.core.history.get(s,n),l=Sa[p.request.method].res;await this.core.relayer.publish(s,h,l),await this.core.history.resolve(f)},this.sendError=async(n,s,o)=>{const f=Xc(n,o),h=await this.core.crypto.encode(s,f),p=await this.core.history.get(s,n),l=Sa[p.request.method]?Sa[p.request.method].res:Sa.unregistered_method.res;await this.core.relayer.publish(s,h,l),await this.core.history.resolve(f)},this.deletePairing=async(n,s)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,It("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),s?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(s=>Sn(s.expiry));await Promise.all(n.map(s=>this.deletePairing(s.topic)))},this.onRelayEventRequest=n=>{const{topic:s,payload:o}=n;switch(o.method){case"wc_pairingPing":return this.onPairingPingRequest(s,o);case"wc_pairingDelete":return this.onPairingDeleteRequest(s,o);default:return this.onUnknownRpcMethodRequest(s,o)}},this.onRelayEventResponse=async n=>{const{topic:s,payload:o}=n,f=(await this.core.history.get(s,o.id)).request.method;switch(f){case"wc_pairingPing":return this.onPairingPingResponse(s,o);default:return this.onUnknownRpcMethodResponse(f)}},this.onPairingPingRequest=async(n,s)=>{const{id:o}=s;try{this.isValidPing({topic:n}),await this.sendResult(o,n,!0),this.events.emit(cs.ping,{id:o,topic:n})}catch(f){await this.sendError(o,n,f),this.logger.error(f)}},this.onPairingPingResponse=(n,s)=>{const{id:o}=s;setTimeout(()=>{Bi(s)?this.events.emit(dt("pairing_ping",o),{}):fi(s)&&this.events.emit(dt("pairing_ping",o),{error:s.error})},500)},this.onPairingDeleteRequest=async(n,s)=>{const{id:o}=s;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(cs.delete,{id:o,topic:n})}catch(f){await this.sendError(o,n,f),this.logger.error(f)}},this.onUnknownRpcMethodRequest=async(n,s)=>{const{id:o,method:f}=s;try{if(this.registeredMethods.includes(f))return;const h=It("WC_METHOD_UNSUPPORTED",f);await this.sendError(o,n,h),this.logger.error(h)}catch(h){await this.sendError(o,n,h),this.logger.error(h)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(It("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,s)=>{var o;if(!Fr(n)){const{message:h}=ge("MISSING_OR_INVALID",`pair() params: ${n}`);throw s.setError(rn.malformed_pairing_uri),new Error(h)}if(!b4(n.uri)){const{message:h}=ge("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw s.setError(rn.malformed_pairing_uri),new Error(h)}const f=y0(n==null?void 0:n.uri);if(!((o=f==null?void 0:f.relay)!=null&&o.protocol)){const{message:h}=ge("MISSING_OR_INVALID","pair() uri#relay-protocol");throw s.setError(rn.malformed_pairing_uri),new Error(h)}if(!(f!=null&&f.symKey)){const{message:h}=ge("MISSING_OR_INVALID","pair() uri#symKey");throw s.setError(rn.malformed_pairing_uri),new Error(h)}if(f!=null&&f.expiryTimestamp&&pe.toMiliseconds(f==null?void 0:f.expiryTimestamp)<Date.now()){s.setError(rn.pairing_expired);const{message:h}=ge("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(h)}},this.isValidPing=async n=>{if(!Fr(n)){const{message:o}=ge("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(o)}const{topic:s}=n;await this.isValidPairingTopic(s)},this.isValidDisconnect=async n=>{if(!Fr(n)){const{message:o}=ge("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(o)}const{topic:s}=n;await this.isValidPairingTopic(s)},this.isValidPairingTopic=async n=>{if(!Xt(n,!1)){const{message:s}=ge("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(s)}if(!this.pairings.keys.includes(n)){const{message:s}=ge("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(s)}if(Sn(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:s}=ge("EXPIRED",`pairing topic: ${n}`);throw new Error(s)}},this.core=e,this.logger=Or(t,this.name),this.pairings=new ms(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Ur(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=ge("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(or.message,async e=>{const{topic:t,message:n,transportType:s}=e;if(!this.pairings.keys.includes(t)||s===Nt.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const o=await this.core.crypto.decode(t,n);try{Eu(o)?(this.core.history.set(t,o),this.onRelayEventRequest({topic:t,payload:o})):Zc(o)&&(await this.core.history.resolve(o),await this.onRelayEventResponse({topic:t,payload:o}),this.core.history.delete(t,o.id))}catch(f){this.logger.error(f)}})}registerExpirerEvents(){this.core.expirer.on(ci.expired,async e=>{const{topic:t}=D1(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(cs.expire,{topic:t}))})}}class ox extends Z9{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new ui.EventEmitter,this.name=Q7,this.version=eE,this.cached=[],this.initialized=!1,this.storagePrefix=Hi,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,s,o)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:s,chainId:o}),this.records.has(s.id))return;const f={id:s.id,topic:n,request:{method:s.method,params:s.params||null},chainId:o,expiry:rr(pe.THIRTY_DAYS)};this.records.set(f.id,f),this.persist(),this.events.emit(Ei.created,f)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const s=await this.getRecord(n.id);typeof s.response>"u"&&(s.response=fi(n)?{error:n.error}:{result:n.result},this.records.set(s.id,s),this.persist(),this.events.emit(Ei.updated,s))},this.get=async(n,s)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:s}),await this.getRecord(s)),this.delete=(n,s)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:s}),this.values.forEach(o=>{if(o.topic===n){if(typeof s<"u"&&o.id!==s)return;this.records.delete(o.id),this.events.emit(Ei.deleted,o)}}),this.persist()},this.exists=async(n,s)=>(this.isInitialized(),this.records.has(s)?(await this.getRecord(s)).topic===n:!1),this.on=(n,s)=>{this.events.on(n,s)},this.once=(n,s)=>{this.events.once(n,s)},this.off=(n,s)=>{this.events.off(n,s)},this.removeListener=(n,s)=>{this.events.removeListener(n,s)},this.logger=Or(t,this.name)}get context(){return Ur(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(t=>{if(typeof t.response<"u")return;const n={topic:t.topic,request:Dn(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const t=this.records.get(e);if(!t){const{message:n}=ge("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Ei.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:t}=ge("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Ei.created,e=>{const t=Ei.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(Ei.updated,e=>{const t=Ei.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(Ei.deleted,e=>{const t=Ei.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.core.heartbeat.on(Qs.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(t=>{pe.toMiliseconds(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.records.delete(t.id),this.events.emit(Ei.deleted,t,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=ge("NOT_INITIALIZED",this.name);throw new Error(e)}}}class cx extends n7{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new ui.EventEmitter,this.name=tE,this.version=rE,this.cached=[],this.initialized=!1,this.storagePrefix=Hi,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const s=this.formatTarget(n);return typeof this.getExpiration(s)<"u"}catch{return!1}},this.set=(n,s)=>{this.isInitialized();const o=this.formatTarget(n),f={target:o,expiry:s};this.expirations.set(o,f),this.checkExpiry(o,f),this.events.emit(ci.created,{target:o,expiration:f})},this.get=n=>{this.isInitialized();const s=this.formatTarget(n);return this.getExpiration(s)},this.del=n=>{if(this.isInitialized(),this.has(n)){const s=this.formatTarget(n),o=this.getExpiration(s);this.expirations.delete(s),this.events.emit(ci.deleted,{target:s,expiration:o})}},this.on=(n,s)=>{this.events.on(n,s)},this.once=(n,s)=>{this.events.once(n,s)},this.off=(n,s)=>{this.events.off(n,s)},this.removeListener=(n,s)=>{this.events.removeListener(n,s)},this.logger=Or(t,this.name)}get context(){return Ur(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 f8(e);if(typeof e=="number")return h8(e);const{message:t}=ge("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(ci.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:t}=ge("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:n}=ge("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return t}checkExpiry(e,t){const{expiry:n}=t;pe.toMiliseconds(n)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(ci.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(Qs.pulse,()=>this.checkExpirations()),this.events.on(ci.created,e=>{const t=ci.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(ci.expired,e=>{const t=ci.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(ci.deleted,e=>{const t=ci.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ge("NOT_INITIALIZED",this.name);throw new Error(e)}}}class fx extends s7{constructor(e,t,n){super(e,t,n),this.core=e,this.logger=t,this.store=n,this.name=iE,this.verifyUrlV3=sE,this.storagePrefix=Hi,this.version=J1,this.init=async()=>{var s;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&pe.toMiliseconds((s=this.publicKey)==null?void 0:s.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))},this.register=async s=>{if(!Wa()||this.isDevEnv)return;const o=window.location.origin,{id:f,decryptedId:h}=s,p=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${o}&id=${f}&decryptedId=${h}`;try{const l=Ba(),m=this.startAbortTimer(pe.ONE_SECOND*5),_=await new Promise((D,I)=>{const M=()=>{window.removeEventListener("message",k),l.body.removeChild(H),I("attestation aborted")};this.abortController.signal.addEventListener("abort",M);const H=l.createElement("iframe");H.src=p,H.style.display="none",H.addEventListener("error",M,{signal:this.abortController.signal});const k=X=>{if(X.data&&typeof X.data=="string")try{const F=JSON.parse(X.data);if(F.type==="verify_attestation"){if(Wh(F.attestation).payload.id!==f)return;clearInterval(m),l.body.removeChild(H),this.abortController.signal.removeEventListener("abort",M),window.removeEventListener("message",k),D(F.attestation===null?"":F.attestation)}}catch(F){this.logger.warn(F)}};l.body.appendChild(H),window.addEventListener("message",k,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",_),_}catch(l){this.logger.warn(l)}return""},this.resolve=async s=>{if(this.isDevEnv)return"";const{attestationId:o,hash:f,encryptedId:h}=s;if(o===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(o){if(Wh(o).payload.id!==h)return;const l=await this.isValidJwtAttestation(o);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!f)return;const p=this.getVerifyUrl(s==null?void 0:s.verifyUrl);return this.fetchAttestation(f,p)},this.fetchAttestation=async(s,o)=>{this.logger.debug(`resolving attestation: ${s} from url: ${o}`);const f=this.startAbortTimer(pe.ONE_SECOND*5),h=await fetch(`${o}/attestation/${s}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(f),h.status===200?await h.json():void 0},this.getVerifyUrl=s=>{let o=s||Ca;return aE.includes(o)||(this.logger.info(`verify url: ${o}, not included in trusted list, assigning default: ${Ca}`),o=Ca),o},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const s=this.startAbortTimer(pe.FIVE_SECONDS),o=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(s),await o.json()}catch(s){this.logger.warn(s)}},this.persistPublicKey=async s=>{this.logger.debug("persisting public key to local storage",s),await this.store.setItem(this.storeKey,s),this.publicKey=s},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 s=>{const o=await this.getPublicKey();try{if(o)return this.validateAttestation(s,o)}catch(h){this.logger.error(h),this.logger.warn("error validating attestation")}const f=await this.fetchAndPersistPublicKey();try{if(f)return this.validateAttestation(s,f)}catch(h){this.logger.error(h),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 o=>{const f=await this.fetchPublicKey();f&&(await this.persistPublicKey(f),o(f))});const s=await this.fetchPromise;return this.fetchPromise=void 0,s},this.validateAttestation=(s,o)=>{const f=X8(s,o.publicKey),h={hasExpired:pe.toMiliseconds(f.exp)<Date.now(),payload:f};if(h.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:h.payload.origin,isScam:h.payload.isScam,isVerified:h.payload.isVerified}},this.logger=Or(t,this.name),this.abortController=new AbortController,this.isDevEnv=gu(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return Ur(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),pe.toMiliseconds(e))}}class hx extends a7{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.context=oE,this.registerDeviceToken=async n=>{const{clientId:s,token:o,notificationType:f,enableEncrypted:h=!1}=n,p=`${cE}/${this.projectId}/clients`;await fetch(p,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:s,type:f,token:o,always_raw:h})})},this.logger=Or(t,this.context)}}var ux=Object.defineProperty,hp=Object.getOwnPropertySymbols,dx=Object.prototype.hasOwnProperty,lx=Object.prototype.propertyIsEnumerable,up=(r,e,t)=>e in r?ux(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Da=(r,e)=>{for(var t in e||(e={}))dx.call(e,t)&&up(r,t,e[t]);if(hp)for(var t of hp(e))lx.call(e,t)&&up(r,t,e[t]);return r};class px extends o7{constructor(e,t,n=!0){super(e,t,n),this.core=e,this.logger=t,this.context=hE,this.storagePrefix=Hi,this.storageVersion=fE,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!gu())try{const s={eventId:o0(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:E1(this.core.relayer.protocol,this.core.relayer.version,Xh)}}};await this.sendEvent([s])}catch(s){this.logger.warn(s)}},this.createEvent=s=>{const{event:o="ERROR",type:f="",properties:{topic:h,trace:p}}=s,l=o0(),m=this.core.projectId||"",_=Date.now(),D=Da({eventId:l,timestamp:_,props:{event:o,type:f,properties:{topic:h,trace:p}},bundleId:m,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,D),this.shouldPersist=!0),D},this.getEvent=s=>{const{eventId:o,topic:f}=s;if(o)return this.events.get(o);const h=Array.from(this.events.values()).find(p=>p.props.properties.topic===f);if(h)return Da(Da({},h),this.setMethods(h.eventId))},this.deleteEvent=s=>{const{eventId:o}=s;this.events.delete(o),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(Qs.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(s=>{pe.fromMiliseconds(Date.now())-pe.fromMiliseconds(s.timestamp)>uE&&(this.events.delete(s.eventId),this.shouldPersist=!0)})})},this.setMethods=s=>({addTrace:o=>this.addTrace(s,o),setError:o=>this.setError(s,o)}),this.addTrace=(s,o)=>{const f=this.events.get(s);f&&(f.props.properties.trace.push(o),this.events.set(s,f),this.shouldPersist=!0)},this.setError=(s,o)=>{const f=this.events.get(s);f&&(f.props.type=o,f.timestamp=Date.now(),this.events.set(s,f),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 s=await this.core.storage.getItem(this.storageKey)||[];if(!s.length)return;s.forEach(o=>{this.events.set(o.eventId,Da(Da({},o),this.setMethods(o.eventId)))})}catch(s){this.logger.warn(s)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const s=[];for(const[o,f]of this.events)f.props.type&&s.push(f);if(s.length!==0)try{if((await this.sendEvent(s)).ok)for(const o of s)this.events.delete(o.eventId),this.shouldPersist=!0}catch(o){this.logger.warn(o)}},this.sendEvent=async s=>{const o=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${dE}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${Xh}${o}`,{method:"POST",body:JSON.stringify(s)})},this.getAppDomain=()=>_1().url,this.logger=Or(t,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var gx=Object.defineProperty,dp=Object.getOwnPropertySymbols,bx=Object.prototype.hasOwnProperty,vx=Object.prototype.propertyIsEnumerable,lp=(r,e,t)=>e in r?gx(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pp=(r,e)=>{for(var t in e||(e={}))bx.call(e,t)&&lp(r,t,e[t]);if(dp)for(var t of dp(e))vx.call(e,t)&&lp(r,t,e[t]);return r};let mx=class fg extends X9{constructor(e){var t;super(e),this.protocol=G1,this.version=J1,this.name=Cc,this.events=new ui.EventEmitter,this.initialized=!1,this.on=(f,h)=>this.events.on(f,h),this.once=(f,h)=>this.events.once(f,h),this.off=(f,h)=>this.events.off(f,h),this.removeListener=(f,h)=>this.events.removeListener(f,h),this.dispatchEnvelope=({topic:f,message:h,sessionExists:p})=>{if(!f||!h)return;const l={topic:f,message:h,publishedAt:Date.now(),transportType:Nt.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:p})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||X1,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=Jc({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:T7.logger,name:Cc}),{logger:s,chunkLoggerController:o}=Y9({opts:n,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=o,(t=this.logChunkController)!=null&&t.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var f,h;(f=this.logChunkController)!=null&&f.downloadLogsBlobInBrowser&&((h=this.logChunkController)==null||h.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=Or(s,this.name),this.heartbeat=new K4,this.crypto=new qS(this,this.logger,e==null?void 0:e.keychain),this.history=new ox(this,this.logger),this.expirer=new cx(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new E9(pp(pp({},N7),e==null?void 0:e.storageOptions)),this.relayer=new rx({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new ax(this,this.logger),this.verify=new fx(this,this.logger,this.storage),this.echoClient=new hx(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new px(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const t=new fg(e);await t.initialize();const n=await t.crypto.getClientId();return await t.storage.setItem(V7,n),t}get context(){return Ur(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(k0,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(k0)||[],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 yx=mx,hg="wc",ug=2,dg="client",Su=`${hg}@${ug}:${dg}:`,Mh={name:dg,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.org"},gp="WALLETCONNECT_DEEPLINK_CHOICE",wx="proposal",lg="Proposal expired",_x="session",zs=pe.SEVEN_DAYS,Ex="engine",sr={wc_sessionPropose:{req:{ttl:pe.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:pe.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:pe.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:pe.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:pe.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:pe.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:pe.ONE_DAY,prompt:!1,tag:1104},res:{ttl:pe.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:pe.ONE_DAY,prompt:!1,tag:1106},res:{ttl:pe.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:pe.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:pe.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:pe.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:pe.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:pe.ONE_DAY,prompt:!1,tag:1112},res:{ttl:pe.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:pe.ONE_DAY,prompt:!1,tag:1114},res:{ttl:pe.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:pe.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:pe.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:pe.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:pe.FIVE_MINUTES,prompt:!1,tag:1119}}},Oh={min:pe.FIVE_MINUTES,max:pe.SEVEN_DAYS},qi={idle:"IDLE",active:"ACTIVE"},Sx="request",xx=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],Ix="wc",Dx="auth",Ax="authKeys",Px="pairingTopics",Mx="requests",ef=`${Ix}@${1.5}:${Dx}:`,bc=`${ef}:PUB_KEY`;var Ox=Object.defineProperty,Cx=Object.defineProperties,Rx=Object.getOwnPropertyDescriptors,bp=Object.getOwnPropertySymbols,Tx=Object.prototype.hasOwnProperty,Nx=Object.prototype.propertyIsEnumerable,vp=(r,e,t)=>e in r?Ox(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Wt=(r,e)=>{for(var t in e||(e={}))Tx.call(e,t)&&vp(r,t,e[t]);if(bp)for(var t of bp(e))Nx.call(e,t)&&vp(r,t,e[t]);return r},xi=(r,e)=>Cx(r,Rx(e));class $x extends f7{constructor(e){super(e),this.name=Ex,this.events=new iu,this.initialized=!1,this.requestQueue={state:qi.idle,queue:[]},this.sessionRequestQueue={state:qi.idle,queue:[]},this.requestQueueDelay=pe.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(sr)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},pe.toMiliseconds(this.requestQueueDelay)))},this.connect=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=xi(Wt({},t),{requiredNamespaces:t.requiredNamespaces||{},optionalNamespaces:t.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:s,requiredNamespaces:o,optionalNamespaces:f,sessionProperties:h,relays:p}=n;let l=s,m,_=!1;try{l&&(_=this.client.core.pairing.pairings.get(l).active)}catch($){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),$}if(!l||!_){const{topic:$,uri:U}=await this.client.core.pairing.create();l=$,m=U}if(!l){const{message:$}=ge("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error($)}const D=await this.client.core.crypto.generateKeyPair(),I=sr.wc_sessionPropose.req.ttl||pe.FIVE_MINUTES,M=rr(I),H=Wt({requiredNamespaces:o,optionalNamespaces:f,relays:p??[{protocol:Y1}],proposer:{publicKey:D,metadata:this.client.metadata},expiryTimestamp:M,pairingTopic:l},h&&{sessionProperties:h}),{reject:k,resolve:X,done:F}=as(I,lg);this.events.once(dt("session_connect"),async({error:$,session:U})=>{if($)k($);else if(U){U.self.publicKey=D;const z=xi(Wt({},U),{pairingTopic:H.pairingTopic,requiredNamespaces:H.requiredNamespaces,optionalNamespaces:H.optionalNamespaces,transportType:Nt.relay});await this.client.session.set(U.topic,z),await this.setExpiry(U.topic,U.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:U.peer.metadata}),this.cleanupDuplicatePairings(z),X(z)}});const V=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:H,throwOnFailedPublish:!0});return await this.setProposal(V,Wt({id:V},H)),{uri:m,approval:F}},this.pair=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(t)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async t=>{var n,s,o;const f=this.client.core.eventClient.createEvent({properties:{topic:(n=t==null?void 0:t.id)==null?void 0:n.toString(),trace:[Si.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(T){throw f.setError(ns.no_internet_connection),T}try{await this.isValidProposalId(t==null?void 0:t.id)}catch(T){throw this.client.logger.error(`approve() -> proposal.get(${t==null?void 0:t.id}) failed`),f.setError(ns.proposal_not_found),T}try{await this.isValidApprove(t)}catch(T){throw this.client.logger.error("approve() -> isValidApprove() failed"),f.setError(ns.session_approve_namespace_validation_failure),T}const{id:h,relayProtocol:p,namespaces:l,sessionProperties:m,sessionConfig:_}=t,D=this.client.proposal.get(h);this.client.core.eventClient.deleteEvent({eventId:f.eventId});const{pairingTopic:I,proposer:M,requiredNamespaces:H,optionalNamespaces:k}=D;let X=(s=this.client.core.eventClient)==null?void 0:s.getEvent({topic:I});X||(X=(o=this.client.core.eventClient)==null?void 0:o.createEvent({type:Si.session_approve_started,properties:{topic:I,trace:[Si.session_approve_started,Si.session_namespaces_validation_success]}}));const F=await this.client.core.crypto.generateKeyPair(),V=M.publicKey,$=await this.client.core.crypto.generateSharedKey(F,V),U=Wt(Wt({relay:{protocol:p??"irn"},namespaces:l,controller:{publicKey:F,metadata:this.client.metadata},expiry:rr(zs)},m&&{sessionProperties:m}),_&&{sessionConfig:_}),z=Nt.relay;X.addTrace(Si.subscribing_session_topic);try{await this.client.core.relayer.subscribe($,{transportType:z})}catch(T){throw X.setError(ns.subscribe_session_topic_failure),T}X.addTrace(Si.subscribe_session_topic_success);const b=xi(Wt({},U),{topic:$,requiredNamespaces:H,optionalNamespaces:k,pairingTopic:I,acknowledged:!1,self:U.controller,peer:{publicKey:M.publicKey,metadata:M.metadata},controller:F,transportType:Nt.relay});await this.client.session.set($,b),X.addTrace(Si.store_session);try{X.addTrace(Si.publishing_session_settle),await this.sendRequest({topic:$,method:"wc_sessionSettle",params:U,throwOnFailedPublish:!0}).catch(T=>{throw X==null||X.setError(ns.session_settle_publish_failure),T}),X.addTrace(Si.session_settle_publish_success),X.addTrace(Si.publishing_session_approve),await this.sendResult({id:h,topic:I,result:{relay:{protocol:p??"irn"},responderPublicKey:F},throwOnFailedPublish:!0}).catch(T=>{throw X==null||X.setError(ns.session_approve_publish_failure),T}),X.addTrace(Si.session_approve_publish_success)}catch(T){throw this.client.logger.error(T),this.client.session.delete($,It("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe($),T}return this.client.core.eventClient.deleteEvent({eventId:X.eventId}),await this.client.core.pairing.updateMetadata({topic:I,metadata:M.metadata}),await this.client.proposal.delete(h,It("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:I}),await this.setExpiry($,rr(zs)),{topic:$,acknowledged:()=>Promise.resolve(this.client.session.get($))}},this.reject=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(t)}catch(f){throw this.client.logger.error("reject() -> isValidReject() failed"),f}const{id:n,reason:s}=t;let o;try{o=this.client.proposal.get(n).pairingTopic}catch(f){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),f}o&&(await this.sendError({id:n,topic:o,error:s,rpcOpts:sr.wc_sessionPropose.reject}),await this.client.proposal.delete(n,It("USER_DISCONNECTED")))},this.update=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(t)}catch(_){throw this.client.logger.error("update() -> isValidUpdate() failed"),_}const{topic:n,namespaces:s}=t,{done:o,resolve:f,reject:h}=as(),p=nn(),l=hs().toString(),m=this.client.session.get(n).namespaces;return this.events.once(dt("session_update",p),({error:_})=>{_?h(_):f()}),await this.client.session.update(n,{namespaces:s}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:s},throwOnFailedPublish:!0,clientRpcId:p,relayRpcId:l}).catch(_=>{this.client.logger.error(_),this.client.session.update(n,{namespaces:m}),h(_)}),{acknowledged:o}},this.extend=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(t)}catch(p){throw this.client.logger.error("extend() -> isValidExtend() failed"),p}const{topic:n}=t,s=nn(),{done:o,resolve:f,reject:h}=as();return this.events.once(dt("session_extend",s),({error:p})=>{p?h(p):f()}),await this.setExpiry(n,rr(zs)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:s,throwOnFailedPublish:!0}).catch(p=>{h(p)}),{acknowledged:o}},this.request=async t=>{this.isInitialized();try{await this.isValidRequest(t)}catch(M){throw this.client.logger.error("request() -> isValidRequest() failed"),M}const{chainId:n,request:s,topic:o,expiry:f=sr.wc_sessionRequest.req.ttl}=t,h=this.client.session.get(o);(h==null?void 0:h.transportType)===Nt.relay&&await this.confirmOnlineStateOrThrow();const p=nn(),l=hs().toString(),{done:m,resolve:_,reject:D}=as(f,"Request expired. Please try again.");this.events.once(dt("session_request",p),({error:M,result:H})=>{M?D(M):_(H)});const I=this.getAppLinkIfEnabled(h.peer.metadata,h.transportType);return I?(await this.sendRequest({clientRpcId:p,relayRpcId:l,topic:o,method:"wc_sessionRequest",params:{request:xi(Wt({},s),{expiryTimestamp:rr(f)}),chainId:n},expiry:f,throwOnFailedPublish:!0,appLink:I}).catch(M=>D(M)),this.client.events.emit("session_request_sent",{topic:o,request:s,chainId:n,id:p}),await m()):await Promise.all([new Promise(async M=>{await this.sendRequest({clientRpcId:p,relayRpcId:l,topic:o,method:"wc_sessionRequest",params:{request:xi(Wt({},s),{expiryTimestamp:rr(f)}),chainId:n},expiry:f,throwOnFailedPublish:!0}).catch(H=>D(H)),this.client.events.emit("session_request_sent",{topic:o,request:s,chainId:n,id:p}),M()}),new Promise(async M=>{var H;if(!((H=h.sessionConfig)!=null&&H.disableDeepLink)){const k=await l8(this.client.core.storage,gp);await u8({id:p,topic:o,wcDeepLink:k})}M()}),m()]).then(M=>M[2])},this.respond=async t=>{this.isInitialized(),await this.isValidRespond(t);const{topic:n,response:s}=t,{id:o}=s,f=this.client.session.get(n);f.transportType===Nt.relay&&await this.confirmOnlineStateOrThrow();const h=this.getAppLinkIfEnabled(f.peer.metadata,f.transportType);Bi(s)?await this.sendResult({id:o,topic:n,result:s.result,throwOnFailedPublish:!0,appLink:h}):fi(s)&&await this.sendError({id:o,topic:n,error:s.error,appLink:h}),this.cleanupAfterResponse(t)},this.ping=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(t)}catch(s){throw this.client.logger.error("ping() -> isValidPing() failed"),s}const{topic:n}=t;if(this.client.session.keys.includes(n)){const s=nn(),o=hs().toString(),{done:f,resolve:h,reject:p}=as();this.events.once(dt("session_ping",s),({error:l})=>{l?p(l):h()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:s,relayRpcId:o}),f()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(t);const{topic:n,event:s,chainId:o}=t,f=hs().toString(),h=nn();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:s,chainId:o},throwOnFailedPublish:!0,relayRpcId:f,clientRpcId:h})},this.disconnect=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(t);const{topic:n}=t;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:It("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:s}=ge("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(s)}},this.find=t=>(this.isInitialized(),this.client.session.getAll().filter(n=>p4(n,t))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(t,n)=>{var s;this.isInitialized(),this.isValidAuthenticate(t);const o=n&&this.client.core.linkModeSupportedApps.includes(n)&&((s=this.client.metadata.redirect)==null?void 0:s.linkMode),f=o?Nt.link_mode:Nt.relay;f===Nt.relay&&await this.confirmOnlineStateOrThrow();const{chains:h,statement:p="",uri:l,domain:m,nonce:_,type:D,exp:I,nbf:M,methods:H=[],expiry:k}=t,X=[...t.resources||[]],{topic:F,uri:V}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:f});this.client.logger.info({message:"Generated new pairing",pairing:{topic:F,uri:V}});const $=await this.client.core.crypto.generateKeyPair(),U=lc($);if(await Promise.all([this.client.auth.authKeys.set(bc,{responseTopic:U,publicKey:$}),this.client.auth.pairingTopics.set(U,{topic:U,pairingTopic:F})]),await this.client.core.relayer.subscribe(U,{transportType:f}),this.client.logger.info(`sending request to new pairing topic: ${F}`),H.length>0){const{namespace:R}=Ws(h[0]);let x=$8(R,"request",H);dc(X)&&(x=F8(x,X.pop())),X.push(x)}const z=k&&k>sr.wc_sessionAuthenticate.req.ttl?k:sr.wc_sessionAuthenticate.req.ttl,b={authPayload:{type:D??"caip122",chains:h,statement:p,aud:l,domain:m,version:"1",nonce:_,iat:new Date().toISOString(),exp:I,nbf:M,resources:X},requester:{publicKey:$,metadata:this.client.metadata},expiryTimestamp:rr(z)},T={eip155:{chains:h,methods:[...new Set(["personal_sign",...H])],events:["chainChanged","accountsChanged"]}},re={requiredNamespaces:{},optionalNamespaces:T,relays:[{protocol:"irn"}],pairingTopic:F,proposer:{publicKey:$,metadata:this.client.metadata},expiryTimestamp:rr(sr.wc_sessionPropose.req.ttl)},{done:de,resolve:L,reject:u}=as(z,"Request expired"),y=async({error:R,session:x})=>{if(this.events.off(dt("session_request",E),w),R)u(R);else if(x){x.self.publicKey=$,await this.client.session.set(x.topic,x),await this.setExpiry(x.topic,x.expiry),F&&await this.client.core.pairing.updateMetadata({topic:F,metadata:x.peer.metadata});const d=this.client.session.get(x.topic);await this.deleteProposal(O),L({session:d})}},w=async R=>{var x,d,A;if(await this.deletePendingAuthRequest(E,{message:"fulfilled",code:0}),R.error){const Z=It("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return R.error.code===Z.code?void 0:(this.events.off(dt("session_connect"),y),u(R.error.message))}await this.deleteProposal(O),this.events.off(dt("session_connect"),y);const{cacaos:fe,responder:ee}=R.result,he=[],ne=[];for(const Z of fe){await h0({cacao:Z,projectId:this.client.core.projectId})||(this.client.logger.error(Z,"Signature verification failed"),u(It("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:K}=Z,v=dc(K.resources),j=[Vh(K.iss)],oe=Ic(K.iss);if(v){const le=u0(v),Te=d0(v);he.push(...le),j.push(...Te)}for(const le of j)ne.push(`${le}:${oe}`)}const be=await this.client.core.crypto.generateSharedKey($,ee.publicKey);let G;he.length>0&&(G={topic:be,acknowledged:!0,self:{publicKey:$,metadata:this.client.metadata},peer:ee,controller:ee.publicKey,expiry:rr(zs),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:F,namespaces:_0([...new Set(he)],[...new Set(ne)]),transportType:f},await this.client.core.relayer.subscribe(be,{transportType:f}),await this.client.session.set(be,G),F&&await this.client.core.pairing.updateMetadata({topic:F,metadata:ee.metadata}),G=this.client.session.get(be)),(x=this.client.metadata.redirect)!=null&&x.linkMode&&(d=ee.metadata.redirect)!=null&&d.linkMode&&(A=ee.metadata.redirect)!=null&&A.universal&&n&&(this.client.core.addLinkModeSupportedApp(ee.metadata.redirect.universal),this.client.session.update(be,{transportType:Nt.link_mode})),L({auths:fe,session:G})},E=nn(),O=nn();this.events.once(dt("session_connect"),y),this.events.once(dt("session_request",E),w);let N;try{if(o){const R=Dn("wc_sessionAuthenticate",b,E);this.client.core.history.set(F,R);const x=await this.client.core.crypto.encode("",R,{type:Ja,encoding:_a});N=ic(n,F,x)}else await Promise.all([this.sendRequest({topic:F,method:"wc_sessionAuthenticate",params:b,expiry:t.expiry,throwOnFailedPublish:!0,clientRpcId:E}),this.sendRequest({topic:F,method:"wc_sessionPropose",params:re,expiry:sr.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:O})])}catch(R){throw this.events.off(dt("session_connect"),y),this.events.off(dt("session_request",E),w),R}return await this.setProposal(O,Wt({id:O},re)),await this.setAuthRequest(E,{request:xi(Wt({},b),{verifyContext:{}}),pairingTopic:F,transportType:f}),{uri:N??V,response:de}},this.approveSessionAuthenticate=async t=>{const{id:n,auths:s}=t,o=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[ss.authenticated_session_approve_started]}});try{this.isInitialized()}catch(k){throw o.setError(xa.no_internet_connection),k}const f=this.getPendingAuthRequest(n);if(!f)throw o.setError(xa.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const h=f.transportType||Nt.relay;h===Nt.relay&&await this.confirmOnlineStateOrThrow();const p=f.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),m=lc(p),_={type:on,receiverPublicKey:p,senderPublicKey:l},D=[],I=[];for(const k of s){if(!await h0({cacao:k,projectId:this.client.core.projectId})){o.setError(xa.invalid_cacao);const U=It("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:m,error:U,encodeOpts:_}),new Error(U.message)}o.addTrace(ss.cacaos_verified);const{p:X}=k,F=dc(X.resources),V=[Vh(X.iss)],$=Ic(X.iss);if(F){const U=u0(F),z=d0(F);D.push(...U),V.push(...z)}for(const U of V)I.push(`${U}:${$}`)}const M=await this.client.core.crypto.generateSharedKey(l,p);o.addTrace(ss.create_authenticated_session_topic);let H;if((D==null?void 0:D.length)>0){H={topic:M,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:p,metadata:f.requester.metadata},controller:p,expiry:rr(zs),authentication:s,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:f.pairingTopic,namespaces:_0([...new Set(D)],[...new Set(I)]),transportType:h},o.addTrace(ss.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(M,{transportType:h})}catch(k){throw o.setError(xa.subscribe_authenticated_session_topic_failure),k}o.addTrace(ss.subscribe_authenticated_session_topic_success),await this.client.session.set(M,H),o.addTrace(ss.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:f.pairingTopic,metadata:f.requester.metadata})}o.addTrace(ss.publishing_authenticated_session_approve);try{await this.sendResult({topic:m,id:n,result:{cacaos:s,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:_,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(f.requester.metadata,h)})}catch(k){throw o.setError(xa.authenticated_session_approve_publish_failure),k}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:f.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:o.eventId}),{session:H}},this.rejectSessionAuthenticate=async t=>{this.isInitialized();const{id:n,reason:s}=t,o=this.getPendingAuthRequest(n);if(!o)throw new Error(`Could not find pending auth request with id ${n}`);o.transportType===Nt.relay&&await this.confirmOnlineStateOrThrow();const f=o.requester.publicKey,h=await this.client.core.crypto.generateKeyPair(),p=lc(f),l={type:on,receiverPublicKey:f,senderPublicKey:h};await this.sendError({id:n,topic:p,error:s,encodeOpts:l,rpcOpts:sr.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(o.requester.metadata,o.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,It("USER_DISCONNECTED"))},this.formatAuthMessage=t=>{this.isInitialized();const{request:n,iss:s}=t;return P1(n,s)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const t=this.relayMessageCache.shift();t&&await this.onRelayMessage(t)}catch(t){this.client.logger.error(t)}},50)},this.cleanupDuplicatePairings=async t=>{if(t.pairingTopic)try{const n=this.client.core.pairing.pairings.get(t.pairingTopic),s=this.client.core.pairing.pairings.getAll().filter(o=>{var f,h;return((f=o.peerMetadata)==null?void 0:f.url)&&((h=o.peerMetadata)==null?void 0:h.url)===t.peer.metadata.url&&o.topic&&o.topic!==n.topic});if(s.length===0)return;this.client.logger.info(`Cleaning up ${s.length} duplicate pairing(s)`),await Promise.all(s.map(o=>this.client.core.pairing.disconnect({topic:o.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async t=>{var n;const{topic:s,expirerHasDeleted:o=!1,emitEvent:f=!0,id:h=0}=t,{self:p}=this.client.session.get(s);await this.client.core.relayer.unsubscribe(s),await this.client.session.delete(s,It("USER_DISCONNECTED")),this.addToRecentlyDeleted(s,"session"),this.client.core.crypto.keychain.has(p.publicKey)&&await this.client.core.crypto.deleteKeyPair(p.publicKey),this.client.core.crypto.keychain.has(s)&&await this.client.core.crypto.deleteSymKey(s),o||this.client.core.expirer.del(s),this.client.core.storage.removeItem(gp).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===s&&this.deletePendingSessionRequest(l.id,It("USER_DISCONNECTED"))}),s===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=qi.idle),f&&this.client.events.emit("session_delete",{id:h,topic:s})},this.deleteProposal=async(t,n)=>{if(n)try{const s=this.client.proposal.get(t),o=this.client.core.eventClient.getEvent({topic:s.pairingTopic});o==null||o.setError(ns.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(t,It("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"proposal")},this.deletePendingSessionRequest=async(t,n,s=!1)=>{await Promise.all([this.client.pendingRequest.delete(t,n),s?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(o=>o.id!==t),s&&(this.sessionRequestQueue.state=qi.idle,this.client.events.emit("session_request_expire",{id:t}))},this.deletePendingAuthRequest=async(t,n,s=!1)=>{await Promise.all([this.client.auth.requests.delete(t,n),s?Promise.resolve():this.client.core.expirer.del(t)])},this.setExpiry=async(t,n)=>{this.client.session.keys.includes(t)&&(this.client.core.expirer.set(t,n),await this.client.session.update(t,{expiry:n}))},this.setProposal=async(t,n)=>{this.client.core.expirer.set(t,rr(sr.wc_sessionPropose.req.ttl)),await this.client.proposal.set(t,n)},this.setAuthRequest=async(t,n)=>{const{request:s,pairingTopic:o,transportType:f=Nt.relay}=n;this.client.core.expirer.set(t,s.expiryTimestamp),await this.client.auth.requests.set(t,{authPayload:s.authPayload,requester:s.requester,expiryTimestamp:s.expiryTimestamp,id:t,pairingTopic:o,verifyContext:s.verifyContext,transportType:f})},this.setPendingSessionRequest=async t=>{const{id:n,topic:s,params:o,verifyContext:f}=t,h=o.request.expiryTimestamp||rr(sr.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,h),await this.client.pendingRequest.set(n,{id:n,topic:s,params:o,verifyContext:f})},this.sendRequest=async t=>{const{topic:n,method:s,params:o,expiry:f,relayRpcId:h,clientRpcId:p,throwOnFailedPublish:l,appLink:m}=t,_=Dn(s,o,p);let D;const I=!!m;try{const k=I?_a:In;D=await this.client.core.crypto.encode(n,_,{encoding:k})}catch(k){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),k}let M;if(xx.includes(s)){const k=sn(JSON.stringify(_)),X=sn(D);M=await this.client.core.verify.register({id:X,decryptedId:k})}const H=sr[s].req;if(H.attestation=M,f&&(H.ttl=f),h&&(H.id=h),this.client.core.history.set(n,_),I){const k=ic(m,n,D);await Fe.Linking.openURL(k,this.client.name)}else{const k=sr[s].req;f&&(k.ttl=f),h&&(k.id=h),l?(k.internal=xi(Wt({},k.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,D,k)):this.client.core.relayer.publish(n,D,k).catch(X=>this.client.logger.error(X))}return _.id},this.sendResult=async t=>{const{id:n,topic:s,result:o,throwOnFailedPublish:f,encodeOpts:h,appLink:p}=t,l=Yc(n,o);let m;const _=p&&typeof(Fe==null?void 0:Fe.Linking)<"u";try{const I=_?_a:In;m=await this.client.core.crypto.encode(s,l,xi(Wt({},h||{}),{encoding:I}))}catch(I){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${s} failed`),I}let D;try{D=await this.client.core.history.get(s,n)}catch(I){throw this.client.logger.error(`sendResult() -> history.get(${s}, ${n}) failed`),I}if(_){const I=ic(p,s,m);await Fe.Linking.openURL(I,this.client.name)}else{const I=sr[D.request.method].res;f?(I.internal=xi(Wt({},I.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(s,m,I)):this.client.core.relayer.publish(s,m,I).catch(M=>this.client.logger.error(M))}await this.client.core.history.resolve(l)},this.sendError=async t=>{const{id:n,topic:s,error:o,encodeOpts:f,rpcOpts:h,appLink:p}=t,l=Xc(n,o);let m;const _=p&&typeof(Fe==null?void 0:Fe.Linking)<"u";try{const I=_?_a:In;m=await this.client.core.crypto.encode(s,l,xi(Wt({},f||{}),{encoding:I}))}catch(I){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${s} failed`),I}let D;try{D=await this.client.core.history.get(s,n)}catch(I){throw this.client.logger.error(`sendError() -> history.get(${s}, ${n}) failed`),I}if(_){const I=ic(p,s,m);await Fe.Linking.openURL(I,this.client.name)}else{const I=h||sr[D.request.method].res;this.client.core.relayer.publish(s,m,I)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const t=[],n=[];this.client.session.getAll().forEach(s=>{let o=!1;Sn(s.expiry)&&(o=!0),this.client.core.crypto.keychain.has(s.topic)||(o=!0),o&&t.push(s.topic)}),this.client.proposal.getAll().forEach(s=>{Sn(s.expiryTimestamp)&&n.push(s.id)}),await Promise.all([...t.map(s=>this.deleteSession({topic:s})),...n.map(s=>this.deleteProposal(s))])},this.onRelayEventRequest=async t=>{this.requestQueue.queue.push(t),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===qi.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=qi.active;const t=this.requestQueue.queue.shift();if(t)try{await this.processRequest(t)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=qi.idle},this.processRequest=async t=>{const{topic:n,payload:s,attestation:o,transportType:f,encryptedId:h}=t,p=s.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:p}))switch(p){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:s,attestation:o,encryptedId:h});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,s);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,s);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,s);case"wc_sessionPing":return await this.onSessionPingRequest(n,s);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,s);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:s,attestation:o,encryptedId:h,transportType:f});case"wc_sessionEvent":return await this.onSessionEventRequest(n,s);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:s,attestation:o,encryptedId:h,transportType:f});default:return this.client.logger.info(`Unsupported request method ${p}`)}},this.onRelayEventResponse=async t=>{const{topic:n,payload:s,transportType:o}=t,f=(await this.client.core.history.get(n,s.id)).request.method;switch(f){case"wc_sessionPropose":return this.onSessionProposeResponse(n,s,o);case"wc_sessionSettle":return this.onSessionSettleResponse(n,s);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,s);case"wc_sessionExtend":return this.onSessionExtendResponse(n,s);case"wc_sessionPing":return this.onSessionPingResponse(n,s);case"wc_sessionRequest":return this.onSessionRequestResponse(n,s);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,s);default:return this.client.logger.info(`Unsupported response method ${f}`)}},this.onRelayEventUnknownPayload=t=>{const{topic:n}=t,{message:s}=ge("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(s)},this.shouldIgnorePairingRequest=t=>{const{topic:n,requestMethod:s}=t,o=this.expectedPairingMethodMap.get(n);return!o||o.includes(s)?!1:!!(o.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async t=>{const{topic:n,payload:s,attestation:o,encryptedId:f}=t,{params:h,id:p}=s;try{const l=this.client.core.eventClient.getEvent({topic:n});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(rn.proposal_listener_not_found)),this.isValidConnect(Wt({},s.params));const m=h.expiryTimestamp||rr(sr.wc_sessionPropose.req.ttl),_=Wt({id:p,pairingTopic:n,expiryTimestamp:m},h);await this.setProposal(p,_);const D=await this.getVerifyContext({attestationId:o,hash:sn(JSON.stringify(s)),encryptedId:f,metadata:_.proposer.metadata});l==null||l.addTrace(Ui.emit_session_proposal),this.client.events.emit("session_proposal",{id:p,params:_,verifyContext:D})}catch(l){await this.sendError({id:p,topic:n,error:l,rpcOpts:sr.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(t,n,s)=>{const{id:o}=n;if(Bi(n)){const{result:f}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:f});const h=this.client.proposal.get(o);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:h});const p=h.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:p});const l=f.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const m=await this.client.core.crypto.generateSharedKey(p,l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:m});const _=await this.client.core.relayer.subscribe(m,{transportType:s});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:_}),await this.client.core.pairing.activate({topic:t})}else if(fi(n)){await this.client.proposal.delete(o,It("USER_DISCONNECTED"));const f=dt("session_connect");if(this.events.listenerCount(f)===0)throw new Error(`emitting ${f} without any listeners, 954`);this.events.emit(dt("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(t,n)=>{const{id:s,params:o}=n;try{this.isValidSessionSettleRequest(o);const{relay:f,controller:h,expiry:p,namespaces:l,sessionProperties:m,sessionConfig:_}=n.params,D=xi(Wt(Wt({topic:t,relay:f,expiry:p,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:h.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:h.publicKey,metadata:h.metadata}},m&&{sessionProperties:m}),_&&{sessionConfig:_}),{transportType:Nt.relay}),I=dt("session_connect");if(this.events.listenerCount(I)===0)throw new Error(`emitting ${I} without any listeners 997`);this.events.emit(dt("session_connect"),{session:D}),await this.sendResult({id:n.id,topic:t,result:!0,throwOnFailedPublish:!0})}catch(f){await this.sendError({id:s,topic:t,error:f}),this.client.logger.error(f)}},this.onSessionSettleResponse=async(t,n)=>{const{id:s}=n;Bi(n)?(await this.client.session.update(t,{acknowledged:!0}),this.events.emit(dt("session_approve",s),{})):fi(n)&&(await this.client.session.delete(t,It("USER_DISCONNECTED")),this.events.emit(dt("session_approve",s),{error:n.error}))},this.onSessionUpdateRequest=async(t,n)=>{const{params:s,id:o}=n;try{const f=`${t}_session_update`,h=Ea.get(f);if(h&&this.isRequestOutOfSync(h,o)){this.client.logger.warn(`Discarding out of sync request - ${o}`),this.sendError({id:o,topic:t,error:It("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(Wt({topic:t},s));try{Ea.set(f,o),await this.client.session.update(t,{namespaces:s.namespaces}),await this.sendResult({id:o,topic:t,result:!0,throwOnFailedPublish:!0})}catch(p){throw Ea.delete(f),p}this.client.events.emit("session_update",{id:o,topic:t,params:s})}catch(f){await this.sendError({id:o,topic:t,error:f}),this.client.logger.error(f)}},this.isRequestOutOfSync=(t,n)=>n.toString().slice(0,-3)<t.toString().slice(0,-3),this.onSessionUpdateResponse=(t,n)=>{const{id:s}=n,o=dt("session_update",s);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners`);Bi(n)?this.events.emit(dt("session_update",s),{}):fi(n)&&this.events.emit(dt("session_update",s),{error:n.error})},this.onSessionExtendRequest=async(t,n)=>{const{id:s}=n;try{this.isValidExtend({topic:t}),await this.setExpiry(t,rr(zs)),await this.sendResult({id:s,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:s,topic:t})}catch(o){await this.sendError({id:s,topic:t,error:o}),this.client.logger.error(o)}},this.onSessionExtendResponse=(t,n)=>{const{id:s}=n,o=dt("session_extend",s);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners`);Bi(n)?this.events.emit(dt("session_extend",s),{}):fi(n)&&this.events.emit(dt("session_extend",s),{error:n.error})},this.onSessionPingRequest=async(t,n)=>{const{id:s}=n;try{this.isValidPing({topic:t}),await this.sendResult({id:s,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:s,topic:t})}catch(o){await this.sendError({id:s,topic:t,error:o}),this.client.logger.error(o)}},this.onSessionPingResponse=(t,n)=>{const{id:s}=n,o=dt("session_ping",s);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners`);setTimeout(()=>{Bi(n)?this.events.emit(dt("session_ping",s),{}):fi(n)&&this.events.emit(dt("session_ping",s),{error:n.error})},500)},this.onSessionDeleteRequest=async(t,n)=>{const{id:s}=n;try{this.isValidDisconnect({topic:t,reason:n.params}),Promise.all([new Promise(o=>{this.client.core.relayer.once(or.publish,async()=>{o(await this.deleteSession({topic:t,id:s}))})}),this.sendResult({id:s,topic:t,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:t,error:It("USER_DISCONNECTED")})]).catch(o=>this.client.logger.error(o))}catch(o){this.client.logger.error(o)}},this.onSessionRequest=async t=>{var n,s,o;const{topic:f,payload:h,attestation:p,encryptedId:l,transportType:m}=t,{id:_,params:D}=h;try{await this.isValidRequest(Wt({topic:f},D));const I=this.client.session.get(f),M=await this.getVerifyContext({attestationId:p,hash:sn(JSON.stringify(Dn("wc_sessionRequest",D,_))),encryptedId:l,metadata:I.peer.metadata,transportType:m}),H={id:_,topic:f,params:D,verifyContext:M};await this.setPendingSessionRequest(H),m===Nt.link_mode&&(n=I.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((s=I.peer.metadata.redirect)==null?void 0:s.universal),(o=this.client.signConfig)!=null&&o.disableRequestQueue?this.emitSessionRequest(H):(this.addSessionRequestToSessionRequestQueue(H),this.processSessionRequestQueue())}catch(I){await this.sendError({id:_,topic:f,error:I}),this.client.logger.error(I)}},this.onSessionRequestResponse=(t,n)=>{const{id:s}=n,o=dt("session_request",s);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners`);Bi(n)?this.events.emit(dt("session_request",s),{result:n.result}):fi(n)&&this.events.emit(dt("session_request",s),{error:n.error})},this.onSessionEventRequest=async(t,n)=>{const{id:s,params:o}=n;try{const f=`${t}_session_event_${o.event.name}`,h=Ea.get(f);if(h&&this.isRequestOutOfSync(h,s)){this.client.logger.info(`Discarding out of sync request - ${s}`);return}this.isValidEmit(Wt({topic:t},o)),this.client.events.emit("session_event",{id:s,topic:t,params:o}),Ea.set(f,s)}catch(f){await this.sendError({id:s,topic:t,error:f}),this.client.logger.error(f)}},this.onSessionAuthenticateResponse=(t,n)=>{const{id:s}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:t,payload:n}),Bi(n)?this.events.emit(dt("session_request",s),{result:n.result}):fi(n)&&this.events.emit(dt("session_request",s),{error:n.error})},this.onSessionAuthenticateRequest=async t=>{var n;const{topic:s,payload:o,attestation:f,encryptedId:h,transportType:p}=t;try{const{requester:l,authPayload:m,expiryTimestamp:_}=o.params,D=await this.getVerifyContext({attestationId:f,hash:sn(JSON.stringify(o)),encryptedId:h,metadata:l.metadata,transportType:p}),I={requester:l,pairingTopic:s,id:o.id,authPayload:m,verifyContext:D,expiryTimestamp:_};await this.setAuthRequest(o.id,{request:I,pairingTopic:s,transportType:p}),p===Nt.link_mode&&(n=l.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:s,params:o.params,id:o.id,verifyContext:D})}catch(l){this.client.logger.error(l);const m=o.params.requester.publicKey,_=await this.client.core.crypto.generateKeyPair(),D=this.getAppLinkIfEnabled(o.params.requester.metadata,p),I={type:on,receiverPublicKey:m,senderPublicKey:_};await this.sendError({id:o.id,topic:s,error:l,encodeOpts:I,rpcOpts:sr.wc_sessionAuthenticate.autoReject,appLink:D})}},this.addSessionRequestToSessionRequestQueue=t=>{this.sessionRequestQueue.queue.push(t)},this.cleanupAfterResponse=t=>{this.deletePendingSessionRequest(t.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=qi.idle,this.processSessionRequestQueue()},pe.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:t,error:n})=>{const s=this.client.core.history.pending;s.length>0&&s.filter(o=>o.topic===t&&o.request.method==="wc_sessionRequest").forEach(o=>{const f=o.request.id,h=dt("session_request",f);if(this.events.listenerCount(h)===0)throw new Error(`emitting ${h} without any listeners`);this.events.emit(dt("session_request",o.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===qi.active){this.client.logger.info("session request queue is already active.");return}const t=this.sessionRequestQueue.queue[0];if(!t){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=qi.active,this.emitSessionRequest(t)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=t=>{this.client.events.emit("session_request",t)},this.onPairingCreated=t=>{if(t.methods&&this.expectedPairingMethodMap.set(t.topic,t.methods),t.active)return;const n=this.client.proposal.getAll().find(s=>s.pairingTopic===t.topic);n&&this.onSessionProposeRequest({topic:t.topic,payload:Dn("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async t=>{if(!Fr(t)){const{message:p}=ge("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(t)}`);throw new Error(p)}const{pairingTopic:n,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:f,relays:h}=t;if(Pr(n)||await this.isValidPairingTopic(n),!D4(h,!0)){const{message:p}=ge("MISSING_OR_INVALID",`connect() relays: ${h}`);throw new Error(p)}!Pr(s)&&La(s)!==0&&this.validateNamespaces(s,"requiredNamespaces"),!Pr(o)&&La(o)!==0&&this.validateNamespaces(o,"optionalNamespaces"),Pr(f)||this.validateSessionProps(f,"sessionProperties")},this.validateNamespaces=(t,n)=>{const s=I4(t,"connect()",n);if(s)throw new Error(s.message)},this.isValidApprove=async t=>{if(!Fr(t))throw new Error(ge("MISSING_OR_INVALID",`approve() params: ${t}`).message);const{id:n,namespaces:s,relayProtocol:o,sessionProperties:f}=t;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const h=this.client.proposal.get(n),p=Eh(s,"approve()");if(p)throw new Error(p.message);const l=x0(h.requiredNamespaces,s,"approve()");if(l)throw new Error(l.message);if(!Xt(o,!0)){const{message:m}=ge("MISSING_OR_INVALID",`approve() relayProtocol: ${o}`);throw new Error(m)}Pr(f)||this.validateSessionProps(f,"sessionProperties")},this.isValidReject=async t=>{if(!Fr(t)){const{message:o}=ge("MISSING_OR_INVALID",`reject() params: ${t}`);throw new Error(o)}const{id:n,reason:s}=t;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!P4(s)){const{message:o}=ge("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidSessionSettleRequest=t=>{if(!Fr(t)){const{message:l}=ge("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${t}`);throw new Error(l)}const{relay:n,controller:s,namespaces:o,expiry:f}=t;if(!L1(n)){const{message:l}=ge("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const h=y4(s,"onSessionSettleRequest()");if(h)throw new Error(h.message);const p=Eh(o,"onSessionSettleRequest()");if(p)throw new Error(p.message);if(Sn(f)){const{message:l}=ge("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async t=>{if(!Fr(t)){const{message:p}=ge("MISSING_OR_INVALID",`update() params: ${t}`);throw new Error(p)}const{topic:n,namespaces:s}=t;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const o=this.client.session.get(n),f=Eh(s,"update()");if(f)throw new Error(f.message);const h=x0(o.requiredNamespaces,s,"update()");if(h)throw new Error(h.message)},this.isValidExtend=async t=>{if(!Fr(t)){const{message:s}=ge("MISSING_OR_INVALID",`extend() params: ${t}`);throw new Error(s)}const{topic:n}=t;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async t=>{if(!Fr(t)){const{message:p}=ge("MISSING_OR_INVALID",`request() params: ${t}`);throw new Error(p)}const{topic:n,request:s,chainId:o,expiry:f}=t;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:h}=this.client.session.get(n);if(!S0(h,o)){const{message:p}=ge("MISSING_OR_INVALID",`request() chainId: ${o}`);throw new Error(p)}if(!M4(s)){const{message:p}=ge("MISSING_OR_INVALID",`request() ${JSON.stringify(s)}`);throw new Error(p)}if(!R4(h,o,s.method)){const{message:p}=ge("MISSING_OR_INVALID",`request() method: ${s.method}`);throw new Error(p)}if(f&&!L4(f,Oh)){const{message:p}=ge("MISSING_OR_INVALID",`request() expiry: ${f}. Expiry must be a number (in seconds) between ${Oh.min} and ${Oh.max}`);throw new Error(p)}},this.isValidRespond=async t=>{var n;if(!Fr(t)){const{message:f}=ge("MISSING_OR_INVALID",`respond() params: ${t}`);throw new Error(f)}const{topic:s,response:o}=t;try{await this.isValidSessionTopic(s)}catch(f){throw(n=t==null?void 0:t.response)!=null&&n.id&&this.cleanupAfterResponse(t),f}if(!O4(o)){const{message:f}=ge("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(o)}`);throw new Error(f)}},this.isValidPing=async t=>{if(!Fr(t)){const{message:s}=ge("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(s)}const{topic:n}=t;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async t=>{if(!Fr(t)){const{message:h}=ge("MISSING_OR_INVALID",`emit() params: ${t}`);throw new Error(h)}const{topic:n,event:s,chainId:o}=t;await this.isValidSessionTopic(n);const{namespaces:f}=this.client.session.get(n);if(!S0(f,o)){const{message:h}=ge("MISSING_OR_INVALID",`emit() chainId: ${o}`);throw new Error(h)}if(!C4(s)){const{message:h}=ge("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(s)}`);throw new Error(h)}if(!T4(f,o,s.name)){const{message:h}=ge("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(s)}`);throw new Error(h)}},this.isValidDisconnect=async t=>{if(!Fr(t)){const{message:s}=ge("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(s)}const{topic:n}=t;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=t=>{const{chains:n,uri:s,domain:o,nonce:f}=t;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!Xt(s,!1))throw new Error("uri is required parameter");if(!Xt(o,!1))throw new Error("domain is required parameter");if(!Xt(f,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(p=>Ws(p).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:h}=Ws(n[0]);if(h!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async t=>{const{attestationId:n,hash:s,encryptedId:o,metadata:f,transportType:h}=t,p={verified:{verifyUrl:f.verifyUrl||Ca,validation:"UNKNOWN",origin:f.url||""}};try{if(h===Nt.link_mode){const m=this.getAppLinkIfEnabled(f,h);return p.verified.validation=m&&new URL(m).origin===new URL(f.url).origin?"VALID":"INVALID",p}const l=await this.client.core.verify.resolve({attestationId:n,hash:s,encryptedId:o,verifyUrl:f.verifyUrl});l&&(p.verified.origin=l.origin,p.verified.isScam=l.isScam,p.verified.validation=l.origin===new URL(f.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(p)}`),p},this.validateSessionProps=(t,n)=>{Object.values(t).forEach(s=>{if(!Xt(s,!1)){const{message:o}=ge("MISSING_OR_INVALID",`${n} must be in Record<string, string> format. Received: ${JSON.stringify(s)}`);throw new Error(o)}})},this.getPendingAuthRequest=t=>{const n=this.client.auth.requests.get(t);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(t,n)=>{if(this.recentlyDeletedMap.set(t,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let s=0;const o=this.recentlyDeletedLimit/2;for(const f of this.recentlyDeletedMap.keys()){if(s++>=o)break;this.recentlyDeletedMap.delete(f)}}},this.checkRecentlyDeleted=t=>{const n=this.recentlyDeletedMap.get(t);if(n){const{message:s}=ge("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${t}`);throw new Error(s)}},this.isLinkModeEnabled=(t,n)=>{var s,o,f,h,p,l,m,_,D;return!t||n!==Nt.link_mode?!1:((o=(s=this.client.metadata)==null?void 0:s.redirect)==null?void 0:o.linkMode)===!0&&((h=(f=this.client.metadata)==null?void 0:f.redirect)==null?void 0:h.universal)!==void 0&&((l=(p=this.client.metadata)==null?void 0:p.redirect)==null?void 0:l.universal)!==""&&((m=t==null?void 0:t.redirect)==null?void 0:m.universal)!==void 0&&((_=t==null?void 0:t.redirect)==null?void 0:_.universal)!==""&&((D=t==null?void 0:t.redirect)==null?void 0:D.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(t.redirect.universal)&&typeof(Fe==null?void 0:Fe.Linking)<"u"},this.getAppLinkIfEnabled=(t,n)=>{var s;return this.isLinkModeEnabled(t,n)?(s=t==null?void 0:t.redirect)==null?void 0:s.universal:void 0},this.handleLinkModeMessage=({url:t})=>{if(!t||!t.includes("wc_ev")||!t.includes("topic"))return;const n=a0(t,"topic")||"",s=decodeURIComponent(a0(t,"wc_ev")||""),o=this.client.session.keys.includes(n);o&&this.client.session.update(n,{transportType:Nt.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:s,sessionExists:o})},this.registerLinkModeListeners=async()=>{var t;if(gu()||On()&&(t=this.client.metadata.redirect)!=null&&t.linkMode){const n=Fe==null?void 0:Fe.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const s=await n.getInitialURL();s&&setTimeout(()=>{this.handleLinkModeMessage({url:s})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=ge("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(or.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:t,message:n,attestation:s,transportType:o}=e,{publicKey:f}=this.client.auth.authKeys.keys.includes(bc)?this.client.auth.authKeys.get(bc):{responseTopic:void 0,publicKey:void 0},h=await this.client.core.crypto.decode(t,n,{receiverPublicKey:f,encoding:o===Nt.link_mode?_a:In});try{Eu(h)?(this.client.core.history.set(t,h),this.onRelayEventRequest({topic:t,payload:h,attestation:s,transportType:o,encryptedId:sn(n)})):Zc(h)?(await this.client.core.history.resolve(h),await this.onRelayEventResponse({topic:t,payload:h,transportType:o}),this.client.core.history.delete(t,h.id)):this.onRelayEventUnknownPayload({topic:t,payload:h,transportType:o})}catch(p){this.client.logger.error(p)}}registerExpirerEvents(){this.client.core.expirer.on(ci.expired,async e=>{const{topic:t,id:n}=D1(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,ge("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,ge("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(cs.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(cs.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!Xt(e,!1)){const{message:t}=ge("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:t}=ge("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(Sn(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=ge("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!Xt(e,!1)){const{message:t}=ge("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:t}=ge("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(Sn(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:t}=ge("EXPIRED",`session topic: ${e}`);throw new Error(t)}if(!this.client.core.crypto.keychain.has(e)){const{message:t}=ge("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(t)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(Xt(e,!1)){const{message:t}=ge("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}else{const{message:t}=ge("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}async isValidProposalId(e){if(!A4(e)){const{message:t}=ge("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=ge("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(Sn(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:t}=ge("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}}class Lx extends ms{constructor(e,t){super(e,t,wx,Su),this.core=e,this.logger=t}}let Fx=class extends ms{constructor(e,t){super(e,t,_x,Su),this.core=e,this.logger=t}};class qx extends ms{constructor(e,t){super(e,t,Sx,Su,n=>n.id),this.core=e,this.logger=t}}class Ux extends ms{constructor(e,t){super(e,t,Ax,ef,()=>bc),this.core=e,this.logger=t}}class Bx extends ms{constructor(e,t){super(e,t,Px,ef),this.core=e,this.logger=t}}class zx extends ms{constructor(e,t){super(e,t,Mx,ef,n=>n.id),this.core=e,this.logger=t}}class Hx{constructor(e,t){this.core=e,this.logger=t,this.authKeys=new Ux(this.core,this.logger),this.pairingTopics=new Bx(this.core,this.logger),this.requests=new zx(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class xu extends c7{constructor(e){super(e),this.protocol=hg,this.version=ug,this.name=Mh.name,this.events=new ui.EventEmitter,this.on=(n,s)=>this.events.on(n,s),this.once=(n,s)=>this.events.once(n,s),this.off=(n,s)=>this.events.off(n,s),this.removeListener=(n,s)=>this.events.removeListener(n,s),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(s){throw this.logger.error(s.message),s}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(s){throw this.logger.error(s.message),s}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(s){throw this.logger.error(s.message),s}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(s){throw this.logger.error(s.message),s}},this.update=async n=>{try{return await this.engine.update(n)}catch(s){throw this.logger.error(s.message),s}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(s){throw this.logger.error(s.message),s}},this.request=async n=>{try{return await this.engine.request(n)}catch(s){throw this.logger.error(s.message),s}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(s){throw this.logger.error(s.message),s}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(s){throw this.logger.error(s.message),s}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(s){throw this.logger.error(s.message),s}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(s){throw this.logger.error(s.message),s}},this.find=n=>{try{return this.engine.find(n)}catch(s){throw this.logger.error(s.message),s}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,s)=>{try{return await this.engine.authenticate(n,s)}catch(o){throw this.logger.error(o.message),o}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(s){throw this.logger.error(s.message),s}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(s){throw this.logger.error(s.message),s}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(s){throw this.logger.error(s.message),s}},this.name=(e==null?void 0:e.name)||Mh.name,this.metadata=(e==null?void 0:e.metadata)||_1(),this.signConfig=e==null?void 0:e.signConfig;const t=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Xa(Jc({level:(e==null?void 0:e.logger)||Mh.logger}));this.core=(e==null?void 0:e.core)||new yx(e),this.logger=Or(t,this.name),this.session=new Fx(this.core,this.logger),this.proposal=new Lx(this.core,this.logger),this.pendingRequest=new qx(this.core,this.logger),this.engine=new $x(this),this.auth=new Hx(this.core,this.logger)}static async init(e){const t=new xu(e);return await t.initialize(),t}get context(){return Ur(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),setTimeout(()=>{this.engine.processRelayMessageCache()},pe.toMiliseconds(pe.ONE_SECOND))}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var Rc={exports:{}};/**
|
|
24
|
-
* @license
|
|
25
|
-
* Lodash <https://lodash.com/>
|
|
26
|
-
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
27
|
-
* Released under MIT license <https://lodash.com/license>
|
|
28
|
-
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
29
|
-
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
30
|
-
*/Rc.exports;(function(r,e){(function(){var t,n="4.17.21",s=200,o="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",f="Expected a function",h="Invalid `variable` option passed into `_.template`",p="__lodash_hash_undefined__",l=500,m="__lodash_placeholder__",_=1,D=2,I=4,M=1,H=2,k=1,X=2,F=4,V=8,$=16,U=32,z=64,b=128,T=256,re=512,de=30,L="...",u=800,y=16,w=1,E=2,O=3,N=1/0,R=9007199254740991,x=17976931348623157e292,d=0/0,A=4294967295,fe=A-1,ee=A>>>1,he=[["ary",b],["bind",k],["bindKey",X],["curry",V],["curryRight",$],["flip",re],["partial",U],["partialRight",z],["rearg",T]],ne="[object Arguments]",be="[object Array]",G="[object AsyncFunction]",Z="[object Boolean]",K="[object Date]",v="[object DOMException]",j="[object Error]",oe="[object Function]",le="[object GeneratorFunction]",Te="[object Map]",Ae="[object Number]",Me="[object Null]",je="[object Object]",qe="[object Promise]",Ue="[object Proxy]",ke="[object RegExp]",ye="[object Set]",Ie="[object String]",Be="[object Symbol]",De="[object Undefined]",Se="[object WeakMap]",ze="[object WeakSet]",me="[object ArrayBuffer]",xe="[object DataView]",Qe="[object Float32Array]",_e="[object Float64Array]",Oe="[object Int8Array]",ct="[object Int16Array]",Ce="[object Int32Array]",Re="[object Uint8Array]",ht="[object Uint8ClampedArray]",lt="[object Uint16Array]",bt="[object Uint32Array]",Br=/\b__p \+= '';/g,pt=/\b(__p \+=) '' \+/g,_t=/(__e\(.*?\)|\b__t\)) \+\n'';/g,bi=/&(?:amp|lt|gt|quot|#39);/g,Dt=/[&<>"']/g,We=RegExp(bi.source),Pt=RegExp(Dt.source),Ve=/<%-([\s\S]+?)%>/g,Ge=/<%([\s\S]+?)%>/g,Tt=/<%=([\s\S]+?)%>/g,He=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,rt=/^\w*$/,jt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Je=/[\\^$.*+?()[\]{}|]/g,it=RegExp(Je.source),Ft=/^\s+/,et=/\s/,Ye=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,St=/\{\n\/\* \[wrapped with (.+)\] \*/,nt=/,? & /,st=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ws=/[()=,{}\[\]\/\s]/,Bt=/\\(\\)?/g,zt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,vr=/\w*$/,Cn=/^[-+]0x[0-9a-f]+$/i,Rn=/^0b[01]+$/i,Tn=/^\[object .+?Constructor\]$/,Nn=/^0o[0-7]+$/i,$n=/^(?:0|[1-9]\d*)$/,zr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Mi=/($^)/,Ln=/['\n\r\u2028\u2029\\]/g,Oi="\\ud800-\\udfff",Fn="\\u0300-\\u036f",qn="\\ufe20-\\ufe2f",Ci="\\u20d0-\\u20ff",un=Fn+qn+Ci,dn="\\u2700-\\u27bf",Sr="a-z\\xdf-\\xf6\\xf8-\\xff",Un="\\xac\\xb1\\xd7\\xf7",Bn="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",zn="\\u2000-\\u206f",tf=" \\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",eo="A-Z\\xc0-\\xd6\\xd8-\\xde",to="\\ufe0e\\ufe0f",Hn=Un+Bn+zn+tf,ea="['’]",jn="["+Oi+"]",ta="["+Hn+"]",Kn="["+un+"]",ro="\\d+",rf="["+dn+"]",io="["+Sr+"]",no="[^"+Oi+Hn+ro+dn+Sr+eo+"]",_s="\\ud83c[\\udffb-\\udfff]",nf="(?:"+Kn+"|"+_s+")",so="[^"+Oi+"]",Es="(?:\\ud83c[\\udde6-\\uddff]){2}",ln="[\\ud800-\\udbff][\\udc00-\\udfff]",Hr="["+eo+"]",ao="\\u200d",oo="(?:"+io+"|"+no+")",Ri="(?:"+Hr+"|"+no+")",co="(?:"+ea+"(?:d|ll|m|re|s|t|ve))?",fo="(?:"+ea+"(?:D|LL|M|RE|S|T|VE))?",ho=nf+"?",uo="["+to+"]?",sf="(?:"+ao+"(?:"+[so,Es,ln].join("|")+")"+uo+ho+")*",Ki="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",lo="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",po=uo+ho+sf,Ss="(?:"+[rf,Es,ln].join("|")+")"+po,af="(?:"+[so+Kn+"?",Kn,Es,ln,jn].join("|")+")",ra=RegExp(ea,"g"),of=RegExp(Kn,"g"),xs=RegExp(_s+"(?="+_s+")|"+af+po,"g"),go=RegExp([Hr+"?"+io+"+"+co+"(?="+[ta,Hr,"$"].join("|")+")",Ri+"+"+fo+"(?="+[ta,Hr+oo,"$"].join("|")+")",Hr+"?"+oo+"+"+co,Hr+"+"+fo,lo,Ki,ro,Ss].join("|"),"g"),bo=RegExp("["+ao+Oi+un+to+"]"),kn=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,vo=["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"],cf=-1,Mt={};Mt[Qe]=Mt[_e]=Mt[Oe]=Mt[ct]=Mt[Ce]=Mt[Re]=Mt[ht]=Mt[lt]=Mt[bt]=!0,Mt[ne]=Mt[be]=Mt[me]=Mt[Z]=Mt[xe]=Mt[K]=Mt[j]=Mt[oe]=Mt[Te]=Mt[Ae]=Mt[je]=Mt[ke]=Mt[ye]=Mt[Ie]=Mt[Se]=!1;var At={};At[ne]=At[be]=At[me]=At[xe]=At[Z]=At[K]=At[Qe]=At[_e]=At[Oe]=At[ct]=At[Ce]=At[Te]=At[Ae]=At[je]=At[ke]=At[ye]=At[Ie]=At[Be]=At[Re]=At[ht]=At[lt]=At[bt]=!0,At[j]=At[oe]=At[Se]=!1;var q={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Y={"&":"&","<":"<",">":">",'"':""","'":"'"},ce={"&":"&","<":"<",">":">",""":'"',"'":"'"},we={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ot=parseFloat,Xe=parseInt,qt=typeof _r=="object"&&_r&&_r.Object===Object&&_r,Zt=typeof self=="object"&&self&&self.Object===Object&&self,vt=qt||Zt||Function("return this")(),Ct=e&&!e.nodeType&&e,Gt=Ct&&!0&&r&&!r.nodeType&&r,Cr=Gt&&Gt.exports===Ct,Qt=Cr&&qt.process,Ut=function(){try{var J=Gt&&Gt.require&&Gt.require("util").types;return J||Qt&&Qt.binding&&Qt.binding("util")}catch{}}(),xr=Ut&&Ut.isArrayBuffer,vi=Ut&&Ut.isDate,Qr=Ut&&Ut.isMap,Ti=Ut&&Ut.isRegExp,ia=Ut&&Ut.isSet,Wn=Ut&&Ut.isTypedArray;function ir(J,ie,te){switch(te.length){case 0:return J.call(ie);case 1:return J.call(ie,te[0]);case 2:return J.call(ie,te[0],te[1]);case 3:return J.call(ie,te[0],te[1],te[2])}return J.apply(ie,te)}function mg(J,ie,te,Ee){for(var Ke=-1,wt=J==null?0:J.length;++Ke<wt;){var er=J[Ke];ie(Ee,er,te(er),J)}return Ee}function ei(J,ie){for(var te=-1,Ee=J==null?0:J.length;++te<Ee&&ie(J[te],te,J)!==!1;);return J}function yg(J,ie){for(var te=J==null?0:J.length;te--&&ie(J[te],te,J)!==!1;);return J}function Du(J,ie){for(var te=-1,Ee=J==null?0:J.length;++te<Ee;)if(!ie(J[te],te,J))return!1;return!0}function pn(J,ie){for(var te=-1,Ee=J==null?0:J.length,Ke=0,wt=[];++te<Ee;){var er=J[te];ie(er,te,J)&&(wt[Ke++]=er)}return wt}function mo(J,ie){var te=J==null?0:J.length;return!!te&&Is(J,ie,0)>-1}function ff(J,ie,te){for(var Ee=-1,Ke=J==null?0:J.length;++Ee<Ke;)if(te(ie,J[Ee]))return!0;return!1}function Ht(J,ie){for(var te=-1,Ee=J==null?0:J.length,Ke=Array(Ee);++te<Ee;)Ke[te]=ie(J[te],te,J);return Ke}function gn(J,ie){for(var te=-1,Ee=ie.length,Ke=J.length;++te<Ee;)J[Ke+te]=ie[te];return J}function hf(J,ie,te,Ee){var Ke=-1,wt=J==null?0:J.length;for(Ee&&wt&&(te=J[++Ke]);++Ke<wt;)te=ie(te,J[Ke],Ke,J);return te}function wg(J,ie,te,Ee){var Ke=J==null?0:J.length;for(Ee&&Ke&&(te=J[--Ke]);Ke--;)te=ie(te,J[Ke],Ke,J);return te}function uf(J,ie){for(var te=-1,Ee=J==null?0:J.length;++te<Ee;)if(ie(J[te],te,J))return!0;return!1}var _g=df("length");function Eg(J){return J.split("")}function Sg(J){return J.match(st)||[]}function Au(J,ie,te){var Ee;return te(J,function(Ke,wt,er){if(ie(Ke,wt,er))return Ee=wt,!1}),Ee}function yo(J,ie,te,Ee){for(var Ke=J.length,wt=te+(Ee?1:-1);Ee?wt--:++wt<Ke;)if(ie(J[wt],wt,J))return wt;return-1}function Is(J,ie,te){return ie===ie?$g(J,ie,te):yo(J,Pu,te)}function xg(J,ie,te,Ee){for(var Ke=te-1,wt=J.length;++Ke<wt;)if(Ee(J[Ke],ie))return Ke;return-1}function Pu(J){return J!==J}function Mu(J,ie){var te=J==null?0:J.length;return te?pf(J,ie)/te:d}function df(J){return function(ie){return ie==null?t:ie[J]}}function lf(J){return function(ie){return J==null?t:J[ie]}}function Ou(J,ie,te,Ee,Ke){return Ke(J,function(wt,er,Rt){te=Ee?(Ee=!1,wt):ie(te,wt,er,Rt)}),te}function Ig(J,ie){var te=J.length;for(J.sort(ie);te--;)J[te]=J[te].value;return J}function pf(J,ie){for(var te,Ee=-1,Ke=J.length;++Ee<Ke;){var wt=ie(J[Ee]);wt!==t&&(te=te===t?wt:te+wt)}return te}function gf(J,ie){for(var te=-1,Ee=Array(J);++te<J;)Ee[te]=ie(te);return Ee}function Dg(J,ie){return Ht(ie,function(te){return[te,J[te]]})}function Cu(J){return J&&J.slice(0,$u(J)+1).replace(Ft,"")}function jr(J){return function(ie){return J(ie)}}function bf(J,ie){return Ht(ie,function(te){return J[te]})}function na(J,ie){return J.has(ie)}function Ru(J,ie){for(var te=-1,Ee=J.length;++te<Ee&&Is(ie,J[te],0)>-1;);return te}function Tu(J,ie){for(var te=J.length;te--&&Is(ie,J[te],0)>-1;);return te}function Ag(J,ie){for(var te=J.length,Ee=0;te--;)J[te]===ie&&++Ee;return Ee}var Pg=lf(q),Mg=lf(Y);function Og(J){return"\\"+we[J]}function Cg(J,ie){return J==null?t:J[ie]}function Ds(J){return bo.test(J)}function Rg(J){return kn.test(J)}function Tg(J){for(var ie,te=[];!(ie=J.next()).done;)te.push(ie.value);return te}function vf(J){var ie=-1,te=Array(J.size);return J.forEach(function(Ee,Ke){te[++ie]=[Ke,Ee]}),te}function Nu(J,ie){return function(te){return J(ie(te))}}function bn(J,ie){for(var te=-1,Ee=J.length,Ke=0,wt=[];++te<Ee;){var er=J[te];(er===ie||er===m)&&(J[te]=m,wt[Ke++]=te)}return wt}function wo(J){var ie=-1,te=Array(J.size);return J.forEach(function(Ee){te[++ie]=Ee}),te}function Ng(J){var ie=-1,te=Array(J.size);return J.forEach(function(Ee){te[++ie]=[Ee,Ee]}),te}function $g(J,ie,te){for(var Ee=te-1,Ke=J.length;++Ee<Ke;)if(J[Ee]===ie)return Ee;return-1}function Lg(J,ie,te){for(var Ee=te+1;Ee--;)if(J[Ee]===ie)return Ee;return Ee}function As(J){return Ds(J)?qg(J):_g(J)}function mi(J){return Ds(J)?Ug(J):Eg(J)}function $u(J){for(var ie=J.length;ie--&&et.test(J.charAt(ie)););return ie}var Fg=lf(ce);function qg(J){for(var ie=xs.lastIndex=0;xs.test(J);)++ie;return ie}function Ug(J){return J.match(xs)||[]}function Bg(J){return J.match(go)||[]}var zg=function J(ie){ie=ie==null?vt:Ps.defaults(vt.Object(),ie,Ps.pick(vt,vo));var te=ie.Array,Ee=ie.Date,Ke=ie.Error,wt=ie.Function,er=ie.Math,Rt=ie.Object,mf=ie.RegExp,Hg=ie.String,ti=ie.TypeError,_o=te.prototype,jg=wt.prototype,Ms=Rt.prototype,Eo=ie["__core-js_shared__"],So=jg.toString,xt=Ms.hasOwnProperty,Kg=0,Lu=function(){var i=/[^.]+$/.exec(Eo&&Eo.keys&&Eo.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}(),xo=Ms.toString,kg=So.call(Rt),Wg=vt._,Vg=mf("^"+So.call(xt).replace(Je,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Io=Cr?ie.Buffer:t,vn=ie.Symbol,Do=ie.Uint8Array,Fu=Io?Io.allocUnsafe:t,Ao=Nu(Rt.getPrototypeOf,Rt),qu=Rt.create,Uu=Ms.propertyIsEnumerable,Po=_o.splice,Bu=vn?vn.isConcatSpreadable:t,sa=vn?vn.iterator:t,Vn=vn?vn.toStringTag:t,Mo=function(){try{var i=Zn(Rt,"defineProperty");return i({},"",{}),i}catch{}}(),Gg=ie.clearTimeout!==vt.clearTimeout&&ie.clearTimeout,Jg=Ee&&Ee.now!==vt.Date.now&&Ee.now,Yg=ie.setTimeout!==vt.setTimeout&&ie.setTimeout,Oo=er.ceil,Co=er.floor,yf=Rt.getOwnPropertySymbols,Xg=Io?Io.isBuffer:t,zu=ie.isFinite,Zg=_o.join,Qg=Nu(Rt.keys,Rt),tr=er.max,mr=er.min,eb=Ee.now,tb=ie.parseInt,Hu=er.random,rb=_o.reverse,wf=Zn(ie,"DataView"),aa=Zn(ie,"Map"),_f=Zn(ie,"Promise"),Os=Zn(ie,"Set"),oa=Zn(ie,"WeakMap"),ca=Zn(Rt,"create"),Ro=oa&&new oa,Cs={},ib=Qn(wf),nb=Qn(aa),sb=Qn(_f),ab=Qn(Os),ob=Qn(oa),To=vn?vn.prototype:t,fa=To?To.valueOf:t,ju=To?To.toString:t;function P(i){if(kt(i)&&!Ze(i)&&!(i instanceof gt)){if(i instanceof ri)return i;if(xt.call(i,"__wrapped__"))return Kd(i)}return new ri(i)}var Rs=function(){function i(){}return function(a){if(!Kt(a))return{};if(qu)return qu(a);i.prototype=a;var c=new i;return i.prototype=t,c}}();function No(){}function ri(i,a){this.__wrapped__=i,this.__actions__=[],this.__chain__=!!a,this.__index__=0,this.__values__=t}P.templateSettings={escape:Ve,evaluate:Ge,interpolate:Tt,variable:"",imports:{_:P}},P.prototype=No.prototype,P.prototype.constructor=P,ri.prototype=Rs(No.prototype),ri.prototype.constructor=ri;function gt(i){this.__wrapped__=i,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=A,this.__views__=[]}function cb(){var i=new gt(this.__wrapped__);return i.__actions__=Rr(this.__actions__),i.__dir__=this.__dir__,i.__filtered__=this.__filtered__,i.__iteratees__=Rr(this.__iteratees__),i.__takeCount__=this.__takeCount__,i.__views__=Rr(this.__views__),i}function fb(){if(this.__filtered__){var i=new gt(this);i.__dir__=-1,i.__filtered__=!0}else i=this.clone(),i.__dir__*=-1;return i}function hb(){var i=this.__wrapped__.value(),a=this.__dir__,c=Ze(i),g=a<0,S=c?i.length:0,C=Ev(0,S,this.__views__),B=C.start,W=C.end,Q=W-B,se=g?W:B-1,ae=this.__iteratees__,ue=ae.length,ve=0,Pe=mr(Q,this.__takeCount__);if(!c||!g&&S==Q&&Pe==Q)return ld(i,this.__actions__);var $e=[];e:for(;Q--&&ve<Pe;){se+=a;for(var ot=-1,Le=i[se];++ot<ue;){var ut=ae[ot],mt=ut.iteratee,Wr=ut.type,Ar=mt(Le);if(Wr==E)Le=Ar;else if(!Ar){if(Wr==w)continue e;break e}}$e[ve++]=Le}return $e}gt.prototype=Rs(No.prototype),gt.prototype.constructor=gt;function Gn(i){var a=-1,c=i==null?0:i.length;for(this.clear();++a<c;){var g=i[a];this.set(g[0],g[1])}}function ub(){this.__data__=ca?ca(null):{},this.size=0}function db(i){var a=this.has(i)&&delete this.__data__[i];return this.size-=a?1:0,a}function lb(i){var a=this.__data__;if(ca){var c=a[i];return c===p?t:c}return xt.call(a,i)?a[i]:t}function pb(i){var a=this.__data__;return ca?a[i]!==t:xt.call(a,i)}function gb(i,a){var c=this.__data__;return this.size+=this.has(i)?0:1,c[i]=ca&&a===t?p:a,this}Gn.prototype.clear=ub,Gn.prototype.delete=db,Gn.prototype.get=lb,Gn.prototype.has=pb,Gn.prototype.set=gb;function ki(i){var a=-1,c=i==null?0:i.length;for(this.clear();++a<c;){var g=i[a];this.set(g[0],g[1])}}function bb(){this.__data__=[],this.size=0}function vb(i){var a=this.__data__,c=$o(a,i);if(c<0)return!1;var g=a.length-1;return c==g?a.pop():Po.call(a,c,1),--this.size,!0}function mb(i){var a=this.__data__,c=$o(a,i);return c<0?t:a[c][1]}function yb(i){return $o(this.__data__,i)>-1}function wb(i,a){var c=this.__data__,g=$o(c,i);return g<0?(++this.size,c.push([i,a])):c[g][1]=a,this}ki.prototype.clear=bb,ki.prototype.delete=vb,ki.prototype.get=mb,ki.prototype.has=yb,ki.prototype.set=wb;function Wi(i){var a=-1,c=i==null?0:i.length;for(this.clear();++a<c;){var g=i[a];this.set(g[0],g[1])}}function _b(){this.size=0,this.__data__={hash:new Gn,map:new(aa||ki),string:new Gn}}function Eb(i){var a=Vo(this,i).delete(i);return this.size-=a?1:0,a}function Sb(i){return Vo(this,i).get(i)}function xb(i){return Vo(this,i).has(i)}function Ib(i,a){var c=Vo(this,i),g=c.size;return c.set(i,a),this.size+=c.size==g?0:1,this}Wi.prototype.clear=_b,Wi.prototype.delete=Eb,Wi.prototype.get=Sb,Wi.prototype.has=xb,Wi.prototype.set=Ib;function Jn(i){var a=-1,c=i==null?0:i.length;for(this.__data__=new Wi;++a<c;)this.add(i[a])}function Db(i){return this.__data__.set(i,p),this}function Ab(i){return this.__data__.has(i)}Jn.prototype.add=Jn.prototype.push=Db,Jn.prototype.has=Ab;function yi(i){var a=this.__data__=new ki(i);this.size=a.size}function Pb(){this.__data__=new ki,this.size=0}function Mb(i){var a=this.__data__,c=a.delete(i);return this.size=a.size,c}function Ob(i){return this.__data__.get(i)}function Cb(i){return this.__data__.has(i)}function Rb(i,a){var c=this.__data__;if(c instanceof ki){var g=c.__data__;if(!aa||g.length<s-1)return g.push([i,a]),this.size=++c.size,this;c=this.__data__=new Wi(g)}return c.set(i,a),this.size=c.size,this}yi.prototype.clear=Pb,yi.prototype.delete=Mb,yi.prototype.get=Ob,yi.prototype.has=Cb,yi.prototype.set=Rb;function Ku(i,a){var c=Ze(i),g=!c&&es(i),S=!c&&!g&&En(i),C=!c&&!g&&!S&&Ls(i),B=c||g||S||C,W=B?gf(i.length,Hg):[],Q=W.length;for(var se in i)(a||xt.call(i,se))&&!(B&&(se=="length"||S&&(se=="offset"||se=="parent")||C&&(se=="buffer"||se=="byteLength"||se=="byteOffset")||Yi(se,Q)))&&W.push(se);return W}function ku(i){var a=i.length;return a?i[Rf(0,a-1)]:t}function Tb(i,a){return Go(Rr(i),Yn(a,0,i.length))}function Nb(i){return Go(Rr(i))}function Ef(i,a,c){(c!==t&&!wi(i[a],c)||c===t&&!(a in i))&&Vi(i,a,c)}function ha(i,a,c){var g=i[a];(!(xt.call(i,a)&&wi(g,c))||c===t&&!(a in i))&&Vi(i,a,c)}function $o(i,a){for(var c=i.length;c--;)if(wi(i[c][0],a))return c;return-1}function $b(i,a,c,g){return mn(i,function(S,C,B){a(g,S,c(S),B)}),g}function Wu(i,a){return i&&$i(a,nr(a),i)}function Lb(i,a){return i&&$i(a,Nr(a),i)}function Vi(i,a,c){a=="__proto__"&&Mo?Mo(i,a,{configurable:!0,enumerable:!0,value:c,writable:!0}):i[a]=c}function Sf(i,a){for(var c=-1,g=a.length,S=te(g),C=i==null;++c<g;)S[c]=C?t:ih(i,a[c]);return S}function Yn(i,a,c){return i===i&&(c!==t&&(i=i<=c?i:c),a!==t&&(i=i>=a?i:a)),i}function ii(i,a,c,g,S,C){var B,W=a&_,Q=a&D,se=a&I;if(c&&(B=S?c(i,g,S,C):c(i)),B!==t)return B;if(!Kt(i))return i;var ae=Ze(i);if(ae){if(B=xv(i),!W)return Rr(i,B)}else{var ue=yr(i),ve=ue==oe||ue==le;if(En(i))return bd(i,W);if(ue==je||ue==ne||ve&&!S){if(B=Q||ve?{}:$d(i),!W)return Q?lv(i,Lb(B,i)):dv(i,Wu(B,i))}else{if(!At[ue])return S?i:{};B=Iv(i,ue,W)}}C||(C=new yi);var Pe=C.get(i);if(Pe)return Pe;C.set(i,B),hl(i)?i.forEach(function(Le){B.add(ii(Le,a,c,Le,i,C))}):cl(i)&&i.forEach(function(Le,ut){B.set(ut,ii(Le,a,c,ut,i,C))});var $e=se?Q?jf:Hf:Q?Nr:nr,ot=ae?t:$e(i);return ei(ot||i,function(Le,ut){ot&&(ut=Le,Le=i[ut]),ha(B,ut,ii(Le,a,c,ut,i,C))}),B}function Fb(i){var a=nr(i);return function(c){return Vu(c,i,a)}}function Vu(i,a,c){var g=c.length;if(i==null)return!g;for(i=Rt(i);g--;){var S=c[g],C=a[S],B=i[S];if(B===t&&!(S in i)||!C(B))return!1}return!0}function Gu(i,a,c){if(typeof i!="function")throw new ti(f);return va(function(){i.apply(t,c)},a)}function ua(i,a,c,g){var S=-1,C=mo,B=!0,W=i.length,Q=[],se=a.length;if(!W)return Q;c&&(a=Ht(a,jr(c))),g?(C=ff,B=!1):a.length>=s&&(C=na,B=!1,a=new Jn(a));e:for(;++S<W;){var ae=i[S],ue=c==null?ae:c(ae);if(ae=g||ae!==0?ae:0,B&&ue===ue){for(var ve=se;ve--;)if(a[ve]===ue)continue e;Q.push(ae)}else C(a,ue,g)||Q.push(ae)}return Q}var mn=_d(Ni),Ju=_d(If,!0);function qb(i,a){var c=!0;return mn(i,function(g,S,C){return c=!!a(g,S,C),c}),c}function Lo(i,a,c){for(var g=-1,S=i.length;++g<S;){var C=i[g],B=a(C);if(B!=null&&(W===t?B===B&&!kr(B):c(B,W)))var W=B,Q=C}return Q}function Ub(i,a,c,g){var S=i.length;for(c=at(c),c<0&&(c=-c>S?0:S+c),g=g===t||g>S?S:at(g),g<0&&(g+=S),g=c>g?0:dl(g);c<g;)i[c++]=a;return i}function Yu(i,a){var c=[];return mn(i,function(g,S,C){a(g,S,C)&&c.push(g)}),c}function lr(i,a,c,g,S){var C=-1,B=i.length;for(c||(c=Av),S||(S=[]);++C<B;){var W=i[C];a>0&&c(W)?a>1?lr(W,a-1,c,g,S):gn(S,W):g||(S[S.length]=W)}return S}var xf=Ed(),Xu=Ed(!0);function Ni(i,a){return i&&xf(i,a,nr)}function If(i,a){return i&&Xu(i,a,nr)}function Fo(i,a){return pn(a,function(c){return Xi(i[c])})}function Xn(i,a){a=wn(a,i);for(var c=0,g=a.length;i!=null&&c<g;)i=i[Li(a[c++])];return c&&c==g?i:t}function Zu(i,a,c){var g=a(i);return Ze(i)?g:gn(g,c(i))}function Ir(i){return i==null?i===t?De:Me:Vn&&Vn in Rt(i)?_v(i):Nv(i)}function Df(i,a){return i>a}function Bb(i,a){return i!=null&&xt.call(i,a)}function zb(i,a){return i!=null&&a in Rt(i)}function Hb(i,a,c){return i>=mr(a,c)&&i<tr(a,c)}function Af(i,a,c){for(var g=c?ff:mo,S=i[0].length,C=i.length,B=C,W=te(C),Q=1/0,se=[];B--;){var ae=i[B];B&&a&&(ae=Ht(ae,jr(a))),Q=mr(ae.length,Q),W[B]=!c&&(a||S>=120&&ae.length>=120)?new Jn(B&&ae):t}ae=i[0];var ue=-1,ve=W[0];e:for(;++ue<S&&se.length<Q;){var Pe=ae[ue],$e=a?a(Pe):Pe;if(Pe=c||Pe!==0?Pe:0,!(ve?na(ve,$e):g(se,$e,c))){for(B=C;--B;){var ot=W[B];if(!(ot?na(ot,$e):g(i[B],$e,c)))continue e}ve&&ve.push($e),se.push(Pe)}}return se}function jb(i,a,c,g){return Ni(i,function(S,C,B){a(g,c(S),C,B)}),g}function da(i,a,c){a=wn(a,i),i=Ud(i,a);var g=i==null?i:i[Li(si(a))];return g==null?t:ir(g,i,c)}function Qu(i){return kt(i)&&Ir(i)==ne}function Kb(i){return kt(i)&&Ir(i)==me}function kb(i){return kt(i)&&Ir(i)==K}function la(i,a,c,g,S){return i===a?!0:i==null||a==null||!kt(i)&&!kt(a)?i!==i&&a!==a:Wb(i,a,c,g,la,S)}function Wb(i,a,c,g,S,C){var B=Ze(i),W=Ze(a),Q=B?be:yr(i),se=W?be:yr(a);Q=Q==ne?je:Q,se=se==ne?je:se;var ae=Q==je,ue=se==je,ve=Q==se;if(ve&&En(i)){if(!En(a))return!1;B=!0,ae=!1}if(ve&&!ae)return C||(C=new yi),B||Ls(i)?Rd(i,a,c,g,S,C):yv(i,a,Q,c,g,S,C);if(!(c&M)){var Pe=ae&&xt.call(i,"__wrapped__"),$e=ue&&xt.call(a,"__wrapped__");if(Pe||$e){var ot=Pe?i.value():i,Le=$e?a.value():a;return C||(C=new yi),S(ot,Le,c,g,C)}}return ve?(C||(C=new yi),wv(i,a,c,g,S,C)):!1}function Vb(i){return kt(i)&&yr(i)==Te}function Pf(i,a,c,g){var S=c.length,C=S,B=!g;if(i==null)return!C;for(i=Rt(i);S--;){var W=c[S];if(B&&W[2]?W[1]!==i[W[0]]:!(W[0]in i))return!1}for(;++S<C;){W=c[S];var Q=W[0],se=i[Q],ae=W[1];if(B&&W[2]){if(se===t&&!(Q in i))return!1}else{var ue=new yi;if(g)var ve=g(se,ae,Q,i,a,ue);if(!(ve===t?la(ae,se,M|H,g,ue):ve))return!1}}return!0}function ed(i){if(!Kt(i)||Mv(i))return!1;var a=Xi(i)?Vg:Tn;return a.test(Qn(i))}function Gb(i){return kt(i)&&Ir(i)==ke}function Jb(i){return kt(i)&&yr(i)==ye}function Yb(i){return kt(i)&&ec(i.length)&&!!Mt[Ir(i)]}function td(i){return typeof i=="function"?i:i==null?$r:typeof i=="object"?Ze(i)?nd(i[0],i[1]):id(i):Sl(i)}function Mf(i){if(!ba(i))return Qg(i);var a=[];for(var c in Rt(i))xt.call(i,c)&&c!="constructor"&&a.push(c);return a}function Xb(i){if(!Kt(i))return Tv(i);var a=ba(i),c=[];for(var g in i)g=="constructor"&&(a||!xt.call(i,g))||c.push(g);return c}function Of(i,a){return i<a}function rd(i,a){var c=-1,g=Tr(i)?te(i.length):[];return mn(i,function(S,C,B){g[++c]=a(S,C,B)}),g}function id(i){var a=kf(i);return a.length==1&&a[0][2]?Fd(a[0][0],a[0][1]):function(c){return c===i||Pf(c,i,a)}}function nd(i,a){return Vf(i)&&Ld(a)?Fd(Li(i),a):function(c){var g=ih(c,i);return g===t&&g===a?nh(c,i):la(a,g,M|H)}}function qo(i,a,c,g,S){i!==a&&xf(a,function(C,B){if(S||(S=new yi),Kt(C))Zb(i,a,B,c,qo,g,S);else{var W=g?g(Jf(i,B),C,B+"",i,a,S):t;W===t&&(W=C),Ef(i,B,W)}},Nr)}function Zb(i,a,c,g,S,C,B){var W=Jf(i,c),Q=Jf(a,c),se=B.get(Q);if(se){Ef(i,c,se);return}var ae=C?C(W,Q,c+"",i,a,B):t,ue=ae===t;if(ue){var ve=Ze(Q),Pe=!ve&&En(Q),$e=!ve&&!Pe&&Ls(Q);ae=Q,ve||Pe||$e?Ze(W)?ae=W:Jt(W)?ae=Rr(W):Pe?(ue=!1,ae=bd(Q,!0)):$e?(ue=!1,ae=vd(Q,!0)):ae=[]:ma(Q)||es(Q)?(ae=W,es(W)?ae=ll(W):(!Kt(W)||Xi(W))&&(ae=$d(Q))):ue=!1}ue&&(B.set(Q,ae),S(ae,Q,g,C,B),B.delete(Q)),Ef(i,c,ae)}function sd(i,a){var c=i.length;if(c)return a+=a<0?c:0,Yi(a,c)?i[a]:t}function ad(i,a,c){a.length?a=Ht(a,function(C){return Ze(C)?function(B){return Xn(B,C.length===1?C[0]:C)}:C}):a=[$r];var g=-1;a=Ht(a,jr(Ne()));var S=rd(i,function(C,B,W){var Q=Ht(a,function(se){return se(C)});return{criteria:Q,index:++g,value:C}});return Ig(S,function(C,B){return uv(C,B,c)})}function Qb(i,a){return od(i,a,function(c,g){return nh(i,g)})}function od(i,a,c){for(var g=-1,S=a.length,C={};++g<S;){var B=a[g],W=Xn(i,B);c(W,B)&&pa(C,wn(B,i),W)}return C}function ev(i){return function(a){return Xn(a,i)}}function Cf(i,a,c,g){var S=g?xg:Is,C=-1,B=a.length,W=i;for(i===a&&(a=Rr(a)),c&&(W=Ht(i,jr(c)));++C<B;)for(var Q=0,se=a[C],ae=c?c(se):se;(Q=S(W,ae,Q,g))>-1;)W!==i&&Po.call(W,Q,1),Po.call(i,Q,1);return i}function cd(i,a){for(var c=i?a.length:0,g=c-1;c--;){var S=a[c];if(c==g||S!==C){var C=S;Yi(S)?Po.call(i,S,1):$f(i,S)}}return i}function Rf(i,a){return i+Co(Hu()*(a-i+1))}function tv(i,a,c,g){for(var S=-1,C=tr(Oo((a-i)/(c||1)),0),B=te(C);C--;)B[g?C:++S]=i,i+=c;return B}function Tf(i,a){var c="";if(!i||a<1||a>R)return c;do a%2&&(c+=i),a=Co(a/2),a&&(i+=i);while(a);return c}function ft(i,a){return Yf(qd(i,a,$r),i+"")}function rv(i){return ku(Fs(i))}function iv(i,a){var c=Fs(i);return Go(c,Yn(a,0,c.length))}function pa(i,a,c,g){if(!Kt(i))return i;a=wn(a,i);for(var S=-1,C=a.length,B=C-1,W=i;W!=null&&++S<C;){var Q=Li(a[S]),se=c;if(Q==="__proto__"||Q==="constructor"||Q==="prototype")return i;if(S!=B){var ae=W[Q];se=g?g(ae,Q,W):t,se===t&&(se=Kt(ae)?ae:Yi(a[S+1])?[]:{})}ha(W,Q,se),W=W[Q]}return i}var fd=Ro?function(i,a){return Ro.set(i,a),i}:$r,nv=Mo?function(i,a){return Mo(i,"toString",{configurable:!0,enumerable:!1,value:ah(a),writable:!0})}:$r;function sv(i){return Go(Fs(i))}function ni(i,a,c){var g=-1,S=i.length;a<0&&(a=-a>S?0:S+a),c=c>S?S:c,c<0&&(c+=S),S=a>c?0:c-a>>>0,a>>>=0;for(var C=te(S);++g<S;)C[g]=i[g+a];return C}function av(i,a){var c;return mn(i,function(g,S,C){return c=a(g,S,C),!c}),!!c}function Uo(i,a,c){var g=0,S=i==null?g:i.length;if(typeof a=="number"&&a===a&&S<=ee){for(;g<S;){var C=g+S>>>1,B=i[C];B!==null&&!kr(B)&&(c?B<=a:B<a)?g=C+1:S=C}return S}return Nf(i,a,$r,c)}function Nf(i,a,c,g){var S=0,C=i==null?0:i.length;if(C===0)return 0;a=c(a);for(var B=a!==a,W=a===null,Q=kr(a),se=a===t;S<C;){var ae=Co((S+C)/2),ue=c(i[ae]),ve=ue!==t,Pe=ue===null,$e=ue===ue,ot=kr(ue);if(B)var Le=g||$e;else se?Le=$e&&(g||ve):W?Le=$e&&ve&&(g||!Pe):Q?Le=$e&&ve&&!Pe&&(g||!ot):Pe||ot?Le=!1:Le=g?ue<=a:ue<a;Le?S=ae+1:C=ae}return mr(C,fe)}function hd(i,a){for(var c=-1,g=i.length,S=0,C=[];++c<g;){var B=i[c],W=a?a(B):B;if(!c||!wi(W,Q)){var Q=W;C[S++]=B===0?0:B}}return C}function ud(i){return typeof i=="number"?i:kr(i)?d:+i}function Kr(i){if(typeof i=="string")return i;if(Ze(i))return Ht(i,Kr)+"";if(kr(i))return ju?ju.call(i):"";var a=i+"";return a=="0"&&1/i==-N?"-0":a}function yn(i,a,c){var g=-1,S=mo,C=i.length,B=!0,W=[],Q=W;if(c)B=!1,S=ff;else if(C>=s){var se=a?null:vv(i);if(se)return wo(se);B=!1,S=na,Q=new Jn}else Q=a?[]:W;e:for(;++g<C;){var ae=i[g],ue=a?a(ae):ae;if(ae=c||ae!==0?ae:0,B&&ue===ue){for(var ve=Q.length;ve--;)if(Q[ve]===ue)continue e;a&&Q.push(ue),W.push(ae)}else S(Q,ue,c)||(Q!==W&&Q.push(ue),W.push(ae))}return W}function $f(i,a){return a=wn(a,i),i=Ud(i,a),i==null||delete i[Li(si(a))]}function dd(i,a,c,g){return pa(i,a,c(Xn(i,a)),g)}function Bo(i,a,c,g){for(var S=i.length,C=g?S:-1;(g?C--:++C<S)&&a(i[C],C,i););return c?ni(i,g?0:C,g?C+1:S):ni(i,g?C+1:0,g?S:C)}function ld(i,a){var c=i;return c instanceof gt&&(c=c.value()),hf(a,function(g,S){return S.func.apply(S.thisArg,gn([g],S.args))},c)}function Lf(i,a,c){var g=i.length;if(g<2)return g?yn(i[0]):[];for(var S=-1,C=te(g);++S<g;)for(var B=i[S],W=-1;++W<g;)W!=S&&(C[S]=ua(C[S]||B,i[W],a,c));return yn(lr(C,1),a,c)}function pd(i,a,c){for(var g=-1,S=i.length,C=a.length,B={};++g<S;){var W=g<C?a[g]:t;c(B,i[g],W)}return B}function Ff(i){return Jt(i)?i:[]}function qf(i){return typeof i=="function"?i:$r}function wn(i,a){return Ze(i)?i:Vf(i,a)?[i]:jd(Et(i))}var ov=ft;function _n(i,a,c){var g=i.length;return c=c===t?g:c,!a&&c>=g?i:ni(i,a,c)}var gd=Gg||function(i){return vt.clearTimeout(i)};function bd(i,a){if(a)return i.slice();var c=i.length,g=Fu?Fu(c):new i.constructor(c);return i.copy(g),g}function Uf(i){var a=new i.constructor(i.byteLength);return new Do(a).set(new Do(i)),a}function cv(i,a){var c=a?Uf(i.buffer):i.buffer;return new i.constructor(c,i.byteOffset,i.byteLength)}function fv(i){var a=new i.constructor(i.source,vr.exec(i));return a.lastIndex=i.lastIndex,a}function hv(i){return fa?Rt(fa.call(i)):{}}function vd(i,a){var c=a?Uf(i.buffer):i.buffer;return new i.constructor(c,i.byteOffset,i.length)}function md(i,a){if(i!==a){var c=i!==t,g=i===null,S=i===i,C=kr(i),B=a!==t,W=a===null,Q=a===a,se=kr(a);if(!W&&!se&&!C&&i>a||C&&B&&Q&&!W&&!se||g&&B&&Q||!c&&Q||!S)return 1;if(!g&&!C&&!se&&i<a||se&&c&&S&&!g&&!C||W&&c&&S||!B&&S||!Q)return-1}return 0}function uv(i,a,c){for(var g=-1,S=i.criteria,C=a.criteria,B=S.length,W=c.length;++g<B;){var Q=md(S[g],C[g]);if(Q){if(g>=W)return Q;var se=c[g];return Q*(se=="desc"?-1:1)}}return i.index-a.index}function yd(i,a,c,g){for(var S=-1,C=i.length,B=c.length,W=-1,Q=a.length,se=tr(C-B,0),ae=te(Q+se),ue=!g;++W<Q;)ae[W]=a[W];for(;++S<B;)(ue||S<C)&&(ae[c[S]]=i[S]);for(;se--;)ae[W++]=i[S++];return ae}function wd(i,a,c,g){for(var S=-1,C=i.length,B=-1,W=c.length,Q=-1,se=a.length,ae=tr(C-W,0),ue=te(ae+se),ve=!g;++S<ae;)ue[S]=i[S];for(var Pe=S;++Q<se;)ue[Pe+Q]=a[Q];for(;++B<W;)(ve||S<C)&&(ue[Pe+c[B]]=i[S++]);return ue}function Rr(i,a){var c=-1,g=i.length;for(a||(a=te(g));++c<g;)a[c]=i[c];return a}function $i(i,a,c,g){var S=!c;c||(c={});for(var C=-1,B=a.length;++C<B;){var W=a[C],Q=g?g(c[W],i[W],W,c,i):t;Q===t&&(Q=i[W]),S?Vi(c,W,Q):ha(c,W,Q)}return c}function dv(i,a){return $i(i,Wf(i),a)}function lv(i,a){return $i(i,Td(i),a)}function zo(i,a){return function(c,g){var S=Ze(c)?mg:$b,C=a?a():{};return S(c,i,Ne(g,2),C)}}function Ts(i){return ft(function(a,c){var g=-1,S=c.length,C=S>1?c[S-1]:t,B=S>2?c[2]:t;for(C=i.length>3&&typeof C=="function"?(S--,C):t,B&&Dr(c[0],c[1],B)&&(C=S<3?t:C,S=1),a=Rt(a);++g<S;){var W=c[g];W&&i(a,W,g,C)}return a})}function _d(i,a){return function(c,g){if(c==null)return c;if(!Tr(c))return i(c,g);for(var S=c.length,C=a?S:-1,B=Rt(c);(a?C--:++C<S)&&g(B[C],C,B)!==!1;);return c}}function Ed(i){return function(a,c,g){for(var S=-1,C=Rt(a),B=g(a),W=B.length;W--;){var Q=B[i?W:++S];if(c(C[Q],Q,C)===!1)break}return a}}function pv(i,a,c){var g=a&k,S=ga(i);function C(){var B=this&&this!==vt&&this instanceof C?S:i;return B.apply(g?c:this,arguments)}return C}function Sd(i){return function(a){a=Et(a);var c=Ds(a)?mi(a):t,g=c?c[0]:a.charAt(0),S=c?_n(c,1).join(""):a.slice(1);return g[i]()+S}}function Ns(i){return function(a){return hf(_l(wl(a).replace(ra,"")),i,"")}}function ga(i){return function(){var a=arguments;switch(a.length){case 0:return new i;case 1:return new i(a[0]);case 2:return new i(a[0],a[1]);case 3:return new i(a[0],a[1],a[2]);case 4:return new i(a[0],a[1],a[2],a[3]);case 5:return new i(a[0],a[1],a[2],a[3],a[4]);case 6:return new i(a[0],a[1],a[2],a[3],a[4],a[5]);case 7:return new i(a[0],a[1],a[2],a[3],a[4],a[5],a[6])}var c=Rs(i.prototype),g=i.apply(c,a);return Kt(g)?g:c}}function gv(i,a,c){var g=ga(i);function S(){for(var C=arguments.length,B=te(C),W=C,Q=$s(S);W--;)B[W]=arguments[W];var se=C<3&&B[0]!==Q&&B[C-1]!==Q?[]:bn(B,Q);if(C-=se.length,C<c)return Pd(i,a,Ho,S.placeholder,t,B,se,t,t,c-C);var ae=this&&this!==vt&&this instanceof S?g:i;return ir(ae,this,B)}return S}function xd(i){return function(a,c,g){var S=Rt(a);if(!Tr(a)){var C=Ne(c,3);a=nr(a),c=function(W){return C(S[W],W,S)}}var B=i(a,c,g);return B>-1?S[C?a[B]:B]:t}}function Id(i){return Ji(function(a){var c=a.length,g=c,S=ri.prototype.thru;for(i&&a.reverse();g--;){var C=a[g];if(typeof C!="function")throw new ti(f);if(S&&!B&&Wo(C)=="wrapper")var B=new ri([],!0)}for(g=B?g:c;++g<c;){C=a[g];var W=Wo(C),Q=W=="wrapper"?Kf(C):t;Q&&Gf(Q[0])&&Q[1]==(b|V|U|T)&&!Q[4].length&&Q[9]==1?B=B[Wo(Q[0])].apply(B,Q[3]):B=C.length==1&&Gf(C)?B[W]():B.thru(C)}return function(){var se=arguments,ae=se[0];if(B&&se.length==1&&Ze(ae))return B.plant(ae).value();for(var ue=0,ve=c?a[ue].apply(this,se):ae;++ue<c;)ve=a[ue].call(this,ve);return ve}})}function Ho(i,a,c,g,S,C,B,W,Q,se){var ae=a&b,ue=a&k,ve=a&X,Pe=a&(V|$),$e=a&re,ot=ve?t:ga(i);function Le(){for(var ut=arguments.length,mt=te(ut),Wr=ut;Wr--;)mt[Wr]=arguments[Wr];if(Pe)var Ar=$s(Le),Vr=Ag(mt,Ar);if(g&&(mt=yd(mt,g,S,Pe)),C&&(mt=wd(mt,C,B,Pe)),ut-=Vr,Pe&&ut<se){var Yt=bn(mt,Ar);return Pd(i,a,Ho,Le.placeholder,c,mt,Yt,W,Q,se-ut)}var _i=ue?c:this,Qi=ve?_i[i]:i;return ut=mt.length,W?mt=$v(mt,W):$e&&ut>1&&mt.reverse(),ae&&Q<ut&&(mt.length=Q),this&&this!==vt&&this instanceof Le&&(Qi=ot||ga(Qi)),Qi.apply(_i,mt)}return Le}function Dd(i,a){return function(c,g){return jb(c,i,a(g),{})}}function jo(i,a){return function(c,g){var S;if(c===t&&g===t)return a;if(c!==t&&(S=c),g!==t){if(S===t)return g;typeof c=="string"||typeof g=="string"?(c=Kr(c),g=Kr(g)):(c=ud(c),g=ud(g)),S=i(c,g)}return S}}function Bf(i){return Ji(function(a){return a=Ht(a,jr(Ne())),ft(function(c){var g=this;return i(a,function(S){return ir(S,g,c)})})})}function Ko(i,a){a=a===t?" ":Kr(a);var c=a.length;if(c<2)return c?Tf(a,i):a;var g=Tf(a,Oo(i/As(a)));return Ds(a)?_n(mi(g),0,i).join(""):g.slice(0,i)}function bv(i,a,c,g){var S=a&k,C=ga(i);function B(){for(var W=-1,Q=arguments.length,se=-1,ae=g.length,ue=te(ae+Q),ve=this&&this!==vt&&this instanceof B?C:i;++se<ae;)ue[se]=g[se];for(;Q--;)ue[se++]=arguments[++W];return ir(ve,S?c:this,ue)}return B}function Ad(i){return function(a,c,g){return g&&typeof g!="number"&&Dr(a,c,g)&&(c=g=t),a=Zi(a),c===t?(c=a,a=0):c=Zi(c),g=g===t?a<c?1:-1:Zi(g),tv(a,c,g,i)}}function ko(i){return function(a,c){return typeof a=="string"&&typeof c=="string"||(a=ai(a),c=ai(c)),i(a,c)}}function Pd(i,a,c,g,S,C,B,W,Q,se){var ae=a&V,ue=ae?B:t,ve=ae?t:B,Pe=ae?C:t,$e=ae?t:C;a|=ae?U:z,a&=~(ae?z:U),a&F||(a&=~(k|X));var ot=[i,a,S,Pe,ue,$e,ve,W,Q,se],Le=c.apply(t,ot);return Gf(i)&&Bd(Le,ot),Le.placeholder=g,zd(Le,i,a)}function zf(i){var a=er[i];return function(c,g){if(c=ai(c),g=g==null?0:mr(at(g),292),g&&zu(c)){var S=(Et(c)+"e").split("e"),C=a(S[0]+"e"+(+S[1]+g));return S=(Et(C)+"e").split("e"),+(S[0]+"e"+(+S[1]-g))}return a(c)}}var vv=Os&&1/wo(new Os([,-0]))[1]==N?function(i){return new Os(i)}:fh;function Md(i){return function(a){var c=yr(a);return c==Te?vf(a):c==ye?Ng(a):Dg(a,i(a))}}function Gi(i,a,c,g,S,C,B,W){var Q=a&X;if(!Q&&typeof i!="function")throw new ti(f);var se=g?g.length:0;if(se||(a&=~(U|z),g=S=t),B=B===t?B:tr(at(B),0),W=W===t?W:at(W),se-=S?S.length:0,a&z){var ae=g,ue=S;g=S=t}var ve=Q?t:Kf(i),Pe=[i,a,c,g,S,ae,ue,C,B,W];if(ve&&Rv(Pe,ve),i=Pe[0],a=Pe[1],c=Pe[2],g=Pe[3],S=Pe[4],W=Pe[9]=Pe[9]===t?Q?0:i.length:tr(Pe[9]-se,0),!W&&a&(V|$)&&(a&=~(V|$)),!a||a==k)var $e=pv(i,a,c);else a==V||a==$?$e=gv(i,a,W):(a==U||a==(k|U))&&!S.length?$e=bv(i,a,c,g):$e=Ho.apply(t,Pe);var ot=ve?fd:Bd;return zd(ot($e,Pe),i,a)}function Od(i,a,c,g){return i===t||wi(i,Ms[c])&&!xt.call(g,c)?a:i}function Cd(i,a,c,g,S,C){return Kt(i)&&Kt(a)&&(C.set(a,i),qo(i,a,t,Cd,C),C.delete(a)),i}function mv(i){return ma(i)?t:i}function Rd(i,a,c,g,S,C){var B=c&M,W=i.length,Q=a.length;if(W!=Q&&!(B&&Q>W))return!1;var se=C.get(i),ae=C.get(a);if(se&&ae)return se==a&&ae==i;var ue=-1,ve=!0,Pe=c&H?new Jn:t;for(C.set(i,a),C.set(a,i);++ue<W;){var $e=i[ue],ot=a[ue];if(g)var Le=B?g(ot,$e,ue,a,i,C):g($e,ot,ue,i,a,C);if(Le!==t){if(Le)continue;ve=!1;break}if(Pe){if(!uf(a,function(ut,mt){if(!na(Pe,mt)&&($e===ut||S($e,ut,c,g,C)))return Pe.push(mt)})){ve=!1;break}}else if(!($e===ot||S($e,ot,c,g,C))){ve=!1;break}}return C.delete(i),C.delete(a),ve}function yv(i,a,c,g,S,C,B){switch(c){case xe:if(i.byteLength!=a.byteLength||i.byteOffset!=a.byteOffset)return!1;i=i.buffer,a=a.buffer;case me:return!(i.byteLength!=a.byteLength||!C(new Do(i),new Do(a)));case Z:case K:case Ae:return wi(+i,+a);case j:return i.name==a.name&&i.message==a.message;case ke:case Ie:return i==a+"";case Te:var W=vf;case ye:var Q=g&M;if(W||(W=wo),i.size!=a.size&&!Q)return!1;var se=B.get(i);if(se)return se==a;g|=H,B.set(i,a);var ae=Rd(W(i),W(a),g,S,C,B);return B.delete(i),ae;case Be:if(fa)return fa.call(i)==fa.call(a)}return!1}function wv(i,a,c,g,S,C){var B=c&M,W=Hf(i),Q=W.length,se=Hf(a),ae=se.length;if(Q!=ae&&!B)return!1;for(var ue=Q;ue--;){var ve=W[ue];if(!(B?ve in a:xt.call(a,ve)))return!1}var Pe=C.get(i),$e=C.get(a);if(Pe&&$e)return Pe==a&&$e==i;var ot=!0;C.set(i,a),C.set(a,i);for(var Le=B;++ue<Q;){ve=W[ue];var ut=i[ve],mt=a[ve];if(g)var Wr=B?g(mt,ut,ve,a,i,C):g(ut,mt,ve,i,a,C);if(!(Wr===t?ut===mt||S(ut,mt,c,g,C):Wr)){ot=!1;break}Le||(Le=ve=="constructor")}if(ot&&!Le){var Ar=i.constructor,Vr=a.constructor;Ar!=Vr&&"constructor"in i&&"constructor"in a&&!(typeof Ar=="function"&&Ar instanceof Ar&&typeof Vr=="function"&&Vr instanceof Vr)&&(ot=!1)}return C.delete(i),C.delete(a),ot}function Ji(i){return Yf(qd(i,t,Vd),i+"")}function Hf(i){return Zu(i,nr,Wf)}function jf(i){return Zu(i,Nr,Td)}var Kf=Ro?function(i){return Ro.get(i)}:fh;function Wo(i){for(var a=i.name+"",c=Cs[a],g=xt.call(Cs,a)?c.length:0;g--;){var S=c[g],C=S.func;if(C==null||C==i)return S.name}return a}function $s(i){var a=xt.call(P,"placeholder")?P:i;return a.placeholder}function Ne(){var i=P.iteratee||oh;return i=i===oh?td:i,arguments.length?i(arguments[0],arguments[1]):i}function Vo(i,a){var c=i.__data__;return Pv(a)?c[typeof a=="string"?"string":"hash"]:c.map}function kf(i){for(var a=nr(i),c=a.length;c--;){var g=a[c],S=i[g];a[c]=[g,S,Ld(S)]}return a}function Zn(i,a){var c=Cg(i,a);return ed(c)?c:t}function _v(i){var a=xt.call(i,Vn),c=i[Vn];try{i[Vn]=t;var g=!0}catch{}var S=xo.call(i);return g&&(a?i[Vn]=c:delete i[Vn]),S}var Wf=yf?function(i){return i==null?[]:(i=Rt(i),pn(yf(i),function(a){return Uu.call(i,a)}))}:hh,Td=yf?function(i){for(var a=[];i;)gn(a,Wf(i)),i=Ao(i);return a}:hh,yr=Ir;(wf&&yr(new wf(new ArrayBuffer(1)))!=xe||aa&&yr(new aa)!=Te||_f&&yr(_f.resolve())!=qe||Os&&yr(new Os)!=ye||oa&&yr(new oa)!=Se)&&(yr=function(i){var a=Ir(i),c=a==je?i.constructor:t,g=c?Qn(c):"";if(g)switch(g){case ib:return xe;case nb:return Te;case sb:return qe;case ab:return ye;case ob:return Se}return a});function Ev(i,a,c){for(var g=-1,S=c.length;++g<S;){var C=c[g],B=C.size;switch(C.type){case"drop":i+=B;break;case"dropRight":a-=B;break;case"take":a=mr(a,i+B);break;case"takeRight":i=tr(i,a-B);break}}return{start:i,end:a}}function Sv(i){var a=i.match(St);return a?a[1].split(nt):[]}function Nd(i,a,c){a=wn(a,i);for(var g=-1,S=a.length,C=!1;++g<S;){var B=Li(a[g]);if(!(C=i!=null&&c(i,B)))break;i=i[B]}return C||++g!=S?C:(S=i==null?0:i.length,!!S&&ec(S)&&Yi(B,S)&&(Ze(i)||es(i)))}function xv(i){var a=i.length,c=new i.constructor(a);return a&&typeof i[0]=="string"&&xt.call(i,"index")&&(c.index=i.index,c.input=i.input),c}function $d(i){return typeof i.constructor=="function"&&!ba(i)?Rs(Ao(i)):{}}function Iv(i,a,c){var g=i.constructor;switch(a){case me:return Uf(i);case Z:case K:return new g(+i);case xe:return cv(i,c);case Qe:case _e:case Oe:case ct:case Ce:case Re:case ht:case lt:case bt:return vd(i,c);case Te:return new g;case Ae:case Ie:return new g(i);case ke:return fv(i);case ye:return new g;case Be:return hv(i)}}function Dv(i,a){var c=a.length;if(!c)return i;var g=c-1;return a[g]=(c>1?"& ":"")+a[g],a=a.join(c>2?", ":" "),i.replace(Ye,`{
|
|
31
|
-
/* [wrapped with `+a+`] */
|
|
32
|
-
`)}function Av(i){return Ze(i)||es(i)||!!(Bu&&i&&i[Bu])}function Yi(i,a){var c=typeof i;return a=a??R,!!a&&(c=="number"||c!="symbol"&&$n.test(i))&&i>-1&&i%1==0&&i<a}function Dr(i,a,c){if(!Kt(c))return!1;var g=typeof a;return(g=="number"?Tr(c)&&Yi(a,c.length):g=="string"&&a in c)?wi(c[a],i):!1}function Vf(i,a){if(Ze(i))return!1;var c=typeof i;return c=="number"||c=="symbol"||c=="boolean"||i==null||kr(i)?!0:rt.test(i)||!He.test(i)||a!=null&&i in Rt(a)}function Pv(i){var a=typeof i;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?i!=="__proto__":i===null}function Gf(i){var a=Wo(i),c=P[a];if(typeof c!="function"||!(a in gt.prototype))return!1;if(i===c)return!0;var g=Kf(c);return!!g&&i===g[0]}function Mv(i){return!!Lu&&Lu in i}var Ov=Eo?Xi:uh;function ba(i){var a=i&&i.constructor,c=typeof a=="function"&&a.prototype||Ms;return i===c}function Ld(i){return i===i&&!Kt(i)}function Fd(i,a){return function(c){return c==null?!1:c[i]===a&&(a!==t||i in Rt(c))}}function Cv(i){var a=Zo(i,function(g){return c.size===l&&c.clear(),g}),c=a.cache;return a}function Rv(i,a){var c=i[1],g=a[1],S=c|g,C=S<(k|X|b),B=g==b&&c==V||g==b&&c==T&&i[7].length<=a[8]||g==(b|T)&&a[7].length<=a[8]&&c==V;if(!(C||B))return i;g&k&&(i[2]=a[2],S|=c&k?0:F);var W=a[3];if(W){var Q=i[3];i[3]=Q?yd(Q,W,a[4]):W,i[4]=Q?bn(i[3],m):a[4]}return W=a[5],W&&(Q=i[5],i[5]=Q?wd(Q,W,a[6]):W,i[6]=Q?bn(i[5],m):a[6]),W=a[7],W&&(i[7]=W),g&b&&(i[8]=i[8]==null?a[8]:mr(i[8],a[8])),i[9]==null&&(i[9]=a[9]),i[0]=a[0],i[1]=S,i}function Tv(i){var a=[];if(i!=null)for(var c in Rt(i))a.push(c);return a}function Nv(i){return xo.call(i)}function qd(i,a,c){return a=tr(a===t?i.length-1:a,0),function(){for(var g=arguments,S=-1,C=tr(g.length-a,0),B=te(C);++S<C;)B[S]=g[a+S];S=-1;for(var W=te(a+1);++S<a;)W[S]=g[S];return W[a]=c(B),ir(i,this,W)}}function Ud(i,a){return a.length<2?i:Xn(i,ni(a,0,-1))}function $v(i,a){for(var c=i.length,g=mr(a.length,c),S=Rr(i);g--;){var C=a[g];i[g]=Yi(C,c)?S[C]:t}return i}function Jf(i,a){if(!(a==="constructor"&&typeof i[a]=="function")&&a!="__proto__")return i[a]}var Bd=Hd(fd),va=Yg||function(i,a){return vt.setTimeout(i,a)},Yf=Hd(nv);function zd(i,a,c){var g=a+"";return Yf(i,Dv(g,Lv(Sv(g),c)))}function Hd(i){var a=0,c=0;return function(){var g=eb(),S=y-(g-c);if(c=g,S>0){if(++a>=u)return arguments[0]}else a=0;return i.apply(t,arguments)}}function Go(i,a){var c=-1,g=i.length,S=g-1;for(a=a===t?g:a;++c<a;){var C=Rf(c,S),B=i[C];i[C]=i[c],i[c]=B}return i.length=a,i}var jd=Cv(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(jt,function(c,g,S,C){a.push(S?C.replace(Bt,"$1"):g||c)}),a});function Li(i){if(typeof i=="string"||kr(i))return i;var a=i+"";return a=="0"&&1/i==-N?"-0":a}function Qn(i){if(i!=null){try{return So.call(i)}catch{}try{return i+""}catch{}}return""}function Lv(i,a){return ei(he,function(c){var g="_."+c[0];a&c[1]&&!mo(i,g)&&i.push(g)}),i.sort()}function Kd(i){if(i instanceof gt)return i.clone();var a=new ri(i.__wrapped__,i.__chain__);return a.__actions__=Rr(i.__actions__),a.__index__=i.__index__,a.__values__=i.__values__,a}function Fv(i,a,c){(c?Dr(i,a,c):a===t)?a=1:a=tr(at(a),0);var g=i==null?0:i.length;if(!g||a<1)return[];for(var S=0,C=0,B=te(Oo(g/a));S<g;)B[C++]=ni(i,S,S+=a);return B}function qv(i){for(var a=-1,c=i==null?0:i.length,g=0,S=[];++a<c;){var C=i[a];C&&(S[g++]=C)}return S}function Uv(){var i=arguments.length;if(!i)return[];for(var a=te(i-1),c=arguments[0],g=i;g--;)a[g-1]=arguments[g];return gn(Ze(c)?Rr(c):[c],lr(a,1))}var Bv=ft(function(i,a){return Jt(i)?ua(i,lr(a,1,Jt,!0)):[]}),zv=ft(function(i,a){var c=si(a);return Jt(c)&&(c=t),Jt(i)?ua(i,lr(a,1,Jt,!0),Ne(c,2)):[]}),Hv=ft(function(i,a){var c=si(a);return Jt(c)&&(c=t),Jt(i)?ua(i,lr(a,1,Jt,!0),t,c):[]});function jv(i,a,c){var g=i==null?0:i.length;return g?(a=c||a===t?1:at(a),ni(i,a<0?0:a,g)):[]}function Kv(i,a,c){var g=i==null?0:i.length;return g?(a=c||a===t?1:at(a),a=g-a,ni(i,0,a<0?0:a)):[]}function kv(i,a){return i&&i.length?Bo(i,Ne(a,3),!0,!0):[]}function Wv(i,a){return i&&i.length?Bo(i,Ne(a,3),!0):[]}function Vv(i,a,c,g){var S=i==null?0:i.length;return S?(c&&typeof c!="number"&&Dr(i,a,c)&&(c=0,g=S),Ub(i,a,c,g)):[]}function kd(i,a,c){var g=i==null?0:i.length;if(!g)return-1;var S=c==null?0:at(c);return S<0&&(S=tr(g+S,0)),yo(i,Ne(a,3),S)}function Wd(i,a,c){var g=i==null?0:i.length;if(!g)return-1;var S=g-1;return c!==t&&(S=at(c),S=c<0?tr(g+S,0):mr(S,g-1)),yo(i,Ne(a,3),S,!0)}function Vd(i){var a=i==null?0:i.length;return a?lr(i,1):[]}function Gv(i){var a=i==null?0:i.length;return a?lr(i,N):[]}function Jv(i,a){var c=i==null?0:i.length;return c?(a=a===t?1:at(a),lr(i,a)):[]}function Yv(i){for(var a=-1,c=i==null?0:i.length,g={};++a<c;){var S=i[a];g[S[0]]=S[1]}return g}function Gd(i){return i&&i.length?i[0]:t}function Xv(i,a,c){var g=i==null?0:i.length;if(!g)return-1;var S=c==null?0:at(c);return S<0&&(S=tr(g+S,0)),Is(i,a,S)}function Zv(i){var a=i==null?0:i.length;return a?ni(i,0,-1):[]}var Qv=ft(function(i){var a=Ht(i,Ff);return a.length&&a[0]===i[0]?Af(a):[]}),em=ft(function(i){var a=si(i),c=Ht(i,Ff);return a===si(c)?a=t:c.pop(),c.length&&c[0]===i[0]?Af(c,Ne(a,2)):[]}),tm=ft(function(i){var a=si(i),c=Ht(i,Ff);return a=typeof a=="function"?a:t,a&&c.pop(),c.length&&c[0]===i[0]?Af(c,t,a):[]});function rm(i,a){return i==null?"":Zg.call(i,a)}function si(i){var a=i==null?0:i.length;return a?i[a-1]:t}function im(i,a,c){var g=i==null?0:i.length;if(!g)return-1;var S=g;return c!==t&&(S=at(c),S=S<0?tr(g+S,0):mr(S,g-1)),a===a?Lg(i,a,S):yo(i,Pu,S,!0)}function nm(i,a){return i&&i.length?sd(i,at(a)):t}var sm=ft(Jd);function Jd(i,a){return i&&i.length&&a&&a.length?Cf(i,a):i}function am(i,a,c){return i&&i.length&&a&&a.length?Cf(i,a,Ne(c,2)):i}function om(i,a,c){return i&&i.length&&a&&a.length?Cf(i,a,t,c):i}var cm=Ji(function(i,a){var c=i==null?0:i.length,g=Sf(i,a);return cd(i,Ht(a,function(S){return Yi(S,c)?+S:S}).sort(md)),g});function fm(i,a){var c=[];if(!(i&&i.length))return c;var g=-1,S=[],C=i.length;for(a=Ne(a,3);++g<C;){var B=i[g];a(B,g,i)&&(c.push(B),S.push(g))}return cd(i,S),c}function Xf(i){return i==null?i:rb.call(i)}function hm(i,a,c){var g=i==null?0:i.length;return g?(c&&typeof c!="number"&&Dr(i,a,c)?(a=0,c=g):(a=a==null?0:at(a),c=c===t?g:at(c)),ni(i,a,c)):[]}function um(i,a){return Uo(i,a)}function dm(i,a,c){return Nf(i,a,Ne(c,2))}function lm(i,a){var c=i==null?0:i.length;if(c){var g=Uo(i,a);if(g<c&&wi(i[g],a))return g}return-1}function pm(i,a){return Uo(i,a,!0)}function gm(i,a,c){return Nf(i,a,Ne(c,2),!0)}function bm(i,a){var c=i==null?0:i.length;if(c){var g=Uo(i,a,!0)-1;if(wi(i[g],a))return g}return-1}function vm(i){return i&&i.length?hd(i):[]}function mm(i,a){return i&&i.length?hd(i,Ne(a,2)):[]}function ym(i){var a=i==null?0:i.length;return a?ni(i,1,a):[]}function wm(i,a,c){return i&&i.length?(a=c||a===t?1:at(a),ni(i,0,a<0?0:a)):[]}function _m(i,a,c){var g=i==null?0:i.length;return g?(a=c||a===t?1:at(a),a=g-a,ni(i,a<0?0:a,g)):[]}function Em(i,a){return i&&i.length?Bo(i,Ne(a,3),!1,!0):[]}function Sm(i,a){return i&&i.length?Bo(i,Ne(a,3)):[]}var xm=ft(function(i){return yn(lr(i,1,Jt,!0))}),Im=ft(function(i){var a=si(i);return Jt(a)&&(a=t),yn(lr(i,1,Jt,!0),Ne(a,2))}),Dm=ft(function(i){var a=si(i);return a=typeof a=="function"?a:t,yn(lr(i,1,Jt,!0),t,a)});function Am(i){return i&&i.length?yn(i):[]}function Pm(i,a){return i&&i.length?yn(i,Ne(a,2)):[]}function Mm(i,a){return a=typeof a=="function"?a:t,i&&i.length?yn(i,t,a):[]}function Zf(i){if(!(i&&i.length))return[];var a=0;return i=pn(i,function(c){if(Jt(c))return a=tr(c.length,a),!0}),gf(a,function(c){return Ht(i,df(c))})}function Yd(i,a){if(!(i&&i.length))return[];var c=Zf(i);return a==null?c:Ht(c,function(g){return ir(a,t,g)})}var Om=ft(function(i,a){return Jt(i)?ua(i,a):[]}),Cm=ft(function(i){return Lf(pn(i,Jt))}),Rm=ft(function(i){var a=si(i);return Jt(a)&&(a=t),Lf(pn(i,Jt),Ne(a,2))}),Tm=ft(function(i){var a=si(i);return a=typeof a=="function"?a:t,Lf(pn(i,Jt),t,a)}),Nm=ft(Zf);function $m(i,a){return pd(i||[],a||[],ha)}function Lm(i,a){return pd(i||[],a||[],pa)}var Fm=ft(function(i){var a=i.length,c=a>1?i[a-1]:t;return c=typeof c=="function"?(i.pop(),c):t,Yd(i,c)});function Xd(i){var a=P(i);return a.__chain__=!0,a}function qm(i,a){return a(i),i}function Jo(i,a){return a(i)}var Um=Ji(function(i){var a=i.length,c=a?i[0]:0,g=this.__wrapped__,S=function(C){return Sf(C,i)};return a>1||this.__actions__.length||!(g instanceof gt)||!Yi(c)?this.thru(S):(g=g.slice(c,+c+(a?1:0)),g.__actions__.push({func:Jo,args:[S],thisArg:t}),new ri(g,this.__chain__).thru(function(C){return a&&!C.length&&C.push(t),C}))});function Bm(){return Xd(this)}function zm(){return new ri(this.value(),this.__chain__)}function Hm(){this.__values__===t&&(this.__values__=ul(this.value()));var i=this.__index__>=this.__values__.length,a=i?t:this.__values__[this.__index__++];return{done:i,value:a}}function jm(){return this}function Km(i){for(var a,c=this;c instanceof No;){var g=Kd(c);g.__index__=0,g.__values__=t,a?S.__wrapped__=g:a=g;var S=g;c=c.__wrapped__}return S.__wrapped__=i,a}function km(){var i=this.__wrapped__;if(i instanceof gt){var a=i;return this.__actions__.length&&(a=new gt(this)),a=a.reverse(),a.__actions__.push({func:Jo,args:[Xf],thisArg:t}),new ri(a,this.__chain__)}return this.thru(Xf)}function Wm(){return ld(this.__wrapped__,this.__actions__)}var Vm=zo(function(i,a,c){xt.call(i,c)?++i[c]:Vi(i,c,1)});function Gm(i,a,c){var g=Ze(i)?Du:qb;return c&&Dr(i,a,c)&&(a=t),g(i,Ne(a,3))}function Jm(i,a){var c=Ze(i)?pn:Yu;return c(i,Ne(a,3))}var Ym=xd(kd),Xm=xd(Wd);function Zm(i,a){return lr(Yo(i,a),1)}function Qm(i,a){return lr(Yo(i,a),N)}function ey(i,a,c){return c=c===t?1:at(c),lr(Yo(i,a),c)}function Zd(i,a){var c=Ze(i)?ei:mn;return c(i,Ne(a,3))}function Qd(i,a){var c=Ze(i)?yg:Ju;return c(i,Ne(a,3))}var ty=zo(function(i,a,c){xt.call(i,c)?i[c].push(a):Vi(i,c,[a])});function ry(i,a,c,g){i=Tr(i)?i:Fs(i),c=c&&!g?at(c):0;var S=i.length;return c<0&&(c=tr(S+c,0)),tc(i)?c<=S&&i.indexOf(a,c)>-1:!!S&&Is(i,a,c)>-1}var iy=ft(function(i,a,c){var g=-1,S=typeof a=="function",C=Tr(i)?te(i.length):[];return mn(i,function(B){C[++g]=S?ir(a,B,c):da(B,a,c)}),C}),ny=zo(function(i,a,c){Vi(i,c,a)});function Yo(i,a){var c=Ze(i)?Ht:rd;return c(i,Ne(a,3))}function sy(i,a,c,g){return i==null?[]:(Ze(a)||(a=a==null?[]:[a]),c=g?t:c,Ze(c)||(c=c==null?[]:[c]),ad(i,a,c))}var ay=zo(function(i,a,c){i[c?0:1].push(a)},function(){return[[],[]]});function oy(i,a,c){var g=Ze(i)?hf:Ou,S=arguments.length<3;return g(i,Ne(a,4),c,S,mn)}function cy(i,a,c){var g=Ze(i)?wg:Ou,S=arguments.length<3;return g(i,Ne(a,4),c,S,Ju)}function fy(i,a){var c=Ze(i)?pn:Yu;return c(i,Qo(Ne(a,3)))}function hy(i){var a=Ze(i)?ku:rv;return a(i)}function uy(i,a,c){(c?Dr(i,a,c):a===t)?a=1:a=at(a);var g=Ze(i)?Tb:iv;return g(i,a)}function dy(i){var a=Ze(i)?Nb:sv;return a(i)}function ly(i){if(i==null)return 0;if(Tr(i))return tc(i)?As(i):i.length;var a=yr(i);return a==Te||a==ye?i.size:Mf(i).length}function py(i,a,c){var g=Ze(i)?uf:av;return c&&Dr(i,a,c)&&(a=t),g(i,Ne(a,3))}var gy=ft(function(i,a){if(i==null)return[];var c=a.length;return c>1&&Dr(i,a[0],a[1])?a=[]:c>2&&Dr(a[0],a[1],a[2])&&(a=[a[0]]),ad(i,lr(a,1),[])}),Xo=Jg||function(){return vt.Date.now()};function by(i,a){if(typeof a!="function")throw new ti(f);return i=at(i),function(){if(--i<1)return a.apply(this,arguments)}}function el(i,a,c){return a=c?t:a,a=i&&a==null?i.length:a,Gi(i,b,t,t,t,t,a)}function tl(i,a){var c;if(typeof a!="function")throw new ti(f);return i=at(i),function(){return--i>0&&(c=a.apply(this,arguments)),i<=1&&(a=t),c}}var Qf=ft(function(i,a,c){var g=k;if(c.length){var S=bn(c,$s(Qf));g|=U}return Gi(i,g,a,c,S)}),rl=ft(function(i,a,c){var g=k|X;if(c.length){var S=bn(c,$s(rl));g|=U}return Gi(a,g,i,c,S)});function il(i,a,c){a=c?t:a;var g=Gi(i,V,t,t,t,t,t,a);return g.placeholder=il.placeholder,g}function nl(i,a,c){a=c?t:a;var g=Gi(i,$,t,t,t,t,t,a);return g.placeholder=nl.placeholder,g}function sl(i,a,c){var g,S,C,B,W,Q,se=0,ae=!1,ue=!1,ve=!0;if(typeof i!="function")throw new ti(f);a=ai(a)||0,Kt(c)&&(ae=!!c.leading,ue="maxWait"in c,C=ue?tr(ai(c.maxWait)||0,a):C,ve="trailing"in c?!!c.trailing:ve);function Pe(Yt){var _i=g,Qi=S;return g=S=t,se=Yt,B=i.apply(Qi,_i),B}function $e(Yt){return se=Yt,W=va(ut,a),ae?Pe(Yt):B}function ot(Yt){var _i=Yt-Q,Qi=Yt-se,xl=a-_i;return ue?mr(xl,C-Qi):xl}function Le(Yt){var _i=Yt-Q,Qi=Yt-se;return Q===t||_i>=a||_i<0||ue&&Qi>=C}function ut(){var Yt=Xo();if(Le(Yt))return mt(Yt);W=va(ut,ot(Yt))}function mt(Yt){return W=t,ve&&g?Pe(Yt):(g=S=t,B)}function Wr(){W!==t&&gd(W),se=0,g=Q=S=W=t}function Ar(){return W===t?B:mt(Xo())}function Vr(){var Yt=Xo(),_i=Le(Yt);if(g=arguments,S=this,Q=Yt,_i){if(W===t)return $e(Q);if(ue)return gd(W),W=va(ut,a),Pe(Q)}return W===t&&(W=va(ut,a)),B}return Vr.cancel=Wr,Vr.flush=Ar,Vr}var vy=ft(function(i,a){return Gu(i,1,a)}),my=ft(function(i,a,c){return Gu(i,ai(a)||0,c)});function yy(i){return Gi(i,re)}function Zo(i,a){if(typeof i!="function"||a!=null&&typeof a!="function")throw new ti(f);var c=function(){var g=arguments,S=a?a.apply(this,g):g[0],C=c.cache;if(C.has(S))return C.get(S);var B=i.apply(this,g);return c.cache=C.set(S,B)||C,B};return c.cache=new(Zo.Cache||Wi),c}Zo.Cache=Wi;function Qo(i){if(typeof i!="function")throw new ti(f);return function(){var a=arguments;switch(a.length){case 0:return!i.call(this);case 1:return!i.call(this,a[0]);case 2:return!i.call(this,a[0],a[1]);case 3:return!i.call(this,a[0],a[1],a[2])}return!i.apply(this,a)}}function wy(i){return tl(2,i)}var _y=ov(function(i,a){a=a.length==1&&Ze(a[0])?Ht(a[0],jr(Ne())):Ht(lr(a,1),jr(Ne()));var c=a.length;return ft(function(g){for(var S=-1,C=mr(g.length,c);++S<C;)g[S]=a[S].call(this,g[S]);return ir(i,this,g)})}),eh=ft(function(i,a){var c=bn(a,$s(eh));return Gi(i,U,t,a,c)}),al=ft(function(i,a){var c=bn(a,$s(al));return Gi(i,z,t,a,c)}),Ey=Ji(function(i,a){return Gi(i,T,t,t,t,a)});function Sy(i,a){if(typeof i!="function")throw new ti(f);return a=a===t?a:at(a),ft(i,a)}function xy(i,a){if(typeof i!="function")throw new ti(f);return a=a==null?0:tr(at(a),0),ft(function(c){var g=c[a],S=_n(c,0,a);return g&&gn(S,g),ir(i,this,S)})}function Iy(i,a,c){var g=!0,S=!0;if(typeof i!="function")throw new ti(f);return Kt(c)&&(g="leading"in c?!!c.leading:g,S="trailing"in c?!!c.trailing:S),sl(i,a,{leading:g,maxWait:a,trailing:S})}function Dy(i){return el(i,1)}function Ay(i,a){return eh(qf(a),i)}function Py(){if(!arguments.length)return[];var i=arguments[0];return Ze(i)?i:[i]}function My(i){return ii(i,I)}function Oy(i,a){return a=typeof a=="function"?a:t,ii(i,I,a)}function Cy(i){return ii(i,_|I)}function Ry(i,a){return a=typeof a=="function"?a:t,ii(i,_|I,a)}function Ty(i,a){return a==null||Vu(i,a,nr(a))}function wi(i,a){return i===a||i!==i&&a!==a}var Ny=ko(Df),$y=ko(function(i,a){return i>=a}),es=Qu(function(){return arguments}())?Qu:function(i){return kt(i)&&xt.call(i,"callee")&&!Uu.call(i,"callee")},Ze=te.isArray,Ly=xr?jr(xr):Kb;function Tr(i){return i!=null&&ec(i.length)&&!Xi(i)}function Jt(i){return kt(i)&&Tr(i)}function Fy(i){return i===!0||i===!1||kt(i)&&Ir(i)==Z}var En=Xg||uh,qy=vi?jr(vi):kb;function Uy(i){return kt(i)&&i.nodeType===1&&!ma(i)}function By(i){if(i==null)return!0;if(Tr(i)&&(Ze(i)||typeof i=="string"||typeof i.splice=="function"||En(i)||Ls(i)||es(i)))return!i.length;var a=yr(i);if(a==Te||a==ye)return!i.size;if(ba(i))return!Mf(i).length;for(var c in i)if(xt.call(i,c))return!1;return!0}function zy(i,a){return la(i,a)}function Hy(i,a,c){c=typeof c=="function"?c:t;var g=c?c(i,a):t;return g===t?la(i,a,t,c):!!g}function th(i){if(!kt(i))return!1;var a=Ir(i);return a==j||a==v||typeof i.message=="string"&&typeof i.name=="string"&&!ma(i)}function jy(i){return typeof i=="number"&&zu(i)}function Xi(i){if(!Kt(i))return!1;var a=Ir(i);return a==oe||a==le||a==G||a==Ue}function ol(i){return typeof i=="number"&&i==at(i)}function ec(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=R}function Kt(i){var a=typeof i;return i!=null&&(a=="object"||a=="function")}function kt(i){return i!=null&&typeof i=="object"}var cl=Qr?jr(Qr):Vb;function Ky(i,a){return i===a||Pf(i,a,kf(a))}function ky(i,a,c){return c=typeof c=="function"?c:t,Pf(i,a,kf(a),c)}function Wy(i){return fl(i)&&i!=+i}function Vy(i){if(Ov(i))throw new Ke(o);return ed(i)}function Gy(i){return i===null}function Jy(i){return i==null}function fl(i){return typeof i=="number"||kt(i)&&Ir(i)==Ae}function ma(i){if(!kt(i)||Ir(i)!=je)return!1;var a=Ao(i);if(a===null)return!0;var c=xt.call(a,"constructor")&&a.constructor;return typeof c=="function"&&c instanceof c&&So.call(c)==kg}var rh=Ti?jr(Ti):Gb;function Yy(i){return ol(i)&&i>=-R&&i<=R}var hl=ia?jr(ia):Jb;function tc(i){return typeof i=="string"||!Ze(i)&&kt(i)&&Ir(i)==Ie}function kr(i){return typeof i=="symbol"||kt(i)&&Ir(i)==Be}var Ls=Wn?jr(Wn):Yb;function Xy(i){return i===t}function Zy(i){return kt(i)&&yr(i)==Se}function Qy(i){return kt(i)&&Ir(i)==ze}var e3=ko(Of),t3=ko(function(i,a){return i<=a});function ul(i){if(!i)return[];if(Tr(i))return tc(i)?mi(i):Rr(i);if(sa&&i[sa])return Tg(i[sa]());var a=yr(i),c=a==Te?vf:a==ye?wo:Fs;return c(i)}function Zi(i){if(!i)return i===0?i:0;if(i=ai(i),i===N||i===-N){var a=i<0?-1:1;return a*x}return i===i?i:0}function at(i){var a=Zi(i),c=a%1;return a===a?c?a-c:a:0}function dl(i){return i?Yn(at(i),0,A):0}function ai(i){if(typeof i=="number")return i;if(kr(i))return d;if(Kt(i)){var a=typeof i.valueOf=="function"?i.valueOf():i;i=Kt(a)?a+"":a}if(typeof i!="string")return i===0?i:+i;i=Cu(i);var c=Rn.test(i);return c||Nn.test(i)?Xe(i.slice(2),c?2:8):Cn.test(i)?d:+i}function ll(i){return $i(i,Nr(i))}function r3(i){return i?Yn(at(i),-R,R):i===0?i:0}function Et(i){return i==null?"":Kr(i)}var i3=Ts(function(i,a){if(ba(a)||Tr(a)){$i(a,nr(a),i);return}for(var c in a)xt.call(a,c)&&ha(i,c,a[c])}),pl=Ts(function(i,a){$i(a,Nr(a),i)}),rc=Ts(function(i,a,c,g){$i(a,Nr(a),i,g)}),n3=Ts(function(i,a,c,g){$i(a,nr(a),i,g)}),s3=Ji(Sf);function a3(i,a){var c=Rs(i);return a==null?c:Wu(c,a)}var o3=ft(function(i,a){i=Rt(i);var c=-1,g=a.length,S=g>2?a[2]:t;for(S&&Dr(a[0],a[1],S)&&(g=1);++c<g;)for(var C=a[c],B=Nr(C),W=-1,Q=B.length;++W<Q;){var se=B[W],ae=i[se];(ae===t||wi(ae,Ms[se])&&!xt.call(i,se))&&(i[se]=C[se])}return i}),c3=ft(function(i){return i.push(t,Cd),ir(gl,t,i)});function f3(i,a){return Au(i,Ne(a,3),Ni)}function h3(i,a){return Au(i,Ne(a,3),If)}function u3(i,a){return i==null?i:xf(i,Ne(a,3),Nr)}function d3(i,a){return i==null?i:Xu(i,Ne(a,3),Nr)}function l3(i,a){return i&&Ni(i,Ne(a,3))}function p3(i,a){return i&&If(i,Ne(a,3))}function g3(i){return i==null?[]:Fo(i,nr(i))}function b3(i){return i==null?[]:Fo(i,Nr(i))}function ih(i,a,c){var g=i==null?t:Xn(i,a);return g===t?c:g}function v3(i,a){return i!=null&&Nd(i,a,Bb)}function nh(i,a){return i!=null&&Nd(i,a,zb)}var m3=Dd(function(i,a,c){a!=null&&typeof a.toString!="function"&&(a=xo.call(a)),i[a]=c},ah($r)),y3=Dd(function(i,a,c){a!=null&&typeof a.toString!="function"&&(a=xo.call(a)),xt.call(i,a)?i[a].push(c):i[a]=[c]},Ne),w3=ft(da);function nr(i){return Tr(i)?Ku(i):Mf(i)}function Nr(i){return Tr(i)?Ku(i,!0):Xb(i)}function _3(i,a){var c={};return a=Ne(a,3),Ni(i,function(g,S,C){Vi(c,a(g,S,C),g)}),c}function E3(i,a){var c={};return a=Ne(a,3),Ni(i,function(g,S,C){Vi(c,S,a(g,S,C))}),c}var S3=Ts(function(i,a,c){qo(i,a,c)}),gl=Ts(function(i,a,c,g){qo(i,a,c,g)}),x3=Ji(function(i,a){var c={};if(i==null)return c;var g=!1;a=Ht(a,function(C){return C=wn(C,i),g||(g=C.length>1),C}),$i(i,jf(i),c),g&&(c=ii(c,_|D|I,mv));for(var S=a.length;S--;)$f(c,a[S]);return c});function I3(i,a){return bl(i,Qo(Ne(a)))}var D3=Ji(function(i,a){return i==null?{}:Qb(i,a)});function bl(i,a){if(i==null)return{};var c=Ht(jf(i),function(g){return[g]});return a=Ne(a),od(i,c,function(g,S){return a(g,S[0])})}function A3(i,a,c){a=wn(a,i);var g=-1,S=a.length;for(S||(S=1,i=t);++g<S;){var C=i==null?t:i[Li(a[g])];C===t&&(g=S,C=c),i=Xi(C)?C.call(i):C}return i}function P3(i,a,c){return i==null?i:pa(i,a,c)}function M3(i,a,c,g){return g=typeof g=="function"?g:t,i==null?i:pa(i,a,c,g)}var vl=Md(nr),ml=Md(Nr);function O3(i,a,c){var g=Ze(i),S=g||En(i)||Ls(i);if(a=Ne(a,4),c==null){var C=i&&i.constructor;S?c=g?new C:[]:Kt(i)?c=Xi(C)?Rs(Ao(i)):{}:c={}}return(S?ei:Ni)(i,function(B,W,Q){return a(c,B,W,Q)}),c}function C3(i,a){return i==null?!0:$f(i,a)}function R3(i,a,c){return i==null?i:dd(i,a,qf(c))}function T3(i,a,c,g){return g=typeof g=="function"?g:t,i==null?i:dd(i,a,qf(c),g)}function Fs(i){return i==null?[]:bf(i,nr(i))}function N3(i){return i==null?[]:bf(i,Nr(i))}function $3(i,a,c){return c===t&&(c=a,a=t),c!==t&&(c=ai(c),c=c===c?c:0),a!==t&&(a=ai(a),a=a===a?a:0),Yn(ai(i),a,c)}function L3(i,a,c){return a=Zi(a),c===t?(c=a,a=0):c=Zi(c),i=ai(i),Hb(i,a,c)}function F3(i,a,c){if(c&&typeof c!="boolean"&&Dr(i,a,c)&&(a=c=t),c===t&&(typeof a=="boolean"?(c=a,a=t):typeof i=="boolean"&&(c=i,i=t)),i===t&&a===t?(i=0,a=1):(i=Zi(i),a===t?(a=i,i=0):a=Zi(a)),i>a){var g=i;i=a,a=g}if(c||i%1||a%1){var S=Hu();return mr(i+S*(a-i+Ot("1e-"+((S+"").length-1))),a)}return Rf(i,a)}var q3=Ns(function(i,a,c){return a=a.toLowerCase(),i+(c?yl(a):a)});function yl(i){return sh(Et(i).toLowerCase())}function wl(i){return i=Et(i),i&&i.replace(zr,Pg).replace(of,"")}function U3(i,a,c){i=Et(i),a=Kr(a);var g=i.length;c=c===t?g:Yn(at(c),0,g);var S=c;return c-=a.length,c>=0&&i.slice(c,S)==a}function B3(i){return i=Et(i),i&&Pt.test(i)?i.replace(Dt,Mg):i}function z3(i){return i=Et(i),i&&it.test(i)?i.replace(Je,"\\$&"):i}var H3=Ns(function(i,a,c){return i+(c?"-":"")+a.toLowerCase()}),j3=Ns(function(i,a,c){return i+(c?" ":"")+a.toLowerCase()}),K3=Sd("toLowerCase");function k3(i,a,c){i=Et(i),a=at(a);var g=a?As(i):0;if(!a||g>=a)return i;var S=(a-g)/2;return Ko(Co(S),c)+i+Ko(Oo(S),c)}function W3(i,a,c){i=Et(i),a=at(a);var g=a?As(i):0;return a&&g<a?i+Ko(a-g,c):i}function V3(i,a,c){i=Et(i),a=at(a);var g=a?As(i):0;return a&&g<a?Ko(a-g,c)+i:i}function G3(i,a,c){return c||a==null?a=0:a&&(a=+a),tb(Et(i).replace(Ft,""),a||0)}function J3(i,a,c){return(c?Dr(i,a,c):a===t)?a=1:a=at(a),Tf(Et(i),a)}function Y3(){var i=arguments,a=Et(i[0]);return i.length<3?a:a.replace(i[1],i[2])}var X3=Ns(function(i,a,c){return i+(c?"_":"")+a.toLowerCase()});function Z3(i,a,c){return c&&typeof c!="number"&&Dr(i,a,c)&&(a=c=t),c=c===t?A:c>>>0,c?(i=Et(i),i&&(typeof a=="string"||a!=null&&!rh(a))&&(a=Kr(a),!a&&Ds(i))?_n(mi(i),0,c):i.split(a,c)):[]}var Q3=Ns(function(i,a,c){return i+(c?" ":"")+sh(a)});function ew(i,a,c){return i=Et(i),c=c==null?0:Yn(at(c),0,i.length),a=Kr(a),i.slice(c,c+a.length)==a}function tw(i,a,c){var g=P.templateSettings;c&&Dr(i,a,c)&&(a=t),i=Et(i),a=rc({},a,g,Od);var S=rc({},a.imports,g.imports,Od),C=nr(S),B=bf(S,C),W,Q,se=0,ae=a.interpolate||Mi,ue="__p += '",ve=mf((a.escape||Mi).source+"|"+ae.source+"|"+(ae===Tt?zt:Mi).source+"|"+(a.evaluate||Mi).source+"|$","g"),Pe="//# sourceURL="+(xt.call(a,"sourceURL")?(a.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++cf+"]")+`
|
|
33
|
-
`;i.replace(ve,function(Le,ut,mt,Wr,Ar,Vr){return mt||(mt=Wr),ue+=i.slice(se,Vr).replace(Ln,Og),ut&&(W=!0,ue+=`' +
|
|
34
|
-
__e(`+ut+`) +
|
|
35
|
-
'`),Ar&&(Q=!0,ue+=`';
|
|
36
|
-
`+Ar+`;
|
|
37
|
-
__p += '`),mt&&(ue+=`' +
|
|
38
|
-
((__t = (`+mt+`)) == null ? '' : __t) +
|
|
39
|
-
'`),se=Vr+Le.length,Le}),ue+=`';
|
|
40
|
-
`;var $e=xt.call(a,"variable")&&a.variable;if(!$e)ue=`with (obj) {
|
|
41
|
-
`+ue+`
|
|
42
|
-
}
|
|
43
|
-
`;else if(ws.test($e))throw new Ke(h);ue=(Q?ue.replace(Br,""):ue).replace(pt,"$1").replace(_t,"$1;"),ue="function("+($e||"obj")+`) {
|
|
44
|
-
`+($e?"":`obj || (obj = {});
|
|
45
|
-
`)+"var __t, __p = ''"+(W?", __e = _.escape":"")+(Q?`, __j = Array.prototype.join;
|
|
46
|
-
function print() { __p += __j.call(arguments, '') }
|
|
47
|
-
`:`;
|
|
48
|
-
`)+ue+`return __p
|
|
49
|
-
}`;var ot=El(function(){return wt(C,Pe+"return "+ue).apply(t,B)});if(ot.source=ue,th(ot))throw ot;return ot}function rw(i){return Et(i).toLowerCase()}function iw(i){return Et(i).toUpperCase()}function nw(i,a,c){if(i=Et(i),i&&(c||a===t))return Cu(i);if(!i||!(a=Kr(a)))return i;var g=mi(i),S=mi(a),C=Ru(g,S),B=Tu(g,S)+1;return _n(g,C,B).join("")}function sw(i,a,c){if(i=Et(i),i&&(c||a===t))return i.slice(0,$u(i)+1);if(!i||!(a=Kr(a)))return i;var g=mi(i),S=Tu(g,mi(a))+1;return _n(g,0,S).join("")}function aw(i,a,c){if(i=Et(i),i&&(c||a===t))return i.replace(Ft,"");if(!i||!(a=Kr(a)))return i;var g=mi(i),S=Ru(g,mi(a));return _n(g,S).join("")}function ow(i,a){var c=de,g=L;if(Kt(a)){var S="separator"in a?a.separator:S;c="length"in a?at(a.length):c,g="omission"in a?Kr(a.omission):g}i=Et(i);var C=i.length;if(Ds(i)){var B=mi(i);C=B.length}if(c>=C)return i;var W=c-As(g);if(W<1)return g;var Q=B?_n(B,0,W).join(""):i.slice(0,W);if(S===t)return Q+g;if(B&&(W+=Q.length-W),rh(S)){if(i.slice(W).search(S)){var se,ae=Q;for(S.global||(S=mf(S.source,Et(vr.exec(S))+"g")),S.lastIndex=0;se=S.exec(ae);)var ue=se.index;Q=Q.slice(0,ue===t?W:ue)}}else if(i.indexOf(Kr(S),W)!=W){var ve=Q.lastIndexOf(S);ve>-1&&(Q=Q.slice(0,ve))}return Q+g}function cw(i){return i=Et(i),i&&We.test(i)?i.replace(bi,Fg):i}var fw=Ns(function(i,a,c){return i+(c?" ":"")+a.toUpperCase()}),sh=Sd("toUpperCase");function _l(i,a,c){return i=Et(i),a=c?t:a,a===t?Rg(i)?Bg(i):Sg(i):i.match(a)||[]}var El=ft(function(i,a){try{return ir(i,t,a)}catch(c){return th(c)?c:new Ke(c)}}),hw=Ji(function(i,a){return ei(a,function(c){c=Li(c),Vi(i,c,Qf(i[c],i))}),i});function uw(i){var a=i==null?0:i.length,c=Ne();return i=a?Ht(i,function(g){if(typeof g[1]!="function")throw new ti(f);return[c(g[0]),g[1]]}):[],ft(function(g){for(var S=-1;++S<a;){var C=i[S];if(ir(C[0],this,g))return ir(C[1],this,g)}})}function dw(i){return Fb(ii(i,_))}function ah(i){return function(){return i}}function lw(i,a){return i==null||i!==i?a:i}var pw=Id(),gw=Id(!0);function $r(i){return i}function oh(i){return td(typeof i=="function"?i:ii(i,_))}function bw(i){return id(ii(i,_))}function vw(i,a){return nd(i,ii(a,_))}var mw=ft(function(i,a){return function(c){return da(c,i,a)}}),yw=ft(function(i,a){return function(c){return da(i,c,a)}});function ch(i,a,c){var g=nr(a),S=Fo(a,g);c==null&&!(Kt(a)&&(S.length||!g.length))&&(c=a,a=i,i=this,S=Fo(a,nr(a)));var C=!(Kt(c)&&"chain"in c)||!!c.chain,B=Xi(i);return ei(S,function(W){var Q=a[W];i[W]=Q,B&&(i.prototype[W]=function(){var se=this.__chain__;if(C||se){var ae=i(this.__wrapped__),ue=ae.__actions__=Rr(this.__actions__);return ue.push({func:Q,args:arguments,thisArg:i}),ae.__chain__=se,ae}return Q.apply(i,gn([this.value()],arguments))})}),i}function ww(){return vt._===this&&(vt._=Wg),this}function fh(){}function _w(i){return i=at(i),ft(function(a){return sd(a,i)})}var Ew=Bf(Ht),Sw=Bf(Du),xw=Bf(uf);function Sl(i){return Vf(i)?df(Li(i)):ev(i)}function Iw(i){return function(a){return i==null?t:Xn(i,a)}}var Dw=Ad(),Aw=Ad(!0);function hh(){return[]}function uh(){return!1}function Pw(){return{}}function Mw(){return""}function Ow(){return!0}function Cw(i,a){if(i=at(i),i<1||i>R)return[];var c=A,g=mr(i,A);a=Ne(a),i-=A;for(var S=gf(g,a);++c<i;)a(c);return S}function Rw(i){return Ze(i)?Ht(i,Li):kr(i)?[i]:Rr(jd(Et(i)))}function Tw(i){var a=++Kg;return Et(i)+a}var Nw=jo(function(i,a){return i+a},0),$w=zf("ceil"),Lw=jo(function(i,a){return i/a},1),Fw=zf("floor");function qw(i){return i&&i.length?Lo(i,$r,Df):t}function Uw(i,a){return i&&i.length?Lo(i,Ne(a,2),Df):t}function Bw(i){return Mu(i,$r)}function zw(i,a){return Mu(i,Ne(a,2))}function Hw(i){return i&&i.length?Lo(i,$r,Of):t}function jw(i,a){return i&&i.length?Lo(i,Ne(a,2),Of):t}var Kw=jo(function(i,a){return i*a},1),kw=zf("round"),Ww=jo(function(i,a){return i-a},0);function Vw(i){return i&&i.length?pf(i,$r):0}function Gw(i,a){return i&&i.length?pf(i,Ne(a,2)):0}return P.after=by,P.ary=el,P.assign=i3,P.assignIn=pl,P.assignInWith=rc,P.assignWith=n3,P.at=s3,P.before=tl,P.bind=Qf,P.bindAll=hw,P.bindKey=rl,P.castArray=Py,P.chain=Xd,P.chunk=Fv,P.compact=qv,P.concat=Uv,P.cond=uw,P.conforms=dw,P.constant=ah,P.countBy=Vm,P.create=a3,P.curry=il,P.curryRight=nl,P.debounce=sl,P.defaults=o3,P.defaultsDeep=c3,P.defer=vy,P.delay=my,P.difference=Bv,P.differenceBy=zv,P.differenceWith=Hv,P.drop=jv,P.dropRight=Kv,P.dropRightWhile=kv,P.dropWhile=Wv,P.fill=Vv,P.filter=Jm,P.flatMap=Zm,P.flatMapDeep=Qm,P.flatMapDepth=ey,P.flatten=Vd,P.flattenDeep=Gv,P.flattenDepth=Jv,P.flip=yy,P.flow=pw,P.flowRight=gw,P.fromPairs=Yv,P.functions=g3,P.functionsIn=b3,P.groupBy=ty,P.initial=Zv,P.intersection=Qv,P.intersectionBy=em,P.intersectionWith=tm,P.invert=m3,P.invertBy=y3,P.invokeMap=iy,P.iteratee=oh,P.keyBy=ny,P.keys=nr,P.keysIn=Nr,P.map=Yo,P.mapKeys=_3,P.mapValues=E3,P.matches=bw,P.matchesProperty=vw,P.memoize=Zo,P.merge=S3,P.mergeWith=gl,P.method=mw,P.methodOf=yw,P.mixin=ch,P.negate=Qo,P.nthArg=_w,P.omit=x3,P.omitBy=I3,P.once=wy,P.orderBy=sy,P.over=Ew,P.overArgs=_y,P.overEvery=Sw,P.overSome=xw,P.partial=eh,P.partialRight=al,P.partition=ay,P.pick=D3,P.pickBy=bl,P.property=Sl,P.propertyOf=Iw,P.pull=sm,P.pullAll=Jd,P.pullAllBy=am,P.pullAllWith=om,P.pullAt=cm,P.range=Dw,P.rangeRight=Aw,P.rearg=Ey,P.reject=fy,P.remove=fm,P.rest=Sy,P.reverse=Xf,P.sampleSize=uy,P.set=P3,P.setWith=M3,P.shuffle=dy,P.slice=hm,P.sortBy=gy,P.sortedUniq=vm,P.sortedUniqBy=mm,P.split=Z3,P.spread=xy,P.tail=ym,P.take=wm,P.takeRight=_m,P.takeRightWhile=Em,P.takeWhile=Sm,P.tap=qm,P.throttle=Iy,P.thru=Jo,P.toArray=ul,P.toPairs=vl,P.toPairsIn=ml,P.toPath=Rw,P.toPlainObject=ll,P.transform=O3,P.unary=Dy,P.union=xm,P.unionBy=Im,P.unionWith=Dm,P.uniq=Am,P.uniqBy=Pm,P.uniqWith=Mm,P.unset=C3,P.unzip=Zf,P.unzipWith=Yd,P.update=R3,P.updateWith=T3,P.values=Fs,P.valuesIn=N3,P.without=Om,P.words=_l,P.wrap=Ay,P.xor=Cm,P.xorBy=Rm,P.xorWith=Tm,P.zip=Nm,P.zipObject=$m,P.zipObjectDeep=Lm,P.zipWith=Fm,P.entries=vl,P.entriesIn=ml,P.extend=pl,P.extendWith=rc,ch(P,P),P.add=Nw,P.attempt=El,P.camelCase=q3,P.capitalize=yl,P.ceil=$w,P.clamp=$3,P.clone=My,P.cloneDeep=Cy,P.cloneDeepWith=Ry,P.cloneWith=Oy,P.conformsTo=Ty,P.deburr=wl,P.defaultTo=lw,P.divide=Lw,P.endsWith=U3,P.eq=wi,P.escape=B3,P.escapeRegExp=z3,P.every=Gm,P.find=Ym,P.findIndex=kd,P.findKey=f3,P.findLast=Xm,P.findLastIndex=Wd,P.findLastKey=h3,P.floor=Fw,P.forEach=Zd,P.forEachRight=Qd,P.forIn=u3,P.forInRight=d3,P.forOwn=l3,P.forOwnRight=p3,P.get=ih,P.gt=Ny,P.gte=$y,P.has=v3,P.hasIn=nh,P.head=Gd,P.identity=$r,P.includes=ry,P.indexOf=Xv,P.inRange=L3,P.invoke=w3,P.isArguments=es,P.isArray=Ze,P.isArrayBuffer=Ly,P.isArrayLike=Tr,P.isArrayLikeObject=Jt,P.isBoolean=Fy,P.isBuffer=En,P.isDate=qy,P.isElement=Uy,P.isEmpty=By,P.isEqual=zy,P.isEqualWith=Hy,P.isError=th,P.isFinite=jy,P.isFunction=Xi,P.isInteger=ol,P.isLength=ec,P.isMap=cl,P.isMatch=Ky,P.isMatchWith=ky,P.isNaN=Wy,P.isNative=Vy,P.isNil=Jy,P.isNull=Gy,P.isNumber=fl,P.isObject=Kt,P.isObjectLike=kt,P.isPlainObject=ma,P.isRegExp=rh,P.isSafeInteger=Yy,P.isSet=hl,P.isString=tc,P.isSymbol=kr,P.isTypedArray=Ls,P.isUndefined=Xy,P.isWeakMap=Zy,P.isWeakSet=Qy,P.join=rm,P.kebabCase=H3,P.last=si,P.lastIndexOf=im,P.lowerCase=j3,P.lowerFirst=K3,P.lt=e3,P.lte=t3,P.max=qw,P.maxBy=Uw,P.mean=Bw,P.meanBy=zw,P.min=Hw,P.minBy=jw,P.stubArray=hh,P.stubFalse=uh,P.stubObject=Pw,P.stubString=Mw,P.stubTrue=Ow,P.multiply=Kw,P.nth=nm,P.noConflict=ww,P.noop=fh,P.now=Xo,P.pad=k3,P.padEnd=W3,P.padStart=V3,P.parseInt=G3,P.random=F3,P.reduce=oy,P.reduceRight=cy,P.repeat=J3,P.replace=Y3,P.result=A3,P.round=kw,P.runInContext=J,P.sample=hy,P.size=ly,P.snakeCase=X3,P.some=py,P.sortedIndex=um,P.sortedIndexBy=dm,P.sortedIndexOf=lm,P.sortedLastIndex=pm,P.sortedLastIndexBy=gm,P.sortedLastIndexOf=bm,P.startCase=Q3,P.startsWith=ew,P.subtract=Ww,P.sum=Vw,P.sumBy=Gw,P.template=tw,P.times=Cw,P.toFinite=Zi,P.toInteger=at,P.toLength=dl,P.toLower=rw,P.toNumber=ai,P.toSafeInteger=r3,P.toString=Et,P.toUpper=iw,P.trim=nw,P.trimEnd=sw,P.trimStart=aw,P.truncate=ow,P.unescape=cw,P.uniqueId=Tw,P.upperCase=fw,P.upperFirst=sh,P.each=Zd,P.eachRight=Qd,P.first=Gd,ch(P,function(){var i={};return Ni(P,function(a,c){xt.call(P.prototype,c)||(i[c]=a)}),i}(),{chain:!1}),P.VERSION=n,ei(["bind","bindKey","curry","curryRight","partial","partialRight"],function(i){P[i].placeholder=P}),ei(["drop","take"],function(i,a){gt.prototype[i]=function(c){c=c===t?1:tr(at(c),0);var g=this.__filtered__&&!a?new gt(this):this.clone();return g.__filtered__?g.__takeCount__=mr(c,g.__takeCount__):g.__views__.push({size:mr(c,A),type:i+(g.__dir__<0?"Right":"")}),g},gt.prototype[i+"Right"]=function(c){return this.reverse()[i](c).reverse()}}),ei(["filter","map","takeWhile"],function(i,a){var c=a+1,g=c==w||c==O;gt.prototype[i]=function(S){var C=this.clone();return C.__iteratees__.push({iteratee:Ne(S,3),type:c}),C.__filtered__=C.__filtered__||g,C}}),ei(["head","last"],function(i,a){var c="take"+(a?"Right":"");gt.prototype[i]=function(){return this[c](1).value()[0]}}),ei(["initial","tail"],function(i,a){var c="drop"+(a?"":"Right");gt.prototype[i]=function(){return this.__filtered__?new gt(this):this[c](1)}}),gt.prototype.compact=function(){return this.filter($r)},gt.prototype.find=function(i){return this.filter(i).head()},gt.prototype.findLast=function(i){return this.reverse().find(i)},gt.prototype.invokeMap=ft(function(i,a){return typeof i=="function"?new gt(this):this.map(function(c){return da(c,i,a)})}),gt.prototype.reject=function(i){return this.filter(Qo(Ne(i)))},gt.prototype.slice=function(i,a){i=at(i);var c=this;return c.__filtered__&&(i>0||a<0)?new gt(c):(i<0?c=c.takeRight(-i):i&&(c=c.drop(i)),a!==t&&(a=at(a),c=a<0?c.dropRight(-a):c.take(a-i)),c)},gt.prototype.takeRightWhile=function(i){return this.reverse().takeWhile(i).reverse()},gt.prototype.toArray=function(){return this.take(A)},Ni(gt.prototype,function(i,a){var c=/^(?:filter|find|map|reject)|While$/.test(a),g=/^(?:head|last)$/.test(a),S=P[g?"take"+(a=="last"?"Right":""):a],C=g||/^find/.test(a);S&&(P.prototype[a]=function(){var B=this.__wrapped__,W=g?[1]:arguments,Q=B instanceof gt,se=W[0],ae=Q||Ze(B),ue=function(ut){var mt=S.apply(P,gn([ut],W));return g&&ve?mt[0]:mt};ae&&c&&typeof se=="function"&&se.length!=1&&(Q=ae=!1);var ve=this.__chain__,Pe=!!this.__actions__.length,$e=C&&!ve,ot=Q&&!Pe;if(!C&&ae){B=ot?B:new gt(this);var Le=i.apply(B,W);return Le.__actions__.push({func:Jo,args:[ue],thisArg:t}),new ri(Le,ve)}return $e&&ot?i.apply(this,W):(Le=this.thru(ue),$e?g?Le.value()[0]:Le.value():Le)})}),ei(["pop","push","shift","sort","splice","unshift"],function(i){var a=_o[i],c=/^(?:push|sort|unshift)$/.test(i)?"tap":"thru",g=/^(?:pop|shift)$/.test(i);P.prototype[i]=function(){var S=arguments;if(g&&!this.__chain__){var C=this.value();return a.apply(Ze(C)?C:[],S)}return this[c](function(B){return a.apply(Ze(B)?B:[],S)})}}),Ni(gt.prototype,function(i,a){var c=P[a];if(c){var g=c.name+"";xt.call(Cs,g)||(Cs[g]=[]),Cs[g].push({name:a,func:c})}}),Cs[Ho(t,X).name]=[{name:"wrapper",func:t}],gt.prototype.clone=cb,gt.prototype.reverse=fb,gt.prototype.value=hb,P.prototype.at=Um,P.prototype.chain=Bm,P.prototype.commit=zm,P.prototype.next=Hm,P.prototype.plant=Km,P.prototype.reverse=km,P.prototype.toJSON=P.prototype.valueOf=P.prototype.value=Wm,P.prototype.first=P.prototype.head,sa&&(P.prototype[sa]=jm),P},Ps=zg();Gt?((Gt.exports=Ps)._=Ps,Ct._=Ps):vt._=Ps}).call(_r)})(Rc,Rc.exports);var jx=Rc.exports,Kx=Object.defineProperty,kx=Object.defineProperties,Wx=Object.getOwnPropertyDescriptors,mp=Object.getOwnPropertySymbols,Vx=Object.prototype.hasOwnProperty,Gx=Object.prototype.propertyIsEnumerable,yp=(r,e,t)=>e in r?Kx(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,wp=(r,e)=>{for(var t in e||(e={}))Vx.call(e,t)&&yp(r,t,e[t]);if(mp)for(var t of mp(e))Gx.call(e,t)&&yp(r,t,e[t]);return r},_p=(r,e)=>kx(r,Wx(e));const Jx={Accept:"application/json","Content-Type":"application/json"},Yx="POST",Ep={headers:Jx,method:Yx},Sp=10;let Pi=class{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new ui.EventEmitter,this.isAvailable=!1,this.registering=!1,!U0(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const t=cn(e),n=await(await Il(this.url,_p(wp({},Ep),{body:t}))).json();this.onPayload({data:n})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!U0(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((n,s)=>{this.events.once("register_error",o=>{this.resetMaxListeners(),s(o)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return s(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const t=cn({id:1,jsonrpc:"2.0",method:"test",params:[]});await Il(e,_p(wp({},Ep),{body:t}))}this.onOpen()}catch(t){const n=this.parseError(t);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?us(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const n=this.parseError(t),s=n.message||n.toString(),o=Xc(e,s);this.events.emit("payload",o)}parseError(e,t=this.url){return K1(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>Sp&&this.events.setMaxListeners(Sp)}};const xp="error",Xx="wss://relay.walletconnect.org",Zx="wc",Qx="universal_provider",Ip=`${Zx}@2:${Qx}:`,pg="https://rpc.walletconnect.org/v1/",js="generic",eI=`${pg}bundler`,gi={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var tI=Object.defineProperty,rI=Object.defineProperties,iI=Object.getOwnPropertyDescriptors,Dp=Object.getOwnPropertySymbols,nI=Object.prototype.hasOwnProperty,sI=Object.prototype.propertyIsEnumerable,Ap=(r,e,t)=>e in r?tI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,oc=(r,e)=>{for(var t in e||(e={}))nI.call(e,t)&&Ap(r,t,e[t]);if(Dp)for(var t of Dp(e))sI.call(e,t)&&Ap(r,t,e[t]);return r},aI=(r,e)=>rI(r,iI(e));function Yr(r,e,t){var n;const s=Ws(r);return((n=e.rpcMap)==null?void 0:n[s.reference])||`${pg}?chainId=${s.namespace}:${s.reference}&projectId=${t}`}function ys(r){return r.includes(":")?r.split(":")[1]:r}function gg(r){return r.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function oI(r,e){const t=Object.keys(e.namespaces).filter(s=>s.includes(r));if(!t.length)return[];const n=[];return t.forEach(s=>{const o=e.namespaces[s].accounts;n.push(...o)}),n}function Ch(r={},e={}){const t=Pp(r),n=Pp(e);return jx.merge(t,n)}function Pp(r){var e,t,n,s;const o={};if(!La(r))return o;for(const[f,h]of Object.entries(r)){const p=mu(f)?[f]:h.chains,l=h.methods||[],m=h.events||[],_=h.rpcMap||{},D=Pa(f);o[D]=aI(oc(oc({},o[D]),h),{chains:uc(p,(e=o[D])==null?void 0:e.chains),methods:uc(l,(t=o[D])==null?void 0:t.methods),events:uc(m,(n=o[D])==null?void 0:n.events),rpcMap:oc(oc({},_),(s=o[D])==null?void 0:s.rpcMap)})}return o}function cI(r){return r.includes(":")?r.split(":")[2]:r}function Mp(r){const e={};for(const[t,n]of Object.entries(r)){const s=n.methods||[],o=n.events||[],f=n.accounts||[],h=mu(t)?[t]:n.chains?n.chains:gg(n.accounts);e[t]={chains:h,methods:s,events:o,accounts:f}}return e}function Rh(r){return typeof r=="number"?r:r.includes("0x")?parseInt(r,16):(r=r.includes(":")?r.split(":")[1]:r,isNaN(Number(r))?r:Number(r))}const bg={},yt=r=>bg[r],Th=(r,e)=>{bg[r]=e};class fI{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=yt("events"),this.client=yt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(gi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;const s=ys(t);e[s]=this.createHttpProvider(s,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Yr(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new pi(new Pi(n,yt("disableProviderPing")))}}var hI=Object.defineProperty,uI=Object.defineProperties,dI=Object.getOwnPropertyDescriptors,Op=Object.getOwnPropertySymbols,lI=Object.prototype.hasOwnProperty,pI=Object.prototype.propertyIsEnumerable,Cp=(r,e,t)=>e in r?hI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Rp=(r,e)=>{for(var t in e||(e={}))lI.call(e,t)&&Cp(r,t,e[t]);if(Op)for(var t of Op(e))pI.call(e,t)&&Cp(r,t,e[t]);return r},Tp=(r,e)=>uI(r,dI(e));class gI{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=yt("events"),this.client=yt("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(gi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const n=t||Yr(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new pi(new Pi(n,yt("disableProviderPing")))}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;const s=parseInt(ys(t));e[s]=this.createHttpProvider(s,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,n;let s=e.request.params?(t=e.request.params[0])==null?void 0:t.chainId:"0x0";s=s.startsWith("0x")?s:`0x${s}`;const o=parseInt(s,16);if(this.isChainApproved(o))this.setDefaultChain(`${o}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:s}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${o}`);else throw new Error(`Failed to switch to chain 'eip155:${o}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var t,n,s;const o=(n=(t=e.request)==null?void 0:t.params)==null?void 0:n[0];if(!o)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const f=this.client.session.get(e.topic),h=((s=f==null?void 0:f.sessionProperties)==null?void 0:s.capabilities)||{};if(h!=null&&h[o])return h==null?void 0:h[o];const p=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:Tp(Rp({},f.sessionProperties||{}),{capabilities:Tp(Rp({},h||{}),{[o]:p})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return p}async getCallStatus(e){var t,n;const s=this.client.session.get(e.topic),o=(t=s.sessionProperties)==null?void 0:t.bundler_name;if(o){const h=this.getBundlerUrl(e.chainId,o);try{return await this.getUserOperationReceipt(h,e)}catch(p){console.warn("Failed to fetch call status from bundler",p,h)}}const f=(n=s.sessionProperties)==null?void 0:n.bundler_url;if(f)try{return await this.getUserOperationReceipt(f,e)}catch(h){console.warn("Failed to fetch call status from custom bundler",h,f)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,t){var n;const s=new URL(e),o=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Dn("eth_getUserOperationReceipt",[(n=t.request.params)==null?void 0:n[0]]))});if(!o.ok)throw new Error(`Failed to fetch user operation receipt - ${o.status}`);return await o.json()}getBundlerUrl(e,t){return`${eI}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}class bI{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=yt("events"),this.client=yt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(gi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;const s=ys(t);e[s]=this.createHttpProvider(s,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Yr(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new pi(new Pi(n,yt("disableProviderPing")))}}class vI{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=yt("events"),this.client=yt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(gi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;const s=ys(t);e[s]=this.createHttpProvider(s,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Yr(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new pi(new Pi(n,yt("disableProviderPing")))}}class mI{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=yt("events"),this.client=yt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){const n=t||Yr(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(gi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;e[t]=this.createHttpProvider(t,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Yr(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new pi(new Pi(n,yt("disableProviderPing")))}}class yI{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=yt("events"),this.client=yt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(gi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{const n=this.getCardanoRPCUrl(t),s=ys(t);e[s]=this.createHttpProvider(s,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new pi(new Pi(n,yt("disableProviderPing")))}}class wI{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=yt("events"),this.client=yt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(gi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;const s=ys(t);e[s]=this.createHttpProvider(s,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Yr(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new pi(new Pi(n,yt("disableProviderPing")))}}class _I{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=yt("events"),this.client=yt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(gi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;const s=ys(t);e[s]=this.createHttpProvider(s,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Yr(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new pi(new Pi(n,yt("disableProviderPing")))}}class EI{constructor(e){this.name="near",this.namespace=e.namespace,this.events=yt("events"),this.client=yt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const n=t||Yr(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(gi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;e[t]=this.createHttpProvider(t,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Yr(e,this.namespace);return typeof n>"u"?void 0:new pi(new Pi(n,yt("disableProviderPing")))}}class SI{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=yt("events"),this.client=yt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const n=t||Yr(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(gi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{e[t]=this.createHttpProvider(t)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Yr(e,this.namespace);return typeof n>"u"?void 0:new pi(new Pi(n))}}class xI{constructor(e){this.name=js,this.namespace=e.namespace,this.events=yt("events"),this.client=yt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(gi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){var e,t;const n={};return(t=(e=this.namespace)==null?void 0:e.accounts)==null||t.forEach(s=>{const o=Ws(s);n[`${o.namespace}:${o.reference}`]=this.createHttpProvider(s)}),n}getHttpProvider(e){const t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||Yr(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new pi(new Pi(n,yt("disableProviderPing")))}}var II=Object.defineProperty,DI=Object.defineProperties,AI=Object.getOwnPropertyDescriptors,Np=Object.getOwnPropertySymbols,PI=Object.prototype.hasOwnProperty,MI=Object.prototype.propertyIsEnumerable,$p=(r,e,t)=>e in r?II(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,cc=(r,e)=>{for(var t in e||(e={}))PI.call(e,t)&&$p(r,t,e[t]);if(Np)for(var t of Np(e))MI.call(e,t)&&$p(r,t,e[t]);return r},Nh=(r,e)=>DI(r,AI(e));let OI=class vg{constructor(e){this.events=new iu,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Xa(Jc({level:(e==null?void 0:e.logger)||xp})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const t=new vg(e);return await t.initialize(),t}async request(e,t,n){const[s,o]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:cc({},e),chainId:`${s}:${o}`,topic:this.session.topic,expiry:n})}sendAsync(e,t,n,s){const o=new Date().getTime();this.request(e,n,s).then(f=>t(null,Yc(o,f))).catch(f=>t(f,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:It("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:s}=await this.client.authenticate(e,t);n&&(this.uri=n,this.events.emit("display_uri",n));const o=await s();if(this.session=o.session,this.session){const f=Mp(this.session.namespaces);this.namespaces=Ch(this.namespaces,f),this.persist("namespaces",this.namespaces),this.onConnect()}return o}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:s}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await s().then(o=>{this.session=o;const f=Mp(o.namespaces);this.namespaces=Ch(this.namespaces,f),this.persist("namespaces",this.namespaces)}).catch(o=>{if(o.message!==lg)throw o;t++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[n,s]=this.validateChain(e),o=this.getProvider(n);o.name===js?o.setDefaultChain(`${n}:${s}`,t):o.setDefaultChain(s,t)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(fn(t)){for(const n of t)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await xu.init({core:this.providerOpts.core,logger:this.providerOpts.logger||xp,relayUrl:this.providerOpts.relayUrl||Xx,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(t=>Pa(t)))];Th("client",this.client),Th("events",this.events),Th("disableProviderPing",this.disableProviderPing),e.forEach(t=>{if(!this.session)return;const n=oI(t,this.session),s=gg(n),o=Ch(this.namespaces,this.optionalNamespaces),f=Nh(cc({},o[t]),{accounts:n,chains:s});switch(t){case"eip155":this.rpcProviders[t]=new gI({namespace:f});break;case"algorand":this.rpcProviders[t]=new mI({namespace:f});break;case"solana":this.rpcProviders[t]=new bI({namespace:f});break;case"cosmos":this.rpcProviders[t]=new vI({namespace:f});break;case"polkadot":this.rpcProviders[t]=new fI({namespace:f});break;case"cip34":this.rpcProviders[t]=new yI({namespace:f});break;case"elrond":this.rpcProviders[t]=new wI({namespace:f});break;case"multiversx":this.rpcProviders[t]=new _I({namespace:f});break;case"near":this.rpcProviders[t]=new EI({namespace:f});break;case"tezos":this.rpcProviders[t]=new SI({namespace:f});break;default:this.rpcProviders[js]?this.rpcProviders[js].updateNamespace(f):this.rpcProviders[js]=new xI({namespace:f})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:t}=e,{event:n}=t;if(n.name==="accountsChanged"){const s=n.data;s&&fn(s)&&this.events.emit("accountsChanged",s.map(cI))}else if(n.name==="chainChanged"){const s=t.chainId,o=t.event.data,f=Pa(s),h=Rh(s)!==Rh(o)?`${f}:${Rh(o)}`:s;this.onChainChanged(h)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var n;const{namespaces:s}=t,o=(n=this.client)==null?void 0:n.session.get(e);this.session=Nh(cc({},o),{namespaces:s}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",Nh(cc({},It("USER_DISCONNECTED")),{data:e.topic}))}),this.on(gi.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[js]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace((t=this.session)==null?void 0:t.namespaces[e])})}setNamespaces(e){const{namespaces:t,optionalNamespaces:n,sessionProperties:s}=e;t&&Object.keys(t).length&&(this.namespaces=t),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=s,this.persist("namespaces",t),this.persist("optionalNamespaces",n)}validateChain(e){const[t,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,n];if(t&&!Object.keys(this.namespaces||{}).map(f=>Pa(f)).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&n)return[t,n];const s=Pa(Object.keys(this.namespaces)[0]),o=this.rpcProviders[s].getDefaultChain();return[s,o]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){if(!this.namespaces)return;const[n,s]=this.validateChain(e);s&&(t||this.getProvider(n).setDefaultChain(s),this.namespaces[n]?this.namespaces[n].defaultChain=s:this.namespaces[`${n}:${s}`]?this.namespaces[`${n}:${s}`].defaultChain=s:this.namespaces[`${n}:${s}`]={defaultChain:s},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",s))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`${Ip}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${Ip}/${e}`)}};const CI=OI,RI="wc",TI="ethereum_provider",NI=`${RI}@2:${TI}:`,$I="https://rpc.walletconnect.org/v1/",eu=["eth_sendTransaction","personal_sign"],LI=["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"],tu=["chainChanged","accountsChanged"],FI=["chainChanged","accountsChanged","message","disconnect","connect"];var qI=Object.defineProperty,UI=Object.defineProperties,BI=Object.getOwnPropertyDescriptors,Lp=Object.getOwnPropertySymbols,zI=Object.prototype.hasOwnProperty,HI=Object.prototype.propertyIsEnumerable,Fp=(r,e,t)=>e in r?qI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ks=(r,e)=>{for(var t in e||(e={}))zI.call(e,t)&&Fp(r,t,e[t]);if(Lp)for(var t of Lp(e))HI.call(e,t)&&Fp(r,t,e[t]);return r},$h=(r,e)=>UI(r,BI(e));function Tc(r){return Number(r[0].split(":")[1])}function fc(r){return`0x${r.toString(16)}`}function jI(r){const{chains:e,optionalChains:t,methods:n,optionalMethods:s,events:o,optionalEvents:f,rpcMap:h}=r;if(!fn(e))throw new Error("Invalid chains");const p={chains:e,methods:n||eu,events:o||tu,rpcMap:Ks({},e.length?{[Tc(e)]:h[Tc(e)]}:{})},l=o==null?void 0:o.filter(I=>!tu.includes(I)),m=n==null?void 0:n.filter(I=>!eu.includes(I));if(!t&&!f&&!s&&!(l!=null&&l.length)&&!(m!=null&&m.length))return{required:e.length?p:void 0};const _=(l==null?void 0:l.length)&&(m==null?void 0:m.length)||!t,D={chains:[...new Set(_?p.chains.concat(t||[]):t)],methods:[...new Set(p.methods.concat(s!=null&&s.length?s:LI))],events:[...new Set(p.events.concat(f!=null&&f.length?f:FI))],rpcMap:h};return{required:e.length?p:void 0,optional:t.length?D:void 0}}class Iu{constructor(){this.events=new ui.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=NI,this.on=(e,t)=>(this.events.on(e,t),this),this.once=(e,t)=>(this.events.once(e,t),this),this.removeListener=(e,t)=>(this.events.removeListener(e,t),this),this.off=(e,t)=>(this.events.off(e,t),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const t=new Iu;return await t.initialize(e),t}async request(e,t){return await this.signer.request(e,this.formatChainId(this.chainId),t)}sendAsync(e,t,n){this.signer.sendAsync(e,t,this.formatChainId(this.chainId),n)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:t,optional:n}=jI(this.rpc);try{const s=await new Promise(async(f,h)=>{var p;this.rpc.showQrModal&&((p=this.modal)==null||p.subscribeModal(l=>{!l.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),h(new Error("Connection request reset. Please try again.")))})),await this.signer.connect($h(Ks({namespaces:Ks({},t&&{[this.namespace]:t})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:e==null?void 0:e.pairingTopic})).then(l=>{f(l)}).catch(l=>{h(new Error(l.message))})});if(!s)return;const o=t0(s.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:o),this.setAccounts(o),this.events.emit("connect",{chainId:fc(this.chainId)})}catch(s){throw this.signer.logger.error(s),s}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e==null?void 0:e.chains});try{const n=await new Promise(async(o,f)=>{var h;this.rpc.showQrModal&&((h=this.modal)==null||h.subscribeModal(p=>{!p.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate($h(Ks({},e),{chains:this.rpc.chains}),t).then(p=>{o(p)}).catch(p=>{f(new Error(p.message))})}),s=n.session;if(s){const o=t0(s.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:o),this.setAccounts(o),this.events.emit("connect",{chainId:fc(this.chainId)})}return n}catch(n){throw this.signer.logger.error(n),n}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:t}=e,{event:n}=t;n.name==="accountsChanged"?(this.accounts=this.parseAccounts(n.data),this.events.emit("accountsChanged",this.accounts)):n.name==="chainChanged"?this.setChainId(this.formatChainId(n.data)):this.events.emit(n.name,n.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",fc(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",$h(Ks({},It("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var t,n;this.rpc.showQrModal&&((t=this.modal)==null||t.closeModal(),(n=this.modal)==null||n.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const t=e.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",fc(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){const[t,n,s]=e.split(":");return{chainId:`${t}:${n}`,address:s}}setAccounts(e){this.accounts=e.filter(t=>this.parseChainId(this.parseAccountId(t).chainId)===this.chainId).map(t=>this.parseAccountId(t).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t,n;const s=(t=e==null?void 0:e.chains)!=null?t:[],o=(n=e==null?void 0:e.optionalChains)!=null?n:[],f=s.concat(o);if(!f.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const h=s.length?(e==null?void 0:e.methods)||eu:[],p=s.length?(e==null?void 0:e.events)||tu:[],l=(e==null?void 0:e.optionalMethods)||[],m=(e==null?void 0:e.optionalEvents)||[],_=(e==null?void 0:e.rpcMap)||this.buildRpcMap(f,e.projectId),D=(e==null?void 0:e.qrModalOptions)||void 0;return{chains:s==null?void 0:s.map(I=>this.formatChainId(I)),optionalChains:o.map(I=>this.formatChainId(I)),methods:h,events:p,optionalMethods:l,optionalEvents:m,rpcMap:_,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:D,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const n={};return e.forEach(s=>{n[s]=this.getRpcUrl(s,t)}),n}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?Tc(this.rpc.chains):Tc(this.rpc.optionalChains),this.signer=await CI.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled,logger:e.logger}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let t;try{const{WalletConnectModal:n}=await s2(()=>import("./index-eb7b778e.js").then(s=>s.i),["assets/index-eb7b778e.js","assets/index-2be79e9f.js","assets/index-a0af7e8f.css"]);t=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(Ks({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:t,optionalChains:n,rpcMap:s}=e;t&&fn(t)&&(this.rpc.chains=t.map(o=>this.formatChainId(o)),t.forEach(o=>{this.rpc.rpcMap[o]=(s==null?void 0:s[o])||this.getRpcUrl(o)})),n&&fn(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n==null?void 0:n.map(o=>this.formatChainId(o)),n.forEach(o=>{this.rpc.rpcMap[o]=(s==null?void 0:s[o])||this.getRpcUrl(o)}))}getRpcUrl(e,t){var n;return((n=this.rpc.rpcMap)==null?void 0:n[e])||`${$I}?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:t==null?void 0:t.accounts),this.setAccounts(t==null?void 0:t.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(t=>this.signer.logger.warn(t))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(t=>this.parseAccount(t))}}const bD=Iu;export{bD as EthereumProvider,FI as OPTIONAL_EVENTS,LI as OPTIONAL_METHODS,tu as REQUIRED_EVENTS,eu as REQUIRED_METHODS,Iu as default};
|