@wormhole-foundation/wormhole-connect 1.1.3-beta.0-development → 1.1.3-beta.2-development
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/README.md +1 -1
- package/dist/assets/{ccip-ZK3nT4p0.js → ccip-CuVLQT8d.js} +1 -1
- package/dist/assets/{evm-CN8bW0Ki.js → evm-Dc3QdSOA.js} +4 -4
- package/dist/assets/{index-Dk-HAicc.js → index-BIssGeVa.js} +1 -1
- package/dist/assets/{index-wPSYQFAU.js → index-BJGeA_ds.js} +1 -1
- package/dist/assets/{index-BrUy8LtR.js → index-EVjhBEXw.js} +2 -2
- package/dist/assets/{index.es-DadojKR5.js → index.es-BObgTr8H.js} +2 -2
- package/dist/assets/{solana-CasQowTc.js → solana-nISyslgA.js} +3 -3
- package/dist/main.js +66 -69
- package/dist/src/config/types.d.ts +6 -13
- package/dist/src/config/types.d.ts.map +1 -1
- package/dist/src/hooks/useAvailableWallets.d.ts.map +1 -1
- package/dist/src/hooks/useComputeFees.d.ts.map +1 -1
- package/dist/src/hooks/useComputeSourceTokens.d.ts.map +1 -1
- package/dist/src/hooks/useRoutesQuotesBulk.d.ts.map +1 -1
- package/dist/src/hooks/useSortedRoutesWithQuotes.d.ts.map +1 -1
- package/dist/src/hooks/useTrackTransfer.d.ts +12 -2
- package/dist/src/hooks/useTrackTransfer.d.ts.map +1 -1
- package/dist/src/hooks/useTransactionHistory.d.ts.map +1 -1
- package/dist/src/hooks/useTransactionHistoryWHScan.d.ts.map +1 -1
- package/dist/src/icons/Tokens/CELO.d.ts.map +1 -1
- package/dist/src/routes/sdkv2/route.d.ts +0 -18
- package/dist/src/routes/sdkv2/route.d.ts.map +1 -1
- package/dist/src/store/redeem.d.ts +1 -12
- package/dist/src/store/redeem.d.ts.map +1 -1
- package/dist/src/telemetry/types.d.ts +3 -2
- package/dist/src/telemetry/types.d.ts.map +1 -1
- package/dist/src/utils/errors.d.ts +2 -3
- package/dist/src/utils/errors.d.ts.map +1 -1
- package/dist/src/utils/inProgressTxCache.d.ts +1 -0
- package/dist/src/utils/inProgressTxCache.d.ts.map +1 -1
- package/dist/src/utils/transferValidation.d.ts +1 -5
- package/dist/src/utils/transferValidation.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/AssetPicker/TokenList.d.ts +1 -0
- package/dist/src/views/v2/Bridge/AssetPicker/TokenList.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/AssetPicker/index.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/ReviewTransaction/index.d.ts.map +1 -1
- package/dist/src/views/v2/Redeem/index.d.ts.map +1 -1
- package/dist/src/views/v2/TxHistory/Widget/Item.d.ts.map +1 -1
- package/lib/{algorand-Bk0g9QgP.js → algorand-BAFj4ZGa.js} +1 -1
- package/lib/{algorand-Y1gjJE79.mjs → algorand-CLoiUadv.mjs} +3 -3
- package/lib/{aptos-DTi6Q8Bm.mjs → aptos-B0EUzhLn.mjs} +1 -1
- package/lib/{aptos-DEyaV1Ue.mjs → aptos-C45UOjMk.mjs} +3 -3
- package/lib/{aptos-Lx6QmRnS.js → aptos-CHkHb9Wn.js} +1 -1
- package/lib/{aptos-WxStQp-p.js → aptos-DLBpR9Uw.js} +2 -2
- package/lib/{ccip-DnA8URE5.mjs → ccip-D6nl66Of.mjs} +1 -1
- package/lib/{ccip-CZSRIG9Z.js → ccip-DwcFzOh0.js} +1 -1
- package/lib/{cosmos-GR_4BDSL.js → cosmos-BEyKk7pN.js} +1 -1
- package/lib/{cosmos-BGd4mOMq.mjs → cosmos-Bc34YeqV.mjs} +5 -5
- package/lib/{cosmwasm-D9hqOwak.mjs → cosmwasm-BBIEjp_6.mjs} +6 -6
- package/lib/{cosmwasm-OpBz-K0E.js → cosmwasm-DPmjLuio.js} +2 -2
- package/lib/{events-BUfFMIsP.js → events-B2ZyXE4l.js} +1 -1
- package/lib/{events-mq_Ozt5U.mjs → events-D9h1HjEa.mjs} +1 -1
- package/lib/{evm-euAOC4rE.js → evm--fmrvZiP.js} +4 -4
- package/lib/{evm-Bh09u6uE.js → evm-D6zAQuRU.js} +1 -1
- package/lib/{evm-Dd7mhHpZ.mjs → evm-DsRkB-Yc.mjs} +7 -7
- package/lib/{evm-Bip4elXo.mjs → evm-sG77B7Ln.mjs} +5 -5
- package/lib/{index-BhSPxtEu.mjs → index--8OR2IWG.mjs} +2 -2
- package/lib/{index-B4ACXG3S.js → index-B7Optu6I.js} +1 -1
- package/lib/{index-CksIEiR-.mjs → index-B9gBvn5a.mjs} +3 -3
- package/lib/{index-ChNwYZYl.mjs → index-BFWViYNu.mjs} +2 -2
- package/lib/{index-PZbWVmCz.js → index-BJ9DGQK7.js} +1 -1
- package/lib/{index-Dkr0Tvzr.mjs → index-BO1rJrRP.mjs} +2 -2
- package/lib/{index-FiYjyweD.mjs → index-BT10pzLw.mjs} +1 -1
- package/lib/{index-BpUvks-l.mjs → index-BYnoX4S7.mjs} +2 -2
- package/lib/{index-O_6SG94Y.js → index-B_vsKDJm.js} +1 -1
- package/lib/{index-CioB5jlk.js → index-Bl8-vKcf.js} +1 -1
- package/lib/{index-CGfTxXIK.js → index-Bx7B-3Uk.js} +1 -1
- package/lib/{index-B2SkhUdY.mjs → index-BxxpLnjr.mjs} +1 -1
- package/lib/{index-LmQpfWk6.js → index-ByOoS9NO.js} +1 -1
- package/lib/{index-CEa1N1JO.js → index-C010ECjb.js} +1 -1
- package/lib/{index-CVEp7rso.js → index-C96ibHXm.js} +1 -1
- package/lib/{index-Bpc4Uc2j.js → index-CEovIwuS.js} +49 -52
- package/lib/{index-CroHHsN6.js → index-CL7evJIB.js} +1 -1
- package/lib/{index-DDK1w1Gy.js → index-CNe0Pean.js} +1 -1
- package/lib/{index-BMgQcGHh.mjs → index-CQY-qyc8.mjs} +2 -2
- package/lib/{index-8W3PL24a.js → index-CVaT6qZW.js} +1 -1
- package/lib/{index-DKWOhn7x.mjs → index-CY9fp7fB.mjs} +4 -4
- package/lib/{index-DaLjsGIa.js → index-CaQpF1dj.js} +1 -1
- package/lib/{index-BgoH9HcO.mjs → index-Cb5M1Ban.mjs} +1 -1
- package/lib/{index-DpeHItMy.js → index-Ci0O-yiU.js} +1 -1
- package/lib/{index-B5wcBfQY.mjs → index-CnElB0dt.mjs} +2 -2
- package/lib/{index-2lyFWSyp.mjs → index-Cpjj11xV.mjs} +2 -2
- package/lib/{index-DfBMIbDj.js → index-CvdPwRnL.js} +1 -1
- package/lib/{index-DSY3L6x7.js → index-CyPbCf5y.js} +1 -1
- package/lib/{index-Cd2iAhn6.js → index-D0RnzOoN.js} +1 -1
- package/lib/{index-BR9mq_aC.mjs → index-D4u8CUKC.mjs} +3 -3
- package/lib/{index-D6wPZpGK.mjs → index-DGq7mQyb.mjs} +1 -1
- package/lib/{index-DoVA8mW7.mjs → index-DPtc-UxP.mjs} +6 -6
- package/lib/{index-CWcodnPh.mjs → index-DWJ5r15M.mjs} +3259 -3270
- package/lib/{index-J8dw-2w6.js → index-D_3BlFSH.js} +1 -1
- package/lib/{index-DL5VcEom.mjs → index-DdhKN5Tn.mjs} +2 -2
- package/lib/{index-Cp3GZM8x.mjs → index-DinZIMWa.mjs} +4 -4
- package/lib/{index-Drhu_ecL.mjs → index-DrDopLyp.mjs} +2 -2
- package/lib/{index-BuOkqOsd.mjs → index-DugvE6YD.mjs} +3 -3
- package/lib/{index-AmWMP_h-.mjs → index-IC9ubiMJ.mjs} +3 -3
- package/lib/{index-gJCBZWkF.js → index-OldEBluq.js} +1 -1
- package/lib/{index-o8rEiaHv.js → index-PcZU5a1K.js} +1 -1
- package/lib/{index-BCsavYT_.js → index-U1A3Ir4_.js} +1 -1
- package/lib/{index-DMgTzJGM.js → index-XMIcJZyr.js} +1 -1
- package/lib/{index-C8WtRQvK.mjs → index-jgZQQCfy.mjs} +1 -1
- package/lib/{index-CLwEnjVp.mjs → index-jydTi-hN.mjs} +2 -2
- package/lib/{index-DkJGHKLZ.js → index-mE3wnazE.js} +1 -1
- package/lib/{index.es-CK6rof29.mjs → index.es-DV6jIgX3.mjs} +5 -5
- package/lib/{index.es-DC7Uig48.js → index.es-DbGYkQrs.js} +2 -2
- package/lib/index.js +1 -1
- package/lib/index.mjs +1 -1
- package/lib/{keccak-CHIoumBY.js → keccak-BvCC2Kx2.js} +1 -1
- package/lib/{keccak-BbGP1Jgp.mjs → keccak-C0uJwxei.mjs} +1 -1
- package/lib/{libsodium-wrappers-CNt1trbm.mjs → libsodium-wrappers-BS68glUg.mjs} +1 -1
- package/lib/{libsodium-wrappers-BevEE8GA.js → libsodium-wrappers-yq_uVk2-.js} +1 -1
- package/lib/{pako.esm-BdYcUYll.mjs → pako.esm-CWQc3qGc.mjs} +2 -2
- package/lib/{pako.esm-BroBxzYL.js → pako.esm-DZDXjYQj.js} +1 -1
- package/lib/{pbkdf2-CUUz7-r8.mjs → pbkdf2-B3V9L7S5.mjs} +1 -1
- package/lib/{pbkdf2-Mh3QRt-g.js → pbkdf2-DbRuCUvp.js} +1 -1
- package/lib/{sei-Q0qEEpNr.mjs → sei-Bty4vIw4.mjs} +3 -3
- package/lib/{sei-D0Z3_R0P.js → sei-D3Eq9BDV.js} +1 -1
- package/lib/{signer-A4746UwI.js → signer-Dw6nmaHE.js} +1 -1
- package/lib/{signer-BHiPBsYT.mjs → signer-zHoIaQqc.mjs} +1 -1
- package/lib/{solana-atuOX46W.js → solana-9m57XHRZ.js} +3 -3
- package/lib/{solana-DHklzwb0.mjs → solana-C-e817Or.mjs} +207 -203
- package/lib/{solana-DKR_bh5A.mjs → solana-CV7qftfl.mjs} +5 -5
- package/lib/solana-GdBZhG_3.js +1 -0
- package/lib/{solanaEmbed.esm-C60u4Y4i.mjs → solanaEmbed.esm-ByzcN6RA.mjs} +3 -3
- package/lib/{solanaEmbed.esm-CRncQ9El.js → solanaEmbed.esm-DBOgwSJE.js} +1 -1
- package/lib/src/config/types.d.ts +6 -13
- package/lib/src/config/types.d.ts.map +1 -1
- package/lib/src/hooks/useAvailableWallets.d.ts.map +1 -1
- package/lib/src/hooks/useComputeFees.d.ts.map +1 -1
- package/lib/src/hooks/useComputeSourceTokens.d.ts.map +1 -1
- package/lib/src/hooks/useRoutesQuotesBulk.d.ts.map +1 -1
- package/lib/src/hooks/useSortedRoutesWithQuotes.d.ts.map +1 -1
- package/lib/src/hooks/useTrackTransfer.d.ts +12 -2
- package/lib/src/hooks/useTrackTransfer.d.ts.map +1 -1
- package/lib/src/hooks/useTransactionHistory.d.ts.map +1 -1
- package/lib/src/hooks/useTransactionHistoryWHScan.d.ts.map +1 -1
- package/lib/src/icons/Tokens/CELO.d.ts.map +1 -1
- package/lib/src/routes/sdkv2/route.d.ts +0 -18
- package/lib/src/routes/sdkv2/route.d.ts.map +1 -1
- package/lib/src/store/redeem.d.ts +1 -12
- package/lib/src/store/redeem.d.ts.map +1 -1
- package/lib/src/telemetry/types.d.ts +3 -2
- package/lib/src/telemetry/types.d.ts.map +1 -1
- package/lib/src/utils/errors.d.ts +2 -3
- package/lib/src/utils/errors.d.ts.map +1 -1
- package/lib/src/utils/inProgressTxCache.d.ts +1 -0
- package/lib/src/utils/inProgressTxCache.d.ts.map +1 -1
- package/lib/src/utils/transferValidation.d.ts +1 -5
- package/lib/src/utils/transferValidation.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/AssetPicker/TokenList.d.ts +1 -0
- package/lib/src/views/v2/Bridge/AssetPicker/TokenList.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/AssetPicker/index.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/ReviewTransaction/index.d.ts.map +1 -1
- package/lib/src/views/v2/Redeem/index.d.ts.map +1 -1
- package/lib/src/views/v2/TxHistory/Widget/Item.d.ts.map +1 -1
- package/lib/{sui-BJf6qfEa.js → sui-B3dbw4a7.js} +2 -2
- package/lib/{sui-DnV1uvEo.mjs → sui-CKgX0Mjn.mjs} +4 -4
- package/lib/{sui-CrGPhOdf.js → sui-lQcSerf0.js} +1 -1
- package/lib/{sui-CXkq5Ld8.mjs → sui-rey0HjGu.mjs} +1 -1
- package/lib/{unsignedTransaction-15n-LbN-.js → unsignedTransaction-DcJyFS5R.js} +1 -1
- package/lib/{unsignedTransaction-CJD6WVk2.mjs → unsignedTransaction-sTI31PuJ.mjs} +2 -2
- package/package.json +2 -1
- package/dist/src/hooks/useTrackTransferInProgress.d.ts +0 -12
- package/dist/src/hooks/useTrackTransferInProgress.d.ts.map +0 -1
- package/dist/src/utils/gas.d.ts +0 -1
- package/dist/src/utils/gas.d.ts.map +0 -1
- package/dist/src/utils/vaa.d.ts +0 -1
- package/dist/src/utils/vaa.d.ts.map +0 -1
- package/lib/solana-D0q_yPbs.js +0 -1
- package/lib/src/hooks/useTrackTransferInProgress.d.ts +0 -12
- package/lib/src/hooks/useTrackTransferInProgress.d.ts.map +0 -1
- package/lib/src/utils/gas.d.ts +0 -1
- package/lib/src/utils/gas.d.ts.map +0 -1
- package/lib/src/utils/vaa.d.ts +0 -1
- package/lib/src/utils/vaa.d.ts.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Q = Object.defineProperty;
|
|
2
2
|
var j = (t, e, s) => e in t ? Q(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
|
|
3
3
|
var y = (t, e, s) => j(t, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
-
import { aZ as u, bA as Y, bB as I, bC as x, bD as ee, bE as ne, bF as se, h as M, co as O, cg as ae, ct as E, cu as N, cL as B, cG as U, c4 as _, u as te, S as b, e as ie, c5 as D, b1 as T, c3 as re, b8 as me, c6 as C, cK as oe, bU as ue, g as le } from "./index-
|
|
4
|
+
import { aZ as u, bA as Y, bB as I, bC as x, bD as ee, bE as ne, bF as se, h as M, co as O, cg as ae, ct as E, cu as N, cL as B, cG as U, c4 as _, u as te, S as b, e as ie, c5 as D, b1 as T, c3 as re, b8 as me, c6 as C, cK as oe, bU as ue, g as le } from "./index-DWJ5r15M.mjs";
|
|
5
5
|
const h = new u("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");
|
|
6
6
|
new u("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");
|
|
7
7
|
const A = new u("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { h as $, cG as J5, dt as Y5, ac as V1, du as K4, V as X5 } from "./index-
|
|
2
|
-
import { h as e7, e as t7 } from "./evm-
|
|
1
|
+
import { h as $, cG as J5, dt as Y5, ac as V1, du as K4, V as X5 } from "./index-DWJ5r15M.mjs";
|
|
2
|
+
import { h as e7, e as t7 } from "./evm-DsRkB-Yc.mjs";
|
|
3
3
|
import * as C3 from "react";
|
|
4
4
|
import w, { createContext as n7, useState as o3, useEffect as j0, useCallback as r7, useContext as i7 } from "react";
|
|
5
5
|
import o7 from "react-dom";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const K=require("./index-Bpc4Uc2j.js"),xu=require("./dijkstra-CtFxn7S9.js"),kt=require("./events-BUfFMIsP.js"),F=require("./index-8W3PL24a.js"),T=require("./index-LmQpfWk6.js");let Nu=class extends T.r{constructor(e){super(e),this.events=new kt.eventsExports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(T.formatJsonRpcRequest(e.method,e.params||[],e.id||T.getBigIntRpcId().toString()),r)}async requestStrict(e,r){return new Promise(async(i,n)=>{if(!this.connection.connected)try{await this.open()}catch(s){n(s)}this.events.on(`${e.id}`,s=>{T.isJsonRpcError(s)?n(s.error):i(s.result)});try{await this.connection.send(e,r)}catch(s){n(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),T.isJsonRpcResponse(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)}};var Cu=function(){var t=document.getSelection();if(!t.rangeCount)return function(){};for(var e=document.activeElement,r=[],i=0;i<t.rangeCount;i++)r.push(t.getRangeAt(i));switch(e.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":e.blur();break;default:e=null;break}return t.removeAllRanges(),function(){t.type==="Caret"&&t.removeAllRanges(),t.rangeCount||r.forEach(function(n){t.addRange(n)}),e&&e.focus()}},Ru=Cu,Bo={"text/plain":"Text","text/html":"Url",default:"Text"},Tu="Copy to clipboard: #{key}, Enter";function Pu(t){var e=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return t.replace(/#{\s*key\s*}/g,e)}function Ou(t,e){var r,i,n,s,o,a,h=!1;e||(e={}),r=e.debug||!1;try{n=Ru(),s=document.createRange(),o=document.getSelection(),a=document.createElement("span"),a.textContent=t,a.ariaHidden="true",a.style.all="unset",a.style.position="fixed",a.style.top=0,a.style.clip="rect(0, 0, 0, 0)",a.style.whiteSpace="pre",a.style.webkitUserSelect="text",a.style.MozUserSelect="text",a.style.msUserSelect="text",a.style.userSelect="text",a.addEventListener("copy",function(f){if(f.stopPropagation(),e.format)if(f.preventDefault(),typeof f.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var m=Bo[e.format]||Bo.default;window.clipboardData.setData(m,t)}else f.clipboardData.clearData(),f.clipboardData.setData(e.format,t);e.onCopy&&(f.preventDefault(),e.onCopy(f.clipboardData))}),document.body.appendChild(a),s.selectNodeContents(a),o.addRange(s);var u=document.execCommand("copy");if(!u)throw new Error("copy command was unsuccessful");h=!0}catch(f){r&&console.error("unable to copy using execCommand: ",f),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",t),e.onCopy&&e.onCopy(window.clipboardData),h=!0}catch(m){r&&console.error("unable to copy using clipboardData: ",m),r&&console.error("falling back to prompt"),i=Pu("message"in e?e.message:Tu),window.prompt(i,t)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),n()}return h}var ku=Ou,Bu={}.toString,to=Array.isArray||function(t){return Bu.call(t)=="[object Array]"},Du=K.requireElliptic(),ro={},le={};Object.defineProperty(le,"__esModule",{value:!0});var kc=le.getLocalStorage=Vc=le.getLocalStorageOrThrow=Kc=le.getCrypto=jc=le.getCryptoOrThrow=zc=le.getLocation=$c=le.getLocationOrThrow=Uc=le.getNavigator=qc=le.getNavigatorOrThrow=Lc=le.getDocument=Fc=le.getDocumentOrThrow=Dc=le.getFromWindowOrThrow=Bc=le.getFromWindow=void 0;function Vr(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}var Bc=le.getFromWindow=Vr;function ui(t){const e=Vr(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}var Dc=le.getFromWindowOrThrow=ui;function Fu(){return ui("document")}var Fc=le.getDocumentOrThrow=Fu;function Lu(){return Vr("document")}var Lc=le.getDocument=Lu;function qu(){return ui("navigator")}var qc=le.getNavigatorOrThrow=qu;function Uu(){return Vr("navigator")}var Uc=le.getNavigator=Uu;function $u(){return ui("location")}var $c=le.getLocationOrThrow=$u;function zu(){return Vr("location")}var zc=le.getLocation=zu;function ju(){return ui("crypto")}var jc=le.getCryptoOrThrow=ju;function Ku(){return Vr("crypto")}var Kc=le.getCrypto=Ku;function Vu(){return ui("localStorage")}var Vc=le.getLocalStorageOrThrow=Vu;function Wu(){return Vr("localStorage")}kc=le.getLocalStorage=Wu;Object.defineProperty(ro,"__esModule",{value:!0});var Wc=ro.getWindowMetadata=void 0;const Do=le;function Hu(){let t,e;try{t=Do.getDocumentOrThrow(),e=Do.getLocationOrThrow()}catch{return null}function r(){const m=t.getElementsByTagName("link"),b=[];for(let v=0;v<m.length;v++){const E=m[v],x=E.getAttribute("rel");if(x&&x.toLowerCase().indexOf("icon")>-1){const S=E.getAttribute("href");if(S)if(S.toLowerCase().indexOf("https:")===-1&&S.toLowerCase().indexOf("http:")===-1&&S.indexOf("//")!==0){let N=e.protocol+"//"+e.host;if(S.indexOf("/")===0)N+=S;else{const R=e.pathname.split("/");R.pop();const O=R.join("/");N+=O+"/"+S}b.push(N)}else if(S.indexOf("//")===0){const N=e.protocol+S;b.push(N)}else b.push(S)}}return b}function i(...m){const b=t.getElementsByTagName("meta");for(let v=0;v<b.length;v++){const E=b[v],x=["itemprop","property","name"].map(S=>E.getAttribute(S)).filter(S=>S?m.includes(S):!1);if(x.length&&x){const S=E.getAttribute("content");if(S)return S}}return""}function n(){let m=i("name","og:site_name","og:title","twitter:title");return m||(m=t.title),m}function s(){return i("description","og:description","twitter:description","keywords")}const o=n(),a=s(),h=e.origin,u=r();return{description:a,url:h,icons:u,name:o}}Wc=ro.getWindowMetadata=Hu;var Ju=function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var i=Array(t),n=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,n++)i[n]=s[o];return i},Qu=function(){function t(e,r,i){this.name=e,this.version=r,this.os=i,this.type="browser"}return t}(),Gu=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=K.dist.process.platform}return t}(),Yu=function(){function t(e,r,i,n){this.name=e,this.version=r,this.os=i,this.bot=n,this.type="bot-device"}return t}(),Xu=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),Zu=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),ed=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,td=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Fo=3,rd=[["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|$)/],["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",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",ed]],Lo=[["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/],["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 id(t){return t?qo(t):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Zu:typeof navigator<"u"?qo(navigator.userAgent):od()}function nd(t){return t!==""&&rd.reduce(function(e,r){var i=r[0],n=r[1];if(e)return e;var s=n.exec(t);return!!s&&[i,s]},!1)}function qo(t){var e=nd(t);if(!e)return null;var r=e[0],i=e[1];if(r==="searchbot")return new Xu;var n=i[1]&&i[1].split(/[._]/).slice(0,3);n?n.length<Fo&&(n=Ju(n,ad(Fo-n.length))):n=[];var s=n.join("."),o=sd(t),a=td.exec(t);return a&&a[1]?new Yu(r,s,o,a[1]):new Qu(r,s,o)}function sd(t){for(var e=0,r=Lo.length;e<r;e++){var i=Lo[e],n=i[0],s=i[1],o=s.exec(t);if(o)return n}return null}function od(){var t=typeof K.dist.process<"u"&&K.dist.process.version;return t?new Gu(K.dist.process.version.slice(1)):null}function ad(t){for(var e=[],r=0;r<t;r++)e.push("0");return e}function io(t){return id(t)}function Tn(){const t=io();return t&&t.os?t.os:void 0}function Hc(){const t=Tn();return t?t.toLowerCase().includes("android"):!1}function Jc(){const t=Tn();return t?t.toLowerCase().includes("ios")||t.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function cd(){return Tn()?Hc()||Jc():!1}function Qc(){const t=io();return t&&t.name?t.name.toLowerCase()==="node":!1}function hd(){return!Qc()&&!!Gc()}const ld=Bc,ud=Dc,dd=Fc,fd=Lc,pd=qc,Gc=Uc,gd=$c,md=zc,yd=jc,vd=Kc,wd=Vc,Pn=kc;function _d(){return Wc()}function bd(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return JSON.parse(t)}catch{return t}}function Ad(t){return typeof t=="string"?t:JSON.stringify(t)}const Yc=bd,Xc=Ad;function Zc(t,e){const r=Xc(e),i=Pn();i&&i.setItem(t,r)}function Ed(t){let e=null,r=null;const i=Pn();return i&&(r=i.getItem(t)),e=r&&Yc(r),e}function Sd(t){const e=Pn();e&&e.removeItem(t)}const eh="WALLETCONNECT_DEEPLINK_CHOICE";function Id(t,e){const r=encodeURIComponent(t);return e.universalLink?`${e.universalLink}/wc?uri=${r}`:e.deepLink?`${e.deepLink}${e.deepLink.endsWith(":")?"//":"/"}wc?uri=${r}`:""}function Md(t){const e=t.href.split("?")[0];Zc(eh,Object.assign(Object.assign({},t),{href:e}))}function th(t,e){return t.filter(r=>r.name.toLowerCase().includes(e.toLowerCase()))[0]}function xd(t,e){let r=t;return e&&(r=e.map(i=>th(t,i)).filter(Boolean)),r}const rh="https://registry.walletconnect.com";function Nd(){return rh+"/api/v2/wallets"}function Cd(){return rh+"/api/v2/dapps"}function ih(t,e="mobile"){var r;return{name:t.name||"",shortName:t.metadata.shortName||"",color:t.metadata.colors.primary||"",logo:(r=t.image_url.sm)!==null&&r!==void 0?r:"",universalLink:t[e].universal||"",deepLink:t[e].native||""}}function Rd(t,e="mobile"){return Object.values(t).filter(r=>!!r[e].universal||!!r[e].native).map(r=>ih(r,e))}const Td=Object.freeze(Object.defineProperty({__proto__:null,detectEnv:io,detectOS:Tn,formatIOSMobile:Id,formatMobileRegistry:Rd,formatMobileRegistryEntry:ih,getClientMeta:_d,getCrypto:vd,getCryptoOrThrow:yd,getDappRegistryUrl:Cd,getDocument:fd,getDocumentOrThrow:dd,getFromWindow:ld,getFromWindowOrThrow:ud,getLocal:Ed,getLocalStorage:Pn,getLocalStorageOrThrow:wd,getLocation:md,getLocationOrThrow:gd,getMobileLinkRegistry:xd,getMobileRegistryEntry:th,getNavigator:Gc,getNavigatorOrThrow:pd,getWalletRegistryUrl:Nd,isAndroid:Hc,isBrowser:hd,isIOS:Jc,isMobile:cd,isNode:Qc,mobileLinkChoiceKey:eh,removeLocal:Sd,safeJsonParse:Yc,safeJsonStringify:Xc,saveMobileLinkInfo:Md,setLocal:Zc},Symbol.toStringTag,{value:"Module"})),Pd=K.getAugmentedNamespace(Td);var Wi={},Od=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},nh={},_r={},kd=to;function Bd(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},t.foo()===42}catch{return!1}}ne.TYPED_ARRAY_SUPPORT=Bd();var Uo=ne.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function ne(t,e,r){return!ne.TYPED_ARRAY_SUPPORT&&!(this instanceof ne)?new ne(t,e,r):typeof t=="number"?sh(this,t):zd(this,t,e,r)}ne.TYPED_ARRAY_SUPPORT&&(ne.prototype.__proto__=Uint8Array.prototype,ne.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&ne[Symbol.species]===ne&&Object.defineProperty(ne,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}));function no(t){if(t>=Uo)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Uo.toString(16)+" bytes");return t|0}function Dd(t){return t!==t}function ii(t,e){var r;return ne.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(e),r.__proto__=ne.prototype):(r=t,r===null&&(r=new ne(e)),r.length=e),r}function sh(t,e){var r=ii(t,e<0?0:no(e)|0);if(!ne.TYPED_ARRAY_SUPPORT)for(var i=0;i<e;++i)r[i]=0;return r}function Fd(t,e){var r=ah(e)|0,i=ii(t,r),n=i.write(e);return n!==r&&(i=i.slice(0,n)),i}function ks(t,e){for(var r=e.length<0?0:no(e.length)|0,i=ii(t,r),n=0;n<r;n+=1)i[n]=e[n]&255;return i}function Ld(t,e,r,i){if(r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");var n;return r===void 0&&i===void 0?n=new Uint8Array(e):i===void 0?n=new Uint8Array(e,r):n=new Uint8Array(e,r,i),ne.TYPED_ARRAY_SUPPORT?n.__proto__=ne.prototype:n=ks(t,n),n}function qd(t,e){if(ne.isBuffer(e)){var r=no(e.length)|0,i=ii(t,r);return i.length===0||e.copy(i,0,0,r),i}if(e){if(typeof ArrayBuffer<"u"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||Dd(e.length)?ii(t,0):ks(t,e);if(e.type==="Buffer"&&Array.isArray(e.data))return ks(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function oh(t,e){e=e||1/0;for(var r,i=t.length,n=null,s=[],o=0;o<i;++o){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function ah(t){if(ne.isBuffer(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var e=t.length;return e===0?0:oh(t).length}function Ud(t,e,r,i){for(var n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function $d(t,e,r,i){return Ud(oh(e,t.length-r),t,r,i)}function zd(t,e,r,i){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?Ld(t,e,r,i):typeof e=="string"?Fd(t,e):qd(t,e)}ne.prototype.write=function(e,r,i){r===void 0?(i=this.length,r=0):i===void 0&&typeof r=="string"?(i=this.length,r=0):isFinite(r)&&(r=r|0,isFinite(i)?i=i|0:i=void 0);var n=this.length-r;if((i===void 0||i>n)&&(i=n),e.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");return $d(this,e,r,i)};ne.prototype.slice=function(e,r){var i=this.length;e=~~e,r=r===void 0?i:~~r,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<e&&(r=e);var n;if(ne.TYPED_ARRAY_SUPPORT)n=this.subarray(e,r),n.__proto__=ne.prototype;else{var s=r-e;n=new ne(s,void 0);for(var o=0;o<s;++o)n[o]=this[o+e]}return n};ne.prototype.copy=function(e,r,i,n){if(i||(i=0),!n&&n!==0&&(n=this.length),r>=e.length&&(r=e.length),r||(r=0),n>0&&n<i&&(n=i),n===i||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-r<n-i&&(n=e.length-r+i);var s=n-i,o;if(this===e&&i<r&&r<n)for(o=s-1;o>=0;--o)e[o+r]=this[o+i];else if(s<1e3||!ne.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)e[o+r]=this[o+i];else Uint8Array.prototype.set.call(e,this.subarray(i,i+s),r);return s};ne.prototype.fill=function(e,r,i){if(typeof e=="string"){if(typeof r=="string"?(r=0,i=this.length):typeof i=="string"&&(i=this.length),e.length===1){var n=e.charCodeAt(0);n<256&&(e=n)}}else typeof e=="number"&&(e=e&255);if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);var s;if(typeof e=="number")for(s=r;s<i;++s)this[s]=e;else{var o=ne.isBuffer(e)?e:new ne(e),a=o.length;for(s=0;s<i-r;++s)this[s+r]=o[s%a]}return this};ne.concat=function(e,r){if(!kd(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return ii(null,0);var i;if(r===void 0)for(r=0,i=0;i<e.length;++i)r+=e[i].length;var n=sh(null,r),s=0;for(i=0;i<e.length;++i){var o=e[i];if(!ne.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,s),s+=o.length}return n};ne.byteLength=ah;ne.prototype._isBuffer=!0;ne.isBuffer=function(e){return!!(e!=null&&e._isBuffer)};_r.alloc=function(t){var e=new ne(t);return e.fill(0),e};_r.from=function(t){return new ne(t)};var wt={},so,jd=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];wt.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};wt.getSymbolTotalCodewords=function(e){return jd[e]};wt.getBCHDigit=function(t){for(var e=0;t!==0;)e++,t>>>=1;return e};wt.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');so=e};wt.isKanjiModeEnabled=function(){return typeof so<"u"};wt.toSJIS=function(e){return so(e)};var On={};(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function e(r){if(typeof r!="string")throw new Error("Param is not a string");var i=r.toLowerCase();switch(i){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+r)}}t.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},t.from=function(i,n){if(t.isValid(i))return i;try{return e(i)}catch{return n}}})(On);function ch(){this.buffer=[],this.length=0}ch.prototype={get:function(t){var e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(var r=0;r<e;r++)this.putBit((t>>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var Kd=ch,$o=_r;function Hi(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=$o.alloc(t*t),this.reservedBit=$o.alloc(t*t)}Hi.prototype.set=function(t,e,r,i){var n=t*this.size+e;this.data[n]=r,i&&(this.reservedBit[n]=!0)};Hi.prototype.get=function(t,e){return this.data[t*this.size+e]};Hi.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};Hi.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var Vd=Hi,hh={};(function(t){var e=wt.getSymbolSize;t.getRowColCoords=function(i){if(i===1)return[];for(var n=Math.floor(i/7)+2,s=e(i),o=s===145?26:Math.ceil((s-13)/(2*n-2))*2,a=[s-7],h=1;h<n-1;h++)a[h]=a[h-1]-o;return a.push(6),a.reverse()},t.getPositions=function(i){for(var n=[],s=t.getRowColCoords(i),o=s.length,a=0;a<o;a++)for(var h=0;h<o;h++)a===0&&h===0||a===0&&h===o-1||a===o-1&&h===0||n.push([s[a],s[h]]);return n}})(hh);var lh={},Wd=wt.getSymbolSize,zo=7;lh.getPositions=function(e){var r=Wd(e);return[[0,0],[r-zo,0],[0,r-zo]]};var uh={};(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var e={N1:3,N2:3,N3:40,N4:10};t.isValid=function(n){return n!=null&&n!==""&&!isNaN(n)&&n>=0&&n<=7},t.from=function(n){return t.isValid(n)?parseInt(n,10):void 0},t.getPenaltyN1=function(n){for(var s=n.size,o=0,a=0,h=0,u=null,f=null,m=0;m<s;m++){a=h=0,u=f=null;for(var b=0;b<s;b++){var v=n.get(m,b);v===u?a++:(a>=5&&(o+=e.N1+(a-5)),u=v,a=1),v=n.get(b,m),v===f?h++:(h>=5&&(o+=e.N1+(h-5)),f=v,h=1)}a>=5&&(o+=e.N1+(a-5)),h>=5&&(o+=e.N1+(h-5))}return o},t.getPenaltyN2=function(n){for(var s=n.size,o=0,a=0;a<s-1;a++)for(var h=0;h<s-1;h++){var u=n.get(a,h)+n.get(a,h+1)+n.get(a+1,h)+n.get(a+1,h+1);(u===4||u===0)&&o++}return o*e.N2},t.getPenaltyN3=function(n){for(var s=n.size,o=0,a=0,h=0,u=0;u<s;u++){a=h=0;for(var f=0;f<s;f++)a=a<<1&2047|n.get(u,f),f>=10&&(a===1488||a===93)&&o++,h=h<<1&2047|n.get(f,u),f>=10&&(h===1488||h===93)&&o++}return o*e.N3},t.getPenaltyN4=function(n){for(var s=0,o=n.data.length,a=0;a<o;a++)s+=n.data[a];var h=Math.abs(Math.ceil(s*100/o/5)-10);return h*e.N4};function r(i,n,s){switch(i){case t.Patterns.PATTERN000:return(n+s)%2===0;case t.Patterns.PATTERN001:return n%2===0;case t.Patterns.PATTERN010:return s%3===0;case t.Patterns.PATTERN011:return(n+s)%3===0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(s/3))%2===0;case t.Patterns.PATTERN101:return n*s%2+n*s%3===0;case t.Patterns.PATTERN110:return(n*s%2+n*s%3)%2===0;case t.Patterns.PATTERN111:return(n*s%3+(n+s)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}t.applyMask=function(n,s){for(var o=s.size,a=0;a<o;a++)for(var h=0;h<o;h++)s.isReserved(h,a)||s.xor(h,a,r(n,h,a))},t.getBestMask=function(n,s){for(var o=Object.keys(t.Patterns).length,a=0,h=1/0,u=0;u<o;u++){s(u),t.applyMask(u,n);var f=t.getPenaltyN1(n)+t.getPenaltyN2(n)+t.getPenaltyN3(n)+t.getPenaltyN4(n);t.applyMask(u,n),f<h&&(h=f,a=u)}return a}})(uh);var kn={},yr=On,rn=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],nn=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];kn.getBlocksCount=function(e,r){switch(r){case yr.L:return rn[(e-1)*4+0];case yr.M:return rn[(e-1)*4+1];case yr.Q:return rn[(e-1)*4+2];case yr.H:return rn[(e-1)*4+3];default:return}};kn.getTotalCodewordsCount=function(e,r){switch(r){case yr.L:return nn[(e-1)*4+0];case yr.M:return nn[(e-1)*4+1];case yr.Q:return nn[(e-1)*4+2];case yr.H:return nn[(e-1)*4+3];default:return}};var dh={},Bn={},fh=_r,Oi=fh.alloc(512),vn=fh.alloc(256);(function(){for(var e=1,r=0;r<255;r++)Oi[r]=e,vn[e]=r,e<<=1,e&256&&(e^=285);for(r=255;r<512;r++)Oi[r]=Oi[r-255]})();Bn.log=function(e){if(e<1)throw new Error("log("+e+")");return vn[e]};Bn.exp=function(e){return Oi[e]};Bn.mul=function(e,r){return e===0||r===0?0:Oi[vn[e]+vn[r]]};(function(t){var e=_r,r=Bn;t.mul=function(n,s){for(var o=e.alloc(n.length+s.length-1),a=0;a<n.length;a++)for(var h=0;h<s.length;h++)o[a+h]^=r.mul(n[a],s[h]);return o},t.mod=function(n,s){for(var o=e.from(n);o.length-s.length>=0;){for(var a=o[0],h=0;h<s.length;h++)o[h]^=r.mul(s[h],a);for(var u=0;u<o.length&&o[u]===0;)u++;o=o.slice(u)}return o},t.generateECPolynomial=function(n){for(var s=e.from([1]),o=0;o<n;o++)s=t.mul(s,[1,r.exp(o)]);return s}})(dh);var jo=_r,ph=dh,Hd=K.bufferPolyfill.Buffer;function oo(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}oo.prototype.initialize=function(e){this.degree=e,this.genPoly=ph.generateECPolynomial(this.degree)};oo.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");var r=jo.alloc(this.degree),i=Hd.concat([e,r],e.length+this.degree),n=ph.mod(i,this.genPoly),s=this.degree-n.length;if(s>0){var o=jo.alloc(this.degree);return n.copy(o,s),o}return n};var Jd=oo,gh={},br={},ao={};ao.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40};var Ht={},mh="[0-9]+",Qd="[A-Z $%*+\\-./:]+",Ui="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Ui=Ui.replace(/u/g,"\\u");var Gd="(?:(?![A-Z0-9 $%*+\\-./:]|"+Ui+`)(?:.|[\r
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const K=require("./index-CEovIwuS.js"),xu=require("./dijkstra-CtFxn7S9.js"),kt=require("./events-B2ZyXE4l.js"),F=require("./index-CVaT6qZW.js"),T=require("./index-ByOoS9NO.js");let Nu=class extends T.r{constructor(e){super(e),this.events=new kt.eventsExports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(T.formatJsonRpcRequest(e.method,e.params||[],e.id||T.getBigIntRpcId().toString()),r)}async requestStrict(e,r){return new Promise(async(i,n)=>{if(!this.connection.connected)try{await this.open()}catch(s){n(s)}this.events.on(`${e.id}`,s=>{T.isJsonRpcError(s)?n(s.error):i(s.result)});try{await this.connection.send(e,r)}catch(s){n(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),T.isJsonRpcResponse(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)}};var Cu=function(){var t=document.getSelection();if(!t.rangeCount)return function(){};for(var e=document.activeElement,r=[],i=0;i<t.rangeCount;i++)r.push(t.getRangeAt(i));switch(e.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":e.blur();break;default:e=null;break}return t.removeAllRanges(),function(){t.type==="Caret"&&t.removeAllRanges(),t.rangeCount||r.forEach(function(n){t.addRange(n)}),e&&e.focus()}},Ru=Cu,Bo={"text/plain":"Text","text/html":"Url",default:"Text"},Tu="Copy to clipboard: #{key}, Enter";function Pu(t){var e=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return t.replace(/#{\s*key\s*}/g,e)}function Ou(t,e){var r,i,n,s,o,a,h=!1;e||(e={}),r=e.debug||!1;try{n=Ru(),s=document.createRange(),o=document.getSelection(),a=document.createElement("span"),a.textContent=t,a.ariaHidden="true",a.style.all="unset",a.style.position="fixed",a.style.top=0,a.style.clip="rect(0, 0, 0, 0)",a.style.whiteSpace="pre",a.style.webkitUserSelect="text",a.style.MozUserSelect="text",a.style.msUserSelect="text",a.style.userSelect="text",a.addEventListener("copy",function(f){if(f.stopPropagation(),e.format)if(f.preventDefault(),typeof f.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var m=Bo[e.format]||Bo.default;window.clipboardData.setData(m,t)}else f.clipboardData.clearData(),f.clipboardData.setData(e.format,t);e.onCopy&&(f.preventDefault(),e.onCopy(f.clipboardData))}),document.body.appendChild(a),s.selectNodeContents(a),o.addRange(s);var u=document.execCommand("copy");if(!u)throw new Error("copy command was unsuccessful");h=!0}catch(f){r&&console.error("unable to copy using execCommand: ",f),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",t),e.onCopy&&e.onCopy(window.clipboardData),h=!0}catch(m){r&&console.error("unable to copy using clipboardData: ",m),r&&console.error("falling back to prompt"),i=Pu("message"in e?e.message:Tu),window.prompt(i,t)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),n()}return h}var ku=Ou,Bu={}.toString,to=Array.isArray||function(t){return Bu.call(t)=="[object Array]"},Du=K.requireElliptic(),ro={},le={};Object.defineProperty(le,"__esModule",{value:!0});var kc=le.getLocalStorage=Vc=le.getLocalStorageOrThrow=Kc=le.getCrypto=jc=le.getCryptoOrThrow=zc=le.getLocation=$c=le.getLocationOrThrow=Uc=le.getNavigator=qc=le.getNavigatorOrThrow=Lc=le.getDocument=Fc=le.getDocumentOrThrow=Dc=le.getFromWindowOrThrow=Bc=le.getFromWindow=void 0;function Vr(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}var Bc=le.getFromWindow=Vr;function ui(t){const e=Vr(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}var Dc=le.getFromWindowOrThrow=ui;function Fu(){return ui("document")}var Fc=le.getDocumentOrThrow=Fu;function Lu(){return Vr("document")}var Lc=le.getDocument=Lu;function qu(){return ui("navigator")}var qc=le.getNavigatorOrThrow=qu;function Uu(){return Vr("navigator")}var Uc=le.getNavigator=Uu;function $u(){return ui("location")}var $c=le.getLocationOrThrow=$u;function zu(){return Vr("location")}var zc=le.getLocation=zu;function ju(){return ui("crypto")}var jc=le.getCryptoOrThrow=ju;function Ku(){return Vr("crypto")}var Kc=le.getCrypto=Ku;function Vu(){return ui("localStorage")}var Vc=le.getLocalStorageOrThrow=Vu;function Wu(){return Vr("localStorage")}kc=le.getLocalStorage=Wu;Object.defineProperty(ro,"__esModule",{value:!0});var Wc=ro.getWindowMetadata=void 0;const Do=le;function Hu(){let t,e;try{t=Do.getDocumentOrThrow(),e=Do.getLocationOrThrow()}catch{return null}function r(){const m=t.getElementsByTagName("link"),b=[];for(let v=0;v<m.length;v++){const E=m[v],x=E.getAttribute("rel");if(x&&x.toLowerCase().indexOf("icon")>-1){const S=E.getAttribute("href");if(S)if(S.toLowerCase().indexOf("https:")===-1&&S.toLowerCase().indexOf("http:")===-1&&S.indexOf("//")!==0){let N=e.protocol+"//"+e.host;if(S.indexOf("/")===0)N+=S;else{const R=e.pathname.split("/");R.pop();const O=R.join("/");N+=O+"/"+S}b.push(N)}else if(S.indexOf("//")===0){const N=e.protocol+S;b.push(N)}else b.push(S)}}return b}function i(...m){const b=t.getElementsByTagName("meta");for(let v=0;v<b.length;v++){const E=b[v],x=["itemprop","property","name"].map(S=>E.getAttribute(S)).filter(S=>S?m.includes(S):!1);if(x.length&&x){const S=E.getAttribute("content");if(S)return S}}return""}function n(){let m=i("name","og:site_name","og:title","twitter:title");return m||(m=t.title),m}function s(){return i("description","og:description","twitter:description","keywords")}const o=n(),a=s(),h=e.origin,u=r();return{description:a,url:h,icons:u,name:o}}Wc=ro.getWindowMetadata=Hu;var Ju=function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var i=Array(t),n=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,n++)i[n]=s[o];return i},Qu=function(){function t(e,r,i){this.name=e,this.version=r,this.os=i,this.type="browser"}return t}(),Gu=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=K.dist.process.platform}return t}(),Yu=function(){function t(e,r,i,n){this.name=e,this.version=r,this.os=i,this.bot=n,this.type="bot-device"}return t}(),Xu=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),Zu=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),ed=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,td=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Fo=3,rd=[["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|$)/],["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",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",ed]],Lo=[["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/],["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 id(t){return t?qo(t):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Zu:typeof navigator<"u"?qo(navigator.userAgent):od()}function nd(t){return t!==""&&rd.reduce(function(e,r){var i=r[0],n=r[1];if(e)return e;var s=n.exec(t);return!!s&&[i,s]},!1)}function qo(t){var e=nd(t);if(!e)return null;var r=e[0],i=e[1];if(r==="searchbot")return new Xu;var n=i[1]&&i[1].split(/[._]/).slice(0,3);n?n.length<Fo&&(n=Ju(n,ad(Fo-n.length))):n=[];var s=n.join("."),o=sd(t),a=td.exec(t);return a&&a[1]?new Yu(r,s,o,a[1]):new Qu(r,s,o)}function sd(t){for(var e=0,r=Lo.length;e<r;e++){var i=Lo[e],n=i[0],s=i[1],o=s.exec(t);if(o)return n}return null}function od(){var t=typeof K.dist.process<"u"&&K.dist.process.version;return t?new Gu(K.dist.process.version.slice(1)):null}function ad(t){for(var e=[],r=0;r<t;r++)e.push("0");return e}function io(t){return id(t)}function Tn(){const t=io();return t&&t.os?t.os:void 0}function Hc(){const t=Tn();return t?t.toLowerCase().includes("android"):!1}function Jc(){const t=Tn();return t?t.toLowerCase().includes("ios")||t.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function cd(){return Tn()?Hc()||Jc():!1}function Qc(){const t=io();return t&&t.name?t.name.toLowerCase()==="node":!1}function hd(){return!Qc()&&!!Gc()}const ld=Bc,ud=Dc,dd=Fc,fd=Lc,pd=qc,Gc=Uc,gd=$c,md=zc,yd=jc,vd=Kc,wd=Vc,Pn=kc;function _d(){return Wc()}function bd(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return JSON.parse(t)}catch{return t}}function Ad(t){return typeof t=="string"?t:JSON.stringify(t)}const Yc=bd,Xc=Ad;function Zc(t,e){const r=Xc(e),i=Pn();i&&i.setItem(t,r)}function Ed(t){let e=null,r=null;const i=Pn();return i&&(r=i.getItem(t)),e=r&&Yc(r),e}function Sd(t){const e=Pn();e&&e.removeItem(t)}const eh="WALLETCONNECT_DEEPLINK_CHOICE";function Id(t,e){const r=encodeURIComponent(t);return e.universalLink?`${e.universalLink}/wc?uri=${r}`:e.deepLink?`${e.deepLink}${e.deepLink.endsWith(":")?"//":"/"}wc?uri=${r}`:""}function Md(t){const e=t.href.split("?")[0];Zc(eh,Object.assign(Object.assign({},t),{href:e}))}function th(t,e){return t.filter(r=>r.name.toLowerCase().includes(e.toLowerCase()))[0]}function xd(t,e){let r=t;return e&&(r=e.map(i=>th(t,i)).filter(Boolean)),r}const rh="https://registry.walletconnect.com";function Nd(){return rh+"/api/v2/wallets"}function Cd(){return rh+"/api/v2/dapps"}function ih(t,e="mobile"){var r;return{name:t.name||"",shortName:t.metadata.shortName||"",color:t.metadata.colors.primary||"",logo:(r=t.image_url.sm)!==null&&r!==void 0?r:"",universalLink:t[e].universal||"",deepLink:t[e].native||""}}function Rd(t,e="mobile"){return Object.values(t).filter(r=>!!r[e].universal||!!r[e].native).map(r=>ih(r,e))}const Td=Object.freeze(Object.defineProperty({__proto__:null,detectEnv:io,detectOS:Tn,formatIOSMobile:Id,formatMobileRegistry:Rd,formatMobileRegistryEntry:ih,getClientMeta:_d,getCrypto:vd,getCryptoOrThrow:yd,getDappRegistryUrl:Cd,getDocument:fd,getDocumentOrThrow:dd,getFromWindow:ld,getFromWindowOrThrow:ud,getLocal:Ed,getLocalStorage:Pn,getLocalStorageOrThrow:wd,getLocation:md,getLocationOrThrow:gd,getMobileLinkRegistry:xd,getMobileRegistryEntry:th,getNavigator:Gc,getNavigatorOrThrow:pd,getWalletRegistryUrl:Nd,isAndroid:Hc,isBrowser:hd,isIOS:Jc,isMobile:cd,isNode:Qc,mobileLinkChoiceKey:eh,removeLocal:Sd,safeJsonParse:Yc,safeJsonStringify:Xc,saveMobileLinkInfo:Md,setLocal:Zc},Symbol.toStringTag,{value:"Module"})),Pd=K.getAugmentedNamespace(Td);var Wi={},Od=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},nh={},_r={},kd=to;function Bd(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},t.foo()===42}catch{return!1}}ne.TYPED_ARRAY_SUPPORT=Bd();var Uo=ne.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function ne(t,e,r){return!ne.TYPED_ARRAY_SUPPORT&&!(this instanceof ne)?new ne(t,e,r):typeof t=="number"?sh(this,t):zd(this,t,e,r)}ne.TYPED_ARRAY_SUPPORT&&(ne.prototype.__proto__=Uint8Array.prototype,ne.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&ne[Symbol.species]===ne&&Object.defineProperty(ne,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}));function no(t){if(t>=Uo)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Uo.toString(16)+" bytes");return t|0}function Dd(t){return t!==t}function ii(t,e){var r;return ne.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(e),r.__proto__=ne.prototype):(r=t,r===null&&(r=new ne(e)),r.length=e),r}function sh(t,e){var r=ii(t,e<0?0:no(e)|0);if(!ne.TYPED_ARRAY_SUPPORT)for(var i=0;i<e;++i)r[i]=0;return r}function Fd(t,e){var r=ah(e)|0,i=ii(t,r),n=i.write(e);return n!==r&&(i=i.slice(0,n)),i}function ks(t,e){for(var r=e.length<0?0:no(e.length)|0,i=ii(t,r),n=0;n<r;n+=1)i[n]=e[n]&255;return i}function Ld(t,e,r,i){if(r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");var n;return r===void 0&&i===void 0?n=new Uint8Array(e):i===void 0?n=new Uint8Array(e,r):n=new Uint8Array(e,r,i),ne.TYPED_ARRAY_SUPPORT?n.__proto__=ne.prototype:n=ks(t,n),n}function qd(t,e){if(ne.isBuffer(e)){var r=no(e.length)|0,i=ii(t,r);return i.length===0||e.copy(i,0,0,r),i}if(e){if(typeof ArrayBuffer<"u"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||Dd(e.length)?ii(t,0):ks(t,e);if(e.type==="Buffer"&&Array.isArray(e.data))return ks(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function oh(t,e){e=e||1/0;for(var r,i=t.length,n=null,s=[],o=0;o<i;++o){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function ah(t){if(ne.isBuffer(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var e=t.length;return e===0?0:oh(t).length}function Ud(t,e,r,i){for(var n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function $d(t,e,r,i){return Ud(oh(e,t.length-r),t,r,i)}function zd(t,e,r,i){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?Ld(t,e,r,i):typeof e=="string"?Fd(t,e):qd(t,e)}ne.prototype.write=function(e,r,i){r===void 0?(i=this.length,r=0):i===void 0&&typeof r=="string"?(i=this.length,r=0):isFinite(r)&&(r=r|0,isFinite(i)?i=i|0:i=void 0);var n=this.length-r;if((i===void 0||i>n)&&(i=n),e.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");return $d(this,e,r,i)};ne.prototype.slice=function(e,r){var i=this.length;e=~~e,r=r===void 0?i:~~r,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<e&&(r=e);var n;if(ne.TYPED_ARRAY_SUPPORT)n=this.subarray(e,r),n.__proto__=ne.prototype;else{var s=r-e;n=new ne(s,void 0);for(var o=0;o<s;++o)n[o]=this[o+e]}return n};ne.prototype.copy=function(e,r,i,n){if(i||(i=0),!n&&n!==0&&(n=this.length),r>=e.length&&(r=e.length),r||(r=0),n>0&&n<i&&(n=i),n===i||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-r<n-i&&(n=e.length-r+i);var s=n-i,o;if(this===e&&i<r&&r<n)for(o=s-1;o>=0;--o)e[o+r]=this[o+i];else if(s<1e3||!ne.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)e[o+r]=this[o+i];else Uint8Array.prototype.set.call(e,this.subarray(i,i+s),r);return s};ne.prototype.fill=function(e,r,i){if(typeof e=="string"){if(typeof r=="string"?(r=0,i=this.length):typeof i=="string"&&(i=this.length),e.length===1){var n=e.charCodeAt(0);n<256&&(e=n)}}else typeof e=="number"&&(e=e&255);if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);var s;if(typeof e=="number")for(s=r;s<i;++s)this[s]=e;else{var o=ne.isBuffer(e)?e:new ne(e),a=o.length;for(s=0;s<i-r;++s)this[s+r]=o[s%a]}return this};ne.concat=function(e,r){if(!kd(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return ii(null,0);var i;if(r===void 0)for(r=0,i=0;i<e.length;++i)r+=e[i].length;var n=sh(null,r),s=0;for(i=0;i<e.length;++i){var o=e[i];if(!ne.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,s),s+=o.length}return n};ne.byteLength=ah;ne.prototype._isBuffer=!0;ne.isBuffer=function(e){return!!(e!=null&&e._isBuffer)};_r.alloc=function(t){var e=new ne(t);return e.fill(0),e};_r.from=function(t){return new ne(t)};var wt={},so,jd=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];wt.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};wt.getSymbolTotalCodewords=function(e){return jd[e]};wt.getBCHDigit=function(t){for(var e=0;t!==0;)e++,t>>>=1;return e};wt.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');so=e};wt.isKanjiModeEnabled=function(){return typeof so<"u"};wt.toSJIS=function(e){return so(e)};var On={};(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function e(r){if(typeof r!="string")throw new Error("Param is not a string");var i=r.toLowerCase();switch(i){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+r)}}t.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},t.from=function(i,n){if(t.isValid(i))return i;try{return e(i)}catch{return n}}})(On);function ch(){this.buffer=[],this.length=0}ch.prototype={get:function(t){var e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(var r=0;r<e;r++)this.putBit((t>>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var Kd=ch,$o=_r;function Hi(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=$o.alloc(t*t),this.reservedBit=$o.alloc(t*t)}Hi.prototype.set=function(t,e,r,i){var n=t*this.size+e;this.data[n]=r,i&&(this.reservedBit[n]=!0)};Hi.prototype.get=function(t,e){return this.data[t*this.size+e]};Hi.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};Hi.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var Vd=Hi,hh={};(function(t){var e=wt.getSymbolSize;t.getRowColCoords=function(i){if(i===1)return[];for(var n=Math.floor(i/7)+2,s=e(i),o=s===145?26:Math.ceil((s-13)/(2*n-2))*2,a=[s-7],h=1;h<n-1;h++)a[h]=a[h-1]-o;return a.push(6),a.reverse()},t.getPositions=function(i){for(var n=[],s=t.getRowColCoords(i),o=s.length,a=0;a<o;a++)for(var h=0;h<o;h++)a===0&&h===0||a===0&&h===o-1||a===o-1&&h===0||n.push([s[a],s[h]]);return n}})(hh);var lh={},Wd=wt.getSymbolSize,zo=7;lh.getPositions=function(e){var r=Wd(e);return[[0,0],[r-zo,0],[0,r-zo]]};var uh={};(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var e={N1:3,N2:3,N3:40,N4:10};t.isValid=function(n){return n!=null&&n!==""&&!isNaN(n)&&n>=0&&n<=7},t.from=function(n){return t.isValid(n)?parseInt(n,10):void 0},t.getPenaltyN1=function(n){for(var s=n.size,o=0,a=0,h=0,u=null,f=null,m=0;m<s;m++){a=h=0,u=f=null;for(var b=0;b<s;b++){var v=n.get(m,b);v===u?a++:(a>=5&&(o+=e.N1+(a-5)),u=v,a=1),v=n.get(b,m),v===f?h++:(h>=5&&(o+=e.N1+(h-5)),f=v,h=1)}a>=5&&(o+=e.N1+(a-5)),h>=5&&(o+=e.N1+(h-5))}return o},t.getPenaltyN2=function(n){for(var s=n.size,o=0,a=0;a<s-1;a++)for(var h=0;h<s-1;h++){var u=n.get(a,h)+n.get(a,h+1)+n.get(a+1,h)+n.get(a+1,h+1);(u===4||u===0)&&o++}return o*e.N2},t.getPenaltyN3=function(n){for(var s=n.size,o=0,a=0,h=0,u=0;u<s;u++){a=h=0;for(var f=0;f<s;f++)a=a<<1&2047|n.get(u,f),f>=10&&(a===1488||a===93)&&o++,h=h<<1&2047|n.get(f,u),f>=10&&(h===1488||h===93)&&o++}return o*e.N3},t.getPenaltyN4=function(n){for(var s=0,o=n.data.length,a=0;a<o;a++)s+=n.data[a];var h=Math.abs(Math.ceil(s*100/o/5)-10);return h*e.N4};function r(i,n,s){switch(i){case t.Patterns.PATTERN000:return(n+s)%2===0;case t.Patterns.PATTERN001:return n%2===0;case t.Patterns.PATTERN010:return s%3===0;case t.Patterns.PATTERN011:return(n+s)%3===0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(s/3))%2===0;case t.Patterns.PATTERN101:return n*s%2+n*s%3===0;case t.Patterns.PATTERN110:return(n*s%2+n*s%3)%2===0;case t.Patterns.PATTERN111:return(n*s%3+(n+s)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}t.applyMask=function(n,s){for(var o=s.size,a=0;a<o;a++)for(var h=0;h<o;h++)s.isReserved(h,a)||s.xor(h,a,r(n,h,a))},t.getBestMask=function(n,s){for(var o=Object.keys(t.Patterns).length,a=0,h=1/0,u=0;u<o;u++){s(u),t.applyMask(u,n);var f=t.getPenaltyN1(n)+t.getPenaltyN2(n)+t.getPenaltyN3(n)+t.getPenaltyN4(n);t.applyMask(u,n),f<h&&(h=f,a=u)}return a}})(uh);var kn={},yr=On,rn=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],nn=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];kn.getBlocksCount=function(e,r){switch(r){case yr.L:return rn[(e-1)*4+0];case yr.M:return rn[(e-1)*4+1];case yr.Q:return rn[(e-1)*4+2];case yr.H:return rn[(e-1)*4+3];default:return}};kn.getTotalCodewordsCount=function(e,r){switch(r){case yr.L:return nn[(e-1)*4+0];case yr.M:return nn[(e-1)*4+1];case yr.Q:return nn[(e-1)*4+2];case yr.H:return nn[(e-1)*4+3];default:return}};var dh={},Bn={},fh=_r,Oi=fh.alloc(512),vn=fh.alloc(256);(function(){for(var e=1,r=0;r<255;r++)Oi[r]=e,vn[e]=r,e<<=1,e&256&&(e^=285);for(r=255;r<512;r++)Oi[r]=Oi[r-255]})();Bn.log=function(e){if(e<1)throw new Error("log("+e+")");return vn[e]};Bn.exp=function(e){return Oi[e]};Bn.mul=function(e,r){return e===0||r===0?0:Oi[vn[e]+vn[r]]};(function(t){var e=_r,r=Bn;t.mul=function(n,s){for(var o=e.alloc(n.length+s.length-1),a=0;a<n.length;a++)for(var h=0;h<s.length;h++)o[a+h]^=r.mul(n[a],s[h]);return o},t.mod=function(n,s){for(var o=e.from(n);o.length-s.length>=0;){for(var a=o[0],h=0;h<s.length;h++)o[h]^=r.mul(s[h],a);for(var u=0;u<o.length&&o[u]===0;)u++;o=o.slice(u)}return o},t.generateECPolynomial=function(n){for(var s=e.from([1]),o=0;o<n;o++)s=t.mul(s,[1,r.exp(o)]);return s}})(dh);var jo=_r,ph=dh,Hd=K.bufferPolyfill.Buffer;function oo(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}oo.prototype.initialize=function(e){this.degree=e,this.genPoly=ph.generateECPolynomial(this.degree)};oo.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");var r=jo.alloc(this.degree),i=Hd.concat([e,r],e.length+this.degree),n=ph.mod(i,this.genPoly),s=this.degree-n.length;if(s>0){var o=jo.alloc(this.degree);return n.copy(o,s),o}return n};var Jd=oo,gh={},br={},ao={};ao.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40};var Ht={},mh="[0-9]+",Qd="[A-Z $%*+\\-./:]+",Ui="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Ui=Ui.replace(/u/g,"\\u");var Gd="(?:(?![A-Z0-9 $%*+\\-./:]|"+Ui+`)(?:.|[\r
|
|
2
2
|
]))+`;Ht.KANJI=new RegExp(Ui,"g");Ht.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");Ht.BYTE=new RegExp(Gd,"g");Ht.NUMERIC=new RegExp(mh,"g");Ht.ALPHANUMERIC=new RegExp(Qd,"g");var Yd=new RegExp("^"+Ui+"$"),Xd=new RegExp("^"+mh+"$"),Zd=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");Ht.testKanji=function(e){return Yd.test(e)};Ht.testNumeric=function(e){return Xd.test(e)};Ht.testAlphanumeric=function(e){return Zd.test(e)};(function(t){var e=ao,r=Ht;t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(s,o){if(!s.ccBits)throw new Error("Invalid mode: "+s);if(!e.isValid(o))throw new Error("Invalid version: "+o);return o>=1&&o<10?s.ccBits[0]:o<27?s.ccBits[1]:s.ccBits[2]},t.getBestModeForData=function(s){return r.testNumeric(s)?t.NUMERIC:r.testAlphanumeric(s)?t.ALPHANUMERIC:r.testKanji(s)?t.KANJI:t.BYTE},t.toString=function(s){if(s&&s.id)return s.id;throw new Error("Invalid mode")},t.isValid=function(s){return s&&s.bit&&s.ccBits};function i(n){if(typeof n!="string")throw new Error("Param is not a string");var s=n.toLowerCase();switch(s){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+n)}}t.from=function(s,o){if(t.isValid(s))return s;try{return i(s)}catch{return o}}})(br);(function(t){var e=wt,r=kn,i=On,n=br,s=ao,o=to,a=7973,h=e.getBCHDigit(a);function u(v,E,x){for(var S=1;S<=40;S++)if(E<=t.getCapacity(S,x,v))return S}function f(v,E){return n.getCharCountIndicator(v,E)+4}function m(v,E){var x=0;return v.forEach(function(S){var N=f(S.mode,E);x+=N+S.getBitsLength()}),x}function b(v,E){for(var x=1;x<=40;x++){var S=m(v,x);if(S<=t.getCapacity(x,E,n.MIXED))return x}}t.from=function(E,x){return s.isValid(E)?parseInt(E,10):x},t.getCapacity=function(E,x,S){if(!s.isValid(E))throw new Error("Invalid QR Code version");typeof S>"u"&&(S=n.BYTE);var N=e.getSymbolTotalCodewords(E),R=r.getTotalCodewordsCount(E,x),O=(N-R)*8;if(S===n.MIXED)return O;var C=O-f(S,E);switch(S){case n.NUMERIC:return Math.floor(C/10*3);case n.ALPHANUMERIC:return Math.floor(C/11*2);case n.KANJI:return Math.floor(C/13);case n.BYTE:default:return Math.floor(C/8)}},t.getBestVersionForData=function(E,x){var S,N=i.from(x,i.M);if(o(E)){if(E.length>1)return b(E,N);if(E.length===0)return 1;S=E[0]}else S=E;return u(S.mode,S.getLength(),N)},t.getEncodedBits=function(E){if(!s.isValid(E)||E<7)throw new Error("Invalid QR Code version");for(var x=E<<12;e.getBCHDigit(x)-h>=0;)x^=a<<e.getBCHDigit(x)-h;return E<<12|x}})(gh);var yh={},Bs=wt,vh=1335,ef=21522,Ko=Bs.getBCHDigit(vh);yh.getEncodedBits=function(e,r){for(var i=e.bit<<3|r,n=i<<10;Bs.getBCHDigit(n)-Ko>=0;)n^=vh<<Bs.getBCHDigit(n)-Ko;return(i<<10|n)^ef};var wh={},tf=br;function ni(t){this.mode=tf.NUMERIC,this.data=t.toString()}ni.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};ni.prototype.getLength=function(){return this.data.length};ni.prototype.getBitsLength=function(){return ni.getBitsLength(this.data.length)};ni.prototype.write=function(e){var r,i,n;for(r=0;r+3<=this.data.length;r+=3)i=this.data.substr(r,3),n=parseInt(i,10),e.put(n,10);var s=this.data.length-r;s>0&&(i=this.data.substr(r),n=parseInt(i,10),e.put(n,s*3+1))};var rf=ni,nf=br,ns=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function si(t){this.mode=nf.ALPHANUMERIC,this.data=t}si.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};si.prototype.getLength=function(){return this.data.length};si.prototype.getBitsLength=function(){return si.getBitsLength(this.data.length)};si.prototype.write=function(e){var r;for(r=0;r+2<=this.data.length;r+=2){var i=ns.indexOf(this.data[r])*45;i+=ns.indexOf(this.data[r+1]),e.put(i,11)}this.data.length%2&&e.put(ns.indexOf(this.data[r]),6)};var sf=si,of=_r,af=br;function oi(t){this.mode=af.BYTE,this.data=of.from(t)}oi.getBitsLength=function(e){return e*8};oi.prototype.getLength=function(){return this.data.length};oi.prototype.getBitsLength=function(){return oi.getBitsLength(this.data.length)};oi.prototype.write=function(t){for(var e=0,r=this.data.length;e<r;e++)t.put(this.data[e],8)};var cf=oi,hf=br,lf=wt;function ai(t){this.mode=hf.KANJI,this.data=t}ai.getBitsLength=function(e){return e*13};ai.prototype.getLength=function(){return this.data.length};ai.prototype.getBitsLength=function(){return ai.getBitsLength(this.data.length)};ai.prototype.write=function(t){var e;for(e=0;e<this.data.length;e++){var r=lf.toSJIS(this.data[e]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
|
|
3
3
|
Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),t.put(r,13)}};var uf=ai;(function(t){var e=br,r=rf,i=sf,n=cf,s=uf,o=Ht,a=wt,h=xu.dijkstraExports;function u(N){return unescape(encodeURIComponent(N)).length}function f(N,R,O){for(var C=[],D;(D=N.exec(O))!==null;)C.push({data:D[0],index:D.index,mode:R,length:D[0].length});return C}function m(N){var R=f(o.NUMERIC,e.NUMERIC,N),O=f(o.ALPHANUMERIC,e.ALPHANUMERIC,N),C,D;a.isKanjiModeEnabled()?(C=f(o.BYTE,e.BYTE,N),D=f(o.KANJI,e.KANJI,N)):(C=f(o.BYTE_KANJI,e.BYTE,N),D=[]);var L=R.concat(O,C,D);return L.sort(function($,U){return $.index-U.index}).map(function($){return{data:$.data,mode:$.mode,length:$.length}})}function b(N,R){switch(R){case e.NUMERIC:return r.getBitsLength(N);case e.ALPHANUMERIC:return i.getBitsLength(N);case e.KANJI:return s.getBitsLength(N);case e.BYTE:return n.getBitsLength(N)}}function v(N){return N.reduce(function(R,O){var C=R.length-1>=0?R[R.length-1]:null;return C&&C.mode===O.mode?(R[R.length-1].data+=O.data,R):(R.push(O),R)},[])}function E(N){for(var R=[],O=0;O<N.length;O++){var C=N[O];switch(C.mode){case e.NUMERIC:R.push([C,{data:C.data,mode:e.ALPHANUMERIC,length:C.length},{data:C.data,mode:e.BYTE,length:C.length}]);break;case e.ALPHANUMERIC:R.push([C,{data:C.data,mode:e.BYTE,length:C.length}]);break;case e.KANJI:R.push([C,{data:C.data,mode:e.BYTE,length:u(C.data)}]);break;case e.BYTE:R.push([{data:C.data,mode:e.BYTE,length:u(C.data)}])}}return R}function x(N,R){for(var O={},C={start:{}},D=["start"],L=0;L<N.length;L++){for(var $=N[L],U=[],ee=0;ee<$.length;ee++){var oe=$[ee],te=""+L+ee;U.push(te),O[te]={node:oe,lastCount:0},C[te]={};for(var he=0;he<D.length;he++){var c=D[he];O[c]&&O[c].node.mode===oe.mode?(C[c][te]=b(O[c].lastCount+oe.length,oe.mode)-b(O[c].lastCount,oe.mode),O[c].lastCount+=oe.length):(O[c]&&(O[c].lastCount=oe.length),C[c][te]=b(oe.length,oe.mode)+4+e.getCharCountIndicator(oe.mode,R))}}D=U}for(he=0;he<D.length;he++)C[D[he]].end=0;return{map:C,table:O}}function S(N,R){var O,C=e.getBestModeForData(N);if(O=e.from(R,C),O!==e.BYTE&&O.bit<C.bit)throw new Error('"'+N+'" cannot be encoded with mode '+e.toString(O)+`.
|
|
4
4
|
Suggested mode is: `+e.toString(C));switch(O===e.KANJI&&!a.isKanjiModeEnabled()&&(O=e.BYTE),O){case e.NUMERIC:return new r(N);case e.ALPHANUMERIC:return new i(N);case e.KANJI:return new s(N);case e.BYTE:return new n(N)}}t.fromArray=function(R){return R.reduce(function(O,C){return typeof C=="string"?O.push(S(C,null)):C.data&&O.push(S(C.data,C.mode)),O},[])},t.fromString=function(R,O){for(var C=m(R,a.isKanjiModeEnabled()),D=E(C),L=x(D,O),$=h.find_path(L.map,"start","end"),U=[],ee=1;ee<$.length-1;ee++)U.push(L.table[$[ee]].node);return t.fromArray(v(U))},t.rawSplit=function(R){return t.fromArray(m(R,a.isKanjiModeEnabled()))}})(wh);var Vo=_r,Dn=wt,ss=On,df=Kd,ff=Vd,pf=hh,gf=lh,Ds=uh,Fs=kn,mf=Jd,wn=gh,yf=yh,vf=br,os=wh,wf=to;function _f(t,e){for(var r=t.size,i=gf.getPositions(e),n=0;n<i.length;n++)for(var s=i[n][0],o=i[n][1],a=-1;a<=7;a++)if(!(s+a<=-1||r<=s+a))for(var h=-1;h<=7;h++)o+h<=-1||r<=o+h||(a>=0&&a<=6&&(h===0||h===6)||h>=0&&h<=6&&(a===0||a===6)||a>=2&&a<=4&&h>=2&&h<=4?t.set(s+a,o+h,!0,!0):t.set(s+a,o+h,!1,!0))}function bf(t){for(var e=t.size,r=8;r<e-8;r++){var i=r%2===0;t.set(r,6,i,!0),t.set(6,r,i,!0)}}function Af(t,e){for(var r=pf.getPositions(e),i=0;i<r.length;i++)for(var n=r[i][0],s=r[i][1],o=-2;o<=2;o++)for(var a=-2;a<=2;a++)o===-2||o===2||a===-2||a===2||o===0&&a===0?t.set(n+o,s+a,!0,!0):t.set(n+o,s+a,!1,!0)}function Ef(t,e){for(var r=t.size,i=wn.getEncodedBits(e),n,s,o,a=0;a<18;a++)n=Math.floor(a/3),s=a%3+r-8-3,o=(i>>a&1)===1,t.set(n,s,o,!0),t.set(s,n,o,!0)}function as(t,e,r){var i=t.size,n=yf.getEncodedBits(e,r),s,o;for(s=0;s<15;s++)o=(n>>s&1)===1,s<6?t.set(s,8,o,!0):s<8?t.set(s+1,8,o,!0):t.set(i-15+s,8,o,!0),s<8?t.set(8,i-s-1,o,!0):s<9?t.set(8,15-s-1+1,o,!0):t.set(8,15-s-1,o,!0);t.set(i-8,8,1,!0)}function Sf(t,e){for(var r=t.size,i=-1,n=r-1,s=7,o=0,a=r-1;a>0;a-=2)for(a===6&&a--;;){for(var h=0;h<2;h++)if(!t.isReserved(n,a-h)){var u=!1;o<e.length&&(u=(e[o]>>>s&1)===1),t.set(n,a-h,u),s--,s===-1&&(o++,s=7)}if(n+=i,n<0||r<=n){n-=i,i=-i;break}}}function If(t,e,r){var i=new df;r.forEach(function(u){i.put(u.mode.bit,4),i.put(u.getLength(),vf.getCharCountIndicator(u.mode,t)),u.write(i)});var n=Dn.getSymbolTotalCodewords(t),s=Fs.getTotalCodewordsCount(t,e),o=(n-s)*8;for(i.getLengthInBits()+4<=o&&i.put(0,4);i.getLengthInBits()%8!==0;)i.putBit(0);for(var a=(o-i.getLengthInBits())/8,h=0;h<a;h++)i.put(h%2?17:236,8);return Mf(i,t,e)}function Mf(t,e,r){for(var i=Dn.getSymbolTotalCodewords(e),n=Fs.getTotalCodewordsCount(e,r),s=i-n,o=Fs.getBlocksCount(e,r),a=i%o,h=o-a,u=Math.floor(i/o),f=Math.floor(s/o),m=f+1,b=u-f,v=new mf(b),E=0,x=new Array(o),S=new Array(o),N=0,R=Vo.from(t.buffer),O=0;O<o;O++){var C=O<h?f:m;x[O]=R.slice(E,E+C),S[O]=v.encode(x[O]),E+=C,N=Math.max(N,C)}var D=Vo.alloc(i),L=0,$,U;for($=0;$<N;$++)for(U=0;U<o;U++)$<x[U].length&&(D[L++]=x[U][$]);for($=0;$<b;$++)for(U=0;U<o;U++)D[L++]=S[U][$];return D}function xf(t,e,r,i){var n;if(wf(t))n=os.fromArray(t);else if(typeof t=="string"){var s=e;if(!s){var o=os.rawSplit(t);s=wn.getBestVersionForData(o,r)}n=os.fromString(t,s||40)}else throw new Error("Invalid data");var a=wn.getBestVersionForData(n,r);if(!a)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=a;else if(e<a)throw new Error(`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { e as bt, a as To } from "./events-
|
|
2
|
-
import { a1 as xo, aR as Iw, h as ee, ac as Pw, du as $u } from "./index-
|
|
3
|
-
import { c as F, s as Do, x as kh, r as zh, H as Sw, a as Hh, q as Ss } from "./index-
|
|
4
|
-
import { I as lr, f as ft, t as nt, c as Cu, C as Ow, r as Rw, a as Dr, g as Vh, i as _t, b as $s, d as Nw, E as ke, y as Qe, q as Cs, k as As, h as $w, e as Au, j as Cw, s as Aw, l as Tw, m as Fo, n as Ts, o as qo, p as Wt, u as xw, v as Tu, w as Dw } from "./index-
|
|
1
|
+
import { e as bt, a as To } from "./events-D9h1HjEa.mjs";
|
|
2
|
+
import { a1 as xo, aR as Iw, h as ee, ac as Pw, du as $u } from "./index-DWJ5r15M.mjs";
|
|
3
|
+
import { c as F, s as Do, x as kh, r as zh, H as Sw, a as Hh, q as Ss } from "./index-BT10pzLw.mjs";
|
|
4
|
+
import { I as lr, f as ft, t as nt, c as Cu, C as Ow, r as Rw, a as Dr, g as Vh, i as _t, b as $s, d as Nw, E as ke, y as Qe, q as Cs, k as As, h as $w, e as Au, j as Cw, s as Aw, l as Tw, m as Fo, n as Ts, o as qo, p as Wt, u as xw, v as Tu, w as Dw } from "./index-IC9ubiMJ.mjs";
|
|
5
5
|
var se = {};
|
|
6
6
|
Object.defineProperty(se, "__esModule", { value: !0 });
|
|
7
7
|
se.getLocalStorage = se.getLocalStorageOrThrow = se.getCrypto = se.getCryptoOrThrow = se.getLocation = se.getLocationOrThrow = se.getNavigator = se.getNavigatorOrThrow = se.getDocument = se.getDocumentOrThrow = se.getFromWindowOrThrow = se.getFromWindow = void 0;
|
|
@@ -7730,7 +7730,7 @@ class Jo {
|
|
|
7730
7730
|
if (this.rpc = this.getRpcConfig(t), this.chainId = this.rpc.chains.length ? Ns(this.rpc.chains) : Ns(this.rpc.optionalChains), this.signer = await tP.init({ projectId: this.rpc.projectId, metadata: this.rpc.metadata, disableProviderPing: t.disableProviderPing, relayUrl: t.relayUrl, storageOptions: t.storageOptions }), this.registerEventListeners(), await this.loadPersistedSession(), this.rpc.showQrModal) {
|
|
7731
7731
|
let r;
|
|
7732
7732
|
try {
|
|
7733
|
-
const { WalletConnectModal: s } = await import("./index-
|
|
7733
|
+
const { WalletConnectModal: s } = await import("./index-DdhKN5Tn.mjs").then((a) => a.i);
|
|
7734
7734
|
r = s;
|
|
7735
7735
|
} catch {
|
|
7736
7736
|
throw new Error("To use QR modal, please install @walletconnect/modal package");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ge=require("./events-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ge=require("./events-B2ZyXE4l.js"),J=require("./index-CEovIwuS.js"),T=require("./index-CVaT6qZW.js"),I=require("./index-ByOoS9NO.js");var ne={};Object.defineProperty(ne,"__esModule",{value:!0});ne.getLocalStorage=ne.getLocalStorageOrThrow=ne.getCrypto=ne.getCryptoOrThrow=ne.getLocation=ne.getLocationOrThrow=ne.getNavigator=ne.getNavigatorOrThrow=ne.getDocument=ne.getDocumentOrThrow=ne.getFromWindowOrThrow=ne.getFromWindow=void 0;function or(o){let t;return typeof window<"u"&&typeof window[o]<"u"&&(t=window[o]),t}ne.getFromWindow=or;function $r(o){const t=or(o);if(!t)throw new Error(`${o} is not defined in Window`);return t}ne.getFromWindowOrThrow=$r;function ew(){return $r("document")}ne.getDocumentOrThrow=ew;function tw(){return or("document")}ne.getDocument=tw;function rw(){return $r("navigator")}ne.getNavigatorOrThrow=rw;function iw(){return or("navigator")}ne.getNavigator=iw;function sw(){return $r("location")}ne.getLocationOrThrow=sw;function nw(){return or("location")}ne.getLocation=nw;function ow(){return $r("crypto")}ne.getCryptoOrThrow=ow;function aw(){return or("crypto")}ne.getCrypto=aw;function cw(){return $r("localStorage")}ne.getLocalStorageOrThrow=cw;function uw(){return or("localStorage")}ne.getLocalStorage=uw;var bo={};Object.defineProperty(bo,"__esModule",{value:!0});bo.getWindowMetadata=void 0;const pu=ne;function hw(){let o,t;try{o=pu.getDocumentOrThrow(),t=pu.getLocationOrThrow()}catch{return null}function r(){const O=o.getElementsByTagName("link"),N=[];for(let q=0;q<O.length;q++){const D=O[q],B=D.getAttribute("rel");if(B&&B.toLowerCase().indexOf("icon")>-1){const F=D.getAttribute("href");if(F)if(F.toLowerCase().indexOf("https:")===-1&&F.toLowerCase().indexOf("http:")===-1&&F.indexOf("//")!==0){let G=t.protocol+"//"+t.host;if(F.indexOf("/")===0)G+=F;else{const de=t.pathname.split("/");de.pop();const Z=de.join("/");G+=Z+"/"+F}N.push(G)}else if(F.indexOf("//")===0){const G=t.protocol+F;N.push(G)}else N.push(F)}}return N}function s(...O){const N=o.getElementsByTagName("meta");for(let q=0;q<N.length;q++){const D=N[q],B=["itemprop","property","name"].map(F=>D.getAttribute(F)).filter(F=>F?O.includes(F):!1);if(B.length&&B){const F=D.getAttribute("content");if(F)return F}}return""}function a(){let O=s("name","og:site_name","og:title","twitter:title");return O||(O=o.title),O}function u(){return s("description","og:description","twitter:description","keywords")}const l=a(),g=u(),w=t.origin,b=r();return{description:g,url:w,icons:b,name:l}}bo.getWindowMetadata=hw;function lw(o,t=[]){const r=[];return Object.keys(o).forEach(s=>{if(t.length&&!t.includes(s))return;const a=o[s];r.push(...a.accounts)}),r}const pw={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}};function dw(o,t){const{message:r,code:s}=pw[o];return{message:r,code:s}}function co(o,t){return!!Array.isArray(o)}var Ar={};/*! *****************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -43,4 +43,4 @@ __p += '`),Y&&(R+=`' +
|
|
|
43
43
|
function print() { __p += __j.call(arguments, '') }
|
|
44
44
|
`:`;
|
|
45
45
|
`)+R+`return __p
|
|
46
|
-
}`;var V=uu(function(){return ee(d,j+"return "+R).apply(r,f)});if(V.source=R,Un(V))throw V;return V}function am(e){return te(e).toLowerCase()}function cm(e){return te(e).toUpperCase()}function um(e,i,n){if(e=te(e),e&&(n||i===r))return ma(e);if(!e||!(i=Ve(i)))return e;var c=at(e),h=at(i),d=wa(c,h),f=_a(c,h)+1;return kt(c,d,f).join("")}function hm(e,i,n){if(e=te(e),e&&(n||i===r))return e.slice(0,Ea(e)+1);if(!e||!(i=Ve(i)))return e;var c=at(e),h=_a(c,at(i))+1;return kt(c,0,h).join("")}function lm(e,i,n){if(e=te(e),e&&(n||i===r))return e.replace(qs,"");if(!e||!(i=Ve(i)))return e;var c=at(e),h=wa(c,at(i));return kt(c,h).join("")}function pm(e,i){var n=sl,c=nl;if(le(i)){var h="separator"in i?i.separator:h;n="length"in i?H(i.length):n,c="omission"in i?Ve(i.omission):c}e=te(e);var d=e.length;if(fr(e)){var f=at(e);d=f.length}if(n>=d)return e;var y=n-gr(c);if(y<1)return c;var m=f?kt(f,0,y).join(""):e.slice(0,y);if(h===r)return m+c;if(f&&(y+=m.length-y),Mn(h)){if(e.slice(y).search(h)){var P,S=m;for(h.global||(h=en(h.source,te(Lo.exec(h))+"g")),h.lastIndex=0;P=h.exec(S);)var R=P.index;m=m.slice(0,R===r?y:R)}}else if(e.indexOf(Ve(h),y)!=y){var A=m.lastIndexOf(h);A>-1&&(m=m.slice(0,A))}return m+c}function dm(e){return e=te(e),e&&Il.test(e)?e.replace(qo,kp):e}var fm=Er(function(e,i,n){return e+(n?" ":"")+i.toUpperCase()}),zn=hc("toUpperCase");function cu(e,i,n){return e=te(e),i=n?r:i,i===r?jp(e)?Vp(e):Rp(e):e.match(i)||[]}var uu=K(function(e,i){try{return ze(e,r,i)}catch(n){return Un(n)?n:new k(n)}}),gm=It(function(e,i){return Ye(i,function(n){n=yt(n),bt(e,n,jn(e[n],e))}),e});function ym(e){var i=e==null?0:e.length,n=U();return e=i?ue(e,function(c){if(typeof c[1]!="function")throw new Ze(l);return[n(c[0]),c[1]]}):[],K(function(c){for(var h=-1;++h<i;){var d=e[h];if(ze(d[0],this,c))return ze(d[1],this,c)}})}function vm(e){return kd(et(e,O))}function Hn(e){return function(){return e}}function mm(e,i){return e==null||e!==e?i:e}var wm=pc(),_m=pc(!0);function Ue(e){return e}function Vn(e){return za(typeof e=="function"?e:et(e,O))}function bm(e){return Va(et(e,O))}function Em(e,i){return Ba(e,et(i,O))}var Im=K(function(e,i){return function(n){return Yr(n,e,i)}}),Pm=K(function(e,i){return function(n){return Yr(e,n,i)}});function Bn(e,i,n){var c=be(i),h=Ki(i,c);n==null&&!(le(i)&&(h.length||!c.length))&&(n=i,i=e,e=this,h=Ki(i,be(i)));var d=!(le(n)&&"chain"in n)||!!n.chain,f=St(e);return Ye(h,function(y){var m=i[y];e[y]=m,f&&(e.prototype[y]=function(){var P=this.__chain__;if(d||P){var S=e(this.__wrapped__),R=S.__actions__=Fe(this.__actions__);return R.push({func:m,args:arguments,thisArg:e}),S.__chain__=P,S}return m.apply(e,Ft([this.value()],arguments))})}),e}function Sm(){return Ie._===this&&(Ie._=Qp),this}function Kn(){}function Om(e){return e=H(e),K(function(i){return Ka(i,e)})}var Rm=In(ue),Nm=In(da),Cm=In(Ws);function hu(e){return $n(e)?Js(yt(e)):nf(e)}function $m(e){return function(i){return e==null?r:Xt(e,i)}}var Am=fc(),Tm=fc(!0);function Wn(){return[]}function Jn(){return!1}function xm(){return{}}function Dm(){return""}function Fm(){return!0}function jm(e,i){if(e=H(e),e<1||e>xt)return[];var n=dt,c=Oe(e,dt);i=U(i),e-=dt;for(var h=Ys(c,i);++n<e;)i(n);return h}function qm(e){return z(e)?ue(e,yt):Be(e)?[e]:Fe($c(te(e)))}function Um(e){var i=++Jp;return te(e)+i}var Mm=Zi(function(e,i){return e+i},0),Lm=Pn("ceil"),km=Zi(function(e,i){return e/i},1),zm=Pn("floor");function Hm(e){return e&&e.length?Bi(e,Ue,un):r}function Vm(e,i){return e&&e.length?Bi(e,U(i,2),un):r}function Bm(e){return ya(e,Ue)}function Km(e,i){return ya(e,U(i,2))}function Wm(e){return e&&e.length?Bi(e,Ue,dn):r}function Jm(e,i){return e&&e.length?Bi(e,U(i,2),dn):r}var Gm=Zi(function(e,i){return e*i},1),Qm=Pn("round"),Ym=Zi(function(e,i){return e-i},0);function Zm(e){return e&&e.length?Qs(e,Ue):0}function Xm(e,i){return e&&e.length?Qs(e,U(i,2)):0}return p.after=by,p.ary=kc,p.assign=cv,p.assignIn=tu,p.assignInWith=ls,p.assignWith=uv,p.at=hv,p.before=zc,p.bind=jn,p.bindAll=gm,p.bindKey=Hc,p.castArray=xy,p.chain=Uc,p.chunk=zf,p.compact=Hf,p.concat=Vf,p.cond=ym,p.conforms=vm,p.constant=Hn,p.countBy=Zg,p.create=lv,p.curry=Vc,p.curryRight=Bc,p.debounce=Kc,p.defaults=pv,p.defaultsDeep=dv,p.defer=Ey,p.delay=Iy,p.difference=Bf,p.differenceBy=Kf,p.differenceWith=Wf,p.drop=Jf,p.dropRight=Gf,p.dropRightWhile=Qf,p.dropWhile=Yf,p.fill=Zf,p.filter=ey,p.flatMap=iy,p.flatMapDeep=sy,p.flatMapDepth=ny,p.flatten=Dc,p.flattenDeep=Xf,p.flattenDepth=eg,p.flip=Py,p.flow=wm,p.flowRight=_m,p.fromPairs=tg,p.functions=_v,p.functionsIn=bv,p.groupBy=oy,p.initial=ig,p.intersection=sg,p.intersectionBy=ng,p.intersectionWith=og,p.invert=Iv,p.invertBy=Pv,p.invokeMap=cy,p.iteratee=Vn,p.keyBy=uy,p.keys=be,p.keysIn=qe,p.map=ns,p.mapKeys=Ov,p.mapValues=Rv,p.matches=bm,p.matchesProperty=Em,p.memoize=as,p.merge=Nv,p.mergeWith=ru,p.method=Im,p.methodOf=Pm,p.mixin=Bn,p.negate=cs,p.nthArg=Om,p.omit=Cv,p.omitBy=$v,p.once=Sy,p.orderBy=hy,p.over=Rm,p.overArgs=Oy,p.overEvery=Nm,p.overSome=Cm,p.partial=qn,p.partialRight=Wc,p.partition=ly,p.pick=Av,p.pickBy=iu,p.property=hu,p.propertyOf=$m,p.pull=hg,p.pullAll=jc,p.pullAllBy=lg,p.pullAllWith=pg,p.pullAt=dg,p.range=Am,p.rangeRight=Tm,p.rearg=Ry,p.reject=fy,p.remove=fg,p.rest=Ny,p.reverse=Dn,p.sampleSize=yy,p.set=xv,p.setWith=Dv,p.shuffle=vy,p.slice=gg,p.sortBy=_y,p.sortedUniq=Eg,p.sortedUniqBy=Ig,p.split=im,p.spread=Cy,p.tail=Pg,p.take=Sg,p.takeRight=Og,p.takeRightWhile=Rg,p.takeWhile=Ng,p.tap=Hg,p.throttle=$y,p.thru=ss,p.toArray=Zc,p.toPairs=su,p.toPairsIn=nu,p.toPath=qm,p.toPlainObject=eu,p.transform=Fv,p.unary=Ay,p.union=Cg,p.unionBy=$g,p.unionWith=Ag,p.uniq=Tg,p.uniqBy=xg,p.uniqWith=Dg,p.unset=jv,p.unzip=Fn,p.unzipWith=qc,p.update=qv,p.updateWith=Uv,p.values=Sr,p.valuesIn=Mv,p.without=Fg,p.words=cu,p.wrap=Ty,p.xor=jg,p.xorBy=qg,p.xorWith=Ug,p.zip=Mg,p.zipObject=Lg,p.zipObjectDeep=kg,p.zipWith=zg,p.entries=su,p.entriesIn=nu,p.extend=tu,p.extendWith=ls,Bn(p,p),p.add=Mm,p.attempt=uu,p.camelCase=Hv,p.capitalize=ou,p.ceil=Lm,p.clamp=Lv,p.clone=Dy,p.cloneDeep=jy,p.cloneDeepWith=qy,p.cloneWith=Fy,p.conformsTo=Uy,p.deburr=au,p.defaultTo=mm,p.divide=km,p.endsWith=Vv,p.eq=ut,p.escape=Bv,p.escapeRegExp=Kv,p.every=Xg,p.find=ty,p.findIndex=Tc,p.findKey=fv,p.findLast=ry,p.findLastIndex=xc,p.findLastKey=gv,p.floor=zm,p.forEach=Mc,p.forEachRight=Lc,p.forIn=yv,p.forInRight=vv,p.forOwn=mv,p.forOwnRight=wv,p.get=Ln,p.gt=My,p.gte=Ly,p.has=Ev,p.hasIn=kn,p.head=Fc,p.identity=Ue,p.includes=ay,p.indexOf=rg,p.inRange=kv,p.invoke=Sv,p.isArguments=rr,p.isArray=z,p.isArrayBuffer=ky,p.isArrayLike=je,p.isArrayLikeObject=ge,p.isBoolean=zy,p.isBuffer=zt,p.isDate=Hy,p.isElement=Vy,p.isEmpty=By,p.isEqual=Ky,p.isEqualWith=Wy,p.isError=Un,p.isFinite=Jy,p.isFunction=St,p.isInteger=Jc,p.isLength=us,p.isMap=Gc,p.isMatch=Gy,p.isMatchWith=Qy,p.isNaN=Yy,p.isNative=Zy,p.isNil=ev,p.isNull=Xy,p.isNumber=Qc,p.isObject=le,p.isObjectLike=pe,p.isPlainObject=ii,p.isRegExp=Mn,p.isSafeInteger=tv,p.isSet=Yc,p.isString=hs,p.isSymbol=Be,p.isTypedArray=Pr,p.isUndefined=rv,p.isWeakMap=iv,p.isWeakSet=sv,p.join=ag,p.kebabCase=Wv,p.last=rt,p.lastIndexOf=cg,p.lowerCase=Jv,p.lowerFirst=Gv,p.lt=nv,p.lte=ov,p.max=Hm,p.maxBy=Vm,p.mean=Bm,p.meanBy=Km,p.min=Wm,p.minBy=Jm,p.stubArray=Wn,p.stubFalse=Jn,p.stubObject=xm,p.stubString=Dm,p.stubTrue=Fm,p.multiply=Gm,p.nth=ug,p.noConflict=Sm,p.noop=Kn,p.now=os,p.pad=Qv,p.padEnd=Yv,p.padStart=Zv,p.parseInt=Xv,p.random=zv,p.reduce=py,p.reduceRight=dy,p.repeat=em,p.replace=tm,p.result=Tv,p.round=Qm,p.runInContext=v,p.sample=gy,p.size=my,p.snakeCase=rm,p.some=wy,p.sortedIndex=yg,p.sortedIndexBy=vg,p.sortedIndexOf=mg,p.sortedLastIndex=wg,p.sortedLastIndexBy=_g,p.sortedLastIndexOf=bg,p.startCase=sm,p.startsWith=nm,p.subtract=Ym,p.sum=Zm,p.sumBy=Xm,p.template=om,p.times=jm,p.toFinite=Ot,p.toInteger=H,p.toLength=Xc,p.toLower=am,p.toNumber=it,p.toSafeInteger=av,p.toString=te,p.toUpper=cm,p.trim=um,p.trimEnd=hm,p.trimStart=lm,p.truncate=pm,p.unescape=dm,p.uniqueId=Um,p.upperCase=fm,p.upperFirst=zn,p.each=Mc,p.eachRight=Lc,p.first=Fc,Bn(p,function(){var e={};return ft(p,function(i,n){re.call(p.prototype,n)||(e[n]=i)}),e}(),{chain:!1}),p.VERSION=s,Ye(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){p[e].placeholder=p}),Ye(["drop","take"],function(e,i){Q.prototype[e]=function(n){n=n===r?1:_e(H(n),0);var c=this.__filtered__&&!i?new Q(this):this.clone();return c.__filtered__?c.__takeCount__=Oe(n,c.__takeCount__):c.__views__.push({size:Oe(n,dt),type:e+(c.__dir__<0?"Right":"")}),c},Q.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Ye(["filter","map","takeWhile"],function(e,i){var n=i+1,c=n==Do||n==ul;Q.prototype[e]=function(h){var d=this.clone();return d.__iteratees__.push({iteratee:U(h,3),type:n}),d.__filtered__=d.__filtered__||c,d}}),Ye(["head","last"],function(e,i){var n="take"+(i?"Right":"");Q.prototype[e]=function(){return this[n](1).value()[0]}}),Ye(["initial","tail"],function(e,i){var n="drop"+(i?"":"Right");Q.prototype[e]=function(){return this.__filtered__?new Q(this):this[n](1)}}),Q.prototype.compact=function(){return this.filter(Ue)},Q.prototype.find=function(e){return this.filter(e).head()},Q.prototype.findLast=function(e){return this.reverse().find(e)},Q.prototype.invokeMap=K(function(e,i){return typeof e=="function"?new Q(this):this.map(function(n){return Yr(n,e,i)})}),Q.prototype.reject=function(e){return this.filter(cs(U(e)))},Q.prototype.slice=function(e,i){e=H(e);var n=this;return n.__filtered__&&(e>0||i<0)?new Q(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),i!==r&&(i=H(i),n=i<0?n.dropRight(-i):n.take(i-e)),n)},Q.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Q.prototype.toArray=function(){return this.take(dt)},ft(Q.prototype,function(e,i){var n=/^(?:filter|find|map|reject)|While$/.test(i),c=/^(?:head|last)$/.test(i),h=p[c?"take"+(i=="last"?"Right":""):i],d=c||/^find/.test(i);h&&(p.prototype[i]=function(){var f=this.__wrapped__,y=c?[1]:arguments,m=f instanceof Q,P=y[0],S=m||z(f),R=function(W){var Y=h.apply(p,Ft([W],y));return c&&A?Y[0]:Y};S&&n&&typeof P=="function"&&P.length!=1&&(m=S=!1);var A=this.__chain__,j=!!this.__actions__.length,M=d&&!A,V=m&&!j;if(!d&&S){f=V?f:new Q(this);var L=e.apply(f,y);return L.__actions__.push({func:ss,args:[R],thisArg:r}),new Xe(L,A)}return M&&V?e.apply(this,y):(L=this.thru(R),M?c?L.value()[0]:L.value():L)})}),Ye(["pop","push","shift","sort","splice","unshift"],function(e){var i=$i[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",c=/^(?:pop|shift)$/.test(e);p.prototype[e]=function(){var h=arguments;if(c&&!this.__chain__){var d=this.value();return i.apply(z(d)?d:[],h)}return this[n](function(f){return i.apply(z(f)?f:[],h)})}}),ft(Q.prototype,function(e,i){var n=p[i];if(n){var c=n.name+"";re.call(wr,c)||(wr[c]=[]),wr[c].push({name:i,func:n})}}),wr[Yi(r,G).name]=[{name:"wrapper",func:r}],Q.prototype.clone=pd,Q.prototype.reverse=dd,Q.prototype.value=fd,p.prototype.at=Vg,p.prototype.chain=Bg,p.prototype.commit=Kg,p.prototype.next=Wg,p.prototype.plant=Gg,p.prototype.reverse=Qg,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=Yg,p.prototype.first=p.prototype.head,Vr&&(p.prototype[Vr]=Jg),p},yr=Bp();Jt?((Jt.exports=yr)._=yr,Hs._=yr):Ie._=yr}).call(hi)})(_o,_o.exports);var YE=Object.defineProperty,ZE=Object.defineProperties,XE=Object.getOwnPropertyDescriptors,ph=Object.getOwnPropertySymbols,eI=Object.prototype.hasOwnProperty,tI=Object.prototype.propertyIsEnumerable,dh=(o,t,r)=>t in o?YE(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,fs=(o,t)=>{for(var r in t||(t={}))eI.call(t,r)&&dh(o,r,t[r]);if(ph)for(var r of ph(t))tI.call(t,r)&&dh(o,r,t[r]);return o},rI=(o,t)=>ZE(o,XE(t));function Bt(o,t,r){var s;const a=R0(o);return((s=t.rpcMap)==null?void 0:s[a.reference])||`${QE}?chainId=${a.namespace}:${a.reference}&projectId=${r}`}function ur(o){return o.includes(":")?o.split(":")[1]:o}function el(o){return o.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function iI(o,t){const r=Object.keys(t.namespaces).filter(a=>a.includes(o));if(!r.length)return[];const s=[];return r.forEach(a=>{const u=t.namespaces[a].accounts;s.push(...u)}),s}function sI(o={},t={}){const r=fh(o),s=fh(t);return _o.exports.merge(r,s)}function fh(o){var t,r,s,a;const u={};if(!Cr(o))return u;for(const[l,g]of Object.entries(o)){const w=No(l)?[l]:g.chains,b=g.methods||[],C=g.events||[],O=g.rpcMap||{},N=li(l);u[N]=rI(fs(fs({},u[N]),g),{chains:Yn(w,(t=u[N])==null?void 0:t.chains),methods:Yn(b,(r=u[N])==null?void 0:r.methods),events:Yn(C,(s=u[N])==null?void 0:s.events),rpcMap:fs(fs({},O),(a=u[N])==null?void 0:a.rpcMap)})}return u}function nI(o){return o.includes(":")?o.split(":")[2]:o}function oI(o){const t={};for(const[r,s]of Object.entries(o)){const a=s.methods||[],u=s.events||[],l=s.accounts||[],g=No(r)?[r]:s.chains?s.chains:el(s.accounts);t[r]={chains:g,methods:a,events:u,accounts:l}}return t}function so(o){return typeof o=="number"?o:o.includes("0x")?parseInt(o,16):o.includes(":")?Number(o.split(":")[1]):Number(o)}const tl={},he=o=>tl[o],no=(o,t)=>{tl[o]=t};class aI{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=ur(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class cI{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(parseInt(t),r),this.chainId=parseInt(t),this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,r){const s=r||Bt(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=parseInt(ur(r));t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}async handleSwitchChain(t){var r,s;let a=t.request.params?(r=t.request.params[0])==null?void 0:r.chainId:"0x0";a=a.startsWith("0x")?a:`0x${a}`;const u=parseInt(a,16);if(this.isChainApproved(u))this.setDefaultChain(`${u}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:a}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${u}`);else throw new Error(`Failed to switch to chain 'eip155:${u}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}}class uI{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=ur(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class hI{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=ur(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class lI{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{const s=this.getCardanoRPCUrl(r),a=ur(r);t[a]=this.createHttpProvider(a,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}getCardanoRPCUrl(t){const r=this.namespace.rpcMap;if(r)return r[t]}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class pI{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=ur(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class dI{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=ur(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class fI{constructor(t){this.name="near",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){if(this.chainId=t,!this.httpProviders[t]){const s=r||Bt(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;t[r]=this.createHttpProvider(r,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace);return typeof s>"u"?void 0:new $t(new Kt(s,he("disableProviderPing")))}}var gI=Object.defineProperty,yI=Object.defineProperties,vI=Object.getOwnPropertyDescriptors,gh=Object.getOwnPropertySymbols,mI=Object.prototype.hasOwnProperty,wI=Object.prototype.propertyIsEnumerable,yh=(o,t,r)=>t in o?gI(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,gs=(o,t)=>{for(var r in t||(t={}))mI.call(t,r)&&yh(o,r,t[r]);if(gh)for(var r of gh(t))wI.call(t,r)&&yh(o,r,t[r]);return o},oo=(o,t)=>yI(o,vI(t));class xo{constructor(t){this.events=new Ge.es,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:I.qt(I.k({level:(t==null?void 0:t.logger)||hh})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const r=new xo(t);return await r.initialize(),r}async request(t,r){const[s,a]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:gs({},t),chainId:`${s}:${a}`,topic:this.session.topic})}sendAsync(t,r,s){const a=new Date().getTime();this.request(t,s).then(u=>r(null,I.formatJsonRpcResult(a,u))).catch(u=>r(u,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 t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:ve("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}removeListener(t,r){this.events.removeListener(t,r)}off(t,r){this.events.off(t,r)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:s,approval:a}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});s&&(this.uri=s,this.events.emit("display_uri",s)),await a().then(u=>{this.session=u,this.namespaces||(this.namespaces=oI(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==Zh)throw u;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[s,a]=this.validateChain(t);this.getProvider(s).setDefaultChain(a,r)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(nr(r)){for(const s of r)t.deletePairings?this.client.core.expirer.set(s.topic,0):await this.client.core.relayer.subscriber.unsubscribe(s.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await jE.init({logger:this.providerOpts.logger||hh,relayUrl:this.providerOpts.relayUrl||WE,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),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 t=[...new Set(Object.keys(this.session.namespaces).map(r=>li(r)))];no("client",this.client),no("events",this.events),no("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const s=iI(r,this.session),a=el(s),u=sI(this.namespaces,this.optionalNamespaces),l=oo(gs({},u[r]),{accounts:s,chains:a});switch(r){case"eip155":this.rpcProviders[r]=new cI({namespace:l});break;case"solana":this.rpcProviders[r]=new uI({namespace:l});break;case"cosmos":this.rpcProviders[r]=new hI({namespace:l});break;case"polkadot":this.rpcProviders[r]=new aI({namespace:l});break;case"cip34":this.rpcProviders[r]=new lI({namespace:l});break;case"elrond":this.rpcProviders[r]=new pI({namespace:l});break;case"multiversx":this.rpcProviders[r]=new dI({namespace:l});break;case"near":this.rpcProviders[r]=new fI({namespace:l});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:r}=t,{event:s}=r;if(s.name==="accountsChanged"){const a=s.data;a&&nr(a)&&this.events.emit("accountsChanged",a.map(nI))}else if(s.name==="chainChanged"){const a=r.chainId,u=r.event.data,l=li(a),g=so(a)!==so(u)?`${l}:${so(u)}`:a;this.onChainChanged(g)}else this.events.emit(s.name,s.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:r})=>{var s;const{namespaces:a}=r,u=(s=this.client)==null?void 0:s.session.get(t);this.session=oo(gs({},u),{namespaces:a}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:r})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",oo(gs({},ve("USER_DISCONNECTED")),{data:t.topic}))}),this.on(At.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var r;this.getProvider(t).updateNamespace((r=this.session)==null?void 0:r.namespaces[t])})}setNamespaces(t){const{namespaces:r,optionalNamespaces:s,sessionProperties:a}=t;r&&Object.keys(r).length&&(this.namespaces=r),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=a,this.persist("namespaces",r),this.persist("optionalNamespaces",s)}validateChain(t){const[r,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,s];if(r&&!Object.keys(this.namespaces||{}).map(l=>li(l)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&s)return[r,s];const a=li(Object.keys(this.namespaces)[0]),u=this.rpcProviders[a].getDefaultChain();return[a,u]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){var s;if(!this.namespaces)return;const[a,u]=this.validateChain(t);r||this.getProvider(a).setDefaultChain(u),((s=this.namespaces[a])!=null?s:this.namespaces[`${a}:${u}`]).defaultChain=u,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",u)}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(t,r){this.client.core.storage.setItem(`${lh}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${lh}/${t}`)}}const _I=xo,bI="wc",EI="ethereum_provider",II=`${bI}@2:${EI}:`,PI="https://rpc.walletconnect.com/v1/",_s=["eth_sendTransaction","personal_sign"],rl=["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"],bs=["chainChanged","accountsChanged"],il=["chainChanged","accountsChanged","message","disconnect","connect"];var SI=Object.defineProperty,OI=Object.defineProperties,RI=Object.getOwnPropertyDescriptors,vh=Object.getOwnPropertySymbols,NI=Object.prototype.hasOwnProperty,CI=Object.prototype.propertyIsEnumerable,mh=(o,t,r)=>t in o?SI(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,di=(o,t)=>{for(var r in t||(t={}))NI.call(t,r)&&mh(o,r,t[r]);if(vh)for(var r of vh(t))CI.call(t,r)&&mh(o,r,t[r]);return o},wh=(o,t)=>OI(o,RI(t));function Es(o){return Number(o[0].split(":")[1])}function ao(o){return`0x${o.toString(16)}`}function $I(o){const{chains:t,optionalChains:r,methods:s,optionalMethods:a,events:u,optionalEvents:l,rpcMap:g}=o;if(!co(t))throw new Error("Invalid chains");const w={chains:t,methods:s||_s,events:u||bs,rpcMap:di({},t.length?{[Es(t)]:g[Es(t)]}:{})},b=u==null?void 0:u.filter(q=>!bs.includes(q)),C=s==null?void 0:s.filter(q=>!_s.includes(q));if(!r&&!l&&!a&&!(b!=null&&b.length)&&!(C!=null&&C.length))return{required:t.length?w:void 0};const O=(b==null?void 0:b.length)&&(C==null?void 0:C.length)||!r,N={chains:[...new Set(O?w.chains.concat(r||[]):r)],methods:[...new Set(w.methods.concat(a!=null&&a.length?a:rl))],events:[...new Set(w.events.concat(l!=null&&l.length?l:il))],rpcMap:g};return{required:t.length?w:void 0,optional:r.length?N:void 0}}class Os{constructor(){this.events=new Ge.eventsExports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=II,this.on=(t,r)=>(this.events.on(t,r),this),this.once=(t,r)=>(this.events.once(t,r),this),this.removeListener=(t,r)=>(this.events.removeListener(t,r),this),this.off=(t,r)=>(this.events.off(t,r),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const r=new Os;return await r.initialize(t),r}async request(t){return await this.signer.request(t,this.formatChainId(this.chainId))}sendAsync(t,r){this.signer.sendAsync(t,r,this.formatChainId(this.chainId))}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(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:r,optional:s}=$I(this.rpc);try{const a=await new Promise(async(l,g)=>{var w;this.rpc.showQrModal&&((w=this.modal)==null||w.subscribeModal(b=>{!b.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),g(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(wh(di({namespaces:di({},r&&{[this.namespace]:r})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(b=>{l(b)}).catch(b=>{g(new Error(b.message))})});if(!a)return;const u=lw(a.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:ao(this.chainId)})}catch(a){throw this.signer.logger.error(a),a}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",t=>{const{params:r}=t,{event:s}=r;s.name==="accountsChanged"?(this.accounts=this.parseAccounts(s.data),this.events.emit("accountsChanged",this.accounts)):s.name==="chainChanged"?this.setChainId(this.formatChainId(s.data)):this.events.emit(s.name,s.data),this.events.emit("session_event",t)}),this.signer.on("chainChanged",t=>{const r=parseInt(t);this.chainId=r,this.events.emit("chainChanged",ao(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",wh(di({},dw("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var r,s;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(s=this.modal)==null||s.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const r=t.filter(s=>this.isCompatibleChainId(s)).map(s=>this.parseChainId(s));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",ao(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const r=this.parseChainId(t);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(t){const[r,s,a]=t.split(":");return{chainId:`${r}:${s}`,address:a}}setAccounts(t){this.accounts=t.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var r,s;const a=(r=t==null?void 0:t.chains)!=null?r:[],u=(s=t==null?void 0:t.optionalChains)!=null?s:[],l=a.concat(u);if(!l.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const g=a.length?(t==null?void 0:t.methods)||_s:[],w=a.length?(t==null?void 0:t.events)||bs:[],b=(t==null?void 0:t.optionalMethods)||[],C=(t==null?void 0:t.optionalEvents)||[],O=(t==null?void 0:t.rpcMap)||this.buildRpcMap(l,t.projectId),N=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:a==null?void 0:a.map(q=>this.formatChainId(q)),optionalChains:u.map(q=>this.formatChainId(q)),methods:g,events:w,optionalMethods:b,optionalEvents:C,rpcMap:O,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:N,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const s={};return t.forEach(a=>{s[a]=this.getRpcUrl(a,r)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?Es(this.rpc.chains):Es(this.rpc.optionalChains),this.signer=await _I.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:s}=await Promise.resolve().then(()=>require("./index-PZbWVmCz.js")).then(a=>a.index);r=s}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(di({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(s){throw this.signer.logger.error(s),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:r,optionalChains:s,rpcMap:a}=t;r&&co(r)&&(this.rpc.chains=r.map(u=>this.formatChainId(u)),r.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)})),s&&co(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s==null?void 0:s.map(u=>this.formatChainId(u)),s.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)}))}getRpcUrl(t,r){var s;return((s=this.rpc.rpcMap)==null?void 0:s[t])||`${PI}?chainId=eip155:${t}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(r=>this.parseAccount(r))}}const AI=Os;exports.EthereumProvider=AI;exports.OPTIONAL_EVENTS=il;exports.OPTIONAL_METHODS=rl;exports.REQUIRED_EVENTS=bs;exports.REQUIRED_METHODS=_s;exports.default=Os;
|
|
46
|
+
}`;var V=uu(function(){return ee(d,j+"return "+R).apply(r,f)});if(V.source=R,Un(V))throw V;return V}function am(e){return te(e).toLowerCase()}function cm(e){return te(e).toUpperCase()}function um(e,i,n){if(e=te(e),e&&(n||i===r))return ma(e);if(!e||!(i=Ve(i)))return e;var c=at(e),h=at(i),d=wa(c,h),f=_a(c,h)+1;return kt(c,d,f).join("")}function hm(e,i,n){if(e=te(e),e&&(n||i===r))return e.slice(0,Ea(e)+1);if(!e||!(i=Ve(i)))return e;var c=at(e),h=_a(c,at(i))+1;return kt(c,0,h).join("")}function lm(e,i,n){if(e=te(e),e&&(n||i===r))return e.replace(qs,"");if(!e||!(i=Ve(i)))return e;var c=at(e),h=wa(c,at(i));return kt(c,h).join("")}function pm(e,i){var n=sl,c=nl;if(le(i)){var h="separator"in i?i.separator:h;n="length"in i?H(i.length):n,c="omission"in i?Ve(i.omission):c}e=te(e);var d=e.length;if(fr(e)){var f=at(e);d=f.length}if(n>=d)return e;var y=n-gr(c);if(y<1)return c;var m=f?kt(f,0,y).join(""):e.slice(0,y);if(h===r)return m+c;if(f&&(y+=m.length-y),Mn(h)){if(e.slice(y).search(h)){var P,S=m;for(h.global||(h=en(h.source,te(Lo.exec(h))+"g")),h.lastIndex=0;P=h.exec(S);)var R=P.index;m=m.slice(0,R===r?y:R)}}else if(e.indexOf(Ve(h),y)!=y){var A=m.lastIndexOf(h);A>-1&&(m=m.slice(0,A))}return m+c}function dm(e){return e=te(e),e&&Il.test(e)?e.replace(qo,kp):e}var fm=Er(function(e,i,n){return e+(n?" ":"")+i.toUpperCase()}),zn=hc("toUpperCase");function cu(e,i,n){return e=te(e),i=n?r:i,i===r?jp(e)?Vp(e):Rp(e):e.match(i)||[]}var uu=K(function(e,i){try{return ze(e,r,i)}catch(n){return Un(n)?n:new k(n)}}),gm=It(function(e,i){return Ye(i,function(n){n=yt(n),bt(e,n,jn(e[n],e))}),e});function ym(e){var i=e==null?0:e.length,n=U();return e=i?ue(e,function(c){if(typeof c[1]!="function")throw new Ze(l);return[n(c[0]),c[1]]}):[],K(function(c){for(var h=-1;++h<i;){var d=e[h];if(ze(d[0],this,c))return ze(d[1],this,c)}})}function vm(e){return kd(et(e,O))}function Hn(e){return function(){return e}}function mm(e,i){return e==null||e!==e?i:e}var wm=pc(),_m=pc(!0);function Ue(e){return e}function Vn(e){return za(typeof e=="function"?e:et(e,O))}function bm(e){return Va(et(e,O))}function Em(e,i){return Ba(e,et(i,O))}var Im=K(function(e,i){return function(n){return Yr(n,e,i)}}),Pm=K(function(e,i){return function(n){return Yr(e,n,i)}});function Bn(e,i,n){var c=be(i),h=Ki(i,c);n==null&&!(le(i)&&(h.length||!c.length))&&(n=i,i=e,e=this,h=Ki(i,be(i)));var d=!(le(n)&&"chain"in n)||!!n.chain,f=St(e);return Ye(h,function(y){var m=i[y];e[y]=m,f&&(e.prototype[y]=function(){var P=this.__chain__;if(d||P){var S=e(this.__wrapped__),R=S.__actions__=Fe(this.__actions__);return R.push({func:m,args:arguments,thisArg:e}),S.__chain__=P,S}return m.apply(e,Ft([this.value()],arguments))})}),e}function Sm(){return Ie._===this&&(Ie._=Qp),this}function Kn(){}function Om(e){return e=H(e),K(function(i){return Ka(i,e)})}var Rm=In(ue),Nm=In(da),Cm=In(Ws);function hu(e){return $n(e)?Js(yt(e)):nf(e)}function $m(e){return function(i){return e==null?r:Xt(e,i)}}var Am=fc(),Tm=fc(!0);function Wn(){return[]}function Jn(){return!1}function xm(){return{}}function Dm(){return""}function Fm(){return!0}function jm(e,i){if(e=H(e),e<1||e>xt)return[];var n=dt,c=Oe(e,dt);i=U(i),e-=dt;for(var h=Ys(c,i);++n<e;)i(n);return h}function qm(e){return z(e)?ue(e,yt):Be(e)?[e]:Fe($c(te(e)))}function Um(e){var i=++Jp;return te(e)+i}var Mm=Zi(function(e,i){return e+i},0),Lm=Pn("ceil"),km=Zi(function(e,i){return e/i},1),zm=Pn("floor");function Hm(e){return e&&e.length?Bi(e,Ue,un):r}function Vm(e,i){return e&&e.length?Bi(e,U(i,2),un):r}function Bm(e){return ya(e,Ue)}function Km(e,i){return ya(e,U(i,2))}function Wm(e){return e&&e.length?Bi(e,Ue,dn):r}function Jm(e,i){return e&&e.length?Bi(e,U(i,2),dn):r}var Gm=Zi(function(e,i){return e*i},1),Qm=Pn("round"),Ym=Zi(function(e,i){return e-i},0);function Zm(e){return e&&e.length?Qs(e,Ue):0}function Xm(e,i){return e&&e.length?Qs(e,U(i,2)):0}return p.after=by,p.ary=kc,p.assign=cv,p.assignIn=tu,p.assignInWith=ls,p.assignWith=uv,p.at=hv,p.before=zc,p.bind=jn,p.bindAll=gm,p.bindKey=Hc,p.castArray=xy,p.chain=Uc,p.chunk=zf,p.compact=Hf,p.concat=Vf,p.cond=ym,p.conforms=vm,p.constant=Hn,p.countBy=Zg,p.create=lv,p.curry=Vc,p.curryRight=Bc,p.debounce=Kc,p.defaults=pv,p.defaultsDeep=dv,p.defer=Ey,p.delay=Iy,p.difference=Bf,p.differenceBy=Kf,p.differenceWith=Wf,p.drop=Jf,p.dropRight=Gf,p.dropRightWhile=Qf,p.dropWhile=Yf,p.fill=Zf,p.filter=ey,p.flatMap=iy,p.flatMapDeep=sy,p.flatMapDepth=ny,p.flatten=Dc,p.flattenDeep=Xf,p.flattenDepth=eg,p.flip=Py,p.flow=wm,p.flowRight=_m,p.fromPairs=tg,p.functions=_v,p.functionsIn=bv,p.groupBy=oy,p.initial=ig,p.intersection=sg,p.intersectionBy=ng,p.intersectionWith=og,p.invert=Iv,p.invertBy=Pv,p.invokeMap=cy,p.iteratee=Vn,p.keyBy=uy,p.keys=be,p.keysIn=qe,p.map=ns,p.mapKeys=Ov,p.mapValues=Rv,p.matches=bm,p.matchesProperty=Em,p.memoize=as,p.merge=Nv,p.mergeWith=ru,p.method=Im,p.methodOf=Pm,p.mixin=Bn,p.negate=cs,p.nthArg=Om,p.omit=Cv,p.omitBy=$v,p.once=Sy,p.orderBy=hy,p.over=Rm,p.overArgs=Oy,p.overEvery=Nm,p.overSome=Cm,p.partial=qn,p.partialRight=Wc,p.partition=ly,p.pick=Av,p.pickBy=iu,p.property=hu,p.propertyOf=$m,p.pull=hg,p.pullAll=jc,p.pullAllBy=lg,p.pullAllWith=pg,p.pullAt=dg,p.range=Am,p.rangeRight=Tm,p.rearg=Ry,p.reject=fy,p.remove=fg,p.rest=Ny,p.reverse=Dn,p.sampleSize=yy,p.set=xv,p.setWith=Dv,p.shuffle=vy,p.slice=gg,p.sortBy=_y,p.sortedUniq=Eg,p.sortedUniqBy=Ig,p.split=im,p.spread=Cy,p.tail=Pg,p.take=Sg,p.takeRight=Og,p.takeRightWhile=Rg,p.takeWhile=Ng,p.tap=Hg,p.throttle=$y,p.thru=ss,p.toArray=Zc,p.toPairs=su,p.toPairsIn=nu,p.toPath=qm,p.toPlainObject=eu,p.transform=Fv,p.unary=Ay,p.union=Cg,p.unionBy=$g,p.unionWith=Ag,p.uniq=Tg,p.uniqBy=xg,p.uniqWith=Dg,p.unset=jv,p.unzip=Fn,p.unzipWith=qc,p.update=qv,p.updateWith=Uv,p.values=Sr,p.valuesIn=Mv,p.without=Fg,p.words=cu,p.wrap=Ty,p.xor=jg,p.xorBy=qg,p.xorWith=Ug,p.zip=Mg,p.zipObject=Lg,p.zipObjectDeep=kg,p.zipWith=zg,p.entries=su,p.entriesIn=nu,p.extend=tu,p.extendWith=ls,Bn(p,p),p.add=Mm,p.attempt=uu,p.camelCase=Hv,p.capitalize=ou,p.ceil=Lm,p.clamp=Lv,p.clone=Dy,p.cloneDeep=jy,p.cloneDeepWith=qy,p.cloneWith=Fy,p.conformsTo=Uy,p.deburr=au,p.defaultTo=mm,p.divide=km,p.endsWith=Vv,p.eq=ut,p.escape=Bv,p.escapeRegExp=Kv,p.every=Xg,p.find=ty,p.findIndex=Tc,p.findKey=fv,p.findLast=ry,p.findLastIndex=xc,p.findLastKey=gv,p.floor=zm,p.forEach=Mc,p.forEachRight=Lc,p.forIn=yv,p.forInRight=vv,p.forOwn=mv,p.forOwnRight=wv,p.get=Ln,p.gt=My,p.gte=Ly,p.has=Ev,p.hasIn=kn,p.head=Fc,p.identity=Ue,p.includes=ay,p.indexOf=rg,p.inRange=kv,p.invoke=Sv,p.isArguments=rr,p.isArray=z,p.isArrayBuffer=ky,p.isArrayLike=je,p.isArrayLikeObject=ge,p.isBoolean=zy,p.isBuffer=zt,p.isDate=Hy,p.isElement=Vy,p.isEmpty=By,p.isEqual=Ky,p.isEqualWith=Wy,p.isError=Un,p.isFinite=Jy,p.isFunction=St,p.isInteger=Jc,p.isLength=us,p.isMap=Gc,p.isMatch=Gy,p.isMatchWith=Qy,p.isNaN=Yy,p.isNative=Zy,p.isNil=ev,p.isNull=Xy,p.isNumber=Qc,p.isObject=le,p.isObjectLike=pe,p.isPlainObject=ii,p.isRegExp=Mn,p.isSafeInteger=tv,p.isSet=Yc,p.isString=hs,p.isSymbol=Be,p.isTypedArray=Pr,p.isUndefined=rv,p.isWeakMap=iv,p.isWeakSet=sv,p.join=ag,p.kebabCase=Wv,p.last=rt,p.lastIndexOf=cg,p.lowerCase=Jv,p.lowerFirst=Gv,p.lt=nv,p.lte=ov,p.max=Hm,p.maxBy=Vm,p.mean=Bm,p.meanBy=Km,p.min=Wm,p.minBy=Jm,p.stubArray=Wn,p.stubFalse=Jn,p.stubObject=xm,p.stubString=Dm,p.stubTrue=Fm,p.multiply=Gm,p.nth=ug,p.noConflict=Sm,p.noop=Kn,p.now=os,p.pad=Qv,p.padEnd=Yv,p.padStart=Zv,p.parseInt=Xv,p.random=zv,p.reduce=py,p.reduceRight=dy,p.repeat=em,p.replace=tm,p.result=Tv,p.round=Qm,p.runInContext=v,p.sample=gy,p.size=my,p.snakeCase=rm,p.some=wy,p.sortedIndex=yg,p.sortedIndexBy=vg,p.sortedIndexOf=mg,p.sortedLastIndex=wg,p.sortedLastIndexBy=_g,p.sortedLastIndexOf=bg,p.startCase=sm,p.startsWith=nm,p.subtract=Ym,p.sum=Zm,p.sumBy=Xm,p.template=om,p.times=jm,p.toFinite=Ot,p.toInteger=H,p.toLength=Xc,p.toLower=am,p.toNumber=it,p.toSafeInteger=av,p.toString=te,p.toUpper=cm,p.trim=um,p.trimEnd=hm,p.trimStart=lm,p.truncate=pm,p.unescape=dm,p.uniqueId=Um,p.upperCase=fm,p.upperFirst=zn,p.each=Mc,p.eachRight=Lc,p.first=Fc,Bn(p,function(){var e={};return ft(p,function(i,n){re.call(p.prototype,n)||(e[n]=i)}),e}(),{chain:!1}),p.VERSION=s,Ye(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){p[e].placeholder=p}),Ye(["drop","take"],function(e,i){Q.prototype[e]=function(n){n=n===r?1:_e(H(n),0);var c=this.__filtered__&&!i?new Q(this):this.clone();return c.__filtered__?c.__takeCount__=Oe(n,c.__takeCount__):c.__views__.push({size:Oe(n,dt),type:e+(c.__dir__<0?"Right":"")}),c},Q.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Ye(["filter","map","takeWhile"],function(e,i){var n=i+1,c=n==Do||n==ul;Q.prototype[e]=function(h){var d=this.clone();return d.__iteratees__.push({iteratee:U(h,3),type:n}),d.__filtered__=d.__filtered__||c,d}}),Ye(["head","last"],function(e,i){var n="take"+(i?"Right":"");Q.prototype[e]=function(){return this[n](1).value()[0]}}),Ye(["initial","tail"],function(e,i){var n="drop"+(i?"":"Right");Q.prototype[e]=function(){return this.__filtered__?new Q(this):this[n](1)}}),Q.prototype.compact=function(){return this.filter(Ue)},Q.prototype.find=function(e){return this.filter(e).head()},Q.prototype.findLast=function(e){return this.reverse().find(e)},Q.prototype.invokeMap=K(function(e,i){return typeof e=="function"?new Q(this):this.map(function(n){return Yr(n,e,i)})}),Q.prototype.reject=function(e){return this.filter(cs(U(e)))},Q.prototype.slice=function(e,i){e=H(e);var n=this;return n.__filtered__&&(e>0||i<0)?new Q(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),i!==r&&(i=H(i),n=i<0?n.dropRight(-i):n.take(i-e)),n)},Q.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Q.prototype.toArray=function(){return this.take(dt)},ft(Q.prototype,function(e,i){var n=/^(?:filter|find|map|reject)|While$/.test(i),c=/^(?:head|last)$/.test(i),h=p[c?"take"+(i=="last"?"Right":""):i],d=c||/^find/.test(i);h&&(p.prototype[i]=function(){var f=this.__wrapped__,y=c?[1]:arguments,m=f instanceof Q,P=y[0],S=m||z(f),R=function(W){var Y=h.apply(p,Ft([W],y));return c&&A?Y[0]:Y};S&&n&&typeof P=="function"&&P.length!=1&&(m=S=!1);var A=this.__chain__,j=!!this.__actions__.length,M=d&&!A,V=m&&!j;if(!d&&S){f=V?f:new Q(this);var L=e.apply(f,y);return L.__actions__.push({func:ss,args:[R],thisArg:r}),new Xe(L,A)}return M&&V?e.apply(this,y):(L=this.thru(R),M?c?L.value()[0]:L.value():L)})}),Ye(["pop","push","shift","sort","splice","unshift"],function(e){var i=$i[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",c=/^(?:pop|shift)$/.test(e);p.prototype[e]=function(){var h=arguments;if(c&&!this.__chain__){var d=this.value();return i.apply(z(d)?d:[],h)}return this[n](function(f){return i.apply(z(f)?f:[],h)})}}),ft(Q.prototype,function(e,i){var n=p[i];if(n){var c=n.name+"";re.call(wr,c)||(wr[c]=[]),wr[c].push({name:i,func:n})}}),wr[Yi(r,G).name]=[{name:"wrapper",func:r}],Q.prototype.clone=pd,Q.prototype.reverse=dd,Q.prototype.value=fd,p.prototype.at=Vg,p.prototype.chain=Bg,p.prototype.commit=Kg,p.prototype.next=Wg,p.prototype.plant=Gg,p.prototype.reverse=Qg,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=Yg,p.prototype.first=p.prototype.head,Vr&&(p.prototype[Vr]=Jg),p},yr=Bp();Jt?((Jt.exports=yr)._=yr,Hs._=yr):Ie._=yr}).call(hi)})(_o,_o.exports);var YE=Object.defineProperty,ZE=Object.defineProperties,XE=Object.getOwnPropertyDescriptors,ph=Object.getOwnPropertySymbols,eI=Object.prototype.hasOwnProperty,tI=Object.prototype.propertyIsEnumerable,dh=(o,t,r)=>t in o?YE(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,fs=(o,t)=>{for(var r in t||(t={}))eI.call(t,r)&&dh(o,r,t[r]);if(ph)for(var r of ph(t))tI.call(t,r)&&dh(o,r,t[r]);return o},rI=(o,t)=>ZE(o,XE(t));function Bt(o,t,r){var s;const a=R0(o);return((s=t.rpcMap)==null?void 0:s[a.reference])||`${QE}?chainId=${a.namespace}:${a.reference}&projectId=${r}`}function ur(o){return o.includes(":")?o.split(":")[1]:o}function el(o){return o.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function iI(o,t){const r=Object.keys(t.namespaces).filter(a=>a.includes(o));if(!r.length)return[];const s=[];return r.forEach(a=>{const u=t.namespaces[a].accounts;s.push(...u)}),s}function sI(o={},t={}){const r=fh(o),s=fh(t);return _o.exports.merge(r,s)}function fh(o){var t,r,s,a;const u={};if(!Cr(o))return u;for(const[l,g]of Object.entries(o)){const w=No(l)?[l]:g.chains,b=g.methods||[],C=g.events||[],O=g.rpcMap||{},N=li(l);u[N]=rI(fs(fs({},u[N]),g),{chains:Yn(w,(t=u[N])==null?void 0:t.chains),methods:Yn(b,(r=u[N])==null?void 0:r.methods),events:Yn(C,(s=u[N])==null?void 0:s.events),rpcMap:fs(fs({},O),(a=u[N])==null?void 0:a.rpcMap)})}return u}function nI(o){return o.includes(":")?o.split(":")[2]:o}function oI(o){const t={};for(const[r,s]of Object.entries(o)){const a=s.methods||[],u=s.events||[],l=s.accounts||[],g=No(r)?[r]:s.chains?s.chains:el(s.accounts);t[r]={chains:g,methods:a,events:u,accounts:l}}return t}function so(o){return typeof o=="number"?o:o.includes("0x")?parseInt(o,16):o.includes(":")?Number(o.split(":")[1]):Number(o)}const tl={},he=o=>tl[o],no=(o,t)=>{tl[o]=t};class aI{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=ur(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class cI{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(parseInt(t),r),this.chainId=parseInt(t),this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,r){const s=r||Bt(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=parseInt(ur(r));t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}async handleSwitchChain(t){var r,s;let a=t.request.params?(r=t.request.params[0])==null?void 0:r.chainId:"0x0";a=a.startsWith("0x")?a:`0x${a}`;const u=parseInt(a,16);if(this.isChainApproved(u))this.setDefaultChain(`${u}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:a}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${u}`);else throw new Error(`Failed to switch to chain 'eip155:${u}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}}class uI{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=ur(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class hI{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=ur(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class lI{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{const s=this.getCardanoRPCUrl(r),a=ur(r);t[a]=this.createHttpProvider(a,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}getCardanoRPCUrl(t){const r=this.namespace.rpcMap;if(r)return r[t]}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class pI{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=ur(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class dI{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=ur(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class fI{constructor(t){this.name="near",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){if(this.chainId=t,!this.httpProviders[t]){const s=r||Bt(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;t[r]=this.createHttpProvider(r,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace);return typeof s>"u"?void 0:new $t(new Kt(s,he("disableProviderPing")))}}var gI=Object.defineProperty,yI=Object.defineProperties,vI=Object.getOwnPropertyDescriptors,gh=Object.getOwnPropertySymbols,mI=Object.prototype.hasOwnProperty,wI=Object.prototype.propertyIsEnumerable,yh=(o,t,r)=>t in o?gI(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,gs=(o,t)=>{for(var r in t||(t={}))mI.call(t,r)&&yh(o,r,t[r]);if(gh)for(var r of gh(t))wI.call(t,r)&&yh(o,r,t[r]);return o},oo=(o,t)=>yI(o,vI(t));class xo{constructor(t){this.events=new Ge.es,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:I.qt(I.k({level:(t==null?void 0:t.logger)||hh})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const r=new xo(t);return await r.initialize(),r}async request(t,r){const[s,a]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:gs({},t),chainId:`${s}:${a}`,topic:this.session.topic})}sendAsync(t,r,s){const a=new Date().getTime();this.request(t,s).then(u=>r(null,I.formatJsonRpcResult(a,u))).catch(u=>r(u,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 t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:ve("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}removeListener(t,r){this.events.removeListener(t,r)}off(t,r){this.events.off(t,r)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:s,approval:a}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});s&&(this.uri=s,this.events.emit("display_uri",s)),await a().then(u=>{this.session=u,this.namespaces||(this.namespaces=oI(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==Zh)throw u;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[s,a]=this.validateChain(t);this.getProvider(s).setDefaultChain(a,r)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(nr(r)){for(const s of r)t.deletePairings?this.client.core.expirer.set(s.topic,0):await this.client.core.relayer.subscriber.unsubscribe(s.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await jE.init({logger:this.providerOpts.logger||hh,relayUrl:this.providerOpts.relayUrl||WE,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),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 t=[...new Set(Object.keys(this.session.namespaces).map(r=>li(r)))];no("client",this.client),no("events",this.events),no("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const s=iI(r,this.session),a=el(s),u=sI(this.namespaces,this.optionalNamespaces),l=oo(gs({},u[r]),{accounts:s,chains:a});switch(r){case"eip155":this.rpcProviders[r]=new cI({namespace:l});break;case"solana":this.rpcProviders[r]=new uI({namespace:l});break;case"cosmos":this.rpcProviders[r]=new hI({namespace:l});break;case"polkadot":this.rpcProviders[r]=new aI({namespace:l});break;case"cip34":this.rpcProviders[r]=new lI({namespace:l});break;case"elrond":this.rpcProviders[r]=new pI({namespace:l});break;case"multiversx":this.rpcProviders[r]=new dI({namespace:l});break;case"near":this.rpcProviders[r]=new fI({namespace:l});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:r}=t,{event:s}=r;if(s.name==="accountsChanged"){const a=s.data;a&&nr(a)&&this.events.emit("accountsChanged",a.map(nI))}else if(s.name==="chainChanged"){const a=r.chainId,u=r.event.data,l=li(a),g=so(a)!==so(u)?`${l}:${so(u)}`:a;this.onChainChanged(g)}else this.events.emit(s.name,s.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:r})=>{var s;const{namespaces:a}=r,u=(s=this.client)==null?void 0:s.session.get(t);this.session=oo(gs({},u),{namespaces:a}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:r})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",oo(gs({},ve("USER_DISCONNECTED")),{data:t.topic}))}),this.on(At.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var r;this.getProvider(t).updateNamespace((r=this.session)==null?void 0:r.namespaces[t])})}setNamespaces(t){const{namespaces:r,optionalNamespaces:s,sessionProperties:a}=t;r&&Object.keys(r).length&&(this.namespaces=r),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=a,this.persist("namespaces",r),this.persist("optionalNamespaces",s)}validateChain(t){const[r,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,s];if(r&&!Object.keys(this.namespaces||{}).map(l=>li(l)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&s)return[r,s];const a=li(Object.keys(this.namespaces)[0]),u=this.rpcProviders[a].getDefaultChain();return[a,u]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){var s;if(!this.namespaces)return;const[a,u]=this.validateChain(t);r||this.getProvider(a).setDefaultChain(u),((s=this.namespaces[a])!=null?s:this.namespaces[`${a}:${u}`]).defaultChain=u,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",u)}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(t,r){this.client.core.storage.setItem(`${lh}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${lh}/${t}`)}}const _I=xo,bI="wc",EI="ethereum_provider",II=`${bI}@2:${EI}:`,PI="https://rpc.walletconnect.com/v1/",_s=["eth_sendTransaction","personal_sign"],rl=["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"],bs=["chainChanged","accountsChanged"],il=["chainChanged","accountsChanged","message","disconnect","connect"];var SI=Object.defineProperty,OI=Object.defineProperties,RI=Object.getOwnPropertyDescriptors,vh=Object.getOwnPropertySymbols,NI=Object.prototype.hasOwnProperty,CI=Object.prototype.propertyIsEnumerable,mh=(o,t,r)=>t in o?SI(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,di=(o,t)=>{for(var r in t||(t={}))NI.call(t,r)&&mh(o,r,t[r]);if(vh)for(var r of vh(t))CI.call(t,r)&&mh(o,r,t[r]);return o},wh=(o,t)=>OI(o,RI(t));function Es(o){return Number(o[0].split(":")[1])}function ao(o){return`0x${o.toString(16)}`}function $I(o){const{chains:t,optionalChains:r,methods:s,optionalMethods:a,events:u,optionalEvents:l,rpcMap:g}=o;if(!co(t))throw new Error("Invalid chains");const w={chains:t,methods:s||_s,events:u||bs,rpcMap:di({},t.length?{[Es(t)]:g[Es(t)]}:{})},b=u==null?void 0:u.filter(q=>!bs.includes(q)),C=s==null?void 0:s.filter(q=>!_s.includes(q));if(!r&&!l&&!a&&!(b!=null&&b.length)&&!(C!=null&&C.length))return{required:t.length?w:void 0};const O=(b==null?void 0:b.length)&&(C==null?void 0:C.length)||!r,N={chains:[...new Set(O?w.chains.concat(r||[]):r)],methods:[...new Set(w.methods.concat(a!=null&&a.length?a:rl))],events:[...new Set(w.events.concat(l!=null&&l.length?l:il))],rpcMap:g};return{required:t.length?w:void 0,optional:r.length?N:void 0}}class Os{constructor(){this.events=new Ge.eventsExports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=II,this.on=(t,r)=>(this.events.on(t,r),this),this.once=(t,r)=>(this.events.once(t,r),this),this.removeListener=(t,r)=>(this.events.removeListener(t,r),this),this.off=(t,r)=>(this.events.off(t,r),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const r=new Os;return await r.initialize(t),r}async request(t){return await this.signer.request(t,this.formatChainId(this.chainId))}sendAsync(t,r){this.signer.sendAsync(t,r,this.formatChainId(this.chainId))}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(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:r,optional:s}=$I(this.rpc);try{const a=await new Promise(async(l,g)=>{var w;this.rpc.showQrModal&&((w=this.modal)==null||w.subscribeModal(b=>{!b.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),g(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(wh(di({namespaces:di({},r&&{[this.namespace]:r})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(b=>{l(b)}).catch(b=>{g(new Error(b.message))})});if(!a)return;const u=lw(a.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:ao(this.chainId)})}catch(a){throw this.signer.logger.error(a),a}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",t=>{const{params:r}=t,{event:s}=r;s.name==="accountsChanged"?(this.accounts=this.parseAccounts(s.data),this.events.emit("accountsChanged",this.accounts)):s.name==="chainChanged"?this.setChainId(this.formatChainId(s.data)):this.events.emit(s.name,s.data),this.events.emit("session_event",t)}),this.signer.on("chainChanged",t=>{const r=parseInt(t);this.chainId=r,this.events.emit("chainChanged",ao(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",wh(di({},dw("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var r,s;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(s=this.modal)==null||s.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const r=t.filter(s=>this.isCompatibleChainId(s)).map(s=>this.parseChainId(s));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",ao(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const r=this.parseChainId(t);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(t){const[r,s,a]=t.split(":");return{chainId:`${r}:${s}`,address:a}}setAccounts(t){this.accounts=t.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var r,s;const a=(r=t==null?void 0:t.chains)!=null?r:[],u=(s=t==null?void 0:t.optionalChains)!=null?s:[],l=a.concat(u);if(!l.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const g=a.length?(t==null?void 0:t.methods)||_s:[],w=a.length?(t==null?void 0:t.events)||bs:[],b=(t==null?void 0:t.optionalMethods)||[],C=(t==null?void 0:t.optionalEvents)||[],O=(t==null?void 0:t.rpcMap)||this.buildRpcMap(l,t.projectId),N=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:a==null?void 0:a.map(q=>this.formatChainId(q)),optionalChains:u.map(q=>this.formatChainId(q)),methods:g,events:w,optionalMethods:b,optionalEvents:C,rpcMap:O,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:N,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const s={};return t.forEach(a=>{s[a]=this.getRpcUrl(a,r)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?Es(this.rpc.chains):Es(this.rpc.optionalChains),this.signer=await _I.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:s}=await Promise.resolve().then(()=>require("./index-BJ9DGQK7.js")).then(a=>a.index);r=s}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(di({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(s){throw this.signer.logger.error(s),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:r,optionalChains:s,rpcMap:a}=t;r&&co(r)&&(this.rpc.chains=r.map(u=>this.formatChainId(u)),r.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)})),s&&co(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s==null?void 0:s.map(u=>this.formatChainId(u)),s.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)}))}getRpcUrl(t,r){var s;return((s=this.rpc.rpcMap)==null?void 0:s[t])||`${PI}?chainId=eip155:${t}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(r=>this.parseAccount(r))}}const AI=Os;exports.EthereumProvider=AI;exports.OPTIONAL_EVENTS=il;exports.OPTIONAL_METHODS=rl;exports.REQUIRED_EVENTS=bs;exports.REQUIRED_METHODS=_s;exports.default=Os;
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index-CEovIwuS.js");exports.AutomaticCCTPRoute=t.AutomaticCCTPRoute;exports.AutomaticPorticoRoute=t.AutomaticPorticoRoute;exports.AutomaticTokenBridgeRoute=t.AutomaticTokenBridgeRoute;exports.CCTPRoute=t.CCTPRoute;exports.DEFAULT_ROUTES=t.DEFAULT_ROUTES;exports.MAINNET=t.MAINNET;exports.MayanRoute=t.MayanRoute;exports.MayanRouteMCTP=t.MayanRouteMCTP;exports.MayanRouteSWIFT=t.MayanRouteSWIFT;exports.MayanRouteWH=t.MayanRouteWH;exports.TESTNET=t.TESTNET;exports.TokenBridgeRoute=t.TokenBridgeRoute;exports.buildConfig=t.buildConfig;exports.default=t.WormholeConnect;exports.nttAutomaticRoute=t.nttAutomaticRoute;exports.nttManualRoute=t.nttManualRoute;exports.nttRoutes=t.nttRoutes;exports.wormholeConnectHosted=t.wormholeConnectHosted;
|
package/lib/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dQ as o, dS as d, dO as e, dR as s, dK as u, dH as R, dT as n, dV as T, dW as i, dU as M, dI as C, dP as c, dJ as m, dG as r, dM as A, dN as E, dL as P, dX as l } from "./index-
|
|
1
|
+
import { dQ as o, dS as d, dO as e, dR as s, dK as u, dH as R, dT as n, dV as T, dW as i, dU as M, dI as C, dP as c, dJ as m, dG as r, dM as A, dN as E, dL as P, dX as l } from "./index-DWJ5r15M.mjs";
|
|
2
2
|
export {
|
|
3
3
|
o as AutomaticCCTPRoute,
|
|
4
4
|
d as AutomaticPorticoRoute,
|