@matchain/matchid-sdk-react 0.1.53-alpha.2 → 0.1.53-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/icon/index.d.mts +4 -144
- package/dist/assets/icon/index.d.ts +4 -144
- package/dist/assets/icon/index.js +54 -0
- package/dist/assets/icon/index.js.map +1 -1
- package/dist/assets/icon/index.mjs +5 -1
- package/dist/chunk-3CR66BEX.mjs +19 -0
- package/dist/chunk-3CR66BEX.mjs.map +1 -0
- package/dist/{chunk-W5A6WY7Y.mjs → chunk-CLMSEFOV.mjs} +5808 -4749
- package/dist/chunk-CLMSEFOV.mjs.map +1 -0
- package/dist/{chunk-LHNKZISB.mjs → chunk-FKXS2XRG.mjs} +114 -2
- package/dist/chunk-FKXS2XRG.mjs.map +1 -0
- package/dist/{chunk-MX7N57AH.mjs → chunk-IZOOVZAD.mjs} +11 -6
- package/dist/chunk-IZOOVZAD.mjs.map +1 -0
- package/dist/{chunk-HYQ3T6WW.mjs → chunk-JX73EY6V.mjs} +2 -14
- package/dist/chunk-JX73EY6V.mjs.map +1 -0
- package/dist/{chunk-FB5MHLWX.mjs → chunk-X5HGL3ZX.mjs} +45 -3
- package/dist/chunk-X5HGL3ZX.mjs.map +1 -0
- package/dist/components/index.d.mts +3 -3
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +1568 -504
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +11 -4
- package/dist/config/chains/index.mjs +2 -1
- package/dist/hooks/api/index.d.mts +3 -2
- package/dist/hooks/api/index.d.ts +3 -2
- package/dist/hooks/api/index.js +393 -82
- package/dist/hooks/api/index.js.map +1 -1
- package/dist/hooks/api/index.mjs +9 -8
- package/dist/hooks/index.d.mts +3 -2
- package/dist/hooks/index.d.ts +3 -2
- package/dist/hooks/index.js +620 -463
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +5 -4
- package/dist/index-B1T3lcwo.d.mts +203 -0
- package/dist/{index-Df-WlkXq.d.ts → index-B6Tmp2HR.d.ts} +25 -5
- package/dist/index-B6pp5UQe.d.ts +203 -0
- package/dist/{index-IwwXQ_QV.d.ts → index-BR3CyOOn.d.ts} +5 -2
- package/dist/{index-CZqdmQu1.d.mts → index-BeTS09HM.d.mts} +41 -17
- package/dist/{index-iWHaT8HV.d.mts → index-BxHKPC5n.d.mts} +1 -1
- package/dist/{index-B8cUP7cH.d.ts → index-CA7lhjpa.d.mts} +25 -5
- package/dist/{index-yy3VTdFU.d.mts → index-CRoZ0p2b.d.ts} +25 -5
- package/dist/{index-BCGJczpk.d.mts → index-CXPCmoIu.d.mts} +5 -2
- package/dist/{index-Bil_db2f.d.mts → index-Ce3oCu6-.d.mts} +19 -16
- package/dist/{index-DNJuiNdz.d.mts → index-Ci_ub_5y.d.mts} +25 -5
- package/dist/{index-BsL6zo6a.d.ts → index-DKV8v6s_.d.ts} +1 -1
- package/dist/{index-K5vXmiRX.d.ts → index-Dnjr-WPp.d.ts} +41 -17
- package/dist/{index-BS-NO8Y2.d.ts → index-IHigYscw.d.ts} +19 -16
- package/dist/index.css +132 -13
- package/dist/index.d.mts +9 -7
- package/dist/index.d.ts +9 -7
- package/dist/index.js +1956 -793
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -8
- package/dist/request-B0CyrGFT.d.mts +15 -0
- package/dist/request-B0CyrGFT.d.ts +15 -0
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/{types-CZbR7ERa.d.mts → types-mRkAnXBf.d.mts} +17 -1
- package/dist/{types-CZbR7ERa.d.ts → types-mRkAnXBf.d.ts} +17 -1
- package/dist/ui/index.d.mts +3 -3
- package/dist/ui/index.d.ts +3 -3
- package/dist/ui/index.js +109 -61
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/index.mjs +8 -4
- package/dist/utils/index.d.mts +3 -2
- package/dist/utils/index.d.ts +3 -2
- package/dist/utils/index.js +10 -4
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +3 -1
- package/example/dist/assets/Arc-R3PUWRPJ-CUdEQO8X.js +1 -0
- package/example/dist/assets/Brave-24BM36UM-C6C5mkTK.js +1 -0
- package/example/dist/assets/Browser-4R4QKTV2-D3ON1q-S.js +1 -0
- package/example/dist/assets/Chrome-TLI42HDP-BgiVz-ma.js +1 -0
- package/example/dist/assets/Edge-AZ34LAFM-EBh9cG_z.js +1 -0
- package/example/dist/assets/Firefox-ZDK7RHKK-5nyhB0sj.js +1 -0
- package/example/dist/assets/Linux-VYP66PDO--MOvpQUa.js +1 -0
- package/example/dist/assets/Macos-5QL4JBJE-DLNYPiln.js +1 -0
- package/example/dist/assets/Opera-BKMCKUXC-CCypmVaM.js +1 -0
- package/example/dist/assets/Safari-PXQIVS6N-B-Lfxb9r.js +1 -0
- package/example/dist/assets/Windows-GTAT3OTE-K9Pt3pUF.js +1 -0
- package/example/dist/assets/apechain-COEQ5RUI-0TDoXOYf.js +1 -0
- package/example/dist/assets/ar_AR-ZRPPM56D-d2WEfzQ_.js +1349 -0
- package/example/dist/assets/arbitrum-HW44W6XR-hPA5bMPt.js +1 -0
- package/example/dist/assets/assets-NU2OP443-COMs-Mo6.js +1 -0
- package/example/dist/assets/avalanche-MXEFEDSW-DcC5FNt3.js +1 -0
- package/example/dist/assets/base-Z4LFBE5D-DHfqMzJC.js +1 -0
- package/example/dist/assets/berachain-ZN3U5LDZ-CAvW_8ws.js +1 -0
- package/example/dist/assets/bitgetWallet-CLYTW54T-Wwn2QYd0.js +1 -0
- package/example/dist/assets/blast-46UQLYYY-BV_Xlsq4.js +1 -0
- package/example/dist/assets/bsc-RVE67I5L-DVYEF0vl.js +1 -0
- package/example/dist/assets/ccip-BhIcA6Sl.js +1 -0
- package/example/dist/assets/celo-E6XU57FO-C5IguUgF.js +1 -0
- package/example/dist/assets/coinbaseWallet-WWX6LF36-BMRj6mTC.js +1 -0
- package/example/dist/assets/connect-MR6XDLIE-BET5HMNk.js +1 -0
- package/example/dist/assets/create-X4WFHLCW-De9pC3ym.js +1 -0
- package/example/dist/assets/cronos-ROYR77VZ-Prn3LRPZ.js +1 -0
- package/example/dist/assets/de_DE-GYZFZXWH-CYZf24IR.js +1349 -0
- package/example/dist/assets/degen-7ROC3GCY-9HqAkHtZ.js +1 -0
- package/example/dist/assets/es_419-OGVOQEFZ-D6BJPTeQ.js +1349 -0
- package/example/dist/assets/ethereum-RFBAMUVK-WsW8NXqo.js +1 -0
- package/example/dist/assets/events-CkdpRqBF.js +1 -0
- package/example/dist/assets/flow-NBCRNYVF-D2XasjKk.js +1 -0
- package/example/dist/assets/fr_FR-Q5QBQBX2-lQoTmpTH.js +1349 -0
- package/example/dist/assets/gnosis-Y56LN66M-D4_J-ZQH.js +1 -0
- package/example/dist/assets/gravity-LMEBVSFN-DLxWpxhy.js +1 -0
- package/example/dist/assets/hardhat-NEEC6JX7-DzuWQYyS.js +1 -0
- package/example/dist/assets/hi_IN-7I7LRHGW-CTQjmeYe.js +1349 -0
- package/example/dist/assets/hooks.module-C5ONEBEq.js +1 -0
- package/example/dist/assets/hyperevm-J6CONVCX-C6oeYIAP.js +1 -0
- package/example/dist/assets/id_ID-ZMGZ2JFV-CgKQKAmU.js +1349 -0
- package/example/dist/assets/index-BG5XIZpE.js +3 -0
- package/example/dist/assets/index-BsarjAeg.js +1 -0
- package/example/dist/assets/index-DK7UFFe7.js +7 -0
- package/example/dist/assets/index-DPb8sz1C.js +54 -0
- package/example/dist/assets/index-JbpWt42F.js +1 -0
- package/example/dist/assets/index-YsGNa18R.css +1 -0
- package/example/dist/assets/index-kAjO6hfy.js +2 -0
- package/example/dist/assets/index-qgo91dsq.js +3942 -0
- package/example/dist/assets/index.es-D44wzsQe.js +71 -0
- package/example/dist/assets/injectedWallet-H7LYKTQS-CAHJNGc-.js +1 -0
- package/example/dist/assets/ink-4U4ZVNAB-AlM1MLfQ.js +1 -0
- package/example/dist/assets/ja_JP-NYBCHQTZ-CMaBl8Za.js +1349 -0
- package/example/dist/assets/kaia-A33DVQBT-Fgclbhio.js +1 -0
- package/example/dist/assets/ko_KR-67WE736M-DHWhIjcm.js +1349 -0
- package/example/dist/assets/linea-IALBSJQC-Cmyd7vgA.js +1 -0
- package/example/dist/assets/login-CWDTIDNK-DhDUYE4b.js +1 -0
- package/example/dist/assets/manta-5V6W5D7G-BnjsGzeJ.js +1 -0
- package/example/dist/assets/mantle-KBL3OIYT-DIpe0poV.js +1 -0
- package/example/dist/assets/metaMaskWallet-YFHEHW7V-BggUDXad.js +1 -0
- package/example/dist/assets/metaMaskWallet-YFHEHW7V-DBxkXEyI.js +1 -0
- package/example/dist/assets/ms_MY-65AJIBUS-BLlUrxe6.js +1349 -0
- package/example/dist/assets/okxWallet-GJMKZIND-Ctk5JsJ6.js +1 -0
- package/example/dist/assets/optimism-YWJ3IQHA-DYER-OR5.js +1 -0
- package/example/dist/assets/polygon-WWEUOMKW-CNBYSB1T.js +1 -0
- package/example/dist/assets/pt_BR-DMJANC65-DMs4DrlC.js +1349 -0
- package/example/dist/assets/rainbowWallet-2SR6TVBF-kimcGeuf.js +1 -0
- package/example/dist/assets/refresh-HJGJRASX-D0rkc63_.js +1 -0
- package/example/dist/assets/ronin-PNHX5V6H-BS-WPXjQ.js +1 -0
- package/example/dist/assets/ru_RU-WER7RQ6A-DsJK55uv.js +1349 -0
- package/example/dist/assets/safeWallet-VUYZPLY4-CXnodgMs.js +1 -0
- package/example/dist/assets/sanko-RHQYXGM5-OX010CbN.js +1 -0
- package/example/dist/assets/scan-DEOT2M37-1-mJ5OyF.js +1 -0
- package/example/dist/assets/scroll-MCKFTBRS-C2gqZSab.js +1 -0
- package/example/dist/assets/sign-A7IJEUT5-CGsRnPrd.js +1 -0
- package/example/dist/assets/th_TH-JOSHEZ6D-Cp87mIRZ.js +1349 -0
- package/example/dist/assets/tr_TR-EAMG2YPO-C52_xfsf.js +1349 -0
- package/example/dist/assets/uk_UA-GO2TRVWA-C1C1400t.js +1349 -0
- package/example/dist/assets/unichain-OQ3BZUDH-CyMLDmFg.js +1 -0
- package/example/dist/assets/vi_VN-5HLLSOJA-Dj7ferOp.js +1349 -0
- package/example/dist/assets/walletConnectWallet-FNSU4KNU-B0ci71fU.js +1 -0
- package/example/dist/assets/walletConnectWallet-FNSU4KNU-CBpCuHbd.js +1 -0
- package/example/dist/assets/xdc-X7V4QFNF-CSGs0o6M.js +1 -0
- package/example/dist/assets/zetachain-BMJKVYBN-IK2CZBr3.js +1 -0
- package/example/dist/assets/zh_CN-THPIFVWJ-Cbp71xMR.js +1349 -0
- package/example/dist/assets/zh_HK-R7XP4TGF-CyJtfKGw.js +1349 -0
- package/example/dist/assets/zh_TW-F5LD752V-AHFgsYw-.js +1349 -0
- package/example/dist/assets/zksync-UWUXFL74-Bt0brpXu.js +1 -0
- package/example/dist/assets/zora-YZH32HP3-CY3tp3EJ.js +1 -0
- package/example/dist/index.html +2 -2
- package/example/package.json +3 -1
- package/example/src/App.tsx +30 -7
- package/example/src/pages/Contact/index.tsx +90 -0
- package/example/src/pages/UI/components/Tabs.tsx +18 -0
- package/example/src/pages/UI/index.tsx +2 -0
- package/example/src/pages/User/index.tsx +7 -1
- package/package.json +5 -1
- package/dist/chunk-4A2YPGO3.mjs +0 -97
- package/dist/chunk-4A2YPGO3.mjs.map +0 -1
- package/dist/chunk-FB5MHLWX.mjs.map +0 -1
- package/dist/chunk-HYQ3T6WW.mjs.map +0 -1
- package/dist/chunk-LHNKZISB.mjs.map +0 -1
- package/dist/chunk-MX7N57AH.mjs.map +0 -1
- package/dist/chunk-W5A6WY7Y.mjs.map +0 -1
- package/example/dist/assets/TransportWebHID-BEu7tC0r.js +0 -1
- package/example/dist/assets/bignumber-iG7K-qxw.js +0 -10
- package/example/dist/assets/ccip-a6wQ1Vcb.js +0 -1
- package/example/dist/assets/draggabilly-CRYR_S0q.js +0 -14
- package/example/dist/assets/index--dp9m9Ep.js +0 -1
- package/example/dist/assets/index-BDTHolFv.js +0 -569
- package/example/dist/assets/index-BZl59qLb.js +0 -179
- package/example/dist/assets/index-BmMbYNHO.js +0 -303
- package/example/dist/assets/index-C7cxVRDF.js +0 -1677
- package/example/dist/assets/index-CJk171Yb.js +0 -1
- package/example/dist/assets/index-CQiBesAa.js +0 -3
- package/example/dist/assets/index-D62loNA9.js +0 -3
- package/example/dist/assets/index-DqyX3FG6.js +0 -1
- package/example/dist/assets/index-Gy3FXGhr.css +0 -1
- package/example/dist/assets/inherits_browser-BlmhoU4v.js +0 -1
- package/example/dist/assets/solanaEmbed.esm-Djn-u4Vn.js +0 -38
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-kAjO6hfy.js","assets/index-qgo91dsq.js","assets/index-YsGNa18R.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{h as Qg,w as ns,q as Zf,r as ia,t as Xg,l as Vr,v as Zg,x as jl,y as kl,g as Hl,_ as L5}from"./index-qgo91dsq.js";import{e as zi,J as Kl}from"./events-CkdpRqBF.js";var Ep=function(r,e,t){if(t||arguments.length===2)for(var i=0,s=e.length,a;i<s;i++)(a||!(i in e))&&(a||(a=Array.prototype.slice.call(e,0,i)),a[i]=e[i]);return r.concat(a||Array.prototype.slice.call(e))},U5=function(){function r(e,t,i){this.name=e,this.version=t,this.os=i,this.type="browser"}return r}(),$5=function(){function r(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return r}(),z5=function(){function r(e,t,i,s){this.name=e,this.version=t,this.os=i,this.bot=s,this.type="bot-device"}return r}(),j5=function(){function r(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return r}(),k5=function(){function r(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return r}(),H5=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,K5=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Sp=3,V5=[["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",H5]],xp=[["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 G5(r){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new k5:typeof navigator<"u"?J5(navigator.userAgent):Q5()}function W5(r){return r!==""&&V5.reduce(function(e,t){var i=t[0],s=t[1];if(e)return e;var a=s.exec(r);return!!a&&[i,a]},!1)}function J5(r){var e=W5(r);if(!e)return null;var t=e[0],i=e[1];if(t==="searchbot")return new j5;var s=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);s?s.length<Sp&&(s=Ep(Ep([],s,!0),X5(Sp-s.length),!0)):s=[];var a=s.join("."),f=Y5(r),u=K5.exec(r);return u&&u[1]?new z5(t,a,f,u[1]):new U5(t,a,f)}function Y5(r){for(var e=0,t=xp.length;e<t;e++){var i=xp[e],s=i[0],a=i[1],f=a.exec(r);if(f)return s}return null}function Q5(){var r=typeof process<"u"&&process.version;return r?new $5(process.version.slice(1)):null}function X5(r){for(var e=[],t=0;t<r;t++)e.push("0");return e}var Se={};/*! *****************************************************************************
|
|
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 gl=function(r,e){return gl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var s in i)i.hasOwnProperty(s)&&(t[s]=i[s])},gl(r,e)};function Z5(r,e){gl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var vl=function(){return vl=Object.assign||function(e){for(var t,i=1,s=arguments.length;i<s;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},vl.apply(this,arguments)};function e8(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(r);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(r,i[s])&&(t[i[s]]=r[i[s]]);return t}function t8(r,e,t,i){var s=arguments.length,a=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var u=r.length-1;u>=0;u--)(f=r[u])&&(a=(s<3?f(a):s>3?f(e,t,a):f(e,t))||a);return s>3&&a&&Object.defineProperty(e,t,a),a}function r8(r,e){return function(t,i){e(t,i,r)}}function i8(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function n8(r,e,t,i){function s(a){return a instanceof t?a:new t(function(f){f(a)})}return new(t||(t=Promise))(function(a,f){function u(w){try{v(i.next(w))}catch(S){f(S)}}function b(w){try{v(i.throw(w))}catch(S){f(S)}}function v(w){w.done?a(w.value):s(w.value).then(u,b)}v((i=i.apply(r,e||[])).next())})}function s8(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,s,a,f;return f={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function u(v){return function(w){return b([v,w])}}function b(v){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,s&&(a=v[0]&2?s.return:v[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,v[1])).done)return a;switch(s=0,a&&(v=[v[0]&2,a.value]),v[0]){case 0:case 1:a=v;break;case 4:return t.label++,{value:v[1],done:!1};case 5:t.label++,s=v[1],v=[0];continue;case 7:v=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(v[0]===6||v[0]===2)){t=0;continue}if(v[0]===3&&(!a||v[1]>a[0]&&v[1]<a[3])){t.label=v[1];break}if(v[0]===6&&t.label<a[1]){t.label=a[1],a=v;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(v);break}a[2]&&t.ops.pop(),t.trys.pop();continue}v=e.call(r,t)}catch(w){v=[6,w],s=0}finally{i=a=0}if(v[0]&5)throw v[1];return{value:v[0]?v[1]:void 0,done:!0}}}function a8(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}function o8(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function bl(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ev(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),s,a=[],f;try{for(;(e===void 0||e-- >0)&&!(s=i.next()).done;)a.push(s.value)}catch(u){f={error:u}}finally{try{s&&!s.done&&(t=i.return)&&t.call(i)}finally{if(f)throw f.error}}return a}function c8(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(ev(arguments[e]));return r}function f8(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var i=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],f=0,u=a.length;f<u;f++,s++)i[s]=a[f];return i}function ko(r){return this instanceof ko?(this.v=r,this):new ko(r)}function u8(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(r,e||[]),s,a=[];return s={},f("next"),f("throw"),f("return"),s[Symbol.asyncIterator]=function(){return this},s;function f(O){i[O]&&(s[O]=function(P){return new Promise(function(R,z){a.push([O,P,R,z])>1||u(O,P)})})}function u(O,P){try{b(i[O](P))}catch(R){S(a[0][3],R)}}function b(O){O.value instanceof ko?Promise.resolve(O.value.v).then(v,w):S(a[0][2],O)}function v(O){u("next",O)}function w(O){u("throw",O)}function S(O,P){O(P),a.shift(),a.length&&u(a[0][0],a[0][1])}}function h8(r){var e,t;return e={},i("next"),i("throw",function(s){throw s}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(s,a){e[s]=r[s]?function(f){return(t=!t)?{value:ko(r[s](f)),done:s==="return"}:a?a(f):f}:a}}function l8(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 bl=="function"?bl(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(a){t[a]=r[a]&&function(f){return new Promise(function(u,b){f=r[a](f),s(u,b,f.done,f.value)})}}function s(a,f,u,b){Promise.resolve(b).then(function(v){a({value:v,done:u})},f)}}function d8(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function p8(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 g8(r){return r&&r.__esModule?r:{default:r}}function v8(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function b8(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 m8=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return vl},__asyncDelegator:h8,__asyncGenerator:u8,__asyncValues:l8,__await:ko,__awaiter:n8,__classPrivateFieldGet:v8,__classPrivateFieldSet:b8,__createBinding:a8,__decorate:t8,__exportStar:o8,__extends:Z5,__generator:s8,__importDefault:g8,__importStar:p8,__makeTemplateObject:d8,__metadata:i8,__param:r8,__read:ev,__rest:e8,__spread:c8,__spreadArrays:f8,__values:bl},Symbol.toStringTag,{value:"Module"})),eu=Qg(m8);var Oh={},Ao={},Mp;function y8(){if(Mp)return Ao;Mp=1,Object.defineProperty(Ao,"__esModule",{value:!0}),Ao.delay=void 0;function r(e){return new Promise(t=>{setTimeout(()=>{t(!0)},e)})}return Ao.delay=r,Ao}var js={},Ch={},ks={},Ip;function w8(){return Ip||(Ip=1,Object.defineProperty(ks,"__esModule",{value:!0}),ks.ONE_THOUSAND=ks.ONE_HUNDRED=void 0,ks.ONE_HUNDRED=100,ks.ONE_THOUSAND=1e3),ks}var Rh={},Dp;function _8(){return Dp||(Dp=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}(Rh)),Rh}var Pp;function tv(){return Pp||(Pp=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=eu;e.__exportStar(w8(),r),e.__exportStar(_8(),r)}(Ch)),Ch}var Op;function A8(){if(Op)return js;Op=1,Object.defineProperty(js,"__esModule",{value:!0}),js.fromMiliseconds=js.toMiliseconds=void 0;const r=tv();function e(i){return i*r.ONE_THOUSAND}js.toMiliseconds=e;function t(i){return Math.floor(i/r.ONE_THOUSAND)}return js.fromMiliseconds=t,js}var Cp;function E8(){return Cp||(Cp=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=eu;e.__exportStar(y8(),r),e.__exportStar(A8(),r)}(Oh)),Oh}var Pa={},Rp;function S8(){if(Rp)return Pa;Rp=1,Object.defineProperty(Pa,"__esModule",{value:!0}),Pa.Watch=void 0;class r{constructor(){this.timestamps=new Map}start(t){if(this.timestamps.has(t))throw new Error(`Watch already started for label: ${t}`);this.timestamps.set(t,{started:Date.now()})}stop(t){const i=this.get(t);if(typeof i.elapsed<"u")throw new Error(`Watch already stopped for label: ${t}`);const s=Date.now()-i.started;this.timestamps.set(t,{started:i.started,elapsed:s})}get(t){const i=this.timestamps.get(t);if(typeof i>"u")throw new Error(`No timestamp found for label: ${t}`);return i}elapsed(t){const i=this.get(t);return i.elapsed||Date.now()-i.started}}return Pa.Watch=r,Pa.default=r,Pa}var Nh={},Eo={},Np;function x8(){if(Np)return Eo;Np=1,Object.defineProperty(Eo,"__esModule",{value:!0}),Eo.IWatch=void 0;class r{}return Eo.IWatch=r,Eo}var Tp;function M8(){return Tp||(Tp=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),eu.__exportStar(x8(),r)}(Nh)),Nh}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=eu;e.__exportStar(E8(),r),e.__exportStar(S8(),r),e.__exportStar(M8(),r),e.__exportStar(tv(),r)})(Se);var Ht={};Object.defineProperty(Ht,"__esModule",{value:!0});Ht.getLocalStorage=Ht.getLocalStorageOrThrow=Ht.getCrypto=Ht.getCryptoOrThrow=rv=Ht.getLocation=Ht.getLocationOrThrow=Vl=Ht.getNavigator=Ht.getNavigatorOrThrow=tu=Ht.getDocument=Ht.getDocumentOrThrow=Ht.getFromWindowOrThrow=Ht.getFromWindow=void 0;function na(r){let e;return typeof window<"u"&&typeof window[r]<"u"&&(e=window[r]),e}Ht.getFromWindow=na;function Ha(r){const e=na(r);if(!e)throw new Error(`${r} is not defined in Window`);return e}Ht.getFromWindowOrThrow=Ha;function I8(){return Ha("document")}Ht.getDocumentOrThrow=I8;function D8(){return na("document")}var tu=Ht.getDocument=D8;function P8(){return Ha("navigator")}Ht.getNavigatorOrThrow=P8;function O8(){return na("navigator")}var Vl=Ht.getNavigator=O8;function C8(){return Ha("location")}Ht.getLocationOrThrow=C8;function R8(){return na("location")}var rv=Ht.getLocation=R8;function N8(){return Ha("crypto")}Ht.getCryptoOrThrow=N8;function T8(){return na("crypto")}Ht.getCrypto=T8;function F8(){return Ha("localStorage")}Ht.getLocalStorageOrThrow=F8;function B8(){return na("localStorage")}Ht.getLocalStorage=B8;var Gl={};Object.defineProperty(Gl,"__esModule",{value:!0});var iv=Gl.getWindowMetadata=void 0;const Fp=Ht;function q8(){let r,e;try{r=Fp.getDocumentOrThrow(),e=Fp.getLocationOrThrow()}catch{return null}function t(){const S=r.getElementsByTagName("link"),O=[];for(let P=0;P<S.length;P++){const R=S[P],z=R.getAttribute("rel");if(z&&z.toLowerCase().indexOf("icon")>-1){const W=R.getAttribute("href");if(W)if(W.toLowerCase().indexOf("https:")===-1&&W.toLowerCase().indexOf("http:")===-1&&W.indexOf("//")!==0){let Q=e.protocol+"//"+e.host;if(W.indexOf("/")===0)Q+=W;else{const j=e.pathname.split("/");j.pop();const Y=j.join("/");Q+=Y+"/"+W}O.push(Q)}else if(W.indexOf("//")===0){const Q=e.protocol+W;O.push(Q)}else O.push(W)}}return O}function i(...S){const O=r.getElementsByTagName("meta");for(let P=0;P<O.length;P++){const R=O[P],z=["itemprop","property","name"].map(W=>R.getAttribute(W)).filter(W=>W?S.includes(W):!1);if(z.length&&z){const W=R.getAttribute("content");if(W)return W}}return""}function s(){let S=i("name","og:site_name","og:title","twitter:title");return S||(S=r.title),S}function a(){return i("description","og:description","twitter:description","keywords")}const f=s(),u=a(),b=e.origin,v=t();return{description:u,url:b,icons:v,name:f}}iv=Gl.getWindowMetadata=q8;var Ho={},L8=r=>encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),nv="%[a-f0-9]{2}",Bp=new RegExp("("+nv+")|([^%]+?)","gi"),qp=new RegExp("("+nv+")+","gi");function ml(r,e){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;e=e||1;var t=r.slice(0,e),i=r.slice(e);return Array.prototype.concat.call([],ml(t),ml(i))}function U8(r){try{return decodeURIComponent(r)}catch{for(var e=r.match(Bp)||[],t=1;t<e.length;t++)r=ml(e,t).join(""),e=r.match(Bp)||[];return r}}function $8(r){for(var e={"%FE%FF":"��","%FF%FE":"��"},t=qp.exec(r);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch{var i=U8(t[0]);i!==t[0]&&(e[t[0]]=i)}t=qp.exec(r)}e["%C2"]="�";for(var s=Object.keys(e),a=0;a<s.length;a++){var f=s[a];r=r.replace(new RegExp(f,"g"),e[f])}return r}var z8=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 $8(r)}},j8=(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)]},k8=function(r,e){for(var t={},i=Object.keys(r),s=Array.isArray(e),a=0;a<i.length;a++){var f=i[a],u=r[f];(s?e.indexOf(f)!==-1:e(f,u,r))&&(t[f]=u)}return t};(function(r){const e=L8,t=z8,i=j8,s=k8,a=j=>j==null,f=Symbol("encodeFragmentIdentifier");function u(j){switch(j.arrayFormat){case"index":return Y=>(U,k)=>{const V=U.length;return k===void 0||j.skipNull&&k===null||j.skipEmptyString&&k===""?U:k===null?[...U,[w(Y,j),"[",V,"]"].join("")]:[...U,[w(Y,j),"[",w(V,j),"]=",w(k,j)].join("")]};case"bracket":return Y=>(U,k)=>k===void 0||j.skipNull&&k===null||j.skipEmptyString&&k===""?U:k===null?[...U,[w(Y,j),"[]"].join("")]:[...U,[w(Y,j),"[]=",w(k,j)].join("")];case"colon-list-separator":return Y=>(U,k)=>k===void 0||j.skipNull&&k===null||j.skipEmptyString&&k===""?U:k===null?[...U,[w(Y,j),":list="].join("")]:[...U,[w(Y,j),":list=",w(k,j)].join("")];case"comma":case"separator":case"bracket-separator":{const Y=j.arrayFormat==="bracket-separator"?"[]=":"=";return U=>(k,V)=>V===void 0||j.skipNull&&V===null||j.skipEmptyString&&V===""?k:(V=V===null?"":V,k.length===0?[[w(U,j),Y,w(V,j)].join("")]:[[k,w(V,j)].join(j.arrayFormatSeparator)])}default:return Y=>(U,k)=>k===void 0||j.skipNull&&k===null||j.skipEmptyString&&k===""?U:k===null?[...U,w(Y,j)]:[...U,[w(Y,j),"=",w(k,j)].join("")]}}function b(j){let Y;switch(j.arrayFormat){case"index":return(U,k,V)=>{if(Y=/\[(\d*)\]$/.exec(U),U=U.replace(/\[\d*\]$/,""),!Y){V[U]=k;return}V[U]===void 0&&(V[U]={}),V[U][Y[1]]=k};case"bracket":return(U,k,V)=>{if(Y=/(\[\])$/.exec(U),U=U.replace(/\[\]$/,""),!Y){V[U]=k;return}if(V[U]===void 0){V[U]=[k];return}V[U]=[].concat(V[U],k)};case"colon-list-separator":return(U,k,V)=>{if(Y=/(:list)$/.exec(U),U=U.replace(/:list$/,""),!Y){V[U]=k;return}if(V[U]===void 0){V[U]=[k];return}V[U]=[].concat(V[U],k)};case"comma":case"separator":return(U,k,V)=>{const A=typeof k=="string"&&k.includes(j.arrayFormatSeparator),F=typeof k=="string"&&!A&&S(k,j).includes(j.arrayFormatSeparator);k=F?S(k,j):k;const ae=A||F?k.split(j.arrayFormatSeparator).map(de=>S(de,j)):k===null?k:S(k,j);V[U]=ae};case"bracket-separator":return(U,k,V)=>{const A=/(\[\])$/.test(U);if(U=U.replace(/\[\]$/,""),!A){V[U]=k&&S(k,j);return}const F=k===null?[]:k.split(j.arrayFormatSeparator).map(ae=>S(ae,j));if(V[U]===void 0){V[U]=F;return}V[U]=[].concat(V[U],F)};default:return(U,k,V)=>{if(V[U]===void 0){V[U]=k;return}V[U]=[].concat(V[U],k)}}}function v(j){if(typeof j!="string"||j.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function w(j,Y){return Y.encode?Y.strict?e(j):encodeURIComponent(j):j}function S(j,Y){return Y.decode?t(j):j}function O(j){return Array.isArray(j)?j.sort():typeof j=="object"?O(Object.keys(j)).sort((Y,U)=>Number(Y)-Number(U)).map(Y=>j[Y]):j}function P(j){const Y=j.indexOf("#");return Y!==-1&&(j=j.slice(0,Y)),j}function R(j){let Y="";const U=j.indexOf("#");return U!==-1&&(Y=j.slice(U)),Y}function z(j){j=P(j);const Y=j.indexOf("?");return Y===-1?"":j.slice(Y+1)}function W(j,Y){return Y.parseNumbers&&!Number.isNaN(Number(j))&&typeof j=="string"&&j.trim()!==""?j=Number(j):Y.parseBooleans&&j!==null&&(j.toLowerCase()==="true"||j.toLowerCase()==="false")&&(j=j.toLowerCase()==="true"),j}function Q(j,Y){Y=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},Y),v(Y.arrayFormatSeparator);const U=b(Y),k=Object.create(null);if(typeof j!="string"||(j=j.trim().replace(/^[?#&]/,""),!j))return k;for(const V of j.split("&")){if(V==="")continue;let[A,F]=i(Y.decode?V.replace(/\+/g," "):V,"=");F=F===void 0?null:["comma","separator","bracket-separator"].includes(Y.arrayFormat)?F:S(F,Y),U(S(A,Y),F,k)}for(const V of Object.keys(k)){const A=k[V];if(typeof A=="object"&&A!==null)for(const F of Object.keys(A))A[F]=W(A[F],Y);else k[V]=W(A,Y)}return Y.sort===!1?k:(Y.sort===!0?Object.keys(k).sort():Object.keys(k).sort(Y.sort)).reduce((V,A)=>{const F=k[A];return F&&typeof F=="object"&&!Array.isArray(F)?V[A]=O(F):V[A]=F,V},Object.create(null))}r.extract=z,r.parse=Q,r.stringify=(j,Y)=>{if(!j)return"";Y=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},Y),v(Y.arrayFormatSeparator);const U=F=>Y.skipNull&&a(j[F])||Y.skipEmptyString&&j[F]==="",k=u(Y),V={};for(const F of Object.keys(j))U(F)||(V[F]=j[F]);const A=Object.keys(V);return Y.sort!==!1&&A.sort(Y.sort),A.map(F=>{const ae=j[F];return ae===void 0?"":ae===null?w(F,Y):Array.isArray(ae)?ae.length===0&&Y.arrayFormat==="bracket-separator"?w(F,Y)+"[]":ae.reduce(k(F),[]).join("&"):w(F,Y)+"="+w(ae,Y)}).filter(F=>F.length>0).join("&")},r.parseUrl=(j,Y)=>{Y=Object.assign({decode:!0},Y);const[U,k]=i(j,"#");return Object.assign({url:U.split("?")[0]||"",query:Q(z(j),Y)},Y&&Y.parseFragmentIdentifier&&k?{fragmentIdentifier:S(k,Y)}:{})},r.stringifyUrl=(j,Y)=>{Y=Object.assign({encode:!0,strict:!0,[f]:!0},Y);const U=P(j.url).split("?")[0]||"",k=r.extract(j.url),V=r.parse(k,{sort:!1}),A=Object.assign(V,j.query);let F=r.stringify(A,Y);F&&(F=`?${F}`);let ae=R(j.url);return j.fragmentIdentifier&&(ae=`#${Y[f]?w(j.fragmentIdentifier,Y):j.fragmentIdentifier}`),`${U}${F}${ae}`},r.pick=(j,Y,U)=>{U=Object.assign({parseFragmentIdentifier:!0,[f]:!1},U);const{url:k,query:V,fragmentIdentifier:A}=r.parseUrl(j,U);return r.stringifyUrl({url:k,query:s(V,Y),fragmentIdentifier:A},U)},r.exclude=(j,Y,U)=>{const k=Array.isArray(Y)?V=>!Y.includes(V):(V,A)=>!Y(V,A);return r.pick(j,k,U)}})(Ho);var Wl={},ru={};Object.defineProperty(ru,"__esModule",{value:!0});var Lr=Zf,yl=ns,H8=20;function K8(r,e,t){for(var i=1634760805,s=857760878,a=2036477234,f=1797285236,u=t[3]<<24|t[2]<<16|t[1]<<8|t[0],b=t[7]<<24|t[6]<<16|t[5]<<8|t[4],v=t[11]<<24|t[10]<<16|t[9]<<8|t[8],w=t[15]<<24|t[14]<<16|t[13]<<8|t[12],S=t[19]<<24|t[18]<<16|t[17]<<8|t[16],O=t[23]<<24|t[22]<<16|t[21]<<8|t[20],P=t[27]<<24|t[26]<<16|t[25]<<8|t[24],R=t[31]<<24|t[30]<<16|t[29]<<8|t[28],z=e[3]<<24|e[2]<<16|e[1]<<8|e[0],W=e[7]<<24|e[6]<<16|e[5]<<8|e[4],Q=e[11]<<24|e[10]<<16|e[9]<<8|e[8],j=e[15]<<24|e[14]<<16|e[13]<<8|e[12],Y=i,U=s,k=a,V=f,A=u,F=b,ae=v,de=w,L=S,m=O,c=P,p=R,d=z,y=W,M=Q,I=j,x=0;x<H8;x+=2)Y=Y+A|0,d^=Y,d=d>>>16|d<<16,L=L+d|0,A^=L,A=A>>>20|A<<12,U=U+F|0,y^=U,y=y>>>16|y<<16,m=m+y|0,F^=m,F=F>>>20|F<<12,k=k+ae|0,M^=k,M=M>>>16|M<<16,c=c+M|0,ae^=c,ae=ae>>>20|ae<<12,V=V+de|0,I^=V,I=I>>>16|I<<16,p=p+I|0,de^=p,de=de>>>20|de<<12,k=k+ae|0,M^=k,M=M>>>24|M<<8,c=c+M|0,ae^=c,ae=ae>>>25|ae<<7,V=V+de|0,I^=V,I=I>>>24|I<<8,p=p+I|0,de^=p,de=de>>>25|de<<7,U=U+F|0,y^=U,y=y>>>24|y<<8,m=m+y|0,F^=m,F=F>>>25|F<<7,Y=Y+A|0,d^=Y,d=d>>>24|d<<8,L=L+d|0,A^=L,A=A>>>25|A<<7,Y=Y+F|0,I^=Y,I=I>>>16|I<<16,c=c+I|0,F^=c,F=F>>>20|F<<12,U=U+ae|0,d^=U,d=d>>>16|d<<16,p=p+d|0,ae^=p,ae=ae>>>20|ae<<12,k=k+de|0,y^=k,y=y>>>16|y<<16,L=L+y|0,de^=L,de=de>>>20|de<<12,V=V+A|0,M^=V,M=M>>>16|M<<16,m=m+M|0,A^=m,A=A>>>20|A<<12,k=k+de|0,y^=k,y=y>>>24|y<<8,L=L+y|0,de^=L,de=de>>>25|de<<7,V=V+A|0,M^=V,M=M>>>24|M<<8,m=m+M|0,A^=m,A=A>>>25|A<<7,U=U+ae|0,d^=U,d=d>>>24|d<<8,p=p+d|0,ae^=p,ae=ae>>>25|ae<<7,Y=Y+F|0,I^=Y,I=I>>>24|I<<8,c=c+I|0,F^=c,F=F>>>25|F<<7;Lr.writeUint32LE(Y+i|0,r,0),Lr.writeUint32LE(U+s|0,r,4),Lr.writeUint32LE(k+a|0,r,8),Lr.writeUint32LE(V+f|0,r,12),Lr.writeUint32LE(A+u|0,r,16),Lr.writeUint32LE(F+b|0,r,20),Lr.writeUint32LE(ae+v|0,r,24),Lr.writeUint32LE(de+w|0,r,28),Lr.writeUint32LE(L+S|0,r,32),Lr.writeUint32LE(m+O|0,r,36),Lr.writeUint32LE(c+P|0,r,40),Lr.writeUint32LE(p+R|0,r,44),Lr.writeUint32LE(d+z|0,r,48),Lr.writeUint32LE(y+W|0,r,52),Lr.writeUint32LE(M+Q|0,r,56),Lr.writeUint32LE(I+j|0,r,60)}function sv(r,e,t,i,s){if(s===void 0&&(s=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length<t.length)throw new Error("ChaCha: destination is shorter than source");var a,f;if(s===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");a=new Uint8Array(16),f=a.length-e.length,a.set(e,f)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");a=e,f=s}for(var u=new Uint8Array(64),b=0;b<t.length;b+=64){K8(u,a,r);for(var v=b;v<b+64&&v<t.length;v++)i[v]=t[v]^u[v-b];G8(a,0,f)}return yl.wipe(u),s===0&&yl.wipe(a),i}ru.streamXOR=sv;function V8(r,e,t,i){return i===void 0&&(i=0),yl.wipe(t),sv(r,e,t,t,i)}ru.stream=V8;function G8(r,e,t){for(var i=1;t--;)i=i+(r[e]&255)|0,r[e]=i&255,i>>>=8,e++;if(i>0)throw new Error("ChaCha: counter overflow")}var av={},Ms={};Object.defineProperty(Ms,"__esModule",{value:!0});function W8(r,e,t){return~(r-1)&e|r-1&t}Ms.select=W8;function J8(r,e){return(r|0)-(e|0)-1>>>31&1}Ms.lessOrEqual=J8;function ov(r,e){if(r.length!==e.length)return 0;for(var t=0,i=0;i<r.length;i++)t|=r[i]^e[i];return 1&t-1>>>8}Ms.compare=ov;function Y8(r,e){return r.length===0||e.length===0?!1:ov(r,e)!==0}Ms.equal=Y8;(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=Ms,t=ns;r.DIGEST_LENGTH=16;var i=function(){function f(u){this.digestLength=r.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var b=u[0]|u[1]<<8;this._r[0]=b&8191;var v=u[2]|u[3]<<8;this._r[1]=(b>>>13|v<<3)&8191;var w=u[4]|u[5]<<8;this._r[2]=(v>>>10|w<<6)&7939;var S=u[6]|u[7]<<8;this._r[3]=(w>>>7|S<<9)&8191;var O=u[8]|u[9]<<8;this._r[4]=(S>>>4|O<<12)&255,this._r[5]=O>>>1&8190;var P=u[10]|u[11]<<8;this._r[6]=(O>>>14|P<<2)&8191;var R=u[12]|u[13]<<8;this._r[7]=(P>>>11|R<<5)&8065;var z=u[14]|u[15]<<8;this._r[8]=(R>>>8|z<<8)&8191,this._r[9]=z>>>5&127,this._pad[0]=u[16]|u[17]<<8,this._pad[1]=u[18]|u[19]<<8,this._pad[2]=u[20]|u[21]<<8,this._pad[3]=u[22]|u[23]<<8,this._pad[4]=u[24]|u[25]<<8,this._pad[5]=u[26]|u[27]<<8,this._pad[6]=u[28]|u[29]<<8,this._pad[7]=u[30]|u[31]<<8}return f.prototype._blocks=function(u,b,v){for(var w=this._fin?0:2048,S=this._h[0],O=this._h[1],P=this._h[2],R=this._h[3],z=this._h[4],W=this._h[5],Q=this._h[6],j=this._h[7],Y=this._h[8],U=this._h[9],k=this._r[0],V=this._r[1],A=this._r[2],F=this._r[3],ae=this._r[4],de=this._r[5],L=this._r[6],m=this._r[7],c=this._r[8],p=this._r[9];v>=16;){var d=u[b+0]|u[b+1]<<8;S+=d&8191;var y=u[b+2]|u[b+3]<<8;O+=(d>>>13|y<<3)&8191;var M=u[b+4]|u[b+5]<<8;P+=(y>>>10|M<<6)&8191;var I=u[b+6]|u[b+7]<<8;R+=(M>>>7|I<<9)&8191;var x=u[b+8]|u[b+9]<<8;z+=(I>>>4|x<<12)&8191,W+=x>>>1&8191;var l=u[b+10]|u[b+11]<<8;Q+=(x>>>14|l<<2)&8191;var g=u[b+12]|u[b+13]<<8;j+=(l>>>11|g<<5)&8191;var N=u[b+14]|u[b+15]<<8;Y+=(g>>>8|N<<8)&8191,U+=N>>>5|w;var Z=0,te=Z;te+=S*k,te+=O*(5*p),te+=P*(5*c),te+=R*(5*m),te+=z*(5*L),Z=te>>>13,te&=8191,te+=W*(5*de),te+=Q*(5*ae),te+=j*(5*F),te+=Y*(5*A),te+=U*(5*V),Z+=te>>>13,te&=8191;var D=Z;D+=S*V,D+=O*k,D+=P*(5*p),D+=R*(5*c),D+=z*(5*m),Z=D>>>13,D&=8191,D+=W*(5*L),D+=Q*(5*de),D+=j*(5*ae),D+=Y*(5*F),D+=U*(5*A),Z+=D>>>13,D&=8191;var ee=Z;ee+=S*A,ee+=O*V,ee+=P*k,ee+=R*(5*p),ee+=z*(5*c),Z=ee>>>13,ee&=8191,ee+=W*(5*m),ee+=Q*(5*L),ee+=j*(5*de),ee+=Y*(5*ae),ee+=U*(5*F),Z+=ee>>>13,ee&=8191;var B=Z;B+=S*F,B+=O*A,B+=P*V,B+=R*k,B+=z*(5*p),Z=B>>>13,B&=8191,B+=W*(5*c),B+=Q*(5*m),B+=j*(5*L),B+=Y*(5*de),B+=U*(5*ae),Z+=B>>>13,B&=8191;var H=Z;H+=S*ae,H+=O*F,H+=P*A,H+=R*V,H+=z*k,Z=H>>>13,H&=8191,H+=W*(5*p),H+=Q*(5*c),H+=j*(5*m),H+=Y*(5*L),H+=U*(5*de),Z+=H>>>13,H&=8191;var K=Z;K+=S*de,K+=O*ae,K+=P*F,K+=R*A,K+=z*V,Z=K>>>13,K&=8191,K+=W*k,K+=Q*(5*p),K+=j*(5*c),K+=Y*(5*m),K+=U*(5*L),Z+=K>>>13,K&=8191;var _=Z;_+=S*L,_+=O*de,_+=P*ae,_+=R*F,_+=z*A,Z=_>>>13,_&=8191,_+=W*V,_+=Q*k,_+=j*(5*p),_+=Y*(5*c),_+=U*(5*m),Z+=_>>>13,_&=8191;var $=Z;$+=S*m,$+=O*L,$+=P*de,$+=R*ae,$+=z*F,Z=$>>>13,$&=8191,$+=W*A,$+=Q*V,$+=j*k,$+=Y*(5*p),$+=U*(5*c),Z+=$>>>13,$&=8191;var se=Z;se+=S*c,se+=O*m,se+=P*L,se+=R*de,se+=z*ae,Z=se>>>13,se&=8191,se+=W*F,se+=Q*A,se+=j*V,se+=Y*k,se+=U*(5*p),Z+=se>>>13,se&=8191;var ce=Z;ce+=S*p,ce+=O*c,ce+=P*m,ce+=R*L,ce+=z*de,Z=ce>>>13,ce&=8191,ce+=W*ae,ce+=Q*F,ce+=j*A,ce+=Y*V,ce+=U*k,Z+=ce>>>13,ce&=8191,Z=(Z<<2)+Z|0,Z=Z+te|0,te=Z&8191,Z=Z>>>13,D+=Z,S=te,O=D,P=ee,R=B,z=H,W=K,Q=_,j=$,Y=se,U=ce,b+=16,v-=16}this._h[0]=S,this._h[1]=O,this._h[2]=P,this._h[3]=R,this._h[4]=z,this._h[5]=W,this._h[6]=Q,this._h[7]=j,this._h[8]=Y,this._h[9]=U},f.prototype.finish=function(u,b){b===void 0&&(b=0);var v=new Uint16Array(10),w,S,O,P;if(this._leftover){for(P=this._leftover,this._buffer[P++]=1;P<16;P++)this._buffer[P]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(w=this._h[1]>>>13,this._h[1]&=8191,P=2;P<10;P++)this._h[P]+=w,w=this._h[P]>>>13,this._h[P]&=8191;for(this._h[0]+=w*5,w=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=w,w=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=w,v[0]=this._h[0]+5,w=v[0]>>>13,v[0]&=8191,P=1;P<10;P++)v[P]=this._h[P]+w,w=v[P]>>>13,v[P]&=8191;for(v[9]-=8192,S=(w^1)-1,P=0;P<10;P++)v[P]&=S;for(S=~S,P=0;P<10;P++)this._h[P]=this._h[P]&S|v[P];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,O=this._h[0]+this._pad[0],this._h[0]=O&65535,P=1;P<8;P++)O=(this._h[P]+this._pad[P]|0)+(O>>>16)|0,this._h[P]=O&65535;return u[b+0]=this._h[0]>>>0,u[b+1]=this._h[0]>>>8,u[b+2]=this._h[1]>>>0,u[b+3]=this._h[1]>>>8,u[b+4]=this._h[2]>>>0,u[b+5]=this._h[2]>>>8,u[b+6]=this._h[3]>>>0,u[b+7]=this._h[3]>>>8,u[b+8]=this._h[4]>>>0,u[b+9]=this._h[4]>>>8,u[b+10]=this._h[5]>>>0,u[b+11]=this._h[5]>>>8,u[b+12]=this._h[6]>>>0,u[b+13]=this._h[6]>>>8,u[b+14]=this._h[7]>>>0,u[b+15]=this._h[7]>>>8,this._finished=!0,this},f.prototype.update=function(u){var b=0,v=u.length,w;if(this._leftover){w=16-this._leftover,w>v&&(w=v);for(var S=0;S<w;S++)this._buffer[this._leftover+S]=u[b+S];if(v-=w,b+=w,this._leftover+=w,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(v>=16&&(w=v-v%16,this._blocks(u,b,w),b+=w,v-=w),v){for(var S=0;S<v;S++)this._buffer[this._leftover+S]=u[b+S];this._leftover+=v}return this},f.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var u=new Uint8Array(16);return this.finish(u),u},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=i;function s(f,u){var b=new i(f);b.update(u);var v=b.digest();return b.clean(),v}r.oneTimeAuth=s;function a(f,u){return f.length!==r.DIGEST_LENGTH||u.length!==r.DIGEST_LENGTH?!1:e.equal(f,u)}r.equal=a})(av);(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=ru,t=av,i=ns,s=Zf,a=Ms;r.KEY_LENGTH=32,r.NONCE_LENGTH=12,r.TAG_LENGTH=16;var f=new Uint8Array(16),u=function(){function b(v){if(this.nonceLength=r.NONCE_LENGTH,this.tagLength=r.TAG_LENGTH,v.length!==r.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(v)}return b.prototype.seal=function(v,w,S,O){if(v.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var P=new Uint8Array(16);P.set(v,P.length-v.length);var R=new Uint8Array(32);e.stream(this._key,P,R,4);var z=w.length+this.tagLength,W;if(O){if(O.length!==z)throw new Error("ChaCha20Poly1305: incorrect destination length");W=O}else W=new Uint8Array(z);return e.streamXOR(this._key,P,w,W,4),this._authenticate(W.subarray(W.length-this.tagLength,W.length),R,W.subarray(0,W.length-this.tagLength),S),i.wipe(P),W},b.prototype.open=function(v,w,S,O){if(v.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(w.length<this.tagLength)return null;var P=new Uint8Array(16);P.set(v,P.length-v.length);var R=new Uint8Array(32);e.stream(this._key,P,R,4);var z=new Uint8Array(this.tagLength);if(this._authenticate(z,R,w.subarray(0,w.length-this.tagLength),S),!a.equal(z,w.subarray(w.length-this.tagLength,w.length)))return null;var W=w.length-this.tagLength,Q;if(O){if(O.length!==W)throw new Error("ChaCha20Poly1305: incorrect destination length");Q=O}else Q=new Uint8Array(W);return e.streamXOR(this._key,P,w.subarray(0,w.length-this.tagLength),Q,4),i.wipe(P),Q},b.prototype.clean=function(){return i.wipe(this._key),this},b.prototype._authenticate=function(v,w,S,O){var P=new t.Poly1305(w);O&&(P.update(O),O.length%16>0&&P.update(f.subarray(O.length%16))),P.update(S),S.length%16>0&&P.update(f.subarray(S.length%16));var R=new Uint8Array(8);O&&s.writeUint64LE(O.length,R),P.update(R),s.writeUint64LE(S.length,R),P.update(R);for(var z=P.digest(),W=0;W<z.length;W++)v[W]=z[W];P.clean(),i.wipe(z),i.wipe(R)},b}();r.ChaCha20Poly1305=u})(Wl);var cv={},Xo={},Jl={};Object.defineProperty(Jl,"__esModule",{value:!0});function Q8(r){return typeof r.saveState<"u"&&typeof r.restoreState<"u"&&typeof r.cleanSavedState<"u"}Jl.isSerializableHash=Q8;Object.defineProperty(Xo,"__esModule",{value:!0});var mn=Jl,X8=Ms,Z8=ns,fv=function(){function r(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(i).clean():i.set(t);for(var s=0;s<i.length;s++)i[s]^=54;this._inner.update(i);for(var s=0;s<i.length;s++)i[s]^=106;this._outer.update(i),mn.isSerializableHash(this._inner)&&mn.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),Z8.wipe(i)}return r.prototype.reset=function(){if(!mn.isSerializableHash(this._inner)||!mn.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(){mn.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),mn.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(!mn.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(!mn.isSerializableHash(this._inner)||!mn.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(!mn.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},r}();Xo.HMAC=fv;function e4(r,e,t){var i=new fv(r,e);i.update(t);var s=i.digest();return i.clean(),s}Xo.hmac=e4;Xo.equal=X8.equal;Object.defineProperty(cv,"__esModule",{value:!0});var Lp=Xo,Up=ns,t4=function(){function r(e,t,i,s){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=s;var a=Lp.hmac(this._hash,i,t);this._hmac=new Lp.HMAC(e,a),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return r.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},r.prototype.expand=function(e){for(var t=new Uint8Array(e),i=0;i<t.length;i++)this._bufpos===this._buffer.length&&this._fillBuffer(),t[i]=this._buffer[this._bufpos++];return t},r.prototype.clean=function(){this._hmac.clean(),Up.wipe(this._buffer),Up.wipe(this._counter),this._bufpos=0},r}(),r4=cv.HKDF=t4,Zo={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=Zf,t=ns;r.DIGEST_LENGTH=32,r.BLOCK_SIZE=64;var i=function(){function u(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return u.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},u.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},u.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._temp),this.reset()},u.prototype.update=function(b,v){if(v===void 0&&(v=b.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var w=0;if(this._bytesHashed+=v,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&v>0;)this._buffer[this._bufferLength++]=b[w++],v--;this._bufferLength===this.blockSize&&(a(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(v>=this.blockSize&&(w=a(this._temp,this._state,b,w,v),v%=this.blockSize);v>0;)this._buffer[this._bufferLength++]=b[w++],v--;return this},u.prototype.finish=function(b){if(!this._finished){var v=this._bytesHashed,w=this._bufferLength,S=v/536870912|0,O=v<<3,P=v%64<56?64:128;this._buffer[w]=128;for(var R=w+1;R<P-8;R++)this._buffer[R]=0;e.writeUint32BE(S,this._buffer,P-8),e.writeUint32BE(O,this._buffer,P-4),a(this._temp,this._state,this._buffer,0,P),this._finished=!0}for(var R=0;R<this.digestLength/4;R++)e.writeUint32BE(this._state[R],b,R*4);return this},u.prototype.digest=function(){var b=new Uint8Array(this.digestLength);return this.finish(b),b},u.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},u.prototype.restoreState=function(b){return this._state.set(b.state),this._bufferLength=b.bufferLength,b.buffer&&this._buffer.set(b.buffer),this._bytesHashed=b.bytesHashed,this._finished=!1,this},u.prototype.cleanSavedState=function(b){t.wipe(b.state),b.buffer&&t.wipe(b.buffer),b.bufferLength=0,b.bytesHashed=0},u}();r.SHA256=i;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 a(u,b,v,w,S){for(;S>=64;){for(var O=b[0],P=b[1],R=b[2],z=b[3],W=b[4],Q=b[5],j=b[6],Y=b[7],U=0;U<16;U++){var k=w+U*4;u[U]=e.readUint32BE(v,k)}for(var U=16;U<64;U++){var V=u[U-2],A=(V>>>17|V<<15)^(V>>>19|V<<13)^V>>>10;V=u[U-15];var F=(V>>>7|V<<25)^(V>>>18|V<<14)^V>>>3;u[U]=(A+u[U-7]|0)+(F+u[U-16]|0)}for(var U=0;U<64;U++){var A=(((W>>>6|W<<26)^(W>>>11|W<<21)^(W>>>25|W<<7))+(W&Q^~W&j)|0)+(Y+(s[U]+u[U]|0)|0)|0,F=((O>>>2|O<<30)^(O>>>13|O<<19)^(O>>>22|O<<10))+(O&P^O&R^P&R)|0;Y=j,j=Q,Q=W,W=z+A|0,z=R,R=P,P=O,O=A+F|0}b[0]+=O,b[1]+=P,b[2]+=R,b[3]+=z,b[4]+=W,b[5]+=Q,b[6]+=j,b[7]+=Y,w+=64,S-=64}return w}function f(u){var b=new i;b.update(u);var v=b.digest();return b.clean(),v}r.hash=f})(Zo);var Yl={};(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=ia,t=ns;r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=32,r.SHARED_KEY_LENGTH=32;function i(U){const k=new Float64Array(16);if(U)for(let V=0;V<U.length;V++)k[V]=U[V];return k}const s=new Uint8Array(32);s[0]=9;const a=i([56129,1]);function f(U){let k=1;for(let V=0;V<16;V++){let A=U[V]+k+65535;k=Math.floor(A/65536),U[V]=A-k*65536}U[0]+=k-1+37*(k-1)}function u(U,k,V){const A=~(V-1);for(let F=0;F<16;F++){const ae=A&(U[F]^k[F]);U[F]^=ae,k[F]^=ae}}function b(U,k){const V=i(),A=i();for(let F=0;F<16;F++)A[F]=k[F];f(A),f(A),f(A);for(let F=0;F<2;F++){V[0]=A[0]-65517;for(let de=1;de<15;de++)V[de]=A[de]-65535-(V[de-1]>>16&1),V[de-1]&=65535;V[15]=A[15]-32767-(V[14]>>16&1);const ae=V[15]>>16&1;V[14]&=65535,u(A,V,1-ae)}for(let F=0;F<16;F++)U[2*F]=A[F]&255,U[2*F+1]=A[F]>>8}function v(U,k){for(let V=0;V<16;V++)U[V]=k[2*V]+(k[2*V+1]<<8);U[15]&=32767}function w(U,k,V){for(let A=0;A<16;A++)U[A]=k[A]+V[A]}function S(U,k,V){for(let A=0;A<16;A++)U[A]=k[A]-V[A]}function O(U,k,V){let A,F,ae=0,de=0,L=0,m=0,c=0,p=0,d=0,y=0,M=0,I=0,x=0,l=0,g=0,N=0,Z=0,te=0,D=0,ee=0,B=0,H=0,K=0,_=0,$=0,se=0,ce=0,ue=0,ye=0,we=0,Re=0,Qe=0,Pe=0,Ne=V[0],Me=V[1],me=V[2],Oe=V[3],Te=V[4],ve=V[5],Ce=V[6],xe=V[7],be=V[8],Le=V[9],Ie=V[10],_e=V[11],He=V[12],Ve=V[13],Ee=V[14],Ke=V[15];A=k[0],ae+=A*Ne,de+=A*Me,L+=A*me,m+=A*Oe,c+=A*Te,p+=A*ve,d+=A*Ce,y+=A*xe,M+=A*be,I+=A*Le,x+=A*Ie,l+=A*_e,g+=A*He,N+=A*Ve,Z+=A*Ee,te+=A*Ke,A=k[1],de+=A*Ne,L+=A*Me,m+=A*me,c+=A*Oe,p+=A*Te,d+=A*ve,y+=A*Ce,M+=A*xe,I+=A*be,x+=A*Le,l+=A*Ie,g+=A*_e,N+=A*He,Z+=A*Ve,te+=A*Ee,D+=A*Ke,A=k[2],L+=A*Ne,m+=A*Me,c+=A*me,p+=A*Oe,d+=A*Te,y+=A*ve,M+=A*Ce,I+=A*xe,x+=A*be,l+=A*Le,g+=A*Ie,N+=A*_e,Z+=A*He,te+=A*Ve,D+=A*Ee,ee+=A*Ke,A=k[3],m+=A*Ne,c+=A*Me,p+=A*me,d+=A*Oe,y+=A*Te,M+=A*ve,I+=A*Ce,x+=A*xe,l+=A*be,g+=A*Le,N+=A*Ie,Z+=A*_e,te+=A*He,D+=A*Ve,ee+=A*Ee,B+=A*Ke,A=k[4],c+=A*Ne,p+=A*Me,d+=A*me,y+=A*Oe,M+=A*Te,I+=A*ve,x+=A*Ce,l+=A*xe,g+=A*be,N+=A*Le,Z+=A*Ie,te+=A*_e,D+=A*He,ee+=A*Ve,B+=A*Ee,H+=A*Ke,A=k[5],p+=A*Ne,d+=A*Me,y+=A*me,M+=A*Oe,I+=A*Te,x+=A*ve,l+=A*Ce,g+=A*xe,N+=A*be,Z+=A*Le,te+=A*Ie,D+=A*_e,ee+=A*He,B+=A*Ve,H+=A*Ee,K+=A*Ke,A=k[6],d+=A*Ne,y+=A*Me,M+=A*me,I+=A*Oe,x+=A*Te,l+=A*ve,g+=A*Ce,N+=A*xe,Z+=A*be,te+=A*Le,D+=A*Ie,ee+=A*_e,B+=A*He,H+=A*Ve,K+=A*Ee,_+=A*Ke,A=k[7],y+=A*Ne,M+=A*Me,I+=A*me,x+=A*Oe,l+=A*Te,g+=A*ve,N+=A*Ce,Z+=A*xe,te+=A*be,D+=A*Le,ee+=A*Ie,B+=A*_e,H+=A*He,K+=A*Ve,_+=A*Ee,$+=A*Ke,A=k[8],M+=A*Ne,I+=A*Me,x+=A*me,l+=A*Oe,g+=A*Te,N+=A*ve,Z+=A*Ce,te+=A*xe,D+=A*be,ee+=A*Le,B+=A*Ie,H+=A*_e,K+=A*He,_+=A*Ve,$+=A*Ee,se+=A*Ke,A=k[9],I+=A*Ne,x+=A*Me,l+=A*me,g+=A*Oe,N+=A*Te,Z+=A*ve,te+=A*Ce,D+=A*xe,ee+=A*be,B+=A*Le,H+=A*Ie,K+=A*_e,_+=A*He,$+=A*Ve,se+=A*Ee,ce+=A*Ke,A=k[10],x+=A*Ne,l+=A*Me,g+=A*me,N+=A*Oe,Z+=A*Te,te+=A*ve,D+=A*Ce,ee+=A*xe,B+=A*be,H+=A*Le,K+=A*Ie,_+=A*_e,$+=A*He,se+=A*Ve,ce+=A*Ee,ue+=A*Ke,A=k[11],l+=A*Ne,g+=A*Me,N+=A*me,Z+=A*Oe,te+=A*Te,D+=A*ve,ee+=A*Ce,B+=A*xe,H+=A*be,K+=A*Le,_+=A*Ie,$+=A*_e,se+=A*He,ce+=A*Ve,ue+=A*Ee,ye+=A*Ke,A=k[12],g+=A*Ne,N+=A*Me,Z+=A*me,te+=A*Oe,D+=A*Te,ee+=A*ve,B+=A*Ce,H+=A*xe,K+=A*be,_+=A*Le,$+=A*Ie,se+=A*_e,ce+=A*He,ue+=A*Ve,ye+=A*Ee,we+=A*Ke,A=k[13],N+=A*Ne,Z+=A*Me,te+=A*me,D+=A*Oe,ee+=A*Te,B+=A*ve,H+=A*Ce,K+=A*xe,_+=A*be,$+=A*Le,se+=A*Ie,ce+=A*_e,ue+=A*He,ye+=A*Ve,we+=A*Ee,Re+=A*Ke,A=k[14],Z+=A*Ne,te+=A*Me,D+=A*me,ee+=A*Oe,B+=A*Te,H+=A*ve,K+=A*Ce,_+=A*xe,$+=A*be,se+=A*Le,ce+=A*Ie,ue+=A*_e,ye+=A*He,we+=A*Ve,Re+=A*Ee,Qe+=A*Ke,A=k[15],te+=A*Ne,D+=A*Me,ee+=A*me,B+=A*Oe,H+=A*Te,K+=A*ve,_+=A*Ce,$+=A*xe,se+=A*be,ce+=A*Le,ue+=A*Ie,ye+=A*_e,we+=A*He,Re+=A*Ve,Qe+=A*Ee,Pe+=A*Ke,ae+=38*D,de+=38*ee,L+=38*B,m+=38*H,c+=38*K,p+=38*_,d+=38*$,y+=38*se,M+=38*ce,I+=38*ue,x+=38*ye,l+=38*we,g+=38*Re,N+=38*Qe,Z+=38*Pe,F=1,A=ae+F+65535,F=Math.floor(A/65536),ae=A-F*65536,A=de+F+65535,F=Math.floor(A/65536),de=A-F*65536,A=L+F+65535,F=Math.floor(A/65536),L=A-F*65536,A=m+F+65535,F=Math.floor(A/65536),m=A-F*65536,A=c+F+65535,F=Math.floor(A/65536),c=A-F*65536,A=p+F+65535,F=Math.floor(A/65536),p=A-F*65536,A=d+F+65535,F=Math.floor(A/65536),d=A-F*65536,A=y+F+65535,F=Math.floor(A/65536),y=A-F*65536,A=M+F+65535,F=Math.floor(A/65536),M=A-F*65536,A=I+F+65535,F=Math.floor(A/65536),I=A-F*65536,A=x+F+65535,F=Math.floor(A/65536),x=A-F*65536,A=l+F+65535,F=Math.floor(A/65536),l=A-F*65536,A=g+F+65535,F=Math.floor(A/65536),g=A-F*65536,A=N+F+65535,F=Math.floor(A/65536),N=A-F*65536,A=Z+F+65535,F=Math.floor(A/65536),Z=A-F*65536,A=te+F+65535,F=Math.floor(A/65536),te=A-F*65536,ae+=F-1+37*(F-1),F=1,A=ae+F+65535,F=Math.floor(A/65536),ae=A-F*65536,A=de+F+65535,F=Math.floor(A/65536),de=A-F*65536,A=L+F+65535,F=Math.floor(A/65536),L=A-F*65536,A=m+F+65535,F=Math.floor(A/65536),m=A-F*65536,A=c+F+65535,F=Math.floor(A/65536),c=A-F*65536,A=p+F+65535,F=Math.floor(A/65536),p=A-F*65536,A=d+F+65535,F=Math.floor(A/65536),d=A-F*65536,A=y+F+65535,F=Math.floor(A/65536),y=A-F*65536,A=M+F+65535,F=Math.floor(A/65536),M=A-F*65536,A=I+F+65535,F=Math.floor(A/65536),I=A-F*65536,A=x+F+65535,F=Math.floor(A/65536),x=A-F*65536,A=l+F+65535,F=Math.floor(A/65536),l=A-F*65536,A=g+F+65535,F=Math.floor(A/65536),g=A-F*65536,A=N+F+65535,F=Math.floor(A/65536),N=A-F*65536,A=Z+F+65535,F=Math.floor(A/65536),Z=A-F*65536,A=te+F+65535,F=Math.floor(A/65536),te=A-F*65536,ae+=F-1+37*(F-1),U[0]=ae,U[1]=de,U[2]=L,U[3]=m,U[4]=c,U[5]=p,U[6]=d,U[7]=y,U[8]=M,U[9]=I,U[10]=x,U[11]=l,U[12]=g,U[13]=N,U[14]=Z,U[15]=te}function P(U,k){O(U,k,k)}function R(U,k){const V=i();for(let A=0;A<16;A++)V[A]=k[A];for(let A=253;A>=0;A--)P(V,V),A!==2&&A!==4&&O(V,V,k);for(let A=0;A<16;A++)U[A]=V[A]}function z(U,k){const V=new Uint8Array(32),A=new Float64Array(80),F=i(),ae=i(),de=i(),L=i(),m=i(),c=i();for(let M=0;M<31;M++)V[M]=U[M];V[31]=U[31]&127|64,V[0]&=248,v(A,k);for(let M=0;M<16;M++)ae[M]=A[M];F[0]=L[0]=1;for(let M=254;M>=0;--M){const I=V[M>>>3]>>>(M&7)&1;u(F,ae,I),u(de,L,I),w(m,F,de),S(F,F,de),w(de,ae,L),S(ae,ae,L),P(L,m),P(c,F),O(F,de,F),O(de,ae,m),w(m,F,de),S(F,F,de),P(ae,F),S(de,L,c),O(F,de,a),w(F,F,L),O(de,de,F),O(F,L,c),O(L,ae,A),P(ae,m),u(F,ae,I),u(de,L,I)}for(let M=0;M<16;M++)A[M+16]=F[M],A[M+32]=de[M],A[M+48]=ae[M],A[M+64]=L[M];const p=A.subarray(32),d=A.subarray(16);R(p,p),O(d,d,p);const y=new Uint8Array(32);return b(y,d),y}r.scalarMult=z;function W(U){return z(U,s)}r.scalarMultBase=W;function Q(U){if(U.length!==r.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${r.SECRET_KEY_LENGTH} bytes`);const k=new Uint8Array(U);return{publicKey:W(k),secretKey:k}}r.generateKeyPairFromSeed=Q;function j(U){const k=(0,e.randomBytes)(32,U),V=Q(k);return(0,t.wipe)(k),V}r.generateKeyPair=j;function Y(U,k,V=!1){if(U.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(k.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const A=z(U,k);if(V){let F=0;for(let ae=0;ae<A.length;ae++)F|=A[ae];if(F===0)throw new Error("X25519: invalid shared key")}return A}r.sharedKey=Y})(Yl);function uv(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function If(r,e){e||(e=r.reduce((s,a)=>s+a.length,0));const t=uv(e);let i=0;for(const s of r)t.set(s,i),i+=s.length;return t}function i4(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i<t.length;i++)t[i]=255;for(var s=0;s<r.length;s++){var a=r.charAt(s),f=a.charCodeAt(0);if(t[f]!==255)throw new TypeError(a+" is ambiguous");t[f]=s}var u=r.length,b=r.charAt(0),v=Math.log(u)/Math.log(256),w=Math.log(256)/Math.log(u);function S(R){if(R instanceof Uint8Array||(ArrayBuffer.isView(R)?R=new Uint8Array(R.buffer,R.byteOffset,R.byteLength):Array.isArray(R)&&(R=Uint8Array.from(R))),!(R instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(R.length===0)return"";for(var z=0,W=0,Q=0,j=R.length;Q!==j&&R[Q]===0;)Q++,z++;for(var Y=(j-Q)*w+1>>>0,U=new Uint8Array(Y);Q!==j;){for(var k=R[Q],V=0,A=Y-1;(k!==0||V<W)&&A!==-1;A--,V++)k+=256*U[A]>>>0,U[A]=k%u>>>0,k=k/u>>>0;if(k!==0)throw new Error("Non-zero carry");W=V,Q++}for(var F=Y-W;F!==Y&&U[F]===0;)F++;for(var ae=b.repeat(z);F<Y;++F)ae+=r.charAt(U[F]);return ae}function O(R){if(typeof R!="string")throw new TypeError("Expected String");if(R.length===0)return new Uint8Array;var z=0;if(R[z]!==" "){for(var W=0,Q=0;R[z]===b;)W++,z++;for(var j=(R.length-z)*v+1>>>0,Y=new Uint8Array(j);R[z];){var U=t[R.charCodeAt(z)];if(U===255)return;for(var k=0,V=j-1;(U!==0||k<Q)&&V!==-1;V--,k++)U+=u*Y[V]>>>0,Y[V]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");Q=k,z++}if(R[z]!==" "){for(var A=j-Q;A!==j&&Y[A]===0;)A++;for(var F=new Uint8Array(W+(j-A)),ae=W;A!==j;)F[ae++]=Y[A++];return F}}}function P(R){var z=O(R);if(z)return z;throw new Error(`Non-${e} character`)}return{encode:S,decodeUnsafe:O,decode:P}}var n4=i4,s4=n4;const a4=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")},o4=r=>new TextEncoder().encode(r),c4=r=>new TextDecoder().decode(r);class f4{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class u4{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return hv(this,e)}}class h4{constructor(e){this.decoders=e}or(e){return hv(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const hv=(r,e)=>new h4({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});class l4{constructor(e,t,i,s){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=s,this.encoder=new f4(e,t,i),this.decoder=new u4(e,t,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const iu=({name:r,prefix:e,encode:t,decode:i})=>new l4(r,e,t,i),ec=({prefix:r,name:e,alphabet:t})=>{const{encode:i,decode:s}=s4(t,e);return iu({prefix:r,name:e,encode:i,decode:a=>a4(s(a))})},d4=(r,e,t,i)=>{const s={};for(let w=0;w<e.length;++w)s[e[w]]=w;let a=r.length;for(;r[a-1]==="=";)--a;const f=new Uint8Array(a*t/8|0);let u=0,b=0,v=0;for(let w=0;w<a;++w){const S=s[r[w]];if(S===void 0)throw new SyntaxError(`Non-${i} character`);b=b<<t|S,u+=t,u>=8&&(u-=8,f[v++]=255&b>>u)}if(u>=t||255&b<<8-u)throw new SyntaxError("Unexpected end of data");return f},p4=(r,e,t)=>{const i=e[e.length-1]==="=",s=(1<<t)-1;let a="",f=0,u=0;for(let b=0;b<r.length;++b)for(u=u<<8|r[b],f+=8;f>t;)f-=t,a+=e[s&u>>f];if(f&&(a+=e[s&u<<t-f]),i)for(;a.length*t&7;)a+="=";return a},Dr=({name:r,prefix:e,bitsPerChar:t,alphabet:i})=>iu({prefix:e,name:r,encode(s){return p4(s,i,t)},decode(s){return d4(s,i,t,r)}}),g4=iu({prefix:"\0",name:"identity",encode:r=>c4(r),decode:r=>o4(r)}),v4=Object.freeze(Object.defineProperty({__proto__:null,identity:g4},Symbol.toStringTag,{value:"Module"})),b4=Dr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),m4=Object.freeze(Object.defineProperty({__proto__:null,base2:b4},Symbol.toStringTag,{value:"Module"})),y4=Dr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),w4=Object.freeze(Object.defineProperty({__proto__:null,base8:y4},Symbol.toStringTag,{value:"Module"})),_4=ec({prefix:"9",name:"base10",alphabet:"0123456789"}),A4=Object.freeze(Object.defineProperty({__proto__:null,base10:_4},Symbol.toStringTag,{value:"Module"})),E4=Dr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),S4=Dr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),x4=Object.freeze(Object.defineProperty({__proto__:null,base16:E4,base16upper:S4},Symbol.toStringTag,{value:"Module"})),M4=Dr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),I4=Dr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),D4=Dr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),P4=Dr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),O4=Dr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),C4=Dr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),R4=Dr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),N4=Dr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),T4=Dr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),F4=Object.freeze(Object.defineProperty({__proto__:null,base32:M4,base32hex:O4,base32hexpad:R4,base32hexpadupper:N4,base32hexupper:C4,base32pad:D4,base32padupper:P4,base32upper:I4,base32z:T4},Symbol.toStringTag,{value:"Module"})),B4=ec({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),q4=ec({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),L4=Object.freeze(Object.defineProperty({__proto__:null,base36:B4,base36upper:q4},Symbol.toStringTag,{value:"Module"})),U4=ec({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),$4=ec({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),z4=Object.freeze(Object.defineProperty({__proto__:null,base58btc:U4,base58flickr:$4},Symbol.toStringTag,{value:"Module"})),j4=Dr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),k4=Dr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),H4=Dr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),K4=Dr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),V4=Object.freeze(Object.defineProperty({__proto__:null,base64:j4,base64pad:k4,base64url:H4,base64urlpad:K4},Symbol.toStringTag,{value:"Module"})),lv=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),G4=lv.reduce((r,e,t)=>(r[t]=e,r),[]),W4=lv.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function J4(r){return r.reduce((e,t)=>(e+=G4[t],e),"")}function Y4(r){const e=[];for(const t of r){const i=W4[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const Q4=iu({prefix:"🚀",name:"base256emoji",encode:J4,decode:Y4}),X4=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:Q4},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const $p={...v4,...m4,...w4,...A4,...x4,...F4,...L4,...z4,...V4,...X4};function dv(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const zp=dv("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Th=dv("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=uv(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),pv={utf8:zp,"utf-8":zp,hex:$p.base16,latin1:Th,ascii:Th,binary:Th,...$p};function wr(r,e="utf8"){const t=pv[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 _r(r,e="utf8"){const t=pv[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 gv={};const Z4="elliptic",e_="6.6.1",t_="EC cryptography",r_="lib/elliptic.js",i_=["lib"],n_={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/"},s_={type:"git",url:"git@github.com:indutny/elliptic"},a_=["EC","Elliptic","curve","Cryptography"],o_="Fedor Indutny <fedor@indutny.com>",c_="MIT",f_={url:"https://github.com/indutny/elliptic/issues"},u_="https://github.com/indutny/elliptic",h_={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"},l_={"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"},d_={name:Z4,version:e_,description:t_,main:r_,files:i_,scripts:n_,repository:s_,keywords:a_,author:o_,license:c_,bugs:f_,homepage:u_,devDependencies:h_,dependencies:l_};var Ai={},Ql={exports:{}};Ql.exports;(function(r){(function(e,t){function i(L,m){if(!L)throw new Error(m||"Assertion failed")}function s(L,m){L.super_=m;var c=function(){};c.prototype=m.prototype,L.prototype=new c,L.prototype.constructor=L}function a(L,m,c){if(a.isBN(L))return L;this.negative=0,this.words=null,this.length=0,this.red=null,L!==null&&((m==="le"||m==="be")&&(c=m,m=10),this._init(L||0,m||10,c||"be"))}typeof e=="object"?e.exports=a:t.BN=a,a.BN=a,a.wordSize=26;var f;try{typeof window<"u"&&typeof window.Buffer<"u"?f=window.Buffer:f=Xg.Buffer}catch{}a.isBN=function(m){return m instanceof a?!0:m!==null&&typeof m=="object"&&m.constructor.wordSize===a.wordSize&&Array.isArray(m.words)},a.max=function(m,c){return m.cmp(c)>0?m:c},a.min=function(m,c){return m.cmp(c)<0?m:c},a.prototype._init=function(m,c,p){if(typeof m=="number")return this._initNumber(m,c,p);if(typeof m=="object")return this._initArray(m,c,p);c==="hex"&&(c=16),i(c===(c|0)&&c>=2&&c<=36),m=m.toString().replace(/\s+/g,"");var d=0;m[0]==="-"&&(d++,this.negative=1),d<m.length&&(c===16?this._parseHex(m,d,p):(this._parseBase(m,c,d),p==="le"&&this._initArray(this.toArray(),c,p)))},a.prototype._initNumber=function(m,c,p){m<0&&(this.negative=1,m=-m),m<67108864?(this.words=[m&67108863],this.length=1):m<4503599627370496?(this.words=[m&67108863,m/67108864&67108863],this.length=2):(i(m<9007199254740992),this.words=[m&67108863,m/67108864&67108863,1],this.length=3),p==="le"&&this._initArray(this.toArray(),c,p)},a.prototype._initArray=function(m,c,p){if(i(typeof m.length=="number"),m.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(m.length/3),this.words=new Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var y,M,I=0;if(p==="be")for(d=m.length-1,y=0;d>=0;d-=3)M=m[d]|m[d-1]<<8|m[d-2]<<16,this.words[y]|=M<<I&67108863,this.words[y+1]=M>>>26-I&67108863,I+=24,I>=26&&(I-=26,y++);else if(p==="le")for(d=0,y=0;d<m.length;d+=3)M=m[d]|m[d+1]<<8|m[d+2]<<16,this.words[y]|=M<<I&67108863,this.words[y+1]=M>>>26-I&67108863,I+=24,I>=26&&(I-=26,y++);return this.strip()};function u(L,m){var c=L.charCodeAt(m);return c>=65&&c<=70?c-55:c>=97&&c<=102?c-87:c-48&15}function b(L,m,c){var p=u(L,c);return c-1>=m&&(p|=u(L,c-1)<<4),p}a.prototype._parseHex=function(m,c,p){this.length=Math.ceil((m.length-c)/6),this.words=new Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var y=0,M=0,I;if(p==="be")for(d=m.length-1;d>=c;d-=2)I=b(m,c,d)<<y,this.words[M]|=I&67108863,y>=18?(y-=18,M+=1,this.words[M]|=I>>>26):y+=8;else{var x=m.length-c;for(d=x%2===0?c+1:c;d<m.length;d+=2)I=b(m,c,d)<<y,this.words[M]|=I&67108863,y>=18?(y-=18,M+=1,this.words[M]|=I>>>26):y+=8}this.strip()};function v(L,m,c,p){for(var d=0,y=Math.min(L.length,c),M=m;M<y;M++){var I=L.charCodeAt(M)-48;d*=p,I>=49?d+=I-49+10:I>=17?d+=I-17+10:d+=I}return d}a.prototype._parseBase=function(m,c,p){this.words=[0],this.length=1;for(var d=0,y=1;y<=67108863;y*=c)d++;d--,y=y/c|0;for(var M=m.length-p,I=M%d,x=Math.min(M,M-I)+p,l=0,g=p;g<x;g+=d)l=v(m,g,g+d,c),this.imuln(y),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l);if(I!==0){var N=1;for(l=v(m,g,m.length,c),g=0;g<I;g++)N*=c;this.imuln(N),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l)}this.strip()},a.prototype.copy=function(m){m.words=new Array(this.length);for(var c=0;c<this.length;c++)m.words[c]=this.words[c];m.length=this.length,m.negative=this.negative,m.red=this.red},a.prototype.clone=function(){var m=new a(null);return this.copy(m),m},a.prototype._expand=function(m){for(;this.length<m;)this.words[this.length++]=0;return this},a.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},a.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var w=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],S=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],O=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];a.prototype.toString=function(m,c){m=m||10,c=c|0||1;var p;if(m===16||m==="hex"){p="";for(var d=0,y=0,M=0;M<this.length;M++){var I=this.words[M],x=((I<<d|y)&16777215).toString(16);y=I>>>24-d&16777215,d+=2,d>=26&&(d-=26,M--),y!==0||M!==this.length-1?p=w[6-x.length]+x+p:p=x+p}for(y!==0&&(p=y.toString(16)+p);p.length%c!==0;)p="0"+p;return this.negative!==0&&(p="-"+p),p}if(m===(m|0)&&m>=2&&m<=36){var l=S[m],g=O[m];p="";var N=this.clone();for(N.negative=0;!N.isZero();){var Z=N.modn(g).toString(m);N=N.idivn(g),N.isZero()?p=Z+p:p=w[l-Z.length]+Z+p}for(this.isZero()&&(p="0"+p);p.length%c!==0;)p="0"+p;return this.negative!==0&&(p="-"+p),p}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var m=this.words[0];return this.length===2?m+=this.words[1]*67108864:this.length===3&&this.words[2]===1?m+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-m:m},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(m,c){return i(typeof f<"u"),this.toArrayLike(f,m,c)},a.prototype.toArray=function(m,c){return this.toArrayLike(Array,m,c)},a.prototype.toArrayLike=function(m,c,p){var d=this.byteLength(),y=p||Math.max(1,d);i(d<=y,"byte array longer than desired length"),i(y>0,"Requested array length <= 0"),this.strip();var M=c==="le",I=new m(y),x,l,g=this.clone();if(M){for(l=0;!g.isZero();l++)x=g.andln(255),g.iushrn(8),I[l]=x;for(;l<y;l++)I[l]=0}else{for(l=0;l<y-d;l++)I[l]=0;for(l=0;!g.isZero();l++)x=g.andln(255),g.iushrn(8),I[y-l-1]=x}return I},Math.clz32?a.prototype._countBits=function(m){return 32-Math.clz32(m)}:a.prototype._countBits=function(m){var c=m,p=0;return c>=4096&&(p+=13,c>>>=13),c>=64&&(p+=7,c>>>=7),c>=8&&(p+=4,c>>>=4),c>=2&&(p+=2,c>>>=2),p+c},a.prototype._zeroBits=function(m){if(m===0)return 26;var c=m,p=0;return c&8191||(p+=13,c>>>=13),c&127||(p+=7,c>>>=7),c&15||(p+=4,c>>>=4),c&3||(p+=2,c>>>=2),c&1||p++,p},a.prototype.bitLength=function(){var m=this.words[this.length-1],c=this._countBits(m);return(this.length-1)*26+c};function P(L){for(var m=new Array(L.bitLength()),c=0;c<m.length;c++){var p=c/26|0,d=c%26;m[c]=(L.words[p]&1<<d)>>>d}return m}a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var m=0,c=0;c<this.length;c++){var p=this._zeroBits(this.words[c]);if(m+=p,p!==26)break}return m},a.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},a.prototype.toTwos=function(m){return this.negative!==0?this.abs().inotn(m).iaddn(1):this.clone()},a.prototype.fromTwos=function(m){return this.testn(m-1)?this.notn(m).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return this.negative!==0},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(m){for(;this.length<m.length;)this.words[this.length++]=0;for(var c=0;c<m.length;c++)this.words[c]=this.words[c]|m.words[c];return this.strip()},a.prototype.ior=function(m){return i((this.negative|m.negative)===0),this.iuor(m)},a.prototype.or=function(m){return this.length>m.length?this.clone().ior(m):m.clone().ior(this)},a.prototype.uor=function(m){return this.length>m.length?this.clone().iuor(m):m.clone().iuor(this)},a.prototype.iuand=function(m){var c;this.length>m.length?c=m:c=this;for(var p=0;p<c.length;p++)this.words[p]=this.words[p]&m.words[p];return this.length=c.length,this.strip()},a.prototype.iand=function(m){return i((this.negative|m.negative)===0),this.iuand(m)},a.prototype.and=function(m){return this.length>m.length?this.clone().iand(m):m.clone().iand(this)},a.prototype.uand=function(m){return this.length>m.length?this.clone().iuand(m):m.clone().iuand(this)},a.prototype.iuxor=function(m){var c,p;this.length>m.length?(c=this,p=m):(c=m,p=this);for(var d=0;d<p.length;d++)this.words[d]=c.words[d]^p.words[d];if(this!==c)for(;d<c.length;d++)this.words[d]=c.words[d];return this.length=c.length,this.strip()},a.prototype.ixor=function(m){return i((this.negative|m.negative)===0),this.iuxor(m)},a.prototype.xor=function(m){return this.length>m.length?this.clone().ixor(m):m.clone().ixor(this)},a.prototype.uxor=function(m){return this.length>m.length?this.clone().iuxor(m):m.clone().iuxor(this)},a.prototype.inotn=function(m){i(typeof m=="number"&&m>=0);var c=Math.ceil(m/26)|0,p=m%26;this._expand(c),p>0&&c--;for(var d=0;d<c;d++)this.words[d]=~this.words[d]&67108863;return p>0&&(this.words[d]=~this.words[d]&67108863>>26-p),this.strip()},a.prototype.notn=function(m){return this.clone().inotn(m)},a.prototype.setn=function(m,c){i(typeof m=="number"&&m>=0);var p=m/26|0,d=m%26;return this._expand(p+1),c?this.words[p]=this.words[p]|1<<d:this.words[p]=this.words[p]&~(1<<d),this.strip()},a.prototype.iadd=function(m){var c;if(this.negative!==0&&m.negative===0)return this.negative=0,c=this.isub(m),this.negative^=1,this._normSign();if(this.negative===0&&m.negative!==0)return m.negative=0,c=this.isub(m),m.negative=1,c._normSign();var p,d;this.length>m.length?(p=this,d=m):(p=m,d=this);for(var y=0,M=0;M<d.length;M++)c=(p.words[M]|0)+(d.words[M]|0)+y,this.words[M]=c&67108863,y=c>>>26;for(;y!==0&&M<p.length;M++)c=(p.words[M]|0)+y,this.words[M]=c&67108863,y=c>>>26;if(this.length=p.length,y!==0)this.words[this.length]=y,this.length++;else if(p!==this)for(;M<p.length;M++)this.words[M]=p.words[M];return this},a.prototype.add=function(m){var c;return m.negative!==0&&this.negative===0?(m.negative=0,c=this.sub(m),m.negative^=1,c):m.negative===0&&this.negative!==0?(this.negative=0,c=m.sub(this),this.negative=1,c):this.length>m.length?this.clone().iadd(m):m.clone().iadd(this)},a.prototype.isub=function(m){if(m.negative!==0){m.negative=0;var c=this.iadd(m);return m.negative=1,c._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(m),this.negative=1,this._normSign();var p=this.cmp(m);if(p===0)return this.negative=0,this.length=1,this.words[0]=0,this;var d,y;p>0?(d=this,y=m):(d=m,y=this);for(var M=0,I=0;I<y.length;I++)c=(d.words[I]|0)-(y.words[I]|0)+M,M=c>>26,this.words[I]=c&67108863;for(;M!==0&&I<d.length;I++)c=(d.words[I]|0)+M,M=c>>26,this.words[I]=c&67108863;if(M===0&&I<d.length&&d!==this)for(;I<d.length;I++)this.words[I]=d.words[I];return this.length=Math.max(this.length,I),d!==this&&(this.negative=1),this.strip()},a.prototype.sub=function(m){return this.clone().isub(m)};function R(L,m,c){c.negative=m.negative^L.negative;var p=L.length+m.length|0;c.length=p,p=p-1|0;var d=L.words[0]|0,y=m.words[0]|0,M=d*y,I=M&67108863,x=M/67108864|0;c.words[0]=I;for(var l=1;l<p;l++){for(var g=x>>>26,N=x&67108863,Z=Math.min(l,m.length-1),te=Math.max(0,l-L.length+1);te<=Z;te++){var D=l-te|0;d=L.words[D]|0,y=m.words[te]|0,M=d*y+N,g+=M/67108864|0,N=M&67108863}c.words[l]=N|0,x=g|0}return x!==0?c.words[l]=x|0:c.length--,c.strip()}var z=function(m,c,p){var d=m.words,y=c.words,M=p.words,I=0,x,l,g,N=d[0]|0,Z=N&8191,te=N>>>13,D=d[1]|0,ee=D&8191,B=D>>>13,H=d[2]|0,K=H&8191,_=H>>>13,$=d[3]|0,se=$&8191,ce=$>>>13,ue=d[4]|0,ye=ue&8191,we=ue>>>13,Re=d[5]|0,Qe=Re&8191,Pe=Re>>>13,Ne=d[6]|0,Me=Ne&8191,me=Ne>>>13,Oe=d[7]|0,Te=Oe&8191,ve=Oe>>>13,Ce=d[8]|0,xe=Ce&8191,be=Ce>>>13,Le=d[9]|0,Ie=Le&8191,_e=Le>>>13,He=y[0]|0,Ve=He&8191,Ee=He>>>13,Ke=y[1]|0,ht=Ke&8191,Ge=Ke>>>13,wt=y[2]|0,lt=wt&8191,Je=wt>>>13,At=y[3]|0,xt=At&8191,Fe=At>>>13,Xe=y[4]|0,tt=Xe&8191,Be=Xe>>>13,et=y[5]|0,Ze=et&8191,$e=et>>>13,ft=y[6]|0,rt=ft&8191,ze=ft>>>13,it=y[7]|0,st=it&8191,qe=it>>>13,Ye=y[8]|0,ut=Ye&8191,je=Ye>>>13,Ct=y[9]|0,Rt=Ct&8191,at=Ct>>>13;p.negative=m.negative^c.negative,p.length=19,x=Math.imul(Z,Ve),l=Math.imul(Z,Ee),l=l+Math.imul(te,Ve)|0,g=Math.imul(te,Ee);var bt=(I+x|0)+((l&8191)<<13)|0;I=(g+(l>>>13)|0)+(bt>>>26)|0,bt&=67108863,x=Math.imul(ee,Ve),l=Math.imul(ee,Ee),l=l+Math.imul(B,Ve)|0,g=Math.imul(B,Ee),x=x+Math.imul(Z,ht)|0,l=l+Math.imul(Z,Ge)|0,l=l+Math.imul(te,ht)|0,g=g+Math.imul(te,Ge)|0;var Cr=(I+x|0)+((l&8191)<<13)|0;I=(g+(l>>>13)|0)+(Cr>>>26)|0,Cr&=67108863,x=Math.imul(K,Ve),l=Math.imul(K,Ee),l=l+Math.imul(_,Ve)|0,g=Math.imul(_,Ee),x=x+Math.imul(ee,ht)|0,l=l+Math.imul(ee,Ge)|0,l=l+Math.imul(B,ht)|0,g=g+Math.imul(B,Ge)|0,x=x+Math.imul(Z,lt)|0,l=l+Math.imul(Z,Je)|0,l=l+Math.imul(te,lt)|0,g=g+Math.imul(te,Je)|0;var Rr=(I+x|0)+((l&8191)<<13)|0;I=(g+(l>>>13)|0)+(Rr>>>26)|0,Rr&=67108863,x=Math.imul(se,Ve),l=Math.imul(se,Ee),l=l+Math.imul(ce,Ve)|0,g=Math.imul(ce,Ee),x=x+Math.imul(K,ht)|0,l=l+Math.imul(K,Ge)|0,l=l+Math.imul(_,ht)|0,g=g+Math.imul(_,Ge)|0,x=x+Math.imul(ee,lt)|0,l=l+Math.imul(ee,Je)|0,l=l+Math.imul(B,lt)|0,g=g+Math.imul(B,Je)|0,x=x+Math.imul(Z,xt)|0,l=l+Math.imul(Z,Fe)|0,l=l+Math.imul(te,xt)|0,g=g+Math.imul(te,Fe)|0;var Nr=(I+x|0)+((l&8191)<<13)|0;I=(g+(l>>>13)|0)+(Nr>>>26)|0,Nr&=67108863,x=Math.imul(ye,Ve),l=Math.imul(ye,Ee),l=l+Math.imul(we,Ve)|0,g=Math.imul(we,Ee),x=x+Math.imul(se,ht)|0,l=l+Math.imul(se,Ge)|0,l=l+Math.imul(ce,ht)|0,g=g+Math.imul(ce,Ge)|0,x=x+Math.imul(K,lt)|0,l=l+Math.imul(K,Je)|0,l=l+Math.imul(_,lt)|0,g=g+Math.imul(_,Je)|0,x=x+Math.imul(ee,xt)|0,l=l+Math.imul(ee,Fe)|0,l=l+Math.imul(B,xt)|0,g=g+Math.imul(B,Fe)|0,x=x+Math.imul(Z,tt)|0,l=l+Math.imul(Z,Be)|0,l=l+Math.imul(te,tt)|0,g=g+Math.imul(te,Be)|0;var Tr=(I+x|0)+((l&8191)<<13)|0;I=(g+(l>>>13)|0)+(Tr>>>26)|0,Tr&=67108863,x=Math.imul(Qe,Ve),l=Math.imul(Qe,Ee),l=l+Math.imul(Pe,Ve)|0,g=Math.imul(Pe,Ee),x=x+Math.imul(ye,ht)|0,l=l+Math.imul(ye,Ge)|0,l=l+Math.imul(we,ht)|0,g=g+Math.imul(we,Ge)|0,x=x+Math.imul(se,lt)|0,l=l+Math.imul(se,Je)|0,l=l+Math.imul(ce,lt)|0,g=g+Math.imul(ce,Je)|0,x=x+Math.imul(K,xt)|0,l=l+Math.imul(K,Fe)|0,l=l+Math.imul(_,xt)|0,g=g+Math.imul(_,Fe)|0,x=x+Math.imul(ee,tt)|0,l=l+Math.imul(ee,Be)|0,l=l+Math.imul(B,tt)|0,g=g+Math.imul(B,Be)|0,x=x+Math.imul(Z,Ze)|0,l=l+Math.imul(Z,$e)|0,l=l+Math.imul(te,Ze)|0,g=g+Math.imul(te,$e)|0;var Fr=(I+x|0)+((l&8191)<<13)|0;I=(g+(l>>>13)|0)+(Fr>>>26)|0,Fr&=67108863,x=Math.imul(Me,Ve),l=Math.imul(Me,Ee),l=l+Math.imul(me,Ve)|0,g=Math.imul(me,Ee),x=x+Math.imul(Qe,ht)|0,l=l+Math.imul(Qe,Ge)|0,l=l+Math.imul(Pe,ht)|0,g=g+Math.imul(Pe,Ge)|0,x=x+Math.imul(ye,lt)|0,l=l+Math.imul(ye,Je)|0,l=l+Math.imul(we,lt)|0,g=g+Math.imul(we,Je)|0,x=x+Math.imul(se,xt)|0,l=l+Math.imul(se,Fe)|0,l=l+Math.imul(ce,xt)|0,g=g+Math.imul(ce,Fe)|0,x=x+Math.imul(K,tt)|0,l=l+Math.imul(K,Be)|0,l=l+Math.imul(_,tt)|0,g=g+Math.imul(_,Be)|0,x=x+Math.imul(ee,Ze)|0,l=l+Math.imul(ee,$e)|0,l=l+Math.imul(B,Ze)|0,g=g+Math.imul(B,$e)|0,x=x+Math.imul(Z,rt)|0,l=l+Math.imul(Z,ze)|0,l=l+Math.imul(te,rt)|0,g=g+Math.imul(te,ze)|0;var Xt=(I+x|0)+((l&8191)<<13)|0;I=(g+(l>>>13)|0)+(Xt>>>26)|0,Xt&=67108863,x=Math.imul(Te,Ve),l=Math.imul(Te,Ee),l=l+Math.imul(ve,Ve)|0,g=Math.imul(ve,Ee),x=x+Math.imul(Me,ht)|0,l=l+Math.imul(Me,Ge)|0,l=l+Math.imul(me,ht)|0,g=g+Math.imul(me,Ge)|0,x=x+Math.imul(Qe,lt)|0,l=l+Math.imul(Qe,Je)|0,l=l+Math.imul(Pe,lt)|0,g=g+Math.imul(Pe,Je)|0,x=x+Math.imul(ye,xt)|0,l=l+Math.imul(ye,Fe)|0,l=l+Math.imul(we,xt)|0,g=g+Math.imul(we,Fe)|0,x=x+Math.imul(se,tt)|0,l=l+Math.imul(se,Be)|0,l=l+Math.imul(ce,tt)|0,g=g+Math.imul(ce,Be)|0,x=x+Math.imul(K,Ze)|0,l=l+Math.imul(K,$e)|0,l=l+Math.imul(_,Ze)|0,g=g+Math.imul(_,$e)|0,x=x+Math.imul(ee,rt)|0,l=l+Math.imul(ee,ze)|0,l=l+Math.imul(B,rt)|0,g=g+Math.imul(B,ze)|0,x=x+Math.imul(Z,st)|0,l=l+Math.imul(Z,qe)|0,l=l+Math.imul(te,st)|0,g=g+Math.imul(te,qe)|0;var Qr=(I+x|0)+((l&8191)<<13)|0;I=(g+(l>>>13)|0)+(Qr>>>26)|0,Qr&=67108863,x=Math.imul(xe,Ve),l=Math.imul(xe,Ee),l=l+Math.imul(be,Ve)|0,g=Math.imul(be,Ee),x=x+Math.imul(Te,ht)|0,l=l+Math.imul(Te,Ge)|0,l=l+Math.imul(ve,ht)|0,g=g+Math.imul(ve,Ge)|0,x=x+Math.imul(Me,lt)|0,l=l+Math.imul(Me,Je)|0,l=l+Math.imul(me,lt)|0,g=g+Math.imul(me,Je)|0,x=x+Math.imul(Qe,xt)|0,l=l+Math.imul(Qe,Fe)|0,l=l+Math.imul(Pe,xt)|0,g=g+Math.imul(Pe,Fe)|0,x=x+Math.imul(ye,tt)|0,l=l+Math.imul(ye,Be)|0,l=l+Math.imul(we,tt)|0,g=g+Math.imul(we,Be)|0,x=x+Math.imul(se,Ze)|0,l=l+Math.imul(se,$e)|0,l=l+Math.imul(ce,Ze)|0,g=g+Math.imul(ce,$e)|0,x=x+Math.imul(K,rt)|0,l=l+Math.imul(K,ze)|0,l=l+Math.imul(_,rt)|0,g=g+Math.imul(_,ze)|0,x=x+Math.imul(ee,st)|0,l=l+Math.imul(ee,qe)|0,l=l+Math.imul(B,st)|0,g=g+Math.imul(B,qe)|0,x=x+Math.imul(Z,ut)|0,l=l+Math.imul(Z,je)|0,l=l+Math.imul(te,ut)|0,g=g+Math.imul(te,je)|0;var Hi=(I+x|0)+((l&8191)<<13)|0;I=(g+(l>>>13)|0)+(Hi>>>26)|0,Hi&=67108863,x=Math.imul(Ie,Ve),l=Math.imul(Ie,Ee),l=l+Math.imul(_e,Ve)|0,g=Math.imul(_e,Ee),x=x+Math.imul(xe,ht)|0,l=l+Math.imul(xe,Ge)|0,l=l+Math.imul(be,ht)|0,g=g+Math.imul(be,Ge)|0,x=x+Math.imul(Te,lt)|0,l=l+Math.imul(Te,Je)|0,l=l+Math.imul(ve,lt)|0,g=g+Math.imul(ve,Je)|0,x=x+Math.imul(Me,xt)|0,l=l+Math.imul(Me,Fe)|0,l=l+Math.imul(me,xt)|0,g=g+Math.imul(me,Fe)|0,x=x+Math.imul(Qe,tt)|0,l=l+Math.imul(Qe,Be)|0,l=l+Math.imul(Pe,tt)|0,g=g+Math.imul(Pe,Be)|0,x=x+Math.imul(ye,Ze)|0,l=l+Math.imul(ye,$e)|0,l=l+Math.imul(we,Ze)|0,g=g+Math.imul(we,$e)|0,x=x+Math.imul(se,rt)|0,l=l+Math.imul(se,ze)|0,l=l+Math.imul(ce,rt)|0,g=g+Math.imul(ce,ze)|0,x=x+Math.imul(K,st)|0,l=l+Math.imul(K,qe)|0,l=l+Math.imul(_,st)|0,g=g+Math.imul(_,qe)|0,x=x+Math.imul(ee,ut)|0,l=l+Math.imul(ee,je)|0,l=l+Math.imul(B,ut)|0,g=g+Math.imul(B,je)|0,x=x+Math.imul(Z,Rt)|0,l=l+Math.imul(Z,at)|0,l=l+Math.imul(te,Rt)|0,g=g+Math.imul(te,at)|0;var Xr=(I+x|0)+((l&8191)<<13)|0;I=(g+(l>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,x=Math.imul(Ie,ht),l=Math.imul(Ie,Ge),l=l+Math.imul(_e,ht)|0,g=Math.imul(_e,Ge),x=x+Math.imul(xe,lt)|0,l=l+Math.imul(xe,Je)|0,l=l+Math.imul(be,lt)|0,g=g+Math.imul(be,Je)|0,x=x+Math.imul(Te,xt)|0,l=l+Math.imul(Te,Fe)|0,l=l+Math.imul(ve,xt)|0,g=g+Math.imul(ve,Fe)|0,x=x+Math.imul(Me,tt)|0,l=l+Math.imul(Me,Be)|0,l=l+Math.imul(me,tt)|0,g=g+Math.imul(me,Be)|0,x=x+Math.imul(Qe,Ze)|0,l=l+Math.imul(Qe,$e)|0,l=l+Math.imul(Pe,Ze)|0,g=g+Math.imul(Pe,$e)|0,x=x+Math.imul(ye,rt)|0,l=l+Math.imul(ye,ze)|0,l=l+Math.imul(we,rt)|0,g=g+Math.imul(we,ze)|0,x=x+Math.imul(se,st)|0,l=l+Math.imul(se,qe)|0,l=l+Math.imul(ce,st)|0,g=g+Math.imul(ce,qe)|0,x=x+Math.imul(K,ut)|0,l=l+Math.imul(K,je)|0,l=l+Math.imul(_,ut)|0,g=g+Math.imul(_,je)|0,x=x+Math.imul(ee,Rt)|0,l=l+Math.imul(ee,at)|0,l=l+Math.imul(B,Rt)|0,g=g+Math.imul(B,at)|0;var Ki=(I+x|0)+((l&8191)<<13)|0;I=(g+(l>>>13)|0)+(Ki>>>26)|0,Ki&=67108863,x=Math.imul(Ie,lt),l=Math.imul(Ie,Je),l=l+Math.imul(_e,lt)|0,g=Math.imul(_e,Je),x=x+Math.imul(xe,xt)|0,l=l+Math.imul(xe,Fe)|0,l=l+Math.imul(be,xt)|0,g=g+Math.imul(be,Fe)|0,x=x+Math.imul(Te,tt)|0,l=l+Math.imul(Te,Be)|0,l=l+Math.imul(ve,tt)|0,g=g+Math.imul(ve,Be)|0,x=x+Math.imul(Me,Ze)|0,l=l+Math.imul(Me,$e)|0,l=l+Math.imul(me,Ze)|0,g=g+Math.imul(me,$e)|0,x=x+Math.imul(Qe,rt)|0,l=l+Math.imul(Qe,ze)|0,l=l+Math.imul(Pe,rt)|0,g=g+Math.imul(Pe,ze)|0,x=x+Math.imul(ye,st)|0,l=l+Math.imul(ye,qe)|0,l=l+Math.imul(we,st)|0,g=g+Math.imul(we,qe)|0,x=x+Math.imul(se,ut)|0,l=l+Math.imul(se,je)|0,l=l+Math.imul(ce,ut)|0,g=g+Math.imul(ce,je)|0,x=x+Math.imul(K,Rt)|0,l=l+Math.imul(K,at)|0,l=l+Math.imul(_,Rt)|0,g=g+Math.imul(_,at)|0;var Vi=(I+x|0)+((l&8191)<<13)|0;I=(g+(l>>>13)|0)+(Vi>>>26)|0,Vi&=67108863,x=Math.imul(Ie,xt),l=Math.imul(Ie,Fe),l=l+Math.imul(_e,xt)|0,g=Math.imul(_e,Fe),x=x+Math.imul(xe,tt)|0,l=l+Math.imul(xe,Be)|0,l=l+Math.imul(be,tt)|0,g=g+Math.imul(be,Be)|0,x=x+Math.imul(Te,Ze)|0,l=l+Math.imul(Te,$e)|0,l=l+Math.imul(ve,Ze)|0,g=g+Math.imul(ve,$e)|0,x=x+Math.imul(Me,rt)|0,l=l+Math.imul(Me,ze)|0,l=l+Math.imul(me,rt)|0,g=g+Math.imul(me,ze)|0,x=x+Math.imul(Qe,st)|0,l=l+Math.imul(Qe,qe)|0,l=l+Math.imul(Pe,st)|0,g=g+Math.imul(Pe,qe)|0,x=x+Math.imul(ye,ut)|0,l=l+Math.imul(ye,je)|0,l=l+Math.imul(we,ut)|0,g=g+Math.imul(we,je)|0,x=x+Math.imul(se,Rt)|0,l=l+Math.imul(se,at)|0,l=l+Math.imul(ce,Rt)|0,g=g+Math.imul(ce,at)|0;var Zr=(I+x|0)+((l&8191)<<13)|0;I=(g+(l>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,x=Math.imul(Ie,tt),l=Math.imul(Ie,Be),l=l+Math.imul(_e,tt)|0,g=Math.imul(_e,Be),x=x+Math.imul(xe,Ze)|0,l=l+Math.imul(xe,$e)|0,l=l+Math.imul(be,Ze)|0,g=g+Math.imul(be,$e)|0,x=x+Math.imul(Te,rt)|0,l=l+Math.imul(Te,ze)|0,l=l+Math.imul(ve,rt)|0,g=g+Math.imul(ve,ze)|0,x=x+Math.imul(Me,st)|0,l=l+Math.imul(Me,qe)|0,l=l+Math.imul(me,st)|0,g=g+Math.imul(me,qe)|0,x=x+Math.imul(Qe,ut)|0,l=l+Math.imul(Qe,je)|0,l=l+Math.imul(Pe,ut)|0,g=g+Math.imul(Pe,je)|0,x=x+Math.imul(ye,Rt)|0,l=l+Math.imul(ye,at)|0,l=l+Math.imul(we,Rt)|0,g=g+Math.imul(we,at)|0;var Ei=(I+x|0)+((l&8191)<<13)|0;I=(g+(l>>>13)|0)+(Ei>>>26)|0,Ei&=67108863,x=Math.imul(Ie,Ze),l=Math.imul(Ie,$e),l=l+Math.imul(_e,Ze)|0,g=Math.imul(_e,$e),x=x+Math.imul(xe,rt)|0,l=l+Math.imul(xe,ze)|0,l=l+Math.imul(be,rt)|0,g=g+Math.imul(be,ze)|0,x=x+Math.imul(Te,st)|0,l=l+Math.imul(Te,qe)|0,l=l+Math.imul(ve,st)|0,g=g+Math.imul(ve,qe)|0,x=x+Math.imul(Me,ut)|0,l=l+Math.imul(Me,je)|0,l=l+Math.imul(me,ut)|0,g=g+Math.imul(me,je)|0,x=x+Math.imul(Qe,Rt)|0,l=l+Math.imul(Qe,at)|0,l=l+Math.imul(Pe,Rt)|0,g=g+Math.imul(Pe,at)|0;var Si=(I+x|0)+((l&8191)<<13)|0;I=(g+(l>>>13)|0)+(Si>>>26)|0,Si&=67108863,x=Math.imul(Ie,rt),l=Math.imul(Ie,ze),l=l+Math.imul(_e,rt)|0,g=Math.imul(_e,ze),x=x+Math.imul(xe,st)|0,l=l+Math.imul(xe,qe)|0,l=l+Math.imul(be,st)|0,g=g+Math.imul(be,qe)|0,x=x+Math.imul(Te,ut)|0,l=l+Math.imul(Te,je)|0,l=l+Math.imul(ve,ut)|0,g=g+Math.imul(ve,je)|0,x=x+Math.imul(Me,Rt)|0,l=l+Math.imul(Me,at)|0,l=l+Math.imul(me,Rt)|0,g=g+Math.imul(me,at)|0;var ur=(I+x|0)+((l&8191)<<13)|0;I=(g+(l>>>13)|0)+(ur>>>26)|0,ur&=67108863,x=Math.imul(Ie,st),l=Math.imul(Ie,qe),l=l+Math.imul(_e,st)|0,g=Math.imul(_e,qe),x=x+Math.imul(xe,ut)|0,l=l+Math.imul(xe,je)|0,l=l+Math.imul(be,ut)|0,g=g+Math.imul(be,je)|0,x=x+Math.imul(Te,Rt)|0,l=l+Math.imul(Te,at)|0,l=l+Math.imul(ve,Rt)|0,g=g+Math.imul(ve,at)|0;var Gi=(I+x|0)+((l&8191)<<13)|0;I=(g+(l>>>13)|0)+(Gi>>>26)|0,Gi&=67108863,x=Math.imul(Ie,ut),l=Math.imul(Ie,je),l=l+Math.imul(_e,ut)|0,g=Math.imul(_e,je),x=x+Math.imul(xe,Rt)|0,l=l+Math.imul(xe,at)|0,l=l+Math.imul(be,Rt)|0,g=g+Math.imul(be,at)|0;var Wi=(I+x|0)+((l&8191)<<13)|0;I=(g+(l>>>13)|0)+(Wi>>>26)|0,Wi&=67108863,x=Math.imul(Ie,Rt),l=Math.imul(Ie,at),l=l+Math.imul(_e,Rt)|0,g=Math.imul(_e,at);var Ji=(I+x|0)+((l&8191)<<13)|0;return I=(g+(l>>>13)|0)+(Ji>>>26)|0,Ji&=67108863,M[0]=bt,M[1]=Cr,M[2]=Rr,M[3]=Nr,M[4]=Tr,M[5]=Fr,M[6]=Xt,M[7]=Qr,M[8]=Hi,M[9]=Xr,M[10]=Ki,M[11]=Vi,M[12]=Zr,M[13]=Ei,M[14]=Si,M[15]=ur,M[16]=Gi,M[17]=Wi,M[18]=Ji,I!==0&&(M[19]=I,p.length++),p};Math.imul||(z=R);function W(L,m,c){c.negative=m.negative^L.negative,c.length=L.length+m.length;for(var p=0,d=0,y=0;y<c.length-1;y++){var M=d;d=0;for(var I=p&67108863,x=Math.min(y,m.length-1),l=Math.max(0,y-L.length+1);l<=x;l++){var g=y-l,N=L.words[g]|0,Z=m.words[l]|0,te=N*Z,D=te&67108863;M=M+(te/67108864|0)|0,D=D+I|0,I=D&67108863,M=M+(D>>>26)|0,d+=M>>>26,M&=67108863}c.words[y]=I,p=M,M=d}return p!==0?c.words[y]=p:c.length--,c.strip()}function Q(L,m,c){var p=new j;return p.mulp(L,m,c)}a.prototype.mulTo=function(m,c){var p,d=this.length+m.length;return this.length===10&&m.length===10?p=z(this,m,c):d<63?p=R(this,m,c):d<1024?p=W(this,m,c):p=Q(this,m,c),p};function j(L,m){this.x=L,this.y=m}j.prototype.makeRBT=function(m){for(var c=new Array(m),p=a.prototype._countBits(m)-1,d=0;d<m;d++)c[d]=this.revBin(d,p,m);return c},j.prototype.revBin=function(m,c,p){if(m===0||m===p-1)return m;for(var d=0,y=0;y<c;y++)d|=(m&1)<<c-y-1,m>>=1;return d},j.prototype.permute=function(m,c,p,d,y,M){for(var I=0;I<M;I++)d[I]=c[m[I]],y[I]=p[m[I]]},j.prototype.transform=function(m,c,p,d,y,M){this.permute(M,m,c,p,d,y);for(var I=1;I<y;I<<=1)for(var x=I<<1,l=Math.cos(2*Math.PI/x),g=Math.sin(2*Math.PI/x),N=0;N<y;N+=x)for(var Z=l,te=g,D=0;D<I;D++){var ee=p[N+D],B=d[N+D],H=p[N+D+I],K=d[N+D+I],_=Z*H-te*K;K=Z*K+te*H,H=_,p[N+D]=ee+H,d[N+D]=B+K,p[N+D+I]=ee-H,d[N+D+I]=B-K,D!==x&&(_=l*Z-g*te,te=l*te+g*Z,Z=_)}},j.prototype.guessLen13b=function(m,c){var p=Math.max(c,m)|1,d=p&1,y=0;for(p=p/2|0;p;p=p>>>1)y++;return 1<<y+1+d},j.prototype.conjugate=function(m,c,p){if(!(p<=1))for(var d=0;d<p/2;d++){var y=m[d];m[d]=m[p-d-1],m[p-d-1]=y,y=c[d],c[d]=-c[p-d-1],c[p-d-1]=-y}},j.prototype.normalize13b=function(m,c){for(var p=0,d=0;d<c/2;d++){var y=Math.round(m[2*d+1]/c)*8192+Math.round(m[2*d]/c)+p;m[d]=y&67108863,y<67108864?p=0:p=y/67108864|0}return m},j.prototype.convert13b=function(m,c,p,d){for(var y=0,M=0;M<c;M++)y=y+(m[M]|0),p[2*M]=y&8191,y=y>>>13,p[2*M+1]=y&8191,y=y>>>13;for(M=2*c;M<d;++M)p[M]=0;i(y===0),i((y&-8192)===0)},j.prototype.stub=function(m){for(var c=new Array(m),p=0;p<m;p++)c[p]=0;return c},j.prototype.mulp=function(m,c,p){var d=2*this.guessLen13b(m.length,c.length),y=this.makeRBT(d),M=this.stub(d),I=new Array(d),x=new Array(d),l=new Array(d),g=new Array(d),N=new Array(d),Z=new Array(d),te=p.words;te.length=d,this.convert13b(m.words,m.length,I,d),this.convert13b(c.words,c.length,g,d),this.transform(I,M,x,l,d,y),this.transform(g,M,N,Z,d,y);for(var D=0;D<d;D++){var ee=x[D]*N[D]-l[D]*Z[D];l[D]=x[D]*Z[D]+l[D]*N[D],x[D]=ee}return this.conjugate(x,l,d),this.transform(x,l,te,M,d,y),this.conjugate(te,M,d),this.normalize13b(te,d),p.negative=m.negative^c.negative,p.length=m.length+c.length,p.strip()},a.prototype.mul=function(m){var c=new a(null);return c.words=new Array(this.length+m.length),this.mulTo(m,c)},a.prototype.mulf=function(m){var c=new a(null);return c.words=new Array(this.length+m.length),Q(this,m,c)},a.prototype.imul=function(m){return this.clone().mulTo(m,this)},a.prototype.imuln=function(m){i(typeof m=="number"),i(m<67108864);for(var c=0,p=0;p<this.length;p++){var d=(this.words[p]|0)*m,y=(d&67108863)+(c&67108863);c>>=26,c+=d/67108864|0,c+=y>>>26,this.words[p]=y&67108863}return c!==0&&(this.words[p]=c,this.length++),this},a.prototype.muln=function(m){return this.clone().imuln(m)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(m){var c=P(m);if(c.length===0)return new a(1);for(var p=this,d=0;d<c.length&&c[d]===0;d++,p=p.sqr());if(++d<c.length)for(var y=p.sqr();d<c.length;d++,y=y.sqr())c[d]!==0&&(p=p.mul(y));return p},a.prototype.iushln=function(m){i(typeof m=="number"&&m>=0);var c=m%26,p=(m-c)/26,d=67108863>>>26-c<<26-c,y;if(c!==0){var M=0;for(y=0;y<this.length;y++){var I=this.words[y]&d,x=(this.words[y]|0)-I<<c;this.words[y]=x|M,M=I>>>26-c}M&&(this.words[y]=M,this.length++)}if(p!==0){for(y=this.length-1;y>=0;y--)this.words[y+p]=this.words[y];for(y=0;y<p;y++)this.words[y]=0;this.length+=p}return this.strip()},a.prototype.ishln=function(m){return i(this.negative===0),this.iushln(m)},a.prototype.iushrn=function(m,c,p){i(typeof m=="number"&&m>=0);var d;c?d=(c-c%26)/26:d=0;var y=m%26,M=Math.min((m-y)/26,this.length),I=67108863^67108863>>>y<<y,x=p;if(d-=M,d=Math.max(0,d),x){for(var l=0;l<M;l++)x.words[l]=this.words[l];x.length=M}if(M!==0)if(this.length>M)for(this.length-=M,l=0;l<this.length;l++)this.words[l]=this.words[l+M];else this.words[0]=0,this.length=1;var g=0;for(l=this.length-1;l>=0&&(g!==0||l>=d);l--){var N=this.words[l]|0;this.words[l]=g<<26-y|N>>>y,g=N&I}return x&&g!==0&&(x.words[x.length++]=g),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(m,c,p){return i(this.negative===0),this.iushrn(m,c,p)},a.prototype.shln=function(m){return this.clone().ishln(m)},a.prototype.ushln=function(m){return this.clone().iushln(m)},a.prototype.shrn=function(m){return this.clone().ishrn(m)},a.prototype.ushrn=function(m){return this.clone().iushrn(m)},a.prototype.testn=function(m){i(typeof m=="number"&&m>=0);var c=m%26,p=(m-c)/26,d=1<<c;if(this.length<=p)return!1;var y=this.words[p];return!!(y&d)},a.prototype.imaskn=function(m){i(typeof m=="number"&&m>=0);var c=m%26,p=(m-c)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=p)return this;if(c!==0&&p++,this.length=Math.min(p,this.length),c!==0){var d=67108863^67108863>>>c<<c;this.words[this.length-1]&=d}return this.strip()},a.prototype.maskn=function(m){return this.clone().imaskn(m)},a.prototype.iaddn=function(m){return i(typeof m=="number"),i(m<67108864),m<0?this.isubn(-m):this.negative!==0?this.length===1&&(this.words[0]|0)<m?(this.words[0]=m-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(m),this.negative=1,this):this._iaddn(m)},a.prototype._iaddn=function(m){this.words[0]+=m;for(var c=0;c<this.length&&this.words[c]>=67108864;c++)this.words[c]-=67108864,c===this.length-1?this.words[c+1]=1:this.words[c+1]++;return this.length=Math.max(this.length,c+1),this},a.prototype.isubn=function(m){if(i(typeof m=="number"),i(m<67108864),m<0)return this.iaddn(-m);if(this.negative!==0)return this.negative=0,this.iaddn(m),this.negative=1,this;if(this.words[0]-=m,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var c=0;c<this.length&&this.words[c]<0;c++)this.words[c]+=67108864,this.words[c+1]-=1;return this.strip()},a.prototype.addn=function(m){return this.clone().iaddn(m)},a.prototype.subn=function(m){return this.clone().isubn(m)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(m,c,p){var d=m.length+p,y;this._expand(d);var M,I=0;for(y=0;y<m.length;y++){M=(this.words[y+p]|0)+I;var x=(m.words[y]|0)*c;M-=x&67108863,I=(M>>26)-(x/67108864|0),this.words[y+p]=M&67108863}for(;y<this.length-p;y++)M=(this.words[y+p]|0)+I,I=M>>26,this.words[y+p]=M&67108863;if(I===0)return this.strip();for(i(I===-1),I=0,y=0;y<this.length;y++)M=-(this.words[y]|0)+I,I=M>>26,this.words[y]=M&67108863;return this.negative=1,this.strip()},a.prototype._wordDiv=function(m,c){var p=this.length-m.length,d=this.clone(),y=m,M=y.words[y.length-1]|0,I=this._countBits(M);p=26-I,p!==0&&(y=y.ushln(p),d.iushln(p),M=y.words[y.length-1]|0);var x=d.length-y.length,l;if(c!=="mod"){l=new a(null),l.length=x+1,l.words=new Array(l.length);for(var g=0;g<l.length;g++)l.words[g]=0}var N=d.clone()._ishlnsubmul(y,1,x);N.negative===0&&(d=N,l&&(l.words[x]=1));for(var Z=x-1;Z>=0;Z--){var te=(d.words[y.length+Z]|0)*67108864+(d.words[y.length+Z-1]|0);for(te=Math.min(te/M|0,67108863),d._ishlnsubmul(y,te,Z);d.negative!==0;)te--,d.negative=0,d._ishlnsubmul(y,1,Z),d.isZero()||(d.negative^=1);l&&(l.words[Z]=te)}return l&&l.strip(),d.strip(),c!=="div"&&p!==0&&d.iushrn(p),{div:l||null,mod:d}},a.prototype.divmod=function(m,c,p){if(i(!m.isZero()),this.isZero())return{div:new a(0),mod:new a(0)};var d,y,M;return this.negative!==0&&m.negative===0?(M=this.neg().divmod(m,c),c!=="mod"&&(d=M.div.neg()),c!=="div"&&(y=M.mod.neg(),p&&y.negative!==0&&y.iadd(m)),{div:d,mod:y}):this.negative===0&&m.negative!==0?(M=this.divmod(m.neg(),c),c!=="mod"&&(d=M.div.neg()),{div:d,mod:M.mod}):this.negative&m.negative?(M=this.neg().divmod(m.neg(),c),c!=="div"&&(y=M.mod.neg(),p&&y.negative!==0&&y.isub(m)),{div:M.div,mod:y}):m.length>this.length||this.cmp(m)<0?{div:new a(0),mod:this}:m.length===1?c==="div"?{div:this.divn(m.words[0]),mod:null}:c==="mod"?{div:null,mod:new a(this.modn(m.words[0]))}:{div:this.divn(m.words[0]),mod:new a(this.modn(m.words[0]))}:this._wordDiv(m,c)},a.prototype.div=function(m){return this.divmod(m,"div",!1).div},a.prototype.mod=function(m){return this.divmod(m,"mod",!1).mod},a.prototype.umod=function(m){return this.divmod(m,"mod",!0).mod},a.prototype.divRound=function(m){var c=this.divmod(m);if(c.mod.isZero())return c.div;var p=c.div.negative!==0?c.mod.isub(m):c.mod,d=m.ushrn(1),y=m.andln(1),M=p.cmp(d);return M<0||y===1&&M===0?c.div:c.div.negative!==0?c.div.isubn(1):c.div.iaddn(1)},a.prototype.modn=function(m){i(m<=67108863);for(var c=(1<<26)%m,p=0,d=this.length-1;d>=0;d--)p=(c*p+(this.words[d]|0))%m;return p},a.prototype.idivn=function(m){i(m<=67108863);for(var c=0,p=this.length-1;p>=0;p--){var d=(this.words[p]|0)+c*67108864;this.words[p]=d/m|0,c=d%m}return this.strip()},a.prototype.divn=function(m){return this.clone().idivn(m)},a.prototype.egcd=function(m){i(m.negative===0),i(!m.isZero());var c=this,p=m.clone();c.negative!==0?c=c.umod(m):c=c.clone();for(var d=new a(1),y=new a(0),M=new a(0),I=new a(1),x=0;c.isEven()&&p.isEven();)c.iushrn(1),p.iushrn(1),++x;for(var l=p.clone(),g=c.clone();!c.isZero();){for(var N=0,Z=1;!(c.words[0]&Z)&&N<26;++N,Z<<=1);if(N>0)for(c.iushrn(N);N-- >0;)(d.isOdd()||y.isOdd())&&(d.iadd(l),y.isub(g)),d.iushrn(1),y.iushrn(1);for(var te=0,D=1;!(p.words[0]&D)&&te<26;++te,D<<=1);if(te>0)for(p.iushrn(te);te-- >0;)(M.isOdd()||I.isOdd())&&(M.iadd(l),I.isub(g)),M.iushrn(1),I.iushrn(1);c.cmp(p)>=0?(c.isub(p),d.isub(M),y.isub(I)):(p.isub(c),M.isub(d),I.isub(y))}return{a:M,b:I,gcd:p.iushln(x)}},a.prototype._invmp=function(m){i(m.negative===0),i(!m.isZero());var c=this,p=m.clone();c.negative!==0?c=c.umod(m):c=c.clone();for(var d=new a(1),y=new a(0),M=p.clone();c.cmpn(1)>0&&p.cmpn(1)>0;){for(var I=0,x=1;!(c.words[0]&x)&&I<26;++I,x<<=1);if(I>0)for(c.iushrn(I);I-- >0;)d.isOdd()&&d.iadd(M),d.iushrn(1);for(var l=0,g=1;!(p.words[0]&g)&&l<26;++l,g<<=1);if(l>0)for(p.iushrn(l);l-- >0;)y.isOdd()&&y.iadd(M),y.iushrn(1);c.cmp(p)>=0?(c.isub(p),d.isub(y)):(p.isub(c),y.isub(d))}var N;return c.cmpn(1)===0?N=d:N=y,N.cmpn(0)<0&&N.iadd(m),N},a.prototype.gcd=function(m){if(this.isZero())return m.abs();if(m.isZero())return this.abs();var c=this.clone(),p=m.clone();c.negative=0,p.negative=0;for(var d=0;c.isEven()&&p.isEven();d++)c.iushrn(1),p.iushrn(1);do{for(;c.isEven();)c.iushrn(1);for(;p.isEven();)p.iushrn(1);var y=c.cmp(p);if(y<0){var M=c;c=p,p=M}else if(y===0||p.cmpn(1)===0)break;c.isub(p)}while(!0);return p.iushln(d)},a.prototype.invm=function(m){return this.egcd(m).a.umod(m)},a.prototype.isEven=function(){return(this.words[0]&1)===0},a.prototype.isOdd=function(){return(this.words[0]&1)===1},a.prototype.andln=function(m){return this.words[0]&m},a.prototype.bincn=function(m){i(typeof m=="number");var c=m%26,p=(m-c)/26,d=1<<c;if(this.length<=p)return this._expand(p+1),this.words[p]|=d,this;for(var y=d,M=p;y!==0&&M<this.length;M++){var I=this.words[M]|0;I+=y,y=I>>>26,I&=67108863,this.words[M]=I}return y!==0&&(this.words[M]=y,this.length++),this},a.prototype.isZero=function(){return this.length===1&&this.words[0]===0},a.prototype.cmpn=function(m){var c=m<0;if(this.negative!==0&&!c)return-1;if(this.negative===0&&c)return 1;this.strip();var p;if(this.length>1)p=1;else{c&&(m=-m),i(m<=67108863,"Number is too big");var d=this.words[0]|0;p=d===m?0:d<m?-1:1}return this.negative!==0?-p|0:p},a.prototype.cmp=function(m){if(this.negative!==0&&m.negative===0)return-1;if(this.negative===0&&m.negative!==0)return 1;var c=this.ucmp(m);return this.negative!==0?-c|0:c},a.prototype.ucmp=function(m){if(this.length>m.length)return 1;if(this.length<m.length)return-1;for(var c=0,p=this.length-1;p>=0;p--){var d=this.words[p]|0,y=m.words[p]|0;if(d!==y){d<y?c=-1:d>y&&(c=1);break}}return c},a.prototype.gtn=function(m){return this.cmpn(m)===1},a.prototype.gt=function(m){return this.cmp(m)===1},a.prototype.gten=function(m){return this.cmpn(m)>=0},a.prototype.gte=function(m){return this.cmp(m)>=0},a.prototype.ltn=function(m){return this.cmpn(m)===-1},a.prototype.lt=function(m){return this.cmp(m)===-1},a.prototype.lten=function(m){return this.cmpn(m)<=0},a.prototype.lte=function(m){return this.cmp(m)<=0},a.prototype.eqn=function(m){return this.cmpn(m)===0},a.prototype.eq=function(m){return this.cmp(m)===0},a.red=function(m){return new ae(m)},a.prototype.toRed=function(m){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),m.convertTo(this)._forceRed(m)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(m){return this.red=m,this},a.prototype.forceRed=function(m){return i(!this.red,"Already a number in reduction context"),this._forceRed(m)},a.prototype.redAdd=function(m){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,m)},a.prototype.redIAdd=function(m){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,m)},a.prototype.redSub=function(m){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,m)},a.prototype.redISub=function(m){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,m)},a.prototype.redShl=function(m){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,m)},a.prototype.redMul=function(m){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,m),this.red.mul(this,m)},a.prototype.redIMul=function(m){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,m),this.red.imul(this,m)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(m){return i(this.red&&!m.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,m)};var Y={k256:null,p224:null,p192:null,p25519:null};function U(L,m){this.name=L,this.p=new a(m,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var m=new a(null);return m.words=new Array(Math.ceil(this.n/13)),m},U.prototype.ireduce=function(m){var c=m,p;do this.split(c,this.tmp),c=this.imulK(c),c=c.iadd(this.tmp),p=c.bitLength();while(p>this.n);var d=p<this.n?-1:c.ucmp(this.p);return d===0?(c.words[0]=0,c.length=1):d>0?c.isub(this.p):c.strip!==void 0?c.strip():c._strip(),c},U.prototype.split=function(m,c){m.iushrn(this.n,0,c)},U.prototype.imulK=function(m){return m.imul(this.k)};function k(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(k,U),k.prototype.split=function(m,c){for(var p=4194303,d=Math.min(m.length,9),y=0;y<d;y++)c.words[y]=m.words[y];if(c.length=d,m.length<=9){m.words[0]=0,m.length=1;return}var M=m.words[9];for(c.words[c.length++]=M&p,y=10;y<m.length;y++){var I=m.words[y]|0;m.words[y-10]=(I&p)<<4|M>>>22,M=I}M>>>=22,m.words[y-10]=M,M===0&&m.length>10?m.length-=10:m.length-=9},k.prototype.imulK=function(m){m.words[m.length]=0,m.words[m.length+1]=0,m.length+=2;for(var c=0,p=0;p<m.length;p++){var d=m.words[p]|0;c+=d*977,m.words[p]=c&67108863,c=d*64+(c/67108864|0)}return m.words[m.length-1]===0&&(m.length--,m.words[m.length-1]===0&&m.length--),m};function V(){U.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(V,U);function A(){U.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(A,U);function F(){U.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(F,U),F.prototype.imulK=function(m){for(var c=0,p=0;p<m.length;p++){var d=(m.words[p]|0)*19+c,y=d&67108863;d>>>=26,m.words[p]=y,c=d}return c!==0&&(m.words[m.length++]=c),m},a._prime=function(m){if(Y[m])return Y[m];var c;if(m==="k256")c=new k;else if(m==="p224")c=new V;else if(m==="p192")c=new A;else if(m==="p25519")c=new F;else throw new Error("Unknown prime "+m);return Y[m]=c,c};function ae(L){if(typeof L=="string"){var m=a._prime(L);this.m=m.p,this.prime=m}else i(L.gtn(1),"modulus must be greater than 1"),this.m=L,this.prime=null}ae.prototype._verify1=function(m){i(m.negative===0,"red works only with positives"),i(m.red,"red works only with red numbers")},ae.prototype._verify2=function(m,c){i((m.negative|c.negative)===0,"red works only with positives"),i(m.red&&m.red===c.red,"red works only with red numbers")},ae.prototype.imod=function(m){return this.prime?this.prime.ireduce(m)._forceRed(this):m.umod(this.m)._forceRed(this)},ae.prototype.neg=function(m){return m.isZero()?m.clone():this.m.sub(m)._forceRed(this)},ae.prototype.add=function(m,c){this._verify2(m,c);var p=m.add(c);return p.cmp(this.m)>=0&&p.isub(this.m),p._forceRed(this)},ae.prototype.iadd=function(m,c){this._verify2(m,c);var p=m.iadd(c);return p.cmp(this.m)>=0&&p.isub(this.m),p},ae.prototype.sub=function(m,c){this._verify2(m,c);var p=m.sub(c);return p.cmpn(0)<0&&p.iadd(this.m),p._forceRed(this)},ae.prototype.isub=function(m,c){this._verify2(m,c);var p=m.isub(c);return p.cmpn(0)<0&&p.iadd(this.m),p},ae.prototype.shl=function(m,c){return this._verify1(m),this.imod(m.ushln(c))},ae.prototype.imul=function(m,c){return this._verify2(m,c),this.imod(m.imul(c))},ae.prototype.mul=function(m,c){return this._verify2(m,c),this.imod(m.mul(c))},ae.prototype.isqr=function(m){return this.imul(m,m.clone())},ae.prototype.sqr=function(m){return this.mul(m,m)},ae.prototype.sqrt=function(m){if(m.isZero())return m.clone();var c=this.m.andln(3);if(i(c%2===1),c===3){var p=this.m.add(new a(1)).iushrn(2);return this.pow(m,p)}for(var d=this.m.subn(1),y=0;!d.isZero()&&d.andln(1)===0;)y++,d.iushrn(1);i(!d.isZero());var M=new a(1).toRed(this),I=M.redNeg(),x=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new a(2*l*l).toRed(this);this.pow(l,x).cmp(I)!==0;)l.redIAdd(I);for(var g=this.pow(l,d),N=this.pow(m,d.addn(1).iushrn(1)),Z=this.pow(m,d),te=y;Z.cmp(M)!==0;){for(var D=Z,ee=0;D.cmp(M)!==0;ee++)D=D.redSqr();i(ee<te);var B=this.pow(g,new a(1).iushln(te-ee-1));N=N.redMul(B),g=B.redSqr(),Z=Z.redMul(g),te=ee}return N},ae.prototype.invm=function(m){var c=m._invmp(this.m);return c.negative!==0?(c.negative=0,this.imod(c).redNeg()):this.imod(c)},ae.prototype.pow=function(m,c){if(c.isZero())return new a(1).toRed(this);if(c.cmpn(1)===0)return m.clone();var p=4,d=new Array(1<<p);d[0]=new a(1).toRed(this),d[1]=m;for(var y=2;y<d.length;y++)d[y]=this.mul(d[y-1],m);var M=d[0],I=0,x=0,l=c.bitLength()%26;for(l===0&&(l=26),y=c.length-1;y>=0;y--){for(var g=c.words[y],N=l-1;N>=0;N--){var Z=g>>N&1;if(M!==d[0]&&(M=this.sqr(M)),Z===0&&I===0){x=0;continue}I<<=1,I|=Z,x++,!(x!==p&&(y!==0||N!==0))&&(M=this.mul(M,d[I]),x=0,I=0)}l=26}return M},ae.prototype.convertTo=function(m){var c=m.umod(this.m);return c===m?c.clone():c},ae.prototype.convertFrom=function(m){var c=m.clone();return c.red=null,c},a.mont=function(m){return new de(m)};function de(L){ae.call(this,L),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new a(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,ae),de.prototype.convertTo=function(m){return this.imod(m.ushln(this.shift))},de.prototype.convertFrom=function(m){var c=this.imod(m.mul(this.rinv));return c.red=null,c},de.prototype.imul=function(m,c){if(m.isZero()||c.isZero())return m.words[0]=0,m.length=1,m;var p=m.imul(c),d=p.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=p.isub(d).iushrn(this.shift),M=y;return y.cmp(this.m)>=0?M=y.isub(this.m):y.cmpn(0)<0&&(M=y.iadd(this.m)),M._forceRed(this)},de.prototype.mul=function(m,c){if(m.isZero()||c.isZero())return new a(0)._forceRed(this);var p=m.mul(c),d=p.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=p.isub(d).iushrn(this.shift),M=y;return y.cmp(this.m)>=0?M=y.isub(this.m):y.cmpn(0)<0&&(M=y.iadd(this.m)),M._forceRed(this)},de.prototype.invm=function(m){var c=this.imod(m._invmp(this.m).mul(this.r2));return c._forceRed(this)}})(r,Vr)})(Ql);var ss=Ql.exports,Xl={};(function(r){var e=r;function t(a,f){if(Array.isArray(a))return a.slice();if(!a)return[];var u=[];if(typeof a!="string"){for(var b=0;b<a.length;b++)u[b]=a[b]|0;return u}if(f==="hex"){a=a.replace(/[^a-z0-9]+/ig,""),a.length%2!==0&&(a="0"+a);for(var b=0;b<a.length;b+=2)u.push(parseInt(a[b]+a[b+1],16))}else for(var b=0;b<a.length;b++){var v=a.charCodeAt(b),w=v>>8,S=v&255;w?u.push(w,S):u.push(S)}return u}e.toArray=t;function i(a){return a.length===1?"0"+a:a}e.zero2=i;function s(a){for(var f="",u=0;u<a.length;u++)f+=i(a[u].toString(16));return f}e.toHex=s,e.encode=function(f,u){return u==="hex"?s(f):f}})(Xl);(function(r){var e=r,t=ss,i=Zg,s=Xl;e.assert=i,e.toArray=s.toArray,e.zero2=s.zero2,e.toHex=s.toHex,e.encode=s.encode;function a(w,S,O){var P=new Array(Math.max(w.bitLength(),O)+1),R;for(R=0;R<P.length;R+=1)P[R]=0;var z=1<<S+1,W=w.clone();for(R=0;R<P.length;R++){var Q,j=W.andln(z-1);W.isOdd()?(j>(z>>1)-1?Q=(z>>1)-j:Q=j,W.isubn(Q)):Q=0,P[R]=Q,W.iushrn(1)}return P}e.getNAF=a;function f(w,S){var O=[[],[]];w=w.clone(),S=S.clone();for(var P=0,R=0,z;w.cmpn(-P)>0||S.cmpn(-R)>0;){var W=w.andln(3)+P&3,Q=S.andln(3)+R&3;W===3&&(W=-1),Q===3&&(Q=-1);var j;W&1?(z=w.andln(7)+P&7,(z===3||z===5)&&Q===2?j=-W:j=W):j=0,O[0].push(j);var Y;Q&1?(z=S.andln(7)+R&7,(z===3||z===5)&&W===2?Y=-Q:Y=Q):Y=0,O[1].push(Y),2*P===j+1&&(P=1-P),2*R===Y+1&&(R=1-R),w.iushrn(1),S.iushrn(1)}return O}e.getJSF=f;function u(w,S,O){var P="_"+S;w.prototype[S]=function(){return this[P]!==void 0?this[P]:this[P]=O.call(this)}}e.cachedProperty=u;function b(w){return typeof w=="string"?e.toArray(w,"hex"):w}e.parseBytes=b;function v(w){return new t(w,"hex","le")}e.intFromLE=v})(Ai);var Zl={exports:{}},Fh;Zl.exports=function(e){return Fh||(Fh=new As(null)),Fh.generate(e)};function As(r){this.rand=r}Zl.exports.Rand=As;As.prototype.generate=function(e){return this._rand(e)};As.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),i=0;i<t.length;i++)t[i]=this.rand.getByte();return t};if(typeof self=="object")self.crypto&&self.crypto.getRandomValues?As.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?As.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:typeof window=="object"&&(As.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var jp=Xg;if(typeof jp.randomBytes!="function")throw new Error("Not supported");As.prototype._rand=function(e){return jp.randomBytes(e)}}catch{}var vv=Zl.exports,ed={},Hs=ss,tc=Ai,qf=tc.getNAF,p_=tc.getJSF,Lf=tc.assert;function Is(r,e){this.type=r,this.p=new Hs(e.p,16),this.red=e.prime?Hs.red(e.prime):Hs.mont(this.p),this.zero=new Hs(0).toRed(this.red),this.one=new Hs(1).toRed(this.red),this.two=new Hs(2).toRed(this.red),this.n=e.n&&new Hs(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 nu=Is;Is.prototype.point=function(){throw new Error("Not implemented")};Is.prototype.validate=function(){throw new Error("Not implemented")};Is.prototype._fixedNafMul=function(e,t){Lf(e.precomputed);var i=e._getDoubles(),s=qf(t,1,this._bitLength),a=(1<<i.step+1)-(i.step%2===0?2:1);a/=3;var f=[],u,b;for(u=0;u<s.length;u+=i.step){b=0;for(var v=u+i.step-1;v>=u;v--)b=(b<<1)+s[v];f.push(b)}for(var w=this.jpoint(null,null,null),S=this.jpoint(null,null,null),O=a;O>0;O--){for(u=0;u<f.length;u++)b=f[u],b===O?S=S.mixedAdd(i.points[u]):b===-O&&(S=S.mixedAdd(i.points[u].neg()));w=w.add(S)}return w.toP()};Is.prototype._wnafMul=function(e,t){var i=4,s=e._getNAFPoints(i);i=s.wnd;for(var a=s.points,f=qf(t,i,this._bitLength),u=this.jpoint(null,null,null),b=f.length-1;b>=0;b--){for(var v=0;b>=0&&f[b]===0;b--)v++;if(b>=0&&v++,u=u.dblp(v),b<0)break;var w=f[b];Lf(w!==0),e.type==="affine"?w>0?u=u.mixedAdd(a[w-1>>1]):u=u.mixedAdd(a[-w-1>>1].neg()):w>0?u=u.add(a[w-1>>1]):u=u.add(a[-w-1>>1].neg())}return e.type==="affine"?u.toP():u};Is.prototype._wnafMulAdd=function(e,t,i,s,a){var f=this._wnafT1,u=this._wnafT2,b=this._wnafT3,v=0,w,S,O;for(w=0;w<s;w++){O=t[w];var P=O._getNAFPoints(e);f[w]=P.wnd,u[w]=P.points}for(w=s-1;w>=1;w-=2){var R=w-1,z=w;if(f[R]!==1||f[z]!==1){b[R]=qf(i[R],f[R],this._bitLength),b[z]=qf(i[z],f[z],this._bitLength),v=Math.max(b[R].length,v),v=Math.max(b[z].length,v);continue}var W=[t[R],null,null,t[z]];t[R].y.cmp(t[z].y)===0?(W[1]=t[R].add(t[z]),W[2]=t[R].toJ().mixedAdd(t[z].neg())):t[R].y.cmp(t[z].y.redNeg())===0?(W[1]=t[R].toJ().mixedAdd(t[z]),W[2]=t[R].add(t[z].neg())):(W[1]=t[R].toJ().mixedAdd(t[z]),W[2]=t[R].toJ().mixedAdd(t[z].neg()));var Q=[-3,-1,-5,-7,0,7,5,1,3],j=p_(i[R],i[z]);for(v=Math.max(j[0].length,v),b[R]=new Array(v),b[z]=new Array(v),S=0;S<v;S++){var Y=j[0][S]|0,U=j[1][S]|0;b[R][S]=Q[(Y+1)*3+(U+1)],b[z][S]=0,u[R]=W}}var k=this.jpoint(null,null,null),V=this._wnafT4;for(w=v;w>=0;w--){for(var A=0;w>=0;){var F=!0;for(S=0;S<s;S++)V[S]=b[S][w]|0,V[S]!==0&&(F=!1);if(!F)break;A++,w--}if(w>=0&&A++,k=k.dblp(A),w<0)break;for(S=0;S<s;S++){var ae=V[S];ae!==0&&(ae>0?O=u[S][ae-1>>1]:ae<0&&(O=u[S][-ae-1>>1].neg()),O.type==="affine"?k=k.mixedAdd(O):k=k.add(O))}}for(w=0;w<s;w++)u[w]=null;return a?k:k.toP()};function ji(r,e){this.curve=r,this.type=e,this.precomputed=null}Is.BasePoint=ji;ji.prototype.eq=function(){throw new Error("Not implemented")};ji.prototype.validate=function(){return this.curve.validate(this)};Is.prototype.decodePoint=function(e,t){e=tc.toArray(e,t);var i=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*i){e[0]===6?Lf(e[e.length-1]%2===0):e[0]===7&&Lf(e[e.length-1]%2===1);var s=this.point(e.slice(1,1+i),e.slice(1+i,1+2*i));return s}else if((e[0]===2||e[0]===3)&&e.length-1===i)return this.pointFromX(e.slice(1,1+i),e[0]===3);throw new Error("Unknown point format")};ji.prototype.encodeCompressed=function(e){return this.encode(e,!0)};ji.prototype._encode=function(e){var t=this.curve.p.byteLength(),i=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(i):[4].concat(i,this.getY().toArray("be",t))};ji.prototype.encode=function(e,t){return tc.encode(this._encode(t),e)};ji.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this};ji.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((e.bitLength()+1)/t.step):!1};ji.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],s=this,a=0;a<t;a+=e){for(var f=0;f<e;f++)s=s.dbl();i.push(s)}return{step:e,points:i}};ji.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],i=(1<<e)-1,s=i===1?null:this.dbl(),a=1;a<i;a++)t[a]=t[a-1].add(s);return{wnd:e,points:t}};ji.prototype._getBeta=function(){return null};ji.prototype.dblp=function(e){for(var t=this,i=0;i<e;i++)t=t.dbl();return t};var g_=Ai,rr=ss,td=jl,Ka=nu,v_=g_.assert;function ki(r){Ka.call(this,"short",r),this.a=new rr(r.a,16).toRed(this.red),this.b=new rr(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)}td(ki,Ka);var b_=ki;ki.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,i;if(e.beta)t=new rr(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)i=new rr(e.lambda,16);else{var a=this._getEndoRoots(this.n);this.g.mul(a[0]).x.cmp(this.g.x.redMul(t))===0?i=a[0]:(i=a[1],v_(this.g.mul(i).x.cmp(this.g.x.redMul(t))===0))}var f;return e.basis?f=e.basis.map(function(u){return{a:new rr(u.a,16),b:new rr(u.b,16)}}):f=this._getEndoBasis(i),{beta:t,lambda:i,basis:f}}};ki.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:rr.mont(e),i=new rr(2).toRed(t).redInvm(),s=i.redNeg(),a=new rr(3).toRed(t).redNeg().redSqrt().redMul(i),f=s.redAdd(a).fromRed(),u=s.redSub(a).fromRed();return[f,u]};ki.prototype._getEndoBasis=function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),i=e,s=this.n.clone(),a=new rr(1),f=new rr(0),u=new rr(0),b=new rr(1),v,w,S,O,P,R,z,W=0,Q,j;i.cmpn(0)!==0;){var Y=s.div(i);Q=s.sub(Y.mul(i)),j=u.sub(Y.mul(a));var U=b.sub(Y.mul(f));if(!S&&Q.cmp(t)<0)v=z.neg(),w=a,S=Q.neg(),O=j;else if(S&&++W===2)break;z=Q,s=i,i=Q,u=a,a=j,b=f,f=U}P=Q.neg(),R=j;var k=S.sqr().add(O.sqr()),V=P.sqr().add(R.sqr());return V.cmp(k)>=0&&(P=v,R=w),S.negative&&(S=S.neg(),O=O.neg()),P.negative&&(P=P.neg(),R=R.neg()),[{a:S,b:O},{a:P,b:R}]};ki.prototype._endoSplit=function(e){var t=this.endo.basis,i=t[0],s=t[1],a=s.b.mul(e).divRound(this.n),f=i.b.neg().mul(e).divRound(this.n),u=a.mul(i.a),b=f.mul(s.a),v=a.mul(i.b),w=f.mul(s.b),S=e.sub(u).sub(b),O=v.add(w).neg();return{k1:S,k2:O}};ki.prototype.pointFromX=function(e,t){e=new rr(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),s=i.redSqrt();if(s.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var a=s.fromRed().isOdd();return(t&&!a||!t&&a)&&(s=s.redNeg()),this.point(e,s)};ki.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,i=e.y,s=this.a.redMul(t),a=t.redSqr().redMul(t).redIAdd(s).redIAdd(this.b);return i.redSqr().redISub(a).cmpn(0)===0};ki.prototype._endoWnafMulAdd=function(e,t,i){for(var s=this._endoWnafT1,a=this._endoWnafT2,f=0;f<e.length;f++){var u=this._endoSplit(t[f]),b=e[f],v=b._getBeta();u.k1.negative&&(u.k1.ineg(),b=b.neg(!0)),u.k2.negative&&(u.k2.ineg(),v=v.neg(!0)),s[f*2]=b,s[f*2+1]=v,a[f*2]=u.k1,a[f*2+1]=u.k2}for(var w=this._wnafMulAdd(1,s,a,f*2,i),S=0;S<f*2;S++)s[S]=null,a[S]=null;return w};function Sr(r,e,t,i){Ka.BasePoint.call(this,r,"affine"),e===null&&t===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new rr(e,16),this.y=new rr(t,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}td(Sr,Ka.BasePoint);ki.prototype.point=function(e,t,i){return new Sr(this,e,t,i)};ki.prototype.pointFromJSON=function(e,t){return Sr.fromJSON(this,e,t)};Sr.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var i=this.curve,s=function(a){return i.point(a.x.redMul(i.endo.beta),a.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}};Sr.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]};Sr.fromJSON=function(e,t,i){typeof t=="string"&&(t=JSON.parse(t));var s=e.point(t[0],t[1],i);if(!t[2])return s;function a(u){return e.point(u[0],u[1],i)}var f=t[2];return s.precomputed={beta:null,doubles:f.doubles&&{step:f.doubles.step,points:[s].concat(f.doubles.points.map(a))},naf:f.naf&&{wnd:f.naf.wnd,points:[s].concat(f.naf.points.map(a))}},s};Sr.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)+">"};Sr.prototype.isInfinity=function(){return this.inf};Sr.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var i=t.redSqr().redISub(this.x).redISub(e.x),s=t.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,s)};Sr.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,i=this.x.redSqr(),s=e.redInvm(),a=i.redAdd(i).redIAdd(i).redIAdd(t).redMul(s),f=a.redSqr().redISub(this.x.redAdd(this.x)),u=a.redMul(this.x.redSub(f)).redISub(this.y);return this.curve.point(f,u)};Sr.prototype.getX=function(){return this.x.fromRed()};Sr.prototype.getY=function(){return this.y.fromRed()};Sr.prototype.mul=function(e){return e=new rr(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)};Sr.prototype.mulAdd=function(e,t,i){var s=[this,t],a=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(s,a):this.curve._wnafMulAdd(1,s,a,2)};Sr.prototype.jmulAdd=function(e,t,i){var s=[this,t],a=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(s,a,!0):this.curve._wnafMulAdd(1,s,a,2,!0)};Sr.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)};Sr.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,s=function(a){return a.neg()};t.precomputed={naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(s)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(s)}}}return t};Sr.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 Pr(r,e,t,i){Ka.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new rr(0)):(this.x=new rr(e,16),this.y=new rr(t,16),this.z=new rr(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}td(Pr,Ka.BasePoint);ki.prototype.jpoint=function(e,t,i){return new Pr(this,e,t,i)};Pr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),i=this.x.redMul(t),s=this.y.redMul(t).redMul(e);return this.curve.point(i,s)};Pr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Pr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),i=this.z.redSqr(),s=this.x.redMul(t),a=e.x.redMul(i),f=this.y.redMul(t.redMul(e.z)),u=e.y.redMul(i.redMul(this.z)),b=s.redSub(a),v=f.redSub(u);if(b.cmpn(0)===0)return v.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var w=b.redSqr(),S=w.redMul(b),O=s.redMul(w),P=v.redSqr().redIAdd(S).redISub(O).redISub(O),R=v.redMul(O.redISub(P)).redISub(f.redMul(S)),z=this.z.redMul(e.z).redMul(b);return this.curve.jpoint(P,R,z)};Pr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),i=this.x,s=e.x.redMul(t),a=this.y,f=e.y.redMul(t).redMul(this.z),u=i.redSub(s),b=a.redSub(f);if(u.cmpn(0)===0)return b.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var v=u.redSqr(),w=v.redMul(u),S=i.redMul(v),O=b.redSqr().redIAdd(w).redISub(S).redISub(S),P=b.redMul(S.redISub(O)).redISub(a.redMul(w)),R=this.z.redMul(u);return this.curve.jpoint(O,P,R)};Pr.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var i=this;for(t=0;t<e;t++)i=i.dbl();return i}var s=this.curve.a,a=this.curve.tinv,f=this.x,u=this.y,b=this.z,v=b.redSqr().redSqr(),w=u.redAdd(u);for(t=0;t<e;t++){var S=f.redSqr(),O=w.redSqr(),P=O.redSqr(),R=S.redAdd(S).redIAdd(S).redIAdd(s.redMul(v)),z=f.redMul(O),W=R.redSqr().redISub(z.redAdd(z)),Q=z.redISub(W),j=R.redMul(Q);j=j.redIAdd(j).redISub(P);var Y=w.redMul(b);t+1<e&&(v=v.redMul(P)),f=W,b=Y,w=j}return this.curve.jpoint(f,w.redMul(a),b)};Pr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()};Pr.prototype._zeroDbl=function(){var e,t,i;if(this.zOne){var s=this.x.redSqr(),a=this.y.redSqr(),f=a.redSqr(),u=this.x.redAdd(a).redSqr().redISub(s).redISub(f);u=u.redIAdd(u);var b=s.redAdd(s).redIAdd(s),v=b.redSqr().redISub(u).redISub(u),w=f.redIAdd(f);w=w.redIAdd(w),w=w.redIAdd(w),e=v,t=b.redMul(u.redISub(v)).redISub(w),i=this.y.redAdd(this.y)}else{var S=this.x.redSqr(),O=this.y.redSqr(),P=O.redSqr(),R=this.x.redAdd(O).redSqr().redISub(S).redISub(P);R=R.redIAdd(R);var z=S.redAdd(S).redIAdd(S),W=z.redSqr(),Q=P.redIAdd(P);Q=Q.redIAdd(Q),Q=Q.redIAdd(Q),e=W.redISub(R).redISub(R),t=z.redMul(R.redISub(e)).redISub(Q),i=this.y.redMul(this.z),i=i.redIAdd(i)}return this.curve.jpoint(e,t,i)};Pr.prototype._threeDbl=function(){var e,t,i;if(this.zOne){var s=this.x.redSqr(),a=this.y.redSqr(),f=a.redSqr(),u=this.x.redAdd(a).redSqr().redISub(s).redISub(f);u=u.redIAdd(u);var b=s.redAdd(s).redIAdd(s).redIAdd(this.curve.a),v=b.redSqr().redISub(u).redISub(u);e=v;var w=f.redIAdd(f);w=w.redIAdd(w),w=w.redIAdd(w),t=b.redMul(u.redISub(v)).redISub(w),i=this.y.redAdd(this.y)}else{var S=this.z.redSqr(),O=this.y.redSqr(),P=this.x.redMul(O),R=this.x.redSub(S).redMul(this.x.redAdd(S));R=R.redAdd(R).redIAdd(R);var z=P.redIAdd(P);z=z.redIAdd(z);var W=z.redAdd(z);e=R.redSqr().redISub(W),i=this.y.redAdd(this.z).redSqr().redISub(O).redISub(S);var Q=O.redSqr();Q=Q.redIAdd(Q),Q=Q.redIAdd(Q),Q=Q.redIAdd(Q),t=R.redMul(z.redISub(e)).redISub(Q)}return this.curve.jpoint(e,t,i)};Pr.prototype._dbl=function(){var e=this.curve.a,t=this.x,i=this.y,s=this.z,a=s.redSqr().redSqr(),f=t.redSqr(),u=i.redSqr(),b=f.redAdd(f).redIAdd(f).redIAdd(e.redMul(a)),v=t.redAdd(t);v=v.redIAdd(v);var w=v.redMul(u),S=b.redSqr().redISub(w.redAdd(w)),O=w.redISub(S),P=u.redSqr();P=P.redIAdd(P),P=P.redIAdd(P),P=P.redIAdd(P);var R=b.redMul(O).redISub(P),z=i.redAdd(i).redMul(s);return this.curve.jpoint(S,R,z)};Pr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),i=this.z.redSqr(),s=t.redSqr(),a=e.redAdd(e).redIAdd(e),f=a.redSqr(),u=this.x.redAdd(t).redSqr().redISub(e).redISub(s);u=u.redIAdd(u),u=u.redAdd(u).redIAdd(u),u=u.redISub(f);var b=u.redSqr(),v=s.redIAdd(s);v=v.redIAdd(v),v=v.redIAdd(v),v=v.redIAdd(v);var w=a.redIAdd(u).redSqr().redISub(f).redISub(b).redISub(v),S=t.redMul(w);S=S.redIAdd(S),S=S.redIAdd(S);var O=this.x.redMul(b).redISub(S);O=O.redIAdd(O),O=O.redIAdd(O);var P=this.y.redMul(w.redMul(v.redISub(w)).redISub(u.redMul(b)));P=P.redIAdd(P),P=P.redIAdd(P),P=P.redIAdd(P);var R=this.z.redAdd(u).redSqr().redISub(i).redISub(b);return this.curve.jpoint(O,P,R)};Pr.prototype.mul=function(e,t){return e=new rr(e,t),this.curve._wnafMul(this,e)};Pr.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),i=e.z.redSqr();if(this.x.redMul(i).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var s=t.redMul(this.z),a=i.redMul(e.z);return this.y.redMul(a).redISub(e.y.redMul(s)).cmpn(0)===0};Pr.prototype.eqXToP=function(e){var t=this.z.redSqr(),i=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(i)===0)return!0;for(var s=e.clone(),a=this.curve.redN.redMul(t);;){if(s.iadd(this.curve.n),s.cmp(this.curve.p)>=0)return!1;if(i.redIAdd(a),this.x.cmp(i)===0)return!0}};Pr.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"};Pr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var qa=ss,bv=jl,su=nu,m_=Ai;function Va(r){su.call(this,"mont",r),this.a=new qa(r.a,16).toRed(this.red),this.b=new qa(r.b,16).toRed(this.red),this.i4=new qa(4).toRed(this.red).redInvm(),this.two=new qa(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}bv(Va,su);var y_=Va;Va.prototype.validate=function(e){var t=e.normalize().x,i=t.redSqr(),s=i.redMul(t).redAdd(i.redMul(this.a)).redAdd(t),a=s.redSqrt();return a.redSqr().cmp(s)===0};function Er(r,e,t){su.BasePoint.call(this,r,"projective"),e===null&&t===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new qa(e,16),this.z=new qa(t,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}bv(Er,su.BasePoint);Va.prototype.decodePoint=function(e,t){return this.point(m_.toArray(e,t),1)};Va.prototype.point=function(e,t){return new Er(this,e,t)};Va.prototype.pointFromJSON=function(e){return Er.fromJSON(this,e)};Er.prototype.precompute=function(){};Er.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};Er.fromJSON=function(e,t){return new Er(e,t[0],t[1]||e.one)};Er.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)+">"};Er.prototype.isInfinity=function(){return this.z.cmpn(0)===0};Er.prototype.dbl=function(){var e=this.x.redAdd(this.z),t=e.redSqr(),i=this.x.redSub(this.z),s=i.redSqr(),a=t.redSub(s),f=t.redMul(s),u=a.redMul(s.redAdd(this.curve.a24.redMul(a)));return this.curve.point(f,u)};Er.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};Er.prototype.diffAdd=function(e,t){var i=this.x.redAdd(this.z),s=this.x.redSub(this.z),a=e.x.redAdd(e.z),f=e.x.redSub(e.z),u=f.redMul(i),b=a.redMul(s),v=t.z.redMul(u.redAdd(b).redSqr()),w=t.x.redMul(u.redISub(b).redSqr());return this.curve.point(v,w)};Er.prototype.mul=function(e){for(var t=e.clone(),i=this,s=this.curve.point(null,null),a=this,f=[];t.cmpn(0)!==0;t.iushrn(1))f.push(t.andln(1));for(var u=f.length-1;u>=0;u--)f[u]===0?(i=i.diffAdd(s,a),s=s.dbl()):(s=i.diffAdd(s,a),i=i.dbl());return s};Er.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};Er.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};Er.prototype.eq=function(e){return this.getX().cmp(e.getX())===0};Er.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};Er.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var w_=Ai,ts=ss,mv=jl,au=nu,__=w_.assert;function Tn(r){this.twisted=(r.a|0)!==1,this.mOneA=this.twisted&&(r.a|0)===-1,this.extended=this.mOneA,au.call(this,"edwards",r),this.a=new ts(r.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new ts(r.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new ts(r.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),__(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(r.c|0)===1}mv(Tn,au);var A_=Tn;Tn.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)};Tn.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)};Tn.prototype.jpoint=function(e,t,i,s){return this.point(e,t,i,s)};Tn.prototype.pointFromX=function(e,t){e=new ts(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),s=this.c2.redSub(this.a.redMul(i)),a=this.one.redSub(this.c2.redMul(this.d).redMul(i)),f=s.redMul(a.redInvm()),u=f.redSqrt();if(u.redSqr().redSub(f).cmp(this.zero)!==0)throw new Error("invalid point");var b=u.fromRed().isOdd();return(t&&!b||!t&&b)&&(u=u.redNeg()),this.point(e,u)};Tn.prototype.pointFromY=function(e,t){e=new ts(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),s=i.redSub(this.c2),a=i.redMul(this.d).redMul(this.c2).redSub(this.a),f=s.redMul(a.redInvm());if(f.cmp(this.zero)===0){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var u=f.redSqrt();if(u.redSqr().redSub(f).cmp(this.zero)!==0)throw new Error("invalid point");return u.fromRed().isOdd()!==t&&(u=u.redNeg()),this.point(u,e)};Tn.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),i=e.y.redSqr(),s=t.redMul(this.a).redAdd(i),a=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(i)));return s.cmp(a)===0};function Vt(r,e,t,i,s){au.BasePoint.call(this,r,"projective"),e===null&&t===null&&i===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new ts(e,16),this.y=new ts(t,16),this.z=i?new ts(i,16):this.curve.one,this.t=s&&new ts(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()))))}mv(Vt,au.BasePoint);Tn.prototype.pointFromJSON=function(e){return Vt.fromJSON(this,e)};Tn.prototype.point=function(e,t,i,s){return new Vt(this,e,t,i,s)};Vt.fromJSON=function(e,t){return new Vt(e,t[0],t[1],t[2])};Vt.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)+">"};Vt.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};Vt.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),i=this.z.redSqr();i=i.redIAdd(i);var s=this.curve._mulA(e),a=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),f=s.redAdd(t),u=f.redSub(i),b=s.redSub(t),v=a.redMul(u),w=f.redMul(b),S=a.redMul(b),O=u.redMul(f);return this.curve.point(v,w,O,S)};Vt.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),t=this.x.redSqr(),i=this.y.redSqr(),s,a,f,u,b,v;if(this.curve.twisted){u=this.curve._mulA(t);var w=u.redAdd(i);this.zOne?(s=e.redSub(t).redSub(i).redMul(w.redSub(this.curve.two)),a=w.redMul(u.redSub(i)),f=w.redSqr().redSub(w).redSub(w)):(b=this.z.redSqr(),v=w.redSub(b).redISub(b),s=e.redSub(t).redISub(i).redMul(v),a=w.redMul(u.redSub(i)),f=w.redMul(v))}else u=t.redAdd(i),b=this.curve._mulC(this.z).redSqr(),v=u.redSub(b).redSub(b),s=this.curve._mulC(e.redISub(u)).redMul(v),a=this.curve._mulC(u).redMul(t.redISub(i)),f=u.redMul(v);return this.curve.point(s,a,f)};Vt.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};Vt.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),i=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),s=this.t.redMul(this.curve.dd).redMul(e.t),a=this.z.redMul(e.z.redAdd(e.z)),f=i.redSub(t),u=a.redSub(s),b=a.redAdd(s),v=i.redAdd(t),w=f.redMul(u),S=b.redMul(v),O=f.redMul(v),P=u.redMul(b);return this.curve.point(w,S,P,O)};Vt.prototype._projAdd=function(e){var t=this.z.redMul(e.z),i=t.redSqr(),s=this.x.redMul(e.x),a=this.y.redMul(e.y),f=this.curve.d.redMul(s).redMul(a),u=i.redSub(f),b=i.redAdd(f),v=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(s).redISub(a),w=t.redMul(u).redMul(v),S,O;return this.curve.twisted?(S=t.redMul(b).redMul(a.redSub(this.curve._mulA(s))),O=u.redMul(b)):(S=t.redMul(b).redMul(a.redSub(s)),O=this.curve._mulC(u).redMul(b)),this.curve.point(w,S,O)};Vt.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)};Vt.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)};Vt.prototype.mulAdd=function(e,t,i){return this.curve._wnafMulAdd(1,[this,t],[e,i],2,!1)};Vt.prototype.jmulAdd=function(e,t,i){return this.curve._wnafMulAdd(1,[this,t],[e,i],2,!0)};Vt.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};Vt.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Vt.prototype.getX=function(){return this.normalize(),this.x.fromRed()};Vt.prototype.getY=function(){return this.normalize(),this.y.fromRed()};Vt.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0};Vt.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(t)===0)return!0;for(var i=e.clone(),s=this.curve.redN.redMul(this.z);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(s),this.x.cmp(t)===0)return!0}};Vt.prototype.toP=Vt.prototype.normalize;Vt.prototype.mixedAdd=Vt.prototype.add;(function(r){var e=r;e.base=nu,e.short=b_,e.mont=y_,e.edwards=A_})(ed);var ou={},Bh,kp;function E_(){return kp||(kp=1,Bh={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"]]}}),Bh}(function(r){var e=r,t=kl,i=ed,s=Ai,a=s.assert;function f(v){v.type==="short"?this.curve=new i.short(v):v.type==="edwards"?this.curve=new i.edwards(v):this.curve=new i.mont(v),this.g=this.curve.g,this.n=this.curve.n,this.hash=v.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=f;function u(v,w){Object.defineProperty(e,v,{configurable:!0,enumerable:!0,get:function(){var S=new f(w);return Object.defineProperty(e,v,{configurable:!0,enumerable:!0,value:S}),S}})}u("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:t.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:t.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:t.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash: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"]}),u("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash: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"]}),u("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"]}),u("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:t.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var b;try{b=E_()}catch{b=void 0}u("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:t.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",b]})})(ou);var S_=kl,Xs=Xl,yv=Zg;function xs(r){if(!(this instanceof xs))return new xs(r);this.hash=r.hash,this.predResist=!!r.predResist,this.outLen=this.hash.outSize,this.minEntropy=r.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Xs.toArray(r.entropy,r.entropyEnc||"hex"),t=Xs.toArray(r.nonce,r.nonceEnc||"hex"),i=Xs.toArray(r.pers,r.persEnc||"hex");yv(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,i)}var x_=xs;xs.prototype._init=function(e,t,i){var s=e.concat(t).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var a=0;a<this.V.length;a++)this.K[a]=0,this.V[a]=1;this._update(s),this._reseed=1,this.reseedInterval=281474976710656};xs.prototype._hmac=function(){return new S_.hmac(this.hash,this.K)};xs.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())};xs.prototype.reseed=function(e,t,i,s){typeof t!="string"&&(s=i,i=t,t=null),e=Xs.toArray(e,t),i=Xs.toArray(i,s),yv(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this._reseed=1};xs.prototype.generate=function(e,t,i,s){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(s=i,i=t,t=null),i&&(i=Xs.toArray(i,s||"hex"),this._update(i));for(var a=[];a.length<e;)this.V=this._hmac().update(this.V).digest(),a=a.concat(this.V);var f=a.slice(0,e);return this._update(i),this._reseed++,Xs.encode(f,t)};var M_=ss,I_=Ai,wl=I_.assert;function $r(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 D_=$r;$r.fromPublic=function(e,t,i){return t instanceof $r?t:new $r(e,{pub:t,pubEnc:i})};$r.fromPrivate=function(e,t,i){return t instanceof $r?t:new $r(e,{priv:t,privEnc:i})};$r.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"}};$r.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};$r.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv};$r.prototype._importPrivate=function(e,t){this.priv=new M_(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)};$r.prototype._importPublic=function(e,t){if(e.x||e.y){this.ec.curve.type==="mont"?wl(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&wl(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)};$r.prototype.derive=function(e){return e.validate()||wl(e.validate(),"public point not validated"),e.mul(this.priv).getX()};$r.prototype.sign=function(e,t,i){return this.ec.sign(e,this,t,i)};$r.prototype.verify=function(e,t,i){return this.ec.verify(e,t,this,void 0,i)};$r.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var Uf=ss,rd=Ai,P_=rd.assert;function cu(r,e){if(r instanceof cu)return r;this._importDER(r,e)||(P_(r.r&&r.s,"Signature without r or s"),this.r=new Uf(r.r,16),this.s=new Uf(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}var O_=cu;function C_(){this.place=0}function qh(r,e){var t=r[e.place++];if(!(t&128))return t;var i=t&15;if(i===0||i>4||r[e.place]===0)return!1;for(var s=0,a=0,f=e.place;a<i;a++,f++)s<<=8,s|=r[f],s>>>=0;return s<=127?!1:(e.place=f,s)}function Hp(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)}cu.prototype._importDER=function(e,t){e=rd.toArray(e,t);var i=new C_;if(e[i.place++]!==48)return!1;var s=qh(e,i);if(s===!1||s+i.place!==e.length||e[i.place++]!==2)return!1;var a=qh(e,i);if(a===!1||e[i.place]&128)return!1;var f=e.slice(i.place,a+i.place);if(i.place+=a,e[i.place++]!==2)return!1;var u=qh(e,i);if(u===!1||e.length!==u+i.place||e[i.place]&128)return!1;var b=e.slice(i.place,u+i.place);if(f[0]===0)if(f[1]&128)f=f.slice(1);else return!1;if(b[0]===0)if(b[1]&128)b=b.slice(1);else return!1;return this.r=new Uf(f),this.s=new Uf(b),this.recoveryParam=null,!0};function Lh(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)}cu.prototype.toDER=function(e){var t=this.r.toArray(),i=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),i[0]&128&&(i=[0].concat(i)),t=Hp(t),i=Hp(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var s=[2];Lh(s,t.length),s=s.concat(t),s.push(2),Lh(s,i.length);var a=s.concat(i),f=[48];return Lh(f,a.length),f=f.concat(a),rd.encode(f,e)};var cn=ss,wv=x_,R_=Ai,Uh=ou,N_=vv,Ws=R_.assert,id=D_,fu=O_;function $i(r){if(!(this instanceof $i))return new $i(r);typeof r=="string"&&(Ws(Object.prototype.hasOwnProperty.call(Uh,r),"Unknown curve "+r),r=Uh[r]),r instanceof Uh.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 T_=$i;$i.prototype.keyPair=function(e){return new id(this,e)};$i.prototype.keyFromPrivate=function(e,t){return id.fromPrivate(this,e,t)};$i.prototype.keyFromPublic=function(e,t){return id.fromPublic(this,e,t)};$i.prototype.genKeyPair=function(e){e||(e={});for(var t=new wv({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||N_(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),s=this.n.sub(new cn(2));;){var a=new cn(t.generate(i));if(!(a.cmp(s)>0))return a.iaddn(1),this.keyFromPrivate(a)}};$i.prototype._truncateToN=function(e,t,i){var s;if(cn.isBN(e)||typeof e=="number")e=new cn(e,16),s=e.byteLength();else if(typeof e=="object")s=e.length,e=new cn(e,16);else{var a=e.toString();s=a.length+1>>>1,e=new cn(a,16)}typeof i!="number"&&(i=s*8);var f=i-this.n.bitLength();return f>0&&(e=e.ushrn(f)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e};$i.prototype.sign=function(e,t,i,s){if(typeof i=="object"&&(s=i,i=null),s||(s={}),typeof e!="string"&&typeof e!="number"&&!cn.isBN(e)){Ws(typeof e=="object"&&e&&typeof e.length=="number","Expected message to be an array-like, a hex string, or a BN instance"),Ws(e.length>>>0===e.length);for(var a=0;a<e.length;a++)Ws((e[a]&255)===e[a])}t=this.keyFromPrivate(t,i),e=this._truncateToN(e,!1,s.msgBitLength),Ws(!e.isNeg(),"Can not sign a negative message");var f=this.n.byteLength(),u=t.getPrivate().toArray("be",f),b=e.toArray("be",f);Ws(new cn(b).eq(e),"Can not sign message");for(var v=new wv({hash:this.hash,entropy:u,nonce:b,pers:s.pers,persEnc:s.persEnc||"utf8"}),w=this.n.sub(new cn(1)),S=0;;S++){var O=s.k?s.k(S):new cn(v.generate(this.n.byteLength()));if(O=this._truncateToN(O,!0),!(O.cmpn(1)<=0||O.cmp(w)>=0)){var P=this.g.mul(O);if(!P.isInfinity()){var R=P.getX(),z=R.umod(this.n);if(z.cmpn(0)!==0){var W=O.invm(this.n).mul(z.mul(t.getPrivate()).iadd(e));if(W=W.umod(this.n),W.cmpn(0)!==0){var Q=(P.getY().isOdd()?1:0)|(R.cmp(z)!==0?2:0);return s.canonical&&W.cmp(this.nh)>0&&(W=this.n.sub(W),Q^=1),new fu({r:z,s:W,recoveryParam:Q})}}}}}};$i.prototype.verify=function(e,t,i,s,a){a||(a={}),e=this._truncateToN(e,!1,a.msgBitLength),i=this.keyFromPublic(i,s),t=new fu(t,"hex");var f=t.r,u=t.s;if(f.cmpn(1)<0||f.cmp(this.n)>=0||u.cmpn(1)<0||u.cmp(this.n)>=0)return!1;var b=u.invm(this.n),v=b.mul(e).umod(this.n),w=b.mul(f).umod(this.n),S;return this.curve._maxwellTrick?(S=this.g.jmulAdd(v,i.getPublic(),w),S.isInfinity()?!1:S.eqXToP(f)):(S=this.g.mulAdd(v,i.getPublic(),w),S.isInfinity()?!1:S.getX().umod(this.n).cmp(f)===0)};$i.prototype.recoverPubKey=function(r,e,t,i){Ws((3&t)===t,"The recovery param is more than two bits"),e=new fu(e,i);var s=this.n,a=new cn(r),f=e.r,u=e.s,b=t&1,v=t>>1;if(f.cmp(this.curve.p.umod(this.curve.n))>=0&&v)throw new Error("Unable to find sencond key candinate");v?f=this.curve.pointFromX(f.add(this.curve.n),b):f=this.curve.pointFromX(f,b);var w=e.r.invm(s),S=s.sub(a).mul(w).umod(s),O=u.mul(w).umod(s);return this.g.mulAdd(S,f,O)};$i.prototype.getKeyRecoveryParam=function(r,e,t,i){if(e=new fu(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var s=0;s<4;s++){var a;try{a=this.recoverPubKey(r,e,s)}catch{continue}if(a.eq(t))return s}throw new Error("Unable to find valid recovery factor")};var rc=Ai,_v=rc.assert,Kp=rc.parseBytes,Ga=rc.cachedProperty;function Ar(r,e){this.eddsa=r,this._secret=Kp(e.secret),r.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=Kp(e.pub)}Ar.fromPublic=function(e,t){return t instanceof Ar?t:new Ar(e,{pub:t})};Ar.fromSecret=function(e,t){return t instanceof Ar?t:new Ar(e,{secret:t})};Ar.prototype.secret=function(){return this._secret};Ga(Ar,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});Ga(Ar,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});Ga(Ar,"privBytes",function(){var e=this.eddsa,t=this.hash(),i=e.encodingLength-1,s=t.slice(0,e.encodingLength);return s[0]&=248,s[i]&=127,s[i]|=64,s});Ga(Ar,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});Ga(Ar,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});Ga(Ar,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});Ar.prototype.sign=function(e){return _v(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)};Ar.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)};Ar.prototype.getSecret=function(e){return _v(this._secret,"KeyPair is public only"),rc.encode(this.secret(),e)};Ar.prototype.getPublic=function(e){return rc.encode(this.pubBytes(),e)};var F_=Ar,B_=ss,uu=Ai,Vp=uu.assert,hu=uu.cachedProperty,q_=uu.parseBytes;function sa(r,e){this.eddsa=r,typeof e!="object"&&(e=q_(e)),Array.isArray(e)&&(Vp(e.length===r.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,r.encodingLength),S:e.slice(r.encodingLength)}),Vp(e.R&&e.S,"Signature without R or S"),r.isPoint(e.R)&&(this._R=e.R),e.S instanceof B_&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}hu(sa,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});hu(sa,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});hu(sa,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});hu(sa,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});sa.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};sa.prototype.toHex=function(){return uu.encode(this.toBytes(),"hex").toUpperCase()};var L_=sa,U_=kl,$_=ou,za=Ai,z_=za.assert,Av=za.parseBytes,Ev=F_,Gp=L_;function ui(r){if(z_(r==="ed25519","only tested with ed25519 so far"),!(this instanceof ui))return new ui(r);r=$_[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=U_.sha512}var j_=ui;ui.prototype.sign=function(e,t){e=Av(e);var i=this.keyFromSecret(t),s=this.hashInt(i.messagePrefix(),e),a=this.g.mul(s),f=this.encodePoint(a),u=this.hashInt(f,i.pubBytes(),e).mul(i.priv()),b=s.add(u).umod(this.curve.n);return this.makeSignature({R:a,S:b,Rencoded:f})};ui.prototype.verify=function(e,t,i){if(e=Av(e),t=this.makeSignature(t),t.S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var s=this.keyFromPublic(i),a=this.hashInt(t.Rencoded(),s.pubBytes(),e),f=this.g.mul(t.S()),u=t.R().add(s.pub().mul(a));return u.eq(f)};ui.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return za.intFromLE(e.digest()).umod(this.curve.n)};ui.prototype.keyFromPublic=function(e){return Ev.fromPublic(this,e)};ui.prototype.keyFromSecret=function(e){return Ev.fromSecret(this,e)};ui.prototype.makeSignature=function(e){return e instanceof Gp?e:new Gp(this,e)};ui.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t};ui.prototype.decodePoint=function(e){e=za.parseBytes(e);var t=e.length-1,i=e.slice(0,t).concat(e[t]&-129),s=(e[t]&128)!==0,a=za.intFromLE(i);return this.curve.pointFromY(a,s)};ui.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)};ui.prototype.decodeInt=function(e){return za.intFromLE(e)};ui.prototype.isPoint=function(e){return e instanceof this.pointClass};(function(r){var e=r;e.version=d_.version,e.utils=Ai,e.rand=vv,e.curve=ed,e.curves=ou,e.ec=T_,e.eddsa=j_})(gv);var nd={},Sv={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=Zf,t=ns;r.DIGEST_LENGTH=64,r.BLOCK_SIZE=128;var i=function(){function u(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return u.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},u.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},u.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._tempHi),t.wipe(this._tempLo),this.reset()},u.prototype.update=function(b,v){if(v===void 0&&(v=b.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var w=0;if(this._bytesHashed+=v,this._bufferLength>0){for(;this._bufferLength<r.BLOCK_SIZE&&v>0;)this._buffer[this._bufferLength++]=b[w++],v--;this._bufferLength===this.blockSize&&(a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(v>=this.blockSize&&(w=a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,b,w,v),v%=this.blockSize);v>0;)this._buffer[this._bufferLength++]=b[w++],v--;return this},u.prototype.finish=function(b){if(!this._finished){var v=this._bytesHashed,w=this._bufferLength,S=v/536870912|0,O=v<<3,P=v%128<112?128:256;this._buffer[w]=128;for(var R=w+1;R<P-8;R++)this._buffer[R]=0;e.writeUint32BE(S,this._buffer,P-8),e.writeUint32BE(O,this._buffer,P-4),a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,P),this._finished=!0}for(var R=0;R<this.digestLength/8;R++)e.writeUint32BE(this._stateHi[R],b,R*8),e.writeUint32BE(this._stateLo[R],b,R*8+4);return this},u.prototype.digest=function(){var b=new Uint8Array(this.digestLength);return this.finish(b),b},u.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},u.prototype.restoreState=function(b){return this._stateHi.set(b.stateHi),this._stateLo.set(b.stateLo),this._bufferLength=b.bufferLength,b.buffer&&this._buffer.set(b.buffer),this._bytesHashed=b.bytesHashed,this._finished=!1,this},u.prototype.cleanSavedState=function(b){t.wipe(b.stateHi),t.wipe(b.stateLo),b.buffer&&t.wipe(b.buffer),b.bufferLength=0,b.bytesHashed=0},u}();r.SHA512=i;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 a(u,b,v,w,S,O,P){for(var R=v[0],z=v[1],W=v[2],Q=v[3],j=v[4],Y=v[5],U=v[6],k=v[7],V=w[0],A=w[1],F=w[2],ae=w[3],de=w[4],L=w[5],m=w[6],c=w[7],p,d,y,M,I,x,l,g;P>=128;){for(var N=0;N<16;N++){var Z=8*N+O;u[N]=e.readUint32BE(S,Z),b[N]=e.readUint32BE(S,Z+4)}for(var N=0;N<80;N++){var te=R,D=z,ee=W,B=Q,H=j,K=Y,_=U,$=k,se=V,ce=A,ue=F,ye=ae,we=de,Re=L,Qe=m,Pe=c;if(p=k,d=c,I=d&65535,x=d>>>16,l=p&65535,g=p>>>16,p=(j>>>14|de<<18)^(j>>>18|de<<14)^(de>>>9|j<<23),d=(de>>>14|j<<18)^(de>>>18|j<<14)^(j>>>9|de<<23),I+=d&65535,x+=d>>>16,l+=p&65535,g+=p>>>16,p=j&Y^~j&U,d=de&L^~de&m,I+=d&65535,x+=d>>>16,l+=p&65535,g+=p>>>16,p=s[N*2],d=s[N*2+1],I+=d&65535,x+=d>>>16,l+=p&65535,g+=p>>>16,p=u[N%16],d=b[N%16],I+=d&65535,x+=d>>>16,l+=p&65535,g+=p>>>16,x+=I>>>16,l+=x>>>16,g+=l>>>16,y=l&65535|g<<16,M=I&65535|x<<16,p=y,d=M,I=d&65535,x=d>>>16,l=p&65535,g=p>>>16,p=(R>>>28|V<<4)^(V>>>2|R<<30)^(V>>>7|R<<25),d=(V>>>28|R<<4)^(R>>>2|V<<30)^(R>>>7|V<<25),I+=d&65535,x+=d>>>16,l+=p&65535,g+=p>>>16,p=R&z^R&W^z&W,d=V&A^V&F^A&F,I+=d&65535,x+=d>>>16,l+=p&65535,g+=p>>>16,x+=I>>>16,l+=x>>>16,g+=l>>>16,$=l&65535|g<<16,Pe=I&65535|x<<16,p=B,d=ye,I=d&65535,x=d>>>16,l=p&65535,g=p>>>16,p=y,d=M,I+=d&65535,x+=d>>>16,l+=p&65535,g+=p>>>16,x+=I>>>16,l+=x>>>16,g+=l>>>16,B=l&65535|g<<16,ye=I&65535|x<<16,z=te,W=D,Q=ee,j=B,Y=H,U=K,k=_,R=$,A=se,F=ce,ae=ue,de=ye,L=we,m=Re,c=Qe,V=Pe,N%16===15)for(var Z=0;Z<16;Z++)p=u[Z],d=b[Z],I=d&65535,x=d>>>16,l=p&65535,g=p>>>16,p=u[(Z+9)%16],d=b[(Z+9)%16],I+=d&65535,x+=d>>>16,l+=p&65535,g+=p>>>16,y=u[(Z+1)%16],M=b[(Z+1)%16],p=(y>>>1|M<<31)^(y>>>8|M<<24)^y>>>7,d=(M>>>1|y<<31)^(M>>>8|y<<24)^(M>>>7|y<<25),I+=d&65535,x+=d>>>16,l+=p&65535,g+=p>>>16,y=u[(Z+14)%16],M=b[(Z+14)%16],p=(y>>>19|M<<13)^(M>>>29|y<<3)^y>>>6,d=(M>>>19|y<<13)^(y>>>29|M<<3)^(M>>>6|y<<26),I+=d&65535,x+=d>>>16,l+=p&65535,g+=p>>>16,x+=I>>>16,l+=x>>>16,g+=l>>>16,u[Z]=l&65535|g<<16,b[Z]=I&65535|x<<16}p=R,d=V,I=d&65535,x=d>>>16,l=p&65535,g=p>>>16,p=v[0],d=w[0],I+=d&65535,x+=d>>>16,l+=p&65535,g+=p>>>16,x+=I>>>16,l+=x>>>16,g+=l>>>16,v[0]=R=l&65535|g<<16,w[0]=V=I&65535|x<<16,p=z,d=A,I=d&65535,x=d>>>16,l=p&65535,g=p>>>16,p=v[1],d=w[1],I+=d&65535,x+=d>>>16,l+=p&65535,g+=p>>>16,x+=I>>>16,l+=x>>>16,g+=l>>>16,v[1]=z=l&65535|g<<16,w[1]=A=I&65535|x<<16,p=W,d=F,I=d&65535,x=d>>>16,l=p&65535,g=p>>>16,p=v[2],d=w[2],I+=d&65535,x+=d>>>16,l+=p&65535,g+=p>>>16,x+=I>>>16,l+=x>>>16,g+=l>>>16,v[2]=W=l&65535|g<<16,w[2]=F=I&65535|x<<16,p=Q,d=ae,I=d&65535,x=d>>>16,l=p&65535,g=p>>>16,p=v[3],d=w[3],I+=d&65535,x+=d>>>16,l+=p&65535,g+=p>>>16,x+=I>>>16,l+=x>>>16,g+=l>>>16,v[3]=Q=l&65535|g<<16,w[3]=ae=I&65535|x<<16,p=j,d=de,I=d&65535,x=d>>>16,l=p&65535,g=p>>>16,p=v[4],d=w[4],I+=d&65535,x+=d>>>16,l+=p&65535,g+=p>>>16,x+=I>>>16,l+=x>>>16,g+=l>>>16,v[4]=j=l&65535|g<<16,w[4]=de=I&65535|x<<16,p=Y,d=L,I=d&65535,x=d>>>16,l=p&65535,g=p>>>16,p=v[5],d=w[5],I+=d&65535,x+=d>>>16,l+=p&65535,g+=p>>>16,x+=I>>>16,l+=x>>>16,g+=l>>>16,v[5]=Y=l&65535|g<<16,w[5]=L=I&65535|x<<16,p=U,d=m,I=d&65535,x=d>>>16,l=p&65535,g=p>>>16,p=v[6],d=w[6],I+=d&65535,x+=d>>>16,l+=p&65535,g+=p>>>16,x+=I>>>16,l+=x>>>16,g+=l>>>16,v[6]=U=l&65535|g<<16,w[6]=m=I&65535|x<<16,p=k,d=c,I=d&65535,x=d>>>16,l=p&65535,g=p>>>16,p=v[7],d=w[7],I+=d&65535,x+=d>>>16,l+=p&65535,g+=p>>>16,x+=I>>>16,l+=x>>>16,g+=l>>>16,v[7]=k=l&65535|g<<16,w[7]=c=I&65535|x<<16,O+=128,P-=128}return O}function f(u){var b=new i;b.update(u);var v=b.digest();return b.clean(),v}r.hash=f})(Sv);(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=ia,t=Sv,i=ns;r.SIGNATURE_LENGTH=64,r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=64,r.SEED_LENGTH=32;function s(B){const H=new Float64Array(16);if(B)for(let K=0;K<B.length;K++)H[K]=B[K];return H}const a=new Uint8Array(32);a[0]=9;const f=s(),u=s([1]),b=s([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),v=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),w=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),S=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),O=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function P(B,H){for(let K=0;K<16;K++)B[K]=H[K]|0}function R(B){let H=1;for(let K=0;K<16;K++){let _=B[K]+H+65535;H=Math.floor(_/65536),B[K]=_-H*65536}B[0]+=H-1+37*(H-1)}function z(B,H,K){const _=~(K-1);for(let $=0;$<16;$++){const se=_&(B[$]^H[$]);B[$]^=se,H[$]^=se}}function W(B,H){const K=s(),_=s();for(let $=0;$<16;$++)_[$]=H[$];R(_),R(_),R(_);for(let $=0;$<2;$++){K[0]=_[0]-65517;for(let ce=1;ce<15;ce++)K[ce]=_[ce]-65535-(K[ce-1]>>16&1),K[ce-1]&=65535;K[15]=_[15]-32767-(K[14]>>16&1);const se=K[15]>>16&1;K[14]&=65535,z(_,K,1-se)}for(let $=0;$<16;$++)B[2*$]=_[$]&255,B[2*$+1]=_[$]>>8}function Q(B,H){let K=0;for(let _=0;_<32;_++)K|=B[_]^H[_];return(1&K-1>>>8)-1}function j(B,H){const K=new Uint8Array(32),_=new Uint8Array(32);return W(K,B),W(_,H),Q(K,_)}function Y(B){const H=new Uint8Array(32);return W(H,B),H[0]&1}function U(B,H){for(let K=0;K<16;K++)B[K]=H[2*K]+(H[2*K+1]<<8);B[15]&=32767}function k(B,H,K){for(let _=0;_<16;_++)B[_]=H[_]+K[_]}function V(B,H,K){for(let _=0;_<16;_++)B[_]=H[_]-K[_]}function A(B,H,K){let _,$,se=0,ce=0,ue=0,ye=0,we=0,Re=0,Qe=0,Pe=0,Ne=0,Me=0,me=0,Oe=0,Te=0,ve=0,Ce=0,xe=0,be=0,Le=0,Ie=0,_e=0,He=0,Ve=0,Ee=0,Ke=0,ht=0,Ge=0,wt=0,lt=0,Je=0,At=0,xt=0,Fe=K[0],Xe=K[1],tt=K[2],Be=K[3],et=K[4],Ze=K[5],$e=K[6],ft=K[7],rt=K[8],ze=K[9],it=K[10],st=K[11],qe=K[12],Ye=K[13],ut=K[14],je=K[15];_=H[0],se+=_*Fe,ce+=_*Xe,ue+=_*tt,ye+=_*Be,we+=_*et,Re+=_*Ze,Qe+=_*$e,Pe+=_*ft,Ne+=_*rt,Me+=_*ze,me+=_*it,Oe+=_*st,Te+=_*qe,ve+=_*Ye,Ce+=_*ut,xe+=_*je,_=H[1],ce+=_*Fe,ue+=_*Xe,ye+=_*tt,we+=_*Be,Re+=_*et,Qe+=_*Ze,Pe+=_*$e,Ne+=_*ft,Me+=_*rt,me+=_*ze,Oe+=_*it,Te+=_*st,ve+=_*qe,Ce+=_*Ye,xe+=_*ut,be+=_*je,_=H[2],ue+=_*Fe,ye+=_*Xe,we+=_*tt,Re+=_*Be,Qe+=_*et,Pe+=_*Ze,Ne+=_*$e,Me+=_*ft,me+=_*rt,Oe+=_*ze,Te+=_*it,ve+=_*st,Ce+=_*qe,xe+=_*Ye,be+=_*ut,Le+=_*je,_=H[3],ye+=_*Fe,we+=_*Xe,Re+=_*tt,Qe+=_*Be,Pe+=_*et,Ne+=_*Ze,Me+=_*$e,me+=_*ft,Oe+=_*rt,Te+=_*ze,ve+=_*it,Ce+=_*st,xe+=_*qe,be+=_*Ye,Le+=_*ut,Ie+=_*je,_=H[4],we+=_*Fe,Re+=_*Xe,Qe+=_*tt,Pe+=_*Be,Ne+=_*et,Me+=_*Ze,me+=_*$e,Oe+=_*ft,Te+=_*rt,ve+=_*ze,Ce+=_*it,xe+=_*st,be+=_*qe,Le+=_*Ye,Ie+=_*ut,_e+=_*je,_=H[5],Re+=_*Fe,Qe+=_*Xe,Pe+=_*tt,Ne+=_*Be,Me+=_*et,me+=_*Ze,Oe+=_*$e,Te+=_*ft,ve+=_*rt,Ce+=_*ze,xe+=_*it,be+=_*st,Le+=_*qe,Ie+=_*Ye,_e+=_*ut,He+=_*je,_=H[6],Qe+=_*Fe,Pe+=_*Xe,Ne+=_*tt,Me+=_*Be,me+=_*et,Oe+=_*Ze,Te+=_*$e,ve+=_*ft,Ce+=_*rt,xe+=_*ze,be+=_*it,Le+=_*st,Ie+=_*qe,_e+=_*Ye,He+=_*ut,Ve+=_*je,_=H[7],Pe+=_*Fe,Ne+=_*Xe,Me+=_*tt,me+=_*Be,Oe+=_*et,Te+=_*Ze,ve+=_*$e,Ce+=_*ft,xe+=_*rt,be+=_*ze,Le+=_*it,Ie+=_*st,_e+=_*qe,He+=_*Ye,Ve+=_*ut,Ee+=_*je,_=H[8],Ne+=_*Fe,Me+=_*Xe,me+=_*tt,Oe+=_*Be,Te+=_*et,ve+=_*Ze,Ce+=_*$e,xe+=_*ft,be+=_*rt,Le+=_*ze,Ie+=_*it,_e+=_*st,He+=_*qe,Ve+=_*Ye,Ee+=_*ut,Ke+=_*je,_=H[9],Me+=_*Fe,me+=_*Xe,Oe+=_*tt,Te+=_*Be,ve+=_*et,Ce+=_*Ze,xe+=_*$e,be+=_*ft,Le+=_*rt,Ie+=_*ze,_e+=_*it,He+=_*st,Ve+=_*qe,Ee+=_*Ye,Ke+=_*ut,ht+=_*je,_=H[10],me+=_*Fe,Oe+=_*Xe,Te+=_*tt,ve+=_*Be,Ce+=_*et,xe+=_*Ze,be+=_*$e,Le+=_*ft,Ie+=_*rt,_e+=_*ze,He+=_*it,Ve+=_*st,Ee+=_*qe,Ke+=_*Ye,ht+=_*ut,Ge+=_*je,_=H[11],Oe+=_*Fe,Te+=_*Xe,ve+=_*tt,Ce+=_*Be,xe+=_*et,be+=_*Ze,Le+=_*$e,Ie+=_*ft,_e+=_*rt,He+=_*ze,Ve+=_*it,Ee+=_*st,Ke+=_*qe,ht+=_*Ye,Ge+=_*ut,wt+=_*je,_=H[12],Te+=_*Fe,ve+=_*Xe,Ce+=_*tt,xe+=_*Be,be+=_*et,Le+=_*Ze,Ie+=_*$e,_e+=_*ft,He+=_*rt,Ve+=_*ze,Ee+=_*it,Ke+=_*st,ht+=_*qe,Ge+=_*Ye,wt+=_*ut,lt+=_*je,_=H[13],ve+=_*Fe,Ce+=_*Xe,xe+=_*tt,be+=_*Be,Le+=_*et,Ie+=_*Ze,_e+=_*$e,He+=_*ft,Ve+=_*rt,Ee+=_*ze,Ke+=_*it,ht+=_*st,Ge+=_*qe,wt+=_*Ye,lt+=_*ut,Je+=_*je,_=H[14],Ce+=_*Fe,xe+=_*Xe,be+=_*tt,Le+=_*Be,Ie+=_*et,_e+=_*Ze,He+=_*$e,Ve+=_*ft,Ee+=_*rt,Ke+=_*ze,ht+=_*it,Ge+=_*st,wt+=_*qe,lt+=_*Ye,Je+=_*ut,At+=_*je,_=H[15],xe+=_*Fe,be+=_*Xe,Le+=_*tt,Ie+=_*Be,_e+=_*et,He+=_*Ze,Ve+=_*$e,Ee+=_*ft,Ke+=_*rt,ht+=_*ze,Ge+=_*it,wt+=_*st,lt+=_*qe,Je+=_*Ye,At+=_*ut,xt+=_*je,se+=38*be,ce+=38*Le,ue+=38*Ie,ye+=38*_e,we+=38*He,Re+=38*Ve,Qe+=38*Ee,Pe+=38*Ke,Ne+=38*ht,Me+=38*Ge,me+=38*wt,Oe+=38*lt,Te+=38*Je,ve+=38*At,Ce+=38*xt,$=1,_=se+$+65535,$=Math.floor(_/65536),se=_-$*65536,_=ce+$+65535,$=Math.floor(_/65536),ce=_-$*65536,_=ue+$+65535,$=Math.floor(_/65536),ue=_-$*65536,_=ye+$+65535,$=Math.floor(_/65536),ye=_-$*65536,_=we+$+65535,$=Math.floor(_/65536),we=_-$*65536,_=Re+$+65535,$=Math.floor(_/65536),Re=_-$*65536,_=Qe+$+65535,$=Math.floor(_/65536),Qe=_-$*65536,_=Pe+$+65535,$=Math.floor(_/65536),Pe=_-$*65536,_=Ne+$+65535,$=Math.floor(_/65536),Ne=_-$*65536,_=Me+$+65535,$=Math.floor(_/65536),Me=_-$*65536,_=me+$+65535,$=Math.floor(_/65536),me=_-$*65536,_=Oe+$+65535,$=Math.floor(_/65536),Oe=_-$*65536,_=Te+$+65535,$=Math.floor(_/65536),Te=_-$*65536,_=ve+$+65535,$=Math.floor(_/65536),ve=_-$*65536,_=Ce+$+65535,$=Math.floor(_/65536),Ce=_-$*65536,_=xe+$+65535,$=Math.floor(_/65536),xe=_-$*65536,se+=$-1+37*($-1),$=1,_=se+$+65535,$=Math.floor(_/65536),se=_-$*65536,_=ce+$+65535,$=Math.floor(_/65536),ce=_-$*65536,_=ue+$+65535,$=Math.floor(_/65536),ue=_-$*65536,_=ye+$+65535,$=Math.floor(_/65536),ye=_-$*65536,_=we+$+65535,$=Math.floor(_/65536),we=_-$*65536,_=Re+$+65535,$=Math.floor(_/65536),Re=_-$*65536,_=Qe+$+65535,$=Math.floor(_/65536),Qe=_-$*65536,_=Pe+$+65535,$=Math.floor(_/65536),Pe=_-$*65536,_=Ne+$+65535,$=Math.floor(_/65536),Ne=_-$*65536,_=Me+$+65535,$=Math.floor(_/65536),Me=_-$*65536,_=me+$+65535,$=Math.floor(_/65536),me=_-$*65536,_=Oe+$+65535,$=Math.floor(_/65536),Oe=_-$*65536,_=Te+$+65535,$=Math.floor(_/65536),Te=_-$*65536,_=ve+$+65535,$=Math.floor(_/65536),ve=_-$*65536,_=Ce+$+65535,$=Math.floor(_/65536),Ce=_-$*65536,_=xe+$+65535,$=Math.floor(_/65536),xe=_-$*65536,se+=$-1+37*($-1),B[0]=se,B[1]=ce,B[2]=ue,B[3]=ye,B[4]=we,B[5]=Re,B[6]=Qe,B[7]=Pe,B[8]=Ne,B[9]=Me,B[10]=me,B[11]=Oe,B[12]=Te,B[13]=ve,B[14]=Ce,B[15]=xe}function F(B,H){A(B,H,H)}function ae(B,H){const K=s();let _;for(_=0;_<16;_++)K[_]=H[_];for(_=253;_>=0;_--)F(K,K),_!==2&&_!==4&&A(K,K,H);for(_=0;_<16;_++)B[_]=K[_]}function de(B,H){const K=s();let _;for(_=0;_<16;_++)K[_]=H[_];for(_=250;_>=0;_--)F(K,K),_!==1&&A(K,K,H);for(_=0;_<16;_++)B[_]=K[_]}function L(B,H){const K=s(),_=s(),$=s(),se=s(),ce=s(),ue=s(),ye=s(),we=s(),Re=s();V(K,B[1],B[0]),V(Re,H[1],H[0]),A(K,K,Re),k(_,B[0],B[1]),k(Re,H[0],H[1]),A(_,_,Re),A($,B[3],H[3]),A($,$,v),A(se,B[2],H[2]),k(se,se,se),V(ce,_,K),V(ue,se,$),k(ye,se,$),k(we,_,K),A(B[0],ce,ue),A(B[1],we,ye),A(B[2],ye,ue),A(B[3],ce,we)}function m(B,H,K){for(let _=0;_<4;_++)z(B[_],H[_],K)}function c(B,H){const K=s(),_=s(),$=s();ae($,H[2]),A(K,H[0],$),A(_,H[1],$),W(B,_),B[31]^=Y(K)<<7}function p(B,H,K){P(B[0],f),P(B[1],u),P(B[2],u),P(B[3],f);for(let _=255;_>=0;--_){const $=K[_/8|0]>>(_&7)&1;m(B,H,$),L(H,B),L(B,B),m(B,H,$)}}function d(B,H){const K=[s(),s(),s(),s()];P(K[0],w),P(K[1],S),P(K[2],u),A(K[3],w,S),p(B,K,H)}function y(B){if(B.length!==r.SEED_LENGTH)throw new Error(`ed25519: seed must be ${r.SEED_LENGTH} bytes`);const H=(0,t.hash)(B);H[0]&=248,H[31]&=127,H[31]|=64;const K=new Uint8Array(32),_=[s(),s(),s(),s()];d(_,H),c(K,_);const $=new Uint8Array(64);return $.set(B),$.set(K,32),{publicKey:K,secretKey:$}}r.generateKeyPairFromSeed=y;function M(B){const H=(0,e.randomBytes)(32,B),K=y(H);return(0,i.wipe)(H),K}r.generateKeyPair=M;function I(B){if(B.length!==r.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${r.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(B.subarray(32))}r.extractPublicKeyFromSecretKey=I;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 l(B,H){let K,_,$,se;for(_=63;_>=32;--_){for(K=0,$=_-32,se=_-12;$<se;++$)H[$]+=K-16*H[_]*x[$-(_-32)],K=Math.floor((H[$]+128)/256),H[$]-=K*256;H[$]+=K,H[_]=0}for(K=0,$=0;$<32;$++)H[$]+=K-(H[31]>>4)*x[$],K=H[$]>>8,H[$]&=255;for($=0;$<32;$++)H[$]-=K*x[$];for(_=0;_<32;_++)H[_+1]+=H[_]>>8,B[_]=H[_]&255}function g(B){const H=new Float64Array(64);for(let K=0;K<64;K++)H[K]=B[K];for(let K=0;K<64;K++)B[K]=0;l(B,H)}function N(B,H){const K=new Float64Array(64),_=[s(),s(),s(),s()],$=(0,t.hash)(B.subarray(0,32));$[0]&=248,$[31]&=127,$[31]|=64;const se=new Uint8Array(64);se.set($.subarray(32),32);const ce=new t.SHA512;ce.update(se.subarray(32)),ce.update(H);const ue=ce.digest();ce.clean(),g(ue),d(_,ue),c(se,_),ce.reset(),ce.update(se.subarray(0,32)),ce.update(B.subarray(32)),ce.update(H);const ye=ce.digest();g(ye);for(let we=0;we<32;we++)K[we]=ue[we];for(let we=0;we<32;we++)for(let Re=0;Re<32;Re++)K[we+Re]+=ye[we]*$[Re];return l(se.subarray(32),K),se}r.sign=N;function Z(B,H){const K=s(),_=s(),$=s(),se=s(),ce=s(),ue=s(),ye=s();return P(B[2],u),U(B[1],H),F($,B[1]),A(se,$,b),V($,$,B[2]),k(se,B[2],se),F(ce,se),F(ue,ce),A(ye,ue,ce),A(K,ye,$),A(K,K,se),de(K,K),A(K,K,$),A(K,K,se),A(K,K,se),A(B[0],K,se),F(_,B[0]),A(_,_,se),j(_,$)&&A(B[0],B[0],O),F(_,B[0]),A(_,_,se),j(_,$)?-1:(Y(B[0])===H[31]>>7&&V(B[0],f,B[0]),A(B[3],B[0],B[1]),0)}function te(B,H,K){const _=new Uint8Array(32),$=[s(),s(),s(),s()],se=[s(),s(),s(),s()];if(K.length!==r.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${r.SIGNATURE_LENGTH} bytes`);if(Z(se,B))return!1;const ce=new t.SHA512;ce.update(K.subarray(0,32)),ce.update(B),ce.update(H);const ue=ce.digest();return g(ue),p($,se,ue),d(se,K.subarray(32)),L($,se),c(_,$),!Q(K,_)}r.verify=te;function D(B){let H=[s(),s(),s(),s()];if(Z(H,B))throw new Error("Ed25519: invalid public key");let K=s(),_=s(),$=H[1];k(K,u,$),V(_,u,$),ae(_,_),A(K,K,_);let se=new Uint8Array(32);return W(se,K),se}r.convertPublicKeyToX25519=D;function ee(B){const H=(0,t.hash)(B.subarray(0,32));H[0]&=248,H[31]&=127,H[31]|=64;const K=new Uint8Array(H.subarray(0,32));return(0,i.wipe)(H),K}r.convertSecretKeyToX25519=ee})(nd);const k_="EdDSA",H_="JWT",$f=".",lu="base64url",xv="utf8",Mv="utf8",K_=":",V_="did",G_="key",Wp="base58btc",W_="z",J_="K36",Y_=32,Q_=r=>JSON.stringify(r,(e,t)=>typeof t=="bigint"?t.toString()+"n":t),X_=r=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,t=r.replace(e,'$1"$2n"$3');return JSON.parse(t,(i,s)=>typeof s=="string"&&s.match(/^\d+n$/)?BigInt(s.substring(0,s.length-1)):s)};function ea(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return X_(r)}catch{return r}}function is(r){return typeof r=="string"?r:Q_(r)||""}function Jp(r){return ea(_r(wr(r,lu),xv))}function zf(r){return _r(wr(is(r),xv),lu)}function Iv(r){const e=wr(J_,Wp),t=W_+_r(If([e,r]),Wp);return[V_,G_,t].join(K_)}function Z_(r){return _r(r,lu)}function e7(r){return wr(r,lu)}function t7(r){return wr([zf(r.header),zf(r.payload)].join($f),Mv)}function r7(r){return[zf(r.header),zf(r.payload),Z_(r.signature)].join($f)}function _l(r){const e=r.split($f),t=Jp(e[0]),i=Jp(e[1]),s=e7(e[2]),a=wr(e.slice(0,2).join($f),Mv);return{header:t,payload:i,signature:s,data:a}}function Yp(r=ia.randomBytes(Y_)){return nd.generateKeyPairFromSeed(r)}async function i7(r,e,t,i,s=Se.fromMiliseconds(Date.now())){const a={alg:k_,typ:H_},f=Iv(i.publicKey),u=s+t,b={iss:f,sub:r,aud:e,iat:s,exp:u},v=t7({header:a,payload:b}),w=nd.sign(i.secretKey,v);return r7({header:a,payload:b,signature:w})}const n7={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"}};var s7={};const a7=":";function qo(r){const[e,t]=r.split(a7);return{namespace:e,reference:t}}function Qp(r,e=[]){const t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;const s=r[i];t.push(...s.accounts)}),t}function Dv(r,e){return r.includes(":")?[r]:e.chains||[]}var o7=Object.defineProperty,Xp=Object.getOwnPropertySymbols,c7=Object.prototype.hasOwnProperty,f7=Object.prototype.propertyIsEnumerable,Zp=(r,e,t)=>e in r?o7(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,e1=(r,e)=>{for(var t in e||(e={}))c7.call(e,t)&&Zp(r,t,e[t]);if(Xp)for(var t of Xp(e))f7.call(e,t)&&Zp(r,t,e[t]);return r};const u7="ReactNative",yi={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},h7="js";function jf(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Wa(){return!tu()&&!!Vl()&&navigator.product===u7}function ic(){return!jf()&&!!Vl()&&!!tu()}function nc(){return Wa()?yi.reactNative:jf()?yi.node:ic()?yi.browser:yi.unknown}function l7(){var r;try{return Wa()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(r=global.Application)==null?void 0:r.applicationId:void 0}catch{return}}function d7(r,e){let t=Ho.parse(r);return t=e1(e1({},t),e),r=Ho.stringify(t),r}function Pv(){return iv()||{name:"",description:"",url:"",icons:[""]}}function p7(){if(nc()===yi.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:t,Version:i}=global.Platform;return[t,i].join("-")}const r=G5();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 g7(){var r;const e=nc();return e===yi.browser?[e,((r=rv())==null?void 0:r.host)||"unknown"].join(":"):e}function Ov(r,e,t){const i=p7(),s=g7();return[[r,e].join("-"),[h7,t].join("-"),i,s].join("/")}function v7({protocol:r,version:e,relayUrl:t,sdkVersion:i,auth:s,projectId:a,useOnCloseEvent:f,bundleId:u}){const b=t.split("?"),v=Ov(r,e,i),w={auth:s,ua:v,projectId:a,useOnCloseEvent:f||void 0,origin:u||void 0},S=d7(b[1]||"",w);return b[0]+"?"+S}function Ys(r,e){return r.filter(t=>e.includes(t)).length===r.length}function Cv(r){return Object.fromEntries(r.entries())}function Rv(r){return new Map(Object.entries(r))}function Gs(r=Se.FIVE_MINUTES,e){const t=Se.toMiliseconds(r||Se.FIVE_MINUTES);let i,s,a;return{resolve:f=>{a&&i&&(clearTimeout(a),i(f))},reject:f=>{a&&s&&(clearTimeout(a),s(f))},done:()=>new Promise((f,u)=>{a=setTimeout(()=>{u(new Error(e))},t),i=f,s=u})}}function La(r,e,t){return new Promise(async(i,s)=>{const a=setTimeout(()=>s(new Error(t)),e);try{const f=await r;i(f)}catch(f){s(f)}clearTimeout(a)})}function Nv(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 b7(r){return Nv("topic",r)}function m7(r){return Nv("id",r)}function Tv(r){const[e,t]=r.split(":"),i={id:void 0,topic:void 0};if(e==="topic"&&typeof t=="string")i.topic=t;else if(e==="id"&&Number.isInteger(Number(t)))i.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${t}`);return i}function pr(r,e){return Se.fromMiliseconds(Date.now()+Se.toMiliseconds(r))}function bs(r){return Date.now()>=Se.toMiliseconds(r)}function St(r,e){return`${r}${e?`:${e}`:""}`}function Df(r=[],e=[]){return[...new Set([...r,...e])]}async function y7({id:r,topic:e,wcDeepLink:t}){var i;try{if(!t)return;const s=typeof t=="string"?JSON.parse(t):t,a=s==null?void 0:s.href;if(typeof a!="string")return;const f=w7(a,r,e),u=nc();if(u===yi.browser){if(!((i=tu())!=null&&i.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,A7()?"_blank":"_self","noreferrer noopener")}else u===yi.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(f)}catch(s){console.error(s)}}function w7(r,e,t){const i=`requestId=${e}&sessionTopic=${t}`;r.endsWith("/")&&(r=r.slice(0,-1));let s=`${r}`;if(r.startsWith("https://t.me")){const a=r.includes("?")?"&startapp=":"?startapp=";s=`${s}${a}${E7(i,!0)}`}else s=`${s}/wc?${i}`;return s}async function _7(r,e){let t="";try{if(ic()&&(t=localStorage.getItem(e),t))return t;t=await r.getItem(e)}catch(i){console.error(i)}return t}function t1(r,e){if(!r.includes(e))return null;const t=r.split(/([&,?,=])/),i=t.indexOf(e);return t[i+2]}function r1(){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 sd(){return typeof process<"u"&&s7.IS_VITEST==="true"}function A7(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function E7(r,e=!1){const t=Buffer.from(r).toString("base64");return e?t.replace(/[=]/g,""):t}function Fv(r){return Buffer.from(r,"base64").toString("utf-8")}var Bv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function S7(r){var e=r.default;if(typeof e=="function"){var t=function(){return e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var s=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:function(){return r[i]}})}),t}var qv={exports:{}};/**
|
|
16
|
+
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
|
17
|
+
*
|
|
18
|
+
* @version 0.8.0
|
|
19
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
20
|
+
* @copyright Chen, Yi-Cyuan 2015-2018
|
|
21
|
+
* @license MIT
|
|
22
|
+
*/(function(r){(function(){var e="input is invalid type",t="finalize already called",i=typeof window=="object",s=i?window:{};s.JS_SHA3_NO_WINDOW&&(i=!1);var a=!i&&typeof self=="object",f=!s.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;f?s=Bv:a&&(s=self);var u=!s.JS_SHA3_NO_COMMON_JS&&!0&&r.exports,b=!s.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",v="0123456789abcdef".split(""),w=[31,7936,2031616,520093696],S=[4,1024,262144,67108864],O=[1,256,65536,16777216],P=[6,1536,393216,100663296],R=[0,8,16,24],z=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],W=[224,256,384,512],Q=[128,256],j=["hex","buffer","arrayBuffer","array","digest"],Y={128:168,256:136};(s.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(D){return Object.prototype.toString.call(D)==="[object Array]"}),b&&(s.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(D){return typeof D=="object"&&D.buffer&&D.buffer.constructor===ArrayBuffer});for(var U=function(D,ee,B){return function(H){return new N(D,ee,D).update(H)[B]()}},k=function(D,ee,B){return function(H,K){return new N(D,ee,K).update(H)[B]()}},V=function(D,ee,B){return function(H,K,_,$){return p["cshake"+D].update(H,K,_,$)[B]()}},A=function(D,ee,B){return function(H,K,_,$){return p["kmac"+D].update(H,K,_,$)[B]()}},F=function(D,ee,B,H){for(var K=0;K<j.length;++K){var _=j[K];D[_]=ee(B,H,_)}return D},ae=function(D,ee){var B=U(D,ee,"hex");return B.create=function(){return new N(D,ee,D)},B.update=function(H){return B.create().update(H)},F(B,U,D,ee)},de=function(D,ee){var B=k(D,ee,"hex");return B.create=function(H){return new N(D,ee,H)},B.update=function(H,K){return B.create(K).update(H)},F(B,k,D,ee)},L=function(D,ee){var B=Y[D],H=V(D,ee,"hex");return H.create=function(K,_,$){return!_&&!$?p["shake"+D].create(K):new N(D,ee,K).bytepad([_,$],B)},H.update=function(K,_,$,se){return H.create(_,$,se).update(K)},F(H,V,D,ee)},m=function(D,ee){var B=Y[D],H=A(D,ee,"hex");return H.create=function(K,_,$){return new Z(D,ee,_).bytepad(["KMAC",$],B).bytepad([K],B)},H.update=function(K,_,$,se){return H.create(K,$,se).update(_)},F(H,A,D,ee)},c=[{name:"keccak",padding:O,bits:W,createMethod:ae},{name:"sha3",padding:P,bits:W,createMethod:ae},{name:"shake",padding:w,bits:Q,createMethod:de},{name:"cshake",padding:S,bits:Q,createMethod:L},{name:"kmac",padding:S,bits:Q,createMethod:m}],p={},d=[],y=0;y<c.length;++y)for(var M=c[y],I=M.bits,x=0;x<I.length;++x){var l=M.name+"_"+I[x];if(d.push(l),p[l]=M.createMethod(I[x],M.padding),M.name!=="sha3"){var g=M.name+I[x];d.push(g),p[g]=p[l]}}function N(D,ee,B){this.blocks=[],this.s=[],this.padding=ee,this.outputBits=B,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(D<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=B>>5,this.extraBytes=(B&31)>>3;for(var H=0;H<50;++H)this.s[H]=0}N.prototype.update=function(D){if(this.finalized)throw new Error(t);var ee,B=typeof D;if(B!=="string"){if(B==="object"){if(D===null)throw new Error(e);if(b&&D.constructor===ArrayBuffer)D=new Uint8Array(D);else if(!Array.isArray(D)&&(!b||!ArrayBuffer.isView(D)))throw new Error(e)}else throw new Error(e);ee=!0}for(var H=this.blocks,K=this.byteCount,_=D.length,$=this.blockCount,se=0,ce=this.s,ue,ye;se<_;){if(this.reset)for(this.reset=!1,H[0]=this.block,ue=1;ue<$+1;++ue)H[ue]=0;if(ee)for(ue=this.start;se<_&&ue<K;++se)H[ue>>2]|=D[se]<<R[ue++&3];else for(ue=this.start;se<_&&ue<K;++se)ye=D.charCodeAt(se),ye<128?H[ue>>2]|=ye<<R[ue++&3]:ye<2048?(H[ue>>2]|=(192|ye>>6)<<R[ue++&3],H[ue>>2]|=(128|ye&63)<<R[ue++&3]):ye<55296||ye>=57344?(H[ue>>2]|=(224|ye>>12)<<R[ue++&3],H[ue>>2]|=(128|ye>>6&63)<<R[ue++&3],H[ue>>2]|=(128|ye&63)<<R[ue++&3]):(ye=65536+((ye&1023)<<10|D.charCodeAt(++se)&1023),H[ue>>2]|=(240|ye>>18)<<R[ue++&3],H[ue>>2]|=(128|ye>>12&63)<<R[ue++&3],H[ue>>2]|=(128|ye>>6&63)<<R[ue++&3],H[ue>>2]|=(128|ye&63)<<R[ue++&3]);if(this.lastByteIndex=ue,ue>=K){for(this.start=ue-K,this.block=H[$],ue=0;ue<$;++ue)ce[ue]^=H[ue];te(ce),this.reset=!0}else this.start=ue}return this},N.prototype.encode=function(D,ee){var B=D&255,H=1,K=[B];for(D=D>>8,B=D&255;B>0;)K.unshift(B),D=D>>8,B=D&255,++H;return ee?K.push(H):K.unshift(H),this.update(K),K.length},N.prototype.encodeString=function(D){var ee,B=typeof D;if(B!=="string"){if(B==="object"){if(D===null)throw new Error(e);if(b&&D.constructor===ArrayBuffer)D=new Uint8Array(D);else if(!Array.isArray(D)&&(!b||!ArrayBuffer.isView(D)))throw new Error(e)}else throw new Error(e);ee=!0}var H=0,K=D.length;if(ee)H=K;else for(var _=0;_<D.length;++_){var $=D.charCodeAt(_);$<128?H+=1:$<2048?H+=2:$<55296||$>=57344?H+=3:($=65536+(($&1023)<<10|D.charCodeAt(++_)&1023),H+=4)}return H+=this.encode(H*8),this.update(D),H},N.prototype.bytepad=function(D,ee){for(var B=this.encode(ee),H=0;H<D.length;++H)B+=this.encodeString(D[H]);var K=ee-B%ee,_=[];return _.length=K,this.update(_),this},N.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var D=this.blocks,ee=this.lastByteIndex,B=this.blockCount,H=this.s;if(D[ee>>2]|=this.padding[ee&3],this.lastByteIndex===this.byteCount)for(D[0]=D[B],ee=1;ee<B+1;++ee)D[ee]=0;for(D[B-1]|=2147483648,ee=0;ee<B;++ee)H[ee]^=D[ee];te(H)}},N.prototype.toString=N.prototype.hex=function(){this.finalize();for(var D=this.blockCount,ee=this.s,B=this.outputBlocks,H=this.extraBytes,K=0,_=0,$="",se;_<B;){for(K=0;K<D&&_<B;++K,++_)se=ee[K],$+=v[se>>4&15]+v[se&15]+v[se>>12&15]+v[se>>8&15]+v[se>>20&15]+v[se>>16&15]+v[se>>28&15]+v[se>>24&15];_%D===0&&(te(ee),K=0)}return H&&(se=ee[K],$+=v[se>>4&15]+v[se&15],H>1&&($+=v[se>>12&15]+v[se>>8&15]),H>2&&($+=v[se>>20&15]+v[se>>16&15])),$},N.prototype.arrayBuffer=function(){this.finalize();var D=this.blockCount,ee=this.s,B=this.outputBlocks,H=this.extraBytes,K=0,_=0,$=this.outputBits>>3,se;H?se=new ArrayBuffer(B+1<<2):se=new ArrayBuffer($);for(var ce=new Uint32Array(se);_<B;){for(K=0;K<D&&_<B;++K,++_)ce[_]=ee[K];_%D===0&&te(ee)}return H&&(ce[K]=ee[K],se=se.slice(0,$)),se},N.prototype.buffer=N.prototype.arrayBuffer,N.prototype.digest=N.prototype.array=function(){this.finalize();for(var D=this.blockCount,ee=this.s,B=this.outputBlocks,H=this.extraBytes,K=0,_=0,$=[],se,ce;_<B;){for(K=0;K<D&&_<B;++K,++_)se=_<<2,ce=ee[K],$[se]=ce&255,$[se+1]=ce>>8&255,$[se+2]=ce>>16&255,$[se+3]=ce>>24&255;_%D===0&&te(ee)}return H&&(se=_<<2,ce=ee[K],$[se]=ce&255,H>1&&($[se+1]=ce>>8&255),H>2&&($[se+2]=ce>>16&255)),$};function Z(D,ee,B){N.call(this,D,ee,B)}Z.prototype=new N,Z.prototype.finalize=function(){return this.encode(this.outputBits,!0),N.prototype.finalize.call(this)};var te=function(D){var ee,B,H,K,_,$,se,ce,ue,ye,we,Re,Qe,Pe,Ne,Me,me,Oe,Te,ve,Ce,xe,be,Le,Ie,_e,He,Ve,Ee,Ke,ht,Ge,wt,lt,Je,At,xt,Fe,Xe,tt,Be,et,Ze,$e,ft,rt,ze,it,st,qe,Ye,ut,je,Ct,Rt,at,bt,Cr,Rr,Nr,Tr,Fr,Xt;for(H=0;H<48;H+=2)K=D[0]^D[10]^D[20]^D[30]^D[40],_=D[1]^D[11]^D[21]^D[31]^D[41],$=D[2]^D[12]^D[22]^D[32]^D[42],se=D[3]^D[13]^D[23]^D[33]^D[43],ce=D[4]^D[14]^D[24]^D[34]^D[44],ue=D[5]^D[15]^D[25]^D[35]^D[45],ye=D[6]^D[16]^D[26]^D[36]^D[46],we=D[7]^D[17]^D[27]^D[37]^D[47],Re=D[8]^D[18]^D[28]^D[38]^D[48],Qe=D[9]^D[19]^D[29]^D[39]^D[49],ee=Re^($<<1|se>>>31),B=Qe^(se<<1|$>>>31),D[0]^=ee,D[1]^=B,D[10]^=ee,D[11]^=B,D[20]^=ee,D[21]^=B,D[30]^=ee,D[31]^=B,D[40]^=ee,D[41]^=B,ee=K^(ce<<1|ue>>>31),B=_^(ue<<1|ce>>>31),D[2]^=ee,D[3]^=B,D[12]^=ee,D[13]^=B,D[22]^=ee,D[23]^=B,D[32]^=ee,D[33]^=B,D[42]^=ee,D[43]^=B,ee=$^(ye<<1|we>>>31),B=se^(we<<1|ye>>>31),D[4]^=ee,D[5]^=B,D[14]^=ee,D[15]^=B,D[24]^=ee,D[25]^=B,D[34]^=ee,D[35]^=B,D[44]^=ee,D[45]^=B,ee=ce^(Re<<1|Qe>>>31),B=ue^(Qe<<1|Re>>>31),D[6]^=ee,D[7]^=B,D[16]^=ee,D[17]^=B,D[26]^=ee,D[27]^=B,D[36]^=ee,D[37]^=B,D[46]^=ee,D[47]^=B,ee=ye^(K<<1|_>>>31),B=we^(_<<1|K>>>31),D[8]^=ee,D[9]^=B,D[18]^=ee,D[19]^=B,D[28]^=ee,D[29]^=B,D[38]^=ee,D[39]^=B,D[48]^=ee,D[49]^=B,Pe=D[0],Ne=D[1],rt=D[11]<<4|D[10]>>>28,ze=D[10]<<4|D[11]>>>28,Ve=D[20]<<3|D[21]>>>29,Ee=D[21]<<3|D[20]>>>29,Nr=D[31]<<9|D[30]>>>23,Tr=D[30]<<9|D[31]>>>23,et=D[40]<<18|D[41]>>>14,Ze=D[41]<<18|D[40]>>>14,lt=D[2]<<1|D[3]>>>31,Je=D[3]<<1|D[2]>>>31,Me=D[13]<<12|D[12]>>>20,me=D[12]<<12|D[13]>>>20,it=D[22]<<10|D[23]>>>22,st=D[23]<<10|D[22]>>>22,Ke=D[33]<<13|D[32]>>>19,ht=D[32]<<13|D[33]>>>19,Fr=D[42]<<2|D[43]>>>30,Xt=D[43]<<2|D[42]>>>30,Ct=D[5]<<30|D[4]>>>2,Rt=D[4]<<30|D[5]>>>2,At=D[14]<<6|D[15]>>>26,xt=D[15]<<6|D[14]>>>26,Oe=D[25]<<11|D[24]>>>21,Te=D[24]<<11|D[25]>>>21,qe=D[34]<<15|D[35]>>>17,Ye=D[35]<<15|D[34]>>>17,Ge=D[45]<<29|D[44]>>>3,wt=D[44]<<29|D[45]>>>3,Le=D[6]<<28|D[7]>>>4,Ie=D[7]<<28|D[6]>>>4,at=D[17]<<23|D[16]>>>9,bt=D[16]<<23|D[17]>>>9,Fe=D[26]<<25|D[27]>>>7,Xe=D[27]<<25|D[26]>>>7,ve=D[36]<<21|D[37]>>>11,Ce=D[37]<<21|D[36]>>>11,ut=D[47]<<24|D[46]>>>8,je=D[46]<<24|D[47]>>>8,$e=D[8]<<27|D[9]>>>5,ft=D[9]<<27|D[8]>>>5,_e=D[18]<<20|D[19]>>>12,He=D[19]<<20|D[18]>>>12,Cr=D[29]<<7|D[28]>>>25,Rr=D[28]<<7|D[29]>>>25,tt=D[38]<<8|D[39]>>>24,Be=D[39]<<8|D[38]>>>24,xe=D[48]<<14|D[49]>>>18,be=D[49]<<14|D[48]>>>18,D[0]=Pe^~Me&Oe,D[1]=Ne^~me&Te,D[10]=Le^~_e&Ve,D[11]=Ie^~He&Ee,D[20]=lt^~At&Fe,D[21]=Je^~xt&Xe,D[30]=$e^~rt&it,D[31]=ft^~ze&st,D[40]=Ct^~at&Cr,D[41]=Rt^~bt&Rr,D[2]=Me^~Oe&ve,D[3]=me^~Te&Ce,D[12]=_e^~Ve&Ke,D[13]=He^~Ee&ht,D[22]=At^~Fe&tt,D[23]=xt^~Xe&Be,D[32]=rt^~it&qe,D[33]=ze^~st&Ye,D[42]=at^~Cr&Nr,D[43]=bt^~Rr&Tr,D[4]=Oe^~ve&xe,D[5]=Te^~Ce&be,D[14]=Ve^~Ke&Ge,D[15]=Ee^~ht&wt,D[24]=Fe^~tt&et,D[25]=Xe^~Be&Ze,D[34]=it^~qe&ut,D[35]=st^~Ye&je,D[44]=Cr^~Nr&Fr,D[45]=Rr^~Tr&Xt,D[6]=ve^~xe&Pe,D[7]=Ce^~be&Ne,D[16]=Ke^~Ge&Le,D[17]=ht^~wt&Ie,D[26]=tt^~et<,D[27]=Be^~Ze&Je,D[36]=qe^~ut&$e,D[37]=Ye^~je&ft,D[46]=Nr^~Fr&Ct,D[47]=Tr^~Xt&Rt,D[8]=xe^~Pe&Me,D[9]=be^~Ne&me,D[18]=Ge^~Le&_e,D[19]=wt^~Ie&He,D[28]=et^~lt&At,D[29]=Ze^~Je&xt,D[38]=ut^~$e&rt,D[39]=je^~ft&ze,D[48]=Fr^~Ct&at,D[49]=Xt^~Rt&bt,D[0]^=z[H],D[1]^=z[H+1]};if(u)r.exports=p;else for(y=0;y<d.length;++y)s[d[y]]=p[d[y]]})()})(qv);var x7=qv.exports;const M7="logger/5.7.0";let i1=!1,n1=!1;const Pf={debug:1,default:2,info:2,warning:3,error:4,off:5};let s1=Pf.default,$h=null;function I7(){try{const r=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{r.push(e)}}),r.length)throw new Error("missing "+r.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(r){return r.message}return null}const a1=I7();var Al;(function(r){r.DEBUG="DEBUG",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r.OFF="OFF"})(Al||(Al={}));var an;(function(r){r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",r.NETWORK_ERROR="NETWORK_ERROR",r.SERVER_ERROR="SERVER_ERROR",r.TIMEOUT="TIMEOUT",r.BUFFER_OVERRUN="BUFFER_OVERRUN",r.NUMERIC_FAULT="NUMERIC_FAULT",r.MISSING_NEW="MISSING_NEW",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",r.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",r.TRANSACTION_REPLACED="TRANSACTION_REPLACED",r.ACTION_REJECTED="ACTION_REJECTED"})(an||(an={}));const o1="0123456789abcdef";let Ir=class dr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const i=e.toLowerCase();Pf[i]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(s1>Pf[i])&&console.log.apply(console,t)}debug(...e){this._log(dr.levels.DEBUG,e)}info(...e){this._log(dr.levels.INFO,e)}warn(...e){this._log(dr.levels.WARNING,e)}makeError(e,t,i){if(n1)return this.makeError("censored error",t,{});t||(t=dr.errors.UNKNOWN_ERROR),i||(i={});const s=[];Object.keys(i).forEach(b=>{const v=i[b];try{if(v instanceof Uint8Array){let w="";for(let S=0;S<v.length;S++)w+=o1[v[S]>>4],w+=o1[v[S]&15];s.push(b+"=Uint8Array(0x"+w+")")}else s.push(b+"="+JSON.stringify(v))}catch{s.push(b+"="+JSON.stringify(i[b].toString()))}}),s.push(`code=${t}`),s.push(`version=${this.version}`);const a=e;let f="";switch(t){case an.NUMERIC_FAULT:{f="NUMERIC_FAULT";const b=e;switch(b){case"overflow":case"underflow":case"division-by-zero":f+="-"+b;break;case"negative-power":case"negative-width":f+="-unsupported";break;case"unbound-bitwise-result":f+="-unbound-result";break}break}case an.CALL_EXCEPTION:case an.INSUFFICIENT_FUNDS:case an.MISSING_NEW:case an.NONCE_EXPIRED:case an.REPLACEMENT_UNDERPRICED:case an.TRANSACTION_REPLACED:case an.UNPREDICTABLE_GAS_LIMIT:f=t;break}f&&(e+=" [ See: https://links.ethers.org/v5-errors-"+f+" ]"),s.length&&(e+=" ("+s.join(", ")+")");const u=new Error(e);return u.reason=a,u.code=t,Object.keys(i).forEach(function(b){u[b]=i[b]}),u}throwError(e,t,i){throw this.makeError(e,t,i)}throwArgumentError(e,t,i){return this.throwError(e,dr.errors.INVALID_ARGUMENT,{argument:t,value:i})}assert(e,t,i,s){e||this.throwError(t,i,s)}assertArgument(e,t,i,s){e||this.throwArgumentError(t,i,s)}checkNormalize(e){a1&&this.throwError("platform missing String.prototype.normalize",dr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:a1})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,dr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,dr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,i){i?i=": "+i:i="",e<t&&this.throwError("missing argument"+i,dr.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+i,dr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",dr.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",dr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",dr.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return $h||($h=new dr(M7)),$h}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",dr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),i1){if(!e)return;this.globalLogger().throwError("error censorship permanent",dr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}n1=!!e,i1=!!t}static setLogLevel(e){const t=Pf[e.toLowerCase()];if(t==null){dr.globalLogger().warn("invalid log level - "+e);return}s1=t}static from(e){return new dr(e)}};Ir.errors=an,Ir.levels=Al;const D7="bytes/5.7.0",ar=new Ir(D7);function Lv(r){return!!r.toHexString}function Ua(r){return r.slice||(r.slice=function(){const e=Array.prototype.slice.call(arguments);return Ua(new Uint8Array(Array.prototype.slice.apply(r,e)))}),r}function P7(r){return wi(r)&&!(r.length%2)||Ja(r)}function c1(r){return typeof r=="number"&&r==r&&r%1===0}function Ja(r){if(r==null)return!1;if(r.constructor===Uint8Array)return!0;if(typeof r=="string"||!c1(r.length)||r.length<0)return!1;for(let e=0;e<r.length;e++){const t=r[e];if(!c1(t)||t<0||t>=256)return!1}return!0}function tr(r,e){if(e||(e={}),typeof r=="number"){ar.checkSafeUint53(r,"invalid arrayify value");const t=[];for(;r;)t.unshift(r&255),r=parseInt(String(r/256));return t.length===0&&t.push(0),Ua(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),Lv(r)&&(r=r.toHexString()),wi(r)){let t=r.substring(2);t.length%2&&(e.hexPad==="left"?t="0"+t:e.hexPad==="right"?t+="0":ar.throwArgumentError("hex data is odd-length","value",r));const i=[];for(let s=0;s<t.length;s+=2)i.push(parseInt(t.substring(s,s+2),16));return Ua(new Uint8Array(i))}return Ja(r)?Ua(new Uint8Array(r)):ar.throwArgumentError("invalid arrayify value","value",r)}function O7(r){const e=r.map(s=>tr(s)),t=e.reduce((s,a)=>s+a.length,0),i=new Uint8Array(t);return e.reduce((s,a)=>(i.set(a,s),s+a.length),0),Ua(i)}function C7(r,e){r=tr(r),r.length>e&&ar.throwArgumentError("value out of range","value",arguments[0]);const t=new Uint8Array(e);return t.set(r,e-r.length),Ua(t)}function wi(r,e){return!(typeof r!="string"||!r.match(/^0x[0-9A-Fa-f]*$/)||e&&r.length!==2+2*e)}const zh="0123456789abcdef";function ci(r,e){if(e||(e={}),typeof r=="number"){ar.checkSafeUint53(r,"invalid hexlify value");let t="";for(;r;)t=zh[r&15]+t,r=Math.floor(r/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if(typeof r=="bigint")return r=r.toString(16),r.length%2?"0x0"+r:"0x"+r;if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),Lv(r))return r.toHexString();if(wi(r))return r.length%2&&(e.hexPad==="left"?r="0x0"+r.substring(2):e.hexPad==="right"?r+="0":ar.throwArgumentError("hex data is odd-length","value",r)),r.toLowerCase();if(Ja(r)){let t="0x";for(let i=0;i<r.length;i++){let s=r[i];t+=zh[(s&240)>>4]+zh[s&15]}return t}return ar.throwArgumentError("invalid hexlify value","value",r)}function R7(r){if(typeof r!="string")r=ci(r);else if(!wi(r)||r.length%2)return null;return(r.length-2)/2}function f1(r,e,t){return typeof r!="string"?r=ci(r):(!wi(r)||r.length%2)&&ar.throwArgumentError("invalid hexData","value",r),e=2+2*e,t!=null?"0x"+r.substring(e,2+2*t):"0x"+r.substring(e)}function In(r,e){for(typeof r!="string"?r=ci(r):wi(r)||ar.throwArgumentError("invalid hex string","value",r),r.length>2*e+2&&ar.throwArgumentError("value out of range","value",arguments[1]);r.length<2*e+2;)r="0x0"+r.substring(2);return r}function Uv(r){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(P7(r)){let t=tr(r);t.length===64?(e.v=27+(t[32]>>7),t[32]&=127,e.r=ci(t.slice(0,32)),e.s=ci(t.slice(32,64))):t.length===65?(e.r=ci(t.slice(0,32)),e.s=ci(t.slice(32,64)),e.v=t[64]):ar.throwArgumentError("invalid signature string","signature",r),e.v<27&&(e.v===0||e.v===1?e.v+=27:ar.throwArgumentError("signature invalid v byte","signature",r)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(t[32]|=128),e._vs=ci(t.slice(32,64))}else{if(e.r=r.r,e.s=r.s,e.v=r.v,e.recoveryParam=r.recoveryParam,e._vs=r._vs,e._vs!=null){const s=C7(tr(e._vs),32);e._vs=ci(s);const a=s[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=a:e.recoveryParam!==a&&ar.throwArgumentError("signature recoveryParam mismatch _vs","signature",r),s[0]&=127;const f=ci(s);e.s==null?e.s=f:e.s!==f&&ar.throwArgumentError("signature v mismatch _vs","signature",r)}if(e.recoveryParam==null)e.v==null?ar.throwArgumentError("signature missing v and recoveryParam","signature",r):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const s=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==s&&ar.throwArgumentError("signature recoveryParam mismatch v","signature",r)}e.r==null||!wi(e.r)?ar.throwArgumentError("signature missing or invalid r","signature",r):e.r=In(e.r,32),e.s==null||!wi(e.s)?ar.throwArgumentError("signature missing or invalid s","signature",r):e.s=In(e.s,32);const t=tr(e.s);t[0]>=128&&ar.throwArgumentError("signature s out of range","signature",r),e.recoveryParam&&(t[0]|=128);const i=ci(t);e._vs&&(wi(e._vs)||ar.throwArgumentError("signature invalid _vs","signature",r),e._vs=In(e._vs,32)),e._vs==null?e._vs=i:e._vs!==i&&ar.throwArgumentError("signature _vs mismatch v and s","signature",r)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function ad(r){return"0x"+x7.keccak_256(tr(r))}var $v={exports:{}},N7={},T7=Object.freeze({__proto__:null,default:N7}),F7=S7(T7);(function(r){(function(e,t){function i(c,p){if(!c)throw new Error(p||"Assertion failed")}function s(c,p){c.super_=p;var d=function(){};d.prototype=p.prototype,c.prototype=new d,c.prototype.constructor=c}function a(c,p,d){if(a.isBN(c))return c;this.negative=0,this.words=null,this.length=0,this.red=null,c!==null&&((p==="le"||p==="be")&&(d=p,p=10),this._init(c||0,p||10,d||"be"))}typeof e=="object"?e.exports=a:t.BN=a,a.BN=a,a.wordSize=26;var f;try{typeof window<"u"&&typeof window.Buffer<"u"?f=window.Buffer:f=F7.Buffer}catch{}a.isBN=function(c){return c instanceof a?!0:c!==null&&typeof c=="object"&&c.constructor.wordSize===a.wordSize&&Array.isArray(c.words)},a.max=function(c,p){return c.cmp(p)>0?c:p},a.min=function(c,p){return c.cmp(p)<0?c:p},a.prototype._init=function(c,p,d){if(typeof c=="number")return this._initNumber(c,p,d);if(typeof c=="object")return this._initArray(c,p,d);p==="hex"&&(p=16),i(p===(p|0)&&p>=2&&p<=36),c=c.toString().replace(/\s+/g,"");var y=0;c[0]==="-"&&(y++,this.negative=1),y<c.length&&(p===16?this._parseHex(c,y,d):(this._parseBase(c,p,y),d==="le"&&this._initArray(this.toArray(),p,d)))},a.prototype._initNumber=function(c,p,d){c<0&&(this.negative=1,c=-c),c<67108864?(this.words=[c&67108863],this.length=1):c<4503599627370496?(this.words=[c&67108863,c/67108864&67108863],this.length=2):(i(c<9007199254740992),this.words=[c&67108863,c/67108864&67108863,1],this.length=3),d==="le"&&this._initArray(this.toArray(),p,d)},a.prototype._initArray=function(c,p,d){if(i(typeof c.length=="number"),c.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(c.length/3),this.words=new Array(this.length);for(var y=0;y<this.length;y++)this.words[y]=0;var M,I,x=0;if(d==="be")for(y=c.length-1,M=0;y>=0;y-=3)I=c[y]|c[y-1]<<8|c[y-2]<<16,this.words[M]|=I<<x&67108863,this.words[M+1]=I>>>26-x&67108863,x+=24,x>=26&&(x-=26,M++);else if(d==="le")for(y=0,M=0;y<c.length;y+=3)I=c[y]|c[y+1]<<8|c[y+2]<<16,this.words[M]|=I<<x&67108863,this.words[M+1]=I>>>26-x&67108863,x+=24,x>=26&&(x-=26,M++);return this._strip()};function u(c,p){var d=c.charCodeAt(p);if(d>=48&&d<=57)return d-48;if(d>=65&&d<=70)return d-55;if(d>=97&&d<=102)return d-87;i(!1,"Invalid character in "+c)}function b(c,p,d){var y=u(c,d);return d-1>=p&&(y|=u(c,d-1)<<4),y}a.prototype._parseHex=function(c,p,d){this.length=Math.ceil((c.length-p)/6),this.words=new Array(this.length);for(var y=0;y<this.length;y++)this.words[y]=0;var M=0,I=0,x;if(d==="be")for(y=c.length-1;y>=p;y-=2)x=b(c,p,y)<<M,this.words[I]|=x&67108863,M>=18?(M-=18,I+=1,this.words[I]|=x>>>26):M+=8;else{var l=c.length-p;for(y=l%2===0?p+1:p;y<c.length;y+=2)x=b(c,p,y)<<M,this.words[I]|=x&67108863,M>=18?(M-=18,I+=1,this.words[I]|=x>>>26):M+=8}this._strip()};function v(c,p,d,y){for(var M=0,I=0,x=Math.min(c.length,d),l=p;l<x;l++){var g=c.charCodeAt(l)-48;M*=y,g>=49?I=g-49+10:g>=17?I=g-17+10:I=g,i(g>=0&&I<y,"Invalid character"),M+=I}return M}a.prototype._parseBase=function(c,p,d){this.words=[0],this.length=1;for(var y=0,M=1;M<=67108863;M*=p)y++;y--,M=M/p|0;for(var I=c.length-d,x=I%y,l=Math.min(I,I-x)+d,g=0,N=d;N<l;N+=y)g=v(c,N,N+y,p),this.imuln(M),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g);if(x!==0){var Z=1;for(g=v(c,N,c.length,p),N=0;N<x;N++)Z*=p;this.imuln(Z),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g)}this._strip()},a.prototype.copy=function(c){c.words=new Array(this.length);for(var p=0;p<this.length;p++)c.words[p]=this.words[p];c.length=this.length,c.negative=this.negative,c.red=this.red};function w(c,p){c.words=p.words,c.length=p.length,c.negative=p.negative,c.red=p.red}if(a.prototype._move=function(c){w(c,this)},a.prototype.clone=function(){var c=new a(null);return this.copy(c),c},a.prototype._expand=function(c){for(;this.length<c;)this.words[this.length++]=0;return this},a.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},a.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{a.prototype[Symbol.for("nodejs.util.inspect.custom")]=S}catch{a.prototype.inspect=S}else a.prototype.inspect=S;function S(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var O=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],P=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],R=[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];a.prototype.toString=function(c,p){c=c||10,p=p|0||1;var d;if(c===16||c==="hex"){d="";for(var y=0,M=0,I=0;I<this.length;I++){var x=this.words[I],l=((x<<y|M)&16777215).toString(16);M=x>>>24-y&16777215,y+=2,y>=26&&(y-=26,I--),M!==0||I!==this.length-1?d=O[6-l.length]+l+d:d=l+d}for(M!==0&&(d=M.toString(16)+d);d.length%p!==0;)d="0"+d;return this.negative!==0&&(d="-"+d),d}if(c===(c|0)&&c>=2&&c<=36){var g=P[c],N=R[c];d="";var Z=this.clone();for(Z.negative=0;!Z.isZero();){var te=Z.modrn(N).toString(c);Z=Z.idivn(N),Z.isZero()?d=te+d:d=O[g-te.length]+te+d}for(this.isZero()&&(d="0"+d);d.length%p!==0;)d="0"+d;return this.negative!==0&&(d="-"+d),d}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var c=this.words[0];return this.length===2?c+=this.words[1]*67108864:this.length===3&&this.words[2]===1?c+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-c:c},a.prototype.toJSON=function(){return this.toString(16,2)},f&&(a.prototype.toBuffer=function(c,p){return this.toArrayLike(f,c,p)}),a.prototype.toArray=function(c,p){return this.toArrayLike(Array,c,p)};var z=function(c,p){return c.allocUnsafe?c.allocUnsafe(p):new c(p)};a.prototype.toArrayLike=function(c,p,d){this._strip();var y=this.byteLength(),M=d||Math.max(1,y);i(y<=M,"byte array longer than desired length"),i(M>0,"Requested array length <= 0");var I=z(c,M),x=p==="le"?"LE":"BE";return this["_toArrayLike"+x](I,y),I},a.prototype._toArrayLikeLE=function(c,p){for(var d=0,y=0,M=0,I=0;M<this.length;M++){var x=this.words[M]<<I|y;c[d++]=x&255,d<c.length&&(c[d++]=x>>8&255),d<c.length&&(c[d++]=x>>16&255),I===6?(d<c.length&&(c[d++]=x>>24&255),y=0,I=0):(y=x>>>24,I+=2)}if(d<c.length)for(c[d++]=y;d<c.length;)c[d++]=0},a.prototype._toArrayLikeBE=function(c,p){for(var d=c.length-1,y=0,M=0,I=0;M<this.length;M++){var x=this.words[M]<<I|y;c[d--]=x&255,d>=0&&(c[d--]=x>>8&255),d>=0&&(c[d--]=x>>16&255),I===6?(d>=0&&(c[d--]=x>>24&255),y=0,I=0):(y=x>>>24,I+=2)}if(d>=0)for(c[d--]=y;d>=0;)c[d--]=0},Math.clz32?a.prototype._countBits=function(c){return 32-Math.clz32(c)}:a.prototype._countBits=function(c){var p=c,d=0;return p>=4096&&(d+=13,p>>>=13),p>=64&&(d+=7,p>>>=7),p>=8&&(d+=4,p>>>=4),p>=2&&(d+=2,p>>>=2),d+p},a.prototype._zeroBits=function(c){if(c===0)return 26;var p=c,d=0;return p&8191||(d+=13,p>>>=13),p&127||(d+=7,p>>>=7),p&15||(d+=4,p>>>=4),p&3||(d+=2,p>>>=2),p&1||d++,d},a.prototype.bitLength=function(){var c=this.words[this.length-1],p=this._countBits(c);return(this.length-1)*26+p};function W(c){for(var p=new Array(c.bitLength()),d=0;d<p.length;d++){var y=d/26|0,M=d%26;p[d]=c.words[y]>>>M&1}return p}a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var c=0,p=0;p<this.length;p++){var d=this._zeroBits(this.words[p]);if(c+=d,d!==26)break}return c},a.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},a.prototype.toTwos=function(c){return this.negative!==0?this.abs().inotn(c).iaddn(1):this.clone()},a.prototype.fromTwos=function(c){return this.testn(c-1)?this.notn(c).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return this.negative!==0},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(c){for(;this.length<c.length;)this.words[this.length++]=0;for(var p=0;p<c.length;p++)this.words[p]=this.words[p]|c.words[p];return this._strip()},a.prototype.ior=function(c){return i((this.negative|c.negative)===0),this.iuor(c)},a.prototype.or=function(c){return this.length>c.length?this.clone().ior(c):c.clone().ior(this)},a.prototype.uor=function(c){return this.length>c.length?this.clone().iuor(c):c.clone().iuor(this)},a.prototype.iuand=function(c){var p;this.length>c.length?p=c:p=this;for(var d=0;d<p.length;d++)this.words[d]=this.words[d]&c.words[d];return this.length=p.length,this._strip()},a.prototype.iand=function(c){return i((this.negative|c.negative)===0),this.iuand(c)},a.prototype.and=function(c){return this.length>c.length?this.clone().iand(c):c.clone().iand(this)},a.prototype.uand=function(c){return this.length>c.length?this.clone().iuand(c):c.clone().iuand(this)},a.prototype.iuxor=function(c){var p,d;this.length>c.length?(p=this,d=c):(p=c,d=this);for(var y=0;y<d.length;y++)this.words[y]=p.words[y]^d.words[y];if(this!==p)for(;y<p.length;y++)this.words[y]=p.words[y];return this.length=p.length,this._strip()},a.prototype.ixor=function(c){return i((this.negative|c.negative)===0),this.iuxor(c)},a.prototype.xor=function(c){return this.length>c.length?this.clone().ixor(c):c.clone().ixor(this)},a.prototype.uxor=function(c){return this.length>c.length?this.clone().iuxor(c):c.clone().iuxor(this)},a.prototype.inotn=function(c){i(typeof c=="number"&&c>=0);var p=Math.ceil(c/26)|0,d=c%26;this._expand(p),d>0&&p--;for(var y=0;y<p;y++)this.words[y]=~this.words[y]&67108863;return d>0&&(this.words[y]=~this.words[y]&67108863>>26-d),this._strip()},a.prototype.notn=function(c){return this.clone().inotn(c)},a.prototype.setn=function(c,p){i(typeof c=="number"&&c>=0);var d=c/26|0,y=c%26;return this._expand(d+1),p?this.words[d]=this.words[d]|1<<y:this.words[d]=this.words[d]&~(1<<y),this._strip()},a.prototype.iadd=function(c){var p;if(this.negative!==0&&c.negative===0)return this.negative=0,p=this.isub(c),this.negative^=1,this._normSign();if(this.negative===0&&c.negative!==0)return c.negative=0,p=this.isub(c),c.negative=1,p._normSign();var d,y;this.length>c.length?(d=this,y=c):(d=c,y=this);for(var M=0,I=0;I<y.length;I++)p=(d.words[I]|0)+(y.words[I]|0)+M,this.words[I]=p&67108863,M=p>>>26;for(;M!==0&&I<d.length;I++)p=(d.words[I]|0)+M,this.words[I]=p&67108863,M=p>>>26;if(this.length=d.length,M!==0)this.words[this.length]=M,this.length++;else if(d!==this)for(;I<d.length;I++)this.words[I]=d.words[I];return this},a.prototype.add=function(c){var p;return c.negative!==0&&this.negative===0?(c.negative=0,p=this.sub(c),c.negative^=1,p):c.negative===0&&this.negative!==0?(this.negative=0,p=c.sub(this),this.negative=1,p):this.length>c.length?this.clone().iadd(c):c.clone().iadd(this)},a.prototype.isub=function(c){if(c.negative!==0){c.negative=0;var p=this.iadd(c);return c.negative=1,p._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(c),this.negative=1,this._normSign();var d=this.cmp(c);if(d===0)return this.negative=0,this.length=1,this.words[0]=0,this;var y,M;d>0?(y=this,M=c):(y=c,M=this);for(var I=0,x=0;x<M.length;x++)p=(y.words[x]|0)-(M.words[x]|0)+I,I=p>>26,this.words[x]=p&67108863;for(;I!==0&&x<y.length;x++)p=(y.words[x]|0)+I,I=p>>26,this.words[x]=p&67108863;if(I===0&&x<y.length&&y!==this)for(;x<y.length;x++)this.words[x]=y.words[x];return this.length=Math.max(this.length,x),y!==this&&(this.negative=1),this._strip()},a.prototype.sub=function(c){return this.clone().isub(c)};function Q(c,p,d){d.negative=p.negative^c.negative;var y=c.length+p.length|0;d.length=y,y=y-1|0;var M=c.words[0]|0,I=p.words[0]|0,x=M*I,l=x&67108863,g=x/67108864|0;d.words[0]=l;for(var N=1;N<y;N++){for(var Z=g>>>26,te=g&67108863,D=Math.min(N,p.length-1),ee=Math.max(0,N-c.length+1);ee<=D;ee++){var B=N-ee|0;M=c.words[B]|0,I=p.words[ee]|0,x=M*I+te,Z+=x/67108864|0,te=x&67108863}d.words[N]=te|0,g=Z|0}return g!==0?d.words[N]=g|0:d.length--,d._strip()}var j=function(c,p,d){var y=c.words,M=p.words,I=d.words,x=0,l,g,N,Z=y[0]|0,te=Z&8191,D=Z>>>13,ee=y[1]|0,B=ee&8191,H=ee>>>13,K=y[2]|0,_=K&8191,$=K>>>13,se=y[3]|0,ce=se&8191,ue=se>>>13,ye=y[4]|0,we=ye&8191,Re=ye>>>13,Qe=y[5]|0,Pe=Qe&8191,Ne=Qe>>>13,Me=y[6]|0,me=Me&8191,Oe=Me>>>13,Te=y[7]|0,ve=Te&8191,Ce=Te>>>13,xe=y[8]|0,be=xe&8191,Le=xe>>>13,Ie=y[9]|0,_e=Ie&8191,He=Ie>>>13,Ve=M[0]|0,Ee=Ve&8191,Ke=Ve>>>13,ht=M[1]|0,Ge=ht&8191,wt=ht>>>13,lt=M[2]|0,Je=lt&8191,At=lt>>>13,xt=M[3]|0,Fe=xt&8191,Xe=xt>>>13,tt=M[4]|0,Be=tt&8191,et=tt>>>13,Ze=M[5]|0,$e=Ze&8191,ft=Ze>>>13,rt=M[6]|0,ze=rt&8191,it=rt>>>13,st=M[7]|0,qe=st&8191,Ye=st>>>13,ut=M[8]|0,je=ut&8191,Ct=ut>>>13,Rt=M[9]|0,at=Rt&8191,bt=Rt>>>13;d.negative=c.negative^p.negative,d.length=19,l=Math.imul(te,Ee),g=Math.imul(te,Ke),g=g+Math.imul(D,Ee)|0,N=Math.imul(D,Ke);var Cr=(x+l|0)+((g&8191)<<13)|0;x=(N+(g>>>13)|0)+(Cr>>>26)|0,Cr&=67108863,l=Math.imul(B,Ee),g=Math.imul(B,Ke),g=g+Math.imul(H,Ee)|0,N=Math.imul(H,Ke),l=l+Math.imul(te,Ge)|0,g=g+Math.imul(te,wt)|0,g=g+Math.imul(D,Ge)|0,N=N+Math.imul(D,wt)|0;var Rr=(x+l|0)+((g&8191)<<13)|0;x=(N+(g>>>13)|0)+(Rr>>>26)|0,Rr&=67108863,l=Math.imul(_,Ee),g=Math.imul(_,Ke),g=g+Math.imul($,Ee)|0,N=Math.imul($,Ke),l=l+Math.imul(B,Ge)|0,g=g+Math.imul(B,wt)|0,g=g+Math.imul(H,Ge)|0,N=N+Math.imul(H,wt)|0,l=l+Math.imul(te,Je)|0,g=g+Math.imul(te,At)|0,g=g+Math.imul(D,Je)|0,N=N+Math.imul(D,At)|0;var Nr=(x+l|0)+((g&8191)<<13)|0;x=(N+(g>>>13)|0)+(Nr>>>26)|0,Nr&=67108863,l=Math.imul(ce,Ee),g=Math.imul(ce,Ke),g=g+Math.imul(ue,Ee)|0,N=Math.imul(ue,Ke),l=l+Math.imul(_,Ge)|0,g=g+Math.imul(_,wt)|0,g=g+Math.imul($,Ge)|0,N=N+Math.imul($,wt)|0,l=l+Math.imul(B,Je)|0,g=g+Math.imul(B,At)|0,g=g+Math.imul(H,Je)|0,N=N+Math.imul(H,At)|0,l=l+Math.imul(te,Fe)|0,g=g+Math.imul(te,Xe)|0,g=g+Math.imul(D,Fe)|0,N=N+Math.imul(D,Xe)|0;var Tr=(x+l|0)+((g&8191)<<13)|0;x=(N+(g>>>13)|0)+(Tr>>>26)|0,Tr&=67108863,l=Math.imul(we,Ee),g=Math.imul(we,Ke),g=g+Math.imul(Re,Ee)|0,N=Math.imul(Re,Ke),l=l+Math.imul(ce,Ge)|0,g=g+Math.imul(ce,wt)|0,g=g+Math.imul(ue,Ge)|0,N=N+Math.imul(ue,wt)|0,l=l+Math.imul(_,Je)|0,g=g+Math.imul(_,At)|0,g=g+Math.imul($,Je)|0,N=N+Math.imul($,At)|0,l=l+Math.imul(B,Fe)|0,g=g+Math.imul(B,Xe)|0,g=g+Math.imul(H,Fe)|0,N=N+Math.imul(H,Xe)|0,l=l+Math.imul(te,Be)|0,g=g+Math.imul(te,et)|0,g=g+Math.imul(D,Be)|0,N=N+Math.imul(D,et)|0;var Fr=(x+l|0)+((g&8191)<<13)|0;x=(N+(g>>>13)|0)+(Fr>>>26)|0,Fr&=67108863,l=Math.imul(Pe,Ee),g=Math.imul(Pe,Ke),g=g+Math.imul(Ne,Ee)|0,N=Math.imul(Ne,Ke),l=l+Math.imul(we,Ge)|0,g=g+Math.imul(we,wt)|0,g=g+Math.imul(Re,Ge)|0,N=N+Math.imul(Re,wt)|0,l=l+Math.imul(ce,Je)|0,g=g+Math.imul(ce,At)|0,g=g+Math.imul(ue,Je)|0,N=N+Math.imul(ue,At)|0,l=l+Math.imul(_,Fe)|0,g=g+Math.imul(_,Xe)|0,g=g+Math.imul($,Fe)|0,N=N+Math.imul($,Xe)|0,l=l+Math.imul(B,Be)|0,g=g+Math.imul(B,et)|0,g=g+Math.imul(H,Be)|0,N=N+Math.imul(H,et)|0,l=l+Math.imul(te,$e)|0,g=g+Math.imul(te,ft)|0,g=g+Math.imul(D,$e)|0,N=N+Math.imul(D,ft)|0;var Xt=(x+l|0)+((g&8191)<<13)|0;x=(N+(g>>>13)|0)+(Xt>>>26)|0,Xt&=67108863,l=Math.imul(me,Ee),g=Math.imul(me,Ke),g=g+Math.imul(Oe,Ee)|0,N=Math.imul(Oe,Ke),l=l+Math.imul(Pe,Ge)|0,g=g+Math.imul(Pe,wt)|0,g=g+Math.imul(Ne,Ge)|0,N=N+Math.imul(Ne,wt)|0,l=l+Math.imul(we,Je)|0,g=g+Math.imul(we,At)|0,g=g+Math.imul(Re,Je)|0,N=N+Math.imul(Re,At)|0,l=l+Math.imul(ce,Fe)|0,g=g+Math.imul(ce,Xe)|0,g=g+Math.imul(ue,Fe)|0,N=N+Math.imul(ue,Xe)|0,l=l+Math.imul(_,Be)|0,g=g+Math.imul(_,et)|0,g=g+Math.imul($,Be)|0,N=N+Math.imul($,et)|0,l=l+Math.imul(B,$e)|0,g=g+Math.imul(B,ft)|0,g=g+Math.imul(H,$e)|0,N=N+Math.imul(H,ft)|0,l=l+Math.imul(te,ze)|0,g=g+Math.imul(te,it)|0,g=g+Math.imul(D,ze)|0,N=N+Math.imul(D,it)|0;var Qr=(x+l|0)+((g&8191)<<13)|0;x=(N+(g>>>13)|0)+(Qr>>>26)|0,Qr&=67108863,l=Math.imul(ve,Ee),g=Math.imul(ve,Ke),g=g+Math.imul(Ce,Ee)|0,N=Math.imul(Ce,Ke),l=l+Math.imul(me,Ge)|0,g=g+Math.imul(me,wt)|0,g=g+Math.imul(Oe,Ge)|0,N=N+Math.imul(Oe,wt)|0,l=l+Math.imul(Pe,Je)|0,g=g+Math.imul(Pe,At)|0,g=g+Math.imul(Ne,Je)|0,N=N+Math.imul(Ne,At)|0,l=l+Math.imul(we,Fe)|0,g=g+Math.imul(we,Xe)|0,g=g+Math.imul(Re,Fe)|0,N=N+Math.imul(Re,Xe)|0,l=l+Math.imul(ce,Be)|0,g=g+Math.imul(ce,et)|0,g=g+Math.imul(ue,Be)|0,N=N+Math.imul(ue,et)|0,l=l+Math.imul(_,$e)|0,g=g+Math.imul(_,ft)|0,g=g+Math.imul($,$e)|0,N=N+Math.imul($,ft)|0,l=l+Math.imul(B,ze)|0,g=g+Math.imul(B,it)|0,g=g+Math.imul(H,ze)|0,N=N+Math.imul(H,it)|0,l=l+Math.imul(te,qe)|0,g=g+Math.imul(te,Ye)|0,g=g+Math.imul(D,qe)|0,N=N+Math.imul(D,Ye)|0;var Hi=(x+l|0)+((g&8191)<<13)|0;x=(N+(g>>>13)|0)+(Hi>>>26)|0,Hi&=67108863,l=Math.imul(be,Ee),g=Math.imul(be,Ke),g=g+Math.imul(Le,Ee)|0,N=Math.imul(Le,Ke),l=l+Math.imul(ve,Ge)|0,g=g+Math.imul(ve,wt)|0,g=g+Math.imul(Ce,Ge)|0,N=N+Math.imul(Ce,wt)|0,l=l+Math.imul(me,Je)|0,g=g+Math.imul(me,At)|0,g=g+Math.imul(Oe,Je)|0,N=N+Math.imul(Oe,At)|0,l=l+Math.imul(Pe,Fe)|0,g=g+Math.imul(Pe,Xe)|0,g=g+Math.imul(Ne,Fe)|0,N=N+Math.imul(Ne,Xe)|0,l=l+Math.imul(we,Be)|0,g=g+Math.imul(we,et)|0,g=g+Math.imul(Re,Be)|0,N=N+Math.imul(Re,et)|0,l=l+Math.imul(ce,$e)|0,g=g+Math.imul(ce,ft)|0,g=g+Math.imul(ue,$e)|0,N=N+Math.imul(ue,ft)|0,l=l+Math.imul(_,ze)|0,g=g+Math.imul(_,it)|0,g=g+Math.imul($,ze)|0,N=N+Math.imul($,it)|0,l=l+Math.imul(B,qe)|0,g=g+Math.imul(B,Ye)|0,g=g+Math.imul(H,qe)|0,N=N+Math.imul(H,Ye)|0,l=l+Math.imul(te,je)|0,g=g+Math.imul(te,Ct)|0,g=g+Math.imul(D,je)|0,N=N+Math.imul(D,Ct)|0;var Xr=(x+l|0)+((g&8191)<<13)|0;x=(N+(g>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,l=Math.imul(_e,Ee),g=Math.imul(_e,Ke),g=g+Math.imul(He,Ee)|0,N=Math.imul(He,Ke),l=l+Math.imul(be,Ge)|0,g=g+Math.imul(be,wt)|0,g=g+Math.imul(Le,Ge)|0,N=N+Math.imul(Le,wt)|0,l=l+Math.imul(ve,Je)|0,g=g+Math.imul(ve,At)|0,g=g+Math.imul(Ce,Je)|0,N=N+Math.imul(Ce,At)|0,l=l+Math.imul(me,Fe)|0,g=g+Math.imul(me,Xe)|0,g=g+Math.imul(Oe,Fe)|0,N=N+Math.imul(Oe,Xe)|0,l=l+Math.imul(Pe,Be)|0,g=g+Math.imul(Pe,et)|0,g=g+Math.imul(Ne,Be)|0,N=N+Math.imul(Ne,et)|0,l=l+Math.imul(we,$e)|0,g=g+Math.imul(we,ft)|0,g=g+Math.imul(Re,$e)|0,N=N+Math.imul(Re,ft)|0,l=l+Math.imul(ce,ze)|0,g=g+Math.imul(ce,it)|0,g=g+Math.imul(ue,ze)|0,N=N+Math.imul(ue,it)|0,l=l+Math.imul(_,qe)|0,g=g+Math.imul(_,Ye)|0,g=g+Math.imul($,qe)|0,N=N+Math.imul($,Ye)|0,l=l+Math.imul(B,je)|0,g=g+Math.imul(B,Ct)|0,g=g+Math.imul(H,je)|0,N=N+Math.imul(H,Ct)|0,l=l+Math.imul(te,at)|0,g=g+Math.imul(te,bt)|0,g=g+Math.imul(D,at)|0,N=N+Math.imul(D,bt)|0;var Ki=(x+l|0)+((g&8191)<<13)|0;x=(N+(g>>>13)|0)+(Ki>>>26)|0,Ki&=67108863,l=Math.imul(_e,Ge),g=Math.imul(_e,wt),g=g+Math.imul(He,Ge)|0,N=Math.imul(He,wt),l=l+Math.imul(be,Je)|0,g=g+Math.imul(be,At)|0,g=g+Math.imul(Le,Je)|0,N=N+Math.imul(Le,At)|0,l=l+Math.imul(ve,Fe)|0,g=g+Math.imul(ve,Xe)|0,g=g+Math.imul(Ce,Fe)|0,N=N+Math.imul(Ce,Xe)|0,l=l+Math.imul(me,Be)|0,g=g+Math.imul(me,et)|0,g=g+Math.imul(Oe,Be)|0,N=N+Math.imul(Oe,et)|0,l=l+Math.imul(Pe,$e)|0,g=g+Math.imul(Pe,ft)|0,g=g+Math.imul(Ne,$e)|0,N=N+Math.imul(Ne,ft)|0,l=l+Math.imul(we,ze)|0,g=g+Math.imul(we,it)|0,g=g+Math.imul(Re,ze)|0,N=N+Math.imul(Re,it)|0,l=l+Math.imul(ce,qe)|0,g=g+Math.imul(ce,Ye)|0,g=g+Math.imul(ue,qe)|0,N=N+Math.imul(ue,Ye)|0,l=l+Math.imul(_,je)|0,g=g+Math.imul(_,Ct)|0,g=g+Math.imul($,je)|0,N=N+Math.imul($,Ct)|0,l=l+Math.imul(B,at)|0,g=g+Math.imul(B,bt)|0,g=g+Math.imul(H,at)|0,N=N+Math.imul(H,bt)|0;var Vi=(x+l|0)+((g&8191)<<13)|0;x=(N+(g>>>13)|0)+(Vi>>>26)|0,Vi&=67108863,l=Math.imul(_e,Je),g=Math.imul(_e,At),g=g+Math.imul(He,Je)|0,N=Math.imul(He,At),l=l+Math.imul(be,Fe)|0,g=g+Math.imul(be,Xe)|0,g=g+Math.imul(Le,Fe)|0,N=N+Math.imul(Le,Xe)|0,l=l+Math.imul(ve,Be)|0,g=g+Math.imul(ve,et)|0,g=g+Math.imul(Ce,Be)|0,N=N+Math.imul(Ce,et)|0,l=l+Math.imul(me,$e)|0,g=g+Math.imul(me,ft)|0,g=g+Math.imul(Oe,$e)|0,N=N+Math.imul(Oe,ft)|0,l=l+Math.imul(Pe,ze)|0,g=g+Math.imul(Pe,it)|0,g=g+Math.imul(Ne,ze)|0,N=N+Math.imul(Ne,it)|0,l=l+Math.imul(we,qe)|0,g=g+Math.imul(we,Ye)|0,g=g+Math.imul(Re,qe)|0,N=N+Math.imul(Re,Ye)|0,l=l+Math.imul(ce,je)|0,g=g+Math.imul(ce,Ct)|0,g=g+Math.imul(ue,je)|0,N=N+Math.imul(ue,Ct)|0,l=l+Math.imul(_,at)|0,g=g+Math.imul(_,bt)|0,g=g+Math.imul($,at)|0,N=N+Math.imul($,bt)|0;var Zr=(x+l|0)+((g&8191)<<13)|0;x=(N+(g>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,l=Math.imul(_e,Fe),g=Math.imul(_e,Xe),g=g+Math.imul(He,Fe)|0,N=Math.imul(He,Xe),l=l+Math.imul(be,Be)|0,g=g+Math.imul(be,et)|0,g=g+Math.imul(Le,Be)|0,N=N+Math.imul(Le,et)|0,l=l+Math.imul(ve,$e)|0,g=g+Math.imul(ve,ft)|0,g=g+Math.imul(Ce,$e)|0,N=N+Math.imul(Ce,ft)|0,l=l+Math.imul(me,ze)|0,g=g+Math.imul(me,it)|0,g=g+Math.imul(Oe,ze)|0,N=N+Math.imul(Oe,it)|0,l=l+Math.imul(Pe,qe)|0,g=g+Math.imul(Pe,Ye)|0,g=g+Math.imul(Ne,qe)|0,N=N+Math.imul(Ne,Ye)|0,l=l+Math.imul(we,je)|0,g=g+Math.imul(we,Ct)|0,g=g+Math.imul(Re,je)|0,N=N+Math.imul(Re,Ct)|0,l=l+Math.imul(ce,at)|0,g=g+Math.imul(ce,bt)|0,g=g+Math.imul(ue,at)|0,N=N+Math.imul(ue,bt)|0;var Ei=(x+l|0)+((g&8191)<<13)|0;x=(N+(g>>>13)|0)+(Ei>>>26)|0,Ei&=67108863,l=Math.imul(_e,Be),g=Math.imul(_e,et),g=g+Math.imul(He,Be)|0,N=Math.imul(He,et),l=l+Math.imul(be,$e)|0,g=g+Math.imul(be,ft)|0,g=g+Math.imul(Le,$e)|0,N=N+Math.imul(Le,ft)|0,l=l+Math.imul(ve,ze)|0,g=g+Math.imul(ve,it)|0,g=g+Math.imul(Ce,ze)|0,N=N+Math.imul(Ce,it)|0,l=l+Math.imul(me,qe)|0,g=g+Math.imul(me,Ye)|0,g=g+Math.imul(Oe,qe)|0,N=N+Math.imul(Oe,Ye)|0,l=l+Math.imul(Pe,je)|0,g=g+Math.imul(Pe,Ct)|0,g=g+Math.imul(Ne,je)|0,N=N+Math.imul(Ne,Ct)|0,l=l+Math.imul(we,at)|0,g=g+Math.imul(we,bt)|0,g=g+Math.imul(Re,at)|0,N=N+Math.imul(Re,bt)|0;var Si=(x+l|0)+((g&8191)<<13)|0;x=(N+(g>>>13)|0)+(Si>>>26)|0,Si&=67108863,l=Math.imul(_e,$e),g=Math.imul(_e,ft),g=g+Math.imul(He,$e)|0,N=Math.imul(He,ft),l=l+Math.imul(be,ze)|0,g=g+Math.imul(be,it)|0,g=g+Math.imul(Le,ze)|0,N=N+Math.imul(Le,it)|0,l=l+Math.imul(ve,qe)|0,g=g+Math.imul(ve,Ye)|0,g=g+Math.imul(Ce,qe)|0,N=N+Math.imul(Ce,Ye)|0,l=l+Math.imul(me,je)|0,g=g+Math.imul(me,Ct)|0,g=g+Math.imul(Oe,je)|0,N=N+Math.imul(Oe,Ct)|0,l=l+Math.imul(Pe,at)|0,g=g+Math.imul(Pe,bt)|0,g=g+Math.imul(Ne,at)|0,N=N+Math.imul(Ne,bt)|0;var ur=(x+l|0)+((g&8191)<<13)|0;x=(N+(g>>>13)|0)+(ur>>>26)|0,ur&=67108863,l=Math.imul(_e,ze),g=Math.imul(_e,it),g=g+Math.imul(He,ze)|0,N=Math.imul(He,it),l=l+Math.imul(be,qe)|0,g=g+Math.imul(be,Ye)|0,g=g+Math.imul(Le,qe)|0,N=N+Math.imul(Le,Ye)|0,l=l+Math.imul(ve,je)|0,g=g+Math.imul(ve,Ct)|0,g=g+Math.imul(Ce,je)|0,N=N+Math.imul(Ce,Ct)|0,l=l+Math.imul(me,at)|0,g=g+Math.imul(me,bt)|0,g=g+Math.imul(Oe,at)|0,N=N+Math.imul(Oe,bt)|0;var Gi=(x+l|0)+((g&8191)<<13)|0;x=(N+(g>>>13)|0)+(Gi>>>26)|0,Gi&=67108863,l=Math.imul(_e,qe),g=Math.imul(_e,Ye),g=g+Math.imul(He,qe)|0,N=Math.imul(He,Ye),l=l+Math.imul(be,je)|0,g=g+Math.imul(be,Ct)|0,g=g+Math.imul(Le,je)|0,N=N+Math.imul(Le,Ct)|0,l=l+Math.imul(ve,at)|0,g=g+Math.imul(ve,bt)|0,g=g+Math.imul(Ce,at)|0,N=N+Math.imul(Ce,bt)|0;var Wi=(x+l|0)+((g&8191)<<13)|0;x=(N+(g>>>13)|0)+(Wi>>>26)|0,Wi&=67108863,l=Math.imul(_e,je),g=Math.imul(_e,Ct),g=g+Math.imul(He,je)|0,N=Math.imul(He,Ct),l=l+Math.imul(be,at)|0,g=g+Math.imul(be,bt)|0,g=g+Math.imul(Le,at)|0,N=N+Math.imul(Le,bt)|0;var Ji=(x+l|0)+((g&8191)<<13)|0;x=(N+(g>>>13)|0)+(Ji>>>26)|0,Ji&=67108863,l=Math.imul(_e,at),g=Math.imul(_e,bt),g=g+Math.imul(He,at)|0,N=Math.imul(He,bt);var Ds=(x+l|0)+((g&8191)<<13)|0;return x=(N+(g>>>13)|0)+(Ds>>>26)|0,Ds&=67108863,I[0]=Cr,I[1]=Rr,I[2]=Nr,I[3]=Tr,I[4]=Fr,I[5]=Xt,I[6]=Qr,I[7]=Hi,I[8]=Xr,I[9]=Ki,I[10]=Vi,I[11]=Zr,I[12]=Ei,I[13]=Si,I[14]=ur,I[15]=Gi,I[16]=Wi,I[17]=Ji,I[18]=Ds,x!==0&&(I[19]=x,d.length++),d};Math.imul||(j=Q);function Y(c,p,d){d.negative=p.negative^c.negative,d.length=c.length+p.length;for(var y=0,M=0,I=0;I<d.length-1;I++){var x=M;M=0;for(var l=y&67108863,g=Math.min(I,p.length-1),N=Math.max(0,I-c.length+1);N<=g;N++){var Z=I-N,te=c.words[Z]|0,D=p.words[N]|0,ee=te*D,B=ee&67108863;x=x+(ee/67108864|0)|0,B=B+l|0,l=B&67108863,x=x+(B>>>26)|0,M+=x>>>26,x&=67108863}d.words[I]=l,y=x,x=M}return y!==0?d.words[I]=y:d.length--,d._strip()}function U(c,p,d){return Y(c,p,d)}a.prototype.mulTo=function(c,p){var d,y=this.length+c.length;return this.length===10&&c.length===10?d=j(this,c,p):y<63?d=Q(this,c,p):y<1024?d=Y(this,c,p):d=U(this,c,p),d},a.prototype.mul=function(c){var p=new a(null);return p.words=new Array(this.length+c.length),this.mulTo(c,p)},a.prototype.mulf=function(c){var p=new a(null);return p.words=new Array(this.length+c.length),U(this,c,p)},a.prototype.imul=function(c){return this.clone().mulTo(c,this)},a.prototype.imuln=function(c){var p=c<0;p&&(c=-c),i(typeof c=="number"),i(c<67108864);for(var d=0,y=0;y<this.length;y++){var M=(this.words[y]|0)*c,I=(M&67108863)+(d&67108863);d>>=26,d+=M/67108864|0,d+=I>>>26,this.words[y]=I&67108863}return d!==0&&(this.words[y]=d,this.length++),p?this.ineg():this},a.prototype.muln=function(c){return this.clone().imuln(c)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(c){var p=W(c);if(p.length===0)return new a(1);for(var d=this,y=0;y<p.length&&p[y]===0;y++,d=d.sqr());if(++y<p.length)for(var M=d.sqr();y<p.length;y++,M=M.sqr())p[y]!==0&&(d=d.mul(M));return d},a.prototype.iushln=function(c){i(typeof c=="number"&&c>=0);var p=c%26,d=(c-p)/26,y=67108863>>>26-p<<26-p,M;if(p!==0){var I=0;for(M=0;M<this.length;M++){var x=this.words[M]&y,l=(this.words[M]|0)-x<<p;this.words[M]=l|I,I=x>>>26-p}I&&(this.words[M]=I,this.length++)}if(d!==0){for(M=this.length-1;M>=0;M--)this.words[M+d]=this.words[M];for(M=0;M<d;M++)this.words[M]=0;this.length+=d}return this._strip()},a.prototype.ishln=function(c){return i(this.negative===0),this.iushln(c)},a.prototype.iushrn=function(c,p,d){i(typeof c=="number"&&c>=0);var y;p?y=(p-p%26)/26:y=0;var M=c%26,I=Math.min((c-M)/26,this.length),x=67108863^67108863>>>M<<M,l=d;if(y-=I,y=Math.max(0,y),l){for(var g=0;g<I;g++)l.words[g]=this.words[g];l.length=I}if(I!==0)if(this.length>I)for(this.length-=I,g=0;g<this.length;g++)this.words[g]=this.words[g+I];else this.words[0]=0,this.length=1;var N=0;for(g=this.length-1;g>=0&&(N!==0||g>=y);g--){var Z=this.words[g]|0;this.words[g]=N<<26-M|Z>>>M,N=Z&x}return l&&N!==0&&(l.words[l.length++]=N),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},a.prototype.ishrn=function(c,p,d){return i(this.negative===0),this.iushrn(c,p,d)},a.prototype.shln=function(c){return this.clone().ishln(c)},a.prototype.ushln=function(c){return this.clone().iushln(c)},a.prototype.shrn=function(c){return this.clone().ishrn(c)},a.prototype.ushrn=function(c){return this.clone().iushrn(c)},a.prototype.testn=function(c){i(typeof c=="number"&&c>=0);var p=c%26,d=(c-p)/26,y=1<<p;if(this.length<=d)return!1;var M=this.words[d];return!!(M&y)},a.prototype.imaskn=function(c){i(typeof c=="number"&&c>=0);var p=c%26,d=(c-p)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=d)return this;if(p!==0&&d++,this.length=Math.min(d,this.length),p!==0){var y=67108863^67108863>>>p<<p;this.words[this.length-1]&=y}return this._strip()},a.prototype.maskn=function(c){return this.clone().imaskn(c)},a.prototype.iaddn=function(c){return i(typeof c=="number"),i(c<67108864),c<0?this.isubn(-c):this.negative!==0?this.length===1&&(this.words[0]|0)<=c?(this.words[0]=c-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(c),this.negative=1,this):this._iaddn(c)},a.prototype._iaddn=function(c){this.words[0]+=c;for(var p=0;p<this.length&&this.words[p]>=67108864;p++)this.words[p]-=67108864,p===this.length-1?this.words[p+1]=1:this.words[p+1]++;return this.length=Math.max(this.length,p+1),this},a.prototype.isubn=function(c){if(i(typeof c=="number"),i(c<67108864),c<0)return this.iaddn(-c);if(this.negative!==0)return this.negative=0,this.iaddn(c),this.negative=1,this;if(this.words[0]-=c,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var p=0;p<this.length&&this.words[p]<0;p++)this.words[p]+=67108864,this.words[p+1]-=1;return this._strip()},a.prototype.addn=function(c){return this.clone().iaddn(c)},a.prototype.subn=function(c){return this.clone().isubn(c)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(c,p,d){var y=c.length+d,M;this._expand(y);var I,x=0;for(M=0;M<c.length;M++){I=(this.words[M+d]|0)+x;var l=(c.words[M]|0)*p;I-=l&67108863,x=(I>>26)-(l/67108864|0),this.words[M+d]=I&67108863}for(;M<this.length-d;M++)I=(this.words[M+d]|0)+x,x=I>>26,this.words[M+d]=I&67108863;if(x===0)return this._strip();for(i(x===-1),x=0,M=0;M<this.length;M++)I=-(this.words[M]|0)+x,x=I>>26,this.words[M]=I&67108863;return this.negative=1,this._strip()},a.prototype._wordDiv=function(c,p){var d=this.length-c.length,y=this.clone(),M=c,I=M.words[M.length-1]|0,x=this._countBits(I);d=26-x,d!==0&&(M=M.ushln(d),y.iushln(d),I=M.words[M.length-1]|0);var l=y.length-M.length,g;if(p!=="mod"){g=new a(null),g.length=l+1,g.words=new Array(g.length);for(var N=0;N<g.length;N++)g.words[N]=0}var Z=y.clone()._ishlnsubmul(M,1,l);Z.negative===0&&(y=Z,g&&(g.words[l]=1));for(var te=l-1;te>=0;te--){var D=(y.words[M.length+te]|0)*67108864+(y.words[M.length+te-1]|0);for(D=Math.min(D/I|0,67108863),y._ishlnsubmul(M,D,te);y.negative!==0;)D--,y.negative=0,y._ishlnsubmul(M,1,te),y.isZero()||(y.negative^=1);g&&(g.words[te]=D)}return g&&g._strip(),y._strip(),p!=="div"&&d!==0&&y.iushrn(d),{div:g||null,mod:y}},a.prototype.divmod=function(c,p,d){if(i(!c.isZero()),this.isZero())return{div:new a(0),mod:new a(0)};var y,M,I;return this.negative!==0&&c.negative===0?(I=this.neg().divmod(c,p),p!=="mod"&&(y=I.div.neg()),p!=="div"&&(M=I.mod.neg(),d&&M.negative!==0&&M.iadd(c)),{div:y,mod:M}):this.negative===0&&c.negative!==0?(I=this.divmod(c.neg(),p),p!=="mod"&&(y=I.div.neg()),{div:y,mod:I.mod}):this.negative&c.negative?(I=this.neg().divmod(c.neg(),p),p!=="div"&&(M=I.mod.neg(),d&&M.negative!==0&&M.isub(c)),{div:I.div,mod:M}):c.length>this.length||this.cmp(c)<0?{div:new a(0),mod:this}:c.length===1?p==="div"?{div:this.divn(c.words[0]),mod:null}:p==="mod"?{div:null,mod:new a(this.modrn(c.words[0]))}:{div:this.divn(c.words[0]),mod:new a(this.modrn(c.words[0]))}:this._wordDiv(c,p)},a.prototype.div=function(c){return this.divmod(c,"div",!1).div},a.prototype.mod=function(c){return this.divmod(c,"mod",!1).mod},a.prototype.umod=function(c){return this.divmod(c,"mod",!0).mod},a.prototype.divRound=function(c){var p=this.divmod(c);if(p.mod.isZero())return p.div;var d=p.div.negative!==0?p.mod.isub(c):p.mod,y=c.ushrn(1),M=c.andln(1),I=d.cmp(y);return I<0||M===1&&I===0?p.div:p.div.negative!==0?p.div.isubn(1):p.div.iaddn(1)},a.prototype.modrn=function(c){var p=c<0;p&&(c=-c),i(c<=67108863);for(var d=(1<<26)%c,y=0,M=this.length-1;M>=0;M--)y=(d*y+(this.words[M]|0))%c;return p?-y:y},a.prototype.modn=function(c){return this.modrn(c)},a.prototype.idivn=function(c){var p=c<0;p&&(c=-c),i(c<=67108863);for(var d=0,y=this.length-1;y>=0;y--){var M=(this.words[y]|0)+d*67108864;this.words[y]=M/c|0,d=M%c}return this._strip(),p?this.ineg():this},a.prototype.divn=function(c){return this.clone().idivn(c)},a.prototype.egcd=function(c){i(c.negative===0),i(!c.isZero());var p=this,d=c.clone();p.negative!==0?p=p.umod(c):p=p.clone();for(var y=new a(1),M=new a(0),I=new a(0),x=new a(1),l=0;p.isEven()&&d.isEven();)p.iushrn(1),d.iushrn(1),++l;for(var g=d.clone(),N=p.clone();!p.isZero();){for(var Z=0,te=1;!(p.words[0]&te)&&Z<26;++Z,te<<=1);if(Z>0)for(p.iushrn(Z);Z-- >0;)(y.isOdd()||M.isOdd())&&(y.iadd(g),M.isub(N)),y.iushrn(1),M.iushrn(1);for(var D=0,ee=1;!(d.words[0]&ee)&&D<26;++D,ee<<=1);if(D>0)for(d.iushrn(D);D-- >0;)(I.isOdd()||x.isOdd())&&(I.iadd(g),x.isub(N)),I.iushrn(1),x.iushrn(1);p.cmp(d)>=0?(p.isub(d),y.isub(I),M.isub(x)):(d.isub(p),I.isub(y),x.isub(M))}return{a:I,b:x,gcd:d.iushln(l)}},a.prototype._invmp=function(c){i(c.negative===0),i(!c.isZero());var p=this,d=c.clone();p.negative!==0?p=p.umod(c):p=p.clone();for(var y=new a(1),M=new a(0),I=d.clone();p.cmpn(1)>0&&d.cmpn(1)>0;){for(var x=0,l=1;!(p.words[0]&l)&&x<26;++x,l<<=1);if(x>0)for(p.iushrn(x);x-- >0;)y.isOdd()&&y.iadd(I),y.iushrn(1);for(var g=0,N=1;!(d.words[0]&N)&&g<26;++g,N<<=1);if(g>0)for(d.iushrn(g);g-- >0;)M.isOdd()&&M.iadd(I),M.iushrn(1);p.cmp(d)>=0?(p.isub(d),y.isub(M)):(d.isub(p),M.isub(y))}var Z;return p.cmpn(1)===0?Z=y:Z=M,Z.cmpn(0)<0&&Z.iadd(c),Z},a.prototype.gcd=function(c){if(this.isZero())return c.abs();if(c.isZero())return this.abs();var p=this.clone(),d=c.clone();p.negative=0,d.negative=0;for(var y=0;p.isEven()&&d.isEven();y++)p.iushrn(1),d.iushrn(1);do{for(;p.isEven();)p.iushrn(1);for(;d.isEven();)d.iushrn(1);var M=p.cmp(d);if(M<0){var I=p;p=d,d=I}else if(M===0||d.cmpn(1)===0)break;p.isub(d)}while(!0);return d.iushln(y)},a.prototype.invm=function(c){return this.egcd(c).a.umod(c)},a.prototype.isEven=function(){return(this.words[0]&1)===0},a.prototype.isOdd=function(){return(this.words[0]&1)===1},a.prototype.andln=function(c){return this.words[0]&c},a.prototype.bincn=function(c){i(typeof c=="number");var p=c%26,d=(c-p)/26,y=1<<p;if(this.length<=d)return this._expand(d+1),this.words[d]|=y,this;for(var M=y,I=d;M!==0&&I<this.length;I++){var x=this.words[I]|0;x+=M,M=x>>>26,x&=67108863,this.words[I]=x}return M!==0&&(this.words[I]=M,this.length++),this},a.prototype.isZero=function(){return this.length===1&&this.words[0]===0},a.prototype.cmpn=function(c){var p=c<0;if(this.negative!==0&&!p)return-1;if(this.negative===0&&p)return 1;this._strip();var d;if(this.length>1)d=1;else{p&&(c=-c),i(c<=67108863,"Number is too big");var y=this.words[0]|0;d=y===c?0:y<c?-1:1}return this.negative!==0?-d|0:d},a.prototype.cmp=function(c){if(this.negative!==0&&c.negative===0)return-1;if(this.negative===0&&c.negative!==0)return 1;var p=this.ucmp(c);return this.negative!==0?-p|0:p},a.prototype.ucmp=function(c){if(this.length>c.length)return 1;if(this.length<c.length)return-1;for(var p=0,d=this.length-1;d>=0;d--){var y=this.words[d]|0,M=c.words[d]|0;if(y!==M){y<M?p=-1:y>M&&(p=1);break}}return p},a.prototype.gtn=function(c){return this.cmpn(c)===1},a.prototype.gt=function(c){return this.cmp(c)===1},a.prototype.gten=function(c){return this.cmpn(c)>=0},a.prototype.gte=function(c){return this.cmp(c)>=0},a.prototype.ltn=function(c){return this.cmpn(c)===-1},a.prototype.lt=function(c){return this.cmp(c)===-1},a.prototype.lten=function(c){return this.cmpn(c)<=0},a.prototype.lte=function(c){return this.cmp(c)<=0},a.prototype.eqn=function(c){return this.cmpn(c)===0},a.prototype.eq=function(c){return this.cmp(c)===0},a.red=function(c){return new L(c)},a.prototype.toRed=function(c){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),c.convertTo(this)._forceRed(c)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(c){return this.red=c,this},a.prototype.forceRed=function(c){return i(!this.red,"Already a number in reduction context"),this._forceRed(c)},a.prototype.redAdd=function(c){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,c)},a.prototype.redIAdd=function(c){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,c)},a.prototype.redSub=function(c){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,c)},a.prototype.redISub=function(c){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,c)},a.prototype.redShl=function(c){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,c)},a.prototype.redMul=function(c){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.mul(this,c)},a.prototype.redIMul=function(c){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.imul(this,c)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(c){return i(this.red&&!c.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,c)};var k={k256:null,p224:null,p192:null,p25519:null};function V(c,p){this.name=c,this.p=new a(p,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}V.prototype._tmp=function(){var c=new a(null);return c.words=new Array(Math.ceil(this.n/13)),c},V.prototype.ireduce=function(c){var p=c,d;do this.split(p,this.tmp),p=this.imulK(p),p=p.iadd(this.tmp),d=p.bitLength();while(d>this.n);var y=d<this.n?-1:p.ucmp(this.p);return y===0?(p.words[0]=0,p.length=1):y>0?p.isub(this.p):p.strip!==void 0?p.strip():p._strip(),p},V.prototype.split=function(c,p){c.iushrn(this.n,0,p)},V.prototype.imulK=function(c){return c.imul(this.k)};function A(){V.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(A,V),A.prototype.split=function(c,p){for(var d=4194303,y=Math.min(c.length,9),M=0;M<y;M++)p.words[M]=c.words[M];if(p.length=y,c.length<=9){c.words[0]=0,c.length=1;return}var I=c.words[9];for(p.words[p.length++]=I&d,M=10;M<c.length;M++){var x=c.words[M]|0;c.words[M-10]=(x&d)<<4|I>>>22,I=x}I>>>=22,c.words[M-10]=I,I===0&&c.length>10?c.length-=10:c.length-=9},A.prototype.imulK=function(c){c.words[c.length]=0,c.words[c.length+1]=0,c.length+=2;for(var p=0,d=0;d<c.length;d++){var y=c.words[d]|0;p+=y*977,c.words[d]=p&67108863,p=y*64+(p/67108864|0)}return c.words[c.length-1]===0&&(c.length--,c.words[c.length-1]===0&&c.length--),c};function F(){V.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(F,V);function ae(){V.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(ae,V);function de(){V.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(de,V),de.prototype.imulK=function(c){for(var p=0,d=0;d<c.length;d++){var y=(c.words[d]|0)*19+p,M=y&67108863;y>>>=26,c.words[d]=M,p=y}return p!==0&&(c.words[c.length++]=p),c},a._prime=function(c){if(k[c])return k[c];var p;if(c==="k256")p=new A;else if(c==="p224")p=new F;else if(c==="p192")p=new ae;else if(c==="p25519")p=new de;else throw new Error("Unknown prime "+c);return k[c]=p,p};function L(c){if(typeof c=="string"){var p=a._prime(c);this.m=p.p,this.prime=p}else i(c.gtn(1),"modulus must be greater than 1"),this.m=c,this.prime=null}L.prototype._verify1=function(c){i(c.negative===0,"red works only with positives"),i(c.red,"red works only with red numbers")},L.prototype._verify2=function(c,p){i((c.negative|p.negative)===0,"red works only with positives"),i(c.red&&c.red===p.red,"red works only with red numbers")},L.prototype.imod=function(c){return this.prime?this.prime.ireduce(c)._forceRed(this):(w(c,c.umod(this.m)._forceRed(this)),c)},L.prototype.neg=function(c){return c.isZero()?c.clone():this.m.sub(c)._forceRed(this)},L.prototype.add=function(c,p){this._verify2(c,p);var d=c.add(p);return d.cmp(this.m)>=0&&d.isub(this.m),d._forceRed(this)},L.prototype.iadd=function(c,p){this._verify2(c,p);var d=c.iadd(p);return d.cmp(this.m)>=0&&d.isub(this.m),d},L.prototype.sub=function(c,p){this._verify2(c,p);var d=c.sub(p);return d.cmpn(0)<0&&d.iadd(this.m),d._forceRed(this)},L.prototype.isub=function(c,p){this._verify2(c,p);var d=c.isub(p);return d.cmpn(0)<0&&d.iadd(this.m),d},L.prototype.shl=function(c,p){return this._verify1(c),this.imod(c.ushln(p))},L.prototype.imul=function(c,p){return this._verify2(c,p),this.imod(c.imul(p))},L.prototype.mul=function(c,p){return this._verify2(c,p),this.imod(c.mul(p))},L.prototype.isqr=function(c){return this.imul(c,c.clone())},L.prototype.sqr=function(c){return this.mul(c,c)},L.prototype.sqrt=function(c){if(c.isZero())return c.clone();var p=this.m.andln(3);if(i(p%2===1),p===3){var d=this.m.add(new a(1)).iushrn(2);return this.pow(c,d)}for(var y=this.m.subn(1),M=0;!y.isZero()&&y.andln(1)===0;)M++,y.iushrn(1);i(!y.isZero());var I=new a(1).toRed(this),x=I.redNeg(),l=this.m.subn(1).iushrn(1),g=this.m.bitLength();for(g=new a(2*g*g).toRed(this);this.pow(g,l).cmp(x)!==0;)g.redIAdd(x);for(var N=this.pow(g,y),Z=this.pow(c,y.addn(1).iushrn(1)),te=this.pow(c,y),D=M;te.cmp(I)!==0;){for(var ee=te,B=0;ee.cmp(I)!==0;B++)ee=ee.redSqr();i(B<D);var H=this.pow(N,new a(1).iushln(D-B-1));Z=Z.redMul(H),N=H.redSqr(),te=te.redMul(N),D=B}return Z},L.prototype.invm=function(c){var p=c._invmp(this.m);return p.negative!==0?(p.negative=0,this.imod(p).redNeg()):this.imod(p)},L.prototype.pow=function(c,p){if(p.isZero())return new a(1).toRed(this);if(p.cmpn(1)===0)return c.clone();var d=4,y=new Array(1<<d);y[0]=new a(1).toRed(this),y[1]=c;for(var M=2;M<y.length;M++)y[M]=this.mul(y[M-1],c);var I=y[0],x=0,l=0,g=p.bitLength()%26;for(g===0&&(g=26),M=p.length-1;M>=0;M--){for(var N=p.words[M],Z=g-1;Z>=0;Z--){var te=N>>Z&1;if(I!==y[0]&&(I=this.sqr(I)),te===0&&x===0){l=0;continue}x<<=1,x|=te,l++,!(l!==d&&(M!==0||Z!==0))&&(I=this.mul(I,y[x]),l=0,x=0)}g=26}return I},L.prototype.convertTo=function(c){var p=c.umod(this.m);return p===c?p.clone():p},L.prototype.convertFrom=function(c){var p=c.clone();return p.red=null,p},a.mont=function(c){return new m(c)};function m(c){L.call(this,c),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new a(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(m,L),m.prototype.convertTo=function(c){return this.imod(c.ushln(this.shift))},m.prototype.convertFrom=function(c){var p=this.imod(c.mul(this.rinv));return p.red=null,p},m.prototype.imul=function(c,p){if(c.isZero()||p.isZero())return c.words[0]=0,c.length=1,c;var d=c.imul(p),y=d.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),M=d.isub(y).iushrn(this.shift),I=M;return M.cmp(this.m)>=0?I=M.isub(this.m):M.cmpn(0)<0&&(I=M.iadd(this.m)),I._forceRed(this)},m.prototype.mul=function(c,p){if(c.isZero()||p.isZero())return new a(0)._forceRed(this);var d=c.mul(p),y=d.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),M=d.isub(y).iushrn(this.shift),I=M;return M.cmp(this.m)>=0?I=M.isub(this.m):M.cmpn(0)<0&&(I=M.iadd(this.m)),I._forceRed(this)},m.prototype.invm=function(c){var p=this.imod(c._invmp(this.m).mul(this.r2));return p._forceRed(this)}})(r,Bv)})($v);var vt=$v.exports;const zv="bignumber/5.7.0";var kf=vt.BN;const Qn=new Ir(zv),jh={},u1=9007199254740991;function B7(r){return r!=null&&(Kt.isBigNumber(r)||typeof r=="number"&&r%1===0||typeof r=="string"&&!!r.match(/^-?[0-9]+$/)||wi(r)||typeof r=="bigint"||Ja(r))}let h1=!1;class Kt{constructor(e,t){e!==jh&&Qn.throwError("cannot call constructor directly; use BigNumber.from",Ir.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return si(It(this).fromTwos(e))}toTwos(e){return si(It(this).toTwos(e))}abs(){return this._hex[0]==="-"?Kt.from(this._hex.substring(1)):this}add(e){return si(It(this).add(It(e)))}sub(e){return si(It(this).sub(It(e)))}div(e){return Kt.from(e).isZero()&&Ni("division-by-zero","div"),si(It(this).div(It(e)))}mul(e){return si(It(this).mul(It(e)))}mod(e){const t=It(e);return t.isNeg()&&Ni("division-by-zero","mod"),si(It(this).umod(t))}pow(e){const t=It(e);return t.isNeg()&&Ni("negative-power","pow"),si(It(this).pow(t))}and(e){const t=It(e);return(this.isNegative()||t.isNeg())&&Ni("unbound-bitwise-result","and"),si(It(this).and(t))}or(e){const t=It(e);return(this.isNegative()||t.isNeg())&&Ni("unbound-bitwise-result","or"),si(It(this).or(t))}xor(e){const t=It(e);return(this.isNegative()||t.isNeg())&&Ni("unbound-bitwise-result","xor"),si(It(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Ni("negative-width","mask"),si(It(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Ni("negative-width","shl"),si(It(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Ni("negative-width","shr"),si(It(this).shrn(e))}eq(e){return It(this).eq(It(e))}lt(e){return It(this).lt(It(e))}lte(e){return It(this).lte(It(e))}gt(e){return It(this).gt(It(e))}gte(e){return It(this).gte(It(e))}isNegative(){return this._hex[0]==="-"}isZero(){return It(this).isZero()}toNumber(){try{return It(this).toNumber()}catch{Ni("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Qn.throwError("this platform does not support BigInt",Ir.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?h1||(h1=!0,Qn.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Qn.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Ir.errors.UNEXPECTED_ARGUMENT,{}):Qn.throwError("BigNumber.toString does not accept parameters",Ir.errors.UNEXPECTED_ARGUMENT,{})),It(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof Kt)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new Kt(jh,Ko(e)):e.match(/^-?[0-9]+$/)?new Kt(jh,Ko(new kf(e))):Qn.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Ni("underflow","BigNumber.from",e),(e>=u1||e<=-u1)&&Ni("overflow","BigNumber.from",e),Kt.from(String(e));const t=e;if(typeof t=="bigint")return Kt.from(t.toString());if(Ja(t))return Kt.from(ci(t));if(t)if(t.toHexString){const i=t.toHexString();if(typeof i=="string")return Kt.from(i)}else{let i=t._hex;if(i==null&&t.type==="BigNumber"&&(i=t.hex),typeof i=="string"&&(wi(i)||i[0]==="-"&&wi(i.substring(1))))return Kt.from(i)}return Qn.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function Ko(r){if(typeof r!="string")return Ko(r.toString(16));if(r[0]==="-")return r=r.substring(1),r[0]==="-"&&Qn.throwArgumentError("invalid hex","value",r),r=Ko(r),r==="0x00"?r:"-"+r;if(r.substring(0,2)!=="0x"&&(r="0x"+r),r==="0x")return"0x00";for(r.length%2&&(r="0x0"+r.substring(2));r.length>4&&r.substring(0,4)==="0x00";)r="0x"+r.substring(4);return r}function si(r){return Kt.from(Ko(r))}function It(r){const e=Kt.from(r).toHexString();return e[0]==="-"?new kf("-"+e.substring(3),16):new kf(e.substring(2),16)}function Ni(r,e,t){const i={fault:r,operation:e};return t!=null&&(i.value=t),Qn.throwError(r,Ir.errors.NUMERIC_FAULT,i)}function q7(r){return new kf(r,36).toString(16)}const Wr=new Ir(zv),Lo={},jv=Kt.from(0),kv=Kt.from(-1);function Hv(r,e,t,i){const s={fault:e,operation:t};return i!==void 0&&(s.value=i),Wr.throwError(r,Ir.errors.NUMERIC_FAULT,s)}let Uo="0";for(;Uo.length<256;)Uo+=Uo;function od(r){if(typeof r!="number")try{r=Kt.from(r).toNumber()}catch{}return typeof r=="number"&&r>=0&&r<=256&&!(r%1)?"1"+Uo.substring(0,r):Wr.throwArgumentError("invalid decimal size","decimals",r)}function kh(r,e){e==null&&(e=0);const t=od(e);r=Kt.from(r);const i=r.lt(jv);i&&(r=r.mul(kv));let s=r.mod(t).toString();for(;s.length<t.length-1;)s="0"+s;s=s.match(/^([0-9]*[1-9]|0)(0*)/)[1];const a=r.div(t).toString();return t.length===1?r=a:r=a+"."+s,i&&(r="-"+r),r}function Gn(r,e){e==null&&(e=0);const t=od(e);(typeof r!="string"||!r.match(/^-?[0-9.]+$/))&&Wr.throwArgumentError("invalid decimal value","value",r);const i=r.substring(0,1)==="-";i&&(r=r.substring(1)),r==="."&&Wr.throwArgumentError("missing value","value",r);const s=r.split(".");s.length>2&&Wr.throwArgumentError("too many decimal points","value",r);let a=s[0],f=s[1];for(a||(a="0"),f||(f="0");f[f.length-1]==="0";)f=f.substring(0,f.length-1);for(f.length>t.length-1&&Hv("fractional component exceeds decimals","underflow","parseFixed"),f===""&&(f="0");f.length<t.length-1;)f+="0";const u=Kt.from(a),b=Kt.from(f);let v=u.mul(t).add(b);return i&&(v=v.mul(kv)),v}let Hh=class El{constructor(e,t,i,s){e!==Lo&&Wr.throwError("cannot use FixedFormat constructor; use FixedFormat.from",Ir.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=i,this.decimals=s,this.name=(t?"":"u")+"fixed"+String(i)+"x"+String(s),this._multiplier=od(s),Object.freeze(this)}static from(e){if(e instanceof El)return e;typeof e=="number"&&(e=`fixed128x${e}`);let t=!0,i=128,s=18;if(typeof e=="string"){if(e!=="fixed")if(e==="ufixed")t=!1;else{const a=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);a||Wr.throwArgumentError("invalid fixed format","format",e),t=a[1]!=="u",i=parseInt(a[2]),s=parseInt(a[3])}}else if(e){const a=(f,u,b)=>e[f]==null?b:(typeof e[f]!==u&&Wr.throwArgumentError("invalid fixed format ("+f+" not "+u+")","format."+f,e[f]),e[f]);t=a("signed","boolean",t),i=a("width","number",i),s=a("decimals","number",s)}return i%8&&Wr.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",i),s>80&&Wr.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",s),new El(Lo,t,i,s)}},Kv=class Kr{constructor(e,t,i,s){e!==Lo&&Wr.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Ir.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=s,this._hex=t,this._value=i,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&Wr.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=Gn(this._value,this.format.decimals),i=Gn(e._value,e.format.decimals);return Kr.fromValue(t.add(i),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=Gn(this._value,this.format.decimals),i=Gn(e._value,e.format.decimals);return Kr.fromValue(t.sub(i),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=Gn(this._value,this.format.decimals),i=Gn(e._value,e.format.decimals);return Kr.fromValue(t.mul(i).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=Gn(this._value,this.format.decimals),i=Gn(e._value,e.format.decimals);return Kr.fromValue(t.mul(this.format._multiplier).div(i),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");e.length===1&&e.push("0");let t=Kr.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return this.isNegative()&&i&&(t=t.subUnsafe(l1.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");e.length===1&&e.push("0");let t=Kr.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return!this.isNegative()&&i&&(t=t.addUnsafe(l1.toFormat(t.format))),t}round(e){e==null&&(e=0);const t=this.toString().split(".");if(t.length===1&&t.push("0"),(e<0||e>80||e%1)&&Wr.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const i=Kr.from("1"+Uo.substring(0,e),this.format),s=L7.toFormat(this.format);return this.mulUnsafe(i).addUnsafe(s).floor().divUnsafe(i)}isZero(){return this._value==="0.0"||this._value==="0"}isNegative(){return this._value[0]==="-"}toString(){return this._value}toHexString(e){if(e==null)return this._hex;e%8&&Wr.throwArgumentError("invalid byte width","width",e);const t=Kt.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return In(t,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return Kr.fromString(this._value,e)}static fromValue(e,t,i){return i==null&&t!=null&&!B7(t)&&(i=t,t=null),t==null&&(t=0),i==null&&(i="fixed"),Kr.fromString(kh(e,t),Hh.from(i))}static fromString(e,t){t==null&&(t="fixed");const i=Hh.from(t),s=Gn(e,i.decimals);!i.signed&&s.lt(jv)&&Hv("unsigned value cannot be negative","overflow","value",e);let a=null;i.signed?a=s.toTwos(i.width).toHexString():(a=s.toHexString(),a=In(a,i.width/8));const f=kh(s,i.decimals);return new Kr(Lo,a,f,i)}static fromBytes(e,t){t==null&&(t="fixed");const i=Hh.from(t);if(tr(e).length>i.width/8)throw new Error("overflow");let s=Kt.from(e);i.signed&&(s=s.fromTwos(i.width));const a=s.toTwos((i.signed?0:1)+i.width).toHexString(),f=kh(s,i.decimals);return new Kr(Lo,a,f,i)}static from(e,t){if(typeof e=="string")return Kr.fromString(e,t);if(Ja(e))return Kr.fromBytes(e,t);try{return Kr.fromValue(e,0,t)}catch(i){if(i.code!==Ir.errors.INVALID_ARGUMENT)throw i}return Wr.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}};const l1=Kv.from(1),L7=Kv.from("0.5"),U7="strings/5.7.0",$7=new Ir(U7);var Hf;(function(r){r.current="",r.NFC="NFC",r.NFD="NFD",r.NFKC="NFKC",r.NFKD="NFKD"})(Hf||(Hf={}));var d1;(function(r){r.UNEXPECTED_CONTINUE="unexpected continuation byte",r.BAD_PREFIX="bad codepoint prefix",r.OVERRUN="string overrun",r.MISSING_CONTINUE="missing continuation byte",r.OUT_OF_RANGE="out of UTF-8 range",r.UTF16_SURROGATE="UTF-16 surrogate",r.OVERLONG="overlong representation"})(d1||(d1={}));function Kh(r,e=Hf.current){e!=Hf.current&&($7.checkNormalize(),r=r.normalize(e));let t=[];for(let i=0;i<r.length;i++){const s=r.charCodeAt(i);if(s<128)t.push(s);else if(s<2048)t.push(s>>6|192),t.push(s&63|128);else if((s&64512)==55296){i++;const a=r.charCodeAt(i);if(i>=r.length||(a&64512)!==56320)throw new Error("invalid utf-8 string");const f=65536+((s&1023)<<10)+(a&1023);t.push(f>>18|240),t.push(f>>12&63|128),t.push(f>>6&63|128),t.push(f&63|128)}else t.push(s>>12|224),t.push(s>>6&63|128),t.push(s&63|128)}return tr(t)}function z7(r){if(r.length%4!==0)throw new Error("bad data");let e=[];for(let t=0;t<r.length;t+=4)e.push(parseInt(r.substring(t,t+4),16));return e}function Vh(r,e){e||(e=function(s){return[parseInt(s,16)]});let t=0,i={};return r.split(",").forEach(s=>{let a=s.split(":");t+=parseInt(a[0],16),i[t]=e(a[1])}),i}function p1(r){let e=0;return r.split(",").map(t=>{let i=t.split("-");i.length===1?i[1]="0":i[1]===""&&(i[1]="1");let s=e+parseInt(i[0],16);return e=parseInt(i[1],16),{l:s,h:e}})}p1("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(r=>parseInt(r,16)),Vh("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),Vh("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),Vh("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",z7),p1("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function j7(r){r=atob(r);const e=[];for(let t=0;t<r.length;t++)e.push(r.charCodeAt(t));return tr(e)}function Vv(r,e){e==null&&(e=1);const t=[],i=t.forEach,s=function(a,f){i.call(a,function(u){f>0&&Array.isArray(u)?s(u,f-1):t.push(u)})};return s(r,e),t}function k7(r){const e={};for(let t=0;t<r.length;t++){const i=r[t];e[i[0]]=i[1]}return e}function H7(r){let e=0;function t(){return r[e++]<<8|r[e++]}let i=t(),s=1,a=[0,1];for(let k=1;k<i;k++)a.push(s+=t());let f=t(),u=e;e+=f;let b=0,v=0;function w(){return b==0&&(v=v<<8|r[e++],b=8),v>>--b&1}const S=31,O=Math.pow(2,S),P=O>>>1,R=P>>1,z=O-1;let W=0;for(let k=0;k<S;k++)W=W<<1|w();let Q=[],j=0,Y=O;for(;;){let k=Math.floor(((W-j+1)*s-1)/Y),V=0,A=i;for(;A-V>1;){let de=V+A>>>1;k<a[de]?A=de:V=de}if(V==0)break;Q.push(V);let F=j+Math.floor(Y*a[V]/s),ae=j+Math.floor(Y*a[V+1]/s)-1;for(;!((F^ae)&P);)W=W<<1&z|w(),F=F<<1&z,ae=ae<<1&z|1;for(;F&~ae&R;)W=W&P|W<<1&z>>>1|w(),F=F<<1^P,ae=(ae^P)<<1|P|1;j=F,Y=1+ae-F}let U=i-4;return Q.map(k=>{switch(k-U){case 3:return U+65792+(r[u++]<<16|r[u++]<<8|r[u++]);case 2:return U+256+(r[u++]<<8|r[u++]);case 1:return U+r[u++];default:return k-1}})}function K7(r){let e=0;return()=>r[e++]}function V7(r){return K7(H7(r))}function G7(r){return r&1?~r>>1:r>>1}function W7(r,e){let t=Array(r);for(let i=0;i<r;i++)t[i]=1+e();return t}function g1(r,e){let t=Array(r);for(let i=0,s=-1;i<r;i++)t[i]=s+=1+e();return t}function J7(r,e){let t=Array(r);for(let i=0,s=0;i<r;i++)t[i]=s+=G7(e());return t}function Kf(r,e){let t=g1(r(),r),i=r(),s=g1(i,r),a=W7(i,r);for(let f=0;f<i;f++)for(let u=0;u<a[f];u++)t.push(s[f]+u);return e?t.map(f=>e[f]):t}function Y7(r){let e=[];for(;;){let t=r();if(t==0)break;e.push(X7(t,r))}for(;;){let t=r()-1;if(t<0)break;e.push(Z7(t,r))}return k7(Vv(e))}function Q7(r){let e=[];for(;;){let t=r();if(t==0)break;e.push(t)}return e}function Gv(r,e,t){let i=Array(r).fill(void 0).map(()=>[]);for(let s=0;s<e;s++)J7(r,t).forEach((a,f)=>i[f].push(a));return i}function X7(r,e){let t=1+e(),i=e(),s=Q7(e),a=Gv(s.length,1+r,e);return Vv(a.map((f,u)=>{const b=f[0],v=f.slice(1);return Array(s[u]).fill(void 0).map((w,S)=>{let O=S*i;return[b+S*t,v.map(P=>P+O)]})}))}function Z7(r,e){let t=1+e();return Gv(t,1+r,e).map(i=>[i[0],i.slice(1)])}function e9(r){let e=Kf(r).sort((i,s)=>i-s);return t();function t(){let i=[];for(;;){let v=Kf(r,e);if(v.length==0)break;i.push({set:new Set(v),node:t()})}i.sort((v,w)=>w.set.size-v.set.size);let s=r(),a=s%3;s=s/3|0;let f=!!(s&1);s>>=1;let u=s==1,b=s==2;return{branches:i,valid:a,fe0f:f,save:u,check:b}}}function t9(){return V7(j7("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const gf=t9();new Set(Kf(gf)),new Set(Kf(gf)),Y7(gf),e9(gf);const r9=new Uint8Array(32);r9.fill(0);const i9=`Ethereum Signed Message:
|
|
23
|
+
`;function Wv(r){return typeof r=="string"&&(r=Kh(r)),ad(O7([Kh(i9),Kh(String(r.length)),r]))}const n9="address/5.7.0",To=new Ir(n9);function v1(r){wi(r,20)||To.throwArgumentError("invalid address","address",r),r=r.toLowerCase();const e=r.substring(2).split(""),t=new Uint8Array(40);for(let s=0;s<40;s++)t[s]=e[s].charCodeAt(0);const i=tr(ad(t));for(let s=0;s<40;s+=2)i[s>>1]>>4>=8&&(e[s]=e[s].toUpperCase()),(i[s>>1]&15)>=8&&(e[s+1]=e[s+1].toUpperCase());return"0x"+e.join("")}const s9=9007199254740991;function a9(r){return Math.log10?Math.log10(r):Math.log(r)/Math.LN10}const cd={};for(let r=0;r<10;r++)cd[String(r)]=String(r);for(let r=0;r<26;r++)cd[String.fromCharCode(65+r)]=String(10+r);const b1=Math.floor(a9(s9));function o9(r){r=r.toUpperCase(),r=r.substring(4)+r.substring(0,2)+"00";let e=r.split("").map(i=>cd[i]).join("");for(;e.length>=b1;){let i=e.substring(0,b1);e=parseInt(i,10)%97+e.substring(i.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}function c9(r){let e=null;if(typeof r!="string"&&To.throwArgumentError("invalid address","address",r),r.match(/^(0x)?[0-9a-fA-F]{40}$/))r.substring(0,2)!=="0x"&&(r="0x"+r),e=v1(r),r.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==r&&To.throwArgumentError("bad address checksum","address",r);else if(r.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(r.substring(2,4)!==o9(r)&&To.throwArgumentError("bad icap checksum","address",r),e=q7(r.substring(4));e.length<40;)e="0"+e;e=v1("0x"+e)}else To.throwArgumentError("invalid address","address",r);return e}function So(r,e,t){Object.defineProperty(r,e,{enumerable:!0,value:t,writable:!1})}const f9=new Uint8Array(32);f9.fill(0),Kt.from(-1);const u9=Kt.from(0),h9=Kt.from(1);Kt.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),In(h9.toHexString(),32),In(u9.toHexString(),32);var _n={},Dt={},sc=Jv;function Jv(r,e){if(!r)throw new Error(e||"Assertion failed")}Jv.equal=function(r,e,t){if(r!=e)throw new Error(t||"Assertion failed: "+r+" != "+e)};var Sl={exports:{}};typeof Object.create=="function"?Sl.exports=function(r,e){e&&(r.super_=e,r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:Sl.exports=function(r,e){if(e){r.super_=e;var t=function(){};t.prototype=e.prototype,r.prototype=new t,r.prototype.constructor=r}};var l9=sc,d9=Sl.exports;Dt.inherits=d9;function p9(r,e){return(r.charCodeAt(e)&64512)!==55296||e<0||e+1>=r.length?!1:(r.charCodeAt(e+1)&64512)===56320}function g9(r,e){if(Array.isArray(r))return r.slice();if(!r)return[];var t=[];if(typeof r=="string")if(e){if(e==="hex")for(r=r.replace(/[^a-z0-9]+/ig,""),r.length%2!==0&&(r="0"+r),s=0;s<r.length;s+=2)t.push(parseInt(r[s]+r[s+1],16))}else for(var i=0,s=0;s<r.length;s++){var a=r.charCodeAt(s);a<128?t[i++]=a:a<2048?(t[i++]=a>>6|192,t[i++]=a&63|128):p9(r,s)?(a=65536+((a&1023)<<10)+(r.charCodeAt(++s)&1023),t[i++]=a>>18|240,t[i++]=a>>12&63|128,t[i++]=a>>6&63|128,t[i++]=a&63|128):(t[i++]=a>>12|224,t[i++]=a>>6&63|128,t[i++]=a&63|128)}else for(s=0;s<r.length;s++)t[s]=r[s]|0;return t}Dt.toArray=g9;function v9(r){for(var e="",t=0;t<r.length;t++)e+=Qv(r[t].toString(16));return e}Dt.toHex=v9;function Yv(r){var e=r>>>24|r>>>8&65280|r<<8&16711680|(r&255)<<24;return e>>>0}Dt.htonl=Yv;function b9(r,e){for(var t="",i=0;i<r.length;i++){var s=r[i];e==="little"&&(s=Yv(s)),t+=Xv(s.toString(16))}return t}Dt.toHex32=b9;function Qv(r){return r.length===1?"0"+r:r}Dt.zero2=Qv;function Xv(r){return r.length===7?"0"+r:r.length===6?"00"+r:r.length===5?"000"+r:r.length===4?"0000"+r:r.length===3?"00000"+r:r.length===2?"000000"+r:r.length===1?"0000000"+r:r}Dt.zero8=Xv;function m9(r,e,t,i){var s=t-e;l9(s%4===0);for(var a=new Array(s/4),f=0,u=e;f<a.length;f++,u+=4){var b;i==="big"?b=r[u]<<24|r[u+1]<<16|r[u+2]<<8|r[u+3]:b=r[u+3]<<24|r[u+2]<<16|r[u+1]<<8|r[u],a[f]=b>>>0}return a}Dt.join32=m9;function y9(r,e){for(var t=new Array(r.length*4),i=0,s=0;i<r.length;i++,s+=4){var a=r[i];e==="big"?(t[s]=a>>>24,t[s+1]=a>>>16&255,t[s+2]=a>>>8&255,t[s+3]=a&255):(t[s+3]=a>>>24,t[s+2]=a>>>16&255,t[s+1]=a>>>8&255,t[s]=a&255)}return t}Dt.split32=y9;function w9(r,e){return r>>>e|r<<32-e}Dt.rotr32=w9;function _9(r,e){return r<<e|r>>>32-e}Dt.rotl32=_9;function A9(r,e){return r+e>>>0}Dt.sum32=A9;function E9(r,e,t){return r+e+t>>>0}Dt.sum32_3=E9;function S9(r,e,t,i){return r+e+t+i>>>0}Dt.sum32_4=S9;function x9(r,e,t,i,s){return r+e+t+i+s>>>0}Dt.sum32_5=x9;function M9(r,e,t,i){var s=r[e],a=r[e+1],f=i+a>>>0,u=(f<i?1:0)+t+s;r[e]=u>>>0,r[e+1]=f}Dt.sum64=M9;function I9(r,e,t,i){var s=e+i>>>0,a=(s<e?1:0)+r+t;return a>>>0}Dt.sum64_hi=I9;function D9(r,e,t,i){var s=e+i;return s>>>0}Dt.sum64_lo=D9;function P9(r,e,t,i,s,a,f,u){var b=0,v=e;v=v+i>>>0,b+=v<e?1:0,v=v+a>>>0,b+=v<a?1:0,v=v+u>>>0,b+=v<u?1:0;var w=r+t+s+f+b;return w>>>0}Dt.sum64_4_hi=P9;function O9(r,e,t,i,s,a,f,u){var b=e+i+a+u;return b>>>0}Dt.sum64_4_lo=O9;function C9(r,e,t,i,s,a,f,u,b,v){var w=0,S=e;S=S+i>>>0,w+=S<e?1:0,S=S+a>>>0,w+=S<a?1:0,S=S+u>>>0,w+=S<u?1:0,S=S+v>>>0,w+=S<v?1:0;var O=r+t+s+f+b+w;return O>>>0}Dt.sum64_5_hi=C9;function R9(r,e,t,i,s,a,f,u,b,v){var w=e+i+a+u+v;return w>>>0}Dt.sum64_5_lo=R9;function N9(r,e,t){var i=e<<32-t|r>>>t;return i>>>0}Dt.rotr64_hi=N9;function T9(r,e,t){var i=r<<32-t|e>>>t;return i>>>0}Dt.rotr64_lo=T9;function F9(r,e,t){return r>>>t}Dt.shr64_hi=F9;function B9(r,e,t){var i=r<<32-t|e>>>t;return i>>>0}Dt.shr64_lo=B9;var Ya={},m1=Dt,q9=sc;function vf(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Ya.BlockHash=vf,vf.prototype.update=function(r,e){if(r=m1.toArray(r,e),this.pending?this.pending=this.pending.concat(r):this.pending=r,this.pendingTotal+=r.length,this.pending.length>=this._delta8){r=this.pending;var t=r.length%this._delta8;this.pending=r.slice(r.length-t,r.length),this.pending.length===0&&(this.pending=null),r=m1.join32(r,0,r.length-t,this.endian);for(var i=0;i<r.length;i+=this._delta32)this._update(r,i,i+this._delta32)}return this},vf.prototype.digest=function(r){return this.update(this._pad()),q9(this.pending===null),this._digest(r)},vf.prototype._pad=function(){var r=this.pendingTotal,e=this._delta8,t=e-(r+this.padLength)%e,i=new Array(t+this.padLength);i[0]=128;for(var s=1;s<t;s++)i[s]=0;if(r<<=3,this.endian==="big"){for(var a=8;a<this.padLength;a++)i[s++]=0;i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=r>>>24&255,i[s++]=r>>>16&255,i[s++]=r>>>8&255,i[s++]=r&255}else for(i[s++]=r&255,i[s++]=r>>>8&255,i[s++]=r>>>16&255,i[s++]=r>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,a=8;a<this.padLength;a++)i[s++]=0;return i};var Na={},Fn={},L9=Dt,Dn=L9.rotr32;function U9(r,e,t,i){if(r===0)return Zv(e,t,i);if(r===1||r===3)return tb(e,t,i);if(r===2)return eb(e,t,i)}Fn.ft_1=U9;function Zv(r,e,t){return r&e^~r&t}Fn.ch32=Zv;function eb(r,e,t){return r&e^r&t^e&t}Fn.maj32=eb;function tb(r,e,t){return r^e^t}Fn.p32=tb;function $9(r){return Dn(r,2)^Dn(r,13)^Dn(r,22)}Fn.s0_256=$9;function z9(r){return Dn(r,6)^Dn(r,11)^Dn(r,25)}Fn.s1_256=z9;function j9(r){return Dn(r,7)^Dn(r,18)^r>>>3}Fn.g0_256=j9;function k9(r){return Dn(r,17)^Dn(r,19)^r>>>10}Fn.g1_256=k9;var ja=Dt,H9=Ya,K9=Fn,Gh=ja.rotl32,xo=ja.sum32,V9=ja.sum32_5,G9=K9.ft_1,rb=H9.BlockHash,W9=[1518500249,1859775393,2400959708,3395469782];function xn(){if(!(this instanceof xn))return new xn;rb.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}ja.inherits(xn,rb);var J9=xn;xn.blockSize=512,xn.outSize=160,xn.hmacStrength=80,xn.padLength=64,xn.prototype._update=function(r,e){for(var t=this.W,i=0;i<16;i++)t[i]=r[e+i];for(;i<t.length;i++)t[i]=Gh(t[i-3]^t[i-8]^t[i-14]^t[i-16],1);var s=this.h[0],a=this.h[1],f=this.h[2],u=this.h[3],b=this.h[4];for(i=0;i<t.length;i++){var v=~~(i/20),w=V9(Gh(s,5),G9(v,a,f,u),b,t[i],W9[v]);b=u,u=f,f=Gh(a,30),a=s,s=w}this.h[0]=xo(this.h[0],s),this.h[1]=xo(this.h[1],a),this.h[2]=xo(this.h[2],f),this.h[3]=xo(this.h[3],u),this.h[4]=xo(this.h[4],b)},xn.prototype._digest=function(r){return r==="hex"?ja.toHex32(this.h,"big"):ja.split32(this.h,"big")};var ka=Dt,Y9=Ya,Qa=Fn,Q9=sc,tn=ka.sum32,X9=ka.sum32_4,Z9=ka.sum32_5,eA=Qa.ch32,tA=Qa.maj32,rA=Qa.s0_256,iA=Qa.s1_256,nA=Qa.g0_256,sA=Qa.g1_256,ib=Y9.BlockHash,aA=[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 Mn(){if(!(this instanceof Mn))return new Mn;ib.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=aA,this.W=new Array(64)}ka.inherits(Mn,ib);var nb=Mn;Mn.blockSize=512,Mn.outSize=256,Mn.hmacStrength=192,Mn.padLength=64,Mn.prototype._update=function(r,e){for(var t=this.W,i=0;i<16;i++)t[i]=r[e+i];for(;i<t.length;i++)t[i]=X9(sA(t[i-2]),t[i-7],nA(t[i-15]),t[i-16]);var s=this.h[0],a=this.h[1],f=this.h[2],u=this.h[3],b=this.h[4],v=this.h[5],w=this.h[6],S=this.h[7];for(Q9(this.k.length===t.length),i=0;i<t.length;i++){var O=Z9(S,iA(b),eA(b,v,w),this.k[i],t[i]),P=tn(rA(s),tA(s,a,f));S=w,w=v,v=b,b=tn(u,O),u=f,f=a,a=s,s=tn(O,P)}this.h[0]=tn(this.h[0],s),this.h[1]=tn(this.h[1],a),this.h[2]=tn(this.h[2],f),this.h[3]=tn(this.h[3],u),this.h[4]=tn(this.h[4],b),this.h[5]=tn(this.h[5],v),this.h[6]=tn(this.h[6],w),this.h[7]=tn(this.h[7],S)},Mn.prototype._digest=function(r){return r==="hex"?ka.toHex32(this.h,"big"):ka.split32(this.h,"big")};var xl=Dt,sb=nb;function Zn(){if(!(this instanceof Zn))return new Zn;sb.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}xl.inherits(Zn,sb);var oA=Zn;Zn.blockSize=512,Zn.outSize=224,Zn.hmacStrength=192,Zn.padLength=64,Zn.prototype._digest=function(r){return r==="hex"?xl.toHex32(this.h.slice(0,7),"big"):xl.split32(this.h.slice(0,7),"big")};var hi=Dt,cA=Ya,fA=sc,Pn=hi.rotr64_hi,On=hi.rotr64_lo,ab=hi.shr64_hi,ob=hi.shr64_lo,vs=hi.sum64,Wh=hi.sum64_hi,Jh=hi.sum64_lo,uA=hi.sum64_4_hi,hA=hi.sum64_4_lo,lA=hi.sum64_5_hi,dA=hi.sum64_5_lo,cb=cA.BlockHash,pA=[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 on(){if(!(this instanceof on))return new on;cb.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=pA,this.W=new Array(160)}hi.inherits(on,cb);var fb=on;on.blockSize=1024,on.outSize=512,on.hmacStrength=192,on.padLength=128,on.prototype._prepareBlock=function(r,e){for(var t=this.W,i=0;i<32;i++)t[i]=r[e+i];for(;i<t.length;i+=2){var s=xA(t[i-4],t[i-3]),a=MA(t[i-4],t[i-3]),f=t[i-14],u=t[i-13],b=EA(t[i-30],t[i-29]),v=SA(t[i-30],t[i-29]),w=t[i-32],S=t[i-31];t[i]=uA(s,a,f,u,b,v,w,S),t[i+1]=hA(s,a,f,u,b,v,w,S)}},on.prototype._update=function(r,e){this._prepareBlock(r,e);var t=this.W,i=this.h[0],s=this.h[1],a=this.h[2],f=this.h[3],u=this.h[4],b=this.h[5],v=this.h[6],w=this.h[7],S=this.h[8],O=this.h[9],P=this.h[10],R=this.h[11],z=this.h[12],W=this.h[13],Q=this.h[14],j=this.h[15];fA(this.k.length===t.length);for(var Y=0;Y<t.length;Y+=2){var U=Q,k=j,V=_A(S,O),A=AA(S,O),F=gA(S,O,P,R,z),ae=vA(S,O,P,R,z,W),de=this.k[Y],L=this.k[Y+1],m=t[Y],c=t[Y+1],p=lA(U,k,V,A,F,ae,de,L,m,c),d=dA(U,k,V,A,F,ae,de,L,m,c);U=yA(i,s),k=wA(i,s),V=bA(i,s,a,f,u),A=mA(i,s,a,f,u,b);var y=Wh(U,k,V,A),M=Jh(U,k,V,A);Q=z,j=W,z=P,W=R,P=S,R=O,S=Wh(v,w,p,d),O=Jh(w,w,p,d),v=u,w=b,u=a,b=f,a=i,f=s,i=Wh(p,d,y,M),s=Jh(p,d,y,M)}vs(this.h,0,i,s),vs(this.h,2,a,f),vs(this.h,4,u,b),vs(this.h,6,v,w),vs(this.h,8,S,O),vs(this.h,10,P,R),vs(this.h,12,z,W),vs(this.h,14,Q,j)},on.prototype._digest=function(r){return r==="hex"?hi.toHex32(this.h,"big"):hi.split32(this.h,"big")};function gA(r,e,t,i,s){var a=r&t^~r&s;return a<0&&(a+=4294967296),a}function vA(r,e,t,i,s,a){var f=e&i^~e&a;return f<0&&(f+=4294967296),f}function bA(r,e,t,i,s){var a=r&t^r&s^t&s;return a<0&&(a+=4294967296),a}function mA(r,e,t,i,s,a){var f=e&i^e&a^i&a;return f<0&&(f+=4294967296),f}function yA(r,e){var t=Pn(r,e,28),i=Pn(e,r,2),s=Pn(e,r,7),a=t^i^s;return a<0&&(a+=4294967296),a}function wA(r,e){var t=On(r,e,28),i=On(e,r,2),s=On(e,r,7),a=t^i^s;return a<0&&(a+=4294967296),a}function _A(r,e){var t=Pn(r,e,14),i=Pn(r,e,18),s=Pn(e,r,9),a=t^i^s;return a<0&&(a+=4294967296),a}function AA(r,e){var t=On(r,e,14),i=On(r,e,18),s=On(e,r,9),a=t^i^s;return a<0&&(a+=4294967296),a}function EA(r,e){var t=Pn(r,e,1),i=Pn(r,e,8),s=ab(r,e,7),a=t^i^s;return a<0&&(a+=4294967296),a}function SA(r,e){var t=On(r,e,1),i=On(r,e,8),s=ob(r,e,7),a=t^i^s;return a<0&&(a+=4294967296),a}function xA(r,e){var t=Pn(r,e,19),i=Pn(e,r,29),s=ab(r,e,6),a=t^i^s;return a<0&&(a+=4294967296),a}function MA(r,e){var t=On(r,e,19),i=On(e,r,29),s=ob(r,e,6),a=t^i^s;return a<0&&(a+=4294967296),a}var Ml=Dt,ub=fb;function es(){if(!(this instanceof es))return new es;ub.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Ml.inherits(es,ub);var IA=es;es.blockSize=1024,es.outSize=384,es.hmacStrength=192,es.padLength=128,es.prototype._digest=function(r){return r==="hex"?Ml.toHex32(this.h.slice(0,12),"big"):Ml.split32(this.h.slice(0,12),"big")},Na.sha1=J9,Na.sha224=oA,Na.sha256=nb,Na.sha384=IA,Na.sha512=fb;var hb={},Zs=Dt,DA=Ya,bf=Zs.rotl32,y1=Zs.sum32,Mo=Zs.sum32_3,w1=Zs.sum32_4,lb=DA.BlockHash;function An(){if(!(this instanceof An))return new An;lb.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Zs.inherits(An,lb),hb.ripemd160=An,An.blockSize=512,An.outSize=160,An.hmacStrength=192,An.padLength=64,An.prototype._update=function(r,e){for(var t=this.h[0],i=this.h[1],s=this.h[2],a=this.h[3],f=this.h[4],u=t,b=i,v=s,w=a,S=f,O=0;O<80;O++){var P=y1(bf(w1(t,_1(O,i,s,a),r[CA[O]+e],PA(O)),NA[O]),f);t=f,f=a,a=bf(s,10),s=i,i=P,P=y1(bf(w1(u,_1(79-O,b,v,w),r[RA[O]+e],OA(O)),TA[O]),S),u=S,S=w,w=bf(v,10),v=b,b=P}P=Mo(this.h[1],s,w),this.h[1]=Mo(this.h[2],a,S),this.h[2]=Mo(this.h[3],f,u),this.h[3]=Mo(this.h[4],t,b),this.h[4]=Mo(this.h[0],i,v),this.h[0]=P},An.prototype._digest=function(r){return r==="hex"?Zs.toHex32(this.h,"little"):Zs.split32(this.h,"little")};function _1(r,e,t,i){return r<=15?e^t^i:r<=31?e&t|~e&i:r<=47?(e|~t)^i:r<=63?e&i|t&~i:e^(t|~i)}function PA(r){return r<=15?0:r<=31?1518500249:r<=47?1859775393:r<=63?2400959708:2840853838}function OA(r){return r<=15?1352829926:r<=31?1548603684:r<=47?1836072691:r<=63?2053994217:0}var CA=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],RA=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],NA=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],TA=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],FA=Dt,BA=sc;function $a(r,e,t){if(!(this instanceof $a))return new $a(r,e,t);this.Hash=r,this.blockSize=r.blockSize/8,this.outSize=r.outSize/8,this.inner=null,this.outer=null,this._init(FA.toArray(e,t))}var qA=$a;$a.prototype._init=function(r){r.length>this.blockSize&&(r=new this.Hash().update(r).digest()),BA(r.length<=this.blockSize);for(var e=r.length;e<this.blockSize;e++)r.push(0);for(e=0;e<r.length;e++)r[e]^=54;for(this.inner=new this.Hash().update(r),e=0;e<r.length;e++)r[e]^=106;this.outer=new this.Hash().update(r)},$a.prototype.update=function(r,e){return this.inner.update(r,e),this},$a.prototype.digest=function(r){return this.outer.update(this.inner.digest()),this.outer.digest(r)},function(r){var e=r;e.utils=Dt,e.common=Ya,e.sha=Na,e.ripemd=hb,e.hmac=qA,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(_n);function Xa(r,e,t){return t={path:e,exports:{},require:function(i,s){return LA(i,s??t.path)}},r(t,t.exports),t.exports}function LA(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var fd=db;function db(r,e){if(!r)throw new Error(e||"Assertion failed")}db.equal=function(r,e,t){if(r!=e)throw new Error(t||"Assertion failed: "+r+" != "+e)};var fn=Xa(function(r,e){var t=e;function i(f,u){if(Array.isArray(f))return f.slice();if(!f)return[];var b=[];if(typeof f!="string"){for(var v=0;v<f.length;v++)b[v]=f[v]|0;return b}if(u==="hex"){f=f.replace(/[^a-z0-9]+/ig,""),f.length%2!==0&&(f="0"+f);for(var v=0;v<f.length;v+=2)b.push(parseInt(f[v]+f[v+1],16))}else for(var v=0;v<f.length;v++){var w=f.charCodeAt(v),S=w>>8,O=w&255;S?b.push(S,O):b.push(O)}return b}t.toArray=i;function s(f){return f.length===1?"0"+f:f}t.zero2=s;function a(f){for(var u="",b=0;b<f.length;b++)u+=s(f[b].toString(16));return u}t.toHex=a,t.encode=function(f,u){return u==="hex"?a(f):f}}),_i=Xa(function(r,e){var t=e;t.assert=fd,t.toArray=fn.toArray,t.zero2=fn.zero2,t.toHex=fn.toHex,t.encode=fn.encode;function i(b,v,w){var S=new Array(Math.max(b.bitLength(),w)+1);S.fill(0);for(var O=1<<v+1,P=b.clone(),R=0;R<S.length;R++){var z,W=P.andln(O-1);P.isOdd()?(W>(O>>1)-1?z=(O>>1)-W:z=W,P.isubn(z)):z=0,S[R]=z,P.iushrn(1)}return S}t.getNAF=i;function s(b,v){var w=[[],[]];b=b.clone(),v=v.clone();for(var S=0,O=0,P;b.cmpn(-S)>0||v.cmpn(-O)>0;){var R=b.andln(3)+S&3,z=v.andln(3)+O&3;R===3&&(R=-1),z===3&&(z=-1);var W;R&1?(P=b.andln(7)+S&7,(P===3||P===5)&&z===2?W=-R:W=R):W=0,w[0].push(W);var Q;z&1?(P=v.andln(7)+O&7,(P===3||P===5)&&R===2?Q=-z:Q=z):Q=0,w[1].push(Q),2*S===W+1&&(S=1-S),2*O===Q+1&&(O=1-O),b.iushrn(1),v.iushrn(1)}return w}t.getJSF=s;function a(b,v,w){var S="_"+v;b.prototype[v]=function(){return this[S]!==void 0?this[S]:this[S]=w.call(this)}}t.cachedProperty=a;function f(b){return typeof b=="string"?t.toArray(b,"hex"):b}t.parseBytes=f;function u(b){return new vt(b,"hex","le")}t.intFromLE=u}),mf=_i.getNAF,UA=_i.getJSF,Vf=_i.assert;function ws(r,e){this.type=r,this.p=new vt(e.p,16),this.red=e.prime?vt.red(e.prime):vt.mont(this.p),this.zero=new vt(0).toRed(this.red),this.one=new vt(1).toRed(this.red),this.two=new vt(2).toRed(this.red),this.n=e.n&&new vt(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var aa=ws;ws.prototype.point=function(){throw new Error("Not implemented")},ws.prototype.validate=function(){throw new Error("Not implemented")},ws.prototype._fixedNafMul=function(r,e){Vf(r.precomputed);var t=r._getDoubles(),i=mf(e,1,this._bitLength),s=(1<<t.step+1)-(t.step%2===0?2:1);s/=3;var a=[],f,u;for(f=0;f<i.length;f+=t.step){u=0;for(var b=f+t.step-1;b>=f;b--)u=(u<<1)+i[b];a.push(u)}for(var v=this.jpoint(null,null,null),w=this.jpoint(null,null,null),S=s;S>0;S--){for(f=0;f<a.length;f++)u=a[f],u===S?w=w.mixedAdd(t.points[f]):u===-S&&(w=w.mixedAdd(t.points[f].neg()));v=v.add(w)}return v.toP()},ws.prototype._wnafMul=function(r,e){var t=4,i=r._getNAFPoints(t);t=i.wnd;for(var s=i.points,a=mf(e,t,this._bitLength),f=this.jpoint(null,null,null),u=a.length-1;u>=0;u--){for(var b=0;u>=0&&a[u]===0;u--)b++;if(u>=0&&b++,f=f.dblp(b),u<0)break;var v=a[u];Vf(v!==0),r.type==="affine"?v>0?f=f.mixedAdd(s[v-1>>1]):f=f.mixedAdd(s[-v-1>>1].neg()):v>0?f=f.add(s[v-1>>1]):f=f.add(s[-v-1>>1].neg())}return r.type==="affine"?f.toP():f},ws.prototype._wnafMulAdd=function(r,e,t,i,s){var a=this._wnafT1,f=this._wnafT2,u=this._wnafT3,b=0,v,w,S;for(v=0;v<i;v++){S=e[v];var O=S._getNAFPoints(r);a[v]=O.wnd,f[v]=O.points}for(v=i-1;v>=1;v-=2){var P=v-1,R=v;if(a[P]!==1||a[R]!==1){u[P]=mf(t[P],a[P],this._bitLength),u[R]=mf(t[R],a[R],this._bitLength),b=Math.max(u[P].length,b),b=Math.max(u[R].length,b);continue}var z=[e[P],null,null,e[R]];e[P].y.cmp(e[R].y)===0?(z[1]=e[P].add(e[R]),z[2]=e[P].toJ().mixedAdd(e[R].neg())):e[P].y.cmp(e[R].y.redNeg())===0?(z[1]=e[P].toJ().mixedAdd(e[R]),z[2]=e[P].add(e[R].neg())):(z[1]=e[P].toJ().mixedAdd(e[R]),z[2]=e[P].toJ().mixedAdd(e[R].neg()));var W=[-3,-1,-5,-7,0,7,5,1,3],Q=UA(t[P],t[R]);for(b=Math.max(Q[0].length,b),u[P]=new Array(b),u[R]=new Array(b),w=0;w<b;w++){var j=Q[0][w]|0,Y=Q[1][w]|0;u[P][w]=W[(j+1)*3+(Y+1)],u[R][w]=0,f[P]=z}}var U=this.jpoint(null,null,null),k=this._wnafT4;for(v=b;v>=0;v--){for(var V=0;v>=0;){var A=!0;for(w=0;w<i;w++)k[w]=u[w][v]|0,k[w]!==0&&(A=!1);if(!A)break;V++,v--}if(v>=0&&V++,U=U.dblp(V),v<0)break;for(w=0;w<i;w++){var F=k[w];F!==0&&(F>0?S=f[w][F-1>>1]:F<0&&(S=f[w][-F-1>>1].neg()),S.type==="affine"?U=U.mixedAdd(S):U=U.add(S))}}for(v=0;v<i;v++)f[v]=null;return s?U:U.toP()};function Ti(r,e){this.curve=r,this.type=e,this.precomputed=null}ws.BasePoint=Ti,Ti.prototype.eq=function(){throw new Error("Not implemented")},Ti.prototype.validate=function(){return this.curve.validate(this)},ws.prototype.decodePoint=function(r,e){r=_i.toArray(r,e);var t=this.p.byteLength();if((r[0]===4||r[0]===6||r[0]===7)&&r.length-1===2*t){r[0]===6?Vf(r[r.length-1]%2===0):r[0]===7&&Vf(r[r.length-1]%2===1);var i=this.point(r.slice(1,1+t),r.slice(1+t,1+2*t));return i}else if((r[0]===2||r[0]===3)&&r.length-1===t)return this.pointFromX(r.slice(1,1+t),r[0]===3);throw new Error("Unknown point format")},Ti.prototype.encodeCompressed=function(r){return this.encode(r,!0)},Ti.prototype._encode=function(r){var e=this.curve.p.byteLength(),t=this.getX().toArray("be",e);return r?[this.getY().isEven()?2:3].concat(t):[4].concat(t,this.getY().toArray("be",e))},Ti.prototype.encode=function(r,e){return _i.encode(this._encode(e),r)},Ti.prototype.precompute=function(r){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,r),e.beta=this._getBeta(),this.precomputed=e,this},Ti.prototype._hasDoubles=function(r){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return e?e.points.length>=Math.ceil((r.bitLength()+1)/e.step):!1},Ti.prototype._getDoubles=function(r,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var t=[this],i=this,s=0;s<e;s+=r){for(var a=0;a<r;a++)i=i.dbl();t.push(i)}return{step:r,points:t}},Ti.prototype._getNAFPoints=function(r){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],t=(1<<r)-1,i=t===1?null:this.dbl(),s=1;s<t;s++)e[s]=e[s-1].add(i);return{wnd:r,points:e}},Ti.prototype._getBeta=function(){return null},Ti.prototype.dblp=function(r){for(var e=this,t=0;t<r;t++)e=e.dbl();return e};var ud=Xa(function(r){typeof Object.create=="function"?r.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:r.exports=function(e,t){if(t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}}}),$A=_i.assert;function Ui(r){aa.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)}ud(Ui,aa);var zA=Ui;Ui.prototype._getEndomorphism=function(r){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var e,t;if(r.beta)e=new vt(r.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);e=i[0].cmp(i[1])<0?i[0]:i[1],e=e.toRed(this.red)}if(r.lambda)t=new vt(r.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(e))===0?t=s[0]:(t=s[1],$A(this.g.mul(t).x.cmp(this.g.x.redMul(e))===0))}var a;return r.basis?a=r.basis.map(function(f){return{a:new vt(f.a,16),b:new vt(f.b,16)}}):a=this._getEndoBasis(t),{beta:e,lambda:t,basis:a}}},Ui.prototype._getEndoRoots=function(r){var e=r===this.p?this.red:vt.mont(r),t=new vt(2).toRed(e).redInvm(),i=t.redNeg(),s=new vt(3).toRed(e).redNeg().redSqrt().redMul(t),a=i.redAdd(s).fromRed(),f=i.redSub(s).fromRed();return[a,f]},Ui.prototype._getEndoBasis=function(r){for(var e=this.n.ushrn(Math.floor(this.n.bitLength()/2)),t=r,i=this.n.clone(),s=new vt(1),a=new vt(0),f=new vt(0),u=new vt(1),b,v,w,S,O,P,R,z=0,W,Q;t.cmpn(0)!==0;){var j=i.div(t);W=i.sub(j.mul(t)),Q=f.sub(j.mul(s));var Y=u.sub(j.mul(a));if(!w&&W.cmp(e)<0)b=R.neg(),v=s,w=W.neg(),S=Q;else if(w&&++z===2)break;R=W,i=t,t=W,f=s,s=Q,u=a,a=Y}O=W.neg(),P=Q;var U=w.sqr().add(S.sqr()),k=O.sqr().add(P.sqr());return k.cmp(U)>=0&&(O=b,P=v),w.negative&&(w=w.neg(),S=S.neg()),O.negative&&(O=O.neg(),P=P.neg()),[{a:w,b:S},{a:O,b:P}]},Ui.prototype._endoSplit=function(r){var e=this.endo.basis,t=e[0],i=e[1],s=i.b.mul(r).divRound(this.n),a=t.b.neg().mul(r).divRound(this.n),f=s.mul(t.a),u=a.mul(i.a),b=s.mul(t.b),v=a.mul(i.b),w=r.sub(f).sub(u),S=b.add(v).neg();return{k1:w,k2:S}},Ui.prototype.pointFromX=function(r,e){r=new vt(r,16),r.red||(r=r.toRed(this.red));var t=r.redSqr().redMul(r).redIAdd(r.redMul(this.a)).redIAdd(this.b),i=t.redSqrt();if(i.redSqr().redSub(t).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(e&&!s||!e&&s)&&(i=i.redNeg()),this.point(r,i)},Ui.prototype.validate=function(r){if(r.inf)return!0;var e=r.x,t=r.y,i=this.a.redMul(e),s=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return t.redSqr().redISub(s).cmpn(0)===0},Ui.prototype._endoWnafMulAdd=function(r,e,t){for(var i=this._endoWnafT1,s=this._endoWnafT2,a=0;a<r.length;a++){var f=this._endoSplit(e[a]),u=r[a],b=u._getBeta();f.k1.negative&&(f.k1.ineg(),u=u.neg(!0)),f.k2.negative&&(f.k2.ineg(),b=b.neg(!0)),i[a*2]=u,i[a*2+1]=b,s[a*2]=f.k1,s[a*2+1]=f.k2}for(var v=this._wnafMulAdd(1,i,s,a*2,t),w=0;w<a*2;w++)i[w]=null,s[w]=null;return v};function br(r,e,t,i){aa.BasePoint.call(this,r,"affine"),e===null&&t===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new vt(e,16),this.y=new vt(t,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}ud(br,aa.BasePoint),Ui.prototype.point=function(r,e,t){return new br(this,r,e,t)},Ui.prototype.pointFromJSON=function(r,e){return br.fromJSON(this,r,e)},br.prototype._getBeta=function(){if(this.curve.endo){var r=this.precomputed;if(r&&r.beta)return r.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(r){var t=this.curve,i=function(s){return t.point(s.x.redMul(t.endo.beta),s.y)};r.beta=e,e.precomputed={beta:null,naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return e}},br.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},br.fromJSON=function(r,e,t){typeof e=="string"&&(e=JSON.parse(e));var i=r.point(e[0],e[1],t);if(!e[2])return i;function s(f){return r.point(f[0],f[1],t)}var a=e[2];return i.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[i].concat(a.doubles.points.map(s))},naf:a.naf&&{wnd:a.naf.wnd,points:[i].concat(a.naf.points.map(s))}},i},br.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},br.prototype.isInfinity=function(){return this.inf},br.prototype.add=function(r){if(this.inf)return r;if(r.inf)return this;if(this.eq(r))return this.dbl();if(this.neg().eq(r))return this.curve.point(null,null);if(this.x.cmp(r.x)===0)return this.curve.point(null,null);var e=this.y.redSub(r.y);e.cmpn(0)!==0&&(e=e.redMul(this.x.redSub(r.x).redInvm()));var t=e.redSqr().redISub(this.x).redISub(r.x),i=e.redMul(this.x.redSub(t)).redISub(this.y);return this.curve.point(t,i)},br.prototype.dbl=function(){if(this.inf)return this;var r=this.y.redAdd(this.y);if(r.cmpn(0)===0)return this.curve.point(null,null);var e=this.curve.a,t=this.x.redSqr(),i=r.redInvm(),s=t.redAdd(t).redIAdd(t).redIAdd(e).redMul(i),a=s.redSqr().redISub(this.x.redAdd(this.x)),f=s.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,f)},br.prototype.getX=function(){return this.x.fromRed()},br.prototype.getY=function(){return this.y.fromRed()},br.prototype.mul=function(r){return r=new vt(r,16),this.isInfinity()?this:this._hasDoubles(r)?this.curve._fixedNafMul(this,r):this.curve.endo?this.curve._endoWnafMulAdd([this],[r]):this.curve._wnafMul(this,r)},br.prototype.mulAdd=function(r,e,t){var i=[this,e],s=[r,t];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},br.prototype.jmulAdd=function(r,e,t){var i=[this,e],s=[r,t];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},br.prototype.eq=function(r){return this===r||this.inf===r.inf&&(this.inf||this.x.cmp(r.x)===0&&this.y.cmp(r.y)===0)},br.prototype.neg=function(r){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(r&&this.precomputed){var t=this.precomputed,i=function(s){return s.neg()};e.precomputed={naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(i)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(i)}}}return e},br.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var r=this.curve.jpoint(this.x,this.y,this.curve.one);return r};function Mr(r,e,t,i){aa.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new vt(0)):(this.x=new vt(e,16),this.y=new vt(t,16),this.z=new vt(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}ud(Mr,aa.BasePoint),Ui.prototype.jpoint=function(r,e,t){return new Mr(this,r,e,t)},Mr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var r=this.z.redInvm(),e=r.redSqr(),t=this.x.redMul(e),i=this.y.redMul(e).redMul(r);return this.curve.point(t,i)},Mr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Mr.prototype.add=function(r){if(this.isInfinity())return r;if(r.isInfinity())return this;var e=r.z.redSqr(),t=this.z.redSqr(),i=this.x.redMul(e),s=r.x.redMul(t),a=this.y.redMul(e.redMul(r.z)),f=r.y.redMul(t.redMul(this.z)),u=i.redSub(s),b=a.redSub(f);if(u.cmpn(0)===0)return b.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var v=u.redSqr(),w=v.redMul(u),S=i.redMul(v),O=b.redSqr().redIAdd(w).redISub(S).redISub(S),P=b.redMul(S.redISub(O)).redISub(a.redMul(w)),R=this.z.redMul(r.z).redMul(u);return this.curve.jpoint(O,P,R)},Mr.prototype.mixedAdd=function(r){if(this.isInfinity())return r.toJ();if(r.isInfinity())return this;var e=this.z.redSqr(),t=this.x,i=r.x.redMul(e),s=this.y,a=r.y.redMul(e).redMul(this.z),f=t.redSub(i),u=s.redSub(a);if(f.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var b=f.redSqr(),v=b.redMul(f),w=t.redMul(b),S=u.redSqr().redIAdd(v).redISub(w).redISub(w),O=u.redMul(w.redISub(S)).redISub(s.redMul(v)),P=this.z.redMul(f);return this.curve.jpoint(S,O,P)},Mr.prototype.dblp=function(r){if(r===0)return this;if(this.isInfinity())return this;if(!r)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var t=this;for(e=0;e<r;e++)t=t.dbl();return t}var i=this.curve.a,s=this.curve.tinv,a=this.x,f=this.y,u=this.z,b=u.redSqr().redSqr(),v=f.redAdd(f);for(e=0;e<r;e++){var w=a.redSqr(),S=v.redSqr(),O=S.redSqr(),P=w.redAdd(w).redIAdd(w).redIAdd(i.redMul(b)),R=a.redMul(S),z=P.redSqr().redISub(R.redAdd(R)),W=R.redISub(z),Q=P.redMul(W);Q=Q.redIAdd(Q).redISub(O);var j=v.redMul(u);e+1<r&&(b=b.redMul(O)),a=z,u=j,v=Q}return this.curve.jpoint(a,v.redMul(s),u)},Mr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},Mr.prototype._zeroDbl=function(){var r,e,t;if(this.zOne){var i=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),f=this.x.redAdd(s).redSqr().redISub(i).redISub(a);f=f.redIAdd(f);var u=i.redAdd(i).redIAdd(i),b=u.redSqr().redISub(f).redISub(f),v=a.redIAdd(a);v=v.redIAdd(v),v=v.redIAdd(v),r=b,e=u.redMul(f.redISub(b)).redISub(v),t=this.y.redAdd(this.y)}else{var w=this.x.redSqr(),S=this.y.redSqr(),O=S.redSqr(),P=this.x.redAdd(S).redSqr().redISub(w).redISub(O);P=P.redIAdd(P);var R=w.redAdd(w).redIAdd(w),z=R.redSqr(),W=O.redIAdd(O);W=W.redIAdd(W),W=W.redIAdd(W),r=z.redISub(P).redISub(P),e=R.redMul(P.redISub(r)).redISub(W),t=this.y.redMul(this.z),t=t.redIAdd(t)}return this.curve.jpoint(r,e,t)},Mr.prototype._threeDbl=function(){var r,e,t;if(this.zOne){var i=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),f=this.x.redAdd(s).redSqr().redISub(i).redISub(a);f=f.redIAdd(f);var u=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),b=u.redSqr().redISub(f).redISub(f);r=b;var v=a.redIAdd(a);v=v.redIAdd(v),v=v.redIAdd(v),e=u.redMul(f.redISub(b)).redISub(v),t=this.y.redAdd(this.y)}else{var w=this.z.redSqr(),S=this.y.redSqr(),O=this.x.redMul(S),P=this.x.redSub(w).redMul(this.x.redAdd(w));P=P.redAdd(P).redIAdd(P);var R=O.redIAdd(O);R=R.redIAdd(R);var z=R.redAdd(R);r=P.redSqr().redISub(z),t=this.y.redAdd(this.z).redSqr().redISub(S).redISub(w);var W=S.redSqr();W=W.redIAdd(W),W=W.redIAdd(W),W=W.redIAdd(W),e=P.redMul(R.redISub(r)).redISub(W)}return this.curve.jpoint(r,e,t)},Mr.prototype._dbl=function(){var r=this.curve.a,e=this.x,t=this.y,i=this.z,s=i.redSqr().redSqr(),a=e.redSqr(),f=t.redSqr(),u=a.redAdd(a).redIAdd(a).redIAdd(r.redMul(s)),b=e.redAdd(e);b=b.redIAdd(b);var v=b.redMul(f),w=u.redSqr().redISub(v.redAdd(v)),S=v.redISub(w),O=f.redSqr();O=O.redIAdd(O),O=O.redIAdd(O),O=O.redIAdd(O);var P=u.redMul(S).redISub(O),R=t.redAdd(t).redMul(i);return this.curve.jpoint(w,P,R)},Mr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var r=this.x.redSqr(),e=this.y.redSqr(),t=this.z.redSqr(),i=e.redSqr(),s=r.redAdd(r).redIAdd(r),a=s.redSqr(),f=this.x.redAdd(e).redSqr().redISub(r).redISub(i);f=f.redIAdd(f),f=f.redAdd(f).redIAdd(f),f=f.redISub(a);var u=f.redSqr(),b=i.redIAdd(i);b=b.redIAdd(b),b=b.redIAdd(b),b=b.redIAdd(b);var v=s.redIAdd(f).redSqr().redISub(a).redISub(u).redISub(b),w=e.redMul(v);w=w.redIAdd(w),w=w.redIAdd(w);var S=this.x.redMul(u).redISub(w);S=S.redIAdd(S),S=S.redIAdd(S);var O=this.y.redMul(v.redMul(b.redISub(v)).redISub(f.redMul(u)));O=O.redIAdd(O),O=O.redIAdd(O),O=O.redIAdd(O);var P=this.z.redAdd(f).redSqr().redISub(t).redISub(u);return this.curve.jpoint(S,O,P)},Mr.prototype.mul=function(r,e){return r=new vt(r,e),this.curve._wnafMul(this,r)},Mr.prototype.eq=function(r){if(r.type==="affine")return this.eq(r.toJ());if(this===r)return!0;var e=this.z.redSqr(),t=r.z.redSqr();if(this.x.redMul(t).redISub(r.x.redMul(e)).cmpn(0)!==0)return!1;var i=e.redMul(this.z),s=t.redMul(r.z);return this.y.redMul(s).redISub(r.y.redMul(i)).cmpn(0)===0},Mr.prototype.eqXToP=function(r){var e=this.z.redSqr(),t=r.toRed(this.curve.red).redMul(e);if(this.x.cmp(t)===0)return!0;for(var i=r.clone(),s=this.curve.redN.redMul(e);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(s),this.x.cmp(t)===0)return!0}},Mr.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)+">"},Mr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Of=Xa(function(r,e){var t=e;t.base=aa,t.short=zA,t.mont=null,t.edwards=null}),Cf=Xa(function(r,e){var t=e,i=_i.assert;function s(u){u.type==="short"?this.curve=new Of.short(u):u.type==="edwards"?this.curve=new Of.edwards(u):this.curve=new Of.mont(u),this.g=this.curve.g,this.n=this.curve.n,this.hash=u.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}t.PresetCurve=s;function a(u,b){Object.defineProperty(t,u,{configurable:!0,enumerable:!0,get:function(){var v=new s(b);return Object.defineProperty(t,u,{configurable:!0,enumerable:!0,value:v}),v}})}a("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:_n.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("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:_n.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("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:_n.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("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:_n.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"]}),a("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:_n.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"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:_n.sha256,gRed:!1,g:["9"]}),a("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:_n.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var f;try{f=null.crash()}catch{f=void 0}a("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:_n.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",f]})});function _s(r){if(!(this instanceof _s))return new _s(r);this.hash=r.hash,this.predResist=!!r.predResist,this.outLen=this.hash.outSize,this.minEntropy=r.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=fn.toArray(r.entropy,r.entropyEnc||"hex"),t=fn.toArray(r.nonce,r.nonceEnc||"hex"),i=fn.toArray(r.pers,r.persEnc||"hex");fd(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,i)}var A1=_s;_s.prototype._init=function(r,e,t){var i=r.concat(e).concat(t);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},_s.prototype._hmac=function(){return new _n.hmac(this.hash,this.K)},_s.prototype._update=function(r){var e=this._hmac().update(this.V).update([0]);r&&(e=e.update(r)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),r&&(this.K=this._hmac().update(this.V).update([1]).update(r).digest(),this.V=this._hmac().update(this.V).digest())},_s.prototype.reseed=function(r,e,t,i){typeof e!="string"&&(i=t,t=e,e=null),r=fn.toArray(r,e),t=fn.toArray(t,i),fd(r.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(r.concat(t||[])),this._reseed=1},_s.prototype.generate=function(r,e,t,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof e!="string"&&(i=t,t=e,e=null),t&&(t=fn.toArray(t,i||"hex"),this._update(t));for(var s=[];s.length<r;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var a=s.slice(0,r);return this._update(t),this._reseed++,fn.encode(a,e)};var Yh=_i.assert;function Ur(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 Qh=Ur;Ur.fromPublic=function(r,e,t){return e instanceof Ur?e:new Ur(r,{pub:e,pubEnc:t})},Ur.fromPrivate=function(r,e,t){return e instanceof Ur?e:new Ur(r,{priv:e,privEnc:t})},Ur.prototype.validate=function(){var r=this.getPublic();return r.isInfinity()?{result:!1,reason:"Invalid public key"}:r.validate()?r.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"}},Ur.prototype.getPublic=function(r,e){return typeof r=="string"&&(e=r,r=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,r):this.pub},Ur.prototype.getPrivate=function(r){return r==="hex"?this.priv.toString(16,2):this.priv},Ur.prototype._importPrivate=function(r,e){this.priv=new vt(r,e||16),this.priv=this.priv.umod(this.ec.curve.n)},Ur.prototype._importPublic=function(r,e){if(r.x||r.y){this.ec.curve.type==="mont"?Yh(r.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Yh(r.x&&r.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(r.x,r.y);return}this.pub=this.ec.curve.decodePoint(r,e)},Ur.prototype.derive=function(r){return r.validate()||Yh(r.validate(),"public point not validated"),r.mul(this.priv).getX()},Ur.prototype.sign=function(r,e,t){return this.ec.sign(r,this,e,t)},Ur.prototype.verify=function(r,e){return this.ec.verify(r,e,this)},Ur.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var jA=_i.assert;function du(r,e){if(r instanceof du)return r;this._importDER(r,e)||(jA(r.r&&r.s,"Signature without r or s"),this.r=new vt(r.r,16),this.s=new vt(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}var yf=du;function kA(){this.place=0}function Xh(r,e){var t=r[e.place++];if(!(t&128))return t;var i=t&15;if(i===0||i>4)return!1;for(var s=0,a=0,f=e.place;a<i;a++,f++)s<<=8,s|=r[f],s>>>=0;return s<=127?!1:(e.place=f,s)}function E1(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)}du.prototype._importDER=function(r,e){r=_i.toArray(r,e);var t=new kA;if(r[t.place++]!==48)return!1;var i=Xh(r,t);if(i===!1||i+t.place!==r.length||r[t.place++]!==2)return!1;var s=Xh(r,t);if(s===!1)return!1;var a=r.slice(t.place,s+t.place);if(t.place+=s,r[t.place++]!==2)return!1;var f=Xh(r,t);if(f===!1||r.length!==f+t.place)return!1;var u=r.slice(t.place,f+t.place);if(a[0]===0)if(a[1]&128)a=a.slice(1);else return!1;if(u[0]===0)if(u[1]&128)u=u.slice(1);else return!1;return this.r=new vt(a),this.s=new vt(u),this.recoveryParam=null,!0};function Zh(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)}du.prototype.toDER=function(r){var e=this.r.toArray(),t=this.s.toArray();for(e[0]&128&&(e=[0].concat(e)),t[0]&128&&(t=[0].concat(t)),e=E1(e),t=E1(t);!t[0]&&!(t[1]&128);)t=t.slice(1);var i=[2];Zh(i,e.length),i=i.concat(e),i.push(2),Zh(i,t.length);var s=i.concat(t),a=[48];return Zh(a,s.length),a=a.concat(s),_i.encode(a,r)};var HA=function(){throw new Error("unsupported")},pb=_i.assert;function qi(r){if(!(this instanceof qi))return new qi(r);typeof r=="string"&&(pb(Object.prototype.hasOwnProperty.call(Cf,r),"Unknown curve "+r),r=Cf[r]),r instanceof Cf.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 KA=qi;qi.prototype.keyPair=function(r){return new Qh(this,r)},qi.prototype.keyFromPrivate=function(r,e){return Qh.fromPrivate(this,r,e)},qi.prototype.keyFromPublic=function(r,e){return Qh.fromPublic(this,r,e)},qi.prototype.genKeyPair=function(r){r||(r={});for(var e=new A1({hash:this.hash,pers:r.pers,persEnc:r.persEnc||"utf8",entropy:r.entropy||HA(this.hash.hmacStrength),entropyEnc:r.entropy&&r.entropyEnc||"utf8",nonce:this.n.toArray()}),t=this.n.byteLength(),i=this.n.sub(new vt(2));;){var s=new vt(e.generate(t));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},qi.prototype._truncateToN=function(r,e){var t=r.byteLength()*8-this.n.bitLength();return t>0&&(r=r.ushrn(t)),!e&&r.cmp(this.n)>=0?r.sub(this.n):r},qi.prototype.sign=function(r,e,t,i){typeof t=="object"&&(i=t,t=null),i||(i={}),e=this.keyFromPrivate(e,t),r=this._truncateToN(new vt(r,16));for(var s=this.n.byteLength(),a=e.getPrivate().toArray("be",s),f=r.toArray("be",s),u=new A1({hash:this.hash,entropy:a,nonce:f,pers:i.pers,persEnc:i.persEnc||"utf8"}),b=this.n.sub(new vt(1)),v=0;;v++){var w=i.k?i.k(v):new vt(u.generate(this.n.byteLength()));if(w=this._truncateToN(w,!0),!(w.cmpn(1)<=0||w.cmp(b)>=0)){var S=this.g.mul(w);if(!S.isInfinity()){var O=S.getX(),P=O.umod(this.n);if(P.cmpn(0)!==0){var R=w.invm(this.n).mul(P.mul(e.getPrivate()).iadd(r));if(R=R.umod(this.n),R.cmpn(0)!==0){var z=(S.getY().isOdd()?1:0)|(O.cmp(P)!==0?2:0);return i.canonical&&R.cmp(this.nh)>0&&(R=this.n.sub(R),z^=1),new yf({r:P,s:R,recoveryParam:z})}}}}}},qi.prototype.verify=function(r,e,t,i){r=this._truncateToN(new vt(r,16)),t=this.keyFromPublic(t,i),e=new yf(e,"hex");var s=e.r,a=e.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var f=a.invm(this.n),u=f.mul(r).umod(this.n),b=f.mul(s).umod(this.n),v;return this.curve._maxwellTrick?(v=this.g.jmulAdd(u,t.getPublic(),b),v.isInfinity()?!1:v.eqXToP(s)):(v=this.g.mulAdd(u,t.getPublic(),b),v.isInfinity()?!1:v.getX().umod(this.n).cmp(s)===0)},qi.prototype.recoverPubKey=function(r,e,t,i){pb((3&t)===t,"The recovery param is more than two bits"),e=new yf(e,i);var s=this.n,a=new vt(r),f=e.r,u=e.s,b=t&1,v=t>>1;if(f.cmp(this.curve.p.umod(this.curve.n))>=0&&v)throw new Error("Unable to find sencond key candinate");v?f=this.curve.pointFromX(f.add(this.curve.n),b):f=this.curve.pointFromX(f,b);var w=e.r.invm(s),S=s.sub(a).mul(w).umod(s),O=u.mul(w).umod(s);return this.g.mulAdd(S,f,O)},qi.prototype.getKeyRecoveryParam=function(r,e,t,i){if(e=new yf(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var s=0;s<4;s++){var a;try{a=this.recoverPubKey(r,e,s)}catch{continue}if(a.eq(t))return s}throw new Error("Unable to find valid recovery factor")};var VA=Xa(function(r,e){var t=e;t.version="6.5.4",t.utils=_i,t.rand=function(){throw new Error("unsupported")},t.curve=Of,t.curves=Cf,t.ec=KA,t.eddsa=null}),GA=VA.ec;const WA="signing-key/5.7.0",Il=new Ir(WA);let el=null;function ms(){return el||(el=new GA("secp256k1")),el}class JA{constructor(e){So(this,"curve","secp256k1"),So(this,"privateKey",ci(e)),R7(this.privateKey)!==32&&Il.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=ms().keyFromPrivate(tr(this.privateKey));So(this,"publicKey","0x"+t.getPublic(!1,"hex")),So(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),So(this,"_isSigningKey",!0)}_addPoint(e){const t=ms().keyFromPublic(tr(this.publicKey)),i=ms().keyFromPublic(tr(e));return"0x"+t.pub.add(i.pub).encodeCompressed("hex")}signDigest(e){const t=ms().keyFromPrivate(tr(this.privateKey)),i=tr(e);i.length!==32&&Il.throwArgumentError("bad digest length","digest",e);const s=t.sign(i,{canonical:!0});return Uv({recoveryParam:s.recoveryParam,r:In("0x"+s.r.toString(16),32),s:In("0x"+s.s.toString(16),32)})}computeSharedSecret(e){const t=ms().keyFromPrivate(tr(this.privateKey)),i=ms().keyFromPublic(tr(gb(e)));return In("0x"+t.derive(i.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function YA(r,e){const t=Uv(e),i={r:tr(t.r),s:tr(t.s)};return"0x"+ms().recoverPubKey(tr(r),i,t.recoveryParam).encode("hex",!1)}function gb(r,e){const t=tr(r);return t.length===32?new JA(t).publicKey:t.length===33?"0x"+ms().keyFromPublic(t).getPublic(!1,"hex"):t.length===65?ci(t):Il.throwArgumentError("invalid public or private key","key","[REDACTED]")}var S1;(function(r){r[r.legacy=0]="legacy",r[r.eip2930=1]="eip2930",r[r.eip1559=2]="eip1559"})(S1||(S1={}));function QA(r){const e=gb(r);return c9(f1(ad(f1(e,1)),12))}function XA(r,e){return QA(YA(tr(r),e))}const ZA="https://rpc.walletconnect.org/v1";async function eE(r,e,t,i,s,a){switch(t.t){case"eip191":return tE(r,e,t.s);case"eip1271":return await rE(r,e,t.s,i,s,a);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${t.t}`)}}function tE(r,e,t){return XA(Wv(e),t).toLowerCase()===r.toLowerCase()}async function rE(r,e,t,i,s,a){try{const f="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",b="0000000000000000000000000000000000000000000000000000000000000041",v=t.substring(2),w=Wv(e).substring(2),S=f+w+u+b+v,O=await fetch(`${a||ZA}/?chainId=${i}&projectId=${s}`,{method:"POST",body:JSON.stringify({id:iE(),jsonrpc:"2.0",method:"eth_call",params:[{to:r,data:S},"latest"]})}),{result:P}=await O.json();return P?P.slice(0,f.length).toLowerCase()===f.toLowerCase():!1}catch(f){return console.error("isValidEip1271Signature: ",f),!1}}function iE(){return Date.now()+Math.floor(Math.random()*1e3)}var nE=Object.defineProperty,sE=Object.defineProperties,aE=Object.getOwnPropertyDescriptors,x1=Object.getOwnPropertySymbols,oE=Object.prototype.hasOwnProperty,cE=Object.prototype.propertyIsEnumerable,M1=(r,e,t)=>e in r?nE(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,fE=(r,e)=>{for(var t in e||(e={}))oE.call(e,t)&&M1(r,t,e[t]);if(x1)for(var t of x1(e))cE.call(e,t)&&M1(r,t,e[t]);return r},uE=(r,e)=>sE(r,aE(e));const hE="did:pkh:",hd=r=>r==null?void 0:r.split(":"),vb=r=>{const e=r&&hd(r);if(e)return r.includes(hE)?e[3]:e[1]},I1=r=>{const e=r&&hd(r);if(e)return e[2]+":"+e[3]},Gf=r=>{const e=r&&hd(r);if(e)return e.pop()};async function D1(r){const{cacao:e,projectId:t}=r,{s:i,p:s}=e,a=bb(s,s.iss),f=Gf(s.iss);return await eE(f,a,i,vb(s.iss),t)}const bb=(r,e)=>{const t=`${r.domain} wants you to sign in with your Ethereum account:`,i=Gf(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 a=`URI: ${r.aud||r.uri}`,f=`Version: ${r.version}`,u=`Chain ID: ${vb(e)}`,b=`Nonce: ${r.nonce}`,v=`Issued At: ${r.iat}`,w=r.exp?`Expiration Time: ${r.exp}`:void 0,S=r.nbf?`Not Before: ${r.nbf}`:void 0,O=r.requestId?`Request ID: ${r.requestId}`:void 0,P=r.resources?`Resources:${r.resources.map(z=>`
|
|
24
|
+
- ${z}`).join("")}`:void 0,R=Rf(r.resources);if(R){const z=Vo(R);s=wE(s,z)}return[t,i,"",s,"",a,f,u,b,v,w,S,O,P].filter(z=>z!=null).join(`
|
|
25
|
+
`)};function lE(r){return Buffer.from(JSON.stringify(r)).toString("base64")}function dE(r){return JSON.parse(Buffer.from(r,"base64").toString("utf-8"))}function ta(r){if(!r)throw new Error("No recap provided, value is undefined");if(!r.att)throw new Error("No `att` property found");const e=Object.keys(r.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(t=>{const i=r.att[t];if(Array.isArray(i))throw new Error(`Resource must be an object: ${t}`);if(typeof i!="object")throw new Error(`Resource must be an object: ${t}`);if(!Object.keys(i).length)throw new Error(`Resource object is empty: ${t}`);Object.keys(i).forEach(s=>{const a=i[s];if(!Array.isArray(a))throw new Error(`Ability limits ${s} must be an array of objects, found: ${a}`);if(!a.length)throw new Error(`Value of ${s} is empty array, must be an array with objects`);a.forEach(f=>{if(typeof f!="object")throw new Error(`Ability limits (${s}) must be an array of objects, found: ${f}`)})})})}function pE(r,e,t,i={}){return t==null||t.sort((s,a)=>s.localeCompare(a)),{att:{[r]:gE(e,t,i)}}}function gE(r,e,t={}){e=e==null?void 0:e.sort((s,a)=>s.localeCompare(a));const i=e.map(s=>({[`${r}/${s}`]:[t]}));return Object.assign({},...i)}function mb(r){return ta(r),`urn:recap:${lE(r).replace(/=/g,"")}`}function Vo(r){const e=dE(r.replace("urn:recap:",""));return ta(e),e}function vE(r,e,t){const i=pE(r,e,t);return mb(i)}function bE(r){return r&&r.includes("urn:recap:")}function mE(r,e){const t=Vo(r),i=Vo(e),s=yE(t,i);return mb(s)}function yE(r,e){ta(r),ta(e);const t=Object.keys(r.att).concat(Object.keys(e.att)).sort((s,a)=>s.localeCompare(a)),i={att:{}};return t.forEach(s=>{var a,f;Object.keys(((a=r.att)==null?void 0:a[s])||{}).concat(Object.keys(((f=e.att)==null?void 0:f[s])||{})).sort((u,b)=>u.localeCompare(b)).forEach(u=>{var b,v;i.att[s]=uE(fE({},i.att[s]),{[u]:((b=r.att[s])==null?void 0:b[u])||((v=e.att[s])==null?void 0:v[u])})})}),i}function wE(r="",e){ta(e);const t="I further authorize the stated URI to perform the following actions on my behalf: ";if(r.includes(t))return r;const i=[];let s=0;Object.keys(e.att).forEach(u=>{const b=Object.keys(e.att[u]).map(S=>({ability:S.split("/")[0],action:S.split("/")[1]}));b.sort((S,O)=>S.action.localeCompare(O.action));const v={};b.forEach(S=>{v[S.ability]||(v[S.ability]=[]),v[S.ability].push(S.action)});const w=Object.keys(v).map(S=>(s++,`(${s}) '${S}': '${v[S].join("', '")}' for '${u}'.`));i.push(w.join(", ").replace(".,","."))});const a=i.join(" "),f=`${t}${a}`;return`${r?r+" ":""}${f}`}function P1(r){var e;const t=Vo(r);ta(t);const i=(e=t.att)==null?void 0:e.eip155;return i?Object.keys(i).map(s=>s.split("/")[1]):[]}function O1(r){const e=Vo(r);ta(e);const t=[];return Object.values(e.att).forEach(i=>{Object.values(i).forEach(s=>{var a;(a=s==null?void 0:s[0])!=null&&a.chains&&t.push(s[0].chains)})}),[...new Set(t.flat())]}function Rf(r){if(!r)return;const e=r==null?void 0:r[r.length-1];return bE(e)?e:void 0}const yb="base10",Jr="base16",Es="base64pad",Io="base64url",ac="utf8",wb=0,rs=1,oc=2,_E=0,C1=1,$o=12,ld=32;function AE(){const r=Yl.generateKeyPair();return{privateKey:_r(r.secretKey,Jr),publicKey:_r(r.publicKey,Jr)}}function Dl(){const r=ia.randomBytes(ld);return _r(r,Jr)}function EE(r,e){const t=Yl.sharedKey(wr(r,Jr),wr(e,Jr),!0),i=new r4(Zo.SHA256,t).expand(ld);return _r(i,Jr)}function Nf(r){const e=Zo.hash(wr(r,Jr));return _r(e,Jr)}function Xn(r){const e=Zo.hash(wr(r,ac));return _r(e,Jr)}function _b(r){return wr(`${r}`,yb)}function ra(r){return Number(_r(r,yb))}function SE(r){const e=_b(typeof r.type<"u"?r.type:wb);if(ra(e)===rs&&typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const t=typeof r.senderPublicKey<"u"?wr(r.senderPublicKey,Jr):void 0,i=typeof r.iv<"u"?wr(r.iv,Jr):ia.randomBytes($o),s=new Wl.ChaCha20Poly1305(wr(r.symKey,Jr)).seal(i,wr(r.message,ac));return Ab({type:e,sealed:s,iv:i,senderPublicKey:t,encoding:r.encoding})}function xE(r,e){const t=_b(oc),i=ia.randomBytes($o),s=wr(r,ac);return Ab({type:t,sealed:s,iv:i,encoding:e})}function ME(r){const e=new Wl.ChaCha20Poly1305(wr(r.symKey,Jr)),{sealed:t,iv:i}=Go({encoded:r.encoded,encoding:r==null?void 0:r.encoding}),s=e.open(i,t);if(s===null)throw new Error("Failed to decrypt");return _r(s,ac)}function IE(r,e){const{sealed:t}=Go({encoded:r,encoding:e});return _r(t,ac)}function Ab(r){const{encoding:e=Es}=r;if(ra(r.type)===oc)return _r(If([r.type,r.sealed]),e);if(ra(r.type)===rs){if(typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return _r(If([r.type,r.senderPublicKey,r.iv,r.sealed]),e)}return _r(If([r.type,r.iv,r.sealed]),e)}function Go(r){const{encoded:e,encoding:t=Es}=r,i=wr(e,t),s=i.slice(_E,C1),a=C1;if(ra(s)===rs){const v=a+ld,w=v+$o,S=i.slice(a,v),O=i.slice(v,w),P=i.slice(w);return{type:s,sealed:P,iv:O,senderPublicKey:S}}if(ra(s)===oc){const v=i.slice(a),w=ia.randomBytes($o);return{type:s,sealed:v,iv:w}}const f=a+$o,u=i.slice(a,f),b=i.slice(f);return{type:s,sealed:b,iv:u}}function DE(r,e){const t=Go({encoded:r,encoding:e==null?void 0:e.encoding});return Eb({type:ra(t.type),senderPublicKey:typeof t.senderPublicKey<"u"?_r(t.senderPublicKey,Jr):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function Eb(r){const e=(r==null?void 0:r.type)||wb;if(e===rs){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 R1(r){return r.type===rs&&typeof r.senderPublicKey=="string"&&typeof r.receiverPublicKey=="string"}function N1(r){return r.type===oc}function PE(r){return new gv.ec("p256").keyFromPublic({x:Buffer.from(r.x,"base64").toString("hex"),y:Buffer.from(r.y,"base64").toString("hex")},"hex")}function OE(r){let e=r.replace(/-/g,"+").replace(/_/g,"/");const t=e.length%4;return t>0&&(e+="=".repeat(4-t)),e}function CE(r){return Buffer.from(OE(r),"base64")}function RE(r,e){const[t,i,s]=r.split("."),a=CE(s);if(a.length!==64)throw new Error("Invalid signature length");const f=a.slice(0,32).toString("hex"),u=a.slice(32,64).toString("hex"),b=`${t}.${i}`,v=new Zo.SHA256().update(Buffer.from(b)).digest(),w=PE(e),S=Buffer.from(v).toString("hex");if(!w.verify(S,{r:f,s:u}))throw new Error("Invalid signature");return _l(r).payload}const NE="irn";function Pl(r){return(r==null?void 0:r.relay)||{protocol:NE}}function Fo(r){const e=n7[r];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${r}`);return e}var TE=Object.defineProperty,FE=Object.defineProperties,BE=Object.getOwnPropertyDescriptors,T1=Object.getOwnPropertySymbols,qE=Object.prototype.hasOwnProperty,LE=Object.prototype.propertyIsEnumerable,F1=(r,e,t)=>e in r?TE(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,B1=(r,e)=>{for(var t in e||(e={}))qE.call(e,t)&&F1(r,t,e[t]);if(T1)for(var t of T1(e))LE.call(e,t)&&F1(r,t,e[t]);return r},UE=(r,e)=>FE(r,BE(e));function $E(r,e="-"){const t={},i="relay"+e;return Object.keys(r).forEach(s=>{if(s.startsWith(i)){const a=s.replace(i,""),f=r[s];t[a]=f}}),t}function q1(r){if(!r.includes("wc:")){const b=Fv(r);b!=null&&b.includes("wc:")&&(r=b)}r=r.includes("wc://")?r.replace("wc://",""):r,r=r.includes("wc:")?r.replace("wc:",""):r;const e=r.indexOf(":"),t=r.indexOf("?")!==-1?r.indexOf("?"):void 0,i=r.substring(0,e),s=r.substring(e+1,t).split("@"),a=typeof t<"u"?r.substring(t):"",f=Ho.parse(a),u=typeof f.methods=="string"?f.methods.split(","):void 0;return{protocol:i,topic:zE(s[0]),version:parseInt(s[1],10),symKey:f.symKey,relay:$E(f),methods:u,expiryTimestamp:f.expiryTimestamp?parseInt(f.expiryTimestamp,10):void 0}}function zE(r){return r.startsWith("//")?r.substring(2):r}function jE(r,e="-"){const t="relay",i={};return Object.keys(r).forEach(s=>{const a=t+e+s;r[s]&&(i[a]=r[s])}),i}function L1(r){return`${r.protocol}:${r.topic}@${r.version}?`+Ho.stringify(B1(UE(B1({symKey:r.symKey},jE(r.relay)),{expiryTimestamp:r.expiryTimestamp}),r.methods?{methods:r.methods.join(",")}:{}))}function wf(r,e,t){return`${r}?wc_ev=${t}&topic=${e}`}function Za(r){const e=[];return r.forEach(t=>{const[i,s]=t.split(":");e.push(`${i}:${s}`)}),e}function kE(r){const e=[];return Object.values(r).forEach(t=>{e.push(...Za(t.accounts))}),e}function HE(r,e){const t=[];return Object.values(r).forEach(i=>{Za(i.accounts).includes(e)&&t.push(...i.methods)}),t}function KE(r,e){const t=[];return Object.values(r).forEach(i=>{Za(i.accounts).includes(e)&&t.push(...i.events)}),t}function dd(r){return r.includes(":")}function Bo(r){return dd(r)?r.split(":")[0]:r}function VE(r){const e={};return r==null||r.forEach(t=>{const[i,s]=t.split(":");e[i]||(e[i]={accounts:[],chains:[],events:[]}),e[i].accounts.push(t),e[i].chains.push(`${i}:${s}`)}),e}function U1(r,e){e=e.map(i=>i.replace("did:pkh:",""));const t=VE(e);for(const[i,s]of Object.entries(t))s.methods?s.methods=Df(s.methods,r):s.methods=r,s.events=["chainChanged","accountsChanged"];return t}const GE={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}},WE={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 Ae(r,e){const{message:t,code:i}=WE[r];return{message:e?`${t} ${e}`:t,code:i}}function qt(r,e){const{message:t,code:i}=GE[r];return{message:e?`${t} ${e}`:t,code:i}}function Rn(r,e){return!!Array.isArray(r)}function Wo(r){return Object.getPrototypeOf(r)===Object.prototype&&Object.keys(r).length}function fi(r){return typeof r>"u"}function or(r,e){return e&&fi(r)?!0:typeof r=="string"&&!!r.trim().length}function pd(r,e){return typeof r=="number"&&!isNaN(r)}function JE(r,e){const{requiredNamespaces:t}=e,i=Object.keys(r.namespaces),s=Object.keys(t);let a=!0;return Ys(s,i)?(i.forEach(f=>{const{accounts:u,methods:b,events:v}=r.namespaces[f],w=Za(u),S=t[f];(!Ys(Dv(f,S),w)||!Ys(S.methods,b)||!Ys(S.events,v))&&(a=!1)}),a):!1}function Wf(r){return or(r,!1)&&r.includes(":")?r.split(":").length===2:!1}function YE(r){if(or(r,!1)&&r.includes(":")){const e=r.split(":");if(e.length===3){const t=e[0]+":"+e[1];return!!e[2]&&Wf(t)}}return!1}function QE(r){function e(t){try{return typeof new URL(t)<"u"}catch{return!1}}try{if(or(r,!1)){if(e(r))return!0;const t=Fv(r);return e(t)}}catch{}return!1}function XE(r){var e;return(e=r==null?void 0:r.proposer)==null?void 0:e.publicKey}function ZE(r){return r==null?void 0:r.topic}function eS(r,e){let t=null;return or(r==null?void 0:r.publicKey,!1)||(t=Ae("MISSING_OR_INVALID",`${e} controller public key should be a string`)),t}function $1(r){let e=!0;return Rn(r)?r.length&&(e=r.every(t=>or(t,!1))):e=!1,e}function tS(r,e,t){let i=null;return Rn(e)&&e.length?e.forEach(s=>{i||Wf(s)||(i=qt("UNSUPPORTED_CHAINS",`${t}, chain ${s} should be a string and conform to "namespace:chainId" format`))}):Wf(r)||(i=qt("UNSUPPORTED_CHAINS",`${t}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),i}function rS(r,e,t){let i=null;return Object.entries(r).forEach(([s,a])=>{if(i)return;const f=tS(s,Dv(s,a),`${e} ${t}`);f&&(i=f)}),i}function iS(r,e){let t=null;return Rn(r)?r.forEach(i=>{t||YE(i)||(t=qt("UNSUPPORTED_ACCOUNTS",`${e}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):t=qt("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),t}function nS(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;const s=iS(i==null?void 0:i.accounts,`${e} namespace`);s&&(t=s)}),t}function sS(r,e){let t=null;return $1(r==null?void 0:r.methods)?$1(r==null?void 0:r.events)||(t=qt("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):t=qt("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),t}function Sb(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;const s=sS(i,`${e}, namespace`);s&&(t=s)}),t}function aS(r,e,t){let i=null;if(r&&Wo(r)){const s=Sb(r,e);s&&(i=s);const a=rS(r,e,t);a&&(i=a)}else i=Ae("MISSING_OR_INVALID",`${e}, ${t} should be an object with data`);return i}function tl(r,e){let t=null;if(r&&Wo(r)){const i=Sb(r,e);i&&(t=i);const s=nS(r,e);s&&(t=s)}else t=Ae("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return t}function xb(r){return or(r.protocol,!0)}function oS(r,e){let t=!1;return r?r&&Rn(r)&&r.length&&r.forEach(i=>{t=xb(i)}):t=!0,t}function cS(r){return typeof r=="number"}function oi(r){return typeof r<"u"&&typeof r!==null}function fS(r){return!(!r||typeof r!="object"||!r.code||!pd(r.code)||!r.message||!or(r.message,!1))}function uS(r){return!(fi(r)||!or(r.method,!1))}function hS(r){return!(fi(r)||fi(r.result)&&fi(r.error)||!pd(r.id)||!or(r.jsonrpc,!1))}function lS(r){return!(fi(r)||!or(r.name,!1))}function z1(r,e){return!(!Wf(e)||!kE(r).includes(e))}function dS(r,e,t){return or(t,!1)?HE(r,e).includes(t):!1}function pS(r,e,t){return or(t,!1)?KE(r,e).includes(t):!1}function j1(r,e,t){let i=null;const s=gS(r),a=vS(e),f=Object.keys(s),u=Object.keys(a),b=k1(Object.keys(r)),v=k1(Object.keys(e)),w=b.filter(S=>!v.includes(S));return w.length&&(i=Ae("NON_CONFORMING_NAMESPACES",`${t} namespaces keys don't satisfy requiredNamespaces.
|
|
26
|
+
Required: ${w.toString()}
|
|
27
|
+
Received: ${Object.keys(e).toString()}`)),Ys(f,u)||(i=Ae("NON_CONFORMING_NAMESPACES",`${t} namespaces chains don't satisfy required namespaces.
|
|
28
|
+
Required: ${f.toString()}
|
|
29
|
+
Approved: ${u.toString()}`)),Object.keys(e).forEach(S=>{if(!S.includes(":")||i)return;const O=Za(e[S].accounts);O.includes(S)||(i=Ae("NON_CONFORMING_NAMESPACES",`${t} namespaces accounts don't satisfy namespace accounts for ${S}
|
|
30
|
+
Required: ${S}
|
|
31
|
+
Approved: ${O.toString()}`))}),f.forEach(S=>{i||(Ys(s[S].methods,a[S].methods)?Ys(s[S].events,a[S].events)||(i=Ae("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy namespace events for ${S}`)):i=Ae("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy namespace methods for ${S}`))}),i}function gS(r){const e={};return Object.keys(r).forEach(t=>{var i;t.includes(":")?e[t]=r[t]:(i=r[t].chains)==null||i.forEach(s=>{e[s]={methods:r[t].methods,events:r[t].events}})}),e}function k1(r){return[...new Set(r.map(e=>e.includes(":")?e.split(":")[0]:e))]}function vS(r){const e={};return Object.keys(r).forEach(t=>{if(t.includes(":"))e[t]=r[t];else{const i=Za(r[t].accounts);i==null||i.forEach(s=>{e[s]={accounts:r[t].accounts.filter(a=>a.includes(`${s}:`)),methods:r[t].methods,events:r[t].events}})}}),e}function bS(r,e){return pd(r)&&r<=e.max&&r>=e.min}function H1(){const r=nc();return new Promise(e=>{switch(r){case yi.browser:e(mS());break;case yi.reactNative:e(yS());break;case yi.node:e(wS());break;default:e(!0)}})}function mS(){return ic()&&(navigator==null?void 0:navigator.onLine)}async function yS(){if(Wa()&&typeof global<"u"&&global!=null&&global.NetInfo){const r=await(global==null?void 0:global.NetInfo.fetch());return r==null?void 0:r.isConnected}return!0}function wS(){return!0}function _S(r){switch(nc()){case yi.browser:AS(r);break;case yi.reactNative:ES(r);break}}function AS(r){!Wa()&&ic()&&(window.addEventListener("online",()=>r(!0)),window.addEventListener("offline",()=>r(!1)))}function ES(r){Wa()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>r(e==null?void 0:e.isConnected)))}const rl={};class Do{static get(e){return rl[e]}static set(e,t){rl[e]=t}static delete(e){delete rl[e]}}class oa{}let SS=class extends oa{constructor(e){super()}};const K1=Se.FIVE_SECONDS,eo={pulse:"heartbeat_pulse"};let xS=class Mb extends SS{constructor(e){super(e),this.events=new zi.EventEmitter,this.interval=K1,this.interval=(e==null?void 0:e.interval)||K1}static async init(e){const t=new Mb(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(),Se.toMiliseconds(this.interval))}pulse(){this.events.emit(eo.pulse)}};const MS=/"(?:_|\\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*:/,IS=/"(?: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*:/,DS=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function PS(r,e){if(r==="__proto__"||r==="constructor"&&e&&typeof e=="object"&&"prototype"in e){OS(r);return}return e}function OS(r){console.warn(`[destr] Dropping "${r}" key to prevent prototype pollution.`)}function _f(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 i=t.toLowerCase();if(i==="true")return!0;if(i==="false")return!1;if(i==="undefined")return;if(i==="null")return null;if(i==="nan")return Number.NaN;if(i==="infinity")return Number.POSITIVE_INFINITY;if(i==="-infinity")return Number.NEGATIVE_INFINITY}if(!DS.test(r)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return r}try{if(MS.test(r)||IS.test(r)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(r,PS)}return JSON.parse(r)}catch(i){if(e.strict)throw i;return r}}function CS(r){return!r||typeof r.then!="function"?Promise.resolve(r):r}function yr(r,...e){try{return CS(r(...e))}catch(t){return Promise.reject(t)}}function RS(r){const e=typeof r;return r===null||e!=="object"&&e!=="function"}function NS(r){const e=Object.getPrototypeOf(r);return!e||e.isPrototypeOf(Object)}function Tf(r){if(RS(r))return String(r);if(NS(r)||Array.isArray(r))return JSON.stringify(r);if(typeof r.toJSON=="function")return Tf(r.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const Ol="base64:";function TS(r){return typeof r=="string"?r:Ol+qS(r)}function FS(r){return typeof r!="string"||!r.startsWith(Ol)?r:BS(r.slice(Ol.length))}function BS(r){return globalThis.Buffer?Buffer.from(r,"base64"):Uint8Array.from(globalThis.atob(r),e=>e.codePointAt(0))}function qS(r){return globalThis.Buffer?Buffer.from(r).toString("base64"):globalThis.btoa(String.fromCodePoint(...r))}function ai(r){var e;return r&&((e=r.split("?")[0])==null?void 0:e.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function LS(...r){return ai(r.join(":"))}function Af(r){return r=ai(r),r?r+":":""}const US="memory",$S=()=>{const r=new Map;return{name:US,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 zS(r={}){const e={mounts:{"":r.driver||$S()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},t=v=>{for(const w of e.mountpoints)if(v.startsWith(w))return{base:w,relativeKey:v.slice(w.length),driver:e.mounts[w]};return{base:"",relativeKey:v,driver:e.mounts[""]}},i=(v,w)=>e.mountpoints.filter(S=>S.startsWith(v)||w&&v.startsWith(S)).map(S=>({relativeBase:v.length>S.length?v.slice(S.length):void 0,mountpoint:S,driver:e.mounts[S]})),s=(v,w)=>{if(e.watching){w=ai(w);for(const S of e.watchListeners)S(v,w)}},a=async()=>{if(!e.watching){e.watching=!0;for(const v in e.mounts)e.unwatch[v]=await V1(e.mounts[v],s,v)}},f=async()=>{if(e.watching){for(const v in e.unwatch)await e.unwatch[v]();e.unwatch={},e.watching=!1}},u=(v,w,S)=>{const O=new Map,P=R=>{let z=O.get(R.base);return z||(z={driver:R.driver,base:R.base,items:[]},O.set(R.base,z)),z};for(const R of v){const z=typeof R=="string",W=ai(z?R:R.key),Q=z?void 0:R.value,j=z||!R.options?w:{...w,...R.options},Y=t(W);P(Y).items.push({key:W,value:Q,relativeKey:Y.relativeKey,options:j})}return Promise.all([...O.values()].map(R=>S(R))).then(R=>R.flat())},b={hasItem(v,w={}){v=ai(v);const{relativeKey:S,driver:O}=t(v);return yr(O.hasItem,S,w)},getItem(v,w={}){v=ai(v);const{relativeKey:S,driver:O}=t(v);return yr(O.getItem,S,w).then(P=>_f(P))},getItems(v,w={}){return u(v,w,S=>S.driver.getItems?yr(S.driver.getItems,S.items.map(O=>({key:O.relativeKey,options:O.options})),w).then(O=>O.map(P=>({key:LS(S.base,P.key),value:_f(P.value)}))):Promise.all(S.items.map(O=>yr(S.driver.getItem,O.relativeKey,O.options).then(P=>({key:O.key,value:_f(P)})))))},getItemRaw(v,w={}){v=ai(v);const{relativeKey:S,driver:O}=t(v);return O.getItemRaw?yr(O.getItemRaw,S,w):yr(O.getItem,S,w).then(P=>FS(P))},async setItem(v,w,S={}){if(w===void 0)return b.removeItem(v);v=ai(v);const{relativeKey:O,driver:P}=t(v);P.setItem&&(await yr(P.setItem,O,Tf(w),S),P.watch||s("update",v))},async setItems(v,w){await u(v,w,async S=>{if(S.driver.setItems)return yr(S.driver.setItems,S.items.map(O=>({key:O.relativeKey,value:Tf(O.value),options:O.options})),w);S.driver.setItem&&await Promise.all(S.items.map(O=>yr(S.driver.setItem,O.relativeKey,Tf(O.value),O.options)))})},async setItemRaw(v,w,S={}){if(w===void 0)return b.removeItem(v,S);v=ai(v);const{relativeKey:O,driver:P}=t(v);if(P.setItemRaw)await yr(P.setItemRaw,O,w,S);else if(P.setItem)await yr(P.setItem,O,TS(w),S);else return;P.watch||s("update",v)},async removeItem(v,w={}){typeof w=="boolean"&&(w={removeMeta:w}),v=ai(v);const{relativeKey:S,driver:O}=t(v);O.removeItem&&(await yr(O.removeItem,S,w),(w.removeMeta||w.removeMata)&&await yr(O.removeItem,S+"$",w),O.watch||s("remove",v))},async getMeta(v,w={}){typeof w=="boolean"&&(w={nativeOnly:w}),v=ai(v);const{relativeKey:S,driver:O}=t(v),P=Object.create(null);if(O.getMeta&&Object.assign(P,await yr(O.getMeta,S,w)),!w.nativeOnly){const R=await yr(O.getItem,S+"$",w).then(z=>_f(z));R&&typeof R=="object"&&(typeof R.atime=="string"&&(R.atime=new Date(R.atime)),typeof R.mtime=="string"&&(R.mtime=new Date(R.mtime)),Object.assign(P,R))}return P},setMeta(v,w,S={}){return this.setItem(v+"$",w,S)},removeMeta(v,w={}){return this.removeItem(v+"$",w)},async getKeys(v,w={}){v=Af(v);const S=i(v,!0);let O=[];const P=[];for(const R of S){const z=await yr(R.driver.getKeys,R.relativeBase,w);for(const W of z){const Q=R.mountpoint+ai(W);O.some(j=>Q.startsWith(j))||P.push(Q)}O=[R.mountpoint,...O.filter(W=>!W.startsWith(R.mountpoint))]}return v?P.filter(R=>R.startsWith(v)&&R[R.length-1]!=="$"):P.filter(R=>R[R.length-1]!=="$")},async clear(v,w={}){v=Af(v),await Promise.all(i(v,!1).map(async S=>{if(S.driver.clear)return yr(S.driver.clear,S.relativeBase,w);if(S.driver.removeItem){const O=await S.driver.getKeys(S.relativeBase||"",w);return Promise.all(O.map(P=>S.driver.removeItem(P,w)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(v=>G1(v)))},async watch(v){return await a(),e.watchListeners.push(v),async()=>{e.watchListeners=e.watchListeners.filter(w=>w!==v),e.watchListeners.length===0&&await f()}},async unwatch(){e.watchListeners=[],await f()},mount(v,w){if(v=Af(v),v&&e.mounts[v])throw new Error(`already mounted at ${v}`);return v&&(e.mountpoints.push(v),e.mountpoints.sort((S,O)=>O.length-S.length)),e.mounts[v]=w,e.watching&&Promise.resolve(V1(w,s,v)).then(S=>{e.unwatch[v]=S}).catch(console.error),b},async unmount(v,w=!0){var S,O;v=Af(v),!(!v||!e.mounts[v])&&(e.watching&&v in e.unwatch&&((O=(S=e.unwatch)[v])==null||O.call(S),delete e.unwatch[v]),w&&await G1(e.mounts[v]),e.mountpoints=e.mountpoints.filter(P=>P!==v),delete e.mounts[v])},getMount(v=""){v=ai(v)+":";const w=t(v);return{driver:w.driver,base:w.base}},getMounts(v="",w={}){return v=ai(v),i(v,w.parents).map(O=>({driver:O.driver,base:O.mountpoint}))},keys:(v,w={})=>b.getKeys(v,w),get:(v,w={})=>b.getItem(v,w),set:(v,w,S={})=>b.setItem(v,w,S),has:(v,w={})=>b.hasItem(v,w),del:(v,w={})=>b.removeItem(v,w),remove:(v,w={})=>b.removeItem(v,w)};return b}function V1(r,e,t){return r.watch?r.watch((i,s)=>e(i,t+s)):()=>{}}async function G1(r){typeof r.dispose=="function"&&await yr(r.dispose)}function ca(r){return new Promise((e,t)=>{r.oncomplete=r.onsuccess=()=>e(r.result),r.onabort=r.onerror=()=>t(r.error)})}function Ib(r,e){const t=indexedDB.open(r);t.onupgradeneeded=()=>t.result.createObjectStore(e);const i=ca(t);return(s,a)=>i.then(f=>a(f.transaction(e,s).objectStore(e)))}let il;function cc(){return il||(il=Ib("keyval-store","keyval")),il}function W1(r,e=cc()){return e("readonly",t=>ca(t.get(r)))}function jS(r,e,t=cc()){return t("readwrite",i=>(i.put(e,r),ca(i.transaction)))}function kS(r,e=cc()){return e("readwrite",t=>(t.delete(r),ca(t.transaction)))}function HS(r=cc()){return r("readwrite",e=>(e.clear(),ca(e.transaction)))}function KS(r,e){return r.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},ca(r.transaction)}function VS(r=cc()){return r("readonly",e=>{if(e.getAllKeys)return ca(e.getAllKeys());const t=[];return KS(e,i=>t.push(i.key)).then(()=>t)})}const GS="idb-keyval";var WS=(r={})=>{const e=r.base&&r.base.length>0?`${r.base}:`:"",t=s=>e+s;let i;return r.dbName&&r.storeName&&(i=Ib(r.dbName,r.storeName)),{name:GS,options:r,async hasItem(s){return!(typeof await W1(t(s),i)>"u")},async getItem(s){return await W1(t(s),i)??null},setItem(s,a){return jS(t(s),a,i)},removeItem(s){return kS(t(s),i)},getKeys(){return VS(i)},clear(){return HS(i)}}};const JS="WALLET_CONNECT_V2_INDEXED_DB",YS="keyvaluestorage";let QS=class{constructor(){this.indexedDb=zS({driver:WS({dbName:JS,storeName:YS})})}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,is(t))}async removeItem(e){await this.indexedDb.removeItem(e)}};var nl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ff={exports:{}};(function(){let r;function e(){}r=e,r.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},r.prototype.setItem=function(t,i){this[t]=String(i)},r.prototype.removeItem=function(t){delete this[t]},r.prototype.clear=function(){const t=this;Object.keys(t).forEach(function(i){t[i]=void 0,delete t[i]})},r.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof nl<"u"&&nl.localStorage?Ff.exports=nl.localStorage:typeof window<"u"&&window.localStorage?Ff.exports=window.localStorage:Ff.exports=new e})();function XS(r){var e;return[r[0],ea((e=r[1])!=null?e:"")]}class ZS{constructor(){this.localStorage=Ff.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(XS)}async getItem(e){const t=this.localStorage.getItem(e);if(t!==null)return ea(t)}async setItem(e,t){this.localStorage.setItem(e,is(t))}async removeItem(e){this.localStorage.removeItem(e)}}const ex="wc_storage_version",J1=1,tx=async(r,e,t)=>{const i=ex,s=await e.getItem(i);if(s&&s>=J1){t(e);return}const a=await r.getKeys();if(!a.length){t(e);return}const f=[];for(;a.length;){const u=a.shift();if(!u)continue;const b=u.toLowerCase();if(b.includes("wc@")||b.includes("walletconnect")||b.includes("wc_")||b.includes("wallet_connect")){const v=await r.getItem(u);await e.setItem(u,v),f.push(u)}}await e.setItem(i,J1),t(e),rx(r,f)},rx=async(r,e)=>{e.length&&e.forEach(async t=>{await r.removeItem(t)})};let ix=class{constructor(){this.initialized=!1,this.setInitialized=t=>{this.storage=t,this.initialized=!0};const e=new ZS;this.storage=e;try{const t=new QS;tx(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 nx(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}var sx=ax;function ax(r,e,t){var i=t&&t.stringify||nx,s=1;if(typeof r=="object"&&r!==null){var a=e.length+s;if(a===1)return r;var f=new Array(a);f[0]=i(r);for(var u=1;u<a;u++)f[u]=i(e[u]);return f.join(" ")}if(typeof r!="string")return r;var b=e.length;if(b===0)return r;for(var v="",w=1-s,S=-1,O=r&&r.length||0,P=0;P<O;){if(r.charCodeAt(P)===37&&P+1<O){switch(S=S>-1?S:0,r.charCodeAt(P+1)){case 100:case 102:if(w>=b||e[w]==null)break;S<P&&(v+=r.slice(S,P)),v+=Number(e[w]),S=P+2,P++;break;case 105:if(w>=b||e[w]==null)break;S<P&&(v+=r.slice(S,P)),v+=Math.floor(Number(e[w])),S=P+2,P++;break;case 79:case 111:case 106:if(w>=b||e[w]===void 0)break;S<P&&(v+=r.slice(S,P));var R=typeof e[w];if(R==="string"){v+="'"+e[w]+"'",S=P+2,P++;break}if(R==="function"){v+=e[w].name||"<anonymous>",S=P+2,P++;break}v+=i(e[w]),S=P+2,P++;break;case 115:if(w>=b)break;S<P&&(v+=r.slice(S,P)),v+=String(e[w]),S=P+2,P++;break;case 37:S<P&&(v+=r.slice(S,P)),v+="%",S=P+2,P++,w--;break}++w}++P}return S===-1?r:(S<O&&(v+=r.slice(S)),v)}const Y1=sx;var Ta=Cn;const Jo=vx().console||{},ox={mapHttpRequest:Ef,mapHttpResponse:Ef,wrapRequestSerializer:sl,wrapResponseSerializer:sl,wrapErrorSerializer:sl,req:Ef,res:Ef,err:lx};function cx(r,e){return Array.isArray(r)?r.filter(function(i){return i!=="!stdSerializers.err"}):r===!0?Object.keys(e):!1}function Cn(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||Jo;r.browser.write&&(r.browser.asObject=!0);const i=r.serializers||{},s=cx(r.browser.serialize,i);let a=r.browser.serialize;Array.isArray(r.browser.serialize)&&r.browser.serialize.indexOf("!stdSerializers.err")>-1&&(a=!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 u=r.level||"info",b=Object.create(t);b.log||(b.log=Yo),Object.defineProperty(b,"levelVal",{get:w}),Object.defineProperty(b,"level",{get:S,set:O});const v={transmit:e,serialize:s,asObject:r.browser.asObject,levels:f,timestamp:dx(r)};b.levels=Cn.levels,b.level=u,b.setMaxListeners=b.getMaxListeners=b.emit=b.addListener=b.on=b.prependListener=b.once=b.prependOnceListener=b.removeListener=b.removeAllListeners=b.listeners=b.listenerCount=b.eventNames=b.write=b.flush=Yo,b.serializers=i,b._serialize=s,b._stdErrSerialize=a,b.child=P,e&&(b._logEvent=Cl());function w(){return this.level==="silent"?1/0:this.levels.values[this.level]}function S(){return this._level}function O(R){if(R!=="silent"&&!this.levels.values[R])throw Error("unknown level "+R);this._level=R,Oa(v,b,"error","log"),Oa(v,b,"fatal","error"),Oa(v,b,"warn","error"),Oa(v,b,"info","log"),Oa(v,b,"debug","log"),Oa(v,b,"trace","log")}function P(R,z){if(!R)throw new Error("missing bindings for child Pino");z=z||{},s&&R.serializers&&(z.serializers=R.serializers);const W=z.serializers;if(s&&W){var Q=Object.assign({},i,W),j=r.browser.serialize===!0?Object.keys(Q):s;delete R.serializers,pu([R],j,Q,this._stdErrSerialize)}function Y(U){this._childLevel=(U._childLevel|0)+1,this.error=Ca(U,R,"error"),this.fatal=Ca(U,R,"fatal"),this.warn=Ca(U,R,"warn"),this.info=Ca(U,R,"info"),this.debug=Ca(U,R,"debug"),this.trace=Ca(U,R,"trace"),Q&&(this.serializers=Q,this._serialize=j),e&&(this._logEvent=Cl([].concat(U._logEvent.bindings,R)))}return Y.prototype=this,new Y(this)}return b}Cn.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"}};Cn.stdSerializers=ox;Cn.stdTimeFunctions=Object.assign({},{nullTime:Db,epochTime:Pb,unixTime:px,isoTime:gx});function Oa(r,e,t,i){const s=Object.getPrototypeOf(e);e[t]=e.levelVal>e.levels.values[t]?Yo:s[t]?s[t]:Jo[t]||Jo[i]||Yo,fx(r,e,t)}function fx(r,e,t){!r.transmit&&e[t]===Yo||(e[t]=function(i){return function(){const a=r.timestamp(),f=new Array(arguments.length),u=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Jo?Jo:this;for(var b=0;b<f.length;b++)f[b]=arguments[b];if(r.serialize&&!r.asObject&&pu(f,this._serialize,this.serializers,this._stdErrSerialize),r.asObject?i.call(u,ux(this,t,f,a)):i.apply(u,f),r.transmit){const v=r.transmit.level||e.level,w=Cn.levels.values[v],S=Cn.levels.values[t];if(S<w)return;hx(this,{ts:a,methodLevel:t,methodValue:S,transmitLevel:v,transmitValue:Cn.levels.values[r.transmit.level||e.level],send:r.transmit.send,val:e.levelVal},f)}}}(e[t]))}function ux(r,e,t,i){r._serialize&&pu(t,r._serialize,r.serializers,r._stdErrSerialize);const s=t.slice();let a=s[0];const f={};i&&(f.time=i),f.level=Cn.levels.values[e];let u=(r._childLevel|0)+1;if(u<1&&(u=1),a!==null&&typeof a=="object"){for(;u--&&typeof s[0]=="object";)Object.assign(f,s.shift());a=s.length?Y1(s.shift(),s):void 0}else typeof a=="string"&&(a=Y1(s.shift(),s));return a!==void 0&&(f.msg=a),f}function pu(r,e,t,i){for(const s in r)if(i&&r[s]instanceof Error)r[s]=Cn.stdSerializers.err(r[s]);else if(typeof r[s]=="object"&&!Array.isArray(r[s]))for(const a in r[s])e&&e.indexOf(a)>-1&&a in t&&(r[s][a]=t[a](r[s][a]))}function Ca(r,e,t){return function(){const i=new Array(1+arguments.length);i[0]=e;for(var s=1;s<i.length;s++)i[s]=arguments[s-1];return r[t].apply(this,i)}}function hx(r,e,t){const i=e.send,s=e.ts,a=e.methodLevel,f=e.methodValue,u=e.val,b=r._logEvent.bindings;pu(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(v){return b.indexOf(v)===-1}),r._logEvent.level.label=a,r._logEvent.level.value=f,i(a,r._logEvent,u),r._logEvent=Cl(b)}function Cl(r){return{ts:0,messages:[],bindings:r||[],level:{label:"",value:0}}}function lx(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 dx(r){return typeof r.timestamp=="function"?r.timestamp:r.timestamp===!1?Db:Pb}function Ef(){return{}}function sl(r){return r}function Yo(){}function Db(){return!1}function Pb(){return Date.now()}function px(){return Math.round(Date.now()/1e3)}function gx(){return new Date(Date.now()).toISOString()}function vx(){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 fc=Hl(Ta),bx={level:"info"},uc="custom_context",gd=1e3*1024;let mx=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}},Q1=class{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const t=new mx(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}}}}},Ob=class{constructor(e,t=gd){this.level=e??"error",this.levelValue=Ta.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new Q1(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===Ta.levels.values.error?console.error(e):t===Ta.levels.values.warn?console.warn(e):t===Ta.levels.values.debug?console.debug(e):t===Ta.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(is({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 Q1(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const t=this.getLogArray();return t.push(is({extraMetadata:e})),new Blob(t,{type:"application/json"})}},yx=class{constructor(e,t=gd){this.baseChunkLogger=new Ob(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),i=document.createElement("a");i.href=t,i.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(t)}};class wx{constructor(e,t=gd){this.baseChunkLogger=new Ob(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 _x=Object.defineProperty,Ax=Object.defineProperties,Ex=Object.getOwnPropertyDescriptors,X1=Object.getOwnPropertySymbols,Sx=Object.prototype.hasOwnProperty,xx=Object.prototype.propertyIsEnumerable,Z1=(r,e,t)=>e in r?_x(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Jf=(r,e)=>{for(var t in e||(e={}))Sx.call(e,t)&&Z1(r,t,e[t]);if(X1)for(var t of X1(e))xx.call(e,t)&&Z1(r,t,e[t]);return r},Yf=(r,e)=>Ax(r,Ex(e));function gu(r){return Yf(Jf({},r),{level:(r==null?void 0:r.level)||bx.level})}function Mx(r,e=uc){return r[e]||""}function Ix(r,e,t=uc){return r[t]=e,r}function li(r,e=uc){let t="";return typeof r.bindings>"u"?t=Mx(r,e):t=r.bindings().context||"",t}function Dx(r,e,t=uc){const i=li(r,t);return i.trim()?`${i}/${e}`:e}function Yr(r,e,t=uc){const i=Dx(r,e,t),s=r.child({context:i});return Ix(s,i,t)}function Px(r){var e,t;const i=new yx((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:fc(Yf(Jf({},r.opts),{level:"trace",browser:Yf(Jf({},(t=r.opts)==null?void 0:t.browser),{write:s=>i.write(s)})})),chunkLoggerController:i}}function Ox(r){var e;const t=new wx((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:fc(Yf(Jf({},r.opts),{level:"trace"}),t),chunkLoggerController:t}}function Cx(r){return typeof r.loggerOverride<"u"&&typeof r.loggerOverride!="string"?{logger:r.loggerOverride,chunkLoggerController:null}:typeof window<"u"?Px(r):Ox(r)}let Rx=class extends oa{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},Nx=class extends oa{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}},Tx=class{constructor(e,t){this.logger=e,this.core=t}},Fx=class extends oa{constructor(e,t){super(),this.relayer=e,this.logger=t}},Bx=class extends oa{constructor(e){super()}},qx=class{constructor(e,t,i,s){this.core=e,this.logger=t,this.name=i}},Lx=class extends oa{constructor(e,t){super(),this.relayer=e,this.logger=t}},Ux=class extends oa{constructor(e,t){super(),this.core=e,this.logger=t}},$x=class{constructor(e,t,i){this.core=e,this.logger=t,this.store=i}},zx=class{constructor(e,t){this.projectId=e,this.logger=t}},jx=class{constructor(e,t,i){this.core=e,this.logger=t,this.telemetryEnabled=i}},kx=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},Hx=class{constructor(e){this.client=e}};const Kx="PARSE_ERROR",Vx="INVALID_REQUEST",Gx="METHOD_NOT_FOUND",Wx="INVALID_PARAMS",Cb="INTERNAL_ERROR",vd="SERVER_ERROR",Jx=[-32700,-32600,-32601,-32602,-32603],zo={[Kx]:{code:-32700,message:"Parse error"},[Vx]:{code:-32600,message:"Invalid Request"},[Gx]:{code:-32601,message:"Method not found"},[Wx]:{code:-32602,message:"Invalid params"},[Cb]:{code:-32603,message:"Internal error"},[vd]:{code:-32e3,message:"Server error"}},Rb=vd;function Yx(r){return Jx.includes(r)}function eg(r){return Object.keys(zo).includes(r)?zo[r]:zo[Rb]}function Qx(r){const e=Object.values(zo).find(t=>t.code===r);return e||zo[Rb]}function Nb(r,e,t){return r.message.includes("getaddrinfo ENOTFOUND")||r.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${t} RPC url at ${e}`):r}var Tb={};/*! *****************************************************************************
|
|
32
|
+
Copyright (c) Microsoft Corporation.
|
|
33
|
+
|
|
34
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
35
|
+
purpose with or without fee is hereby granted.
|
|
36
|
+
|
|
37
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
38
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
39
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
40
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
41
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
42
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
43
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
44
|
+
***************************************************************************** */var Rl=function(r,e){return Rl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var s in i)i.hasOwnProperty(s)&&(t[s]=i[s])},Rl(r,e)};function Xx(r,e){Rl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Nl=function(){return Nl=Object.assign||function(e){for(var t,i=1,s=arguments.length;i<s;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},Nl.apply(this,arguments)};function Zx(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(r);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(r,i[s])&&(t[i[s]]=r[i[s]]);return t}function eM(r,e,t,i){var s=arguments.length,a=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var u=r.length-1;u>=0;u--)(f=r[u])&&(a=(s<3?f(a):s>3?f(e,t,a):f(e,t))||a);return s>3&&a&&Object.defineProperty(e,t,a),a}function tM(r,e){return function(t,i){e(t,i,r)}}function rM(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function iM(r,e,t,i){function s(a){return a instanceof t?a:new t(function(f){f(a)})}return new(t||(t=Promise))(function(a,f){function u(w){try{v(i.next(w))}catch(S){f(S)}}function b(w){try{v(i.throw(w))}catch(S){f(S)}}function v(w){w.done?a(w.value):s(w.value).then(u,b)}v((i=i.apply(r,e||[])).next())})}function nM(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,s,a,f;return f={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function u(v){return function(w){return b([v,w])}}function b(v){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,s&&(a=v[0]&2?s.return:v[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,v[1])).done)return a;switch(s=0,a&&(v=[v[0]&2,a.value]),v[0]){case 0:case 1:a=v;break;case 4:return t.label++,{value:v[1],done:!1};case 5:t.label++,s=v[1],v=[0];continue;case 7:v=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(v[0]===6||v[0]===2)){t=0;continue}if(v[0]===3&&(!a||v[1]>a[0]&&v[1]<a[3])){t.label=v[1];break}if(v[0]===6&&t.label<a[1]){t.label=a[1],a=v;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(v);break}a[2]&&t.ops.pop(),t.trys.pop();continue}v=e.call(r,t)}catch(w){v=[6,w],s=0}finally{i=a=0}if(v[0]&5)throw v[1];return{value:v[0]?v[1]:void 0,done:!0}}}function sM(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}function aM(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function Tl(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Fb(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),s,a=[],f;try{for(;(e===void 0||e-- >0)&&!(s=i.next()).done;)a.push(s.value)}catch(u){f={error:u}}finally{try{s&&!s.done&&(t=i.return)&&t.call(i)}finally{if(f)throw f.error}}return a}function oM(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(Fb(arguments[e]));return r}function cM(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var i=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],f=0,u=a.length;f<u;f++,s++)i[s]=a[f];return i}function Qo(r){return this instanceof Qo?(this.v=r,this):new Qo(r)}function fM(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(r,e||[]),s,a=[];return s={},f("next"),f("throw"),f("return"),s[Symbol.asyncIterator]=function(){return this},s;function f(O){i[O]&&(s[O]=function(P){return new Promise(function(R,z){a.push([O,P,R,z])>1||u(O,P)})})}function u(O,P){try{b(i[O](P))}catch(R){S(a[0][3],R)}}function b(O){O.value instanceof Qo?Promise.resolve(O.value.v).then(v,w):S(a[0][2],O)}function v(O){u("next",O)}function w(O){u("throw",O)}function S(O,P){O(P),a.shift(),a.length&&u(a[0][0],a[0][1])}}function uM(r){var e,t;return e={},i("next"),i("throw",function(s){throw s}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(s,a){e[s]=r[s]?function(f){return(t=!t)?{value:Qo(r[s](f)),done:s==="return"}:a?a(f):f}:a}}function hM(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 Tl=="function"?Tl(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(a){t[a]=r[a]&&function(f){return new Promise(function(u,b){f=r[a](f),s(u,b,f.done,f.value)})}}function s(a,f,u,b){Promise.resolve(b).then(function(v){a({value:v,done:u})},f)}}function lM(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function dM(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 pM(r){return r&&r.__esModule?r:{default:r}}function gM(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function vM(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 bM=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Nl},__asyncDelegator:uM,__asyncGenerator:fM,__asyncValues:hM,__await:Qo,__awaiter:iM,__classPrivateFieldGet:gM,__classPrivateFieldSet:vM,__createBinding:sM,__decorate:eM,__exportStar:aM,__extends:Xx,__generator:nM,__importDefault:pM,__importStar:dM,__makeTemplateObject:lM,__metadata:rM,__param:tM,__read:Fb,__rest:Zx,__spread:oM,__spreadArrays:cM,__values:Tl},Symbol.toStringTag,{value:"Module"})),mM=Qg(bM);var Wn={},tg;function yM(){if(tg)return Wn;tg=1,Object.defineProperty(Wn,"__esModule",{value:!0}),Wn.isBrowserCryptoAvailable=Wn.getSubtleCrypto=Wn.getBrowerCrypto=void 0;function r(){return(Vr===null||Vr===void 0?void 0:Vr.crypto)||(Vr===null||Vr===void 0?void 0:Vr.msCrypto)||{}}Wn.getBrowerCrypto=r;function e(){const i=r();return i.subtle||i.webkitSubtle}Wn.getSubtleCrypto=e;function t(){return!!r()&&!!e()}return Wn.isBrowserCryptoAvailable=t,Wn}var Jn={},rg;function wM(){if(rg)return Jn;rg=1,Object.defineProperty(Jn,"__esModule",{value:!0}),Jn.isBrowser=Jn.isNode=Jn.isReactNative=void 0;function r(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Jn.isReactNative=r;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Jn.isNode=e;function t(){return!r()&&!e()}return Jn.isBrowser=t,Jn}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=mM;e.__exportStar(yM(),r),e.__exportStar(wM(),r)})(Tb);function ys(r=3){const e=Date.now()*Math.pow(10,r),t=Math.floor(Math.random()*Math.pow(10,r));return e+t}function Qs(r=6){return BigInt(ys(r))}function Ss(r,e,t){return{id:t||ys(),jsonrpc:"2.0",method:r,params:e}}function vu(r,e){return{id:r,jsonrpc:"2.0",result:e}}function bu(r,e,t){return{id:r,jsonrpc:"2.0",error:_M(e)}}function _M(r,e){return typeof r>"u"?eg(Cb):(typeof r=="string"&&(r=Object.assign(Object.assign({},eg(vd)),{message:r})),Yx(r.code)&&(r=Qx(r.code)),r)}class AM{}class EM extends AM{constructor(){super()}}class SM extends EM{constructor(e){super()}}const xM="^https?:",MM="^wss?:";function IM(r){const e=r.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function Bb(r,e){const t=IM(r);return typeof t>"u"?!1:new RegExp(e).test(t)}function ig(r){return Bb(r,xM)}function ng(r){return Bb(r,MM)}function DM(r){return new RegExp("wss?://localhost(:d{2,5})?").test(r)}function qb(r){return typeof r=="object"&&"id"in r&&"jsonrpc"in r&&r.jsonrpc==="2.0"}function bd(r){return qb(r)&&"method"in r}function mu(r){return qb(r)&&(En(r)||Li(r))}function En(r){return"result"in r}function Li(r){return"error"in r}let hn=class extends SM{constructor(e){super(e),this.events=new zi.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(Ss(e.method,e.params||[],e.id||Qs().toString()),t)}async requestStrict(e,t){return new Promise(async(i,s)=>{if(!this.connection.connected)try{await this.open()}catch(a){s(a)}this.events.on(`${e.id}`,a=>{Li(a)?s(a.error):i(a.result)});try{await this.connection.send(e,t)}catch(a){s(a)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),mu(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 PM=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),OM=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",sg=r=>r.split("?")[0],ag=10,CM=PM();let RM=class{constructor(e){if(this.url=e,this.events=new zi.EventEmitter,this.registering=!1,!ng(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,t)=>{if(typeof this.socket>"u"){t(new Error("Connection already closed"));return}this.socket.onclose=i=>{this.onClose(i),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(is(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!ng(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,s)=>{this.events.once("register_error",a=>{this.resetMaxListeners(),s(a)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return s(new Error("WebSocket connection is missing or invalid"));i(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,i)=>{const s=new URLSearchParams(e).get("origin"),a=Tb.isReactNative()?{headers:{origin:s}}:{rejectUnauthorized:!DM(e)},f=new CM(e,[],a);OM()?f.onerror=u=>{const b=u;i(this.emitError(b.error))}:f.on("error",u=>{i(this.emitError(u))}),f.onopen=()=>{this.onOpen(f),t(f)}})}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"?ea(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const i=this.parseError(t),s=i.message||i.toString(),a=bu(e,s);this.events.emit("payload",a)}parseError(e,t=this.url){return Nb(e,sg(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>ag&&this.events.setMaxListeners(ag)}emitError(e){const t=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${sg(this.url)}`));return this.events.emit("register_error",t),t}};var Qf={exports:{}};Qf.exports;(function(r,e){var t=200,i="__lodash_hash_undefined__",s=1,a=2,f=9007199254740991,u="[object Arguments]",b="[object Array]",v="[object AsyncFunction]",w="[object Boolean]",S="[object Date]",O="[object Error]",P="[object Function]",R="[object GeneratorFunction]",z="[object Map]",W="[object Number]",Q="[object Null]",j="[object Object]",Y="[object Promise]",U="[object Proxy]",k="[object RegExp]",V="[object Set]",A="[object String]",F="[object Symbol]",ae="[object Undefined]",de="[object WeakMap]",L="[object ArrayBuffer]",m="[object DataView]",c="[object Float32Array]",p="[object Float64Array]",d="[object Int8Array]",y="[object Int16Array]",M="[object Int32Array]",I="[object Uint8Array]",x="[object Uint8ClampedArray]",l="[object Uint16Array]",g="[object Uint32Array]",N=/[\\^$.*+?()[\]{}|]/g,Z=/^\[object .+?Constructor\]$/,te=/^(?:0|[1-9]\d*)$/,D={};D[c]=D[p]=D[d]=D[y]=D[M]=D[I]=D[x]=D[l]=D[g]=!0,D[u]=D[b]=D[L]=D[w]=D[m]=D[S]=D[O]=D[P]=D[z]=D[W]=D[j]=D[k]=D[V]=D[A]=D[de]=!1;var ee=typeof Vr=="object"&&Vr&&Vr.Object===Object&&Vr,B=typeof self=="object"&&self&&self.Object===Object&&self,H=ee||B||Function("return this")(),K=e&&!e.nodeType&&e,_=K&&!0&&r&&!r.nodeType&&r,$=_&&_.exports===K,se=$&&ee.process,ce=function(){try{return se&&se.binding&&se.binding("util")}catch{}}(),ue=ce&&ce.isTypedArray;function ye(G,re){for(var pe=-1,Ue=G==null?0:G.length,$t=0,pt=[];++pe<Ue;){var Gt=G[pe];re(Gt,pe,G)&&(pt[$t++]=Gt)}return pt}function we(G,re){for(var pe=-1,Ue=re.length,$t=G.length;++pe<Ue;)G[$t+pe]=re[pe];return G}function Re(G,re){for(var pe=-1,Ue=G==null?0:G.length;++pe<Ue;)if(re(G[pe],pe,G))return!0;return!1}function Qe(G,re){for(var pe=-1,Ue=Array(G);++pe<G;)Ue[pe]=re(pe);return Ue}function Pe(G){return function(re){return G(re)}}function Ne(G,re){return G.has(re)}function Me(G,re){return G==null?void 0:G[re]}function me(G){var re=-1,pe=Array(G.size);return G.forEach(function(Ue,$t){pe[++re]=[$t,Ue]}),pe}function Oe(G,re){return function(pe){return G(re(pe))}}function Te(G){var re=-1,pe=Array(G.size);return G.forEach(function(Ue){pe[++re]=Ue}),pe}var ve=Array.prototype,Ce=Function.prototype,xe=Object.prototype,be=H["__core-js_shared__"],Le=Ce.toString,Ie=xe.hasOwnProperty,_e=function(){var G=/[^.]+$/.exec(be&&be.keys&&be.keys.IE_PROTO||"");return G?"Symbol(src)_1."+G:""}(),He=xe.toString,Ve=RegExp("^"+Le.call(Ie).replace(N,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ee=$?H.Buffer:void 0,Ke=H.Symbol,ht=H.Uint8Array,Ge=xe.propertyIsEnumerable,wt=ve.splice,lt=Ke?Ke.toStringTag:void 0,Je=Object.getOwnPropertySymbols,At=Ee?Ee.isBuffer:void 0,xt=Oe(Object.keys,Object),Fe=di(H,"DataView"),Xe=di(H,"Map"),tt=di(H,"Promise"),Be=di(H,"Set"),et=di(H,"WeakMap"),Ze=di(Object,"create"),$e=qn(Fe),ft=qn(Xe),rt=qn(tt),ze=qn(Be),it=qn(et),st=Ke?Ke.prototype:void 0,qe=st?st.valueOf:void 0;function Ye(G){var re=-1,pe=G==null?0:G.length;for(this.clear();++re<pe;){var Ue=G[re];this.set(Ue[0],Ue[1])}}function ut(){this.__data__=Ze?Ze(null):{},this.size=0}function je(G){var re=this.has(G)&&delete this.__data__[G];return this.size-=re?1:0,re}function Ct(G){var re=this.__data__;if(Ze){var pe=re[G];return pe===i?void 0:pe}return Ie.call(re,G)?re[G]:void 0}function Rt(G){var re=this.__data__;return Ze?re[G]!==void 0:Ie.call(re,G)}function at(G,re){var pe=this.__data__;return this.size+=this.has(G)?0:1,pe[G]=Ze&&re===void 0?i:re,this}Ye.prototype.clear=ut,Ye.prototype.delete=je,Ye.prototype.get=Ct,Ye.prototype.has=Rt,Ye.prototype.set=at;function bt(G){var re=-1,pe=G==null?0:G.length;for(this.clear();++re<pe;){var Ue=G[re];this.set(Ue[0],Ue[1])}}function Cr(){this.__data__=[],this.size=0}function Rr(G){var re=this.__data__,pe=Ps(re,G);if(pe<0)return!1;var Ue=re.length-1;return pe==Ue?re.pop():wt.call(re,pe,1),--this.size,!0}function Nr(G){var re=this.__data__,pe=Ps(re,G);return pe<0?void 0:re[pe][1]}function Tr(G){return Ps(this.__data__,G)>-1}function Fr(G,re){var pe=this.__data__,Ue=Ps(pe,G);return Ue<0?(++this.size,pe.push([G,re])):pe[Ue][1]=re,this}bt.prototype.clear=Cr,bt.prototype.delete=Rr,bt.prototype.get=Nr,bt.prototype.has=Tr,bt.prototype.set=Fr;function Xt(G){var re=-1,pe=G==null?0:G.length;for(this.clear();++re<pe;){var Ue=G[re];this.set(Ue[0],Ue[1])}}function Qr(){this.size=0,this.__data__={hash:new Ye,map:new(Xe||bt),string:new Ye}}function Hi(G){var re=as(this,G).delete(G);return this.size-=re?1:0,re}function Xr(G){return as(this,G).get(G)}function Ki(G){return as(this,G).has(G)}function Vi(G,re){var pe=as(this,G),Ue=pe.size;return pe.set(G,re),this.size+=pe.size==Ue?0:1,this}Xt.prototype.clear=Qr,Xt.prototype.delete=Hi,Xt.prototype.get=Xr,Xt.prototype.has=Ki,Xt.prototype.set=Vi;function Zr(G){var re=-1,pe=G==null?0:G.length;for(this.__data__=new Xt;++re<pe;)this.add(G[re])}function Ei(G){return this.__data__.set(G,i),this}function Si(G){return this.__data__.has(G)}Zr.prototype.add=Zr.prototype.push=Ei,Zr.prototype.has=Si;function ur(G){var re=this.__data__=new bt(G);this.size=re.size}function Gi(){this.__data__=new bt,this.size=0}function Wi(G){var re=this.__data__,pe=re.delete(G);return this.size=re.size,pe}function Ji(G){return this.__data__.get(G)}function Ds(G){return this.__data__.has(G)}function lc(G,re){var pe=this.__data__;if(pe instanceof bt){var Ue=pe.__data__;if(!Xe||Ue.length<t-1)return Ue.push([G,re]),this.size=++pe.size,this;pe=this.__data__=new Xt(Ue)}return pe.set(G,re),this.size=pe.size,this}ur.prototype.clear=Gi,ur.prototype.delete=Wi,ur.prototype.get=Ji,ur.prototype.has=Ds,ur.prototype.set=lc;function dc(G,re){var pe=pa(G),Ue=!pe&&xc(G),$t=!pe&&!Ue&&no(G),pt=!pe&&!Ue&&!$t&&Dc(G),Gt=pe||Ue||$t||pt,cr=Gt?Qe(G.length,String):[],Pt=cr.length;for(var zt in G)Ie.call(G,zt)&&!(Gt&&(zt=="length"||$t&&(zt=="offset"||zt=="parent")||pt&&(zt=="buffer"||zt=="byteLength"||zt=="byteOffset")||wc(zt,Pt)))&&cr.push(zt);return cr}function Ps(G,re){for(var pe=G.length;pe--;)if(Sc(G[pe][0],re))return pe;return-1}function ro(G,re,pe){var Ue=re(G);return pa(G)?Ue:we(Ue,pe(G))}function Os(G){return G==null?G===void 0?ae:Q:lt&< in Object(G)?mc(G):Eu(G)}function io(G){return Rs(G)&&Os(G)==u}function Cs(G,re,pe,Ue,$t){return G===re?!0:G==null||re==null||!Rs(G)&&!Rs(re)?G!==G&&re!==re:pc(G,re,pe,Ue,Cs,$t)}function pc(G,re,pe,Ue,$t,pt){var Gt=pa(G),cr=pa(re),Pt=Gt?b:dn(G),zt=cr?b:dn(re);Pt=Pt==u?j:Pt,zt=zt==u?j:zt;var ir=Pt==j,ei=zt==j,fr=Pt==zt;if(fr&&no(G)){if(!no(re))return!1;Gt=!0,ir=!1}if(fr&&!ir)return pt||(pt=new ur),Gt||Dc(G)?la(G,re,pe,Ue,$t,pt):Au(G,re,Pt,pe,Ue,$t,pt);if(!(pe&s)){var Wt=ir&&Ie.call(G,"__wrapped__"),zr=ei&&Ie.call(re,"__wrapped__");if(Wt||zr){var Yi=Wt?G.value():G,xi=zr?re.value():re;return pt||(pt=new ur),$t(Yi,xi,pe,Ue,pt)}}return fr?(pt||(pt=new ur),bc(G,re,pe,Ue,$t,pt)):!1}function _u(G){if(!Ic(G)||Ac(G))return!1;var re=ga(G)?Ve:Z;return re.test(qn(G))}function gc(G){return Rs(G)&&Mc(G.length)&&!!D[Os(G)]}function vc(G){if(!Ec(G))return xt(G);var re=[];for(var pe in Object(G))Ie.call(G,pe)&&pe!="constructor"&&re.push(pe);return re}function la(G,re,pe,Ue,$t,pt){var Gt=pe&s,cr=G.length,Pt=re.length;if(cr!=Pt&&!(Gt&&Pt>cr))return!1;var zt=pt.get(G);if(zt&&pt.get(re))return zt==re;var ir=-1,ei=!0,fr=pe&a?new Zr:void 0;for(pt.set(G,re),pt.set(re,G);++ir<cr;){var Wt=G[ir],zr=re[ir];if(Ue)var Yi=Gt?Ue(zr,Wt,ir,re,G,pt):Ue(Wt,zr,ir,G,re,pt);if(Yi!==void 0){if(Yi)continue;ei=!1;break}if(fr){if(!Re(re,function(xi,pn){if(!Ne(fr,pn)&&(Wt===xi||$t(Wt,xi,pe,Ue,pt)))return fr.push(pn)})){ei=!1;break}}else if(!(Wt===zr||$t(Wt,zr,pe,Ue,pt))){ei=!1;break}}return pt.delete(G),pt.delete(re),ei}function Au(G,re,pe,Ue,$t,pt,Gt){switch(pe){case m:if(G.byteLength!=re.byteLength||G.byteOffset!=re.byteOffset)return!1;G=G.buffer,re=re.buffer;case L:return!(G.byteLength!=re.byteLength||!pt(new ht(G),new ht(re)));case w:case S:case W:return Sc(+G,+re);case O:return G.name==re.name&&G.message==re.message;case k:case A:return G==re+"";case z:var cr=me;case V:var Pt=Ue&s;if(cr||(cr=Te),G.size!=re.size&&!Pt)return!1;var zt=Gt.get(G);if(zt)return zt==re;Ue|=a,Gt.set(G,re);var ir=la(cr(G),cr(re),Ue,$t,pt,Gt);return Gt.delete(G),ir;case F:if(qe)return qe.call(G)==qe.call(re)}return!1}function bc(G,re,pe,Ue,$t,pt){var Gt=pe&s,cr=da(G),Pt=cr.length,zt=da(re),ir=zt.length;if(Pt!=ir&&!Gt)return!1;for(var ei=Pt;ei--;){var fr=cr[ei];if(!(Gt?fr in re:Ie.call(re,fr)))return!1}var Wt=pt.get(G);if(Wt&&pt.get(re))return Wt==re;var zr=!0;pt.set(G,re),pt.set(re,G);for(var Yi=Gt;++ei<Pt;){fr=cr[ei];var xi=G[fr],pn=re[fr];if(Ue)var so=Gt?Ue(pn,xi,fr,re,G,pt):Ue(xi,pn,fr,G,re,pt);if(!(so===void 0?xi===pn||$t(xi,pn,pe,Ue,pt):so)){zr=!1;break}Yi||(Yi=fr=="constructor")}if(zr&&!Yi){var Ns=G.constructor,gr=re.constructor;Ns!=gr&&"constructor"in G&&"constructor"in re&&!(typeof Ns=="function"&&Ns instanceof Ns&&typeof gr=="function"&&gr instanceof gr)&&(zr=!1)}return pt.delete(G),pt.delete(re),zr}function da(G){return ro(G,Mu,yc)}function as(G,re){var pe=G.__data__;return _c(re)?pe[typeof re=="string"?"string":"hash"]:pe.map}function di(G,re){var pe=Me(G,re);return _u(pe)?pe:void 0}function mc(G){var re=Ie.call(G,lt),pe=G[lt];try{G[lt]=void 0;var Ue=!0}catch{}var $t=He.call(G);return Ue&&(re?G[lt]=pe:delete G[lt]),$t}var yc=Je?function(G){return G==null?[]:(G=Object(G),ye(Je(G),function(re){return Ge.call(G,re)}))}:Ut,dn=Os;(Fe&&dn(new Fe(new ArrayBuffer(1)))!=m||Xe&&dn(new Xe)!=z||tt&&dn(tt.resolve())!=Y||Be&&dn(new Be)!=V||et&&dn(new et)!=de)&&(dn=function(G){var re=Os(G),pe=re==j?G.constructor:void 0,Ue=pe?qn(pe):"";if(Ue)switch(Ue){case $e:return m;case ft:return z;case rt:return Y;case ze:return V;case it:return de}return re});function wc(G,re){return re=re??f,!!re&&(typeof G=="number"||te.test(G))&&G>-1&&G%1==0&&G<re}function _c(G){var re=typeof G;return re=="string"||re=="number"||re=="symbol"||re=="boolean"?G!=="__proto__":G===null}function Ac(G){return!!_e&&_e in G}function Ec(G){var re=G&&G.constructor,pe=typeof re=="function"&&re.prototype||xe;return G===pe}function Eu(G){return He.call(G)}function qn(G){if(G!=null){try{return Le.call(G)}catch{}try{return G+""}catch{}}return""}function Sc(G,re){return G===re||G!==G&&re!==re}var xc=io(function(){return arguments}())?io:function(G){return Rs(G)&&Ie.call(G,"callee")&&!Ge.call(G,"callee")},pa=Array.isArray;function Su(G){return G!=null&&Mc(G.length)&&!ga(G)}var no=At||Lt;function xu(G,re){return Cs(G,re)}function ga(G){if(!Ic(G))return!1;var re=Os(G);return re==P||re==R||re==v||re==U}function Mc(G){return typeof G=="number"&&G>-1&&G%1==0&&G<=f}function Ic(G){var re=typeof G;return G!=null&&(re=="object"||re=="function")}function Rs(G){return G!=null&&typeof G=="object"}var Dc=ue?Pe(ue):gc;function Mu(G){return Su(G)?dc(G):vc(G)}function Ut(){return[]}function Lt(){return!1}r.exports=xu})(Qf,Qf.exports);var NM=Qf.exports;const TM=Hl(NM),Lb="wc",Ub=2,md="core",Nn=`${Lb}@2:${md}:`,FM={name:md,logger:"error"},BM={database:":memory:"},qM="crypto",og="client_ed25519_seed",LM=Se.ONE_DAY,UM="keychain",$M="0.3",zM="messages",jM="0.3",kM=Se.SIX_HOURS,HM="publisher",$b="irn",KM="error",zb="wss://relay.walletconnect.org",VM="relayer",Gr={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"},GM="_subscription",Fi={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},WM=.1,Fl="2.17.0",kt={link_mode:"link_mode",relay:"relay"},JM="0.3",YM="WALLETCONNECT_CLIENT_ID",cg="WALLETCONNECT_LINK_MODE_APPS",Sn={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},QM="subscription",XM="0.3",ZM=Se.FIVE_SECONDS*1e3,eI="pairing",tI="0.3",Po={wc_pairingDelete:{req:{ttl:Se.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:Se.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:Se.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:Se.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:Se.ONE_DAY,prompt:!1,tag:0},res:{ttl:Se.ONE_DAY,prompt:!1,tag:0}}},Js={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},rn={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},rI="history",iI="0.3",nI="expirer",Bi={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},sI="0.3",aI="verify-api",oI="https://verify.walletconnect.com",jb="https://verify.walletconnect.org",jo=jb,cI=`${jo}/v3`,fI=[oI,jb],uI="echo",hI="https://echo.walletconnect.com",wn={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"},Yn={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"},nn={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"},Ks={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"},Vs={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"},Oo={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"},lI=.1,dI="event-client",pI=86400,gI="https://pulse.walletconnect.org/batch";function vI(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i<t.length;i++)t[i]=255;for(var s=0;s<r.length;s++){var a=r.charAt(s),f=a.charCodeAt(0);if(t[f]!==255)throw new TypeError(a+" is ambiguous");t[f]=s}var u=r.length,b=r.charAt(0),v=Math.log(u)/Math.log(256),w=Math.log(256)/Math.log(u);function S(R){if(R instanceof Uint8Array||(ArrayBuffer.isView(R)?R=new Uint8Array(R.buffer,R.byteOffset,R.byteLength):Array.isArray(R)&&(R=Uint8Array.from(R))),!(R instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(R.length===0)return"";for(var z=0,W=0,Q=0,j=R.length;Q!==j&&R[Q]===0;)Q++,z++;for(var Y=(j-Q)*w+1>>>0,U=new Uint8Array(Y);Q!==j;){for(var k=R[Q],V=0,A=Y-1;(k!==0||V<W)&&A!==-1;A--,V++)k+=256*U[A]>>>0,U[A]=k%u>>>0,k=k/u>>>0;if(k!==0)throw new Error("Non-zero carry");W=V,Q++}for(var F=Y-W;F!==Y&&U[F]===0;)F++;for(var ae=b.repeat(z);F<Y;++F)ae+=r.charAt(U[F]);return ae}function O(R){if(typeof R!="string")throw new TypeError("Expected String");if(R.length===0)return new Uint8Array;var z=0;if(R[z]!==" "){for(var W=0,Q=0;R[z]===b;)W++,z++;for(var j=(R.length-z)*v+1>>>0,Y=new Uint8Array(j);R[z];){var U=t[R.charCodeAt(z)];if(U===255)return;for(var k=0,V=j-1;(U!==0||k<Q)&&V!==-1;V--,k++)U+=u*Y[V]>>>0,Y[V]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");Q=k,z++}if(R[z]!==" "){for(var A=j-Q;A!==j&&Y[A]===0;)A++;for(var F=new Uint8Array(W+(j-A)),ae=W;A!==j;)F[ae++]=Y[A++];return F}}}function P(R){var z=O(R);if(z)return z;throw new Error(`Non-${e} character`)}return{encode:S,decodeUnsafe:O,decode:P}}var bI=vI,mI=bI;const kb=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")},yI=r=>new TextEncoder().encode(r),wI=r=>new TextDecoder().decode(r);class _I{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class AI{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Hb(this,e)}}class EI{constructor(e){this.decoders=e}or(e){return Hb(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Hb=(r,e)=>new EI({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});class SI{constructor(e,t,i,s){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=s,this.encoder=new _I(e,t,i),this.decoder=new AI(e,t,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const yu=({name:r,prefix:e,encode:t,decode:i})=>new SI(r,e,t,i),hc=({prefix:r,name:e,alphabet:t})=>{const{encode:i,decode:s}=mI(t,e);return yu({prefix:r,name:e,encode:i,decode:a=>kb(s(a))})},xI=(r,e,t,i)=>{const s={};for(let w=0;w<e.length;++w)s[e[w]]=w;let a=r.length;for(;r[a-1]==="=";)--a;const f=new Uint8Array(a*t/8|0);let u=0,b=0,v=0;for(let w=0;w<a;++w){const S=s[r[w]];if(S===void 0)throw new SyntaxError(`Non-${i} character`);b=b<<t|S,u+=t,u>=8&&(u-=8,f[v++]=255&b>>u)}if(u>=t||255&b<<8-u)throw new SyntaxError("Unexpected end of data");return f},MI=(r,e,t)=>{const i=e[e.length-1]==="=",s=(1<<t)-1;let a="",f=0,u=0;for(let b=0;b<r.length;++b)for(u=u<<8|r[b],f+=8;f>t;)f-=t,a+=e[s&u>>f];if(f&&(a+=e[s&u<<t-f]),i)for(;a.length*t&7;)a+="=";return a},Or=({name:r,prefix:e,bitsPerChar:t,alphabet:i})=>yu({prefix:e,name:r,encode(s){return MI(s,i,t)},decode(s){return xI(s,i,t,r)}}),II=yu({prefix:"\0",name:"identity",encode:r=>wI(r),decode:r=>yI(r)});var DI=Object.freeze({__proto__:null,identity:II});const PI=Or({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var OI=Object.freeze({__proto__:null,base2:PI});const CI=Or({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var RI=Object.freeze({__proto__:null,base8:CI});const NI=hc({prefix:"9",name:"base10",alphabet:"0123456789"});var TI=Object.freeze({__proto__:null,base10:NI});const FI=Or({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),BI=Or({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var qI=Object.freeze({__proto__:null,base16:FI,base16upper:BI});const LI=Or({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),UI=Or({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),$I=Or({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),zI=Or({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),jI=Or({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),kI=Or({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),HI=Or({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),KI=Or({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),VI=Or({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var GI=Object.freeze({__proto__:null,base32:LI,base32upper:UI,base32pad:$I,base32padupper:zI,base32hex:jI,base32hexupper:kI,base32hexpad:HI,base32hexpadupper:KI,base32z:VI});const WI=hc({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),JI=hc({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var YI=Object.freeze({__proto__:null,base36:WI,base36upper:JI});const QI=hc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),XI=hc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var ZI=Object.freeze({__proto__:null,base58btc:QI,base58flickr:XI});const eD=Or({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),tD=Or({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),rD=Or({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),iD=Or({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var nD=Object.freeze({__proto__:null,base64:eD,base64pad:tD,base64url:rD,base64urlpad:iD});const Kb=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),sD=Kb.reduce((r,e,t)=>(r[t]=e,r),[]),aD=Kb.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function oD(r){return r.reduce((e,t)=>(e+=sD[t],e),"")}function cD(r){const e=[];for(const t of r){const i=aD[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const fD=yu({prefix:"🚀",name:"base256emoji",encode:oD,decode:cD});var uD=Object.freeze({__proto__:null,base256emoji:fD}),hD=Vb,fg=128,lD=127,dD=~lD,pD=Math.pow(2,31);function Vb(r,e,t){e=e||[],t=t||0;for(var i=t;r>=pD;)e[t++]=r&255|fg,r/=128;for(;r&dD;)e[t++]=r&255|fg,r>>>=7;return e[t]=r|0,Vb.bytes=t-i+1,e}var gD=Bl,vD=128,ug=127;function Bl(r,i){var t=0,i=i||0,s=0,a=i,f,u=r.length;do{if(a>=u)throw Bl.bytes=0,new RangeError("Could not decode varint");f=r[a++],t+=s<28?(f&ug)<<s:(f&ug)*Math.pow(2,s),s+=7}while(f>=vD);return Bl.bytes=a-i,t}var bD=Math.pow(2,7),mD=Math.pow(2,14),yD=Math.pow(2,21),wD=Math.pow(2,28),_D=Math.pow(2,35),AD=Math.pow(2,42),ED=Math.pow(2,49),SD=Math.pow(2,56),xD=Math.pow(2,63),MD=function(r){return r<bD?1:r<mD?2:r<yD?3:r<wD?4:r<_D?5:r<AD?6:r<ED?7:r<SD?8:r<xD?9:10},ID={encode:hD,decode:gD,encodingLength:MD},Gb=ID;const hg=(r,e,t=0)=>(Gb.encode(r,e,t),e),lg=r=>Gb.encodingLength(r),ql=(r,e)=>{const t=e.byteLength,i=lg(r),s=i+lg(t),a=new Uint8Array(s+t);return hg(r,a,0),hg(t,a,i),a.set(e,s),new DD(r,t,e,a)};class DD{constructor(e,t,i,s){this.code=e,this.size=t,this.digest=i,this.bytes=s}}const Wb=({name:r,code:e,encode:t})=>new PD(r,e,t);class PD{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?ql(this.code,t):t.then(i=>ql(this.code,i))}else throw Error("Unknown type, must be binary type")}}const Jb=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),OD=Wb({name:"sha2-256",code:18,encode:Jb("SHA-256")}),CD=Wb({name:"sha2-512",code:19,encode:Jb("SHA-512")});var RD=Object.freeze({__proto__:null,sha256:OD,sha512:CD});const Yb=0,ND="identity",Qb=kb,TD=r=>ql(Yb,Qb(r)),FD={code:Yb,name:ND,encode:Qb,digest:TD};var BD=Object.freeze({__proto__:null,identity:FD});new TextEncoder,new TextDecoder;const dg={...DI,...OI,...RI,...TI,...qI,...GI,...YI,...ZI,...nD,...uD};({...RD,...BD});function qD(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function Xb(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const pg=Xb("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),al=Xb("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=qD(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),LD={utf8:pg,"utf-8":pg,hex:dg.base16,latin1:al,ascii:al,binary:al,...dg};function UD(r,e="utf8"){const t=LD[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):t.decoder.decode(`${t.prefix}${r}`)}class $D{constructor(e,t){this.core=e,this.logger=t,this.keychain=new Map,this.name=UM,this.version=$M,this.initialized=!1,this.storagePrefix=Nn,this.init=async()=>{if(!this.initialized){const i=await this.getKeyChain();typeof i<"u"&&(this.keychain=i),this.initialized=!0}},this.has=i=>(this.isInitialized(),this.keychain.has(i)),this.set=async(i,s)=>{this.isInitialized(),this.keychain.set(i,s),await this.persist()},this.get=i=>{this.isInitialized();const s=this.keychain.get(i);if(typeof s>"u"){const{message:a}=Ae("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(a)}return s},this.del=async i=>{this.isInitialized(),this.keychain.delete(i),await this.persist()},this.core=e,this.logger=Yr(t,this.name)}get context(){return li(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,Cv(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Rv(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=Ae("NOT_INITIALIZED",this.name);throw new Error(e)}}}class zD{constructor(e,t,i){this.core=e,this.logger=t,this.name=qM,this.randomSessionIdentifier=Dl(),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(),a=Yp(s);return Iv(a.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const s=AE();return this.setPrivateKey(s.publicKey,s.privateKey)},this.signJWT=async s=>{this.isInitialized();const a=await this.getClientSeed(),f=Yp(a),u=this.randomSessionIdentifier;return await i7(u,s,LM,f)},this.generateSharedKey=(s,a,f)=>{this.isInitialized();const u=this.getPrivateKey(s),b=EE(u,a);return this.setSymKey(b,f)},this.setSymKey=async(s,a)=>{this.isInitialized();const f=a||Nf(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,a,f)=>{this.isInitialized();const u=Eb(f),b=is(a);if(N1(u))return xE(b,f==null?void 0:f.encoding);if(R1(u)){const O=u.senderPublicKey,P=u.receiverPublicKey;s=await this.generateSharedKey(O,P)}const v=this.getSymKey(s),{type:w,senderPublicKey:S}=u;return SE({type:w,symKey:v,message:b,senderPublicKey:S,encoding:f==null?void 0:f.encoding})},this.decode=async(s,a,f)=>{this.isInitialized();const u=DE(a,f);if(N1(u)){const b=IE(a,f==null?void 0:f.encoding);return ea(b)}if(R1(u)){const b=u.receiverPublicKey,v=u.senderPublicKey;s=await this.generateSharedKey(b,v)}try{const b=this.getSymKey(s),v=ME({symKey:b,encoded:a,encoding:f==null?void 0:f.encoding});return ea(v)}catch(b){this.logger.error(`Failed to decode message from topic: '${s}', clientId: '${await this.getClientId()}'`),this.logger.error(b)}},this.getPayloadType=(s,a=Es)=>{const f=Go({encoded:s,encoding:a});return ra(f.type)},this.getPayloadSenderPublicKey=(s,a=Es)=>{const f=Go({encoded:s,encoding:a});return f.senderPublicKey?_r(f.senderPublicKey,Jr):void 0},this.core=e,this.logger=Yr(t,this.name),this.keychain=i||new $D(this.core,this.logger)}get context(){return li(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(og)}catch{e=Dl(),await this.keychain.set(og,e)}return UD(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=Ae("NOT_INITIALIZED",this.name);throw new Error(e)}}}class jD extends Tx{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=zM,this.version=jM,this.initialized=!1,this.storagePrefix=Nn,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const i=await this.getRelayerMessages();typeof i<"u"&&(this.messages=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}finally{this.initialized=!0}}},this.set=async(i,s)=>{this.isInitialized();const a=Xn(s);let f=this.messages.get(i);return typeof f>"u"&&(f={}),typeof f[a]<"u"||(f[a]=s,this.messages.set(i,f),await this.persist()),a},this.get=i=>{this.isInitialized();let s=this.messages.get(i);return typeof s>"u"&&(s={}),s},this.has=(i,s)=>{this.isInitialized();const a=this.get(i),f=Xn(s);return typeof a[f]<"u"},this.del=async i=>{this.isInitialized(),this.messages.delete(i),await this.persist()},this.logger=Yr(e,this.name),this.core=t}get context(){return li(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,Cv(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Rv(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=Ae("NOT_INITIALIZED",this.name);throw new Error(e)}}}class kD extends Fx{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new zi.EventEmitter,this.name=HM,this.queue=new Map,this.publishTimeout=Se.toMiliseconds(Se.ONE_MINUTE),this.failedPublishTimeout=Se.toMiliseconds(Se.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(i,s,a)=>{var f;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:s,opts:a}});const u=(a==null?void 0:a.ttl)||kM,b=Pl(a),v=(a==null?void 0:a.prompt)||!1,w=(a==null?void 0:a.tag)||0,S=(a==null?void 0:a.id)||Qs().toString(),O={topic:i,message:s,opts:{ttl:u,relay:b,prompt:v,tag:w,id:S,attestation:a==null?void 0:a.attestation}},P=`Failed to publish payload, please try again. id:${S} tag:${w}`,R=Date.now();let z,W=1;try{for(;z===void 0;){if(Date.now()-R>this.publishTimeout)throw new Error(P);this.logger.trace({id:S,attempts:W},`publisher.publish - attempt ${W}`),z=await await La(this.rpcPublish(i,s,u,b,v,w,S,a==null?void 0:a.attestation).catch(Q=>this.logger.warn(Q)),this.publishTimeout,P),W++,z||await new Promise(Q=>setTimeout(Q,this.failedPublishTimeout))}this.relayer.events.emit(Gr.publish,O),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:S,topic:i,message:s,opts:a}})}catch(Q){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(Q),(f=a==null?void 0:a.internal)!=null&&f.throwOnFailedPublish)throw Q;this.queue.set(S,O)}},this.on=(i,s)=>{this.events.on(i,s)},this.once=(i,s)=>{this.events.once(i,s)},this.off=(i,s)=>{this.events.off(i,s)},this.removeListener=(i,s)=>{this.events.removeListener(i,s)},this.relayer=e,this.logger=Yr(t,this.name),this.registerEventListeners()}get context(){return li(this.logger)}rpcPublish(e,t,i,s,a,f,u,b){var v,w,S,O;const P={method:Fo(s.protocol).publish,params:{topic:e,message:t,ttl:i,prompt:a,tag:f,attestation:b},id:u};return fi((v=P.params)==null?void 0:v.prompt)&&((w=P.params)==null||delete w.prompt),fi((S=P.params)==null?void 0:S.tag)&&((O=P.params)==null||delete O.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:P}),this.relayer.request(P)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:t,message:i,opts:s}=e;await this.publish(t,i,s)})}registerEventListeners(){this.relayer.core.heartbeat.on(eo.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(Gr.connection_stalled);return}this.checkQueue()}),this.relayer.on(Gr.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class HD{constructor(){this.map=new Map,this.set=(e,t)=>{const i=this.get(e);this.exists(e,t)||this.map.set(e,[...i,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const i=this.get(e);if(!this.exists(e,t))return;const s=i.filter(a=>a!==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 KD=Object.defineProperty,VD=Object.defineProperties,GD=Object.getOwnPropertyDescriptors,gg=Object.getOwnPropertySymbols,WD=Object.prototype.hasOwnProperty,JD=Object.prototype.propertyIsEnumerable,vg=(r,e,t)=>e in r?KD(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Co=(r,e)=>{for(var t in e||(e={}))WD.call(e,t)&&vg(r,t,e[t]);if(gg)for(var t of gg(e))JD.call(e,t)&&vg(r,t,e[t]);return r},ol=(r,e)=>VD(r,GD(e));class YD extends Lx{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new HD,this.events=new zi.EventEmitter,this.name=QM,this.version=XM,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Nn,this.subscribeTimeout=Se.toMiliseconds(Se.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(i,s)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:s}});try{const a=Pl(s),f={topic:i,relay:a,transportType:s==null?void 0:s.transportType};this.pending.set(i,f);const u=await this.rpcSubscribe(i,a,s==null?void 0:s.transportType);return typeof u=="string"&&(this.onSubscribe(u,f),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:s}})),u}catch(a){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(a),a}},this.unsubscribe=async(i,s)=>{await this.restartToComplete(),this.isInitialized(),typeof(s==null?void 0:s.id)<"u"?await this.unsubscribeById(i,s.id,s):await this.unsubscribeByTopic(i,s)},this.isSubscribed=async i=>{if(this.topics.includes(i))return!0;const s=`${this.pendingSubscriptionWatchLabel}_${i}`;return await new Promise((a,f)=>{const u=new Se.Watch;u.start(s);const b=setInterval(()=>{!this.pending.has(i)&&this.topics.includes(i)&&(clearInterval(b),u.stop(s),a(!0)),u.elapsed(s)>=ZM&&(clearInterval(b),u.stop(s),f(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(i,s)=>{this.events.on(i,s)},this.once=(i,s)=>{this.events.once(i,s)},this.off=(i,s)=>{this.events.off(i,s)},this.removeListener=(i,s)=>{this.events.removeListener(i,s)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=Yr(t,this.name),this.clientId=""}get context(){return li(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let i=!1;try{i=this.getSubscription(e).topic===t}catch{}return i}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const i=this.topicMap.get(e);await Promise.all(i.map(async s=>await this.unsubscribeById(e,s,t)))}async unsubscribeById(e,t,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}});try{const s=Pl(i);await this.rpcUnsubscribe(e,t,s);const a=qt("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,a),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}})}catch(s){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(s),s}}async rpcSubscribe(e,t,i=kt.relay){i===kt.relay&&await this.restartToComplete();const s={method:Fo(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});try{const a=Xn(e+this.clientId);return i===kt.link_mode?(setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(f=>this.logger.warn(f))},Se.toMiliseconds(Se.ONE_SECOND)),a):await await La(this.relayer.request(s).catch(f=>this.logger.warn(f)),this.subscribeTimeout)?a:null}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Gr.connection_stalled)}return null}async rpcBatchSubscribe(e){if(!e.length)return;const t=e[0].relay,i={method:Fo(t.protocol).batchSubscribe,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{return await await La(this.relayer.request(i).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(Gr.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const t=e[0].relay,i={method:Fo(t.protocol).batchFetchMessages,params:{topics:e.map(a=>a.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});let s;try{s=await await La(this.relayer.request(i).catch(a=>this.logger.warn(a)),this.subscribeTimeout)}catch{this.relayer.events.emit(Gr.connection_stalled)}return s}rpcUnsubscribe(e,t,i){const s={method:Fo(i.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,ol(Co({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach(t=>{this.setSubscription(t.id,Co({},t)),this.pending.delete(t.topic)})}async onUnsubscribe(e,t,i){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,i),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t)}addSubscription(e,t){this.subscriptions.set(e,Co({},t)),this.topicMap.set(t.topic,e),this.events.emit(Sn.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:i}=Ae("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const i=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(i.topic,e),this.events.emit(Sn.deleted,ol(Co({},i),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Sn.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t<e;t++){const i=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchFetchMessages(i),await this.batchSubscribe(i)}}this.events.emit(Sn.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:t}=Ae("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const t=await this.rpcBatchSubscribe(e);Rn(t)&&this.onBatchSubscribe(t.map((i,s)=>ol(Co({},e[s]),{id:i})))}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&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(t.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(t=>{e.push(t)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(eo.pulse,async()=>{await this.checkPending()}),this.events.on(Sn.created,async e=>{const t=Sn.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}),this.events.on(Sn.deleted,async e=>{const t=Sn.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=Ae("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const t=setInterval(()=>{this.restartInProgress||(clearInterval(t),e())},this.pollingInterval)})}}var QD=Object.defineProperty,bg=Object.getOwnPropertySymbols,XD=Object.prototype.hasOwnProperty,ZD=Object.prototype.propertyIsEnumerable,mg=(r,e,t)=>e in r?QD(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,eP=(r,e)=>{for(var t in e||(e={}))XD.call(e,t)&&mg(r,t,e[t]);if(bg)for(var t of bg(e))ZD.call(e,t)&&mg(r,t,e[t]);return r};class tP extends Bx{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new zi.EventEmitter,this.name=VM,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=Se.toMiliseconds(Se.THIRTY_SECONDS+Se.ONE_SECOND),this.request=async t=>{var i,s;this.logger.debug("Publishing Request Payload");const a=t.id||Qs().toString();await this.toEstablishConnection();try{const f=this.provider.request(t);this.requestsInFlight.set(a,{promise:f,request:t}),this.logger.trace({id:a,method:t.method,topic:(i=t.params)==null?void 0:i.topic},"relayer.request - attempt to publish...");const u=await new Promise(async(b,v)=>{const w=()=>{v(new Error(`relayer.request - publish interrupted, id: ${a}`))};this.provider.on(Fi.disconnect,w);const S=await f;this.provider.off(Fi.disconnect,w),b(S)});return this.logger.trace({id:a,method:t.method,topic:(s=t.params)==null?void 0:s.topic},"relayer.request - published"),u}catch(f){throw this.logger.debug(`Failed to Publish Request: ${a}`),f}finally{this.requestsInFlight.delete(a)}},this.resetPingTimeout=()=>{if(jf())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var t,i,s;(s=(i=(t=this.provider)==null?void 0:t.connection)==null?void 0:i.socket)==null||s.terminate()},this.heartBeatTimeout)}catch(t){this.logger.warn(t)}},this.onPayloadHandler=t=>{this.onProviderPayload(t),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(Gr.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=t=>{this.logger.error(t),this.events.emit(Gr.error,t),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Fi.payload,this.onPayloadHandler),this.provider.on(Fi.connect,this.onConnectHandler),this.provider.on(Fi.disconnect,this.onDisconnectHandler),this.provider.on(Fi.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Yr(e.logger,this.name):fc(gu({level:e.logger||KM})),this.messages=new jD(this.logger,e.core),this.subscriber=new YD(this,this.logger),this.publisher=new kD(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||zb,this.projectId=e.projectId,this.bundleId=l7(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return li(this.logger)}get connected(){var e,t,i;return((i=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:i.readyState)===1}get connecting(){var e,t,i;return((i=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:i.readyState)===0}async publish(e,t,i){this.isInitialized(),await this.publisher.publish(e,t,i),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now(),transportType:kt.relay})}async subscribe(e,t){var i;this.isInitialized(),(t==null?void 0:t.transportType)==="relay"&&await this.toEstablishConnection();let s=((i=this.subscriber.topicMap.get(e))==null?void 0:i[0])||"",a;const f=u=>{u.topic===e&&(this.subscriber.off(Sn.created,f),a())};return await Promise.all([new Promise(u=>{a=u,this.subscriber.on(Sn.created,f)}),new Promise(async u=>{s=await this.subscriber.subscribe(e,t)||s,u()})]),s}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.hasExperiencedNetworkDisruption||this.connected?await La(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(t,i)=>{const s=()=>{this.provider.off(Fi.disconnect,s),i(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Fi.disconnect,s),await La(this.provider.connect(),Se.toMiliseconds(Se.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(a=>{i(a)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(a=>{this.logger.error(a),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,t()})}catch(t){this.logger.error(t);const i=t;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(i.message))throw t}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await H1())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((i,s)=>i.publishedAt-s.publishedAt);this.logger.trace(`Batch of ${t.length} message events sorted`);for(const i of t)try{await this.onMessageEvent(i)}catch(s){this.logger.warn(s)}this.logger.trace(`Batch of ${t.length} message events processed`)}async onLinkMessageEvent(e,t){const{topic:i}=e;if(!t.sessionExists){const s=pr(Se.FIVE_MINUTES),a={topic:i,expiry:s,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(i,a)}this.events.emit(Gr.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,t,i,s,a;if(jf())try{(t=(e=this.provider)==null?void 0:e.connection)!=null&&t.socket&&((a=(s=(i=this.provider)==null?void 0:i.connection)==null?void 0:s.socket)==null||a.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(f){this.logger.warn(f)}}isConnectionStalled(e){return this.staleConnectionErrors.some(t=>e.includes(t))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new hn(new RM(v7({sdkVersion:Fl,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:t,message:i}=e;await this.messages.set(t,i)}async shouldIgnoreMessageEvent(e){const{topic:t,message:i}=e;if(!i||i.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${i}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;const s=this.messages.has(t,i);return s&&this.logger.debug(`Ignoring duplicate message: ${i}`),s}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),bd(e)){if(!e.method.endsWith(GM))return;const t=e.params,{topic:i,message:s,publishedAt:a,attestation:f}=t.data,u={topic:i,message:s,publishedAt:a,transportType:kt.relay,attestation:f};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(eP({type:"event",event:t.id},u)),this.events.emit(t.id,u),await this.acknowledgePayload(e),await this.onMessageEvent(u)}else mu(e)&&this.events.emit(Gr.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Gr.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const t=vu(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(Fi.payload,this.onPayloadHandler),this.provider.off(Fi.connect,this.onConnectHandler),this.provider.off(Fi.disconnect,this.onDisconnectHandler),this.provider.off(Fi.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await H1();_S(async t=>{e!==t&&(e=t,t?await this.restartTransport().catch(i=>this.logger.error(i)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(Gr.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},Se.toMiliseconds(WM))))}isInitialized(){if(!this.initialized){const{message:e}=Ae("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const t=setInterval(()=>{this.connected&&(clearInterval(t),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var rP=Object.defineProperty,yg=Object.getOwnPropertySymbols,iP=Object.prototype.hasOwnProperty,nP=Object.prototype.propertyIsEnumerable,wg=(r,e,t)=>e in r?rP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_g=(r,e)=>{for(var t in e||(e={}))iP.call(e,t)&&wg(r,t,e[t]);if(yg)for(var t of yg(e))nP.call(e,t)&&wg(r,t,e[t]);return r};class fa extends qx{constructor(e,t,i,s=Nn,a=void 0){super(e,t,i,s),this.core=e,this.logger=t,this.name=i,this.map=new Map,this.version=JM,this.cached=[],this.initialized=!1,this.storagePrefix=Nn,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&&!fi(f)?this.map.set(this.getKey(f),f):XE(f)?this.map.set(f.id,f):ZE(f)&&this.map.set(f.topic,f)}),this.cached=[],this.initialized=!0)},this.set=async(f,u)=>{this.isInitialized(),this.map.has(f)?await this.update(f,u):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:f,value:u}),this.map.set(f,u),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(u=>Object.keys(f).every(b=>TM(u[b],f[b]))):this.values),this.update=async(f,u)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:f,update:u});const b=_g(_g({},this.getData(f)),u);this.map.set(f,b),await this.persist()},this.delete=async(f,u)=>{this.isInitialized(),this.map.has(f)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:f,reason:u}),this.map.delete(f),this.addToRecentlyDeleted(f),await this.persist())},this.logger=Yr(t,this.name),this.storagePrefix=s,this.getKey=a}get context(){return li(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}=Ae("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(s),new Error(s)}const{message:i}=Ae("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:t}=Ae("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}=Ae("NOT_INITIALIZED",this.name);throw new Error(e)}}}class sP{constructor(e,t){this.core=e,this.logger=t,this.name=eI,this.version=tI,this.events=new Kl,this.initialized=!1,this.storagePrefix=Nn,this.ignoredPayloadTypes=[rs],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:i})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...i])]},this.create=async i=>{this.isInitialized();const s=Dl(),a=await this.core.crypto.setSymKey(s),f=pr(Se.FIVE_MINUTES),u={protocol:$b},b={topic:a,expiry:f,relay:u,active:!1,methods:i==null?void 0:i.methods},v=L1({protocol:this.core.protocol,version:this.core.version,topic:a,symKey:s,relay:u,expiryTimestamp:f,methods:i==null?void 0:i.methods});return this.events.emit(Js.create,b),this.core.expirer.set(a,f),await this.pairings.set(a,b),await this.core.relayer.subscribe(a,{transportType:i==null?void 0:i.transportType}),{topic:a,uri:v}},this.pair=async i=>{this.isInitialized();const s=this.core.eventClient.createEvent({properties:{topic:i==null?void 0:i.uri,trace:[wn.pairing_started]}});this.isValidPair(i,s);const{topic:a,symKey:f,relay:u,expiryTimestamp:b,methods:v}=q1(i.uri);s.props.properties.topic=a,s.addTrace(wn.pairing_uri_validation_success),s.addTrace(wn.pairing_uri_not_expired);let w;if(this.pairings.keys.includes(a)){if(w=this.pairings.get(a),s.addTrace(wn.existing_pairing),w.active)throw s.setError(Yn.active_pairing_already_exists),new Error(`Pairing already exists: ${a}. Please try again with a new connection URI.`);s.addTrace(wn.pairing_not_expired)}const S=b||pr(Se.FIVE_MINUTES),O={topic:a,relay:u,expiry:S,active:!1,methods:v};this.core.expirer.set(a,S),await this.pairings.set(a,O),s.addTrace(wn.store_new_pairing),i.activatePairing&&await this.activate({topic:a}),this.events.emit(Js.create,O),s.addTrace(wn.emit_inactive_pairing),this.core.crypto.keychain.has(a)||await this.core.crypto.setSymKey(f,a),s.addTrace(wn.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{s.setError(Yn.no_internet_connection)}try{await this.core.relayer.subscribe(a,{relay:u})}catch(P){throw s.setError(Yn.subscribe_pairing_topic_failure),P}return s.addTrace(wn.subscribe_pairing_topic_success),O},this.activate=async({topic:i})=>{this.isInitialized();const s=pr(Se.THIRTY_DAYS);this.core.expirer.set(i,s),await this.pairings.update(i,{active:!0,expiry:s})},this.ping=async i=>{this.isInitialized(),await this.isValidPing(i);const{topic:s}=i;if(this.pairings.keys.includes(s)){const a=await this.sendRequest(s,"wc_pairingPing",{}),{done:f,resolve:u,reject:b}=Gs();this.events.once(St("pairing_ping",a),({error:v})=>{v?b(v):u()}),await f()}},this.updateExpiry=async({topic:i,expiry:s})=>{this.isInitialized(),await this.pairings.update(i,{expiry:s})},this.updateMetadata=async({topic:i,metadata:s})=>{this.isInitialized(),await this.pairings.update(i,{peerMetadata:s})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async i=>{this.isInitialized(),await this.isValidDisconnect(i);const{topic:s}=i;this.pairings.keys.includes(s)&&(await this.sendRequest(s,"wc_pairingDelete",qt("USER_DISCONNECTED")),await this.deletePairing(s))},this.formatUriFromPairing=i=>{this.isInitialized();const{topic:s,relay:a,expiry:f,methods:u}=i,b=this.core.crypto.keychain.get(s);return L1({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:b,relay:a,expiryTimestamp:f,methods:u})},this.sendRequest=async(i,s,a)=>{const f=Ss(s,a),u=await this.core.crypto.encode(i,f),b=Po[s].req;return this.core.history.set(i,f),this.core.relayer.publish(i,u,b),f.id},this.sendResult=async(i,s,a)=>{const f=vu(i,a),u=await this.core.crypto.encode(s,f),b=await this.core.history.get(s,i),v=Po[b.request.method].res;await this.core.relayer.publish(s,u,v),await this.core.history.resolve(f)},this.sendError=async(i,s,a)=>{const f=bu(i,a),u=await this.core.crypto.encode(s,f),b=await this.core.history.get(s,i),v=Po[b.request.method]?Po[b.request.method].res:Po.unregistered_method.res;await this.core.relayer.publish(s,u,v),await this.core.history.resolve(f)},this.deletePairing=async(i,s)=>{await this.core.relayer.unsubscribe(i),await Promise.all([this.pairings.delete(i,qt("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(i),s?Promise.resolve():this.core.expirer.del(i)])},this.cleanup=async()=>{const i=this.pairings.getAll().filter(s=>bs(s.expiry));await Promise.all(i.map(s=>this.deletePairing(s.topic)))},this.onRelayEventRequest=i=>{const{topic:s,payload:a}=i;switch(a.method){case"wc_pairingPing":return this.onPairingPingRequest(s,a);case"wc_pairingDelete":return this.onPairingDeleteRequest(s,a);default:return this.onUnknownRpcMethodRequest(s,a)}},this.onRelayEventResponse=async i=>{const{topic:s,payload:a}=i,f=(await this.core.history.get(s,a.id)).request.method;switch(f){case"wc_pairingPing":return this.onPairingPingResponse(s,a);default:return this.onUnknownRpcMethodResponse(f)}},this.onPairingPingRequest=async(i,s)=>{const{id:a}=s;try{this.isValidPing({topic:i}),await this.sendResult(a,i,!0),this.events.emit(Js.ping,{id:a,topic:i})}catch(f){await this.sendError(a,i,f),this.logger.error(f)}},this.onPairingPingResponse=(i,s)=>{const{id:a}=s;setTimeout(()=>{En(s)?this.events.emit(St("pairing_ping",a),{}):Li(s)&&this.events.emit(St("pairing_ping",a),{error:s.error})},500)},this.onPairingDeleteRequest=async(i,s)=>{const{id:a}=s;try{this.isValidDisconnect({topic:i}),await this.deletePairing(i),this.events.emit(Js.delete,{id:a,topic:i})}catch(f){await this.sendError(a,i,f),this.logger.error(f)}},this.onUnknownRpcMethodRequest=async(i,s)=>{const{id:a,method:f}=s;try{if(this.registeredMethods.includes(f))return;const u=qt("WC_METHOD_UNSUPPORTED",f);await this.sendError(a,i,u),this.logger.error(u)}catch(u){await this.sendError(a,i,u),this.logger.error(u)}},this.onUnknownRpcMethodResponse=i=>{this.registeredMethods.includes(i)||this.logger.error(qt("WC_METHOD_UNSUPPORTED",i))},this.isValidPair=(i,s)=>{var a;if(!oi(i)){const{message:u}=Ae("MISSING_OR_INVALID",`pair() params: ${i}`);throw s.setError(Yn.malformed_pairing_uri),new Error(u)}if(!QE(i.uri)){const{message:u}=Ae("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw s.setError(Yn.malformed_pairing_uri),new Error(u)}const f=q1(i==null?void 0:i.uri);if(!((a=f==null?void 0:f.relay)!=null&&a.protocol)){const{message:u}=Ae("MISSING_OR_INVALID","pair() uri#relay-protocol");throw s.setError(Yn.malformed_pairing_uri),new Error(u)}if(!(f!=null&&f.symKey)){const{message:u}=Ae("MISSING_OR_INVALID","pair() uri#symKey");throw s.setError(Yn.malformed_pairing_uri),new Error(u)}if(f!=null&&f.expiryTimestamp&&Se.toMiliseconds(f==null?void 0:f.expiryTimestamp)<Date.now()){s.setError(Yn.pairing_expired);const{message:u}=Ae("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(u)}},this.isValidPing=async i=>{if(!oi(i)){const{message:a}=Ae("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(a)}const{topic:s}=i;await this.isValidPairingTopic(s)},this.isValidDisconnect=async i=>{if(!oi(i)){const{message:a}=Ae("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(a)}const{topic:s}=i;await this.isValidPairingTopic(s)},this.isValidPairingTopic=async i=>{if(!or(i,!1)){const{message:s}=Ae("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(s)}if(!this.pairings.keys.includes(i)){const{message:s}=Ae("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(s)}if(bs(this.pairings.get(i).expiry)){await this.deletePairing(i);const{message:s}=Ae("EXPIRED",`pairing topic: ${i}`);throw new Error(s)}},this.core=e,this.logger=Yr(t,this.name),this.pairings=new fa(this.core,this.logger,this.name,this.storagePrefix)}get context(){return li(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=Ae("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Gr.message,async e=>{const{topic:t,message:i,transportType:s}=e;if(!this.pairings.keys.includes(t)||s===kt.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))return;const a=await this.core.crypto.decode(t,i);try{bd(a)?(this.core.history.set(t,a),this.onRelayEventRequest({topic:t,payload:a})):mu(a)&&(await this.core.history.resolve(a),await this.onRelayEventResponse({topic:t,payload:a}),this.core.history.delete(t,a.id))}catch(f){this.logger.error(f)}})}registerExpirerEvents(){this.core.expirer.on(Bi.expired,async e=>{const{topic:t}=Tv(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(Js.expire,{topic:t}))})}}class aP extends Nx{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new zi.EventEmitter,this.name=rI,this.version=iI,this.cached=[],this.initialized=!1,this.storagePrefix=Nn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.records.set(i.id,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(i,s,a)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:i,request:s,chainId:a}),this.records.has(s.id))return;const f={id:s.id,topic:i,request:{method:s.method,params:s.params||null},chainId:a,expiry:pr(Se.THIRTY_DAYS)};this.records.set(f.id,f),this.persist(),this.events.emit(rn.created,f)},this.resolve=async i=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:i}),!this.records.has(i.id))return;const s=await this.getRecord(i.id);typeof s.response>"u"&&(s.response=Li(i)?{error:i.error}:{result:i.result},this.records.set(s.id,s),this.persist(),this.events.emit(rn.updated,s))},this.get=async(i,s)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:i,id:s}),await this.getRecord(s)),this.delete=(i,s)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:s}),this.values.forEach(a=>{if(a.topic===i){if(typeof s<"u"&&a.id!==s)return;this.records.delete(a.id),this.events.emit(rn.deleted,a)}}),this.persist()},this.exists=async(i,s)=>(this.isInitialized(),this.records.has(s)?(await this.getRecord(s)).topic===i:!1),this.on=(i,s)=>{this.events.on(i,s)},this.once=(i,s)=>{this.events.once(i,s)},this.off=(i,s)=>{this.events.off(i,s)},this.removeListener=(i,s)=>{this.events.removeListener(i,s)},this.logger=Yr(t,this.name)}get context(){return li(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(t=>{if(typeof t.response<"u")return;const i={topic:t.topic,request:Ss(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(i)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const t=this.records.get(e);if(!t){const{message:i}=Ae("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(rn.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:t}=Ae("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(rn.created,e=>{const t=rn.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(rn.updated,e=>{const t=rn.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(rn.deleted,e=>{const t=rn.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.core.heartbeat.on(eo.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(t=>{Se.toMiliseconds(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.records.delete(t.id),this.events.emit(rn.deleted,t,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=Ae("NOT_INITIALIZED",this.name);throw new Error(e)}}}class oP extends Ux{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new zi.EventEmitter,this.name=nI,this.version=sI,this.cached=[],this.initialized=!1,this.storagePrefix=Nn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.expirations.set(i.target,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=i=>{try{const s=this.formatTarget(i);return typeof this.getExpiration(s)<"u"}catch{return!1}},this.set=(i,s)=>{this.isInitialized();const a=this.formatTarget(i),f={target:a,expiry:s};this.expirations.set(a,f),this.checkExpiry(a,f),this.events.emit(Bi.created,{target:a,expiration:f})},this.get=i=>{this.isInitialized();const s=this.formatTarget(i);return this.getExpiration(s)},this.del=i=>{if(this.isInitialized(),this.has(i)){const s=this.formatTarget(i),a=this.getExpiration(s);this.expirations.delete(s),this.events.emit(Bi.deleted,{target:s,expiration:a})}},this.on=(i,s)=>{this.events.on(i,s)},this.once=(i,s)=>{this.events.once(i,s)},this.off=(i,s)=>{this.events.off(i,s)},this.removeListener=(i,s)=>{this.events.removeListener(i,s)},this.logger=Yr(t,this.name)}get context(){return li(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 b7(e);if(typeof e=="number")return m7(e);const{message:t}=Ae("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(Bi.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:t}=Ae("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:i}=Ae("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(i),new Error(i)}return t}checkExpiry(e,t){const{expiry:i}=t;Se.toMiliseconds(i)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(Bi.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(eo.pulse,()=>this.checkExpirations()),this.events.on(Bi.created,e=>{const t=Bi.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Bi.expired,e=>{const t=Bi.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Bi.deleted,e=>{const t=Bi.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=Ae("NOT_INITIALIZED",this.name);throw new Error(e)}}}var Jt={};Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.getLocalStorage=Jt.getLocalStorageOrThrow=Jt.getCrypto=Jt.getCryptoOrThrow=Jt.getLocation=Jt.getLocationOrThrow=Jt.getNavigator=Jt.getNavigatorOrThrow=Zb=Jt.getDocument=Jt.getDocumentOrThrow=Jt.getFromWindowOrThrow=Jt.getFromWindow=void 0;function ua(r){let e;return typeof window<"u"&&typeof window[r]<"u"&&(e=window[r]),e}Jt.getFromWindow=ua;function to(r){const e=ua(r);if(!e)throw new Error(`${r} is not defined in Window`);return e}Jt.getFromWindowOrThrow=to;function cP(){return to("document")}Jt.getDocumentOrThrow=cP;function fP(){return ua("document")}var Zb=Jt.getDocument=fP;function uP(){return to("navigator")}Jt.getNavigatorOrThrow=uP;function hP(){return ua("navigator")}Jt.getNavigator=hP;function lP(){return to("location")}Jt.getLocationOrThrow=lP;function dP(){return ua("location")}Jt.getLocation=dP;function pP(){return to("crypto")}Jt.getCryptoOrThrow=pP;function gP(){return ua("crypto")}Jt.getCrypto=gP;function vP(){return to("localStorage")}Jt.getLocalStorageOrThrow=vP;function bP(){return ua("localStorage")}Jt.getLocalStorage=bP;class mP extends $x{constructor(e,t,i){super(e,t,i),this.core=e,this.logger=t,this.store=i,this.name=aI,this.verifyUrlV3=cI,this.storagePrefix=Nn,this.version=Ub,this.init=async()=>{var s;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&Se.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(!ic()||this.isDevEnv)return;const a=window.location.origin,{id:f,decryptedId:u}=s,b=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${a}&id=${f}&decryptedId=${u}`;try{const v=Zb(),w=this.startAbortTimer(Se.ONE_SECOND*5),S=await new Promise((O,P)=>{const R=()=>{window.removeEventListener("message",W),v.body.removeChild(z),P("attestation aborted")};this.abortController.signal.addEventListener("abort",R);const z=v.createElement("iframe");z.src=b,z.style.display="none",z.addEventListener("error",R,{signal:this.abortController.signal});const W=Q=>{if(Q.data&&typeof Q.data=="string")try{const j=JSON.parse(Q.data);if(j.type==="verify_attestation"){if(_l(j.attestation).payload.id!==f)return;clearInterval(w),v.body.removeChild(z),this.abortController.signal.removeEventListener("abort",R),window.removeEventListener("message",W),O(j.attestation===null?"":j.attestation)}}catch(j){this.logger.warn(j)}};v.body.appendChild(z),window.addEventListener("message",W,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",S),S}catch(v){this.logger.warn(v)}return""},this.resolve=async s=>{if(this.isDevEnv)return"";const{attestationId:a,hash:f,encryptedId:u}=s;if(a===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(a){if(_l(a).payload.id!==u)return;const v=await this.isValidJwtAttestation(a);if(v){if(!v.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return v}}if(!f)return;const b=this.getVerifyUrl(s==null?void 0:s.verifyUrl);return this.fetchAttestation(f,b)},this.fetchAttestation=async(s,a)=>{this.logger.debug(`resolving attestation: ${s} from url: ${a}`);const f=this.startAbortTimer(Se.ONE_SECOND*5),u=await fetch(`${a}/attestation/${s}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(f),u.status===200?await u.json():void 0},this.getVerifyUrl=s=>{let a=s||jo;return fI.includes(a)||(this.logger.info(`verify url: ${a}, not included in trusted list, assigning default: ${jo}`),a=jo),a},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const s=this.startAbortTimer(Se.FIVE_SECONDS),a=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(s),await a.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 a=await this.getPublicKey();try{if(a)return this.validateAttestation(s,a)}catch(u){this.logger.error(u),this.logger.warn("error validating attestation")}const f=await this.fetchAndPersistPublicKey();try{if(f)return this.validateAttestation(s,f)}catch(u){this.logger.error(u),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async a=>{const f=await this.fetchPublicKey();f&&(await this.persistPublicKey(f),a(f))});const s=await this.fetchPromise;return this.fetchPromise=void 0,s},this.validateAttestation=(s,a)=>{const f=RE(s,a.publicKey),u={hasExpired:Se.toMiliseconds(f.exp)<Date.now(),payload:f};if(u.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:u.payload.origin,isScam:u.payload.isScam,isVerified:u.payload.isVerified}},this.logger=Yr(t,this.name),this.abortController=new AbortController,this.isDevEnv=sd(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return li(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),Se.toMiliseconds(e))}}class yP extends zx{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.context=uI,this.registerDeviceToken=async i=>{const{clientId:s,token:a,notificationType:f,enableEncrypted:u=!1}=i,b=`${hI}/${this.projectId}/clients`;await fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:s,type:f,token:a,always_raw:u})})},this.logger=Yr(t,this.context)}}var wP=Object.defineProperty,Ag=Object.getOwnPropertySymbols,_P=Object.prototype.hasOwnProperty,AP=Object.prototype.propertyIsEnumerable,Eg=(r,e,t)=>e in r?wP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ro=(r,e)=>{for(var t in e||(e={}))_P.call(e,t)&&Eg(r,t,e[t]);if(Ag)for(var t of Ag(e))AP.call(e,t)&&Eg(r,t,e[t]);return r};class EP extends jx{constructor(e,t,i=!0){super(e,t,i),this.core=e,this.logger=t,this.context=dI,this.storagePrefix=Nn,this.storageVersion=lI,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!sd())try{const s={eventId:r1(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:Ov(this.core.relayer.protocol,this.core.relayer.version,Fl)}}};await this.sendEvent([s])}catch(s){this.logger.warn(s)}},this.createEvent=s=>{const{event:a="ERROR",type:f="",properties:{topic:u,trace:b}}=s,v=r1(),w=this.core.projectId||"",S=Date.now(),O=Ro({eventId:v,timestamp:S,props:{event:a,type:f,properties:{topic:u,trace:b}},bundleId:w,domain:this.getAppDomain()},this.setMethods(v));return this.telemetryEnabled&&(this.events.set(v,O),this.shouldPersist=!0),O},this.getEvent=s=>{const{eventId:a,topic:f}=s;if(a)return this.events.get(a);const u=Array.from(this.events.values()).find(b=>b.props.properties.topic===f);if(u)return Ro(Ro({},u),this.setMethods(u.eventId))},this.deleteEvent=s=>{const{eventId:a}=s;this.events.delete(a),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(eo.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(s=>{Se.fromMiliseconds(Date.now())-Se.fromMiliseconds(s.timestamp)>pI&&(this.events.delete(s.eventId),this.shouldPersist=!0)})})},this.setMethods=s=>({addTrace:a=>this.addTrace(s,a),setError:a=>this.setError(s,a)}),this.addTrace=(s,a)=>{const f=this.events.get(s);f&&(f.props.properties.trace.push(a),this.events.set(s,f),this.shouldPersist=!0)},this.setError=(s,a)=>{const f=this.events.get(s);f&&(f.props.type=a,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(a=>{this.events.set(a.eventId,Ro(Ro({},a),this.setMethods(a.eventId)))})}catch(s){this.logger.warn(s)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const s=[];for(const[a,f]of this.events)f.props.type&&s.push(f);if(s.length!==0)try{if((await this.sendEvent(s)).ok)for(const a of s)this.events.delete(a.eventId),this.shouldPersist=!0}catch(a){this.logger.warn(a)}},this.sendEvent=async s=>{const a=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${gI}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${Fl}${a}`,{method:"POST",body:JSON.stringify(s)})},this.getAppDomain=()=>Pv().url,this.logger=Yr(t,this.context),this.telemetryEnabled=i,i?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var SP=Object.defineProperty,Sg=Object.getOwnPropertySymbols,xP=Object.prototype.hasOwnProperty,MP=Object.prototype.propertyIsEnumerable,xg=(r,e,t)=>e in r?SP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Mg=(r,e)=>{for(var t in e||(e={}))xP.call(e,t)&&xg(r,t,e[t]);if(Sg)for(var t of Sg(e))MP.call(e,t)&&xg(r,t,e[t]);return r};class yd extends Rx{constructor(e){var t;super(e),this.protocol=Lb,this.version=Ub,this.name=md,this.events=new zi.EventEmitter,this.initialized=!1,this.on=(f,u)=>this.events.on(f,u),this.once=(f,u)=>this.events.once(f,u),this.off=(f,u)=>this.events.off(f,u),this.removeListener=(f,u)=>this.events.removeListener(f,u),this.dispatchEnvelope=({topic:f,message:u,sessionExists:b})=>{if(!f||!u)return;const v={topic:f,message:u,publishedAt:Date.now(),transportType:kt.link_mode};this.relayer.onLinkMessageEvent(v,{sessionExists:b})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||zb,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const i=gu({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:FM.logger}),{logger:s,chunkLoggerController:a}=Cx({opts:i,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=a,(t=this.logChunkController)!=null&&t.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var f,u;(f=this.logChunkController)!=null&&f.downloadLogsBlobInBrowser&&((u=this.logChunkController)==null||u.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=Yr(s,this.name),this.heartbeat=new xS,this.crypto=new zD(this,this.logger,e==null?void 0:e.keychain),this.history=new aP(this,this.logger),this.expirer=new oP(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new ix(Mg(Mg({},BM),e==null?void 0:e.storageOptions)),this.relayer=new tP({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new sP(this,this.logger),this.verify=new mP(this,this.logger,this.storage),this.echoClient=new yP(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new EP(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const t=new yd(e);await t.initialize();const i=await t.crypto.getClientId();return await t.storage.setItem(YM,i),t}get context(){return li(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(cg,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(cg)||[],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 IP=yd,em="wc",tm=2,rm="client",wd=`${em}@${tm}:${rm}:`,cl={name:rm,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.org"},Ig="WALLETCONNECT_DEEPLINK_CHOICE",DP="proposal",im="Proposal expired",PP="session",Ra=Se.SEVEN_DAYS,OP="engine",mr={wc_sessionPropose:{req:{ttl:Se.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Se.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:Se.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:Se.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:Se.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Se.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Se.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Se.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Se.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Se.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Se.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Se.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Se.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Se.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Se.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Se.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Se.ONE_DAY,prompt:!1,tag:1114},res:{ttl:Se.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:Se.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:Se.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:Se.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:Se.FIVE_MINUTES,prompt:!1,tag:1119}}},fl={min:Se.FIVE_MINUTES,max:Se.SEVEN_DAYS},yn={idle:"IDLE",active:"ACTIVE"},CP="request",RP=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],NP="wc",TP="auth",FP="authKeys",BP="pairingTopics",qP="requests",wu=`${NP}@${1.5}:${TP}:`,Bf=`${wu}:PUB_KEY`;var LP=Object.defineProperty,UP=Object.defineProperties,$P=Object.getOwnPropertyDescriptors,Dg=Object.getOwnPropertySymbols,zP=Object.prototype.hasOwnProperty,jP=Object.prototype.propertyIsEnumerable,Pg=(r,e,t)=>e in r?LP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,er=(r,e)=>{for(var t in e||(e={}))zP.call(e,t)&&Pg(r,t,e[t]);if(Dg)for(var t of Dg(e))jP.call(e,t)&&Pg(r,t,e[t]);return r},sn=(r,e)=>UP(r,$P(e));class kP extends Hx{constructor(e){super(e),this.name=OP,this.events=new Kl,this.initialized=!1,this.requestQueue={state:yn.idle,queue:[]},this.sessionRequestQueue={state:yn.idle,queue:[]},this.requestQueueDelay=Se.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(mr)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},Se.toMiliseconds(this.requestQueueDelay)))},this.connect=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const i=sn(er({},t),{requiredNamespaces:t.requiredNamespaces||{},optionalNamespaces:t.optionalNamespaces||{}});await this.isValidConnect(i);const{pairingTopic:s,requiredNamespaces:a,optionalNamespaces:f,sessionProperties:u,relays:b}=i;let v=s,w,S=!1;try{v&&(S=this.client.core.pairing.pairings.get(v).active)}catch(U){throw this.client.logger.error(`connect() -> pairing.get(${v}) failed`),U}if(!v||!S){const{topic:U,uri:k}=await this.client.core.pairing.create();v=U,w=k}if(!v){const{message:U}=Ae("NO_MATCHING_KEY",`connect() pairing topic: ${v}`);throw new Error(U)}const O=await this.client.core.crypto.generateKeyPair(),P=mr.wc_sessionPropose.req.ttl||Se.FIVE_MINUTES,R=pr(P),z=er({requiredNamespaces:a,optionalNamespaces:f,relays:b??[{protocol:$b}],proposer:{publicKey:O,metadata:this.client.metadata},expiryTimestamp:R,pairingTopic:v},u&&{sessionProperties:u}),{reject:W,resolve:Q,done:j}=Gs(P,im);this.events.once(St("session_connect"),async({error:U,session:k})=>{if(U)W(U);else if(k){k.self.publicKey=O;const V=sn(er({},k),{pairingTopic:z.pairingTopic,requiredNamespaces:z.requiredNamespaces,optionalNamespaces:z.optionalNamespaces,transportType:kt.relay});await this.client.session.set(k.topic,V),await this.setExpiry(k.topic,k.expiry),v&&await this.client.core.pairing.updateMetadata({topic:v,metadata:k.peer.metadata}),this.cleanupDuplicatePairings(V),Q(V)}});const Y=await this.sendRequest({topic:v,method:"wc_sessionPropose",params:z,throwOnFailedPublish:!0});return await this.setProposal(Y,er({id:Y},z)),{uri:w,approval:j}},this.pair=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(t)}catch(i){throw this.client.logger.error("pair() failed"),i}},this.approve=async t=>{var i,s,a;const f=this.client.core.eventClient.createEvent({properties:{topic:(i=t==null?void 0:t.id)==null?void 0:i.toString(),trace:[nn.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(F){throw f.setError(Ks.no_internet_connection),F}try{await this.isValidProposalId(t==null?void 0:t.id)}catch(F){throw this.client.logger.error(`approve() -> proposal.get(${t==null?void 0:t.id}) failed`),f.setError(Ks.proposal_not_found),F}try{await this.isValidApprove(t)}catch(F){throw this.client.logger.error("approve() -> isValidApprove() failed"),f.setError(Ks.session_approve_namespace_validation_failure),F}const{id:u,relayProtocol:b,namespaces:v,sessionProperties:w,sessionConfig:S}=t,O=this.client.proposal.get(u);this.client.core.eventClient.deleteEvent({eventId:f.eventId});const{pairingTopic:P,proposer:R,requiredNamespaces:z,optionalNamespaces:W}=O;let Q=(s=this.client.core.eventClient)==null?void 0:s.getEvent({topic:P});Q||(Q=(a=this.client.core.eventClient)==null?void 0:a.createEvent({type:nn.session_approve_started,properties:{topic:P,trace:[nn.session_approve_started,nn.session_namespaces_validation_success]}}));const j=await this.client.core.crypto.generateKeyPair(),Y=R.publicKey,U=await this.client.core.crypto.generateSharedKey(j,Y),k=er(er({relay:{protocol:b??"irn"},namespaces:v,controller:{publicKey:j,metadata:this.client.metadata},expiry:pr(Ra)},w&&{sessionProperties:w}),S&&{sessionConfig:S}),V=kt.relay;Q.addTrace(nn.subscribing_session_topic);try{await this.client.core.relayer.subscribe(U,{transportType:V})}catch(F){throw Q.setError(Ks.subscribe_session_topic_failure),F}Q.addTrace(nn.subscribe_session_topic_success);const A=sn(er({},k),{topic:U,requiredNamespaces:z,optionalNamespaces:W,pairingTopic:P,acknowledged:!1,self:k.controller,peer:{publicKey:R.publicKey,metadata:R.metadata},controller:j,transportType:kt.relay});await this.client.session.set(U,A),Q.addTrace(nn.store_session);try{Q.addTrace(nn.publishing_session_settle),await this.sendRequest({topic:U,method:"wc_sessionSettle",params:k,throwOnFailedPublish:!0}).catch(F=>{throw Q==null||Q.setError(Ks.session_settle_publish_failure),F}),Q.addTrace(nn.session_settle_publish_success),Q.addTrace(nn.publishing_session_approve),await this.sendResult({id:u,topic:P,result:{relay:{protocol:b??"irn"},responderPublicKey:j},throwOnFailedPublish:!0}).catch(F=>{throw Q==null||Q.setError(Ks.session_approve_publish_failure),F}),Q.addTrace(nn.session_approve_publish_success)}catch(F){throw this.client.logger.error(F),this.client.session.delete(U,qt("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(U),F}return this.client.core.eventClient.deleteEvent({eventId:Q.eventId}),await this.client.core.pairing.updateMetadata({topic:P,metadata:R.metadata}),await this.client.proposal.delete(u,qt("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:P}),await this.setExpiry(U,pr(Ra)),{topic:U,acknowledged:()=>Promise.resolve(this.client.session.get(U))}},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:i,reason:s}=t;let a;try{a=this.client.proposal.get(i).pairingTopic}catch(f){throw this.client.logger.error(`reject() -> proposal.get(${i}) failed`),f}a&&(await this.sendError({id:i,topic:a,error:s,rpcOpts:mr.wc_sessionPropose.reject}),await this.client.proposal.delete(i,qt("USER_DISCONNECTED")))},this.update=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(t)}catch(S){throw this.client.logger.error("update() -> isValidUpdate() failed"),S}const{topic:i,namespaces:s}=t,{done:a,resolve:f,reject:u}=Gs(),b=ys(),v=Qs().toString(),w=this.client.session.get(i).namespaces;return this.events.once(St("session_update",b),({error:S})=>{S?u(S):f()}),await this.client.session.update(i,{namespaces:s}),await this.sendRequest({topic:i,method:"wc_sessionUpdate",params:{namespaces:s},throwOnFailedPublish:!0,clientRpcId:b,relayRpcId:v}).catch(S=>{this.client.logger.error(S),this.client.session.update(i,{namespaces:w}),u(S)}),{acknowledged:a}},this.extend=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(t)}catch(b){throw this.client.logger.error("extend() -> isValidExtend() failed"),b}const{topic:i}=t,s=ys(),{done:a,resolve:f,reject:u}=Gs();return this.events.once(St("session_extend",s),({error:b})=>{b?u(b):f()}),await this.setExpiry(i,pr(Ra)),this.sendRequest({topic:i,method:"wc_sessionExtend",params:{},clientRpcId:s,throwOnFailedPublish:!0}).catch(b=>{u(b)}),{acknowledged:a}},this.request=async t=>{this.isInitialized();try{await this.isValidRequest(t)}catch(R){throw this.client.logger.error("request() -> isValidRequest() failed"),R}const{chainId:i,request:s,topic:a,expiry:f=mr.wc_sessionRequest.req.ttl}=t,u=this.client.session.get(a);(u==null?void 0:u.transportType)===kt.relay&&await this.confirmOnlineStateOrThrow();const b=ys(),v=Qs().toString(),{done:w,resolve:S,reject:O}=Gs(f,"Request expired. Please try again.");this.events.once(St("session_request",b),({error:R,result:z})=>{R?O(R):S(z)});const P=this.getAppLinkIfEnabled(u.peer.metadata,u.transportType);return P?(await this.sendRequest({clientRpcId:b,relayRpcId:v,topic:a,method:"wc_sessionRequest",params:{request:sn(er({},s),{expiryTimestamp:pr(f)}),chainId:i},expiry:f,throwOnFailedPublish:!0,appLink:P}).catch(R=>O(R)),this.client.events.emit("session_request_sent",{topic:a,request:s,chainId:i,id:b}),await w()):await Promise.all([new Promise(async R=>{await this.sendRequest({clientRpcId:b,relayRpcId:v,topic:a,method:"wc_sessionRequest",params:{request:sn(er({},s),{expiryTimestamp:pr(f)}),chainId:i},expiry:f,throwOnFailedPublish:!0}).catch(z=>O(z)),this.client.events.emit("session_request_sent",{topic:a,request:s,chainId:i,id:b}),R()}),new Promise(async R=>{var z;if(!((z=u.sessionConfig)!=null&&z.disableDeepLink)){const W=await _7(this.client.core.storage,Ig);await y7({id:b,topic:a,wcDeepLink:W})}R()}),w()]).then(R=>R[2])},this.respond=async t=>{this.isInitialized(),await this.isValidRespond(t);const{topic:i,response:s}=t,{id:a}=s,f=this.client.session.get(i);f.transportType===kt.relay&&await this.confirmOnlineStateOrThrow();const u=this.getAppLinkIfEnabled(f.peer.metadata,f.transportType);En(s)?await this.sendResult({id:a,topic:i,result:s.result,throwOnFailedPublish:!0,appLink:u}):Li(s)&&await this.sendError({id:a,topic:i,error:s.error,appLink:u}),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:i}=t;if(this.client.session.keys.includes(i)){const s=ys(),a=Qs().toString(),{done:f,resolve:u,reject:b}=Gs();this.events.once(St("session_ping",s),({error:v})=>{v?b(v):u()}),await Promise.all([this.sendRequest({topic:i,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:s,relayRpcId:a}),f()])}else this.client.core.pairing.pairings.keys.includes(i)&&await this.client.core.pairing.ping({topic:i})},this.emit=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(t);const{topic:i,event:s,chainId:a}=t,f=Qs().toString();await this.sendRequest({topic:i,method:"wc_sessionEvent",params:{event:s,chainId:a},throwOnFailedPublish:!0,relayRpcId:f})},this.disconnect=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(t);const{topic:i}=t;if(this.client.session.keys.includes(i))await this.sendRequest({topic:i,method:"wc_sessionDelete",params:qt("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:i,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(i))await this.client.core.pairing.disconnect({topic:i});else{const{message:s}=Ae("MISMATCHED_TOPIC",`Session or pairing topic not found: ${i}`);throw new Error(s)}},this.find=t=>(this.isInitialized(),this.client.session.getAll().filter(i=>JE(i,t))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(t,i)=>{var s;this.isInitialized(),this.isValidAuthenticate(t);const a=i&&this.client.core.linkModeSupportedApps.includes(i)&&((s=this.client.metadata.redirect)==null?void 0:s.linkMode),f=a?kt.link_mode:kt.relay;f===kt.relay&&await this.confirmOnlineStateOrThrow();const{chains:u,statement:b="",uri:v,domain:w,nonce:S,type:O,exp:P,nbf:R,methods:z=[],expiry:W}=t,Q=[...t.resources||[]],{topic:j,uri:Y}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:f});this.client.logger.info({message:"Generated new pairing",pairing:{topic:j,uri:Y}});const U=await this.client.core.crypto.generateKeyPair(),k=Nf(U);if(await Promise.all([this.client.auth.authKeys.set(Bf,{responseTopic:k,publicKey:U}),this.client.auth.pairingTopics.set(k,{topic:k,pairingTopic:j})]),await this.client.core.relayer.subscribe(k,{transportType:f}),this.client.logger.info(`sending request to new pairing topic: ${j}`),z.length>0){const{namespace:I}=qo(u[0]);let x=vE(I,"request",z);Rf(Q)&&(x=mE(x,Q.pop())),Q.push(x)}const V=W&&W>mr.wc_sessionAuthenticate.req.ttl?W:mr.wc_sessionAuthenticate.req.ttl,A={authPayload:{type:O??"caip122",chains:u,statement:b,aud:v,domain:w,version:"1",nonce:S,iat:new Date().toISOString(),exp:P,nbf:R,resources:Q},requester:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:pr(V)},F={eip155:{chains:u,methods:[...new Set(["personal_sign",...z])],events:["chainChanged","accountsChanged"]}},ae={requiredNamespaces:{},optionalNamespaces:F,relays:[{protocol:"irn"}],pairingTopic:j,proposer:{publicKey:U,metadata:this.client.metadata},expiryTimestamp:pr(mr.wc_sessionPropose.req.ttl)},{done:de,resolve:L,reject:m}=Gs(V,"Request expired"),c=async({error:I,session:x})=>{if(this.events.off(St("session_request",d),p),I)m(I);else if(x){x.self.publicKey=U,await this.client.session.set(x.topic,x),await this.setExpiry(x.topic,x.expiry),j&&await this.client.core.pairing.updateMetadata({topic:j,metadata:x.peer.metadata});const l=this.client.session.get(x.topic);await this.deleteProposal(y),L({session:l})}},p=async I=>{var x,l,g;if(await this.deletePendingAuthRequest(d,{message:"fulfilled",code:0}),I.error){const H=qt("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return I.error.code===H.code?void 0:(this.events.off(St("session_connect"),c),m(I.error.message))}await this.deleteProposal(y),this.events.off(St("session_connect"),c);const{cacaos:N,responder:Z}=I.result,te=[],D=[];for(const H of N){await D1({cacao:H,projectId:this.client.core.projectId})||(this.client.logger.error(H,"Signature verification failed"),m(qt("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:K}=H,_=Rf(K.resources),$=[I1(K.iss)],se=Gf(K.iss);if(_){const ce=P1(_),ue=O1(_);te.push(...ce),$.push(...ue)}for(const ce of $)D.push(`${ce}:${se}`)}const ee=await this.client.core.crypto.generateSharedKey(U,Z.publicKey);let B;te.length>0&&(B={topic:ee,acknowledged:!0,self:{publicKey:U,metadata:this.client.metadata},peer:Z,controller:Z.publicKey,expiry:pr(Ra),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:j,namespaces:U1([...new Set(te)],[...new Set(D)]),transportType:f},await this.client.core.relayer.subscribe(ee,{transportType:f}),await this.client.session.set(ee,B),j&&await this.client.core.pairing.updateMetadata({topic:j,metadata:Z.metadata}),B=this.client.session.get(ee)),(x=this.client.metadata.redirect)!=null&&x.linkMode&&(l=Z.metadata.redirect)!=null&&l.linkMode&&(g=Z.metadata.redirect)!=null&&g.universal&&i&&(this.client.core.addLinkModeSupportedApp(Z.metadata.redirect.universal),this.client.session.update(ee,{transportType:kt.link_mode})),L({auths:N,session:B})},d=ys(),y=ys();this.events.once(St("session_connect"),c),this.events.once(St("session_request",d),p);let M;try{if(a){const I=Ss("wc_sessionAuthenticate",A,d);this.client.core.history.set(j,I);const x=await this.client.core.crypto.encode("",I,{type:oc,encoding:Io});M=wf(i,j,x)}else await Promise.all([this.sendRequest({topic:j,method:"wc_sessionAuthenticate",params:A,expiry:t.expiry,throwOnFailedPublish:!0,clientRpcId:d}),this.sendRequest({topic:j,method:"wc_sessionPropose",params:ae,expiry:mr.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:y})])}catch(I){throw this.events.off(St("session_connect"),c),this.events.off(St("session_request",d),p),I}return await this.setProposal(y,er({id:y},ae)),await this.setAuthRequest(d,{request:sn(er({},A),{verifyContext:{}}),pairingTopic:j,transportType:f}),{uri:M??Y,response:de}},this.approveSessionAuthenticate=async t=>{const{id:i,auths:s}=t,a=this.client.core.eventClient.createEvent({properties:{topic:i.toString(),trace:[Vs.authenticated_session_approve_started]}});try{this.isInitialized()}catch(W){throw a.setError(Oo.no_internet_connection),W}const f=this.getPendingAuthRequest(i);if(!f)throw a.setError(Oo.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${i}`);const u=f.transportType||kt.relay;u===kt.relay&&await this.confirmOnlineStateOrThrow();const b=f.requester.publicKey,v=await this.client.core.crypto.generateKeyPair(),w=Nf(b),S={type:rs,receiverPublicKey:b,senderPublicKey:v},O=[],P=[];for(const W of s){if(!await D1({cacao:W,projectId:this.client.core.projectId})){a.setError(Oo.invalid_cacao);const k=qt("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:i,topic:w,error:k,encodeOpts:S}),new Error(k.message)}a.addTrace(Vs.cacaos_verified);const{p:Q}=W,j=Rf(Q.resources),Y=[I1(Q.iss)],U=Gf(Q.iss);if(j){const k=P1(j),V=O1(j);O.push(...k),Y.push(...V)}for(const k of Y)P.push(`${k}:${U}`)}const R=await this.client.core.crypto.generateSharedKey(v,b);a.addTrace(Vs.create_authenticated_session_topic);let z;if((O==null?void 0:O.length)>0){z={topic:R,acknowledged:!0,self:{publicKey:v,metadata:this.client.metadata},peer:{publicKey:b,metadata:f.requester.metadata},controller:b,expiry:pr(Ra),authentication:s,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:f.pairingTopic,namespaces:U1([...new Set(O)],[...new Set(P)]),transportType:u},a.addTrace(Vs.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(R,{transportType:u})}catch(W){throw a.setError(Oo.subscribe_authenticated_session_topic_failure),W}a.addTrace(Vs.subscribe_authenticated_session_topic_success),await this.client.session.set(R,z),a.addTrace(Vs.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:f.pairingTopic,metadata:f.requester.metadata})}a.addTrace(Vs.publishing_authenticated_session_approve);try{await this.sendResult({topic:w,id:i,result:{cacaos:s,responder:{publicKey:v,metadata:this.client.metadata}},encodeOpts:S,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(f.requester.metadata,u)})}catch(W){throw a.setError(Oo.authenticated_session_approve_publish_failure),W}return await this.client.auth.requests.delete(i,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:f.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:a.eventId}),{session:z}},this.rejectSessionAuthenticate=async t=>{this.isInitialized();const{id:i,reason:s}=t,a=this.getPendingAuthRequest(i);if(!a)throw new Error(`Could not find pending auth request with id ${i}`);a.transportType===kt.relay&&await this.confirmOnlineStateOrThrow();const f=a.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),b=Nf(f),v={type:rs,receiverPublicKey:f,senderPublicKey:u};await this.sendError({id:i,topic:b,error:s,encodeOpts:v,rpcOpts:mr.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(a.requester.metadata,a.transportType)}),await this.client.auth.requests.delete(i,{message:"rejected",code:0}),await this.client.proposal.delete(i,qt("USER_DISCONNECTED"))},this.formatAuthMessage=t=>{this.isInitialized();const{request:i,iss:s}=t;return bb(i,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 i=this.client.core.pairing.pairings.get(t.pairingTopic),s=this.client.core.pairing.pairings.getAll().filter(a=>{var f,u;return((f=a.peerMetadata)==null?void 0:f.url)&&((u=a.peerMetadata)==null?void 0:u.url)===t.peer.metadata.url&&a.topic&&a.topic!==i.topic});if(s.length===0)return;this.client.logger.info(`Cleaning up ${s.length} duplicate pairing(s)`),await Promise.all(s.map(a=>this.client.core.pairing.disconnect({topic:a.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(i){this.client.logger.error(i)}},this.deleteSession=async t=>{var i;const{topic:s,expirerHasDeleted:a=!1,emitEvent:f=!0,id:u=0}=t,{self:b}=this.client.session.get(s);await this.client.core.relayer.unsubscribe(s),await this.client.session.delete(s,qt("USER_DISCONNECTED")),this.addToRecentlyDeleted(s,"session"),this.client.core.crypto.keychain.has(b.publicKey)&&await this.client.core.crypto.deleteKeyPair(b.publicKey),this.client.core.crypto.keychain.has(s)&&await this.client.core.crypto.deleteSymKey(s),a||this.client.core.expirer.del(s),this.client.core.storage.removeItem(Ig).catch(v=>this.client.logger.warn(v)),this.getPendingSessionRequests().forEach(v=>{v.topic===s&&this.deletePendingSessionRequest(v.id,qt("USER_DISCONNECTED"))}),s===((i=this.sessionRequestQueue.queue[0])==null?void 0:i.topic)&&(this.sessionRequestQueue.state=yn.idle),f&&this.client.events.emit("session_delete",{id:u,topic:s})},this.deleteProposal=async(t,i)=>{if(i)try{const s=this.client.proposal.get(t),a=this.client.core.eventClient.getEvent({topic:s.pairingTopic});a==null||a.setError(Ks.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(t,qt("USER_DISCONNECTED")),i?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"proposal")},this.deletePendingSessionRequest=async(t,i,s=!1)=>{await Promise.all([this.client.pendingRequest.delete(t,i),s?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(a=>a.id!==t),s&&(this.sessionRequestQueue.state=yn.idle,this.client.events.emit("session_request_expire",{id:t}))},this.deletePendingAuthRequest=async(t,i,s=!1)=>{await Promise.all([this.client.auth.requests.delete(t,i),s?Promise.resolve():this.client.core.expirer.del(t)])},this.setExpiry=async(t,i)=>{this.client.session.keys.includes(t)&&(this.client.core.expirer.set(t,i),await this.client.session.update(t,{expiry:i}))},this.setProposal=async(t,i)=>{this.client.core.expirer.set(t,pr(mr.wc_sessionPropose.req.ttl)),await this.client.proposal.set(t,i)},this.setAuthRequest=async(t,i)=>{const{request:s,pairingTopic:a,transportType:f=kt.relay}=i;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:a,verifyContext:s.verifyContext,transportType:f})},this.setPendingSessionRequest=async t=>{const{id:i,topic:s,params:a,verifyContext:f}=t,u=a.request.expiryTimestamp||pr(mr.wc_sessionRequest.req.ttl);this.client.core.expirer.set(i,u),await this.client.pendingRequest.set(i,{id:i,topic:s,params:a,verifyContext:f})},this.sendRequest=async t=>{const{topic:i,method:s,params:a,expiry:f,relayRpcId:u,clientRpcId:b,throwOnFailedPublish:v,appLink:w}=t,S=Ss(s,a,b);let O;const P=!!w;try{const W=P?Io:Es;O=await this.client.core.crypto.encode(i,S,{encoding:W})}catch(W){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${i} failed`),W}let R;if(RP.includes(s)){const W=Xn(JSON.stringify(S)),Q=Xn(O);R=await this.client.core.verify.register({id:Q,decryptedId:W})}const z=mr[s].req;if(z.attestation=R,f&&(z.ttl=f),u&&(z.id=u),this.client.core.history.set(i,S),P){const W=wf(w,i,O);await global.Linking.openURL(W,this.client.name)}else{const W=mr[s].req;f&&(W.ttl=f),u&&(W.id=u),v?(W.internal=sn(er({},W.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,O,W)):this.client.core.relayer.publish(i,O,W).catch(Q=>this.client.logger.error(Q))}return S.id},this.sendResult=async t=>{const{id:i,topic:s,result:a,throwOnFailedPublish:f,encodeOpts:u,appLink:b}=t,v=vu(i,a);let w;const S=b&&typeof(global==null?void 0:global.Linking)<"u";try{const P=S?Io:Es;w=await this.client.core.crypto.encode(s,v,sn(er({},u||{}),{encoding:P}))}catch(P){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${s} failed`),P}let O;try{O=await this.client.core.history.get(s,i)}catch(P){throw this.client.logger.error(`sendResult() -> history.get(${s}, ${i}) failed`),P}if(S){const P=wf(b,s,w);await global.Linking.openURL(P,this.client.name)}else{const P=mr[O.request.method].res;f?(P.internal=sn(er({},P.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(s,w,P)):this.client.core.relayer.publish(s,w,P).catch(R=>this.client.logger.error(R))}await this.client.core.history.resolve(v)},this.sendError=async t=>{const{id:i,topic:s,error:a,encodeOpts:f,rpcOpts:u,appLink:b}=t,v=bu(i,a);let w;const S=b&&typeof(global==null?void 0:global.Linking)<"u";try{const P=S?Io:Es;w=await this.client.core.crypto.encode(s,v,sn(er({},f||{}),{encoding:P}))}catch(P){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${s} failed`),P}let O;try{O=await this.client.core.history.get(s,i)}catch(P){throw this.client.logger.error(`sendError() -> history.get(${s}, ${i}) failed`),P}if(S){const P=wf(b,s,w);await global.Linking.openURL(P,this.client.name)}else{const P=u||mr[O.request.method].res;this.client.core.relayer.publish(s,w,P)}await this.client.core.history.resolve(v)},this.cleanup=async()=>{const t=[],i=[];this.client.session.getAll().forEach(s=>{let a=!1;bs(s.expiry)&&(a=!0),this.client.core.crypto.keychain.has(s.topic)||(a=!0),a&&t.push(s.topic)}),this.client.proposal.getAll().forEach(s=>{bs(s.expiryTimestamp)&&i.push(s.id)}),await Promise.all([...t.map(s=>this.deleteSession({topic:s})),...i.map(s=>this.deleteProposal(s))])},this.onRelayEventRequest=async t=>{this.requestQueue.queue.push(t),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===yn.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=yn.active;const t=this.requestQueue.queue.shift();if(t)try{await this.processRequest(t)}catch(i){this.client.logger.warn(i)}}this.requestQueue.state=yn.idle},this.processRequest=async t=>{const{topic:i,payload:s,attestation:a,transportType:f,encryptedId:u}=t,b=s.method;if(!this.shouldIgnorePairingRequest({topic:i,requestMethod:b}))switch(b){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:i,payload:s,attestation:a,encryptedId:u});case"wc_sessionSettle":return await this.onSessionSettleRequest(i,s);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(i,s);case"wc_sessionExtend":return await this.onSessionExtendRequest(i,s);case"wc_sessionPing":return await this.onSessionPingRequest(i,s);case"wc_sessionDelete":return await this.onSessionDeleteRequest(i,s);case"wc_sessionRequest":return await this.onSessionRequest({topic:i,payload:s,attestation:a,encryptedId:u,transportType:f});case"wc_sessionEvent":return await this.onSessionEventRequest(i,s);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:i,payload:s,attestation:a,encryptedId:u,transportType:f});default:return this.client.logger.info(`Unsupported request method ${b}`)}},this.onRelayEventResponse=async t=>{const{topic:i,payload:s,transportType:a}=t,f=(await this.client.core.history.get(i,s.id)).request.method;switch(f){case"wc_sessionPropose":return this.onSessionProposeResponse(i,s,a);case"wc_sessionSettle":return this.onSessionSettleResponse(i,s);case"wc_sessionUpdate":return this.onSessionUpdateResponse(i,s);case"wc_sessionExtend":return this.onSessionExtendResponse(i,s);case"wc_sessionPing":return this.onSessionPingResponse(i,s);case"wc_sessionRequest":return this.onSessionRequestResponse(i,s);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(i,s);default:return this.client.logger.info(`Unsupported response method ${f}`)}},this.onRelayEventUnknownPayload=t=>{const{topic:i}=t,{message:s}=Ae("MISSING_OR_INVALID",`Decoded payload on topic ${i} is not identifiable as a JSON-RPC request or a response.`);throw new Error(s)},this.shouldIgnorePairingRequest=t=>{const{topic:i,requestMethod:s}=t,a=this.expectedPairingMethodMap.get(i);return!a||a.includes(s)?!1:!!(a.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async t=>{const{topic:i,payload:s,attestation:a,encryptedId:f}=t,{params:u,id:b}=s;try{const v=this.client.core.eventClient.getEvent({topic:i});this.isValidConnect(er({},s.params));const w=u.expiryTimestamp||pr(mr.wc_sessionPropose.req.ttl),S=er({id:b,pairingTopic:i,expiryTimestamp:w},u);await this.setProposal(b,S);const O=await this.getVerifyContext({attestationId:a,hash:Xn(JSON.stringify(s)),encryptedId:f,metadata:S.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),v==null||v.setError(Yn.proposal_listener_not_found)),v==null||v.addTrace(wn.emit_session_proposal),this.client.events.emit("session_proposal",{id:b,params:S,verifyContext:O})}catch(v){await this.sendError({id:b,topic:i,error:v,rpcOpts:mr.wc_sessionPropose.autoReject}),this.client.logger.error(v)}},this.onSessionProposeResponse=async(t,i,s)=>{const{id:a}=i;if(En(i)){const{result:f}=i;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:f});const u=this.client.proposal.get(a);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:u});const b=u.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:b});const v=f.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:v});const w=await this.client.core.crypto.generateSharedKey(b,v);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:w});const S=await this.client.core.relayer.subscribe(w,{transportType:s});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:S}),await this.client.core.pairing.activate({topic:t})}else if(Li(i)){await this.client.proposal.delete(a,qt("USER_DISCONNECTED"));const f=St("session_connect");if(this.events.listenerCount(f)===0)throw new Error(`emitting ${f} without any listeners, 954`);this.events.emit(St("session_connect"),{error:i.error})}},this.onSessionSettleRequest=async(t,i)=>{const{id:s,params:a}=i;try{this.isValidSessionSettleRequest(a);const{relay:f,controller:u,expiry:b,namespaces:v,sessionProperties:w,sessionConfig:S}=i.params,O=sn(er(er({topic:t,relay:f,expiry:b,namespaces:v,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:u.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:u.publicKey,metadata:u.metadata}},w&&{sessionProperties:w}),S&&{sessionConfig:S}),{transportType:kt.relay}),P=St("session_connect");if(this.events.listenerCount(P)===0)throw new Error(`emitting ${P} without any listeners 997`);this.events.emit(St("session_connect"),{session:O}),await this.sendResult({id:i.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,i)=>{const{id:s}=i;En(i)?(await this.client.session.update(t,{acknowledged:!0}),this.events.emit(St("session_approve",s),{})):Li(i)&&(await this.client.session.delete(t,qt("USER_DISCONNECTED")),this.events.emit(St("session_approve",s),{error:i.error}))},this.onSessionUpdateRequest=async(t,i)=>{const{params:s,id:a}=i;try{const f=`${t}_session_update`,u=Do.get(f);if(u&&this.isRequestOutOfSync(u,a)){this.client.logger.info(`Discarding out of sync request - ${a}`),this.sendError({id:a,topic:t,error:qt("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(er({topic:t},s));try{Do.set(f,a),await this.client.session.update(t,{namespaces:s.namespaces}),await this.sendResult({id:a,topic:t,result:!0,throwOnFailedPublish:!0})}catch(b){throw Do.delete(f),b}this.client.events.emit("session_update",{id:a,topic:t,params:s})}catch(f){await this.sendError({id:a,topic:t,error:f}),this.client.logger.error(f)}},this.isRequestOutOfSync=(t,i)=>parseInt(i.toString().slice(0,-3))<=parseInt(t.toString().slice(0,-3)),this.onSessionUpdateResponse=(t,i)=>{const{id:s}=i,a=St("session_update",s);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);En(i)?this.events.emit(St("session_update",s),{}):Li(i)&&this.events.emit(St("session_update",s),{error:i.error})},this.onSessionExtendRequest=async(t,i)=>{const{id:s}=i;try{this.isValidExtend({topic:t}),await this.setExpiry(t,pr(Ra)),await this.sendResult({id:s,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:s,topic:t})}catch(a){await this.sendError({id:s,topic:t,error:a}),this.client.logger.error(a)}},this.onSessionExtendResponse=(t,i)=>{const{id:s}=i,a=St("session_extend",s);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);En(i)?this.events.emit(St("session_extend",s),{}):Li(i)&&this.events.emit(St("session_extend",s),{error:i.error})},this.onSessionPingRequest=async(t,i)=>{const{id:s}=i;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(a){await this.sendError({id:s,topic:t,error:a}),this.client.logger.error(a)}},this.onSessionPingResponse=(t,i)=>{const{id:s}=i,a=St("session_ping",s);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);setTimeout(()=>{En(i)?this.events.emit(St("session_ping",s),{}):Li(i)&&this.events.emit(St("session_ping",s),{error:i.error})},500)},this.onSessionDeleteRequest=async(t,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:t,reason:i.params}),Promise.all([new Promise(a=>{this.client.core.relayer.once(Gr.publish,async()=>{a(await this.deleteSession({topic:t,id:s}))})}),this.sendResult({id:s,topic:t,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:t,error:qt("USER_DISCONNECTED")})]).catch(a=>this.client.logger.error(a))}catch(a){this.client.logger.error(a)}},this.onSessionRequest=async t=>{var i,s,a;const{topic:f,payload:u,attestation:b,encryptedId:v,transportType:w}=t,{id:S,params:O}=u;try{await this.isValidRequest(er({topic:f},O));const P=this.client.session.get(f),R=await this.getVerifyContext({attestationId:b,hash:Xn(JSON.stringify(Ss("wc_sessionRequest",O,S))),encryptedId:v,metadata:P.peer.metadata,transportType:w}),z={id:S,topic:f,params:O,verifyContext:R};await this.setPendingSessionRequest(z),w===kt.link_mode&&(i=P.peer.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp((s=P.peer.metadata.redirect)==null?void 0:s.universal),(a=this.client.signConfig)!=null&&a.disableRequestQueue?this.emitSessionRequest(z):(this.addSessionRequestToSessionRequestQueue(z),this.processSessionRequestQueue())}catch(P){await this.sendError({id:S,topic:f,error:P}),this.client.logger.error(P)}},this.onSessionRequestResponse=(t,i)=>{const{id:s}=i,a=St("session_request",s);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);En(i)?this.events.emit(St("session_request",s),{result:i.result}):Li(i)&&this.events.emit(St("session_request",s),{error:i.error})},this.onSessionEventRequest=async(t,i)=>{const{id:s,params:a}=i;try{const f=`${t}_session_event_${a.event.name}`,u=Do.get(f);if(u&&this.isRequestOutOfSync(u,s)){this.client.logger.info(`Discarding out of sync request - ${s}`);return}this.isValidEmit(er({topic:t},a)),this.client.events.emit("session_event",{id:s,topic:t,params:a}),Do.set(f,s)}catch(f){await this.sendError({id:s,topic:t,error:f}),this.client.logger.error(f)}},this.onSessionAuthenticateResponse=(t,i)=>{const{id:s}=i;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:t,payload:i}),En(i)?this.events.emit(St("session_request",s),{result:i.result}):Li(i)&&this.events.emit(St("session_request",s),{error:i.error})},this.onSessionAuthenticateRequest=async t=>{var i;const{topic:s,payload:a,attestation:f,encryptedId:u,transportType:b}=t;try{const{requester:v,authPayload:w,expiryTimestamp:S}=a.params,O=await this.getVerifyContext({attestationId:f,hash:Xn(JSON.stringify(a)),encryptedId:u,metadata:v.metadata,transportType:b}),P={requester:v,pairingTopic:s,id:a.id,authPayload:w,verifyContext:O,expiryTimestamp:S};await this.setAuthRequest(a.id,{request:P,pairingTopic:s,transportType:b}),b===kt.link_mode&&(i=v.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp(v.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:s,params:a.params,id:a.id,verifyContext:O})}catch(v){this.client.logger.error(v);const w=a.params.requester.publicKey,S=await this.client.core.crypto.generateKeyPair(),O=this.getAppLinkIfEnabled(a.params.requester.metadata,b),P={type:rs,receiverPublicKey:w,senderPublicKey:S};await this.sendError({id:a.id,topic:s,error:v,encodeOpts:P,rpcOpts:mr.wc_sessionAuthenticate.autoReject,appLink:O})}},this.addSessionRequestToSessionRequestQueue=t=>{this.sessionRequestQueue.queue.push(t)},this.cleanupAfterResponse=t=>{this.deletePendingSessionRequest(t.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=yn.idle,this.processSessionRequestQueue()},Se.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:t,error:i})=>{const s=this.client.core.history.pending;s.length>0&&s.filter(a=>a.topic===t&&a.request.method==="wc_sessionRequest").forEach(a=>{const f=a.request.id,u=St("session_request",f);if(this.events.listenerCount(u)===0)throw new Error(`emitting ${u} without any listeners`);this.events.emit(St("session_request",a.request.id),{error:i})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===yn.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=yn.active,this.emitSessionRequest(t)}catch(i){this.client.logger.error(i)}},this.emitSessionRequest=t=>{this.client.events.emit("session_request",t)},this.onPairingCreated=t=>{if(t.methods&&this.expectedPairingMethodMap.set(t.topic,t.methods),t.active)return;const i=this.client.proposal.getAll().find(s=>s.pairingTopic===t.topic);i&&this.onSessionProposeRequest({topic:t.topic,payload:Ss("wc_sessionPropose",{requiredNamespaces:i.requiredNamespaces,optionalNamespaces:i.optionalNamespaces,relays:i.relays,proposer:i.proposer,sessionProperties:i.sessionProperties},i.id)})},this.isValidConnect=async t=>{if(!oi(t)){const{message:b}=Ae("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(t)}`);throw new Error(b)}const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:a,sessionProperties:f,relays:u}=t;if(fi(i)||await this.isValidPairingTopic(i),!oS(u)){const{message:b}=Ae("MISSING_OR_INVALID",`connect() relays: ${u}`);throw new Error(b)}!fi(s)&&Wo(s)!==0&&this.validateNamespaces(s,"requiredNamespaces"),!fi(a)&&Wo(a)!==0&&this.validateNamespaces(a,"optionalNamespaces"),fi(f)||this.validateSessionProps(f,"sessionProperties")},this.validateNamespaces=(t,i)=>{const s=aS(t,"connect()",i);if(s)throw new Error(s.message)},this.isValidApprove=async t=>{if(!oi(t))throw new Error(Ae("MISSING_OR_INVALID",`approve() params: ${t}`).message);const{id:i,namespaces:s,relayProtocol:a,sessionProperties:f}=t;this.checkRecentlyDeleted(i),await this.isValidProposalId(i);const u=this.client.proposal.get(i),b=tl(s,"approve()");if(b)throw new Error(b.message);const v=j1(u.requiredNamespaces,s,"approve()");if(v)throw new Error(v.message);if(!or(a,!0)){const{message:w}=Ae("MISSING_OR_INVALID",`approve() relayProtocol: ${a}`);throw new Error(w)}fi(f)||this.validateSessionProps(f,"sessionProperties")},this.isValidReject=async t=>{if(!oi(t)){const{message:a}=Ae("MISSING_OR_INVALID",`reject() params: ${t}`);throw new Error(a)}const{id:i,reason:s}=t;if(this.checkRecentlyDeleted(i),await this.isValidProposalId(i),!fS(s)){const{message:a}=Ae("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(s)}`);throw new Error(a)}},this.isValidSessionSettleRequest=t=>{if(!oi(t)){const{message:v}=Ae("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${t}`);throw new Error(v)}const{relay:i,controller:s,namespaces:a,expiry:f}=t;if(!xb(i)){const{message:v}=Ae("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(v)}const u=eS(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);const b=tl(a,"onSessionSettleRequest()");if(b)throw new Error(b.message);if(bs(f)){const{message:v}=Ae("EXPIRED","onSessionSettleRequest()");throw new Error(v)}},this.isValidUpdate=async t=>{if(!oi(t)){const{message:b}=Ae("MISSING_OR_INVALID",`update() params: ${t}`);throw new Error(b)}const{topic:i,namespaces:s}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const a=this.client.session.get(i),f=tl(s,"update()");if(f)throw new Error(f.message);const u=j1(a.requiredNamespaces,s,"update()");if(u)throw new Error(u.message)},this.isValidExtend=async t=>{if(!oi(t)){const{message:s}=Ae("MISSING_OR_INVALID",`extend() params: ${t}`);throw new Error(s)}const{topic:i}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i)},this.isValidRequest=async t=>{if(!oi(t)){const{message:b}=Ae("MISSING_OR_INVALID",`request() params: ${t}`);throw new Error(b)}const{topic:i,request:s,chainId:a,expiry:f}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const{namespaces:u}=this.client.session.get(i);if(!z1(u,a)){const{message:b}=Ae("MISSING_OR_INVALID",`request() chainId: ${a}`);throw new Error(b)}if(!uS(s)){const{message:b}=Ae("MISSING_OR_INVALID",`request() ${JSON.stringify(s)}`);throw new Error(b)}if(!dS(u,a,s.method)){const{message:b}=Ae("MISSING_OR_INVALID",`request() method: ${s.method}`);throw new Error(b)}if(f&&!bS(f,fl)){const{message:b}=Ae("MISSING_OR_INVALID",`request() expiry: ${f}. Expiry must be a number (in seconds) between ${fl.min} and ${fl.max}`);throw new Error(b)}},this.isValidRespond=async t=>{var i;if(!oi(t)){const{message:f}=Ae("MISSING_OR_INVALID",`respond() params: ${t}`);throw new Error(f)}const{topic:s,response:a}=t;try{await this.isValidSessionTopic(s)}catch(f){throw(i=t==null?void 0:t.response)!=null&&i.id&&this.cleanupAfterResponse(t),f}if(!hS(a)){const{message:f}=Ae("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(a)}`);throw new Error(f)}},this.isValidPing=async t=>{if(!oi(t)){const{message:s}=Ae("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(s)}const{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.isValidEmit=async t=>{if(!oi(t)){const{message:u}=Ae("MISSING_OR_INVALID",`emit() params: ${t}`);throw new Error(u)}const{topic:i,event:s,chainId:a}=t;await this.isValidSessionTopic(i);const{namespaces:f}=this.client.session.get(i);if(!z1(f,a)){const{message:u}=Ae("MISSING_OR_INVALID",`emit() chainId: ${a}`);throw new Error(u)}if(!lS(s)){const{message:u}=Ae("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(s)}`);throw new Error(u)}if(!pS(f,a,s.name)){const{message:u}=Ae("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(s)}`);throw new Error(u)}},this.isValidDisconnect=async t=>{if(!oi(t)){const{message:s}=Ae("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(s)}const{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.isValidAuthenticate=t=>{const{chains:i,uri:s,domain:a,nonce:f}=t;if(!Array.isArray(i)||i.length===0)throw new Error("chains is required and must be a non-empty array");if(!or(s,!1))throw new Error("uri is required parameter");if(!or(a,!1))throw new Error("domain is required parameter");if(!or(f,!1))throw new Error("nonce is required parameter");if([...new Set(i.map(b=>qo(b).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:u}=qo(i[0]);if(u!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async t=>{const{attestationId:i,hash:s,encryptedId:a,metadata:f,transportType:u}=t,b={verified:{verifyUrl:f.verifyUrl||jo,validation:"UNKNOWN",origin:f.url||""}};try{if(u===kt.link_mode){const w=this.getAppLinkIfEnabled(f,u);return b.verified.validation=w&&new URL(w).origin===new URL(f.url).origin?"VALID":"INVALID",b}const v=await this.client.core.verify.resolve({attestationId:i,hash:s,encryptedId:a,verifyUrl:f.verifyUrl});v&&(b.verified.origin=v.origin,b.verified.isScam=v.isScam,b.verified.validation=v.origin===new URL(f.url).origin?"VALID":"INVALID")}catch(v){this.client.logger.warn(v)}return this.client.logger.debug(`Verify context: ${JSON.stringify(b)}`),b},this.validateSessionProps=(t,i)=>{Object.values(t).forEach(s=>{if(!or(s,!1)){const{message:a}=Ae("MISSING_OR_INVALID",`${i} must be in Record<string, string> format. Received: ${JSON.stringify(s)}`);throw new Error(a)}})},this.getPendingAuthRequest=t=>{const i=this.client.auth.requests.get(t);return typeof i=="object"?i:void 0},this.addToRecentlyDeleted=(t,i)=>{if(this.recentlyDeletedMap.set(t,i),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let s=0;const a=this.recentlyDeletedLimit/2;for(const f of this.recentlyDeletedMap.keys()){if(s++>=a)break;this.recentlyDeletedMap.delete(f)}}},this.checkRecentlyDeleted=t=>{const i=this.recentlyDeletedMap.get(t);if(i){const{message:s}=Ae("MISSING_OR_INVALID",`Record was recently deleted - ${i}: ${t}`);throw new Error(s)}},this.isLinkModeEnabled=(t,i)=>{var s,a,f,u,b,v,w,S,O;return!t||i!==kt.link_mode?!1:((a=(s=this.client.metadata)==null?void 0:s.redirect)==null?void 0:a.linkMode)===!0&&((u=(f=this.client.metadata)==null?void 0:f.redirect)==null?void 0:u.universal)!==void 0&&((v=(b=this.client.metadata)==null?void 0:b.redirect)==null?void 0:v.universal)!==""&&((w=t==null?void 0:t.redirect)==null?void 0:w.universal)!==void 0&&((S=t==null?void 0:t.redirect)==null?void 0:S.universal)!==""&&((O=t==null?void 0:t.redirect)==null?void 0:O.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(t.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(t,i)=>{var s;return this.isLinkModeEnabled(t,i)?(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 i=t1(t,"topic")||"",s=decodeURIComponent(t1(t,"wc_ev")||""),a=this.client.session.keys.includes(i);a&&this.client.session.update(i,{transportType:kt.link_mode}),this.client.core.dispatchEnvelope({topic:i,message:s,sessionExists:a})},this.registerLinkModeListeners=async()=>{var t;if(sd()||Wa()&&(t=this.client.metadata.redirect)!=null&&t.linkMode){const i=global==null?void 0:global.Linking;if(typeof i<"u"){i.addEventListener("url",this.handleLinkModeMessage,this.client.name);const s=await i.getInitialURL();s&&setTimeout(()=>{this.handleLinkModeMessage({url:s})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=Ae("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Gr.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:t,message:i,attestation:s,transportType:a}=e,{publicKey:f}=this.client.auth.authKeys.keys.includes(Bf)?this.client.auth.authKeys.get(Bf):{responseTopic:void 0,publicKey:void 0},u=await this.client.core.crypto.decode(t,i,{receiverPublicKey:f,encoding:a===kt.link_mode?Io:Es});try{bd(u)?(this.client.core.history.set(t,u),this.onRelayEventRequest({topic:t,payload:u,attestation:s,transportType:a,encryptedId:Xn(i)})):mu(u)?(await this.client.core.history.resolve(u),await this.onRelayEventResponse({topic:t,payload:u,transportType:a}),this.client.core.history.delete(t,u.id)):this.onRelayEventUnknownPayload({topic:t,payload:u,transportType:a})}catch(b){this.client.logger.error(b)}}registerExpirerEvents(){this.client.core.expirer.on(Bi.expired,async e=>{const{topic:t,id:i}=Tv(e.target);if(i&&this.client.pendingRequest.keys.includes(i))return await this.deletePendingSessionRequest(i,Ae("EXPIRED"),!0);if(i&&this.client.auth.requests.keys.includes(i))return await this.deletePendingAuthRequest(i,Ae("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):i&&(await this.deleteProposal(i,!0),this.client.events.emit("proposal_expire",{id:i}))})}registerPairingEvents(){this.client.core.pairing.events.on(Js.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(Js.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!or(e,!1)){const{message:t}=Ae("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}=Ae("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(bs(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=Ae("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!or(e,!1)){const{message:t}=Ae("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}=Ae("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(bs(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:t}=Ae("EXPIRED",`session topic: ${e}`);throw new Error(t)}if(!this.client.core.crypto.keychain.has(e)){const{message:t}=Ae("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(or(e,!1)){const{message:t}=Ae("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}else{const{message:t}=Ae("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}async isValidProposalId(e){if(!cS(e)){const{message:t}=Ae("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=Ae("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(bs(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:t}=Ae("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}}class HP extends fa{constructor(e,t){super(e,t,DP,wd),this.core=e,this.logger=t}}class KP extends fa{constructor(e,t){super(e,t,PP,wd),this.core=e,this.logger=t}}class VP extends fa{constructor(e,t){super(e,t,CP,wd,i=>i.id),this.core=e,this.logger=t}}class GP extends fa{constructor(e,t){super(e,t,FP,wu,()=>Bf),this.core=e,this.logger=t}}class WP extends fa{constructor(e,t){super(e,t,BP,wu),this.core=e,this.logger=t}}class JP extends fa{constructor(e,t){super(e,t,qP,wu,i=>i.id),this.core=e,this.logger=t}}class YP{constructor(e,t){this.core=e,this.logger=t,this.authKeys=new GP(this.core,this.logger),this.pairingTopics=new WP(this.core,this.logger),this.requests=new JP(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class _d extends kx{constructor(e){super(e),this.protocol=em,this.version=tm,this.name=cl.name,this.events=new zi.EventEmitter,this.on=(i,s)=>this.events.on(i,s),this.once=(i,s)=>this.events.once(i,s),this.off=(i,s)=>this.events.off(i,s),this.removeListener=(i,s)=>this.events.removeListener(i,s),this.removeAllListeners=i=>this.events.removeAllListeners(i),this.connect=async i=>{try{return await this.engine.connect(i)}catch(s){throw this.logger.error(s.message),s}},this.pair=async i=>{try{return await this.engine.pair(i)}catch(s){throw this.logger.error(s.message),s}},this.approve=async i=>{try{return await this.engine.approve(i)}catch(s){throw this.logger.error(s.message),s}},this.reject=async i=>{try{return await this.engine.reject(i)}catch(s){throw this.logger.error(s.message),s}},this.update=async i=>{try{return await this.engine.update(i)}catch(s){throw this.logger.error(s.message),s}},this.extend=async i=>{try{return await this.engine.extend(i)}catch(s){throw this.logger.error(s.message),s}},this.request=async i=>{try{return await this.engine.request(i)}catch(s){throw this.logger.error(s.message),s}},this.respond=async i=>{try{return await this.engine.respond(i)}catch(s){throw this.logger.error(s.message),s}},this.ping=async i=>{try{return await this.engine.ping(i)}catch(s){throw this.logger.error(s.message),s}},this.emit=async i=>{try{return await this.engine.emit(i)}catch(s){throw this.logger.error(s.message),s}},this.disconnect=async i=>{try{return await this.engine.disconnect(i)}catch(s){throw this.logger.error(s.message),s}},this.find=i=>{try{return this.engine.find(i)}catch(s){throw this.logger.error(s.message),s}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(i){throw this.logger.error(i.message),i}},this.authenticate=async(i,s)=>{try{return await this.engine.authenticate(i,s)}catch(a){throw this.logger.error(a.message),a}},this.formatAuthMessage=i=>{try{return this.engine.formatAuthMessage(i)}catch(s){throw this.logger.error(s.message),s}},this.approveSessionAuthenticate=async i=>{try{return await this.engine.approveSessionAuthenticate(i)}catch(s){throw this.logger.error(s.message),s}},this.rejectSessionAuthenticate=async i=>{try{return await this.engine.rejectSessionAuthenticate(i)}catch(s){throw this.logger.error(s.message),s}},this.name=(e==null?void 0:e.name)||cl.name,this.metadata=(e==null?void 0:e.metadata)||Pv(),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:fc(gu({level:(e==null?void 0:e.logger)||cl.logger}));this.core=(e==null?void 0:e.core)||new IP(e),this.logger=Yr(t,this.name),this.session=new KP(this.core,this.logger),this.proposal=new HP(this.core,this.logger),this.pendingRequest=new VP(this.core,this.logger),this.engine=new kP(this),this.auth=new YP(this.core,this.logger)}static async init(e){const t=new _d(e);return await t.initialize(),t}get context(){return li(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var Ll={exports:{}};(function(r,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Vr<"u"&&Vr,i=function(){function a(){this.fetch=!1,this.DOMException=t.DOMException}return a.prototype=t,new a}();(function(a){(function(f){var u=typeof a<"u"&&a||typeof self<"u"&&self||typeof Vr<"u"&&Vr||{},b={searchParams:"URLSearchParams"in u,iterable:"Symbol"in u&&"iterator"in Symbol,blob:"FileReader"in u&&"Blob"in u&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in u,arrayBuffer:"ArrayBuffer"in u};function v(d){return d&&DataView.prototype.isPrototypeOf(d)}if(b.arrayBuffer)var w=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],S=ArrayBuffer.isView||function(d){return d&&w.indexOf(Object.prototype.toString.call(d))>-1};function O(d){if(typeof d!="string"&&(d=String(d)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(d)||d==="")throw new TypeError('Invalid character in header field name: "'+d+'"');return d.toLowerCase()}function P(d){return typeof d!="string"&&(d=String(d)),d}function R(d){var y={next:function(){var M=d.shift();return{done:M===void 0,value:M}}};return b.iterable&&(y[Symbol.iterator]=function(){return y}),y}function z(d){this.map={},d instanceof z?d.forEach(function(y,M){this.append(M,y)},this):Array.isArray(d)?d.forEach(function(y){if(y.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+y.length);this.append(y[0],y[1])},this):d&&Object.getOwnPropertyNames(d).forEach(function(y){this.append(y,d[y])},this)}z.prototype.append=function(d,y){d=O(d),y=P(y);var M=this.map[d];this.map[d]=M?M+", "+y:y},z.prototype.delete=function(d){delete this.map[O(d)]},z.prototype.get=function(d){return d=O(d),this.has(d)?this.map[d]:null},z.prototype.has=function(d){return this.map.hasOwnProperty(O(d))},z.prototype.set=function(d,y){this.map[O(d)]=P(y)},z.prototype.forEach=function(d,y){for(var M in this.map)this.map.hasOwnProperty(M)&&d.call(y,this.map[M],M,this)},z.prototype.keys=function(){var d=[];return this.forEach(function(y,M){d.push(M)}),R(d)},z.prototype.values=function(){var d=[];return this.forEach(function(y){d.push(y)}),R(d)},z.prototype.entries=function(){var d=[];return this.forEach(function(y,M){d.push([M,y])}),R(d)},b.iterable&&(z.prototype[Symbol.iterator]=z.prototype.entries);function W(d){if(!d._noBody){if(d.bodyUsed)return Promise.reject(new TypeError("Already read"));d.bodyUsed=!0}}function Q(d){return new Promise(function(y,M){d.onload=function(){y(d.result)},d.onerror=function(){M(d.error)}})}function j(d){var y=new FileReader,M=Q(y);return y.readAsArrayBuffer(d),M}function Y(d){var y=new FileReader,M=Q(y),I=/charset=([A-Za-z0-9_-]+)/.exec(d.type),x=I?I[1]:"utf-8";return y.readAsText(d,x),M}function U(d){for(var y=new Uint8Array(d),M=new Array(y.length),I=0;I<y.length;I++)M[I]=String.fromCharCode(y[I]);return M.join("")}function k(d){if(d.slice)return d.slice(0);var y=new Uint8Array(d.byteLength);return y.set(new Uint8Array(d)),y.buffer}function V(){return this.bodyUsed=!1,this._initBody=function(d){this.bodyUsed=this.bodyUsed,this._bodyInit=d,d?typeof d=="string"?this._bodyText=d:b.blob&&Blob.prototype.isPrototypeOf(d)?this._bodyBlob=d:b.formData&&FormData.prototype.isPrototypeOf(d)?this._bodyFormData=d:b.searchParams&&URLSearchParams.prototype.isPrototypeOf(d)?this._bodyText=d.toString():b.arrayBuffer&&b.blob&&v(d)?(this._bodyArrayBuffer=k(d.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):b.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(d)||S(d))?this._bodyArrayBuffer=k(d):this._bodyText=d=Object.prototype.toString.call(d):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof d=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):b.searchParams&&URLSearchParams.prototype.isPrototypeOf(d)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},b.blob&&(this.blob=function(){var d=W(this);if(d)return d;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var d=W(this);return d||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(b.blob)return this.blob().then(j);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var d=W(this);if(d)return d;if(this._bodyBlob)return Y(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(U(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},b.formData&&(this.formData=function(){return this.text().then(de)}),this.json=function(){return this.text().then(JSON.parse)},this}var A=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function F(d){var y=d.toUpperCase();return A.indexOf(y)>-1?y:d}function ae(d,y){if(!(this instanceof ae))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');y=y||{};var M=y.body;if(d instanceof ae){if(d.bodyUsed)throw new TypeError("Already read");this.url=d.url,this.credentials=d.credentials,y.headers||(this.headers=new z(d.headers)),this.method=d.method,this.mode=d.mode,this.signal=d.signal,!M&&d._bodyInit!=null&&(M=d._bodyInit,d.bodyUsed=!0)}else this.url=String(d);if(this.credentials=y.credentials||this.credentials||"same-origin",(y.headers||!this.headers)&&(this.headers=new z(y.headers)),this.method=F(y.method||this.method||"GET"),this.mode=y.mode||this.mode||null,this.signal=y.signal||this.signal||function(){if("AbortController"in u){var l=new AbortController;return l.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&M)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(M),(this.method==="GET"||this.method==="HEAD")&&(y.cache==="no-store"||y.cache==="no-cache")){var I=/([?&])_=[^&]*/;if(I.test(this.url))this.url=this.url.replace(I,"$1_="+new Date().getTime());else{var x=/\?/;this.url+=(x.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}ae.prototype.clone=function(){return new ae(this,{body:this._bodyInit})};function de(d){var y=new FormData;return d.trim().split("&").forEach(function(M){if(M){var I=M.split("="),x=I.shift().replace(/\+/g," "),l=I.join("=").replace(/\+/g," ");y.append(decodeURIComponent(x),decodeURIComponent(l))}}),y}function L(d){var y=new z,M=d.replace(/\r?\n[\t ]+/g," ");return M.split("\r").map(function(I){return I.indexOf(`
|
|
45
|
+
`)===0?I.substr(1,I.length):I}).forEach(function(I){var x=I.split(":"),l=x.shift().trim();if(l){var g=x.join(":").trim();try{y.append(l,g)}catch(N){console.warn("Response "+N.message)}}}),y}V.call(ae.prototype);function m(d,y){if(!(this instanceof m))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(y||(y={}),this.type="default",this.status=y.status===void 0?200:y.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=y.statusText===void 0?"":""+y.statusText,this.headers=new z(y.headers),this.url=y.url||"",this._initBody(d)}V.call(m.prototype),m.prototype.clone=function(){return new m(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new z(this.headers),url:this.url})},m.error=function(){var d=new m(null,{status:200,statusText:""});return d.ok=!1,d.status=0,d.type="error",d};var c=[301,302,303,307,308];m.redirect=function(d,y){if(c.indexOf(y)===-1)throw new RangeError("Invalid status code");return new m(null,{status:y,headers:{location:d}})},f.DOMException=u.DOMException;try{new f.DOMException}catch{f.DOMException=function(y,M){this.message=y,this.name=M;var I=Error(y);this.stack=I.stack},f.DOMException.prototype=Object.create(Error.prototype),f.DOMException.prototype.constructor=f.DOMException}function p(d,y){return new Promise(function(M,I){var x=new ae(d,y);if(x.signal&&x.signal.aborted)return I(new f.DOMException("Aborted","AbortError"));var l=new XMLHttpRequest;function g(){l.abort()}l.onload=function(){var te={statusText:l.statusText,headers:L(l.getAllResponseHeaders()||"")};x.url.indexOf("file://")===0&&(l.status<200||l.status>599)?te.status=200:te.status=l.status,te.url="responseURL"in l?l.responseURL:te.headers.get("X-Request-URL");var D="response"in l?l.response:l.responseText;setTimeout(function(){M(new m(D,te))},0)},l.onerror=function(){setTimeout(function(){I(new TypeError("Network request failed"))},0)},l.ontimeout=function(){setTimeout(function(){I(new TypeError("Network request timed out"))},0)},l.onabort=function(){setTimeout(function(){I(new f.DOMException("Aborted","AbortError"))},0)};function N(te){try{return te===""&&u.location.href?u.location.href:te}catch{return te}}if(l.open(x.method,N(x.url),!0),x.credentials==="include"?l.withCredentials=!0:x.credentials==="omit"&&(l.withCredentials=!1),"responseType"in l&&(b.blob?l.responseType="blob":b.arrayBuffer&&(l.responseType="arraybuffer")),y&&typeof y.headers=="object"&&!(y.headers instanceof z||u.Headers&&y.headers instanceof u.Headers)){var Z=[];Object.getOwnPropertyNames(y.headers).forEach(function(te){Z.push(O(te)),l.setRequestHeader(te,P(y.headers[te]))}),x.headers.forEach(function(te,D){Z.indexOf(D)===-1&&l.setRequestHeader(D,te)})}else x.headers.forEach(function(te,D){l.setRequestHeader(D,te)});x.signal&&(x.signal.addEventListener("abort",g),l.onreadystatechange=function(){l.readyState===4&&x.signal.removeEventListener("abort",g)}),l.send(typeof x._bodyInit>"u"?null:x._bodyInit)})}return p.polyfill=!0,u.fetch||(u.fetch=p,u.Headers=z,u.Request=ae,u.Response=m),f.Headers=z,f.Request=ae,f.Response=m,f.fetch=p,Object.defineProperty(f,"__esModule",{value:!0}),f})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var s=t.fetch?t:i;e=s.fetch,e.default=s.fetch,e.fetch=s.fetch,e.Headers=s.Headers,e.Request=s.Request,e.Response=s.Response,r.exports=e})(Ll,Ll.exports);var QP=Ll.exports;const Og=Hl(QP);var XP=Object.defineProperty,ZP=Object.defineProperties,eO=Object.getOwnPropertyDescriptors,Cg=Object.getOwnPropertySymbols,tO=Object.prototype.hasOwnProperty,rO=Object.prototype.propertyIsEnumerable,Rg=(r,e,t)=>e in r?XP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ng=(r,e)=>{for(var t in e||(e={}))tO.call(e,t)&&Rg(r,t,e[t]);if(Cg)for(var t of Cg(e))rO.call(e,t)&&Rg(r,t,e[t]);return r},Tg=(r,e)=>ZP(r,eO(e));const iO={Accept:"application/json","Content-Type":"application/json"},nO="POST",Fg={headers:iO,method:nO},Bg=10;class Bn{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new zi.EventEmitter,this.isAvailable=!1,this.registering=!1,!ig(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=is(e),i=await(await Og(this.url,Tg(Ng({},Fg),{body:t}))).json();this.onPayload({data:i})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!ig(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,s)=>{this.events.once("register_error",a=>{this.resetMaxListeners(),s(a)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return s(new Error("HTTP connection is missing or invalid"));i()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const t=is({id:1,jsonrpc:"2.0",method:"test",params:[]});await Og(e,Tg(Ng({},Fg),{body:t}))}this.onOpen()}catch(t){const i=this.parseError(t);throw this.events.emit("register_error",i),this.onClose(),i}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?ea(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const i=this.parseError(t),s=i.message||i.toString(),a=bu(e,s);this.events.emit("payload",a)}parseError(e,t=this.url){return Nb(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>Bg&&this.events.setMaxListeners(Bg)}}const qg="error",sO="wss://relay.walletconnect.org",aO="wc",oO="universal_provider",Lg=`${aO}@2:${oO}:`,nm="https://rpc.walletconnect.org/v1/",Fa="generic",cO=`${nm}bundler`,ln={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var No=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ul={exports:{}};/**
|
|
46
|
+
* @license
|
|
47
|
+
* Lodash <https://lodash.com/>
|
|
48
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
49
|
+
* Released under MIT license <https://lodash.com/license>
|
|
50
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
51
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
52
|
+
*/(function(r,e){(function(){var t,i="4.17.21",s=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",f="Expected a function",u="Invalid `variable` option passed into `_.template`",b="__lodash_hash_undefined__",v=500,w="__lodash_placeholder__",S=1,O=2,P=4,R=1,z=2,W=1,Q=2,j=4,Y=8,U=16,k=32,V=64,A=128,F=256,ae=512,de=30,L="...",m=800,c=16,p=1,d=2,y=3,M=1/0,I=9007199254740991,x=17976931348623157e292,l=NaN,g=4294967295,N=g-1,Z=g>>>1,te=[["ary",A],["bind",W],["bindKey",Q],["curry",Y],["curryRight",U],["flip",ae],["partial",k],["partialRight",V],["rearg",F]],D="[object Arguments]",ee="[object Array]",B="[object AsyncFunction]",H="[object Boolean]",K="[object Date]",_="[object DOMException]",$="[object Error]",se="[object Function]",ce="[object GeneratorFunction]",ue="[object Map]",ye="[object Number]",we="[object Null]",Re="[object Object]",Qe="[object Promise]",Pe="[object Proxy]",Ne="[object RegExp]",Me="[object Set]",me="[object String]",Oe="[object Symbol]",Te="[object Undefined]",ve="[object WeakMap]",Ce="[object WeakSet]",xe="[object ArrayBuffer]",be="[object DataView]",Le="[object Float32Array]",Ie="[object Float64Array]",_e="[object Int8Array]",He="[object Int16Array]",Ve="[object Int32Array]",Ee="[object Uint8Array]",Ke="[object Uint8ClampedArray]",ht="[object Uint16Array]",Ge="[object Uint32Array]",wt=/\b__p \+= '';/g,lt=/\b(__p \+=) '' \+/g,Je=/(__e\(.*?\)|\b__t\)) \+\n'';/g,At=/&(?:amp|lt|gt|quot|#39);/g,xt=/[&<>"']/g,Fe=RegExp(At.source),Xe=RegExp(xt.source),tt=/<%-([\s\S]+?)%>/g,Be=/<%([\s\S]+?)%>/g,et=/<%=([\s\S]+?)%>/g,Ze=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$e=/^\w*$/,ft=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,rt=/[\\^$.*+?()[\]{}|]/g,ze=RegExp(rt.source),it=/^\s+/,st=/\s/,qe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ye=/\{\n\/\* \[wrapped with (.+)\] \*/,ut=/,? & /,je=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Ct=/[()=,{}\[\]\/\s]/,Rt=/\\(\\)?/g,at=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,bt=/\w*$/,Cr=/^[-+]0x[0-9a-f]+$/i,Rr=/^0b[01]+$/i,Nr=/^\[object .+?Constructor\]$/,Tr=/^0o[0-7]+$/i,Fr=/^(?:0|[1-9]\d*)$/,Xt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Qr=/($^)/,Hi=/['\n\r\u2028\u2029\\]/g,Xr="\\ud800-\\udfff",Ki="\\u0300-\\u036f",Vi="\\ufe20-\\ufe2f",Zr="\\u20d0-\\u20ff",Ei=Ki+Vi+Zr,Si="\\u2700-\\u27bf",ur="a-z\\xdf-\\xf6\\xf8-\\xff",Gi="\\xac\\xb1\\xd7\\xf7",Wi="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ji="\\u2000-\\u206f",Ds=" \\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",lc="A-Z\\xc0-\\xd6\\xd8-\\xde",dc="\\ufe0e\\ufe0f",Ps=Gi+Wi+Ji+Ds,ro="['’]",Os="["+Xr+"]",io="["+Ps+"]",Cs="["+Ei+"]",pc="\\d+",_u="["+Si+"]",gc="["+ur+"]",vc="[^"+Xr+Ps+pc+Si+ur+lc+"]",la="\\ud83c[\\udffb-\\udfff]",Au="(?:"+Cs+"|"+la+")",bc="[^"+Xr+"]",da="(?:\\ud83c[\\udde6-\\uddff]){2}",as="[\\ud800-\\udbff][\\udc00-\\udfff]",di="["+lc+"]",mc="\\u200d",yc="(?:"+gc+"|"+vc+")",dn="(?:"+di+"|"+vc+")",wc="(?:"+ro+"(?:d|ll|m|re|s|t|ve))?",_c="(?:"+ro+"(?:D|LL|M|RE|S|T|VE))?",Ac=Au+"?",Ec="["+dc+"]?",Eu="(?:"+mc+"(?:"+[bc,da,as].join("|")+")"+Ec+Ac+")*",qn="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Sc="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",xc=Ec+Ac+Eu,pa="(?:"+[_u,da,as].join("|")+")"+xc,Su="(?:"+[bc+Cs+"?",Cs,da,as,Os].join("|")+")",no=RegExp(ro,"g"),xu=RegExp(Cs,"g"),ga=RegExp(la+"(?="+la+")|"+Su+xc,"g"),Mc=RegExp([di+"?"+gc+"+"+wc+"(?="+[io,di,"$"].join("|")+")",dn+"+"+_c+"(?="+[io,di+yc,"$"].join("|")+")",di+"?"+yc+"+"+wc,di+"+"+_c,Sc,qn,pc,pa].join("|"),"g"),Ic=RegExp("["+mc+Xr+Ei+dc+"]"),Rs=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Dc=["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"],Mu=-1,Ut={};Ut[Le]=Ut[Ie]=Ut[_e]=Ut[He]=Ut[Ve]=Ut[Ee]=Ut[Ke]=Ut[ht]=Ut[Ge]=!0,Ut[D]=Ut[ee]=Ut[xe]=Ut[H]=Ut[be]=Ut[K]=Ut[$]=Ut[se]=Ut[ue]=Ut[ye]=Ut[Re]=Ut[Ne]=Ut[Me]=Ut[me]=Ut[ve]=!1;var Lt={};Lt[D]=Lt[ee]=Lt[xe]=Lt[be]=Lt[H]=Lt[K]=Lt[Le]=Lt[Ie]=Lt[_e]=Lt[He]=Lt[Ve]=Lt[ue]=Lt[ye]=Lt[Re]=Lt[Ne]=Lt[Me]=Lt[me]=Lt[Oe]=Lt[Ee]=Lt[Ke]=Lt[ht]=Lt[Ge]=!0,Lt[$]=Lt[se]=Lt[ve]=!1;var G={À:"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"},re={"&":"&","<":"<",">":">",'"':""","'":"'"},pe={"&":"&","<":"<",">":">",""":'"',"'":"'"},Ue={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},$t=parseFloat,pt=parseInt,Gt=typeof No=="object"&&No&&No.Object===Object&&No,cr=typeof self=="object"&&self&&self.Object===Object&&self,Pt=Gt||cr||Function("return this")(),zt=e&&!e.nodeType&&e,ir=zt&&!0&&r&&!r.nodeType&&r,ei=ir&&ir.exports===zt,fr=ei&&Gt.process,Wt=function(){try{var ie=ir&&ir.require&&ir.require("util").types;return ie||fr&&fr.binding&&fr.binding("util")}catch{}}(),zr=Wt&&Wt.isArrayBuffer,Yi=Wt&&Wt.isDate,xi=Wt&&Wt.isMap,pn=Wt&&Wt.isRegExp,so=Wt&&Wt.isSet,Ns=Wt&&Wt.isTypedArray;function gr(ie,fe,oe){switch(oe.length){case 0:return ie.call(fe);case 1:return ie.call(fe,oe[0]);case 2:return ie.call(fe,oe[0],oe[1]);case 3:return ie.call(fe,oe[0],oe[1],oe[2])}return ie.apply(fe,oe)}function om(ie,fe,oe,ke){for(var dt=-1,Nt=ie==null?0:ie.length;++dt<Nt;){var hr=ie[dt];fe(ke,hr,oe(hr),ie)}return ke}function Mi(ie,fe){for(var oe=-1,ke=ie==null?0:ie.length;++oe<ke&&fe(ie[oe],oe,ie)!==!1;);return ie}function cm(ie,fe){for(var oe=ie==null?0:ie.length;oe--&&fe(ie[oe],oe,ie)!==!1;);return ie}function Sd(ie,fe){for(var oe=-1,ke=ie==null?0:ie.length;++oe<ke;)if(!fe(ie[oe],oe,ie))return!1;return!0}function os(ie,fe){for(var oe=-1,ke=ie==null?0:ie.length,dt=0,Nt=[];++oe<ke;){var hr=ie[oe];fe(hr,oe,ie)&&(Nt[dt++]=hr)}return Nt}function Pc(ie,fe){var oe=ie==null?0:ie.length;return!!oe&&va(ie,fe,0)>-1}function Iu(ie,fe,oe){for(var ke=-1,dt=ie==null?0:ie.length;++ke<dt;)if(oe(fe,ie[ke]))return!0;return!1}function Yt(ie,fe){for(var oe=-1,ke=ie==null?0:ie.length,dt=Array(ke);++oe<ke;)dt[oe]=fe(ie[oe],oe,ie);return dt}function cs(ie,fe){for(var oe=-1,ke=fe.length,dt=ie.length;++oe<ke;)ie[dt+oe]=fe[oe];return ie}function Du(ie,fe,oe,ke){var dt=-1,Nt=ie==null?0:ie.length;for(ke&&Nt&&(oe=ie[++dt]);++dt<Nt;)oe=fe(oe,ie[dt],dt,ie);return oe}function fm(ie,fe,oe,ke){var dt=ie==null?0:ie.length;for(ke&&dt&&(oe=ie[--dt]);dt--;)oe=fe(oe,ie[dt],dt,ie);return oe}function Pu(ie,fe){for(var oe=-1,ke=ie==null?0:ie.length;++oe<ke;)if(fe(ie[oe],oe,ie))return!0;return!1}var um=Ou("length");function hm(ie){return ie.split("")}function lm(ie){return ie.match(je)||[]}function xd(ie,fe,oe){var ke;return oe(ie,function(dt,Nt,hr){if(fe(dt,Nt,hr))return ke=Nt,!1}),ke}function Oc(ie,fe,oe,ke){for(var dt=ie.length,Nt=oe+(ke?1:-1);ke?Nt--:++Nt<dt;)if(fe(ie[Nt],Nt,ie))return Nt;return-1}function va(ie,fe,oe){return fe===fe?Sm(ie,fe,oe):Oc(ie,Md,oe)}function dm(ie,fe,oe,ke){for(var dt=oe-1,Nt=ie.length;++dt<Nt;)if(ke(ie[dt],fe))return dt;return-1}function Md(ie){return ie!==ie}function Id(ie,fe){var oe=ie==null?0:ie.length;return oe?Ru(ie,fe)/oe:l}function Ou(ie){return function(fe){return fe==null?t:fe[ie]}}function Cu(ie){return function(fe){return ie==null?t:ie[fe]}}function Dd(ie,fe,oe,ke,dt){return dt(ie,function(Nt,hr,jt){oe=ke?(ke=!1,Nt):fe(oe,Nt,hr,jt)}),oe}function pm(ie,fe){var oe=ie.length;for(ie.sort(fe);oe--;)ie[oe]=ie[oe].value;return ie}function Ru(ie,fe){for(var oe,ke=-1,dt=ie.length;++ke<dt;){var Nt=fe(ie[ke]);Nt!==t&&(oe=oe===t?Nt:oe+Nt)}return oe}function Nu(ie,fe){for(var oe=-1,ke=Array(ie);++oe<ie;)ke[oe]=fe(oe);return ke}function gm(ie,fe){return Yt(fe,function(oe){return[oe,ie[oe]]})}function Pd(ie){return ie&&ie.slice(0,Nd(ie)+1).replace(it,"")}function pi(ie){return function(fe){return ie(fe)}}function Tu(ie,fe){return Yt(fe,function(oe){return ie[oe]})}function ao(ie,fe){return ie.has(fe)}function Od(ie,fe){for(var oe=-1,ke=ie.length;++oe<ke&&va(fe,ie[oe],0)>-1;);return oe}function Cd(ie,fe){for(var oe=ie.length;oe--&&va(fe,ie[oe],0)>-1;);return oe}function vm(ie,fe){for(var oe=ie.length,ke=0;oe--;)ie[oe]===fe&&++ke;return ke}var bm=Cu(G),mm=Cu(re);function ym(ie){return"\\"+Ue[ie]}function wm(ie,fe){return ie==null?t:ie[fe]}function ba(ie){return Ic.test(ie)}function _m(ie){return Rs.test(ie)}function Am(ie){for(var fe,oe=[];!(fe=ie.next()).done;)oe.push(fe.value);return oe}function Fu(ie){var fe=-1,oe=Array(ie.size);return ie.forEach(function(ke,dt){oe[++fe]=[dt,ke]}),oe}function Rd(ie,fe){return function(oe){return ie(fe(oe))}}function fs(ie,fe){for(var oe=-1,ke=ie.length,dt=0,Nt=[];++oe<ke;){var hr=ie[oe];(hr===fe||hr===w)&&(ie[oe]=w,Nt[dt++]=oe)}return Nt}function Cc(ie){var fe=-1,oe=Array(ie.size);return ie.forEach(function(ke){oe[++fe]=ke}),oe}function Em(ie){var fe=-1,oe=Array(ie.size);return ie.forEach(function(ke){oe[++fe]=[ke,ke]}),oe}function Sm(ie,fe,oe){for(var ke=oe-1,dt=ie.length;++ke<dt;)if(ie[ke]===fe)return ke;return-1}function xm(ie,fe,oe){for(var ke=oe+1;ke--;)if(ie[ke]===fe)return ke;return ke}function ma(ie){return ba(ie)?Im(ie):um(ie)}function Qi(ie){return ba(ie)?Dm(ie):hm(ie)}function Nd(ie){for(var fe=ie.length;fe--&&st.test(ie.charAt(fe)););return fe}var Mm=Cu(pe);function Im(ie){for(var fe=ga.lastIndex=0;ga.test(ie);)++fe;return fe}function Dm(ie){return ie.match(ga)||[]}function Pm(ie){return ie.match(Mc)||[]}var Om=function ie(fe){fe=fe==null?Pt:ya.defaults(Pt.Object(),fe,ya.pick(Pt,Dc));var oe=fe.Array,ke=fe.Date,dt=fe.Error,Nt=fe.Function,hr=fe.Math,jt=fe.Object,Bu=fe.RegExp,Cm=fe.String,Ii=fe.TypeError,Rc=oe.prototype,Rm=Nt.prototype,wa=jt.prototype,Nc=fe["__core-js_shared__"],Tc=Rm.toString,Bt=wa.hasOwnProperty,Nm=0,Td=function(){var n=/[^.]+$/.exec(Nc&&Nc.keys&&Nc.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}(),Fc=wa.toString,Tm=Tc.call(jt),Fm=Pt._,Bm=Bu("^"+Tc.call(Bt).replace(rt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Bc=ei?fe.Buffer:t,us=fe.Symbol,qc=fe.Uint8Array,Fd=Bc?Bc.allocUnsafe:t,Lc=Rd(jt.getPrototypeOf,jt),Bd=jt.create,qd=wa.propertyIsEnumerable,Uc=Rc.splice,Ld=us?us.isConcatSpreadable:t,oo=us?us.iterator:t,Ts=us?us.toStringTag:t,$c=function(){try{var n=Us(jt,"defineProperty");return n({},"",{}),n}catch{}}(),qm=fe.clearTimeout!==Pt.clearTimeout&&fe.clearTimeout,Lm=ke&&ke.now!==Pt.Date.now&&ke.now,Um=fe.setTimeout!==Pt.setTimeout&&fe.setTimeout,zc=hr.ceil,jc=hr.floor,qu=jt.getOwnPropertySymbols,$m=Bc?Bc.isBuffer:t,Ud=fe.isFinite,zm=Rc.join,jm=Rd(jt.keys,jt),lr=hr.max,Br=hr.min,km=ke.now,Hm=fe.parseInt,$d=hr.random,Km=Rc.reverse,Lu=Us(fe,"DataView"),co=Us(fe,"Map"),Uu=Us(fe,"Promise"),_a=Us(fe,"Set"),fo=Us(fe,"WeakMap"),uo=Us(jt,"create"),kc=fo&&new fo,Aa={},Vm=$s(Lu),Gm=$s(co),Wm=$s(Uu),Jm=$s(_a),Ym=$s(fo),Hc=us?us.prototype:t,ho=Hc?Hc.valueOf:t,zd=Hc?Hc.toString:t;function T(n){if(Zt(n)&&!gt(n)&&!(n instanceof Mt)){if(n instanceof Di)return n;if(Bt.call(n,"__wrapped__"))return j0(n)}return new Di(n)}var Ea=function(){function n(){}return function(o){if(!Qt(o))return{};if(Bd)return Bd(o);n.prototype=o;var h=new n;return n.prototype=t,h}}();function Kc(){}function Di(n,o){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!o,this.__index__=0,this.__values__=t}T.templateSettings={escape:tt,evaluate:Be,interpolate:et,variable:"",imports:{_:T}},T.prototype=Kc.prototype,T.prototype.constructor=T,Di.prototype=Ea(Kc.prototype),Di.prototype.constructor=Di;function Mt(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=g,this.__views__=[]}function Qm(){var n=new Mt(this.__wrapped__);return n.__actions__=ti(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=ti(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=ti(this.__views__),n}function Xm(){if(this.__filtered__){var n=new Mt(this);n.__dir__=-1,n.__filtered__=!0}else n=this.clone(),n.__dir__*=-1;return n}function Zm(){var n=this.__wrapped__.value(),o=this.__dir__,h=gt(n),E=o<0,C=h?n.length:0,q=hy(0,C,this.__views__),J=q.start,X=q.end,ne=X-J,he=E?X:J-1,le=this.__iteratees__,ge=le.length,De=0,We=Br(ne,this.__takeCount__);if(!h||!E&&C==ne&&We==ne)return h0(n,this.__actions__);var ot=[];e:for(;ne--&&De<We;){he+=o;for(var yt=-1,ct=n[he];++yt<ge;){var Et=le[yt],Ot=Et.iteratee,bi=Et.type,Hr=Ot(ct);if(bi==d)ct=Hr;else if(!Hr){if(bi==p)continue e;break e}}ot[De++]=ct}return ot}Mt.prototype=Ea(Kc.prototype),Mt.prototype.constructor=Mt;function Fs(n){var o=-1,h=n==null?0:n.length;for(this.clear();++o<h;){var E=n[o];this.set(E[0],E[1])}}function e2(){this.__data__=uo?uo(null):{},this.size=0}function t2(n){var o=this.has(n)&&delete this.__data__[n];return this.size-=o?1:0,o}function r2(n){var o=this.__data__;if(uo){var h=o[n];return h===b?t:h}return Bt.call(o,n)?o[n]:t}function i2(n){var o=this.__data__;return uo?o[n]!==t:Bt.call(o,n)}function n2(n,o){var h=this.__data__;return this.size+=this.has(n)?0:1,h[n]=uo&&o===t?b:o,this}Fs.prototype.clear=e2,Fs.prototype.delete=t2,Fs.prototype.get=r2,Fs.prototype.has=i2,Fs.prototype.set=n2;function Ln(n){var o=-1,h=n==null?0:n.length;for(this.clear();++o<h;){var E=n[o];this.set(E[0],E[1])}}function s2(){this.__data__=[],this.size=0}function a2(n){var o=this.__data__,h=Vc(o,n);if(h<0)return!1;var E=o.length-1;return h==E?o.pop():Uc.call(o,h,1),--this.size,!0}function o2(n){var o=this.__data__,h=Vc(o,n);return h<0?t:o[h][1]}function c2(n){return Vc(this.__data__,n)>-1}function f2(n,o){var h=this.__data__,E=Vc(h,n);return E<0?(++this.size,h.push([n,o])):h[E][1]=o,this}Ln.prototype.clear=s2,Ln.prototype.delete=a2,Ln.prototype.get=o2,Ln.prototype.has=c2,Ln.prototype.set=f2;function Un(n){var o=-1,h=n==null?0:n.length;for(this.clear();++o<h;){var E=n[o];this.set(E[0],E[1])}}function u2(){this.size=0,this.__data__={hash:new Fs,map:new(co||Ln),string:new Fs}}function h2(n){var o=sf(this,n).delete(n);return this.size-=o?1:0,o}function l2(n){return sf(this,n).get(n)}function d2(n){return sf(this,n).has(n)}function p2(n,o){var h=sf(this,n),E=h.size;return h.set(n,o),this.size+=h.size==E?0:1,this}Un.prototype.clear=u2,Un.prototype.delete=h2,Un.prototype.get=l2,Un.prototype.has=d2,Un.prototype.set=p2;function Bs(n){var o=-1,h=n==null?0:n.length;for(this.__data__=new Un;++o<h;)this.add(n[o])}function g2(n){return this.__data__.set(n,b),this}function v2(n){return this.__data__.has(n)}Bs.prototype.add=Bs.prototype.push=g2,Bs.prototype.has=v2;function Xi(n){var o=this.__data__=new Ln(n);this.size=o.size}function b2(){this.__data__=new Ln,this.size=0}function m2(n){var o=this.__data__,h=o.delete(n);return this.size=o.size,h}function y2(n){return this.__data__.get(n)}function w2(n){return this.__data__.has(n)}function _2(n,o){var h=this.__data__;if(h instanceof Ln){var E=h.__data__;if(!co||E.length<s-1)return E.push([n,o]),this.size=++h.size,this;h=this.__data__=new Un(E)}return h.set(n,o),this.size=h.size,this}Xi.prototype.clear=b2,Xi.prototype.delete=m2,Xi.prototype.get=y2,Xi.prototype.has=w2,Xi.prototype.set=_2;function jd(n,o){var h=gt(n),E=!h&&zs(n),C=!h&&!E&&gs(n),q=!h&&!E&&!C&&Ia(n),J=h||E||C||q,X=J?Nu(n.length,Cm):[],ne=X.length;for(var he in n)(o||Bt.call(n,he))&&!(J&&(he=="length"||C&&(he=="offset"||he=="parent")||q&&(he=="buffer"||he=="byteLength"||he=="byteOffset")||kn(he,ne)))&&X.push(he);return X}function kd(n){var o=n.length;return o?n[Yu(0,o-1)]:t}function A2(n,o){return af(ti(n),qs(o,0,n.length))}function E2(n){return af(ti(n))}function $u(n,o,h){(h!==t&&!Zi(n[o],h)||h===t&&!(o in n))&&$n(n,o,h)}function lo(n,o,h){var E=n[o];(!(Bt.call(n,o)&&Zi(E,h))||h===t&&!(o in n))&&$n(n,o,h)}function Vc(n,o){for(var h=n.length;h--;)if(Zi(n[h][0],o))return h;return-1}function S2(n,o,h,E){return hs(n,function(C,q,J){o(E,C,h(C),J)}),E}function Hd(n,o){return n&&vn(o,vr(o),n)}function x2(n,o){return n&&vn(o,ii(o),n)}function $n(n,o,h){o=="__proto__"&&$c?$c(n,o,{configurable:!0,enumerable:!0,value:h,writable:!0}):n[o]=h}function zu(n,o){for(var h=-1,E=o.length,C=oe(E),q=n==null;++h<E;)C[h]=q?t:_h(n,o[h]);return C}function qs(n,o,h){return n===n&&(h!==t&&(n=n<=h?n:h),o!==t&&(n=n>=o?n:o)),n}function Pi(n,o,h,E,C,q){var J,X=o&S,ne=o&O,he=o&P;if(h&&(J=C?h(n,E,C,q):h(n)),J!==t)return J;if(!Qt(n))return n;var le=gt(n);if(le){if(J=dy(n),!X)return ti(n,J)}else{var ge=qr(n),De=ge==se||ge==ce;if(gs(n))return p0(n,X);if(ge==Re||ge==D||De&&!C){if(J=ne||De?{}:N0(n),!X)return ne?ry(n,x2(J,n)):ty(n,Hd(J,n))}else{if(!Lt[ge])return C?n:{};J=py(n,ge,X)}}q||(q=new Xi);var We=q.get(n);if(We)return We;q.set(n,J),cp(n)?n.forEach(function(ct){J.add(Pi(ct,o,h,ct,n,q))}):ap(n)&&n.forEach(function(ct,Et){J.set(Et,Pi(ct,o,h,Et,n,q))});var ot=he?ne?oh:ah:ne?ii:vr,yt=le?t:ot(n);return Mi(yt||n,function(ct,Et){yt&&(Et=ct,ct=n[Et]),lo(J,Et,Pi(ct,o,h,Et,n,q))}),J}function M2(n){var o=vr(n);return function(h){return Kd(h,n,o)}}function Kd(n,o,h){var E=h.length;if(n==null)return!E;for(n=jt(n);E--;){var C=h[E],q=o[C],J=n[C];if(J===t&&!(C in n)||!q(J))return!1}return!0}function Vd(n,o,h){if(typeof n!="function")throw new Ii(f);return wo(function(){n.apply(t,h)},o)}function po(n,o,h,E){var C=-1,q=Pc,J=!0,X=n.length,ne=[],he=o.length;if(!X)return ne;h&&(o=Yt(o,pi(h))),E?(q=Iu,J=!1):o.length>=s&&(q=ao,J=!1,o=new Bs(o));e:for(;++C<X;){var le=n[C],ge=h==null?le:h(le);if(le=E||le!==0?le:0,J&&ge===ge){for(var De=he;De--;)if(o[De]===ge)continue e;ne.push(le)}else q(o,ge,E)||ne.push(le)}return ne}var hs=y0(gn),Gd=y0(ku,!0);function I2(n,o){var h=!0;return hs(n,function(E,C,q){return h=!!o(E,C,q),h}),h}function Gc(n,o,h){for(var E=-1,C=n.length;++E<C;){var q=n[E],J=o(q);if(J!=null&&(X===t?J===J&&!vi(J):h(J,X)))var X=J,ne=q}return ne}function D2(n,o,h,E){var C=n.length;for(h=mt(h),h<0&&(h=-h>C?0:C+h),E=E===t||E>C?C:mt(E),E<0&&(E+=C),E=h>E?0:up(E);h<E;)n[h++]=o;return n}function Wd(n,o){var h=[];return hs(n,function(E,C,q){o(E,C,q)&&h.push(E)}),h}function xr(n,o,h,E,C){var q=-1,J=n.length;for(h||(h=vy),C||(C=[]);++q<J;){var X=n[q];o>0&&h(X)?o>1?xr(X,o-1,h,E,C):cs(C,X):E||(C[C.length]=X)}return C}var ju=w0(),Jd=w0(!0);function gn(n,o){return n&&ju(n,o,vr)}function ku(n,o){return n&&Jd(n,o,vr)}function Wc(n,o){return os(o,function(h){return Hn(n[h])})}function Ls(n,o){o=ds(o,n);for(var h=0,E=o.length;n!=null&&h<E;)n=n[bn(o[h++])];return h&&h==E?n:t}function Yd(n,o,h){var E=o(n);return gt(n)?E:cs(E,h(n))}function jr(n){return n==null?n===t?Te:we:Ts&&Ts in jt(n)?uy(n):Ey(n)}function Hu(n,o){return n>o}function P2(n,o){return n!=null&&Bt.call(n,o)}function O2(n,o){return n!=null&&o in jt(n)}function C2(n,o,h){return n>=Br(o,h)&&n<lr(o,h)}function Ku(n,o,h){for(var E=h?Iu:Pc,C=n[0].length,q=n.length,J=q,X=oe(q),ne=1/0,he=[];J--;){var le=n[J];J&&o&&(le=Yt(le,pi(o))),ne=Br(le.length,ne),X[J]=!h&&(o||C>=120&&le.length>=120)?new Bs(J&&le):t}le=n[0];var ge=-1,De=X[0];e:for(;++ge<C&&he.length<ne;){var We=le[ge],ot=o?o(We):We;if(We=h||We!==0?We:0,!(De?ao(De,ot):E(he,ot,h))){for(J=q;--J;){var yt=X[J];if(!(yt?ao(yt,ot):E(n[J],ot,h)))continue e}De&&De.push(ot),he.push(We)}}return he}function R2(n,o,h,E){return gn(n,function(C,q,J){o(E,h(C),q,J)}),E}function go(n,o,h){o=ds(o,n),n=q0(n,o);var E=n==null?n:n[bn(Ci(o))];return E==null?t:gr(E,n,h)}function Qd(n){return Zt(n)&&jr(n)==D}function N2(n){return Zt(n)&&jr(n)==xe}function T2(n){return Zt(n)&&jr(n)==K}function vo(n,o,h,E,C){return n===o?!0:n==null||o==null||!Zt(n)&&!Zt(o)?n!==n&&o!==o:F2(n,o,h,E,vo,C)}function F2(n,o,h,E,C,q){var J=gt(n),X=gt(o),ne=J?ee:qr(n),he=X?ee:qr(o);ne=ne==D?Re:ne,he=he==D?Re:he;var le=ne==Re,ge=he==Re,De=ne==he;if(De&&gs(n)){if(!gs(o))return!1;J=!0,le=!1}if(De&&!le)return q||(q=new Xi),J||Ia(n)?O0(n,o,h,E,C,q):cy(n,o,ne,h,E,C,q);if(!(h&R)){var We=le&&Bt.call(n,"__wrapped__"),ot=ge&&Bt.call(o,"__wrapped__");if(We||ot){var yt=We?n.value():n,ct=ot?o.value():o;return q||(q=new Xi),C(yt,ct,h,E,q)}}return De?(q||(q=new Xi),fy(n,o,h,E,C,q)):!1}function B2(n){return Zt(n)&&qr(n)==ue}function Vu(n,o,h,E){var C=h.length,q=C,J=!E;if(n==null)return!q;for(n=jt(n);C--;){var X=h[C];if(J&&X[2]?X[1]!==n[X[0]]:!(X[0]in n))return!1}for(;++C<q;){X=h[C];var ne=X[0],he=n[ne],le=X[1];if(J&&X[2]){if(he===t&&!(ne in n))return!1}else{var ge=new Xi;if(E)var De=E(he,le,ne,n,o,ge);if(!(De===t?vo(le,he,R|z,E,ge):De))return!1}}return!0}function Xd(n){if(!Qt(n)||my(n))return!1;var o=Hn(n)?Bm:Nr;return o.test($s(n))}function q2(n){return Zt(n)&&jr(n)==Ne}function L2(n){return Zt(n)&&qr(n)==Me}function U2(n){return Zt(n)&&lf(n.length)&&!!Ut[jr(n)]}function Zd(n){return typeof n=="function"?n:n==null?ni:typeof n=="object"?gt(n)?r0(n[0],n[1]):t0(n):_p(n)}function Gu(n){if(!yo(n))return jm(n);var o=[];for(var h in jt(n))Bt.call(n,h)&&h!="constructor"&&o.push(h);return o}function $2(n){if(!Qt(n))return Ay(n);var o=yo(n),h=[];for(var E in n)E=="constructor"&&(o||!Bt.call(n,E))||h.push(E);return h}function Wu(n,o){return n<o}function e0(n,o){var h=-1,E=ri(n)?oe(n.length):[];return hs(n,function(C,q,J){E[++h]=o(C,q,J)}),E}function t0(n){var o=fh(n);return o.length==1&&o[0][2]?F0(o[0][0],o[0][1]):function(h){return h===n||Vu(h,n,o)}}function r0(n,o){return hh(n)&&T0(o)?F0(bn(n),o):function(h){var E=_h(h,n);return E===t&&E===o?Ah(h,n):vo(o,E,R|z)}}function Jc(n,o,h,E,C){n!==o&&ju(o,function(q,J){if(C||(C=new Xi),Qt(q))z2(n,o,J,h,Jc,E,C);else{var X=E?E(dh(n,J),q,J+"",n,o,C):t;X===t&&(X=q),$u(n,J,X)}},ii)}function z2(n,o,h,E,C,q,J){var X=dh(n,h),ne=dh(o,h),he=J.get(ne);if(he){$u(n,h,he);return}var le=q?q(X,ne,h+"",n,o,J):t,ge=le===t;if(ge){var De=gt(ne),We=!De&&gs(ne),ot=!De&&!We&&Ia(ne);le=ne,De||We||ot?gt(X)?le=X:nr(X)?le=ti(X):We?(ge=!1,le=p0(ne,!0)):ot?(ge=!1,le=g0(ne,!0)):le=[]:_o(ne)||zs(ne)?(le=X,zs(X)?le=hp(X):(!Qt(X)||Hn(X))&&(le=N0(ne))):ge=!1}ge&&(J.set(ne,le),C(le,ne,E,q,J),J.delete(ne)),$u(n,h,le)}function i0(n,o){var h=n.length;if(h)return o+=o<0?h:0,kn(o,h)?n[o]:t}function n0(n,o,h){o.length?o=Yt(o,function(q){return gt(q)?function(J){return Ls(J,q.length===1?q[0]:q)}:q}):o=[ni];var E=-1;o=Yt(o,pi(nt()));var C=e0(n,function(q,J,X){var ne=Yt(o,function(he){return he(q)});return{criteria:ne,index:++E,value:q}});return pm(C,function(q,J){return ey(q,J,h)})}function j2(n,o){return s0(n,o,function(h,E){return Ah(n,E)})}function s0(n,o,h){for(var E=-1,C=o.length,q={};++E<C;){var J=o[E],X=Ls(n,J);h(X,J)&&bo(q,ds(J,n),X)}return q}function k2(n){return function(o){return Ls(o,n)}}function Ju(n,o,h,E){var C=E?dm:va,q=-1,J=o.length,X=n;for(n===o&&(o=ti(o)),h&&(X=Yt(n,pi(h)));++q<J;)for(var ne=0,he=o[q],le=h?h(he):he;(ne=C(X,le,ne,E))>-1;)X!==n&&Uc.call(X,ne,1),Uc.call(n,ne,1);return n}function a0(n,o){for(var h=n?o.length:0,E=h-1;h--;){var C=o[h];if(h==E||C!==q){var q=C;kn(C)?Uc.call(n,C,1):Zu(n,C)}}return n}function Yu(n,o){return n+jc($d()*(o-n+1))}function H2(n,o,h,E){for(var C=-1,q=lr(zc((o-n)/(h||1)),0),J=oe(q);q--;)J[E?q:++C]=n,n+=h;return J}function Qu(n,o){var h="";if(!n||o<1||o>I)return h;do o%2&&(h+=n),o=jc(o/2),o&&(n+=n);while(o);return h}function _t(n,o){return ph(B0(n,o,ni),n+"")}function K2(n){return kd(Da(n))}function V2(n,o){var h=Da(n);return af(h,qs(o,0,h.length))}function bo(n,o,h,E){if(!Qt(n))return n;o=ds(o,n);for(var C=-1,q=o.length,J=q-1,X=n;X!=null&&++C<q;){var ne=bn(o[C]),he=h;if(ne==="__proto__"||ne==="constructor"||ne==="prototype")return n;if(C!=J){var le=X[ne];he=E?E(le,ne,X):t,he===t&&(he=Qt(le)?le:kn(o[C+1])?[]:{})}lo(X,ne,he),X=X[ne]}return n}var o0=kc?function(n,o){return kc.set(n,o),n}:ni,G2=$c?function(n,o){return $c(n,"toString",{configurable:!0,enumerable:!1,value:Sh(o),writable:!0})}:ni;function W2(n){return af(Da(n))}function Oi(n,o,h){var E=-1,C=n.length;o<0&&(o=-o>C?0:C+o),h=h>C?C:h,h<0&&(h+=C),C=o>h?0:h-o>>>0,o>>>=0;for(var q=oe(C);++E<C;)q[E]=n[E+o];return q}function J2(n,o){var h;return hs(n,function(E,C,q){return h=o(E,C,q),!h}),!!h}function Yc(n,o,h){var E=0,C=n==null?E:n.length;if(typeof o=="number"&&o===o&&C<=Z){for(;E<C;){var q=E+C>>>1,J=n[q];J!==null&&!vi(J)&&(h?J<=o:J<o)?E=q+1:C=q}return C}return Xu(n,o,ni,h)}function Xu(n,o,h,E){var C=0,q=n==null?0:n.length;if(q===0)return 0;o=h(o);for(var J=o!==o,X=o===null,ne=vi(o),he=o===t;C<q;){var le=jc((C+q)/2),ge=h(n[le]),De=ge!==t,We=ge===null,ot=ge===ge,yt=vi(ge);if(J)var ct=E||ot;else he?ct=ot&&(E||De):X?ct=ot&&De&&(E||!We):ne?ct=ot&&De&&!We&&(E||!yt):We||yt?ct=!1:ct=E?ge<=o:ge<o;ct?C=le+1:q=le}return Br(q,N)}function c0(n,o){for(var h=-1,E=n.length,C=0,q=[];++h<E;){var J=n[h],X=o?o(J):J;if(!h||!Zi(X,ne)){var ne=X;q[C++]=J===0?0:J}}return q}function f0(n){return typeof n=="number"?n:vi(n)?l:+n}function gi(n){if(typeof n=="string")return n;if(gt(n))return Yt(n,gi)+"";if(vi(n))return zd?zd.call(n):"";var o=n+"";return o=="0"&&1/n==-M?"-0":o}function ls(n,o,h){var E=-1,C=Pc,q=n.length,J=!0,X=[],ne=X;if(h)J=!1,C=Iu;else if(q>=s){var he=o?null:ay(n);if(he)return Cc(he);J=!1,C=ao,ne=new Bs}else ne=o?[]:X;e:for(;++E<q;){var le=n[E],ge=o?o(le):le;if(le=h||le!==0?le:0,J&&ge===ge){for(var De=ne.length;De--;)if(ne[De]===ge)continue e;o&&ne.push(ge),X.push(le)}else C(ne,ge,h)||(ne!==X&&ne.push(ge),X.push(le))}return X}function Zu(n,o){return o=ds(o,n),n=q0(n,o),n==null||delete n[bn(Ci(o))]}function u0(n,o,h,E){return bo(n,o,h(Ls(n,o)),E)}function Qc(n,o,h,E){for(var C=n.length,q=E?C:-1;(E?q--:++q<C)&&o(n[q],q,n););return h?Oi(n,E?0:q,E?q+1:C):Oi(n,E?q+1:0,E?C:q)}function h0(n,o){var h=n;return h instanceof Mt&&(h=h.value()),Du(o,function(E,C){return C.func.apply(C.thisArg,cs([E],C.args))},h)}function eh(n,o,h){var E=n.length;if(E<2)return E?ls(n[0]):[];for(var C=-1,q=oe(E);++C<E;)for(var J=n[C],X=-1;++X<E;)X!=C&&(q[C]=po(q[C]||J,n[X],o,h));return ls(xr(q,1),o,h)}function l0(n,o,h){for(var E=-1,C=n.length,q=o.length,J={};++E<C;){var X=E<q?o[E]:t;h(J,n[E],X)}return J}function th(n){return nr(n)?n:[]}function rh(n){return typeof n=="function"?n:ni}function ds(n,o){return gt(n)?n:hh(n,o)?[n]:z0(Tt(n))}var Y2=_t;function ps(n,o,h){var E=n.length;return h=h===t?E:h,!o&&h>=E?n:Oi(n,o,h)}var d0=qm||function(n){return Pt.clearTimeout(n)};function p0(n,o){if(o)return n.slice();var h=n.length,E=Fd?Fd(h):new n.constructor(h);return n.copy(E),E}function ih(n){var o=new n.constructor(n.byteLength);return new qc(o).set(new qc(n)),o}function Q2(n,o){var h=o?ih(n.buffer):n.buffer;return new n.constructor(h,n.byteOffset,n.byteLength)}function X2(n){var o=new n.constructor(n.source,bt.exec(n));return o.lastIndex=n.lastIndex,o}function Z2(n){return ho?jt(ho.call(n)):{}}function g0(n,o){var h=o?ih(n.buffer):n.buffer;return new n.constructor(h,n.byteOffset,n.length)}function v0(n,o){if(n!==o){var h=n!==t,E=n===null,C=n===n,q=vi(n),J=o!==t,X=o===null,ne=o===o,he=vi(o);if(!X&&!he&&!q&&n>o||q&&J&&ne&&!X&&!he||E&&J&&ne||!h&&ne||!C)return 1;if(!E&&!q&&!he&&n<o||he&&h&&C&&!E&&!q||X&&h&&C||!J&&C||!ne)return-1}return 0}function ey(n,o,h){for(var E=-1,C=n.criteria,q=o.criteria,J=C.length,X=h.length;++E<J;){var ne=v0(C[E],q[E]);if(ne){if(E>=X)return ne;var he=h[E];return ne*(he=="desc"?-1:1)}}return n.index-o.index}function b0(n,o,h,E){for(var C=-1,q=n.length,J=h.length,X=-1,ne=o.length,he=lr(q-J,0),le=oe(ne+he),ge=!E;++X<ne;)le[X]=o[X];for(;++C<J;)(ge||C<q)&&(le[h[C]]=n[C]);for(;he--;)le[X++]=n[C++];return le}function m0(n,o,h,E){for(var C=-1,q=n.length,J=-1,X=h.length,ne=-1,he=o.length,le=lr(q-X,0),ge=oe(le+he),De=!E;++C<le;)ge[C]=n[C];for(var We=C;++ne<he;)ge[We+ne]=o[ne];for(;++J<X;)(De||C<q)&&(ge[We+h[J]]=n[C++]);return ge}function ti(n,o){var h=-1,E=n.length;for(o||(o=oe(E));++h<E;)o[h]=n[h];return o}function vn(n,o,h,E){var C=!h;h||(h={});for(var q=-1,J=o.length;++q<J;){var X=o[q],ne=E?E(h[X],n[X],X,h,n):t;ne===t&&(ne=n[X]),C?$n(h,X,ne):lo(h,X,ne)}return h}function ty(n,o){return vn(n,uh(n),o)}function ry(n,o){return vn(n,C0(n),o)}function Xc(n,o){return function(h,E){var C=gt(h)?om:S2,q=o?o():{};return C(h,n,nt(E,2),q)}}function Sa(n){return _t(function(o,h){var E=-1,C=h.length,q=C>1?h[C-1]:t,J=C>2?h[2]:t;for(q=n.length>3&&typeof q=="function"?(C--,q):t,J&&kr(h[0],h[1],J)&&(q=C<3?t:q,C=1),o=jt(o);++E<C;){var X=h[E];X&&n(o,X,E,q)}return o})}function y0(n,o){return function(h,E){if(h==null)return h;if(!ri(h))return n(h,E);for(var C=h.length,q=o?C:-1,J=jt(h);(o?q--:++q<C)&&E(J[q],q,J)!==!1;);return h}}function w0(n){return function(o,h,E){for(var C=-1,q=jt(o),J=E(o),X=J.length;X--;){var ne=J[n?X:++C];if(h(q[ne],ne,q)===!1)break}return o}}function iy(n,o,h){var E=o&W,C=mo(n);function q(){var J=this&&this!==Pt&&this instanceof q?C:n;return J.apply(E?h:this,arguments)}return q}function _0(n){return function(o){o=Tt(o);var h=ba(o)?Qi(o):t,E=h?h[0]:o.charAt(0),C=h?ps(h,1).join(""):o.slice(1);return E[n]()+C}}function xa(n){return function(o){return Du(yp(mp(o).replace(no,"")),n,"")}}function mo(n){return function(){var o=arguments;switch(o.length){case 0:return new n;case 1:return new n(o[0]);case 2:return new n(o[0],o[1]);case 3:return new n(o[0],o[1],o[2]);case 4:return new n(o[0],o[1],o[2],o[3]);case 5:return new n(o[0],o[1],o[2],o[3],o[4]);case 6:return new n(o[0],o[1],o[2],o[3],o[4],o[5]);case 7:return new n(o[0],o[1],o[2],o[3],o[4],o[5],o[6])}var h=Ea(n.prototype),E=n.apply(h,o);return Qt(E)?E:h}}function ny(n,o,h){var E=mo(n);function C(){for(var q=arguments.length,J=oe(q),X=q,ne=Ma(C);X--;)J[X]=arguments[X];var he=q<3&&J[0]!==ne&&J[q-1]!==ne?[]:fs(J,ne);if(q-=he.length,q<h)return M0(n,o,Zc,C.placeholder,t,J,he,t,t,h-q);var le=this&&this!==Pt&&this instanceof C?E:n;return gr(le,this,J)}return C}function A0(n){return function(o,h,E){var C=jt(o);if(!ri(o)){var q=nt(h,3);o=vr(o),h=function(X){return q(C[X],X,C)}}var J=n(o,h,E);return J>-1?C[q?o[J]:J]:t}}function E0(n){return jn(function(o){var h=o.length,E=h,C=Di.prototype.thru;for(n&&o.reverse();E--;){var q=o[E];if(typeof q!="function")throw new Ii(f);if(C&&!J&&nf(q)=="wrapper")var J=new Di([],!0)}for(E=J?E:h;++E<h;){q=o[E];var X=nf(q),ne=X=="wrapper"?ch(q):t;ne&&lh(ne[0])&&ne[1]==(A|Y|k|F)&&!ne[4].length&&ne[9]==1?J=J[nf(ne[0])].apply(J,ne[3]):J=q.length==1&&lh(q)?J[X]():J.thru(q)}return function(){var he=arguments,le=he[0];if(J&&he.length==1&>(le))return J.plant(le).value();for(var ge=0,De=h?o[ge].apply(this,he):le;++ge<h;)De=o[ge].call(this,De);return De}})}function Zc(n,o,h,E,C,q,J,X,ne,he){var le=o&A,ge=o&W,De=o&Q,We=o&(Y|U),ot=o&ae,yt=De?t:mo(n);function ct(){for(var Et=arguments.length,Ot=oe(Et),bi=Et;bi--;)Ot[bi]=arguments[bi];if(We)var Hr=Ma(ct),mi=vm(Ot,Hr);if(E&&(Ot=b0(Ot,E,C,We)),q&&(Ot=m0(Ot,q,J,We)),Et-=mi,We&&Et<he){var sr=fs(Ot,Hr);return M0(n,o,Zc,ct.placeholder,h,Ot,sr,X,ne,he-Et)}var en=ge?h:this,Vn=De?en[n]:n;return Et=Ot.length,X?Ot=Sy(Ot,X):ot&&Et>1&&Ot.reverse(),le&&ne<Et&&(Ot.length=ne),this&&this!==Pt&&this instanceof ct&&(Vn=yt||mo(Vn)),Vn.apply(en,Ot)}return ct}function S0(n,o){return function(h,E){return R2(h,n,o(E),{})}}function ef(n,o){return function(h,E){var C;if(h===t&&E===t)return o;if(h!==t&&(C=h),E!==t){if(C===t)return E;typeof h=="string"||typeof E=="string"?(h=gi(h),E=gi(E)):(h=f0(h),E=f0(E)),C=n(h,E)}return C}}function nh(n){return jn(function(o){return o=Yt(o,pi(nt())),_t(function(h){var E=this;return n(o,function(C){return gr(C,E,h)})})})}function tf(n,o){o=o===t?" ":gi(o);var h=o.length;if(h<2)return h?Qu(o,n):o;var E=Qu(o,zc(n/ma(o)));return ba(o)?ps(Qi(E),0,n).join(""):E.slice(0,n)}function sy(n,o,h,E){var C=o&W,q=mo(n);function J(){for(var X=-1,ne=arguments.length,he=-1,le=E.length,ge=oe(le+ne),De=this&&this!==Pt&&this instanceof J?q:n;++he<le;)ge[he]=E[he];for(;ne--;)ge[he++]=arguments[++X];return gr(De,C?h:this,ge)}return J}function x0(n){return function(o,h,E){return E&&typeof E!="number"&&kr(o,h,E)&&(h=E=t),o=Kn(o),h===t?(h=o,o=0):h=Kn(h),E=E===t?o<h?1:-1:Kn(E),H2(o,h,E,n)}}function rf(n){return function(o,h){return typeof o=="string"&&typeof h=="string"||(o=Ri(o),h=Ri(h)),n(o,h)}}function M0(n,o,h,E,C,q,J,X,ne,he){var le=o&Y,ge=le?J:t,De=le?t:J,We=le?q:t,ot=le?t:q;o|=le?k:V,o&=~(le?V:k),o&j||(o&=~(W|Q));var yt=[n,o,C,We,ge,ot,De,X,ne,he],ct=h.apply(t,yt);return lh(n)&&L0(ct,yt),ct.placeholder=E,U0(ct,n,o)}function sh(n){var o=hr[n];return function(h,E){if(h=Ri(h),E=E==null?0:Br(mt(E),292),E&&Ud(h)){var C=(Tt(h)+"e").split("e"),q=o(C[0]+"e"+(+C[1]+E));return C=(Tt(q)+"e").split("e"),+(C[0]+"e"+(+C[1]-E))}return o(h)}}var ay=_a&&1/Cc(new _a([,-0]))[1]==M?function(n){return new _a(n)}:Ih;function I0(n){return function(o){var h=qr(o);return h==ue?Fu(o):h==Me?Em(o):gm(o,n(o))}}function zn(n,o,h,E,C,q,J,X){var ne=o&Q;if(!ne&&typeof n!="function")throw new Ii(f);var he=E?E.length:0;if(he||(o&=~(k|V),E=C=t),J=J===t?J:lr(mt(J),0),X=X===t?X:mt(X),he-=C?C.length:0,o&V){var le=E,ge=C;E=C=t}var De=ne?t:ch(n),We=[n,o,h,E,C,le,ge,q,J,X];if(De&&_y(We,De),n=We[0],o=We[1],h=We[2],E=We[3],C=We[4],X=We[9]=We[9]===t?ne?0:n.length:lr(We[9]-he,0),!X&&o&(Y|U)&&(o&=~(Y|U)),!o||o==W)var ot=iy(n,o,h);else o==Y||o==U?ot=ny(n,o,X):(o==k||o==(W|k))&&!C.length?ot=sy(n,o,h,E):ot=Zc.apply(t,We);var yt=De?o0:L0;return U0(yt(ot,We),n,o)}function D0(n,o,h,E){return n===t||Zi(n,wa[h])&&!Bt.call(E,h)?o:n}function P0(n,o,h,E,C,q){return Qt(n)&&Qt(o)&&(q.set(o,n),Jc(n,o,t,P0,q),q.delete(o)),n}function oy(n){return _o(n)?t:n}function O0(n,o,h,E,C,q){var J=h&R,X=n.length,ne=o.length;if(X!=ne&&!(J&&ne>X))return!1;var he=q.get(n),le=q.get(o);if(he&&le)return he==o&&le==n;var ge=-1,De=!0,We=h&z?new Bs:t;for(q.set(n,o),q.set(o,n);++ge<X;){var ot=n[ge],yt=o[ge];if(E)var ct=J?E(yt,ot,ge,o,n,q):E(ot,yt,ge,n,o,q);if(ct!==t){if(ct)continue;De=!1;break}if(We){if(!Pu(o,function(Et,Ot){if(!ao(We,Ot)&&(ot===Et||C(ot,Et,h,E,q)))return We.push(Ot)})){De=!1;break}}else if(!(ot===yt||C(ot,yt,h,E,q))){De=!1;break}}return q.delete(n),q.delete(o),De}function cy(n,o,h,E,C,q,J){switch(h){case be:if(n.byteLength!=o.byteLength||n.byteOffset!=o.byteOffset)return!1;n=n.buffer,o=o.buffer;case xe:return!(n.byteLength!=o.byteLength||!q(new qc(n),new qc(o)));case H:case K:case ye:return Zi(+n,+o);case $:return n.name==o.name&&n.message==o.message;case Ne:case me:return n==o+"";case ue:var X=Fu;case Me:var ne=E&R;if(X||(X=Cc),n.size!=o.size&&!ne)return!1;var he=J.get(n);if(he)return he==o;E|=z,J.set(n,o);var le=O0(X(n),X(o),E,C,q,J);return J.delete(n),le;case Oe:if(ho)return ho.call(n)==ho.call(o)}return!1}function fy(n,o,h,E,C,q){var J=h&R,X=ah(n),ne=X.length,he=ah(o),le=he.length;if(ne!=le&&!J)return!1;for(var ge=ne;ge--;){var De=X[ge];if(!(J?De in o:Bt.call(o,De)))return!1}var We=q.get(n),ot=q.get(o);if(We&&ot)return We==o&&ot==n;var yt=!0;q.set(n,o),q.set(o,n);for(var ct=J;++ge<ne;){De=X[ge];var Et=n[De],Ot=o[De];if(E)var bi=J?E(Ot,Et,De,o,n,q):E(Et,Ot,De,n,o,q);if(!(bi===t?Et===Ot||C(Et,Ot,h,E,q):bi)){yt=!1;break}ct||(ct=De=="constructor")}if(yt&&!ct){var Hr=n.constructor,mi=o.constructor;Hr!=mi&&"constructor"in n&&"constructor"in o&&!(typeof Hr=="function"&&Hr instanceof Hr&&typeof mi=="function"&&mi instanceof mi)&&(yt=!1)}return q.delete(n),q.delete(o),yt}function jn(n){return ph(B0(n,t,K0),n+"")}function ah(n){return Yd(n,vr,uh)}function oh(n){return Yd(n,ii,C0)}var ch=kc?function(n){return kc.get(n)}:Ih;function nf(n){for(var o=n.name+"",h=Aa[o],E=Bt.call(Aa,o)?h.length:0;E--;){var C=h[E],q=C.func;if(q==null||q==n)return C.name}return o}function Ma(n){var o=Bt.call(T,"placeholder")?T:n;return o.placeholder}function nt(){var n=T.iteratee||xh;return n=n===xh?Zd:n,arguments.length?n(arguments[0],arguments[1]):n}function sf(n,o){var h=n.__data__;return by(o)?h[typeof o=="string"?"string":"hash"]:h.map}function fh(n){for(var o=vr(n),h=o.length;h--;){var E=o[h],C=n[E];o[h]=[E,C,T0(C)]}return o}function Us(n,o){var h=wm(n,o);return Xd(h)?h:t}function uy(n){var o=Bt.call(n,Ts),h=n[Ts];try{n[Ts]=t;var E=!0}catch{}var C=Fc.call(n);return E&&(o?n[Ts]=h:delete n[Ts]),C}var uh=qu?function(n){return n==null?[]:(n=jt(n),os(qu(n),function(o){return qd.call(n,o)}))}:Dh,C0=qu?function(n){for(var o=[];n;)cs(o,uh(n)),n=Lc(n);return o}:Dh,qr=jr;(Lu&&qr(new Lu(new ArrayBuffer(1)))!=be||co&&qr(new co)!=ue||Uu&&qr(Uu.resolve())!=Qe||_a&&qr(new _a)!=Me||fo&&qr(new fo)!=ve)&&(qr=function(n){var o=jr(n),h=o==Re?n.constructor:t,E=h?$s(h):"";if(E)switch(E){case Vm:return be;case Gm:return ue;case Wm:return Qe;case Jm:return Me;case Ym:return ve}return o});function hy(n,o,h){for(var E=-1,C=h.length;++E<C;){var q=h[E],J=q.size;switch(q.type){case"drop":n+=J;break;case"dropRight":o-=J;break;case"take":o=Br(o,n+J);break;case"takeRight":n=lr(n,o-J);break}}return{start:n,end:o}}function ly(n){var o=n.match(Ye);return o?o[1].split(ut):[]}function R0(n,o,h){o=ds(o,n);for(var E=-1,C=o.length,q=!1;++E<C;){var J=bn(o[E]);if(!(q=n!=null&&h(n,J)))break;n=n[J]}return q||++E!=C?q:(C=n==null?0:n.length,!!C&&lf(C)&&kn(J,C)&&(gt(n)||zs(n)))}function dy(n){var o=n.length,h=new n.constructor(o);return o&&typeof n[0]=="string"&&Bt.call(n,"index")&&(h.index=n.index,h.input=n.input),h}function N0(n){return typeof n.constructor=="function"&&!yo(n)?Ea(Lc(n)):{}}function py(n,o,h){var E=n.constructor;switch(o){case xe:return ih(n);case H:case K:return new E(+n);case be:return Q2(n,h);case Le:case Ie:case _e:case He:case Ve:case Ee:case Ke:case ht:case Ge:return g0(n,h);case ue:return new E;case ye:case me:return new E(n);case Ne:return X2(n);case Me:return new E;case Oe:return Z2(n)}}function gy(n,o){var h=o.length;if(!h)return n;var E=h-1;return o[E]=(h>1?"& ":"")+o[E],o=o.join(h>2?", ":" "),n.replace(qe,`{
|
|
53
|
+
/* [wrapped with `+o+`] */
|
|
54
|
+
`)}function vy(n){return gt(n)||zs(n)||!!(Ld&&n&&n[Ld])}function kn(n,o){var h=typeof n;return o=o??I,!!o&&(h=="number"||h!="symbol"&&Fr.test(n))&&n>-1&&n%1==0&&n<o}function kr(n,o,h){if(!Qt(h))return!1;var E=typeof o;return(E=="number"?ri(h)&&kn(o,h.length):E=="string"&&o in h)?Zi(h[o],n):!1}function hh(n,o){if(gt(n))return!1;var h=typeof n;return h=="number"||h=="symbol"||h=="boolean"||n==null||vi(n)?!0:$e.test(n)||!Ze.test(n)||o!=null&&n in jt(o)}function by(n){var o=typeof n;return o=="string"||o=="number"||o=="symbol"||o=="boolean"?n!=="__proto__":n===null}function lh(n){var o=nf(n),h=T[o];if(typeof h!="function"||!(o in Mt.prototype))return!1;if(n===h)return!0;var E=ch(h);return!!E&&n===E[0]}function my(n){return!!Td&&Td in n}var yy=Nc?Hn:Ph;function yo(n){var o=n&&n.constructor,h=typeof o=="function"&&o.prototype||wa;return n===h}function T0(n){return n===n&&!Qt(n)}function F0(n,o){return function(h){return h==null?!1:h[n]===o&&(o!==t||n in jt(h))}}function wy(n){var o=uf(n,function(E){return h.size===v&&h.clear(),E}),h=o.cache;return o}function _y(n,o){var h=n[1],E=o[1],C=h|E,q=C<(W|Q|A),J=E==A&&h==Y||E==A&&h==F&&n[7].length<=o[8]||E==(A|F)&&o[7].length<=o[8]&&h==Y;if(!(q||J))return n;E&W&&(n[2]=o[2],C|=h&W?0:j);var X=o[3];if(X){var ne=n[3];n[3]=ne?b0(ne,X,o[4]):X,n[4]=ne?fs(n[3],w):o[4]}return X=o[5],X&&(ne=n[5],n[5]=ne?m0(ne,X,o[6]):X,n[6]=ne?fs(n[5],w):o[6]),X=o[7],X&&(n[7]=X),E&A&&(n[8]=n[8]==null?o[8]:Br(n[8],o[8])),n[9]==null&&(n[9]=o[9]),n[0]=o[0],n[1]=C,n}function Ay(n){var o=[];if(n!=null)for(var h in jt(n))o.push(h);return o}function Ey(n){return Fc.call(n)}function B0(n,o,h){return o=lr(o===t?n.length-1:o,0),function(){for(var E=arguments,C=-1,q=lr(E.length-o,0),J=oe(q);++C<q;)J[C]=E[o+C];C=-1;for(var X=oe(o+1);++C<o;)X[C]=E[C];return X[o]=h(J),gr(n,this,X)}}function q0(n,o){return o.length<2?n:Ls(n,Oi(o,0,-1))}function Sy(n,o){for(var h=n.length,E=Br(o.length,h),C=ti(n);E--;){var q=o[E];n[E]=kn(q,h)?C[q]:t}return n}function dh(n,o){if(!(o==="constructor"&&typeof n[o]=="function")&&o!="__proto__")return n[o]}var L0=$0(o0),wo=Um||function(n,o){return Pt.setTimeout(n,o)},ph=$0(G2);function U0(n,o,h){var E=o+"";return ph(n,gy(E,xy(ly(E),h)))}function $0(n){var o=0,h=0;return function(){var E=km(),C=c-(E-h);if(h=E,C>0){if(++o>=m)return arguments[0]}else o=0;return n.apply(t,arguments)}}function af(n,o){var h=-1,E=n.length,C=E-1;for(o=o===t?E:o;++h<o;){var q=Yu(h,C),J=n[q];n[q]=n[h],n[h]=J}return n.length=o,n}var z0=wy(function(n){var o=[];return n.charCodeAt(0)===46&&o.push(""),n.replace(ft,function(h,E,C,q){o.push(C?q.replace(Rt,"$1"):E||h)}),o});function bn(n){if(typeof n=="string"||vi(n))return n;var o=n+"";return o=="0"&&1/n==-M?"-0":o}function $s(n){if(n!=null){try{return Tc.call(n)}catch{}try{return n+""}catch{}}return""}function xy(n,o){return Mi(te,function(h){var E="_."+h[0];o&h[1]&&!Pc(n,E)&&n.push(E)}),n.sort()}function j0(n){if(n instanceof Mt)return n.clone();var o=new Di(n.__wrapped__,n.__chain__);return o.__actions__=ti(n.__actions__),o.__index__=n.__index__,o.__values__=n.__values__,o}function My(n,o,h){(h?kr(n,o,h):o===t)?o=1:o=lr(mt(o),0);var E=n==null?0:n.length;if(!E||o<1)return[];for(var C=0,q=0,J=oe(zc(E/o));C<E;)J[q++]=Oi(n,C,C+=o);return J}function Iy(n){for(var o=-1,h=n==null?0:n.length,E=0,C=[];++o<h;){var q=n[o];q&&(C[E++]=q)}return C}function Dy(){var n=arguments.length;if(!n)return[];for(var o=oe(n-1),h=arguments[0],E=n;E--;)o[E-1]=arguments[E];return cs(gt(h)?ti(h):[h],xr(o,1))}var Py=_t(function(n,o){return nr(n)?po(n,xr(o,1,nr,!0)):[]}),Oy=_t(function(n,o){var h=Ci(o);return nr(h)&&(h=t),nr(n)?po(n,xr(o,1,nr,!0),nt(h,2)):[]}),Cy=_t(function(n,o){var h=Ci(o);return nr(h)&&(h=t),nr(n)?po(n,xr(o,1,nr,!0),t,h):[]});function Ry(n,o,h){var E=n==null?0:n.length;return E?(o=h||o===t?1:mt(o),Oi(n,o<0?0:o,E)):[]}function Ny(n,o,h){var E=n==null?0:n.length;return E?(o=h||o===t?1:mt(o),o=E-o,Oi(n,0,o<0?0:o)):[]}function Ty(n,o){return n&&n.length?Qc(n,nt(o,3),!0,!0):[]}function Fy(n,o){return n&&n.length?Qc(n,nt(o,3),!0):[]}function By(n,o,h,E){var C=n==null?0:n.length;return C?(h&&typeof h!="number"&&kr(n,o,h)&&(h=0,E=C),D2(n,o,h,E)):[]}function k0(n,o,h){var E=n==null?0:n.length;if(!E)return-1;var C=h==null?0:mt(h);return C<0&&(C=lr(E+C,0)),Oc(n,nt(o,3),C)}function H0(n,o,h){var E=n==null?0:n.length;if(!E)return-1;var C=E-1;return h!==t&&(C=mt(h),C=h<0?lr(E+C,0):Br(C,E-1)),Oc(n,nt(o,3),C,!0)}function K0(n){var o=n==null?0:n.length;return o?xr(n,1):[]}function qy(n){var o=n==null?0:n.length;return o?xr(n,M):[]}function Ly(n,o){var h=n==null?0:n.length;return h?(o=o===t?1:mt(o),xr(n,o)):[]}function Uy(n){for(var o=-1,h=n==null?0:n.length,E={};++o<h;){var C=n[o];E[C[0]]=C[1]}return E}function V0(n){return n&&n.length?n[0]:t}function $y(n,o,h){var E=n==null?0:n.length;if(!E)return-1;var C=h==null?0:mt(h);return C<0&&(C=lr(E+C,0)),va(n,o,C)}function zy(n){var o=n==null?0:n.length;return o?Oi(n,0,-1):[]}var jy=_t(function(n){var o=Yt(n,th);return o.length&&o[0]===n[0]?Ku(o):[]}),ky=_t(function(n){var o=Ci(n),h=Yt(n,th);return o===Ci(h)?o=t:h.pop(),h.length&&h[0]===n[0]?Ku(h,nt(o,2)):[]}),Hy=_t(function(n){var o=Ci(n),h=Yt(n,th);return o=typeof o=="function"?o:t,o&&h.pop(),h.length&&h[0]===n[0]?Ku(h,t,o):[]});function Ky(n,o){return n==null?"":zm.call(n,o)}function Ci(n){var o=n==null?0:n.length;return o?n[o-1]:t}function Vy(n,o,h){var E=n==null?0:n.length;if(!E)return-1;var C=E;return h!==t&&(C=mt(h),C=C<0?lr(E+C,0):Br(C,E-1)),o===o?xm(n,o,C):Oc(n,Md,C,!0)}function Gy(n,o){return n&&n.length?i0(n,mt(o)):t}var Wy=_t(G0);function G0(n,o){return n&&n.length&&o&&o.length?Ju(n,o):n}function Jy(n,o,h){return n&&n.length&&o&&o.length?Ju(n,o,nt(h,2)):n}function Yy(n,o,h){return n&&n.length&&o&&o.length?Ju(n,o,t,h):n}var Qy=jn(function(n,o){var h=n==null?0:n.length,E=zu(n,o);return a0(n,Yt(o,function(C){return kn(C,h)?+C:C}).sort(v0)),E});function Xy(n,o){var h=[];if(!(n&&n.length))return h;var E=-1,C=[],q=n.length;for(o=nt(o,3);++E<q;){var J=n[E];o(J,E,n)&&(h.push(J),C.push(E))}return a0(n,C),h}function gh(n){return n==null?n:Km.call(n)}function Zy(n,o,h){var E=n==null?0:n.length;return E?(h&&typeof h!="number"&&kr(n,o,h)?(o=0,h=E):(o=o==null?0:mt(o),h=h===t?E:mt(h)),Oi(n,o,h)):[]}function e3(n,o){return Yc(n,o)}function t3(n,o,h){return Xu(n,o,nt(h,2))}function r3(n,o){var h=n==null?0:n.length;if(h){var E=Yc(n,o);if(E<h&&Zi(n[E],o))return E}return-1}function i3(n,o){return Yc(n,o,!0)}function n3(n,o,h){return Xu(n,o,nt(h,2),!0)}function s3(n,o){var h=n==null?0:n.length;if(h){var E=Yc(n,o,!0)-1;if(Zi(n[E],o))return E}return-1}function a3(n){return n&&n.length?c0(n):[]}function o3(n,o){return n&&n.length?c0(n,nt(o,2)):[]}function c3(n){var o=n==null?0:n.length;return o?Oi(n,1,o):[]}function f3(n,o,h){return n&&n.length?(o=h||o===t?1:mt(o),Oi(n,0,o<0?0:o)):[]}function u3(n,o,h){var E=n==null?0:n.length;return E?(o=h||o===t?1:mt(o),o=E-o,Oi(n,o<0?0:o,E)):[]}function h3(n,o){return n&&n.length?Qc(n,nt(o,3),!1,!0):[]}function l3(n,o){return n&&n.length?Qc(n,nt(o,3)):[]}var d3=_t(function(n){return ls(xr(n,1,nr,!0))}),p3=_t(function(n){var o=Ci(n);return nr(o)&&(o=t),ls(xr(n,1,nr,!0),nt(o,2))}),g3=_t(function(n){var o=Ci(n);return o=typeof o=="function"?o:t,ls(xr(n,1,nr,!0),t,o)});function v3(n){return n&&n.length?ls(n):[]}function b3(n,o){return n&&n.length?ls(n,nt(o,2)):[]}function m3(n,o){return o=typeof o=="function"?o:t,n&&n.length?ls(n,t,o):[]}function vh(n){if(!(n&&n.length))return[];var o=0;return n=os(n,function(h){if(nr(h))return o=lr(h.length,o),!0}),Nu(o,function(h){return Yt(n,Ou(h))})}function W0(n,o){if(!(n&&n.length))return[];var h=vh(n);return o==null?h:Yt(h,function(E){return gr(o,t,E)})}var y3=_t(function(n,o){return nr(n)?po(n,o):[]}),w3=_t(function(n){return eh(os(n,nr))}),_3=_t(function(n){var o=Ci(n);return nr(o)&&(o=t),eh(os(n,nr),nt(o,2))}),A3=_t(function(n){var o=Ci(n);return o=typeof o=="function"?o:t,eh(os(n,nr),t,o)}),E3=_t(vh);function S3(n,o){return l0(n||[],o||[],lo)}function x3(n,o){return l0(n||[],o||[],bo)}var M3=_t(function(n){var o=n.length,h=o>1?n[o-1]:t;return h=typeof h=="function"?(n.pop(),h):t,W0(n,h)});function J0(n){var o=T(n);return o.__chain__=!0,o}function I3(n,o){return o(n),n}function of(n,o){return o(n)}var D3=jn(function(n){var o=n.length,h=o?n[0]:0,E=this.__wrapped__,C=function(q){return zu(q,n)};return o>1||this.__actions__.length||!(E instanceof Mt)||!kn(h)?this.thru(C):(E=E.slice(h,+h+(o?1:0)),E.__actions__.push({func:of,args:[C],thisArg:t}),new Di(E,this.__chain__).thru(function(q){return o&&!q.length&&q.push(t),q}))});function P3(){return J0(this)}function O3(){return new Di(this.value(),this.__chain__)}function C3(){this.__values__===t&&(this.__values__=fp(this.value()));var n=this.__index__>=this.__values__.length,o=n?t:this.__values__[this.__index__++];return{done:n,value:o}}function R3(){return this}function N3(n){for(var o,h=this;h instanceof Kc;){var E=j0(h);E.__index__=0,E.__values__=t,o?C.__wrapped__=E:o=E;var C=E;h=h.__wrapped__}return C.__wrapped__=n,o}function T3(){var n=this.__wrapped__;if(n instanceof Mt){var o=n;return this.__actions__.length&&(o=new Mt(this)),o=o.reverse(),o.__actions__.push({func:of,args:[gh],thisArg:t}),new Di(o,this.__chain__)}return this.thru(gh)}function F3(){return h0(this.__wrapped__,this.__actions__)}var B3=Xc(function(n,o,h){Bt.call(n,h)?++n[h]:$n(n,h,1)});function q3(n,o,h){var E=gt(n)?Sd:I2;return h&&kr(n,o,h)&&(o=t),E(n,nt(o,3))}function L3(n,o){var h=gt(n)?os:Wd;return h(n,nt(o,3))}var U3=A0(k0),$3=A0(H0);function z3(n,o){return xr(cf(n,o),1)}function j3(n,o){return xr(cf(n,o),M)}function k3(n,o,h){return h=h===t?1:mt(h),xr(cf(n,o),h)}function Y0(n,o){var h=gt(n)?Mi:hs;return h(n,nt(o,3))}function Q0(n,o){var h=gt(n)?cm:Gd;return h(n,nt(o,3))}var H3=Xc(function(n,o,h){Bt.call(n,h)?n[h].push(o):$n(n,h,[o])});function K3(n,o,h,E){n=ri(n)?n:Da(n),h=h&&!E?mt(h):0;var C=n.length;return h<0&&(h=lr(C+h,0)),df(n)?h<=C&&n.indexOf(o,h)>-1:!!C&&va(n,o,h)>-1}var V3=_t(function(n,o,h){var E=-1,C=typeof o=="function",q=ri(n)?oe(n.length):[];return hs(n,function(J){q[++E]=C?gr(o,J,h):go(J,o,h)}),q}),G3=Xc(function(n,o,h){$n(n,h,o)});function cf(n,o){var h=gt(n)?Yt:e0;return h(n,nt(o,3))}function W3(n,o,h,E){return n==null?[]:(gt(o)||(o=o==null?[]:[o]),h=E?t:h,gt(h)||(h=h==null?[]:[h]),n0(n,o,h))}var J3=Xc(function(n,o,h){n[h?0:1].push(o)},function(){return[[],[]]});function Y3(n,o,h){var E=gt(n)?Du:Dd,C=arguments.length<3;return E(n,nt(o,4),h,C,hs)}function Q3(n,o,h){var E=gt(n)?fm:Dd,C=arguments.length<3;return E(n,nt(o,4),h,C,Gd)}function X3(n,o){var h=gt(n)?os:Wd;return h(n,hf(nt(o,3)))}function Z3(n){var o=gt(n)?kd:K2;return o(n)}function e6(n,o,h){(h?kr(n,o,h):o===t)?o=1:o=mt(o);var E=gt(n)?A2:V2;return E(n,o)}function t6(n){var o=gt(n)?E2:W2;return o(n)}function r6(n){if(n==null)return 0;if(ri(n))return df(n)?ma(n):n.length;var o=qr(n);return o==ue||o==Me?n.size:Gu(n).length}function i6(n,o,h){var E=gt(n)?Pu:J2;return h&&kr(n,o,h)&&(o=t),E(n,nt(o,3))}var n6=_t(function(n,o){if(n==null)return[];var h=o.length;return h>1&&kr(n,o[0],o[1])?o=[]:h>2&&kr(o[0],o[1],o[2])&&(o=[o[0]]),n0(n,xr(o,1),[])}),ff=Lm||function(){return Pt.Date.now()};function s6(n,o){if(typeof o!="function")throw new Ii(f);return n=mt(n),function(){if(--n<1)return o.apply(this,arguments)}}function X0(n,o,h){return o=h?t:o,o=n&&o==null?n.length:o,zn(n,A,t,t,t,t,o)}function Z0(n,o){var h;if(typeof o!="function")throw new Ii(f);return n=mt(n),function(){return--n>0&&(h=o.apply(this,arguments)),n<=1&&(o=t),h}}var bh=_t(function(n,o,h){var E=W;if(h.length){var C=fs(h,Ma(bh));E|=k}return zn(n,E,o,h,C)}),ep=_t(function(n,o,h){var E=W|Q;if(h.length){var C=fs(h,Ma(ep));E|=k}return zn(o,E,n,h,C)});function tp(n,o,h){o=h?t:o;var E=zn(n,Y,t,t,t,t,t,o);return E.placeholder=tp.placeholder,E}function rp(n,o,h){o=h?t:o;var E=zn(n,U,t,t,t,t,t,o);return E.placeholder=rp.placeholder,E}function ip(n,o,h){var E,C,q,J,X,ne,he=0,le=!1,ge=!1,De=!0;if(typeof n!="function")throw new Ii(f);o=Ri(o)||0,Qt(h)&&(le=!!h.leading,ge="maxWait"in h,q=ge?lr(Ri(h.maxWait)||0,o):q,De="trailing"in h?!!h.trailing:De);function We(sr){var en=E,Vn=C;return E=C=t,he=sr,J=n.apply(Vn,en),J}function ot(sr){return he=sr,X=wo(Et,o),le?We(sr):J}function yt(sr){var en=sr-ne,Vn=sr-he,Ap=o-en;return ge?Br(Ap,q-Vn):Ap}function ct(sr){var en=sr-ne,Vn=sr-he;return ne===t||en>=o||en<0||ge&&Vn>=q}function Et(){var sr=ff();if(ct(sr))return Ot(sr);X=wo(Et,yt(sr))}function Ot(sr){return X=t,De&&E?We(sr):(E=C=t,J)}function bi(){X!==t&&d0(X),he=0,E=ne=C=X=t}function Hr(){return X===t?J:Ot(ff())}function mi(){var sr=ff(),en=ct(sr);if(E=arguments,C=this,ne=sr,en){if(X===t)return ot(ne);if(ge)return d0(X),X=wo(Et,o),We(ne)}return X===t&&(X=wo(Et,o)),J}return mi.cancel=bi,mi.flush=Hr,mi}var a6=_t(function(n,o){return Vd(n,1,o)}),o6=_t(function(n,o,h){return Vd(n,Ri(o)||0,h)});function c6(n){return zn(n,ae)}function uf(n,o){if(typeof n!="function"||o!=null&&typeof o!="function")throw new Ii(f);var h=function(){var E=arguments,C=o?o.apply(this,E):E[0],q=h.cache;if(q.has(C))return q.get(C);var J=n.apply(this,E);return h.cache=q.set(C,J)||q,J};return h.cache=new(uf.Cache||Un),h}uf.Cache=Un;function hf(n){if(typeof n!="function")throw new Ii(f);return function(){var o=arguments;switch(o.length){case 0:return!n.call(this);case 1:return!n.call(this,o[0]);case 2:return!n.call(this,o[0],o[1]);case 3:return!n.call(this,o[0],o[1],o[2])}return!n.apply(this,o)}}function f6(n){return Z0(2,n)}var u6=Y2(function(n,o){o=o.length==1&>(o[0])?Yt(o[0],pi(nt())):Yt(xr(o,1),pi(nt()));var h=o.length;return _t(function(E){for(var C=-1,q=Br(E.length,h);++C<q;)E[C]=o[C].call(this,E[C]);return gr(n,this,E)})}),mh=_t(function(n,o){var h=fs(o,Ma(mh));return zn(n,k,t,o,h)}),np=_t(function(n,o){var h=fs(o,Ma(np));return zn(n,V,t,o,h)}),h6=jn(function(n,o){return zn(n,F,t,t,t,o)});function l6(n,o){if(typeof n!="function")throw new Ii(f);return o=o===t?o:mt(o),_t(n,o)}function d6(n,o){if(typeof n!="function")throw new Ii(f);return o=o==null?0:lr(mt(o),0),_t(function(h){var E=h[o],C=ps(h,0,o);return E&&cs(C,E),gr(n,this,C)})}function p6(n,o,h){var E=!0,C=!0;if(typeof n!="function")throw new Ii(f);return Qt(h)&&(E="leading"in h?!!h.leading:E,C="trailing"in h?!!h.trailing:C),ip(n,o,{leading:E,maxWait:o,trailing:C})}function g6(n){return X0(n,1)}function v6(n,o){return mh(rh(o),n)}function b6(){if(!arguments.length)return[];var n=arguments[0];return gt(n)?n:[n]}function m6(n){return Pi(n,P)}function y6(n,o){return o=typeof o=="function"?o:t,Pi(n,P,o)}function w6(n){return Pi(n,S|P)}function _6(n,o){return o=typeof o=="function"?o:t,Pi(n,S|P,o)}function A6(n,o){return o==null||Kd(n,o,vr(o))}function Zi(n,o){return n===o||n!==n&&o!==o}var E6=rf(Hu),S6=rf(function(n,o){return n>=o}),zs=Qd(function(){return arguments}())?Qd:function(n){return Zt(n)&&Bt.call(n,"callee")&&!qd.call(n,"callee")},gt=oe.isArray,x6=zr?pi(zr):N2;function ri(n){return n!=null&&lf(n.length)&&!Hn(n)}function nr(n){return Zt(n)&&ri(n)}function M6(n){return n===!0||n===!1||Zt(n)&&jr(n)==H}var gs=$m||Ph,I6=Yi?pi(Yi):T2;function D6(n){return Zt(n)&&n.nodeType===1&&!_o(n)}function P6(n){if(n==null)return!0;if(ri(n)&&(gt(n)||typeof n=="string"||typeof n.splice=="function"||gs(n)||Ia(n)||zs(n)))return!n.length;var o=qr(n);if(o==ue||o==Me)return!n.size;if(yo(n))return!Gu(n).length;for(var h in n)if(Bt.call(n,h))return!1;return!0}function O6(n,o){return vo(n,o)}function C6(n,o,h){h=typeof h=="function"?h:t;var E=h?h(n,o):t;return E===t?vo(n,o,t,h):!!E}function yh(n){if(!Zt(n))return!1;var o=jr(n);return o==$||o==_||typeof n.message=="string"&&typeof n.name=="string"&&!_o(n)}function R6(n){return typeof n=="number"&&Ud(n)}function Hn(n){if(!Qt(n))return!1;var o=jr(n);return o==se||o==ce||o==B||o==Pe}function sp(n){return typeof n=="number"&&n==mt(n)}function lf(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=I}function Qt(n){var o=typeof n;return n!=null&&(o=="object"||o=="function")}function Zt(n){return n!=null&&typeof n=="object"}var ap=xi?pi(xi):B2;function N6(n,o){return n===o||Vu(n,o,fh(o))}function T6(n,o,h){return h=typeof h=="function"?h:t,Vu(n,o,fh(o),h)}function F6(n){return op(n)&&n!=+n}function B6(n){if(yy(n))throw new dt(a);return Xd(n)}function q6(n){return n===null}function L6(n){return n==null}function op(n){return typeof n=="number"||Zt(n)&&jr(n)==ye}function _o(n){if(!Zt(n)||jr(n)!=Re)return!1;var o=Lc(n);if(o===null)return!0;var h=Bt.call(o,"constructor")&&o.constructor;return typeof h=="function"&&h instanceof h&&Tc.call(h)==Tm}var wh=pn?pi(pn):q2;function U6(n){return sp(n)&&n>=-I&&n<=I}var cp=so?pi(so):L2;function df(n){return typeof n=="string"||!gt(n)&&Zt(n)&&jr(n)==me}function vi(n){return typeof n=="symbol"||Zt(n)&&jr(n)==Oe}var Ia=Ns?pi(Ns):U2;function $6(n){return n===t}function z6(n){return Zt(n)&&qr(n)==ve}function j6(n){return Zt(n)&&jr(n)==Ce}var k6=rf(Wu),H6=rf(function(n,o){return n<=o});function fp(n){if(!n)return[];if(ri(n))return df(n)?Qi(n):ti(n);if(oo&&n[oo])return Am(n[oo]());var o=qr(n),h=o==ue?Fu:o==Me?Cc:Da;return h(n)}function Kn(n){if(!n)return n===0?n:0;if(n=Ri(n),n===M||n===-M){var o=n<0?-1:1;return o*x}return n===n?n:0}function mt(n){var o=Kn(n),h=o%1;return o===o?h?o-h:o:0}function up(n){return n?qs(mt(n),0,g):0}function Ri(n){if(typeof n=="number")return n;if(vi(n))return l;if(Qt(n)){var o=typeof n.valueOf=="function"?n.valueOf():n;n=Qt(o)?o+"":o}if(typeof n!="string")return n===0?n:+n;n=Pd(n);var h=Rr.test(n);return h||Tr.test(n)?pt(n.slice(2),h?2:8):Cr.test(n)?l:+n}function hp(n){return vn(n,ii(n))}function K6(n){return n?qs(mt(n),-I,I):n===0?n:0}function Tt(n){return n==null?"":gi(n)}var V6=Sa(function(n,o){if(yo(o)||ri(o)){vn(o,vr(o),n);return}for(var h in o)Bt.call(o,h)&&lo(n,h,o[h])}),lp=Sa(function(n,o){vn(o,ii(o),n)}),pf=Sa(function(n,o,h,E){vn(o,ii(o),n,E)}),G6=Sa(function(n,o,h,E){vn(o,vr(o),n,E)}),W6=jn(zu);function J6(n,o){var h=Ea(n);return o==null?h:Hd(h,o)}var Y6=_t(function(n,o){n=jt(n);var h=-1,E=o.length,C=E>2?o[2]:t;for(C&&kr(o[0],o[1],C)&&(E=1);++h<E;)for(var q=o[h],J=ii(q),X=-1,ne=J.length;++X<ne;){var he=J[X],le=n[he];(le===t||Zi(le,wa[he])&&!Bt.call(n,he))&&(n[he]=q[he])}return n}),Q6=_t(function(n){return n.push(t,P0),gr(dp,t,n)});function X6(n,o){return xd(n,nt(o,3),gn)}function Z6(n,o){return xd(n,nt(o,3),ku)}function ew(n,o){return n==null?n:ju(n,nt(o,3),ii)}function tw(n,o){return n==null?n:Jd(n,nt(o,3),ii)}function rw(n,o){return n&&gn(n,nt(o,3))}function iw(n,o){return n&&ku(n,nt(o,3))}function nw(n){return n==null?[]:Wc(n,vr(n))}function sw(n){return n==null?[]:Wc(n,ii(n))}function _h(n,o,h){var E=n==null?t:Ls(n,o);return E===t?h:E}function aw(n,o){return n!=null&&R0(n,o,P2)}function Ah(n,o){return n!=null&&R0(n,o,O2)}var ow=S0(function(n,o,h){o!=null&&typeof o.toString!="function"&&(o=Fc.call(o)),n[o]=h},Sh(ni)),cw=S0(function(n,o,h){o!=null&&typeof o.toString!="function"&&(o=Fc.call(o)),Bt.call(n,o)?n[o].push(h):n[o]=[h]},nt),fw=_t(go);function vr(n){return ri(n)?jd(n):Gu(n)}function ii(n){return ri(n)?jd(n,!0):$2(n)}function uw(n,o){var h={};return o=nt(o,3),gn(n,function(E,C,q){$n(h,o(E,C,q),E)}),h}function hw(n,o){var h={};return o=nt(o,3),gn(n,function(E,C,q){$n(h,C,o(E,C,q))}),h}var lw=Sa(function(n,o,h){Jc(n,o,h)}),dp=Sa(function(n,o,h,E){Jc(n,o,h,E)}),dw=jn(function(n,o){var h={};if(n==null)return h;var E=!1;o=Yt(o,function(q){return q=ds(q,n),E||(E=q.length>1),q}),vn(n,oh(n),h),E&&(h=Pi(h,S|O|P,oy));for(var C=o.length;C--;)Zu(h,o[C]);return h});function pw(n,o){return pp(n,hf(nt(o)))}var gw=jn(function(n,o){return n==null?{}:j2(n,o)});function pp(n,o){if(n==null)return{};var h=Yt(oh(n),function(E){return[E]});return o=nt(o),s0(n,h,function(E,C){return o(E,C[0])})}function vw(n,o,h){o=ds(o,n);var E=-1,C=o.length;for(C||(C=1,n=t);++E<C;){var q=n==null?t:n[bn(o[E])];q===t&&(E=C,q=h),n=Hn(q)?q.call(n):q}return n}function bw(n,o,h){return n==null?n:bo(n,o,h)}function mw(n,o,h,E){return E=typeof E=="function"?E:t,n==null?n:bo(n,o,h,E)}var gp=I0(vr),vp=I0(ii);function yw(n,o,h){var E=gt(n),C=E||gs(n)||Ia(n);if(o=nt(o,4),h==null){var q=n&&n.constructor;C?h=E?new q:[]:Qt(n)?h=Hn(q)?Ea(Lc(n)):{}:h={}}return(C?Mi:gn)(n,function(J,X,ne){return o(h,J,X,ne)}),h}function ww(n,o){return n==null?!0:Zu(n,o)}function _w(n,o,h){return n==null?n:u0(n,o,rh(h))}function Aw(n,o,h,E){return E=typeof E=="function"?E:t,n==null?n:u0(n,o,rh(h),E)}function Da(n){return n==null?[]:Tu(n,vr(n))}function Ew(n){return n==null?[]:Tu(n,ii(n))}function Sw(n,o,h){return h===t&&(h=o,o=t),h!==t&&(h=Ri(h),h=h===h?h:0),o!==t&&(o=Ri(o),o=o===o?o:0),qs(Ri(n),o,h)}function xw(n,o,h){return o=Kn(o),h===t?(h=o,o=0):h=Kn(h),n=Ri(n),C2(n,o,h)}function Mw(n,o,h){if(h&&typeof h!="boolean"&&kr(n,o,h)&&(o=h=t),h===t&&(typeof o=="boolean"?(h=o,o=t):typeof n=="boolean"&&(h=n,n=t)),n===t&&o===t?(n=0,o=1):(n=Kn(n),o===t?(o=n,n=0):o=Kn(o)),n>o){var E=n;n=o,o=E}if(h||n%1||o%1){var C=$d();return Br(n+C*(o-n+$t("1e-"+((C+"").length-1))),o)}return Yu(n,o)}var Iw=xa(function(n,o,h){return o=o.toLowerCase(),n+(h?bp(o):o)});function bp(n){return Eh(Tt(n).toLowerCase())}function mp(n){return n=Tt(n),n&&n.replace(Xt,bm).replace(xu,"")}function Dw(n,o,h){n=Tt(n),o=gi(o);var E=n.length;h=h===t?E:qs(mt(h),0,E);var C=h;return h-=o.length,h>=0&&n.slice(h,C)==o}function Pw(n){return n=Tt(n),n&&Xe.test(n)?n.replace(xt,mm):n}function Ow(n){return n=Tt(n),n&&ze.test(n)?n.replace(rt,"\\$&"):n}var Cw=xa(function(n,o,h){return n+(h?"-":"")+o.toLowerCase()}),Rw=xa(function(n,o,h){return n+(h?" ":"")+o.toLowerCase()}),Nw=_0("toLowerCase");function Tw(n,o,h){n=Tt(n),o=mt(o);var E=o?ma(n):0;if(!o||E>=o)return n;var C=(o-E)/2;return tf(jc(C),h)+n+tf(zc(C),h)}function Fw(n,o,h){n=Tt(n),o=mt(o);var E=o?ma(n):0;return o&&E<o?n+tf(o-E,h):n}function Bw(n,o,h){n=Tt(n),o=mt(o);var E=o?ma(n):0;return o&&E<o?tf(o-E,h)+n:n}function qw(n,o,h){return h||o==null?o=0:o&&(o=+o),Hm(Tt(n).replace(it,""),o||0)}function Lw(n,o,h){return(h?kr(n,o,h):o===t)?o=1:o=mt(o),Qu(Tt(n),o)}function Uw(){var n=arguments,o=Tt(n[0]);return n.length<3?o:o.replace(n[1],n[2])}var $w=xa(function(n,o,h){return n+(h?"_":"")+o.toLowerCase()});function zw(n,o,h){return h&&typeof h!="number"&&kr(n,o,h)&&(o=h=t),h=h===t?g:h>>>0,h?(n=Tt(n),n&&(typeof o=="string"||o!=null&&!wh(o))&&(o=gi(o),!o&&ba(n))?ps(Qi(n),0,h):n.split(o,h)):[]}var jw=xa(function(n,o,h){return n+(h?" ":"")+Eh(o)});function kw(n,o,h){return n=Tt(n),h=h==null?0:qs(mt(h),0,n.length),o=gi(o),n.slice(h,h+o.length)==o}function Hw(n,o,h){var E=T.templateSettings;h&&kr(n,o,h)&&(o=t),n=Tt(n),o=pf({},o,E,D0);var C=pf({},o.imports,E.imports,D0),q=vr(C),J=Tu(C,q),X,ne,he=0,le=o.interpolate||Qr,ge="__p += '",De=Bu((o.escape||Qr).source+"|"+le.source+"|"+(le===et?at:Qr).source+"|"+(o.evaluate||Qr).source+"|$","g"),We="//# sourceURL="+(Bt.call(o,"sourceURL")?(o.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Mu+"]")+`
|
|
55
|
+
`;n.replace(De,function(ct,Et,Ot,bi,Hr,mi){return Ot||(Ot=bi),ge+=n.slice(he,mi).replace(Hi,ym),Et&&(X=!0,ge+=`' +
|
|
56
|
+
__e(`+Et+`) +
|
|
57
|
+
'`),Hr&&(ne=!0,ge+=`';
|
|
58
|
+
`+Hr+`;
|
|
59
|
+
__p += '`),Ot&&(ge+=`' +
|
|
60
|
+
((__t = (`+Ot+`)) == null ? '' : __t) +
|
|
61
|
+
'`),he=mi+ct.length,ct}),ge+=`';
|
|
62
|
+
`;var ot=Bt.call(o,"variable")&&o.variable;if(!ot)ge=`with (obj) {
|
|
63
|
+
`+ge+`
|
|
64
|
+
}
|
|
65
|
+
`;else if(Ct.test(ot))throw new dt(u);ge=(ne?ge.replace(wt,""):ge).replace(lt,"$1").replace(Je,"$1;"),ge="function("+(ot||"obj")+`) {
|
|
66
|
+
`+(ot?"":`obj || (obj = {});
|
|
67
|
+
`)+"var __t, __p = ''"+(X?", __e = _.escape":"")+(ne?`, __j = Array.prototype.join;
|
|
68
|
+
function print() { __p += __j.call(arguments, '') }
|
|
69
|
+
`:`;
|
|
70
|
+
`)+ge+`return __p
|
|
71
|
+
}`;var yt=wp(function(){return Nt(q,We+"return "+ge).apply(t,J)});if(yt.source=ge,yh(yt))throw yt;return yt}function Kw(n){return Tt(n).toLowerCase()}function Vw(n){return Tt(n).toUpperCase()}function Gw(n,o,h){if(n=Tt(n),n&&(h||o===t))return Pd(n);if(!n||!(o=gi(o)))return n;var E=Qi(n),C=Qi(o),q=Od(E,C),J=Cd(E,C)+1;return ps(E,q,J).join("")}function Ww(n,o,h){if(n=Tt(n),n&&(h||o===t))return n.slice(0,Nd(n)+1);if(!n||!(o=gi(o)))return n;var E=Qi(n),C=Cd(E,Qi(o))+1;return ps(E,0,C).join("")}function Jw(n,o,h){if(n=Tt(n),n&&(h||o===t))return n.replace(it,"");if(!n||!(o=gi(o)))return n;var E=Qi(n),C=Od(E,Qi(o));return ps(E,C).join("")}function Yw(n,o){var h=de,E=L;if(Qt(o)){var C="separator"in o?o.separator:C;h="length"in o?mt(o.length):h,E="omission"in o?gi(o.omission):E}n=Tt(n);var q=n.length;if(ba(n)){var J=Qi(n);q=J.length}if(h>=q)return n;var X=h-ma(E);if(X<1)return E;var ne=J?ps(J,0,X).join(""):n.slice(0,X);if(C===t)return ne+E;if(J&&(X+=ne.length-X),wh(C)){if(n.slice(X).search(C)){var he,le=ne;for(C.global||(C=Bu(C.source,Tt(bt.exec(C))+"g")),C.lastIndex=0;he=C.exec(le);)var ge=he.index;ne=ne.slice(0,ge===t?X:ge)}}else if(n.indexOf(gi(C),X)!=X){var De=ne.lastIndexOf(C);De>-1&&(ne=ne.slice(0,De))}return ne+E}function Qw(n){return n=Tt(n),n&&Fe.test(n)?n.replace(At,Mm):n}var Xw=xa(function(n,o,h){return n+(h?" ":"")+o.toUpperCase()}),Eh=_0("toUpperCase");function yp(n,o,h){return n=Tt(n),o=h?t:o,o===t?_m(n)?Pm(n):lm(n):n.match(o)||[]}var wp=_t(function(n,o){try{return gr(n,t,o)}catch(h){return yh(h)?h:new dt(h)}}),Zw=jn(function(n,o){return Mi(o,function(h){h=bn(h),$n(n,h,bh(n[h],n))}),n});function e5(n){var o=n==null?0:n.length,h=nt();return n=o?Yt(n,function(E){if(typeof E[1]!="function")throw new Ii(f);return[h(E[0]),E[1]]}):[],_t(function(E){for(var C=-1;++C<o;){var q=n[C];if(gr(q[0],this,E))return gr(q[1],this,E)}})}function t5(n){return M2(Pi(n,S))}function Sh(n){return function(){return n}}function r5(n,o){return n==null||n!==n?o:n}var i5=E0(),n5=E0(!0);function ni(n){return n}function xh(n){return Zd(typeof n=="function"?n:Pi(n,S))}function s5(n){return t0(Pi(n,S))}function a5(n,o){return r0(n,Pi(o,S))}var o5=_t(function(n,o){return function(h){return go(h,n,o)}}),c5=_t(function(n,o){return function(h){return go(n,h,o)}});function Mh(n,o,h){var E=vr(o),C=Wc(o,E);h==null&&!(Qt(o)&&(C.length||!E.length))&&(h=o,o=n,n=this,C=Wc(o,vr(o)));var q=!(Qt(h)&&"chain"in h)||!!h.chain,J=Hn(n);return Mi(C,function(X){var ne=o[X];n[X]=ne,J&&(n.prototype[X]=function(){var he=this.__chain__;if(q||he){var le=n(this.__wrapped__),ge=le.__actions__=ti(this.__actions__);return ge.push({func:ne,args:arguments,thisArg:n}),le.__chain__=he,le}return ne.apply(n,cs([this.value()],arguments))})}),n}function f5(){return Pt._===this&&(Pt._=Fm),this}function Ih(){}function u5(n){return n=mt(n),_t(function(o){return i0(o,n)})}var h5=nh(Yt),l5=nh(Sd),d5=nh(Pu);function _p(n){return hh(n)?Ou(bn(n)):k2(n)}function p5(n){return function(o){return n==null?t:Ls(n,o)}}var g5=x0(),v5=x0(!0);function Dh(){return[]}function Ph(){return!1}function b5(){return{}}function m5(){return""}function y5(){return!0}function w5(n,o){if(n=mt(n),n<1||n>I)return[];var h=g,E=Br(n,g);o=nt(o),n-=g;for(var C=Nu(E,o);++h<n;)o(h);return C}function _5(n){return gt(n)?Yt(n,bn):vi(n)?[n]:ti(z0(Tt(n)))}function A5(n){var o=++Nm;return Tt(n)+o}var E5=ef(function(n,o){return n+o},0),S5=sh("ceil"),x5=ef(function(n,o){return n/o},1),M5=sh("floor");function I5(n){return n&&n.length?Gc(n,ni,Hu):t}function D5(n,o){return n&&n.length?Gc(n,nt(o,2),Hu):t}function P5(n){return Id(n,ni)}function O5(n,o){return Id(n,nt(o,2))}function C5(n){return n&&n.length?Gc(n,ni,Wu):t}function R5(n,o){return n&&n.length?Gc(n,nt(o,2),Wu):t}var N5=ef(function(n,o){return n*o},1),T5=sh("round"),F5=ef(function(n,o){return n-o},0);function B5(n){return n&&n.length?Ru(n,ni):0}function q5(n,o){return n&&n.length?Ru(n,nt(o,2)):0}return T.after=s6,T.ary=X0,T.assign=V6,T.assignIn=lp,T.assignInWith=pf,T.assignWith=G6,T.at=W6,T.before=Z0,T.bind=bh,T.bindAll=Zw,T.bindKey=ep,T.castArray=b6,T.chain=J0,T.chunk=My,T.compact=Iy,T.concat=Dy,T.cond=e5,T.conforms=t5,T.constant=Sh,T.countBy=B3,T.create=J6,T.curry=tp,T.curryRight=rp,T.debounce=ip,T.defaults=Y6,T.defaultsDeep=Q6,T.defer=a6,T.delay=o6,T.difference=Py,T.differenceBy=Oy,T.differenceWith=Cy,T.drop=Ry,T.dropRight=Ny,T.dropRightWhile=Ty,T.dropWhile=Fy,T.fill=By,T.filter=L3,T.flatMap=z3,T.flatMapDeep=j3,T.flatMapDepth=k3,T.flatten=K0,T.flattenDeep=qy,T.flattenDepth=Ly,T.flip=c6,T.flow=i5,T.flowRight=n5,T.fromPairs=Uy,T.functions=nw,T.functionsIn=sw,T.groupBy=H3,T.initial=zy,T.intersection=jy,T.intersectionBy=ky,T.intersectionWith=Hy,T.invert=ow,T.invertBy=cw,T.invokeMap=V3,T.iteratee=xh,T.keyBy=G3,T.keys=vr,T.keysIn=ii,T.map=cf,T.mapKeys=uw,T.mapValues=hw,T.matches=s5,T.matchesProperty=a5,T.memoize=uf,T.merge=lw,T.mergeWith=dp,T.method=o5,T.methodOf=c5,T.mixin=Mh,T.negate=hf,T.nthArg=u5,T.omit=dw,T.omitBy=pw,T.once=f6,T.orderBy=W3,T.over=h5,T.overArgs=u6,T.overEvery=l5,T.overSome=d5,T.partial=mh,T.partialRight=np,T.partition=J3,T.pick=gw,T.pickBy=pp,T.property=_p,T.propertyOf=p5,T.pull=Wy,T.pullAll=G0,T.pullAllBy=Jy,T.pullAllWith=Yy,T.pullAt=Qy,T.range=g5,T.rangeRight=v5,T.rearg=h6,T.reject=X3,T.remove=Xy,T.rest=l6,T.reverse=gh,T.sampleSize=e6,T.set=bw,T.setWith=mw,T.shuffle=t6,T.slice=Zy,T.sortBy=n6,T.sortedUniq=a3,T.sortedUniqBy=o3,T.split=zw,T.spread=d6,T.tail=c3,T.take=f3,T.takeRight=u3,T.takeRightWhile=h3,T.takeWhile=l3,T.tap=I3,T.throttle=p6,T.thru=of,T.toArray=fp,T.toPairs=gp,T.toPairsIn=vp,T.toPath=_5,T.toPlainObject=hp,T.transform=yw,T.unary=g6,T.union=d3,T.unionBy=p3,T.unionWith=g3,T.uniq=v3,T.uniqBy=b3,T.uniqWith=m3,T.unset=ww,T.unzip=vh,T.unzipWith=W0,T.update=_w,T.updateWith=Aw,T.values=Da,T.valuesIn=Ew,T.without=y3,T.words=yp,T.wrap=v6,T.xor=w3,T.xorBy=_3,T.xorWith=A3,T.zip=E3,T.zipObject=S3,T.zipObjectDeep=x3,T.zipWith=M3,T.entries=gp,T.entriesIn=vp,T.extend=lp,T.extendWith=pf,Mh(T,T),T.add=E5,T.attempt=wp,T.camelCase=Iw,T.capitalize=bp,T.ceil=S5,T.clamp=Sw,T.clone=m6,T.cloneDeep=w6,T.cloneDeepWith=_6,T.cloneWith=y6,T.conformsTo=A6,T.deburr=mp,T.defaultTo=r5,T.divide=x5,T.endsWith=Dw,T.eq=Zi,T.escape=Pw,T.escapeRegExp=Ow,T.every=q3,T.find=U3,T.findIndex=k0,T.findKey=X6,T.findLast=$3,T.findLastIndex=H0,T.findLastKey=Z6,T.floor=M5,T.forEach=Y0,T.forEachRight=Q0,T.forIn=ew,T.forInRight=tw,T.forOwn=rw,T.forOwnRight=iw,T.get=_h,T.gt=E6,T.gte=S6,T.has=aw,T.hasIn=Ah,T.head=V0,T.identity=ni,T.includes=K3,T.indexOf=$y,T.inRange=xw,T.invoke=fw,T.isArguments=zs,T.isArray=gt,T.isArrayBuffer=x6,T.isArrayLike=ri,T.isArrayLikeObject=nr,T.isBoolean=M6,T.isBuffer=gs,T.isDate=I6,T.isElement=D6,T.isEmpty=P6,T.isEqual=O6,T.isEqualWith=C6,T.isError=yh,T.isFinite=R6,T.isFunction=Hn,T.isInteger=sp,T.isLength=lf,T.isMap=ap,T.isMatch=N6,T.isMatchWith=T6,T.isNaN=F6,T.isNative=B6,T.isNil=L6,T.isNull=q6,T.isNumber=op,T.isObject=Qt,T.isObjectLike=Zt,T.isPlainObject=_o,T.isRegExp=wh,T.isSafeInteger=U6,T.isSet=cp,T.isString=df,T.isSymbol=vi,T.isTypedArray=Ia,T.isUndefined=$6,T.isWeakMap=z6,T.isWeakSet=j6,T.join=Ky,T.kebabCase=Cw,T.last=Ci,T.lastIndexOf=Vy,T.lowerCase=Rw,T.lowerFirst=Nw,T.lt=k6,T.lte=H6,T.max=I5,T.maxBy=D5,T.mean=P5,T.meanBy=O5,T.min=C5,T.minBy=R5,T.stubArray=Dh,T.stubFalse=Ph,T.stubObject=b5,T.stubString=m5,T.stubTrue=y5,T.multiply=N5,T.nth=Gy,T.noConflict=f5,T.noop=Ih,T.now=ff,T.pad=Tw,T.padEnd=Fw,T.padStart=Bw,T.parseInt=qw,T.random=Mw,T.reduce=Y3,T.reduceRight=Q3,T.repeat=Lw,T.replace=Uw,T.result=vw,T.round=T5,T.runInContext=ie,T.sample=Z3,T.size=r6,T.snakeCase=$w,T.some=i6,T.sortedIndex=e3,T.sortedIndexBy=t3,T.sortedIndexOf=r3,T.sortedLastIndex=i3,T.sortedLastIndexBy=n3,T.sortedLastIndexOf=s3,T.startCase=jw,T.startsWith=kw,T.subtract=F5,T.sum=B5,T.sumBy=q5,T.template=Hw,T.times=w5,T.toFinite=Kn,T.toInteger=mt,T.toLength=up,T.toLower=Kw,T.toNumber=Ri,T.toSafeInteger=K6,T.toString=Tt,T.toUpper=Vw,T.trim=Gw,T.trimEnd=Ww,T.trimStart=Jw,T.truncate=Yw,T.unescape=Qw,T.uniqueId=A5,T.upperCase=Xw,T.upperFirst=Eh,T.each=Y0,T.eachRight=Q0,T.first=V0,Mh(T,function(){var n={};return gn(T,function(o,h){Bt.call(T.prototype,h)||(n[h]=o)}),n}(),{chain:!1}),T.VERSION=i,Mi(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){T[n].placeholder=T}),Mi(["drop","take"],function(n,o){Mt.prototype[n]=function(h){h=h===t?1:lr(mt(h),0);var E=this.__filtered__&&!o?new Mt(this):this.clone();return E.__filtered__?E.__takeCount__=Br(h,E.__takeCount__):E.__views__.push({size:Br(h,g),type:n+(E.__dir__<0?"Right":"")}),E},Mt.prototype[n+"Right"]=function(h){return this.reverse()[n](h).reverse()}}),Mi(["filter","map","takeWhile"],function(n,o){var h=o+1,E=h==p||h==y;Mt.prototype[n]=function(C){var q=this.clone();return q.__iteratees__.push({iteratee:nt(C,3),type:h}),q.__filtered__=q.__filtered__||E,q}}),Mi(["head","last"],function(n,o){var h="take"+(o?"Right":"");Mt.prototype[n]=function(){return this[h](1).value()[0]}}),Mi(["initial","tail"],function(n,o){var h="drop"+(o?"":"Right");Mt.prototype[n]=function(){return this.__filtered__?new Mt(this):this[h](1)}}),Mt.prototype.compact=function(){return this.filter(ni)},Mt.prototype.find=function(n){return this.filter(n).head()},Mt.prototype.findLast=function(n){return this.reverse().find(n)},Mt.prototype.invokeMap=_t(function(n,o){return typeof n=="function"?new Mt(this):this.map(function(h){return go(h,n,o)})}),Mt.prototype.reject=function(n){return this.filter(hf(nt(n)))},Mt.prototype.slice=function(n,o){n=mt(n);var h=this;return h.__filtered__&&(n>0||o<0)?new Mt(h):(n<0?h=h.takeRight(-n):n&&(h=h.drop(n)),o!==t&&(o=mt(o),h=o<0?h.dropRight(-o):h.take(o-n)),h)},Mt.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},Mt.prototype.toArray=function(){return this.take(g)},gn(Mt.prototype,function(n,o){var h=/^(?:filter|find|map|reject)|While$/.test(o),E=/^(?:head|last)$/.test(o),C=T[E?"take"+(o=="last"?"Right":""):o],q=E||/^find/.test(o);C&&(T.prototype[o]=function(){var J=this.__wrapped__,X=E?[1]:arguments,ne=J instanceof Mt,he=X[0],le=ne||gt(J),ge=function(Et){var Ot=C.apply(T,cs([Et],X));return E&&De?Ot[0]:Ot};le&&h&&typeof he=="function"&&he.length!=1&&(ne=le=!1);var De=this.__chain__,We=!!this.__actions__.length,ot=q&&!De,yt=ne&&!We;if(!q&&le){J=yt?J:new Mt(this);var ct=n.apply(J,X);return ct.__actions__.push({func:of,args:[ge],thisArg:t}),new Di(ct,De)}return ot&&yt?n.apply(this,X):(ct=this.thru(ge),ot?E?ct.value()[0]:ct.value():ct)})}),Mi(["pop","push","shift","sort","splice","unshift"],function(n){var o=Rc[n],h=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",E=/^(?:pop|shift)$/.test(n);T.prototype[n]=function(){var C=arguments;if(E&&!this.__chain__){var q=this.value();return o.apply(gt(q)?q:[],C)}return this[h](function(J){return o.apply(gt(J)?J:[],C)})}}),gn(Mt.prototype,function(n,o){var h=T[o];if(h){var E=h.name+"";Bt.call(Aa,E)||(Aa[E]=[]),Aa[E].push({name:o,func:h})}}),Aa[Zc(t,Q).name]=[{name:"wrapper",func:t}],Mt.prototype.clone=Qm,Mt.prototype.reverse=Xm,Mt.prototype.value=Zm,T.prototype.at=D3,T.prototype.chain=P3,T.prototype.commit=O3,T.prototype.next=C3,T.prototype.plant=N3,T.prototype.reverse=T3,T.prototype.toJSON=T.prototype.valueOf=T.prototype.value=F3,T.prototype.first=T.prototype.head,oo&&(T.prototype[oo]=R3),T},ya=Om();ir?((ir.exports=ya)._=ya,zt._=ya):Pt._=ya}).call(No)})(Ul,Ul.exports);var fO=Object.defineProperty,uO=Object.defineProperties,hO=Object.getOwnPropertyDescriptors,Ug=Object.getOwnPropertySymbols,lO=Object.prototype.hasOwnProperty,dO=Object.prototype.propertyIsEnumerable,$g=(r,e,t)=>e in r?fO(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Sf=(r,e)=>{for(var t in e||(e={}))lO.call(e,t)&&$g(r,t,e[t]);if(Ug)for(var t of Ug(e))dO.call(e,t)&&$g(r,t,e[t]);return r},pO=(r,e)=>uO(r,hO(e));function un(r,e,t){var i;const s=qo(r);return((i=e.rpcMap)==null?void 0:i[s.reference])||`${nm}?chainId=${s.namespace}:${s.reference}&projectId=${t}`}function ha(r){return r.includes(":")?r.split(":")[1]:r}function sm(r){return r.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function gO(r,e){const t=Object.keys(e.namespaces).filter(s=>s.includes(r));if(!t.length)return[];const i=[];return t.forEach(s=>{const a=e.namespaces[s].accounts;i.push(...a)}),i}function ul(r={},e={}){const t=zg(r),i=zg(e);return Ul.exports.merge(t,i)}function zg(r){var e,t,i,s;const a={};if(!Wo(r))return a;for(const[f,u]of Object.entries(r)){const b=dd(f)?[f]:u.chains,v=u.methods||[],w=u.events||[],S=u.rpcMap||{},O=Bo(f);a[O]=pO(Sf(Sf({},a[O]),u),{chains:Df(b,(e=a[O])==null?void 0:e.chains),methods:Df(v,(t=a[O])==null?void 0:t.methods),events:Df(w,(i=a[O])==null?void 0:i.events),rpcMap:Sf(Sf({},S),(s=a[O])==null?void 0:s.rpcMap)})}return a}function vO(r){return r.includes(":")?r.split(":")[2]:r}function jg(r){const e={};for(const[t,i]of Object.entries(r)){const s=i.methods||[],a=i.events||[],f=i.accounts||[],u=dd(t)?[t]:i.chains?i.chains:sm(i.accounts);e[t]={chains:u,methods:s,events:a,accounts:f}}return e}function hl(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 am={},Ft=r=>am[r],ll=(r,e)=>{am[r]=e};class bO{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Ft("events"),this.client=Ft("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(ln.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const s=ha(t);e[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||un(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new hn(new Bn(i,Ft("disableProviderPing")))}}var mO=Object.defineProperty,yO=Object.defineProperties,wO=Object.getOwnPropertyDescriptors,kg=Object.getOwnPropertySymbols,_O=Object.prototype.hasOwnProperty,AO=Object.prototype.propertyIsEnumerable,Hg=(r,e,t)=>e in r?mO(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Kg=(r,e)=>{for(var t in e||(e={}))_O.call(e,t)&&Hg(r,t,e[t]);if(kg)for(var t of kg(e))AO.call(e,t)&&Hg(r,t,e[t]);return r},Vg=(r,e)=>yO(r,wO(e));class EO{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Ft("events"),this.client=Ft("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(ln.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const i=t||un(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new hn(new Bn(i,Ft("disableProviderPing")))}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const s=parseInt(ha(t));e[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,i;let s=e.request.params?(t=e.request.params[0])==null?void 0:t.chainId:"0x0";s=s.startsWith("0x")?s:`0x${s}`;const a=parseInt(s,16);if(this.isChainApproved(a))this.setDefaultChain(`${a}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:s}]},chainId:(i=this.namespace.chains)==null?void 0:i[0]}),this.setDefaultChain(`${a}`);else throw new Error(`Failed to switch to chain 'eip155:${a}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var t,i,s;const a=(i=(t=e.request)==null?void 0:t.params)==null?void 0:i[0];if(!a)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const f=this.client.session.get(e.topic),u=((s=f==null?void 0:f.sessionProperties)==null?void 0:s.capabilities)||{};if(u!=null&&u[a])return u==null?void 0:u[a];const b=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:Vg(Kg({},f.sessionProperties||{}),{capabilities:Vg(Kg({},u||{}),{[a]:b})})})}catch(v){console.warn("Failed to update session with capabilities",v)}return b}async getCallStatus(e){var t,i;const s=this.client.session.get(e.topic),a=(t=s.sessionProperties)==null?void 0:t.bundler_name;if(a){const u=this.getBundlerUrl(e.chainId,a);try{return await this.getUserOperationReceipt(u,e)}catch(b){console.warn("Failed to fetch call status from bundler",b,u)}}const f=(i=s.sessionProperties)==null?void 0:i.bundler_url;if(f)try{return await this.getUserOperationReceipt(f,e)}catch(u){console.warn("Failed to fetch call status from custom bundler",u,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 i;const s=new URL(e),a=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ss("eth_getUserOperationReceipt",[(i=t.request.params)==null?void 0:i[0]]))});if(!a.ok)throw new Error(`Failed to fetch user operation receipt - ${a.status}`);return await a.json()}getBundlerUrl(e,t){return`${cO}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}class SO{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Ft("events"),this.client=Ft("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(ln.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const s=ha(t);e[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||un(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new hn(new Bn(i,Ft("disableProviderPing")))}}class xO{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Ft("events"),this.client=Ft("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(ln.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const s=ha(t);e[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||un(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new hn(new Bn(i,Ft("disableProviderPing")))}}class MO{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Ft("events"),this.client=Ft("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){const i=t||un(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.chainId=e,this.events.emit(ln.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||un(e,this.namespace,this.client.core.projectId);return typeof i>"u"?void 0:new hn(new Bn(i,Ft("disableProviderPing")))}}class IO{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Ft("events"),this.client=Ft("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(ln.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{const i=this.getCardanoRPCUrl(t),s=ha(t);e[s]=this.createHttpProvider(s,i)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||this.getCardanoRPCUrl(e);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new hn(new Bn(i,Ft("disableProviderPing")))}}class DO{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Ft("events"),this.client=Ft("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(ln.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const s=ha(t);e[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||un(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new hn(new Bn(i,Ft("disableProviderPing")))}}class PO{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Ft("events"),this.client=Ft("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(ln.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const s=ha(t);e[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||un(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new hn(new Bn(i,Ft("disableProviderPing")))}}class OO{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Ft("events"),this.client=Ft("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const i=t||un(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(ln.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||un(e,this.namespace);return typeof i>"u"?void 0:new hn(new Bn(i,Ft("disableProviderPing")))}}class CO{constructor(e){this.name=Fa,this.namespace=e.namespace,this.events=Ft("events"),this.client=Ft("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(ln.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){var e,t;const i={};return(t=(e=this.namespace)==null?void 0:e.accounts)==null||t.forEach(s=>{const a=qo(s);i[`${a.namespace}:${a.reference}`]=this.createHttpProvider(s)}),i}getHttpProvider(e){const t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||un(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new hn(new Bn(i,Ft("disableProviderPing")))}}var RO=Object.defineProperty,NO=Object.defineProperties,TO=Object.getOwnPropertyDescriptors,Gg=Object.getOwnPropertySymbols,FO=Object.prototype.hasOwnProperty,BO=Object.prototype.propertyIsEnumerable,Wg=(r,e,t)=>e in r?RO(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,xf=(r,e)=>{for(var t in e||(e={}))FO.call(e,t)&&Wg(r,t,e[t]);if(Gg)for(var t of Gg(e))BO.call(e,t)&&Wg(r,t,e[t]);return r},dl=(r,e)=>NO(r,TO(e));class Ad{constructor(e){this.events=new Kl,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:fc(gu({level:(e==null?void 0:e.logger)||qg})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const t=new Ad(e);return await t.initialize(),t}async request(e,t,i){const[s,a]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:xf({},e),chainId:`${s}:${a}`,topic:this.session.topic,expiry:i})}sendAsync(e,t,i,s){const a=new Date().getTime();this.request(e,i,s).then(f=>t(null,vu(a,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:qt("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:i,response:s}=await this.client.authenticate(e,t);i&&(this.uri=i,this.events.emit("display_uri",i));const a=await s();if(this.session=a.session,this.session){const f=jg(this.session.namespaces);this.namespaces=ul(this.namespaces,f),this.persist("namespaces",this.namespaces),this.onConnect()}return a}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:i,approval:s}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});i&&(this.uri=i,this.events.emit("display_uri",i)),await s().then(a=>{this.session=a;const f=jg(a.namespaces);this.namespaces=ul(this.namespaces,f),this.persist("namespaces",this.namespaces)}).catch(a=>{if(a.message!==im)throw a;t++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[i,s]=this.validateChain(e),a=this.getProvider(i);a.name===Fa?a.setDefaultChain(`${i}:${s}`,t):a.setDefaultChain(s,t)}catch(i){if(!/Please call connect/.test(i.message))throw i}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(Rn(t)){for(const i of t)e.deletePairings?this.client.core.expirer.set(i.topic,0):await this.client.core.relayer.subscriber.unsubscribe(i.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await _d.init({core:this.providerOpts.core,logger:this.providerOpts.logger||qg,relayUrl:this.providerOpts.relayUrl||sO,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=>Bo(t)))];ll("client",this.client),ll("events",this.events),ll("disableProviderPing",this.disableProviderPing),e.forEach(t=>{if(!this.session)return;const i=gO(t,this.session),s=sm(i),a=ul(this.namespaces,this.optionalNamespaces),f=dl(xf({},a[t]),{accounts:i,chains:s});switch(t){case"eip155":this.rpcProviders[t]=new EO({namespace:f});break;case"algorand":this.rpcProviders[t]=new MO({namespace:f});break;case"solana":this.rpcProviders[t]=new SO({namespace:f});break;case"cosmos":this.rpcProviders[t]=new xO({namespace:f});break;case"polkadot":this.rpcProviders[t]=new bO({namespace:f});break;case"cip34":this.rpcProviders[t]=new IO({namespace:f});break;case"elrond":this.rpcProviders[t]=new DO({namespace:f});break;case"multiversx":this.rpcProviders[t]=new PO({namespace:f});break;case"near":this.rpcProviders[t]=new OO({namespace:f});break;default:this.rpcProviders[Fa]?this.rpcProviders[Fa].updateNamespace(f):this.rpcProviders[Fa]=new CO({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:i}=t;if(i.name==="accountsChanged"){const s=i.data;s&&Rn(s)&&this.events.emit("accountsChanged",s.map(vO))}else if(i.name==="chainChanged"){const s=t.chainId,a=t.event.data,f=Bo(s),u=hl(s)!==hl(a)?`${f}:${hl(a)}`:s;this.onChainChanged(u)}else this.events.emit(i.name,i.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var i;const{namespaces:s}=t,a=(i=this.client)==null?void 0:i.session.get(e);this.session=dl(xf({},a),{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",dl(xf({},qt("USER_DISCONNECTED")),{data:e.topic}))}),this.on(ln.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Fa]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace((t=this.session)==null?void 0:t.namespaces[e])})}setNamespaces(e){const{namespaces:t,optionalNamespaces:i,sessionProperties:s}=e;t&&Object.keys(t).length&&(this.namespaces=t),i&&Object.keys(i).length&&(this.optionalNamespaces=i),this.sessionProperties=s,this.persist("namespaces",t),this.persist("optionalNamespaces",i)}validateChain(e){const[t,i]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,i];if(t&&!Object.keys(this.namespaces||{}).map(f=>Bo(f)).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&i)return[t,i];const s=Bo(Object.keys(this.namespaces)[0]),a=this.rpcProviders[s].getDefaultChain();return[s,a]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){if(!this.namespaces)return;const[i,s]=this.validateChain(e);s&&(t||this.getProvider(i).setDefaultChain(s),this.namespaces[i]?this.namespaces[i].defaultChain=s:this.namespaces[`${i}:${s}`]?this.namespaces[`${i}:${s}`].defaultChain=s:this.namespaces[`${i}:${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(`${Lg}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${Lg}/${e}`)}}const qO=Ad,LO="wc",UO="ethereum_provider",$O=`${LO}@2:${UO}:`,zO="https://rpc.walletconnect.org/v1/",$l=["eth_sendTransaction","personal_sign"],jO=["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"],zl=["chainChanged","accountsChanged"],kO=["chainChanged","accountsChanged","message","disconnect","connect"];var HO=Object.defineProperty,KO=Object.defineProperties,VO=Object.getOwnPropertyDescriptors,Jg=Object.getOwnPropertySymbols,GO=Object.prototype.hasOwnProperty,WO=Object.prototype.propertyIsEnumerable,Yg=(r,e,t)=>e in r?HO(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ba=(r,e)=>{for(var t in e||(e={}))GO.call(e,t)&&Yg(r,t,e[t]);if(Jg)for(var t of Jg(e))WO.call(e,t)&&Yg(r,t,e[t]);return r},pl=(r,e)=>KO(r,VO(e));function Xf(r){return Number(r[0].split(":")[1])}function Mf(r){return`0x${r.toString(16)}`}function JO(r){const{chains:e,optionalChains:t,methods:i,optionalMethods:s,events:a,optionalEvents:f,rpcMap:u}=r;if(!Rn(e))throw new Error("Invalid chains");const b={chains:e,methods:i||$l,events:a||zl,rpcMap:Ba({},e.length?{[Xf(e)]:u[Xf(e)]}:{})},v=a==null?void 0:a.filter(P=>!zl.includes(P)),w=i==null?void 0:i.filter(P=>!$l.includes(P));if(!t&&!f&&!s&&!(v!=null&&v.length)&&!(w!=null&&w.length))return{required:e.length?b:void 0};const S=(v==null?void 0:v.length)&&(w==null?void 0:w.length)||!t,O={chains:[...new Set(S?b.chains.concat(t||[]):t)],methods:[...new Set(b.methods.concat(s!=null&&s.length?s:jO))],events:[...new Set(b.events.concat(f!=null&&f.length?f:kO))],rpcMap:u};return{required:e.length?b:void 0,optional:t.length?O:void 0}}class Ed{constructor(){this.events=new zi.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=$O,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 Ed;return await t.initialize(e),t}async request(e,t){return await this.signer.request(e,this.formatChainId(this.chainId),t)}sendAsync(e,t,i){this.signer.sendAsync(e,t,this.formatChainId(this.chainId),i)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:t,optional:i}=JO(this.rpc);try{const s=await new Promise(async(f,u)=>{var b;this.rpc.showQrModal&&((b=this.modal)==null||b.subscribeModal(v=>{!v.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),u(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(pl(Ba({namespaces:Ba({},t&&{[this.namespace]:t})},i&&{optionalNamespaces:{[this.namespace]:i}}),{pairingTopic:e==null?void 0:e.pairingTopic})).then(v=>{f(v)}).catch(v=>{u(new Error(v.message))})});if(!s)return;const a=Qp(s.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:Mf(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 i=await new Promise(async(a,f)=>{var u;this.rpc.showQrModal&&((u=this.modal)==null||u.subscribeModal(b=>{!b.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(pl(Ba({},e),{chains:this.rpc.chains}),t).then(b=>{a(b)}).catch(b=>{f(new Error(b.message))})}),s=i.session;if(s){const a=Qp(s.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:Mf(this.chainId)})}return i}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:t}=e,{event:i}=t;i.name==="accountsChanged"?(this.accounts=this.parseAccounts(i.data),this.events.emit("accountsChanged",this.accounts)):i.name==="chainChanged"?this.setChainId(this.formatChainId(i.data)):this.events.emit(i.name,i.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",Mf(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",pl(Ba({},qt("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var t,i;this.rpc.showQrModal&&((t=this.modal)==null||t.closeModal(),(i=this.modal)==null||i.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const t=e.filter(i=>this.isCompatibleChainId(i)).map(i=>this.parseChainId(i));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",Mf(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){const[t,i,s]=e.split(":");return{chainId:`${t}:${i}`,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,i;const s=(t=e==null?void 0:e.chains)!=null?t:[],a=(i=e==null?void 0:e.optionalChains)!=null?i:[],f=s.concat(a);if(!f.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const u=s.length?(e==null?void 0:e.methods)||$l:[],b=s.length?(e==null?void 0:e.events)||zl:[],v=(e==null?void 0:e.optionalMethods)||[],w=(e==null?void 0:e.optionalEvents)||[],S=(e==null?void 0:e.rpcMap)||this.buildRpcMap(f,e.projectId),O=(e==null?void 0:e.qrModalOptions)||void 0;return{chains:s==null?void 0:s.map(P=>this.formatChainId(P)),optionalChains:a.map(P=>this.formatChainId(P)),methods:u,events:b,optionalMethods:v,optionalEvents:w,rpcMap:S,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:O,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const i={};return e.forEach(s=>{i[s]=this.getRpcUrl(s,t)}),i}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?Xf(this.rpc.chains):Xf(this.rpc.optionalChains),this.signer=await qO.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let t;try{const{WalletConnectModal:i}=await L5(()=>import("./index-kAjO6hfy.js").then(s=>s.i),__vite__mapDeps([0,1,2]));t=i}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(Ba({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(i){throw this.signer.logger.error(i),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:t,optionalChains:i,rpcMap:s}=e;t&&Rn(t)&&(this.rpc.chains=t.map(a=>this.formatChainId(a)),t.forEach(a=>{this.rpc.rpcMap[a]=(s==null?void 0:s[a])||this.getRpcUrl(a)})),i&&Rn(i)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=i==null?void 0:i.map(a=>this.formatChainId(a)),i.forEach(a=>{this.rpc.rpcMap[a]=(s==null?void 0:s[a])||this.getRpcUrl(a)}))}getRpcUrl(e,t){var i;return((i=this.rpc.rpcMap)==null?void 0:i[e])||`${zO}?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 wC=Ed;export{wC as EthereumProvider,kO as OPTIONAL_EVENTS,jO as OPTIONAL_METHODS,zl as REQUIRED_EVENTS,$l as REQUIRED_METHODS,Ed as default};
|