@wormhole-foundation/wormhole-connect 3.0.0 → 3.0.1-beta.0-development
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{add-DcSO6g7v.js → add-Cy39EVaY.js} +1 -1
- package/dist/assets/{all-wallets-DWzxa3vS.js → all-wallets-BG4OMn19.js} +1 -1
- package/dist/assets/{app-store-6phYCHjG.js → app-store-B2VJcnKc.js} +1 -1
- package/dist/assets/{apple-DWWnLevU.js → apple-6OWWifFn.js} +1 -1
- package/dist/assets/{aptos-DkSiRwPH.js → aptos-BuLH7jck.js} +3 -3
- package/dist/assets/{aptos-63ExGocu.js → aptos-gb8snog6.js} +1 -1
- package/dist/assets/{arrow-bottom-BAP07o8i.js → arrow-bottom-YGKzRes5.js} +1 -1
- package/dist/assets/{arrow-bottom-circle-DsrpzBMS.js → arrow-bottom-circle-BH-P4D_L.js} +1 -1
- package/dist/assets/{arrow-left-DUwketVX.js → arrow-left-DF2t0i5J.js} +1 -1
- package/dist/assets/{arrow-right-NA0HPVOL.js → arrow-right-CP40LqnJ.js} +1 -1
- package/dist/assets/{arrow-top-EZdWHthM.js → arrow-top-DnKSFz-5.js} +1 -1
- package/dist/assets/{bank-u2fFSB-h.js → bank-BpG6sNAE.js} +1 -1
- package/dist/assets/{basic-BZbF5gyr.js → basic-CLnavz_q.js} +1 -1
- package/dist/assets/{blake2b-Bb1VZYtg.js → blake2b-B2b685Yu.js} +1 -1
- package/dist/assets/{browser-clrim_u1.js → browser-BhlgRcS6.js} +1 -1
- package/dist/assets/{card-7RD9NrX1.js → card-BTep0Fm_.js} +1 -1
- package/dist/assets/{ccip-CpYYPW6X.js → ccip-By49zU3M.js} +1 -1
- package/dist/assets/{chain-DF9mIQM9.js → chain-Du7paeNG.js} +1 -1
- package/dist/assets/{checkmark-BNiNaYKO.js → checkmark-UEyfqUU3.js} +1 -1
- package/dist/assets/{checkmark-bold-DIgBXK3A.js → checkmark-bold-DMLl2gC5.js} +1 -1
- package/dist/assets/{chevron-bottom-lLKkTFta.js → chevron-bottom-CPv_izmZ.js} +1 -1
- package/dist/assets/{chevron-left-7fy1dk8e.js → chevron-left-0a7IeWd5.js} +1 -1
- package/dist/assets/{chevron-right-DN4RsCT_.js → chevron-right-B-0wsh8g.js} +1 -1
- package/dist/assets/{chevron-top-CxEvK7Z7.js → chevron-top-BHFncmmu.js} +1 -1
- package/dist/assets/{chrome-store-C_EP1Dya.js → chrome-store-BIaI9-ba.js} +1 -1
- package/dist/assets/{chunk-KJH4KKG6-B7DCZZVY.js → chunk-KJH4KKG6-Po5MChR6.js} +1 -1
- package/dist/assets/{clock-DJtk2vKP.js → clock-BQdD9J7H.js} +1 -1
- package/dist/assets/{close-DhVxMT3P.js → close-Cjok36co.js} +1 -1
- package/dist/assets/{coinPlaceholder-CmJrU68z.js → coinPlaceholder-CneTHrCz.js} +1 -1
- package/dist/assets/{compass-DDACJ8hx.js → compass-Dit7B215.js} +1 -1
- package/dist/assets/{contract-bGGxC9_m.js → contract-BhySpM-Z.js} +1 -1
- package/dist/assets/{copy-CyDvDXaX.js → copy-JvNImG5R.js} +1 -1
- package/dist/assets/{create-CbRd6EbF.js → create-gkOVonha.js} +1 -1
- package/dist/assets/{cursor-DMi-8XQe.js → cursor-CSwolbdC.js} +1 -1
- package/dist/assets/{cursor-transparent-CZoHZhIC.js → cursor-transparent-DQ2bEHaM.js} +1 -1
- package/dist/assets/{desktop-ZKhBfFcs.js → desktop-F3wMUZcL.js} +1 -1
- package/dist/assets/{disconnect-D6_W2NeZ.js → disconnect-vvd6SXmG.js} +1 -1
- package/dist/assets/{discord-CNw9YLkF.js → discord-mwjbbdll.js} +1 -1
- package/dist/assets/{etherscan-ZR8F73yU.js → etherscan-ZpIOVA81.js} +1 -1
- package/dist/assets/{evm-DwqzhXfk.js → evm-CWAxZ2a7.js} +3 -3
- package/dist/assets/{evm-CaU1lKeB.js → evm-fcQsoqVd.js} +4 -4
- package/dist/assets/{exclamation-triangle-es13TDGx.js → exclamation-triangle-CrFNsvqc.js} +1 -1
- package/dist/assets/{extension-CdAdgyKr.js → extension-C_zCCj6H.js} +1 -1
- package/dist/assets/{external-link-BX1h33YE.js → external-link-B0LEq1D3.js} +1 -1
- package/dist/assets/{facebook-Jhm06hzF.js → facebook-B_HaXZVY.js} +1 -1
- package/dist/assets/{farcaster-DqQ_p1hK.js → farcaster-C9d4q5--.js} +1 -1
- package/dist/assets/{filters-tJXH7Nb1.js → filters-Coi2MlO2.js} +1 -1
- package/dist/assets/{github-Ct6wtKmx.js → github-DiDkJ9-4.js} +1 -1
- package/dist/assets/{google-B0PPXdke.js → google-BHKYD7dA.js} +1 -1
- package/dist/assets/{help-circle-CZWvsEZP.js → help-circle-lf3f_u3Q.js} +1 -1
- package/dist/assets/{id-BvW00BCn.js → id-BoAkobNw.js} +1 -1
- package/dist/assets/{image-C24xCI2p.js → image-C9_T15rA.js} +1 -1
- package/dist/assets/{index-CKPf-3Vo.js → index--d0JCrsI.js} +1 -1
- package/dist/assets/{index-C0-WLpMA.js → index-BE55BSK7.js} +1 -1
- package/dist/assets/{index-Cu0b-jgK.js → index-BJYqkXUw.js} +1 -1
- package/dist/assets/{index-C_YTupmk.js → index-BYTZG2bF.js} +1 -1
- package/dist/assets/{index-CuKiKQIt.js → index-BZCSByFC.js} +3 -3
- package/dist/assets/{index-CVqQ68io.js → index-BedU_k3i.js} +1 -1
- package/dist/assets/{index-BTkoFKAW.js → index-BgLBca6k.js} +1 -1
- package/dist/assets/{index-DynC8vQ4.js → index-BjvqCh5g.js} +1 -1
- package/dist/assets/{index-BqLA4xTj.js → index-BpI-Jtyb.js} +3 -3
- package/dist/assets/{index-GmuqTVr0.js → index-Breet2G4.js} +1 -1
- package/dist/assets/{index-BUtdFAj3.js → index-Bx8vjRmV.js} +1 -1
- package/dist/assets/{index-DA4wR-ie.js → index-DB7g9m_R.js} +1 -1
- package/dist/assets/{index-DKdokzug.js → index-DMWfYwZZ.js} +1 -1
- package/dist/assets/{index-COZ2cSR6.js → index-DSTd1tRp.js} +1 -1
- package/dist/assets/{index-CVqXQiSE.js → index-DZ96gAj4.js} +1 -1
- package/dist/assets/{index-CYFq9U58.js → index-TYicGq2L.js} +1 -1
- package/dist/assets/index-Z3Xir6L3.js +1 -0
- package/dist/assets/{index-DC3x_AFd.js → index-kF0xEQ0E.js} +1 -1
- package/dist/assets/{index-CCOXtJ1P.js → index-zEIfo2_n.js} +1 -1
- package/dist/assets/index.es-3Tq6bjFW.js +47 -0
- package/dist/assets/index.es-CBqWEk7T.js +15 -0
- package/dist/assets/{info-SvuGOfi5.js → info-C0I2HHbp.js} +1 -1
- package/dist/assets/{info-circle-84iqM8-Q.js → info-circle-BJmxBusI.js} +1 -1
- package/dist/assets/{lightbulb-DGPyF6jt.js → lightbulb-Chfw09TV.js} +1 -1
- package/dist/assets/{mail-OnqfCeMQ.js → mail-BGqa051c.js} +1 -1
- package/dist/assets/{mobile-MUTbclBT.js → mobile-DkPjbMNa.js} +1 -1
- package/dist/assets/{more-D7xvB08n.js → more-f7FKhsyw.js} +1 -1
- package/dist/assets/{network-placeholder-B3oNxx7m.js → network-placeholder-DyyxIB08.js} +1 -1
- package/dist/assets/{nftPlaceholder-BpspzVAZ.js → nftPlaceholder-CfDPimUz.js} +1 -1
- package/dist/assets/{off-CKJS0rlt.js → off-BvnUT7bh.js} +1 -1
- package/dist/assets/{play-store-DPdM8tTb.js → play-store-Dl8Di4Xz.js} +1 -1
- package/dist/assets/{plus-BEacG4PU.js → plus-Dtc5pm0q.js} +1 -1
- package/dist/assets/{provider-jsonrpc-DTnJKzTS.js → provider-jsonrpc-CG-x8-V6.js} +1 -1
- package/dist/assets/{qr-code-D5Z-jGKj.js → qr-code-b5m8lMyQ.js} +1 -1
- package/dist/assets/{recycle-horizontal-Cv9AatSG.js → recycle-horizontal-DztIZMpd.js} +1 -1
- package/dist/assets/{refresh-D3McR5aq.js → refresh-Z55s9i8s.js} +1 -1
- package/dist/assets/{reown-logo-LTh9tOQw.js → reown-logo-BVpI-nfV.js} +1 -1
- package/dist/assets/{search-BbBy9kw3.js → search-CjKBf0db.js} +1 -1
- package/dist/assets/{secp256k1-BmFL2ykZ.js → secp256k1-BHTD1Qmp.js} +1 -1
- package/dist/assets/{secp256k1-Dzt1ocCq.js → secp256k1-CCS9UBYD.js} +1 -1
- package/dist/assets/{send-B86sPReU.js → send-DRsIh8XD.js} +1 -1
- package/dist/assets/signer-BRan8q4C.js +2 -0
- package/dist/assets/solana-B3bc0p0T.js +2 -0
- package/dist/assets/{solana-BqDLZw3p.js → solana-D0M1N7L4.js} +9 -9
- package/dist/assets/solanaEmbed.esm-Mnq6o_qa.js +10 -0
- package/dist/assets/{sui-Pc10JTxL.js → sui-CXoaI0gx.js} +2 -2
- package/dist/assets/{sui-DXg2Lhyt.js → sui-DXdm7DBB.js} +4 -4
- package/dist/assets/{swapHorizontal-Dhmacw5x.js → swapHorizontal-COY_WODc.js} +1 -1
- package/dist/assets/{swapHorizontalBold-CDIQPrQ8.js → swapHorizontalBold-C0JXN9CW.js} +1 -1
- package/dist/assets/{swapHorizontalMedium-DylShk_S.js → swapHorizontalMedium-DH34hVvb.js} +1 -1
- package/dist/assets/{swapHorizontalRoundedBold-CfplGW6w.js → swapHorizontalRoundedBold-Cbu2lR_U.js} +1 -1
- package/dist/assets/{swapVertical-DrDE8l8C.js → swapVertical-CjpRMkF_.js} +1 -1
- package/dist/assets/{telegram-DbwUz_vy.js → telegram-DxmYoEg_.js} +1 -1
- package/dist/assets/{three-dots-B8-Bf1M-.js → three-dots-GsCsg39y.js} +1 -1
- package/dist/assets/{tokens-BjeNFBPV.js → tokens-DNQKjj3l.js} +2 -2
- package/dist/assets/{twitch-CSNqjiLg.js → twitch-LH0w9yHE.js} +1 -1
- package/dist/assets/{twitterIcon-Bja28Sjm.js → twitterIcon-Ci6YQIIR.js} +1 -1
- package/dist/assets/{verify-BeTF48Me.js → verify-CLWJXQKG.js} +1 -1
- package/dist/assets/{verify-filled-CtyAqLP0.js → verify-filled-Bgbn2dT_.js} +1 -1
- package/dist/assets/{w3m-modal-CPF3wa2e.js → w3m-modal-BR4v9o5N.js} +1 -1
- package/dist/assets/{wallet-BBddJ-Oq.js → wallet-Dy9a13FP.js} +1 -1
- package/dist/assets/{wallet-placeholder-CNd4KccY.js → wallet-placeholder-BlMcAG8z.js} +1 -1
- package/dist/assets/{walletconnect-ayJrSmrJ.js → walletconnect-BmSWYy7N.js} +1 -1
- package/dist/assets/{warning-circle-BGHnveRG.js → warning-circle-DUSLmVwm.js} +1 -1
- package/dist/assets/{x-B520PEWg.js → x-D-BfG-2C.js} +1 -1
- package/dist/main.js +79 -79
- package/dist/src/views/v2/Bridge/Routes/index.d.ts.map +1 -1
- package/lib/{add-CR5Ztf9K.mjs → add-BPFasfGu.mjs} +1 -1
- package/lib/{add-DsQYu8-3.js → add-k3ewuJUG.js} +1 -1
- package/lib/{all-wallets-DjH7e8Le.js → all-wallets-DbhnhSgQ.js} +1 -1
- package/lib/{all-wallets-DuQYa3_A.mjs → all-wallets-la-1zudw.mjs} +1 -1
- package/lib/{app-store-BxXQ176e.js → app-store-DwyKNjnW.js} +1 -1
- package/lib/{app-store-BDd6cFgE.mjs → app-store-doruxuZE.mjs} +1 -1
- package/lib/{apple-CAgvMnTl.mjs → apple-Ba-W9z_L.mjs} +1 -1
- package/lib/{apple-Djo4pf9S.js → apple-f5EysyhV.js} +1 -1
- package/lib/{aptos-BSB6qX7S.js → aptos-BYM651I5.js} +1 -1
- package/lib/{aptos-CkGw1Mfc.mjs → aptos-ChgDZ9Bs.mjs} +1 -1
- package/lib/{arrow-bottom-U8uSFPEG.mjs → arrow-bottom-CZPkUc3D.mjs} +1 -1
- package/lib/{arrow-bottom-D9foyHjG.js → arrow-bottom-CyaXCpbT.js} +1 -1
- package/lib/{arrow-bottom-circle-BjCfUqTl.mjs → arrow-bottom-circle-BOmrxjxV.mjs} +1 -1
- package/lib/{arrow-bottom-circle-DM0xE-Kv.js → arrow-bottom-circle-Kla1lJ0S.js} +1 -1
- package/lib/{arrow-left-CvpUHKKM.mjs → arrow-left-Dqlhv2Qp.mjs} +1 -1
- package/lib/{arrow-left-D_2byrHa.js → arrow-left-DtuOud7o.js} +1 -1
- package/lib/{arrow-right-Dz6L1I_M.js → arrow-right-W0IwU-6h.js} +1 -1
- package/lib/{arrow-right-Cngz1-ce.mjs → arrow-right-glR4LxQL.mjs} +1 -1
- package/lib/{arrow-top-CoJfLN99.mjs → arrow-top-ChZhpBX5.mjs} +1 -1
- package/lib/{arrow-top-C_hqOn2K.js → arrow-top-DDcfmUYc.js} +1 -1
- package/lib/{bank-DCEhbelz.js → bank-2fSYiPNd.js} +1 -1
- package/lib/{bank-CF44-N3R.mjs → bank-CeAxLFYE.mjs} +1 -1
- package/lib/{basic-DFvA-W2I.js → basic-DATFcjGI.js} +1 -1
- package/lib/{basic-zSaFlloC.mjs → basic-DmAZdELt.mjs} +2 -2
- package/lib/{browser-CZB6pBHh.mjs → browser-CD59CQ82.mjs} +1 -1
- package/lib/{browser-BmnrqP_d.js → browser-DrdHogv9.js} +1 -1
- package/lib/{card-CDV4C5Yo.mjs → card-CR5E0M8J.mjs} +1 -1
- package/lib/{card-CcJnzKXd.js → card-DsBOUpCN.js} +1 -1
- package/lib/{ccip-DNxNSRd4.js → ccip-BFa4y-oy.js} +1 -1
- package/lib/{ccip-C3r5a63m.mjs → ccip-bLQYuHSY.mjs} +1 -1
- package/lib/{checkmark-Bjj5gfFz.mjs → checkmark-CfNjLqyN.mjs} +1 -1
- package/lib/{checkmark-5PyusBI3.js → checkmark-CsX9NZH7.js} +1 -1
- package/lib/{checkmark-bold-NRwRKH0S.js → checkmark-bold-BJIvwCmJ.js} +1 -1
- package/lib/{checkmark-bold-dOE8wbJm.mjs → checkmark-bold-DY9T5oVa.mjs} +1 -1
- package/lib/{chevron-bottom-DwMHk5_9.mjs → chevron-bottom-BYoFClQQ.mjs} +1 -1
- package/lib/{chevron-bottom-Uo73BZVA.js → chevron-bottom-Ditoq2xa.js} +1 -1
- package/lib/{chevron-left-qMKjlzUK.js → chevron-left-3WnVWUcO.js} +1 -1
- package/lib/{chevron-left-DFZlw99v.mjs → chevron-left-CqVSZU9b.mjs} +1 -1
- package/lib/{chevron-right-Ca1KQVa4.js → chevron-right-CJBuSXL6.js} +1 -1
- package/lib/{chevron-right-CsJHgvgE.mjs → chevron-right-X3OiwFgb.mjs} +1 -1
- package/lib/{chevron-top-CQgrgMDC.js → chevron-top-evdJz5l1.js} +1 -1
- package/lib/{chevron-top-DmxacwcX.mjs → chevron-top-sE88QRY5.mjs} +1 -1
- package/lib/{chrome-store-j17yBO59.js → chrome-store-BE0d8gm3.js} +1 -1
- package/lib/{chrome-store-B-3SO4tn.mjs → chrome-store-CrGMC4Ms.mjs} +1 -1
- package/lib/{clock-DND917Zx.mjs → clock-B2hRLLna.mjs} +1 -1
- package/lib/{clock-j5OYPG9G.js → clock-BQOPbXNd.js} +1 -1
- package/lib/{close-BnzlOwgC.mjs → close-BAo2qofr.mjs} +1 -1
- package/lib/{close-D5eQIZeo.js → close-DwQUJGX9.js} +1 -1
- package/lib/{coinPlaceholder-5MD4FxJz.mjs → coinPlaceholder-Cop9iL3O.mjs} +1 -1
- package/lib/{coinPlaceholder-DZB3lmBK.js → coinPlaceholder-D4XIXbUt.js} +1 -1
- package/lib/{compass-BFGiiRyj.mjs → compass-BirhgtWV.mjs} +1 -1
- package/lib/{compass-Hnnvqf4W.js → compass-C1qPsOLt.js} +1 -1
- package/lib/{constants-DlMk_6zA.mjs → constants-D9NeMoZZ.mjs} +3 -3
- package/lib/constants-T5Vq_IiF.js +1 -0
- package/lib/{copy-_cD0YCcN.mjs → copy-CEI12w7k.mjs} +1 -1
- package/lib/{copy-BG1v_IT3.js → copy-DTprqw_x.js} +1 -1
- package/lib/{cursor-D51EWHtw.mjs → cursor-BWYqc_Iy.mjs} +1 -1
- package/lib/{cursor-4OCaNc3A.js → cursor-CJNQd6s1.js} +1 -1
- package/lib/{cursor-transparent-D4G8CiJu.js → cursor-transparent-BgDxhGZb.js} +1 -1
- package/lib/{cursor-transparent-BbRm_WoL.mjs → cursor-transparent-DyUm_Gyl.mjs} +1 -1
- package/lib/{desktop-BPV4Jq7C.js → desktop-Dhc3ut6w.js} +1 -1
- package/lib/{desktop-_jVvy3G9.mjs → desktop-Donl6N-w.mjs} +1 -1
- package/lib/{disconnect-BRh7LOf_.js → disconnect-BF1o-_4J.js} +1 -1
- package/lib/{disconnect-Dp0kUWeF.mjs → disconnect-BOkIc2nC.mjs} +1 -1
- package/lib/{discord-DVlxZDzX.mjs → discord-3TAxBxMm.mjs} +1 -1
- package/lib/{discord-DfkQh97Z.js → discord-Cr_4Cd1g.js} +1 -1
- package/lib/{etherscan-BYTtEWXg.js → etherscan-BdKsG3Bv.js} +1 -1
- package/lib/{etherscan-CVTkTQkY.mjs → etherscan-crtB48km.mjs} +1 -1
- package/lib/{evm-A_PshNGs.mjs → evm-BW-hVkAs.mjs} +5 -4
- package/lib/{evm-AmBHj3pD.js → evm-BwVzzPhr.js} +3 -3
- package/lib/{exclamation-triangle-CqvJcLBM.mjs → exclamation-triangle-B8ouyGn5.mjs} +1 -1
- package/lib/{exclamation-triangle-CW2RfEyP.js → exclamation-triangle-CDWJ40KD.js} +1 -1
- package/lib/{extension-DXI0EvM-.mjs → extension-CKbWDUFI.mjs} +1 -1
- package/lib/{extension-DJMyrtMq.js → extension-DdSvlDz-.js} +1 -1
- package/lib/{external-link-BWqola9w.mjs → external-link-Ba6hY_g_.mjs} +1 -1
- package/lib/{external-link-BwuF5S4F.js → external-link-DJvJgYIh.js} +1 -1
- package/lib/{facebook-C_UUBb6g.js → facebook-A65A2Gkq.js} +1 -1
- package/lib/{facebook-CL4jfLuQ.mjs → facebook-CFUYIcny.mjs} +1 -1
- package/lib/{farcaster-CzKUflnu.mjs → farcaster-BVmh2zDV.mjs} +1 -1
- package/lib/{farcaster-BIoquIGI.js → farcaster-qZSmV22m.js} +1 -1
- package/lib/{filters-BW7K6cO8.js → filters-CNDKq3Qc.js} +1 -1
- package/lib/{filters-olRHEzRz.mjs → filters-Uk-V5NfL.mjs} +1 -1
- package/lib/{github-Cdb2MSS8.js → github-B34wWZJc.js} +1 -1
- package/lib/{github-BYG4fdMZ.mjs → github-CKyZTPiz.mjs} +1 -1
- package/lib/{google-DyaGudk1.js → google-CuY8LtEi.js} +1 -1
- package/lib/{google-Cj5iFHjT.mjs → google-D5l_b5at.mjs} +1 -1
- package/lib/{help-circle-C3cz2mhr.js → help-circle-B8yY3eo0.js} +1 -1
- package/lib/{help-circle-Y9FUcqDe.mjs → help-circle-CecVMIZq.mjs} +1 -1
- package/lib/hosted.js +1 -1
- package/lib/hosted.mjs +1 -1
- package/lib/{id-WMVfV2eA.js → id-DLcZPuZY.js} +1 -1
- package/lib/{id-k-6XX-i3.mjs → id-DTrVc-vC.mjs} +1 -1
- package/lib/{image-Dq1CEatm.js → image-Cwpi7jk6.js} +1 -1
- package/lib/{image-Cv9d6W9m.mjs → image-DTiFTFsi.mjs} +1 -1
- package/lib/index-BLJhpzbW.js +304 -0
- package/lib/{index-CSme-v_P.mjs → index-C8Ud7j_3.mjs} +19193 -19184
- package/lib/{index-dPmy3HXi.mjs → index-CXkqbcY-.mjs} +78 -78
- package/lib/{index-B3BPxQII.js → index-DoD0YukX.js} +2 -2
- package/lib/{index.es-Baasatwd.mjs → index.es-BMIY5pYw.mjs} +3 -3
- package/lib/{index.es-CEy-pF4C.mjs → index.es-CDEST0S7.mjs} +1 -1
- package/lib/{index.es-DkYlA3ur.js → index.es-DpOAk4i2.js} +1 -1
- package/lib/{index.es-BPWrzgLw.js → index.es-TJGl70mY.js} +1 -1
- package/lib/index.js +1 -1
- package/lib/index.mjs +1 -1
- package/lib/{info-DKtbpKFe.js → info-DcQS8IpR.js} +1 -1
- package/lib/{info-circle-D-VQKTUY.mjs → info-circle-DT6JQVme.mjs} +1 -1
- package/lib/{info-circle-CrAp5FW5.js → info-circle-aXtdOOCE.js} +1 -1
- package/lib/{info-C-APj01Z.mjs → info-t-enQ6Lr.mjs} +1 -1
- package/lib/{lightbulb-D6OnARen.mjs → lightbulb-CtbmuzLN.mjs} +1 -1
- package/lib/{lightbulb-Bch6Bif3.js → lightbulb-PXEUZBLD.js} +1 -1
- package/lib/{mail-CGX6Ebtq.mjs → mail-BeOHsaxl.mjs} +1 -1
- package/lib/{mail-9in0xpOQ.js → mail-D9Wkb_fX.js} +1 -1
- package/lib/{mobile-NmA6wrO4.mjs → mobile-RJYQQ92x.mjs} +1 -1
- package/lib/{mobile-CyagzH3-.js → mobile-iCRio9M2.js} +1 -1
- package/lib/{more-CFca7uI_.mjs → more-5fdnBWda.mjs} +1 -1
- package/lib/{more-DcJPJGe5.js → more-CjmHuHR3.js} +1 -1
- package/lib/{network-placeholder-BYXUJOeS.js → network-placeholder-DfXy-pw6.js} +1 -1
- package/lib/{network-placeholder-Cd1Q08rr.mjs → network-placeholder-xXksUrh5.mjs} +1 -1
- package/lib/{nftPlaceholder-Dzx7XKJd.mjs → nftPlaceholder-CsrQCxrs.mjs} +1 -1
- package/lib/{nftPlaceholder-DdfFTwua.js → nftPlaceholder-sAiBQkMk.js} +1 -1
- package/lib/{off-NE8r79uo.js → off-BqIL7yPu.js} +1 -1
- package/lib/{off-8JP1Gy_j.mjs → off-BwM4HctO.mjs} +1 -1
- package/lib/{play-store-CjR8Ye5i.js → play-store-CI-BG6p6.js} +1 -1
- package/lib/{play-store-BtkXn6Qi.mjs → play-store-DxNIHRp-.mjs} +1 -1
- package/lib/{plus-BcelSf8P.mjs → plus-B7obWHt8.mjs} +1 -1
- package/lib/{plus-DYoXeuFJ.js → plus-C6x2EScU.js} +1 -1
- package/lib/{qr-code-BH5tvrnq.mjs → qr-code-3DFC3Q4R.mjs} +1 -1
- package/lib/{qr-code-CvM_r_h_.js → qr-code-DmjJRj0_.js} +1 -1
- package/lib/{recycle-horizontal-DF-bpqgQ.mjs → recycle-horizontal-Bdxajrwe.mjs} +1 -1
- package/lib/{recycle-horizontal-CtsSBIRS.js → recycle-horizontal-CG5av2fz.js} +1 -1
- package/lib/{refresh-NdMm4wug.js → refresh-Btbt-_sS.js} +1 -1
- package/lib/{refresh-CQOZ2mAu.mjs → refresh-Zr5AsEKU.mjs} +1 -1
- package/lib/{reown-logo-nJjEHWXo.mjs → reown-logo-CR3PdJr3.mjs} +1 -1
- package/lib/{reown-logo-Dvzu-NrE.js → reown-logo-CfO-XbUR.js} +1 -1
- package/lib/{search-BJolJxEl.mjs → search-CSdDYgkF.mjs} +1 -1
- package/lib/{search-Deat4EBf.js → search-CTbUM9lC.js} +1 -1
- package/lib/{secp256k1-D72Q3VYt.js → secp256k1-BZjEFwP8.js} +1 -1
- package/lib/{secp256k1-BNlpZRIz.js → secp256k1-CnnROfkI.js} +1 -1
- package/lib/{secp256k1-C56YnRUb.mjs → secp256k1-DPqpw2CY.mjs} +1 -1
- package/lib/{secp256k1-BFBj5yVh.mjs → secp256k1-DWHMs4rw.mjs} +1 -1
- package/lib/{send-BAAbPeec.js → send-B7xqmURU.js} +1 -1
- package/lib/{send-Cg8O9lHI.mjs → send-DznbeEhx.mjs} +1 -1
- package/lib/{solana-CIjJKPC4.mjs → solana-AxtnvbY3.mjs} +6 -6
- package/lib/{solana-CgmPqyOk.js → solana-DLlqlTiO.js} +4 -4
- package/lib/{solanaEmbed.esm-a7S5N_pS.mjs → solanaEmbed.esm-7UXGCmUk.mjs} +1 -1
- package/lib/{solanaEmbed.esm-Ci_SmLQ5.js → solanaEmbed.esm-CAxFhfEV.js} +1 -1
- package/lib/src/views/v2/Bridge/Routes/index.d.ts.map +1 -1
- package/lib/{sui-BwPdGPGy.js → sui-CBgZojMi.js} +1 -1
- package/lib/{sui-DreWttXF.mjs → sui-hvPfY1xD.mjs} +1 -1
- package/lib/{swapHorizontal-DWeRan0H.js → swapHorizontal-CD3pRzO9.js} +1 -1
- package/lib/{swapHorizontal-BNQcyra_.mjs → swapHorizontal-D794mX-0.mjs} +1 -1
- package/lib/{swapHorizontalBold-CMU4Ln4I.mjs → swapHorizontalBold-BNqV8D-B.mjs} +1 -1
- package/lib/{swapHorizontalBold-DiLlPFUH.js → swapHorizontalBold-DmkD9tJg.js} +1 -1
- package/lib/{swapHorizontalMedium-B93wR42U.js → swapHorizontalMedium-BAsprxHr.js} +1 -1
- package/lib/{swapHorizontalMedium-CZFnTcX4.mjs → swapHorizontalMedium-mBKWLCjs.mjs} +1 -1
- package/lib/{swapHorizontalRoundedBold-wlGfwhPM.js → swapHorizontalRoundedBold-Bxkjq6qT.js} +1 -1
- package/lib/{swapHorizontalRoundedBold-TWMTV7dt.mjs → swapHorizontalRoundedBold-TCs9zHMJ.mjs} +1 -1
- package/lib/{swapVertical-dLQL4U_l.js → swapVertical-DhTXBg3D.js} +1 -1
- package/lib/{swapVertical-hcNqr9L_.mjs → swapVertical-l8Luks9S.mjs} +1 -1
- package/lib/{telegram-D-ZDOgyu.js → telegram-DL0uLP7b.js} +1 -1
- package/lib/{telegram-C39Le0iS.mjs → telegram-kWkcmqoP.mjs} +1 -1
- package/lib/{three-dots-xVml4oxI.js → three-dots-DWHn78kh.js} +1 -1
- package/lib/{three-dots-BbsgFUd9.mjs → three-dots-DrLoXyiQ.mjs} +1 -1
- package/lib/{tokens-sw1ixfEi.js → tokens-BUz0LqoV.js} +1 -1
- package/lib/{tokens-Biwt_Vlp.mjs → tokens-CVWDocZl.mjs} +1 -1
- package/lib/{twitch-9p6JjObE.js → twitch-DhKQH1oi.js} +1 -1
- package/lib/{twitch-C5rtlsn8.mjs → twitch-I4SDZ--W.mjs} +1 -1
- package/lib/{twitterIcon-CvHEure8.mjs → twitterIcon-b32a7G08.mjs} +1 -1
- package/lib/{twitterIcon-CLEf6yY1.js → twitterIcon-jhkqYcKG.js} +1 -1
- package/lib/{verify-Dws0cvKw.js → verify-BHunOaoq.js} +1 -1
- package/lib/{verify-DKZ0iyjc.mjs → verify-BILic2OM.mjs} +1 -1
- package/lib/{verify-filled-CtJGAYrO.mjs → verify-filled-DWED2hiA.mjs} +1 -1
- package/lib/{verify-filled-BbZK0pKJ.js → verify-filled-DaZqbtNa.js} +1 -1
- package/lib/{w3m-modal-DksS6aIT.mjs → w3m-modal-Cy1spBe9.mjs} +2 -2
- package/lib/{w3m-modal-DdtDvE03.js → w3m-modal-FbJz8iZj.js} +1 -1
- package/lib/{wallet-DXVeRjbu.mjs → wallet-BcFzu16M.mjs} +1 -1
- package/lib/{wallet-CyH12dYP.js → wallet-Bt7nP-Xo.js} +1 -1
- package/lib/{wallet-placeholder-x6zsaldG.js → wallet-placeholder-B4QUbZ9F.js} +1 -1
- package/lib/{wallet-placeholder-BMnT070m.mjs → wallet-placeholder-DgWC2b6z.mjs} +1 -1
- package/lib/{walletconnect-BaiHrAQU.mjs → walletconnect-D0jqiSEY.mjs} +1 -1
- package/lib/{walletconnect-DWLSx2RY.js → walletconnect-DJotTW4X.js} +1 -1
- package/lib/{warning-circle-D-Cxtafm.js → warning-circle-B9it-2WD.js} +1 -1
- package/lib/{warning-circle-Dv8U36XN.mjs → warning-circle-Bj9uBvqX.mjs} +1 -1
- package/lib/{x-CDag6DSG.js → x-BLLVBVBO.js} +1 -1
- package/lib/{x-iPGjMI8Y.mjs → x-uoxUEJo2.mjs} +1 -1
- package/package.json +2 -2
- package/dist/assets/index-BZFyhaji.js +0 -1
- package/dist/assets/index.es-FdLcv4RX.js +0 -47
- package/dist/assets/index.es-g5_0R3zE.js +0 -15
- package/dist/assets/signer-7-tpWjBV.js +0 -2
- package/dist/assets/solana-C6mHMmQi.js +0 -2
- package/dist/assets/solanaEmbed.esm-DhAz8SOB.js +0 -10
- package/lib/constants-DdwxK2TX.js +0 -1
- package/lib/index-DuCVZm5q.js +0 -304
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CKhAKgH8.js","main.js","main.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{f as J,k as qo,d as gt,j as gw,L as jo,_ as yw}from"../main.js";import{s as Mo,x as Ah,r as Th,H as mw,c as Dh,q as Ss}from"./evm-CaU1lKeB.js";import{I as ur,h as dt,t as nt,l as Ru,C as vw,i as ww,d as gs,s as Ns,a as xs,c as _w,b as bw,k as Iw,e as Ew,f as Pw,g as $u,r as Sw,m as Cr,n as qh,o as bt,p as Cs,q as Nu,u as Ow,v as Rw,w as Uo,x as $w,D as As,y as Ts,E as ke,z as Qe,P as xu,Q as Nw,G as xw,B as zo,F as Ds,J as Wt,H as Cw,K as Aw,L as Yt}from"./index.es-g5_0R3zE.js";import{a4 as Tw,a3 as q,a6 as jh,a5 as Mh,a7 as Dw}from"./index-Czf_KRcW.js";import"./provider-jsonrpc-DTnJKzTS.js";import"./contract-bGGxC9_m.js";const qw=Object.freeze(Object.defineProperty({__proto__:null,IEvents:ur},Symbol.toStringTag,{value:"Module"})),jw=":";function Mw(o){const[t,r]=o.split(jw);return{namespace:t,reference:r}}function Uw(o,t=[]){const r=[];return Object.keys(o).forEach(s=>{if(t.length&&!t.includes(s))return;const a=o[s];r.push(...a.accounts)}),r}function Uh(o,t){return o.includes(":")?[o]:t.chains||[]}const zh="base10",Ae="base16",bo="base64pad",Lo="utf8",Lh=0,hr=1,zw=0,Cu=1,Io=12,ko=32;function Lw(){const o=Ah.generateKeyPair();return{privateKey:nt(o.secretKey,Ae),publicKey:nt(o.publicKey,Ae)}}function Eo(){const o=Th.randomBytes(ko);return nt(o,Ae)}function kw(o,t){const r=Ah.sharedKey(dt(o,Ae),dt(t,Ae),!0),s=new mw(Mo.SHA256,r).expand(ko);return nt(s,Ae)}function Kw(o){const t=Mo.hash(dt(o,Ae));return nt(t,Ae)}function Ar(o){const t=Mo.hash(dt(o,Lo));return nt(t,Ae)}function Hw(o){return dt(`${o}`,zh)}function vi(o){return Number(nt(o,zh))}function Vw(o){const t=Hw(typeof o.type<"u"?o.type:Lh);if(vi(t)===hr&&typeof o.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof o.senderPublicKey<"u"?dt(o.senderPublicKey,Ae):void 0,s=typeof o.iv<"u"?dt(o.iv,Ae):Th.randomBytes(Io),a=new Dh.ChaCha20Poly1305(dt(o.symKey,Ae)).seal(s,dt(o.message,Lo));return Bw({type:t,sealed:a,iv:s,senderPublicKey:r})}function Fw(o){const t=new Dh.ChaCha20Poly1305(dt(o.symKey,Ae)),{sealed:r,iv:s}=Os(o.encoded),a=t.open(s,r);if(a===null)throw new Error("Failed to decrypt");return nt(a,Lo)}function Bw(o){if(vi(o.type)===hr){if(typeof o.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return nt(Ru([o.type,o.senderPublicKey,o.iv,o.sealed]),bo)}return nt(Ru([o.type,o.iv,o.sealed]),bo)}function Os(o){const t=dt(o,bo),r=t.slice(zw,Cu),s=Cu;if(vi(r)===hr){const g=s+ko,w=g+Io,d=t.slice(s,g),b=t.slice(g,w),I=t.slice(w);return{type:r,sealed:I,iv:b,senderPublicKey:d}}const a=s+Io,u=t.slice(s,a),l=t.slice(a);return{type:r,sealed:l,iv:u}}function Ww(o,t){const r=Os(o);return kh({type:vi(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?nt(r.senderPublicKey,Ae):void 0,receiverPublicKey:t==null?void 0:t.receiverPublicKey})}function kh(o){const t=(o==null?void 0:o.type)||Lh;if(t===hr){if(typeof(o==null?void 0:o.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(o==null?void 0:o.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:o==null?void 0:o.senderPublicKey,receiverPublicKey:o==null?void 0:o.receiverPublicKey}}function Au(o){return o.type===hr&&typeof o.senderPublicKey=="string"&&typeof o.receiverPublicKey=="string"}var Gw=Object.defineProperty,Tu=Object.getOwnPropertySymbols,Qw=Object.prototype.hasOwnProperty,Jw=Object.prototype.propertyIsEnumerable,Du=(o,t,r)=>t in o?Gw(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,qu=(o,t)=>{for(var r in t||(t={}))Qw.call(t,r)&&Du(o,r,t[r]);if(Tu)for(var r of Tu(t))Jw.call(t,r)&&Du(o,r,t[r]);return o};const Yw="ReactNative",Ge={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Zw="js";function Ko(){return typeof J.process<"u"&&typeof J.process.versions<"u"&&typeof J.process.versions.node<"u"}function Dr(){return!Mh()&&!!jh()&&navigator.product===Yw}function qr(){return!Ko()&&!!jh()&&!!Mh()}function wi(){return Dr()?Ge.reactNative:Ko()?Ge.node:qr()?Ge.browser:Ge.unknown}function Xw(){var o;try{return Dr()&&typeof J.global<"u"&&typeof(J.global==null?void 0:J.global.Application)<"u"?(o=J.global.Application)==null?void 0:o.applicationId:void 0}catch{return}}function e_(o,t){let r=Ss.parse(o);return r=qu(qu({},r),t),o=Ss.stringify(r),o}function t_(){return Tw()||{name:"",description:"",url:"",icons:[""]}}function r_(){if(wi()===Ge.reactNative&&typeof J.global<"u"&&typeof(J.global==null?void 0:J.global.Platform)<"u"){const{OS:r,Version:s}=J.global.Platform;return[r,s].join("-")}const o=ww();if(o===null)return"unknown";const t=o.os?o.os.replace(" ","").toLowerCase():"unknown";return o.type==="browser"?[t,o.name,o.version].join("-"):[t,o.version].join("-")}function i_(){var o;const t=wi();return t===Ge.browser?[t,((o=Dw())==null?void 0:o.host)||"unknown"].join(":"):t}function s_(o,t,r){const s=r_(),a=i_();return[[o,t].join("-"),[Zw,r].join("-"),s,a].join("/")}function n_({protocol:o,version:t,relayUrl:r,sdkVersion:s,auth:a,projectId:u,useOnCloseEvent:l,bundleId:g}){const w=r.split("?"),d=s_(o,t,s),b={auth:a,ua:d,projectId:u,useOnCloseEvent:l,origin:g||void 0},I=e_(w[1]||"",b);return w[0]+"?"+I}function cr(o,t){return o.filter(r=>t.includes(r)).length===o.length}function Kh(o){return Object.fromEntries(o.entries())}function Hh(o){return new Map(Object.entries(o))}function Nr(o=q.FIVE_MINUTES,t){const r=q.toMiliseconds(o||q.FIVE_MINUTES);let s,a,u;return{resolve:l=>{u&&s&&(clearTimeout(u),s(l))},reject:l=>{u&&a&&(clearTimeout(u),a(l))},done:()=>new Promise((l,g)=>{u=setTimeout(()=>{g(new Error(t))},r),s=l,a=g})}}function yi(o,t,r){return new Promise(async(s,a)=>{const u=setTimeout(()=>a(new Error(r)),t);try{const l=await o;s(l)}catch(l){a(l)}clearTimeout(u)})}function Vh(o,t){if(typeof t=="string"&&t.startsWith(`${o}:`))return t;if(o.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(o.toLowerCase()==="id"){if(typeof t!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${o}`)}function o_(o){return Vh("topic",o)}function a_(o){return Vh("id",o)}function Fh(o){const[t,r]=o.split(":"),s={id:void 0,topic:void 0};if(t==="topic"&&typeof r=="string")s.topic=r;else if(t==="id"&&Number.isInteger(Number(r)))s.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${r}`);return s}function ft(o,t){return q.fromMiliseconds(Date.now()+q.toMiliseconds(o))}function Gt(o){return Date.now()>=q.toMiliseconds(o)}function de(o,t){return`${o}${t?`:${t}`:""}`}function oo(o=[],t=[]){return[...new Set([...o,...t])]}async function c_({id:o,topic:t,wcDeepLink:r}){try{if(!r)return;const s=typeof r=="string"?JSON.parse(r):r;let a=s==null?void 0:s.href;if(typeof a!="string")return;a.endsWith("/")&&(a=a.slice(0,-1));const u=`${a}/wc?requestId=${o}&sessionTopic=${t}`,l=wi();l===Ge.browser?u.startsWith("https://")?window.open(u,"_blank","noreferrer noopener"):window.open(u,"_self","noreferrer noopener"):l===Ge.reactNative&&typeof(J.global==null?void 0:J.global.Linking)<"u"&&await J.global.Linking.openURL(u)}catch(s){console.error(s)}}async function u_(o,t){try{return await o.getItem(t)||(qr()?localStorage.getItem(t):void 0)}catch(r){console.error(r)}}const h_="irn";function Po(o){return(o==null?void 0:o.relay)||{protocol:h_}}function bs(o){const t=vw[o];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${o}`);return t}var l_=Object.defineProperty,ju=Object.getOwnPropertySymbols,p_=Object.prototype.hasOwnProperty,f_=Object.prototype.propertyIsEnumerable,Mu=(o,t,r)=>t in o?l_(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,d_=(o,t)=>{for(var r in t||(t={}))p_.call(t,r)&&Mu(o,r,t[r]);if(ju)for(var r of ju(t))f_.call(t,r)&&Mu(o,r,t[r]);return o};function g_(o,t="-"){const r={},s="relay"+t;return Object.keys(o).forEach(a=>{if(a.startsWith(s)){const u=a.replace(s,""),l=o[a];r[u]=l}}),r}function Uu(o){o=o.includes("wc://")?o.replace("wc://",""):o,o=o.includes("wc:")?o.replace("wc:",""):o;const t=o.indexOf(":"),r=o.indexOf("?")!==-1?o.indexOf("?"):void 0,s=o.substring(0,t),a=o.substring(t+1,r).split("@"),u=typeof r<"u"?o.substring(r):"",l=Ss.parse(u);return{protocol:s,topic:y_(a[0]),version:parseInt(a[1],10),symKey:l.symKey,relay:g_(l)}}function y_(o){return o.startsWith("//")?o.substring(2):o}function m_(o,t="-"){const r="relay",s={};return Object.keys(o).forEach(a=>{const u=r+t+a;o[a]&&(s[u]=o[a])}),s}function v_(o){return`${o.protocol}:${o.topic}@${o.version}?`+Ss.stringify(d_({symKey:o.symKey},m_(o.relay)))}function jr(o){const t=[];return o.forEach(r=>{const[s,a]=r.split(":");t.push(`${s}:${a}`)}),t}function w_(o){const t=[];return Object.values(o).forEach(r=>{t.push(...jr(r.accounts))}),t}function __(o,t){const r=[];return Object.values(o).forEach(s=>{jr(s.accounts).includes(t)&&r.push(...s.methods)}),r}function b_(o,t){const r=[];return Object.values(o).forEach(s=>{jr(s.accounts).includes(t)&&r.push(...s.events)}),r}function I_(o,t){const r=Is(o,t);if(r)throw new Error(r.message);const s={};for(const[a,u]of Object.entries(o))s[a]={methods:u.methods,events:u.events,chains:u.accounts.map(l=>`${l.split(":")[0]}:${l.split(":")[1]}`)};return s}function Ho(o){return o.includes(":")}function fi(o){return Ho(o)?o.split(":")[0]:o}const E_={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}},P_={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 x(o,t){const{message:r,code:s}=P_[o];return{message:t?`${r} ${t}`:r,code:s}}function he(o,t){const{message:r,code:s}=E_[o];return{message:t?`${r} ${t}`:r,code:s}}function It(o,t){return!!Array.isArray(o)}function Tr(o){return Object.getPrototypeOf(o)===Object.prototype&&Object.keys(o).length}function Ce(o){return typeof o>"u"}function _e(o,t){return t&&Ce(o)?!0:typeof o=="string"&&!!o.trim().length}function Vo(o,t){return t&&Ce(o)?!0:typeof o=="number"&&!isNaN(o)}function S_(o,t){const{requiredNamespaces:r}=t,s=Object.keys(o.namespaces),a=Object.keys(r);let u=!0;return cr(a,s)?(s.forEach(l=>{const{accounts:g,methods:w,events:d}=o.namespaces[l],b=jr(g),I=r[l];(!cr(Uh(l,I),b)||!cr(I.methods,w)||!cr(I.events,d))&&(u=!1)}),u):!1}function Rs(o){return _e(o,!1)&&o.includes(":")?o.split(":").length===2:!1}function O_(o){if(_e(o,!1)&&o.includes(":")){const t=o.split(":");if(t.length===3){const r=t[0]+":"+t[1];return!!t[2]&&Rs(r)}}return!1}function R_(o){if(_e(o,!1))try{return typeof new URL(o)<"u"}catch{return!1}return!1}function $_(o){var t;return(t=o==null?void 0:o.proposer)==null?void 0:t.publicKey}function N_(o){return o==null?void 0:o.topic}function x_(o,t){let r=null;return _e(o==null?void 0:o.publicKey,!1)||(r=x("MISSING_OR_INVALID",`${t} controller public key should be a string`)),r}function zu(o){let t=!0;return It(o)?o.length&&(t=o.every(r=>_e(r,!1))):t=!1,t}function C_(o,t,r){let s=null;return It(t)&&t.length?t.forEach(a=>{s||Rs(a)||(s=he("UNSUPPORTED_CHAINS",`${r}, chain ${a} should be a string and conform to "namespace:chainId" format`))}):Rs(o)||(s=he("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"] }`)),s}function A_(o,t,r){let s=null;return Object.entries(o).forEach(([a,u])=>{if(s)return;const l=C_(a,Uh(a,u),`${t} ${r}`);l&&(s=l)}),s}function T_(o,t){let r=null;return It(o)?o.forEach(s=>{r||O_(s)||(r=he("UNSUPPORTED_ACCOUNTS",`${t}, account ${s} should be a string and conform to "namespace:chainId:address" format`))}):r=he("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function D_(o,t){let r=null;return Object.values(o).forEach(s=>{if(r)return;const a=T_(s==null?void 0:s.accounts,`${t} namespace`);a&&(r=a)}),r}function q_(o,t){let r=null;return zu(o==null?void 0:o.methods)?zu(o==null?void 0:o.events)||(r=he("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):r=he("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),r}function Bh(o,t){let r=null;return Object.values(o).forEach(s=>{if(r)return;const a=q_(s,`${t}, namespace`);a&&(r=a)}),r}function j_(o,t,r){let s=null;if(o&&Tr(o)){const a=Bh(o,t);a&&(s=a);const u=A_(o,t,r);u&&(s=u)}else s=x("MISSING_OR_INVALID",`${t}, ${r} should be an object with data`);return s}function Is(o,t){let r=null;if(o&&Tr(o)){const s=Bh(o,t);s&&(r=s);const a=D_(o,t);a&&(r=a)}else r=x("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return r}function Wh(o){return _e(o.protocol,!0)}function M_(o,t){let r=!1;return o?o&&It(o)&&o.length&&o.forEach(s=>{r=Wh(s)}):r=!0,r}function U_(o){return typeof o=="number"}function Le(o){return typeof o<"u"&&typeof o!==null}function z_(o){return!(!o||typeof o!="object"||!o.code||!Vo(o.code,!1)||!o.message||!_e(o.message,!1))}function L_(o){return!(Ce(o)||!_e(o.method,!1))}function k_(o){return!(Ce(o)||Ce(o.result)&&Ce(o.error)||!Vo(o.id,!1)||!_e(o.jsonrpc,!1))}function K_(o){return!(Ce(o)||!_e(o.name,!1))}function Lu(o,t){return!(!Rs(t)||!w_(o).includes(t))}function H_(o,t,r){return _e(r,!1)?__(o,t).includes(r):!1}function V_(o,t,r){return _e(r,!1)?b_(o,t).includes(r):!1}function ku(o,t,r){let s=null;const a=F_(o),u=B_(t),l=Object.keys(a),g=Object.keys(u),w=Ku(Object.keys(o)),d=Ku(Object.keys(t)),b=w.filter(I=>!d.includes(I));return b.length&&(s=x("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces.
|
|
3
|
-
Required: ${b.toString()}
|
|
4
|
-
Received: ${Object.keys(t).toString()}`)),cr(l,g)||(s=x("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces.
|
|
5
|
-
Required: ${l.toString()}
|
|
6
|
-
Approved: ${g.toString()}`)),Object.keys(t).forEach(I=>{if(!I.includes(":")||s)return;const P=jr(t[I].accounts);P.includes(I)||(s=x("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${I}
|
|
7
|
-
Required: ${I}
|
|
8
|
-
Approved: ${P.toString()}`))}),l.forEach(I=>{s||(cr(a[I].methods,u[I].methods)?cr(a[I].events,u[I].events)||(s=x("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${I}`)):s=x("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${I}`))}),s}function F_(o){const t={};return Object.keys(o).forEach(r=>{var s;r.includes(":")?t[r]=o[r]:(s=o[r].chains)==null||s.forEach(a=>{t[a]={methods:o[r].methods,events:o[r].events}})}),t}function Ku(o){return[...new Set(o.map(t=>t.includes(":")?t.split(":")[0]:t))]}function B_(o){const t={};return Object.keys(o).forEach(r=>{if(r.includes(":"))t[r]=o[r];else{const s=jr(o[r].accounts);s==null||s.forEach(a=>{t[a]={accounts:o[r].accounts.filter(u=>u.includes(`${a}:`)),methods:o[r].methods,events:o[r].events}})}}),t}function W_(o,t){return Vo(o,!1)&&o<=t.max&&o>=t.min}function Hu(){const o=wi();return new Promise(t=>{switch(o){case Ge.browser:t(G_());break;case Ge.reactNative:t(Q_());break;case Ge.node:t(J_());break;default:t(!0)}})}function G_(){return qr()&&(navigator==null?void 0:navigator.onLine)}async function Q_(){if(Dr()&&typeof J.global<"u"&&J.global!=null&&J.global.NetInfo){const o=await(J.global==null?void 0:J.global.NetInfo.fetch());return o==null?void 0:o.isConnected}return!0}function J_(){return!0}function Y_(o){switch(wi()){case Ge.browser:Z_(o);break;case Ge.reactNative:X_(o);break}}function Z_(o){!Dr()&&qr()&&(window.addEventListener("online",()=>o(!0)),window.addEventListener("offline",()=>o(!1)))}function X_(o){var t;Dr()&&typeof J.global<"u"&&J.global!=null&&J.global.NetInfo&&((t=J.global)==null||t.NetInfo.addEventListener(r=>o(r==null?void 0:r.isConnected)))}const ao={};let ys=class{static get(t){return ao[t]}static set(t,r){ao[t]=r}static delete(t){delete ao[t]}};function eb(o){return!o||typeof o.then!="function"?Promise.resolve(o):o}function we(o,...t){try{return eb(o(...t))}catch(r){return Promise.reject(r)}}function tb(o){const t=typeof o;return o===null||t!=="object"&&t!=="function"}function rb(o){const t=Object.getPrototypeOf(o);return!t||t.isPrototypeOf(Object)}function Es(o){if(tb(o))return String(o);if(rb(o)||Array.isArray(o))return JSON.stringify(o);if(typeof o.toJSON=="function")return Es(o.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const So="base64:";function ib(o){return typeof o=="string"?o:So+ob(o)}function sb(o){return typeof o!="string"||!o.startsWith(So)?o:nb(o.slice(So.length))}function nb(o){return globalThis.Buffer?J.Buffer.from(o,"base64"):Uint8Array.from(globalThis.atob(o),t=>t.codePointAt(0))}function ob(o){return globalThis.Buffer?J.Buffer.from(o).toString("base64"):globalThis.btoa(String.fromCodePoint(...o))}function ze(o){var t;return o&&((t=o.split("?")[0])==null?void 0:t.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function ab(...o){return ze(o.join(":"))}function ms(o){return o=ze(o),o?o+":":""}function cb(o,t){if(t===void 0)return!0;let r=0,s=o.indexOf(":");for(;s>-1;)r++,s=o.indexOf(":",s+1);return r<=t}function ub(o,t){return t?o.startsWith(t)&&o[o.length-1]!=="$":o[o.length-1]!=="$"}const hb="memory",lb=()=>{const o=new Map;return{name:hb,getInstance:()=>o,hasItem(t){return o.has(t)},getItem(t){return o.get(t)??null},getItemRaw(t){return o.get(t)??null},setItem(t,r){o.set(t,r)},setItemRaw(t,r){o.set(t,r)},removeItem(t){o.delete(t)},getKeys(){return[...o.keys()]},clear(){o.clear()},dispose(){o.clear()}}};function pb(o={}){const t={mounts:{"":o.driver||lb()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=d=>{for(const b of t.mountpoints)if(d.startsWith(b))return{base:b,relativeKey:d.slice(b.length),driver:t.mounts[b]};return{base:"",relativeKey:d,driver:t.mounts[""]}},s=(d,b)=>t.mountpoints.filter(I=>I.startsWith(d)||b&&d.startsWith(I)).map(I=>({relativeBase:d.length>I.length?d.slice(I.length):void 0,mountpoint:I,driver:t.mounts[I]})),a=(d,b)=>{if(t.watching){b=ze(b);for(const I of t.watchListeners)I(d,b)}},u=async()=>{if(!t.watching){t.watching=!0;for(const d in t.mounts)t.unwatch[d]=await Vu(t.mounts[d],a,d)}},l=async()=>{if(t.watching){for(const d in t.unwatch)await t.unwatch[d]();t.unwatch={},t.watching=!1}},g=(d,b,I)=>{const P=new Map,A=N=>{let K=P.get(N.base);return K||(K={driver:N.driver,base:N.base,items:[]},P.set(N.base,K)),K};for(const N of d){const K=typeof N=="string",ee=ze(K?N:N.key),W=K?void 0:N.value,ge=K||!N.options?b:{...b,...N.options},Q=r(ee);A(Q).items.push({key:ee,value:W,relativeKey:Q.relativeKey,options:ge})}return Promise.all([...P.values()].map(N=>I(N))).then(N=>N.flat())},w={hasItem(d,b={}){d=ze(d);const{relativeKey:I,driver:P}=r(d);return we(P.hasItem,I,b)},getItem(d,b={}){d=ze(d);const{relativeKey:I,driver:P}=r(d);return we(P.getItem,I,b).then(A=>gs(A))},getItems(d,b={}){return g(d,b,I=>I.driver.getItems?we(I.driver.getItems,I.items.map(P=>({key:P.relativeKey,options:P.options})),b).then(P=>P.map(A=>({key:ab(I.base,A.key),value:gs(A.value)}))):Promise.all(I.items.map(P=>we(I.driver.getItem,P.relativeKey,P.options).then(A=>({key:P.key,value:gs(A)})))))},getItemRaw(d,b={}){d=ze(d);const{relativeKey:I,driver:P}=r(d);return P.getItemRaw?we(P.getItemRaw,I,b):we(P.getItem,I,b).then(A=>sb(A))},async setItem(d,b,I={}){if(b===void 0)return w.removeItem(d);d=ze(d);const{relativeKey:P,driver:A}=r(d);A.setItem&&(await we(A.setItem,P,Es(b),I),A.watch||a("update",d))},async setItems(d,b){await g(d,b,async I=>{if(I.driver.setItems)return we(I.driver.setItems,I.items.map(P=>({key:P.relativeKey,value:Es(P.value),options:P.options})),b);I.driver.setItem&&await Promise.all(I.items.map(P=>we(I.driver.setItem,P.relativeKey,Es(P.value),P.options)))})},async setItemRaw(d,b,I={}){if(b===void 0)return w.removeItem(d,I);d=ze(d);const{relativeKey:P,driver:A}=r(d);if(A.setItemRaw)await we(A.setItemRaw,P,b,I);else if(A.setItem)await we(A.setItem,P,ib(b),I);else return;A.watch||a("update",d)},async removeItem(d,b={}){typeof b=="boolean"&&(b={removeMeta:b}),d=ze(d);const{relativeKey:I,driver:P}=r(d);P.removeItem&&(await we(P.removeItem,I,b),(b.removeMeta||b.removeMata)&&await we(P.removeItem,I+"$",b),P.watch||a("remove",d))},async getMeta(d,b={}){typeof b=="boolean"&&(b={nativeOnly:b}),d=ze(d);const{relativeKey:I,driver:P}=r(d),A=Object.create(null);if(P.getMeta&&Object.assign(A,await we(P.getMeta,I,b)),!b.nativeOnly){const N=await we(P.getItem,I+"$",b).then(K=>gs(K));N&&typeof N=="object"&&(typeof N.atime=="string"&&(N.atime=new Date(N.atime)),typeof N.mtime=="string"&&(N.mtime=new Date(N.mtime)),Object.assign(A,N))}return A},setMeta(d,b,I={}){return this.setItem(d+"$",b,I)},removeMeta(d,b={}){return this.removeItem(d+"$",b)},async getKeys(d,b={}){var ee;d=ms(d);const I=s(d,!0);let P=[];const A=[];let N=!0;for(const W of I){(ee=W.driver.flags)!=null&&ee.maxDepth||(N=!1);const ge=await we(W.driver.getKeys,W.relativeBase,b);for(const Q of ge){const Y=W.mountpoint+ze(Q);P.some(se=>Y.startsWith(se))||A.push(Y)}P=[W.mountpoint,...P.filter(Q=>!Q.startsWith(W.mountpoint))]}const K=b.maxDepth!==void 0&&!N;return A.filter(W=>(!K||cb(W,b.maxDepth))&&ub(W,d))},async clear(d,b={}){d=ms(d),await Promise.all(s(d,!1).map(async I=>{if(I.driver.clear)return we(I.driver.clear,I.relativeBase,b);if(I.driver.removeItem){const P=await I.driver.getKeys(I.relativeBase||"",b);return Promise.all(P.map(A=>I.driver.removeItem(A,b)))}}))},async dispose(){await Promise.all(Object.values(t.mounts).map(d=>Fu(d)))},async watch(d){return await u(),t.watchListeners.push(d),async()=>{t.watchListeners=t.watchListeners.filter(b=>b!==d),t.watchListeners.length===0&&await l()}},async unwatch(){t.watchListeners=[],await l()},mount(d,b){if(d=ms(d),d&&t.mounts[d])throw new Error(`already mounted at ${d}`);return d&&(t.mountpoints.push(d),t.mountpoints.sort((I,P)=>P.length-I.length)),t.mounts[d]=b,t.watching&&Promise.resolve(Vu(b,a,d)).then(I=>{t.unwatch[d]=I}).catch(console.error),w},async unmount(d,b=!0){var I,P;d=ms(d),!(!d||!t.mounts[d])&&(t.watching&&d in t.unwatch&&((P=(I=t.unwatch)[d])==null||P.call(I),delete t.unwatch[d]),b&&await Fu(t.mounts[d]),t.mountpoints=t.mountpoints.filter(A=>A!==d),delete t.mounts[d])},getMount(d=""){d=ze(d)+":";const b=r(d);return{driver:b.driver,base:b.base}},getMounts(d="",b={}){return d=ze(d),s(d,b.parents).map(P=>({driver:P.driver,base:P.mountpoint}))},keys:(d,b={})=>w.getKeys(d,b),get:(d,b={})=>w.getItem(d,b),set:(d,b,I={})=>w.setItem(d,b,I),has:(d,b={})=>w.hasItem(d,b),del:(d,b={})=>w.removeItem(d,b),remove:(d,b={})=>w.removeItem(d,b)};return w}function Vu(o,t,r){return o.watch?o.watch((s,a)=>t(s,r+a)):()=>{}}async function Fu(o){typeof o.dispose=="function"&&await we(o.dispose)}const fb="idb-keyval";var db=(o={})=>{const t=o.base&&o.base.length>0?`${o.base}:`:"",r=a=>t+a;let s;return o.dbName&&o.storeName&&(s=_w(o.dbName,o.storeName)),{name:fb,options:o,async hasItem(a){return!(typeof await $u(r(a),s)>"u")},async getItem(a){return await $u(r(a),s)??null},setItem(a,u){return Pw(r(a),u,s)},removeItem(a){return Ew(r(a),s)},getKeys(){return Iw(s)},clear(){return bw(s)}}};const gb="WALLET_CONNECT_V2_INDEXED_DB",yb="keyvaluestorage";let mb=class{constructor(){this.indexedDb=pb({driver:db({dbName:gb,storeName:yb})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(t=>[t.key,t.value])}async getItem(t){const r=await this.indexedDb.getItem(t);if(r!==null)return r}async setItem(t,r){await this.indexedDb.setItem(t,xs(r))}async removeItem(t){await this.indexedDb.removeItem(t)}};var co=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof J.global<"u"?J.global:typeof self<"u"?self:{},Ps={exports:{}};(function(){let o;function t(){}o=t,o.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},o.prototype.setItem=function(r,s){this[r]=String(s)},o.prototype.removeItem=function(r){delete this[r]},o.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(s){r[s]=void 0,delete r[s]})},o.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},o.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof co<"u"&&co.localStorage?Ps.exports=co.localStorage:typeof window<"u"&&window.localStorage?Ps.exports=window.localStorage:Ps.exports=new t})();function vb(o){var t;return[o[0],Ns((t=o[1])!=null?t:"")]}class wb{constructor(){this.localStorage=Ps.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(vb)}async getItem(t){const r=this.localStorage.getItem(t);if(r!==null)return Ns(r)}async setItem(t,r){this.localStorage.setItem(t,xs(r))}async removeItem(t){this.localStorage.removeItem(t)}}const _b="wc_storage_version",Bu=1,bb=async(o,t,r)=>{const s=_b,a=await t.getItem(s);if(a&&a>=Bu){r(t);return}const u=await o.getKeys();if(!u.length){r(t);return}const l=[];for(;u.length;){const g=u.shift();if(!g)continue;const w=g.toLowerCase();if(w.includes("wc@")||w.includes("walletconnect")||w.includes("wc_")||w.includes("wallet_connect")){const d=await o.getItem(g);await t.setItem(g,d),l.push(g)}}await t.setItem(s,Bu),r(t),Ib(o,l)},Ib=async(o,t)=>{t.length&&t.forEach(async r=>{await o.removeItem(r)})};let Eb=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const t=new wb;this.storage=t;try{const r=new mb;bb(t,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(t){return await this.initialize(),this.storage.getItem(t)}async setItem(t,r){return await this.initialize(),this.storage.setItem(t,r)}async removeItem(t){return await this.initialize(),this.storage.removeItem(t)}async initialize(){this.initialized||await new Promise(t=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),t())},20)})}};var Mr={};/*! *****************************************************************************
|
|
9
|
-
Copyright (c) Microsoft Corporation.
|
|
10
|
-
|
|
11
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
12
|
-
purpose with or without fee is hereby granted.
|
|
13
|
-
|
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
15
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
16
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
17
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
18
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
19
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
20
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
21
|
-
***************************************************************************** */var Oo=function(o,t){return Oo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var a in s)s.hasOwnProperty(a)&&(r[a]=s[a])},Oo(o,t)};function Pb(o,t){Oo(o,t);function r(){this.constructor=o}o.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var Ro=function(){return Ro=Object.assign||function(t){for(var r,s=1,a=arguments.length;s<a;s++){r=arguments[s];for(var u in r)Object.prototype.hasOwnProperty.call(r,u)&&(t[u]=r[u])}return t},Ro.apply(this,arguments)};function Sb(o,t){var r={};for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&t.indexOf(s)<0&&(r[s]=o[s]);if(o!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,s=Object.getOwnPropertySymbols(o);a<s.length;a++)t.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(o,s[a])&&(r[s[a]]=o[s[a]]);return r}function Ob(o,t,r,s){var a=arguments.length,u=a<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,r):s,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(o,t,r,s);else for(var g=o.length-1;g>=0;g--)(l=o[g])&&(u=(a<3?l(u):a>3?l(t,r,u):l(t,r))||u);return a>3&&u&&Object.defineProperty(t,r,u),u}function Rb(o,t){return function(r,s){t(r,s,o)}}function $b(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)}function Nb(o,t,r,s){function a(u){return u instanceof r?u:new r(function(l){l(u)})}return new(r||(r=Promise))(function(u,l){function g(b){try{d(s.next(b))}catch(I){l(I)}}function w(b){try{d(s.throw(b))}catch(I){l(I)}}function d(b){b.done?u(b.value):a(b.value).then(g,w)}d((s=s.apply(o,t||[])).next())})}function xb(o,t){var r={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},s,a,u,l;return l={next:g(0),throw:g(1),return:g(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function g(d){return function(b){return w([d,b])}}function w(d){if(s)throw new TypeError("Generator is already executing.");for(;r;)try{if(s=1,a&&(u=d[0]&2?a.return:d[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,d[1])).done)return u;switch(a=0,u&&(d=[d[0]&2,u.value]),d[0]){case 0:case 1:u=d;break;case 4:return r.label++,{value:d[1],done:!1};case 5:r.label++,a=d[1],d=[0];continue;case 7:d=r.ops.pop(),r.trys.pop();continue;default:if(u=r.trys,!(u=u.length>0&&u[u.length-1])&&(d[0]===6||d[0]===2)){r=0;continue}if(d[0]===3&&(!u||d[1]>u[0]&&d[1]<u[3])){r.label=d[1];break}if(d[0]===6&&r.label<u[1]){r.label=u[1],u=d;break}if(u&&r.label<u[2]){r.label=u[2],r.ops.push(d);break}u[2]&&r.ops.pop(),r.trys.pop();continue}d=t.call(o,r)}catch(b){d=[6,b],a=0}finally{s=u=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function Cb(o,t,r,s){s===void 0&&(s=r),o[s]=t[r]}function Ab(o,t){for(var r in o)r!=="default"&&!t.hasOwnProperty(r)&&(t[r]=o[r])}function $o(o){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&o[t],s=0;if(r)return r.call(o);if(o&&typeof o.length=="number")return{next:function(){return o&&s>=o.length&&(o=void 0),{value:o&&o[s++],done:!o}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Gh(o,t){var r=typeof Symbol=="function"&&o[Symbol.iterator];if(!r)return o;var s=r.call(o),a,u=[],l;try{for(;(t===void 0||t-- >0)&&!(a=s.next()).done;)u.push(a.value)}catch(g){l={error:g}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(l)throw l.error}}return u}function Tb(){for(var o=[],t=0;t<arguments.length;t++)o=o.concat(Gh(arguments[t]));return o}function Db(){for(var o=0,t=0,r=arguments.length;t<r;t++)o+=arguments[t].length;for(var s=Array(o),a=0,t=0;t<r;t++)for(var u=arguments[t],l=0,g=u.length;l<g;l++,a++)s[a]=u[l];return s}function mi(o){return this instanceof mi?(this.v=o,this):new mi(o)}function qb(o,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=r.apply(o,t||[]),a,u=[];return a={},l("next"),l("throw"),l("return"),a[Symbol.asyncIterator]=function(){return this},a;function l(P){s[P]&&(a[P]=function(A){return new Promise(function(N,K){u.push([P,A,N,K])>1||g(P,A)})})}function g(P,A){try{w(s[P](A))}catch(N){I(u[0][3],N)}}function w(P){P.value instanceof mi?Promise.resolve(P.value.v).then(d,b):I(u[0][2],P)}function d(P){g("next",P)}function b(P){g("throw",P)}function I(P,A){P(A),u.shift(),u.length&&g(u[0][0],u[0][1])}}function jb(o){var t,r;return t={},s("next"),s("throw",function(a){throw a}),s("return"),t[Symbol.iterator]=function(){return this},t;function s(a,u){t[a]=o[a]?function(l){return(r=!r)?{value:mi(o[a](l)),done:a==="return"}:u?u(l):l}:u}}function Mb(o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=o[Symbol.asyncIterator],r;return t?t.call(o):(o=typeof $o=="function"?$o(o):o[Symbol.iterator](),r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r);function s(u){r[u]=o[u]&&function(l){return new Promise(function(g,w){l=o[u](l),a(g,w,l.done,l.value)})}}function a(u,l,g,w){Promise.resolve(w).then(function(d){u({value:d,done:g})},l)}}function Ub(o,t){return Object.defineProperty?Object.defineProperty(o,"raw",{value:t}):o.raw=t,o}function zb(o){if(o&&o.__esModule)return o;var t={};if(o!=null)for(var r in o)Object.hasOwnProperty.call(o,r)&&(t[r]=o[r]);return t.default=o,t}function Lb(o){return o&&o.__esModule?o:{default:o}}function kb(o,t){if(!t.has(o))throw new TypeError("attempted to get private field on non-instance");return t.get(o)}function Kb(o,t,r){if(!t.has(o))throw new TypeError("attempted to set private field on non-instance");return t.set(o,r),r}const Hb=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Ro},__asyncDelegator:jb,__asyncGenerator:qb,__asyncValues:Mb,__await:mi,__awaiter:Nb,__classPrivateFieldGet:kb,__classPrivateFieldSet:Kb,__createBinding:Cb,__decorate:Ob,__exportStar:Ab,__extends:Pb,__generator:xb,__importDefault:Lb,__importStar:zb,__makeTemplateObject:Ub,__metadata:$b,__param:Rb,__read:Gh,__rest:Sb,__spread:Tb,__spreadArrays:Db,__values:$o},Symbol.toStringTag,{value:"Module"})),qs=qo(Hb);var oi={},uo={},ai={};const Vb=qo(qw);var Wu;function Fb(){if(Wu)return ai;Wu=1,Object.defineProperty(ai,"__esModule",{value:!0}),ai.IHeartBeat=void 0;const o=Vb;class t extends o.IEvents{constructor(s){super()}}return ai.IHeartBeat=t,ai}var Gu;function Qh(){return Gu||(Gu=1,function(o){Object.defineProperty(o,"__esModule",{value:!0}),qs.__exportStar(Fb(),o)}(uo)),uo}var ho={},ar={},Qu;function Bb(){if(Qu)return ar;Qu=1,Object.defineProperty(ar,"__esModule",{value:!0}),ar.HEARTBEAT_EVENTS=ar.HEARTBEAT_INTERVAL=void 0;const o=q;return ar.HEARTBEAT_INTERVAL=o.FIVE_SECONDS,ar.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"},ar}var Ju;function Jh(){return Ju||(Ju=1,function(o){Object.defineProperty(o,"__esModule",{value:!0}),qs.__exportStar(Bb(),o)}(ho)),ho}var Yu;function Wb(){if(Yu)return oi;Yu=1,Object.defineProperty(oi,"__esModule",{value:!0}),oi.HeartBeat=void 0;const o=qs,t=gt,r=q,s=Qh(),a=Jh();class u extends s.IHeartBeat{constructor(g){super(g),this.events=new t.EventEmitter,this.interval=a.HEARTBEAT_INTERVAL,this.interval=(g==null?void 0:g.interval)||a.HEARTBEAT_INTERVAL}static init(g){return o.__awaiter(this,void 0,void 0,function*(){const w=new u(g);return yield w.init(),w})}init(){return o.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(g,w){this.events.on(g,w)}once(g,w){this.events.once(g,w)}off(g,w){this.events.off(g,w)}removeListener(g,w){this.events.removeListener(g,w)}initialize(){return o.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),r.toMiliseconds(this.interval))})}pulse(){this.events.emit(a.HEARTBEAT_EVENTS.pulse)}}return oi.HeartBeat=u,oi}(function(o){Object.defineProperty(o,"__esModule",{value:!0});const t=qs;t.__exportStar(Wb(),o),t.__exportStar(Qh(),o),t.__exportStar(Jh(),o)})(Mr);class Gb extends ur{constructor(t){super(),this.opts=t,this.protocol="wc",this.version=2}}let Qb=class extends ur{constructor(t,r){super(),this.core=t,this.logger=r,this.records=new Map}},Jb=class{constructor(t,r){this.logger=t,this.core=r}},Yb=class extends ur{constructor(t,r){super(),this.relayer=t,this.logger=r}},Zb=class extends ur{constructor(t){super()}},Xb=class{constructor(t,r,s,a){this.core=t,this.logger=r,this.name=s}};class e0 extends ur{constructor(t,r){super(),this.relayer=t,this.logger=r}}let t0=class extends ur{constructor(t,r){super(),this.core=t,this.logger=r}},r0=class{constructor(t,r){this.projectId=t,this.logger=r}},i0=class{constructor(t,r){this.projectId=t,this.logger=r}},s0=class{constructor(t){this.opts=t,this.protocol="wc",this.version=2}},n0=class{constructor(t){this.client=t}};class qt extends Sw{constructor(t){super(t),this.events=new gt.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(t),this.connection.connected&&this.registerEventListeners()}async connect(t=this.connection){await this.open(t)}async disconnect(){await this.close()}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}off(t,r){this.events.off(t,r)}removeListener(t,r){this.events.removeListener(t,r)}async request(t,r){return this.requestStrict(Cr(t.method,t.params||[],t.id||qh().toString()),r)}async requestStrict(t,r){return new Promise(async(s,a)=>{if(!this.connection.connected)try{await this.open()}catch(u){a(u)}this.events.on(`${t.id}`,u=>{bt(u)?a(u.error):s(u.result)});try{await this.connection.send(t,r)}catch(u){a(u)}})}setConnection(t=this.connection){return t}onPayload(t){this.events.emit("payload",t),Cs(t)?this.events.emit(`${t.id}`,t):this.events.emit("message",{type:t.method,data:t.params})}onClose(t){t&&t.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${t.code} ${t.reason?`(${t.reason})`:""}`)),this.events.emit("disconnect")}async open(t=this.connection){this.connection===t&&this.connection.connected||(this.connection.connected&&this.close(),typeof t=="string"&&(await this.connection.open(t),t=this.connection),this.connection=this.setConnection(t),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",t=>this.onPayload(t)),this.connection.on("close",t=>this.onClose(t)),this.connection.on("error",t=>this.events.emit("error",t)),this.connection.on("register_error",t=>this.onClose()),this.hasRegisteredEventListeners=!0)}}const o0=()=>typeof WebSocket<"u"?WebSocket:typeof J.global<"u"&&typeof J.global.WebSocket<"u"?J.global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),a0=()=>typeof WebSocket<"u"||typeof J.global<"u"&&typeof J.global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",Zu=o=>o.split("?")[0],Xu=10,c0=o0();let u0=class{constructor(t){if(this.url=t,this.events=new gt.EventEmitter,this.registering=!1,!Nu(t))throw new Error(`Provided URL is not compatible with WebSocket connection: ${t}`);this.url=t}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}off(t,r){this.events.off(t,r)}removeListener(t,r){this.events.removeListener(t,r)}async open(t=this.url){await this.register(t)}async close(){return new Promise((t,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=s=>{this.onClose(s),t()},this.socket.close()})}async send(t){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(xs(t))}catch(r){this.onError(t.id,r)}}register(t=this.url){if(!Nu(t))throw new Error(`Provided URL is not compatible with WebSocket connection: ${t}`);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((s,a)=>{this.events.once("register_error",u=>{this.resetMaxListeners(),a(u)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return a(new Error("WebSocket connection is missing or invalid"));s(this.socket)})})}return this.url=t,this.registering=!0,new Promise((r,s)=>{const a=new URLSearchParams(t).get("origin"),u=Ow.isReactNative()?{headers:{origin:a}}:{rejectUnauthorized:!Rw(t)},l=new c0(t,[],u);a0()?l.onerror=g=>{const w=g;s(this.emitError(w.error))}:l.on("error",g=>{s(this.emitError(g))}),l.onopen=()=>{this.onOpen(l),r(l)}})}onOpen(t){t.onmessage=r=>this.onPayload(r),t.onclose=r=>this.onClose(r),this.socket=t,this.registering=!1,this.events.emit("open")}onClose(t){this.socket=void 0,this.registering=!1,this.events.emit("close",t)}onPayload(t){if(typeof t.data>"u")return;const r=typeof t.data=="string"?Ns(t.data):t.data;this.events.emit("payload",r)}onError(t,r){const s=this.parseError(r),a=s.message||s.toString(),u=Uo(t,a);this.events.emit("payload",u)}parseError(t,r=this.url){return $w(t,Zu(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>Xu&&this.events.setMaxListeners(Xu)}emitError(t){const r=this.parseError(new Error((t==null?void 0:t.message)||`WebSocket connection failed for host: ${Zu(this.url)}`));return this.events.emit("register_error",r),r}};function h0(o,t){return t=t||{},new Promise(function(r,s){var a=new XMLHttpRequest,u=[],l=[],g={},w=function(){return{ok:(a.status/100|0)==2,statusText:a.statusText,status:a.status,url:a.responseURL,text:function(){return Promise.resolve(a.responseText)},json:function(){return Promise.resolve(a.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([a.response]))},clone:w,headers:{keys:function(){return u},entries:function(){return l},get:function(b){return g[b.toLowerCase()]},has:function(b){return b.toLowerCase()in g}}}};for(var d in a.open(t.method||"get",o,!0),a.onload=function(){a.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(b,I,P){u.push(I=I.toLowerCase()),l.push([I,P]),g[I]=g[I]?g[I]+","+P:P}),r(w())},a.onerror=s,a.withCredentials=t.credentials=="include",t.headers)a.setRequestHeader(d,t.headers[d]);a.send(t.body||null)})}const l0=Object.freeze(Object.defineProperty({__proto__:null,default:h0},Symbol.toStringTag,{value:"Module"})),eh=qo(l0);var p0=self.fetch||(self.fetch=eh.default||eh);const f0=gw(p0);var d0={};function g0(o,t){if(o.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),s=0;s<r.length;s++)r[s]=255;for(var a=0;a<o.length;a++){var u=o.charAt(a),l=u.charCodeAt(0);if(r[l]!==255)throw new TypeError(u+" is ambiguous");r[l]=a}var g=o.length,w=o.charAt(0),d=Math.log(g)/Math.log(256),b=Math.log(256)/Math.log(g);function I(N){if(N instanceof Uint8Array||(ArrayBuffer.isView(N)?N=new Uint8Array(N.buffer,N.byteOffset,N.byteLength):Array.isArray(N)&&(N=Uint8Array.from(N))),!(N instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(N.length===0)return"";for(var K=0,ee=0,W=0,ge=N.length;W!==ge&&N[W]===0;)W++,K++;for(var Q=(ge-W)*b+1>>>0,Y=new Uint8Array(Q);W!==ge;){for(var se=N[W],Te=0,le=Q-1;(se!==0||Te<ee)&&le!==-1;le--,Te++)se+=256*Y[le]>>>0,Y[le]=se%g>>>0,se=se/g>>>0;if(se!==0)throw new Error("Non-zero carry");ee=Te,W++}for(var Re=Q-ee;Re!==Q&&Y[Re]===0;)Re++;for(var Mt=w.repeat(K);Re<Q;++Re)Mt+=o.charAt(Y[Re]);return Mt}function P(N){if(typeof N!="string")throw new TypeError("Expected String");if(N.length===0)return new Uint8Array;var K=0;if(N[K]!==" "){for(var ee=0,W=0;N[K]===w;)ee++,K++;for(var ge=(N.length-K)*d+1>>>0,Q=new Uint8Array(ge);N[K];){var Y=r[N.charCodeAt(K)];if(Y===255)return;for(var se=0,Te=ge-1;(Y!==0||se<W)&&Te!==-1;Te--,se++)Y+=g*Q[Te]>>>0,Q[Te]=Y%256>>>0,Y=Y/256>>>0;if(Y!==0)throw new Error("Non-zero carry");W=se,K++}if(N[K]!==" "){for(var le=ge-W;le!==ge&&Q[le]===0;)le++;for(var Re=new Uint8Array(ee+(ge-le)),Mt=ee;le!==ge;)Re[Mt++]=Q[le++];return Re}}}function A(N){var K=P(N);if(K)return K;throw new Error(`Non-${t} character`)}return{encode:I,decodeUnsafe:P,decode:A}}var y0=g0,m0=y0;const Yh=o=>{if(o instanceof Uint8Array&&o.constructor.name==="Uint8Array")return o;if(o instanceof ArrayBuffer)return new Uint8Array(o);if(ArrayBuffer.isView(o))return new Uint8Array(o.buffer,o.byteOffset,o.byteLength);throw new Error("Unknown type, must be binary type")},v0=o=>new TextEncoder().encode(o),w0=o=>new TextDecoder().decode(o);class _0{constructor(t,r,s){this.name=t,this.prefix=r,this.baseEncode=s}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class b0{constructor(t,r,s){if(this.name=t,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=s}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Zh(this,t)}}class I0{constructor(t){this.decoders=t}or(t){return Zh(this,t)}decode(t){const r=t[0],s=this.decoders[r];if(s)return s.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Zh=(o,t)=>new I0({...o.decoders||{[o.prefix]:o},...t.decoders||{[t.prefix]:t}});class E0{constructor(t,r,s,a){this.name=t,this.prefix=r,this.baseEncode=s,this.baseDecode=a,this.encoder=new _0(t,r,s),this.decoder=new b0(t,r,a)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const js=({name:o,prefix:t,encode:r,decode:s})=>new E0(o,t,r,s),_i=({prefix:o,name:t,alphabet:r})=>{const{encode:s,decode:a}=m0(r,t);return js({prefix:o,name:t,encode:s,decode:u=>Yh(a(u))})},P0=(o,t,r,s)=>{const a={};for(let b=0;b<t.length;++b)a[t[b]]=b;let u=o.length;for(;o[u-1]==="=";)--u;const l=new Uint8Array(u*r/8|0);let g=0,w=0,d=0;for(let b=0;b<u;++b){const I=a[o[b]];if(I===void 0)throw new SyntaxError(`Non-${s} character`);w=w<<r|I,g+=r,g>=8&&(g-=8,l[d++]=255&w>>g)}if(g>=r||255&w<<8-g)throw new SyntaxError("Unexpected end of data");return l},S0=(o,t,r)=>{const s=t[t.length-1]==="=",a=(1<<r)-1;let u="",l=0,g=0;for(let w=0;w<o.length;++w)for(g=g<<8|o[w],l+=8;l>r;)l-=r,u+=t[a&g>>l];if(l&&(u+=t[a&g<<r-l]),s)for(;u.length*r&7;)u+="=";return u},Ee=({name:o,prefix:t,bitsPerChar:r,alphabet:s})=>js({prefix:t,name:o,encode(a){return S0(a,s,r)},decode(a){return P0(a,s,r,o)}}),O0=js({prefix:"\0",name:"identity",encode:o=>w0(o),decode:o=>v0(o)});var R0=Object.freeze({__proto__:null,identity:O0});const $0=Ee({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var N0=Object.freeze({__proto__:null,base2:$0});const x0=Ee({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var C0=Object.freeze({__proto__:null,base8:x0});const A0=_i({prefix:"9",name:"base10",alphabet:"0123456789"});var T0=Object.freeze({__proto__:null,base10:A0});const D0=Ee({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),q0=Ee({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var j0=Object.freeze({__proto__:null,base16:D0,base16upper:q0});const M0=Ee({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),U0=Ee({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),z0=Ee({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),L0=Ee({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),k0=Ee({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),K0=Ee({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),H0=Ee({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),V0=Ee({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),F0=Ee({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var B0=Object.freeze({__proto__:null,base32:M0,base32upper:U0,base32pad:z0,base32padupper:L0,base32hex:k0,base32hexupper:K0,base32hexpad:H0,base32hexpadupper:V0,base32z:F0});const W0=_i({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),G0=_i({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Q0=Object.freeze({__proto__:null,base36:W0,base36upper:G0});const J0=_i({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Y0=_i({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Z0=Object.freeze({__proto__:null,base58btc:J0,base58flickr:Y0});const X0=Ee({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),eI=Ee({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),tI=Ee({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),rI=Ee({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var iI=Object.freeze({__proto__:null,base64:X0,base64pad:eI,base64url:tI,base64urlpad:rI});const Xh=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),sI=Xh.reduce((o,t,r)=>(o[r]=t,o),[]),nI=Xh.reduce((o,t,r)=>(o[t.codePointAt(0)]=r,o),[]);function oI(o){return o.reduce((t,r)=>(t+=sI[r],t),"")}function aI(o){const t=[];for(const r of o){const s=nI[r.codePointAt(0)];if(s===void 0)throw new Error(`Non-base256emoji character: ${r}`);t.push(s)}return new Uint8Array(t)}const cI=js({prefix:"🚀",name:"base256emoji",encode:oI,decode:aI});var uI=Object.freeze({__proto__:null,base256emoji:cI}),hI=el,th=128,lI=-128,pI=Math.pow(2,31);function el(o,t,r){t=t||[],r=r||0;for(var s=r;o>=pI;)t[r++]=o&255|th,o/=128;for(;o&lI;)t[r++]=o&255|th,o>>>=7;return t[r]=o|0,el.bytes=r-s+1,t}var fI=No,dI=128,rh=127;function No(o,s){var r=0,s=s||0,a=0,u=s,l,g=o.length;do{if(u>=g)throw No.bytes=0,new RangeError("Could not decode varint");l=o[u++],r+=a<28?(l&rh)<<a:(l&rh)*Math.pow(2,a),a+=7}while(l>=dI);return No.bytes=u-s,r}var gI=Math.pow(2,7),yI=Math.pow(2,14),mI=Math.pow(2,21),vI=Math.pow(2,28),wI=Math.pow(2,35),_I=Math.pow(2,42),bI=Math.pow(2,49),II=Math.pow(2,56),EI=Math.pow(2,63),PI=function(o){return o<gI?1:o<yI?2:o<mI?3:o<vI?4:o<wI?5:o<_I?6:o<bI?7:o<II?8:o<EI?9:10},SI={encode:hI,decode:fI,encodingLength:PI},tl=SI;const ih=(o,t,r=0)=>(tl.encode(o,t,r),t),sh=o=>tl.encodingLength(o),xo=(o,t)=>{const r=t.byteLength,s=sh(o),a=s+sh(r),u=new Uint8Array(a+r);return ih(o,u,0),ih(r,u,s),u.set(t,a),new OI(o,r,t,u)};class OI{constructor(t,r,s,a){this.code=t,this.size=r,this.digest=s,this.bytes=a}}const rl=({name:o,code:t,encode:r})=>new RI(o,t,r);class RI{constructor(t,r,s){this.name=t,this.code=r,this.encode=s}digest(t){if(t instanceof Uint8Array){const r=this.encode(t);return r instanceof Uint8Array?xo(this.code,r):r.then(s=>xo(this.code,s))}else throw Error("Unknown type, must be binary type")}}const il=o=>async t=>new Uint8Array(await crypto.subtle.digest(o,t)),$I=rl({name:"sha2-256",code:18,encode:il("SHA-256")}),NI=rl({name:"sha2-512",code:19,encode:il("SHA-512")});var xI=Object.freeze({__proto__:null,sha256:$I,sha512:NI});const sl=0,CI="identity",nl=Yh,AI=o=>xo(sl,nl(o)),TI={code:sl,name:CI,encode:nl,digest:AI};var DI=Object.freeze({__proto__:null,identity:TI});new TextEncoder,new TextDecoder;const nh={...R0,...N0,...C0,...T0,...j0,...B0,...Q0,...Z0,...iI,...uI};({...xI,...DI});function ol(o){return globalThis.Buffer!=null?new Uint8Array(o.buffer,o.byteOffset,o.byteLength):o}function qI(o=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?ol(globalThis.Buffer.allocUnsafe(o)):new Uint8Array(o)}function al(o,t,r,s){return{name:o,prefix:t,encoder:{name:o,prefix:t,encode:r},decoder:{decode:s}}}const oh=al("utf8","u",o=>"u"+new TextDecoder("utf8").decode(o),o=>new TextEncoder().encode(o.substring(1))),lo=al("ascii","a",o=>{let t="a";for(let r=0;r<o.length;r++)t+=String.fromCharCode(o[r]);return t},o=>{o=o.substring(1);const t=qI(o.length);for(let r=0;r<o.length;r++)t[r]=o.charCodeAt(r);return t}),jI={utf8:oh,"utf-8":oh,hex:nh.base16,latin1:lo,ascii:lo,binary:lo,...nh};function MI(o,t="utf8"){const r=jI[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?ol(globalThis.Buffer.from(o,"utf-8")):r.decoder.decode(`${r.prefix}${o}`)}const cl="wc",UI=2,ul="core",Qt=`${cl}@2:${ul}:`,zI={logger:"error"},LI={database:":memory:"},kI="crypto",ah="client_ed25519_seed",KI=q.ONE_DAY,HI="keychain",VI="0.3",FI="messages",BI="0.3",WI=q.SIX_HOURS,GI="publisher",hl="irn",QI="error",ll="wss://relay.walletconnect.com",ch="wss://relay.walletconnect.org",JI="relayer",Oe={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"},YI="_subscription",Tt={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},ZI=q.ONE_SECOND,XI="2.11.0",eE=1e4,tE="0.3",rE="WALLETCONNECT_CLIENT_ID",pt={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},iE="subscription",sE="0.3",nE=q.FIVE_SECONDS*1e3,oE="pairing",aE="0.3",ci={wc_pairingDelete:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:q.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:q.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:q.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:q.ONE_DAY,prompt:!1,tag:0},res:{ttl:q.ONE_DAY,prompt:!1,tag:0}}},di={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},_t={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},cE="history",uE="0.3",hE="expirer",st={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},lE="0.3",po="verify-api",xr="https://verify.walletconnect.com",Co="https://verify.walletconnect.org",pE=[xr,Co],fE="echo",dE="https://echo.walletconnect.com";class gE{constructor(t,r){this.core=t,this.logger=r,this.keychain=new Map,this.name=HI,this.version=VI,this.initialized=!1,this.storagePrefix=Qt,this.init=async()=>{if(!this.initialized){const s=await this.getKeyChain();typeof s<"u"&&(this.keychain=s),this.initialized=!0}},this.has=s=>(this.isInitialized(),this.keychain.has(s)),this.set=async(s,a)=>{this.isInitialized(),this.keychain.set(s,a),await this.persist()},this.get=s=>{this.isInitialized();const a=this.keychain.get(s);if(typeof a>"u"){const{message:u}=x("NO_MATCHING_KEY",`${this.name}: ${s}`);throw new Error(u)}return a},this.del=async s=>{this.isInitialized(),this.keychain.delete(s),await this.persist()},this.core=t,this.logger=ke(r,this.name)}get context(){return Qe(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(t){await this.core.storage.setItem(this.storageKey,Kh(t))}async getKeyChain(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?Hh(t):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:t}=x("NOT_INITIALIZED",this.name);throw new Error(t)}}}class yE{constructor(t,r,s){this.core=t,this.logger=r,this.name=kI,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=a=>(this.isInitialized(),this.keychain.has(a)),this.getClientId=async()=>{this.isInitialized();const a=await this.getClientSeed(),u=xu(a);return Nw(u.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const a=Lw();return this.setPrivateKey(a.publicKey,a.privateKey)},this.signJWT=async a=>{this.isInitialized();const u=await this.getClientSeed(),l=xu(u),g=Eo();return await xw(g,a,KI,l)},this.generateSharedKey=(a,u,l)=>{this.isInitialized();const g=this.getPrivateKey(a),w=kw(g,u);return this.setSymKey(w,l)},this.setSymKey=async(a,u)=>{this.isInitialized();const l=u||Kw(a);return await this.keychain.set(l,a),l},this.deleteKeyPair=async a=>{this.isInitialized(),await this.keychain.del(a)},this.deleteSymKey=async a=>{this.isInitialized(),await this.keychain.del(a)},this.encode=async(a,u,l)=>{this.isInitialized();const g=kh(l),w=xs(u);if(Au(g)){const P=g.senderPublicKey,A=g.receiverPublicKey;a=await this.generateSharedKey(P,A)}const d=this.getSymKey(a),{type:b,senderPublicKey:I}=g;return Vw({type:b,symKey:d,message:w,senderPublicKey:I})},this.decode=async(a,u,l)=>{this.isInitialized();const g=Ww(u,l);if(Au(g)){const w=g.receiverPublicKey,d=g.senderPublicKey;a=await this.generateSharedKey(w,d)}try{const w=this.getSymKey(a),d=Fw({symKey:w,encoded:u});return Ns(d)}catch(w){this.logger.error(`Failed to decode message from topic: '${a}', clientId: '${await this.getClientId()}'`),this.logger.error(w)}},this.getPayloadType=a=>{const u=Os(a);return vi(u.type)},this.getPayloadSenderPublicKey=a=>{const u=Os(a);return u.senderPublicKey?nt(u.senderPublicKey,Ae):void 0},this.core=t,this.logger=ke(r,this.name),this.keychain=s||new gE(this.core,this.logger)}get context(){return Qe(this.logger)}async setPrivateKey(t,r){return await this.keychain.set(t,r),t}getPrivateKey(t){return this.keychain.get(t)}async getClientSeed(){let t="";try{t=this.keychain.get(ah)}catch{t=Eo(),await this.keychain.set(ah,t)}return MI(t,"base16")}getSymKey(t){return this.keychain.get(t)}isInitialized(){if(!this.initialized){const{message:t}=x("NOT_INITIALIZED",this.name);throw new Error(t)}}}class mE extends Jb{constructor(t,r){super(t,r),this.logger=t,this.core=r,this.messages=new Map,this.name=FI,this.version=BI,this.initialized=!1,this.storagePrefix=Qt,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const s=await this.getRelayerMessages();typeof s<"u"&&(this.messages=s),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(s){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(s)}finally{this.initialized=!0}}},this.set=async(s,a)=>{this.isInitialized();const u=Ar(a);let l=this.messages.get(s);return typeof l>"u"&&(l={}),typeof l[u]<"u"||(l[u]=a,this.messages.set(s,l),await this.persist()),u},this.get=s=>{this.isInitialized();let a=this.messages.get(s);return typeof a>"u"&&(a={}),a},this.has=(s,a)=>{this.isInitialized();const u=this.get(s),l=Ar(a);return typeof u[l]<"u"},this.del=async s=>{this.isInitialized(),this.messages.delete(s),await this.persist()},this.logger=ke(t,this.name),this.core=r}get context(){return Qe(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(t){await this.core.storage.setItem(this.storageKey,Kh(t))}async getRelayerMessages(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?Hh(t):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:t}=x("NOT_INITIALIZED",this.name);throw new Error(t)}}}class vE extends Yb{constructor(t,r){super(t,r),this.relayer=t,this.logger=r,this.events=new gt.EventEmitter,this.name=GI,this.queue=new Map,this.publishTimeout=q.toMiliseconds(q.TEN_SECONDS),this.needsTransportRestart=!1,this.publish=async(s,a,u)=>{var l;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:s,message:a,opts:u}});try{const g=(u==null?void 0:u.ttl)||WI,w=Po(u),d=(u==null?void 0:u.prompt)||!1,b=(u==null?void 0:u.tag)||0,I=(u==null?void 0:u.id)||qh().toString(),P={topic:s,message:a,opts:{ttl:g,relay:w,prompt:d,tag:b,id:I}},A=setTimeout(()=>this.queue.set(I,P),this.publishTimeout);try{await await yi(this.rpcPublish(s,a,g,w,d,b,I),this.publishTimeout,"Failed to publish payload, please try again."),this.removeRequestFromQueue(I),this.relayer.events.emit(Oe.publish,P)}catch(N){if(this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0,(l=u==null?void 0:u.internal)!=null&&l.throwOnFailedPublish)throw this.removeRequestFromQueue(I),N;return}finally{clearTimeout(A)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:s,message:a,opts:u}})}catch(g){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(g),g}},this.on=(s,a)=>{this.events.on(s,a)},this.once=(s,a)=>{this.events.once(s,a)},this.off=(s,a)=>{this.events.off(s,a)},this.removeListener=(s,a)=>{this.events.removeListener(s,a)},this.relayer=t,this.logger=ke(r,this.name),this.registerEventListeners()}get context(){return Qe(this.logger)}rpcPublish(t,r,s,a,u,l,g){var w,d,b,I;const P={method:bs(a.protocol).publish,params:{topic:t,message:r,ttl:s,prompt:u,tag:l},id:g};return Ce((w=P.params)==null?void 0:w.prompt)&&((d=P.params)==null||delete d.prompt),Ce((b=P.params)==null?void 0:b.tag)&&((I=P.params)==null||delete I.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:P}),this.relayer.request(P)}removeRequestFromQueue(t){this.queue.delete(t)}checkQueue(){this.queue.forEach(async t=>{const{topic:r,message:s,opts:a}=t;await this.publish(r,s,a)})}registerEventListeners(){this.relayer.core.heartbeat.on(Mr.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(Oe.connection_stalled);return}this.checkQueue()}),this.relayer.on(Oe.message_ack,t=>{this.removeRequestFromQueue(t.id.toString())})}}class wE{constructor(){this.map=new Map,this.set=(t,r)=>{const s=this.get(t);this.exists(t,r)||this.map.set(t,[...s,r])},this.get=t=>this.map.get(t)||[],this.exists=(t,r)=>this.get(t).includes(r),this.delete=(t,r)=>{if(typeof r>"u"){this.map.delete(t);return}if(!this.map.has(t))return;const s=this.get(t);if(!this.exists(t,r))return;const a=s.filter(u=>u!==r);if(!a.length){this.map.delete(t);return}this.map.set(t,a)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var _E=Object.defineProperty,bE=Object.defineProperties,IE=Object.getOwnPropertyDescriptors,uh=Object.getOwnPropertySymbols,EE=Object.prototype.hasOwnProperty,PE=Object.prototype.propertyIsEnumerable,hh=(o,t,r)=>t in o?_E(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,ui=(o,t)=>{for(var r in t||(t={}))EE.call(t,r)&&hh(o,r,t[r]);if(uh)for(var r of uh(t))PE.call(t,r)&&hh(o,r,t[r]);return o},fo=(o,t)=>bE(o,IE(t));class SE extends e0{constructor(t,r){super(t,r),this.relayer=t,this.logger=r,this.subscriptions=new Map,this.topicMap=new wE,this.events=new gt.EventEmitter,this.name=iE,this.version=sE,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Qt,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(s,a)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:s,opts:a}});try{const u=Po(a),l={topic:s,relay:u};this.pending.set(s,l);const g=await this.rpcSubscribe(s,u);return this.onSubscribe(g,l),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:s,opts:a}}),g}catch(u){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(u),u}},this.unsubscribe=async(s,a)=>{await this.restartToComplete(),this.isInitialized(),typeof(a==null?void 0:a.id)<"u"?await this.unsubscribeById(s,a.id,a):await this.unsubscribeByTopic(s,a)},this.isSubscribed=async s=>this.topics.includes(s)?!0:await new Promise((a,u)=>{const l=new q.Watch;l.start(this.pendingSubscriptionWatchLabel);const g=setInterval(()=>{!this.pending.has(s)&&this.topics.includes(s)&&(clearInterval(g),l.stop(this.pendingSubscriptionWatchLabel),a(!0)),l.elapsed(this.pendingSubscriptionWatchLabel)>=nE&&(clearInterval(g),l.stop(this.pendingSubscriptionWatchLabel),u(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1),this.on=(s,a)=>{this.events.on(s,a)},this.once=(s,a)=>{this.events.once(s,a)},this.off=(s,a)=>{this.events.off(s,a)},this.removeListener=(s,a)=>{this.events.removeListener(s,a)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=t,this.logger=ke(r,this.name),this.clientId=""}get context(){return Qe(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(t,r){let s=!1;try{s=this.getSubscription(t).topic===r}catch{}return s}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(t,r){const s=this.topicMap.get(t);await Promise.all(s.map(async a=>await this.unsubscribeById(t,a,r)))}async unsubscribeById(t,r,s){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:r,opts:s}});try{const a=Po(s);await this.rpcUnsubscribe(t,r,a);const u=he("USER_DISCONNECTED",`${this.name}, ${t}`);await this.onUnsubscribe(t,r,u),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:r,opts:s}})}catch(a){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(a),a}}async rpcSubscribe(t,r){const s={method:bs(r.protocol).subscribe,params:{topic:t}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});try{await await yi(this.relayer.request(s),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Oe.connection_stalled)}return Ar(t+this.clientId)}async rpcBatchSubscribe(t){if(!t.length)return;const r=t[0].relay,s={method:bs(r.protocol).batchSubscribe,params:{topics:t.map(a=>a.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});try{return await await yi(this.relayer.request(s),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(Oe.connection_stalled)}}rpcUnsubscribe(t,r,s){const a={method:bs(s.protocol).unsubscribe,params:{topic:t,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:a}),this.relayer.request(a)}onSubscribe(t,r){this.setSubscription(t,fo(ui({},r),{id:t})),this.pending.delete(r.topic)}onBatchSubscribe(t){t.length&&t.forEach(r=>{this.setSubscription(r.id,ui({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(t,r,s){this.events.removeAllListeners(r),this.hasSubscription(r,t)&&this.deleteSubscription(r,s),await this.relayer.messages.del(t)}async setRelayerSubscriptions(t){await this.relayer.core.storage.setItem(this.storageKey,t)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(t,r){this.subscriptions.has(t)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:t,subscription:r}),this.addSubscription(t,r))}addSubscription(t,r){this.subscriptions.set(t,ui({},r)),this.topicMap.set(r.topic,t),this.events.emit(pt.created,r)}getSubscription(t){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:t});const r=this.subscriptions.get(t);if(!r){const{message:s}=x("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(s)}return r}deleteSubscription(t,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:t,reason:r});const s=this.getSubscription(t);this.subscriptions.delete(t),this.topicMap.delete(s.topic,t),this.events.emit(pt.deleted,fo(ui({},s),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(pt.sync)}async reset(){if(this.cached.length){const t=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r<t;r++){const s=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(s)}}this.events.emit(pt.resubscribed)}async restore(){try{const t=await this.getRelayerSubscriptions();if(typeof t>"u"||!t.length)return;if(this.subscriptions.size){const{message:r}=x("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=t,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(t){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(t)}}async batchSubscribe(t){if(!t.length)return;const r=await this.rpcBatchSubscribe(t);It(r)&&this.onBatchSubscribe(r.map((s,a)=>fo(ui({},t[a]),{id:s})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;const t=[];this.pending.forEach(r=>{t.push(r)}),await this.batchSubscribe(t)}registerEventListeners(){this.relayer.core.heartbeat.on(Mr.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(Oe.connect,async()=>{await this.onConnect()}),this.relayer.on(Oe.disconnect,()=>{this.onDisconnect()}),this.events.on(pt.created,async t=>{const r=pt.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:t}),await this.persist()}),this.events.on(pt.deleted,async t=>{const r=pt.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:t}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:t}=x("NOT_INITIALIZED",this.name);throw new Error(t)}}async restartToComplete(){this.restartInProgress&&await new Promise(t=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),t())},this.pollingInterval)})}}var OE=Object.defineProperty,lh=Object.getOwnPropertySymbols,RE=Object.prototype.hasOwnProperty,$E=Object.prototype.propertyIsEnumerable,ph=(o,t,r)=>t in o?OE(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,NE=(o,t)=>{for(var r in t||(t={}))RE.call(t,r)&&ph(o,r,t[r]);if(lh)for(var r of lh(t))$E.call(t,r)&&ph(o,r,t[r]);return o};class xE extends Zb{constructor(t){super(t),this.protocol="wc",this.version=2,this.events=new gt.EventEmitter,this.name=JI,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.hasExperiencedNetworkDisruption=!1,this.request=async r=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(r)}catch(s){throw this.logger.debug("Failed to Publish Request"),this.logger.error(s),s}},this.onPayloadHandler=r=>{this.onProviderPayload(r)},this.onConnectHandler=()=>{this.events.emit(Oe.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(Oe.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Tt.payload,this.onPayloadHandler),this.provider.on(Tt.connect,this.onConnectHandler),this.provider.on(Tt.disconnect,this.onDisconnectHandler),this.provider.on(Tt.error,this.onProviderErrorHandler)},this.core=t.core,this.logger=typeof t.logger<"u"&&typeof t.logger!="string"?ke(t.logger,this.name):As(Ts({level:t.logger||QI})),this.messages=new mE(this.logger,t.core),this.subscriber=new SE(this,this.logger),this.publisher=new vE(this,this.logger),this.relayUrl=(t==null?void 0:t.relayUrl)||ll,this.projectId=t.projectId,this.bundleId=Xw(),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${ch}...`),await this.restartTransport(ch)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},eE)}get context(){return Qe(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(t,r,s){this.isInitialized(),await this.publisher.publish(t,r,s),await this.recordMessageEvent({topic:t,message:r,publishedAt:Date.now()})}async subscribe(t,r){var s;this.isInitialized();let a=((s=this.subscriber.topicMap.get(t))==null?void 0:s[0])||"";if(a)return a;let u;const l=g=>{g.topic===t&&(this.subscriber.off(pt.created,l),u())};return await Promise.all([new Promise(g=>{u=g,this.subscriber.on(pt.created,l)}),new Promise(async g=>{a=await this.subscriber.subscribe(t,r),g()})]),a}async unsubscribe(t,r){this.isInitialized(),await this.subscriber.unsubscribe(t,r)}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}off(t,r){this.events.off(t,r)}removeListener(t,r){this.events.removeListener(t,r)}async transportClose(){this.transportExplicitlyClosed=!0,this.hasExperiencedNetworkDisruption&&this.connected?await yi(this.provider.disconnect(),1e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.connected&&await this.provider.disconnect()}async transportOpen(t){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){t&&t!==this.relayUrl&&(this.relayUrl=t,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise(r=>{if(!this.initialized)return r();this.subscriber.once(pt.resubscribed,()=>{r()})}),new Promise(async(r,s)=>{try{await yi(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(a){s(a);return}r()})])}catch(r){this.logger.error(r);const s=r;if(!this.isConnectionStalled(s.message))throw r;this.provider.events.emit(Tt.disconnect)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(t){await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress&&(this.relayUrl=t||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Hu())throw new Error("No internet connection detected. Please restart your network and try again.")}isConnectionStalled(t){return this.staleConnectionErrors.some(r=>t.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const t=await this.core.crypto.signJWT(this.relayUrl);this.provider=new qt(new u0(n_({sdkVersion:XI,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:t,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(t){const{topic:r,message:s}=t;await this.messages.set(r,s)}async shouldIgnoreMessageEvent(t){const{topic:r,message:s}=t;if(!s||s.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${s}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const a=this.messages.has(r,s);return a&&this.logger.debug(`Ignoring duplicate message: ${s}`),a}async onProviderPayload(t){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),zo(t)){if(!t.method.endsWith(YI))return;const r=t.params,{topic:s,message:a,publishedAt:u}=r.data,l={topic:s,message:a,publishedAt:u};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(NE({type:"event",event:r.id},l)),this.events.emit(r.id,l),await this.acknowledgePayload(t),await this.onMessageEvent(l)}else Cs(t)&&this.events.emit(Oe.message_ack,t)}async onMessageEvent(t){await this.shouldIgnoreMessageEvent(t)||(this.events.emit(Oe.message,t),await this.recordMessageEvent(t))}async acknowledgePayload(t){const r=Ds(t.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Tt.payload,this.onPayloadHandler),this.provider.off(Tt.connect,this.onConnectHandler),this.provider.off(Tt.disconnect,this.onDisconnectHandler),this.provider.off(Tt.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(Oe.connection_stalled,()=>{this.restartTransport().catch(r=>this.logger.error(r))});let t=await Hu();Y_(async r=>{this.initialized&&t!==r&&(t=r,r?await this.restartTransport().catch(s=>this.logger.error(s)):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch(s=>this.logger.error(s))))})}onProviderDisconnect(){this.events.emit(Oe.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout(async()=>{await this.restartTransport().catch(t=>this.logger.error(t))},q.toMiliseconds(ZI)))}isInitialized(){if(!this.initialized){const{message:t}=x("NOT_INITIALIZED",this.name);throw new Error(t)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise(t=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),t())},this.connectionStatusPollingInterval)});await this.restartTransport()}}}var CE=Object.defineProperty,fh=Object.getOwnPropertySymbols,AE=Object.prototype.hasOwnProperty,TE=Object.prototype.propertyIsEnumerable,dh=(o,t,r)=>t in o?CE(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,gh=(o,t)=>{for(var r in t||(t={}))AE.call(t,r)&&dh(o,r,t[r]);if(fh)for(var r of fh(t))TE.call(t,r)&&dh(o,r,t[r]);return o};class Ms extends Xb{constructor(t,r,s,a=Qt,u=void 0){super(t,r,s,a),this.core=t,this.logger=r,this.name=s,this.map=new Map,this.version=tE,this.cached=[],this.initialized=!1,this.storagePrefix=Qt,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(l=>{this.getKey&&l!==null&&!Ce(l)?this.map.set(this.getKey(l),l):$_(l)?this.map.set(l.id,l):N_(l)&&this.map.set(l.topic,l)}),this.cached=[],this.initialized=!0)},this.set=async(l,g)=>{this.isInitialized(),this.map.has(l)?await this.update(l,g):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:l,value:g}),this.map.set(l,g),await this.persist())},this.get=l=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:l}),this.getData(l)),this.getAll=l=>(this.isInitialized(),l?this.values.filter(g=>Object.keys(l).every(w=>Cw(g[w],l[w]))):this.values),this.update=async(l,g)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:l,update:g});const w=gh(gh({},this.getData(l)),g);this.map.set(l,w),await this.persist()},this.delete=async(l,g)=>{this.isInitialized(),this.map.has(l)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:l,reason:g}),this.map.delete(l),await this.persist())},this.logger=ke(r,this.name),this.storagePrefix=a,this.getKey=u}get context(){return Qe(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())}async setDataStore(t){await this.core.storage.setItem(this.storageKey,t)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(t){const r=this.map.get(t);if(!r){const{message:s}=x("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.error(s),new Error(s)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const t=await this.getDataStore();if(typeof t>"u"||!t.length)return;if(this.map.size){const{message:r}=x("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=t,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(t){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(t)}}isInitialized(){if(!this.initialized){const{message:t}=x("NOT_INITIALIZED",this.name);throw new Error(t)}}}class DE{constructor(t,r){this.core=t,this.logger=r,this.name=oE,this.version=aE,this.events=new jo,this.initialized=!1,this.storagePrefix=Qt,this.ignoredPayloadTypes=[hr],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:s})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...s])]},this.create=async()=>{this.isInitialized();const s=Eo(),a=await this.core.crypto.setSymKey(s),u=ft(q.FIVE_MINUTES),l={protocol:hl},g={topic:a,expiry:u,relay:l,active:!1},w=v_({protocol:this.core.protocol,version:this.core.version,topic:a,symKey:s,relay:l});return await this.pairings.set(a,g),await this.core.relayer.subscribe(a),this.core.expirer.set(a,u),{topic:a,uri:w}},this.pair=async s=>{this.isInitialized(),this.isValidPair(s);const{topic:a,symKey:u,relay:l}=Uu(s.uri);let g;if(this.pairings.keys.includes(a)&&(g=this.pairings.get(a),g.active))throw new Error(`Pairing already exists: ${a}. Please try again with a new connection URI.`);const w=ft(q.FIVE_MINUTES),d={topic:a,relay:l,expiry:w,active:!1};return await this.pairings.set(a,d),this.core.expirer.set(a,w),s.activatePairing&&await this.activate({topic:a}),this.events.emit(di.create,d),this.core.crypto.keychain.has(a)||(await this.core.crypto.setSymKey(u,a),await this.core.relayer.subscribe(a,{relay:l})),d},this.activate=async({topic:s})=>{this.isInitialized();const a=ft(q.THIRTY_DAYS);await this.pairings.update(s,{active:!0,expiry:a}),this.core.expirer.set(s,a)},this.ping=async s=>{this.isInitialized(),await this.isValidPing(s);const{topic:a}=s;if(this.pairings.keys.includes(a)){const u=await this.sendRequest(a,"wc_pairingPing",{}),{done:l,resolve:g,reject:w}=Nr();this.events.once(de("pairing_ping",u),({error:d})=>{d?w(d):g()}),await l()}},this.updateExpiry=async({topic:s,expiry:a})=>{this.isInitialized(),await this.pairings.update(s,{expiry:a})},this.updateMetadata=async({topic:s,metadata:a})=>{this.isInitialized(),await this.pairings.update(s,{peerMetadata:a})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async s=>{this.isInitialized(),await this.isValidDisconnect(s);const{topic:a}=s;this.pairings.keys.includes(a)&&(await this.sendRequest(a,"wc_pairingDelete",he("USER_DISCONNECTED")),await this.deletePairing(a))},this.sendRequest=async(s,a,u)=>{const l=Cr(a,u),g=await this.core.crypto.encode(s,l),w=ci[a].req;return this.core.history.set(s,l),this.core.relayer.publish(s,g,w),l.id},this.sendResult=async(s,a,u)=>{const l=Ds(s,u),g=await this.core.crypto.encode(a,l),w=await this.core.history.get(a,s),d=ci[w.request.method].res;await this.core.relayer.publish(a,g,d),await this.core.history.resolve(l)},this.sendError=async(s,a,u)=>{const l=Uo(s,u),g=await this.core.crypto.encode(a,l),w=await this.core.history.get(a,s),d=ci[w.request.method]?ci[w.request.method].res:ci.unregistered_method.res;await this.core.relayer.publish(a,g,d),await this.core.history.resolve(l)},this.deletePairing=async(s,a)=>{await this.core.relayer.unsubscribe(s),await Promise.all([this.pairings.delete(s,he("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(s),a?Promise.resolve():this.core.expirer.del(s)])},this.cleanup=async()=>{const s=this.pairings.getAll().filter(a=>Gt(a.expiry));await Promise.all(s.map(a=>this.deletePairing(a.topic)))},this.onRelayEventRequest=s=>{const{topic:a,payload:u}=s;switch(u.method){case"wc_pairingPing":return this.onPairingPingRequest(a,u);case"wc_pairingDelete":return this.onPairingDeleteRequest(a,u);default:return this.onUnknownRpcMethodRequest(a,u)}},this.onRelayEventResponse=async s=>{const{topic:a,payload:u}=s,l=(await this.core.history.get(a,u.id)).request.method;switch(l){case"wc_pairingPing":return this.onPairingPingResponse(a,u);default:return this.onUnknownRpcMethodResponse(l)}},this.onPairingPingRequest=async(s,a)=>{const{id:u}=a;try{this.isValidPing({topic:s}),await this.sendResult(u,s,!0),this.events.emit(di.ping,{id:u,topic:s})}catch(l){await this.sendError(u,s,l),this.logger.error(l)}},this.onPairingPingResponse=(s,a)=>{const{id:u}=a;setTimeout(()=>{Wt(a)?this.events.emit(de("pairing_ping",u),{}):bt(a)&&this.events.emit(de("pairing_ping",u),{error:a.error})},500)},this.onPairingDeleteRequest=async(s,a)=>{const{id:u}=a;try{this.isValidDisconnect({topic:s}),await this.deletePairing(s),this.events.emit(di.delete,{id:u,topic:s})}catch(l){await this.sendError(u,s,l),this.logger.error(l)}},this.onUnknownRpcMethodRequest=async(s,a)=>{const{id:u,method:l}=a;try{if(this.registeredMethods.includes(l))return;const g=he("WC_METHOD_UNSUPPORTED",l);await this.sendError(u,s,g),this.logger.error(g)}catch(g){await this.sendError(u,s,g),this.logger.error(g)}},this.onUnknownRpcMethodResponse=s=>{this.registeredMethods.includes(s)||this.logger.error(he("WC_METHOD_UNSUPPORTED",s))},this.isValidPair=s=>{var a;if(!Le(s)){const{message:l}=x("MISSING_OR_INVALID",`pair() params: ${s}`);throw new Error(l)}if(!R_(s.uri)){const{message:l}=x("MISSING_OR_INVALID",`pair() uri: ${s.uri}`);throw new Error(l)}const u=Uu(s.uri);if(!((a=u==null?void 0:u.relay)!=null&&a.protocol)){const{message:l}=x("MISSING_OR_INVALID","pair() uri#relay-protocol");throw new Error(l)}if(!(u!=null&&u.symKey)){const{message:l}=x("MISSING_OR_INVALID","pair() uri#symKey");throw new Error(l)}},this.isValidPing=async s=>{if(!Le(s)){const{message:u}=x("MISSING_OR_INVALID",`ping() params: ${s}`);throw new Error(u)}const{topic:a}=s;await this.isValidPairingTopic(a)},this.isValidDisconnect=async s=>{if(!Le(s)){const{message:u}=x("MISSING_OR_INVALID",`disconnect() params: ${s}`);throw new Error(u)}const{topic:a}=s;await this.isValidPairingTopic(a)},this.isValidPairingTopic=async s=>{if(!_e(s,!1)){const{message:a}=x("MISSING_OR_INVALID",`pairing topic should be a string: ${s}`);throw new Error(a)}if(!this.pairings.keys.includes(s)){const{message:a}=x("NO_MATCHING_KEY",`pairing topic doesn't exist: ${s}`);throw new Error(a)}if(Gt(this.pairings.get(s).expiry)){await this.deletePairing(s);const{message:a}=x("EXPIRED",`pairing topic: ${s}`);throw new Error(a)}},this.core=t,this.logger=ke(r,this.name),this.pairings=new Ms(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Qe(this.logger)}isInitialized(){if(!this.initialized){const{message:t}=x("NOT_INITIALIZED",this.name);throw new Error(t)}}registerRelayerEvents(){this.core.relayer.on(Oe.message,async t=>{const{topic:r,message:s}=t;if(!this.pairings.keys.includes(r)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(s)))return;const a=await this.core.crypto.decode(r,s);try{zo(a)?(this.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a})):Cs(a)&&(await this.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a}),this.core.history.delete(r,a.id))}catch(u){this.logger.error(u)}})}registerExpirerEvents(){this.core.expirer.on(st.expired,async t=>{const{topic:r}=Fh(t.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(di.expire,{topic:r}))})}}class qE extends Qb{constructor(t,r){super(t,r),this.core=t,this.logger=r,this.records=new Map,this.events=new gt.EventEmitter,this.name=cE,this.version=uE,this.cached=[],this.initialized=!1,this.storagePrefix=Qt,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(s=>this.records.set(s.id,s)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(s,a,u)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:s,request:a,chainId:u}),this.records.has(a.id))return;const l={id:a.id,topic:s,request:{method:a.method,params:a.params||null},chainId:u,expiry:ft(q.THIRTY_DAYS)};this.records.set(l.id,l),this.events.emit(_t.created,l)},this.resolve=async s=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:s}),!this.records.has(s.id))return;const a=await this.getRecord(s.id);typeof a.response>"u"&&(a.response=bt(s)?{error:s.error}:{result:s.result},this.records.set(a.id,a),this.events.emit(_t.updated,a))},this.get=async(s,a)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:s,id:a}),await this.getRecord(a)),this.delete=(s,a)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:a}),this.values.forEach(u=>{if(u.topic===s){if(typeof a<"u"&&u.id!==a)return;this.records.delete(u.id),this.events.emit(_t.deleted,u)}})},this.exists=async(s,a)=>(this.isInitialized(),this.records.has(a)?(await this.getRecord(a)).topic===s:!1),this.on=(s,a)=>{this.events.on(s,a)},this.once=(s,a)=>{this.events.once(s,a)},this.off=(s,a)=>{this.events.off(s,a)},this.removeListener=(s,a)=>{this.events.removeListener(s,a)},this.logger=ke(r,this.name)}get context(){return Qe(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 t=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const s={topic:r.topic,request:Cr(r.request.method,r.request.params,r.id),chainId:r.chainId};return t.push(s)}),t}async setJsonRpcRecords(t){await this.core.storage.setItem(this.storageKey,t)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(t){this.isInitialized();const r=this.records.get(t);if(!r){const{message:s}=x("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(s)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(_t.sync)}async restore(){try{const t=await this.getJsonRpcRecords();if(typeof t>"u"||!t.length)return;if(this.records.size){const{message:r}=x("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=t,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(t){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(t)}}registerEventListeners(){this.events.on(_t.created,t=>{const r=_t.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:t}),this.persist()}),this.events.on(_t.updated,t=>{const r=_t.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:t}),this.persist()}),this.events.on(_t.deleted,t=>{const r=_t.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:t}),this.persist()}),this.core.heartbeat.on(Mr.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(t=>{q.toMiliseconds(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.delete(t.topic,t.id))})}catch(t){this.logger.warn(t)}}isInitialized(){if(!this.initialized){const{message:t}=x("NOT_INITIALIZED",this.name);throw new Error(t)}}}class jE extends t0{constructor(t,r){super(t,r),this.core=t,this.logger=r,this.expirations=new Map,this.events=new gt.EventEmitter,this.name=hE,this.version=lE,this.cached=[],this.initialized=!1,this.storagePrefix=Qt,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(s=>this.expirations.set(s.target,s)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=s=>{try{const a=this.formatTarget(s);return typeof this.getExpiration(a)<"u"}catch{return!1}},this.set=(s,a)=>{this.isInitialized();const u=this.formatTarget(s),l={target:u,expiry:a};this.expirations.set(u,l),this.checkExpiry(u,l),this.events.emit(st.created,{target:u,expiration:l})},this.get=s=>{this.isInitialized();const a=this.formatTarget(s);return this.getExpiration(a)},this.del=s=>{if(this.isInitialized(),this.has(s)){const a=this.formatTarget(s),u=this.getExpiration(a);this.expirations.delete(a),this.events.emit(st.deleted,{target:a,expiration:u})}},this.on=(s,a)=>{this.events.on(s,a)},this.once=(s,a)=>{this.events.once(s,a)},this.off=(s,a)=>{this.events.off(s,a)},this.removeListener=(s,a)=>{this.events.removeListener(s,a)},this.logger=ke(r,this.name)}get context(){return Qe(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(t){if(typeof t=="string")return o_(t);if(typeof t=="number")return a_(t);const{message:r}=x("UNKNOWN_TYPE",`Target type: ${typeof t}`);throw new Error(r)}async setExpirations(t){await this.core.storage.setItem(this.storageKey,t)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(st.sync)}async restore(){try{const t=await this.getExpirations();if(typeof t>"u"||!t.length)return;if(this.expirations.size){const{message:r}=x("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=t,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(t){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(t)}}getExpiration(t){const r=this.expirations.get(t);if(!r){const{message:s}=x("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.error(s),new Error(s)}return r}checkExpiry(t,r){const{expiry:s}=r;q.toMiliseconds(s)-Date.now()<=0&&this.expire(t,r)}expire(t,r){this.expirations.delete(t),this.events.emit(st.expired,{target:t,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((t,r)=>this.checkExpiry(r,t))}registerEventListeners(){this.core.heartbeat.on(Mr.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(st.created,t=>{const r=st.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:t}),this.persist()}),this.events.on(st.expired,t=>{const r=st.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:t}),this.persist()}),this.events.on(st.deleted,t=>{const r=st.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:t}),this.persist()})}isInitialized(){if(!this.initialized){const{message:t}=x("NOT_INITIALIZED",this.name);throw new Error(t)}}}class ME extends r0{constructor(t,r){super(t,r),this.projectId=t,this.logger=r,this.name=po,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async s=>{if(this.verifyDisabled||Dr()||!qr())return;const a=this.getVerifyUrl(s==null?void 0:s.verifyUrl);this.verifyUrl!==a&&this.removeIframe(),this.verifyUrl=a;try{await this.createIframe()}catch(u){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(u)}if(!this.initialized){this.removeIframe(),this.verifyUrl=Co;try{await this.createIframe()}catch(u){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(u),this.verifyDisabled=!0}}},this.register=async s=>{this.initialized?this.sendPost(s.attestationId):(this.addToQueue(s.attestationId),await this.init())},this.resolve=async s=>{if(this.isDevEnv)return"";const a=this.getVerifyUrl(s==null?void 0:s.verifyUrl);let u;try{u=await this.fetchAttestation(s.attestationId,a)}catch(l){this.logger.info(`failed to resolve attestation: ${s.attestationId} from url: ${a}`),this.logger.info(l),u=await this.fetchAttestation(s.attestationId,Co)}return u},this.fetchAttestation=async(s,a)=>{this.logger.info(`resolving attestation: ${s} from url: ${a}`);const u=this.startAbortTimer(q.ONE_SECOND*2),l=await fetch(`${a}/attestation/${s}`,{signal:this.abortController.signal});return clearTimeout(u),l.status===200?await l.json():void 0},this.addToQueue=s=>{this.queue.push(s)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(s=>this.sendPost(s)),this.queue=[])},this.sendPost=s=>{var a;try{if(!this.iframe)return;(a=this.iframe.contentWindow)==null||a.postMessage(s,"*"),this.logger.info(`postMessage sent: ${s} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let s;const a=u=>{u.data==="verify_ready"&&(this.initialized=!0,this.processQueue(),window.removeEventListener("message",a),s())};await Promise.race([new Promise(u=>{if(document.getElementById(po))return u();window.addEventListener("message",a);const l=document.createElement("iframe");l.id=po,l.src=`${this.verifyUrl}/${this.projectId}`,l.style.display="none",document.body.append(l),this.iframe=l,s=u}),new Promise((u,l)=>setTimeout(()=>{window.removeEventListener("message",a),l("verify iframe load timeout")},q.toMiliseconds(q.FIVE_SECONDS)))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=s=>{let a=s||xr;return pE.includes(a)||(this.logger.info(`verify url: ${a}, not included in trusted list, assigning default: ${xr}`),a=xr),a},this.logger=ke(r,this.name),this.verifyUrl=xr,this.abortController=new AbortController,this.isDevEnv=Ko()&&d0.IS_VITEST}get context(){return Qe(this.logger)}startAbortTimer(t){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),q.toMiliseconds(t))}}class UE extends i0{constructor(t,r){super(t,r),this.projectId=t,this.logger=r,this.context=fE,this.registerDeviceToken=async s=>{const{clientId:a,token:u,notificationType:l,enableEncrypted:g=!1}=s,w=`${dE}/${this.projectId}/clients`;await f0(w,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:a,type:l,token:u,always_raw:g})})},this.logger=ke(r,this.context)}}var zE=Object.defineProperty,yh=Object.getOwnPropertySymbols,LE=Object.prototype.hasOwnProperty,kE=Object.prototype.propertyIsEnumerable,mh=(o,t,r)=>t in o?zE(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,vh=(o,t)=>{for(var r in t||(t={}))LE.call(t,r)&&mh(o,r,t[r]);if(yh)for(var r of yh(t))kE.call(t,r)&&mh(o,r,t[r]);return o};class Fo extends Gb{constructor(t){super(t),this.protocol=cl,this.version=UI,this.name=ul,this.events=new gt.EventEmitter,this.initialized=!1,this.on=(s,a)=>this.events.on(s,a),this.once=(s,a)=>this.events.once(s,a),this.off=(s,a)=>this.events.off(s,a),this.removeListener=(s,a)=>this.events.removeListener(s,a),this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||ll,this.customStoragePrefix=t!=null&&t.customStoragePrefix?`:${t.customStoragePrefix}`:"";const r=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:As(Ts({level:(t==null?void 0:t.logger)||zI.logger}));this.logger=ke(r,this.name),this.heartbeat=new Mr.HeartBeat,this.crypto=new yE(this,this.logger,t==null?void 0:t.keychain),this.history=new qE(this,this.logger),this.expirer=new jE(this,this.logger),this.storage=t!=null&&t.storage?t.storage:new Eb(vh(vh({},LI),t==null?void 0:t.storageOptions)),this.relayer=new xE({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new DE(this,this.logger),this.verify=new ME(this.projectId||"",this.logger),this.echoClient=new UE(this.projectId||"",this.logger)}static async init(t){const r=new Fo(t);await r.initialize();const s=await r.crypto.getClientId();return await r.storage.setItem(rE,s),r}get context(){return Qe(this.logger)}async start(){this.initialized||await this.initialize()}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.initialized=!0,this.logger.info("Core Initialization Success")}catch(t){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,t),this.logger.error(t.message),t}}}const KE=Fo,pl="wc",fl=2,dl="client",Bo=`${pl}@${fl}:${dl}:`,go={name:dl,logger:"error"},wh="WALLETCONNECT_DEEPLINK_CHOICE",HE="proposal",gl="Proposal expired",VE="session",vs=q.SEVEN_DAYS,FE="engine",hi={wc_sessionPropose:{req:{ttl:q.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1104},res:{ttl:q.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1106},res:{ttl:q.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:q.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:q.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1112},res:{ttl:q.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:q.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:q.THIRTY_SECONDS,prompt:!1,tag:1115}}},yo={min:q.FIVE_MINUTES,max:q.SEVEN_DAYS},Dt={idle:"IDLE",active:"ACTIVE"},BE="request",WE=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"];var GE=Object.defineProperty,QE=Object.defineProperties,JE=Object.getOwnPropertyDescriptors,_h=Object.getOwnPropertySymbols,YE=Object.prototype.hasOwnProperty,ZE=Object.prototype.propertyIsEnumerable,bh=(o,t,r)=>t in o?GE(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,Ue=(o,t)=>{for(var r in t||(t={}))YE.call(t,r)&&bh(o,r,t[r]);if(_h)for(var r of _h(t))ZE.call(t,r)&&bh(o,r,t[r]);return o},li=(o,t)=>QE(o,JE(t));class XE extends n0{constructor(t){super(t),this.name=FE,this.events=new jo,this.initialized=!1,this.ignoredPayloadTypes=[hr],this.requestQueue={state:Dt.idle,queue:[]},this.sessionRequestQueue={state:Dt.idle,queue:[]},this.requestQueueDelay=q.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(hi)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},q.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{await this.isInitialized();const s=li(Ue({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(s);const{pairingTopic:a,requiredNamespaces:u,optionalNamespaces:l,sessionProperties:g,relays:w}=s;let d=a,b,I=!1;if(d&&(I=this.client.core.pairing.pairings.get(d).active),!d||!I){const{topic:Q,uri:Y}=await this.client.core.pairing.create();d=Q,b=Y}const P=await this.client.core.crypto.generateKeyPair(),A=Ue({requiredNamespaces:u,optionalNamespaces:l,relays:w??[{protocol:hl}],proposer:{publicKey:P,metadata:this.client.metadata}},g&&{sessionProperties:g}),{reject:N,resolve:K,done:ee}=Nr(q.FIVE_MINUTES,gl);if(this.events.once(de("session_connect"),async({error:Q,session:Y})=>{if(Q)N(Q);else if(Y){Y.self.publicKey=P;const se=li(Ue({},Y),{requiredNamespaces:Y.requiredNamespaces,optionalNamespaces:Y.optionalNamespaces});await this.client.session.set(Y.topic,se),await this.setExpiry(Y.topic,Y.expiry),d&&await this.client.core.pairing.updateMetadata({topic:d,metadata:Y.peer.metadata}),K(se)}}),!d){const{message:Q}=x("NO_MATCHING_KEY",`connect() pairing topic: ${d}`);throw new Error(Q)}const W=await this.sendRequest({topic:d,method:"wc_sessionPropose",params:A}),ge=ft(q.FIVE_MINUTES);return await this.setProposal(W,Ue({id:W,expiry:ge},A)),{uri:b,approval:ee}},this.pair=async r=>(await this.isInitialized(),await this.client.core.pairing.pair(r)),this.approve=async r=>{await this.isInitialized(),await this.isValidApprove(r);const{id:s,relayProtocol:a,namespaces:u,sessionProperties:l}=r,g=this.client.proposal.get(s);let{pairingTopic:w,proposer:d,requiredNamespaces:b,optionalNamespaces:I}=g;w=w||"",Tr(b)||(b=I_(u,"approve()"));const P=await this.client.core.crypto.generateKeyPair(),A=d.publicKey,N=await this.client.core.crypto.generateSharedKey(P,A);w&&s&&(await this.client.core.pairing.updateMetadata({topic:w,metadata:d.metadata}),await this.sendResult({id:s,topic:w,result:{relay:{protocol:a??"irn"},responderPublicKey:P}}),await this.client.proposal.delete(s,he("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:w}));const K=Ue({relay:{protocol:a??"irn"},namespaces:u,requiredNamespaces:b,optionalNamespaces:I,pairingTopic:w,controller:{publicKey:P,metadata:this.client.metadata},expiry:ft(vs)},l&&{sessionProperties:l});await this.client.core.relayer.subscribe(N),await this.sendRequest({topic:N,method:"wc_sessionSettle",params:K,throwOnFailedPublish:!0});const ee=li(Ue({},K),{topic:N,pairingTopic:w,acknowledged:!1,self:K.controller,peer:{publicKey:d.publicKey,metadata:d.metadata},controller:P});return await this.client.session.set(N,ee),await this.setExpiry(N,ft(vs)),{topic:N,acknowledged:()=>new Promise(W=>setTimeout(()=>W(this.client.session.get(N)),500))}},this.reject=async r=>{await this.isInitialized(),await this.isValidReject(r);const{id:s,reason:a}=r,{pairingTopic:u}=this.client.proposal.get(s);u&&(await this.sendError(s,u,a),await this.client.proposal.delete(s,he("USER_DISCONNECTED")))},this.update=async r=>{await this.isInitialized(),await this.isValidUpdate(r);const{topic:s,namespaces:a}=r,u=await this.sendRequest({topic:s,method:"wc_sessionUpdate",params:{namespaces:a}}),{done:l,resolve:g,reject:w}=Nr();return this.events.once(de("session_update",u),({error:d})=>{d?w(d):g()}),await this.client.session.update(s,{namespaces:a}),{acknowledged:l}},this.extend=async r=>{await this.isInitialized(),await this.isValidExtend(r);const{topic:s}=r,a=await this.sendRequest({topic:s,method:"wc_sessionExtend",params:{}}),{done:u,resolve:l,reject:g}=Nr();return this.events.once(de("session_extend",a),({error:w})=>{w?g(w):l()}),await this.setExpiry(s,ft(vs)),{acknowledged:u}},this.request=async r=>{await this.isInitialized(),await this.isValidRequest(r);const{chainId:s,request:a,topic:u,expiry:l}=r,g=Aw(),{done:w,resolve:d,reject:b}=Nr(l,"Request expired. Please try again.");return this.events.once(de("session_request",g),({error:I,result:P})=>{I?b(I):d(P)}),await Promise.all([new Promise(async I=>{await this.sendRequest({clientRpcId:g,topic:u,method:"wc_sessionRequest",params:{request:a,chainId:s},expiry:l,throwOnFailedPublish:!0}).catch(P=>b(P)),this.client.events.emit("session_request_sent",{topic:u,request:a,chainId:s,id:g}),I()}),new Promise(async I=>{const P=await u_(this.client.core.storage,wh);c_({id:g,topic:u,wcDeepLink:P}),I()}),w()]).then(I=>I[2])},this.respond=async r=>{await this.isInitialized(),await this.isValidRespond(r);const{topic:s,response:a}=r,{id:u}=a;Wt(a)?await this.sendResult({id:u,topic:s,result:a.result,throwOnFailedPublish:!0}):bt(a)&&await this.sendError(u,s,a.error),this.cleanupAfterResponse(r)},this.ping=async r=>{await this.isInitialized(),await this.isValidPing(r);const{topic:s}=r;if(this.client.session.keys.includes(s)){const a=await this.sendRequest({topic:s,method:"wc_sessionPing",params:{}}),{done:u,resolve:l,reject:g}=Nr();this.events.once(de("session_ping",a),({error:w})=>{w?g(w):l()}),await u()}else this.client.core.pairing.pairings.keys.includes(s)&&await this.client.core.pairing.ping({topic:s})},this.emit=async r=>{await this.isInitialized(),await this.isValidEmit(r);const{topic:s,event:a,chainId:u}=r;await this.sendRequest({topic:s,method:"wc_sessionEvent",params:{event:a,chainId:u}})},this.disconnect=async r=>{await this.isInitialized(),await this.isValidDisconnect(r);const{topic:s}=r;this.client.session.keys.includes(s)?(await this.sendRequest({topic:s,method:"wc_sessionDelete",params:he("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession(s)):await this.client.core.pairing.disconnect({topic:s})},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(s=>S_(s,r))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const s=this.client.core.pairing.pairings.get(r.pairingTopic),a=this.client.core.pairing.pairings.getAll().filter(u=>{var l,g;return((l=u.peerMetadata)==null?void 0:l.url)&&((g=u.peerMetadata)==null?void 0:g.url)===r.peer.metadata.url&&u.topic&&u.topic!==s.topic});if(a.length===0)return;this.client.logger.info(`Cleaning up ${a.length} duplicate pairing(s)`),await Promise.all(a.map(u=>this.client.core.pairing.disconnect({topic:u.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(s){this.client.logger.error(s)}},this.deleteSession=async(r,s)=>{const{self:a}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),this.client.session.delete(r,he("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(a.publicKey)&&await this.client.core.crypto.deleteKeyPair(a.publicKey),this.client.core.crypto.keychain.has(r)&&await this.client.core.crypto.deleteSymKey(r),s||this.client.core.expirer.del(r),this.client.core.storage.removeItem(wh).catch(u=>this.client.logger.warn(u)),this.getPendingSessionRequests().forEach(u=>{u.topic===r&&this.deletePendingSessionRequest(u.id,he("USER_DISCONNECTED"))})},this.deleteProposal=async(r,s)=>{await Promise.all([this.client.proposal.delete(r,he("USER_DISCONNECTED")),s?Promise.resolve():this.client.core.expirer.del(r)])},this.deletePendingSessionRequest=async(r,s,a=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,s),a?Promise.resolve():this.client.core.expirer.del(r)]),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(u=>u.id!==r),a&&(this.sessionRequestQueue.state=Dt.idle)},this.setExpiry=async(r,s)=>{this.client.session.keys.includes(r)&&await this.client.session.update(r,{expiry:s}),this.client.core.expirer.set(r,s)},this.setProposal=async(r,s)=>{await this.client.proposal.set(r,s),this.client.core.expirer.set(r,s.expiry)},this.setPendingSessionRequest=async r=>{const s=hi.wc_sessionRequest.req.ttl,{id:a,topic:u,params:l,verifyContext:g}=r;await this.client.pendingRequest.set(a,{id:a,topic:u,params:l,verifyContext:g}),s&&this.client.core.expirer.set(a,ft(s))},this.sendRequest=async r=>{const{topic:s,method:a,params:u,expiry:l,relayRpcId:g,clientRpcId:w,throwOnFailedPublish:d}=r,b=Cr(a,u,w);if(qr()&&WE.includes(a)){const A=Ar(JSON.stringify(b));this.client.core.verify.register({attestationId:A})}const I=await this.client.core.crypto.encode(s,b),P=hi[a].req;return l&&(P.ttl=l),g&&(P.id=g),this.client.core.history.set(s,b),d?(P.internal=li(Ue({},P.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(s,I,P)):this.client.core.relayer.publish(s,I,P).catch(A=>this.client.logger.error(A)),b.id},this.sendResult=async r=>{const{id:s,topic:a,result:u,throwOnFailedPublish:l}=r,g=Ds(s,u),w=await this.client.core.crypto.encode(a,g),d=await this.client.core.history.get(a,s),b=hi[d.request.method].res;l?(b.internal=li(Ue({},b.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(a,w,b)):this.client.core.relayer.publish(a,w,b).catch(I=>this.client.logger.error(I)),await this.client.core.history.resolve(g)},this.sendError=async(r,s,a)=>{const u=Uo(r,a),l=await this.client.core.crypto.encode(s,u),g=await this.client.core.history.get(s,r),w=hi[g.request.method].res;this.client.core.relayer.publish(s,l,w),await this.client.core.history.resolve(u)},this.cleanup=async()=>{const r=[],s=[];this.client.session.getAll().forEach(a=>{Gt(a.expiry)&&r.push(a.topic)}),this.client.proposal.getAll().forEach(a=>{Gt(a.expiry)&&s.push(a.id)}),await Promise.all([...r.map(a=>this.deleteSession(a)),...s.map(a=>this.deleteProposal(a))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Dt.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=Dt.active;const r=this.requestQueue.queue.shift();if(r)try{this.processRequest(r),await new Promise(s=>setTimeout(s,300))}catch(s){this.client.logger.warn(s)}}this.requestQueue.state=Dt.idle},this.processRequest=r=>{const{topic:s,payload:a}=r,u=a.method;switch(u){case"wc_sessionPropose":return this.onSessionProposeRequest(s,a);case"wc_sessionSettle":return this.onSessionSettleRequest(s,a);case"wc_sessionUpdate":return this.onSessionUpdateRequest(s,a);case"wc_sessionExtend":return this.onSessionExtendRequest(s,a);case"wc_sessionPing":return this.onSessionPingRequest(s,a);case"wc_sessionDelete":return this.onSessionDeleteRequest(s,a);case"wc_sessionRequest":return this.onSessionRequest(s,a);case"wc_sessionEvent":return this.onSessionEventRequest(s,a);default:return this.client.logger.info(`Unsupported request method ${u}`)}},this.onRelayEventResponse=async r=>{const{topic:s,payload:a}=r,u=(await this.client.core.history.get(s,a.id)).request.method;switch(u){case"wc_sessionPropose":return this.onSessionProposeResponse(s,a);case"wc_sessionSettle":return this.onSessionSettleResponse(s,a);case"wc_sessionUpdate":return this.onSessionUpdateResponse(s,a);case"wc_sessionExtend":return this.onSessionExtendResponse(s,a);case"wc_sessionPing":return this.onSessionPingResponse(s,a);case"wc_sessionRequest":return this.onSessionRequestResponse(s,a);default:return this.client.logger.info(`Unsupported response method ${u}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:s}=r,{message:a}=x("MISSING_OR_INVALID",`Decoded payload on topic ${s} is not identifiable as a JSON-RPC request or a response.`);throw new Error(a)},this.onSessionProposeRequest=async(r,s)=>{const{params:a,id:u}=s;try{this.isValidConnect(Ue({},s.params));const l=ft(q.FIVE_MINUTES),g=Ue({id:u,pairingTopic:r,expiry:l},a);await this.setProposal(u,g);const w=Ar(JSON.stringify(s)),d=await this.getVerifyContext(w,g.proposer.metadata);this.client.events.emit("session_proposal",{id:u,params:g,verifyContext:d})}catch(l){await this.sendError(u,r,l),this.client.logger.error(l)}},this.onSessionProposeResponse=async(r,s)=>{const{id:a}=s;if(Wt(s)){const{result:u}=s;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:u});const l=this.client.proposal.get(a);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:l});const g=l.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:g});const w=u.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:w});const d=await this.client.core.crypto.generateSharedKey(g,w);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:d});const b=await this.client.core.relayer.subscribe(d);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:b}),await this.client.core.pairing.activate({topic:r})}else bt(s)&&(await this.client.proposal.delete(a,he("USER_DISCONNECTED")),this.events.emit(de("session_connect"),{error:s.error}))},this.onSessionSettleRequest=async(r,s)=>{const{id:a,params:u}=s;try{this.isValidSessionSettleRequest(u);const{relay:l,controller:g,expiry:w,namespaces:d,requiredNamespaces:b,optionalNamespaces:I,sessionProperties:P,pairingTopic:A}=s.params,N=Ue({topic:r,relay:l,expiry:w,namespaces:d,acknowledged:!0,pairingTopic:A,requiredNamespaces:b,optionalNamespaces:I,controller:g.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:g.publicKey,metadata:g.metadata}},P&&{sessionProperties:P});await this.sendResult({id:s.id,topic:r,result:!0}),this.events.emit(de("session_connect"),{session:N}),this.cleanupDuplicatePairings(N)}catch(l){await this.sendError(a,r,l),this.client.logger.error(l)}},this.onSessionSettleResponse=async(r,s)=>{const{id:a}=s;Wt(s)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(de("session_approve",a),{})):bt(s)&&(await this.client.session.delete(r,he("USER_DISCONNECTED")),this.events.emit(de("session_approve",a),{error:s.error}))},this.onSessionUpdateRequest=async(r,s)=>{const{params:a,id:u}=s;try{const l=`${r}_session_update`,g=ys.get(l);if(g&&this.isRequestOutOfSync(g,u)){this.client.logger.info(`Discarding out of sync request - ${u}`);return}this.isValidUpdate(Ue({topic:r},a)),await this.client.session.update(r,{namespaces:a.namespaces}),await this.sendResult({id:u,topic:r,result:!0}),this.client.events.emit("session_update",{id:u,topic:r,params:a}),ys.set(l,u)}catch(l){await this.sendError(u,r,l),this.client.logger.error(l)}},this.isRequestOutOfSync=(r,s)=>parseInt(s.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,s)=>{const{id:a}=s;Wt(s)?this.events.emit(de("session_update",a),{}):bt(s)&&this.events.emit(de("session_update",a),{error:s.error})},this.onSessionExtendRequest=async(r,s)=>{const{id:a}=s;try{this.isValidExtend({topic:r}),await this.setExpiry(r,ft(vs)),await this.sendResult({id:a,topic:r,result:!0}),this.client.events.emit("session_extend",{id:a,topic:r})}catch(u){await this.sendError(a,r,u),this.client.logger.error(u)}},this.onSessionExtendResponse=(r,s)=>{const{id:a}=s;Wt(s)?this.events.emit(de("session_extend",a),{}):bt(s)&&this.events.emit(de("session_extend",a),{error:s.error})},this.onSessionPingRequest=async(r,s)=>{const{id:a}=s;try{this.isValidPing({topic:r}),await this.sendResult({id:a,topic:r,result:!0}),this.client.events.emit("session_ping",{id:a,topic:r})}catch(u){await this.sendError(a,r,u),this.client.logger.error(u)}},this.onSessionPingResponse=(r,s)=>{const{id:a}=s;setTimeout(()=>{Wt(s)?this.events.emit(de("session_ping",a),{}):bt(s)&&this.events.emit(de("session_ping",a),{error:s.error})},500)},this.onSessionDeleteRequest=async(r,s)=>{const{id:a}=s;try{this.isValidDisconnect({topic:r,reason:s.params}),await Promise.all([new Promise(u=>{this.client.core.relayer.once(Oe.publish,async()=>{u(await this.deleteSession(r))})}),this.sendResult({id:a,topic:r,result:!0})]),this.client.events.emit("session_delete",{id:a,topic:r})}catch(u){this.client.logger.error(u)}},this.onSessionRequest=async(r,s)=>{const{id:a,params:u}=s;try{this.isValidRequest(Ue({topic:r},u));const l=Ar(JSON.stringify(Cr("wc_sessionRequest",u,a))),g=this.client.session.get(r),w=await this.getVerifyContext(l,g.peer.metadata),d={id:a,topic:r,params:u,verifyContext:w};await this.setPendingSessionRequest(d),this.addSessionRequestToSessionRequestQueue(d),this.processSessionRequestQueue()}catch(l){await this.sendError(a,r,l),this.client.logger.error(l)}},this.onSessionRequestResponse=(r,s)=>{const{id:a}=s;Wt(s)?this.events.emit(de("session_request",a),{result:s.result}):bt(s)&&this.events.emit(de("session_request",a),{error:s.error})},this.onSessionEventRequest=async(r,s)=>{const{id:a,params:u}=s;try{const l=`${r}_session_event_${u.event.name}`,g=ys.get(l);if(g&&this.isRequestOutOfSync(g,a)){this.client.logger.info(`Discarding out of sync request - ${a}`);return}this.isValidEmit(Ue({topic:r},u)),this.client.events.emit("session_event",{id:a,topic:r,params:u}),ys.set(l,a)}catch(l){await this.sendError(a,r,l),this.client.logger.error(l)}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Dt.idle,this.processSessionRequestQueue()},q.toMiliseconds(this.requestQueueDelay))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Dt.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=Dt.active,this.client.events.emit("session_request",r)}catch(s){this.client.logger.error(s)}},this.onPairingCreated=r=>{if(r.active)return;const s=this.client.proposal.getAll().find(a=>a.pairingTopic===r.topic);s&&this.onSessionProposeRequest(r.topic,Cr("wc_sessionPropose",{requiredNamespaces:s.requiredNamespaces,optionalNamespaces:s.optionalNamespaces,relays:s.relays,proposer:s.proposer,sessionProperties:s.sessionProperties},s.id))},this.isValidConnect=async r=>{if(!Le(r)){const{message:w}=x("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(w)}const{pairingTopic:s,requiredNamespaces:a,optionalNamespaces:u,sessionProperties:l,relays:g}=r;if(Ce(s)||await this.isValidPairingTopic(s),!M_(g)){const{message:w}=x("MISSING_OR_INVALID",`connect() relays: ${g}`);throw new Error(w)}!Ce(a)&&Tr(a)!==0&&this.validateNamespaces(a,"requiredNamespaces"),!Ce(u)&&Tr(u)!==0&&this.validateNamespaces(u,"optionalNamespaces"),Ce(l)||this.validateSessionProps(l,"sessionProperties")},this.validateNamespaces=(r,s)=>{const a=j_(r,"connect()",s);if(a)throw new Error(a.message)},this.isValidApprove=async r=>{if(!Le(r))throw new Error(x("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:s,namespaces:a,relayProtocol:u,sessionProperties:l}=r;await this.isValidProposalId(s);const g=this.client.proposal.get(s),w=Is(a,"approve()");if(w)throw new Error(w.message);const d=ku(g.requiredNamespaces,a,"approve()");if(d)throw new Error(d.message);if(!_e(u,!0)){const{message:b}=x("MISSING_OR_INVALID",`approve() relayProtocol: ${u}`);throw new Error(b)}Ce(l)||this.validateSessionProps(l,"sessionProperties")},this.isValidReject=async r=>{if(!Le(r)){const{message:u}=x("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(u)}const{id:s,reason:a}=r;if(await this.isValidProposalId(s),!z_(a)){const{message:u}=x("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(a)}`);throw new Error(u)}},this.isValidSessionSettleRequest=r=>{if(!Le(r)){const{message:d}=x("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(d)}const{relay:s,controller:a,namespaces:u,expiry:l}=r;if(!Wh(s)){const{message:d}=x("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(d)}const g=x_(a,"onSessionSettleRequest()");if(g)throw new Error(g.message);const w=Is(u,"onSessionSettleRequest()");if(w)throw new Error(w.message);if(Gt(l)){const{message:d}=x("EXPIRED","onSessionSettleRequest()");throw new Error(d)}},this.isValidUpdate=async r=>{if(!Le(r)){const{message:w}=x("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(w)}const{topic:s,namespaces:a}=r;await this.isValidSessionTopic(s);const u=this.client.session.get(s),l=Is(a,"update()");if(l)throw new Error(l.message);const g=ku(u.requiredNamespaces,a,"update()");if(g)throw new Error(g.message)},this.isValidExtend=async r=>{if(!Le(r)){const{message:a}=x("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(a)}const{topic:s}=r;await this.isValidSessionTopic(s)},this.isValidRequest=async r=>{if(!Le(r)){const{message:w}=x("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(w)}const{topic:s,request:a,chainId:u,expiry:l}=r;await this.isValidSessionTopic(s);const{namespaces:g}=this.client.session.get(s);if(!Lu(g,u)){const{message:w}=x("MISSING_OR_INVALID",`request() chainId: ${u}`);throw new Error(w)}if(!L_(a)){const{message:w}=x("MISSING_OR_INVALID",`request() ${JSON.stringify(a)}`);throw new Error(w)}if(!H_(g,u,a.method)){const{message:w}=x("MISSING_OR_INVALID",`request() method: ${a.method}`);throw new Error(w)}if(l&&!W_(l,yo)){const{message:w}=x("MISSING_OR_INVALID",`request() expiry: ${l}. Expiry must be a number (in seconds) between ${yo.min} and ${yo.max}`);throw new Error(w)}},this.isValidRespond=async r=>{var s;if(!Le(r)){const{message:l}=x("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(l)}const{topic:a,response:u}=r;try{await this.isValidSessionTopic(a)}catch(l){throw(s=r==null?void 0:r.response)!=null&&s.id&&this.cleanupAfterResponse(r),l}if(!k_(u)){const{message:l}=x("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(u)}`);throw new Error(l)}},this.isValidPing=async r=>{if(!Le(r)){const{message:a}=x("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(a)}const{topic:s}=r;await this.isValidSessionOrPairingTopic(s)},this.isValidEmit=async r=>{if(!Le(r)){const{message:g}=x("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(g)}const{topic:s,event:a,chainId:u}=r;await this.isValidSessionTopic(s);const{namespaces:l}=this.client.session.get(s);if(!Lu(l,u)){const{message:g}=x("MISSING_OR_INVALID",`emit() chainId: ${u}`);throw new Error(g)}if(!K_(a)){const{message:g}=x("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(a)}`);throw new Error(g)}if(!V_(l,u,a.name)){const{message:g}=x("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(a)}`);throw new Error(g)}},this.isValidDisconnect=async r=>{if(!Le(r)){const{message:a}=x("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(a)}const{topic:s}=r;await this.isValidSessionOrPairingTopic(s)},this.getVerifyContext=async(r,s)=>{const a={verified:{verifyUrl:s.verifyUrl||xr,validation:"UNKNOWN",origin:s.url||""}};try{const u=await this.client.core.verify.resolve({attestationId:r,verifyUrl:s.verifyUrl});u&&(a.verified.origin=u.origin,a.verified.isScam=u.isScam,a.verified.validation=u.origin===new URL(s.url).origin?"VALID":"INVALID")}catch(u){this.client.logger.info(u)}return this.client.logger.info(`Verify context: ${JSON.stringify(a)}`),a},this.validateSessionProps=(r,s)=>{Object.values(r).forEach(a=>{if(!_e(a,!1)){const{message:u}=x("MISSING_OR_INVALID",`${s} must be in Record<string, string> format. Received: ${JSON.stringify(a)}`);throw new Error(u)}})}}async isInitialized(){if(!this.initialized){const{message:t}=x("NOT_INITIALIZED",this.name);throw new Error(t)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Oe.message,async t=>{const{topic:r,message:s}=t;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(s)))return;const a=await this.client.core.crypto.decode(r,s);try{zo(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a})):Cs(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a})}catch(u){this.client.logger.error(u)}})}registerExpirerEvents(){this.client.core.expirer.on(st.expired,async t=>{const{topic:r,id:s}=Fh(t.target);if(s&&this.client.pendingRequest.keys.includes(s))return await this.deletePendingSessionRequest(s,x("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession(r,!0),this.client.events.emit("session_expire",{topic:r})):s&&(await this.deleteProposal(s,!0),this.client.events.emit("proposal_expire",{id:s}))})}registerPairingEvents(){this.client.core.pairing.events.on(di.create,t=>this.onPairingCreated(t))}isValidPairingTopic(t){if(!_e(t,!1)){const{message:r}=x("MISSING_OR_INVALID",`pairing topic should be a string: ${t}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(t)){const{message:r}=x("NO_MATCHING_KEY",`pairing topic doesn't exist: ${t}`);throw new Error(r)}if(Gt(this.client.core.pairing.pairings.get(t).expiry)){const{message:r}=x("EXPIRED",`pairing topic: ${t}`);throw new Error(r)}}async isValidSessionTopic(t){if(!_e(t,!1)){const{message:r}=x("MISSING_OR_INVALID",`session topic should be a string: ${t}`);throw new Error(r)}if(!this.client.session.keys.includes(t)){const{message:r}=x("NO_MATCHING_KEY",`session topic doesn't exist: ${t}`);throw new Error(r)}if(Gt(this.client.session.get(t).expiry)){await this.deleteSession(t);const{message:r}=x("EXPIRED",`session topic: ${t}`);throw new Error(r)}}async isValidSessionOrPairingTopic(t){if(this.client.session.keys.includes(t))await this.isValidSessionTopic(t);else if(this.client.core.pairing.pairings.keys.includes(t))this.isValidPairingTopic(t);else if(_e(t,!1)){const{message:r}=x("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${t}`);throw new Error(r)}else{const{message:r}=x("MISSING_OR_INVALID",`session or pairing topic should be a string: ${t}`);throw new Error(r)}}async isValidProposalId(t){if(!U_(t)){const{message:r}=x("MISSING_OR_INVALID",`proposal id should be a number: ${t}`);throw new Error(r)}if(!this.client.proposal.keys.includes(t)){const{message:r}=x("NO_MATCHING_KEY",`proposal id doesn't exist: ${t}`);throw new Error(r)}if(Gt(this.client.proposal.get(t).expiry)){await this.deleteProposal(t);const{message:r}=x("EXPIRED",`proposal id: ${t}`);throw new Error(r)}}}class e1 extends Ms{constructor(t,r){super(t,r,HE,Bo),this.core=t,this.logger=r}}class t1 extends Ms{constructor(t,r){super(t,r,VE,Bo),this.core=t,this.logger=r}}class r1 extends Ms{constructor(t,r){super(t,r,BE,Bo,s=>s.id),this.core=t,this.logger=r}}let i1=class yl extends s0{constructor(t){super(t),this.protocol=pl,this.version=fl,this.name=go.name,this.events=new gt.EventEmitter,this.on=(s,a)=>this.events.on(s,a),this.once=(s,a)=>this.events.once(s,a),this.off=(s,a)=>this.events.off(s,a),this.removeListener=(s,a)=>this.events.removeListener(s,a),this.removeAllListeners=s=>this.events.removeAllListeners(s),this.connect=async s=>{try{return await this.engine.connect(s)}catch(a){throw this.logger.error(a.message),a}},this.pair=async s=>{try{return await this.engine.pair(s)}catch(a){throw this.logger.error(a.message),a}},this.approve=async s=>{try{return await this.engine.approve(s)}catch(a){throw this.logger.error(a.message),a}},this.reject=async s=>{try{return await this.engine.reject(s)}catch(a){throw this.logger.error(a.message),a}},this.update=async s=>{try{return await this.engine.update(s)}catch(a){throw this.logger.error(a.message),a}},this.extend=async s=>{try{return await this.engine.extend(s)}catch(a){throw this.logger.error(a.message),a}},this.request=async s=>{try{return await this.engine.request(s)}catch(a){throw this.logger.error(a.message),a}},this.respond=async s=>{try{return await this.engine.respond(s)}catch(a){throw this.logger.error(a.message),a}},this.ping=async s=>{try{return await this.engine.ping(s)}catch(a){throw this.logger.error(a.message),a}},this.emit=async s=>{try{return await this.engine.emit(s)}catch(a){throw this.logger.error(a.message),a}},this.disconnect=async s=>{try{return await this.engine.disconnect(s)}catch(a){throw this.logger.error(a.message),a}},this.find=s=>{try{return this.engine.find(s)}catch(a){throw this.logger.error(a.message),a}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(s){throw this.logger.error(s.message),s}},this.name=(t==null?void 0:t.name)||go.name,this.metadata=(t==null?void 0:t.metadata)||t_();const r=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:As(Ts({level:(t==null?void 0:t.logger)||go.logger}));this.core=(t==null?void 0:t.core)||new KE(t),this.logger=ke(r,this.name),this.session=new t1(this.core,this.logger),this.proposal=new e1(this.core,this.logger),this.pendingRequest=new r1(this.core,this.logger),this.engine=new XE(this)}static async init(t){const r=new yl(t);return await r.initialize(),r}get context(){return Qe(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.engine.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(t){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(t.message),t}}};const Ih="error",s1="wss://relay.walletconnect.com",n1="wc",o1="universal_provider",Eh=`${n1}@2:${o1}:`,a1="https://rpc.walletconnect.com/v1/",jt={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var pi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof J.global<"u"?J.global:typeof self<"u"?self:{},Ao={exports:{}};/**
|
|
22
|
-
* @license
|
|
23
|
-
* Lodash <https://lodash.com/>
|
|
24
|
-
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
25
|
-
* Released under MIT license <https://lodash.com/license>
|
|
26
|
-
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
27
|
-
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
28
|
-
*/(function(o,t){(function(){var r,s="4.17.21",a=200,u="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",l="Expected a function",g="Invalid `variable` option passed into `_.template`",w="__lodash_hash_undefined__",d=500,b="__lodash_placeholder__",I=1,P=2,A=4,N=1,K=2,ee=1,W=2,ge=4,Q=8,Y=16,se=32,Te=64,le=128,Re=256,Mt=512,wl=30,_l="...",bl=800,Il=16,Qo=1,El=2,Pl=3,bi=1/0,pr=9007199254740991,Sl=17976931348623157e292,Ii=NaN,yt=4294967295,Ol=yt-1,Rl=yt>>>1,$l=[["ary",le],["bind",ee],["bindKey",W],["curry",Q],["curryRight",Y],["flip",Mt],["partial",se],["partialRight",Te],["rearg",Re]],fr="[object Arguments]",Ei="[object Array]",Nl="[object AsyncFunction]",Ur="[object Boolean]",zr="[object Date]",xl="[object DOMException]",Pi="[object Error]",Si="[object Function]",Jo="[object GeneratorFunction]",ot="[object Map]",Lr="[object Number]",Cl="[object Null]",Et="[object Object]",Yo="[object Promise]",Al="[object Proxy]",kr="[object RegExp]",at="[object Set]",Kr="[object String]",Oi="[object Symbol]",Tl="[object Undefined]",Hr="[object WeakMap]",Dl="[object WeakSet]",Vr="[object ArrayBuffer]",dr="[object DataView]",Us="[object Float32Array]",zs="[object Float64Array]",Ls="[object Int8Array]",ks="[object Int16Array]",Ks="[object Int32Array]",Hs="[object Uint8Array]",Vs="[object Uint8ClampedArray]",Fs="[object Uint16Array]",Bs="[object Uint32Array]",ql=/\b__p \+= '';/g,jl=/\b(__p \+=) '' \+/g,Ml=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Zo=/&(?:amp|lt|gt|quot|#39);/g,Xo=/[&<>"']/g,Ul=RegExp(Zo.source),zl=RegExp(Xo.source),Ll=/<%-([\s\S]+?)%>/g,kl=/<%([\s\S]+?)%>/g,ea=/<%=([\s\S]+?)%>/g,Kl=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Hl=/^\w*$/,Vl=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ws=/[\\^$.*+?()[\]{}|]/g,Fl=RegExp(Ws.source),Gs=/^\s+/,Bl=/\s/,Wl=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Gl=/\{\n\/\* \[wrapped with (.+)\] \*/,Ql=/,? & /,Jl=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Yl=/[()=,{}\[\]\/\s]/,Zl=/\\(\\)?/g,Xl=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ta=/\w*$/,ep=/^[-+]0x[0-9a-f]+$/i,tp=/^0b[01]+$/i,rp=/^\[object .+?Constructor\]$/,ip=/^0o[0-7]+$/i,sp=/^(?:0|[1-9]\d*)$/,np=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ri=/($^)/,op=/['\n\r\u2028\u2029\\]/g,$i="\\ud800-\\udfff",ap="\\u0300-\\u036f",cp="\\ufe20-\\ufe2f",up="\\u20d0-\\u20ff",ra=ap+cp+up,ia="\\u2700-\\u27bf",sa="a-z\\xdf-\\xf6\\xf8-\\xff",hp="\\xac\\xb1\\xd7\\xf7",lp="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",pp="\\u2000-\\u206f",fp=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",na="A-Z\\xc0-\\xd6\\xd8-\\xde",oa="\\ufe0e\\ufe0f",aa=hp+lp+pp+fp,Qs="['’]",dp="["+$i+"]",ca="["+aa+"]",Ni="["+ra+"]",ua="\\d+",gp="["+ia+"]",ha="["+sa+"]",la="[^"+$i+aa+ua+ia+sa+na+"]",Js="\\ud83c[\\udffb-\\udfff]",yp="(?:"+Ni+"|"+Js+")",pa="[^"+$i+"]",Ys="(?:\\ud83c[\\udde6-\\uddff]){2}",Zs="[\\ud800-\\udbff][\\udc00-\\udfff]",gr="["+na+"]",fa="\\u200d",da="(?:"+ha+"|"+la+")",mp="(?:"+gr+"|"+la+")",ga="(?:"+Qs+"(?:d|ll|m|re|s|t|ve))?",ya="(?:"+Qs+"(?:D|LL|M|RE|S|T|VE))?",ma=yp+"?",va="["+oa+"]?",vp="(?:"+fa+"(?:"+[pa,Ys,Zs].join("|")+")"+va+ma+")*",wp="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",_p="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",wa=va+ma+vp,bp="(?:"+[gp,Ys,Zs].join("|")+")"+wa,Ip="(?:"+[pa+Ni+"?",Ni,Ys,Zs,dp].join("|")+")",Ep=RegExp(Qs,"g"),Pp=RegExp(Ni,"g"),Xs=RegExp(Js+"(?="+Js+")|"+Ip+wa,"g"),Sp=RegExp([gr+"?"+ha+"+"+ga+"(?="+[ca,gr,"$"].join("|")+")",mp+"+"+ya+"(?="+[ca,gr+da,"$"].join("|")+")",gr+"?"+da+"+"+ga,gr+"+"+ya,_p,wp,ua,bp].join("|"),"g"),Op=RegExp("["+fa+$i+ra+oa+"]"),Rp=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,$p=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Np=-1,ne={};ne[Us]=ne[zs]=ne[Ls]=ne[ks]=ne[Ks]=ne[Hs]=ne[Vs]=ne[Fs]=ne[Bs]=!0,ne[fr]=ne[Ei]=ne[Vr]=ne[Ur]=ne[dr]=ne[zr]=ne[Pi]=ne[Si]=ne[ot]=ne[Lr]=ne[Et]=ne[kr]=ne[at]=ne[Kr]=ne[Hr]=!1;var ie={};ie[fr]=ie[Ei]=ie[Vr]=ie[dr]=ie[Ur]=ie[zr]=ie[Us]=ie[zs]=ie[Ls]=ie[ks]=ie[Ks]=ie[ot]=ie[Lr]=ie[Et]=ie[kr]=ie[at]=ie[Kr]=ie[Oi]=ie[Hs]=ie[Vs]=ie[Fs]=ie[Bs]=!0,ie[Pi]=ie[Si]=ie[Hr]=!1;var xp={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Cp={"&":"&","<":"<",">":">",'"':""","'":"'"},Ap={"&":"&","<":"<",">":">",""":'"',"'":"'"},Tp={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Dp=parseFloat,qp=parseInt,_a=typeof pi=="object"&&pi&&pi.Object===Object&&pi,jp=typeof self=="object"&&self&&self.Object===Object&&self,be=_a||jp||Function("return this")(),en=t&&!t.nodeType&&t,Zt=en&&!0&&o&&!o.nodeType&&o,ba=Zt&&Zt.exports===en,tn=ba&&_a.process,Je=function(){try{var v=Zt&&Zt.require&&Zt.require("util").types;return v||tn&&tn.binding&&tn.binding("util")}catch{}}(),Ia=Je&&Je.isArrayBuffer,Ea=Je&&Je.isDate,Pa=Je&&Je.isMap,Sa=Je&&Je.isRegExp,Oa=Je&&Je.isSet,Ra=Je&&Je.isTypedArray;function Ke(v,S,E){switch(E.length){case 0:return v.call(S);case 1:return v.call(S,E[0]);case 2:return v.call(S,E[0],E[1]);case 3:return v.call(S,E[0],E[1],E[2])}return v.apply(S,E)}function Mp(v,S,E,T){for(var z=-1,Z=v==null?0:v.length;++z<Z;){var ye=v[z];S(T,ye,E(ye),v)}return T}function Ye(v,S){for(var E=-1,T=v==null?0:v.length;++E<T&&S(v[E],E,v)!==!1;);return v}function Up(v,S){for(var E=v==null?0:v.length;E--&&S(v[E],E,v)!==!1;);return v}function $a(v,S){for(var E=-1,T=v==null?0:v.length;++E<T;)if(!S(v[E],E,v))return!1;return!0}function Ut(v,S){for(var E=-1,T=v==null?0:v.length,z=0,Z=[];++E<T;){var ye=v[E];S(ye,E,v)&&(Z[z++]=ye)}return Z}function xi(v,S){var E=v==null?0:v.length;return!!E&&yr(v,S,0)>-1}function rn(v,S,E){for(var T=-1,z=v==null?0:v.length;++T<z;)if(E(S,v[T]))return!0;return!1}function oe(v,S){for(var E=-1,T=v==null?0:v.length,z=Array(T);++E<T;)z[E]=S(v[E],E,v);return z}function zt(v,S){for(var E=-1,T=S.length,z=v.length;++E<T;)v[z+E]=S[E];return v}function sn(v,S,E,T){var z=-1,Z=v==null?0:v.length;for(T&&Z&&(E=v[++z]);++z<Z;)E=S(E,v[z],z,v);return E}function zp(v,S,E,T){var z=v==null?0:v.length;for(T&&z&&(E=v[--z]);z--;)E=S(E,v[z],z,v);return E}function nn(v,S){for(var E=-1,T=v==null?0:v.length;++E<T;)if(S(v[E],E,v))return!0;return!1}var Lp=on("length");function kp(v){return v.split("")}function Kp(v){return v.match(Jl)||[]}function Na(v,S,E){var T;return E(v,function(z,Z,ye){if(S(z,Z,ye))return T=Z,!1}),T}function Ci(v,S,E,T){for(var z=v.length,Z=E+(T?1:-1);T?Z--:++Z<z;)if(S(v[Z],Z,v))return Z;return-1}function yr(v,S,E){return S===S?ef(v,S,E):Ci(v,xa,E)}function Hp(v,S,E,T){for(var z=E-1,Z=v.length;++z<Z;)if(T(v[z],S))return z;return-1}function xa(v){return v!==v}function Ca(v,S){var E=v==null?0:v.length;return E?cn(v,S)/E:Ii}function on(v){return function(S){return S==null?r:S[v]}}function an(v){return function(S){return v==null?r:v[S]}}function Aa(v,S,E,T,z){return z(v,function(Z,ye,re){E=T?(T=!1,Z):S(E,Z,ye,re)}),E}function Vp(v,S){var E=v.length;for(v.sort(S);E--;)v[E]=v[E].value;return v}function cn(v,S){for(var E,T=-1,z=v.length;++T<z;){var Z=S(v[T]);Z!==r&&(E=E===r?Z:E+Z)}return E}function un(v,S){for(var E=-1,T=Array(v);++E<v;)T[E]=S(E);return T}function Fp(v,S){return oe(S,function(E){return[E,v[E]]})}function Ta(v){return v&&v.slice(0,Ma(v)+1).replace(Gs,"")}function He(v){return function(S){return v(S)}}function hn(v,S){return oe(S,function(E){return v[E]})}function Fr(v,S){return v.has(S)}function Da(v,S){for(var E=-1,T=v.length;++E<T&&yr(S,v[E],0)>-1;);return E}function qa(v,S){for(var E=v.length;E--&&yr(S,v[E],0)>-1;);return E}function Bp(v,S){for(var E=v.length,T=0;E--;)v[E]===S&&++T;return T}var Wp=an(xp),Gp=an(Cp);function Qp(v){return"\\"+Tp[v]}function Jp(v,S){return v==null?r:v[S]}function mr(v){return Op.test(v)}function Yp(v){return Rp.test(v)}function Zp(v){for(var S,E=[];!(S=v.next()).done;)E.push(S.value);return E}function ln(v){var S=-1,E=Array(v.size);return v.forEach(function(T,z){E[++S]=[z,T]}),E}function ja(v,S){return function(E){return v(S(E))}}function Lt(v,S){for(var E=-1,T=v.length,z=0,Z=[];++E<T;){var ye=v[E];(ye===S||ye===b)&&(v[E]=b,Z[z++]=E)}return Z}function Ai(v){var S=-1,E=Array(v.size);return v.forEach(function(T){E[++S]=T}),E}function Xp(v){var S=-1,E=Array(v.size);return v.forEach(function(T){E[++S]=[T,T]}),E}function ef(v,S,E){for(var T=E-1,z=v.length;++T<z;)if(v[T]===S)return T;return-1}function tf(v,S,E){for(var T=E+1;T--;)if(v[T]===S)return T;return T}function vr(v){return mr(v)?sf(v):Lp(v)}function ct(v){return mr(v)?nf(v):kp(v)}function Ma(v){for(var S=v.length;S--&&Bl.test(v.charAt(S)););return S}var rf=an(Ap);function sf(v){for(var S=Xs.lastIndex=0;Xs.test(v);)++S;return S}function nf(v){return v.match(Xs)||[]}function of(v){return v.match(Sp)||[]}var af=function v(S){S=S==null?be:wr.defaults(be.Object(),S,wr.pick(be,$p));var E=S.Array,T=S.Date,z=S.Error,Z=S.Function,ye=S.Math,re=S.Object,pn=S.RegExp,cf=S.String,Ze=S.TypeError,Ti=E.prototype,uf=Z.prototype,_r=re.prototype,Di=S["__core-js_shared__"],qi=uf.toString,te=_r.hasOwnProperty,hf=0,Ua=function(){var e=/[^.]+$/.exec(Di&&Di.keys&&Di.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ji=_r.toString,lf=qi.call(re),pf=be._,ff=pn("^"+qi.call(te).replace(Ws,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Mi=ba?S.Buffer:r,kt=S.Symbol,Ui=S.Uint8Array,za=Mi?Mi.allocUnsafe:r,zi=ja(re.getPrototypeOf,re),La=re.create,ka=_r.propertyIsEnumerable,Li=Ti.splice,Ka=kt?kt.isConcatSpreadable:r,Br=kt?kt.iterator:r,Xt=kt?kt.toStringTag:r,ki=function(){try{var e=sr(re,"defineProperty");return e({},"",{}),e}catch{}}(),df=S.clearTimeout!==be.clearTimeout&&S.clearTimeout,gf=T&&T.now!==be.Date.now&&T.now,yf=S.setTimeout!==be.setTimeout&&S.setTimeout,Ki=ye.ceil,Hi=ye.floor,fn=re.getOwnPropertySymbols,mf=Mi?Mi.isBuffer:r,Ha=S.isFinite,vf=Ti.join,wf=ja(re.keys,re),me=ye.max,Pe=ye.min,_f=T.now,bf=S.parseInt,Va=ye.random,If=Ti.reverse,dn=sr(S,"DataView"),Wr=sr(S,"Map"),gn=sr(S,"Promise"),br=sr(S,"Set"),Gr=sr(S,"WeakMap"),Qr=sr(re,"create"),Vi=Gr&&new Gr,Ir={},Ef=nr(dn),Pf=nr(Wr),Sf=nr(gn),Of=nr(br),Rf=nr(Gr),Fi=kt?kt.prototype:r,Jr=Fi?Fi.valueOf:r,Fa=Fi?Fi.toString:r;function p(e){if(ue(e)&&!L(e)&&!(e instanceof B)){if(e instanceof Xe)return e;if(te.call(e,"__wrapped__"))return Bc(e)}return new Xe(e)}var Er=function(){function e(){}return function(i){if(!ce(i))return{};if(La)return La(i);e.prototype=i;var n=new e;return e.prototype=r,n}}();function Bi(){}function Xe(e,i){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!i,this.__index__=0,this.__values__=r}p.templateSettings={escape:Ll,evaluate:kl,interpolate:ea,variable:"",imports:{_:p}},p.prototype=Bi.prototype,p.prototype.constructor=p,Xe.prototype=Er(Bi.prototype),Xe.prototype.constructor=Xe;function B(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=yt,this.__views__=[]}function $f(){var e=new B(this.__wrapped__);return e.__actions__=De(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=De(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=De(this.__views__),e}function Nf(){if(this.__filtered__){var e=new B(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function xf(){var e=this.__wrapped__.value(),i=this.__dir__,n=L(e),c=i<0,h=n?e.length:0,f=Kd(0,h,this.__views__),y=f.start,m=f.end,_=m-y,O=c?m:y-1,R=this.__iteratees__,$=R.length,C=0,D=Pe(_,this.__takeCount__);if(!n||!c&&h==_&&D==_)return gc(e,this.__actions__);var M=[];e:for(;_--&&C<D;){O+=i;for(var H=-1,U=e[O];++H<$;){var F=R[H],G=F.iteratee,Be=F.type,xe=G(U);if(Be==El)U=xe;else if(!xe){if(Be==Qo)continue e;break e}}M[C++]=U}return M}B.prototype=Er(Bi.prototype),B.prototype.constructor=B;function er(e){var i=-1,n=e==null?0:e.length;for(this.clear();++i<n;){var c=e[i];this.set(c[0],c[1])}}function Cf(){this.__data__=Qr?Qr(null):{},this.size=0}function Af(e){var i=this.has(e)&&delete this.__data__[e];return this.size-=i?1:0,i}function Tf(e){var i=this.__data__;if(Qr){var n=i[e];return n===w?r:n}return te.call(i,e)?i[e]:r}function Df(e){var i=this.__data__;return Qr?i[e]!==r:te.call(i,e)}function qf(e,i){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Qr&&i===r?w:i,this}er.prototype.clear=Cf,er.prototype.delete=Af,er.prototype.get=Tf,er.prototype.has=Df,er.prototype.set=qf;function Pt(e){var i=-1,n=e==null?0:e.length;for(this.clear();++i<n;){var c=e[i];this.set(c[0],c[1])}}function jf(){this.__data__=[],this.size=0}function Mf(e){var i=this.__data__,n=Wi(i,e);if(n<0)return!1;var c=i.length-1;return n==c?i.pop():Li.call(i,n,1),--this.size,!0}function Uf(e){var i=this.__data__,n=Wi(i,e);return n<0?r:i[n][1]}function zf(e){return Wi(this.__data__,e)>-1}function Lf(e,i){var n=this.__data__,c=Wi(n,e);return c<0?(++this.size,n.push([e,i])):n[c][1]=i,this}Pt.prototype.clear=jf,Pt.prototype.delete=Mf,Pt.prototype.get=Uf,Pt.prototype.has=zf,Pt.prototype.set=Lf;function St(e){var i=-1,n=e==null?0:e.length;for(this.clear();++i<n;){var c=e[i];this.set(c[0],c[1])}}function kf(){this.size=0,this.__data__={hash:new er,map:new(Wr||Pt),string:new er}}function Kf(e){var i=ns(this,e).delete(e);return this.size-=i?1:0,i}function Hf(e){return ns(this,e).get(e)}function Vf(e){return ns(this,e).has(e)}function Ff(e,i){var n=ns(this,e),c=n.size;return n.set(e,i),this.size+=n.size==c?0:1,this}St.prototype.clear=kf,St.prototype.delete=Kf,St.prototype.get=Hf,St.prototype.has=Vf,St.prototype.set=Ff;function tr(e){var i=-1,n=e==null?0:e.length;for(this.__data__=new St;++i<n;)this.add(e[i])}function Bf(e){return this.__data__.set(e,w),this}function Wf(e){return this.__data__.has(e)}tr.prototype.add=tr.prototype.push=Bf,tr.prototype.has=Wf;function ut(e){var i=this.__data__=new Pt(e);this.size=i.size}function Gf(){this.__data__=new Pt,this.size=0}function Qf(e){var i=this.__data__,n=i.delete(e);return this.size=i.size,n}function Jf(e){return this.__data__.get(e)}function Yf(e){return this.__data__.has(e)}function Zf(e,i){var n=this.__data__;if(n instanceof Pt){var c=n.__data__;if(!Wr||c.length<a-1)return c.push([e,i]),this.size=++n.size,this;n=this.__data__=new St(c)}return n.set(e,i),this.size=n.size,this}ut.prototype.clear=Gf,ut.prototype.delete=Qf,ut.prototype.get=Jf,ut.prototype.has=Yf,ut.prototype.set=Zf;function Ba(e,i){var n=L(e),c=!n&&or(e),h=!n&&!c&&Bt(e),f=!n&&!c&&!h&&Rr(e),y=n||c||h||f,m=y?un(e.length,cf):[],_=m.length;for(var O in e)(i||te.call(e,O))&&!(y&&(O=="length"||h&&(O=="offset"||O=="parent")||f&&(O=="buffer"||O=="byteLength"||O=="byteOffset")||Nt(O,_)))&&m.push(O);return m}function Wa(e){var i=e.length;return i?e[On(0,i-1)]:r}function Xf(e,i){return os(De(e),rr(i,0,e.length))}function ed(e){return os(De(e))}function yn(e,i,n){(n!==r&&!ht(e[i],n)||n===r&&!(i in e))&&Ot(e,i,n)}function Yr(e,i,n){var c=e[i];(!(te.call(e,i)&&ht(c,n))||n===r&&!(i in e))&&Ot(e,i,n)}function Wi(e,i){for(var n=e.length;n--;)if(ht(e[n][0],i))return n;return-1}function td(e,i,n,c){return Kt(e,function(h,f,y){i(c,h,n(h),y)}),c}function Ga(e,i){return e&&vt(i,ve(i),e)}function rd(e,i){return e&&vt(i,je(i),e)}function Ot(e,i,n){i=="__proto__"&&ki?ki(e,i,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[i]=n}function mn(e,i){for(var n=-1,c=i.length,h=E(c),f=e==null;++n<c;)h[n]=f?r:Yn(e,i[n]);return h}function rr(e,i,n){return e===e&&(n!==r&&(e=e<=n?e:n),i!==r&&(e=e>=i?e:i)),e}function et(e,i,n,c,h,f){var y,m=i&I,_=i&P,O=i&A;if(n&&(y=h?n(e,c,h,f):n(e)),y!==r)return y;if(!ce(e))return e;var R=L(e);if(R){if(y=Vd(e),!m)return De(e,y)}else{var $=Se(e),C=$==Si||$==Jo;if(Bt(e))return vc(e,m);if($==Et||$==fr||C&&!h){if(y=_||C?{}:Mc(e),!m)return _?Td(e,rd(y,e)):Ad(e,Ga(y,e))}else{if(!ie[$])return h?e:{};y=Fd(e,$,m)}}f||(f=new ut);var D=f.get(e);if(D)return D;f.set(e,y),pu(e)?e.forEach(function(U){y.add(et(U,i,n,U,e,f))}):hu(e)&&e.forEach(function(U,F){y.set(F,et(U,i,n,F,e,f))});var M=O?_?Mn:jn:_?je:ve,H=R?r:M(e);return Ye(H||e,function(U,F){H&&(F=U,U=e[F]),Yr(y,F,et(U,i,n,F,e,f))}),y}function id(e){var i=ve(e);return function(n){return Qa(n,e,i)}}function Qa(e,i,n){var c=n.length;if(e==null)return!c;for(e=re(e);c--;){var h=n[c],f=i[h],y=e[h];if(y===r&&!(h in e)||!f(y))return!1}return!0}function Ja(e,i,n){if(typeof e!="function")throw new Ze(l);return si(function(){e.apply(r,n)},i)}function Zr(e,i,n,c){var h=-1,f=xi,y=!0,m=e.length,_=[],O=i.length;if(!m)return _;n&&(i=oe(i,He(n))),c?(f=rn,y=!1):i.length>=a&&(f=Fr,y=!1,i=new tr(i));e:for(;++h<m;){var R=e[h],$=n==null?R:n(R);if(R=c||R!==0?R:0,y&&$===$){for(var C=O;C--;)if(i[C]===$)continue e;_.push(R)}else f(i,$,c)||_.push(R)}return _}var Kt=Ec(mt),Ya=Ec(wn,!0);function sd(e,i){var n=!0;return Kt(e,function(c,h,f){return n=!!i(c,h,f),n}),n}function Gi(e,i,n){for(var c=-1,h=e.length;++c<h;){var f=e[c],y=i(f);if(y!=null&&(m===r?y===y&&!Fe(y):n(y,m)))var m=y,_=f}return _}function nd(e,i,n,c){var h=e.length;for(n=k(n),n<0&&(n=-n>h?0:h+n),c=c===r||c>h?h:k(c),c<0&&(c+=h),c=n>c?0:du(c);n<c;)e[n++]=i;return e}function Za(e,i){var n=[];return Kt(e,function(c,h,f){i(c,h,f)&&n.push(c)}),n}function Ie(e,i,n,c,h){var f=-1,y=e.length;for(n||(n=Wd),h||(h=[]);++f<y;){var m=e[f];i>0&&n(m)?i>1?Ie(m,i-1,n,c,h):zt(h,m):c||(h[h.length]=m)}return h}var vn=Pc(),Xa=Pc(!0);function mt(e,i){return e&&vn(e,i,ve)}function wn(e,i){return e&&Xa(e,i,ve)}function Qi(e,i){return Ut(i,function(n){return xt(e[n])})}function ir(e,i){i=Vt(i,e);for(var n=0,c=i.length;e!=null&&n<c;)e=e[wt(i[n++])];return n&&n==c?e:r}function ec(e,i,n){var c=i(e);return L(e)?c:zt(c,n(e))}function $e(e){return e==null?e===r?Tl:Cl:Xt&&Xt in re(e)?kd(e):eg(e)}function _n(e,i){return e>i}function od(e,i){return e!=null&&te.call(e,i)}function ad(e,i){return e!=null&&i in re(e)}function cd(e,i,n){return e>=Pe(i,n)&&e<me(i,n)}function bn(e,i,n){for(var c=n?rn:xi,h=e[0].length,f=e.length,y=f,m=E(f),_=1/0,O=[];y--;){var R=e[y];y&&i&&(R=oe(R,He(i))),_=Pe(R.length,_),m[y]=!n&&(i||h>=120&&R.length>=120)?new tr(y&&R):r}R=e[0];var $=-1,C=m[0];e:for(;++$<h&&O.length<_;){var D=R[$],M=i?i(D):D;if(D=n||D!==0?D:0,!(C?Fr(C,M):c(O,M,n))){for(y=f;--y;){var H=m[y];if(!(H?Fr(H,M):c(e[y],M,n)))continue e}C&&C.push(M),O.push(D)}}return O}function ud(e,i,n,c){return mt(e,function(h,f,y){i(c,n(h),f,y)}),c}function Xr(e,i,n){i=Vt(i,e),e=kc(e,i);var c=e==null?e:e[wt(rt(i))];return c==null?r:Ke(c,e,n)}function tc(e){return ue(e)&&$e(e)==fr}function hd(e){return ue(e)&&$e(e)==Vr}function ld(e){return ue(e)&&$e(e)==zr}function ei(e,i,n,c,h){return e===i?!0:e==null||i==null||!ue(e)&&!ue(i)?e!==e&&i!==i:pd(e,i,n,c,ei,h)}function pd(e,i,n,c,h,f){var y=L(e),m=L(i),_=y?Ei:Se(e),O=m?Ei:Se(i);_=_==fr?Et:_,O=O==fr?Et:O;var R=_==Et,$=O==Et,C=_==O;if(C&&Bt(e)){if(!Bt(i))return!1;y=!0,R=!1}if(C&&!R)return f||(f=new ut),y||Rr(e)?Dc(e,i,n,c,h,f):zd(e,i,_,n,c,h,f);if(!(n&N)){var D=R&&te.call(e,"__wrapped__"),M=$&&te.call(i,"__wrapped__");if(D||M){var H=D?e.value():e,U=M?i.value():i;return f||(f=new ut),h(H,U,n,c,f)}}return C?(f||(f=new ut),Ld(e,i,n,c,h,f)):!1}function fd(e){return ue(e)&&Se(e)==ot}function In(e,i,n,c){var h=n.length,f=h,y=!c;if(e==null)return!f;for(e=re(e);h--;){var m=n[h];if(y&&m[2]?m[1]!==e[m[0]]:!(m[0]in e))return!1}for(;++h<f;){m=n[h];var _=m[0],O=e[_],R=m[1];if(y&&m[2]){if(O===r&&!(_ in e))return!1}else{var $=new ut;if(c)var C=c(O,R,_,e,i,$);if(!(C===r?ei(R,O,N|K,c,$):C))return!1}}return!0}function rc(e){if(!ce(e)||Qd(e))return!1;var i=xt(e)?ff:rp;return i.test(nr(e))}function dd(e){return ue(e)&&$e(e)==kr}function gd(e){return ue(e)&&Se(e)==at}function yd(e){return ue(e)&&ps(e.length)&&!!ne[$e(e)]}function ic(e){return typeof e=="function"?e:e==null?Me:typeof e=="object"?L(e)?oc(e[0],e[1]):nc(e):Su(e)}function En(e){if(!ii(e))return wf(e);var i=[];for(var n in re(e))te.call(e,n)&&n!="constructor"&&i.push(n);return i}function md(e){if(!ce(e))return Xd(e);var i=ii(e),n=[];for(var c in e)c=="constructor"&&(i||!te.call(e,c))||n.push(c);return n}function Pn(e,i){return e<i}function sc(e,i){var n=-1,c=qe(e)?E(e.length):[];return Kt(e,function(h,f,y){c[++n]=i(h,f,y)}),c}function nc(e){var i=zn(e);return i.length==1&&i[0][2]?zc(i[0][0],i[0][1]):function(n){return n===e||In(n,e,i)}}function oc(e,i){return kn(e)&&Uc(i)?zc(wt(e),i):function(n){var c=Yn(n,e);return c===r&&c===i?Zn(n,e):ei(i,c,N|K)}}function Ji(e,i,n,c,h){e!==i&&vn(i,function(f,y){if(h||(h=new ut),ce(f))vd(e,i,y,n,Ji,c,h);else{var m=c?c(Hn(e,y),f,y+"",e,i,h):r;m===r&&(m=f),yn(e,y,m)}},je)}function vd(e,i,n,c,h,f,y){var m=Hn(e,n),_=Hn(i,n),O=y.get(_);if(O){yn(e,n,O);return}var R=f?f(m,_,n+"",e,i,y):r,$=R===r;if($){var C=L(_),D=!C&&Bt(_),M=!C&&!D&&Rr(_);R=_,C||D||M?L(m)?R=m:pe(m)?R=De(m):D?($=!1,R=vc(_,!0)):M?($=!1,R=wc(_,!0)):R=[]:ni(_)||or(_)?(R=m,or(m)?R=gu(m):(!ce(m)||xt(m))&&(R=Mc(_))):$=!1}$&&(y.set(_,R),h(R,_,c,f,y),y.delete(_)),yn(e,n,R)}function ac(e,i){var n=e.length;if(n)return i+=i<0?n:0,Nt(i,n)?e[i]:r}function cc(e,i,n){i.length?i=oe(i,function(f){return L(f)?function(y){return ir(y,f.length===1?f[0]:f)}:f}):i=[Me];var c=-1;i=oe(i,He(j()));var h=sc(e,function(f,y,m){var _=oe(i,function(O){return O(f)});return{criteria:_,index:++c,value:f}});return Vp(h,function(f,y){return Cd(f,y,n)})}function wd(e,i){return uc(e,i,function(n,c){return Zn(e,c)})}function uc(e,i,n){for(var c=-1,h=i.length,f={};++c<h;){var y=i[c],m=ir(e,y);n(m,y)&&ti(f,Vt(y,e),m)}return f}function _d(e){return function(i){return ir(i,e)}}function Sn(e,i,n,c){var h=c?Hp:yr,f=-1,y=i.length,m=e;for(e===i&&(i=De(i)),n&&(m=oe(e,He(n)));++f<y;)for(var _=0,O=i[f],R=n?n(O):O;(_=h(m,R,_,c))>-1;)m!==e&&Li.call(m,_,1),Li.call(e,_,1);return e}function hc(e,i){for(var n=e?i.length:0,c=n-1;n--;){var h=i[n];if(n==c||h!==f){var f=h;Nt(h)?Li.call(e,h,1):Nn(e,h)}}return e}function On(e,i){return e+Hi(Va()*(i-e+1))}function bd(e,i,n,c){for(var h=-1,f=me(Ki((i-e)/(n||1)),0),y=E(f);f--;)y[c?f:++h]=e,e+=n;return y}function Rn(e,i){var n="";if(!e||i<1||i>pr)return n;do i%2&&(n+=e),i=Hi(i/2),i&&(e+=e);while(i);return n}function V(e,i){return Vn(Lc(e,i,Me),e+"")}function Id(e){return Wa($r(e))}function Ed(e,i){var n=$r(e);return os(n,rr(i,0,n.length))}function ti(e,i,n,c){if(!ce(e))return e;i=Vt(i,e);for(var h=-1,f=i.length,y=f-1,m=e;m!=null&&++h<f;){var _=wt(i[h]),O=n;if(_==="__proto__"||_==="constructor"||_==="prototype")return e;if(h!=y){var R=m[_];O=c?c(R,_,m):r,O===r&&(O=ce(R)?R:Nt(i[h+1])?[]:{})}Yr(m,_,O),m=m[_]}return e}var lc=Vi?function(e,i){return Vi.set(e,i),e}:Me,Pd=ki?function(e,i){return ki(e,"toString",{configurable:!0,enumerable:!1,value:eo(i),writable:!0})}:Me;function Sd(e){return os($r(e))}function tt(e,i,n){var c=-1,h=e.length;i<0&&(i=-i>h?0:h+i),n=n>h?h:n,n<0&&(n+=h),h=i>n?0:n-i>>>0,i>>>=0;for(var f=E(h);++c<h;)f[c]=e[c+i];return f}function Od(e,i){var n;return Kt(e,function(c,h,f){return n=i(c,h,f),!n}),!!n}function Yi(e,i,n){var c=0,h=e==null?c:e.length;if(typeof i=="number"&&i===i&&h<=Rl){for(;c<h;){var f=c+h>>>1,y=e[f];y!==null&&!Fe(y)&&(n?y<=i:y<i)?c=f+1:h=f}return h}return $n(e,i,Me,n)}function $n(e,i,n,c){var h=0,f=e==null?0:e.length;if(f===0)return 0;i=n(i);for(var y=i!==i,m=i===null,_=Fe(i),O=i===r;h<f;){var R=Hi((h+f)/2),$=n(e[R]),C=$!==r,D=$===null,M=$===$,H=Fe($);if(y)var U=c||M;else O?U=M&&(c||C):m?U=M&&C&&(c||!D):_?U=M&&C&&!D&&(c||!H):D||H?U=!1:U=c?$<=i:$<i;U?h=R+1:f=R}return Pe(f,Ol)}function pc(e,i){for(var n=-1,c=e.length,h=0,f=[];++n<c;){var y=e[n],m=i?i(y):y;if(!n||!ht(m,_)){var _=m;f[h++]=y===0?0:y}}return f}function fc(e){return typeof e=="number"?e:Fe(e)?Ii:+e}function Ve(e){if(typeof e=="string")return e;if(L(e))return oe(e,Ve)+"";if(Fe(e))return Fa?Fa.call(e):"";var i=e+"";return i=="0"&&1/e==-1/0?"-0":i}function Ht(e,i,n){var c=-1,h=xi,f=e.length,y=!0,m=[],_=m;if(n)y=!1,h=rn;else if(f>=a){var O=i?null:Md(e);if(O)return Ai(O);y=!1,h=Fr,_=new tr}else _=i?[]:m;e:for(;++c<f;){var R=e[c],$=i?i(R):R;if(R=n||R!==0?R:0,y&&$===$){for(var C=_.length;C--;)if(_[C]===$)continue e;i&&_.push($),m.push(R)}else h(_,$,n)||(_!==m&&_.push($),m.push(R))}return m}function Nn(e,i){return i=Vt(i,e),e=kc(e,i),e==null||delete e[wt(rt(i))]}function dc(e,i,n,c){return ti(e,i,n(ir(e,i)),c)}function Zi(e,i,n,c){for(var h=e.length,f=c?h:-1;(c?f--:++f<h)&&i(e[f],f,e););return n?tt(e,c?0:f,c?f+1:h):tt(e,c?f+1:0,c?h:f)}function gc(e,i){var n=e;return n instanceof B&&(n=n.value()),sn(i,function(c,h){return h.func.apply(h.thisArg,zt([c],h.args))},n)}function xn(e,i,n){var c=e.length;if(c<2)return c?Ht(e[0]):[];for(var h=-1,f=E(c);++h<c;)for(var y=e[h],m=-1;++m<c;)m!=h&&(f[h]=Zr(f[h]||y,e[m],i,n));return Ht(Ie(f,1),i,n)}function yc(e,i,n){for(var c=-1,h=e.length,f=i.length,y={};++c<h;){var m=c<f?i[c]:r;n(y,e[c],m)}return y}function Cn(e){return pe(e)?e:[]}function An(e){return typeof e=="function"?e:Me}function Vt(e,i){return L(e)?e:kn(e,i)?[e]:Fc(X(e))}var Rd=V;function Ft(e,i,n){var c=e.length;return n=n===r?c:n,!i&&n>=c?e:tt(e,i,n)}var mc=df||function(e){return be.clearTimeout(e)};function vc(e,i){if(i)return e.slice();var n=e.length,c=za?za(n):new e.constructor(n);return e.copy(c),c}function Tn(e){var i=new e.constructor(e.byteLength);return new Ui(i).set(new Ui(e)),i}function $d(e,i){var n=i?Tn(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function Nd(e){var i=new e.constructor(e.source,ta.exec(e));return i.lastIndex=e.lastIndex,i}function xd(e){return Jr?re(Jr.call(e)):{}}function wc(e,i){var n=i?Tn(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function _c(e,i){if(e!==i){var n=e!==r,c=e===null,h=e===e,f=Fe(e),y=i!==r,m=i===null,_=i===i,O=Fe(i);if(!m&&!O&&!f&&e>i||f&&y&&_&&!m&&!O||c&&y&&_||!n&&_||!h)return 1;if(!c&&!f&&!O&&e<i||O&&n&&h&&!c&&!f||m&&n&&h||!y&&h||!_)return-1}return 0}function Cd(e,i,n){for(var c=-1,h=e.criteria,f=i.criteria,y=h.length,m=n.length;++c<y;){var _=_c(h[c],f[c]);if(_){if(c>=m)return _;var O=n[c];return _*(O=="desc"?-1:1)}}return e.index-i.index}function bc(e,i,n,c){for(var h=-1,f=e.length,y=n.length,m=-1,_=i.length,O=me(f-y,0),R=E(_+O),$=!c;++m<_;)R[m]=i[m];for(;++h<y;)($||h<f)&&(R[n[h]]=e[h]);for(;O--;)R[m++]=e[h++];return R}function Ic(e,i,n,c){for(var h=-1,f=e.length,y=-1,m=n.length,_=-1,O=i.length,R=me(f-m,0),$=E(R+O),C=!c;++h<R;)$[h]=e[h];for(var D=h;++_<O;)$[D+_]=i[_];for(;++y<m;)(C||h<f)&&($[D+n[y]]=e[h++]);return $}function De(e,i){var n=-1,c=e.length;for(i||(i=E(c));++n<c;)i[n]=e[n];return i}function vt(e,i,n,c){var h=!n;n||(n={});for(var f=-1,y=i.length;++f<y;){var m=i[f],_=c?c(n[m],e[m],m,n,e):r;_===r&&(_=e[m]),h?Ot(n,m,_):Yr(n,m,_)}return n}function Ad(e,i){return vt(e,Ln(e),i)}function Td(e,i){return vt(e,qc(e),i)}function Xi(e,i){return function(n,c){var h=L(n)?Mp:td,f=i?i():{};return h(n,e,j(c,2),f)}}function Pr(e){return V(function(i,n){var c=-1,h=n.length,f=h>1?n[h-1]:r,y=h>2?n[2]:r;for(f=e.length>3&&typeof f=="function"?(h--,f):r,y&&Ne(n[0],n[1],y)&&(f=h<3?r:f,h=1),i=re(i);++c<h;){var m=n[c];m&&e(i,m,c,f)}return i})}function Ec(e,i){return function(n,c){if(n==null)return n;if(!qe(n))return e(n,c);for(var h=n.length,f=i?h:-1,y=re(n);(i?f--:++f<h)&&c(y[f],f,y)!==!1;);return n}}function Pc(e){return function(i,n,c){for(var h=-1,f=re(i),y=c(i),m=y.length;m--;){var _=y[e?m:++h];if(n(f[_],_,f)===!1)break}return i}}function Dd(e,i,n){var c=i&ee,h=ri(e);function f(){var y=this&&this!==be&&this instanceof f?h:e;return y.apply(c?n:this,arguments)}return f}function Sc(e){return function(i){i=X(i);var n=mr(i)?ct(i):r,c=n?n[0]:i.charAt(0),h=n?Ft(n,1).join(""):i.slice(1);return c[e]()+h}}function Sr(e){return function(i){return sn(Eu(Iu(i).replace(Ep,"")),e,"")}}function ri(e){return function(){var i=arguments;switch(i.length){case 0:return new e;case 1:return new e(i[0]);case 2:return new e(i[0],i[1]);case 3:return new e(i[0],i[1],i[2]);case 4:return new e(i[0],i[1],i[2],i[3]);case 5:return new e(i[0],i[1],i[2],i[3],i[4]);case 6:return new e(i[0],i[1],i[2],i[3],i[4],i[5]);case 7:return new e(i[0],i[1],i[2],i[3],i[4],i[5],i[6])}var n=Er(e.prototype),c=e.apply(n,i);return ce(c)?c:n}}function qd(e,i,n){var c=ri(e);function h(){for(var f=arguments.length,y=E(f),m=f,_=Or(h);m--;)y[m]=arguments[m];var O=f<3&&y[0]!==_&&y[f-1]!==_?[]:Lt(y,_);if(f-=O.length,f<n)return xc(e,i,es,h.placeholder,r,y,O,r,r,n-f);var R=this&&this!==be&&this instanceof h?c:e;return Ke(R,this,y)}return h}function Oc(e){return function(i,n,c){var h=re(i);if(!qe(i)){var f=j(n,3);i=ve(i),n=function(m){return f(h[m],m,h)}}var y=e(i,n,c);return y>-1?h[f?i[y]:y]:r}}function Rc(e){return $t(function(i){var n=i.length,c=n,h=Xe.prototype.thru;for(e&&i.reverse();c--;){var f=i[c];if(typeof f!="function")throw new Ze(l);if(h&&!y&&ss(f)=="wrapper")var y=new Xe([],!0)}for(c=y?c:n;++c<n;){f=i[c];var m=ss(f),_=m=="wrapper"?Un(f):r;_&&Kn(_[0])&&_[1]==(le|Q|se|Re)&&!_[4].length&&_[9]==1?y=y[ss(_[0])].apply(y,_[3]):y=f.length==1&&Kn(f)?y[m]():y.thru(f)}return function(){var O=arguments,R=O[0];if(y&&O.length==1&&L(R))return y.plant(R).value();for(var $=0,C=n?i[$].apply(this,O):R;++$<n;)C=i[$].call(this,C);return C}})}function es(e,i,n,c,h,f,y,m,_,O){var R=i&le,$=i&ee,C=i&W,D=i&(Q|Y),M=i&Mt,H=C?r:ri(e);function U(){for(var F=arguments.length,G=E(F),Be=F;Be--;)G[Be]=arguments[Be];if(D)var xe=Or(U),We=Bp(G,xe);if(c&&(G=bc(G,c,h,D)),f&&(G=Ic(G,f,y,D)),F-=We,D&&F<O){var fe=Lt(G,xe);return xc(e,i,es,U.placeholder,n,G,fe,m,_,O-F)}var lt=$?n:this,At=C?lt[e]:e;return F=G.length,m?G=tg(G,m):M&&F>1&&G.reverse(),R&&_<F&&(G.length=_),this&&this!==be&&this instanceof U&&(At=H||ri(At)),At.apply(lt,G)}return U}function $c(e,i){return function(n,c){return ud(n,e,i(c),{})}}function ts(e,i){return function(n,c){var h;if(n===r&&c===r)return i;if(n!==r&&(h=n),c!==r){if(h===r)return c;typeof n=="string"||typeof c=="string"?(n=Ve(n),c=Ve(c)):(n=fc(n),c=fc(c)),h=e(n,c)}return h}}function Dn(e){return $t(function(i){return i=oe(i,He(j())),V(function(n){var c=this;return e(i,function(h){return Ke(h,c,n)})})})}function rs(e,i){i=i===r?" ":Ve(i);var n=i.length;if(n<2)return n?Rn(i,e):i;var c=Rn(i,Ki(e/vr(i)));return mr(i)?Ft(ct(c),0,e).join(""):c.slice(0,e)}function jd(e,i,n,c){var h=i&ee,f=ri(e);function y(){for(var m=-1,_=arguments.length,O=-1,R=c.length,$=E(R+_),C=this&&this!==be&&this instanceof y?f:e;++O<R;)$[O]=c[O];for(;_--;)$[O++]=arguments[++m];return Ke(C,h?n:this,$)}return y}function Nc(e){return function(i,n,c){return c&&typeof c!="number"&&Ne(i,n,c)&&(n=c=r),i=Ct(i),n===r?(n=i,i=0):n=Ct(n),c=c===r?i<n?1:-1:Ct(c),bd(i,n,c,e)}}function is(e){return function(i,n){return typeof i=="string"&&typeof n=="string"||(i=it(i),n=it(n)),e(i,n)}}function xc(e,i,n,c,h,f,y,m,_,O){var R=i&Q,$=R?y:r,C=R?r:y,D=R?f:r,M=R?r:f;i|=R?se:Te,i&=~(R?Te:se),i&ge||(i&=-4);var H=[e,i,h,D,$,M,C,m,_,O],U=n.apply(r,H);return Kn(e)&&Kc(U,H),U.placeholder=c,Hc(U,e,i)}function qn(e){var i=ye[e];return function(n,c){if(n=it(n),c=c==null?0:Pe(k(c),292),c&&Ha(n)){var h=(X(n)+"e").split("e"),f=i(h[0]+"e"+(+h[1]+c));return h=(X(f)+"e").split("e"),+(h[0]+"e"+(+h[1]-c))}return i(n)}}var Md=br&&1/Ai(new br([,-0]))[1]==bi?function(e){return new br(e)}:io;function Cc(e){return function(i){var n=Se(i);return n==ot?ln(i):n==at?Xp(i):Fp(i,e(i))}}function Rt(e,i,n,c,h,f,y,m){var _=i&W;if(!_&&typeof e!="function")throw new Ze(l);var O=c?c.length:0;if(O||(i&=-97,c=h=r),y=y===r?y:me(k(y),0),m=m===r?m:k(m),O-=h?h.length:0,i&Te){var R=c,$=h;c=h=r}var C=_?r:Un(e),D=[e,i,n,c,h,R,$,f,y,m];if(C&&Zd(D,C),e=D[0],i=D[1],n=D[2],c=D[3],h=D[4],m=D[9]=D[9]===r?_?0:e.length:me(D[9]-O,0),!m&&i&(Q|Y)&&(i&=-25),!i||i==ee)var M=Dd(e,i,n);else i==Q||i==Y?M=qd(e,i,m):(i==se||i==(ee|se))&&!h.length?M=jd(e,i,n,c):M=es.apply(r,D);var H=C?lc:Kc;return Hc(H(M,D),e,i)}function Ac(e,i,n,c){return e===r||ht(e,_r[n])&&!te.call(c,n)?i:e}function Tc(e,i,n,c,h,f){return ce(e)&&ce(i)&&(f.set(i,e),Ji(e,i,r,Tc,f),f.delete(i)),e}function Ud(e){return ni(e)?r:e}function Dc(e,i,n,c,h,f){var y=n&N,m=e.length,_=i.length;if(m!=_&&!(y&&_>m))return!1;var O=f.get(e),R=f.get(i);if(O&&R)return O==i&&R==e;var $=-1,C=!0,D=n&K?new tr:r;for(f.set(e,i),f.set(i,e);++$<m;){var M=e[$],H=i[$];if(c)var U=y?c(H,M,$,i,e,f):c(M,H,$,e,i,f);if(U!==r){if(U)continue;C=!1;break}if(D){if(!nn(i,function(F,G){if(!Fr(D,G)&&(M===F||h(M,F,n,c,f)))return D.push(G)})){C=!1;break}}else if(!(M===H||h(M,H,n,c,f))){C=!1;break}}return f.delete(e),f.delete(i),C}function zd(e,i,n,c,h,f,y){switch(n){case dr:if(e.byteLength!=i.byteLength||e.byteOffset!=i.byteOffset)return!1;e=e.buffer,i=i.buffer;case Vr:return!(e.byteLength!=i.byteLength||!f(new Ui(e),new Ui(i)));case Ur:case zr:case Lr:return ht(+e,+i);case Pi:return e.name==i.name&&e.message==i.message;case kr:case Kr:return e==i+"";case ot:var m=ln;case at:var _=c&N;if(m||(m=Ai),e.size!=i.size&&!_)return!1;var O=y.get(e);if(O)return O==i;c|=K,y.set(e,i);var R=Dc(m(e),m(i),c,h,f,y);return y.delete(e),R;case Oi:if(Jr)return Jr.call(e)==Jr.call(i)}return!1}function Ld(e,i,n,c,h,f){var y=n&N,m=jn(e),_=m.length,O=jn(i),R=O.length;if(_!=R&&!y)return!1;for(var $=_;$--;){var C=m[$];if(!(y?C in i:te.call(i,C)))return!1}var D=f.get(e),M=f.get(i);if(D&&M)return D==i&&M==e;var H=!0;f.set(e,i),f.set(i,e);for(var U=y;++$<_;){C=m[$];var F=e[C],G=i[C];if(c)var Be=y?c(G,F,C,i,e,f):c(F,G,C,e,i,f);if(!(Be===r?F===G||h(F,G,n,c,f):Be)){H=!1;break}U||(U=C=="constructor")}if(H&&!U){var xe=e.constructor,We=i.constructor;xe!=We&&"constructor"in e&&"constructor"in i&&!(typeof xe=="function"&&xe instanceof xe&&typeof We=="function"&&We instanceof We)&&(H=!1)}return f.delete(e),f.delete(i),H}function $t(e){return Vn(Lc(e,r,Qc),e+"")}function jn(e){return ec(e,ve,Ln)}function Mn(e){return ec(e,je,qc)}var Un=Vi?function(e){return Vi.get(e)}:io;function ss(e){for(var i=e.name+"",n=Ir[i],c=te.call(Ir,i)?n.length:0;c--;){var h=n[c],f=h.func;if(f==null||f==e)return h.name}return i}function Or(e){var i=te.call(p,"placeholder")?p:e;return i.placeholder}function j(){var e=p.iteratee||to;return e=e===to?ic:e,arguments.length?e(arguments[0],arguments[1]):e}function ns(e,i){var n=e.__data__;return Gd(i)?n[typeof i=="string"?"string":"hash"]:n.map}function zn(e){for(var i=ve(e),n=i.length;n--;){var c=i[n],h=e[c];i[n]=[c,h,Uc(h)]}return i}function sr(e,i){var n=Jp(e,i);return rc(n)?n:r}function kd(e){var i=te.call(e,Xt),n=e[Xt];try{e[Xt]=r;var c=!0}catch{}var h=ji.call(e);return c&&(i?e[Xt]=n:delete e[Xt]),h}var Ln=fn?function(e){return e==null?[]:(e=re(e),Ut(fn(e),function(i){return ka.call(e,i)}))}:so,qc=fn?function(e){for(var i=[];e;)zt(i,Ln(e)),e=zi(e);return i}:so,Se=$e;(dn&&Se(new dn(new ArrayBuffer(1)))!=dr||Wr&&Se(new Wr)!=ot||gn&&Se(gn.resolve())!=Yo||br&&Se(new br)!=at||Gr&&Se(new Gr)!=Hr)&&(Se=function(e){var i=$e(e),n=i==Et?e.constructor:r,c=n?nr(n):"";if(c)switch(c){case Ef:return dr;case Pf:return ot;case Sf:return Yo;case Of:return at;case Rf:return Hr}return i});function Kd(e,i,n){for(var c=-1,h=n.length;++c<h;){var f=n[c],y=f.size;switch(f.type){case"drop":e+=y;break;case"dropRight":i-=y;break;case"take":i=Pe(i,e+y);break;case"takeRight":e=me(e,i-y);break}}return{start:e,end:i}}function Hd(e){var i=e.match(Gl);return i?i[1].split(Ql):[]}function jc(e,i,n){i=Vt(i,e);for(var c=-1,h=i.length,f=!1;++c<h;){var y=wt(i[c]);if(!(f=e!=null&&n(e,y)))break;e=e[y]}return f||++c!=h?f:(h=e==null?0:e.length,!!h&&ps(h)&&Nt(y,h)&&(L(e)||or(e)))}function Vd(e){var i=e.length,n=new e.constructor(i);return i&&typeof e[0]=="string"&&te.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function Mc(e){return typeof e.constructor=="function"&&!ii(e)?Er(zi(e)):{}}function Fd(e,i,n){var c=e.constructor;switch(i){case Vr:return Tn(e);case Ur:case zr:return new c(+e);case dr:return $d(e,n);case Us:case zs:case Ls:case ks:case Ks:case Hs:case Vs:case Fs:case Bs:return wc(e,n);case ot:return new c;case Lr:case Kr:return new c(e);case kr:return Nd(e);case at:return new c;case Oi:return xd(e)}}function Bd(e,i){var n=i.length;if(!n)return e;var c=n-1;return i[c]=(n>1?"& ":"")+i[c],i=i.join(n>2?", ":" "),e.replace(Wl,`{
|
|
29
|
-
/* [wrapped with `+i+`] */
|
|
30
|
-
`)}function Wd(e){return L(e)||or(e)||!!(Ka&&e&&e[Ka])}function Nt(e,i){var n=typeof e;return i=i??pr,!!i&&(n=="number"||n!="symbol"&&sp.test(e))&&e>-1&&e%1==0&&e<i}function Ne(e,i,n){if(!ce(n))return!1;var c=typeof i;return(c=="number"?qe(n)&&Nt(i,n.length):c=="string"&&i in n)?ht(n[i],e):!1}function kn(e,i){if(L(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Fe(e)?!0:Hl.test(e)||!Kl.test(e)||i!=null&&e in re(i)}function Gd(e){var i=typeof e;return i=="string"||i=="number"||i=="symbol"||i=="boolean"?e!=="__proto__":e===null}function Kn(e){var i=ss(e),n=p[i];if(typeof n!="function"||!(i in B.prototype))return!1;if(e===n)return!0;var c=Un(n);return!!c&&e===c[0]}function Qd(e){return!!Ua&&Ua in e}var Jd=Di?xt:no;function ii(e){var i=e&&e.constructor,n=typeof i=="function"&&i.prototype||_r;return e===n}function Uc(e){return e===e&&!ce(e)}function zc(e,i){return function(n){return n==null?!1:n[e]===i&&(i!==r||e in re(n))}}function Yd(e){var i=hs(e,function(c){return n.size===d&&n.clear(),c}),n=i.cache;return i}function Zd(e,i){var n=e[1],c=i[1],h=n|c,f=h<(ee|W|le),y=c==le&&n==Q||c==le&&n==Re&&e[7].length<=i[8]||c==(le|Re)&&i[7].length<=i[8]&&n==Q;if(!(f||y))return e;c&ee&&(e[2]=i[2],h|=n&ee?0:ge);var m=i[3];if(m){var _=e[3];e[3]=_?bc(_,m,i[4]):m,e[4]=_?Lt(e[3],b):i[4]}return m=i[5],m&&(_=e[5],e[5]=_?Ic(_,m,i[6]):m,e[6]=_?Lt(e[5],b):i[6]),m=i[7],m&&(e[7]=m),c&le&&(e[8]=e[8]==null?i[8]:Pe(e[8],i[8])),e[9]==null&&(e[9]=i[9]),e[0]=i[0],e[1]=h,e}function Xd(e){var i=[];if(e!=null)for(var n in re(e))i.push(n);return i}function eg(e){return ji.call(e)}function Lc(e,i,n){return i=me(i===r?e.length-1:i,0),function(){for(var c=arguments,h=-1,f=me(c.length-i,0),y=E(f);++h<f;)y[h]=c[i+h];h=-1;for(var m=E(i+1);++h<i;)m[h]=c[h];return m[i]=n(y),Ke(e,this,m)}}function kc(e,i){return i.length<2?e:ir(e,tt(i,0,-1))}function tg(e,i){for(var n=e.length,c=Pe(i.length,n),h=De(e);c--;){var f=i[c];e[c]=Nt(f,n)?h[f]:r}return e}function Hn(e,i){if(!(i==="constructor"&&typeof e[i]=="function")&&i!="__proto__")return e[i]}var Kc=Vc(lc),si=yf||function(e,i){return be.setTimeout(e,i)},Vn=Vc(Pd);function Hc(e,i,n){var c=i+"";return Vn(e,Bd(c,rg(Hd(c),n)))}function Vc(e){var i=0,n=0;return function(){var c=_f(),h=Il-(c-n);if(n=c,h>0){if(++i>=bl)return arguments[0]}else i=0;return e.apply(r,arguments)}}function os(e,i){var n=-1,c=e.length,h=c-1;for(i=i===r?c:i;++n<i;){var f=On(n,h),y=e[f];e[f]=e[n],e[n]=y}return e.length=i,e}var Fc=Yd(function(e){var i=[];return e.charCodeAt(0)===46&&i.push(""),e.replace(Vl,function(n,c,h,f){i.push(h?f.replace(Zl,"$1"):c||n)}),i});function wt(e){if(typeof e=="string"||Fe(e))return e;var i=e+"";return i=="0"&&1/e==-1/0?"-0":i}function nr(e){if(e!=null){try{return qi.call(e)}catch{}try{return e+""}catch{}}return""}function rg(e,i){return Ye($l,function(n){var c="_."+n[0];i&n[1]&&!xi(e,c)&&e.push(c)}),e.sort()}function Bc(e){if(e instanceof B)return e.clone();var i=new Xe(e.__wrapped__,e.__chain__);return i.__actions__=De(e.__actions__),i.__index__=e.__index__,i.__values__=e.__values__,i}function ig(e,i,n){(n?Ne(e,i,n):i===r)?i=1:i=me(k(i),0);var c=e==null?0:e.length;if(!c||i<1)return[];for(var h=0,f=0,y=E(Ki(c/i));h<c;)y[f++]=tt(e,h,h+=i);return y}function sg(e){for(var i=-1,n=e==null?0:e.length,c=0,h=[];++i<n;){var f=e[i];f&&(h[c++]=f)}return h}function ng(){var e=arguments.length;if(!e)return[];for(var i=E(e-1),n=arguments[0],c=e;c--;)i[c-1]=arguments[c];return zt(L(n)?De(n):[n],Ie(i,1))}var og=V(function(e,i){return pe(e)?Zr(e,Ie(i,1,pe,!0)):[]}),ag=V(function(e,i){var n=rt(i);return pe(n)&&(n=r),pe(e)?Zr(e,Ie(i,1,pe,!0),j(n,2)):[]}),cg=V(function(e,i){var n=rt(i);return pe(n)&&(n=r),pe(e)?Zr(e,Ie(i,1,pe,!0),r,n):[]});function ug(e,i,n){var c=e==null?0:e.length;return c?(i=n||i===r?1:k(i),tt(e,i<0?0:i,c)):[]}function hg(e,i,n){var c=e==null?0:e.length;return c?(i=n||i===r?1:k(i),i=c-i,tt(e,0,i<0?0:i)):[]}function lg(e,i){return e&&e.length?Zi(e,j(i,3),!0,!0):[]}function pg(e,i){return e&&e.length?Zi(e,j(i,3),!0):[]}function fg(e,i,n,c){var h=e==null?0:e.length;return h?(n&&typeof n!="number"&&Ne(e,i,n)&&(n=0,c=h),nd(e,i,n,c)):[]}function Wc(e,i,n){var c=e==null?0:e.length;if(!c)return-1;var h=n==null?0:k(n);return h<0&&(h=me(c+h,0)),Ci(e,j(i,3),h)}function Gc(e,i,n){var c=e==null?0:e.length;if(!c)return-1;var h=c-1;return n!==r&&(h=k(n),h=n<0?me(c+h,0):Pe(h,c-1)),Ci(e,j(i,3),h,!0)}function Qc(e){var i=e==null?0:e.length;return i?Ie(e,1):[]}function dg(e){var i=e==null?0:e.length;return i?Ie(e,bi):[]}function gg(e,i){var n=e==null?0:e.length;return n?(i=i===r?1:k(i),Ie(e,i)):[]}function yg(e){for(var i=-1,n=e==null?0:e.length,c={};++i<n;){var h=e[i];c[h[0]]=h[1]}return c}function Jc(e){return e&&e.length?e[0]:r}function mg(e,i,n){var c=e==null?0:e.length;if(!c)return-1;var h=n==null?0:k(n);return h<0&&(h=me(c+h,0)),yr(e,i,h)}function vg(e){var i=e==null?0:e.length;return i?tt(e,0,-1):[]}var wg=V(function(e){var i=oe(e,Cn);return i.length&&i[0]===e[0]?bn(i):[]}),_g=V(function(e){var i=rt(e),n=oe(e,Cn);return i===rt(n)?i=r:n.pop(),n.length&&n[0]===e[0]?bn(n,j(i,2)):[]}),bg=V(function(e){var i=rt(e),n=oe(e,Cn);return i=typeof i=="function"?i:r,i&&n.pop(),n.length&&n[0]===e[0]?bn(n,r,i):[]});function Ig(e,i){return e==null?"":vf.call(e,i)}function rt(e){var i=e==null?0:e.length;return i?e[i-1]:r}function Eg(e,i,n){var c=e==null?0:e.length;if(!c)return-1;var h=c;return n!==r&&(h=k(n),h=h<0?me(c+h,0):Pe(h,c-1)),i===i?tf(e,i,h):Ci(e,xa,h,!0)}function Pg(e,i){return e&&e.length?ac(e,k(i)):r}var Sg=V(Yc);function Yc(e,i){return e&&e.length&&i&&i.length?Sn(e,i):e}function Og(e,i,n){return e&&e.length&&i&&i.length?Sn(e,i,j(n,2)):e}function Rg(e,i,n){return e&&e.length&&i&&i.length?Sn(e,i,r,n):e}var $g=$t(function(e,i){var n=e==null?0:e.length,c=mn(e,i);return hc(e,oe(i,function(h){return Nt(h,n)?+h:h}).sort(_c)),c});function Ng(e,i){var n=[];if(!(e&&e.length))return n;var c=-1,h=[],f=e.length;for(i=j(i,3);++c<f;){var y=e[c];i(y,c,e)&&(n.push(y),h.push(c))}return hc(e,h),n}function Fn(e){return e==null?e:If.call(e)}function xg(e,i,n){var c=e==null?0:e.length;return c?(n&&typeof n!="number"&&Ne(e,i,n)?(i=0,n=c):(i=i==null?0:k(i),n=n===r?c:k(n)),tt(e,i,n)):[]}function Cg(e,i){return Yi(e,i)}function Ag(e,i,n){return $n(e,i,j(n,2))}function Tg(e,i){var n=e==null?0:e.length;if(n){var c=Yi(e,i);if(c<n&&ht(e[c],i))return c}return-1}function Dg(e,i){return Yi(e,i,!0)}function qg(e,i,n){return $n(e,i,j(n,2),!0)}function jg(e,i){var n=e==null?0:e.length;if(n){var c=Yi(e,i,!0)-1;if(ht(e[c],i))return c}return-1}function Mg(e){return e&&e.length?pc(e):[]}function Ug(e,i){return e&&e.length?pc(e,j(i,2)):[]}function zg(e){var i=e==null?0:e.length;return i?tt(e,1,i):[]}function Lg(e,i,n){return e&&e.length?(i=n||i===r?1:k(i),tt(e,0,i<0?0:i)):[]}function kg(e,i,n){var c=e==null?0:e.length;return c?(i=n||i===r?1:k(i),i=c-i,tt(e,i<0?0:i,c)):[]}function Kg(e,i){return e&&e.length?Zi(e,j(i,3),!1,!0):[]}function Hg(e,i){return e&&e.length?Zi(e,j(i,3)):[]}var Vg=V(function(e){return Ht(Ie(e,1,pe,!0))}),Fg=V(function(e){var i=rt(e);return pe(i)&&(i=r),Ht(Ie(e,1,pe,!0),j(i,2))}),Bg=V(function(e){var i=rt(e);return i=typeof i=="function"?i:r,Ht(Ie(e,1,pe,!0),r,i)});function Wg(e){return e&&e.length?Ht(e):[]}function Gg(e,i){return e&&e.length?Ht(e,j(i,2)):[]}function Qg(e,i){return i=typeof i=="function"?i:r,e&&e.length?Ht(e,r,i):[]}function Bn(e){if(!(e&&e.length))return[];var i=0;return e=Ut(e,function(n){if(pe(n))return i=me(n.length,i),!0}),un(i,function(n){return oe(e,on(n))})}function Zc(e,i){if(!(e&&e.length))return[];var n=Bn(e);return i==null?n:oe(n,function(c){return Ke(i,r,c)})}var Jg=V(function(e,i){return pe(e)?Zr(e,i):[]}),Yg=V(function(e){return xn(Ut(e,pe))}),Zg=V(function(e){var i=rt(e);return pe(i)&&(i=r),xn(Ut(e,pe),j(i,2))}),Xg=V(function(e){var i=rt(e);return i=typeof i=="function"?i:r,xn(Ut(e,pe),r,i)}),ey=V(Bn);function ty(e,i){return yc(e||[],i||[],Yr)}function ry(e,i){return yc(e||[],i||[],ti)}var iy=V(function(e){var i=e.length,n=i>1?e[i-1]:r;return n=typeof n=="function"?(e.pop(),n):r,Zc(e,n)});function Xc(e){var i=p(e);return i.__chain__=!0,i}function sy(e,i){return i(e),e}function as(e,i){return i(e)}var ny=$t(function(e){var i=e.length,n=i?e[0]:0,c=this.__wrapped__,h=function(f){return mn(f,e)};return i>1||this.__actions__.length||!(c instanceof B)||!Nt(n)?this.thru(h):(c=c.slice(n,+n+(i?1:0)),c.__actions__.push({func:as,args:[h],thisArg:r}),new Xe(c,this.__chain__).thru(function(f){return i&&!f.length&&f.push(r),f}))});function oy(){return Xc(this)}function ay(){return new Xe(this.value(),this.__chain__)}function cy(){this.__values__===r&&(this.__values__=fu(this.value()));var e=this.__index__>=this.__values__.length,i=e?r:this.__values__[this.__index__++];return{done:e,value:i}}function uy(){return this}function hy(e){for(var i,n=this;n instanceof Bi;){var c=Bc(n);c.__index__=0,c.__values__=r,i?h.__wrapped__=c:i=c;var h=c;n=n.__wrapped__}return h.__wrapped__=e,i}function ly(){var e=this.__wrapped__;if(e instanceof B){var i=e;return this.__actions__.length&&(i=new B(this)),i=i.reverse(),i.__actions__.push({func:as,args:[Fn],thisArg:r}),new Xe(i,this.__chain__)}return this.thru(Fn)}function py(){return gc(this.__wrapped__,this.__actions__)}var fy=Xi(function(e,i,n){te.call(e,n)?++e[n]:Ot(e,n,1)});function dy(e,i,n){var c=L(e)?$a:sd;return n&&Ne(e,i,n)&&(i=r),c(e,j(i,3))}function gy(e,i){var n=L(e)?Ut:Za;return n(e,j(i,3))}var yy=Oc(Wc),my=Oc(Gc);function vy(e,i){return Ie(cs(e,i),1)}function wy(e,i){return Ie(cs(e,i),bi)}function _y(e,i,n){return n=n===r?1:k(n),Ie(cs(e,i),n)}function eu(e,i){var n=L(e)?Ye:Kt;return n(e,j(i,3))}function tu(e,i){var n=L(e)?Up:Ya;return n(e,j(i,3))}var by=Xi(function(e,i,n){te.call(e,n)?e[n].push(i):Ot(e,n,[i])});function Iy(e,i,n,c){e=qe(e)?e:$r(e),n=n&&!c?k(n):0;var h=e.length;return n<0&&(n=me(h+n,0)),fs(e)?n<=h&&e.indexOf(i,n)>-1:!!h&&yr(e,i,n)>-1}var Ey=V(function(e,i,n){var c=-1,h=typeof i=="function",f=qe(e)?E(e.length):[];return Kt(e,function(y){f[++c]=h?Ke(i,y,n):Xr(y,i,n)}),f}),Py=Xi(function(e,i,n){Ot(e,n,i)});function cs(e,i){var n=L(e)?oe:sc;return n(e,j(i,3))}function Sy(e,i,n,c){return e==null?[]:(L(i)||(i=i==null?[]:[i]),n=c?r:n,L(n)||(n=n==null?[]:[n]),cc(e,i,n))}var Oy=Xi(function(e,i,n){e[n?0:1].push(i)},function(){return[[],[]]});function Ry(e,i,n){var c=L(e)?sn:Aa,h=arguments.length<3;return c(e,j(i,4),n,h,Kt)}function $y(e,i,n){var c=L(e)?zp:Aa,h=arguments.length<3;return c(e,j(i,4),n,h,Ya)}function Ny(e,i){var n=L(e)?Ut:Za;return n(e,ls(j(i,3)))}function xy(e){var i=L(e)?Wa:Id;return i(e)}function Cy(e,i,n){(n?Ne(e,i,n):i===r)?i=1:i=k(i);var c=L(e)?Xf:Ed;return c(e,i)}function Ay(e){var i=L(e)?ed:Sd;return i(e)}function Ty(e){if(e==null)return 0;if(qe(e))return fs(e)?vr(e):e.length;var i=Se(e);return i==ot||i==at?e.size:En(e).length}function Dy(e,i,n){var c=L(e)?nn:Od;return n&&Ne(e,i,n)&&(i=r),c(e,j(i,3))}var qy=V(function(e,i){if(e==null)return[];var n=i.length;return n>1&&Ne(e,i[0],i[1])?i=[]:n>2&&Ne(i[0],i[1],i[2])&&(i=[i[0]]),cc(e,Ie(i,1),[])}),us=gf||function(){return be.Date.now()};function jy(e,i){if(typeof i!="function")throw new Ze(l);return e=k(e),function(){if(--e<1)return i.apply(this,arguments)}}function ru(e,i,n){return i=n?r:i,i=e&&i==null?e.length:i,Rt(e,le,r,r,r,r,i)}function iu(e,i){var n;if(typeof i!="function")throw new Ze(l);return e=k(e),function(){return--e>0&&(n=i.apply(this,arguments)),e<=1&&(i=r),n}}var Wn=V(function(e,i,n){var c=ee;if(n.length){var h=Lt(n,Or(Wn));c|=se}return Rt(e,c,i,n,h)}),su=V(function(e,i,n){var c=ee|W;if(n.length){var h=Lt(n,Or(su));c|=se}return Rt(i,c,e,n,h)});function nu(e,i,n){i=n?r:i;var c=Rt(e,Q,r,r,r,r,r,i);return c.placeholder=nu.placeholder,c}function ou(e,i,n){i=n?r:i;var c=Rt(e,Y,r,r,r,r,r,i);return c.placeholder=ou.placeholder,c}function au(e,i,n){var c,h,f,y,m,_,O=0,R=!1,$=!1,C=!0;if(typeof e!="function")throw new Ze(l);i=it(i)||0,ce(n)&&(R=!!n.leading,$="maxWait"in n,f=$?me(it(n.maxWait)||0,i):f,C="trailing"in n?!!n.trailing:C);function D(fe){var lt=c,At=h;return c=h=r,O=fe,y=e.apply(At,lt),y}function M(fe){return O=fe,m=si(F,i),R?D(fe):y}function H(fe){var lt=fe-_,At=fe-O,Ou=i-lt;return $?Pe(Ou,f-At):Ou}function U(fe){var lt=fe-_,At=fe-O;return _===r||lt>=i||lt<0||$&&At>=f}function F(){var fe=us();if(U(fe))return G(fe);m=si(F,H(fe))}function G(fe){return m=r,C&&c?D(fe):(c=h=r,y)}function Be(){m!==r&&mc(m),O=0,c=_=h=m=r}function xe(){return m===r?y:G(us())}function We(){var fe=us(),lt=U(fe);if(c=arguments,h=this,_=fe,lt){if(m===r)return M(_);if($)return mc(m),m=si(F,i),D(_)}return m===r&&(m=si(F,i)),y}return We.cancel=Be,We.flush=xe,We}var My=V(function(e,i){return Ja(e,1,i)}),Uy=V(function(e,i,n){return Ja(e,it(i)||0,n)});function zy(e){return Rt(e,Mt)}function hs(e,i){if(typeof e!="function"||i!=null&&typeof i!="function")throw new Ze(l);var n=function(){var c=arguments,h=i?i.apply(this,c):c[0],f=n.cache;if(f.has(h))return f.get(h);var y=e.apply(this,c);return n.cache=f.set(h,y)||f,y};return n.cache=new(hs.Cache||St),n}hs.Cache=St;function ls(e){if(typeof e!="function")throw new Ze(l);return function(){var i=arguments;switch(i.length){case 0:return!e.call(this);case 1:return!e.call(this,i[0]);case 2:return!e.call(this,i[0],i[1]);case 3:return!e.call(this,i[0],i[1],i[2])}return!e.apply(this,i)}}function Ly(e){return iu(2,e)}var ky=Rd(function(e,i){i=i.length==1&&L(i[0])?oe(i[0],He(j())):oe(Ie(i,1),He(j()));var n=i.length;return V(function(c){for(var h=-1,f=Pe(c.length,n);++h<f;)c[h]=i[h].call(this,c[h]);return Ke(e,this,c)})}),Gn=V(function(e,i){var n=Lt(i,Or(Gn));return Rt(e,se,r,i,n)}),cu=V(function(e,i){var n=Lt(i,Or(cu));return Rt(e,Te,r,i,n)}),Ky=$t(function(e,i){return Rt(e,Re,r,r,r,i)});function Hy(e,i){if(typeof e!="function")throw new Ze(l);return i=i===r?i:k(i),V(e,i)}function Vy(e,i){if(typeof e!="function")throw new Ze(l);return i=i==null?0:me(k(i),0),V(function(n){var c=n[i],h=Ft(n,0,i);return c&&zt(h,c),Ke(e,this,h)})}function Fy(e,i,n){var c=!0,h=!0;if(typeof e!="function")throw new Ze(l);return ce(n)&&(c="leading"in n?!!n.leading:c,h="trailing"in n?!!n.trailing:h),au(e,i,{leading:c,maxWait:i,trailing:h})}function By(e){return ru(e,1)}function Wy(e,i){return Gn(An(i),e)}function Gy(){if(!arguments.length)return[];var e=arguments[0];return L(e)?e:[e]}function Qy(e){return et(e,A)}function Jy(e,i){return i=typeof i=="function"?i:r,et(e,A,i)}function Yy(e){return et(e,I|A)}function Zy(e,i){return i=typeof i=="function"?i:r,et(e,I|A,i)}function Xy(e,i){return i==null||Qa(e,i,ve(i))}function ht(e,i){return e===i||e!==e&&i!==i}var em=is(_n),tm=is(function(e,i){return e>=i}),or=tc(function(){return arguments}())?tc:function(e){return ue(e)&&te.call(e,"callee")&&!ka.call(e,"callee")},L=E.isArray,rm=Ia?He(Ia):hd;function qe(e){return e!=null&&ps(e.length)&&!xt(e)}function pe(e){return ue(e)&&qe(e)}function im(e){return e===!0||e===!1||ue(e)&&$e(e)==Ur}var Bt=mf||no,sm=Ea?He(Ea):ld;function nm(e){return ue(e)&&e.nodeType===1&&!ni(e)}function om(e){if(e==null)return!0;if(qe(e)&&(L(e)||typeof e=="string"||typeof e.splice=="function"||Bt(e)||Rr(e)||or(e)))return!e.length;var i=Se(e);if(i==ot||i==at)return!e.size;if(ii(e))return!En(e).length;for(var n in e)if(te.call(e,n))return!1;return!0}function am(e,i){return ei(e,i)}function cm(e,i,n){n=typeof n=="function"?n:r;var c=n?n(e,i):r;return c===r?ei(e,i,r,n):!!c}function Qn(e){if(!ue(e))return!1;var i=$e(e);return i==Pi||i==xl||typeof e.message=="string"&&typeof e.name=="string"&&!ni(e)}function um(e){return typeof e=="number"&&Ha(e)}function xt(e){if(!ce(e))return!1;var i=$e(e);return i==Si||i==Jo||i==Nl||i==Al}function uu(e){return typeof e=="number"&&e==k(e)}function ps(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=pr}function ce(e){var i=typeof e;return e!=null&&(i=="object"||i=="function")}function ue(e){return e!=null&&typeof e=="object"}var hu=Pa?He(Pa):fd;function hm(e,i){return e===i||In(e,i,zn(i))}function lm(e,i,n){return n=typeof n=="function"?n:r,In(e,i,zn(i),n)}function pm(e){return lu(e)&&e!=+e}function fm(e){if(Jd(e))throw new z(u);return rc(e)}function dm(e){return e===null}function gm(e){return e==null}function lu(e){return typeof e=="number"||ue(e)&&$e(e)==Lr}function ni(e){if(!ue(e)||$e(e)!=Et)return!1;var i=zi(e);if(i===null)return!0;var n=te.call(i,"constructor")&&i.constructor;return typeof n=="function"&&n instanceof n&&qi.call(n)==lf}var Jn=Sa?He(Sa):dd;function ym(e){return uu(e)&&e>=-9007199254740991&&e<=pr}var pu=Oa?He(Oa):gd;function fs(e){return typeof e=="string"||!L(e)&&ue(e)&&$e(e)==Kr}function Fe(e){return typeof e=="symbol"||ue(e)&&$e(e)==Oi}var Rr=Ra?He(Ra):yd;function mm(e){return e===r}function vm(e){return ue(e)&&Se(e)==Hr}function wm(e){return ue(e)&&$e(e)==Dl}var _m=is(Pn),bm=is(function(e,i){return e<=i});function fu(e){if(!e)return[];if(qe(e))return fs(e)?ct(e):De(e);if(Br&&e[Br])return Zp(e[Br]());var i=Se(e),n=i==ot?ln:i==at?Ai:$r;return n(e)}function Ct(e){if(!e)return e===0?e:0;if(e=it(e),e===bi||e===-1/0){var i=e<0?-1:1;return i*Sl}return e===e?e:0}function k(e){var i=Ct(e),n=i%1;return i===i?n?i-n:i:0}function du(e){return e?rr(k(e),0,yt):0}function it(e){if(typeof e=="number")return e;if(Fe(e))return Ii;if(ce(e)){var i=typeof e.valueOf=="function"?e.valueOf():e;e=ce(i)?i+"":i}if(typeof e!="string")return e===0?e:+e;e=Ta(e);var n=tp.test(e);return n||ip.test(e)?qp(e.slice(2),n?2:8):ep.test(e)?Ii:+e}function gu(e){return vt(e,je(e))}function Im(e){return e?rr(k(e),-9007199254740991,pr):e===0?e:0}function X(e){return e==null?"":Ve(e)}var Em=Pr(function(e,i){if(ii(i)||qe(i)){vt(i,ve(i),e);return}for(var n in i)te.call(i,n)&&Yr(e,n,i[n])}),yu=Pr(function(e,i){vt(i,je(i),e)}),ds=Pr(function(e,i,n,c){vt(i,je(i),e,c)}),Pm=Pr(function(e,i,n,c){vt(i,ve(i),e,c)}),Sm=$t(mn);function Om(e,i){var n=Er(e);return i==null?n:Ga(n,i)}var Rm=V(function(e,i){e=re(e);var n=-1,c=i.length,h=c>2?i[2]:r;for(h&&Ne(i[0],i[1],h)&&(c=1);++n<c;)for(var f=i[n],y=je(f),m=-1,_=y.length;++m<_;){var O=y[m],R=e[O];(R===r||ht(R,_r[O])&&!te.call(e,O))&&(e[O]=f[O])}return e}),$m=V(function(e){return e.push(r,Tc),Ke(mu,r,e)});function Nm(e,i){return Na(e,j(i,3),mt)}function xm(e,i){return Na(e,j(i,3),wn)}function Cm(e,i){return e==null?e:vn(e,j(i,3),je)}function Am(e,i){return e==null?e:Xa(e,j(i,3),je)}function Tm(e,i){return e&&mt(e,j(i,3))}function Dm(e,i){return e&&wn(e,j(i,3))}function qm(e){return e==null?[]:Qi(e,ve(e))}function jm(e){return e==null?[]:Qi(e,je(e))}function Yn(e,i,n){var c=e==null?r:ir(e,i);return c===r?n:c}function Mm(e,i){return e!=null&&jc(e,i,od)}function Zn(e,i){return e!=null&&jc(e,i,ad)}var Um=$c(function(e,i,n){i!=null&&typeof i.toString!="function"&&(i=ji.call(i)),e[i]=n},eo(Me)),zm=$c(function(e,i,n){i!=null&&typeof i.toString!="function"&&(i=ji.call(i)),te.call(e,i)?e[i].push(n):e[i]=[n]},j),Lm=V(Xr);function ve(e){return qe(e)?Ba(e):En(e)}function je(e){return qe(e)?Ba(e,!0):md(e)}function km(e,i){var n={};return i=j(i,3),mt(e,function(c,h,f){Ot(n,i(c,h,f),c)}),n}function Km(e,i){var n={};return i=j(i,3),mt(e,function(c,h,f){Ot(n,h,i(c,h,f))}),n}var Hm=Pr(function(e,i,n){Ji(e,i,n)}),mu=Pr(function(e,i,n,c){Ji(e,i,n,c)}),Vm=$t(function(e,i){var n={};if(e==null)return n;var c=!1;i=oe(i,function(f){return f=Vt(f,e),c||(c=f.length>1),f}),vt(e,Mn(e),n),c&&(n=et(n,I|P|A,Ud));for(var h=i.length;h--;)Nn(n,i[h]);return n});function Fm(e,i){return vu(e,ls(j(i)))}var Bm=$t(function(e,i){return e==null?{}:wd(e,i)});function vu(e,i){if(e==null)return{};var n=oe(Mn(e),function(c){return[c]});return i=j(i),uc(e,n,function(c,h){return i(c,h[0])})}function Wm(e,i,n){i=Vt(i,e);var c=-1,h=i.length;for(h||(h=1,e=r);++c<h;){var f=e==null?r:e[wt(i[c])];f===r&&(c=h,f=n),e=xt(f)?f.call(e):f}return e}function Gm(e,i,n){return e==null?e:ti(e,i,n)}function Qm(e,i,n,c){return c=typeof c=="function"?c:r,e==null?e:ti(e,i,n,c)}var wu=Cc(ve),_u=Cc(je);function Jm(e,i,n){var c=L(e),h=c||Bt(e)||Rr(e);if(i=j(i,4),n==null){var f=e&&e.constructor;h?n=c?new f:[]:ce(e)?n=xt(f)?Er(zi(e)):{}:n={}}return(h?Ye:mt)(e,function(y,m,_){return i(n,y,m,_)}),n}function Ym(e,i){return e==null?!0:Nn(e,i)}function Zm(e,i,n){return e==null?e:dc(e,i,An(n))}function Xm(e,i,n,c){return c=typeof c=="function"?c:r,e==null?e:dc(e,i,An(n),c)}function $r(e){return e==null?[]:hn(e,ve(e))}function ev(e){return e==null?[]:hn(e,je(e))}function tv(e,i,n){return n===r&&(n=i,i=r),n!==r&&(n=it(n),n=n===n?n:0),i!==r&&(i=it(i),i=i===i?i:0),rr(it(e),i,n)}function rv(e,i,n){return i=Ct(i),n===r?(n=i,i=0):n=Ct(n),e=it(e),cd(e,i,n)}function iv(e,i,n){if(n&&typeof n!="boolean"&&Ne(e,i,n)&&(i=n=r),n===r&&(typeof i=="boolean"?(n=i,i=r):typeof e=="boolean"&&(n=e,e=r)),e===r&&i===r?(e=0,i=1):(e=Ct(e),i===r?(i=e,e=0):i=Ct(i)),e>i){var c=e;e=i,i=c}if(n||e%1||i%1){var h=Va();return Pe(e+h*(i-e+Dp("1e-"+((h+"").length-1))),i)}return On(e,i)}var sv=Sr(function(e,i,n){return i=i.toLowerCase(),e+(n?bu(i):i)});function bu(e){return Xn(X(e).toLowerCase())}function Iu(e){return e=X(e),e&&e.replace(np,Wp).replace(Pp,"")}function nv(e,i,n){e=X(e),i=Ve(i);var c=e.length;n=n===r?c:rr(k(n),0,c);var h=n;return n-=i.length,n>=0&&e.slice(n,h)==i}function ov(e){return e=X(e),e&&zl.test(e)?e.replace(Xo,Gp):e}function av(e){return e=X(e),e&&Fl.test(e)?e.replace(Ws,"\\$&"):e}var cv=Sr(function(e,i,n){return e+(n?"-":"")+i.toLowerCase()}),uv=Sr(function(e,i,n){return e+(n?" ":"")+i.toLowerCase()}),hv=Sc("toLowerCase");function lv(e,i,n){e=X(e),i=k(i);var c=i?vr(e):0;if(!i||c>=i)return e;var h=(i-c)/2;return rs(Hi(h),n)+e+rs(Ki(h),n)}function pv(e,i,n){e=X(e),i=k(i);var c=i?vr(e):0;return i&&c<i?e+rs(i-c,n):e}function fv(e,i,n){e=X(e),i=k(i);var c=i?vr(e):0;return i&&c<i?rs(i-c,n)+e:e}function dv(e,i,n){return n||i==null?i=0:i&&(i=+i),bf(X(e).replace(Gs,""),i||0)}function gv(e,i,n){return(n?Ne(e,i,n):i===r)?i=1:i=k(i),Rn(X(e),i)}function yv(){var e=arguments,i=X(e[0]);return e.length<3?i:i.replace(e[1],e[2])}var mv=Sr(function(e,i,n){return e+(n?"_":"")+i.toLowerCase()});function vv(e,i,n){return n&&typeof n!="number"&&Ne(e,i,n)&&(i=n=r),n=n===r?yt:n>>>0,n?(e=X(e),e&&(typeof i=="string"||i!=null&&!Jn(i))&&(i=Ve(i),!i&&mr(e))?Ft(ct(e),0,n):e.split(i,n)):[]}var wv=Sr(function(e,i,n){return e+(n?" ":"")+Xn(i)});function _v(e,i,n){return e=X(e),n=n==null?0:rr(k(n),0,e.length),i=Ve(i),e.slice(n,n+i.length)==i}function bv(e,i,n){var c=p.templateSettings;n&&Ne(e,i,n)&&(i=r),e=X(e),i=ds({},i,c,Ac);var h=ds({},i.imports,c.imports,Ac),f=ve(h),y=hn(h,f),m,_,O=0,R=i.interpolate||Ri,$="__p += '",C=pn((i.escape||Ri).source+"|"+R.source+"|"+(R===ea?Xl:Ri).source+"|"+(i.evaluate||Ri).source+"|$","g"),D="//# sourceURL="+(te.call(i,"sourceURL")?(i.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Np+"]")+`
|
|
31
|
-
`;e.replace(C,function(U,F,G,Be,xe,We){return G||(G=Be),$+=e.slice(O,We).replace(op,Qp),F&&(m=!0,$+=`' +
|
|
32
|
-
__e(`+F+`) +
|
|
33
|
-
'`),xe&&(_=!0,$+=`';
|
|
34
|
-
`+xe+`;
|
|
35
|
-
__p += '`),G&&($+=`' +
|
|
36
|
-
((__t = (`+G+`)) == null ? '' : __t) +
|
|
37
|
-
'`),O=We+U.length,U}),$+=`';
|
|
38
|
-
`;var M=te.call(i,"variable")&&i.variable;if(!M)$=`with (obj) {
|
|
39
|
-
`+$+`
|
|
40
|
-
}
|
|
41
|
-
`;else if(Yl.test(M))throw new z(g);$=(_?$.replace(ql,""):$).replace(jl,"$1").replace(Ml,"$1;"),$="function("+(M||"obj")+`) {
|
|
42
|
-
`+(M?"":`obj || (obj = {});
|
|
43
|
-
`)+"var __t, __p = ''"+(m?", __e = _.escape":"")+(_?`, __j = Array.prototype.join;
|
|
44
|
-
function print() { __p += __j.call(arguments, '') }
|
|
45
|
-
`:`;
|
|
46
|
-
`)+$+`return __p
|
|
47
|
-
}`;var H=Pu(function(){return Z(f,D+"return "+$).apply(r,y)});if(H.source=$,Qn(H))throw H;return H}function Iv(e){return X(e).toLowerCase()}function Ev(e){return X(e).toUpperCase()}function Pv(e,i,n){if(e=X(e),e&&(n||i===r))return Ta(e);if(!e||!(i=Ve(i)))return e;var c=ct(e),h=ct(i),f=Da(c,h),y=qa(c,h)+1;return Ft(c,f,y).join("")}function Sv(e,i,n){if(e=X(e),e&&(n||i===r))return e.slice(0,Ma(e)+1);if(!e||!(i=Ve(i)))return e;var c=ct(e),h=qa(c,ct(i))+1;return Ft(c,0,h).join("")}function Ov(e,i,n){if(e=X(e),e&&(n||i===r))return e.replace(Gs,"");if(!e||!(i=Ve(i)))return e;var c=ct(e),h=Da(c,ct(i));return Ft(c,h).join("")}function Rv(e,i){var n=wl,c=_l;if(ce(i)){var h="separator"in i?i.separator:h;n="length"in i?k(i.length):n,c="omission"in i?Ve(i.omission):c}e=X(e);var f=e.length;if(mr(e)){var y=ct(e);f=y.length}if(n>=f)return e;var m=n-vr(c);if(m<1)return c;var _=y?Ft(y,0,m).join(""):e.slice(0,m);if(h===r)return _+c;if(y&&(m+=_.length-m),Jn(h)){if(e.slice(m).search(h)){var O,R=_;for(h.global||(h=pn(h.source,X(ta.exec(h))+"g")),h.lastIndex=0;O=h.exec(R);)var $=O.index;_=_.slice(0,$===r?m:$)}}else if(e.indexOf(Ve(h),m)!=m){var C=_.lastIndexOf(h);C>-1&&(_=_.slice(0,C))}return _+c}function $v(e){return e=X(e),e&&Ul.test(e)?e.replace(Zo,rf):e}var Nv=Sr(function(e,i,n){return e+(n?" ":"")+i.toUpperCase()}),Xn=Sc("toUpperCase");function Eu(e,i,n){return e=X(e),i=n?r:i,i===r?Yp(e)?of(e):Kp(e):e.match(i)||[]}var Pu=V(function(e,i){try{return Ke(e,r,i)}catch(n){return Qn(n)?n:new z(n)}}),xv=$t(function(e,i){return Ye(i,function(n){n=wt(n),Ot(e,n,Wn(e[n],e))}),e});function Cv(e){var i=e==null?0:e.length,n=j();return e=i?oe(e,function(c){if(typeof c[1]!="function")throw new Ze(l);return[n(c[0]),c[1]]}):[],V(function(c){for(var h=-1;++h<i;){var f=e[h];if(Ke(f[0],this,c))return Ke(f[1],this,c)}})}function Av(e){return id(et(e,I))}function eo(e){return function(){return e}}function Tv(e,i){return e==null||e!==e?i:e}var Dv=Rc(),qv=Rc(!0);function Me(e){return e}function to(e){return ic(typeof e=="function"?e:et(e,I))}function jv(e){return nc(et(e,I))}function Mv(e,i){return oc(e,et(i,I))}var Uv=V(function(e,i){return function(n){return Xr(n,e,i)}}),zv=V(function(e,i){return function(n){return Xr(e,n,i)}});function ro(e,i,n){var c=ve(i),h=Qi(i,c);n==null&&!(ce(i)&&(h.length||!c.length))&&(n=i,i=e,e=this,h=Qi(i,ve(i)));var f=!(ce(n)&&"chain"in n)||!!n.chain,y=xt(e);return Ye(h,function(m){var _=i[m];e[m]=_,y&&(e.prototype[m]=function(){var O=this.__chain__;if(f||O){var R=e(this.__wrapped__),$=R.__actions__=De(this.__actions__);return $.push({func:_,args:arguments,thisArg:e}),R.__chain__=O,R}return _.apply(e,zt([this.value()],arguments))})}),e}function Lv(){return be._===this&&(be._=pf),this}function io(){}function kv(e){return e=k(e),V(function(i){return ac(i,e)})}var Kv=Dn(oe),Hv=Dn($a),Vv=Dn(nn);function Su(e){return kn(e)?on(wt(e)):_d(e)}function Fv(e){return function(i){return e==null?r:ir(e,i)}}var Bv=Nc(),Wv=Nc(!0);function so(){return[]}function no(){return!1}function Gv(){return{}}function Qv(){return""}function Jv(){return!0}function Yv(e,i){if(e=k(e),e<1||e>pr)return[];var n=yt,c=Pe(e,yt);i=j(i),e-=yt;for(var h=un(c,i);++n<e;)i(n);return h}function Zv(e){return L(e)?oe(e,wt):Fe(e)?[e]:De(Fc(X(e)))}function Xv(e){var i=++hf;return X(e)+i}var ew=ts(function(e,i){return e+i},0),tw=qn("ceil"),rw=ts(function(e,i){return e/i},1),iw=qn("floor");function sw(e){return e&&e.length?Gi(e,Me,_n):r}function nw(e,i){return e&&e.length?Gi(e,j(i,2),_n):r}function ow(e){return Ca(e,Me)}function aw(e,i){return Ca(e,j(i,2))}function cw(e){return e&&e.length?Gi(e,Me,Pn):r}function uw(e,i){return e&&e.length?Gi(e,j(i,2),Pn):r}var hw=ts(function(e,i){return e*i},1),lw=qn("round"),pw=ts(function(e,i){return e-i},0);function fw(e){return e&&e.length?cn(e,Me):0}function dw(e,i){return e&&e.length?cn(e,j(i,2)):0}return p.after=jy,p.ary=ru,p.assign=Em,p.assignIn=yu,p.assignInWith=ds,p.assignWith=Pm,p.at=Sm,p.before=iu,p.bind=Wn,p.bindAll=xv,p.bindKey=su,p.castArray=Gy,p.chain=Xc,p.chunk=ig,p.compact=sg,p.concat=ng,p.cond=Cv,p.conforms=Av,p.constant=eo,p.countBy=fy,p.create=Om,p.curry=nu,p.curryRight=ou,p.debounce=au,p.defaults=Rm,p.defaultsDeep=$m,p.defer=My,p.delay=Uy,p.difference=og,p.differenceBy=ag,p.differenceWith=cg,p.drop=ug,p.dropRight=hg,p.dropRightWhile=lg,p.dropWhile=pg,p.fill=fg,p.filter=gy,p.flatMap=vy,p.flatMapDeep=wy,p.flatMapDepth=_y,p.flatten=Qc,p.flattenDeep=dg,p.flattenDepth=gg,p.flip=zy,p.flow=Dv,p.flowRight=qv,p.fromPairs=yg,p.functions=qm,p.functionsIn=jm,p.groupBy=by,p.initial=vg,p.intersection=wg,p.intersectionBy=_g,p.intersectionWith=bg,p.invert=Um,p.invertBy=zm,p.invokeMap=Ey,p.iteratee=to,p.keyBy=Py,p.keys=ve,p.keysIn=je,p.map=cs,p.mapKeys=km,p.mapValues=Km,p.matches=jv,p.matchesProperty=Mv,p.memoize=hs,p.merge=Hm,p.mergeWith=mu,p.method=Uv,p.methodOf=zv,p.mixin=ro,p.negate=ls,p.nthArg=kv,p.omit=Vm,p.omitBy=Fm,p.once=Ly,p.orderBy=Sy,p.over=Kv,p.overArgs=ky,p.overEvery=Hv,p.overSome=Vv,p.partial=Gn,p.partialRight=cu,p.partition=Oy,p.pick=Bm,p.pickBy=vu,p.property=Su,p.propertyOf=Fv,p.pull=Sg,p.pullAll=Yc,p.pullAllBy=Og,p.pullAllWith=Rg,p.pullAt=$g,p.range=Bv,p.rangeRight=Wv,p.rearg=Ky,p.reject=Ny,p.remove=Ng,p.rest=Hy,p.reverse=Fn,p.sampleSize=Cy,p.set=Gm,p.setWith=Qm,p.shuffle=Ay,p.slice=xg,p.sortBy=qy,p.sortedUniq=Mg,p.sortedUniqBy=Ug,p.split=vv,p.spread=Vy,p.tail=zg,p.take=Lg,p.takeRight=kg,p.takeRightWhile=Kg,p.takeWhile=Hg,p.tap=sy,p.throttle=Fy,p.thru=as,p.toArray=fu,p.toPairs=wu,p.toPairsIn=_u,p.toPath=Zv,p.toPlainObject=gu,p.transform=Jm,p.unary=By,p.union=Vg,p.unionBy=Fg,p.unionWith=Bg,p.uniq=Wg,p.uniqBy=Gg,p.uniqWith=Qg,p.unset=Ym,p.unzip=Bn,p.unzipWith=Zc,p.update=Zm,p.updateWith=Xm,p.values=$r,p.valuesIn=ev,p.without=Jg,p.words=Eu,p.wrap=Wy,p.xor=Yg,p.xorBy=Zg,p.xorWith=Xg,p.zip=ey,p.zipObject=ty,p.zipObjectDeep=ry,p.zipWith=iy,p.entries=wu,p.entriesIn=_u,p.extend=yu,p.extendWith=ds,ro(p,p),p.add=ew,p.attempt=Pu,p.camelCase=sv,p.capitalize=bu,p.ceil=tw,p.clamp=tv,p.clone=Qy,p.cloneDeep=Yy,p.cloneDeepWith=Zy,p.cloneWith=Jy,p.conformsTo=Xy,p.deburr=Iu,p.defaultTo=Tv,p.divide=rw,p.endsWith=nv,p.eq=ht,p.escape=ov,p.escapeRegExp=av,p.every=dy,p.find=yy,p.findIndex=Wc,p.findKey=Nm,p.findLast=my,p.findLastIndex=Gc,p.findLastKey=xm,p.floor=iw,p.forEach=eu,p.forEachRight=tu,p.forIn=Cm,p.forInRight=Am,p.forOwn=Tm,p.forOwnRight=Dm,p.get=Yn,p.gt=em,p.gte=tm,p.has=Mm,p.hasIn=Zn,p.head=Jc,p.identity=Me,p.includes=Iy,p.indexOf=mg,p.inRange=rv,p.invoke=Lm,p.isArguments=or,p.isArray=L,p.isArrayBuffer=rm,p.isArrayLike=qe,p.isArrayLikeObject=pe,p.isBoolean=im,p.isBuffer=Bt,p.isDate=sm,p.isElement=nm,p.isEmpty=om,p.isEqual=am,p.isEqualWith=cm,p.isError=Qn,p.isFinite=um,p.isFunction=xt,p.isInteger=uu,p.isLength=ps,p.isMap=hu,p.isMatch=hm,p.isMatchWith=lm,p.isNaN=pm,p.isNative=fm,p.isNil=gm,p.isNull=dm,p.isNumber=lu,p.isObject=ce,p.isObjectLike=ue,p.isPlainObject=ni,p.isRegExp=Jn,p.isSafeInteger=ym,p.isSet=pu,p.isString=fs,p.isSymbol=Fe,p.isTypedArray=Rr,p.isUndefined=mm,p.isWeakMap=vm,p.isWeakSet=wm,p.join=Ig,p.kebabCase=cv,p.last=rt,p.lastIndexOf=Eg,p.lowerCase=uv,p.lowerFirst=hv,p.lt=_m,p.lte=bm,p.max=sw,p.maxBy=nw,p.mean=ow,p.meanBy=aw,p.min=cw,p.minBy=uw,p.stubArray=so,p.stubFalse=no,p.stubObject=Gv,p.stubString=Qv,p.stubTrue=Jv,p.multiply=hw,p.nth=Pg,p.noConflict=Lv,p.noop=io,p.now=us,p.pad=lv,p.padEnd=pv,p.padStart=fv,p.parseInt=dv,p.random=iv,p.reduce=Ry,p.reduceRight=$y,p.repeat=gv,p.replace=yv,p.result=Wm,p.round=lw,p.runInContext=v,p.sample=xy,p.size=Ty,p.snakeCase=mv,p.some=Dy,p.sortedIndex=Cg,p.sortedIndexBy=Ag,p.sortedIndexOf=Tg,p.sortedLastIndex=Dg,p.sortedLastIndexBy=qg,p.sortedLastIndexOf=jg,p.startCase=wv,p.startsWith=_v,p.subtract=pw,p.sum=fw,p.sumBy=dw,p.template=bv,p.times=Yv,p.toFinite=Ct,p.toInteger=k,p.toLength=du,p.toLower=Iv,p.toNumber=it,p.toSafeInteger=Im,p.toString=X,p.toUpper=Ev,p.trim=Pv,p.trimEnd=Sv,p.trimStart=Ov,p.truncate=Rv,p.unescape=$v,p.uniqueId=Xv,p.upperCase=Nv,p.upperFirst=Xn,p.each=eu,p.eachRight=tu,p.first=Jc,ro(p,function(){var e={};return mt(p,function(i,n){te.call(p.prototype,n)||(e[n]=i)}),e}(),{chain:!1}),p.VERSION=s,Ye(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){p[e].placeholder=p}),Ye(["drop","take"],function(e,i){B.prototype[e]=function(n){n=n===r?1:me(k(n),0);var c=this.__filtered__&&!i?new B(this):this.clone();return c.__filtered__?c.__takeCount__=Pe(n,c.__takeCount__):c.__views__.push({size:Pe(n,yt),type:e+(c.__dir__<0?"Right":"")}),c},B.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Ye(["filter","map","takeWhile"],function(e,i){var n=i+1,c=n==Qo||n==Pl;B.prototype[e]=function(h){var f=this.clone();return f.__iteratees__.push({iteratee:j(h,3),type:n}),f.__filtered__=f.__filtered__||c,f}}),Ye(["head","last"],function(e,i){var n="take"+(i?"Right":"");B.prototype[e]=function(){return this[n](1).value()[0]}}),Ye(["initial","tail"],function(e,i){var n="drop"+(i?"":"Right");B.prototype[e]=function(){return this.__filtered__?new B(this):this[n](1)}}),B.prototype.compact=function(){return this.filter(Me)},B.prototype.find=function(e){return this.filter(e).head()},B.prototype.findLast=function(e){return this.reverse().find(e)},B.prototype.invokeMap=V(function(e,i){return typeof e=="function"?new B(this):this.map(function(n){return Xr(n,e,i)})}),B.prototype.reject=function(e){return this.filter(ls(j(e)))},B.prototype.slice=function(e,i){e=k(e);var n=this;return n.__filtered__&&(e>0||i<0)?new B(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),i!==r&&(i=k(i),n=i<0?n.dropRight(-i):n.take(i-e)),n)},B.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},B.prototype.toArray=function(){return this.take(yt)},mt(B.prototype,function(e,i){var n=/^(?:filter|find|map|reject)|While$/.test(i),c=/^(?:head|last)$/.test(i),h=p[c?"take"+(i=="last"?"Right":""):i],f=c||/^find/.test(i);h&&(p.prototype[i]=function(){var y=this.__wrapped__,m=c?[1]:arguments,_=y instanceof B,O=m[0],R=_||L(y),$=function(F){var G=h.apply(p,zt([F],m));return c&&C?G[0]:G};R&&n&&typeof O=="function"&&O.length!=1&&(_=R=!1);var C=this.__chain__,D=!!this.__actions__.length,M=f&&!C,H=_&&!D;if(!f&&R){y=H?y:new B(this);var U=e.apply(y,m);return U.__actions__.push({func:as,args:[$],thisArg:r}),new Xe(U,C)}return M&&H?e.apply(this,m):(U=this.thru($),M?c?U.value()[0]:U.value():U)})}),Ye(["pop","push","shift","sort","splice","unshift"],function(e){var i=Ti[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",c=/^(?:pop|shift)$/.test(e);p.prototype[e]=function(){var h=arguments;if(c&&!this.__chain__){var f=this.value();return i.apply(L(f)?f:[],h)}return this[n](function(y){return i.apply(L(y)?y:[],h)})}}),mt(B.prototype,function(e,i){var n=p[i];if(n){var c=n.name+"";te.call(Ir,c)||(Ir[c]=[]),Ir[c].push({name:i,func:n})}}),Ir[es(r,W).name]=[{name:"wrapper",func:r}],B.prototype.clone=$f,B.prototype.reverse=Nf,B.prototype.value=xf,p.prototype.at=ny,p.prototype.chain=oy,p.prototype.commit=ay,p.prototype.next=cy,p.prototype.plant=hy,p.prototype.reverse=ly,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=py,p.prototype.first=p.prototype.head,Br&&(p.prototype[Br]=uy),p},wr=af();Zt?((Zt.exports=wr)._=wr,en._=wr):be._=wr}).call(pi)})(Ao,Ao.exports);var c1=Object.defineProperty,u1=Object.defineProperties,h1=Object.getOwnPropertyDescriptors,Ph=Object.getOwnPropertySymbols,l1=Object.prototype.hasOwnProperty,p1=Object.prototype.propertyIsEnumerable,Sh=(o,t,r)=>t in o?c1(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,ws=(o,t)=>{for(var r in t||(t={}))l1.call(t,r)&&Sh(o,r,t[r]);if(Ph)for(var r of Ph(t))p1.call(t,r)&&Sh(o,r,t[r]);return o},f1=(o,t)=>u1(o,h1(t));function Jt(o,t,r){var s;const a=Mw(o);return((s=t.rpcMap)==null?void 0:s[a.reference])||`${a1}?chainId=${a.namespace}:${a.reference}&projectId=${r}`}function lr(o){return o.includes(":")?o.split(":")[1]:o}function ml(o){return o.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function d1(o,t){const r=Object.keys(t.namespaces).filter(a=>a.includes(o));if(!r.length)return[];const s=[];return r.forEach(a=>{const u=t.namespaces[a].accounts;s.push(...u)}),s}function g1(o={},t={}){const r=Oh(o),s=Oh(t);return Ao.exports.merge(r,s)}function Oh(o){var t,r,s,a;const u={};if(!Tr(o))return u;for(const[l,g]of Object.entries(o)){const w=Ho(l)?[l]:g.chains,d=g.methods||[],b=g.events||[],I=g.rpcMap||{},P=fi(l);u[P]=f1(ws(ws({},u[P]),g),{chains:oo(w,(t=u[P])==null?void 0:t.chains),methods:oo(d,(r=u[P])==null?void 0:r.methods),events:oo(b,(s=u[P])==null?void 0:s.events),rpcMap:ws(ws({},I),(a=u[P])==null?void 0:a.rpcMap)})}return u}function y1(o){return o.includes(":")?o.split(":")[2]:o}function m1(o){const t={};for(const[r,s]of Object.entries(o)){const a=s.methods||[],u=s.events||[],l=s.accounts||[],g=Ho(r)?[r]:s.chains?s.chains:ml(s.accounts);t[r]={chains:g,methods:a,events:u,accounts:l}}return t}function mo(o){return typeof o=="number"?o:o.includes("0x")?parseInt(o,16):o.includes(":")?Number(o.split(":")[1]):Number(o)}const vl={},ae=o=>vl[o],vo=(o,t)=>{vl[o]=t};class v1{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=ae("events"),this.client=ae("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(jt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=lr(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Jt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new qt(new Yt(s,ae("disableProviderPing")))}}class w1{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=ae("events"),this.client=ae("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(parseInt(t),r),this.chainId=parseInt(t),this.events.emit(jt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,r){const s=r||Jt(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new qt(new Yt(s,ae("disableProviderPing")))}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=parseInt(lr(r));t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}async handleSwitchChain(t){var r,s;let a=t.request.params?(r=t.request.params[0])==null?void 0:r.chainId:"0x0";a=a.startsWith("0x")?a:`0x${a}`;const u=parseInt(a,16);if(this.isChainApproved(u))this.setDefaultChain(`${u}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:a}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${u}`);else throw new Error(`Failed to switch to chain 'eip155:${u}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}}class _1{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=ae("events"),this.client=ae("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(jt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=lr(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Jt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new qt(new Yt(s,ae("disableProviderPing")))}}class b1{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=ae("events"),this.client=ae("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(jt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=lr(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Jt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new qt(new Yt(s,ae("disableProviderPing")))}}class I1{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=ae("events"),this.client=ae("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(jt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{const s=this.getCardanoRPCUrl(r),a=lr(r);t[a]=this.createHttpProvider(a,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}getCardanoRPCUrl(t){const r=this.namespace.rpcMap;if(r)return r[t]}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new qt(new Yt(s,ae("disableProviderPing")))}}class E1{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=ae("events"),this.client=ae("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(jt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=lr(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Jt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new qt(new Yt(s,ae("disableProviderPing")))}}class P1{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=ae("events"),this.client=ae("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(jt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=lr(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Jt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new qt(new Yt(s,ae("disableProviderPing")))}}class S1{constructor(t){this.name="near",this.namespace=t.namespace,this.events=ae("events"),this.client=ae("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){if(this.chainId=t,!this.httpProviders[t]){const s=r||Jt(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(jt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;t[r]=this.createHttpProvider(r,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Jt(t,this.namespace);return typeof s>"u"?void 0:new qt(new Yt(s,ae("disableProviderPing")))}}var O1=Object.defineProperty,R1=Object.defineProperties,$1=Object.getOwnPropertyDescriptors,Rh=Object.getOwnPropertySymbols,N1=Object.prototype.hasOwnProperty,x1=Object.prototype.propertyIsEnumerable,$h=(o,t,r)=>t in o?O1(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,_s=(o,t)=>{for(var r in t||(t={}))N1.call(t,r)&&$h(o,r,t[r]);if(Rh)for(var r of Rh(t))x1.call(t,r)&&$h(o,r,t[r]);return o},wo=(o,t)=>R1(o,$1(t));class Wo{constructor(t){this.events=new jo,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:As(Ts({level:(t==null?void 0:t.logger)||Ih})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const r=new Wo(t);return await r.initialize(),r}async request(t,r){const[s,a]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:_s({},t),chainId:`${s}:${a}`,topic:this.session.topic})}sendAsync(t,r,s){const a=new Date().getTime();this.request(t,s).then(u=>r(null,Ds(a,u))).catch(u=>r(u,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:he("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}removeListener(t,r){this.events.removeListener(t,r)}off(t,r){this.events.off(t,r)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:s,approval:a}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});s&&(this.uri=s,this.events.emit("display_uri",s)),await a().then(u=>{this.session=u,this.namespaces||(this.namespaces=m1(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==gl)throw u;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[s,a]=this.validateChain(t);this.getProvider(s).setDefaultChain(a,r)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(It(r)){for(const s of r)t.deletePairings?this.client.core.expirer.set(s.topic,0):await this.client.core.relayer.subscriber.unsubscribe(s.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await i1.init({logger:this.providerOpts.logger||Ih,relayUrl:this.providerOpts.relayUrl||s1,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(r=>fi(r)))];vo("client",this.client),vo("events",this.events),vo("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const s=d1(r,this.session),a=ml(s),u=g1(this.namespaces,this.optionalNamespaces),l=wo(_s({},u[r]),{accounts:s,chains:a});switch(r){case"eip155":this.rpcProviders[r]=new w1({namespace:l});break;case"solana":this.rpcProviders[r]=new _1({namespace:l});break;case"cosmos":this.rpcProviders[r]=new b1({namespace:l});break;case"polkadot":this.rpcProviders[r]=new v1({namespace:l});break;case"cip34":this.rpcProviders[r]=new I1({namespace:l});break;case"elrond":this.rpcProviders[r]=new E1({namespace:l});break;case"multiversx":this.rpcProviders[r]=new P1({namespace:l});break;case"near":this.rpcProviders[r]=new S1({namespace:l});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:r}=t,{event:s}=r;if(s.name==="accountsChanged"){const a=s.data;a&&It(a)&&this.events.emit("accountsChanged",a.map(y1))}else if(s.name==="chainChanged"){const a=r.chainId,u=r.event.data,l=fi(a),g=mo(a)!==mo(u)?`${l}:${mo(u)}`:a;this.onChainChanged(g)}else this.events.emit(s.name,s.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:r})=>{var s;const{namespaces:a}=r,u=(s=this.client)==null?void 0:s.session.get(t);this.session=wo(_s({},u),{namespaces:a}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:r})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",wo(_s({},he("USER_DISCONNECTED")),{data:t.topic}))}),this.on(jt.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var r;this.getProvider(t).updateNamespace((r=this.session)==null?void 0:r.namespaces[t])})}setNamespaces(t){const{namespaces:r,optionalNamespaces:s,sessionProperties:a}=t;r&&Object.keys(r).length&&(this.namespaces=r),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=a,this.persist("namespaces",r),this.persist("optionalNamespaces",s)}validateChain(t){const[r,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,s];if(r&&!Object.keys(this.namespaces||{}).map(l=>fi(l)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&s)return[r,s];const a=fi(Object.keys(this.namespaces)[0]),u=this.rpcProviders[a].getDefaultChain();return[a,u]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){var s;if(!this.namespaces)return;const[a,u]=this.validateChain(t);r||this.getProvider(a).setDefaultChain(u),((s=this.namespaces[a])!=null?s:this.namespaces[`${a}:${u}`]).defaultChain=u,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",u)}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(t,r){this.client.core.storage.setItem(`${Eh}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${Eh}/${t}`)}}const C1=Wo,A1="wc",T1="ethereum_provider",D1=`${A1}@2:${T1}:`,q1="https://rpc.walletconnect.com/v1/",To=["eth_sendTransaction","personal_sign"],j1=["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"],Do=["chainChanged","accountsChanged"],M1=["chainChanged","accountsChanged","message","disconnect","connect"];var U1=Object.defineProperty,z1=Object.defineProperties,L1=Object.getOwnPropertyDescriptors,Nh=Object.getOwnPropertySymbols,k1=Object.prototype.hasOwnProperty,K1=Object.prototype.propertyIsEnumerable,xh=(o,t,r)=>t in o?U1(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,gi=(o,t)=>{for(var r in t||(t={}))k1.call(t,r)&&xh(o,r,t[r]);if(Nh)for(var r of Nh(t))K1.call(t,r)&&xh(o,r,t[r]);return o},Ch=(o,t)=>z1(o,L1(t));function $s(o){return Number(o[0].split(":")[1])}function _o(o){return`0x${o.toString(16)}`}function H1(o){const{chains:t,optionalChains:r,methods:s,optionalMethods:a,events:u,optionalEvents:l,rpcMap:g}=o;if(!It(t))throw new Error("Invalid chains");const w={chains:t,methods:s||To,events:u||Do,rpcMap:gi({},t.length?{[$s(t)]:g[$s(t)]}:{})},d=u==null?void 0:u.filter(A=>!Do.includes(A)),b=s==null?void 0:s.filter(A=>!To.includes(A));if(!r&&!l&&!a&&!(d!=null&&d.length)&&!(b!=null&&b.length))return{required:t.length?w:void 0};const I=(d==null?void 0:d.length)&&(b==null?void 0:b.length)||!r,P={chains:[...new Set(I?w.chains.concat(r||[]):r)],methods:[...new Set(w.methods.concat(a!=null&&a.length?a:j1))],events:[...new Set(w.events.concat(l!=null&&l.length?l:M1))],rpcMap:g};return{required:t.length?w:void 0,optional:r.length?P:void 0}}class Go{constructor(){this.events=new gt.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=D1,this.on=(t,r)=>(this.events.on(t,r),this),this.once=(t,r)=>(this.events.once(t,r),this),this.removeListener=(t,r)=>(this.events.removeListener(t,r),this),this.off=(t,r)=>(this.events.off(t,r),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const r=new Go;return await r.initialize(t),r}async request(t){return await this.signer.request(t,this.formatChainId(this.chainId))}sendAsync(t,r){this.signer.sendAsync(t,r,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:r,optional:s}=H1(this.rpc);try{const a=await new Promise(async(l,g)=>{var w;this.rpc.showQrModal&&((w=this.modal)==null||w.subscribeModal(d=>{!d.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),g(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(Ch(gi({namespaces:gi({},r&&{[this.namespace]:r})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(d=>{l(d)}).catch(d=>{g(new Error(d.message))})});if(!a)return;const u=Uw(a.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:_o(this.chainId)})}catch(a){throw this.signer.logger.error(a),a}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",t=>{const{params:r}=t,{event:s}=r;s.name==="accountsChanged"?(this.accounts=this.parseAccounts(s.data),this.events.emit("accountsChanged",this.accounts)):s.name==="chainChanged"?this.setChainId(this.formatChainId(s.data)):this.events.emit(s.name,s.data),this.events.emit("session_event",t)}),this.signer.on("chainChanged",t=>{const r=parseInt(t);this.chainId=r,this.events.emit("chainChanged",_o(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",Ch(gi({},he("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var r,s;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(s=this.modal)==null||s.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const r=t.filter(s=>this.isCompatibleChainId(s)).map(s=>this.parseChainId(s));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",_o(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const r=this.parseChainId(t);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(t){const[r,s,a]=t.split(":");return{chainId:`${r}:${s}`,address:a}}setAccounts(t){this.accounts=t.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var r,s;const a=(r=t==null?void 0:t.chains)!=null?r:[],u=(s=t==null?void 0:t.optionalChains)!=null?s:[],l=a.concat(u);if(!l.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const g=a.length?(t==null?void 0:t.methods)||To:[],w=a.length?(t==null?void 0:t.events)||Do:[],d=(t==null?void 0:t.optionalMethods)||[],b=(t==null?void 0:t.optionalEvents)||[],I=(t==null?void 0:t.rpcMap)||this.buildRpcMap(l,t.projectId),P=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:a==null?void 0:a.map(A=>this.formatChainId(A)),optionalChains:u.map(A=>this.formatChainId(A)),methods:g,events:w,optionalMethods:d,optionalEvents:b,rpcMap:I,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:P,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const s={};return t.forEach(a=>{s[a]=this.getRpcUrl(a,r)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?$s(this.rpc.chains):$s(this.rpc.optionalChains),this.signer=await C1.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:s}=await yw(()=>import("./index-CKhAKgH8.js").then(a=>a.i),__vite__mapDeps([0,1,2]));r=s}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(gi({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(s){throw this.signer.logger.error(s),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:r,optionalChains:s,rpcMap:a}=t;r&&It(r)&&(this.rpc.chains=r.map(u=>this.formatChainId(u)),r.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)})),s&&It(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s==null?void 0:s.map(u=>this.formatChainId(u)),s.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)}))}getRpcUrl(t,r){var s;return((s=this.rpc.rpcMap)==null?void 0:s[t])||`${q1}?chainId=eip155:${t}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(r=>this.parseAccount(r))}}const hP=Go;export{hP as EthereumProvider,M1 as OPTIONAL_EVENTS,j1 as OPTIONAL_METHODS,Do as REQUIRED_EVENTS,To as REQUIRED_METHODS,Go as default};
|