@dcl/blog-site 0.2.1 → 0.2.2-23649734878.commit-de1a383
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/{add-DDmiKSFa.js → add-zf09jsz8.js} +2 -2
- package/assets/all-wallets-tVLLlnWi.js +6 -0
- package/assets/{app-store-C2QH_szq.js → app-store-C64E-ygN.js} +2 -2
- package/assets/{apple-CXj8DdVt.js → apple-B11br0RG.js} +2 -2
- package/assets/arrow-bottom-DifqQKT2.js +8 -0
- package/assets/{arrow-bottom-circle-TcBObsHz.js → arrow-bottom-circle-BYISwBN-.js} +2 -2
- package/assets/arrow-left-DTR_KHWL.js +8 -0
- package/assets/arrow-right-DU6_D0VV.js +8 -0
- package/assets/arrow-top-B_CgJVlG.js +8 -0
- package/assets/arweave-CAGvOb64.js +1 -0
- package/assets/{auto-track-BFFg9YAK.js → auto-track-BxXPoe4g.js} +1 -1
- package/assets/{bank-DWNW3eFi.js → bank-q4oLVSZ1.js} +2 -2
- package/assets/basic-CGdBHVeA.js +2121 -0
- package/assets/biconomy-6NHz5Iqa.js +1 -0
- package/assets/brotli_wasm_bg-NfWIZley.wasm +0 -0
- package/assets/{browser-B_-ItlW_.js → browser-BH_NdFte.js} +2 -2
- package/assets/browser-DZBysBvj.js +8 -0
- package/assets/{card-CILIst2o.js → card-CU8Sx8aZ.js} +2 -2
- package/assets/ccip-BfmMG-TS.js +1 -0
- package/assets/chains-BJ1WS73W.js +1 -0
- package/assets/{checkmark-DeIpEs1l.js → checkmark-CJQv14xB.js} +2 -2
- package/assets/{checkmark-bold-C_61zTYK.js → checkmark-bold-yZPChLqH.js} +2 -2
- package/assets/chevron-bottom-DTs-26Eq.js +8 -0
- package/assets/chevron-left-CWQcI0TP.js +8 -0
- package/assets/chevron-right-zjZwGM3P.js +8 -0
- package/assets/chevron-top-DiPqYm2O.js +8 -0
- package/assets/{chrome-store-C2XnnQkV.js → chrome-store-uudWD7dl.js} +2 -2
- package/assets/{clock-Bz8Zp6Co.js → clock-BtHKgq8x.js} +2 -2
- package/assets/close-C0UXp_W-.js +8 -0
- package/assets/{coinPlaceholder-DDkOYyU1.js → coinPlaceholder-4wrqCYAs.js} +2 -2
- package/assets/common-B5-2TPMC.js +1 -0
- package/assets/{compass-C8fw5jfC.js → compass-DfOzkjuQ.js} +2 -2
- package/assets/controller-zOLBxAda.js +2 -0
- package/assets/{copy-a_HfxYLy.js → copy-BDn55LjS.js} +2 -2
- package/assets/core-FalccOZQ.js +908 -0
- package/assets/createBundlerClient-ceEjCqsz.js +8 -0
- package/assets/cursor-BQJeaiqW.js +3 -0
- package/assets/{cursor-transparent-D0OfS4QP.js → cursor-transparent-B0-Mw3Y1.js} +2 -2
- package/assets/custom-welcome-background-BxlFQma9.webp +0 -0
- package/assets/decimals-BBBuCBiH.js +1 -0
- package/assets/decimals-DrdfxUxV.js +1 -0
- package/assets/{desktop-BQBasLqG.js → desktop-Cm0fPOoG.js} +2 -2
- package/assets/detectExtension-CTJS_83C.js +1 -0
- package/assets/{disconnect-DElTat18.js → disconnect-BuA91iia.js} +2 -2
- package/assets/{discord-C7fZNpsD.js → discord-CEAkeZ_H.js} +2 -2
- package/assets/engine-1bZj5J3h.js +1 -0
- package/assets/estimate-l1-fee-C9trXYSy.js +1 -0
- package/assets/eth_estimateGas-DylIsdQK.js +1 -0
- package/assets/eth_getStorageAt-D6adTFW0.js +1 -0
- package/assets/eth_getTransactionCount-BIhOSWd4.js +1 -0
- package/assets/ethereum-Bb-GI0c-.js +1 -0
- package/assets/{etherscan-BezQZOy1.js → etherscan-WCjozDmo.js} +2 -2
- package/assets/events-BSf9wyey.js +1 -0
- package/assets/{exclamation-triangle-DSs74NXb.js → exclamation-triangle-CXoNKPez.js} +1 -1
- package/assets/{extension-Drl0Yq5h.js → extension-BszEBTVU.js} +2 -2
- package/assets/external-link-Dd_ZWmsS.js +8 -0
- package/assets/extractIPFS-GqdL13gj.js +1 -0
- package/assets/{facebook-C95SplI1.js → facebook-4SsNdpO8.js} +2 -2
- package/assets/{farcaster-hgy-b3WU.js → farcaster-ayvvFuu8.js} +2 -2
- package/assets/fetchTokenMetadata-BVwYMovl.js +2 -0
- package/assets/{filters-CVfSTbCU.js → filters-CaJPoSbo.js} +2 -2
- package/assets/get-ecosystem-wallet-info-Q0K86GGt.js +1 -0
- package/assets/getBalance-B57AUVbe.js +1 -0
- package/assets/getInstalledModules-CAje9rp8.js +1 -0
- package/assets/getNFT-Bb-t59ds.js +2 -0
- package/assets/getNFT-CpvjLK0Y.js +1 -0
- package/assets/{github-_DsFpXFL.js → github-Agge6OPm.js} +2 -2
- package/assets/{google-K_hOZ0IZ.js → google-BCp2rRpD.js} +2 -2
- package/assets/hashTypedData-621x-e3F.js +1 -0
- package/assets/{help-circle-8Aiq3Vak.js → help-circle-BglhVJJg.js} +1 -1
- package/assets/{hooks.module-Dz_XB4AG.js → hooks.module-Cpp96UEK.js} +1 -1
- package/assets/{id-Co_-DHw4.js → id-DJWOh1yx.js} +1 -1
- package/assets/image--EMjkbyZ.js +1 -0
- package/assets/image--O11VYbP.js +1 -0
- package/assets/image--fcqsYch.js +1 -0
- package/assets/image-1-dOu4Yt.js +1 -0
- package/assets/image-139plIjh.js +1 -0
- package/assets/image-1epPqHV4.js +1 -0
- package/assets/image-29vwsAfI.js +1 -0
- package/assets/image-2s8lIjLJ.js +1 -0
- package/assets/image-2wmDBIB6.js +1 -0
- package/assets/image-3-p5LJAk.js +1 -0
- package/assets/image-3Q7PfsJG.js +1 -0
- package/assets/image-4bx5chOJ.js +1 -0
- package/assets/image-5CGX_QL3.js +1 -0
- package/assets/image-5QXPaavh.js +1 -0
- package/assets/image-5mReG_-1.js +1 -0
- package/assets/image-5xiz28Wo.js +1 -0
- package/assets/image-6levnvAC.js +1 -0
- package/assets/image-6ouyxZRt.js +1 -0
- package/assets/image-8DkN4eFx.js +1 -0
- package/assets/image-8LnJ1bNt.js +1 -0
- package/assets/image-8Zz6I0OH.js +1 -0
- package/assets/image-8r04P3UP.js +1 -0
- package/assets/image-8u03hBEl.js +1 -0
- package/assets/image-8vXf4Xjy.js +1 -0
- package/assets/image-9509MPsE.js +1 -0
- package/assets/image-9BTuaiXb.js +1 -0
- package/assets/image-9Jtg22X3.js +1 -0
- package/assets/image-AlOoIjkb.js +1 -0
- package/assets/image-Atwyf6cQ.js +1 -0
- package/assets/image-B-l20wIO.js +1 -0
- package/assets/image-B02ECgsY.js +1 -0
- package/assets/image-B14TCFf5.js +1 -0
- package/assets/image-B3lDLhwe.js +1 -0
- package/assets/image-B3sWXgWp.js +1 -0
- package/assets/image-B4MULACL.js +1 -0
- package/assets/image-B5M2ftPa.js +1 -0
- package/assets/image-B5ZxW0VG.js +1 -0
- package/assets/image-B6SAWLjq.js +1 -0
- package/assets/image-B6VmDbM6.js +1 -0
- package/assets/image-B6ncW7rJ.js +1 -0
- package/assets/image-B6woX8-F.js +1 -0
- package/assets/image-B7QIFAir.js +1 -0
- package/assets/image-B7h27Vsd.js +1 -0
- package/assets/image-BAS5CqSz.js +1 -0
- package/assets/image-BAl5qyeX.js +1 -0
- package/assets/image-BBFbQZtc.js +1 -0
- package/assets/image-BBZFtk5k.js +1 -0
- package/assets/image-BBez6ov1.js +1 -0
- package/assets/image-BBk5bBxJ.js +1 -0
- package/assets/image-BCXqBewH.js +1 -0
- package/assets/image-BDOqiI6p.js +1 -0
- package/assets/image-BFzDP99B.js +1 -0
- package/assets/image-BGSprUxs.js +1 -0
- package/assets/image-BGZ2pFmO.js +1 -0
- package/assets/image-BGxqJH7c.js +1 -0
- package/assets/image-BH6pi8gb.js +1 -0
- package/assets/image-BHJFFIIN.js +1 -0
- package/assets/image-BI-5Z38o.js +1 -0
- package/assets/image-BI8lK7Gl.js +1 -0
- package/assets/image-BIDqxk8w.js +1 -0
- package/assets/image-BIIaxSfC.js +1 -0
- package/assets/image-BJAlBW3-.js +1 -0
- package/assets/image-BJ_lqI1X.js +1 -0
- package/assets/image-BJbq9ykO.js +1 -0
- package/assets/image-BKNtkg6s.js +1 -0
- package/assets/image-BKSQyIc5.js +1 -0
- package/assets/image-BKjOwOZU.js +1 -0
- package/assets/image-BMgLTkFN.js +1 -0
- package/assets/image-BMh4HSr7.js +1 -0
- package/assets/image-BN4ovMrn.js +1 -0
- package/assets/image-BNA4BP9T.js +1 -0
- package/assets/image-BNvlqRxs.js +1 -0
- package/assets/image-BOJcifnx.js +1 -0
- package/assets/image-BP17CoHz.js +1 -0
- package/assets/image-BP2Ox9Qn.js +1 -0
- package/assets/image-BPAkEl8k.js +1 -0
- package/assets/image-BPqXYngz.js +1 -0
- package/assets/image-BQTKy54v.js +1 -0
- package/assets/image-BQUnnXTb.js +1 -0
- package/assets/image-BQXnGJhx.js +1 -0
- package/assets/image-BQcTbEVl.js +1 -0
- package/assets/image-BRPzDWpX.js +1 -0
- package/assets/image-BSLjXnNe.js +1 -0
- package/assets/image-BTZyVpoA.js +1 -0
- package/assets/image-BULUy74S.js +1 -0
- package/assets/image-BUsH-M52.js +1 -0
- package/assets/image-BVO9IT_6.js +1 -0
- package/assets/image-BX4sAPzh.js +1 -0
- package/assets/image-BXzPnbc4.js +1 -0
- package/assets/image-BYUgGshq.js +1 -0
- package/assets/image-B_0Cqkss.js +1 -0
- package/assets/image-B_AAvjJY.js +1 -0
- package/assets/image-B_ozWfd0.js +1 -0
- package/assets/image-BaRuJqy0.js +1 -0
- package/assets/image-BanazMP9.js +1 -0
- package/assets/image-Bb4ZLG-2.js +1 -0
- package/assets/image-BbH7e9pw.js +1 -0
- package/assets/image-BbeMBRJP.js +1 -0
- package/assets/image-BbwfB3J_.js +1 -0
- package/assets/image-BcNLqzB4.js +1 -0
- package/assets/image-BcfiUDv-.js +1 -0
- package/assets/image-BdJA4XzW.js +1 -0
- package/assets/image-BdLvgjKp.js +1 -0
- package/assets/image-BdqmMP8T.js +1 -0
- package/assets/image-Bdtwdp85.js +1 -0
- package/assets/image-BfGkQCHU.js +1 -0
- package/assets/image-BfmBx3-B.js +1 -0
- package/assets/image-BhECDi_9.js +1 -0
- package/assets/image-BhmKXBqm.js +1 -0
- package/assets/image-Bi1elmSL.js +1 -0
- package/assets/image-BjFjHCOg.js +1 -0
- package/assets/image-BjKXKIhU.js +1 -0
- package/assets/image-BjTMD2k8.js +1 -0
- package/assets/image-BkKo9DtA.js +1 -0
- package/assets/image-Bkj-ZRbS.js +1 -0
- package/assets/image-Bktw-NJ-.js +1 -0
- package/assets/image-BlZLdRma.js +1 -0
- package/assets/image-BlogSp8o.js +1 -0
- package/assets/image-Bm-o9RF3.js +1 -0
- package/assets/image-Bn2sAgXJ.js +1 -0
- package/assets/image-BnT6IaIq.js +1 -0
- package/assets/image-BnXzDKuV.js +1 -0
- package/assets/image-BnYtBA0B.js +1 -0
- package/assets/image-Bo8CHmCG.js +1 -0
- package/assets/image-BoANtDMS.js +1 -0
- package/assets/image-BoS2kgXC.js +1 -0
- package/assets/image-BocNs9ze.js +1 -0
- package/assets/image-Bq1UxveY.js +1 -0
- package/assets/image-BqQffU2u.js +1 -0
- package/assets/image-BqmT5urK.js +1 -0
- package/assets/image-BqtrMo-7.js +1 -0
- package/assets/image-BsQYdoXP.js +1 -0
- package/assets/image-BstOz2Sd.js +1 -0
- package/assets/image-Bsv1aEQB.js +1 -0
- package/assets/image-BszqTwo7.js +1 -0
- package/assets/image-BtnrRGhZ.js +1 -0
- package/assets/image-BuqgjEJD.js +1 -0
- package/assets/image-Bv8VGwx8.js +1 -0
- package/assets/image-BvEJhPGs.js +1 -0
- package/assets/image-BvJKCSpY.js +1 -0
- package/assets/image-BvkSxpXq.js +1 -0
- package/assets/image-Bvw8wNRu.js +1 -0
- package/assets/image-BwBO8BTi.js +1 -0
- package/assets/image-BwjeUYie.js +1 -0
- package/assets/image-Bx8ULApC.js +1 -0
- package/assets/image-Bx8buncY.js +1 -0
- package/assets/image-BxeDPEwg.js +1 -0
- package/assets/image-BxfO9qDl.js +1 -0
- package/assets/image-ByHnaba8.js +1 -0
- package/assets/image-Bz03or90.js +1 -0
- package/assets/image-BzGwleUn.js +1 -0
- package/assets/image-C1w2WpL5.js +1 -0
- package/assets/image-C2QANSRr.js +1 -0
- package/assets/image-C2Wl7RAy.js +1 -0
- package/assets/image-C3Va51zP.js +1 -0
- package/assets/image-C46yxCl4.js +1 -0
- package/assets/image-C4ELurjg.js +1 -0
- package/assets/image-C4KoLZ1v.js +1 -0
- package/assets/image-C4hEqt6v.js +1 -0
- package/assets/image-C6EsuPXB.js +1 -0
- package/assets/image-C6LRjQzh.js +1 -0
- package/assets/image-C6NJnfCW.js +1 -0
- package/assets/image-C6QSWUy4.js +1 -0
- package/assets/image-C6aZzydG.js +1 -0
- package/assets/image-C6ewnpHo.js +1 -0
- package/assets/image-C7H4CQ65.js +1 -0
- package/assets/image-C7tHBnQp.js +1 -0
- package/assets/image-C8_9fy1e.js +1 -0
- package/assets/image-CAIffJi4.js +1 -0
- package/assets/image-CC2_AL18.js +1 -0
- package/assets/image-CCDmsN6r.js +1 -0
- package/assets/image-CCgX-pcz.js +1 -0
- package/assets/image-CD3he1Tj.js +1 -0
- package/assets/image-CE6B5igp.js +1 -0
- package/assets/image-CECsJh3H.js +1 -0
- package/assets/image-CEuSmI3b.js +1 -0
- package/assets/image-CGobRsqC.js +1 -0
- package/assets/image-CHotlokX.js +1 -0
- package/assets/image-CI3i53ES.js +1 -0
- package/assets/image-CIhcwJo_.js +1 -0
- package/assets/image-CJb0NNxX.js +1 -0
- package/assets/image-CLUlwzEU.js +1 -0
- package/assets/image-CMJsc-Ir.js +1 -0
- package/assets/image-COKP1J8V.js +1 -0
- package/assets/image-COnY36UD.js +1 -0
- package/assets/image-COwCE3RO.js +1 -0
- package/assets/image-CPMDxql6.js +1 -0
- package/assets/image-CPrfOTN2.js +1 -0
- package/assets/image-CQKjvlto.js +1 -0
- package/assets/image-CQm90J-d.js +1 -0
- package/assets/image-CRU88082.js +1 -0
- package/assets/image-CRsMfPT0.js +1 -0
- package/assets/image-CSAN5rKt.js +1 -0
- package/assets/image-CSyxcTwp.js +1 -0
- package/assets/image-CTAbQz5j.js +1 -0
- package/assets/image-CTBdimeM.js +1 -0
- package/assets/image-CTLwieHz.js +1 -0
- package/assets/image-CTsHGgDx.js +1 -0
- package/assets/image-CUFBkGzy.js +1 -0
- package/assets/image-CUPOo6zK.js +1 -0
- package/assets/image-CVAbhfmI.js +1 -0
- package/assets/image-CVBI4BwD.js +1 -0
- package/assets/image-CVPmP4Bl.js +1 -0
- package/assets/image-CVrpZdwi.js +1 -0
- package/assets/image-CWCOKSln.js +1 -0
- package/assets/image-CWG4tRzZ.js +1 -0
- package/assets/image-CXpsLPxr.js +1 -0
- package/assets/image-CYFfk7g3.js +1 -0
- package/assets/image-CZ2qSHpt.js +1 -0
- package/assets/image-CZ9z1ucT.js +1 -0
- package/assets/image-CZLdphQJ.js +1 -0
- package/assets/image-C_JPqQZj.js +1 -0
- package/assets/image-C_rXI8lY.js +1 -0
- package/assets/image-CaBQfcNB.js +1 -0
- package/assets/image-CaHdVXd1.js +1 -0
- package/assets/image-CaoCxndE.js +1 -0
- package/assets/image-CaqftHzf.js +1 -0
- package/assets/image-CawBnBIo.js +1 -0
- package/assets/image-CbmAI5Wi.js +1 -0
- package/assets/image-CbnSXqJS.js +1 -0
- package/assets/image-Cc6jyxLi.js +1 -0
- package/assets/image-CcKS-8-S.js +1 -0
- package/assets/image-CcPbeTXv.js +1 -0
- package/assets/image-Ccx8wDSE.js +1 -0
- package/assets/image-CdGvq_lV.js +1 -0
- package/assets/image-CfglWSsQ.js +1 -0
- package/assets/image-CgHABHdL.js +1 -0
- package/assets/image-CgzMLfDa.js +1 -0
- package/assets/image-ChDeiuh7.js +1 -0
- package/assets/image-Chg2WzE1.js +1 -0
- package/assets/image-Ci0UFTFy.js +1 -0
- package/assets/image-CirJIT7l.js +1 -0
- package/assets/image-CisWvLpc.js +1 -0
- package/assets/image-Ck2fht2U.js +1 -0
- package/assets/image-CkQb0YUH.js +1 -0
- package/assets/image-CkSdZpFq.js +1 -0
- package/assets/image-CljvD_on.js +1 -0
- package/assets/image-ClyvBbEv.js +1 -0
- package/assets/image-CmVMIVLM.js +1 -0
- package/assets/image-CmWdSXJI.js +1 -0
- package/assets/image-CmkiYZaU.js +1 -0
- package/assets/image-CmrOpLf4.js +1 -0
- package/assets/image-CmzmxiTz.js +1 -0
- package/assets/image-CnDG0aor.js +1 -0
- package/assets/image-Co9P7WAh.js +1 -0
- package/assets/image-Covp72ND.js +1 -0
- package/assets/image-CpFHTO_m.js +1 -0
- package/assets/image-Cq54pcgl.js +1 -0
- package/assets/image-CqLwuE__.js +1 -0
- package/assets/image-Crp2YP47.js +1 -0
- package/assets/image-CruMo9Ar.js +1 -0
- package/assets/image-Cs2bevZt.js +1 -0
- package/assets/image-CsH_NRy-.js +1 -0
- package/assets/image-CsNgSbbt.js +1 -0
- package/assets/image-CsTNl20e.js +1 -0
- package/assets/image-CsUCYFyx.js +1 -0
- package/assets/image-CsmwtAjX.js +1 -0
- package/assets/image-CtZg2vKX.js +1 -0
- package/assets/image-CtiFcEL8.js +1 -0
- package/assets/image-CwDXHpUj.js +1 -0
- package/assets/image-CwaGmiHI.js +1 -0
- package/assets/image-Cwg1QVuh.js +1 -0
- package/assets/image-CwsKp0mM.js +1 -0
- package/assets/image-CxvWjDXv.js +1 -0
- package/assets/image-CxyHP7w7.js +1 -0
- package/assets/image-Cy0vmJls.js +1 -0
- package/assets/image-CyE6Mi3e.js +1 -0
- package/assets/image-CyF2UJbG.js +1 -0
- package/assets/image-CyLv-qKv.js +1 -0
- package/assets/image-CyezMyAx.js +1 -0
- package/assets/image-CypdirPa.js +1 -0
- package/assets/image-Cyu_SKNX.js +1 -0
- package/assets/image-Cyy1KupU.js +1 -0
- package/assets/image-CzKmxeZp.js +1 -0
- package/assets/image-CzL8n4ZU.js +1 -0
- package/assets/image-D13kcv8b.js +1 -0
- package/assets/image-D1eN-vq9.js +1 -0
- package/assets/image-D1qvgd7h.js +1 -0
- package/assets/image-D2051qUc.js +1 -0
- package/assets/image-D2QL-j27.js +1 -0
- package/assets/image-D3ALeCj7.js +1 -0
- package/assets/image-D3VAu6BC.js +1 -0
- package/assets/image-D3tLM-DF.js +1 -0
- package/assets/image-D3z3GjMO.js +1 -0
- package/assets/image-D4-YMi52.js +1 -0
- package/assets/image-D4PYvYqY.js +1 -0
- package/assets/image-D4nkyGrg.js +1 -0
- package/assets/image-D55LvXjp.js +1 -0
- package/assets/image-D5wxf47e.js +1 -0
- package/assets/image-D6x5dtDG.js +1 -0
- package/assets/image-D7P0qSfx.js +1 -0
- package/assets/image-D7Sd6W8U.js +1 -0
- package/assets/image-D7wXb0Un.js +1 -0
- package/assets/image-D8ARN-Gu.js +1 -0
- package/assets/image-D8scG8aP.js +1 -0
- package/assets/image-D9OC6Qfy.js +1 -0
- package/assets/image-D9i7y0RW.js +1 -0
- package/assets/image-DA8Sg5HZ.js +1 -0
- package/assets/image-DBFrM6tr.js +1 -0
- package/assets/image-DBehogZh.js +1 -0
- package/assets/image-DC2DOoz2.js +1 -0
- package/assets/image-DC9Wj56E.js +1 -0
- package/assets/image-DDBzbPSl.js +1 -0
- package/assets/image-DDUR5y02.js +1 -0
- package/assets/image-DDso8kuB.js +1 -0
- package/assets/image-DETlLb_v.js +1 -0
- package/assets/image-DFF2Z6Pk.js +1 -0
- package/assets/image-DFYGQEwh.js +1 -0
- package/assets/image-DFYwzuHA.js +1 -0
- package/assets/image-DFf3lDA_.js +1 -0
- package/assets/image-DFo7XMVJ.js +1 -0
- package/assets/image-DGLcwgsS.js +1 -0
- package/assets/image-DGhNZ1rS.js +1 -0
- package/assets/image-DH5ootHk.js +1 -0
- package/assets/image-DHHZDLK-.js +1 -0
- package/assets/image-DHnnMCFG.js +1 -0
- package/assets/image-DIDeRhKH.js +1 -0
- package/assets/image-DJLc6AlW.js +1 -0
- package/assets/image-DJYKaoNi.js +1 -0
- package/assets/image-DKBlkqWK.js +1 -0
- package/assets/image-DKcWaLtu.js +1 -0
- package/assets/image-DLiMUWBI.js +1 -0
- package/assets/image-DLtkWmCC.js +1 -0
- package/assets/image-DLvMDcgw.js +1 -0
- package/assets/image-DLwHWQ4l.js +1 -0
- package/assets/image-DMTT8AeN.js +1 -0
- package/assets/image-DNtaIeSw.js +1 -0
- package/assets/image-DNyYhMNV.js +1 -0
- package/assets/image-DOcz3CQ4.js +1 -0
- package/assets/image-DOwBqPVS.js +1 -0
- package/assets/image-DPzEe6a_.js +1 -0
- package/assets/image-DQzzFCs2.js +1 -0
- package/assets/image-DRpXk5be.js +1 -0
- package/assets/image-DRqNpoe6.js +1 -0
- package/assets/image-DSGxNIm1.js +1 -0
- package/assets/image-DT5Fvf2s.js +1 -0
- package/assets/image-DTa4RXUa.js +1 -0
- package/assets/image-DTy0DgOV.js +1 -0
- package/assets/image-DUcJQ0b3.js +1 -0
- package/assets/image-DUk3AUBd.js +1 -0
- package/assets/image-DUs_WIFe.js +1 -0
- package/assets/image-DVyDRAAO.js +1 -0
- package/assets/image-DWR067hG.js +1 -0
- package/assets/image-DZ-B-aVa.js +1 -0
- package/assets/image-DZc2BYzk.js +1 -0
- package/assets/image-DZpGtN5l.js +1 -0
- package/assets/image-DZplWZyD.js +1 -0
- package/assets/image-D_0i3ZH4.js +1 -0
- package/assets/image-D_cIj1db.js +1 -0
- package/assets/image-D_i0o0Nv.js +1 -0
- package/assets/image-Da2xkAVi.js +1 -0
- package/assets/image-DaaIjpQJ.js +1 -0
- package/assets/image-DaxrbegS.js +1 -0
- package/assets/image-DbBiNCFK.js +1 -0
- package/assets/image-DbpOM2LD.js +1 -0
- package/assets/image-Dc5zhKf6.js +1 -0
- package/assets/image-DcIu3U38.js +1 -0
- package/assets/image-DcM8byf5.js +1 -0
- package/assets/image-DcX8AUYd.js +1 -0
- package/assets/image-DdicXBNF.js +1 -0
- package/assets/image-De2xpum1.js +1 -0
- package/assets/image-DecSbpNG.js +1 -0
- package/assets/image-DesBMjvP.js +1 -0
- package/assets/image-Dfhapk7_.js +1 -0
- package/assets/image-DfzpWAED.js +1 -0
- package/assets/image-DgU8tR58.js +1 -0
- package/assets/image-Dgb3Vdrr.js +1 -0
- package/assets/image-DgkgLcDL.js +1 -0
- package/assets/image-Dh9w9A8z.js +1 -0
- package/assets/image-DhOOZChF.js +1 -0
- package/assets/image-DjXN5hvv.js +1 -0
- package/assets/image-Dkp4M1ik.js +1 -0
- package/assets/image-DmNOl1OW.js +1 -0
- package/assets/image-DmhgJWq-.js +1 -0
- package/assets/image-Dmp2jTO0.js +1 -0
- package/assets/image-Do8rO3zE.js +1 -0
- package/assets/image-DooF_Vfs.js +1 -0
- package/assets/image-DpGIEKrK.js +1 -0
- package/assets/image-DpHbdMp9.js +1 -0
- package/assets/image-DpeCw-px.js +1 -0
- package/assets/image-Dpgf4dcg.js +1 -0
- package/assets/image-DpjDzWCs.js +1 -0
- package/assets/image-DqH_Lyo9.js +1 -0
- package/assets/image-Dqbrewdt.js +1 -0
- package/assets/image-DrH3Wn2w.js +1 -0
- package/assets/image-DrHhCSDD.js +1 -0
- package/assets/image-DrobCWF2.js +1 -0
- package/assets/image-DrraBYJZ.js +1 -0
- package/assets/image-Ds78yECl.js +1 -0
- package/assets/image-DsOpF0U0.js +1 -0
- package/assets/image-Dtc98pdf.js +1 -0
- package/assets/image-DuQoo_kR.js +1 -0
- package/assets/image-Duck5tqn.js +1 -0
- package/assets/image-DvpdMMzF.js +1 -0
- package/assets/image-DwUGDFj5.js +1 -0
- package/assets/image-Dx4ya6_y.js +1 -0
- package/assets/image-DyrMImIL.js +1 -0
- package/assets/image-Dz82Zyfj.js +1 -0
- package/assets/image-DzJAqGfB.js +1 -0
- package/assets/image-DzLDqqsm.js +1 -0
- package/assets/image-E3PT44xu.js +1 -0
- package/assets/image-EUVXQieb.js +1 -0
- package/assets/image-ExeF69qZ.js +1 -0
- package/assets/image-EyKsXf_1.js +1 -0
- package/assets/image-FnAIuX7S.js +1 -0
- package/assets/image-Fq457JJn.js +1 -0
- package/assets/image-HcidEyjv.js +1 -0
- package/assets/image-IpgDqPq2.js +1 -0
- package/assets/image-JIl7mHMQ.js +1 -0
- package/assets/image-JyGUnQ_N.js +1 -0
- package/assets/image-K1HoU8Qi.js +1 -0
- package/assets/image-LfonVSeq.js +1 -0
- package/assets/image-M7TV7WaH.js +1 -0
- package/assets/image-MGwelZJS.js +1 -0
- package/assets/image-MQbcgW7z.js +1 -0
- package/assets/image-M_AWRaKs.js +1 -0
- package/assets/image-Mf3UQvEC.js +1 -0
- package/assets/image-Npe5Xkhl.js +1 -0
- package/assets/image-NsVKBwxZ.js +1 -0
- package/assets/image-OT0Fb2Nb.js +1 -0
- package/assets/image-On2ij4Ix.js +1 -0
- package/assets/image-OrIz0o8m.js +1 -0
- package/assets/image-PWpnYSKI.js +1 -0
- package/assets/image-SJHuomz2.js +1 -0
- package/assets/image-Sy6X7CtO.js +1 -0
- package/assets/image-T2oAotCg.js +1 -0
- package/assets/image-TA_PkYBz.js +1 -0
- package/assets/image-TQ3Nh_VF.js +1 -0
- package/assets/image-TQLBEOIW.js +1 -0
- package/assets/image-UFnS_pK0.js +1 -0
- package/assets/image-V4qYiUxw.js +1 -0
- package/assets/image-VFWT6oS6.js +1 -0
- package/assets/image-VlTaWJmy.js +1 -0
- package/assets/image-VxDqDj0T.js +1 -0
- package/assets/image-W-Y_Nm-s.js +1 -0
- package/assets/image-W5rUOVDT.js +1 -0
- package/assets/image-W7SfqKZe.js +1 -0
- package/assets/image-WbOd8jAJ.js +1 -0
- package/assets/{image-CWwCZyLK.js → image-XVP-TFUR.js} +2 -2
- package/assets/image-Xfz-LkLu.js +1 -0
- package/assets/image-YbQrvLSP.js +1 -0
- package/assets/image-YhquT9-B.js +1 -0
- package/assets/image-YzdSnFCd.js +1 -0
- package/assets/image-Z9k3mhsb.js +1 -0
- package/assets/image-ZLtraAGN.js +1 -0
- package/assets/image-ZVoqlWXW.js +1 -0
- package/assets/image-Zh059TUR.js +1 -0
- package/assets/image-ZwibGfzR.js +1 -0
- package/assets/image-_t2-K1ZP.js +1 -0
- package/assets/image-bHJO6btW.js +1 -0
- package/assets/image-bHVCC2t9.js +1 -0
- package/assets/image-bSOL4gQb.js +1 -0
- package/assets/image-bpacFMFT.js +1 -0
- package/assets/image-cDoShVvl.js +1 -0
- package/assets/image-cwzgrAkh.js +1 -0
- package/assets/image-d8n8A6si.js +1 -0
- package/assets/image-dO78_uyn.js +1 -0
- package/assets/image-ddsU9gPS.js +1 -0
- package/assets/image-fjbgiffe.js +1 -0
- package/assets/image-gnC_p3Da.js +1 -0
- package/assets/image-gxCVLutB.js +1 -0
- package/assets/image-hO8Jv2oh.js +1 -0
- package/assets/image-iR_slvRo.js +1 -0
- package/assets/image-jv6wUF7a.js +1 -0
- package/assets/image-kZBIIBVa.js +1 -0
- package/assets/image-lBIlUHFP.js +1 -0
- package/assets/image-lOdcUtWG.js +1 -0
- package/assets/image-lXBTHYnD.js +1 -0
- package/assets/image-m7IlStdm.js +1 -0
- package/assets/image-mMy4SSmg.js +1 -0
- package/assets/image-nW5JvdXC.js +1 -0
- package/assets/image-nqueMEws.js +1 -0
- package/assets/image-o3pjQDbu.js +1 -0
- package/assets/image-oGFA7lCe.js +1 -0
- package/assets/image-oKct0i27.js +1 -0
- package/assets/image-pEGSGt6h.js +1 -0
- package/assets/image-pKZ5ApxC.js +1 -0
- package/assets/image-pcyfaNhf.js +1 -0
- package/assets/image-q4XfUN6v.js +1 -0
- package/assets/image-qLUwfjzV.js +1 -0
- package/assets/image-qsAyF5Oj.js +1 -0
- package/assets/image-rAE1A9js.js +1 -0
- package/assets/image-rdvu9IOp.js +1 -0
- package/assets/image-ripXpF5P.js +1 -0
- package/assets/image-rvsWf8U_.js +1 -0
- package/assets/image-rw28GAIu.js +1 -0
- package/assets/image-sDrIF89f.js +1 -0
- package/assets/image-sm-_D7TO.js +1 -0
- package/assets/image-ss2LFlQu.js +1 -0
- package/assets/image-t4jvKgpV.js +1 -0
- package/assets/image-tiHbZ1Vk.js +1 -0
- package/assets/image-uGs9mRWl.js +1 -0
- package/assets/image-uk4MysVY.js +1 -0
- package/assets/image-vXNBwFvw.js +1 -0
- package/assets/image-vrSaD0K9.js +1 -0
- package/assets/image-vuuCn07N.js +1 -0
- package/assets/image-wR942Jk6.js +1 -0
- package/assets/image-xJO47ptb.js +1 -0
- package/assets/image-xMsS8TDb.js +1 -0
- package/assets/image-xaEWk6k8.js +1 -0
- package/assets/image-y3eCNAT6.js +1 -0
- package/assets/image-zsArRLIF.js +1 -0
- package/assets/in-app-wallet-calls-C4soc9zT.js +1 -0
- package/assets/index--YTVamH2.js +1 -0
- package/assets/index--rITGawC.js +1 -0
- package/assets/index--t3K2suC.js +1 -0
- package/assets/index-0qRtNAQn.js +1 -0
- package/assets/index-18L0wZ74.js +1 -0
- package/assets/index-1CA6ps09.js +1 -0
- package/assets/index-2qmxPQhP.js +1 -0
- package/assets/index-3DerMn1X.js +1 -0
- package/assets/index-3an-fsOm.js +1 -0
- package/assets/index-3d3uK5Ax.js +1 -0
- package/assets/index-3jJtZlGN.js +1 -0
- package/assets/index-4Nmn8ium.js +1 -0
- package/assets/index-4WvPsM5O.js +1 -0
- package/assets/index-5IpGHzAv.js +1 -0
- package/assets/index-5U2ZJeh5.js +1 -0
- package/assets/index-6E4L_h32.js +1 -0
- package/assets/index-7BdGIDy3.js +1 -0
- package/assets/index-7C_yDnI4.js +1 -0
- package/assets/index-7Xw6Dozy.js +1 -0
- package/assets/index-8Ff6vDUD.js +1 -0
- package/assets/index-9552Tb-C.js +1 -0
- package/assets/index-9Ml23qSY.js +1 -0
- package/assets/index-B-BftUxa.js +1 -0
- package/assets/index-B-UTLjBc.js +1 -0
- package/assets/index-B-kI7R4f.js +1 -0
- package/assets/index-B-oXIR8J.js +1 -0
- package/assets/index-B05algAv.js +1 -0
- package/assets/index-B062fuzr.js +1 -0
- package/assets/index-B1-qcL-p.js +1 -0
- package/assets/{index-iRCpTifY.js → index-B1P0UjN9.js} +1 -1
- package/assets/index-B1XrJIPH.js +1 -0
- package/assets/index-B21BIk0D.js +1 -0
- package/assets/index-B2WV7sR7.js +1 -0
- package/assets/index-B3vR_dtk.js +1 -0
- package/assets/index-B51294pb.js +1 -0
- package/assets/index-B5AZ3O3C.js +1 -0
- package/assets/index-B5BAsv-B.js +1 -0
- package/assets/index-B6n-vVE0.js +1 -0
- package/assets/index-B6yqoFuC.js +1 -0
- package/assets/index-B78E3fcT.js +1 -0
- package/assets/index-B7GQyWAF.js +1 -0
- package/assets/index-B7dAHFam.js +1 -0
- package/assets/index-B8BWAl26.js +1 -0
- package/assets/index-B8De2hoC.js +1 -0
- package/assets/index-B8SH8PS4.js +1 -0
- package/assets/index-B94SpzOt.js +1 -0
- package/assets/index-BA0Hn6eE.js +1 -0
- package/assets/index-BARF52iT.js +1 -0
- package/assets/{index-BFHHrVBG.js → index-BAkdueH0.js} +1 -1
- package/assets/index-BBANTdk4.js +1 -0
- package/assets/index-BBDAdmKp.js +1 -0
- package/assets/index-BBiL2lyk.js +1 -0
- package/assets/index-BBkeSt5m.js +1 -0
- package/assets/index-BDifUsn3.js +1 -0
- package/assets/index-BEFk-36A.js +1 -0
- package/assets/index-BEXV42kp.js +1 -0
- package/assets/index-BEx6ckei.js +1 -0
- package/assets/index-BFGXqrJS.js +1 -0
- package/assets/index-BFJUkm8C.js +1 -0
- package/assets/index-BFZxo6Jc.js +1 -0
- package/assets/index-BG1ZQeCA.js +1 -0
- package/assets/index-BGGk2Hck.js +1 -0
- package/assets/index-BH1-nK1j.js +1 -0
- package/assets/index-BHZDuU0I.js +1 -0
- package/assets/index-BIFgx20V.js +1 -0
- package/assets/index-BILUwmJ9.js +1 -0
- package/assets/index-BIXqJF5y.js +1 -0
- package/assets/index-BIcsFldg.js +1 -0
- package/assets/index-BIeLm-x3.js +1 -0
- package/assets/index-BJAcAgB9.js +1 -0
- package/assets/index-BJBC3bLU.js +1 -0
- package/assets/index-BKN05ia6.js +1 -0
- package/assets/index-BKkJhanY.js +1 -0
- package/assets/index-BKoDPf_i.js +1 -0
- package/assets/index-BLMjeGJ-.js +1 -0
- package/assets/index-BLO6pY9b.js +1 -0
- package/assets/index-BLsnOBhg.js +1 -0
- package/assets/index-BM8c6qO-.js +1 -0
- package/assets/index-BM9GzZ_o.js +1 -0
- package/assets/index-BMPGw_D6.js +1 -0
- package/assets/index-BNlDhEDg.js +1 -0
- package/assets/index-BP-yDgcx.js +1 -0
- package/assets/index-BP76iXI2.js +1 -0
- package/assets/index-BPFXH4g9.js +1 -0
- package/assets/index-BPgl8Hhp.js +1 -0
- package/assets/index-BQWXi0by.js +1 -0
- package/assets/index-BQwDdmmS.js +1 -0
- package/assets/index-BRIQuVzg.js +1 -0
- package/assets/index-BSA2BPZ9.js +1 -0
- package/assets/index-BTkNDmCP.js +1 -0
- package/assets/index-BTqXeJHf.js +1 -0
- package/assets/index-BTzbgIH6.js +1 -0
- package/assets/index-BVAmxcaa.js +1 -0
- package/assets/index-BVQeUBdj.js +1 -0
- package/assets/index-BXY5tnuK.js +1 -0
- package/assets/index-BXZiXU-9.js +1 -0
- package/assets/index-BXi61TZ5.js +1 -0
- package/assets/index-BXnDDK-y.js +1 -0
- package/assets/index-BZUSQkq9.js +1 -0
- package/assets/index-BZhX-e71.js +1 -0
- package/assets/index-BZwq4W5O.js +1 -0
- package/assets/index-B_OXuBhF.js +1 -0
- package/assets/index-Ba2OoCBH.js +1 -0
- package/assets/index-Ba45jQBJ.js +1 -0
- package/assets/index-Ba7PpD6d.js +1 -0
- package/assets/index-Bap5Lkty.js +1 -0
- package/assets/index-Bbv-4GNB.js +1 -0
- package/assets/index-Bbznecif.js +1 -0
- package/assets/index-Bd7BhrCK.js +1 -0
- package/assets/index-BdgyG9Qa.js +1 -0
- package/assets/index-BdkJrfxl.js +1 -0
- package/assets/index-BfYVYwh5.js +1 -0
- package/assets/index-BftqI1FU.js +1 -0
- package/assets/index-BgECKCj8.js +1 -0
- package/assets/index-BgbYZOnC.js +1 -0
- package/assets/index-Bh8eOJMM.js +1 -0
- package/assets/index-BiHhxeDt.js +1 -0
- package/assets/index-Bk-uZV0j.js +1 -0
- package/assets/index-BkM7PWkU.js +1 -0
- package/assets/index-Bl6ScMn3.js +1 -0
- package/assets/index-BlU4B6pe.js +1 -0
- package/assets/index-Bm92iZMY.js +1 -0
- package/assets/index-BmKJ1abQ.js +1 -0
- package/assets/index-BmXd0pys.js +1 -0
- package/assets/index-BmwlJTQ-.js +1 -0
- package/assets/index-BnsE1W-S.js +1 -0
- package/assets/index-BoC-cn90.js +1 -0
- package/assets/index-BoCHG1VO.js +1 -0
- package/assets/index-BoJGVmma.js +1 -0
- package/assets/index-BogX5ITG.js +1 -0
- package/assets/index-Bprjmfje.js +1 -0
- package/assets/index-BpspMk9l.js +1 -0
- package/assets/index-BqK7Phb6.js +1 -0
- package/assets/index-BqLb859N.js +1 -0
- package/assets/index-BqxSKkSq.js +1 -0
- package/assets/index-BrOCsLbf.js +1 -0
- package/assets/index-BrvgJVgh.js +1 -0
- package/assets/index-BtBx3hi1.js +1 -0
- package/assets/index-BtZsXMJj.js +1 -0
- package/assets/index-BtfbjCVr.js +1 -0
- package/assets/index-BuSavAVK.js +1 -0
- package/assets/index-BuWGQyCe.js +1 -0
- package/assets/index-BuhGQjsZ.js +1 -0
- package/assets/index-BwCUvEoQ.js +1 -0
- package/assets/index-BwL47YsA.js +1 -0
- package/assets/index-Bwjy4Jw7.js +1 -0
- package/assets/index-Bx9srovK.js +1 -0
- package/assets/index-BxqRct_I.js +1 -0
- package/assets/index-BxtNhRvf.js +1 -0
- package/assets/index-BzNpkHfI.js +1 -0
- package/assets/index-BzfyCotn.js +1 -0
- package/assets/index-C-A1j44m.js +1 -0
- package/assets/index-C-OT0KJG.js +1 -0
- package/assets/index-C-b1qpM9.js +1 -0
- package/assets/index-C0HCn7GN.js +1 -0
- package/assets/index-C0I75rp3.js +1 -0
- package/assets/index-C1a5oPtZ.js +1 -0
- package/assets/index-C1adBKyv.js +1 -0
- package/assets/index-C2CZkwuV.js +1 -0
- package/assets/index-C2KnoZm4.js +1 -0
- package/assets/index-C5NL4PoV.js +1 -0
- package/assets/index-C5X26G0P.js +1 -0
- package/assets/index-C5ZfEOey.js +1 -0
- package/assets/index-C5gBqe1B.js +1 -0
- package/assets/index-C63hJ0G0.js +1 -0
- package/assets/index-C6EDKfcJ.js +1 -0
- package/assets/index-C6baQHax.js +1 -0
- package/assets/index-C6d9DLRH.js +1 -0
- package/assets/index-C7HuhgLE.js +1 -0
- package/assets/index-C7N44kNF.js +1 -0
- package/assets/index-C7WD5W_Z.js +1 -0
- package/assets/index-C7njqxXR.js +1 -0
- package/assets/index-C8AQSvJD.js +1 -0
- package/assets/index-C8VMxu1Z.js +1 -0
- package/assets/index-C8mAROh2.js +1 -0
- package/assets/index-C91aPf2g.js +1 -0
- package/assets/index-C93NlSEw.js +1 -0
- package/assets/index-C9taR4Do.js +1 -0
- package/assets/index-CAYpPiIA.js +1 -0
- package/assets/index-CAfHv9Ye.js +1 -0
- package/assets/index-CBVJzm96.js +1 -0
- package/assets/index-CB_NguTF.js +1 -0
- package/assets/index-CCIAeA2T.js +1 -0
- package/assets/index-CD7cY8HX.js +1 -0
- package/assets/index-CDqfDzT6.js +1 -0
- package/assets/index-CE9n_StB.js +1 -0
- package/assets/index-CEpc_g8h.js +1 -0
- package/assets/index-CExunyqd.js +1 -0
- package/assets/index-CFUSXkKo.js +1 -0
- package/assets/index-CGMXxK_x.js +1 -0
- package/assets/index-CId5PD0X.js +1 -0
- package/assets/index-CJ8I9s4o.js +1 -0
- package/assets/index-CJYo3Znz.js +1 -0
- package/assets/index-CJt068xh.js +1 -0
- package/assets/index-CKXDw-uc.js +1 -0
- package/assets/index-CLikIjn_.js +1 -0
- package/assets/index-CLtv9-lU.js +1 -0
- package/assets/index-CLxj2t1J.js +1 -0
- package/assets/index-CMGByxdA.js +1 -0
- package/assets/index-CMzQk3O6.js +1 -0
- package/assets/index-CN6XdMAo.js +1 -0
- package/assets/index-CN99OAiz.js +1 -0
- package/assets/index-CNLH4wrU.js +1 -0
- package/assets/index-CNkg8_tm.js +1 -0
- package/assets/index-CNl69Nv0.js +1 -0
- package/assets/index-COFjg0BY.js +1 -0
- package/assets/index-COlGaDkw.js +1 -0
- package/assets/index-CP3DQPwx.js +1 -0
- package/assets/index-CP_9UNXA.js +1 -0
- package/assets/index-CQ3aQg5G.js +1 -0
- package/assets/index-CQPZVLgk.js +1 -0
- package/assets/index-CRRdY0XA.js +1 -0
- package/assets/index-CRTSSeuy.js +1 -0
- package/assets/index-CTs1t6rA.js +1 -0
- package/assets/index-CU6cpe0O.js +1 -0
- package/assets/index-CU6dgzkA.js +1 -0
- package/assets/index-CUEmD5dS.js +1 -0
- package/assets/index-CUJUgO36.js +1 -0
- package/assets/{index-BF30EhGq.js → index-CUn0wuu2.js} +2 -2
- package/assets/index-CW58bOV7.js +1 -0
- package/assets/index-CW6lKp1A.js +1 -0
- package/assets/index-CW8D5Pv5.js +1 -0
- package/assets/index-CWTqaiN6.js +1 -0
- package/assets/index-CWdL5XwO.js +1 -0
- package/assets/index-CWmGdvBR.js +1 -0
- package/assets/index-CXYI0OjH.js +1 -0
- package/assets/index-CXgqt45P.js +1 -0
- package/assets/index-CZNdz8B6.js +1 -0
- package/assets/index-CZfaBXw3.js +1 -0
- package/assets/index-CZmLnawh.js +1 -0
- package/assets/index-C_5dy4gh.js +1 -0
- package/assets/index-C_C9JdoE.js +1 -0
- package/assets/index-C_XOoDbk.js +1 -0
- package/assets/index-C_fnrq8t.js +1 -0
- package/assets/index-C_j5E1ow.js +1 -0
- package/assets/index-C_j7AjFr.js +1 -0
- package/assets/index-Ca7jbqnT.js +1 -0
- package/assets/index-CaZIFXyW.js +1 -0
- package/assets/index-CapnWgEl.js +1 -0
- package/assets/index-Cb41eDDJ.js +1 -0
- package/assets/index-CbEIEIEo.js +1 -0
- package/assets/index-CbGJyo5C.js +1 -0
- package/assets/index-CbMeskkV.js +1 -0
- package/assets/index-Cc4uopde.js +1 -0
- package/assets/index-CcNQ53IV.js +1 -0
- package/assets/index-CcdGs50g.js +1 -0
- package/assets/index-Cd5Dye5X.js +1 -0
- package/assets/index-CdMxme0L.js +1 -0
- package/assets/index-CdOxXIip.js +1 -0
- package/assets/index-CdYRC4Ux.js +1 -0
- package/assets/index-CdvxolxE.js +1 -0
- package/assets/index-Ce98wt2N.js +1 -0
- package/assets/index-CecEswCv.js +1 -0
- package/assets/index-CecZD-vJ.js +395 -0
- package/assets/index-CfCXSq_b.js +1 -0
- package/assets/index-CfO_m3oL.js +1 -0
- package/assets/index-Cfzzcvgo.js +1 -0
- package/assets/index-Cg1E5HxJ.js +1 -0
- package/assets/index-CiwBOkla.js +1 -0
- package/assets/index-CjVYDT09.js +1 -0
- package/assets/index-CkqupmC6.js +1 -0
- package/assets/index-Cl87iGjg.js +1 -0
- package/assets/index-CmCRou09.js +1 -0
- package/assets/index-CmTH1mn1.js +1 -0
- package/assets/index-ComRbnem.js +1 -0
- package/assets/index-Coq7--sH.js +1 -0
- package/assets/index-CpJZxSfI.js +1 -0
- package/assets/index-CpMkh5pZ.js +1 -0
- package/assets/index-CqJjpCD5.js +1 -0
- package/assets/index-CqWFxNbG.js +1 -0
- package/assets/index-CrBWjlui.js +1 -0
- package/assets/index-CrGDBMbK.js +1 -0
- package/assets/index-CrUcAJK0.js +1 -0
- package/assets/index-Crs9jVrm.js +1 -0
- package/assets/index-CsAX4sL-.js +1 -0
- package/assets/index-CszQa87W.js +1 -0
- package/assets/index-Ct6AYfZ-.js +1 -0
- package/assets/index-Cu2rQjR7.js +1 -0
- package/assets/index-CuJtvtqs.js +1 -0
- package/assets/index-CuQBw1y6.js +1 -0
- package/assets/index-CujrNB-Q.js +1 -0
- package/assets/index-Cv59xn6_.js +1 -0
- package/assets/index-Cw9NGSPc.js +1 -0
- package/assets/index-Cws1zSAX.js +1 -0
- package/assets/index-Cx8lAzRu.js +1 -0
- package/assets/index-CxBkKx5Q.js +1 -0
- package/assets/index-CyhgnW_d.js +1 -0
- package/assets/index-Czf-i91G.js +1 -0
- package/assets/index-D-qw7id5.js +1 -0
- package/assets/index-D06ftJGd.js +1 -0
- package/assets/index-D09WfuKj.js +1 -0
- package/assets/index-D0rQT1_1.js +1 -0
- package/assets/index-D1G_5OyD.js +1 -0
- package/assets/index-D1Wt1Kx7.js +1 -0
- package/assets/index-D1j-SvoJ.js +1 -0
- package/assets/index-D2-ySoTs.js +1 -0
- package/assets/index-D2Z8_AUU.js +1 -0
- package/assets/index-D2_d10WC.js +1 -0
- package/assets/index-D2hPph8l.js +1 -0
- package/assets/index-D2vPh3Mc.js +1 -0
- package/assets/index-D30RfPa1.js +1 -0
- package/assets/index-D45a0k-1.js +1 -0
- package/assets/{index-DNhKcEat.js → index-D4HP5DQC.js} +1 -1
- package/assets/index-D4Sgj1mL.js +1 -0
- package/assets/index-D4VnhuTS.js +1 -0
- package/assets/index-D5GVUjIM.js +1 -0
- package/assets/index-D6d2Y6jv.js +1 -0
- package/assets/index-D6xvjdG0.js +1 -0
- package/assets/index-D6zAueb_.js +1 -0
- package/assets/index-D7FslwZl.js +1 -0
- package/assets/index-D7Gl-ZGb.js +1 -0
- package/assets/index-D8dYcFAn.js +1 -0
- package/assets/index-D9Jrno_D.js +1 -0
- package/assets/index-DACt8hFb.js +1 -0
- package/assets/index-DAEFTu29.js +1 -0
- package/assets/index-DAYuEFQ-.js +1 -0
- package/assets/index-DAlw00ee.js +1 -0
- package/assets/index-DBst6Hla.js +1 -0
- package/assets/index-DDdoZFD-.js +1 -0
- package/assets/index-DDggnqr4.js +1 -0
- package/assets/index-DDk7D3eE.js +1 -0
- package/assets/index-DDwu-IMz.js +1 -0
- package/assets/index-DEMIRENu.js +1 -0
- package/assets/index-DEV4egrN.js +1 -0
- package/assets/index-DE_8irSD.js +1 -0
- package/assets/index-DEzKWTBJ.js +1 -0
- package/assets/index-DFSGuScS.js +1 -0
- package/assets/index-DFZNHq44.js +1 -0
- package/assets/index-DFc7lZHb.js +1 -0
- package/assets/index-DFghxfjK.js +1 -0
- package/assets/index-DFrKYv4g.js +1 -0
- package/assets/index-DFt1vT8N.js +1 -0
- package/assets/index-DHDm_YtM.js +1 -0
- package/assets/index-DHNwai-Z.js +1 -0
- package/assets/index-DICTy0sa.js +1 -0
- package/assets/index-DILut-jL.js +1 -0
- package/assets/index-DJYG2Vtc.js +1 -0
- package/assets/index-DK-e_E51.js +1 -0
- package/assets/index-DKbx-y78.js +1 -0
- package/assets/index-DKzyJcIY.js +1 -0
- package/assets/index-DLGneTkB.js +1 -0
- package/assets/index-DLHjxUiX.js +1 -0
- package/assets/index-DLMSD3H_.js +1 -0
- package/assets/index-DMAP8qTI.js +1 -0
- package/assets/index-DMEV07wA.js +1 -0
- package/assets/index-DMTU8hfu.js +1 -0
- package/assets/index-DMyDV-OH.js +1 -0
- package/assets/index-DMyHg26L.js +1 -0
- package/assets/index-DNynPGua.js +1 -0
- package/assets/index-DOqN8xaU.js +1 -0
- package/assets/index-DP0utIbV.js +1 -0
- package/assets/index-DPCPDLBT.js +1 -0
- package/assets/index-DPFoWmV6.js +1 -0
- package/assets/index-DPPIbXj8.js +1 -0
- package/assets/index-DPXkoJXK.js +1 -0
- package/assets/index-DPgWRg9-.js +1 -0
- package/assets/index-DPhI9JUn.js +1 -0
- package/assets/index-DPic1oJg.js +1 -0
- package/assets/index-DQ8_v09O.js +1 -0
- package/assets/index-DQa9pNJd.js +1 -0
- package/assets/index-DR-ujXcj.js +1 -0
- package/assets/index-DRVDpxj6.js +1 -0
- package/assets/index-DSL1LhIu.js +1 -0
- package/assets/index-DSWhMtMn.js +1 -0
- package/assets/index-DSxj-vNU.js +3 -0
- package/assets/index-DTPO88lj.js +1 -0
- package/assets/index-DTtDhdi2.js +1 -0
- package/assets/index-DUBZIaC-.js +1 -0
- package/assets/index-DV2Q2KhC.js +1 -0
- package/assets/index-DVGcX2HE.js +1 -0
- package/assets/index-DX_PNZlK.js +2 -0
- package/assets/index-DYiL0IsZ.js +1 -0
- package/assets/index-DZ2hd5eC.js +1 -0
- package/assets/index-DZRVQyzq.js +1 -0
- package/assets/index-D_7wDcMK.js +1 -0
- package/assets/index-D_d6gemZ.js +1 -0
- package/assets/index-DaZnaClT.js +1 -0
- package/assets/index-DbAxetvE.js +1 -0
- package/assets/index-Db_DlPJs.js +1 -0
- package/assets/index-DcUozftP.js +1 -0
- package/assets/index-DcwbqEHj.js +1 -0
- package/assets/index-DcyXtFTG.js +1 -0
- package/assets/index-Ddqy22qU.js +1 -0
- package/assets/index-De1eZyIJ.js +1 -0
- package/assets/index-DeQey0SH.js +1 -0
- package/assets/index-DfafaK4Q.js +1 -0
- package/assets/index-DgNvhZ_M.js +1 -0
- package/assets/index-DhFHq_nZ.js +1 -0
- package/assets/index-DhlaSoR4.js +1 -0
- package/assets/index-DibwKtF2.js +1 -0
- package/assets/index-DjLE3t9q.js +1 -0
- package/assets/index-Dk8LF9Yk.js +1 -0
- package/assets/index-DkPRLpmE.js +1 -0
- package/assets/index-DkcP2fCc.js +1 -0
- package/assets/index-DlDkzdhK.js +895 -0
- package/assets/index-DlKNOIdN.js +1 -0
- package/assets/index-DlfGjmz4.js +1 -0
- package/assets/index-DmLPMpkA.js +1 -0
- package/assets/index-Dn2svNQz.js +1 -0
- package/assets/index-DnUUaSfF.js +1 -0
- package/assets/index-DoKNVID8.js +2 -0
- package/assets/index-DoKwRUhz.js +1 -0
- package/assets/index-DoeeKGAI.js +1 -0
- package/assets/index-DpRqa1iX.js +1 -0
- package/assets/index-DpoJvg5R.js +1 -0
- package/assets/index-DqVvpGRi.js +1 -0
- package/assets/index-DqYjD_64.js +1 -0
- package/assets/index-Dqyfi4dm.js +1 -0
- package/assets/index-DrzmRQ9S.js +1 -0
- package/assets/index-DsgD7D-8.js +1 -0
- package/assets/index-DszThTMl.js +1 -0
- package/assets/index-Dtavj5eK.js +1 -0
- package/assets/index-DuTQzi4Z.js +1 -0
- package/assets/index-DufOfQ90.js +1 -0
- package/assets/index-DvXpQOkv.js +1 -0
- package/assets/{index-DK-FwhFH.js → index-Dw1-bBaI.js} +1 -1
- package/assets/index-Dxm6Y7eO.js +1 -0
- package/assets/index-Dy45c3qF.js +1 -0
- package/assets/index-DyaPXLoO.js +1 -0
- package/assets/index-Dzkop1Gk.js +1 -0
- package/assets/index-Fd858RJQ.js +1 -0
- package/assets/index-G-h-xM0C.js +1 -0
- package/assets/index-HFnaQWCU.js +1 -0
- package/assets/index-HPp1Id1p.js +1 -0
- package/assets/index-He5kaR9n.js +1 -0
- package/assets/index-HnCuhDYJ.js +1 -0
- package/assets/index-HzSvsrak.js +1 -0
- package/assets/index-IBUgXgOa.js +1 -0
- package/assets/index-Ia3LffGn.js +1 -0
- package/assets/index-Im6F3t68.js +1 -0
- package/assets/index-JAAqCLcG.js +1 -0
- package/assets/index-JNZoio_2.js +1 -0
- package/assets/index-Jmrm9oUu.js +1 -0
- package/assets/index-JuvDLDuk.js +1 -0
- package/assets/index-K7y9yqJI.js +1 -0
- package/assets/index-KXLAu1y1.js +1 -0
- package/assets/index-KpPak-wu.js +1 -0
- package/assets/index-Kt6GlPCW.js +1 -0
- package/assets/index-LCDpDH8Q.js +4 -0
- package/assets/index-MECmwSvw.js +1 -0
- package/assets/index-Mb-EqEoD.js +23 -0
- package/assets/index-NO3dCFlG.js +1 -0
- package/assets/index-PjYIiHEb.js +1 -0
- package/assets/index-Pw2thZ4h.js +1 -0
- package/assets/index-QGSP4PI8.js +1 -0
- package/assets/index-QvBzJwgv.js +1 -0
- package/assets/index-RJhc6LnM.js +1 -0
- package/assets/index-RiIluuCN.js +1 -0
- package/assets/index-RpXAvNRL.js +1 -0
- package/assets/index-S5s6rAc3.js +1 -0
- package/assets/index-SCBLsVUL.js +1 -0
- package/assets/index-SSgaCJsD.js +1 -0
- package/assets/index-SaOy8OjI.js +1 -0
- package/assets/index-VZmM-6RJ.js +1 -0
- package/assets/index-VloZUDIL.js +12 -0
- package/assets/index-WXvxLSve.js +1 -0
- package/assets/index-WsH2ZGfO.js +1 -0
- package/assets/index-WwjGYjHa.js +1 -0
- package/assets/index-Wz7obrZB.js +1 -0
- package/assets/index-X-a697cI.js +5 -0
- package/assets/index-X1qL-0B0.js +13 -0
- package/assets/index-XRQW1mUN.js +1 -0
- package/assets/index-YDG1R00C.js +1 -0
- package/assets/index-YcqLCtWD.js +1 -0
- package/assets/index-Yk_iQY25.js +1 -0
- package/assets/index-ZITrt5Fi.js +1 -0
- package/assets/index-_36_A-pH.js +1 -0
- package/assets/index-_a8zNWKv.js +1 -0
- package/assets/index-aoLVKFG1.js +1 -0
- package/assets/index-b5ABnFKj.js +1 -0
- package/assets/index-bQArImNA.js +1 -0
- package/assets/index-bsKYZmcs.js +1 -0
- package/assets/index-bzH6W7xo.js +1 -0
- package/assets/index-cAvSYrmF.js +1 -0
- package/assets/index-cF_6KJvb.js +1 -0
- package/assets/index-cTRIo3rN.js +1 -0
- package/assets/index-caEr82M6.js +1 -0
- package/assets/index-cdlur5jM.js +1 -0
- package/assets/index-e_qeQmc1.js +1 -0
- package/assets/index-eiEAIzdd.js +1 -0
- package/assets/index-eujSyrnd.js +1 -0
- package/assets/index-fiGpKN6W.js +1 -0
- package/assets/index-ficai7Ce.js +1 -0
- package/assets/index-fm1oF4Rd.js +1 -0
- package/assets/index-gQ8zpnGO.js +1 -0
- package/assets/index-hUldZ-v8.js +1 -0
- package/assets/index-iJWzlNVI.js +1 -0
- package/assets/index-j06jujv2.js +1 -0
- package/assets/index-j8mIFeCA.js +1 -0
- package/assets/index-j8xu_BhO.js +1 -0
- package/assets/index-jTpsrMvb.js +1 -0
- package/assets/index-jsmqr-24.js +1 -0
- package/assets/index-kNZGxYSe.js +1 -0
- package/assets/index-l2eJJ7mG.js +1 -0
- package/assets/index-l8DhIVZW.js +1 -0
- package/assets/index-lGNYNhMi.js +1 -0
- package/assets/index-lIOVfT2m.js +1 -0
- package/assets/index-m0YDsCpu.js +1 -0
- package/assets/index-mJTgSazQ.js +1 -0
- package/assets/index-npRlG_V2.js +1 -0
- package/assets/index-oEcArN4B.js +1 -0
- package/assets/index-otRo5H2H.js +1 -0
- package/assets/index-ovz39Egy.js +1 -0
- package/assets/index-p0ATWoVh.js +1 -0
- package/assets/index-pcLdliEp.js +1 -0
- package/assets/index-qNIXx6_B.js +1 -0
- package/assets/index-qmNRbp6W.js +1 -0
- package/assets/index-s6ugJH3L.js +1 -0
- package/assets/index-stFagoJS.js +1 -0
- package/assets/index-szNElS1a.js +1 -0
- package/assets/index-t6B_NULY.js +1 -0
- package/assets/index-tkvX3w1X.js +1 -0
- package/assets/index-uKvrIGe-.js +1 -0
- package/assets/index-uM5GtqSd.js +1 -0
- package/assets/index-wBbkQCZY.js +1 -0
- package/assets/index-wk2CJ7i5.js +1 -0
- package/assets/index-xEbiF_Me.js +1 -0
- package/assets/index-yLatYZZK.js +1 -0
- package/assets/index-yOwMLl2f.js +1 -0
- package/assets/index-yURkkC3L.js +1 -0
- package/assets/index.es-B3ObrDkW.js +27 -0
- package/assets/index.es-ClZCnaxS.js +1 -0
- package/assets/index.es-DqGsvA8g.js +12 -0
- package/assets/index.es-vOkXvnBD.js +2 -0
- package/assets/{index.umd-BQwmTmay.js → index.umd-CrjosV4X.js} +1 -1
- package/assets/{info-BiTWqOS2.js → info-Ce-k8YeY.js} +2 -2
- package/assets/{info-circle-BlwtSH6V.js → info-circle-DWKsUP7S.js} +2 -2
- package/assets/{lightbulb-DhJfj8MH.js → lightbulb-WJ_BxNVb.js} +2 -2
- package/assets/localBatchGatewayRequest-DbABcKyV.js +1 -0
- package/assets/logo-pattern-D4X-bvlg.webp +0 -0
- package/assets/{mail-lEAuFBjI.js → mail-KoHfgvFC.js} +2 -2
- package/assets/{mobile-vCIqBTka.js → mobile-DgiOcfZl.js} +2 -2
- package/assets/{more-CNs-UlcY.js → more-DQ2sX7uC.js} +2 -2
- package/assets/native-CJ5et6AR.js +1 -0
- package/assets/{network-placeholder-dEBkyLBn.js → network-placeholder-J46GlKpA.js} +2 -2
- package/assets/{nftPlaceholder-_Yrwy0gl.js → nftPlaceholder-DJzkRgNi.js} +2 -2
- package/assets/off-Bx4KjNoN.js +8 -0
- package/assets/openzeppelin-CDBEZ0A6.js +1 -0
- package/assets/ownerOf-H_15UHmZ.js +1 -0
- package/assets/parseNft-C-gFG5mL.js +2 -0
- package/assets/passkeys-CqFedyqV.js +1 -0
- package/assets/{play-store-BOAMj2E1.js → play-store-DnrAN_Zk.js} +2 -2
- package/assets/{plus-B3CQt1QT.js → plus-CG21jVu3.js} +2 -2
- package/assets/{qr-code-BAy9g_ON.js → qr-code-DCN5HoIC.js} +1 -1
- package/assets/qr-overlay-DZM2US31.js +76 -0
- package/assets/{recycle-horizontal-Df0Vqa14.js → recycle-horizontal-pV5cKVIC.js} +2 -2
- package/assets/{refresh-BxEO_tim.js → refresh-DDAlbnMR.js} +2 -2
- package/assets/{reown-logo-y7EqMfkb.js → reown-logo-BgBTRPqh.js} +2 -2
- package/assets/resolveImplementation--0Bj03XB.js +1 -0
- package/assets/rpc-BMTq3WxT.js +3 -0
- package/assets/search-F5Kt2PDD.js +8 -0
- package/assets/secp256k1-D0j47cev.js +1 -0
- package/assets/secp256k1-DTovG4r4.js +1 -0
- package/assets/secp256k1-HF3nQqZj.js +1 -0
- package/assets/{send-D6d3c-Pn.js → send-1sOEDYYV.js} +2 -2
- package/assets/send-batch-transaction-DexqN5g2.js +1 -0
- package/assets/send-eip712-transaction-CzOG_yjy.js +2 -0
- package/assets/send-gasless-transaction-BerY-rcr.js +2 -0
- package/assets/session-proposal-BxP6Eg-Q.js +1 -0
- package/assets/session-request-BmUVvzLs.js +2 -0
- package/assets/sha256-CBZo01eO.js +1 -0
- package/assets/signing-CQ15XHyj.js +30 -0
- package/assets/sleep-mAKpSMLY.js +1 -0
- package/assets/{swapHorizontal-kAJKtdFO.js → swapHorizontal-DwtkaBY9.js} +2 -2
- package/assets/{swapHorizontalBold-3GOCFzN3.js → swapHorizontalBold-DjH3VBED.js} +2 -2
- package/assets/{swapHorizontalMedium-Zch-_6kr.js → swapHorizontalMedium-B8m-zSxH.js} +2 -2
- package/assets/{swapHorizontalRoundedBold-BWMTRDi0.js → swapHorizontalRoundedBold-CcKr4oU5.js} +2 -2
- package/assets/{swapVertical-xZuzYdEd.js → swapVertical-Vhgw_9G1.js} +2 -2
- package/assets/{telegram-Bj2RBZxQ.js → telegram-CItwttXQ.js} +2 -2
- package/assets/thirdweb-BEvIP-fy.js +27 -0
- package/assets/thirdweb-DZ2vK6IO.js +1 -0
- package/assets/{three-dots-Cc-tfMGr.js → three-dots-DcElkEG2.js} +2 -2
- package/assets/totalSupply-DYVdetcS.js +1 -0
- package/assets/{twitch-BI5kalH0.js → twitch-DIYf-ntg.js} +2 -2
- package/assets/{twitterIcon-CLAvdnm3.js → twitterIcon-xMs4TJuA.js} +2 -2
- package/assets/uint8-array-CjVHUazS.js +1 -0
- package/assets/utils-B3vUvlNq.js +1 -0
- package/assets/{verify-BTOHn-c8.js → verify-CJQEOvVE.js} +2 -2
- package/assets/{verify-filled-k4EYM7Cx.js → verify-filled-Dm46z2W0.js} +2 -2
- package/assets/{w3m-modal-BN_vVw5I.js → w3m-modal-ime9_H71.js} +1 -1
- package/assets/wait-for-tx-receipt-BWZbdlKf.js +1 -0
- package/assets/{wallet-DyXqcjym.js → wallet-DsKK0DZZ.js} +2 -2
- package/assets/wallet-infos-BHI_w6r-.js +1 -0
- package/assets/{wallet-placeholder-XWpW8ukm.js → wallet-placeholder-lVvJajkJ.js} +2 -2
- package/assets/{walletconnect-BY5z5AWv.js → walletconnect-BzBoiyAH.js} +4 -4
- package/assets/wallets-CCAGQYIy.js +17 -0
- package/assets/{warning-circle-B_CSTZ92.js → warning-circle-DPKmaE0h.js} +2 -2
- package/assets/web-connector-BiJHWbvm.js +9 -0
- package/assets/{x-BMYVgeVC.js → x-DEpEErGT.js} +2 -2
- package/assets/zora-sepolia-CZ4Tf1UH.js +1 -0
- package/dcl-blog-site-0.2.2-23649734878.commit-de1a383.tgz +0 -0
- package/index.html +3 -3
- package/package.json +3 -3
- package/assets/all-wallets-DC01LqWF.js +0 -6
- package/assets/arrow-bottom-Dt2_a4Uc.js +0 -8
- package/assets/arrow-left-C7Dfuyvz.js +0 -8
- package/assets/arrow-right-DQuxvPSv.js +0 -8
- package/assets/arrow-top-B4EyC6oJ.js +0 -8
- package/assets/basic-CqJIYk7E.js +0 -2128
- package/assets/ccip-uhjATGap.js +0 -1
- package/assets/chevron-bottom-9T9F_74l.js +0 -8
- package/assets/chevron-left-ZXigefUh.js +0 -8
- package/assets/chevron-right-CAy3jHy9.js +0 -8
- package/assets/chevron-top-BdbIiSwG.js +0 -8
- package/assets/close-D2mqnZfU.js +0 -8
- package/assets/core-U204j_bI.js +0 -908
- package/assets/cursor-C9RcPFVI.js +0 -3
- package/assets/external-link-BElCAjBD.js +0 -8
- package/assets/index-BHO3IhfZ.js +0 -1
- package/assets/index-Bpdy2MPa.js +0 -5
- package/assets/index-BzJXlud5.js +0 -895
- package/assets/index-CvCoQvoF.js +0 -11
- package/assets/index-D6ZMQedT.js +0 -1
- package/assets/index-DWZ1rox-.js +0 -2
- package/assets/index-DfzECMTB.js +0 -1
- package/assets/index-I4GHeC7o.js +0 -395
- package/assets/index-n2uXTT5n.js +0 -12
- package/assets/index.es-CJShRzl8.js +0 -39
- package/assets/localBatchGatewayRequest-Gsv0T8EJ.js +0 -1
- package/assets/off-DGNi0YJQ.js +0 -8
- package/assets/search-C8bQGcPS.js +0 -8
- package/assets/secp256k1-D6itJ-3R.js +0 -1
- package/assets/secp256k1-Dm2IR8Ly.js +0 -1
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const __vite__fileDeps=["assets/secp256k1-D6itJ-3R.js","assets/index-BzJXlud5.js","assets/index-nibyPLVP.js","assets/core-U204j_bI.js"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]);
|
|
2
|
-
import{h as hh,g as fh,i as ei,f as Dt}from"./index-BzJXlud5.js";import{c as pg,g as Ya,s as gg,d as yg,k as mg,a as wg}from"./index-nibyPLVP.js";var la={exports:{}},Xr=typeof Reflect=="object"?Reflect:null,Ja=Xr&&typeof Xr.apply=="function"?Xr.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},xi;Xr&&typeof Xr.ownKeys=="function"?xi=Xr.ownKeys:Object.getOwnPropertySymbols?xi=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:xi=function(e){return Object.getOwnPropertyNames(e)};function vg(t){console&&console.warn&&console.warn(t)}var dh=Number.isNaN||function(e){return e!==e};function re(){re.init.call(this)}la.exports=re;la.exports.once=$g;re.EventEmitter=re;re.prototype._events=void 0;re.prototype._eventsCount=0;re.prototype._maxListeners=void 0;var Za=10;function is(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(re,"defaultMaxListeners",{enumerable:!0,get:function(){return Za},set:function(t){if(typeof t!="number"||t<0||dh(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Za=t}});re.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};re.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||dh(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function ph(t){return t._maxListeners===void 0?re.defaultMaxListeners:t._maxListeners}re.prototype.getMaxListeners=function(){return ph(this)};re.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[e];if(c===void 0)return!1;if(typeof c=="function")Ja(c,this,r);else for(var u=c.length,l=vh(c,u),n=0;n<u;++n)Ja(l[n],this,r);return!0};function gh(t,e,r,n){var i,s,o;if(is(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=ph(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,vg(a)}return t}re.prototype.addListener=function(e,r){return gh(this,e,r,!1)};re.prototype.on=re.prototype.addListener;re.prototype.prependListener=function(e,r){return gh(this,e,r,!0)};function bg(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function yh(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=bg.bind(n);return i.listener=r,n.wrapFn=i,i}re.prototype.once=function(e,r){return is(r),this.on(e,yh(this,e,r)),this};re.prototype.prependOnceListener=function(e,r){return is(r),this.prependListener(e,yh(this,e,r)),this};re.prototype.removeListener=function(e,r){var n,i,s,o,a;if(is(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():Eg(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};re.prototype.off=re.prototype.removeListener;re.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function mh(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?_g(i):vh(i,i.length)}re.prototype.listeners=function(e){return mh(this,e,!0)};re.prototype.rawListeners=function(e){return mh(this,e,!1)};re.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):wh.call(t,e)};re.prototype.listenerCount=wh;function wh(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}re.prototype.eventNames=function(){return this._eventsCount>0?xi(this._events):[]};function vh(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function Eg(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function _g(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function $g(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}bh(t,e,s,{once:!0}),e!=="error"&&Og(t,i,{once:!0})})}function Og(t,e,r){typeof t.on=="function"&&bh(t,"error",e,r)}function bh(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var Ig=la.exports,Qa=function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))},Pg=function(){function t(e,r,n){this.name=e,this.version=r,this.os=n,this.type="browser"}return t}(),Sg=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return t}(),Dg=function(){function t(e,r,n,i){this.name=e,this.version=r,this.os=n,this.bot=i,this.type="bot-device"}return t}(),xg=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),Ag=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),Cg=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,Lg=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Xa=3,Rg=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",Cg]],ec=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function Ng(t){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Ag:typeof navigator<"u"?jg(navigator.userAgent):Mg()}function Tg(t){return t!==""&&Rg.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function jg(t){var e=Tg(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new xg;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<Xa&&(i=Qa(Qa([],i,!0),Ug(Xa-i.length),!0)):i=[];var s=i.join("."),o=Bg(t),a=Lg.exec(t);return a&&a[1]?new Dg(r,s,o,a[1]):new Pg(r,s,o)}function Bg(t){for(var e=0,r=ec.length;e<r;e++){var n=ec[e],i=n[0],s=n[1],o=s.exec(t);if(o)return i}return null}function Mg(){var t=typeof process<"u"&&process.version;return t?new Sg(process.version.slice(1)):null}function Ug(t){for(var e=[],r=0;r<t;r++)e.push("0");return e}var N={};/*! *****************************************************************************
|
|
3
|
-
Copyright (c) Microsoft Corporation.
|
|
4
|
-
|
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
purpose with or without fee is hereby granted.
|
|
7
|
-
|
|
8
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */var bo=function(t,e){return bo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},bo(t,e)};function Fg(t,e){bo(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Eo=function(){return Eo=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Eo.apply(this,arguments)};function kg(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function qg(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function zg(t,e){return function(r,n){e(r,n,t)}}function Hg(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Kg(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(h){o(h)}}function c(l){try{u(n.throw(l))}catch(h){o(h)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})}function Vg(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(l){return c([u,l])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){r.label=u[1];break}if(u[0]===6&&r.label<s[1]){r.label=s[1],s=u;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(u);break}s[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(l){u=[6,l],i=0}finally{n=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function Wg(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function Gg(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function _o(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Eh(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function Yg(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Eh(arguments[e]));return t}function Jg(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function Hn(t){return this instanceof Hn?(this.v=t,this):new Hn(t)}function Zg(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(f){n[f]&&(i[f]=function(p){return new Promise(function(d,y){s.push([f,p,d,y])>1||a(f,p)})})}function a(f,p){try{c(n[f](p))}catch(d){h(s[0][3],d)}}function c(f){f.value instanceof Hn?Promise.resolve(f.value.v).then(u,l):h(s[0][2],f)}function u(f){a("next",f)}function l(f){a("throw",f)}function h(f,p){f(p),s.shift(),s.length&&a(s[0][0],s[0][1])}}function Qg(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Hn(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function Xg(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof _o=="function"?_o(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,c){o=t[s](o),i(a,c,o.done,o.value)})}}function i(s,o,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},o)}}function ey(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function ty(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function ry(t){return t&&t.__esModule?t:{default:t}}function ny(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function iy(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const sy=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Eo},__asyncDelegator:Qg,__asyncGenerator:Zg,__asyncValues:Xg,__await:Hn,__awaiter:Kg,__classPrivateFieldGet:ny,__classPrivateFieldSet:iy,__createBinding:Wg,__decorate:qg,__exportStar:Gg,__extends:Fg,__generator:Vg,__importDefault:ry,__importStar:ty,__makeTemplateObject:ey,__metadata:Hg,__param:zg,__read:Eh,__rest:kg,__spread:Yg,__spreadArrays:Jg,__values:_o},Symbol.toStringTag,{value:"Module"})),ss=hh(sy);var Ns={},In={},tc;function oy(){if(tc)return In;tc=1,Object.defineProperty(In,"__esModule",{value:!0}),In.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return In.delay=t,In}var rr={},Ts={},nr={},rc;function ay(){return rc||(rc=1,Object.defineProperty(nr,"__esModule",{value:!0}),nr.ONE_THOUSAND=nr.ONE_HUNDRED=void 0,nr.ONE_HUNDRED=100,nr.ONE_THOUSAND=1e3),nr}var js={},nc;function cy(){return nc||(nc=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(js)),js}var ic;function _h(){return ic||(ic=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=ss;e.__exportStar(ay(),t),e.__exportStar(cy(),t)}(Ts)),Ts}var sc;function uy(){if(sc)return rr;sc=1,Object.defineProperty(rr,"__esModule",{value:!0}),rr.fromMiliseconds=rr.toMiliseconds=void 0;const t=_h();function e(n){return n*t.ONE_THOUSAND}rr.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return rr.fromMiliseconds=r,rr}var oc;function ly(){return oc||(oc=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=ss;e.__exportStar(oy(),t),e.__exportStar(uy(),t)}(Ns)),Ns}var Dr={},ac;function hy(){if(ac)return Dr;ac=1,Object.defineProperty(Dr,"__esModule",{value:!0}),Dr.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return Dr.Watch=t,Dr.default=t,Dr}var Bs={},Pn={},cc;function fy(){if(cc)return Pn;cc=1,Object.defineProperty(Pn,"__esModule",{value:!0}),Pn.IWatch=void 0;class t{}return Pn.IWatch=t,Pn}var uc;function dy(){return uc||(uc=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),ss.__exportStar(fy(),t)}(Bs)),Bs}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=ss;e.__exportStar(ly(),t),e.__exportStar(hy(),t),e.__exportStar(dy(),t),e.__exportStar(_h(),t)})(N);var ge={};Object.defineProperty(ge,"__esModule",{value:!0});ge.getLocalStorage=ge.getLocalStorageOrThrow=ge.getCrypto=ge.getCryptoOrThrow=$h=ge.getLocation=ge.getLocationOrThrow=ha=ge.getNavigator=ge.getNavigatorOrThrow=gr=ge.getDocument=ge.getDocumentOrThrow=ge.getFromWindowOrThrow=ge.getFromWindow=void 0;function Er(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}ge.getFromWindow=Er;function mn(t){const e=Er(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}ge.getFromWindowOrThrow=mn;function py(){return mn("document")}ge.getDocumentOrThrow=py;function gy(){return Er("document")}var gr=ge.getDocument=gy;function yy(){return mn("navigator")}ge.getNavigatorOrThrow=yy;function my(){return Er("navigator")}var ha=ge.getNavigator=my;function wy(){return mn("location")}ge.getLocationOrThrow=wy;function vy(){return Er("location")}var $h=ge.getLocation=vy;function by(){return mn("crypto")}ge.getCryptoOrThrow=by;function Ey(){return Er("crypto")}ge.getCrypto=Ey;function _y(){return mn("localStorage")}ge.getLocalStorageOrThrow=_y;function $y(){return Er("localStorage")}ge.getLocalStorage=$y;var fa={};Object.defineProperty(fa,"__esModule",{value:!0});var Oh=fa.getWindowMetadata=void 0;const lc=ge;function Oy(){let t,e;try{t=lc.getDocumentOrThrow(),e=lc.getLocationOrThrow()}catch{return null}function r(){const h=t.getElementsByTagName("link"),f=[];for(let p=0;p<h.length;p++){const d=h[p],y=d.getAttribute("rel");if(y&&y.toLowerCase().indexOf("icon")>-1){const w=d.getAttribute("href");if(w)if(w.toLowerCase().indexOf("https:")===-1&&w.toLowerCase().indexOf("http:")===-1&&w.indexOf("//")!==0){let b=e.protocol+"//"+e.host;if(w.indexOf("/")===0)b+=w;else{const v=e.pathname.split("/");v.pop();const E=v.join("/");b+=E+"/"+w}f.push(b)}else if(w.indexOf("//")===0){const b=e.protocol+w;f.push(b)}else f.push(w)}}return f}function n(...h){const f=t.getElementsByTagName("meta");for(let p=0;p<f.length;p++){const d=f[p],y=["itemprop","property","name"].map(w=>d.getAttribute(w)).filter(w=>w?h.includes(w):!1);if(y.length&&y){const w=d.getAttribute("content");if(w)return w}}return""}function i(){let h=n("name","og:site_name","og:title","twitter:title");return h||(h=t.title),h}function s(){return n("description","og:description","twitter:description","keywords")}const o=i(),a=s(),c=e.origin,u=r();return{description:a,url:c,icons:u,name:o}}Oh=fa.getWindowMetadata=Oy;function Kn(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function hc(t){return Kn(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const Ih="2.23.2";let Sn={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:r})=>e?`${t??"https://viem.sh"}${e}${r?`#${r}`:""}`:void 0,version:`viem@${Ih}`};class yr extends Error{constructor(e,r={}){var a;const n=(()=>{var c;return r.cause instanceof yr?r.cause.details:(c=r.cause)!=null&&c.message?r.cause.message:r.details})(),i=r.cause instanceof yr&&r.cause.docsPath||r.docsPath,s=(a=Sn.getDocsUrl)==null?void 0:a.call(Sn,{...r,docsPath:i}),o=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...Sn.version?[`Version: ${Sn.version}`]:[]].join(`
|
|
16
|
-
`);super(o,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=e,this.version=Ih}walk(e){return Ph(this,e)}}function Ph(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?Ph(t.cause,e):e?null:t}class Sh extends yr{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}function wn(t,{dir:e,size:r=32}={}){return typeof t=="string"?Iy(t,{dir:e,size:r}):Py(t,{dir:e,size:r})}function Iy(t,{dir:e,size:r=32}={}){if(r===null)return t;const n=t.replace("0x","");if(n.length>r*2)throw new Sh({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](r*2,"0")}`}function Py(t,{dir:e,size:r=32}={}){if(r===null)return t;if(t.length>r)throw new Sh({size:t.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;i<r;i++){const s=e==="right";n[s?i:r-i-1]=t[s?i:t.length-i-1]}return n}class Sy extends yr{constructor({max:e,min:r,signed:n,size:i,value:s}){super(`Number "${s}" is not in safe ${i?`${i*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${e?`(${r} to ${e})`:`(above ${r})`}`,{name:"IntegerOutOfRangeError"})}}class Dy extends yr{constructor({givenSize:e,maxSize:r}){super(`Size cannot exceed ${r} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function vn(t,{size:e}){if(hc(t)>e)throw new Dy({givenSize:hc(t),maxSize:e})}function $o(t,e={}){const{signed:r}=e;e.size&&vn(t,{size:e.size});const n=BigInt(t);if(!r)return n;const i=(t.length-2)/2,s=(1n<<BigInt(i)*8n-1n)-1n;return n<=s?n:n-BigInt(`0x${"f".padStart(i*2,"f")}`)-1n}function xy(t,e={}){return Number($o(t,e))}const Ay=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Oo(t,e={}){return typeof t=="number"||typeof t=="bigint"?xh(t,e):typeof t=="string"?Ry(t,e):typeof t=="boolean"?Cy(t,e):Dh(t,e)}function Cy(t,e={}){const r=`0x${Number(t)}`;return typeof e.size=="number"?(vn(r,{size:e.size}),wn(r,{size:e.size})):r}function Dh(t,e={}){let r="";for(let i=0;i<t.length;i++)r+=Ay[t[i]];const n=`0x${r}`;return typeof e.size=="number"?(vn(n,{size:e.size}),wn(n,{dir:"right",size:e.size})):n}function xh(t,e={}){const{signed:r,size:n}=e,i=BigInt(t);let s;n?r?s=(1n<<BigInt(n)*8n-1n)-1n:s=2n**(BigInt(n)*8n)-1n:typeof t=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof s=="bigint"&&r?-s-1n:0;if(s&&i>s||i<o){const c=typeof t=="bigint"?"n":"";throw new Sy({max:s?`${s}${c}`:void 0,min:`${o}${c}`,signed:r,size:n,value:`${t}${c}`})}const a=`0x${(r&&i<0?(1n<<BigInt(n*8))+BigInt(i):i).toString(16)}`;return n?wn(a,{size:n}):a}const Ly=new TextEncoder;function Ry(t,e={}){const r=Ly.encode(t);return Dh(r,e)}const Ny=new TextEncoder;function Ty(t,e={}){return typeof t=="number"||typeof t=="bigint"?By(t,e):typeof t=="boolean"?jy(t,e):Kn(t)?Ah(t,e):Ch(t,e)}function jy(t,e={}){const r=new Uint8Array(1);return r[0]=Number(t),typeof e.size=="number"?(vn(r,{size:e.size}),wn(r,{size:e.size})):r}const Rt={zero:48,nine:57,A:65,F:70,a:97,f:102};function fc(t){if(t>=Rt.zero&&t<=Rt.nine)return t-Rt.zero;if(t>=Rt.A&&t<=Rt.F)return t-(Rt.A-10);if(t>=Rt.a&&t<=Rt.f)return t-(Rt.a-10)}function Ah(t,e={}){let r=t;e.size&&(vn(r,{size:e.size}),r=wn(r,{dir:"right",size:e.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let o=0,a=0;o<i;o++){const c=fc(n.charCodeAt(a++)),u=fc(n.charCodeAt(a++));if(c===void 0||u===void 0)throw new yr(`Invalid byte sequence ("${n[a-2]}${n[a-1]}" in "${n}").`);s[o]=c*16+u}return s}function By(t,e){const r=xh(t,e);return Ah(r)}function Ch(t,e={}){const r=Ny.encode(t);return typeof e.size=="number"?(vn(r,{size:e.size}),wn(r,{dir:"right",size:e.size})):r}function Ki(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function My(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function os(t,...e){if(!My(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function PC(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Ki(t.outputLen),Ki(t.blockLen)}function dc(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Uy(t,e){os(t);const r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}const fi=BigInt(2**32-1),pc=BigInt(32);function Fy(t,e=!1){return e?{h:Number(t&fi),l:Number(t>>pc&fi)}:{h:Number(t>>pc&fi)|0,l:Number(t&fi)|0}}function ky(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:s,l:o}=Fy(t[i],e);[r[i],n[i]]=[s,o]}return[r,n]}const qy=(t,e,r)=>t<<r|e>>>32-r,zy=(t,e,r)=>e<<r|t>>>32-r,Hy=(t,e,r)=>e<<r-32|t>>>64-r,Ky=(t,e,r)=>t<<r-32|e>>>64-r,xr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Vy(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function SC(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function DC(t,e){return t<<32-e|t>>>e}const gc=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Wy(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function yc(t){for(let e=0;e<t.length;e++)t[e]=Wy(t[e])}function Gy(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function Lh(t){return typeof t=="string"&&(t=Gy(t)),os(t),t}function xC(...t){let e=0;for(let n=0;n<t.length;n++){const i=t[n];os(i),e+=i.length}const r=new Uint8Array(e);for(let n=0,i=0;n<t.length;n++){const s=t[n];r.set(s,i),i+=s.length}return r}class Yy{clone(){return this._cloneInto()}}function Jy(t){const e=n=>t().update(Lh(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function AC(t=32){if(xr&&typeof xr.getRandomValues=="function")return xr.getRandomValues(new Uint8Array(t));if(xr&&typeof xr.randomBytes=="function")return xr.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}const Rh=[],Nh=[],Th=[],Zy=BigInt(0),Dn=BigInt(1),Qy=BigInt(2),Xy=BigInt(7),em=BigInt(256),tm=BigInt(113);for(let t=0,e=Dn,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],Rh.push(2*(5*n+r)),Nh.push((t+1)*(t+2)/2%64);let i=Zy;for(let s=0;s<7;s++)e=(e<<Dn^(e>>Xy)*tm)%em,e&Qy&&(i^=Dn<<(Dn<<BigInt(s))-Dn);Th.push(i)}const[rm,nm]=ky(Th,!0),mc=(t,e,r)=>r>32?Hy(t,e,r):qy(t,e,r),wc=(t,e,r)=>r>32?Ky(t,e,r):zy(t,e,r);function im(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,u=r[c],l=r[c+1],h=mc(u,l,1)^r[a],f=wc(u,l,1)^r[a+1];for(let p=0;p<50;p+=10)t[o+p]^=h,t[o+p+1]^=f}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=Nh[o],c=mc(i,s,a),u=wc(i,s,a),l=Rh[o];i=t[l],s=t[l+1],t[l]=c,t[l+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=rm[n],t[1]^=nm[n]}r.fill(0)}class da extends Yy{constructor(e,r,n,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Ki(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Vy(this.state)}keccak(){gc||yc(this.state32),im(this.state32,this.rounds),gc||yc(this.state32),this.posOut=0,this.pos=0}update(e){dc(this);const{blockLen:r,state:n}=this;e=Lh(e);const i=e.length;for(let s=0;s<i;){const o=Math.min(r-this.pos,i-s);for(let a=0;a<o;a++)n[this.pos++]^=e[s++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:r,pos:n,blockLen:i}=this;e[n]^=r,r&128&&n===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){dc(this,!1),os(e),this.finish();const r=this.state,{blockLen:n}=this;for(let i=0,s=e.length;i<s;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Ki(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Uy(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new da(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const sm=(t,e,r)=>Jy(()=>new da(e,t,r)),om=sm(1,136,256/8);function jh(t,e){const r=e||"hex",n=om(Kn(t,{strict:!1})?Ty(t):t);return r==="bytes"?n:Oo(n)}class am extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&r!==void 0&&(this.delete(e),super.set(e,r)),r}set(e,r){if(super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const Ms=new am(8192);function cm(t,e){if(Ms.has(`${t}.${e}`))return Ms.get(`${t}.${e}`);const r=t.substring(2).toLowerCase(),n=jh(Ch(r),"bytes"),i=r.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(n[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return Ms.set(`${t}.${e}`,s),s}function um(t){const e=jh(`0x${t.substring(4)}`).substring(26);return cm(`0x${e}`)}async function lm({hash:t,signature:e}){const r=Kn(t)?t:Oo(t),{secp256k1:n}=await fh(async()=>{const{secp256k1:o}=await import("./secp256k1-D6itJ-3R.js");return{secp256k1:o}},__vite__mapDeps([0,1,2]));return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:u,s:l,v:h,yParity:f}=e,p=Number(f??h),d=vc(p);return new n.Signature($o(u),$o(l)).addRecoveryBit(d)}const o=Kn(e)?e:Oo(e),a=xy(`0x${o.slice(130)}`),c=vc(a);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(c)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function vc(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function hm({hash:t,signature:e}){return um(await lm({hash:t,signature:e}))}function fm(t){if(t.length>=255)throw new TypeError("Alphabet too long");const e=new Uint8Array(256);for(let u=0;u<e.length;u++)e[u]=255;for(let u=0;u<t.length;u++){const l=t.charAt(u),h=l.charCodeAt(0);if(e[h]!==255)throw new TypeError(l+" is ambiguous");e[h]=u}const r=t.length,n=t.charAt(0),i=Math.log(r)/Math.log(256),s=Math.log(256)/Math.log(r);function o(u){if(u instanceof Uint8Array||(ArrayBuffer.isView(u)?u=new Uint8Array(u.buffer,u.byteOffset,u.byteLength):Array.isArray(u)&&(u=Uint8Array.from(u))),!(u instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(u.length===0)return"";let l=0,h=0,f=0;const p=u.length;for(;f!==p&&u[f]===0;)f++,l++;const d=(p-f)*s+1>>>0,y=new Uint8Array(d);for(;f!==p;){let v=u[f],E=0;for(let $=d-1;(v!==0||E<h)&&$!==-1;$--,E++)v+=256*y[$]>>>0,y[$]=v%r>>>0,v=v/r>>>0;if(v!==0)throw new Error("Non-zero carry");h=E,f++}let w=d-h;for(;w!==d&&y[w]===0;)w++;let b=n.repeat(l);for(;w<d;++w)b+=t.charAt(y[w]);return b}function a(u){if(typeof u!="string")throw new TypeError("Expected String");if(u.length===0)return new Uint8Array;let l=0,h=0,f=0;for(;u[l]===n;)h++,l++;const p=(u.length-l)*i+1>>>0,d=new Uint8Array(p);for(;l<u.length;){const v=u.charCodeAt(l);if(v>255)return;let E=e[v];if(E===255)return;let $=0;for(let D=p-1;(E!==0||$<f)&&D!==-1;D--,$++)E+=r*d[D]>>>0,d[D]=E%256>>>0,E=E/256>>>0;if(E!==0)throw new Error("Non-zero carry");f=$,l++}let y=p-f;for(;y!==p&&d[y]===0;)y++;const w=new Uint8Array(h+(p-y));let b=h;for(;y!==p;)w[b++]=d[y++];return w}function c(u){const l=a(u);if(l)return l;throw new Error("Non-base"+r+" character")}return{encode:o,decodeUnsafe:a,decode:c}}var dm="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const pm=fm(dm),gm=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),ym=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function mr(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return ym(t)}catch{return t}}function Ht(t){return typeof t=="string"?t:gm(t)||""}function mm(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function Bh(t,...e){if(!mm(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function bc(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function wm(t,e){Bh(t);const r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}const Ar=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Us=t=>new DataView(t.buffer,t.byteOffset,t.byteLength);function vm(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function Mh(t){return typeof t=="string"&&(t=vm(t)),Bh(t),t}let bm=class{clone(){return this._cloneInto()}};function Em(t){const e=n=>t().update(Mh(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function Uh(t=32){if(Ar&&typeof Ar.getRandomValues=="function")return Ar.getRandomValues(new Uint8Array(t));if(Ar&&typeof Ar.randomBytes=="function")return Ar.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}function _m(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),c=n?4:0,u=n?0:4;t.setUint32(e+c,o,n),t.setUint32(e+u,a,n)}let $m=class extends bm{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Us(this.buffer)}update(e){bc(this);const{view:r,buffer:n,blockLen:i}=this;e=Mh(e);const s=e.length;for(let o=0;o<s;){const a=Math.min(i-this.pos,s-o);if(a===i){const c=Us(e);for(;i<=s-o;o+=i)this.process(c,o);continue}n.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){bc(this),wm(e,this),this.finished=!0;const{buffer:r,view:n,blockLen:i,isLE:s}=this;let{pos:o}=this;r[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>i-o&&(this.process(n,0),o=0);for(let h=o;h<i;h++)r[h]=0;_m(n,i-8,BigInt(this.length*8),s),this.process(n,0);const a=Us(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<u;h++)a.setUint32(4*h,l[h],s)}digest(){const{buffer:e,outputLen:r}=this;this.digestInto(e);const n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:r,buffer:n,length:i,finished:s,destroyed:o,pos:a}=this;return e.length=i,e.pos=a,e.finished=s,e.destroyed=o,i%r&&e.buffer.set(n),e}};const di=BigInt(2**32-1),Io=BigInt(32);function Fh(t,e=!1){return e?{h:Number(t&di),l:Number(t>>Io&di)}:{h:Number(t>>Io&di)|0,l:Number(t&di)|0}}function Om(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:s,l:o}=Fh(t[i],e);[r[i],n[i]]=[s,o]}return[r,n]}const Im=(t,e)=>BigInt(t>>>0)<<Io|BigInt(e>>>0),Pm=(t,e,r)=>t>>>r,Sm=(t,e,r)=>t<<32-r|e>>>r,Dm=(t,e,r)=>t>>>r|e<<32-r,xm=(t,e,r)=>t<<32-r|e>>>r,Am=(t,e,r)=>t<<64-r|e>>>r-32,Cm=(t,e,r)=>t>>>r-32|e<<64-r,Lm=(t,e)=>e,Rm=(t,e)=>t,Nm=(t,e,r)=>t<<r|e>>>32-r,Tm=(t,e,r)=>e<<r|t>>>32-r,jm=(t,e,r)=>e<<r-32|t>>>64-r,Bm=(t,e,r)=>t<<r-32|e>>>64-r;function Mm(t,e,r,n){const i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}const Um=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),Fm=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,km=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),qm=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,zm=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),Hm=(t,e,r,n,i,s)=>e+r+n+i+s+(t/2**32|0)|0,K={fromBig:Fh,split:Om,toBig:Im,shrSH:Pm,shrSL:Sm,rotrSH:Dm,rotrSL:xm,rotrBH:Am,rotrBL:Cm,rotr32H:Lm,rotr32L:Rm,rotlSH:Nm,rotlSL:Tm,rotlBH:jm,rotlBL:Bm,add:Mm,add3L:Um,add3H:Fm,add4L:km,add4H:qm,add5H:Hm,add5L:zm},[Km,Vm]=K.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),Kt=new Uint32Array(80),Vt=new Uint32Array(80);let Wm=class extends $m{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:r,Bh:n,Bl:i,Ch:s,Cl:o,Dh:a,Dl:c,Eh:u,El:l,Fh:h,Fl:f,Gh:p,Gl:d,Hh:y,Hl:w}=this;return[e,r,n,i,s,o,a,c,u,l,h,f,p,d,y,w]}set(e,r,n,i,s,o,a,c,u,l,h,f,p,d,y,w){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=s|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=u|0,this.El=l|0,this.Fh=h|0,this.Fl=f|0,this.Gh=p|0,this.Gl=d|0,this.Hh=y|0,this.Hl=w|0}process(e,r){for(let E=0;E<16;E++,r+=4)Kt[E]=e.getUint32(r),Vt[E]=e.getUint32(r+=4);for(let E=16;E<80;E++){const $=Kt[E-15]|0,D=Vt[E-15]|0,x=K.rotrSH($,D,1)^K.rotrSH($,D,8)^K.shrSH($,D,7),S=K.rotrSL($,D,1)^K.rotrSL($,D,8)^K.shrSL($,D,7),C=Kt[E-2]|0,I=Vt[E-2]|0,k=K.rotrSH(C,I,19)^K.rotrBH(C,I,61)^K.shrSH(C,I,6),B=K.rotrSL(C,I,19)^K.rotrBL(C,I,61)^K.shrSL(C,I,6),j=K.add4L(S,B,Vt[E-7],Vt[E-16]),q=K.add4H(j,x,k,Kt[E-7],Kt[E-16]);Kt[E]=q|0,Vt[E]=j|0}let{Ah:n,Al:i,Bh:s,Bl:o,Ch:a,Cl:c,Dh:u,Dl:l,Eh:h,El:f,Fh:p,Fl:d,Gh:y,Gl:w,Hh:b,Hl:v}=this;for(let E=0;E<80;E++){const $=K.rotrSH(h,f,14)^K.rotrSH(h,f,18)^K.rotrBH(h,f,41),D=K.rotrSL(h,f,14)^K.rotrSL(h,f,18)^K.rotrBL(h,f,41),x=h&p^~h&y,S=f&d^~f&w,C=K.add5L(v,D,S,Vm[E],Vt[E]),I=K.add5H(C,b,$,x,Km[E],Kt[E]),k=C|0,B=K.rotrSH(n,i,28)^K.rotrBH(n,i,34)^K.rotrBH(n,i,39),j=K.rotrSL(n,i,28)^K.rotrBL(n,i,34)^K.rotrBL(n,i,39),q=n&s^n&a^s&a,L=i&o^i&c^o&c;b=y|0,v=w|0,y=p|0,w=d|0,p=h|0,d=f|0,{h,l:f}=K.add(u|0,l|0,I|0,k|0),u=a|0,l=c|0,a=s|0,c=o|0,s=n|0,o=i|0;const g=K.add3L(k,j,L);n=K.add3H(g,I,B,q),i=g|0}({h:n,l:i}=K.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:s,l:o}=K.add(this.Bh|0,this.Bl|0,s|0,o|0),{h:a,l:c}=K.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:u,l}=K.add(this.Dh|0,this.Dl|0,u|0,l|0),{h,l:f}=K.add(this.Eh|0,this.El|0,h|0,f|0),{h:p,l:d}=K.add(this.Fh|0,this.Fl|0,p|0,d|0),{h:y,l:w}=K.add(this.Gh|0,this.Gl|0,y|0,w|0),{h:b,l:v}=K.add(this.Hh|0,this.Hl|0,b|0,v|0),this.set(n,i,s,o,a,c,u,l,h,f,p,d,y,w,b,v)}roundClean(){Kt.fill(0),Vt.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};const Gm=Em(()=>new Wm);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const pa=BigInt(0),kh=BigInt(1),Ym=BigInt(2);function ga(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function ya(t){if(!ga(t))throw new Error("Uint8Array expected")}function Fs(t,e){if(typeof e!="boolean")throw new Error(t+" boolean expected, got "+e)}const Jm=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function ma(t){ya(t);let e="";for(let r=0;r<t.length;r++)e+=Jm[t[r]];return e}function qh(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?pa:BigInt("0x"+t)}const Nt={_0:48,_9:57,A:65,F:70,a:97,f:102};function Ec(t){if(t>=Nt._0&&t<=Nt._9)return t-Nt._0;if(t>=Nt.A&&t<=Nt.F)return t-(Nt.A-10);if(t>=Nt.a&&t<=Nt.f)return t-(Nt.a-10)}function zh(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,s=0;i<r;i++,s+=2){const o=Ec(t.charCodeAt(s)),a=Ec(t.charCodeAt(s+1));if(o===void 0||a===void 0){const c=t[s]+t[s+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+s)}n[i]=o*16+a}return n}function Zm(t){return qh(ma(t))}function Ai(t){return ya(t),qh(ma(Uint8Array.from(t).reverse()))}function Hh(t,e){return zh(t.toString(16).padStart(e*2,"0"))}function Po(t,e){return Hh(t,e).reverse()}function Tt(t,e,r){let n;if(typeof e=="string")try{n=zh(e)}catch(s){throw new Error(t+" must be hex string or Uint8Array, cause: "+s)}else if(ga(e))n=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");const i=n.length;if(typeof r=="number"&&i!==r)throw new Error(t+" of length "+r+" expected, got "+i);return n}function _c(...t){let e=0;for(let n=0;n<t.length;n++){const i=t[n];ya(i),e+=i.length}const r=new Uint8Array(e);for(let n=0,i=0;n<t.length;n++){const s=t[n];r.set(s,i),i+=s.length}return r}const ks=t=>typeof t=="bigint"&&pa<=t;function Qm(t,e,r){return ks(t)&&ks(e)&&ks(r)&&e<=t&&t<r}function xn(t,e,r,n){if(!Qm(e,r,n))throw new Error("expected valid "+t+": "+r+" <= n < "+n+", got "+e)}function Xm(t){let e;for(e=0;t>pa;t>>=kh,e+=1);return e}const ew=t=>(Ym<<BigInt(t-1))-kh,tw={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||ga(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function wa(t,e,r={}){const n=(i,s,o)=>{const a=tw[s];if(typeof a!="function")throw new Error("invalid validator function");const c=t[i];if(!(o&&c===void 0)&&!a(c,t))throw new Error("param "+String(i)+" is invalid. Expected "+s+", got "+c)};for(const[i,s]of Object.entries(e))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return t}function $c(t){const e=new WeakMap;return(r,...n)=>{const i=e.get(r);if(i!==void 0)return i;const s=t(r,...n);return e.set(r,s),s}}const De=BigInt(0),me=BigInt(1),cr=BigInt(2),rw=BigInt(3),So=BigInt(4),Oc=BigInt(5),Ic=BigInt(8);function _e(t,e){const r=t%e;return r>=De?r:e+r}function nw(t,e,r){if(e<De)throw new Error("invalid exponent, negatives unsupported");if(r<=De)throw new Error("invalid modulus");if(r===me)return De;let n=me;for(;e>De;)e&me&&(n=n*t%r),t=t*t%r,e>>=me;return n}function Et(t,e,r){let n=t;for(;e-- >De;)n*=n,n%=r;return n}function Pc(t,e){if(t===De)throw new Error("invert: expected non-zero number");if(e<=De)throw new Error("invert: expected positive modulus, got "+e);let r=_e(t,e),n=e,i=De,s=me;for(;r!==De;){const o=n/r,a=n%r,c=i-s*o;n=r,r=a,i=s,s=c}if(n!==me)throw new Error("invert: does not exist");return _e(i,e)}function iw(t){const e=(t-me)/cr;let r,n,i;for(r=t-me,n=0;r%cr===De;r/=cr,n++);for(i=cr;i<t&&nw(i,e,t)!==t-me;i++)if(i>1e3)throw new Error("Cannot find square root: likely non-prime P");if(n===1){const o=(t+me)/So;return function(a,c){const u=a.pow(c,o);if(!a.eql(a.sqr(u),c))throw new Error("Cannot find square root");return u}}const s=(r+me)/cr;return function(o,a){if(o.pow(a,e)===o.neg(o.ONE))throw new Error("Cannot find square root");let c=n,u=o.pow(o.mul(o.ONE,i),r),l=o.pow(a,s),h=o.pow(a,r);for(;!o.eql(h,o.ONE);){if(o.eql(h,o.ZERO))return o.ZERO;let f=1;for(let d=o.sqr(h);f<c&&!o.eql(d,o.ONE);f++)d=o.sqr(d);const p=o.pow(u,me<<BigInt(c-f-1));u=o.sqr(p),l=o.mul(l,p),h=o.mul(h,u),c=f}return l}}function sw(t){if(t%So===rw){const e=(t+me)/So;return function(r,n){const i=r.pow(n,e);if(!r.eql(r.sqr(i),n))throw new Error("Cannot find square root");return i}}if(t%Ic===Oc){const e=(t-Oc)/Ic;return function(r,n){const i=r.mul(n,cr),s=r.pow(i,e),o=r.mul(n,s),a=r.mul(r.mul(o,cr),s),c=r.mul(o,r.sub(a,r.ONE));if(!r.eql(r.sqr(c),n))throw new Error("Cannot find square root");return c}}return iw(t)}const ow=(t,e)=>(_e(t,e)&me)===me,aw=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function cw(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=aw.reduce((n,i)=>(n[i]="function",n),e);return wa(t,r)}function uw(t,e,r){if(r<De)throw new Error("invalid exponent, negatives unsupported");if(r===De)return t.ONE;if(r===me)return e;let n=t.ONE,i=e;for(;r>De;)r&me&&(n=t.mul(n,i)),i=t.sqr(i),r>>=me;return n}function lw(t,e){const r=new Array(e.length),n=e.reduce((s,o,a)=>t.is0(o)?s:(r[a]=s,t.mul(s,o)),t.ONE),i=t.inv(n);return e.reduceRight((s,o,a)=>t.is0(o)?s:(r[a]=t.mul(s,r[a]),t.mul(s,o)),i),r}function Kh(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function Vh(t,e,r=!1,n={}){if(t<=De)throw new Error("invalid field: expected ORDER > 0, got "+t);const{nBitLength:i,nByteLength:s}=Kh(t,e);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:t,isLE:r,BITS:i,BYTES:s,MASK:ew(i),ZERO:De,ONE:me,create:c=>_e(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return De<=c&&c<t},is0:c=>c===De,isOdd:c=>(c&me)===me,neg:c=>_e(-c,t),eql:(c,u)=>c===u,sqr:c=>_e(c*c,t),add:(c,u)=>_e(c+u,t),sub:(c,u)=>_e(c-u,t),mul:(c,u)=>_e(c*u,t),pow:(c,u)=>uw(a,c,u),div:(c,u)=>_e(c*Pc(u,t),t),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>Pc(c,t),sqrt:n.sqrt||(c=>(o||(o=sw(t)),o(a,c))),invertBatch:c=>lw(a,c),cmov:(c,u,l)=>l?u:c,toBytes:c=>r?Po(c,s):Hh(c,s),fromBytes:c=>{if(c.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+c.length);return r?Ai(c):Zm(c)}});return Object.freeze(a)}const Sc=BigInt(0),pi=BigInt(1);function qs(t,e){const r=e.negate();return t?r:e}function Wh(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function zs(t,e){Wh(t,e);const r=Math.ceil(e/t)+1,n=2**(t-1);return{windows:r,windowSize:n}}function hw(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((r,n)=>{if(!(r instanceof e))throw new Error("invalid point at index "+n)})}function fw(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((r,n)=>{if(!e.isValid(r))throw new Error("invalid scalar at index "+n)})}const Hs=new WeakMap,Gh=new WeakMap;function Ks(t){return Gh.get(t)||1}function dw(t,e){return{constTimeNegate:qs,hasPrecomputes(r){return Ks(r)!==1},unsafeLadder(r,n,i=t.ZERO){let s=r;for(;n>Sc;)n&pi&&(i=i.add(s)),s=s.double(),n>>=pi;return i},precomputeWindow(r,n){const{windows:i,windowSize:s}=zs(n,e),o=[];let a=r,c=a;for(let u=0;u<i;u++){c=a,o.push(c);for(let l=1;l<s;l++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(r,n,i){const{windows:s,windowSize:o}=zs(r,e);let a=t.ZERO,c=t.BASE;const u=BigInt(2**r-1),l=2**r,h=BigInt(r);for(let f=0;f<s;f++){const p=f*o;let d=Number(i&u);i>>=h,d>o&&(d-=l,i+=pi);const y=p,w=p+Math.abs(d)-1,b=f%2!==0,v=d<0;d===0?c=c.add(qs(b,n[y])):a=a.add(qs(v,n[w]))}return{p:a,f:c}},wNAFUnsafe(r,n,i,s=t.ZERO){const{windows:o,windowSize:a}=zs(r,e),c=BigInt(2**r-1),u=2**r,l=BigInt(r);for(let h=0;h<o;h++){const f=h*a;if(i===Sc)break;let p=Number(i&c);if(i>>=l,p>a&&(p-=u,i+=pi),p===0)continue;let d=n[f+Math.abs(p)-1];p<0&&(d=d.negate()),s=s.add(d)}return s},getPrecomputes(r,n,i){let s=Hs.get(n);return s||(s=this.precomputeWindow(n,r),r!==1&&Hs.set(n,i(s))),s},wNAFCached(r,n,i){const s=Ks(r);return this.wNAF(s,this.getPrecomputes(s,r,i),n)},wNAFCachedUnsafe(r,n,i,s){const o=Ks(r);return o===1?this.unsafeLadder(r,n,s):this.wNAFUnsafe(o,this.getPrecomputes(o,r,i),n,s)},setWindowSize(r,n){Wh(n,e),Gh.set(r,n),Hs.delete(r)}}}function pw(t,e,r,n){if(hw(r,t),fw(n,e),r.length!==n.length)throw new Error("arrays of points and scalars must have equal length");const i=t.ZERO,s=Xm(BigInt(r.length)),o=s>12?s-3:s>4?s-2:s?2:1,a=(1<<o)-1,c=new Array(a+1).fill(i),u=Math.floor((e.BITS-1)/o)*o;let l=i;for(let h=u;h>=0;h-=o){c.fill(i);for(let p=0;p<n.length;p++){const d=n[p],y=Number(d>>BigInt(h)&BigInt(a));c[y]=c[y].add(r[p])}let f=i;for(let p=c.length-1,d=i;p>0;p--)d=d.add(c[p]),f=f.add(d);if(l=l.add(f),h!==0)for(let p=0;p<o;p++)l=l.double()}return l}function gw(t){return cw(t.Fp),wa(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Kh(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}const dt=BigInt(0),He=BigInt(1),gi=BigInt(2),yw=BigInt(8),mw={zip215:!0};function ww(t){const e=gw(t);return wa(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function vw(t){const e=ww(t),{Fp:r,n,prehash:i,hash:s,randomBytes:o,nByteLength:a,h:c}=e,u=gi<<BigInt(a*8)-He,l=r.create,h=Vh(e.n,e.nBitLength),f=e.uvRatio||((g,m)=>{try{return{isValid:!0,value:r.sqrt(g*r.inv(m))}}catch{return{isValid:!1,value:dt}}}),p=e.adjustScalarBytes||(g=>g),d=e.domain||((g,m,_)=>{if(Fs("phflag",_),m.length||_)throw new Error("Contexts/pre-hash are not supported");return g});function y(g,m){xn("coordinate "+g,m,dt,u)}function w(g){if(!(g instanceof E))throw new Error("ExtendedPoint expected")}const b=$c((g,m)=>{const{ex:_,ey:P,ez:O}=g,A=g.is0();m==null&&(m=A?yw:r.inv(O));const M=l(_*m),F=l(P*m),z=l(O*m);if(A)return{x:dt,y:He};if(z!==He)throw new Error("invZ was invalid");return{x:M,y:F}}),v=$c(g=>{const{a:m,d:_}=e;if(g.is0())throw new Error("bad point: ZERO");const{ex:P,ey:O,ez:A,et:M}=g,F=l(P*P),z=l(O*O),U=l(A*A),H=l(U*U),G=l(F*m),de=l(U*l(G+z)),ee=l(H+l(_*l(F*z)));if(de!==ee)throw new Error("bad point: equation left != right (1)");const Y=l(P*O),Be=l(A*M);if(Y!==Be)throw new Error("bad point: equation left != right (2)");return!0});class E{constructor(m,_,P,O){this.ex=m,this.ey=_,this.ez=P,this.et=O,y("x",m),y("y",_),y("z",P),y("t",O),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(m){if(m instanceof E)throw new Error("extended point not allowed");const{x:_,y:P}=m||{};return y("x",_),y("y",P),new E(_,P,He,l(_*P))}static normalizeZ(m){const _=r.invertBatch(m.map(P=>P.ez));return m.map((P,O)=>P.toAffine(_[O])).map(E.fromAffine)}static msm(m,_){return pw(E,h,m,_)}_setWindowSize(m){x.setWindowSize(this,m)}assertValidity(){v(this)}equals(m){w(m);const{ex:_,ey:P,ez:O}=this,{ex:A,ey:M,ez:F}=m,z=l(_*F),U=l(A*O),H=l(P*F),G=l(M*O);return z===U&&H===G}is0(){return this.equals(E.ZERO)}negate(){return new E(l(-this.ex),this.ey,this.ez,l(-this.et))}double(){const{a:m}=e,{ex:_,ey:P,ez:O}=this,A=l(_*_),M=l(P*P),F=l(gi*l(O*O)),z=l(m*A),U=_+P,H=l(l(U*U)-A-M),G=z+M,de=G-F,ee=z-M,Y=l(H*de),Be=l(G*ee),Ae=l(H*ee),Fe=l(de*G);return new E(Y,Be,Fe,Ae)}add(m){w(m);const{a:_,d:P}=e,{ex:O,ey:A,ez:M,et:F}=this,{ex:z,ey:U,ez:H,et:G}=m;if(_===BigInt(-1)){const qa=l((A-O)*(U+z)),za=l((A+O)*(U-z)),Rs=l(za-qa);if(Rs===dt)return this.double();const Ha=l(M*gi*G),Ka=l(F*gi*H),Va=Ka+Ha,Wa=za+qa,Ga=Ka-Ha,lg=l(Va*Rs),hg=l(Wa*Ga),fg=l(Va*Ga),dg=l(Rs*Wa);return new E(lg,hg,dg,fg)}const de=l(O*z),ee=l(A*U),Y=l(F*P*G),Be=l(M*H),Ae=l((O+A)*(z+U)-de-ee),Fe=Be-Y,it=Be+Y,st=l(ee-_*de),Sr=l(Ae*Fe),ag=l(it*st),cg=l(Ae*st),ug=l(Fe*it);return new E(Sr,ag,ug,cg)}subtract(m){return this.add(m.negate())}wNAF(m){return x.wNAFCached(this,m,E.normalizeZ)}multiply(m){const _=m;xn("scalar",_,He,n);const{p:P,f:O}=this.wNAF(_);return E.normalizeZ([P,O])[0]}multiplyUnsafe(m,_=E.ZERO){const P=m;return xn("scalar",P,dt,n),P===dt?D:this.is0()||P===He?this:x.wNAFCachedUnsafe(this,P,E.normalizeZ,_)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return x.unsafeLadder(this,n).is0()}toAffine(m){return b(this,m)}clearCofactor(){const{h:m}=e;return m===He?this:this.multiplyUnsafe(m)}static fromHex(m,_=!1){const{d:P,a:O}=e,A=r.BYTES;m=Tt("pointHex",m,A),Fs("zip215",_);const M=m.slice(),F=m[A-1];M[A-1]=F&-129;const z=Ai(M),U=_?u:r.ORDER;xn("pointHex.y",z,dt,U);const H=l(z*z),G=l(H-He),de=l(P*H-O);let{isValid:ee,value:Y}=f(G,de);if(!ee)throw new Error("Point.fromHex: invalid y coordinate");const Be=(Y&He)===He,Ae=(F&128)!==0;if(!_&&Y===dt&&Ae)throw new Error("Point.fromHex: x=0 and x_0=1");return Ae!==Be&&(Y=l(-Y)),E.fromAffine({x:Y,y:z})}static fromPrivateKey(m){return I(m).point}toRawBytes(){const{x:m,y:_}=this.toAffine(),P=Po(_,r.BYTES);return P[P.length-1]|=m&He?128:0,P}toHex(){return ma(this.toRawBytes())}}E.BASE=new E(e.Gx,e.Gy,He,l(e.Gx*e.Gy)),E.ZERO=new E(dt,He,He,dt);const{BASE:$,ZERO:D}=E,x=dw(E,a*8);function S(g){return _e(g,n)}function C(g){return S(Ai(g))}function I(g){const m=r.BYTES;g=Tt("private key",g,m);const _=Tt("hashed private key",s(g),2*m),P=p(_.slice(0,m)),O=_.slice(m,2*m),A=C(P),M=$.multiply(A),F=M.toRawBytes();return{head:P,prefix:O,scalar:A,point:M,pointBytes:F}}function k(g){return I(g).pointBytes}function B(g=new Uint8Array,...m){const _=_c(...m);return C(s(d(_,Tt("context",g),!!i)))}function j(g,m,_={}){g=Tt("message",g),i&&(g=i(g));const{prefix:P,scalar:O,pointBytes:A}=I(m),M=B(_.context,P,g),F=$.multiply(M).toRawBytes(),z=B(_.context,F,A,g),U=S(M+z*O);xn("signature.s",U,dt,n);const H=_c(F,Po(U,r.BYTES));return Tt("result",H,r.BYTES*2)}const q=mw;function L(g,m,_,P=q){const{context:O,zip215:A}=P,M=r.BYTES;g=Tt("signature",g,2*M),m=Tt("message",m),_=Tt("publicKey",_,M),A!==void 0&&Fs("zip215",A),i&&(m=i(m));const F=Ai(g.slice(M,2*M));let z,U,H;try{z=E.fromHex(_,A),U=E.fromHex(g.slice(0,M),A),H=$.multiplyUnsafe(F)}catch{return!1}if(!A&&z.isSmallOrder())return!1;const G=B(O,U.toRawBytes(),z.toRawBytes(),m);return U.add(z.multiplyUnsafe(G)).subtract(H).clearCofactor().equals(E.ZERO)}return $._setWindowSize(8),{CURVE:e,getPublicKey:k,sign:j,verify:L,ExtendedPoint:E,utils:{getExtendedPublicKey:I,randomPrivateKey:()=>o(r.BYTES),precompute(g=8,m=E.BASE){return m._setWindowSize(g),m.multiply(BigInt(3)),m}}}}BigInt(0),BigInt(1);const va=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Dc=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const bw=BigInt(1),xc=BigInt(2);BigInt(3);const Ew=BigInt(5),_w=BigInt(8);function $w(t){const e=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),s=va,o=t*t%s*t%s,a=Et(o,xc,s)*o%s,c=Et(a,bw,s)*t%s,u=Et(c,Ew,s)*c%s,l=Et(u,e,s)*u%s,h=Et(l,r,s)*l%s,f=Et(h,n,s)*h%s,p=Et(f,i,s)*f%s,d=Et(p,i,s)*f%s,y=Et(d,e,s)*u%s;return{pow_p_5_8:Et(y,xc,s)*t%s,b2:o}}function Ow(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}function Iw(t,e){const r=va,n=_e(e*e*e,r),i=_e(n*n*e,r),s=$w(t*i).pow_p_5_8;let o=_e(t*n*s,r);const a=_e(e*o*o,r),c=o,u=_e(o*Dc,r),l=a===t,h=a===_e(-t,r),f=a===_e(-t*Dc,r);return l&&(o=c),(h||f)&&(o=u),ow(o,r)&&(o=_e(-o,r)),{isValid:l||h,value:o}}const Pw=Vh(va,void 0,!0),Sw={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Pw,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:_w,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Gm,randomBytes:Uh,adjustScalarBytes:Ow,uvRatio:Iw},Yh=vw(Sw),Dw="EdDSA",xw="JWT",Vi=".",as="base64url",Jh="utf8",Zh="utf8",Aw=":",Cw="did",Lw="key",Ac="base58btc",Rw="z",Nw="K36",Tw=32;function ba(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function Qh(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?ba(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function Xh(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=Qh(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return ba(r)}function jw(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var s=t.charAt(i),o=s.charCodeAt(0);if(r[o]!==255)throw new TypeError(s+" is ambiguous");r[o]=i}var a=t.length,c=t.charAt(0),u=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function h(d){if(d instanceof Uint8Array||(ArrayBuffer.isView(d)?d=new Uint8Array(d.buffer,d.byteOffset,d.byteLength):Array.isArray(d)&&(d=Uint8Array.from(d))),!(d instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(d.length===0)return"";for(var y=0,w=0,b=0,v=d.length;b!==v&&d[b]===0;)b++,y++;for(var E=(v-b)*l+1>>>0,$=new Uint8Array(E);b!==v;){for(var D=d[b],x=0,S=E-1;(D!==0||x<w)&&S!==-1;S--,x++)D+=256*$[S]>>>0,$[S]=D%a>>>0,D=D/a>>>0;if(D!==0)throw new Error("Non-zero carry");w=x,b++}for(var C=E-w;C!==E&&$[C]===0;)C++;for(var I=c.repeat(y);C<E;++C)I+=t.charAt($[C]);return I}function f(d){if(typeof d!="string")throw new TypeError("Expected String");if(d.length===0)return new Uint8Array;var y=0;if(d[y]!==" "){for(var w=0,b=0;d[y]===c;)w++,y++;for(var v=(d.length-y)*u+1>>>0,E=new Uint8Array(v);d[y];){var $=r[d.charCodeAt(y)];if($===255)return;for(var D=0,x=v-1;($!==0||D<b)&&x!==-1;x--,D++)$+=a*E[x]>>>0,E[x]=$%256>>>0,$=$/256>>>0;if($!==0)throw new Error("Non-zero carry");b=D,y++}if(d[y]!==" "){for(var S=v-b;S!==v&&E[S]===0;)S++;for(var C=new Uint8Array(w+(v-S)),I=w;S!==v;)C[I++]=E[S++];return C}}}function p(d){var y=f(d);if(y)return y;throw new Error(`Non-${e} character`)}return{encode:h,decodeUnsafe:f,decode:p}}var Bw=jw,Mw=Bw;const ef=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},Uw=t=>new TextEncoder().encode(t),Fw=t=>new TextDecoder().decode(t);let kw=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},qw=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return tf(this,e)}},zw=class{constructor(e){this.decoders=e}or(e){return tf(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};const tf=(t,e)=>new zw({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});let Hw=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new kw(e,r,n),this.decoder=new qw(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};const cs=({name:t,prefix:e,encode:r,decode:n})=>new Hw(t,e,r,n),ti=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=Mw(r,e);return cs({prefix:t,name:e,encode:n,decode:s=>ef(i(s))})},Kw=(t,e,r,n)=>{const i={};for(let l=0;l<e.length;++l)i[e[l]]=l;let s=t.length;for(;t[s-1]==="=";)--s;const o=new Uint8Array(s*r/8|0);let a=0,c=0,u=0;for(let l=0;l<s;++l){const h=i[t[l]];if(h===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<r|h,a+=r,a>=8&&(a-=8,o[u++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},Vw=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<<r)-1;let s="",o=0,a=0;for(let c=0;c<t.length;++c)for(a=a<<8|t[c],o+=8;o>r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<<r-o]),n)for(;s.length*r&7;)s+="=";return s},Ne=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>cs({prefix:e,name:t,encode(i){return Vw(i,n,r)},decode(i){return Kw(i,n,r,t)}}),Ww=cs({prefix:"\0",name:"identity",encode:t=>Fw(t),decode:t=>Uw(t)});var Gw=Object.freeze({__proto__:null,identity:Ww});const Yw=Ne({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Jw=Object.freeze({__proto__:null,base2:Yw});const Zw=Ne({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Qw=Object.freeze({__proto__:null,base8:Zw});const Xw=ti({prefix:"9",name:"base10",alphabet:"0123456789"});var ev=Object.freeze({__proto__:null,base10:Xw});const tv=Ne({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),rv=Ne({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var nv=Object.freeze({__proto__:null,base16:tv,base16upper:rv});const iv=Ne({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),sv=Ne({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ov=Ne({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),av=Ne({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),cv=Ne({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),uv=Ne({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),lv=Ne({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),hv=Ne({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),fv=Ne({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var dv=Object.freeze({__proto__:null,base32:iv,base32upper:sv,base32pad:ov,base32padupper:av,base32hex:cv,base32hexupper:uv,base32hexpad:lv,base32hexpadupper:hv,base32z:fv});const pv=ti({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),gv=ti({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var yv=Object.freeze({__proto__:null,base36:pv,base36upper:gv});const mv=ti({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),wv=ti({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var vv=Object.freeze({__proto__:null,base58btc:mv,base58flickr:wv});const bv=Ne({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Ev=Ne({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),_v=Ne({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),$v=Ne({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ov=Object.freeze({__proto__:null,base64:bv,base64pad:Ev,base64url:_v,base64urlpad:$v});const rf=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Iv=rf.reduce((t,e,r)=>(t[r]=e,t),[]),Pv=rf.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Sv(t){return t.reduce((e,r)=>(e+=Iv[r],e),"")}function Dv(t){const e=[];for(const r of t){const n=Pv[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const xv=cs({prefix:"🚀",name:"base256emoji",encode:Sv,decode:Dv});var Av=Object.freeze({__proto__:null,base256emoji:xv}),Cv=nf,Cc=128,Lv=127,Rv=~Lv,Nv=Math.pow(2,31);function nf(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Nv;)e[r++]=t&255|Cc,t/=128;for(;t&Rv;)e[r++]=t&255|Cc,t>>>=7;return e[r]=t|0,nf.bytes=r-n+1,e}var Tv=Do,jv=128,Lc=127;function Do(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw Do.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&Lc)<<i:(o&Lc)*Math.pow(2,i),i+=7}while(o>=jv);return Do.bytes=s-n,r}var Bv=Math.pow(2,7),Mv=Math.pow(2,14),Uv=Math.pow(2,21),Fv=Math.pow(2,28),kv=Math.pow(2,35),qv=Math.pow(2,42),zv=Math.pow(2,49),Hv=Math.pow(2,56),Kv=Math.pow(2,63),Vv=function(t){return t<Bv?1:t<Mv?2:t<Uv?3:t<Fv?4:t<kv?5:t<qv?6:t<zv?7:t<Hv?8:t<Kv?9:10},Wv={encode:Cv,decode:Tv,encodingLength:Vv},sf=Wv;const Rc=(t,e,r=0)=>(sf.encode(t,e,r),e),Nc=t=>sf.encodingLength(t),xo=(t,e)=>{const r=e.byteLength,n=Nc(t),i=n+Nc(r),s=new Uint8Array(i+r);return Rc(t,s,0),Rc(r,s,n),s.set(e,i),new Gv(t,r,e,s)};let Gv=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};const of=({name:t,code:e,encode:r})=>new Yv(t,e,r);let Yv=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?xo(this.code,r):r.then(n=>xo(this.code,n))}else throw Error("Unknown type, must be binary type")}};const af=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Jv=of({name:"sha2-256",code:18,encode:af("SHA-256")}),Zv=of({name:"sha2-512",code:19,encode:af("SHA-512")});var Qv=Object.freeze({__proto__:null,sha256:Jv,sha512:Zv});const cf=0,Xv="identity",uf=ef,eb=t=>xo(cf,uf(t)),tb={code:cf,name:Xv,encode:uf,digest:eb};var rb=Object.freeze({__proto__:null,identity:tb});new TextEncoder,new TextDecoder;const Tc={...Gw,...Jw,...Qw,...ev,...nv,...dv,...yv,...vv,...Ov,...Av};({...Qv,...rb});function lf(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const jc=lf("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Vs=lf("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=Qh(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),hf={utf8:jc,"utf-8":jc,hex:Tc.base16,latin1:Vs,ascii:Vs,binary:Vs,...Tc};function us(t,e="utf8"){const r=hf[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}function bn(t,e="utf8"){const r=hf[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?ba(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}function Bc(t){return mr(us(bn(t,as),Jh))}function Wi(t){return us(bn(Ht(t),Jh),as)}function ff(t){const e=bn(Nw,Ac),r=Rw+us(Xh([e,t]),Ac);return[Cw,Lw,r].join(Aw)}function nb(t){return us(t,as)}function ib(t){return bn(t,as)}function sb(t){return bn([Wi(t.header),Wi(t.payload)].join(Vi),Zh)}function ob(t){return[Wi(t.header),Wi(t.payload),nb(t.signature)].join(Vi)}function Ao(t){const e=t.split(Vi),r=Bc(e[0]),n=Bc(e[1]),i=ib(e[2]),s=bn(e.slice(0,2).join(Vi),Zh);return{header:r,payload:n,signature:i,data:s}}function Mc(t=Uh(Tw)){const e=Yh.getPublicKey(t);return{secretKey:Xh([t,e]),publicKey:e}}async function ab(t,e,r,n,i=N.fromMiliseconds(Date.now())){const s={alg:Dw,typ:xw},o=ff(n.publicKey),a=i+r,c={iss:o,sub:t,aud:e,iat:i,exp:a},u=sb({header:s,payload:c}),l=Yh.sign(u,n.secretKey.slice(0,32));return ob({header:s,payload:c,signature:l})}function df(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function Un(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=df(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function cb(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var s=t.charAt(i),o=s.charCodeAt(0);if(r[o]!==255)throw new TypeError(s+" is ambiguous");r[o]=i}var a=t.length,c=t.charAt(0),u=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function h(d){if(d instanceof Uint8Array||(ArrayBuffer.isView(d)?d=new Uint8Array(d.buffer,d.byteOffset,d.byteLength):Array.isArray(d)&&(d=Uint8Array.from(d))),!(d instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(d.length===0)return"";for(var y=0,w=0,b=0,v=d.length;b!==v&&d[b]===0;)b++,y++;for(var E=(v-b)*l+1>>>0,$=new Uint8Array(E);b!==v;){for(var D=d[b],x=0,S=E-1;(D!==0||x<w)&&S!==-1;S--,x++)D+=256*$[S]>>>0,$[S]=D%a>>>0,D=D/a>>>0;if(D!==0)throw new Error("Non-zero carry");w=x,b++}for(var C=E-w;C!==E&&$[C]===0;)C++;for(var I=c.repeat(y);C<E;++C)I+=t.charAt($[C]);return I}function f(d){if(typeof d!="string")throw new TypeError("Expected String");if(d.length===0)return new Uint8Array;var y=0;if(d[y]!==" "){for(var w=0,b=0;d[y]===c;)w++,y++;for(var v=(d.length-y)*u+1>>>0,E=new Uint8Array(v);d[y];){var $=r[d.charCodeAt(y)];if($===255)return;for(var D=0,x=v-1;($!==0||D<b)&&x!==-1;x--,D++)$+=a*E[x]>>>0,E[x]=$%256>>>0,$=$/256>>>0;if($!==0)throw new Error("Non-zero carry");b=D,y++}if(d[y]!==" "){for(var S=v-b;S!==v&&E[S]===0;)S++;for(var C=new Uint8Array(w+(v-S)),I=w;S!==v;)C[I++]=E[S++];return C}}}function p(d){var y=f(d);if(y)return y;throw new Error(`Non-${e} character`)}return{encode:h,decodeUnsafe:f,decode:p}}var ub=cb,lb=ub;const hb=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},fb=t=>new TextEncoder().encode(t),db=t=>new TextDecoder().decode(t);class pb{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class gb{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return pf(this,e)}}class yb{constructor(e){this.decoders=e}or(e){return pf(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const pf=(t,e)=>new yb({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class mb{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new pb(e,r,n),this.decoder=new gb(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const ls=({name:t,prefix:e,encode:r,decode:n})=>new mb(t,e,r,n),ri=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=lb(r,e);return ls({prefix:t,name:e,encode:n,decode:s=>hb(i(s))})},wb=(t,e,r,n)=>{const i={};for(let l=0;l<e.length;++l)i[e[l]]=l;let s=t.length;for(;t[s-1]==="=";)--s;const o=new Uint8Array(s*r/8|0);let a=0,c=0,u=0;for(let l=0;l<s;++l){const h=i[t[l]];if(h===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<r|h,a+=r,a>=8&&(a-=8,o[u++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},vb=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<<r)-1;let s="",o=0,a=0;for(let c=0;c<t.length;++c)for(a=a<<8|t[c],o+=8;o>r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<<r-o]),n)for(;s.length*r&7;)s+="=";return s},Te=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>ls({prefix:e,name:t,encode(i){return vb(i,n,r)},decode(i){return wb(i,n,r,t)}}),bb=ls({prefix:"\0",name:"identity",encode:t=>db(t),decode:t=>fb(t)}),Eb=Object.freeze(Object.defineProperty({__proto__:null,identity:bb},Symbol.toStringTag,{value:"Module"})),_b=Te({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),$b=Object.freeze(Object.defineProperty({__proto__:null,base2:_b},Symbol.toStringTag,{value:"Module"})),Ob=Te({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),Ib=Object.freeze(Object.defineProperty({__proto__:null,base8:Ob},Symbol.toStringTag,{value:"Module"})),Pb=ri({prefix:"9",name:"base10",alphabet:"0123456789"}),Sb=Object.freeze(Object.defineProperty({__proto__:null,base10:Pb},Symbol.toStringTag,{value:"Module"})),Db=Te({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),xb=Te({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),Ab=Object.freeze(Object.defineProperty({__proto__:null,base16:Db,base16upper:xb},Symbol.toStringTag,{value:"Module"})),Cb=Te({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Lb=Te({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Rb=Te({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Nb=Te({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Tb=Te({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),jb=Te({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Bb=Te({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Mb=Te({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Ub=Te({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Fb=Object.freeze(Object.defineProperty({__proto__:null,base32:Cb,base32hex:Tb,base32hexpad:Bb,base32hexpadupper:Mb,base32hexupper:jb,base32pad:Rb,base32padupper:Nb,base32upper:Lb,base32z:Ub},Symbol.toStringTag,{value:"Module"})),kb=ri({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),qb=ri({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),zb=Object.freeze(Object.defineProperty({__proto__:null,base36:kb,base36upper:qb},Symbol.toStringTag,{value:"Module"})),Hb=ri({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Kb=ri({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Vb=Object.freeze(Object.defineProperty({__proto__:null,base58btc:Hb,base58flickr:Kb},Symbol.toStringTag,{value:"Module"})),Wb=Te({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Gb=Te({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Yb=Te({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Jb=Te({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),Zb=Object.freeze(Object.defineProperty({__proto__:null,base64:Wb,base64pad:Gb,base64url:Yb,base64urlpad:Jb},Symbol.toStringTag,{value:"Module"})),gf=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Qb=gf.reduce((t,e,r)=>(t[r]=e,t),[]),Xb=gf.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function e0(t){return t.reduce((e,r)=>(e+=Qb[r],e),"")}function t0(t){const e=[];for(const r of t){const n=Xb[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const r0=ls({prefix:"🚀",name:"base256emoji",encode:e0,decode:t0}),n0=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:r0},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const Uc={...Eb,...$b,...Ib,...Sb,...Ab,...Fb,...zb,...Vb,...Zb,...n0};function yf(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const Fc=yf("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Ws=yf("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=df(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),mf={utf8:Fc,"utf-8":Fc,hex:Uc.base16,latin1:Ws,ascii:Ws,binary:Ws,...Uc};function lt(t,e="utf8"){const r=mf[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):r.decoder.decode(`${r.prefix}${t}`)}function Ye(t,e="utf8"){const r=mf[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}const i0={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}};var s0={};const o0=":";function en(t){const[e,r]=t.split(o0);return{namespace:e,reference:r}}function kc(t,e=[]){const r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;const i=t[n];r.push(...i.accounts)}),r}function wf(t,e){return t.includes(":")?[t]:e.chains||[]}var a0=Object.defineProperty,c0=Object.defineProperties,u0=Object.getOwnPropertyDescriptors,qc=Object.getOwnPropertySymbols,l0=Object.prototype.hasOwnProperty,h0=Object.prototype.propertyIsEnumerable,zc=(t,e,r)=>e in t?a0(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Hc=(t,e)=>{for(var r in e||(e={}))l0.call(e,r)&&zc(t,r,e[r]);if(qc)for(var r of qc(e))h0.call(e,r)&&zc(t,r,e[r]);return t},f0=(t,e)=>c0(t,u0(e));const d0="ReactNative",rt={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},p0="js";function Gi(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function tr(){return!gr()&&!!ha()&&navigator.product===d0}function g0(){return tr()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="android"}function y0(){return tr()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="ios"}function En(){return!Gi()&&!!ha()&&!!gr()}function ni(){return tr()?rt.reactNative:Gi()?rt.node:En()?rt.browser:rt.unknown}function Kc(){var t;try{return tr()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function m0(t,e){const r=new URLSearchParams(t);for(const n of Object.keys(e).sort())if(e.hasOwnProperty(n)){const i=e[n];i!==void 0&&r.set(n,i)}return r.toString()}function w0(t){var e,r;const n=vf();try{return t!=null&&t.url&&n.url&&new URL(t.url).host!==new URL(n.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${t.url} differs from the actual page url:${n.url}. This is probably unintended and can lead to issues.`),t.url=n.url),(e=t==null?void 0:t.icons)!=null&&e.length&&t.icons.length>0&&(t.icons=t.icons.filter(i=>i!=="")),f0(Hc(Hc({},n),t),{url:(t==null?void 0:t.url)||n.url,name:(t==null?void 0:t.name)||n.name,description:(t==null?void 0:t.description)||n.description,icons:(r=t==null?void 0:t.icons)!=null&&r.length&&t.icons.length>0?t.icons:n.icons})}catch(i){return console.warn("Error populating app metadata",i),t||n}}function vf(){return Oh()||{name:"",description:"",url:"",icons:[""]}}function v0(){if(ni()===rt.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=Ng();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function b0(){var t;const e=ni();return e===rt.browser?[e,((t=$h())==null?void 0:t.host)||"unknown"].join(":"):e}function bf(t,e,r){const n=v0(),i=b0();return[[t,e].join("-"),[p0,r].join("-"),n,i].join("/")}function E0({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a,packageName:c}){const u=r.split("?"),l=bf(t,e,n),h={auth:i,ua:l,projectId:s,useOnCloseEvent:o||void 0,packageName:c||void 0,bundleId:a||void 0},f=m0(u[1]||"",h);return u[0]+"?"+f}function fr(t,e){return t.filter(r=>e.includes(r)).length===t.length}function Co(t){return Object.fromEntries(t.entries())}function Lo(t){return new Map(Object.entries(t))}function or(t=N.FIVE_MINUTES,e){const r=N.toMiliseconds(t||N.FIVE_MINUTES);let n,i,s,o;return{resolve:a=>{s&&n&&(clearTimeout(s),n(a),o=Promise.resolve(a))},reject:a=>{s&&i&&(clearTimeout(s),i(a))},done:()=>new Promise((a,c)=>{if(o)return a(o);s=setTimeout(()=>{const u=new Error(e);o=Promise.reject(u),c(u)},r),n=a,i=c})}}function Zt(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function Ef(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function _0(t){return Ef("topic",t)}function $0(t){return Ef("id",t)}function _f(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function Ee(t,e){return N.fromMiliseconds(Date.now()+N.toMiliseconds(t))}function Yt(t){return Date.now()>=N.toMiliseconds(t)}function X(t,e){return`${t}${e?`:${e}`:""}`}function At(t=[],e=[]){return[...new Set([...t,...e])]}async function O0({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;const i=typeof r=="string"?JSON.parse(r):r,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=I0(s,t,e),a=ni();if(a===rt.browser){if(!((n=gr())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}P0(o)}else a===rt.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function I0(t,e,r){const n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${A0(n,!0)}`}else i=`${i}/wc?${n}`;return i}function P0(t){let e="_self";x0()?e="_top":(D0()||t.startsWith("https://")||t.startsWith("http://"))&&(e="_blank"),window.open(t,e,"noreferrer noopener")}async function S0(t,e){let r="";try{if(En()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function Vc(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function Wc(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function Ea(){return typeof process<"u"&&s0.IS_VITEST==="true"}function D0(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function x0(){try{return window.self!==window.top}catch{return!1}}function A0(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function $f(t){return Buffer.from(t,"base64").toString("utf-8")}function C0(t){return new Promise(e=>setTimeout(e,t))}function Vn(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function L0(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function ii(t,...e){if(!L0(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function _a(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Vn(t.outputLen),Vn(t.blockLen)}function ln(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Of(t,e){ii(t);const r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}const yi=BigInt(2**32-1),Gc=BigInt(32);function R0(t,e=!1){return e?{h:Number(t&yi),l:Number(t>>Gc&yi)}:{h:Number(t>>Gc&yi)|0,l:Number(t&yi)|0}}function N0(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:s,l:o}=R0(t[i],e);[r[i],n[i]]=[s,o]}return[r,n]}const T0=(t,e,r)=>t<<r|e>>>32-r,j0=(t,e,r)=>e<<r|t>>>32-r,B0=(t,e,r)=>e<<r-32|t>>>64-r,M0=(t,e,r)=>t<<r-32|e>>>64-r,Cr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function U0(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function Gs(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function _t(t,e){return t<<32-e|t>>>e}const Yc=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function F0(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function Jc(t){for(let e=0;e<t.length;e++)t[e]=F0(t[e])}function k0(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function hn(t){return typeof t=="string"&&(t=k0(t)),ii(t),t}function q0(...t){let e=0;for(let n=0;n<t.length;n++){const i=t[n];ii(i),e+=i.length}const r=new Uint8Array(e);for(let n=0,i=0;n<t.length;n++){const s=t[n];r.set(s,i),i+=s.length}return r}let $a=class{clone(){return this._cloneInto()}};function If(t){const e=n=>t().update(hn(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function _n(t=32){if(Cr&&typeof Cr.getRandomValues=="function")return Cr.getRandomValues(new Uint8Array(t));if(Cr&&typeof Cr.randomBytes=="function")return Cr.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}const Pf=[],Sf=[],Df=[],z0=BigInt(0),An=BigInt(1),H0=BigInt(2),K0=BigInt(7),V0=BigInt(256),W0=BigInt(113);for(let t=0,e=An,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],Pf.push(2*(5*n+r)),Sf.push((t+1)*(t+2)/2%64);let i=z0;for(let s=0;s<7;s++)e=(e<<An^(e>>K0)*W0)%V0,e&H0&&(i^=An<<(An<<BigInt(s))-An);Df.push(i)}const[G0,Y0]=N0(Df,!0),Zc=(t,e,r)=>r>32?B0(t,e,r):T0(t,e,r),Qc=(t,e,r)=>r>32?M0(t,e,r):j0(t,e,r);function J0(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,u=r[c],l=r[c+1],h=Zc(u,l,1)^r[a],f=Qc(u,l,1)^r[a+1];for(let p=0;p<50;p+=10)t[o+p]^=h,t[o+p+1]^=f}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=Sf[o],c=Zc(i,s,a),u=Qc(i,s,a),l=Pf[o];i=t[l],s=t[l+1],t[l]=c,t[l+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=G0[n],t[1]^=Y0[n]}r.fill(0)}let Z0=class xf extends $a{constructor(e,r,n,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Vn(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=U0(this.state)}keccak(){Yc||Jc(this.state32),J0(this.state32,this.rounds),Yc||Jc(this.state32),this.posOut=0,this.pos=0}update(e){ln(this);const{blockLen:r,state:n}=this;e=hn(e);const i=e.length;for(let s=0;s<i;){const o=Math.min(r-this.pos,i-s);for(let a=0;a<o;a++)n[this.pos++]^=e[s++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:r,pos:n,blockLen:i}=this;e[n]^=r,r&128&&n===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){ln(this,!1),ii(e),this.finish();const r=this.state,{blockLen:n}=this;for(let i=0,s=e.length;i<s;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Vn(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Of(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new xf(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}};const Q0=(t,e,r)=>If(()=>new Z0(e,t,r)),X0=Q0(1,136,256/8),eE="https://rpc.walletconnect.org/v1";function Af(t){const e=`Ethereum Signed Message:
|
|
17
|
-
${t.length}`,r=new TextEncoder().encode(e+t);return"0x"+Buffer.from(X0(r)).toString("hex")}async function tE(t,e,r,n,i,s){switch(r.t){case"eip191":return await rE(t,e,r.s);case"eip1271":return await nE(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}async function rE(t,e,r){return(await hm({hash:Af(e),signature:r})).toLowerCase()===t.toLowerCase()}async function nE(t,e,r,n,i,s){const o=en(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",c="0000000000000000000000000000000000000000000000000000000000000040",u="0000000000000000000000000000000000000000000000000000000000000041",l=r.substring(2),h=Af(e).substring(2),f=a+h+c+u+l,p=await fetch(`${s||eE}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:iE(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:f},"latest"]})}),{result:d}=await p.json();return d?d.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function iE(){return Date.now()+Math.floor(Math.random()*1e3)}function sE(t){const e=atob(t),r=new Uint8Array(e.length);for(let o=0;o<e.length;o++)r[o]=e.charCodeAt(o);const n=r[0];if(n===0)throw new Error("No signatures found");const i=1+n*64;if(r.length<i)throw new Error("Transaction data too short for claimed signature count");if(r.length<100)throw new Error("Transaction too short");const s=Buffer.from(t,"base64").slice(1,65);return pm.encode(s)}var oE=Object.defineProperty,aE=Object.defineProperties,cE=Object.getOwnPropertyDescriptors,Xc=Object.getOwnPropertySymbols,uE=Object.prototype.hasOwnProperty,lE=Object.prototype.propertyIsEnumerable,eu=(t,e,r)=>e in t?oE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hE=(t,e)=>{for(var r in e||(e={}))uE.call(e,r)&&eu(t,r,e[r]);if(Xc)for(var r of Xc(e))lE.call(e,r)&&eu(t,r,e[r]);return t},fE=(t,e)=>aE(t,cE(e));const dE="did:pkh:",Oa=t=>t==null?void 0:t.split(":"),pE=t=>{const e=t&&Oa(t);if(e)return t.includes(dE)?e[3]:e[1]},Ro=t=>{const e=t&&Oa(t);if(e)return e[2]+":"+e[3]},Yi=t=>{const e=t&&Oa(t);if(e)return e.pop()};async function tu(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=Cf(i,i.iss),o=Yi(i.iss);return await tE(o,s,n,Ro(i.iss),r)}const Cf=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=Yi(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${pE(e)}`,c=`Nonce: ${t.nonce}`,u=`Issued At: ${t.iat}`,l=t.exp?`Expiration Time: ${t.exp}`:void 0,h=t.nbf?`Not Before: ${t.nbf}`:void 0,f=t.requestId?`Request ID: ${t.requestId}`:void 0,p=t.resources?`Resources:${t.resources.map(y=>`
|
|
18
|
-
- ${y}`).join("")}`:void 0,d=Ci(t.resources);if(d){const y=Wn(d);i=$E(i,y)}return[r,n,"",i,"",s,o,a,c,u,l,h,f,p].filter(y=>y!=null).join(`
|
|
19
|
-
`)};function gE(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function yE(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function wr(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function mE(t,e,r,n={}){return r==null||r.sort((i,s)=>i.localeCompare(s)),{att:{[t]:wE(e,r,n)}}}function wE(t,e,r={}){e=e==null?void 0:e.sort((i,s)=>i.localeCompare(s));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function Lf(t){return wr(t),`urn:recap:${gE(t).replace(/=/g,"")}`}function Wn(t){const e=yE(t.replace("urn:recap:",""));return wr(e),e}function vE(t,e,r){const n=mE(t,e,r);return Lf(n)}function bE(t){return t&&t.includes("urn:recap:")}function EE(t,e){const r=Wn(t),n=Wn(e),i=_E(r,n);return Lf(i)}function _E(t,e){wr(t),wr(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((a,c)=>a.localeCompare(c)).forEach(a=>{var c,u;n.att[i]=fE(hE({},n.att[i]),{[a]:((c=t.att[i])==null?void 0:c[a])||((u=e.att[i])==null?void 0:u[a])})})}),n}function $E(t="",e){wr(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let i=0;Object.keys(e.att).forEach(a=>{const c=Object.keys(e.att[a]).map(h=>({ability:h.split("/")[0],action:h.split("/")[1]}));c.sort((h,f)=>h.action.localeCompare(f.action));const u={};c.forEach(h=>{u[h.ability]||(u[h.ability]=[]),u[h.ability].push(h.action)});const l=Object.keys(u).map(h=>(i++,`(${i}) '${h}': '${u[h].join("', '")}' for '${a}'.`));n.push(l.join(", ").replace(".,","."))});const s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function ru(t){var e;const r=Wn(t);wr(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function nu(t){const e=Wn(t);wr(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i==null?void 0:i[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function Ci(t){if(!t)return;const e=t==null?void 0:t[t.length-1];return bE(e)?e:void 0}function Ys(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function Rf(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function tt(t,...e){if(!Rf(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function iu(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function OE(t,e){tt(t);const r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function su(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}const Xt=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),IE=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),PE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!PE)throw new Error("Non little-endian hardware is not supported");function SE(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function No(t){if(typeof t=="string")t=SE(t);else if(Rf(t))t=To(t);else throw new Error("Uint8Array expected, got "+typeof t);return t}function DE(t,e){if(e==null||typeof e!="object")throw new Error("options must be defined");return Object.assign(t,e)}function xE(t,e){if(t.length!==e.length)return!1;let r=0;for(let n=0;n<t.length;n++)r|=t[n]^e[n];return r===0}const AE=(t,e)=>{function r(n,...i){if(tt(n),t.nonceLength!==void 0){const u=i[0];if(!u)throw new Error("nonce / iv required");t.varSizeNonce?tt(u):tt(u,t.nonceLength)}const s=t.tagLength;s&&i[1]!==void 0&&tt(i[1]);const o=e(n,...i),a=(u,l)=>{if(l!==void 0){if(u!==2)throw new Error("cipher output not supported");tt(l)}};let c=!1;return{encrypt(u,l){if(c)throw new Error("cannot encrypt() twice with same key + nonce");return c=!0,tt(u),a(o.encrypt.length,l),o.encrypt(u,l)},decrypt(u,l){if(tt(u),s&&u.length<s)throw new Error("invalid ciphertext length: smaller than tagLength="+s);return a(o.decrypt.length,l),o.decrypt(u,l)}}}return Object.assign(r,t),r};function ou(t,e,r=!0){if(e===void 0)return new Uint8Array(t);if(e.length!==t)throw new Error("invalid output length, expected "+t+", got: "+e.length);if(r&&!CE(e))throw new Error("invalid output, must be aligned");return e}function au(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s);t.setUint32(e+4,o,n),t.setUint32(e+0,a,n)}function CE(t){return t.byteOffset%4===0}function To(t){return Uint8Array.from(t)}function fn(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}const Nf=t=>Uint8Array.from(t.split("").map(e=>e.charCodeAt(0))),LE=Nf("expand 16-byte k"),RE=Nf("expand 32-byte k"),NE=Xt(LE),TE=Xt(RE);function J(t,e){return t<<e|t>>>32-e}function jo(t){return t.byteOffset%4===0}const mi=64,jE=16,Tf=2**32-1,cu=new Uint32Array;function BE(t,e,r,n,i,s,o,a){const c=i.length,u=new Uint8Array(mi),l=Xt(u),h=jo(i)&&jo(s),f=h?Xt(i):cu,p=h?Xt(s):cu;for(let d=0;d<c;o++){if(t(e,r,n,l,o,a),o>=Tf)throw new Error("arx: counter overflow");const y=Math.min(mi,c-d);if(h&&y===mi){const w=d/4;if(d%4!==0)throw new Error("arx: invalid block position");for(let b=0,v;b<jE;b++)v=w+b,p[v]=f[v]^l[b];d+=mi;continue}for(let w=0,b;w<y;w++)b=d+w,s[b]=i[b]^u[w];d+=y}}function ME(t,e){const{allowShortKeys:r,extendNonceFn:n,counterLength:i,counterRight:s,rounds:o}=DE({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},e);if(typeof t!="function")throw new Error("core must be a function");return Ys(i),Ys(o),su(s),su(r),(a,c,u,l,h=0)=>{tt(a),tt(c),tt(u);const f=u.length;if(l===void 0&&(l=new Uint8Array(f)),tt(l),Ys(h),h<0||h>=Tf)throw new Error("arx: counter overflow");if(l.length<f)throw new Error(`arx: output (${l.length}) is shorter than data (${f})`);const p=[];let d=a.length,y,w;if(d===32)p.push(y=To(a)),w=TE;else if(d===16&&r)y=new Uint8Array(32),y.set(a),y.set(a,16),w=NE,p.push(y);else throw new Error(`arx: invalid 32-byte key, got length=${d}`);jo(c)||p.push(c=To(c));const b=Xt(y);if(n){if(c.length!==24)throw new Error("arx: extended nonce must be 24 bytes");n(w,b,Xt(c.subarray(0,16)),b),c=c.subarray(16)}const v=16-i;if(v!==c.length)throw new Error(`arx: nonce must be ${v} or 16 bytes`);if(v!==12){const $=new Uint8Array(12);$.set(c,s?0:12-c.length),c=$,p.push(c)}const E=Xt(c);return BE(t,w,b,E,u,l,h,o),fn(...p),l}}const Ce=(t,e)=>t[e++]&255|(t[e++]&255)<<8;class UE{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,e=No(e),tt(e,32);const r=Ce(e,0),n=Ce(e,2),i=Ce(e,4),s=Ce(e,6),o=Ce(e,8),a=Ce(e,10),c=Ce(e,12),u=Ce(e,14);this.r[0]=r&8191,this.r[1]=(r>>>13|n<<3)&8191,this.r[2]=(n>>>10|i<<6)&7939,this.r[3]=(i>>>7|s<<9)&8191,this.r[4]=(s>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|a<<2)&8191,this.r[7]=(a>>>11|c<<5)&8065,this.r[8]=(c>>>8|u<<8)&8191,this.r[9]=u>>>5&127;for(let l=0;l<8;l++)this.pad[l]=Ce(e,16+2*l)}process(e,r,n=!1){const i=n?0:2048,{h:s,r:o}=this,a=o[0],c=o[1],u=o[2],l=o[3],h=o[4],f=o[5],p=o[6],d=o[7],y=o[8],w=o[9],b=Ce(e,r+0),v=Ce(e,r+2),E=Ce(e,r+4),$=Ce(e,r+6),D=Ce(e,r+8),x=Ce(e,r+10),S=Ce(e,r+12),C=Ce(e,r+14);let I=s[0]+(b&8191),k=s[1]+((b>>>13|v<<3)&8191),B=s[2]+((v>>>10|E<<6)&8191),j=s[3]+((E>>>7|$<<9)&8191),q=s[4]+(($>>>4|D<<12)&8191),L=s[5]+(D>>>1&8191),g=s[6]+((D>>>14|x<<2)&8191),m=s[7]+((x>>>11|S<<5)&8191),_=s[8]+((S>>>8|C<<8)&8191),P=s[9]+(C>>>5|i),O=0,A=O+I*a+k*(5*w)+B*(5*y)+j*(5*d)+q*(5*p);O=A>>>13,A&=8191,A+=L*(5*f)+g*(5*h)+m*(5*l)+_*(5*u)+P*(5*c),O+=A>>>13,A&=8191;let M=O+I*c+k*a+B*(5*w)+j*(5*y)+q*(5*d);O=M>>>13,M&=8191,M+=L*(5*p)+g*(5*f)+m*(5*h)+_*(5*l)+P*(5*u),O+=M>>>13,M&=8191;let F=O+I*u+k*c+B*a+j*(5*w)+q*(5*y);O=F>>>13,F&=8191,F+=L*(5*d)+g*(5*p)+m*(5*f)+_*(5*h)+P*(5*l),O+=F>>>13,F&=8191;let z=O+I*l+k*u+B*c+j*a+q*(5*w);O=z>>>13,z&=8191,z+=L*(5*y)+g*(5*d)+m*(5*p)+_*(5*f)+P*(5*h),O+=z>>>13,z&=8191;let U=O+I*h+k*l+B*u+j*c+q*a;O=U>>>13,U&=8191,U+=L*(5*w)+g*(5*y)+m*(5*d)+_*(5*p)+P*(5*f),O+=U>>>13,U&=8191;let H=O+I*f+k*h+B*l+j*u+q*c;O=H>>>13,H&=8191,H+=L*a+g*(5*w)+m*(5*y)+_*(5*d)+P*(5*p),O+=H>>>13,H&=8191;let G=O+I*p+k*f+B*h+j*l+q*u;O=G>>>13,G&=8191,G+=L*c+g*a+m*(5*w)+_*(5*y)+P*(5*d),O+=G>>>13,G&=8191;let de=O+I*d+k*p+B*f+j*h+q*l;O=de>>>13,de&=8191,de+=L*u+g*c+m*a+_*(5*w)+P*(5*y),O+=de>>>13,de&=8191;let ee=O+I*y+k*d+B*p+j*f+q*h;O=ee>>>13,ee&=8191,ee+=L*l+g*u+m*c+_*a+P*(5*w),O+=ee>>>13,ee&=8191;let Y=O+I*w+k*y+B*d+j*p+q*f;O=Y>>>13,Y&=8191,Y+=L*h+g*l+m*u+_*c+P*a,O+=Y>>>13,Y&=8191,O=(O<<2)+O|0,O=O+A|0,A=O&8191,O=O>>>13,M+=O,s[0]=A,s[1]=M,s[2]=F,s[3]=z,s[4]=U,s[5]=H,s[6]=G,s[7]=de,s[8]=ee,s[9]=Y}finalize(){const{h:e,pad:r}=this,n=new Uint16Array(10);let i=e[1]>>>13;e[1]&=8191;for(let a=2;a<10;a++)e[a]+=i,i=e[a]>>>13,e[a]&=8191;e[0]+=i*5,i=e[0]>>>13,e[0]&=8191,e[1]+=i,i=e[1]>>>13,e[1]&=8191,e[2]+=i,n[0]=e[0]+5,i=n[0]>>>13,n[0]&=8191;for(let a=1;a<10;a++)n[a]=e[a]+i,i=n[a]>>>13,n[a]&=8191;n[9]-=8192;let s=(i^1)-1;for(let a=0;a<10;a++)n[a]&=s;s=~s;for(let a=0;a<10;a++)e[a]=e[a]&s|n[a];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let o=e[0]+r[0];e[0]=o&65535;for(let a=1;a<8;a++)o=(e[a]+r[a]|0)+(o>>>16)|0,e[a]=o&65535;fn(n)}update(e){iu(this);const{buffer:r,blockLen:n}=this;e=No(e);const i=e.length;for(let s=0;s<i;){const o=Math.min(n-this.pos,i-s);if(o===n){for(;n<=i-s;s+=n)this.process(e,s);continue}r.set(e.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===n&&(this.process(r,0,!1),this.pos=0)}return this}destroy(){fn(this.h,this.r,this.buffer,this.pad)}digestInto(e){iu(this),OE(e,this),this.finished=!0;const{buffer:r,h:n}=this;let{pos:i}=this;if(i){for(r[i++]=1;i<16;i++)r[i]=0;this.process(r,0,!0)}this.finalize();let s=0;for(let o=0;o<8;o++)e[s++]=n[o]>>>0,e[s++]=n[o]>>>8;return e}digest(){const{buffer:e,outputLen:r}=this;this.digestInto(e);const n=e.slice(0,r);return this.destroy(),n}}function FE(t){const e=(n,i)=>t(i).update(No(n)).digest(),r=t(new Uint8Array(32));return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}const kE=FE(t=>new UE(t));function qE(t,e,r,n,i,s=20){let o=t[0],a=t[1],c=t[2],u=t[3],l=e[0],h=e[1],f=e[2],p=e[3],d=e[4],y=e[5],w=e[6],b=e[7],v=i,E=r[0],$=r[1],D=r[2],x=o,S=a,C=c,I=u,k=l,B=h,j=f,q=p,L=d,g=y,m=w,_=b,P=v,O=E,A=$,M=D;for(let z=0;z<s;z+=2)x=x+k|0,P=J(P^x,16),L=L+P|0,k=J(k^L,12),x=x+k|0,P=J(P^x,8),L=L+P|0,k=J(k^L,7),S=S+B|0,O=J(O^S,16),g=g+O|0,B=J(B^g,12),S=S+B|0,O=J(O^S,8),g=g+O|0,B=J(B^g,7),C=C+j|0,A=J(A^C,16),m=m+A|0,j=J(j^m,12),C=C+j|0,A=J(A^C,8),m=m+A|0,j=J(j^m,7),I=I+q|0,M=J(M^I,16),_=_+M|0,q=J(q^_,12),I=I+q|0,M=J(M^I,8),_=_+M|0,q=J(q^_,7),x=x+B|0,M=J(M^x,16),m=m+M|0,B=J(B^m,12),x=x+B|0,M=J(M^x,8),m=m+M|0,B=J(B^m,7),S=S+j|0,P=J(P^S,16),_=_+P|0,j=J(j^_,12),S=S+j|0,P=J(P^S,8),_=_+P|0,j=J(j^_,7),C=C+q|0,O=J(O^C,16),L=L+O|0,q=J(q^L,12),C=C+q|0,O=J(O^C,8),L=L+O|0,q=J(q^L,7),I=I+k|0,A=J(A^I,16),g=g+A|0,k=J(k^g,12),I=I+k|0,A=J(A^I,8),g=g+A|0,k=J(k^g,7);let F=0;n[F++]=o+x|0,n[F++]=a+S|0,n[F++]=c+C|0,n[F++]=u+I|0,n[F++]=l+k|0,n[F++]=h+B|0,n[F++]=f+j|0,n[F++]=p+q|0,n[F++]=d+L|0,n[F++]=y+g|0,n[F++]=w+m|0,n[F++]=b+_|0,n[F++]=v+P|0,n[F++]=E+O|0,n[F++]=$+A|0,n[F++]=D+M|0}const zE=ME(qE,{counterRight:!1,counterLength:4,allowShortKeys:!1}),HE=new Uint8Array(16),uu=(t,e)=>{t.update(e);const r=e.length%16;r&&t.update(HE.subarray(r))},KE=new Uint8Array(32);function lu(t,e,r,n,i){const s=t(e,r,KE),o=kE.create(s);i&&uu(o,i),uu(o,n);const a=new Uint8Array(16),c=IE(a);au(c,0,BigInt(i?i.length:0),!0),au(c,8,BigInt(n.length),!0),o.update(a);const u=o.digest();return fn(s,a),u}const VE=t=>(e,r,n)=>({encrypt(i,s){const o=i.length;s=ou(o+16,s,!1),s.set(i);const a=s.subarray(0,-16);t(e,r,a,a,1);const c=lu(t,e,r,a,n);return s.set(c,o),fn(c),s},decrypt(i,s){s=ou(i.length-16,s,!1);const o=i.subarray(0,-16),a=i.subarray(-16),c=lu(t,e,r,o,n);if(!xE(a,c))throw new Error("invalid tag");return s.set(i.subarray(0,-16)),t(e,r,s,s,1),fn(c),s}}),jf=AE({blockSize:64,nonceLength:12,tagLength:16},VE(zE));let Bf=class extends $a{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,_a(e);const n=hn(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;o<s.length;o++)s[o]^=54;this.iHash.update(s),this.oHash=e.create();for(let o=0;o<s.length;o++)s[o]^=106;this.oHash.update(s),s.fill(0)}update(e){return ln(this),this.iHash.update(e),this}digestInto(e){ln(this),ii(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:r,iHash:n,finished:i,destroyed:s,blockLen:o,outputLen:a}=this;return e=e,e.finished=i,e.destroyed=s,e.blockLen=o,e.outputLen=a,e.oHash=r._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const hs=(t,e,r)=>new Bf(t,e).update(r).digest();hs.create=(t,e)=>new Bf(t,e);function WE(t,e,r){return _a(t),r===void 0&&(r=new Uint8Array(t.outputLen)),hs(t,hn(r),hn(e))}const Js=new Uint8Array([0]),hu=new Uint8Array;function GE(t,e,r,n=32){if(_a(t),Vn(n),n>255*t.outputLen)throw new Error("Length should be <= 255*HashLen");const i=Math.ceil(n/t.outputLen);r===void 0&&(r=hu);const s=new Uint8Array(i*t.outputLen),o=hs.create(t,e),a=o._cloneInto(),c=new Uint8Array(o.outputLen);for(let u=0;u<i;u++)Js[0]=u+1,a.update(u===0?hu:c).update(r).update(Js).digestInto(c),s.set(c,t.outputLen*u),o._cloneInto(a);return o.destroy(),a.destroy(),c.fill(0),Js.fill(0),s.slice(0,n)}const YE=(t,e,r,n,i)=>GE(t,WE(t,e,r),n,i);function JE(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),c=n?4:0,u=n?0:4;t.setUint32(e+c,o,n),t.setUint32(e+u,a,n)}function ZE(t,e,r){return t&e^~t&r}function QE(t,e,r){return t&e^t&r^e&r}let XE=class extends $a{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Gs(this.buffer)}update(e){ln(this);const{view:r,buffer:n,blockLen:i}=this;e=hn(e);const s=e.length;for(let o=0;o<s;){const a=Math.min(i-this.pos,s-o);if(a===i){const c=Gs(e);for(;i<=s-o;o+=i)this.process(c,o);continue}n.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){ln(this),Of(e,this),this.finished=!0;const{buffer:r,view:n,blockLen:i,isLE:s}=this;let{pos:o}=this;r[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>i-o&&(this.process(n,0),o=0);for(let h=o;h<i;h++)r[h]=0;JE(n,i-8,BigInt(this.length*8),s),this.process(n,0);const a=Gs(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<u;h++)a.setUint32(4*h,l[h],s)}digest(){const{buffer:e,outputLen:r}=this;this.digestInto(e);const n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:r,buffer:n,length:i,finished:s,destroyed:o,pos:a}=this;return e.length=i,e.pos=a,e.finished=s,e.destroyed=o,i%r&&e.buffer.set(n),e}};const e1=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Wt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Gt=new Uint32Array(64);class t1 extends XE{constructor(){super(64,32,8,!1),this.A=Wt[0]|0,this.B=Wt[1]|0,this.C=Wt[2]|0,this.D=Wt[3]|0,this.E=Wt[4]|0,this.F=Wt[5]|0,this.G=Wt[6]|0,this.H=Wt[7]|0}get(){const{A:e,B:r,C:n,D:i,E:s,F:o,G:a,H:c}=this;return[e,r,n,i,s,o,a,c]}set(e,r,n,i,s,o,a,c){this.A=e|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=c|0}process(e,r){for(let h=0;h<16;h++,r+=4)Gt[h]=e.getUint32(r,!1);for(let h=16;h<64;h++){const f=Gt[h-15],p=Gt[h-2],d=_t(f,7)^_t(f,18)^f>>>3,y=_t(p,17)^_t(p,19)^p>>>10;Gt[h]=y+Gt[h-7]+d+Gt[h-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:c,G:u,H:l}=this;for(let h=0;h<64;h++){const f=_t(a,6)^_t(a,11)^_t(a,25),p=l+f+ZE(a,c,u)+e1[h]+Gt[h]|0,d=(_t(n,2)^_t(n,13)^_t(n,22))+QE(n,i,s)|0;l=u,u=c,c=a,a=o+p|0,o=s,s=i,i=n,n=p+d|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(n,i,s,o,a,c,u,l)}roundClean(){Gt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const si=If(()=>new t1);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const fs=BigInt(0),ds=BigInt(1),r1=BigInt(2);function vr(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function oi(t){if(!vr(t))throw new Error("Uint8Array expected")}function dn(t,e){if(typeof e!="boolean")throw new Error(t+" boolean expected, got "+e)}const n1=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function pn(t){oi(t);let e="";for(let r=0;r<t.length;r++)e+=n1[t[r]];return e}function Jr(t){const e=t.toString(16);return e.length&1?"0"+e:e}function Ia(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?fs:BigInt("0x"+t)}const jt={_0:48,_9:57,A:65,F:70,a:97,f:102};function fu(t){if(t>=jt._0&&t<=jt._9)return t-jt._0;if(t>=jt.A&&t<=jt.F)return t-(jt.A-10);if(t>=jt.a&&t<=jt.f)return t-(jt.a-10)}function gn(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,s=0;i<r;i++,s+=2){const o=fu(t.charCodeAt(s)),a=fu(t.charCodeAt(s+1));if(o===void 0||a===void 0){const c=t[s]+t[s+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+s)}n[i]=o*16+a}return n}function pr(t){return Ia(pn(t))}function Gn(t){return oi(t),Ia(pn(Uint8Array.from(t).reverse()))}function yn(t,e){return gn(t.toString(16).padStart(e*2,"0"))}function ps(t,e){return yn(t,e).reverse()}function i1(t){return gn(Jr(t))}function et(t,e,r){let n;if(typeof e=="string")try{n=gn(e)}catch(s){throw new Error(t+" must be hex string or Uint8Array, cause: "+s)}else if(vr(e))n=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");const i=n.length;if(typeof r=="number"&&i!==r)throw new Error(t+" of length "+r+" expected, got "+i);return n}function Yn(...t){let e=0;for(let n=0;n<t.length;n++){const i=t[n];oi(i),e+=i.length}const r=new Uint8Array(e);for(let n=0,i=0;n<t.length;n++){const s=t[n];r.set(s,i),i+=s.length}return r}function s1(t,e){if(t.length!==e.length)return!1;let r=0;for(let n=0;n<t.length;n++)r|=t[n]^e[n];return r===0}function o1(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}const Zs=t=>typeof t=="bigint"&&fs<=t;function gs(t,e,r){return Zs(t)&&Zs(e)&&Zs(r)&&e<=t&&t<r}function qt(t,e,r,n){if(!gs(e,r,n))throw new Error("expected valid "+t+": "+r+" <= n < "+n+", got "+e)}function Mf(t){let e;for(e=0;t>fs;t>>=ds,e+=1);return e}function a1(t,e){return t>>BigInt(e)&ds}function c1(t,e,r){return t|(r?ds:fs)<<BigInt(e)}const Pa=t=>(r1<<BigInt(t-1))-ds,Qs=t=>new Uint8Array(t),du=t=>Uint8Array.from(t);function Uf(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=Qs(t),i=Qs(t),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...l)=>r(i,n,...l),c=(l=Qs())=>{i=a(du([0]),l),n=a(),l.length!==0&&(i=a(du([1]),l),n=a())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let l=0;const h=[];for(;l<e;){n=a();const f=n.slice();h.push(f),l+=n.length}return Yn(...h)};return(l,h)=>{o(),c(l);let f;for(;!(f=h(u()));)c();return o(),f}}const u1={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||vr(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function $n(t,e,r={}){const n=(i,s,o)=>{const a=u1[s];if(typeof a!="function")throw new Error("invalid validator function");const c=t[i];if(!(o&&c===void 0)&&!a(c,t))throw new Error("param "+String(i)+" is invalid. Expected "+s+", got "+c)};for(const[i,s]of Object.entries(e))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return t}const l1=()=>{throw new Error("not implemented")};function Bo(t){const e=new WeakMap;return(r,...n)=>{const i=e.get(r);if(i!==void 0)return i;const s=t(r,...n);return e.set(r,s),s}}var h1=Object.freeze({__proto__:null,isBytes:vr,abytes:oi,abool:dn,bytesToHex:pn,numberToHexUnpadded:Jr,hexToNumber:Ia,hexToBytes:gn,bytesToNumberBE:pr,bytesToNumberLE:Gn,numberToBytesBE:yn,numberToBytesLE:ps,numberToVarBytesBE:i1,ensureBytes:et,concatBytes:Yn,equalBytes:s1,utf8ToBytes:o1,inRange:gs,aInRange:qt,bitLen:Mf,bitGet:a1,bitSet:c1,bitMask:Pa,createHmacDrbg:Uf,validateObject:$n,notImplemented:l1,memoized:Bo});const xe=BigInt(0),we=BigInt(1),ur=BigInt(2),f1=BigInt(3),Mo=BigInt(4),pu=BigInt(5),gu=BigInt(8);function Ge(t,e){const r=t%e;return r>=xe?r:e+r}function Ff(t,e,r){if(e<xe)throw new Error("invalid exponent, negatives unsupported");if(r<=xe)throw new Error("invalid modulus");if(r===we)return xe;let n=we;for(;e>xe;)e&we&&(n=n*t%r),t=t*t%r,e>>=we;return n}function mt(t,e,r){let n=t;for(;e-- >xe;)n*=n,n%=r;return n}function Uo(t,e){if(t===xe)throw new Error("invert: expected non-zero number");if(e<=xe)throw new Error("invert: expected positive modulus, got "+e);let r=Ge(t,e),n=e,i=xe,s=we;for(;r!==xe;){const o=n/r,a=n%r,c=i-s*o;n=r,r=a,i=s,s=c}if(n!==we)throw new Error("invert: does not exist");return Ge(i,e)}function d1(t){const e=(t-we)/ur;let r,n,i;for(r=t-we,n=0;r%ur===xe;r/=ur,n++);for(i=ur;i<t&&Ff(i,e,t)!==t-we;i++)if(i>1e3)throw new Error("Cannot find square root: likely non-prime P");if(n===1){const o=(t+we)/Mo;return function(a,c){const u=a.pow(c,o);if(!a.eql(a.sqr(u),c))throw new Error("Cannot find square root");return u}}const s=(r+we)/ur;return function(o,a){if(o.pow(a,e)===o.neg(o.ONE))throw new Error("Cannot find square root");let c=n,u=o.pow(o.mul(o.ONE,i),r),l=o.pow(a,s),h=o.pow(a,r);for(;!o.eql(h,o.ONE);){if(o.eql(h,o.ZERO))return o.ZERO;let f=1;for(let d=o.sqr(h);f<c&&!o.eql(d,o.ONE);f++)d=o.sqr(d);const p=o.pow(u,we<<BigInt(c-f-1));u=o.sqr(p),l=o.mul(l,p),h=o.mul(h,u),c=f}return l}}function p1(t){if(t%Mo===f1){const e=(t+we)/Mo;return function(r,n){const i=r.pow(n,e);if(!r.eql(r.sqr(i),n))throw new Error("Cannot find square root");return i}}if(t%gu===pu){const e=(t-pu)/gu;return function(r,n){const i=r.mul(n,ur),s=r.pow(i,e),o=r.mul(n,s),a=r.mul(r.mul(o,ur),s),c=r.mul(o,r.sub(a,r.ONE));if(!r.eql(r.sqr(c),n))throw new Error("Cannot find square root");return c}}return d1(t)}const g1=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function y1(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=g1.reduce((n,i)=>(n[i]="function",n),e);return $n(t,r)}function m1(t,e,r){if(r<xe)throw new Error("invalid exponent, negatives unsupported");if(r===xe)return t.ONE;if(r===we)return e;let n=t.ONE,i=e;for(;r>xe;)r&we&&(n=t.mul(n,i)),i=t.sqr(i),r>>=we;return n}function w1(t,e){const r=new Array(e.length),n=e.reduce((s,o,a)=>t.is0(o)?s:(r[a]=s,t.mul(s,o)),t.ONE),i=t.inv(n);return e.reduceRight((s,o,a)=>t.is0(o)?s:(r[a]=t.mul(s,r[a]),t.mul(s,o)),i),r}function kf(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function qf(t,e,r=!1,n={}){if(t<=xe)throw new Error("invalid field: expected ORDER > 0, got "+t);const{nBitLength:i,nByteLength:s}=kf(t,e);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:t,isLE:r,BITS:i,BYTES:s,MASK:Pa(i),ZERO:xe,ONE:we,create:c=>Ge(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return xe<=c&&c<t},is0:c=>c===xe,isOdd:c=>(c&we)===we,neg:c=>Ge(-c,t),eql:(c,u)=>c===u,sqr:c=>Ge(c*c,t),add:(c,u)=>Ge(c+u,t),sub:(c,u)=>Ge(c-u,t),mul:(c,u)=>Ge(c*u,t),pow:(c,u)=>m1(a,c,u),div:(c,u)=>Ge(c*Uo(u,t),t),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>Uo(c,t),sqrt:n.sqrt||(c=>(o||(o=p1(t)),o(a,c))),invertBatch:c=>w1(a,c),cmov:(c,u,l)=>l?u:c,toBytes:c=>r?ps(c,s):yn(c,s),fromBytes:c=>{if(c.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+c.length);return r?Gn(c):pr(c)}});return Object.freeze(a)}function zf(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function Hf(t){const e=zf(t);return e+Math.ceil(e/2)}function v1(t,e,r=!1){const n=t.length,i=zf(e),s=Hf(e);if(n<16||n<s||n>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);const o=r?Gn(t):pr(t),a=Ge(o,e-we)+we;return r?ps(a,i):yn(a,i)}const yu=BigInt(0),wi=BigInt(1);function Xs(t,e){const r=e.negate();return t?r:e}function Kf(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function eo(t,e){Kf(t,e);const r=Math.ceil(e/t)+1,n=2**(t-1);return{windows:r,windowSize:n}}function b1(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((r,n)=>{if(!(r instanceof e))throw new Error("invalid point at index "+n)})}function E1(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((r,n)=>{if(!e.isValid(r))throw new Error("invalid scalar at index "+n)})}const to=new WeakMap,Vf=new WeakMap;function ro(t){return Vf.get(t)||1}function _1(t,e){return{constTimeNegate:Xs,hasPrecomputes(r){return ro(r)!==1},unsafeLadder(r,n,i=t.ZERO){let s=r;for(;n>yu;)n&wi&&(i=i.add(s)),s=s.double(),n>>=wi;return i},precomputeWindow(r,n){const{windows:i,windowSize:s}=eo(n,e),o=[];let a=r,c=a;for(let u=0;u<i;u++){c=a,o.push(c);for(let l=1;l<s;l++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(r,n,i){const{windows:s,windowSize:o}=eo(r,e);let a=t.ZERO,c=t.BASE;const u=BigInt(2**r-1),l=2**r,h=BigInt(r);for(let f=0;f<s;f++){const p=f*o;let d=Number(i&u);i>>=h,d>o&&(d-=l,i+=wi);const y=p,w=p+Math.abs(d)-1,b=f%2!==0,v=d<0;d===0?c=c.add(Xs(b,n[y])):a=a.add(Xs(v,n[w]))}return{p:a,f:c}},wNAFUnsafe(r,n,i,s=t.ZERO){const{windows:o,windowSize:a}=eo(r,e),c=BigInt(2**r-1),u=2**r,l=BigInt(r);for(let h=0;h<o;h++){const f=h*a;if(i===yu)break;let p=Number(i&c);if(i>>=l,p>a&&(p-=u,i+=wi),p===0)continue;let d=n[f+Math.abs(p)-1];p<0&&(d=d.negate()),s=s.add(d)}return s},getPrecomputes(r,n,i){let s=to.get(n);return s||(s=this.precomputeWindow(n,r),r!==1&&to.set(n,i(s))),s},wNAFCached(r,n,i){const s=ro(r);return this.wNAF(s,this.getPrecomputes(s,r,i),n)},wNAFCachedUnsafe(r,n,i,s){const o=ro(r);return o===1?this.unsafeLadder(r,n,s):this.wNAFUnsafe(o,this.getPrecomputes(o,r,i),n,s)},setWindowSize(r,n){Kf(n,e),Vf.set(r,n),to.delete(r)}}}function $1(t,e,r,n){if(b1(r,t),E1(n,e),r.length!==n.length)throw new Error("arrays of points and scalars must have equal length");const i=t.ZERO,s=Mf(BigInt(r.length)),o=s>12?s-3:s>4?s-2:s?2:1,a=(1<<o)-1,c=new Array(a+1).fill(i),u=Math.floor((e.BITS-1)/o)*o;let l=i;for(let h=u;h>=0;h-=o){c.fill(i);for(let p=0;p<n.length;p++){const d=n[p],y=Number(d>>BigInt(h)&BigInt(a));c[y]=c[y].add(r[p])}let f=i;for(let p=c.length-1,d=i;p>0;p--)d=d.add(c[p]),f=f.add(d);if(l=l.add(f),h!==0)for(let p=0;p<o;p++)l=l.double()}return l}function Wf(t){return y1(t.Fp),$n(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...kf(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}BigInt(0),BigInt(1),BigInt(2),BigInt(8);const Lr=BigInt(0),no=BigInt(1);function O1(t){return $n(t,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...t})}function I1(t){const e=O1(t),{P:r}=e,n=v=>Ge(v,r),i=e.montgomeryBits,s=Math.ceil(i/8),o=e.nByteLength,a=e.adjustScalarBytes||(v=>v),c=e.powPminus2||(v=>Ff(v,r-BigInt(2),r));function u(v,E,$){const D=n(v*(E-$));return E=n(E-D),$=n($+D),[E,$]}const l=(e.a-BigInt(2))/BigInt(4);function h(v,E){qt("u",v,Lr,r),qt("scalar",E,Lr,r);const $=E,D=v;let x=no,S=Lr,C=v,I=no,k=Lr,B;for(let q=BigInt(i-1);q>=Lr;q--){const L=$>>q&no;k^=L,B=u(k,x,C),x=B[0],C=B[1],B=u(k,S,I),S=B[0],I=B[1],k=L;const g=x+S,m=n(g*g),_=x-S,P=n(_*_),O=m-P,A=C+I,M=C-I,F=n(M*g),z=n(A*_),U=F+z,H=F-z;C=n(U*U),I=n(D*n(H*H)),x=n(m*P),S=n(O*(m+n(l*O)))}B=u(k,x,C),x=B[0],C=B[1],B=u(k,S,I),S=B[0],I=B[1];const j=c(S);return n(x*j)}function f(v){return ps(n(v),s)}function p(v){const E=et("u coordinate",v,s);return o===32&&(E[31]&=127),Gn(E)}function d(v){const E=et("scalar",v),$=E.length;if($!==s&&$!==o){let D=""+s+" or "+o;throw new Error("invalid scalar, expected "+D+" bytes, got "+$)}return Gn(a(E))}function y(v,E){const $=p(E),D=d(v),x=h($,D);if(x===Lr)throw new Error("invalid private or public key received");return f(x)}const w=f(e.Gu);function b(v){return y(v,w)}return{scalarMult:y,scalarMultBase:b,getSharedSecret:(v,E)=>y(v,E),getPublicKey:v=>b(v),utils:{randomPrivateKey:()=>e.randomBytes(e.nByteLength)},GuBytes:w}}const Fo=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949");BigInt(0);const P1=BigInt(1),mu=BigInt(2),S1=BigInt(3),D1=BigInt(5);BigInt(8);function x1(t){const e=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),s=Fo,o=t*t%s*t%s,a=mt(o,mu,s)*o%s,c=mt(a,P1,s)*t%s,u=mt(c,D1,s)*c%s,l=mt(u,e,s)*u%s,h=mt(l,r,s)*l%s,f=mt(h,n,s)*h%s,p=mt(f,i,s)*f%s,d=mt(p,i,s)*f%s,y=mt(d,e,s)*u%s;return{pow_p_5_8:mt(y,mu,s)*t%s,b2:o}}function A1(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}const ko=I1({P:Fo,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:t=>{const e=Fo,{pow_p_5_8:r,b2:n}=x1(t);return Ge(mt(r,S1,e)*n,e)},adjustScalarBytes:A1,randomBytes:_n});function wu(t){t.lowS!==void 0&&dn("lowS",t.lowS),t.prehash!==void 0&&dn("prehash",t.prehash)}function C1(t){const e=Wf(t);$n(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:r,Fp:n,a:i}=e;if(r){if(!n.eql(i,n.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:L1,hexToBytes:R1}=h1;class N1 extends Error{constructor(e=""){super(e)}}const Ft={Err:N1,_tlv:{encode:(t,e)=>{const{Err:r}=Ft;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");const n=e.length/2,i=Jr(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const s=n>127?Jr(i.length/2|128):"";return Jr(t)+s+i+e},decode(t,e){const{Err:r}=Ft;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const i=e[n++],s=!!(i&128);let o=0;if(!s)o=i;else{const c=i&127;if(!c)throw new r("tlv.decode(long): indefinite length not supported");if(c>4)throw new r("tlv.decode(long): byte length is too big");const u=e.subarray(n,n+c);if(u.length!==c)throw new r("tlv.decode: length bytes not complete");if(u[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(const l of u)o=o<<8|l;if(n+=c,o<128)throw new r("tlv.decode(long): not minimal encoding")}const a=e.subarray(n,n+o);if(a.length!==o)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+o)}}},_int:{encode(t){const{Err:e}=Ft;if(t<kt)throw new e("integer: negative integers are not allowed");let r=Jr(t);if(Number.parseInt(r[0],16)&8&&(r="00"+r),r.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return r},decode(t){const{Err:e}=Ft;if(t[0]&128)throw new e("invalid signature integer: negative");if(t[0]===0&&!(t[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return L1(t)}},toSig(t){const{Err:e,_int:r,_tlv:n}=Ft,i=typeof t=="string"?R1(t):t;oi(i);const{v:s,l:o}=n.decode(48,i);if(o.length)throw new e("invalid signature: left bytes after parsing");const{v:a,l:c}=n.decode(2,s),{v:u,l}=n.decode(2,c);if(l.length)throw new e("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(u)}},hexFromSig(t){const{_tlv:e,_int:r}=Ft,n=e.encode(2,r.encode(t.r)),i=e.encode(2,r.encode(t.s)),s=n+i;return e.encode(48,s)}},kt=BigInt(0),Pe=BigInt(1);BigInt(2);const vu=BigInt(3);BigInt(4);function T1(t){const e=C1(t),{Fp:r}=e,n=qf(e.n,e.nBitLength),i=e.toBytes||((y,w,b)=>{const v=w.toAffine();return Yn(Uint8Array.from([4]),r.toBytes(v.x),r.toBytes(v.y))}),s=e.fromBytes||(y=>{const w=y.subarray(1),b=r.fromBytes(w.subarray(0,r.BYTES)),v=r.fromBytes(w.subarray(r.BYTES,2*r.BYTES));return{x:b,y:v}});function o(y){const{a:w,b}=e,v=r.sqr(y),E=r.mul(v,y);return r.add(r.add(E,r.mul(y,w)),b)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function a(y){return gs(y,Pe,e.n)}function c(y){const{allowedPrivateKeyLengths:w,nByteLength:b,wrapPrivateKey:v,n:E}=e;if(w&&typeof y!="bigint"){if(vr(y)&&(y=pn(y)),typeof y!="string"||!w.includes(y.length))throw new Error("invalid private key");y=y.padStart(b*2,"0")}let $;try{$=typeof y=="bigint"?y:pr(et("private key",y,b))}catch{throw new Error("invalid private key, expected hex or "+b+" bytes, got "+typeof y)}return v&&($=Ge($,E)),qt("private key",$,Pe,E),$}function u(y){if(!(y instanceof f))throw new Error("ProjectivePoint expected")}const l=Bo((y,w)=>{const{px:b,py:v,pz:E}=y;if(r.eql(E,r.ONE))return{x:b,y:v};const $=y.is0();w==null&&(w=$?r.ONE:r.inv(E));const D=r.mul(b,w),x=r.mul(v,w),S=r.mul(E,w);if($)return{x:r.ZERO,y:r.ZERO};if(!r.eql(S,r.ONE))throw new Error("invZ was invalid");return{x:D,y:x}}),h=Bo(y=>{if(y.is0()){if(e.allowInfinityPoint&&!r.is0(y.py))return;throw new Error("bad point: ZERO")}const{x:w,y:b}=y.toAffine();if(!r.isValid(w)||!r.isValid(b))throw new Error("bad point: x or y not FE");const v=r.sqr(b),E=o(w);if(!r.eql(v,E))throw new Error("bad point: equation left != right");if(!y.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class f{constructor(w,b,v){if(this.px=w,this.py=b,this.pz=v,w==null||!r.isValid(w))throw new Error("x required");if(b==null||!r.isValid(b))throw new Error("y required");if(v==null||!r.isValid(v))throw new Error("z required");Object.freeze(this)}static fromAffine(w){const{x:b,y:v}=w||{};if(!w||!r.isValid(b)||!r.isValid(v))throw new Error("invalid affine point");if(w instanceof f)throw new Error("projective point not allowed");const E=$=>r.eql($,r.ZERO);return E(b)&&E(v)?f.ZERO:new f(b,v,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(w){const b=r.invertBatch(w.map(v=>v.pz));return w.map((v,E)=>v.toAffine(b[E])).map(f.fromAffine)}static fromHex(w){const b=f.fromAffine(s(et("pointHex",w)));return b.assertValidity(),b}static fromPrivateKey(w){return f.BASE.multiply(c(w))}static msm(w,b){return $1(f,n,w,b)}_setWindowSize(w){d.setWindowSize(this,w)}assertValidity(){h(this)}hasEvenY(){const{y:w}=this.toAffine();if(r.isOdd)return!r.isOdd(w);throw new Error("Field doesn't support isOdd")}equals(w){u(w);const{px:b,py:v,pz:E}=this,{px:$,py:D,pz:x}=w,S=r.eql(r.mul(b,x),r.mul($,E)),C=r.eql(r.mul(v,x),r.mul(D,E));return S&&C}negate(){return new f(this.px,r.neg(this.py),this.pz)}double(){const{a:w,b}=e,v=r.mul(b,vu),{px:E,py:$,pz:D}=this;let x=r.ZERO,S=r.ZERO,C=r.ZERO,I=r.mul(E,E),k=r.mul($,$),B=r.mul(D,D),j=r.mul(E,$);return j=r.add(j,j),C=r.mul(E,D),C=r.add(C,C),x=r.mul(w,C),S=r.mul(v,B),S=r.add(x,S),x=r.sub(k,S),S=r.add(k,S),S=r.mul(x,S),x=r.mul(j,x),C=r.mul(v,C),B=r.mul(w,B),j=r.sub(I,B),j=r.mul(w,j),j=r.add(j,C),C=r.add(I,I),I=r.add(C,I),I=r.add(I,B),I=r.mul(I,j),S=r.add(S,I),B=r.mul($,D),B=r.add(B,B),I=r.mul(B,j),x=r.sub(x,I),C=r.mul(B,k),C=r.add(C,C),C=r.add(C,C),new f(x,S,C)}add(w){u(w);const{px:b,py:v,pz:E}=this,{px:$,py:D,pz:x}=w;let S=r.ZERO,C=r.ZERO,I=r.ZERO;const k=e.a,B=r.mul(e.b,vu);let j=r.mul(b,$),q=r.mul(v,D),L=r.mul(E,x),g=r.add(b,v),m=r.add($,D);g=r.mul(g,m),m=r.add(j,q),g=r.sub(g,m),m=r.add(b,E);let _=r.add($,x);return m=r.mul(m,_),_=r.add(j,L),m=r.sub(m,_),_=r.add(v,E),S=r.add(D,x),_=r.mul(_,S),S=r.add(q,L),_=r.sub(_,S),I=r.mul(k,m),S=r.mul(B,L),I=r.add(S,I),S=r.sub(q,I),I=r.add(q,I),C=r.mul(S,I),q=r.add(j,j),q=r.add(q,j),L=r.mul(k,L),m=r.mul(B,m),q=r.add(q,L),L=r.sub(j,L),L=r.mul(k,L),m=r.add(m,L),j=r.mul(q,m),C=r.add(C,j),j=r.mul(_,m),S=r.mul(g,S),S=r.sub(S,j),j=r.mul(g,q),I=r.mul(_,I),I=r.add(I,j),new f(S,C,I)}subtract(w){return this.add(w.negate())}is0(){return this.equals(f.ZERO)}wNAF(w){return d.wNAFCached(this,w,f.normalizeZ)}multiplyUnsafe(w){const{endo:b,n:v}=e;qt("scalar",w,kt,v);const E=f.ZERO;if(w===kt)return E;if(this.is0()||w===Pe)return this;if(!b||d.hasPrecomputes(this))return d.wNAFCachedUnsafe(this,w,f.normalizeZ);let{k1neg:$,k1:D,k2neg:x,k2:S}=b.splitScalar(w),C=E,I=E,k=this;for(;D>kt||S>kt;)D&Pe&&(C=C.add(k)),S&Pe&&(I=I.add(k)),k=k.double(),D>>=Pe,S>>=Pe;return $&&(C=C.negate()),x&&(I=I.negate()),I=new f(r.mul(I.px,b.beta),I.py,I.pz),C.add(I)}multiply(w){const{endo:b,n:v}=e;qt("scalar",w,Pe,v);let E,$;if(b){const{k1neg:D,k1:x,k2neg:S,k2:C}=b.splitScalar(w);let{p:I,f:k}=this.wNAF(x),{p:B,f:j}=this.wNAF(C);I=d.constTimeNegate(D,I),B=d.constTimeNegate(S,B),B=new f(r.mul(B.px,b.beta),B.py,B.pz),E=I.add(B),$=k.add(j)}else{const{p:D,f:x}=this.wNAF(w);E=D,$=x}return f.normalizeZ([E,$])[0]}multiplyAndAddUnsafe(w,b,v){const E=f.BASE,$=(x,S)=>S===kt||S===Pe||!x.equals(E)?x.multiplyUnsafe(S):x.multiply(S),D=$(this,b).add($(w,v));return D.is0()?void 0:D}toAffine(w){return l(this,w)}isTorsionFree(){const{h:w,isTorsionFree:b}=e;if(w===Pe)return!0;if(b)return b(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:w,clearCofactor:b}=e;return w===Pe?this:b?b(f,this):this.multiplyUnsafe(e.h)}toRawBytes(w=!0){return dn("isCompressed",w),this.assertValidity(),i(f,this,w)}toHex(w=!0){return dn("isCompressed",w),pn(this.toRawBytes(w))}}f.BASE=new f(e.Gx,e.Gy,r.ONE),f.ZERO=new f(r.ZERO,r.ONE,r.ZERO);const p=e.nBitLength,d=_1(f,e.endo?Math.ceil(p/2):p);return{CURVE:e,ProjectivePoint:f,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:a}}function j1(t){const e=Wf(t);return $n(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function B1(t){const e=j1(t),{Fp:r,n}=e,i=r.BYTES+1,s=2*r.BYTES+1;function o(L){return Ge(L,n)}function a(L){return Uo(L,n)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:l,isWithinCurveOrder:h}=T1({...e,toBytes(L,g,m){const _=g.toAffine(),P=r.toBytes(_.x),O=Yn;return dn("isCompressed",m),m?O(Uint8Array.from([g.hasEvenY()?2:3]),P):O(Uint8Array.from([4]),P,r.toBytes(_.y))},fromBytes(L){const g=L.length,m=L[0],_=L.subarray(1);if(g===i&&(m===2||m===3)){const P=pr(_);if(!gs(P,Pe,r.ORDER))throw new Error("Point is not on curve");const O=l(P);let A;try{A=r.sqrt(O)}catch(F){const z=F instanceof Error?": "+F.message:"";throw new Error("Point is not on curve"+z)}const M=(A&Pe)===Pe;return(m&1)===1!==M&&(A=r.neg(A)),{x:P,y:A}}else if(g===s&&m===4){const P=r.fromBytes(_.subarray(0,r.BYTES)),O=r.fromBytes(_.subarray(r.BYTES,2*r.BYTES));return{x:P,y:O}}else{const P=i,O=s;throw new Error("invalid Point, expected length of "+P+", or uncompressed "+O+", got "+g)}}}),f=L=>pn(yn(L,e.nByteLength));function p(L){const g=n>>Pe;return L>g}function d(L){return p(L)?o(-L):L}const y=(L,g,m)=>pr(L.slice(g,m));class w{constructor(g,m,_){this.r=g,this.s=m,this.recovery=_,this.assertValidity()}static fromCompact(g){const m=e.nByteLength;return g=et("compactSignature",g,m*2),new w(y(g,0,m),y(g,m,2*m))}static fromDER(g){const{r:m,s:_}=Ft.toSig(et("DER",g));return new w(m,_)}assertValidity(){qt("r",this.r,Pe,n),qt("s",this.s,Pe,n)}addRecoveryBit(g){return new w(this.r,this.s,g)}recoverPublicKey(g){const{r:m,s:_,recovery:P}=this,O=x(et("msgHash",g));if(P==null||![0,1,2,3].includes(P))throw new Error("recovery id invalid");const A=P===2||P===3?m+e.n:m;if(A>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const M=P&1?"03":"02",F=c.fromHex(M+f(A)),z=a(A),U=o(-O*z),H=o(_*z),G=c.BASE.multiplyAndAddUnsafe(F,U,H);if(!G)throw new Error("point at infinify");return G.assertValidity(),G}hasHighS(){return p(this.s)}normalizeS(){return this.hasHighS()?new w(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return gn(this.toDERHex())}toDERHex(){return Ft.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return gn(this.toCompactHex())}toCompactHex(){return f(this.r)+f(this.s)}}const b={isValidPrivateKey(L){try{return u(L),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const L=Hf(e.n);return v1(e.randomBytes(L),e.n)},precompute(L=8,g=c.BASE){return g._setWindowSize(L),g.multiply(BigInt(3)),g}};function v(L,g=!0){return c.fromPrivateKey(L).toRawBytes(g)}function E(L){const g=vr(L),m=typeof L=="string",_=(g||m)&&L.length;return g?_===i||_===s:m?_===2*i||_===2*s:L instanceof c}function $(L,g,m=!0){if(E(L))throw new Error("first arg must be private key");if(!E(g))throw new Error("second arg must be public key");return c.fromHex(g).multiply(u(L)).toRawBytes(m)}const D=e.bits2int||function(L){if(L.length>8192)throw new Error("input is too large");const g=pr(L),m=L.length*8-e.nBitLength;return m>0?g>>BigInt(m):g},x=e.bits2int_modN||function(L){return o(D(L))},S=Pa(e.nBitLength);function C(L){return qt("num < 2^"+e.nBitLength,L,kt,S),yn(L,e.nByteLength)}function I(L,g,m=k){if(["recovered","canonical"].some(ee=>ee in m))throw new Error("sign() legacy options not supported");const{hash:_,randomBytes:P}=e;let{lowS:O,prehash:A,extraEntropy:M}=m;O==null&&(O=!0),L=et("msgHash",L),wu(m),A&&(L=et("prehashed msgHash",_(L)));const F=x(L),z=u(g),U=[C(z),C(F)];if(M!=null&&M!==!1){const ee=M===!0?P(r.BYTES):M;U.push(et("extraEntropy",ee))}const H=Yn(...U),G=F;function de(ee){const Y=D(ee);if(!h(Y))return;const Be=a(Y),Ae=c.BASE.multiply(Y).toAffine(),Fe=o(Ae.x);if(Fe===kt)return;const it=o(Be*o(G+Fe*z));if(it===kt)return;let st=(Ae.x===Fe?0:2)|Number(Ae.y&Pe),Sr=it;return O&&p(it)&&(Sr=d(it),st^=1),new w(Fe,Sr,st)}return{seed:H,k2sig:de}}const k={lowS:e.lowS,prehash:!1},B={lowS:e.lowS,prehash:!1};function j(L,g,m=k){const{seed:_,k2sig:P}=I(L,g,m),O=e;return Uf(O.hash.outputLen,O.nByteLength,O.hmac)(_,P)}c.BASE._setWindowSize(8);function q(L,g,m,_=B){var it;const P=L;g=et("msgHash",g),m=et("publicKey",m);const{lowS:O,prehash:A,format:M}=_;if(wu(_),"strict"in _)throw new Error("options.strict was renamed to lowS");if(M!==void 0&&M!=="compact"&&M!=="der")throw new Error("format must be compact or der");const F=typeof P=="string"||vr(P),z=!F&&!M&&typeof P=="object"&&P!==null&&typeof P.r=="bigint"&&typeof P.s=="bigint";if(!F&&!z)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let U,H;try{if(z&&(U=new w(P.r,P.s)),F){try{M!=="compact"&&(U=w.fromDER(P))}catch(st){if(!(st instanceof Ft.Err))throw st}!U&&M!=="der"&&(U=w.fromCompact(P))}H=c.fromHex(m)}catch{return!1}if(!U||O&&U.hasHighS())return!1;A&&(g=e.hash(g));const{r:G,s:de}=U,ee=x(g),Y=a(de),Be=o(ee*Y),Ae=o(G*Y),Fe=(it=c.BASE.multiplyAndAddUnsafe(H,Be,Ae))==null?void 0:it.toAffine();return Fe?o(Fe.x)===G:!1}return{CURVE:e,getPublicKey:v,getSharedSecret:$,sign:j,verify:q,ProjectivePoint:c,Signature:w,utils:b}}function M1(t){return{hash:t,hmac:(e,...r)=>hs(t,e,q0(...r)),randomBytes:_n}}function U1(t,e){const r=n=>B1({...t,...M1(n)});return{...r(e),create:r}}const Gf=qf(BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff")),F1=Gf.create(BigInt("-3")),k1=BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),q1=U1({a:F1,b:k1,Fp:Gf,n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"),h:BigInt(1),lowS:!1},si),Yf="base10",qe="base16",wt="base64pad",Jt="base64url",ai="utf8",Jf=0,zt=1,ci=2,z1=0,bu=1,Fn=12,Sa=32;function H1(){const t=ko.utils.randomPrivateKey(),e=ko.getPublicKey(t);return{privateKey:Ye(t,qe),publicKey:Ye(e,qe)}}function qo(){const t=_n(Sa);return Ye(t,qe)}function K1(t,e){const r=ko.getSharedSecret(lt(t,qe),lt(e,qe)),n=YE(si,r,void 0,void 0,Sa);return Ye(n,qe)}function Li(t){const e=si(lt(t,qe));return Ye(e,qe)}function xt(t){const e=si(lt(t,ai));return Ye(e,qe)}function Zf(t){return lt(`${t}`,Yf)}function br(t){return Number(Ye(t,Yf))}function Qf(t){return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Xf(t){const e=t.replace(/-/g,"+").replace(/_/g,"/"),r=(4-e.length%4)%4;return e+"=".repeat(r)}function V1(t){const e=Zf(typeof t.type<"u"?t.type:Jf);if(br(e)===zt&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?lt(t.senderPublicKey,qe):void 0,n=typeof t.iv<"u"?lt(t.iv,qe):_n(Fn),i=lt(t.symKey,qe),s=jf(i,n).encrypt(lt(t.message,ai)),o=ed({type:e,sealed:s,iv:n,senderPublicKey:r});return t.encoding===Jt?Qf(o):o}function W1(t){const e=lt(t.symKey,qe),{sealed:r,iv:n}=Jn({encoded:t.encoded,encoding:t.encoding}),i=jf(e,n).decrypt(r);if(i===null)throw new Error("Failed to decrypt");return Ye(i,ai)}function G1(t,e){const r=Zf(ci),n=_n(Fn),i=lt(t,ai),s=ed({type:r,sealed:i,iv:n});return e===Jt?Qf(s):s}function Y1(t,e){const{sealed:r}=Jn({encoded:t,encoding:e});return Ye(r,ai)}function ed(t){if(br(t.type)===ci)return Ye(Un([t.type,t.sealed]),wt);if(br(t.type)===zt){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Ye(Un([t.type,t.senderPublicKey,t.iv,t.sealed]),wt)}return Ye(Un([t.type,t.iv,t.sealed]),wt)}function Jn(t){const e=(t.encoding||wt)===Jt?Xf(t.encoded):t.encoded,r=lt(e,wt),n=r.slice(z1,bu),i=bu;if(br(n)===zt){const c=i+Sa,u=c+Fn,l=r.slice(i,c),h=r.slice(c,u),f=r.slice(u);return{type:n,sealed:f,iv:h,senderPublicKey:l}}if(br(n)===ci){const c=r.slice(i),u=_n(Fn);return{type:n,sealed:c,iv:u}}const s=i+Fn,o=r.slice(i,s),a=r.slice(s);return{type:n,sealed:a,iv:o}}function J1(t,e){const r=Jn({encoded:t,encoding:e==null?void 0:e.encoding});return td({type:br(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Ye(r.senderPublicKey,qe):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function td(t){const e=(t==null?void 0:t.type)||Jf;if(e===zt){if(typeof(t==null?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(t==null?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t==null?void 0:t.senderPublicKey,receiverPublicKey:t==null?void 0:t.receiverPublicKey}}function Eu(t){return t.type===zt&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function _u(t){return t.type===ci}function Z1(t){const e=Buffer.from(t.x,"base64"),r=Buffer.from(t.y,"base64");return Un([new Uint8Array([4]),e,r])}function Q1(t,e){const[r,n,i]=t.split("."),s=Buffer.from(Xf(i),"base64");if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32),a=s.slice(32,64),c=`${r}.${n}`,u=si(c),l=Z1(e);if(!q1.verify(Un([o,a]),u,l))throw new Error("Invalid signature");return Ao(t).payload}const X1="irn";function Ji(t){return(t==null?void 0:t.relay)||{protocol:X1}}function Bn(t){const e=i0[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}function e_(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function $u(t){if(!t.includes("wc:")){const u=$f(t);u!=null&&u.includes("wc:")&&(t=u)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=new URLSearchParams(s),a={};o.forEach((u,l)=>{a[l]=u});const c=typeof a.methods=="string"?a.methods.split(","):void 0;return{protocol:n,topic:t_(i[0]),version:parseInt(i[1],10),symKey:a.symKey,relay:e_(a),methods:c,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function t_(t){return t.startsWith("//")?t.substring(2):t}function r_(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=i,o=r+e+s;t[s]&&(n[o]=t[s])}),n}function Ou(t){const e=new URLSearchParams,r=r_(t.relay);Object.keys(r).sort().forEach(i=>{e.set(i,r[i])}),e.set("symKey",t.symKey),t.expiryTimestamp&&e.set("expiryTimestamp",t.expiryTimestamp.toString()),t.methods&&e.set("methods",t.methods.join(","));const n=e.toString();return`${t.protocol}:${t.topic}@${t.version}?${n}`}function vi(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}var n_=Object.defineProperty,i_=Object.defineProperties,s_=Object.getOwnPropertyDescriptors,Iu=Object.getOwnPropertySymbols,o_=Object.prototype.hasOwnProperty,a_=Object.prototype.propertyIsEnumerable,Pu=(t,e,r)=>e in t?n_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,c_=(t,e)=>{for(var r in e||(e={}))o_.call(e,r)&&Pu(t,r,e[r]);if(Iu)for(var r of Iu(e))a_.call(e,r)&&Pu(t,r,e[r]);return t},u_=(t,e)=>i_(t,s_(e));function On(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function l_(t){const e=[];return Object.values(t).forEach(r=>{e.push(...On(r.accounts))}),e}function h_(t,e){const r=[];return Object.values(t).forEach(n=>{On(n.accounts).includes(e)&&r.push(...n.methods)}),r}function f_(t,e){const r=[];return Object.values(t).forEach(n=>{On(n.accounts).includes(e)&&r.push(...n.events)}),r}function ys(t){return t.includes(":")}function Zr(t){return ys(t)?t.split(":")[0]:t}function Su(t){var e,r,n;const i={};if(!er(t))return i;for(const[s,o]of Object.entries(t)){const a=ys(s)?[s]:o.chains,c=o.methods||[],u=o.events||[],l=Zr(s);i[l]=u_(c_({},i[l]),{chains:At(a,(e=i[l])==null?void 0:e.chains),methods:At(c,(r=i[l])==null?void 0:r.methods),events:At(u,(n=i[l])==null?void 0:n.events)})}return i}function d_(t){const e={};return t==null||t.forEach(r=>{var n;const[i,s]=r.split(":");e[i]||(e[i]={accounts:[],chains:[],events:[],methods:[]}),e[i].accounts.push(r),(n=e[i].chains)==null||n.push(`${i}:${s}`)}),e}function Du(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=d_(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=At(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}function p_(t,e){var r,n,i,s,o,a;const c=Su(t),u=Su(e),l={},h=Object.keys(c).concat(Object.keys(u));for(const f of h)l[f]={chains:At((r=c[f])==null?void 0:r.chains,(n=u[f])==null?void 0:n.chains),methods:At((i=c[f])==null?void 0:i.methods,(s=u[f])==null?void 0:s.methods),events:At((o=c[f])==null?void 0:o.events,(a=u[f])==null?void 0:a.events)};return l}const g_={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}},y_={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function T(t,e){const{message:r,code:n}=y_[t];return{message:e?`${r} ${e}`:r,code:n}}function te(t,e){const{message:r,code:n}=g_[t];return{message:e?`${r} ${e}`:r,code:n}}function vt(t,e){return!!Array.isArray(t)}function er(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function Ue(t){return typeof t>"u"}function be(t,e){return e&&Ue(t)?!0:typeof t=="string"&&!!t.trim().length}function Da(t,e){return typeof t=="number"&&!isNaN(t)}function m_(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return fr(i,n)?(n.forEach(o=>{const{accounts:a,methods:c,events:u}=t.namespaces[o],l=On(a),h=r[o];(!fr(wf(o,h),l)||!fr(h.methods,c)||!fr(h.events,u))&&(s=!1)}),s):!1}function Zi(t){return be(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function w_(t){if(be(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&Zi(r)}}return!1}function v_(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(be(t,!1)){if(e(t))return!0;const r=$f(t);return e(r)}}catch{}return!1}function b_(t){var e;return(e=t==null?void 0:t.proposer)==null?void 0:e.publicKey}function E_(t){return t==null?void 0:t.topic}function __(t,e){let r=null;return be(t==null?void 0:t.publicKey,!1)||(r=T("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function xu(t){let e=!0;return vt(t)?t.length&&(e=t.every(r=>be(r,!1))):e=!1,e}function $_(t,e,r){let n=null;return vt(e)&&e.length?e.forEach(i=>{n||Zi(i)||(n=te("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Zi(t)||(n=te("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function O_(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;const o=$_(i,wf(i,s),`${e} ${r}`);o&&(n=o)}),n}function I_(t,e){let r=null;return vt(t)?t.forEach(n=>{r||w_(n)||(r=te("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=te("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function P_(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=I_(n==null?void 0:n.accounts,`${e} namespace`);i&&(r=i)}),r}function S_(t,e){let r=null;return xu(t==null?void 0:t.methods)?xu(t==null?void 0:t.events)||(r=te("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=te("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function rd(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=S_(n,`${e}, namespace`);i&&(r=i)}),r}function D_(t,e,r){let n=null;if(t&&er(t)){const i=rd(t,e);i&&(n=i);const s=O_(t,e,r);s&&(n=s)}else n=T("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function io(t,e){let r=null;if(t&&er(t)){const n=rd(t,e);n&&(r=n);const i=P_(t,e);i&&(r=i)}else r=T("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function nd(t){return be(t.protocol,!0)}function x_(t,e){let r=!1;return t?t&&vt(t)&&t.length&&t.forEach(n=>{r=nd(n)}):r=!0,r}function A_(t){return typeof t=="number"}function We(t){return typeof t<"u"&&typeof t!==null}function C_(t){return!(!t||typeof t!="object"||!t.code||!Da(t.code)||!t.message||!be(t.message,!1))}function L_(t){return!(Ue(t)||!be(t.method,!1))}function R_(t){return!(Ue(t)||Ue(t.result)&&Ue(t.error)||!Da(t.id)||!be(t.jsonrpc,!1))}function N_(t){return!(Ue(t)||!be(t.name,!1))}function Au(t,e){return!(!Zi(e)||!l_(t).includes(e))}function T_(t,e,r){return be(r,!1)?h_(t,e).includes(r):!1}function j_(t,e,r){return be(r,!1)?f_(t,e).includes(r):!1}function Cu(t,e,r){let n=null;const i=B_(t),s=M_(e),o=Object.keys(i),a=Object.keys(s),c=Lu(Object.keys(t)),u=Lu(Object.keys(e)),l=c.filter(h=>!u.includes(h));return l.length&&(n=T("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces.
|
|
20
|
-
Required: ${l.toString()}
|
|
21
|
-
Received: ${Object.keys(e).toString()}`)),fr(o,a)||(n=T("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces.
|
|
22
|
-
Required: ${o.toString()}
|
|
23
|
-
Approved: ${a.toString()}`)),Object.keys(e).forEach(h=>{if(!h.includes(":")||n)return;const f=On(e[h].accounts);f.includes(h)||(n=T("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${h}
|
|
24
|
-
Required: ${h}
|
|
25
|
-
Approved: ${f.toString()}`))}),o.forEach(h=>{n||(fr(i[h].methods,s[h].methods)?fr(i[h].events,s[h].events)||(n=T("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${h}`)):n=T("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${h}`))}),n}function B_(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function Lu(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function M_(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=On(t[r].accounts);n==null||n.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function U_(t,e){return Da(t)&&t<=e.max&&t>=e.min}function Ru(){const t=ni();return new Promise(e=>{switch(t){case rt.browser:e(F_());break;case rt.reactNative:e(k_());break;case rt.node:e(q_());break;default:e(!0)}})}function F_(){return En()&&(navigator==null?void 0:navigator.onLine)}async function k_(){if(tr()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function q_(){return!0}function z_(t){switch(ni()){case rt.browser:H_(t);break;case rt.reactNative:K_(t);break}}function H_(t){!tr()&&En()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function K_(t){tr()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}function V_(){var t;return En()&&gr()?((t=gr())==null?void 0:t.visibilityState)==="visible":!0}const so={};class Cn{static get(e){return so[e]}static set(e,r){so[e]=r}static delete(e){delete so[e]}}var xa={exports:{}},tn=typeof Reflect=="object"?Reflect:null,Nu=tn&&typeof tn.apply=="function"?tn.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Ri;tn&&typeof tn.ownKeys=="function"?Ri=tn.ownKeys:Object.getOwnPropertySymbols?Ri=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Ri=function(e){return Object.getOwnPropertyNames(e)};function W_(t){console&&console.warn&&console.warn(t)}var id=Number.isNaN||function(e){return e!==e};function ne(){ne.init.call(this)}xa.exports=ne;xa.exports.once=Z_;ne.EventEmitter=ne;ne.prototype._events=void 0;ne.prototype._eventsCount=0;ne.prototype._maxListeners=void 0;var Tu=10;function ms(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(ne,"defaultMaxListeners",{enumerable:!0,get:function(){return Tu},set:function(t){if(typeof t!="number"||t<0||id(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Tu=t}});ne.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};ne.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||id(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function sd(t){return t._maxListeners===void 0?ne.defaultMaxListeners:t._maxListeners}ne.prototype.getMaxListeners=function(){return sd(this)};ne.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[e];if(c===void 0)return!1;if(typeof c=="function")Nu(c,this,r);else for(var u=c.length,l=ld(c,u),n=0;n<u;++n)Nu(l[n],this,r);return!0};function od(t,e,r,n){var i,s,o;if(ms(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=sd(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,W_(a)}return t}ne.prototype.addListener=function(e,r){return od(this,e,r,!1)};ne.prototype.on=ne.prototype.addListener;ne.prototype.prependListener=function(e,r){return od(this,e,r,!0)};function G_(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function ad(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=G_.bind(n);return i.listener=r,n.wrapFn=i,i}ne.prototype.once=function(e,r){return ms(r),this.on(e,ad(this,e,r)),this};ne.prototype.prependOnceListener=function(e,r){return ms(r),this.prependListener(e,ad(this,e,r)),this};ne.prototype.removeListener=function(e,r){var n,i,s,o,a;if(ms(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():Y_(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};ne.prototype.off=ne.prototype.removeListener;ne.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function cd(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?J_(i):ld(i,i.length)}ne.prototype.listeners=function(e){return cd(this,e,!0)};ne.prototype.rawListeners=function(e){return cd(this,e,!1)};ne.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):ud.call(t,e)};ne.prototype.listenerCount=ud;function ud(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}ne.prototype.eventNames=function(){return this._eventsCount>0?Ri(this._events):[]};function ld(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function Y_(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function J_(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Z_(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}hd(t,e,s,{once:!0}),e!=="error"&&Q_(t,i,{once:!0})})}function Q_(t,e,r){typeof t.on=="function"&&hd(t,"error",e,r)}function hd(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var _r=xa.exports;const X_=ei(_r);var Aa={exports:{}},rn=typeof Reflect=="object"?Reflect:null,ju=rn&&typeof rn.apply=="function"?rn.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Ni;rn&&typeof rn.ownKeys=="function"?Ni=rn.ownKeys:Object.getOwnPropertySymbols?Ni=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Ni=function(e){return Object.getOwnPropertyNames(e)};function e$(t){console&&console.warn&&console.warn(t)}var fd=Number.isNaN||function(e){return e!==e};function ie(){ie.init.call(this)}Aa.exports=ie;Aa.exports.once=i$;ie.EventEmitter=ie;ie.prototype._events=void 0;ie.prototype._eventsCount=0;ie.prototype._maxListeners=void 0;var Bu=10;function ws(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(ie,"defaultMaxListeners",{enumerable:!0,get:function(){return Bu},set:function(t){if(typeof t!="number"||t<0||fd(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Bu=t}});ie.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};ie.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||fd(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function dd(t){return t._maxListeners===void 0?ie.defaultMaxListeners:t._maxListeners}ie.prototype.getMaxListeners=function(){return dd(this)};ie.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[e];if(c===void 0)return!1;if(typeof c=="function")ju(c,this,r);else for(var u=c.length,l=wd(c,u),n=0;n<u;++n)ju(l[n],this,r);return!0};function pd(t,e,r,n){var i,s,o;if(ws(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=dd(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,e$(a)}return t}ie.prototype.addListener=function(e,r){return pd(this,e,r,!1)};ie.prototype.on=ie.prototype.addListener;ie.prototype.prependListener=function(e,r){return pd(this,e,r,!0)};function t$(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function gd(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=t$.bind(n);return i.listener=r,n.wrapFn=i,i}ie.prototype.once=function(e,r){return ws(r),this.on(e,gd(this,e,r)),this};ie.prototype.prependOnceListener=function(e,r){return ws(r),this.prependListener(e,gd(this,e,r)),this};ie.prototype.removeListener=function(e,r){var n,i,s,o,a;if(ws(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():r$(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};ie.prototype.off=ie.prototype.removeListener;ie.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function yd(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?n$(i):wd(i,i.length)}ie.prototype.listeners=function(e){return yd(this,e,!0)};ie.prototype.rawListeners=function(e){return yd(this,e,!1)};ie.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):md.call(t,e)};ie.prototype.listenerCount=md;function md(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}ie.prototype.eventNames=function(){return this._eventsCount>0?Ni(this._events):[]};function wd(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function r$(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function n$(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function i$(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}vd(t,e,s,{once:!0}),e!=="error"&&s$(t,i,{once:!0})})}function s$(t,e,r){typeof t.on=="function"&&vd(t,"error",e,r)}function vd(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var o$=Aa.exports;class $r{}let a$=class extends $r{constructor(e){super()}};const Mu=N.FIVE_SECONDS,Or={pulse:"heartbeat_pulse"};let c$=class bd extends a${constructor(e){super(e),this.events=new o$.EventEmitter,this.interval=Mu,this.interval=(e==null?void 0:e.interval)||Mu}static async init(e){const r=new bd(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),N.toMiliseconds(this.interval))}pulse(){this.events.emit(Or.pulse)}};const u$=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,l$=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,h$=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function f$(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){d$(t);return}return e}function d$(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function bi(t,e={}){if(typeof t!="string")return t;if(t[0]==='"'&&t[t.length-1]==='"'&&t.indexOf("\\")===-1)return t.slice(1,-1);const r=t.trim();if(r.length<=9)switch(r.toLowerCase()){case"true":return!0;case"false":return!1;case"undefined":return;case"null":return null;case"nan":return Number.NaN;case"infinity":return Number.POSITIVE_INFINITY;case"-infinity":return Number.NEGATIVE_INFINITY}if(!h$.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(u$.test(t)||l$.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,f$)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function p$(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Ie(t,...e){try{return p$(t(...e))}catch(r){return Promise.reject(r)}}function g$(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function y$(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Ti(t){if(g$(t))return String(t);if(y$(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Ti(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const zo="base64:";function m$(t){return typeof t=="string"?t:zo+b$(t)}function w$(t){return typeof t!="string"||!t.startsWith(zo)?t:v$(t.slice(zo.length))}function v$(t){return globalThis.Buffer?Buffer.from(t,"base64"):Uint8Array.from(globalThis.atob(t),e=>e.codePointAt(0))}function b$(t){return globalThis.Buffer?Buffer.from(t).toString("base64"):globalThis.btoa(String.fromCodePoint(...t))}function Ve(t){var e;return t&&((e=t.split("?")[0])==null?void 0:e.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function E$(...t){return Ve(t.join(":"))}function Ei(t){return t=Ve(t),t?t+":":""}function _$(t,e){if(e===void 0)return!0;let r=0,n=t.indexOf(":");for(;n>-1;)r++,n=t.indexOf(":",n+1);return r<=e}function $$(t,e){return e?t.startsWith(e)&&t[t.length-1]!=="$":t[t.length-1]!=="$"}const O$="memory",I$=()=>{const t=new Map;return{name:O$,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function P$(t={}){const e={mounts:{"":t.driver||I$()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=u=>{for(const l of e.mountpoints)if(u.startsWith(l))return{base:l,relativeKey:u.slice(l.length),driver:e.mounts[l]};return{base:"",relativeKey:u,driver:e.mounts[""]}},n=(u,l)=>e.mountpoints.filter(h=>h.startsWith(u)||l&&u.startsWith(h)).map(h=>({relativeBase:u.length>h.length?u.slice(h.length):void 0,mountpoint:h,driver:e.mounts[h]})),i=(u,l)=>{if(e.watching){l=Ve(l);for(const h of e.watchListeners)h(u,l)}},s=async()=>{if(!e.watching){e.watching=!0;for(const u in e.mounts)e.unwatch[u]=await Uu(e.mounts[u],i,u)}},o=async()=>{if(e.watching){for(const u in e.unwatch)await e.unwatch[u]();e.unwatch={},e.watching=!1}},a=(u,l,h)=>{const f=new Map,p=d=>{let y=f.get(d.base);return y||(y={driver:d.driver,base:d.base,items:[]},f.set(d.base,y)),y};for(const d of u){const y=typeof d=="string",w=Ve(y?d:d.key),b=y?void 0:d.value,v=y||!d.options?l:{...l,...d.options},E=r(w);p(E).items.push({key:w,value:b,relativeKey:E.relativeKey,options:v})}return Promise.all([...f.values()].map(d=>h(d))).then(d=>d.flat())},c={hasItem(u,l={}){u=Ve(u);const{relativeKey:h,driver:f}=r(u);return Ie(f.hasItem,h,l)},getItem(u,l={}){u=Ve(u);const{relativeKey:h,driver:f}=r(u);return Ie(f.getItem,h,l).then(p=>bi(p))},getItems(u,l={}){return a(u,l,h=>h.driver.getItems?Ie(h.driver.getItems,h.items.map(f=>({key:f.relativeKey,options:f.options})),l).then(f=>f.map(p=>({key:E$(h.base,p.key),value:bi(p.value)}))):Promise.all(h.items.map(f=>Ie(h.driver.getItem,f.relativeKey,f.options).then(p=>({key:f.key,value:bi(p)})))))},getItemRaw(u,l={}){u=Ve(u);const{relativeKey:h,driver:f}=r(u);return f.getItemRaw?Ie(f.getItemRaw,h,l):Ie(f.getItem,h,l).then(p=>w$(p))},async setItem(u,l,h={}){if(l===void 0)return c.removeItem(u);u=Ve(u);const{relativeKey:f,driver:p}=r(u);p.setItem&&(await Ie(p.setItem,f,Ti(l),h),p.watch||i("update",u))},async setItems(u,l){await a(u,l,async h=>{if(h.driver.setItems)return Ie(h.driver.setItems,h.items.map(f=>({key:f.relativeKey,value:Ti(f.value),options:f.options})),l);h.driver.setItem&&await Promise.all(h.items.map(f=>Ie(h.driver.setItem,f.relativeKey,Ti(f.value),f.options)))})},async setItemRaw(u,l,h={}){if(l===void 0)return c.removeItem(u,h);u=Ve(u);const{relativeKey:f,driver:p}=r(u);if(p.setItemRaw)await Ie(p.setItemRaw,f,l,h);else if(p.setItem)await Ie(p.setItem,f,m$(l),h);else return;p.watch||i("update",u)},async removeItem(u,l={}){typeof l=="boolean"&&(l={removeMeta:l}),u=Ve(u);const{relativeKey:h,driver:f}=r(u);f.removeItem&&(await Ie(f.removeItem,h,l),(l.removeMeta||l.removeMata)&&await Ie(f.removeItem,h+"$",l),f.watch||i("remove",u))},async getMeta(u,l={}){typeof l=="boolean"&&(l={nativeOnly:l}),u=Ve(u);const{relativeKey:h,driver:f}=r(u),p=Object.create(null);if(f.getMeta&&Object.assign(p,await Ie(f.getMeta,h,l)),!l.nativeOnly){const d=await Ie(f.getItem,h+"$",l).then(y=>bi(y));d&&typeof d=="object"&&(typeof d.atime=="string"&&(d.atime=new Date(d.atime)),typeof d.mtime=="string"&&(d.mtime=new Date(d.mtime)),Object.assign(p,d))}return p},setMeta(u,l,h={}){return this.setItem(u+"$",l,h)},removeMeta(u,l={}){return this.removeItem(u+"$",l)},async getKeys(u,l={}){var w;u=Ei(u);const h=n(u,!0);let f=[];const p=[];let d=!0;for(const b of h){(w=b.driver.flags)!=null&&w.maxDepth||(d=!1);const v=await Ie(b.driver.getKeys,b.relativeBase,l);for(const E of v){const $=b.mountpoint+Ve(E);f.some(D=>$.startsWith(D))||p.push($)}f=[b.mountpoint,...f.filter(E=>!E.startsWith(b.mountpoint))]}const y=l.maxDepth!==void 0&&!d;return p.filter(b=>(!y||_$(b,l.maxDepth))&&$$(b,u))},async clear(u,l={}){u=Ei(u),await Promise.all(n(u,!1).map(async h=>{if(h.driver.clear)return Ie(h.driver.clear,h.relativeBase,l);if(h.driver.removeItem){const f=await h.driver.getKeys(h.relativeBase||"",l);return Promise.all(f.map(p=>h.driver.removeItem(p,l)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(u=>Fu(u)))},async watch(u){return await s(),e.watchListeners.push(u),async()=>{e.watchListeners=e.watchListeners.filter(l=>l!==u),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(u,l){if(u=Ei(u),u&&e.mounts[u])throw new Error(`already mounted at ${u}`);return u&&(e.mountpoints.push(u),e.mountpoints.sort((h,f)=>f.length-h.length)),e.mounts[u]=l,e.watching&&Promise.resolve(Uu(l,i,u)).then(h=>{e.unwatch[u]=h}).catch(console.error),c},async unmount(u,l=!0){var h,f;u=Ei(u),!(!u||!e.mounts[u])&&(e.watching&&u in e.unwatch&&((f=(h=e.unwatch)[u])==null||f.call(h),delete e.unwatch[u]),l&&await Fu(e.mounts[u]),e.mountpoints=e.mountpoints.filter(p=>p!==u),delete e.mounts[u])},getMount(u=""){u=Ve(u)+":";const l=r(u);return{driver:l.driver,base:l.base}},getMounts(u="",l={}){return u=Ve(u),n(u,l.parents).map(f=>({driver:f.driver,base:f.mountpoint}))},keys:(u,l={})=>c.getKeys(u,l),get:(u,l={})=>c.getItem(u,l),set:(u,l,h={})=>c.setItem(u,l,h),has:(u,l={})=>c.hasItem(u,l),del:(u,l={})=>c.removeItem(u,l),remove:(u,l={})=>c.removeItem(u,l)};return c}function Uu(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function Fu(t){typeof t.dispose=="function"&&await Ie(t.dispose)}const S$="idb-keyval";var D$=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=pg(t.dbName,t.storeName)),{name:S$,options:t,async hasItem(i){return!(typeof await Ya(r(i),n)>"u")},async getItem(i){return await Ya(r(i),n)??null},setItem(i,s){return gg(r(i),s,n)},removeItem(i){return yg(r(i),n)},getKeys(){return mg(n)},clear(){return wg(n)}}};const x$="WALLET_CONNECT_V2_INDEXED_DB",A$="keyvaluestorage";let C$=class{constructor(){this.indexedDb=P$({driver:D$({dbName:x$,storeName:A$})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,Ht(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var oo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ji={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof oo<"u"&&oo.localStorage?ji.exports=oo.localStorage:typeof window<"u"&&window.localStorage?ji.exports=window.localStorage:ji.exports=new e})();function L$(t){var e;return[t[0],mr((e=t[1])!=null?e:"")]}let R$=class{constructor(){this.localStorage=ji.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(L$)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return mr(r)}async setItem(e,r){this.localStorage.setItem(e,Ht(r))}async removeItem(e){this.localStorage.removeItem(e)}};const N$="wc_storage_version",ku=1,T$=async(t,e,r)=>{const n=N$,i=await e.getItem(n);if(i&&i>=ku){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const c=a.toLowerCase();if(c.includes("wc@")||c.includes("walletconnect")||c.includes("wc_")||c.includes("wallet_connect")){const u=await t.getItem(a);await e.setItem(a,u),o.push(a)}}await e.setItem(n,ku),r(e),j$(t,o)},j$=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let B$=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new R$;this.storage=e;try{const r=new C$;T$(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};function M$(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var U$=F$;function F$(t,e,r){var n=r&&r.stringify||M$,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a<s;a++)o[a]=n(e[a]);return o.join(" ")}if(typeof t!="string")return t;var c=e.length;if(c===0)return t;for(var u="",l=1-i,h=-1,f=t&&t.length||0,p=0;p<f;){if(t.charCodeAt(p)===37&&p+1<f){switch(h=h>-1?h:0,t.charCodeAt(p+1)){case 100:case 102:if(l>=c||e[l]==null)break;h<p&&(u+=t.slice(h,p)),u+=Number(e[l]),h=p+2,p++;break;case 105:if(l>=c||e[l]==null)break;h<p&&(u+=t.slice(h,p)),u+=Math.floor(Number(e[l])),h=p+2,p++;break;case 79:case 111:case 106:if(l>=c||e[l]===void 0)break;h<p&&(u+=t.slice(h,p));var d=typeof e[l];if(d==="string"){u+="'"+e[l]+"'",h=p+2,p++;break}if(d==="function"){u+=e[l].name||"<anonymous>",h=p+2,p++;break}u+=n(e[l]),h=p+2,p++;break;case 115:if(l>=c)break;h<p&&(u+=t.slice(h,p)),u+=String(e[l]),h=p+2,p++;break;case 37:h<p&&(u+=t.slice(h,p)),u+="%",h=p+2,p++,l--;break}++l}++p}return h===-1?t:(h<f&&(u+=t.slice(h)),u)}const qu=U$;var Gr=Ct;const Zn=J$().console||{},k$={mapHttpRequest:_i,mapHttpResponse:_i,wrapRequestSerializer:ao,wrapResponseSerializer:ao,wrapErrorSerializer:ao,req:_i,res:_i,err:V$};function q$(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function Ct(t){t=t||{},t.browser=t.browser||{};const e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");const r=t.browser.write||Zn;t.browser.write&&(t.browser.asObject=!0);const n=t.serializers||{},i=q$(t.browser.serialize,n);let s=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",c=Object.create(r);c.log||(c.log=Qn),Object.defineProperty(c,"levelVal",{get:l}),Object.defineProperty(c,"level",{get:h,set:f});const u={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:W$(t)};c.levels=Ct.levels,c.level=a,c.setMaxListeners=c.getMaxListeners=c.emit=c.addListener=c.on=c.prependListener=c.once=c.prependOnceListener=c.removeListener=c.removeAllListeners=c.listeners=c.listenerCount=c.eventNames=c.write=c.flush=Qn,c.serializers=n,c._serialize=i,c._stdErrSerialize=s,c.child=p,e&&(c._logEvent=Ho());function l(){return this.level==="silent"?1/0:this.levels.values[this.level]}function h(){return this._level}function f(d){if(d!=="silent"&&!this.levels.values[d])throw Error("unknown level "+d);this._level=d,Rr(u,c,"error","log"),Rr(u,c,"fatal","error"),Rr(u,c,"warn","error"),Rr(u,c,"info","log"),Rr(u,c,"debug","log"),Rr(u,c,"trace","log")}function p(d,y){if(!d)throw new Error("missing bindings for child Pino");y=y||{},i&&d.serializers&&(y.serializers=d.serializers);const w=y.serializers;if(i&&w){var b=Object.assign({},n,w),v=t.browser.serialize===!0?Object.keys(b):i;delete d.serializers,vs([d],v,b,this._stdErrSerialize)}function E($){this._childLevel=($._childLevel|0)+1,this.error=Nr($,d,"error"),this.fatal=Nr($,d,"fatal"),this.warn=Nr($,d,"warn"),this.info=Nr($,d,"info"),this.debug=Nr($,d,"debug"),this.trace=Nr($,d,"trace"),b&&(this.serializers=b,this._serialize=v),e&&(this._logEvent=Ho([].concat($._logEvent.bindings,d)))}return E.prototype=this,new E(this)}return c}Ct.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};Ct.stdSerializers=k$;Ct.stdTimeFunctions=Object.assign({},{nullTime:Ed,epochTime:_d,unixTime:G$,isoTime:Y$});function Rr(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Qn:i[r]?i[r]:Zn[r]||Zn[n]||Qn,z$(t,e,r)}function z$(t,e,r){!t.transmit&&e[r]===Qn||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Zn?Zn:this;for(var c=0;c<o.length;c++)o[c]=arguments[c];if(t.serialize&&!t.asObject&&vs(o,this._serialize,this.serializers,this._stdErrSerialize),t.asObject?n.call(a,H$(this,r,o,s)):n.apply(a,o),t.transmit){const u=t.transmit.level||e.level,l=Ct.levels.values[u],h=Ct.levels.values[r];if(h<l)return;K$(this,{ts:s,methodLevel:r,methodValue:h,transmitLevel:u,transmitValue:Ct.levels.values[t.transmit.level||e.level],send:t.transmit.send,val:e.levelVal},o)}}}(e[r]))}function H$(t,e,r,n){t._serialize&&vs(r,t._serialize,t.serializers,t._stdErrSerialize);const i=r.slice();let s=i[0];const o={};n&&(o.time=n),o.level=Ct.levels.values[e];let a=(t._childLevel|0)+1;if(a<1&&(a=1),s!==null&&typeof s=="object"){for(;a--&&typeof i[0]=="object";)Object.assign(o,i.shift());s=i.length?qu(i.shift(),i):void 0}else typeof s=="string"&&(s=qu(i.shift(),i));return s!==void 0&&(o.msg=s),o}function vs(t,e,r,n){for(const i in t)if(n&&t[i]instanceof Error)t[i]=Ct.stdSerializers.err(t[i]);else if(typeof t[i]=="object"&&!Array.isArray(t[i]))for(const s in t[i])e&&e.indexOf(s)>-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function Nr(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;i<n.length;i++)n[i]=arguments[i-1];return t[r].apply(this,n)}}function K$(t,e,r){const n=e.send,i=e.ts,s=e.methodLevel,o=e.methodValue,a=e.val,c=t._logEvent.bindings;vs(r,t._serialize||Object.keys(t.serializers),t.serializers,t._stdErrSerialize===void 0?!0:t._stdErrSerialize),t._logEvent.ts=i,t._logEvent.messages=r.filter(function(u){return c.indexOf(u)===-1}),t._logEvent.level.label=s,t._logEvent.level.value=o,n(s,t._logEvent,a),t._logEvent=Ho(c)}function Ho(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function V$(t){const e={type:t.constructor.name,msg:t.message,stack:t.stack};for(const r in t)e[r]===void 0&&(e[r]=t[r]);return e}function W$(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?Ed:_d}function _i(){return{}}function ao(t){return t}function Qn(){}function Ed(){return!1}function _d(){return Date.now()}function G$(){return Math.round(Date.now()/1e3)}function Y$(){return new Date(Date.now()).toISOString()}function J$(){function t(e){return typeof e<"u"&&e}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return t(self)||t(window)||t(this)||{}}}const ui=ei(Gr),Z$={level:"info"},li="custom_context",Ca=1e3*1024;let Q$=class{constructor(e){this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},zu=class{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const r=new Q$(e);if(r.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}},$d=class{constructor(e,r=Ca){this.level=e??"error",this.levelValue=Gr.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new zu(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===Gr.levels.values.error?console.error(e):r===Gr.levels.values.warn?console.warn(e):r===Gr.levels.values.debug?console.debug(e):r===Gr.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(Ht({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new zu(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(Ht({extraMetadata:e})),new Blob(r,{type:"application/json"})}},X$=class{constructor(e,r=Ca){this.baseChunkLogger=new $d(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},eO=class{constructor(e,r=Ca){this.baseChunkLogger=new $d(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var tO=Object.defineProperty,rO=Object.defineProperties,nO=Object.getOwnPropertyDescriptors,Hu=Object.getOwnPropertySymbols,iO=Object.prototype.hasOwnProperty,sO=Object.prototype.propertyIsEnumerable,Ku=(t,e,r)=>e in t?tO(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Qi=(t,e)=>{for(var r in e||(e={}))iO.call(e,r)&&Ku(t,r,e[r]);if(Hu)for(var r of Hu(e))sO.call(e,r)&&Ku(t,r,e[r]);return t},Xi=(t,e)=>rO(t,nO(e));function bs(t){return Xi(Qi({},t),{level:(t==null?void 0:t.level)||Z$.level})}function oO(t,e=li){return t[e]||""}function aO(t,e,r=li){return t[r]=e,t}function Je(t,e=li){let r="";return typeof t.bindings>"u"?r=oO(t,e):r=t.bindings().context||"",r}function cO(t,e,r=li){const n=Je(t,r);return n.trim()?`${n}/${e}`:e}function ze(t,e,r=li){const n=cO(t,e,r),i=t.child({context:n});return aO(i,n,r)}function uO(t){var e,r;const n=new X$((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:ui(Xi(Qi({},t.opts),{level:"trace",browser:Xi(Qi({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function lO(t){var e;const r=new eO((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:ui(Xi(Qi({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function hO(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?uO(t):lO(t)}var Od={exports:{}},nn=typeof Reflect=="object"?Reflect:null,Vu=nn&&typeof nn.apply=="function"?nn.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Bi;nn&&typeof nn.ownKeys=="function"?Bi=nn.ownKeys:Object.getOwnPropertySymbols?Bi=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Bi=function(e){return Object.getOwnPropertyNames(e)};function fO(t){console&&console.warn&&console.warn(t)}var Id=Number.isNaN||function(e){return e!==e};function se(){se.init.call(this)}Od.exports=se;Od.exports.once=yO;se.EventEmitter=se;se.prototype._events=void 0;se.prototype._eventsCount=0;se.prototype._maxListeners=void 0;var Wu=10;function Es(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(se,"defaultMaxListeners",{enumerable:!0,get:function(){return Wu},set:function(t){if(typeof t!="number"||t<0||Id(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Wu=t}});se.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};se.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Id(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function Pd(t){return t._maxListeners===void 0?se.defaultMaxListeners:t._maxListeners}se.prototype.getMaxListeners=function(){return Pd(this)};se.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[e];if(c===void 0)return!1;if(typeof c=="function")Vu(c,this,r);else for(var u=c.length,l=Cd(c,u),n=0;n<u;++n)Vu(l[n],this,r);return!0};function Sd(t,e,r,n){var i,s,o;if(Es(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=Pd(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,fO(a)}return t}se.prototype.addListener=function(e,r){return Sd(this,e,r,!1)};se.prototype.on=se.prototype.addListener;se.prototype.prependListener=function(e,r){return Sd(this,e,r,!0)};function dO(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Dd(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=dO.bind(n);return i.listener=r,n.wrapFn=i,i}se.prototype.once=function(e,r){return Es(r),this.on(e,Dd(this,e,r)),this};se.prototype.prependOnceListener=function(e,r){return Es(r),this.prependListener(e,Dd(this,e,r)),this};se.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Es(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():pO(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};se.prototype.off=se.prototype.removeListener;se.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function xd(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?gO(i):Cd(i,i.length)}se.prototype.listeners=function(e){return xd(this,e,!0)};se.prototype.rawListeners=function(e){return xd(this,e,!1)};se.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Ad.call(t,e)};se.prototype.listenerCount=Ad;function Ad(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}se.prototype.eventNames=function(){return this._eventsCount>0?Bi(this._events):[]};function Cd(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function pO(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function gO(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function yO(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}Ld(t,e,s,{once:!0}),e!=="error"&&mO(t,i,{once:!0})})}function mO(t,e,r){typeof t.on=="function"&&Ld(t,"error",e,r)}function Ld(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var wO=Object.defineProperty,vO=(t,e,r)=>e in t?wO(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Gu=(t,e,r)=>vO(t,typeof e!="symbol"?e+"":e,r);let bO=class extends $r{constructor(e){super(),this.opts=e,Gu(this,"protocol","wc"),Gu(this,"version",2)}};var EO=Object.defineProperty,_O=(t,e,r)=>e in t?EO(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$O=(t,e,r)=>_O(t,e+"",r);let OO=class extends $r{constructor(e,r){super(),this.core=e,this.logger=r,$O(this,"records",new Map)}},IO=class{constructor(e,r){this.logger=e,this.core=r}};class PO extends $r{constructor(e,r){super(),this.relayer=e,this.logger=r}}let SO=class extends $r{constructor(e){super()}},DO=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},xO=class extends $r{constructor(e,r){super(),this.relayer=e,this.logger=r}},AO=class extends $r{constructor(e,r){super(),this.core=e,this.logger=r}},CO=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},LO=class{constructor(e,r){this.projectId=e,this.logger=r}},RO=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}};var NO=Object.defineProperty,TO=(t,e,r)=>e in t?NO(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Yu=(t,e,r)=>TO(t,typeof e!="symbol"?e+"":e,r);let jO=class{constructor(e){this.opts=e,Yu(this,"protocol","wc"),Yu(this,"version",2)}},BO=class{constructor(e){this.client=e}};var La={exports:{}},sn=typeof Reflect=="object"?Reflect:null,Ju=sn&&typeof sn.apply=="function"?sn.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Mi;sn&&typeof sn.ownKeys=="function"?Mi=sn.ownKeys:Object.getOwnPropertySymbols?Mi=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Mi=function(e){return Object.getOwnPropertyNames(e)};function MO(t){console&&console.warn&&console.warn(t)}var Rd=Number.isNaN||function(e){return e!==e};function oe(){oe.init.call(this)}La.exports=oe;La.exports.once=qO;oe.EventEmitter=oe;oe.prototype._events=void 0;oe.prototype._eventsCount=0;oe.prototype._maxListeners=void 0;var Zu=10;function _s(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(oe,"defaultMaxListeners",{enumerable:!0,get:function(){return Zu},set:function(t){if(typeof t!="number"||t<0||Rd(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Zu=t}});oe.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};oe.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Rd(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function Nd(t){return t._maxListeners===void 0?oe.defaultMaxListeners:t._maxListeners}oe.prototype.getMaxListeners=function(){return Nd(this)};oe.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[e];if(c===void 0)return!1;if(typeof c=="function")Ju(c,this,r);else for(var u=c.length,l=Ud(c,u),n=0;n<u;++n)Ju(l[n],this,r);return!0};function Td(t,e,r,n){var i,s,o;if(_s(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=Nd(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,MO(a)}return t}oe.prototype.addListener=function(e,r){return Td(this,e,r,!1)};oe.prototype.on=oe.prototype.addListener;oe.prototype.prependListener=function(e,r){return Td(this,e,r,!0)};function UO(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function jd(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=UO.bind(n);return i.listener=r,n.wrapFn=i,i}oe.prototype.once=function(e,r){return _s(r),this.on(e,jd(this,e,r)),this};oe.prototype.prependOnceListener=function(e,r){return _s(r),this.prependListener(e,jd(this,e,r)),this};oe.prototype.removeListener=function(e,r){var n,i,s,o,a;if(_s(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():FO(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};oe.prototype.off=oe.prototype.removeListener;oe.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function Bd(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?kO(i):Ud(i,i.length)}oe.prototype.listeners=function(e){return Bd(this,e,!0)};oe.prototype.rawListeners=function(e){return Bd(this,e,!1)};oe.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Md.call(t,e)};oe.prototype.listenerCount=Md;function Md(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}oe.prototype.eventNames=function(){return this._eventsCount>0?Mi(this._events):[]};function Ud(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function FO(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function kO(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function qO(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}Fd(t,e,s,{once:!0}),e!=="error"&&zO(t,i,{once:!0})})}function zO(t,e,r){typeof t.on=="function"&&Fd(t,"error",e,r)}function Fd(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var HO=La.exports;const KO="PARSE_ERROR",VO="INVALID_REQUEST",WO="METHOD_NOT_FOUND",GO="INVALID_PARAMS",kd="INTERNAL_ERROR",Ra="SERVER_ERROR",YO=[-32700,-32600,-32601,-32602,-32603],kn={[KO]:{code:-32700,message:"Parse error"},[VO]:{code:-32600,message:"Invalid Request"},[WO]:{code:-32601,message:"Method not found"},[GO]:{code:-32602,message:"Invalid params"},[kd]:{code:-32603,message:"Internal error"},[Ra]:{code:-32e3,message:"Server error"}},qd=Ra;function JO(t){return YO.includes(t)}function Qu(t){return Object.keys(kn).includes(t)?kn[t]:kn[qd]}function ZO(t){const e=Object.values(kn).find(r=>r.code===t);return e||kn[qd]}function zd(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var Hd={};/*! *****************************************************************************
|
|
26
|
-
Copyright (c) Microsoft Corporation.
|
|
27
|
-
|
|
28
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
29
|
-
purpose with or without fee is hereby granted.
|
|
30
|
-
|
|
31
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
32
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
33
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
34
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
35
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
36
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
37
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
38
|
-
***************************************************************************** */var Ko=function(t,e){return Ko=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Ko(t,e)};function QO(t,e){Ko(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Vo=function(){return Vo=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Vo.apply(this,arguments)};function XO(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function eI(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function tI(t,e){return function(r,n){e(r,n,t)}}function rI(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function nI(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(h){o(h)}}function c(l){try{u(n.throw(l))}catch(h){o(h)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})}function iI(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(l){return c([u,l])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){r.label=u[1];break}if(u[0]===6&&r.label<s[1]){r.label=s[1],s=u;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(u);break}s[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(l){u=[6,l],i=0}finally{n=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function sI(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function oI(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Wo(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Kd(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function aI(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Kd(arguments[e]));return t}function cI(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function Xn(t){return this instanceof Xn?(this.v=t,this):new Xn(t)}function uI(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(f){n[f]&&(i[f]=function(p){return new Promise(function(d,y){s.push([f,p,d,y])>1||a(f,p)})})}function a(f,p){try{c(n[f](p))}catch(d){h(s[0][3],d)}}function c(f){f.value instanceof Xn?Promise.resolve(f.value.v).then(u,l):h(s[0][2],f)}function u(f){a("next",f)}function l(f){a("throw",f)}function h(f,p){f(p),s.shift(),s.length&&a(s[0][0],s[0][1])}}function lI(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Xn(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function hI(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Wo=="function"?Wo(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,c){o=t[s](o),i(a,c,o.done,o.value)})}}function i(s,o,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},o)}}function fI(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function dI(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function pI(t){return t&&t.__esModule?t:{default:t}}function gI(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function yI(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const mI=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Vo},__asyncDelegator:lI,__asyncGenerator:uI,__asyncValues:hI,__await:Xn,__awaiter:nI,__classPrivateFieldGet:gI,__classPrivateFieldSet:yI,__createBinding:sI,__decorate:eI,__exportStar:oI,__extends:QO,__generator:iI,__importDefault:pI,__importStar:dI,__makeTemplateObject:fI,__metadata:rI,__param:tI,__read:Kd,__rest:XO,__spread:aI,__spreadArrays:cI,__values:Wo},Symbol.toStringTag,{value:"Module"})),wI=hh(mI);var Bt={},Xu;function vI(){if(Xu)return Bt;Xu=1,Object.defineProperty(Bt,"__esModule",{value:!0}),Bt.isBrowserCryptoAvailable=Bt.getSubtleCrypto=Bt.getBrowerCrypto=void 0;function t(){return(Dt===null||Dt===void 0?void 0:Dt.crypto)||(Dt===null||Dt===void 0?void 0:Dt.msCrypto)||{}}Bt.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Bt.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Bt.isBrowserCryptoAvailable=r,Bt}var Mt={},el;function bI(){if(el)return Mt;el=1,Object.defineProperty(Mt,"__esModule",{value:!0}),Mt.isBrowser=Mt.isNode=Mt.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Mt.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Mt.isNode=e;function r(){return!t()&&!e()}return Mt.isBrowser=r,Mt}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=wI;e.__exportStar(vI(),t),e.__exportStar(bI(),t)})(Hd);function Pt(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function dr(t=6){return BigInt(Pt(t))}function Qt(t,e,r){return{id:r||Pt(),jsonrpc:"2.0",method:t,params:e}}function $s(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Os(t,e,r){return{id:t,jsonrpc:"2.0",error:EI(e)}}function EI(t,e){return typeof t>"u"?Qu(kd):(typeof t=="string"&&(t=Object.assign(Object.assign({},Qu(Ra)),{message:t})),JO(t.code)&&(t=ZO(t.code)),t)}class _I{}class $I extends _I{constructor(){super()}}class OI extends $I{constructor(e){super()}}const II="^https?:",PI="^wss?:";function SI(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function Vd(t,e){const r=SI(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function tl(t){return Vd(t,II)}function rl(t){return Vd(t,PI)}function DI(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function Wd(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function Na(t){return Wd(t)&&"method"in t}function Is(t){return Wd(t)&&(St(t)||ut(t))}function St(t){return"result"in t}function ut(t){return"error"in t}let ht=class extends OI{constructor(e){super(e),this.events=new HO.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(Qt(e.method,e.params||[],e.id||dr().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{ut(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Is(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 co,nl;function xI(){return nl||(nl=1,co=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}),co}var Ta={exports:{}},on=typeof Reflect=="object"?Reflect:null,il=on&&typeof on.apply=="function"?on.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Ui;on&&typeof on.ownKeys=="function"?Ui=on.ownKeys:Object.getOwnPropertySymbols?Ui=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Ui=function(e){return Object.getOwnPropertyNames(e)};function AI(t){console&&console.warn&&console.warn(t)}var Gd=Number.isNaN||function(e){return e!==e};function ae(){ae.init.call(this)}Ta.exports=ae;Ta.exports.once=NI;ae.EventEmitter=ae;ae.prototype._events=void 0;ae.prototype._eventsCount=0;ae.prototype._maxListeners=void 0;var sl=10;function Ps(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(ae,"defaultMaxListeners",{enumerable:!0,get:function(){return sl},set:function(t){if(typeof t!="number"||t<0||Gd(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");sl=t}});ae.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};ae.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Gd(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function Yd(t){return t._maxListeners===void 0?ae.defaultMaxListeners:t._maxListeners}ae.prototype.getMaxListeners=function(){return Yd(this)};ae.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[e];if(c===void 0)return!1;if(typeof c=="function")il(c,this,r);else for(var u=c.length,l=ep(c,u),n=0;n<u;++n)il(l[n],this,r);return!0};function Jd(t,e,r,n){var i,s,o;if(Ps(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=Yd(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,AI(a)}return t}ae.prototype.addListener=function(e,r){return Jd(this,e,r,!1)};ae.prototype.on=ae.prototype.addListener;ae.prototype.prependListener=function(e,r){return Jd(this,e,r,!0)};function CI(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Zd(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=CI.bind(n);return i.listener=r,n.wrapFn=i,i}ae.prototype.once=function(e,r){return Ps(r),this.on(e,Zd(this,e,r)),this};ae.prototype.prependOnceListener=function(e,r){return Ps(r),this.prependListener(e,Zd(this,e,r)),this};ae.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Ps(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():LI(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};ae.prototype.off=ae.prototype.removeListener;ae.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function Qd(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?RI(i):ep(i,i.length)}ae.prototype.listeners=function(e){return Qd(this,e,!0)};ae.prototype.rawListeners=function(e){return Qd(this,e,!1)};ae.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Xd.call(t,e)};ae.prototype.listenerCount=Xd;function Xd(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}ae.prototype.eventNames=function(){return this._eventsCount>0?Ui(this._events):[]};function ep(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function LI(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function RI(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function NI(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}tp(t,e,s,{once:!0}),e!=="error"&&TI(t,i,{once:!0})})}function TI(t,e,r){typeof t.on=="function"&&tp(t,"error",e,r)}function tp(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var jI=Ta.exports;const BI=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:xI(),MI=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",ol=t=>t.split("?")[0],al=10,UI=BI();let FI=class{constructor(e){if(this.url=e,this.events=new jI.EventEmitter,this.registering=!1,!rl(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Ht(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!rl(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=Hd.isReactNative()?void 0:{rejectUnauthorized:!DI(e)},s=new UI(e,[],i);MI()?s.onerror=o=>{const a=o;n(this.emitError(a.error))}:s.on("error",o=>{n(this.emitError(o))}),s.onopen=()=>{this.onOpen(s),r(s)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?mr(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Os(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return zd(e,ol(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>al&&this.events.setMaxListeners(al)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${ol(this.url)}`));return this.events.emit("register_error",r),r}};var kI={};const rp="wc",np=2,es="core",Lt=`${rp}@2:${es}:`,qI={name:es,logger:"error"},zI={database:":memory:"},HI="crypto",cl="client_ed25519_seed",KI=N.ONE_DAY,VI="keychain",WI="0.3",GI="messages",YI="0.3",ul=N.SIX_HOURS,JI="publisher",ip="irn",ZI="error",sp="wss://relay.walletconnect.org",QI="relayer",Se={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},XI="_subscription",ot={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},e2=.1,Go="2.21.1",ye={link_mode:"link_mode",relay:"relay"},Fi={inbound:"inbound",outbound:"outbound"},t2="0.3",r2="WALLETCONNECT_CLIENT_ID",ll="WALLETCONNECT_LINK_MODE_APPS",Xe={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},n2="subscription",i2="0.3",s2="pairing",o2="0.3",Ln={wc_pairingDelete:{req:{ttl:N.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:N.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:N.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:N.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:N.ONE_DAY,prompt:!1,tag:0},res:{ttl:N.ONE_DAY,prompt:!1,tag:0}}},lr={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},pt={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},a2="history",c2="0.3",u2="expirer",ct={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},l2="0.3",h2="verify-api",f2="https://verify.walletconnect.com",op="https://verify.walletconnect.org",qn=op,d2=`${qn}/v3`,p2=[f2,op],g2="echo",y2="https://echo.walletconnect.com",It={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},Ut={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},gt={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},ir={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},sr={authenticated_session_approve_started:"authenticated_session_approve_started",authenticated_session_not_expired:"authenticated_session_not_expired",chains_caip2_compliant:"chains_caip2_compliant",chains_evm_compliant:"chains_evm_compliant",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve",authenticated_session_approve_publish_success:"authenticated_session_approve_publish_success"},Rn={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",missing_session_authenticate_request:"missing_session_authenticate_request",session_authenticate_request_expired:"session_authenticate_request_expired",chains_caip2_compliant_failure:"chains_caip2_compliant_failure",chains_evm_compliant_failure:"chains_evm_compliant_failure",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},m2=.1,w2="event-client",v2=86400,b2="https://pulse.walletconnect.org/batch";function E2(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var s=t.charAt(i),o=s.charCodeAt(0);if(r[o]!==255)throw new TypeError(s+" is ambiguous");r[o]=i}var a=t.length,c=t.charAt(0),u=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function h(d){if(d instanceof Uint8Array||(ArrayBuffer.isView(d)?d=new Uint8Array(d.buffer,d.byteOffset,d.byteLength):Array.isArray(d)&&(d=Uint8Array.from(d))),!(d instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(d.length===0)return"";for(var y=0,w=0,b=0,v=d.length;b!==v&&d[b]===0;)b++,y++;for(var E=(v-b)*l+1>>>0,$=new Uint8Array(E);b!==v;){for(var D=d[b],x=0,S=E-1;(D!==0||x<w)&&S!==-1;S--,x++)D+=256*$[S]>>>0,$[S]=D%a>>>0,D=D/a>>>0;if(D!==0)throw new Error("Non-zero carry");w=x,b++}for(var C=E-w;C!==E&&$[C]===0;)C++;for(var I=c.repeat(y);C<E;++C)I+=t.charAt($[C]);return I}function f(d){if(typeof d!="string")throw new TypeError("Expected String");if(d.length===0)return new Uint8Array;var y=0;if(d[y]!==" "){for(var w=0,b=0;d[y]===c;)w++,y++;for(var v=(d.length-y)*u+1>>>0,E=new Uint8Array(v);d[y];){var $=r[d.charCodeAt(y)];if($===255)return;for(var D=0,x=v-1;($!==0||D<b)&&x!==-1;x--,D++)$+=a*E[x]>>>0,E[x]=$%256>>>0,$=$/256>>>0;if($!==0)throw new Error("Non-zero carry");b=D,y++}if(d[y]!==" "){for(var S=v-b;S!==v&&E[S]===0;)S++;for(var C=new Uint8Array(w+(v-S)),I=w;S!==v;)C[I++]=E[S++];return C}}}function p(d){var y=f(d);if(y)return y;throw new Error(`Non-${e} character`)}return{encode:h,decodeUnsafe:f,decode:p}}var _2=E2,$2=_2;const ap=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},O2=t=>new TextEncoder().encode(t),I2=t=>new TextDecoder().decode(t);class P2{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class S2{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return cp(this,e)}}class D2{constructor(e){this.decoders=e}or(e){return cp(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const cp=(t,e)=>new D2({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class x2{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new P2(e,r,n),this.decoder=new S2(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Ss=({name:t,prefix:e,encode:r,decode:n})=>new x2(t,e,r,n),hi=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=$2(r,e);return Ss({prefix:t,name:e,encode:n,decode:s=>ap(i(s))})},A2=(t,e,r,n)=>{const i={};for(let l=0;l<e.length;++l)i[e[l]]=l;let s=t.length;for(;t[s-1]==="=";)--s;const o=new Uint8Array(s*r/8|0);let a=0,c=0,u=0;for(let l=0;l<s;++l){const h=i[t[l]];if(h===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<r|h,a+=r,a>=8&&(a-=8,o[u++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},C2=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<<r)-1;let s="",o=0,a=0;for(let c=0;c<t.length;++c)for(a=a<<8|t[c],o+=8;o>r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<<r-o]),n)for(;s.length*r&7;)s+="=";return s},je=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>Ss({prefix:e,name:t,encode(i){return C2(i,n,r)},decode(i){return A2(i,n,r,t)}}),L2=Ss({prefix:"\0",name:"identity",encode:t=>I2(t),decode:t=>O2(t)});var R2=Object.freeze({__proto__:null,identity:L2});const N2=je({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var T2=Object.freeze({__proto__:null,base2:N2});const j2=je({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var B2=Object.freeze({__proto__:null,base8:j2});const M2=hi({prefix:"9",name:"base10",alphabet:"0123456789"});var U2=Object.freeze({__proto__:null,base10:M2});const F2=je({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),k2=je({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var q2=Object.freeze({__proto__:null,base16:F2,base16upper:k2});const z2=je({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),H2=je({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),K2=je({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),V2=je({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),W2=je({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),G2=je({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Y2=je({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),J2=je({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Z2=je({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Q2=Object.freeze({__proto__:null,base32:z2,base32upper:H2,base32pad:K2,base32padupper:V2,base32hex:W2,base32hexupper:G2,base32hexpad:Y2,base32hexpadupper:J2,base32z:Z2});const X2=hi({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),eP=hi({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var tP=Object.freeze({__proto__:null,base36:X2,base36upper:eP});const rP=hi({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),nP=hi({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var iP=Object.freeze({__proto__:null,base58btc:rP,base58flickr:nP});const sP=je({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),oP=je({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),aP=je({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),cP=je({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var uP=Object.freeze({__proto__:null,base64:sP,base64pad:oP,base64url:aP,base64urlpad:cP});const up=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),lP=up.reduce((t,e,r)=>(t[r]=e,t),[]),hP=up.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function fP(t){return t.reduce((e,r)=>(e+=lP[r],e),"")}function dP(t){const e=[];for(const r of t){const n=hP[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const pP=Ss({prefix:"🚀",name:"base256emoji",encode:fP,decode:dP});var gP=Object.freeze({__proto__:null,base256emoji:pP}),yP=lp,hl=128,mP=127,wP=~mP,vP=Math.pow(2,31);function lp(t,e,r){e=e||[],r=r||0;for(var n=r;t>=vP;)e[r++]=t&255|hl,t/=128;for(;t&wP;)e[r++]=t&255|hl,t>>>=7;return e[r]=t|0,lp.bytes=r-n+1,e}var bP=Yo,EP=128,fl=127;function Yo(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw Yo.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&fl)<<i:(o&fl)*Math.pow(2,i),i+=7}while(o>=EP);return Yo.bytes=s-n,r}var _P=Math.pow(2,7),$P=Math.pow(2,14),OP=Math.pow(2,21),IP=Math.pow(2,28),PP=Math.pow(2,35),SP=Math.pow(2,42),DP=Math.pow(2,49),xP=Math.pow(2,56),AP=Math.pow(2,63),CP=function(t){return t<_P?1:t<$P?2:t<OP?3:t<IP?4:t<PP?5:t<SP?6:t<DP?7:t<xP?8:t<AP?9:10},LP={encode:yP,decode:bP,encodingLength:CP},hp=LP;const dl=(t,e,r=0)=>(hp.encode(t,e,r),e),pl=t=>hp.encodingLength(t),Jo=(t,e)=>{const r=e.byteLength,n=pl(t),i=n+pl(r),s=new Uint8Array(i+r);return dl(t,s,0),dl(r,s,n),s.set(e,i),new RP(t,r,e,s)};class RP{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const fp=({name:t,code:e,encode:r})=>new NP(t,e,r);class NP{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?Jo(this.code,r):r.then(n=>Jo(this.code,n))}else throw Error("Unknown type, must be binary type")}}const dp=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),TP=fp({name:"sha2-256",code:18,encode:dp("SHA-256")}),jP=fp({name:"sha2-512",code:19,encode:dp("SHA-512")});var BP=Object.freeze({__proto__:null,sha256:TP,sha512:jP});const pp=0,MP="identity",gp=ap,UP=t=>Jo(pp,gp(t)),FP={code:pp,name:MP,encode:gp,digest:UP};var kP=Object.freeze({__proto__:null,identity:FP});new TextEncoder,new TextDecoder;const gl={...R2,...T2,...B2,...U2,...q2,...Q2,...tP,...iP,...uP,...gP};({...BP,...kP});function qP(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function yp(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const yl=yp("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),uo=yp("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=qP(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),zP={utf8:yl,"utf-8":yl,hex:gl.base16,latin1:uo,ascii:uo,binary:uo,...gl};function HP(t,e="utf8"){const r=zP[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):r.decoder.decode(`${r.prefix}${t}`)}var KP=Object.defineProperty,VP=(t,e,r)=>e in t?KP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$t=(t,e,r)=>VP(t,typeof e!="symbol"?e+"":e,r);class WP{constructor(e,r){this.core=e,this.logger=r,$t(this,"keychain",new Map),$t(this,"name",VI),$t(this,"version",WI),$t(this,"initialized",!1),$t(this,"storagePrefix",Lt),$t(this,"init",async()=>{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}}),$t(this,"has",n=>(this.isInitialized(),this.keychain.has(n))),$t(this,"set",async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()}),$t(this,"get",n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=T("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i}),$t(this,"del",async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()}),this.core=e,this.logger=ze(r,this.name)}get context(){return Je(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,Co(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Lo(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=T("NOT_INITIALIZED",this.name);throw new Error(e)}}}var GP=Object.defineProperty,YP=(t,e,r)=>e in t?GP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Le=(t,e,r)=>YP(t,typeof e!="symbol"?e+"":e,r);class JP{constructor(e,r,n){this.core=e,this.logger=r,Le(this,"name",HI),Le(this,"keychain"),Le(this,"randomSessionIdentifier",qo()),Le(this,"initialized",!1),Le(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),Le(this,"hasKeys",i=>(this.isInitialized(),this.keychain.has(i))),Le(this,"getClientId",async()=>{this.isInitialized();const i=await this.getClientSeed(),s=Mc(i);return ff(s.publicKey)}),Le(this,"generateKeyPair",()=>{this.isInitialized();const i=H1();return this.setPrivateKey(i.publicKey,i.privateKey)}),Le(this,"signJWT",async i=>{this.isInitialized();const s=await this.getClientSeed(),o=Mc(s),a=this.randomSessionIdentifier;return await ab(a,i,KI,o)}),Le(this,"generateSharedKey",(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),c=K1(a,s);return this.setSymKey(c,o)}),Le(this,"setSymKey",async(i,s)=>{this.isInitialized();const o=s||Li(i);return await this.keychain.set(o,i),o}),Le(this,"deleteKeyPair",async i=>{this.isInitialized(),await this.keychain.del(i)}),Le(this,"deleteSymKey",async i=>{this.isInitialized(),await this.keychain.del(i)}),Le(this,"encode",async(i,s,o)=>{this.isInitialized();const a=td(o),c=Ht(s);if(_u(a))return G1(c,o==null?void 0:o.encoding);if(Eu(a)){const f=a.senderPublicKey,p=a.receiverPublicKey;i=await this.generateSharedKey(f,p)}const u=this.getSymKey(i),{type:l,senderPublicKey:h}=a;return V1({type:l,symKey:u,message:c,senderPublicKey:h,encoding:o==null?void 0:o.encoding})}),Le(this,"decode",async(i,s,o)=>{this.isInitialized();const a=J1(s,o);if(_u(a)){const c=Y1(s,o==null?void 0:o.encoding);return mr(c)}if(Eu(a)){const c=a.receiverPublicKey,u=a.senderPublicKey;i=await this.generateSharedKey(c,u)}try{const c=this.getSymKey(i),u=W1({symKey:c,encoded:s,encoding:o==null?void 0:o.encoding});return mr(u)}catch(c){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(c)}}),Le(this,"getPayloadType",(i,s=wt)=>{const o=Jn({encoded:i,encoding:s});return br(o.type)}),Le(this,"getPayloadSenderPublicKey",(i,s=wt)=>{const o=Jn({encoded:i,encoding:s});return o.senderPublicKey?Ye(o.senderPublicKey,qe):void 0}),this.core=e,this.logger=ze(r,this.name),this.keychain=n||new WP(this.core,this.logger)}get context(){return Je(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(cl)}catch{e=qo(),await this.keychain.set(cl,e)}return HP(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=T("NOT_INITIALIZED",this.name);throw new Error(e)}}}var ZP=Object.defineProperty,QP=Object.defineProperties,XP=Object.getOwnPropertyDescriptors,ml=Object.getOwnPropertySymbols,eS=Object.prototype.hasOwnProperty,tS=Object.prototype.propertyIsEnumerable,Zo=(t,e,r)=>e in t?ZP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,rS=(t,e)=>{for(var r in e||(e={}))eS.call(e,r)&&Zo(t,r,e[r]);if(ml)for(var r of ml(e))tS.call(e,r)&&Zo(t,r,e[r]);return t},nS=(t,e)=>QP(t,XP(e)),Ze=(t,e,r)=>Zo(t,typeof e!="symbol"?e+"":e,r);class iS extends IO{constructor(e,r){super(e,r),this.logger=e,this.core=r,Ze(this,"messages",new Map),Ze(this,"messagesWithoutClientAck",new Map),Ze(this,"name",GI),Ze(this,"version",YI),Ze(this,"initialized",!1),Ze(this,"storagePrefix",Lt),Ze(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n);const i=await this.getRelayerMessagesWithoutClientAck();typeof i<"u"&&(this.messagesWithoutClientAck=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}}),Ze(this,"set",async(n,i,s)=>{this.isInitialized();const o=xt(i);let a=this.messages.get(n);if(typeof a>"u"&&(a={}),typeof a[o]<"u")return o;if(a[o]=i,this.messages.set(n,a),s===Fi.inbound){const c=this.messagesWithoutClientAck.get(n)||{};this.messagesWithoutClientAck.set(n,nS(rS({},c),{[o]:i}))}return await this.persist(),o}),Ze(this,"get",n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i}),Ze(this,"getWithoutAck",n=>{this.isInitialized();const i={};for(const s of n){const o=this.messagesWithoutClientAck.get(s)||{};i[s]=Object.values(o)}return i}),Ze(this,"has",(n,i)=>{this.isInitialized();const s=this.get(n),o=xt(i);return typeof s[o]<"u"}),Ze(this,"ack",async(n,i)=>{this.isInitialized();const s=this.messagesWithoutClientAck.get(n);if(typeof s>"u")return;const o=xt(i);delete s[o],Object.keys(s).length===0?this.messagesWithoutClientAck.delete(n):this.messagesWithoutClientAck.set(n,s),await this.persist()}),Ze(this,"del",async n=>{this.isInitialized(),this.messages.delete(n),this.messagesWithoutClientAck.delete(n),await this.persist()}),this.logger=ze(e,this.name),this.core=r}get context(){return Je(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get storageKeyWithoutClientAck(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name+"_withoutClientAck"}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,Co(e))}async setRelayerMessagesWithoutClientAck(e){await this.core.storage.setItem(this.storageKeyWithoutClientAck,Co(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Lo(e):void 0}async getRelayerMessagesWithoutClientAck(){const e=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return typeof e<"u"?Lo(e):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){const{message:e}=T("NOT_INITIALIZED",this.name);throw new Error(e)}}}var sS=Object.defineProperty,oS=Object.defineProperties,aS=Object.getOwnPropertyDescriptors,wl=Object.getOwnPropertySymbols,cS=Object.prototype.hasOwnProperty,uS=Object.prototype.propertyIsEnumerable,Qo=(t,e,r)=>e in t?sS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$i=(t,e)=>{for(var r in e||(e={}))cS.call(e,r)&&Qo(t,r,e[r]);if(wl)for(var r of wl(e))uS.call(e,r)&&Qo(t,r,e[r]);return t},lo=(t,e)=>oS(t,aS(e)),yt=(t,e,r)=>Qo(t,typeof e!="symbol"?e+"":e,r);class lS extends PO{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,yt(this,"events",new _r.EventEmitter),yt(this,"name",JI),yt(this,"queue",new Map),yt(this,"publishTimeout",N.toMiliseconds(N.ONE_MINUTE)),yt(this,"initialPublishTimeout",N.toMiliseconds(N.ONE_SECOND*15)),yt(this,"needsTransportRestart",!1),yt(this,"publish",async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const a=(s==null?void 0:s.ttl)||ul,c=Ji(s),u=(s==null?void 0:s.prompt)||!1,l=(s==null?void 0:s.tag)||0,h=(s==null?void 0:s.id)||dr().toString(),f={topic:n,message:i,opts:{ttl:a,relay:c,prompt:u,tag:l,id:h,attestation:s==null?void 0:s.attestation,tvf:s==null?void 0:s.tvf}},p=`Failed to publish payload, please try again. id:${h} tag:${l}`;try{const d=new Promise(async y=>{const w=({id:v})=>{f.opts.id===v&&(this.removeRequestFromQueue(v),this.relayer.events.removeListener(Se.publish,w),y(f))};this.relayer.events.on(Se.publish,w);const b=Zt(new Promise((v,E)=>{this.rpcPublish({topic:n,message:i,ttl:a,prompt:u,tag:l,id:h,attestation:s==null?void 0:s.attestation,tvf:s==null?void 0:s.tvf}).then(v).catch($=>{this.logger.warn($,$==null?void 0:$.message),E($)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${h} tag:${l}`);try{await b,this.events.removeListener(Se.publish,w)}catch(v){this.queue.set(h,lo($i({},f),{attempt:1})),this.logger.warn(v,v==null?void 0:v.message)}});this.logger.trace({type:"method",method:"publish",params:{id:h,topic:n,message:i,opts:s}}),await Zt(d,this.publishTimeout,p)}catch(d){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(d),(o=s==null?void 0:s.internal)!=null&&o.throwOnFailedPublish)throw d}finally{this.queue.delete(h)}}),yt(this,"on",(n,i)=>{this.events.on(n,i)}),yt(this,"once",(n,i)=>{this.events.once(n,i)}),yt(this,"off",(n,i)=>{this.events.off(n,i)}),yt(this,"removeListener",(n,i)=>{this.events.removeListener(n,i)}),this.relayer=e,this.logger=ze(r,this.name),this.registerEventListeners()}get context(){return Je(this.logger)}async rpcPublish(e){var r,n,i,s;const{topic:o,message:a,ttl:c=ul,prompt:u,tag:l,id:h,attestation:f,tvf:p}=e,d={method:Bn(Ji().protocol).publish,params:$i({topic:o,message:a,ttl:c,prompt:u,tag:l,attestation:f},p),id:h};Ue((r=d.params)==null?void 0:r.prompt)&&((n=d.params)==null||delete n.prompt),Ue((i=d.params)==null?void 0:i.tag)&&((s=d.params)==null||delete s.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:d});const y=await this.relayer.request(d);return this.relayer.events.emit(Se.publish,e),this.logger.debug("Successfully Published Payload"),y}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async(e,r)=>{const n=e.attempt+1;this.queue.set(r,lo($i({},e),{attempt:n}));const{topic:i,message:s,opts:o,attestation:a}=e;this.logger.warn({},`Publisher: queue->publishing: ${e.opts.id}, tag: ${e.opts.tag}, attempt: ${n}`),await this.rpcPublish(lo($i({},e),{topic:i,message:s,ttl:o.ttl,prompt:o.prompt,tag:o.tag,id:o.id,attestation:a,tvf:o.tvf})),this.logger.warn({},`Publisher: queue->published: ${e.opts.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(Or.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(Se.connection_stalled);return}this.checkQueue()}),this.relayer.on(Se.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}var hS=Object.defineProperty,fS=(t,e,r)=>e in t?hS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Tr=(t,e,r)=>fS(t,typeof e!="symbol"?e+"":e,r);class dS{constructor(){Tr(this,"map",new Map),Tr(this,"set",(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])}),Tr(this,"get",e=>this.map.get(e)||[]),Tr(this,"exists",(e,r)=>this.get(e).includes(r)),Tr(this,"delete",(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)}),Tr(this,"clear",()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}}var pS=Object.defineProperty,gS=Object.defineProperties,yS=Object.getOwnPropertyDescriptors,vl=Object.getOwnPropertySymbols,mS=Object.prototype.hasOwnProperty,wS=Object.prototype.propertyIsEnumerable,Xo=(t,e,r)=>e in t?pS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Nn=(t,e)=>{for(var r in e||(e={}))mS.call(e,r)&&Xo(t,r,e[r]);if(vl)for(var r of vl(e))wS.call(e,r)&&Xo(t,r,e[r]);return t},ho=(t,e)=>gS(t,yS(e)),he=(t,e,r)=>Xo(t,typeof e!="symbol"?e+"":e,r);class vS extends xO{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,he(this,"subscriptions",new Map),he(this,"topicMap",new dS),he(this,"events",new _r.EventEmitter),he(this,"name",n2),he(this,"version",i2),he(this,"pending",new Map),he(this,"cached",[]),he(this,"initialized",!1),he(this,"storagePrefix",Lt),he(this,"subscribeTimeout",N.toMiliseconds(N.ONE_MINUTE)),he(this,"initialSubscribeTimeout",N.toMiliseconds(N.ONE_SECOND*15)),he(this,"clientId"),he(this,"batchSubscribeTopicsLimit",500),he(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),he(this,"subscribe",async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=Ji(i),o={topic:n,relay:s,transportType:i==null?void 0:i.transportType};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s,i);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}}),he(this,"unsubscribe",async(n,i)=>{this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)}),he(this,"isSubscribed",n=>new Promise(i=>{i(this.topicMap.topics.includes(n))})),he(this,"isKnownTopic",n=>new Promise(i=>{i(this.topicMap.topics.includes(n)||this.pending.has(n)||this.cached.some(s=>s.topic===n))})),he(this,"on",(n,i)=>{this.events.on(n,i)}),he(this,"once",(n,i)=>{this.events.once(n,i)}),he(this,"off",(n,i)=>{this.events.off(n,i)}),he(this,"removeListener",(n,i)=>{this.events.removeListener(n,i)}),he(this,"start",async()=>{await this.onConnect()}),he(this,"stop",async()=>{await this.onDisconnect()}),he(this,"restart",async()=>{await this.restore(),await this.onRestart()}),he(this,"checkPending",async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const n=[];this.pending.forEach(i=>{n.push(i)}),await this.batchSubscribe(n)}),he(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(Or.pulse,async()=>{await this.checkPending()}),this.events.on(Xe.created,async n=>{const i=Xe.created;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:n}),await this.persist()}),this.events.on(Xe.deleted,async n=>{const i=Xe.deleted;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:n}),await this.persist()})}),this.relayer=e,this.logger=ze(r,this.name),this.clientId=""}get context(){return Je(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}get hasAnyTopics(){return this.topicMap.topics.length>0||this.pending.size>0||this.cached.length>0||this.subscriptions.size>0}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}reset(){this.cached=[],this.initialized=!0}onDisable(){this.values.length>0&&(this.cached=this.values),this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=Ji(n);await this.restartToComplete({topic:e,id:r,relay:i}),await this.rpcUnsubscribe(e,r,i);const s=te("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n){var i;(!n||(n==null?void 0:n.transportType)===ye.relay)&&await this.restartToComplete({topic:e,id:e,relay:r});const s={method:Bn(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const o=(i=n==null?void 0:n.internal)==null?void 0:i.throwOnFailedPublish;try{const a=await this.getSubscriptionId(e);if((n==null?void 0:n.transportType)===ye.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(l=>this.logger.warn(l))},N.toMiliseconds(N.ONE_SECOND)),a;const c=new Promise(async l=>{const h=f=>{f.topic===e&&(this.events.removeListener(Xe.created,h),l(f.id))};this.events.on(Xe.created,h);try{const f=await Zt(new Promise((p,d)=>{this.relayer.request(s).catch(y=>{this.logger.warn(y,y==null?void 0:y.message),d(y)}).then(p)}),this.initialSubscribeTimeout,`Subscribing to ${e} failed, please try again`);this.events.removeListener(Xe.created,h),l(f)}catch{}}),u=await Zt(c,this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!u&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return u?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Se.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:Bn(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await Zt(new Promise(i=>{this.relayer.request(n).catch(s=>this.logger.warn(s)).then(i)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(Se.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:Bn(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await Zt(new Promise((s,o)=>{this.relayer.request(n).catch(a=>{this.logger.warn(a),o(a)}).then(s)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(Se.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:Bn(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,ho(Nn({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Nn({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,Nn({},r)),this.topicMap.set(r.topic,e),this.events.emit(Xe.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=T("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Xe.deleted,ho(Nn({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Xe.sync)}async onRestart(){if(this.cached.length){const e=[...this.cached],r=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let n=0;n<r;n++){const i=e.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(i)}}this.events.emit(Xe.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=T("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){e.length&&(await this.rpcBatchSubscribe(e),this.onBatchSubscribe(await Promise.all(e.map(async r=>ho(Nn({},r),{id:await this.getSubscriptionId(r.topic)})))))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(await C0(N.toMiliseconds(N.ONE_SECOND)),await this.relayer.handleBatchMessageEvents(r.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:e}=T("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(e){!this.relayer.connected&&!this.relayer.connecting&&(this.cached.push(e),await this.relayer.transportOpen())}async getClientId(){return this.clientId||(this.clientId=await this.relayer.core.crypto.getClientId()),this.clientId}async getSubscriptionId(e){return xt(e+await this.getClientId())}}var bS=Object.defineProperty,bl=Object.getOwnPropertySymbols,ES=Object.prototype.hasOwnProperty,_S=Object.prototype.propertyIsEnumerable,ea=(t,e,r)=>e in t?bS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,El=(t,e)=>{for(var r in e||(e={}))ES.call(e,r)&&ea(t,r,e[r]);if(bl)for(var r of bl(e))_S.call(e,r)&&ea(t,r,e[r]);return t},Z=(t,e,r)=>ea(t,typeof e!="symbol"?e+"":e,r);class $S extends SO{constructor(e){super(e),Z(this,"protocol","wc"),Z(this,"version",2),Z(this,"core"),Z(this,"logger"),Z(this,"events",new _r.EventEmitter),Z(this,"provider"),Z(this,"messages"),Z(this,"subscriber"),Z(this,"publisher"),Z(this,"name",QI),Z(this,"transportExplicitlyClosed",!1),Z(this,"initialized",!1),Z(this,"connectionAttemptInProgress",!1),Z(this,"relayUrl"),Z(this,"projectId"),Z(this,"packageName"),Z(this,"bundleId"),Z(this,"hasExperiencedNetworkDisruption",!1),Z(this,"pingTimeout"),Z(this,"heartBeatTimeout",N.toMiliseconds(N.THIRTY_SECONDS+N.FIVE_SECONDS)),Z(this,"reconnectTimeout"),Z(this,"connectPromise"),Z(this,"reconnectInProgress",!1),Z(this,"requestsInFlight",[]),Z(this,"connectTimeout",N.toMiliseconds(N.ONE_SECOND*15)),Z(this,"request",async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||dr().toString();await this.toEstablishConnection();try{this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - publishing...");const o=`${s}:${((i=r.params)==null?void 0:i.tag)||""}`;this.requestsInFlight.push(o);const a=await this.provider.request(r);return this.requestsInFlight=this.requestsInFlight.filter(c=>c!==o),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}}),Z(this,"resetPingTimeout",()=>{Gi()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i,s;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(s=(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null?void 0:i.terminate)==null||s.call(i)}catch(o){this.logger.warn(o,o==null?void 0:o.message)}},this.heartBeatTimeout))}),Z(this,"onPayloadHandler",r=>{this.onProviderPayload(r),this.resetPingTimeout()}),Z(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected 🛜"),this.startPingTimeout(),this.events.emit(Se.connect)}),Z(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected 🛑"),this.requestsInFlight=[],this.onProviderDisconnect()}),Z(this,"onProviderErrorHandler",r=>{this.logger.fatal(`Fatal socket error: ${r.message}`),this.events.emit(Se.error,r),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()}),Z(this,"registerProviderListeners",()=>{this.provider.on(ot.payload,this.onPayloadHandler),this.provider.on(ot.connect,this.onConnectHandler),this.provider.on(ot.disconnect,this.onDisconnectHandler),this.provider.on(ot.error,this.onProviderErrorHandler)}),this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?ze(e.logger,this.name):ui(bs({level:e.logger||ZI})),this.messages=new iS(this.logger,e.core),this.subscriber=new vS(this,this.logger),this.publisher=new lS(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||sp,this.projectId=e.projectId,g0()?this.packageName=Kc():y0()&&(this.bundleId=Kc()),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.hasAnyTopics)try{await this.transportOpen()}catch(e){this.logger.warn(e,e==null?void 0:e.message)}}get context(){return Je(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1||!1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0||this.connectPromise!==void 0||!1}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:ye.relay},Fi.outbound)}async subscribe(e,r){var n,i,s;this.isInitialized(),(!(r!=null&&r.transportType)||(r==null?void 0:r.transportType)==="relay")&&await this.toEstablishConnection();const o=typeof((n=r==null?void 0:r.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=r==null?void 0:r.internal)==null?void 0:i.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",c;const u=l=>{l.topic===e&&(this.subscriber.off(Xe.created,u),c())};return await Promise.all([new Promise(l=>{c=l,this.subscriber.on(Xe.created,u)}),new Promise(async(l,h)=>{a=await this.subscriber.subscribe(e,El({internal:{throwOnFailedPublish:o}},r)).catch(f=>{o&&h(f)})||a,l()})]),a}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Zt(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){if(!this.subscriber.hasAnyTopics){this.logger.warn("Starting WS connection skipped because the client has no topics to work with.");return}if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise(async(r,n)=>{await this.connect(e).then(r).catch(n).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw new Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(e){this.logger.debug({},"Restarting transport..."),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Ru())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.debug(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i,"Error while processing batch message event: "+(i==null?void 0:i.message))}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:n}=e;if(!r.sessionExists){const i=Ee(N.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(Se.message,e),await this.recordMessageEvent(e,Fi.inbound)}async connect(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let r=1;for(;r<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${r}...`),await this.createProvider(),await new Promise(async(n,i)=>{const s=()=>{i(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(ot.disconnect,s),await Zt(new Promise((o,a)=>{this.provider.connect().then(o).catch(a)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>{i(o)}).finally(()=>{this.provider.off(ot.disconnect,s),clearTimeout(this.reconnectTimeout)}),await new Promise(async(o,a)=>{const c=()=>{a(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(ot.disconnect,c),await this.subscriber.start().then(o).catch(a).finally(()=>{this.provider.off(ot.disconnect,c)})}),this.hasExperiencedNetworkDisruption=!1,n()})}catch(n){await this.subscriber.stop();const i=n;this.logger.warn({},i.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${r}`);break}await new Promise(n=>setTimeout(n,N.toMiliseconds(r*1))),r++}}startPingTimeout(){var e,r,n,i,s;if(Gi())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o,o==null?void 0:o.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new ht(new FI(E0({sdkVersion:Go,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(e,r){const{topic:n,message:i}=e;await this.messages.set(n,i,r)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isKnownTopic(r))return this.logger.warn(`Ignoring message for unknown topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.warn(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),Na(e)){if(!e.method.endsWith(XI))return;const r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,a={topic:n,message:i,publishedAt:s,transportType:ye.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(El({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else Is(e)&&this.events.emit(Se.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(await this.recordMessageEvent(e,Fi.inbound),this.events.emit(Se.message,e))}async acknowledgePayload(e){const r=$s(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(ot.payload,this.onPayloadHandler),this.provider.off(ot.connect,this.onConnectHandler),this.provider.off(ot.disconnect,this.onDisconnectHandler),this.provider.off(ot.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await Ru();z_(async r=>{e!==r&&(e=r,r?await this.transportOpen().catch(n=>this.logger.error(n,n==null?void 0:n.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}),this.core.heartbeat.on(Or.pulse,async()=>{if(!this.transportExplicitlyClosed&&!this.connected&&V_())try{await this.confirmOnlineStateOrThrow(),await this.transportOpen()}catch(r){this.logger.warn(r,r==null?void 0:r.message)}})}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(Se.disconnect),this.connectionAttemptInProgress=!1,!this.reconnectInProgress&&(this.reconnectInProgress=!0,await this.subscriber.stop(),this.subscriber.hasAnyTopics&&(this.transportExplicitlyClosed||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e,e==null?void 0:e.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},N.toMiliseconds(e2)))))}isInitialized(){if(!this.initialized){const{message:e}=T("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectPromise){await this.connectPromise;return}await this.connect()}}}function OS(){}function _l(t){if(!t||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e===null||e===Object.prototype||Object.getPrototypeOf(e)===null?Object.prototype.toString.call(t)==="[object Object]":!1}function $l(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function Ol(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const IS="[object RegExp]",PS="[object String]",SS="[object Number]",DS="[object Boolean]",Il="[object Arguments]",xS="[object Symbol]",AS="[object Date]",CS="[object Map]",LS="[object Set]",RS="[object Array]",NS="[object Function]",TS="[object ArrayBuffer]",fo="[object Object]",jS="[object Error]",BS="[object DataView]",MS="[object Uint8Array]",US="[object Uint8ClampedArray]",FS="[object Uint16Array]",kS="[object Uint32Array]",qS="[object BigUint64Array]",zS="[object Int8Array]",HS="[object Int16Array]",KS="[object Int32Array]",VS="[object BigInt64Array]",WS="[object Float32Array]",GS="[object Float64Array]";function YS(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}function JS(t,e,r){return Mn(t,e,void 0,void 0,void 0,void 0,r)}function Mn(t,e,r,n,i,s,o){const a=o(t,e,r,n,i,s);if(a!==void 0)return a;if(typeof t==typeof e)switch(typeof t){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return t===e;case"number":return t===e||Object.is(t,e);case"function":return t===e;case"object":return zn(t,e,s,o)}return zn(t,e,s,o)}function zn(t,e,r,n){if(Object.is(t,e))return!0;let i=Ol(t),s=Ol(e);if(i===Il&&(i=fo),s===Il&&(s=fo),i!==s)return!1;switch(i){case PS:return t.toString()===e.toString();case SS:{const c=t.valueOf(),u=e.valueOf();return YS(c,u)}case DS:case AS:case xS:return Object.is(t.valueOf(),e.valueOf());case IS:return t.source===e.source&&t.flags===e.flags;case NS:return t===e}r=r??new Map;const o=r.get(t),a=r.get(e);if(o!=null&&a!=null)return o===e;r.set(t,e),r.set(e,t);try{switch(i){case CS:{if(t.size!==e.size)return!1;for(const[c,u]of t.entries())if(!e.has(c)||!Mn(u,e.get(c),c,t,e,r,n))return!1;return!0}case LS:{if(t.size!==e.size)return!1;const c=Array.from(t.values()),u=Array.from(e.values());for(let l=0;l<c.length;l++){const h=c[l],f=u.findIndex(p=>Mn(h,p,void 0,t,e,r,n));if(f===-1)return!1;u.splice(f,1)}return!0}case RS:case MS:case US:case FS:case kS:case qS:case zS:case HS:case KS:case VS:case WS:case GS:{if(typeof Buffer<"u"&&Buffer.isBuffer(t)!==Buffer.isBuffer(e)||t.length!==e.length)return!1;for(let c=0;c<t.length;c++)if(!Mn(t[c],e[c],c,t,e,r,n))return!1;return!0}case TS:return t.byteLength!==e.byteLength?!1:zn(new Uint8Array(t),new Uint8Array(e),r,n);case BS:return t.byteLength!==e.byteLength||t.byteOffset!==e.byteOffset?!1:zn(new Uint8Array(t),new Uint8Array(e),r,n);case jS:return t.name===e.name&&t.message===e.message;case fo:{if(!(zn(t.constructor,e.constructor,r,n)||_l(t)&&_l(e)))return!1;const c=[...Object.keys(t),...$l(t)],u=[...Object.keys(e),...$l(e)];if(c.length!==u.length)return!1;for(let l=0;l<c.length;l++){const h=c[l],f=t[h];if(!Object.hasOwn(e,h))return!1;const p=e[h];if(!Mn(f,p,h,t,e,r,n))return!1}return!0}default:return!1}}finally{r.delete(t),r.delete(e)}}function ZS(t,e){return JS(t,e,OS)}var QS=Object.defineProperty,Pl=Object.getOwnPropertySymbols,XS=Object.prototype.hasOwnProperty,eD=Object.prototype.propertyIsEnumerable,ta=(t,e,r)=>e in t?QS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Sl=(t,e)=>{for(var r in e||(e={}))XS.call(e,r)&&ta(t,r,e[r]);if(Pl)for(var r of Pl(e))eD.call(e,r)&&ta(t,r,e[r]);return t},Ke=(t,e,r)=>ta(t,typeof e!="symbol"?e+"":e,r);class Ir extends DO{constructor(e,r,n,i=Lt,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,Ke(this,"map",new Map),Ke(this,"version",t2),Ke(this,"cached",[]),Ke(this,"initialized",!1),Ke(this,"getKey"),Ke(this,"storagePrefix",Lt),Ke(this,"recentlyDeleted",[]),Ke(this,"recentlyDeletedLimit",200),Ke(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!Ue(o)?this.map.set(this.getKey(o),o):b_(o)?this.map.set(o.id,o):E_(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)}),Ke(this,"set",async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())}),Ke(this,"get",o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o))),Ke(this,"getAll",o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(c=>ZS(a[c],o[c]))):this.values)),Ke(this,"update",async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const c=Sl(Sl({},this.getData(o)),a);this.map.set(o,c),await this.persist()}),Ke(this,"delete",async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())}),this.logger=ze(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return Je(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=T("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=T("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=T("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=T("NOT_INITIALIZED",this.name);throw new Error(e)}}}var tD=Object.defineProperty,rD=(t,e,r)=>e in t?tD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,V=(t,e,r)=>rD(t,typeof e!="symbol"?e+"":e,r);class nD{constructor(e,r){this.core=e,this.logger=r,V(this,"name",s2),V(this,"version",o2),V(this,"events",new X_),V(this,"pairings"),V(this,"initialized",!1),V(this,"storagePrefix",Lt),V(this,"ignoredPayloadTypes",[zt]),V(this,"registeredMethods",[]),V(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),V(this,"register",({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]}),V(this,"create",async n=>{this.isInitialized();const i=qo(),s=await this.core.crypto.setSymKey(i),o=Ee(N.FIVE_MINUTES),a={protocol:ip},c={topic:s,expiry:o,relay:a,active:!1,methods:n==null?void 0:n.methods},u=Ou({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(lr.create,c),this.core.expirer.set(s,o),await this.pairings.set(s,c),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType}),{topic:s,uri:u}}),V(this,"pair",async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[It.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:a,expiryTimestamp:c,methods:u}=$u(n.uri);i.props.properties.topic=s,i.addTrace(It.pairing_uri_validation_success),i.addTrace(It.pairing_uri_not_expired);let l;if(this.pairings.keys.includes(s)){if(l=this.pairings.get(s),i.addTrace(It.existing_pairing),l.active)throw i.setError(Ut.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(It.pairing_not_expired)}const h=c||Ee(N.FIVE_MINUTES),f={topic:s,relay:a,expiry:h,active:!1,methods:u};this.core.expirer.set(s,h),await this.pairings.set(s,f),i.addTrace(It.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(lr.create,f),i.addTrace(It.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(It.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(Ut.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(p){throw i.setError(Ut.subscribe_pairing_topic_failure),p}return i.addTrace(It.subscribe_pairing_topic_success),f}),V(this,"activate",async({topic:n})=>{this.isInitialized();const i=Ee(N.FIVE_MINUTES);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})}),V(this,"ping",async n=>{this.isInitialized(),await this.isValidPing(n),this.logger.warn("ping() is deprecated and will be removed in the next major release.");const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:c}=or();this.events.once(X("pairing_ping",s),({error:u})=>{u?c(u):a()}),await o()}}),V(this,"updateExpiry",async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})}),V(this,"updateMetadata",async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})}),V(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),V(this,"disconnect",async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",te("USER_DISCONNECTED")),await this.deletePairing(i))}),V(this,"formatUriFromPairing",n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:a}=n,c=this.core.crypto.keychain.get(i);return Ou({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:c,relay:s,expiryTimestamp:o,methods:a})}),V(this,"sendRequest",async(n,i,s)=>{const o=Qt(i,s),a=await this.core.crypto.encode(n,o),c=Ln[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,c),o.id}),V(this,"sendResult",async(n,i,s)=>{const o=$s(n,s),a=await this.core.crypto.encode(i,o),c=(await this.core.history.get(i,n)).request.method,u=Ln[c].res;await this.core.relayer.publish(i,a,u),await this.core.history.resolve(o)}),V(this,"sendError",async(n,i,s)=>{const o=Os(n,s),a=await this.core.crypto.encode(i,o),c=(await this.core.history.get(i,n)).request.method,u=Ln[c]?Ln[c].res:Ln.unregistered_method.res;await this.core.relayer.publish(i,a,u),await this.core.history.resolve(o)}),V(this,"deletePairing",async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,te("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])}),V(this,"cleanup",async()=>{const n=this.pairings.getAll().filter(i=>Yt(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))}),V(this,"onRelayEventRequest",async n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return await this.onPairingPingRequest(i,s);case"wc_pairingDelete":return await this.onPairingDeleteRequest(i,s);default:return await this.onUnknownRpcMethodRequest(i,s)}}),V(this,"onRelayEventResponse",async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}}),V(this,"onPairingPingRequest",async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(lr.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}}),V(this,"onPairingPingResponse",(n,i)=>{const{id:s}=i;setTimeout(()=>{St(i)?this.events.emit(X("pairing_ping",s),{}):ut(i)&&this.events.emit(X("pairing_ping",s),{error:i.error})},500)}),V(this,"onPairingDeleteRequest",async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(lr.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}}),V(this,"onUnknownRpcMethodRequest",async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=te("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}}),V(this,"onUnknownRpcMethodResponse",n=>{this.registeredMethods.includes(n)||this.logger.error(te("WC_METHOD_UNSUPPORTED",n))}),V(this,"isValidPair",(n,i)=>{var s;if(!We(n)){const{message:a}=T("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(Ut.malformed_pairing_uri),new Error(a)}if(!v_(n.uri)){const{message:a}=T("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(Ut.malformed_pairing_uri),new Error(a)}const o=$u(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=T("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(Ut.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=T("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(Ut.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&N.toMiliseconds(o==null?void 0:o.expiryTimestamp)<Date.now()){i.setError(Ut.pairing_expired);const{message:a}=T("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(a)}}),V(this,"isValidPing",async n=>{if(!We(n)){const{message:s}=T("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)}),V(this,"isValidDisconnect",async n=>{if(!We(n)){const{message:s}=T("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)}),V(this,"isValidPairingTopic",async n=>{if(!be(n,!1)){const{message:i}=T("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=T("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(Yt(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=T("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}}),this.core=e,this.logger=ze(r,this.name),this.pairings=new Ir(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Je(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=T("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Se.message,async e=>{const{topic:r,message:n,transportType:i}=e;if(this.pairings.keys.includes(r)&&i!==ye.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))try{const s=await this.core.crypto.decode(r,n);Na(s)?(this.core.history.set(r,s),await this.onRelayEventRequest({topic:r,payload:s})):Is(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id)),await this.core.relayer.messages.ack(r,n)}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(ct.expired,async e=>{const{topic:r}=_f(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(lr.expire,{topic:r}))})}}var iD=Object.defineProperty,sD=(t,e,r)=>e in t?iD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Re=(t,e,r)=>sD(t,typeof e!="symbol"?e+"":e,r);class oD extends OO{constructor(e,r){super(e,r),this.core=e,this.logger=r,Re(this,"records",new Map),Re(this,"events",new _r.EventEmitter),Re(this,"name",a2),Re(this,"version",c2),Re(this,"cached",[]),Re(this,"initialized",!1),Re(this,"storagePrefix",Lt),Re(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),Re(this,"set",(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:Ee(N.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(pt.created,o)}),Re(this,"resolve",async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=ut(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(pt.updated,i))}),Re(this,"get",async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i))),Re(this,"delete",(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(pt.deleted,s)}}),this.persist()}),Re(this,"exists",async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1)),Re(this,"on",(n,i)=>{this.events.on(n,i)}),Re(this,"once",(n,i)=>{this.events.once(n,i)}),Re(this,"off",(n,i)=>{this.events.off(n,i)}),Re(this,"removeListener",(n,i)=>{this.events.removeListener(n,i)}),this.logger=ze(r,this.name)}get context(){return Je(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:Qt(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=T("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(pt.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=T("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(pt.created,e=>{const r=pt.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(pt.updated,e=>{const r=pt.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(pt.deleted,e=>{const r=pt.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(Or.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{N.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(pt.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=T("NOT_INITIALIZED",this.name);throw new Error(e)}}}var aD=Object.defineProperty,cD=(t,e,r)=>e in t?aD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Me=(t,e,r)=>cD(t,typeof e!="symbol"?e+"":e,r);class uD extends AO{constructor(e,r){super(e,r),this.core=e,this.logger=r,Me(this,"expirations",new Map),Me(this,"events",new _r.EventEmitter),Me(this,"name",u2),Me(this,"version",l2),Me(this,"cached",[]),Me(this,"initialized",!1),Me(this,"storagePrefix",Lt),Me(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),Me(this,"has",n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}}),Me(this,"set",(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(ct.created,{target:s,expiration:o})}),Me(this,"get",n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)}),Me(this,"del",n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(ct.deleted,{target:i,expiration:s})}}),Me(this,"on",(n,i)=>{this.events.on(n,i)}),Me(this,"once",(n,i)=>{this.events.once(n,i)}),Me(this,"off",(n,i)=>{this.events.off(n,i)}),Me(this,"removeListener",(n,i)=>{this.events.removeListener(n,i)}),this.logger=ze(r,this.name)}get context(){return Je(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return _0(e);if(typeof e=="number")return $0(e);const{message:r}=T("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(ct.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=T("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=T("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;N.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(ct.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(Or.pulse,()=>this.checkExpirations()),this.events.on(ct.created,e=>{const r=ct.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(ct.expired,e=>{const r=ct.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(ct.deleted,e=>{const r=ct.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=T("NOT_INITIALIZED",this.name);throw new Error(e)}}}var lD=Object.defineProperty,hD=(t,e,r)=>e in t?lD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ve=(t,e,r)=>hD(t,typeof e!="symbol"?e+"":e,r);class fD extends CO{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,ve(this,"name",h2),ve(this,"abortController"),ve(this,"isDevEnv"),ve(this,"verifyUrlV3",d2),ve(this,"storagePrefix",Lt),ve(this,"version",np),ve(this,"publicKey"),ve(this,"fetchPromise"),ve(this,"init",async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&N.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))}),ve(this,"register",async i=>{if(!En()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=i,c=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const u=gr(),l=this.startAbortTimer(N.ONE_SECOND*5),h=await new Promise((f,p)=>{const d=()=>{window.removeEventListener("message",w),u.body.removeChild(y),p("attestation aborted")};this.abortController.signal.addEventListener("abort",d);const y=u.createElement("iframe");y.src=c,y.style.display="none",y.addEventListener("error",d,{signal:this.abortController.signal});const w=b=>{if(b.data&&typeof b.data=="string")try{const v=JSON.parse(b.data);if(v.type==="verify_attestation"){if(Ao(v.attestation).payload.id!==o)return;clearInterval(l),u.body.removeChild(y),this.abortController.signal.removeEventListener("abort",d),window.removeEventListener("message",w),f(v.attestation===null?"":v.attestation)}}catch(v){this.logger.warn(v)}};u.body.appendChild(y),window.addEventListener("message",w,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",h),h}catch(u){this.logger.warn(u)}return""}),ve(this,"resolve",async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(Ao(s).payload.id!==a)return;const u=await this.isValidJwtAttestation(s);if(u){if(!u.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return u}}if(!o)return;const c=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,c)}),ve(this,"fetchAttestation",async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(N.ONE_SECOND*5),a=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0}),ve(this,"getVerifyUrl",i=>{let s=i||qn;return p2.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${qn}`),s=qn),s}),ve(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(N.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}}),ve(this,"persistPublicKey",async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i}),ve(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),ve(this,"isValidJwtAttestation",async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}}),ve(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),ve(this,"fetchAndPersistPublicKey",async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i}),ve(this,"validateAttestation",(i,s)=>{const o=Q1(i,s.publicKey),a={hasExpired:N.toMiliseconds(o.exp)<Date.now(),payload:o};if(a.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:a.payload.origin,isScam:a.payload.isScam,isVerified:a.payload.isVerified}}),this.logger=ze(r,this.name),this.abortController=new AbortController,this.isDevEnv=Ea(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return Je(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),N.toMiliseconds(e))}}var dD=Object.defineProperty,pD=(t,e,r)=>e in t?dD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dl=(t,e,r)=>pD(t,typeof e!="symbol"?e+"":e,r);class gD extends LO{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,Dl(this,"context",g2),Dl(this,"registerDeviceToken",async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,c=`${y2}/${this.projectId}/clients`;await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})}),this.logger=ze(r,this.context)}}var yD=Object.defineProperty,xl=Object.getOwnPropertySymbols,mD=Object.prototype.hasOwnProperty,wD=Object.prototype.propertyIsEnumerable,ra=(t,e,r)=>e in t?yD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Tn=(t,e)=>{for(var r in e||(e={}))mD.call(e,r)&&ra(t,r,e[r]);if(xl)for(var r of xl(e))wD.call(e,r)&&ra(t,r,e[r]);return t},$e=(t,e,r)=>ra(t,typeof e!="symbol"?e+"":e,r);class vD extends RO{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,$e(this,"context",w2),$e(this,"storagePrefix",Lt),$e(this,"storageVersion",m2),$e(this,"events",new Map),$e(this,"shouldPersist",!1),$e(this,"init",async()=>{if(!Ea())try{const i={eventId:Wc(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:bf(this.core.relayer.protocol,this.core.relayer.version,Go)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}}),$e(this,"createEvent",i=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:c}}=i,u=Wc(),l=this.core.projectId||"",h=Date.now(),f=Tn({eventId:u,timestamp:h,props:{event:s,type:o,properties:{topic:a,trace:c}},bundleId:l,domain:this.getAppDomain()},this.setMethods(u));return this.telemetryEnabled&&(this.events.set(u,f),this.shouldPersist=!0),f}),$e(this,"getEvent",i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(c=>c.props.properties.topic===o);if(a)return Tn(Tn({},a),this.setMethods(a.eventId))}),$e(this,"deleteEvent",i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0}),$e(this,"setEventListeners",()=>{this.core.heartbeat.on(Or.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{N.fromMiliseconds(Date.now())-N.fromMiliseconds(i.timestamp)>v2&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})}),$e(this,"setMethods",i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)})),$e(this,"addTrace",(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)}),$e(this,"setError",(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)}),$e(this,"persist",async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),$e(this,"restore",async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,Tn(Tn({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}}),$e(this,"submit",async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}}),$e(this,"sendEvent",async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${b2}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${Go}${s}`,{method:"POST",body:JSON.stringify(i)})}),$e(this,"getAppDomain",()=>vf().url),this.logger=ze(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var bD=Object.defineProperty,Al=Object.getOwnPropertySymbols,ED=Object.prototype.hasOwnProperty,_D=Object.prototype.propertyIsEnumerable,na=(t,e,r)=>e in t?bD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Cl=(t,e)=>{for(var r in e||(e={}))ED.call(e,r)&&na(t,r,e[r]);if(Al)for(var r of Al(e))_D.call(e,r)&&na(t,r,e[r]);return t},pe=(t,e,r)=>na(t,typeof e!="symbol"?e+"":e,r);let $D=class mp extends bO{constructor(e){var r;super(e),pe(this,"protocol",rp),pe(this,"version",np),pe(this,"name",es),pe(this,"relayUrl"),pe(this,"projectId"),pe(this,"customStoragePrefix"),pe(this,"events",new _r.EventEmitter),pe(this,"logger"),pe(this,"heartbeat"),pe(this,"relayer"),pe(this,"crypto"),pe(this,"storage"),pe(this,"history"),pe(this,"expirer"),pe(this,"pairing"),pe(this,"verify"),pe(this,"echoClient"),pe(this,"linkModeSupportedApps"),pe(this,"eventClient"),pe(this,"initialized",!1),pe(this,"logChunkController"),pe(this,"on",(a,c)=>this.events.on(a,c)),pe(this,"once",(a,c)=>this.events.once(a,c)),pe(this,"off",(a,c)=>this.events.off(a,c)),pe(this,"removeListener",(a,c)=>this.events.removeListener(a,c)),pe(this,"dispatchEnvelope",({topic:a,message:c,sessionExists:u})=>{if(!a||!c)return;const l={topic:a,message:c,publishedAt:Date.now(),transportType:ye.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:u})});const n=this.getGlobalCore(e==null?void 0:e.customStoragePrefix);if(n)try{return this.customStoragePrefix=n.customStoragePrefix,this.logger=n.logger,this.heartbeat=n.heartbeat,this.crypto=n.crypto,this.history=n.history,this.expirer=n.expirer,this.storage=n.storage,this.relayer=n.relayer,this.pairing=n.pairing,this.verify=n.verify,this.echoClient=n.echoClient,this.linkModeSupportedApps=n.linkModeSupportedApps,this.eventClient=n.eventClient,this.initialized=n.initialized,this.logChunkController=n.logChunkController,n}catch(a){console.warn("Failed to copy global core",a)}this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||sp,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const i=bs({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:qI.logger,name:es}),{logger:s,chunkLoggerController:o}=hO({opts:i,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=o,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var a,c;(a=this.logChunkController)!=null&&a.downloadLogsBlobInBrowser&&((c=this.logChunkController)==null||c.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ze(s,this.name),this.heartbeat=new c$,this.crypto=new JP(this,this.logger,e==null?void 0:e.keychain),this.history=new oD(this,this.logger),this.expirer=new uD(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new B$(Cl(Cl({},zI),e==null?void 0:e.storageOptions)),this.relayer=new $S({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new nD(this,this.logger),this.verify=new fD(this,this.logger,this.storage),this.echoClient=new gD(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new vD(this,this.logger,e==null?void 0:e.telemetryEnabled),this.setGlobalCore(this)}static async init(e){const r=new mp(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem(r2,n),r}get context(){return Je(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(ll,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(ll)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}getGlobalCore(e=""){try{if(this.isGlobalCoreDisabled())return;const r=`_walletConnectCore_${e}`,n=`${r}_count`;return globalThis[n]=(globalThis[n]||0)+1,globalThis[n]>1&&console.warn(`WalletConnect Core is already initialized. This is probably a mistake and can lead to unexpected behavior. Init() was called ${globalThis[n]} times.`),globalThis[r]}catch(r){console.warn("Failed to get global WalletConnect core",r);return}}setGlobalCore(e){var r;try{if(this.isGlobalCoreDisabled())return;const n=`_walletConnectCore_${((r=e.opts)==null?void 0:r.customStoragePrefix)||""}`;globalThis[n]=e}catch(n){console.warn("Failed to set global WalletConnect core",n)}}isGlobalCoreDisabled(){try{return typeof process<"u"&&kI.DISABLE_GLOBAL_CORE==="true"}catch{return!0}}};const OD=$D;var ja={exports:{}},an=typeof Reflect=="object"?Reflect:null,Ll=an&&typeof an.apply=="function"?an.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},ki;an&&typeof an.ownKeys=="function"?ki=an.ownKeys:Object.getOwnPropertySymbols?ki=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:ki=function(e){return Object.getOwnPropertyNames(e)};function ID(t){console&&console.warn&&console.warn(t)}var wp=Number.isNaN||function(e){return e!==e};function ce(){ce.init.call(this)}ja.exports=ce;ja.exports.once=xD;ce.EventEmitter=ce;ce.prototype._events=void 0;ce.prototype._eventsCount=0;ce.prototype._maxListeners=void 0;var Rl=10;function Ds(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(ce,"defaultMaxListeners",{enumerable:!0,get:function(){return Rl},set:function(t){if(typeof t!="number"||t<0||wp(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Rl=t}});ce.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};ce.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||wp(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function vp(t){return t._maxListeners===void 0?ce.defaultMaxListeners:t._maxListeners}ce.prototype.getMaxListeners=function(){return vp(this)};ce.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[e];if(c===void 0)return!1;if(typeof c=="function")Ll(c,this,r);else for(var u=c.length,l=Op(c,u),n=0;n<u;++n)Ll(l[n],this,r);return!0};function bp(t,e,r,n){var i,s,o;if(Ds(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=vp(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,ID(a)}return t}ce.prototype.addListener=function(e,r){return bp(this,e,r,!1)};ce.prototype.on=ce.prototype.addListener;ce.prototype.prependListener=function(e,r){return bp(this,e,r,!0)};function PD(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Ep(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=PD.bind(n);return i.listener=r,n.wrapFn=i,i}ce.prototype.once=function(e,r){return Ds(r),this.on(e,Ep(this,e,r)),this};ce.prototype.prependOnceListener=function(e,r){return Ds(r),this.prependListener(e,Ep(this,e,r)),this};ce.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Ds(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():SD(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};ce.prototype.off=ce.prototype.removeListener;ce.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function _p(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?DD(i):Op(i,i.length)}ce.prototype.listeners=function(e){return _p(this,e,!0)};ce.prototype.rawListeners=function(e){return _p(this,e,!1)};ce.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):$p.call(t,e)};ce.prototype.listenerCount=$p;function $p(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}ce.prototype.eventNames=function(){return this._eventsCount>0?ki(this._events):[]};function Op(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function SD(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function DD(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function xD(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}Ip(t,e,s,{once:!0}),e!=="error"&&AD(t,i,{once:!0})})}function AD(t,e,r){typeof t.on=="function"&&Ip(t,"error",e,r)}function Ip(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var Pp=ja.exports;const CD=ei(Pp),Sp="wc",Dp=2,xp="client",Ba=`${Sp}@${Dp}:${xp}:`,po={name:xp,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.org"},Nl="WALLETCONNECT_DEEPLINK_CHOICE",LD="proposal",Tl="Proposal expired",RD="session",jr=N.SEVEN_DAYS,ND="engine",Oe={wc_sessionPropose:{req:{ttl:N.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:N.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:N.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:N.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:N.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:N.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:N.ONE_DAY,prompt:!1,tag:1104},res:{ttl:N.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:N.ONE_DAY,prompt:!1,tag:1106},res:{ttl:N.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:N.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:N.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:N.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:N.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:N.ONE_DAY,prompt:!1,tag:1112},res:{ttl:N.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:N.ONE_DAY,prompt:!1,tag:1114},res:{ttl:N.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:N.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:N.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:N.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:N.FIVE_MINUTES,prompt:!1,tag:1119}}},go={min:N.FIVE_MINUTES,max:N.SEVEN_DAYS},Ot={idle:"IDLE",active:"ACTIVE"},jl={eth_sendTransaction:{key:""},eth_sendRawTransaction:{key:""},wallet_sendCalls:{key:""},solana_signTransaction:{key:"signature"},solana_signAllTransactions:{key:"transactions"},solana_signAndSendTransaction:{key:"signature"}},TD="request",jD=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],BD="wc",MD="auth",UD="authKeys",FD="pairingTopics",kD="requests",xs=`${BD}@${1.5}:${MD}:`,qi=`${xs}:PUB_KEY`;var qD=Object.defineProperty,zD=Object.defineProperties,HD=Object.getOwnPropertyDescriptors,Bl=Object.getOwnPropertySymbols,KD=Object.prototype.hasOwnProperty,VD=Object.prototype.propertyIsEnumerable,ia=(t,e,r)=>e in t?qD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,fe=(t,e)=>{for(var r in e||(e={}))KD.call(e,r)&&ia(t,r,e[r]);if(Bl)for(var r of Bl(e))VD.call(e,r)&&ia(t,r,e[r]);return t},ke=(t,e)=>zD(t,HD(e)),R=(t,e,r)=>ia(t,typeof e!="symbol"?e+"":e,r);class WD extends BO{constructor(e){super(e),R(this,"name",ND),R(this,"events",new CD),R(this,"initialized",!1),R(this,"requestQueue",{state:Ot.idle,queue:[]}),R(this,"sessionRequestQueue",{state:Ot.idle,queue:[]}),R(this,"requestQueueDelay",N.ONE_SECOND),R(this,"expectedPairingMethodMap",new Map),R(this,"recentlyDeletedMap",new Map),R(this,"recentlyDeletedLimit",200),R(this,"relayMessageCache",[]),R(this,"pendingSessions",new Map),R(this,"init",async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(Oe)}),this.initialized=!0,setTimeout(async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},N.toMiliseconds(this.requestQueueDelay)))}),R(this,"connect",async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=ke(fe({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n),n.optionalNamespaces=p_(n.requiredNamespaces,n.optionalNamespaces),n.requiredNamespaces={};const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,scopedProperties:c,relays:u}=n;let l=i,h,f=!1;try{if(l){const x=this.client.core.pairing.pairings.get(l);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),f=x.active}}catch(x){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),x}if(!l||!f){const{topic:x,uri:S}=await this.client.core.pairing.create();l=x,h=S}if(!l){const{message:x}=T("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(x)}const p=await this.client.core.crypto.generateKeyPair(),d=Oe.wc_sessionPropose.req.ttl||N.FIVE_MINUTES,y=Ee(d),w=ke(fe(fe({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:ip}],proposer:{publicKey:p,metadata:this.client.metadata},expiryTimestamp:y,pairingTopic:l},a&&{sessionProperties:a}),c&&{scopedProperties:c}),{id:Pt()}),b=X("session_connect",w.id),{reject:v,resolve:E,done:$}=or(d,Tl),D=({id:x})=>{x===w.id&&(this.client.events.off("proposal_expire",D),this.pendingSessions.delete(w.id),this.events.emit(b,{error:{message:Tl,code:0}}))};return this.client.events.on("proposal_expire",D),this.events.once(b,({error:x,session:S})=>{this.client.events.off("proposal_expire",D),x?v(x):S&&E(S)}),await this.sendRequest({topic:l,method:"wc_sessionPropose",params:w,throwOnFailedPublish:!0,clientRpcId:w.id}),await this.setProposal(w.id,w),{uri:h,approval:$}}),R(this,"pair",async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}}),R(this,"approve",async r=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=r==null?void 0:r.id)==null?void 0:n.toString(),trace:[gt.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(I){throw o.setError(ir.no_internet_connection),I}try{await this.isValidProposalId(r==null?void 0:r.id)}catch(I){throw this.client.logger.error(`approve() -> proposal.get(${r==null?void 0:r.id}) failed`),o.setError(ir.proposal_not_found),I}try{await this.isValidApprove(r)}catch(I){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(ir.session_approve_namespace_validation_failure),I}const{id:a,relayProtocol:c,namespaces:u,sessionProperties:l,scopedProperties:h,sessionConfig:f}=r,p=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:d,proposer:y,requiredNamespaces:w,optionalNamespaces:b}=p;let v=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:d});v||(v=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:gt.session_approve_started,properties:{topic:d,trace:[gt.session_approve_started,gt.session_namespaces_validation_success]}}));const E=await this.client.core.crypto.generateKeyPair(),$=y.publicKey,D=await this.client.core.crypto.generateSharedKey(E,$),x=fe(fe(fe({relay:{protocol:c??"irn"},namespaces:u,controller:{publicKey:E,metadata:this.client.metadata},expiry:Ee(jr)},l&&{sessionProperties:l}),h&&{scopedProperties:h}),f&&{sessionConfig:f}),S=ye.relay;v.addTrace(gt.subscribing_session_topic);try{await this.client.core.relayer.subscribe(D,{transportType:S})}catch(I){throw v.setError(ir.subscribe_session_topic_failure),I}v.addTrace(gt.subscribe_session_topic_success);const C=ke(fe({},x),{topic:D,requiredNamespaces:w,optionalNamespaces:b,pairingTopic:d,acknowledged:!1,self:x.controller,peer:{publicKey:y.publicKey,metadata:y.metadata},controller:E,transportType:ye.relay});await this.client.session.set(D,C),v.addTrace(gt.store_session);try{v.addTrace(gt.publishing_session_settle),await this.sendRequest({topic:D,method:"wc_sessionSettle",params:x,throwOnFailedPublish:!0}).catch(I=>{throw v==null||v.setError(ir.session_settle_publish_failure),I}),v.addTrace(gt.session_settle_publish_success),v.addTrace(gt.publishing_session_approve),await this.sendResult({id:a,topic:d,result:{relay:{protocol:c??"irn"},responderPublicKey:E},throwOnFailedPublish:!0}).catch(I=>{throw v==null||v.setError(ir.session_approve_publish_failure),I}),v.addTrace(gt.session_approve_publish_success)}catch(I){throw this.client.logger.error(I),this.client.session.delete(D,te("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(D),I}return this.client.core.eventClient.deleteEvent({eventId:v.eventId}),await this.client.core.pairing.updateMetadata({topic:d,metadata:y.metadata}),await this.client.proposal.delete(a,te("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:d}),await this.setExpiry(D,Ee(jr)),{topic:D,acknowledged:()=>Promise.resolve(this.client.session.get(D))}}),R(this,"reject",async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:Oe.wc_sessionPropose.reject}),await this.client.proposal.delete(n,te("USER_DISCONNECTED")))}),R(this,"update",async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(h){throw this.client.logger.error("update() -> isValidUpdate() failed"),h}const{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:a}=or(),c=Pt(),u=dr().toString(),l=this.client.session.get(n).namespaces;return this.events.once(X("session_update",c),({error:h})=>{h?a(h):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:c,relayRpcId:u}).catch(h=>{this.client.logger.error(h),this.client.session.update(n,{namespaces:l}),a(h)}),{acknowledged:s}}),R(this,"extend",async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(c){throw this.client.logger.error("extend() -> isValidExtend() failed"),c}const{topic:n}=r,i=Pt(),{done:s,resolve:o,reject:a}=or();return this.events.once(X("session_extend",i),({error:c})=>{c?a(c):o()}),await this.setExpiry(n,Ee(jr)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(c=>{a(c)}),{acknowledged:s}}),R(this,"request",async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(b){throw this.client.logger.error("request() -> isValidRequest() failed"),b}const{chainId:n,request:i,topic:s,expiry:o=Oe.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(s);(a==null?void 0:a.transportType)===ye.relay&&await this.confirmOnlineStateOrThrow();const c=Pt(),u=dr().toString(),{done:l,resolve:h,reject:f}=or(o,"Request expired. Please try again.");this.events.once(X("session_request",c),({error:b,result:v})=>{b?f(b):h(v)});const p="wc_sessionRequest",d=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);if(d)return await this.sendRequest({clientRpcId:c,relayRpcId:u,topic:s,method:p,params:{request:ke(fe({},i),{expiryTimestamp:Ee(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:d}).catch(b=>f(b)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:c}),await l();const y={request:ke(fe({},i),{expiryTimestamp:Ee(o)}),chainId:n},w=this.shouldSetTVF(p,y);return await Promise.all([new Promise(async b=>{await this.sendRequest(fe({clientRpcId:c,relayRpcId:u,topic:s,method:p,params:y,expiry:o,throwOnFailedPublish:!0},w&&{tvf:this.getTVFParams(c,y)})).catch(v=>f(v)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:c}),b()}),new Promise(async b=>{var v;if(!((v=a.sessionConfig)!=null&&v.disableDeepLink)){const E=await S0(this.client.core.storage,Nl);await O0({id:c,topic:s,wcDeepLink:E})}b()}),l()]).then(b=>b[2])}),R(this,"respond",async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===ye.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);St(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:a}):ut(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:a}),this.cleanupAfterResponse(r)}),R(this,"ping",async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=Pt(),s=dr().toString(),{done:o,resolve:a,reject:c}=or();this.events.once(X("session_ping",i),({error:u})=>{u?c(u):a()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&(this.client.logger.warn("ping() on pairing topic is deprecated and will be removed in the next major release."),await this.client.core.pairing.ping({topic:n}))}),R(this,"emit",async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,o=dr().toString(),a=Pt();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o,clientRpcId:a})}),R(this,"disconnect",async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:te("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=T("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}}),R(this,"find",r=>(this.isInitialized(),this.client.session.getAll().filter(n=>m_(n,r)))),R(this,"getPendingSessionRequests",()=>this.client.pendingRequest.getAll()),R(this,"authenticate",async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?ye.link_mode:ye.relay;o===ye.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:c="",uri:u,domain:l,nonce:h,type:f,exp:p,nbf:d,methods:y=[],expiry:w}=r,b=[...r.resources||[]],{topic:v,uri:E}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:v,uri:E}});const $=await this.client.core.crypto.generateKeyPair(),D=Li($);if(await Promise.all([this.client.auth.authKeys.set(qi,{responseTopic:D,publicKey:$}),this.client.auth.pairingTopics.set(D,{topic:D,pairingTopic:v})]),await this.client.core.relayer.subscribe(D,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${v}`),y.length>0){const{namespace:O}=en(a[0]);let A=vE(O,"request",y);Ci(b)&&(A=EE(A,b.pop())),b.push(A)}const x=w&&w>Oe.wc_sessionAuthenticate.req.ttl?w:Oe.wc_sessionAuthenticate.req.ttl,S={authPayload:{type:f??"caip122",chains:a,statement:c,aud:u,domain:l,version:"1",nonce:h,iat:new Date().toISOString(),exp:p,nbf:d,resources:b},requester:{publicKey:$,metadata:this.client.metadata},expiryTimestamp:Ee(x)},C={eip155:{chains:a,methods:[...new Set(["personal_sign",...y])],events:["chainChanged","accountsChanged"]}},I={requiredNamespaces:{},optionalNamespaces:C,relays:[{protocol:"irn"}],pairingTopic:v,proposer:{publicKey:$,metadata:this.client.metadata},expiryTimestamp:Ee(Oe.wc_sessionPropose.req.ttl),id:Pt()},{done:k,resolve:B,reject:j}=or(x,"Request expired"),q=Pt(),L=X("session_connect",I.id),g=X("session_request",q),m=async({error:O,session:A})=>{this.events.off(g,_),O?j(O):A&&B({session:A})},_=async O=>{var A,M,F;if(await this.deletePendingAuthRequest(q,{message:"fulfilled",code:0}),O.error){const Y=te("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return O.error.code===Y.code?void 0:(this.events.off(L,m),j(O.error.message))}await this.deleteProposal(I.id),this.events.off(L,m);const{cacaos:z,responder:U}=O.result,H=[],G=[];for(const Y of z){await tu({cacao:Y,projectId:this.client.core.projectId})||(this.client.logger.error(Y,"Signature verification failed"),j(te("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Be}=Y,Ae=Ci(Be.resources),Fe=[Ro(Be.iss)],it=Yi(Be.iss);if(Ae){const st=ru(Ae),Sr=nu(Ae);H.push(...st),Fe.push(...Sr)}for(const st of Fe)G.push(`${st}:${it}`)}const de=await this.client.core.crypto.generateSharedKey($,U.publicKey);let ee;H.length>0&&(ee={topic:de,acknowledged:!0,self:{publicKey:$,metadata:this.client.metadata},peer:U,controller:U.publicKey,expiry:Ee(jr),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:v,namespaces:Du([...new Set(H)],[...new Set(G)]),transportType:o},await this.client.core.relayer.subscribe(de,{transportType:o}),await this.client.session.set(de,ee),v&&await this.client.core.pairing.updateMetadata({topic:v,metadata:U.metadata}),ee=this.client.session.get(de)),(A=this.client.metadata.redirect)!=null&&A.linkMode&&(M=U.metadata.redirect)!=null&&M.linkMode&&(F=U.metadata.redirect)!=null&&F.universal&&n&&(this.client.core.addLinkModeSupportedApp(U.metadata.redirect.universal),this.client.session.update(de,{transportType:ye.link_mode})),B({auths:z,session:ee})};this.events.once(L,m),this.events.once(g,_);let P;try{if(s){const O=Qt("wc_sessionAuthenticate",S,q);this.client.core.history.set(v,O);const A=await this.client.core.crypto.encode("",O,{type:ci,encoding:Jt});P=vi(n,v,A)}else await Promise.all([this.sendRequest({topic:v,method:"wc_sessionAuthenticate",params:S,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:q}),this.sendRequest({topic:v,method:"wc_sessionPropose",params:I,expiry:Oe.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:I.id})])}catch(O){throw this.events.off(L,m),this.events.off(g,_),O}return await this.setProposal(I.id,I),await this.setAuthRequest(q,{request:ke(fe({},S),{verifyContext:{}}),pairingTopic:v,transportType:o}),{uri:P??E,response:k}}),R(this,"approveSessionAuthenticate",async r=>{const{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[sr.authenticated_session_approve_started]}});try{this.isInitialized()}catch(w){throw s.setError(Rn.no_internet_connection),w}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(Rn.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const a=o.transportType||ye.relay;a===ye.relay&&await this.confirmOnlineStateOrThrow();const c=o.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),l=Li(c),h={type:zt,receiverPublicKey:c,senderPublicKey:u},f=[],p=[];for(const w of i){if(!await tu({cacao:w,projectId:this.client.core.projectId})){s.setError(Rn.invalid_cacao);const D=te("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:l,error:D,encodeOpts:h}),new Error(D.message)}s.addTrace(sr.cacaos_verified);const{p:b}=w,v=Ci(b.resources),E=[Ro(b.iss)],$=Yi(b.iss);if(v){const D=ru(v),x=nu(v);f.push(...D),E.push(...x)}for(const D of E)p.push(`${D}:${$}`)}const d=await this.client.core.crypto.generateSharedKey(u,c);s.addTrace(sr.create_authenticated_session_topic);let y;if((f==null?void 0:f.length)>0){y={topic:d,acknowledged:!0,self:{publicKey:u,metadata:this.client.metadata},peer:{publicKey:c,metadata:o.requester.metadata},controller:c,expiry:Ee(jr),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:Du([...new Set(f)],[...new Set(p)]),transportType:a},s.addTrace(sr.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(d,{transportType:a})}catch(w){throw s.setError(Rn.subscribe_authenticated_session_topic_failure),w}s.addTrace(sr.subscribe_authenticated_session_topic_success),await this.client.session.set(d,y),s.addTrace(sr.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(sr.publishing_authenticated_session_approve);try{await this.sendResult({topic:l,id:n,result:{cacaos:i,responder:{publicKey:u,metadata:this.client.metadata}},encodeOpts:h,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(w){throw s.setError(Rn.authenticated_session_approve_publish_failure),w}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:y}}),R(this,"rejectSessionAuthenticate",async r=>{this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===ye.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),c=Li(o),u={type:zt,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:n,topic:c,error:i,encodeOpts:u,rpcOpts:Oe.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,te("USER_DISCONNECTED"))}),R(this,"formatAuthMessage",r=>{this.isInitialized();const{request:n,iss:i}=r;return Cf(n,i)}),R(this,"processRelayMessageCache",()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)}),R(this,"cleanupDuplicatePairings",async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}}),R(this,"deleteSession",async r=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=r,{self:c}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,te("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(c.publicKey)&&await this.client.core.crypto.deleteKeyPair(c.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(Nl).catch(u=>this.client.logger.warn(u)),this.getPendingSessionRequests().forEach(u=>{u.topic===i&&this.deletePendingSessionRequest(u.id,te("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=Ot.idle),o&&this.client.events.emit("session_delete",{id:a,topic:i})}),R(this,"deleteProposal",async(r,n)=>{if(n)try{const i=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(ir.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,te("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")}),R(this,"deletePendingSessionRequest",async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Ot.idle,this.client.events.emit("session_request_expire",{id:r}))}),R(this,"deletePendingAuthRequest",async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])}),R(this,"setExpiry",async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))}),R(this,"setProposal",async(r,n)=>{this.client.core.expirer.set(r,Ee(Oe.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)}),R(this,"setAuthRequest",async(r,n)=>{const{request:i,pairingTopic:s,transportType:o=ye.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})}),R(this,"setPendingSessionRequest",async r=>{const{id:n,topic:i,params:s,verifyContext:o}=r,a=s.request.expiryTimestamp||Ee(Oe.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,a),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})}),R(this,"sendRequest",async r=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:c,throwOnFailedPublish:u,appLink:l,tvf:h}=r,f=Qt(i,s,c);let p;const d=!!l;try{const b=d?Jt:wt;p=await this.client.core.crypto.encode(n,f,{encoding:b})}catch(b){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),b}let y;if(jD.includes(i)){const b=xt(JSON.stringify(f)),v=xt(p);y=await this.client.core.verify.register({id:v,decryptedId:b})}const w=Oe[i].req;if(w.attestation=y,o&&(w.ttl=o),a&&(w.id=a),this.client.core.history.set(n,f),d){const b=vi(l,n,p);await global.Linking.openURL(b,this.client.name)}else{const b=Oe[i].req;o&&(b.ttl=o),a&&(b.id=a),b.tvf=ke(fe({},h),{correlationId:f.id}),u?(b.internal=ke(fe({},b.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,p,b)):this.client.core.relayer.publish(n,p,b).catch(v=>this.client.logger.error(v))}return f.id}),R(this,"sendResult",async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:c}=r,u=$s(n,s);let l;const h=c&&typeof(global==null?void 0:global.Linking)<"u";try{const d=h?Jt:wt;l=await this.client.core.crypto.encode(i,u,ke(fe({},a||{}),{encoding:d}))}catch(d){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),d}let f,p;try{f=await this.client.core.history.get(i,n);const d=f.request;try{this.shouldSetTVF(d.method,d.params)&&(p=this.getTVFParams(n,d.params,s))}catch(y){this.client.logger.warn("sendResult() -> getTVFParams() failed",y)}}catch(d){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),d}if(h){const d=vi(c,i,l);await global.Linking.openURL(d,this.client.name)}else{const d=f.request.method,y=Oe[d].res;y.tvf=ke(fe({},p),{correlationId:n}),o?(y.internal=ke(fe({},y.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,l,y)):this.client.core.relayer.publish(i,l,y).catch(w=>this.client.logger.error(w))}await this.client.core.history.resolve(u)}),R(this,"sendError",async r=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:c}=r,u=Os(n,s);let l;const h=c&&typeof(global==null?void 0:global.Linking)<"u";try{const p=h?Jt:wt;l=await this.client.core.crypto.encode(i,u,ke(fe({},o||{}),{encoding:p}))}catch(p){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),p}let f;try{f=await this.client.core.history.get(i,n)}catch(p){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),p}if(h){const p=vi(c,i,l);await global.Linking.openURL(p,this.client.name)}else{const p=f.request.method,d=a||Oe[p].res;this.client.core.relayer.publish(i,l,d)}await this.client.core.history.resolve(u)}),R(this,"cleanup",async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;Yt(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{Yt(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])}),R(this,"onProviderMessageEvent",async r=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(r):await this.onRelayMessage(r)}),R(this,"onRelayEventRequest",async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()}),R(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===Ot.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Ot.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Ot.idle}),R(this,"processRequest",async r=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:a}=r,c=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:c}))switch(c){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${c}`)}}),R(this,"onRelayEventResponse",async r=>{const{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}}),R(this,"onRelayEventUnknownPayload",r=>{const{topic:n}=r,{message:i}=T("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)}),R(this,"shouldIgnorePairingRequest",r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),R(this,"onSessionProposeRequest",async r=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:a,id:c}=i;try{const u=this.client.core.eventClient.getEvent({topic:n});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),u==null||u.setError(Ut.proposal_listener_not_found)),this.isValidConnect(fe({},i.params));const l=a.expiryTimestamp||Ee(Oe.wc_sessionPropose.req.ttl),h=fe({id:c,pairingTopic:n,expiryTimestamp:l},a);await this.setProposal(c,h);const f=await this.getVerifyContext({attestationId:s,hash:xt(JSON.stringify(i)),encryptedId:o,metadata:h.proposer.metadata});u==null||u.addTrace(It.emit_session_proposal),this.client.events.emit("session_proposal",{id:c,params:h,verifyContext:f})}catch(u){await this.sendError({id:c,topic:n,error:u,rpcOpts:Oe.wc_sessionPropose.autoReject}),this.client.logger.error(u)}}),R(this,"onSessionProposeResponse",async(r,n,i)=>{const{id:s}=n;if(St(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const c=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:c});const u=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});const l=await this.client.core.crypto.generateSharedKey(c,u);this.pendingSessions.set(s,{sessionTopic:l,pairingTopic:r,proposalId:s,publicKey:c});const h=await this.client.core.relayer.subscribe(l,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:h}),await this.client.core.pairing.activate({topic:r})}else if(ut(n)){await this.client.proposal.delete(s,te("USER_DISCONNECTED"));const o=X("session_connect",s);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(o,{error:n.error})}}),R(this,"onSessionSettleRequest",async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:c,namespaces:u,sessionProperties:l,scopedProperties:h,sessionConfig:f}=n.params,p=[...this.pendingSessions.values()].find(w=>w.sessionTopic===r);if(!p)return this.client.logger.error(`Pending session not found for topic ${r}`);const d=this.client.proposal.get(p.proposalId),y=ke(fe(fe(fe({topic:r,relay:o,expiry:c,namespaces:u,acknowledged:!0,pairingTopic:p.pairingTopic,requiredNamespaces:d.requiredNamespaces,optionalNamespaces:d.optionalNamespaces,controller:a.publicKey,self:{publicKey:p.publicKey,metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},l&&{sessionProperties:l}),h&&{scopedProperties:h}),f&&{sessionConfig:f}),{transportType:ye.relay});await this.client.session.set(y.topic,y),await this.setExpiry(y.topic,y.expiry),await this.client.core.pairing.updateMetadata({topic:p.pairingTopic,metadata:y.peer.metadata}),this.client.events.emit("session_connect",{session:y}),this.events.emit(X("session_connect",p.proposalId),{session:y}),this.pendingSessions.delete(p.proposalId),this.deleteProposal(p.proposalId,!1),this.cleanupDuplicatePairings(y),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}}),R(this,"onSessionSettleResponse",async(r,n)=>{const{id:i}=n;St(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(X("session_approve",i),{})):ut(n)&&(await this.client.session.delete(r,te("USER_DISCONNECTED")),this.events.emit(X("session_approve",i),{error:n.error}))}),R(this,"onSessionUpdateRequest",async(r,n)=>{const{params:i,id:s}=n;try{const o=`${r}_session_update`,a=Cn.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.warn(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:te("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(fe({topic:r},i));try{Cn.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(c){throw Cn.delete(o),c}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}}),R(this,"isRequestOutOfSync",(r,n)=>n.toString().slice(0,-3)<r.toString().slice(0,-3)),R(this,"onSessionUpdateResponse",(r,n)=>{const{id:i}=n,s=X("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);St(n)?this.events.emit(X("session_update",i),{}):ut(n)&&this.events.emit(X("session_update",i),{error:n.error})}),R(this,"onSessionExtendRequest",async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,Ee(jr)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}}),R(this,"onSessionExtendResponse",(r,n)=>{const{id:i}=n,s=X("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);St(n)?this.events.emit(X("session_extend",i),{}):ut(n)&&this.events.emit(X("session_extend",i),{error:n.error})}),R(this,"onSessionPingRequest",async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}}),R(this,"onSessionPingResponse",(r,n)=>{const{id:i}=n,s=X("session_ping",i);setTimeout(()=>{if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners 2176`);St(n)?this.events.emit(X("session_ping",i),{}):ut(n)&&this.events.emit(X("session_ping",i),{error:n.error})},500)}),R(this,"onSessionDeleteRequest",async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(Se.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:te("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}}),R(this,"onSessionRequest",async r=>{var n,i,s;const{topic:o,payload:a,attestation:c,encryptedId:u,transportType:l}=r,{id:h,params:f}=a;try{await this.isValidRequest(fe({topic:o},f));const p=this.client.session.get(o),d=await this.getVerifyContext({attestationId:c,hash:xt(JSON.stringify(Qt("wc_sessionRequest",f,h))),encryptedId:u,metadata:p.peer.metadata,transportType:l}),y={id:h,topic:o,params:f,verifyContext:d};await this.setPendingSessionRequest(y),l===ye.link_mode&&(n=p.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=p.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(y):(this.addSessionRequestToSessionRequestQueue(y),this.processSessionRequestQueue())}catch(p){await this.sendError({id:h,topic:o,error:p}),this.client.logger.error(p)}}),R(this,"onSessionRequestResponse",(r,n)=>{const{id:i}=n,s=X("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);St(n)?this.events.emit(X("session_request",i),{result:n.result}):ut(n)&&this.events.emit(X("session_request",i),{error:n.error})}),R(this,"onSessionEventRequest",async(r,n)=>{const{id:i,params:s}=n;try{const o=`${r}_session_event_${s.event.name}`,a=Cn.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(fe({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),Cn.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}}),R(this,"onSessionAuthenticateResponse",(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),St(n)?this.events.emit(X("session_request",i),{result:n.result}):ut(n)&&this.events.emit(X("session_request",i),{error:n.error})}),R(this,"onSessionAuthenticateRequest",async r=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:a,transportType:c}=r;try{const{requester:u,authPayload:l,expiryTimestamp:h}=s.params,f=await this.getVerifyContext({attestationId:o,hash:xt(JSON.stringify(s)),encryptedId:a,metadata:u.metadata,transportType:c}),p={requester:u,pairingTopic:i,id:s.id,authPayload:l,verifyContext:f,expiryTimestamp:h};await this.setAuthRequest(s.id,{request:p,pairingTopic:i,transportType:c}),c===ye.link_mode&&(n=u.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(u.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:f})}catch(u){this.client.logger.error(u);const l=s.params.requester.publicKey,h=await this.client.core.crypto.generateKeyPair(),f=this.getAppLinkIfEnabled(s.params.requester.metadata,c),p={type:zt,receiverPublicKey:l,senderPublicKey:h};await this.sendError({id:s.id,topic:i,error:u,encodeOpts:p,rpcOpts:Oe.wc_sessionAuthenticate.autoReject,appLink:f})}}),R(this,"addSessionRequestToSessionRequestQueue",r=>{this.sessionRequestQueue.queue.push(r)}),R(this,"cleanupAfterResponse",r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Ot.idle,this.processSessionRequestQueue()},N.toMiliseconds(this.requestQueueDelay))}),R(this,"cleanupPendingSentRequestsForTopic",({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=X("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(X("session_request",s.request.id),{error:n})})}),R(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===Ot.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Ot.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}}),R(this,"emitSessionRequest",r=>{this.client.events.emit("session_request",r)}),R(this,"onPairingCreated",r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:Qt("wc_sessionPropose",ke(fe({},n),{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties,scopedProperties:n.scopedProperties}),n.id)})}),R(this,"isValidConnect",async r=>{if(!We(r)){const{message:u}=T("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,scopedProperties:a,relays:c}=r;if(Ue(n)||await this.isValidPairingTopic(n),!x_(c)){const{message:u}=T("MISSING_OR_INVALID",`connect() relays: ${c}`);throw new Error(u)}if(!Ue(i)&&er(i)!==0){const u="requiredNamespaces are deprecated and are automatically assigned to optionalNamespaces";["fatal","error","silent"].includes(this.client.logger.level)?console.warn(u):this.client.logger.warn(u),this.validateNamespaces(i,"requiredNamespaces")}if(!Ue(s)&&er(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),Ue(o)||this.validateSessionProps(o,"sessionProperties"),!Ue(a)){this.validateSessionProps(a,"scopedProperties");const u=Object.keys(i||{}).concat(Object.keys(s||{}));if(!Object.keys(a).every(l=>u.includes(l)))throw new Error(`Scoped properties must be a subset of required/optional namespaces, received: ${JSON.stringify(a)}, required/optional namespaces: ${JSON.stringify(u)}`)}}),R(this,"validateNamespaces",(r,n)=>{const i=D_(r,"connect()",n);if(i)throw new Error(i.message)}),R(this,"isValidApprove",async r=>{if(!We(r))throw new Error(T("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o,scopedProperties:a}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const c=this.client.proposal.get(n),u=io(i,"approve()");if(u)throw new Error(u.message);const l=Cu(c.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!be(s,!0)){const{message:h}=T("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(h)}if(Ue(o)||this.validateSessionProps(o,"sessionProperties"),!Ue(a)){this.validateSessionProps(a,"scopedProperties");const h=new Set(Object.keys(i));if(!Object.keys(a).every(f=>h.has(f)))throw new Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(a)}, approved namespaces: ${Array.from(h).join(", ")}`)}}),R(this,"isValidReject",async r=>{if(!We(r)){const{message:s}=T("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!C_(i)){const{message:s}=T("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}}),R(this,"isValidSessionSettleRequest",r=>{if(!We(r)){const{message:u}=T("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(u)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!nd(n)){const{message:u}=T("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(u)}const a=__(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const c=io(s,"onSessionSettleRequest()");if(c)throw new Error(c.message);if(Yt(o)){const{message:u}=T("EXPIRED","onSessionSettleRequest()");throw new Error(u)}}),R(this,"isValidUpdate",async r=>{if(!We(r)){const{message:c}=T("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(c)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=io(i,"update()");if(o)throw new Error(o.message);const a=Cu(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)}),R(this,"isValidExtend",async r=>{if(!We(r)){const{message:i}=T("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)}),R(this,"isValidRequest",async r=>{if(!We(r)){const{message:c}=T("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(c)}const{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!Au(a,s)){const{message:c}=T("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(c)}if(!L_(i)){const{message:c}=T("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(c)}if(!T_(a,s,i.method)){const{message:c}=T("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(c)}if(o&&!U_(o,go)){const{message:c}=T("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${go.min} and ${go.max}`);throw new Error(c)}}),R(this,"isValidRespond",async r=>{var n;if(!We(r)){const{message:o}=T("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r==null?void 0:r.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!R_(s)){const{message:o}=T("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}}),R(this,"isValidPing",async r=>{if(!We(r)){const{message:i}=T("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)}),R(this,"isValidEmit",async r=>{if(!We(r)){const{message:a}=T("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!Au(o,s)){const{message:a}=T("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!N_(i)){const{message:a}=T("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!j_(o,s,i.name)){const{message:a}=T("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}}),R(this,"isValidDisconnect",async r=>{if(!We(r)){const{message:i}=T("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)}),R(this,"isValidAuthenticate",r=>{const{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!be(i,!1))throw new Error("uri is required parameter");if(!be(s,!1))throw new Error("domain is required parameter");if(!be(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(c=>en(c).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=en(n[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),R(this,"getVerifyContext",async r=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:a}=r,c={verified:{verifyUrl:o.verifyUrl||qn,validation:"UNKNOWN",origin:o.url||""}};try{if(a===ye.link_mode){const l=this.getAppLinkIfEnabled(o,a);return c.verified.validation=l&&new URL(l).origin===new URL(o.url).origin?"VALID":"INVALID",c}const u=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});u&&(c.verified.origin=u.origin,c.verified.isScam=u.isScam,c.verified.validation=u.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(u){this.client.logger.warn(u)}return this.client.logger.debug(`Verify context: ${JSON.stringify(c)}`),c}),R(this,"validateSessionProps",(r,n)=>{Object.values(r).forEach((i,s)=>{if(i==null){const{message:o}=T("MISSING_OR_INVALID",`${n} must contain an existing value for each key. Received: ${i} for key ${Object.keys(r)[s]}`);throw new Error(o)}})}),R(this,"getPendingAuthRequest",r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0}),R(this,"addToRecentlyDeleted",(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}}),R(this,"checkRecentlyDeleted",r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=T("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}}),R(this,"isLinkModeEnabled",(r,n)=>{var i,s,o,a,c,u,l,h,f;return!r||n!==ye.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((u=(c=this.client.metadata)==null?void 0:c.redirect)==null?void 0:u.universal)!==""&&((l=r==null?void 0:r.redirect)==null?void 0:l.universal)!==void 0&&((h=r==null?void 0:r.redirect)==null?void 0:h.universal)!==""&&((f=r==null?void 0:r.redirect)==null?void 0:f.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"}),R(this,"getAppLinkIfEnabled",(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r==null?void 0:r.redirect)==null?void 0:i.universal:void 0}),R(this,"handleLinkModeMessage",({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const n=Vc(r,"topic")||"",i=decodeURIComponent(Vc(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:ye.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})}),R(this,"registerLinkModeListeners",async()=>{var r;if(Ea()||tr()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}),R(this,"shouldSetTVF",(r,n)=>{if(!n||r!=="wc_sessionRequest")return!1;const{request:i}=n;return Object.keys(jl).includes(i.method)}),R(this,"getTVFParams",(r,n,i)=>{var s,o;try{const a=n.request.method,c=this.extractTxHashesFromResult(a,i);return ke(fe({correlationId:r,rpcMethods:[a],chainId:n.chainId},this.isValidContractData(n.request.params)&&{contractAddresses:[(o=(s=n.request.params)==null?void 0:s[0])==null?void 0:o.to]}),{txHashes:c})}catch(a){this.client.logger.warn("Error getting TVF params",a)}return{}}),R(this,"isValidContractData",r=>{var n;if(!r)return!1;try{const i=(r==null?void 0:r.data)||((n=r==null?void 0:r[0])==null?void 0:n.data);if(!i.startsWith("0x"))return!1;const s=i.slice(2);return/^[0-9a-fA-F]*$/.test(s)?s.length%2===0:!1}catch{}return!1}),R(this,"extractTxHashesFromResult",(r,n)=>{try{const i=jl[r];if(typeof n=="string")return[n];const s=n[i.key];if(vt(s))return r==="solana_signAllTransactions"?s.map(o=>sE(o)):s;if(typeof s=="string")return[s]}catch(i){this.client.logger.warn("Error extracting tx hashes from result",i)}return[]})}async processPendingMessageEvents(){try{const e=this.client.session.keys,r=this.client.core.relayer.messages.getWithoutAck(e);for(const[n,i]of Object.entries(r))for(const s of i)try{await this.onProviderMessageEvent({topic:n,message:s,publishedAt:Date.now()})}catch{this.client.logger.warn(`Error processing pending message event for topic: ${n}, message: ${s}`)}}catch(e){this.client.logger.warn("processPendingMessageEvents failed",e)}}isInitialized(){if(!this.initialized){const{message:e}=T("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Se.message,e=>{this.onProviderMessageEvent(e)})}async onRelayMessage(e){const{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(qi)?this.client.auth.authKeys.get(qi):{responseTopic:void 0,publicKey:void 0};try{const a=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===ye.link_mode?Jt:wt});Na(a)?(this.client.core.history.set(r,a),await this.onRelayEventRequest({topic:r,payload:a,attestation:i,transportType:s,encryptedId:xt(n)})):Is(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:s}),this.client.core.history.delete(r,a.id)):await this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:s}),await this.client.core.relayer.messages.ack(r,n)}catch(a){this.client.logger.error(a)}}registerExpirerEvents(){this.client.core.expirer.on(ct.expired,async e=>{const{topic:r,id:n}=_f(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,T("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,T("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(lr.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(lr.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!be(e,!1)){const{message:r}=T("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=T("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(Yt(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=T("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!be(e,!1)){const{message:r}=T("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=T("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(Yt(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=T("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=T("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(be(e,!1)){const{message:r}=T("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=T("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!A_(e)){const{message:r}=T("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=T("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(Yt(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=T("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class GD extends Ir{constructor(e,r){super(e,r,LD,Ba),this.core=e,this.logger=r}}let YD=class extends Ir{constructor(e,r){super(e,r,RD,Ba),this.core=e,this.logger=r}};class JD extends Ir{constructor(e,r){super(e,r,TD,Ba,n=>n.id),this.core=e,this.logger=r}}class ZD extends Ir{constructor(e,r){super(e,r,UD,xs,()=>qi),this.core=e,this.logger=r}}class QD extends Ir{constructor(e,r){super(e,r,FD,xs),this.core=e,this.logger=r}}class XD extends Ir{constructor(e,r){super(e,r,kD,xs,n=>n.id),this.core=e,this.logger=r}}var ex=Object.defineProperty,tx=(t,e,r)=>e in t?ex(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,yo=(t,e,r)=>tx(t,typeof e!="symbol"?e+"":e,r);class rx{constructor(e,r){this.core=e,this.logger=r,yo(this,"authKeys"),yo(this,"pairingTopics"),yo(this,"requests"),this.authKeys=new ZD(this.core,this.logger),this.pairingTopics=new QD(this.core,this.logger),this.requests=new XD(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}var nx=Object.defineProperty,ix=(t,e,r)=>e in t?nx(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,W=(t,e,r)=>ix(t,typeof e!="symbol"?e+"":e,r);let sx=class Ap extends jO{constructor(e){super(e),W(this,"protocol",Sp),W(this,"version",Dp),W(this,"name",po.name),W(this,"metadata"),W(this,"core"),W(this,"logger"),W(this,"events",new Pp.EventEmitter),W(this,"engine"),W(this,"session"),W(this,"proposal"),W(this,"pendingRequest"),W(this,"auth"),W(this,"signConfig"),W(this,"on",(n,i)=>this.events.on(n,i)),W(this,"once",(n,i)=>this.events.once(n,i)),W(this,"off",(n,i)=>this.events.off(n,i)),W(this,"removeListener",(n,i)=>this.events.removeListener(n,i)),W(this,"removeAllListeners",n=>this.events.removeAllListeners(n)),W(this,"connect",async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}}),W(this,"pair",async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}}),W(this,"approve",async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}}),W(this,"reject",async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}}),W(this,"update",async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}}),W(this,"extend",async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}}),W(this,"request",async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}}),W(this,"respond",async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}}),W(this,"ping",async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}}),W(this,"emit",async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}}),W(this,"disconnect",async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}}),W(this,"find",n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}}),W(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}}),W(this,"authenticate",async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}}),W(this,"formatAuthMessage",n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}}),W(this,"approveSessionAuthenticate",async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}}),W(this,"rejectSessionAuthenticate",async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}}),this.name=(e==null?void 0:e.name)||po.name,this.metadata=w0(e==null?void 0:e.metadata),this.signConfig=e==null?void 0:e.signConfig;const r=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:ui(bs({level:(e==null?void 0:e.logger)||po.logger}));this.core=(e==null?void 0:e.core)||new OD(e),this.logger=ze(r,this.name),this.session=new YD(this.core,this.logger),this.proposal=new GD(this.core,this.logger),this.pendingRequest=new JD(this.core,this.logger),this.engine=new WD(this),this.auth=new rx(this.core,this.logger)}static async init(e){const r=new Ap(e);return await r.initialize(),r}get context(){return Je(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),setTimeout(()=>{this.engine.processRelayMessageCache()},N.toMiliseconds(N.ONE_SECOND))}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}};var Ma={exports:{}},cn=typeof Reflect=="object"?Reflect:null,Ml=cn&&typeof cn.apply=="function"?cn.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},zi;cn&&typeof cn.ownKeys=="function"?zi=cn.ownKeys:Object.getOwnPropertySymbols?zi=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:zi=function(e){return Object.getOwnPropertyNames(e)};function ox(t){console&&console.warn&&console.warn(t)}var Cp=Number.isNaN||function(e){return e!==e};function ue(){ue.init.call(this)}Ma.exports=ue;Ma.exports.once=lx;ue.EventEmitter=ue;ue.prototype._events=void 0;ue.prototype._eventsCount=0;ue.prototype._maxListeners=void 0;var Ul=10;function As(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(ue,"defaultMaxListeners",{enumerable:!0,get:function(){return Ul},set:function(t){if(typeof t!="number"||t<0||Cp(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Ul=t}});ue.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};ue.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Cp(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function Lp(t){return t._maxListeners===void 0?ue.defaultMaxListeners:t._maxListeners}ue.prototype.getMaxListeners=function(){return Lp(this)};ue.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[e];if(c===void 0)return!1;if(typeof c=="function")Ml(c,this,r);else for(var u=c.length,l=Bp(c,u),n=0;n<u;++n)Ml(l[n],this,r);return!0};function Rp(t,e,r,n){var i,s,o;if(As(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=Lp(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,ox(a)}return t}ue.prototype.addListener=function(e,r){return Rp(this,e,r,!1)};ue.prototype.on=ue.prototype.addListener;ue.prototype.prependListener=function(e,r){return Rp(this,e,r,!0)};function ax(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Np(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=ax.bind(n);return i.listener=r,n.wrapFn=i,i}ue.prototype.once=function(e,r){return As(r),this.on(e,Np(this,e,r)),this};ue.prototype.prependOnceListener=function(e,r){return As(r),this.prependListener(e,Np(this,e,r)),this};ue.prototype.removeListener=function(e,r){var n,i,s,o,a;if(As(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():cx(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};ue.prototype.off=ue.prototype.removeListener;ue.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function Tp(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?ux(i):Bp(i,i.length)}ue.prototype.listeners=function(e){return Tp(this,e,!0)};ue.prototype.rawListeners=function(e){return Tp(this,e,!1)};ue.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):jp.call(t,e)};ue.prototype.listenerCount=jp;function jp(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}ue.prototype.eventNames=function(){return this._eventsCount>0?zi(this._events):[]};function Bp(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function cx(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function ux(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function lx(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}Mp(t,e,s,{once:!0}),e!=="error"&&hx(t,i,{once:!0})})}function hx(t,e,r){typeof t.on=="function"&&Mp(t,"error",e,r)}function Mp(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var fx=Ma.exports,sa={exports:{}};(function(t,e){var r=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Dt<"u"&&Dt,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a=typeof s<"u"&&s||typeof self<"u"&&self||typeof Dt<"u"&&Dt||{},c={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function u(g){return g&&DataView.prototype.isPrototypeOf(g)}if(c.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(g){return g&&l.indexOf(Object.prototype.toString.call(g))>-1};function f(g){if(typeof g!="string"&&(g=String(g)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(g)||g==="")throw new TypeError('Invalid character in header field name: "'+g+'"');return g.toLowerCase()}function p(g){return typeof g!="string"&&(g=String(g)),g}function d(g){var m={next:function(){var _=g.shift();return{done:_===void 0,value:_}}};return c.iterable&&(m[Symbol.iterator]=function(){return m}),m}function y(g){this.map={},g instanceof y?g.forEach(function(m,_){this.append(_,m)},this):Array.isArray(g)?g.forEach(function(m){if(m.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+m.length);this.append(m[0],m[1])},this):g&&Object.getOwnPropertyNames(g).forEach(function(m){this.append(m,g[m])},this)}y.prototype.append=function(g,m){g=f(g),m=p(m);var _=this.map[g];this.map[g]=_?_+", "+m:m},y.prototype.delete=function(g){delete this.map[f(g)]},y.prototype.get=function(g){return g=f(g),this.has(g)?this.map[g]:null},y.prototype.has=function(g){return this.map.hasOwnProperty(f(g))},y.prototype.set=function(g,m){this.map[f(g)]=p(m)},y.prototype.forEach=function(g,m){for(var _ in this.map)this.map.hasOwnProperty(_)&&g.call(m,this.map[_],_,this)},y.prototype.keys=function(){var g=[];return this.forEach(function(m,_){g.push(_)}),d(g)},y.prototype.values=function(){var g=[];return this.forEach(function(m){g.push(m)}),d(g)},y.prototype.entries=function(){var g=[];return this.forEach(function(m,_){g.push([_,m])}),d(g)},c.iterable&&(y.prototype[Symbol.iterator]=y.prototype.entries);function w(g){if(!g._noBody){if(g.bodyUsed)return Promise.reject(new TypeError("Already read"));g.bodyUsed=!0}}function b(g){return new Promise(function(m,_){g.onload=function(){m(g.result)},g.onerror=function(){_(g.error)}})}function v(g){var m=new FileReader,_=b(m);return m.readAsArrayBuffer(g),_}function E(g){var m=new FileReader,_=b(m),P=/charset=([A-Za-z0-9_-]+)/.exec(g.type),O=P?P[1]:"utf-8";return m.readAsText(g,O),_}function $(g){for(var m=new Uint8Array(g),_=new Array(m.length),P=0;P<m.length;P++)_[P]=String.fromCharCode(m[P]);return _.join("")}function D(g){if(g.slice)return g.slice(0);var m=new Uint8Array(g.byteLength);return m.set(new Uint8Array(g)),m.buffer}function x(){return this.bodyUsed=!1,this._initBody=function(g){this.bodyUsed=this.bodyUsed,this._bodyInit=g,g?typeof g=="string"?this._bodyText=g:c.blob&&Blob.prototype.isPrototypeOf(g)?this._bodyBlob=g:c.formData&&FormData.prototype.isPrototypeOf(g)?this._bodyFormData=g:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(g)?this._bodyText=g.toString():c.arrayBuffer&&c.blob&&u(g)?(this._bodyArrayBuffer=D(g.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(g)||h(g))?this._bodyArrayBuffer=D(g):this._bodyText=g=Object.prototype.toString.call(g):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof g=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):c.searchParams&&URLSearchParams.prototype.isPrototypeOf(g)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var g=w(this);if(g)return g;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var g=w(this);return g||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(c.blob)return this.blob().then(v);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var g=w(this);if(g)return g;if(this._bodyBlob)return E(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve($(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c.formData&&(this.formData=function(){return this.text().then(k)}),this.json=function(){return this.text().then(JSON.parse)},this}var S=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function C(g){var m=g.toUpperCase();return S.indexOf(m)>-1?m:g}function I(g,m){if(!(this instanceof I))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');m=m||{};var _=m.body;if(g instanceof I){if(g.bodyUsed)throw new TypeError("Already read");this.url=g.url,this.credentials=g.credentials,m.headers||(this.headers=new y(g.headers)),this.method=g.method,this.mode=g.mode,this.signal=g.signal,!_&&g._bodyInit!=null&&(_=g._bodyInit,g.bodyUsed=!0)}else this.url=String(g);if(this.credentials=m.credentials||this.credentials||"same-origin",(m.headers||!this.headers)&&(this.headers=new y(m.headers)),this.method=C(m.method||this.method||"GET"),this.mode=m.mode||this.mode||null,this.signal=m.signal||this.signal||function(){if("AbortController"in a){var A=new AbortController;return A.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&_)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(_),(this.method==="GET"||this.method==="HEAD")&&(m.cache==="no-store"||m.cache==="no-cache")){var P=/([?&])_=[^&]*/;if(P.test(this.url))this.url=this.url.replace(P,"$1_="+new Date().getTime());else{var O=/\?/;this.url+=(O.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}I.prototype.clone=function(){return new I(this,{body:this._bodyInit})};function k(g){var m=new FormData;return g.trim().split("&").forEach(function(_){if(_){var P=_.split("="),O=P.shift().replace(/\+/g," "),A=P.join("=").replace(/\+/g," ");m.append(decodeURIComponent(O),decodeURIComponent(A))}}),m}function B(g){var m=new y,_=g.replace(/\r?\n[\t ]+/g," ");return _.split("\r").map(function(P){return P.indexOf(`
|
|
39
|
-
`)===0?P.substr(1,P.length):P}).forEach(function(P){var O=P.split(":"),A=O.shift().trim();if(A){var M=O.join(":").trim();try{m.append(A,M)}catch(F){console.warn("Response "+F.message)}}}),m}x.call(I.prototype);function j(g,m){if(!(this instanceof j))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(m||(m={}),this.type="default",this.status=m.status===void 0?200:m.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=m.statusText===void 0?"":""+m.statusText,this.headers=new y(m.headers),this.url=m.url||"",this._initBody(g)}x.call(j.prototype),j.prototype.clone=function(){return new j(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new y(this.headers),url:this.url})},j.error=function(){var g=new j(null,{status:200,statusText:""});return g.ok=!1,g.status=0,g.type="error",g};var q=[301,302,303,307,308];j.redirect=function(g,m){if(q.indexOf(m)===-1)throw new RangeError("Invalid status code");return new j(null,{status:m,headers:{location:g}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(m,_){this.message=m,this.name=_;var P=Error(m);this.stack=P.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function L(g,m){return new Promise(function(_,P){var O=new I(g,m);if(O.signal&&O.signal.aborted)return P(new o.DOMException("Aborted","AbortError"));var A=new XMLHttpRequest;function M(){A.abort()}A.onload=function(){var U={statusText:A.statusText,headers:B(A.getAllResponseHeaders()||"")};O.url.indexOf("file://")===0&&(A.status<200||A.status>599)?U.status=200:U.status=A.status,U.url="responseURL"in A?A.responseURL:U.headers.get("X-Request-URL");var H="response"in A?A.response:A.responseText;setTimeout(function(){_(new j(H,U))},0)},A.onerror=function(){setTimeout(function(){P(new TypeError("Network request failed"))},0)},A.ontimeout=function(){setTimeout(function(){P(new TypeError("Network request timed out"))},0)},A.onabort=function(){setTimeout(function(){P(new o.DOMException("Aborted","AbortError"))},0)};function F(U){try{return U===""&&a.location.href?a.location.href:U}catch{return U}}if(A.open(O.method,F(O.url),!0),O.credentials==="include"?A.withCredentials=!0:O.credentials==="omit"&&(A.withCredentials=!1),"responseType"in A&&(c.blob?A.responseType="blob":c.arrayBuffer&&(A.responseType="arraybuffer")),m&&typeof m.headers=="object"&&!(m.headers instanceof y||a.Headers&&m.headers instanceof a.Headers)){var z=[];Object.getOwnPropertyNames(m.headers).forEach(function(U){z.push(f(U)),A.setRequestHeader(U,p(m.headers[U]))}),O.headers.forEach(function(U,H){z.indexOf(H)===-1&&A.setRequestHeader(H,U)})}else O.headers.forEach(function(U,H){A.setRequestHeader(H,U)});O.signal&&(O.signal.addEventListener("abort",M),A.onreadystatechange=function(){A.readyState===4&&O.signal.removeEventListener("abort",M)}),A.send(typeof O._bodyInit>"u"?null:O._bodyInit)})}return L.polyfill=!0,a.fetch||(a.fetch=L,a.Headers=y,a.Request=I,a.Response=j),o.Headers=y,o.Request=I,o.Response=j,o.fetch=L,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=r.fetch?r:n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(sa,sa.exports);var dx=sa.exports;const Fl=ei(dx);var px=Object.defineProperty,gx=Object.defineProperties,yx=Object.getOwnPropertyDescriptors,kl=Object.getOwnPropertySymbols,mx=Object.prototype.hasOwnProperty,wx=Object.prototype.propertyIsEnumerable,ql=(t,e,r)=>e in t?px(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,zl=(t,e)=>{for(var r in e||(e={}))mx.call(e,r)&&ql(t,r,e[r]);if(kl)for(var r of kl(e))wx.call(e,r)&&ql(t,r,e[r]);return t},Hl=(t,e)=>gx(t,yx(e));const vx={Accept:"application/json","Content-Type":"application/json"},bx="POST",Kl={headers:vx,method:bx},Vl=10;let bt=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new fx.EventEmitter,this.isAvailable=!1,this.registering=!1,!tl(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=Ht(e),n=await(await Fl(this.url,Hl(zl({},Kl),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!tl(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=Ht({id:1,jsonrpc:"2.0",method:"test",params:[]});await Fl(e,Hl(zl({},Kl),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?mr(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Os(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return zd(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>Vl&&this.events.setMaxListeners(Vl)}};var Ua={exports:{}},un=typeof Reflect=="object"?Reflect:null,Wl=un&&typeof un.apply=="function"?un.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Hi;un&&typeof un.ownKeys=="function"?Hi=un.ownKeys:Object.getOwnPropertySymbols?Hi=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Hi=function(e){return Object.getOwnPropertyNames(e)};function Ex(t){console&&console.warn&&console.warn(t)}var Up=Number.isNaN||function(e){return e!==e};function le(){le.init.call(this)}Ua.exports=le;Ua.exports.once=Ix;le.EventEmitter=le;le.prototype._events=void 0;le.prototype._eventsCount=0;le.prototype._maxListeners=void 0;var Gl=10;function Cs(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(le,"defaultMaxListeners",{enumerable:!0,get:function(){return Gl},set:function(t){if(typeof t!="number"||t<0||Up(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Gl=t}});le.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};le.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Up(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function Fp(t){return t._maxListeners===void 0?le.defaultMaxListeners:t._maxListeners}le.prototype.getMaxListeners=function(){return Fp(this)};le.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[e];if(c===void 0)return!1;if(typeof c=="function")Wl(c,this,r);else for(var u=c.length,l=Kp(c,u),n=0;n<u;++n)Wl(l[n],this,r);return!0};function kp(t,e,r,n){var i,s,o;if(Cs(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=Fp(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,Ex(a)}return t}le.prototype.addListener=function(e,r){return kp(this,e,r,!1)};le.prototype.on=le.prototype.addListener;le.prototype.prependListener=function(e,r){return kp(this,e,r,!0)};function _x(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function qp(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=_x.bind(n);return i.listener=r,n.wrapFn=i,i}le.prototype.once=function(e,r){return Cs(r),this.on(e,qp(this,e,r)),this};le.prototype.prependOnceListener=function(e,r){return Cs(r),this.prependListener(e,qp(this,e,r)),this};le.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Cs(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():$x(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};le.prototype.off=le.prototype.removeListener;le.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function zp(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?Ox(i):Kp(i,i.length)}le.prototype.listeners=function(e){return zp(this,e,!0)};le.prototype.rawListeners=function(e){return zp(this,e,!1)};le.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Hp.call(t,e)};le.prototype.listenerCount=Hp;function Hp(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}le.prototype.eventNames=function(){return this._eventsCount>0?Hi(this._events):[]};function Kp(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function $x(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Ox(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Ix(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}Vp(t,e,s,{once:!0}),e!=="error"&&Px(t,i,{once:!0})})}function Px(t,e,r){typeof t.on=="function"&&Vp(t,"error",e,r)}function Vp(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var Sx=Ua.exports;const Dx=ei(Sx),Yl="error",xx="wss://relay.walletconnect.org",Ax="wc",Cx="universal_provider",Oi=`${Ax}@2:${Cx}:`,Wp="https://rpc.walletconnect.org/v1/",Yr="generic",Lx=`${Wp}bundler`,ft={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};function Rx(){}function Fa(t){return t==null||typeof t!="object"&&typeof t!="function"}function ka(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Nx(t){if(Fa(t))return t;if(Array.isArray(t)||ka(t)||t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);const e=Object.getPrototypeOf(t),r=e.constructor;if(t instanceof Date||t instanceof Map||t instanceof Set)return new r(t);if(t instanceof RegExp){const n=new r(t);return n.lastIndex=t.lastIndex,n}if(t instanceof DataView)return new r(t.buffer.slice(0));if(t instanceof Error){const n=new r(t.message);return n.stack=t.stack,n.name=t.name,n.cause=t.cause,n}if(typeof File<"u"&&t instanceof File)return new r([t],t.name,{type:t.type,lastModified:t.lastModified});if(typeof t=="object"){const n=Object.create(e);return Object.assign(n,t)}return t}function Jl(t){return typeof t=="object"&&t!==null}function Gp(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function Yp(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const Tx="[object RegExp]",Jp="[object String]",Zp="[object Number]",Qp="[object Boolean]",Xp="[object Arguments]",jx="[object Symbol]",Bx="[object Date]",Mx="[object Map]",Ux="[object Set]",Fx="[object Array]",kx="[object ArrayBuffer]",qx="[object Object]",zx="[object DataView]",Hx="[object Uint8Array]",Kx="[object Uint8ClampedArray]",Vx="[object Uint16Array]",Wx="[object Uint32Array]",Gx="[object Int8Array]",Yx="[object Int16Array]",Jx="[object Int32Array]",Zx="[object Float32Array]",Qx="[object Float64Array]";function Xx(t,e){return Qr(t,void 0,t,new Map,e)}function Qr(t,e,r,n=new Map,i=void 0){const s=i==null?void 0:i(t,e,r,n);if(s!=null)return s;if(Fa(t))return t;if(n.has(t))return n.get(t);if(Array.isArray(t)){const o=new Array(t.length);n.set(t,o);for(let a=0;a<t.length;a++)o[a]=Qr(t[a],a,r,n,i);return Object.hasOwn(t,"index")&&(o.index=t.index),Object.hasOwn(t,"input")&&(o.input=t.input),o}if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){const o=new RegExp(t.source,t.flags);return o.lastIndex=t.lastIndex,o}if(t instanceof Map){const o=new Map;n.set(t,o);for(const[a,c]of t)o.set(a,Qr(c,a,r,n,i));return o}if(t instanceof Set){const o=new Set;n.set(t,o);for(const a of t)o.add(Qr(a,void 0,r,n,i));return o}if(typeof Buffer<"u"&&Buffer.isBuffer(t))return t.subarray();if(ka(t)){const o=new(Object.getPrototypeOf(t)).constructor(t.length);n.set(t,o);for(let a=0;a<t.length;a++)o[a]=Qr(t[a],a,r,n,i);return o}if(t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);if(t instanceof DataView){const o=new DataView(t.buffer.slice(0),t.byteOffset,t.byteLength);return n.set(t,o),hr(o,t,r,n,i),o}if(typeof File<"u"&&t instanceof File){const o=new File([t],t.name,{type:t.type});return n.set(t,o),hr(o,t,r,n,i),o}if(t instanceof Blob){const o=new Blob([t],{type:t.type});return n.set(t,o),hr(o,t,r,n,i),o}if(t instanceof Error){const o=new t.constructor;return n.set(t,o),o.message=t.message,o.name=t.name,o.stack=t.stack,o.cause=t.cause,hr(o,t,r,n,i),o}if(typeof t=="object"&&eA(t)){const o=Object.create(Object.getPrototypeOf(t));return n.set(t,o),hr(o,t,r,n,i),o}return t}function hr(t,e,r=t,n,i){const s=[...Object.keys(e),...Gp(e)];for(let o=0;o<s.length;o++){const a=s[o],c=Object.getOwnPropertyDescriptor(t,a);(c==null||c.writable)&&(t[a]=Qr(e[a],a,r,n,i))}}function eA(t){switch(Yp(t)){case Xp:case Fx:case kx:case zx:case Qp:case Bx:case Zx:case Qx:case Gx:case Yx:case Jx:case Mx:case Zp:case qx:case Tx:case Ux:case Jp:case jx:case Hx:case Kx:case Vx:case Wx:return!0;default:return!1}}function tA(t,e){return Xx(t,(r,n,i,s)=>{if(typeof t=="object")switch(Object.prototype.toString.call(t)){case Zp:case Jp:case Qp:{const o=new t.constructor(t==null?void 0:t.valueOf());return hr(o,t),o}case Xp:{const o={};return hr(o,t),o.length=t.length,o[Symbol.iterator]=t[Symbol.iterator],o}default:return}})}function Zl(t){return tA(t)}function Ql(t){return t!==null&&typeof t=="object"&&Yp(t)==="[object Arguments]"}function rA(t){return ka(t)}function nA(t){var r;if(typeof t!="object"||t==null)return!1;if(Object.getPrototypeOf(t)===null)return!0;if(Object.prototype.toString.call(t)!=="[object Object]"){const n=t[Symbol.toStringTag];return n==null||!((r=Object.getOwnPropertyDescriptor(t,Symbol.toStringTag))!=null&&r.writable)?!1:t.toString()===`[object ${n}]`}let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function iA(t,...e){const r=e.slice(0,-1),n=e[e.length-1];let i=t;for(let s=0;s<r.length;s++){const o=r[s];i=oa(i,o,n,new Map)}return i}function oa(t,e,r,n){if(Fa(t)&&(t=Object(t)),e==null||typeof e!="object")return t;if(n.has(e))return Nx(n.get(e));if(n.set(e,t),Array.isArray(e)){e=e.slice();for(let s=0;s<e.length;s++)e[s]=e[s]??void 0}const i=[...Object.keys(e),...Gp(e)];for(let s=0;s<i.length;s++){const o=i[s];let a=e[o],c=t[o];if(Ql(a)&&(a={...a}),Ql(c)&&(c={...c}),typeof Buffer<"u"&&Buffer.isBuffer(a)&&(a=Zl(a)),Array.isArray(a))if(typeof c=="object"&&c!=null){const l=[],h=Reflect.ownKeys(c);for(let f=0;f<h.length;f++){const p=h[f];l[p]=c[p]}c=l}else c=[];const u=r(c,a,o,t,e,n);u!=null?t[o]=u:Array.isArray(a)||Jl(c)&&Jl(a)?t[o]=oa(c,a,r,n):c==null&&nA(a)?t[o]=oa({},a,r,n):c==null&&rA(a)?t[o]=Zl(a):(c===void 0||a!==void 0)&&(t[o]=a)}return t}function sA(t,...e){return iA(t,...e,Rx)}var oA=Object.defineProperty,aA=Object.defineProperties,cA=Object.getOwnPropertyDescriptors,Xl=Object.getOwnPropertySymbols,uA=Object.prototype.hasOwnProperty,lA=Object.prototype.propertyIsEnumerable,eh=(t,e,r)=>e in t?oA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ii=(t,e)=>{for(var r in e||(e={}))uA.call(e,r)&&eh(t,r,e[r]);if(Xl)for(var r of Xl(e))lA.call(e,r)&&eh(t,r,e[r]);return t},hA=(t,e)=>aA(t,cA(e));function nt(t,e,r){var n;const i=en(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${Wp}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function Pr(t){return t.includes(":")?t.split(":")[1]:t}function eg(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function fA(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function Pi(t={},e={}){const r=th(t),n=th(e);return sA(r,n)}function th(t){var e,r,n,i,s;const o={};if(!er(t))return o;for(const[a,c]of Object.entries(t)){const u=ys(a)?[a]:c.chains,l=c.methods||[],h=c.events||[],f=c.rpcMap||{},p=Zr(a);o[p]=hA(Ii(Ii({},o[p]),c),{chains:At(u,(e=o[p])==null?void 0:e.chains),methods:At(l,(r=o[p])==null?void 0:r.methods),events:At(h,(n=o[p])==null?void 0:n.events)}),(er(f)||er(((i=o[p])==null?void 0:i.rpcMap)||{}))&&(o[p].rpcMap=Ii(Ii({},f),(s=o[p])==null?void 0:s.rpcMap))}return o}function rh(t){return t.includes(":")?t.split(":")[2]:t}function nh(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=ys(r)?[r]:n.chains?n.chains:eg(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function mo(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const tg={},Q=t=>tg[t],wo=(t,e)=>{tg[t]=e};var dA=Object.defineProperty,pA=(t,e,r)=>e in t?dA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Br=(t,e,r)=>pA(t,typeof e!="symbol"?e+"":e,r);class gA{constructor(e){Br(this,"name","polkadot"),Br(this,"client"),Br(this,"httpProviders"),Br(this,"events"),Br(this,"namespace"),Br(this,"chainId"),this.namespace=e.namespace,this.events=Q("events"),this.client=Q("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ft.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Pr(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||nt(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new ht(new bt(n,Q("disableProviderPing")))}}var yA=Object.defineProperty,mA=Object.defineProperties,wA=Object.getOwnPropertyDescriptors,ih=Object.getOwnPropertySymbols,vA=Object.prototype.hasOwnProperty,bA=Object.prototype.propertyIsEnumerable,aa=(t,e,r)=>e in t?yA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,sh=(t,e)=>{for(var r in e||(e={}))vA.call(e,r)&&aa(t,r,e[r]);if(ih)for(var r of ih(e))bA.call(e,r)&&aa(t,r,e[r]);return t},oh=(t,e)=>mA(t,wA(e)),Mr=(t,e,r)=>aa(t,typeof e!="symbol"?e+"":e,r);class EA{constructor(e){Mr(this,"name","eip155"),Mr(this,"client"),Mr(this,"chainId"),Mr(this,"namespace"),Mr(this,"httpProviders"),Mr(this,"events"),this.namespace=e.namespace,this.events=Q("events"),this.client=Q("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(ft.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||nt(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new ht(new bt(n,Q("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(Pr(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i,s,o;const a=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0],c=((s=(i=e.request)==null?void 0:i.params)==null?void 0:s[1])||[],u=`${a}${c.join(",")}`;if(!a)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const l=this.client.session.get(e.topic),h=((o=l==null?void 0:l.sessionProperties)==null?void 0:o.capabilities)||{};if(h!=null&&h[u])return h==null?void 0:h[u];const f=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:oh(sh({},l.sessionProperties||{}),{capabilities:oh(sh({},h||{}),{[u]:f})})})}catch(p){console.warn("Failed to update session with capabilities",p)}return f}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(c){console.warn("Failed to fetch call status from bundler",c,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Qt("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${Lx}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}var _A=Object.defineProperty,$A=(t,e,r)=>e in t?_A(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ur=(t,e,r)=>$A(t,typeof e!="symbol"?e+"":e,r);class OA{constructor(e){Ur(this,"name","solana"),Ur(this,"client"),Ur(this,"httpProviders"),Ur(this,"events"),Ur(this,"namespace"),Ur(this,"chainId"),this.namespace=e.namespace,this.events=Q("events"),this.client=Q("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ft.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Pr(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||nt(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new ht(new bt(n,Q("disableProviderPing")))}}var IA=Object.defineProperty,PA=(t,e,r)=>e in t?IA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Fr=(t,e,r)=>PA(t,typeof e!="symbol"?e+"":e,r);class SA{constructor(e){Fr(this,"name","cosmos"),Fr(this,"client"),Fr(this,"httpProviders"),Fr(this,"events"),Fr(this,"namespace"),Fr(this,"chainId"),this.namespace=e.namespace,this.events=Q("events"),this.client=Q("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ft.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Pr(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||nt(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new ht(new bt(n,Q("disableProviderPing")))}}var DA=Object.defineProperty,xA=(t,e,r)=>e in t?DA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,kr=(t,e,r)=>xA(t,typeof e!="symbol"?e+"":e,r);class AA{constructor(e){kr(this,"name","algorand"),kr(this,"client"),kr(this,"httpProviders"),kr(this,"events"),kr(this,"namespace"),kr(this,"chainId"),this.namespace=e.namespace,this.events=Q("events"),this.client=Q("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||nt(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(ft.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||nt(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new ht(new bt(n,Q("disableProviderPing")))}}var CA=Object.defineProperty,LA=(t,e,r)=>e in t?CA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,qr=(t,e,r)=>LA(t,typeof e!="symbol"?e+"":e,r);class RA{constructor(e){qr(this,"name","cip34"),qr(this,"client"),qr(this,"httpProviders"),qr(this,"events"),qr(this,"namespace"),qr(this,"chainId"),this.namespace=e.namespace,this.events=Q("events"),this.client=Q("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ft.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=Pr(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new ht(new bt(n,Q("disableProviderPing")))}}var NA=Object.defineProperty,TA=(t,e,r)=>e in t?NA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,zr=(t,e,r)=>TA(t,typeof e!="symbol"?e+"":e,r);class jA{constructor(e){zr(this,"name","elrond"),zr(this,"client"),zr(this,"httpProviders"),zr(this,"events"),zr(this,"namespace"),zr(this,"chainId"),this.namespace=e.namespace,this.events=Q("events"),this.client=Q("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ft.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Pr(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||nt(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new ht(new bt(n,Q("disableProviderPing")))}}var BA=Object.defineProperty,MA=(t,e,r)=>e in t?BA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Hr=(t,e,r)=>MA(t,typeof e!="symbol"?e+"":e,r);class UA{constructor(e){Hr(this,"name","multiversx"),Hr(this,"client"),Hr(this,"httpProviders"),Hr(this,"events"),Hr(this,"namespace"),Hr(this,"chainId"),this.namespace=e.namespace,this.events=Q("events"),this.client=Q("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ft.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Pr(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||nt(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new ht(new bt(n,Q("disableProviderPing")))}}var FA=Object.defineProperty,kA=(t,e,r)=>e in t?FA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Kr=(t,e,r)=>kA(t,typeof e!="symbol"?e+"":e,r);class qA{constructor(e){Kr(this,"name","near"),Kr(this,"client"),Kr(this,"httpProviders"),Kr(this,"events"),Kr(this,"namespace"),Kr(this,"chainId"),this.namespace=e.namespace,this.events=Q("events"),this.client=Q("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||nt(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(ft.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||nt(e,this.namespace);return typeof n>"u"?void 0:new ht(new bt(n,Q("disableProviderPing")))}}var zA=Object.defineProperty,HA=(t,e,r)=>e in t?zA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Vr=(t,e,r)=>HA(t,typeof e!="symbol"?e+"":e,r);class KA{constructor(e){Vr(this,"name","tezos"),Vr(this,"client"),Vr(this,"httpProviders"),Vr(this,"events"),Vr(this,"namespace"),Vr(this,"chainId"),this.namespace=e.namespace,this.events=Q("events"),this.client=Q("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||nt(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(ft.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||nt(e,this.namespace);return typeof n>"u"?void 0:new ht(new bt(n))}}var VA=Object.defineProperty,WA=(t,e,r)=>e in t?VA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Wr=(t,e,r)=>WA(t,typeof e!="symbol"?e+"":e,r);class GA{constructor(e){Wr(this,"name",Yr),Wr(this,"client"),Wr(this,"httpProviders"),Wr(this,"events"),Wr(this,"namespace"),Wr(this,"chainId"),this.namespace=e.namespace,this.events=Q("events"),this.client=Q("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(ft.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=en(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||nt(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new ht(new bt(n,Q("disableProviderPing")))}}var YA=Object.defineProperty,JA=Object.defineProperties,ZA=Object.getOwnPropertyDescriptors,ah=Object.getOwnPropertySymbols,QA=Object.prototype.hasOwnProperty,XA=Object.prototype.propertyIsEnumerable,ca=(t,e,r)=>e in t?YA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Si=(t,e)=>{for(var r in e||(e={}))QA.call(e,r)&&ca(t,r,e[r]);if(ah)for(var r of ah(e))XA.call(e,r)&&ca(t,r,e[r]);return t},vo=(t,e)=>JA(t,ZA(e)),at=(t,e,r)=>ca(t,typeof e!="symbol"?e+"":e,r);let eC=class rg{constructor(e){at(this,"client"),at(this,"namespaces"),at(this,"optionalNamespaces"),at(this,"sessionProperties"),at(this,"scopedProperties"),at(this,"events",new Dx),at(this,"rpcProviders",{}),at(this,"session"),at(this,"providerOpts"),at(this,"logger"),at(this,"uri"),at(this,"disableProviderPing",!1),this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:ui(bs({level:(e==null?void 0:e.logger)||Yl})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new rg(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:Si({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,$s(s,o))).catch(o=>r(o,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,scopedProperties:this.scopedProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:te("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=nh(this.session.namespaces);this.namespaces=Pi(this.namespaces,o),await this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){const{uri:r,approval:n}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties});r&&(this.uri=r,this.events.emit("display_uri",r));const i=await n();this.session=i;const s=nh(i.namespaces);return this.namespaces=Pi(this.namespaces,s),await this.persist("namespaces",this.namespaces),await this.persist("optionalNamespaces",this.optionalNamespaces),this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===Yr?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(vt(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.logger.warn("abortPairingAttempt is deprecated. This is now a no-op.")}async checkStorage(){this.namespaces=await this.getFromStore("namespaces")||{},this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.session&&this.createProviders()}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){var e,r;if(this.client=this.providerOpts.client||await sx.init({core:this.providerOpts.core,logger:this.providerOpts.logger||Yl,relayUrl:this.providerOpts.relayUrl||xx,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.providerOpts.session)try{this.session=this.client.session.get(this.providerOpts.session.topic)}catch(n){throw this.logger.error("Failed to get session",n),new Error(`The provided session: ${(r=(e=this.providerOpts)==null?void 0:e.session)==null?void 0:r.topic} doesn't exist in the Sign client`)}else{const n=this.client.session.getAll();this.session=n[0]}this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>Zr(r)))];wo("client",this.client),wo("events",this.events),wo("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=fA(r,this.session),i=eg(n),s=Pi(this.namespaces,this.optionalNamespaces),o=vo(Si({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new EA({namespace:o});break;case"algorand":this.rpcProviders[r]=new AA({namespace:o});break;case"solana":this.rpcProviders[r]=new OA({namespace:o});break;case"cosmos":this.rpcProviders[r]=new SA({namespace:o});break;case"polkadot":this.rpcProviders[r]=new gA({namespace:o});break;case"cip34":this.rpcProviders[r]=new RA({namespace:o});break;case"elrond":this.rpcProviders[r]=new jA({namespace:o});break;case"multiversx":this.rpcProviders[r]=new UA({namespace:o});break;case"near":this.rpcProviders[r]=new qA({namespace:o});break;case"tezos":this.rpcProviders[r]=new KA({namespace:o});break;default:this.rpcProviders[Yr]?this.rpcProviders[Yr].updateNamespace(o):this.rpcProviders[Yr]=new GA({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{var r;const{topic:n}=e;n===((r=this.session)==null?void 0:r.topic)&&this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{var r;const{params:n,topic:i}=e;if(i!==((r=this.session)==null?void 0:r.topic))return;const{event:s}=n;if(s.name==="accountsChanged"){const o=s.data;o&&vt(o)&&this.events.emit("accountsChanged",o.map(rh))}else if(s.name==="chainChanged"){const o=n.chainId,a=n.event.data,c=Zr(o),u=mo(o)!==mo(a)?`${c}:${mo(a)}`:o;this.onChainChanged(u)}else this.events.emit(s.name,s.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n,i;if(e!==((n=this.session)==null?void 0:n.topic))return;const{namespaces:s}=r,o=(i=this.client)==null?void 0:i.session.get(e);this.session=vo(Si({},o),{namespaces:s}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{var r;e.topic===((r=this.session)==null?void 0:r.topic)&&(await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",vo(Si({},te("USER_DISCONNECTED")),{data:e.topic})))}),this.on(ft.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Yr]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r={},optionalNamespaces:n={},sessionProperties:i,scopedProperties:s}=e;this.optionalNamespaces=Pi(r,n),this.sessionProperties=i,this.scopedProperties=s}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>Zr(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=Zr(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}async onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);if(!i)return;this.updateNamespaceChain(n,i),this.events.emit("chainChanged",i);const s=this.getProvider(n).getDefaultChain();r||this.getProvider(n).setDefaultChain(i),this.emitAccountsChangedOnChainChange({namespace:n,previousChainId:s,newChainId:e}),await this.persist("namespaces",this.namespaces)}emitAccountsChangedOnChainChange({namespace:e,previousChainId:r,newChainId:n}){var i,s;try{if(r===n)return;const o=(s=(i=this.session)==null?void 0:i.namespaces[e])==null?void 0:s.accounts;if(!o)return;const a=o.filter(c=>c.includes(`${n}:`)).map(rh);if(!vt(a))return;this.events.emit("accountsChanged",a)}catch(o){this.logger.warn("Failed to emit accountsChanged on chain change",o)}}updateNamespaceChain(e,r){if(!this.namespaces)return;const n=this.namespaces[e]?e:`${e}:${r}`,i={chains:[],methods:[],events:[],defaultChain:r};this.namespaces[n]?this.namespaces[n]&&(this.namespaces[n].defaultChain=r):this.namespaces[n]=i}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,await this.deleteFromStore("namespaces"),await this.deleteFromStore("optionalNamespaces"),await this.deleteFromStore("sessionProperties"),this.session=void 0,await this.cleanupPendingPairings({deletePairings:!0}),await this.cleanupStorage()}async persist(e,r){var n;const i=((n=this.session)==null?void 0:n.topic)||"";await this.client.core.storage.setItem(`${Oi}/${e}${i}`,r)}async getFromStore(e){var r;const n=((r=this.session)==null?void 0:r.topic)||"";return await this.client.core.storage.getItem(`${Oi}/${e}${n}`)}async deleteFromStore(e){var r;const n=((r=this.session)==null?void 0:r.topic)||"";await this.client.core.storage.removeItem(`${Oi}/${e}${n}`)}async cleanupStorage(){var e;try{if(((e=this.client)==null?void 0:e.session.length)>0)return;const r=await this.client.core.storage.getKeys();for(const n of r)n.startsWith(Oi)&&await this.client.core.storage.removeItem(n)}catch(r){this.logger.warn("Failed to cleanup storage",r)}}};const tC=eC,rC="wc",nC="ethereum_provider",iC=`${rC}@2:${nC}:`,sC="https://rpc.walletconnect.org/v1/",ts=["eth_sendTransaction","personal_sign"],ng=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],rs=["chainChanged","accountsChanged"],ig=["chainChanged","accountsChanged","message","disconnect","connect"],oC=async()=>{const{createAppKit:t}=await fh(()=>import("./core-U204j_bI.js").then(e=>e.X),__vite__mapDeps([3,1,2]));return t};var aC=Object.defineProperty,cC=Object.defineProperties,uC=Object.getOwnPropertyDescriptors,ch=Object.getOwnPropertySymbols,lC=Object.prototype.hasOwnProperty,hC=Object.prototype.propertyIsEnumerable,ua=(t,e,r)=>e in t?aC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ar=(t,e)=>{for(var r in e||(e={}))lC.call(e,r)&&ua(t,r,e[r]);if(ch)for(var r of ch(e))hC.call(e,r)&&ua(t,r,e[r]);return t},jn=(t,e)=>cC(t,uC(e)),Qe=(t,e,r)=>ua(t,typeof e!="symbol"?e+"":e,r);function ns(t){return Number(t[0].split(":")[1])}function Di(t){return`0x${t.toString(16)}`}function fC(t){const{chains:e,optionalChains:r,methods:n,optionalMethods:i,events:s,optionalEvents:o,rpcMap:a}=t;if(!vt(e))throw new Error("Invalid chains");const c={chains:e,methods:n||ts,events:s||rs,rpcMap:ar({},e.length?{[ns(e)]:a[ns(e)]}:{})},u=s==null?void 0:s.filter(p=>!rs.includes(p)),l=n==null?void 0:n.filter(p=>!ts.includes(p));if(!r&&!o&&!i&&!(u!=null&&u.length)&&!(l!=null&&l.length))return{required:e.length?c:void 0};const h=(u==null?void 0:u.length)&&(l==null?void 0:l.length)||!r,f={chains:[...new Set(h?c.chains.concat(r||[]):r)],methods:[...new Set(c.methods.concat(i!=null&&i.length?i:ng))],events:[...new Set(c.events.concat(o!=null&&o.length?o:ig))],rpcMap:a};return{required:e.length?c:void 0,optional:r.length?f:void 0}}class Ls{constructor(){Qe(this,"events",new Ig.EventEmitter),Qe(this,"namespace","eip155"),Qe(this,"accounts",[]),Qe(this,"signer"),Qe(this,"chainId",1),Qe(this,"modal"),Qe(this,"rpc"),Qe(this,"STORAGE_KEY",iC),Qe(this,"on",(e,r)=>(this.events.on(e,r),this)),Qe(this,"once",(e,r)=>(this.events.once(e,r),this)),Qe(this,"removeListener",(e,r)=>(this.events.removeListener(e,r),this)),Qe(this,"off",(e,r)=>(this.events.off(e,r),this)),Qe(this,"parseAccount",e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e),this.signer={},this.rpc={}}static async init(e){const r=new Ls;return await r.initialize(e),r}async request(e,r){return await this.signer.request(e,this.formatChainId(this.chainId),r)}sendAsync(e,r,n){this.signer.sendAsync(e,r,this.formatChainId(this.chainId),n)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){var r;if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:n,optional:i}=fC(this.rpc);try{const s=await new Promise(async(a,c)=>{var u,l;this.rpc.showQrModal&&((u=this.modal)==null||u.open(),(l=this.modal)==null||l.subscribeState(f=>{!f.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),c(new Error("Connection request reset. Please try again.")))}));const h=e!=null&&e.scopedProperties?{[this.namespace]:e.scopedProperties}:void 0;await this.signer.connect(jn(ar({namespaces:ar({},n&&{[this.namespace]:n})},i&&{optionalNamespaces:{[this.namespace]:i}}),{pairingTopic:e==null?void 0:e.pairingTopic,scopedProperties:h})).then(f=>{a(f)}).catch(f=>{var p;(p=this.modal)==null||p.showErrorMessage("Unable to connect"),c(new Error(f.message))})});if(!s)return;const o=kc(s.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:o),this.setAccounts(o),this.events.emit("connect",{chainId:Di(this.chainId)})}catch(s){throw this.signer.logger.error(s),s}finally{(r=this.modal)==null||r.close()}}async authenticate(e,r){var n;if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e==null?void 0:e.chains});try{const i=await new Promise(async(o,a)=>{var c,u;this.rpc.showQrModal&&((c=this.modal)==null||c.open(),(u=this.modal)==null||u.subscribeState(l=>{!l.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(jn(ar({},e),{chains:this.rpc.chains}),r).then(l=>{o(l)}).catch(l=>{var h;(h=this.modal)==null||h.showErrorMessage("Unable to connect"),a(new Error(l.message))})}),s=i.session;if(s){const o=kc(s.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:o),this.setAccounts(o),this.events.emit("connect",{chainId:Di(this.chainId)})}return i}catch(i){throw this.signer.logger.error(i),i}finally{(n=this.modal)==null||n.close()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:r}=e,{event:n}=r;n.name==="accountsChanged"?(this.accounts=this.parseAccounts(n.data),this.events.emit("accountsChanged",this.accounts)):n.name==="chainChanged"?this.setChainId(this.formatChainId(n.data)):this.events.emit(n.name,n.data),this.events.emit("session_event",e)}),this.signer.on("accountsChanged",e=>{this.accounts=this.parseAccounts(e),this.events.emit("accountsChanged",this.accounts)}),this.signer.on("chainChanged",e=>{const r=parseInt(e);this.chainId=r,this.events.emit("chainChanged",Di(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",jn(ar({},te("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const r=e.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",Di(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const r=this.parseChainId(e);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(e){const[r,n,i]=e.split(":");return{chainId:`${r}:${n}`,address:i}}setAccounts(e){this.accounts=e.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var r,n;const i=(r=e==null?void 0:e.chains)!=null?r:[],s=(n=e==null?void 0:e.optionalChains)!=null?n:[],o=i.concat(s);if(!o.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const a=i.length?(e==null?void 0:e.methods)||ts:[],c=i.length?(e==null?void 0:e.events)||rs:[],u=(e==null?void 0:e.optionalMethods)||[],l=(e==null?void 0:e.optionalEvents)||[],h=(e==null?void 0:e.rpcMap)||this.buildRpcMap(o,e.projectId),f=(e==null?void 0:e.qrModalOptions)||void 0;return{chains:i==null?void 0:i.map(p=>this.formatChainId(p)),optionalChains:s.map(p=>this.formatChainId(p)),methods:a,events:c,optionalMethods:u,optionalEvents:l,rpcMap:h,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:f,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,r){const n={};return e.forEach(i=>{n[i]=this.getRpcUrl(i,r)}),n}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?ns(this.rpc.chains):ns(this.rpc.optionalChains),this.signer=await tC.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storage:e.storage,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled,logger:e.logger}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const n=await oC(),{convertWCMToAppKitOptions:i}=await Promise.resolve().then(function(){return $C}),s=i(jn(ar({},this.rpc.qrModalOptions),{chains:[...new Set([...this.rpc.chains,...this.rpc.optionalChains])],metadata:this.rpc.metadata,projectId:this.rpc.projectId}));if(!s.networks.length)throw new Error("No networks found for WalletConnect·");r=n(jn(ar({},s),{universalProvider:this.signer,manualWCControl:!0}))}catch(n){throw console.warn(n),new Error("To use QR modal, please install @reown/appkit package")}if(r)try{this.modal=r}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:r,optionalChains:n,rpcMap:i}=e;r&&vt(r)&&(this.rpc.chains=r.map(s=>this.formatChainId(s)),r.forEach(s=>{this.rpc.rpcMap[s]=(i==null?void 0:i[s])||this.getRpcUrl(s)})),n&&vt(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n==null?void 0:n.map(s=>this.formatChainId(s)),n.forEach(s=>{this.rpc.rpcMap[s]=(i==null?void 0:i[s])||this.getRpcUrl(s)}))}getRpcUrl(e,r){var n;return((n=this.rpc.rpcMap)==null?void 0:n[e])||`${sC}?chainId=eip155:${e}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(r=>this.signer.logger.warn(r))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(r=>this.parseAccount(r))}}const dC=Ls;var pC=Object.defineProperty,gC=Object.defineProperties,yC=Object.getOwnPropertyDescriptors,uh=Object.getOwnPropertySymbols,mC=Object.prototype.hasOwnProperty,wC=Object.prototype.propertyIsEnumerable,lh=(t,e,r)=>e in t?pC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,sg=(t,e)=>{for(var r in e||(e={}))mC.call(e,r)&&lh(t,r,e[r]);if(uh)for(var r of uh(e))wC.call(e,r)&&lh(t,r,e[r]);return t},vC=(t,e)=>gC(t,yC(e));function bC(t){if(t)return{"--w3m-font-family":t["--wcm-font-family"],"--w3m-accent":t["--wcm-accent-color"],"--w3m-color-mix":t["--wcm-background-color"],"--w3m-z-index":t["--wcm-z-index"]?Number(t["--wcm-z-index"]):void 0,"--w3m-qr-color":t["--wcm-accent-color"],"--w3m-font-size-master":t["--wcm-text-medium-regular-size"],"--w3m-border-radius-master":t["--wcm-container-border-radius"],"--w3m-color-mix-strength":0}}const EC=t=>{const[e,r]=t.split(":");return og({id:r,caipNetworkId:t,chainNamespace:e,name:"",nativeCurrency:{name:"",symbol:"",decimals:8},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}}})};function _C(t){var e,r,n,i,s,o,a;const c=(e=t.chains)==null?void 0:e.map(EC).filter(Boolean);if(c.length===0)throw new Error("At least one chain must be specified");const u=c.find(h=>{var f;return h.id===((f=t.defaultChain)==null?void 0:f.id)}),l={projectId:t.projectId,networks:c,themeMode:t.themeMode,themeVariables:bC(t.themeVariables),chainImages:t.chainImages,connectorImages:t.walletImages,defaultNetwork:u,metadata:vC(sg({},t.metadata),{name:((r=t.metadata)==null?void 0:r.name)||"WalletConnect",description:((n=t.metadata)==null?void 0:n.description)||"Connect to WalletConnect-compatible wallets",url:((i=t.metadata)==null?void 0:i.url)||"https://walletconnect.org",icons:((s=t.metadata)==null?void 0:s.icons)||["https://walletconnect.org/walletconnect-logo.png"]}),showWallets:!0,featuredWalletIds:t.explorerRecommendedWalletIds==="NONE"?[]:Array.isArray(t.explorerRecommendedWalletIds)?t.explorerRecommendedWalletIds:[],excludeWalletIds:t.explorerExcludedWalletIds==="ALL"?[]:Array.isArray(t.explorerExcludedWalletIds)?t.explorerExcludedWalletIds:[],enableEIP6963:!1,enableInjected:!1,enableCoinbase:!0,enableWalletConnect:!0,features:{email:!1,socials:!1}};if((o=t.mobileWallets)!=null&&o.length||(a=t.desktopWallets)!=null&&a.length){const h=[...(t.mobileWallets||[]).map(d=>({id:d.id,name:d.name,links:d.links})),...(t.desktopWallets||[]).map(d=>({id:d.id,name:d.name,links:{native:d.links.native,universal:d.links.universal}}))],f=[...l.featuredWalletIds||[],...l.excludeWalletIds||[]],p=h.filter(d=>!f.includes(d.id));p.length&&(l.customWallets=p)}return l}function og(t){return sg({formatters:void 0,fees:void 0,serializers:void 0},t)}var $C=Object.freeze({__proto__:null,convertWCMToAppKitOptions:_C,defineChain:og});const p3=Object.freeze(Object.defineProperty({__proto__:null,EthereumProvider:dC,OPTIONAL_EVENTS:ig,OPTIONAL_METHODS:ng,REQUIRED_EVENTS:rs,REQUIRED_METHODS:ts,default:Ls},Symbol.toStringTag,{value:"Module"}));export{hO as A,St as B,i0 as C,ut as D,ze as E,Pt as F,bt as G,Yy as H,$r as I,SC as J,dc as K,Lh as L,Uy as M,Jy as N,ui as O,Mc as P,ff as Q,DC as R,PC as S,os as T,xC as U,AC as V,p3 as W,mr as a,gr as b,N as c,bi as d,ha as e,lt as f,Oh as g,Ng as h,$h as i,Un as j,Ao as k,bs as l,c$ as m,FI as n,ht as o,Na as p,Is as q,$s as r,Ht as s,Ye as t,Or as u,Qt as v,ab as w,dr as x,Je as y,Os as z};
|