@dcl/account-site 6.8.0 → 6.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/Address-BHGD07NO.js +1 -0
- package/assets/Authorization-DmoiysGx.js +1 -0
- package/assets/CoinbaseSDKConnection-C9-JnGls.js +1 -0
- package/assets/{ConstantsUtil-Dl5WOfjM.js → ConstantsUtil-g0AjdkOa.js} +1 -1
- package/assets/{ExchangeController-JD5-aj9j.js → ExchangeController-C-OE-irq.js} +1 -1
- package/assets/{HelpersUtil-BYRqEOLc.js → HelpersUtil-C073QcrZ.js} +1 -1
- package/assets/InAppWalletConnectUI-Bdxz0Bmy.js +1 -0
- package/assets/{NetworkUtil-CORVq-U7.js → NetworkUtil-BooKnyFI.js} +1 -1
- package/assets/{QRCodeRenderer-CAUMCMrQ.js → QRCodeRenderer-C2O8aJw5.js} +1 -1
- package/assets/Solidity-D6b-SCK0.js +1 -0
- package/assets/{SwapController-CENGi_f8.js → SwapController-DITN3ZmR.js} +1 -1
- package/assets/ThirdwebWalletManager-BUJ2S4b0.js +298 -0
- package/assets/TypedData-ByTQ7nLR.js +2 -0
- package/assets/addresses-DVWfx5EX.js +1 -0
- package/assets/arweave-CldmCeKB.js +1 -0
- package/assets/{biconomy-DURQhrK6.js → biconomy-C7JeDEA3.js} +1 -1
- package/assets/biconomy-C9hDxeVn.js +1 -0
- package/assets/{ccip-CzLewx-i.js → ccip-BtKXNXL8.js} +1 -1
- package/assets/{ccip-DGvrteB6.js → ccip-ByfH6Pp1.js} +1 -1
- package/assets/ccip-sd4F7RdI.js +1 -0
- package/assets/{chains-ClhAINLn.js → chains-ClhzAPRM.js} +1 -1
- package/assets/{common-BaZ48mbG.js → common-5Sx2Oaqw.js} +1 -1
- package/assets/common-DAlzQshe.js +1 -0
- package/assets/concat-hex-D_Hd0Y8j.js +1 -0
- package/assets/{controller-CgHGY4fa.js → controller-BKewv9ws.js} +2 -2
- package/assets/controller-CMiTdXrl.js +2 -0
- package/assets/{data-capture-C3H4h0ye.js → data-capture-SGXWH8uV.js} +1 -1
- package/assets/decimals-BkxTCZnw.js +1 -0
- package/assets/{decimals-wNlF21S5.js → decimals-DYCSb7r6.js} +1 -1
- package/assets/decimals-Den2KPun.js +1 -0
- package/assets/{detectExtension-ywrU3B9f.js → detectExtension-BqT-gQP6.js} +1 -1
- package/assets/detectExtension-DRxhZaJ-.js +1 -0
- package/assets/{email-EtC4Qw7k.js → email-D9PJu66O.js} +1 -1
- package/assets/{embedded-wallet-BLxx2nq0.js → embedded-wallet-BNJE9JJY.js} +1 -1
- package/assets/{engine-CbOuNdui.js → engine-BpIYDc2z.js} +1 -1
- package/assets/engine-CmO-qFS1.js +1 -0
- package/assets/estimate-l1-fee-DnqX0KQm.js +2 -0
- package/assets/{estimate-l1-fee-COxQ74Xh.js → estimate-l1-fee-n2GS47w0.js} +1 -1
- package/assets/eth_estimateGas-DVJqp0a0.js +1 -0
- package/assets/eth_estimateGas-ZIidgCSn.js +1 -0
- package/assets/{eth_getStorageAt-CLxjZO4t.js → eth_getStorageAt-DMscVfg3.js} +1 -1
- package/assets/eth_getTransactionCount-CMQovf3i.js +1 -0
- package/assets/{eth_getTransactionCount-BKcuSAaU.js → eth_getTransactionCount-h82D3bxu.js} +1 -1
- package/assets/{ethereum-D98w8ceQ.js → ethereum-Db4wQ8cQ.js} +1 -1
- package/assets/{extractIPFS-Bwmi3T5d.js → extractIPFS-446jiCiR.js} +1 -1
- package/assets/extractIPFS-tOg-rRc-.js +1 -0
- package/assets/{features-BqZGfYIj.js → features-Bya_uQnq.js} +1 -1
- package/assets/{fetchTokenMetadata-BrBgEOsH.js → fetchTokenMetadata-B1jhcJrg.js} +2 -2
- package/assets/fetchTokenMetadata-DXhdZ9jJ.js +2 -0
- package/assets/{fortmatic-Rdz9ucwd.js → fortmatic-DWc9CMNy.js} +1 -1
- package/assets/get-bytecode-FPC_G1PK.js +1 -0
- package/assets/get-ecosystem-wallet-info-BH812YkU.js +1 -0
- package/assets/{get-ecosystem-wallet-info-DfHMq1Kz.js → get-ecosystem-wallet-info-CsVSXoZ9.js} +1 -1
- package/assets/{getBalance-ZH0H3K3Z.js → getBalance-BJu93LMj.js} +2 -2
- package/assets/getBalance-BjubRO2E.js +1 -0
- package/assets/getCurrencyMetadata-B6uMlDub.js +2 -0
- package/assets/{getInstalledModules-DRhOlDcR.js → getInstalledModules-C_LJpz_7.js} +1 -1
- package/assets/getInstalledModules-cmepPgT8.js +1 -0
- package/assets/getNFT-BLT_Nrf_.js +2 -0
- package/assets/{getNFT-GNDwObaN.js → getNFT-Cf6D_49D.js} +1 -1
- package/assets/{getNFT-D6wHZRiB.js → getNFT-ClRsQ9zy.js} +2 -2
- package/assets/getNFT-uyJP8nm4.js +1 -0
- package/assets/{hashTypedData-41394cRH.js → hashTypedData-CLob9Zsk.js} +1 -1
- package/assets/{if-defined-DwiGupeI.js → if-defined-BfXFCfhz.js} +1 -1
- package/assets/in-app-wallet-calls-C0n9HjId.js +1 -0
- package/assets/{in-app-wallet-calls-CPU2uJ6f.js → in-app-wallet-calls-DUqkYMt1.js} +1 -1
- package/assets/index-1chDcRmP.js +2 -0
- package/assets/{index-CawWU9rF.js → index-4aItPLLW.js} +1 -1
- package/assets/{index-BEFVLZMS.js → index-9x3mVUYQ.js} +1 -1
- package/assets/{index-BR8a5etK.js → index-ACY2zvow.js} +1 -1
- package/assets/index-B1VBbtk9.js +1 -0
- package/assets/index-B4kmUY0d.js +2 -0
- package/assets/{index-Fv-acDXO.js → index-B6-Xobl2.js} +79 -78
- package/assets/{index-DIBbErfW.js → index-BGg37GBj.js} +1 -1
- package/assets/{index-C5zfi_7H.js → index-BQsaEzy7.js} +1 -1
- package/assets/{index-BOh2weBI.js → index-BRxU5H7H.js} +1 -1
- package/assets/{index-8zzhpxyI.js → index-BSP467IN.js} +1 -1
- package/assets/{index-DYQDZBEQ.js → index-BXifexJq.js} +1 -1
- package/assets/{index-phZWvHfL.js → index-Bi3OUhfd.js} +1 -1
- package/assets/{index-LZKkcZAZ.js → index-BkdqENWn.js} +1 -1
- package/assets/{index-BUjD0aLT.js → index-Bqkhbf-j.js} +1 -1
- package/assets/{index-CAfWDhIh.js → index-BrNT2tPP.js} +1 -1
- package/assets/index-BuLBr4CJ.js +3 -0
- package/assets/index-CBfD9fG_.js +3 -0
- package/assets/{index-Cm5owbs6.js → index-CCxvZC9z.js} +1 -1
- package/assets/{index-dE7qT1rS.js → index-CCzw3eWF.js} +1 -1
- package/assets/{index-BYXYehKA.js → index-CFnBXD-E.js} +2 -2
- package/assets/{index-Bi4I_eXH.js → index-CFy1Eegq.js} +1 -1
- package/assets/{index-vbDUNbAe.js → index-CGT2TfpK.js} +1 -1
- package/assets/{index-DjP1lSeJ.js → index-CLLWxWw1.js} +1 -1
- package/assets/{index-BjsRGW04.js → index-CMAF5KQo.js} +1 -1
- package/assets/{index-DDz_fX9F.js → index-CRXo5c7W.js} +1 -1
- package/assets/{index-C8LVWiNY.js → index-CXPEr8lr.js} +1 -1
- package/assets/{index-C79cRihP.js → index-C_CWRNXS.js} +1 -1
- package/assets/{index-B2fn3xIB.js → index-Ci26p999.js} +1 -1
- package/assets/{index-BkDiaE7t.js → index-Cja4UOCF.js} +1 -1
- package/assets/{index-C8qQNWbc.js → index-CpXrWP2a.js} +1 -1
- package/assets/{index-CgxIIYSr.js → index-Cv59_Dqg.js} +1 -1
- package/assets/{index-BbTsvCPk.js → index-CwOCLTiY.js} +1 -1
- package/assets/{index-C52TTugH.js → index-CxlJ-ZjW.js} +1 -1
- package/assets/{index-CJe1v77g.js → index-D-By2c9G.js} +1 -1
- package/assets/{index-CSiyIFnr.js → index-D0Jyo-s4.js} +1 -1
- package/assets/{index-mD5QWGsm.css → index-D2E7Umr3.css} +3 -3
- package/assets/{index-DLargbIn.js → index-DAGLKstf.js} +2 -2
- package/assets/{index-CSOxc5sc.js → index-DMZH80fA.js} +4 -4
- package/assets/index-DO01SzHY.js +4 -0
- package/assets/{index-DaWq4Nzj.js → index-DPWaLJzM.js} +1 -1
- package/assets/{index-DL0Eu5uz.js → index-DQt5rtxO.js} +1 -1
- package/assets/{index-jGki-zKe.js → index-DSqN93eC.js} +1 -1
- package/assets/{index-DjWVQGcv.js → index-DcZ1OZua.js} +1 -1
- package/assets/{index-BWZPtavh.js → index-DdD6BFNW.js} +1 -1
- package/assets/{index-8Zxz62OX.js → index-DftmpJ8E.js} +2 -2
- package/assets/{index-ZEPn8qKc.js → index-DuB7aae8.js} +1 -1
- package/assets/{index-rAbloVh4.js → index-TpT45Yhr.js} +4 -4
- package/assets/{index-B8gDkzKR.js → index-yvAPBrdI.js} +1 -1
- package/assets/index.es-BdGfQ9jz.js +29 -0
- package/assets/{index.es-BdRu1h__.js → index.es-CN4hhQIr.js} +1 -1
- package/assets/index.es-Cjo6uLeK.js +1 -0
- package/assets/{index.es-pnQCY6-7.js → index.es-LxVxXtUw.js} +1 -1
- package/assets/is-smart-wallet-kSShE3hl.js +1 -0
- package/assets/{native-CjSUDNml.js → native-CXizm-TO.js} +1 -1
- package/assets/{networks-B6IlNWMm.js → networks-DyswiDcL.js} +1 -1
- package/assets/oauth-CbK0gPlt.js +1 -0
- package/assets/{onramp-BTk7sVPr.js → onramp-phO3GqLV.js} +1 -1
- package/assets/{openzeppelin-BKxO6pj6.js → openzeppelin-CASw4uSB.js} +1 -1
- package/assets/openzeppelin-Dkk77Xr9.js +1 -0
- package/assets/ownerOf-Dn5Rvewb.js +1 -0
- package/assets/{ownerOf-CYvZRT99.js → ownerOf-HLFmP4SY.js} +1 -1
- package/assets/parse-typed-data-BSOEUDy_.js +1 -0
- package/assets/{parseNft-DhQFzpJp.js → parseNft-CwiONVVV.js} +2 -2
- package/assets/{parseSignature-DoNNAGxu.js → parseSignature-BsYIWxqL.js} +13 -13
- package/assets/{parseSignature-BduqmbK2.js → parseSignature-DXMGd6Bf.js} +3 -3
- package/assets/passkeys-tlSlZIRR.js +1 -0
- package/assets/{pay-with-exchange-CgOu6Uya.js → pay-with-exchange-BsYgDiHf.js} +1 -1
- package/assets/{qr-overlay-Bm0XTjkI.js → qr-overlay-B21EcFCK.js} +1 -1
- package/assets/{qr-overlay-DyMiJXUk.js → qr-overlay-CDVJkAma.js} +1 -1
- package/assets/read-contract-D8CQ_i-D.js +1 -0
- package/assets/{receive-r5RgRUWl.js → receive-CVGDvas8.js} +1 -1
- package/assets/{ref-Ki-jDMmv.js → ref-DeR4tBmt.js} +1 -1
- package/assets/resolveImplementation-2abc0dxK.js +1 -0
- package/assets/{resolveImplementation-B8tKI-wG.js → resolveImplementation-Cr9HN7sF.js} +1 -1
- package/assets/{rpc-nyXL61KJ.js → rpc-BuDu_uQE.js} +1 -1
- package/assets/{rpc-rFcFDQyb.js → rpc-DjXtIps7.js} +2 -2
- package/assets/secp256k1-BlHNYIaG.js +1 -0
- package/assets/{secp256k1-CPRDF0BA.js → secp256k1-CJ52XpcF.js} +1 -1
- package/assets/{send-DeIfSZo1.js → send-DP5QRJYD.js} +1 -1
- package/assets/send-batch-transaction-De71luzT.js +1 -0
- package/assets/{send-batch-transaction-CIuDJ271.js → send-batch-transaction-Dx0kM3Nk.js} +1 -1
- package/assets/{send-eip712-transaction-CknhU72d.js → send-eip712-transaction-Dm4F9s4t.js} +2 -2
- package/assets/send-eip712-transaction-q3anVEgs.js +2 -0
- package/assets/send-gasless-transaction-CQa_Dj1Y.js +2 -0
- package/assets/{send-gasless-transaction-yIAhbb7k.js → send-gasless-transaction-mWAyMAXy.js} +2 -2
- package/assets/send-transaction-B0F9brDJ.js +2 -0
- package/assets/{session-proposal-qDW11rpc.js → session-proposal-FRNsvDTi.js} +1 -1
- package/assets/session-proposal-ef7aaaHV.js +1 -0
- package/assets/session-request-Bz2BIU-j.js +2 -0
- package/assets/{session-request-By9y-Ayi.js → session-request-Cwmcu41B.js} +2 -2
- package/assets/sha256-BPZogG9w.js +1 -0
- package/assets/{sha256-_sKanFR7.js → sha256-DViOA4V5.js} +1 -1
- package/assets/{signing-Db0bjZpz.js → signing-D7Nlzpwh.js} +5 -5
- package/assets/signing-DhfHxzxy.js +2 -0
- package/assets/sleep-B_ShGKZF.js +1 -0
- package/assets/{socials-BcoSkWK5.js → socials-BZcwTEhb.js} +1 -1
- package/assets/{swaps-Bj8TNJkd.js → swaps-Cam24Ey2.js} +1 -1
- package/assets/switch-chain-YGyDlbyD.js +1 -0
- package/assets/thirdweb-B7gLwLri.js +27 -0
- package/assets/to-serializable-transaction-DAYFWHyO.js +23 -0
- package/assets/{totalSupply-CcNS_GzH.js → totalSupply-BZIagNGM.js} +1 -1
- package/assets/totalSupply-CWYDbbpl.js +1 -0
- package/assets/{transactionReceipt-CdsZdsdr.js → transactionReceipt-B-BG4ub0.js} +1 -1
- package/assets/{transactions-DuCMsSn_.js → transactions-CSAp5P5s.js} +1 -1
- package/assets/types-DFEAKZ3L.js +4 -0
- package/assets/utils-BtpzmIxp.js +2 -0
- package/assets/{utils-mHMkg6Kp.js → utils-Onbz2awt.js} +1 -1
- package/assets/{verifyHash-CboNxe2B.js → verifyHash-Bx9bP5KA.js} +3 -3
- package/assets/{w3m-modal-Cv35RGiT.js → w3m-modal-C63bxWaq.js} +1 -1
- package/assets/wait-for-tx-receipt-CuLnfaKm.js +1 -0
- package/assets/{wait-for-tx-receipt-Drv8Lr1P.js → wait-for-tx-receipt-DhBzWdPW.js} +1 -1
- package/assets/{wallets-GwhGT1dM.js → wallets-SiIK_4eu.js} +6 -6
- package/assets/{web-connector-bxGgXqpW.js → web-connector-BnZ6I9U8.js} +3 -3
- package/assets/web-connector-DJrJBk0_.js +2 -0
- package/assets/{zora-sepolia-Cm6nfoBw.js → zora-sepolia-5TL5obss.js} +1 -1
- package/index.html +2 -2
- package/package.json +3 -3
- package/assets/CoinbaseSDKConnection-BKJdrNl1.js +0 -1
- package/assets/InAppWalletConnectUI-BCpqJr7x.js +0 -1
- package/assets/ThirdwebWalletManager-C0WgXnZx.js +0 -326
- package/assets/biconomy-dnUC9FHi.js +0 -1
- package/assets/ccip-gHbZ_fY7.js +0 -1
- package/assets/common-DXGQjmn7.js +0 -1
- package/assets/concat-hex-BkDmxQZp.js +0 -1
- package/assets/controller-XOXJb_Xj.js +0 -2
- package/assets/decimals-Bk-qoHwa.js +0 -1
- package/assets/detectExtension-BeXqHbY8.js +0 -1
- package/assets/engine-BZxfKBvb.js +0 -1
- package/assets/estimate-l1-fee-CpxowJdJ.js +0 -2
- package/assets/eth_estimateGas-BI87Z6lb.js +0 -1
- package/assets/eth_estimateGas-D6jt3ABx.js +0 -1
- package/assets/eth_getTransactionCount-DX2PE6Uh.js +0 -1
- package/assets/extractIPFS-LV30uJp-.js +0 -1
- package/assets/fetchTokenMetadata-D7KlTBZU.js +0 -2
- package/assets/get-ecosystem-wallet-info-BpGtHQgI.js +0 -1
- package/assets/getBalance-B2S2mDBX.js +0 -1
- package/assets/getCurrencyMetadata-DO1CX_p4.js +0 -2
- package/assets/getInstalledModules-DQWxNwhQ.js +0 -1
- package/assets/getNFT-BS49C2kr.js +0 -1
- package/assets/getNFT-CW_k-N6S.js +0 -2
- package/assets/in-app-wallet-calls-C-2B-t-w.js +0 -1
- package/assets/index-BDODUKme.js +0 -1
- package/assets/index-BKKV2746.js +0 -3
- package/assets/index-C1yUcBr3.js +0 -2
- package/assets/index-DJX4jI7z.js +0 -2
- package/assets/index-DKiQCady.js +0 -3
- package/assets/index.es-DkH7OFeN.js +0 -29
- package/assets/index.es-anFcjT3-.js +0 -1
- package/assets/openzeppelin-C8E5DMGT.js +0 -1
- package/assets/ownerOf-CLN-nhw1.js +0 -1
- package/assets/resolveImplementation-YurP5AVa.js +0 -1
- package/assets/secp256k1-CLk510R-.js +0 -1
- package/assets/send-batch-transaction-BRauQRcY.js +0 -1
- package/assets/send-eip712-transaction-CJ8IBHyz.js +0 -2
- package/assets/send-gasless-transaction-Ds_GyVDO.js +0 -2
- package/assets/session-proposal-BOjuBppp.js +0 -1
- package/assets/session-request-BltijLOZ.js +0 -2
- package/assets/sha256-uQaZGirP.js +0 -1
- package/assets/signing-GXncBciP.js +0 -2
- package/assets/switch-chain-DXxIqQkk.js +0 -1
- package/assets/thirdweb-COhbCMEp.js +0 -27
- package/assets/totalSupply-ur_EDW6t.js +0 -1
- package/assets/web-connector-B0B4AGqG.js +0 -2
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import{i as En,e as rr,a as me,b as Ee,c as Ae}from"./index-Fv-acDXO.js";function ji(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var dh=Hi;function Hi(t,e,r){var n=r&&r.stringify||ji,i=1;if(typeof t=="object"&&t!==null){var o=e.length+i;if(o===1)return t;var a=new Array(o);a[0]=n(t);for(var c=1;c<o;c++)a[c]=n(e[c]);return a.join(" ")}if(typeof t!="string")return t;var f=e.length;if(f===0)return t;for(var s="",u=1-i,l=-1,h=t&&t.length||0,w=0;w<h;){if(t.charCodeAt(w)===37&&w+1<h){switch(l=l>-1?l:0,t.charCodeAt(w+1)){case 100:case 102:if(u>=f||e[u]==null)break;l<w&&(s+=t.slice(l,w)),s+=Number(e[u]),l=w+2,w++;break;case 105:if(u>=f||e[u]==null)break;l<w&&(s+=t.slice(l,w)),s+=Math.floor(Number(e[u])),l=w+2,w++;break;case 79:case 111:case 106:if(u>=f||e[u]===void 0)break;l<w&&(s+=t.slice(l,w));var d=typeof e[u];if(d==="string"){s+="'"+e[u]+"'",l=w+2,w++;break}if(d==="function"){s+=e[u].name||"<anonymous>",l=w+2,w++;break}s+=n(e[u]),l=w+2,w++;break;case 115:if(u>=f)break;l<w&&(s+=t.slice(l,w)),s+=String(e[u]),l=w+2,w++;break;case 37:l<w&&(s+=t.slice(l,w)),s+="%",l=w+2,w++,u--;break}++u}++w}return l===-1?t:(l<h&&(s+=t.slice(l)),s)}const Ki=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),$i=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function dt(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return $i(t)}catch{return t}}function wt(t){return typeof t=="string"?t:Ki(t)||""}var gt={};/*! *****************************************************************************
|
|
2
|
-
Copyright (c) Microsoft Corporation.
|
|
3
|
-
|
|
4
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
-
purpose with or without fee is hereby granted.
|
|
6
|
-
|
|
7
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
-
***************************************************************************** */var Wt=function(t,e){return Wt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Wt(t,e)};function Vi(t,e){Wt(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var jt=function(){return jt=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},jt.apply(this,arguments)};function qi(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function Yi(t,e,r,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,r,n);else for(var c=t.length-1;c>=0;c--)(a=t[c])&&(o=(i<3?a(o):i>3?a(e,r,o):a(e,r))||o);return i>3&&o&&Object.defineProperty(e,r,o),o}function Gi(t,e){return function(r,n){e(r,n,t)}}function Ji(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Xi(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function c(u){try{s(n.next(u))}catch(l){a(l)}}function f(u){try{s(n.throw(u))}catch(l){a(l)}}function s(u){u.done?o(u.value):i(u.value).then(c,f)}s((n=n.apply(t,e||[])).next())})}function Zi(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(s){return function(u){return f([s,u])}}function f(s){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=s[0]&2?i.return:s[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;switch(i=0,o&&(s=[s[0]&2,o.value]),s[0]){case 0:case 1:o=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,i=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(s[0]===6&&r.label<o[1]){r.label=o[1],o=s;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(s);break}o[2]&&r.ops.pop(),r.trys.pop();continue}s=e.call(t,r)}catch(u){s=[6,u],i=0}finally{n=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function Qi(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function eo(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Ht(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function xn(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){a={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o}function to(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(xn(arguments[e]));return t}function ro(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var o=arguments[e],a=0,c=o.length;a<c;a++,i++)n[i]=o[a];return n}function je(t){return this instanceof je?(this.v=t,this):new je(t)}function no(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,o=[];return i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i;function a(h){n[h]&&(i[h]=function(w){return new Promise(function(d,p){o.push([h,w,d,p])>1||c(h,w)})})}function c(h,w){try{f(n[h](w))}catch(d){l(o[0][3],d)}}function f(h){h.value instanceof je?Promise.resolve(h.value.v).then(s,u):l(o[0][2],h)}function s(h){c("next",h)}function u(h){c("throw",h)}function l(h,w){h(w),o.shift(),o.length&&c(o[0][0],o[0][1])}}function io(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,o){e[i]=t[i]?function(a){return(r=!r)?{value:je(t[i](a)),done:i==="return"}:o?o(a):a}:o}}function oo(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Ht=="function"?Ht(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=t[o]&&function(a){return new Promise(function(c,f){a=t[o](a),i(c,f,a.done,a.value)})}}function i(o,a,c,f){Promise.resolve(f).then(function(s){o({value:s,done:c})},a)}}function so(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function ao(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function uo(t){return t&&t.__esModule?t:{default:t}}function co(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function fo(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const lo=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return jt},__asyncDelegator:io,__asyncGenerator:no,__asyncValues:oo,__await:je,__awaiter:Xi,__classPrivateFieldGet:co,__classPrivateFieldSet:fo,__createBinding:Qi,__decorate:Yi,__exportStar:eo,__extends:Vi,__generator:Zi,__importDefault:uo,__importStar:ao,__makeTemplateObject:so,__metadata:Ji,__param:Gi,__read:xn,__rest:qi,__spread:to,__spreadArrays:ro,__values:Ht},Symbol.toStringTag,{value:"Module"})),pt=En(lo);var vt={},Oe={},Ar;function ho(){if(Ar)return Oe;Ar=1,Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Oe.delay=t,Oe}var ye={},_t={},be={},Fr;function wo(){return Fr||(Fr=1,Object.defineProperty(be,"__esModule",{value:!0}),be.ONE_THOUSAND=be.ONE_HUNDRED=void 0,be.ONE_HUNDRED=100,be.ONE_THOUSAND=1e3),be}var St={},Br;function go(){return Br||(Br=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(St)),St}var Ur;function vn(){return Ur||(Ur=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=pt;e.__exportStar(wo(),t),e.__exportStar(go(),t)}(_t)),_t}var Cr;function po(){if(Cr)return ye;Cr=1,Object.defineProperty(ye,"__esModule",{value:!0}),ye.fromMiliseconds=ye.toMiliseconds=void 0;const t=vn();function e(n){return n*t.ONE_THOUSAND}ye.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return ye.fromMiliseconds=r,ye}var Ir;function yo(){return Ir||(Ir=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=pt;e.__exportStar(ho(),t),e.__exportStar(po(),t)}(vt)),vt}var Fe={},Or;function bo(){if(Or)return Fe;Or=1,Object.defineProperty(Fe,"__esModule",{value:!0}),Fe.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return Fe.Watch=t,Fe.default=t,Fe}var At={},Te={},Tr;function Do(){if(Tr)return Te;Tr=1,Object.defineProperty(Te,"__esModule",{value:!0}),Te.IWatch=void 0;class t{}return Te.IWatch=t,Te}var Rr;function mo(){return Rr||(Rr=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),pt.__exportStar(Do(),t)}(At)),At}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=pt;e.__exportStar(yo(),t),e.__exportStar(bo(),t),e.__exportStar(mo(),t),e.__exportStar(vn(),t)})(gt);class Eo{}let xo=class extends Eo{constructor(e){super()}};const Nr=gt.FIVE_SECONDS,vo={pulse:"heartbeat_pulse"};class _n extends xo{constructor(e){super(e),this.events=new rr.EventEmitter,this.interval=Nr,this.interval=(e==null?void 0:e.interval)||Nr}static async init(e){const r=new _n(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),gt.toMiliseconds(this.interval))}pulse(){this.events.emit(vo.pulse)}}const _o=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,So=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,Ao=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function Fo(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){Bo(t);return}return e}function Bo(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Ye(t,e={}){if(typeof t!="string")return t;if(t[0]==='"'&&t[t.length-1]==='"'&&t.indexOf("\\")===-1)return t.slice(1,-1);const r=t.trim();if(r.length<=9)switch(r.toLowerCase()){case"true":return!0;case"false":return!1;case"undefined":return;case"null":return null;case"nan":return Number.NaN;case"infinity":return Number.POSITIVE_INFINITY;case"-infinity":return Number.NEGATIVE_INFINITY}if(!Ao.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(_o.test(t)||So.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,Fo)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function Uo(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function j(t,...e){try{return Uo(t(...e))}catch(r){return Promise.reject(r)}}function Co(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function Io(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function nt(t){if(Co(t))return String(t);if(Io(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return nt(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const Kt="base64:";function Oo(t){return typeof t=="string"?t:Kt+No(t)}function To(t){return typeof t!="string"||!t.startsWith(Kt)?t:Ro(t.slice(Kt.length))}function Ro(t){return globalThis.Buffer?Buffer.from(t,"base64"):Uint8Array.from(globalThis.atob(t),e=>e.codePointAt(0))}function No(t){return globalThis.Buffer?Buffer.from(t).toString("base64"):globalThis.btoa(String.fromCodePoint(...t))}function Z(t){var e;return t&&((e=t.split("?")[0])==null?void 0:e.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function Mo(...t){return Z(t.join(":"))}function Ge(t){return t=Z(t),t?t+":":""}function Po(t,e){if(e===void 0)return!0;let r=0,n=t.indexOf(":");for(;n>-1;)r++,n=t.indexOf(":",n+1);return r<=e}function ko(t,e){return e?t.startsWith(e)&&t[t.length-1]!=="$":t[t.length-1]!=="$"}const Lo="memory",zo=()=>{const t=new Map;return{name:Lo,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function Wo(t={}){const e={mounts:{"":t.driver||zo()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=s=>{for(const u of e.mountpoints)if(s.startsWith(u))return{base:u,relativeKey:s.slice(u.length),driver:e.mounts[u]};return{base:"",relativeKey:s,driver:e.mounts[""]}},n=(s,u)=>e.mountpoints.filter(l=>l.startsWith(s)||u&&s.startsWith(l)).map(l=>({relativeBase:s.length>l.length?s.slice(l.length):void 0,mountpoint:l,driver:e.mounts[l]})),i=(s,u)=>{if(e.watching){u=Z(u);for(const l of e.watchListeners)l(s,u)}},o=async()=>{if(!e.watching){e.watching=!0;for(const s in e.mounts)e.unwatch[s]=await Mr(e.mounts[s],i,s)}},a=async()=>{if(e.watching){for(const s in e.unwatch)await e.unwatch[s]();e.unwatch={},e.watching=!1}},c=(s,u,l)=>{const h=new Map,w=d=>{let p=h.get(d.base);return p||(p={driver:d.driver,base:d.base,items:[]},h.set(d.base,p)),p};for(const d of s){const p=typeof d=="string",b=Z(p?d:d.key),D=p?void 0:d.value,x=p||!d.options?u:{...u,...d.options},g=r(b);w(g).items.push({key:b,value:D,relativeKey:g.relativeKey,options:x})}return Promise.all([...h.values()].map(d=>l(d))).then(d=>d.flat())},f={hasItem(s,u={}){s=Z(s);const{relativeKey:l,driver:h}=r(s);return j(h.hasItem,l,u)},getItem(s,u={}){s=Z(s);const{relativeKey:l,driver:h}=r(s);return j(h.getItem,l,u).then(w=>Ye(w))},getItems(s,u={}){return c(s,u,l=>l.driver.getItems?j(l.driver.getItems,l.items.map(h=>({key:h.relativeKey,options:h.options})),u).then(h=>h.map(w=>({key:Mo(l.base,w.key),value:Ye(w.value)}))):Promise.all(l.items.map(h=>j(l.driver.getItem,h.relativeKey,h.options).then(w=>({key:h.key,value:Ye(w)})))))},getItemRaw(s,u={}){s=Z(s);const{relativeKey:l,driver:h}=r(s);return h.getItemRaw?j(h.getItemRaw,l,u):j(h.getItem,l,u).then(w=>To(w))},async setItem(s,u,l={}){if(u===void 0)return f.removeItem(s);s=Z(s);const{relativeKey:h,driver:w}=r(s);w.setItem&&(await j(w.setItem,h,nt(u),l),w.watch||i("update",s))},async setItems(s,u){await c(s,u,async l=>{if(l.driver.setItems)return j(l.driver.setItems,l.items.map(h=>({key:h.relativeKey,value:nt(h.value),options:h.options})),u);l.driver.setItem&&await Promise.all(l.items.map(h=>j(l.driver.setItem,h.relativeKey,nt(h.value),h.options)))})},async setItemRaw(s,u,l={}){if(u===void 0)return f.removeItem(s,l);s=Z(s);const{relativeKey:h,driver:w}=r(s);if(w.setItemRaw)await j(w.setItemRaw,h,u,l);else if(w.setItem)await j(w.setItem,h,Oo(u),l);else return;w.watch||i("update",s)},async removeItem(s,u={}){typeof u=="boolean"&&(u={removeMeta:u}),s=Z(s);const{relativeKey:l,driver:h}=r(s);h.removeItem&&(await j(h.removeItem,l,u),(u.removeMeta||u.removeMata)&&await j(h.removeItem,l+"$",u),h.watch||i("remove",s))},async getMeta(s,u={}){typeof u=="boolean"&&(u={nativeOnly:u}),s=Z(s);const{relativeKey:l,driver:h}=r(s),w=Object.create(null);if(h.getMeta&&Object.assign(w,await j(h.getMeta,l,u)),!u.nativeOnly){const d=await j(h.getItem,l+"$",u).then(p=>Ye(p));d&&typeof d=="object"&&(typeof d.atime=="string"&&(d.atime=new Date(d.atime)),typeof d.mtime=="string"&&(d.mtime=new Date(d.mtime)),Object.assign(w,d))}return w},setMeta(s,u,l={}){return this.setItem(s+"$",u,l)},removeMeta(s,u={}){return this.removeItem(s+"$",u)},async getKeys(s,u={}){var b;s=Ge(s);const l=n(s,!0);let h=[];const w=[];let d=!0;for(const D of l){(b=D.driver.flags)!=null&&b.maxDepth||(d=!1);const x=await j(D.driver.getKeys,D.relativeBase,u);for(const g of x){const m=D.mountpoint+Z(g);h.some(F=>m.startsWith(F))||w.push(m)}h=[D.mountpoint,...h.filter(g=>!g.startsWith(D.mountpoint))]}const p=u.maxDepth!==void 0&&!d;return w.filter(D=>(!p||Po(D,u.maxDepth))&&ko(D,s))},async clear(s,u={}){s=Ge(s),await Promise.all(n(s,!1).map(async l=>{if(l.driver.clear)return j(l.driver.clear,l.relativeBase,u);if(l.driver.removeItem){const h=await l.driver.getKeys(l.relativeBase||"",u);return Promise.all(h.map(w=>l.driver.removeItem(w,u)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(s=>Pr(s)))},async watch(s){return await o(),e.watchListeners.push(s),async()=>{e.watchListeners=e.watchListeners.filter(u=>u!==s),e.watchListeners.length===0&&await a()}},async unwatch(){e.watchListeners=[],await a()},mount(s,u){if(s=Ge(s),s&&e.mounts[s])throw new Error(`already mounted at ${s}`);return s&&(e.mountpoints.push(s),e.mountpoints.sort((l,h)=>h.length-l.length)),e.mounts[s]=u,e.watching&&Promise.resolve(Mr(u,i,s)).then(l=>{e.unwatch[s]=l}).catch(console.error),f},async unmount(s,u=!0){var l,h;s=Ge(s),!(!s||!e.mounts[s])&&(e.watching&&s in e.unwatch&&((h=(l=e.unwatch)[s])==null||h.call(l),delete e.unwatch[s]),u&&await Pr(e.mounts[s]),e.mountpoints=e.mountpoints.filter(w=>w!==s),delete e.mounts[s])},getMount(s=""){s=Z(s)+":";const u=r(s);return{driver:u.driver,base:u.base}},getMounts(s="",u={}){return s=Z(s),n(s,u.parents).map(h=>({driver:h.driver,base:h.mountpoint}))},keys:(s,u={})=>f.getKeys(s,u),get:(s,u={})=>f.getItem(s,u),set:(s,u,l={})=>f.setItem(s,u,l),has:(s,u={})=>f.hasItem(s,u),del:(s,u={})=>f.removeItem(s,u),remove:(s,u={})=>f.removeItem(s,u)};return f}function Mr(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function Pr(t){typeof t.dispose=="function"&&await j(t.dispose)}function xe(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function Sn(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=xe(r);return(i,o)=>n.then(a=>o(a.transaction(e,i).objectStore(e)))}let Ft;function Ke(){return Ft||(Ft=Sn("keyval-store","keyval")),Ft}function kr(t,e=Ke()){return e("readonly",r=>xe(r.get(t)))}function jo(t,e,r=Ke()){return r("readwrite",n=>(n.put(e,t),xe(n.transaction)))}function Ho(t,e=Ke()){return e("readwrite",r=>(r.delete(t),xe(r.transaction)))}function Ko(t=Ke()){return t("readwrite",e=>(e.clear(),xe(e.transaction)))}function $o(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},xe(t.transaction)}function Vo(t=Ke()){return t("readonly",e=>{if(e.getAllKeys)return xe(e.getAllKeys());const r=[];return $o(e,n=>r.push(n.key)).then(()=>r)})}const qo="idb-keyval";var Yo=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=Sn(t.dbName,t.storeName)),{name:qo,options:t,async hasItem(i){return!(typeof await kr(r(i),n)>"u")},async getItem(i){return await kr(r(i),n)??null},setItem(i,o){return jo(r(i),o,n)},removeItem(i){return Ho(r(i),n)},getKeys(){return Vo(n)},clear(){return Ko(n)}}};const Go="WALLET_CONNECT_V2_INDEXED_DB",Jo="keyvaluestorage";class Xo{constructor(){this.indexedDb=Wo({driver:Yo({dbName:Go,storeName:Jo})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,wt(r))}async removeItem(e){await this.indexedDb.removeItem(e)}}var Bt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof me<"u"?me:typeof self<"u"?self:{},it={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Bt<"u"&&Bt.localStorage?it.exports=Bt.localStorage:typeof window<"u"&&window.localStorage?it.exports=window.localStorage:it.exports=new e})();function Zo(t){var e;return[t[0],dt((e=t[1])!=null?e:"")]}let Qo=class{constructor(){this.localStorage=it.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Zo)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return dt(r)}async setItem(e,r){this.localStorage.setItem(e,wt(r))}async removeItem(e){this.localStorage.removeItem(e)}};const es="wc_storage_version",Lr=1,ts=async(t,e,r)=>{const n=es,i=await e.getItem(n);if(i&&i>=Lr){r(e);return}const o=await t.getKeys();if(!o.length){r(e);return}const a=[];for(;o.length;){const c=o.shift();if(!c)continue;const f=c.toLowerCase();if(f.includes("wc@")||f.includes("walletconnect")||f.includes("wc_")||f.includes("wallet_connect")){const s=await t.getItem(c);await e.setItem(c,s),a.push(c)}}await e.setItem(n,Lr),r(e),rs(t,a)},rs=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let ph=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new Qo;this.storage=e;try{const r=new Xo;ts(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};function ns(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function An(t,...e){if(!ns(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function zr(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function is(t,e){An(t);const r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}const Be=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ut=t=>new DataView(t.buffer,t.byteOffset,t.byteLength);function os(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function Fn(t){return typeof t=="string"&&(t=os(t)),An(t),t}class ss{clone(){return this._cloneInto()}}function as(t){const e=n=>t().update(Fn(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function Bn(t=32){if(Be&&typeof Be.getRandomValues=="function")return Be.getRandomValues(new Uint8Array(t));if(Be&&typeof Be.randomBytes=="function")return Be.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}function us(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),o=BigInt(4294967295),a=Number(r>>i&o),c=Number(r&o),f=n?4:0,s=n?0:4;t.setUint32(e+f,a,n),t.setUint32(e+s,c,n)}class cs extends ss{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Ut(this.buffer)}update(e){zr(this);const{view:r,buffer:n,blockLen:i}=this;e=Fn(e);const o=e.length;for(let a=0;a<o;){const c=Math.min(i-this.pos,o-a);if(c===i){const f=Ut(e);for(;i<=o-a;a+=i)this.process(f,a);continue}n.set(e.subarray(a,a+c),this.pos),this.pos+=c,a+=c,this.pos===i&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){zr(this),is(e,this),this.finished=!0;const{buffer:r,view:n,blockLen:i,isLE:o}=this;let{pos:a}=this;r[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>i-a&&(this.process(n,0),a=0);for(let l=a;l<i;l++)r[l]=0;us(n,i-8,BigInt(this.length*8),o),this.process(n,0);const c=Ut(e),f=this.outputLen;if(f%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const s=f/4,u=this.get();if(s>u.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<s;l++)c.setUint32(4*l,u[l],o)}digest(){const{buffer:e,outputLen:r}=this;this.digestInto(e);const n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:r,buffer:n,length:i,finished:o,destroyed:a,pos:c}=this;return e.length=i,e.pos=c,e.finished=o,e.destroyed=a,i%r&&e.buffer.set(n),e}}const Je=BigInt(2**32-1),$t=BigInt(32);function Un(t,e=!1){return e?{h:Number(t&Je),l:Number(t>>$t&Je)}:{h:Number(t>>$t&Je)|0,l:Number(t&Je)|0}}function fs(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:o,l:a}=Un(t[i],e);[r[i],n[i]]=[o,a]}return[r,n]}const ls=(t,e)=>BigInt(t>>>0)<<$t|BigInt(e>>>0),hs=(t,e,r)=>t>>>r,ds=(t,e,r)=>t<<32-r|e>>>r,ws=(t,e,r)=>t>>>r|e<<32-r,gs=(t,e,r)=>t<<32-r|e>>>r,ps=(t,e,r)=>t<<64-r|e>>>r-32,ys=(t,e,r)=>t>>>r-32|e<<64-r,bs=(t,e)=>e,Ds=(t,e)=>t,ms=(t,e,r)=>t<<r|e>>>32-r,Es=(t,e,r)=>e<<r|t>>>32-r,xs=(t,e,r)=>e<<r-32|t>>>64-r,vs=(t,e,r)=>t<<r-32|e>>>64-r;function _s(t,e,r,n){const i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}const Ss=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),As=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,Fs=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),Bs=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,Us=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),Cs=(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0,A={fromBig:Un,split:fs,toBig:ls,shrSH:hs,shrSL:ds,rotrSH:ws,rotrSL:gs,rotrBH:ps,rotrBL:ys,rotr32H:bs,rotr32L:Ds,rotlSH:ms,rotlSL:Es,rotlBH:xs,rotlBL:vs,add:_s,add3L:Ss,add3H:As,add4L:Fs,add4H:Bs,add5H:Cs,add5L:Us},[Is,Os]=A.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),fe=new Uint32Array(80),le=new Uint32Array(80);class Ts extends cs{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:r,Bh:n,Bl:i,Ch:o,Cl:a,Dh:c,Dl:f,Eh:s,El:u,Fh:l,Fl:h,Gh:w,Gl:d,Hh:p,Hl:b}=this;return[e,r,n,i,o,a,c,f,s,u,l,h,w,d,p,b]}set(e,r,n,i,o,a,c,f,s,u,l,h,w,d,p,b){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=o|0,this.Cl=a|0,this.Dh=c|0,this.Dl=f|0,this.Eh=s|0,this.El=u|0,this.Fh=l|0,this.Fl=h|0,this.Gh=w|0,this.Gl=d|0,this.Hh=p|0,this.Hl=b|0}process(e,r){for(let g=0;g<16;g++,r+=4)fe[g]=e.getUint32(r),le[g]=e.getUint32(r+=4);for(let g=16;g<80;g++){const m=fe[g-15]|0,F=le[g-15]|0,R=A.rotrSH(m,F,1)^A.rotrSH(m,F,8)^A.shrSH(m,F,7),O=A.rotrSL(m,F,1)^A.rotrSL(m,F,8)^A.shrSL(m,F,7),B=fe[g-2]|0,P=le[g-2]|0,_e=A.rotrSH(B,P,19)^A.rotrBH(B,P,61)^A.shrSH(B,P,6),ge=A.rotrSL(B,P,19)^A.rotrBL(B,P,61)^A.shrSL(B,P,6),Se=A.add4L(O,ge,le[g-7],le[g-16]),Ie=A.add4H(Se,R,_e,fe[g-7],fe[g-16]);fe[g]=Ie|0,le[g]=Se|0}let{Ah:n,Al:i,Bh:o,Bl:a,Ch:c,Cl:f,Dh:s,Dl:u,Eh:l,El:h,Fh:w,Fl:d,Gh:p,Gl:b,Hh:D,Hl:x}=this;for(let g=0;g<80;g++){const m=A.rotrSH(l,h,14)^A.rotrSH(l,h,18)^A.rotrBH(l,h,41),F=A.rotrSL(l,h,14)^A.rotrSL(l,h,18)^A.rotrBL(l,h,41),R=l&w^~l&p,O=h&d^~h&b,B=A.add5L(x,F,O,Os[g],le[g]),P=A.add5H(B,D,m,R,Is[g],fe[g]),_e=B|0,ge=A.rotrSH(n,i,28)^A.rotrBH(n,i,34)^A.rotrBH(n,i,39),Se=A.rotrSL(n,i,28)^A.rotrBL(n,i,34)^A.rotrBL(n,i,39),Ie=n&o^n&c^o&c,Et=i&a^i&f^a&f;D=p|0,x=b|0,p=w|0,b=d|0,w=l|0,d=h|0,{h:l,l:h}=A.add(s|0,u|0,P|0,_e|0),s=c|0,u=f|0,c=o|0,f=a|0,o=n|0,a=i|0;const v=A.add3L(_e,Se,Et);n=A.add3H(v,P,ge,Ie),i=v|0}({h:n,l:i}=A.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:a}=A.add(this.Bh|0,this.Bl|0,o|0,a|0),{h:c,l:f}=A.add(this.Ch|0,this.Cl|0,c|0,f|0),{h:s,l:u}=A.add(this.Dh|0,this.Dl|0,s|0,u|0),{h:l,l:h}=A.add(this.Eh|0,this.El|0,l|0,h|0),{h:w,l:d}=A.add(this.Fh|0,this.Fl|0,w|0,d|0),{h:p,l:b}=A.add(this.Gh|0,this.Gl|0,p|0,b|0),{h:D,l:x}=A.add(this.Hh|0,this.Hl|0,D|0,x|0),this.set(n,i,o,a,c,f,s,u,l,h,w,d,p,b,D,x)}roundClean(){fe.fill(0),le.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Rs=as(()=>new Ts);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const nr=BigInt(0),Cn=BigInt(1),Ns=BigInt(2);function ir(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function or(t){if(!ir(t))throw new Error("Uint8Array expected")}function Ct(t,e){if(typeof e!="boolean")throw new Error(t+" boolean expected, got "+e)}const Ms=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function sr(t){or(t);let e="";for(let r=0;r<t.length;r++)e+=Ms[t[r]];return e}function In(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?nr:BigInt("0x"+t)}const oe={_0:48,_9:57,A:65,F:70,a:97,f:102};function Wr(t){if(t>=oe._0&&t<=oe._9)return t-oe._0;if(t>=oe.A&&t<=oe.F)return t-(oe.A-10);if(t>=oe.a&&t<=oe.f)return t-(oe.a-10)}function On(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,o=0;i<r;i++,o+=2){const a=Wr(t.charCodeAt(o)),c=Wr(t.charCodeAt(o+1));if(a===void 0||c===void 0){const f=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+f+'" at index '+o)}n[i]=a*16+c}return n}function Ps(t){return In(sr(t))}function ot(t){return or(t),In(sr(Uint8Array.from(t).reverse()))}function Tn(t,e){return On(t.toString(16).padStart(e*2,"0"))}function Vt(t,e){return Tn(t,e).reverse()}function se(t,e,r){let n;if(typeof e=="string")try{n=On(e)}catch(o){throw new Error(t+" must be hex string or Uint8Array, cause: "+o)}else if(ir(e))n=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");const i=n.length;if(typeof r=="number"&&i!==r)throw new Error(t+" of length "+r+" expected, got "+i);return n}function jr(...t){let e=0;for(let n=0;n<t.length;n++){const i=t[n];or(i),e+=i.length}const r=new Uint8Array(e);for(let n=0,i=0;n<t.length;n++){const o=t[n];r.set(o,i),i+=o.length}return r}const It=t=>typeof t=="bigint"&&nr<=t;function ks(t,e,r){return It(t)&&It(e)&&It(r)&&e<=t&&t<r}function Re(t,e,r,n){if(!ks(e,r,n))throw new Error("expected valid "+t+": "+r+" <= n < "+n+", got "+e)}function Ls(t){let e;for(e=0;t>nr;t>>=Cn,e+=1);return e}const zs=t=>(Ns<<BigInt(t-1))-Cn,Ws={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||ir(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function ar(t,e,r={}){const n=(i,o,a)=>{const c=Ws[o];if(typeof c!="function")throw new Error("invalid validator function");const f=t[i];if(!(a&&f===void 0)&&!c(f,t))throw new Error("param "+String(i)+" is invalid. Expected "+o+", got "+f)};for(const[i,o]of Object.entries(e))n(i,o,!1);for(const[i,o]of Object.entries(r))n(i,o,!0);return t}function Hr(t){const e=new WeakMap;return(r,...n)=>{const i=e.get(r);if(i!==void 0)return i;const o=t(r,...n);return e.set(r,o),o}}const H=BigInt(0),z=BigInt(1),De=BigInt(2),js=BigInt(3),qt=BigInt(4),Kr=BigInt(5),$r=BigInt(8);function W(t,e){const r=t%e;return r>=H?r:e+r}function Hs(t,e,r){if(e<H)throw new Error("invalid exponent, negatives unsupported");if(r<=H)throw new Error("invalid modulus");if(r===z)return H;let n=z;for(;e>H;)e&z&&(n=n*t%r),t=t*t%r,e>>=z;return n}function re(t,e,r){let n=t;for(;e-- >H;)n*=n,n%=r;return n}function Vr(t,e){if(t===H)throw new Error("invert: expected non-zero number");if(e<=H)throw new Error("invert: expected positive modulus, got "+e);let r=W(t,e),n=e,i=H,o=z;for(;r!==H;){const a=n/r,c=n%r,f=i-o*a;n=r,r=c,i=o,o=f}if(n!==z)throw new Error("invert: does not exist");return W(i,e)}function Ks(t){const e=(t-z)/De;let r,n,i;for(r=t-z,n=0;r%De===H;r/=De,n++);for(i=De;i<t&&Hs(i,e,t)!==t-z;i++)if(i>1e3)throw new Error("Cannot find square root: likely non-prime P");if(n===1){const a=(t+z)/qt;return function(c,f){const s=c.pow(f,a);if(!c.eql(c.sqr(s),f))throw new Error("Cannot find square root");return s}}const o=(r+z)/De;return function(a,c){if(a.pow(c,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let f=n,s=a.pow(a.mul(a.ONE,i),r),u=a.pow(c,o),l=a.pow(c,r);for(;!a.eql(l,a.ONE);){if(a.eql(l,a.ZERO))return a.ZERO;let h=1;for(let d=a.sqr(l);h<f&&!a.eql(d,a.ONE);h++)d=a.sqr(d);const w=a.pow(s,z<<BigInt(f-h-1));s=a.sqr(w),u=a.mul(u,w),l=a.mul(l,s),f=h}return u}}function $s(t){if(t%qt===js){const e=(t+z)/qt;return function(r,n){const i=r.pow(n,e);if(!r.eql(r.sqr(i),n))throw new Error("Cannot find square root");return i}}if(t%$r===Kr){const e=(t-Kr)/$r;return function(r,n){const i=r.mul(n,De),o=r.pow(i,e),a=r.mul(n,o),c=r.mul(r.mul(a,De),o),f=r.mul(a,r.sub(c,r.ONE));if(!r.eql(r.sqr(f),n))throw new Error("Cannot find square root");return f}}return Ks(t)}const Vs=(t,e)=>(W(t,e)&z)===z,qs=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Ys(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=qs.reduce((n,i)=>(n[i]="function",n),e);return ar(t,r)}function Gs(t,e,r){if(r<H)throw new Error("invalid exponent, negatives unsupported");if(r===H)return t.ONE;if(r===z)return e;let n=t.ONE,i=e;for(;r>H;)r&z&&(n=t.mul(n,i)),i=t.sqr(i),r>>=z;return n}function Js(t,e){const r=new Array(e.length),n=e.reduce((o,a,c)=>t.is0(a)?o:(r[c]=o,t.mul(o,a)),t.ONE),i=t.inv(n);return e.reduceRight((o,a,c)=>t.is0(a)?o:(r[c]=t.mul(o,r[c]),t.mul(o,a)),i),r}function Rn(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function Nn(t,e,r=!1,n={}){if(t<=H)throw new Error("invalid field: expected ORDER > 0, got "+t);const{nBitLength:i,nByteLength:o}=Rn(t,e);if(o>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let a;const c=Object.freeze({ORDER:t,isLE:r,BITS:i,BYTES:o,MASK:zs(i),ZERO:H,ONE:z,create:f=>W(f,t),isValid:f=>{if(typeof f!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof f);return H<=f&&f<t},is0:f=>f===H,isOdd:f=>(f&z)===z,neg:f=>W(-f,t),eql:(f,s)=>f===s,sqr:f=>W(f*f,t),add:(f,s)=>W(f+s,t),sub:(f,s)=>W(f-s,t),mul:(f,s)=>W(f*s,t),pow:(f,s)=>Gs(c,f,s),div:(f,s)=>W(f*Vr(s,t),t),sqrN:f=>f*f,addN:(f,s)=>f+s,subN:(f,s)=>f-s,mulN:(f,s)=>f*s,inv:f=>Vr(f,t),sqrt:n.sqrt||(f=>(a||(a=$s(t)),a(c,f))),invertBatch:f=>Js(c,f),cmov:(f,s,u)=>u?s:f,toBytes:f=>r?Vt(f,o):Tn(f,o),fromBytes:f=>{if(f.length!==o)throw new Error("Field.fromBytes: expected "+o+" bytes, got "+f.length);return r?ot(f):Ps(f)}});return Object.freeze(c)}const qr=BigInt(0),Xe=BigInt(1);function Ot(t,e){const r=e.negate();return t?r:e}function Mn(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function Tt(t,e){Mn(t,e);const r=Math.ceil(e/t)+1,n=2**(t-1);return{windows:r,windowSize:n}}function Xs(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((r,n)=>{if(!(r instanceof e))throw new Error("invalid point at index "+n)})}function Zs(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((r,n)=>{if(!e.isValid(r))throw new Error("invalid scalar at index "+n)})}const Rt=new WeakMap,Pn=new WeakMap;function Nt(t){return Pn.get(t)||1}function Qs(t,e){return{constTimeNegate:Ot,hasPrecomputes(r){return Nt(r)!==1},unsafeLadder(r,n,i=t.ZERO){let o=r;for(;n>qr;)n&Xe&&(i=i.add(o)),o=o.double(),n>>=Xe;return i},precomputeWindow(r,n){const{windows:i,windowSize:o}=Tt(n,e),a=[];let c=r,f=c;for(let s=0;s<i;s++){f=c,a.push(f);for(let u=1;u<o;u++)f=f.add(c),a.push(f);c=f.double()}return a},wNAF(r,n,i){const{windows:o,windowSize:a}=Tt(r,e);let c=t.ZERO,f=t.BASE;const s=BigInt(2**r-1),u=2**r,l=BigInt(r);for(let h=0;h<o;h++){const w=h*a;let d=Number(i&s);i>>=l,d>a&&(d-=u,i+=Xe);const p=w,b=w+Math.abs(d)-1,D=h%2!==0,x=d<0;d===0?f=f.add(Ot(D,n[p])):c=c.add(Ot(x,n[b]))}return{p:c,f}},wNAFUnsafe(r,n,i,o=t.ZERO){const{windows:a,windowSize:c}=Tt(r,e),f=BigInt(2**r-1),s=2**r,u=BigInt(r);for(let l=0;l<a;l++){const h=l*c;if(i===qr)break;let w=Number(i&f);if(i>>=u,w>c&&(w-=s,i+=Xe),w===0)continue;let d=n[h+Math.abs(w)-1];w<0&&(d=d.negate()),o=o.add(d)}return o},getPrecomputes(r,n,i){let o=Rt.get(n);return o||(o=this.precomputeWindow(n,r),r!==1&&Rt.set(n,i(o))),o},wNAFCached(r,n,i){const o=Nt(r);return this.wNAF(o,this.getPrecomputes(o,r,i),n)},wNAFCachedUnsafe(r,n,i,o){const a=Nt(r);return a===1?this.unsafeLadder(r,n,o):this.wNAFUnsafe(a,this.getPrecomputes(a,r,i),n,o)},setWindowSize(r,n){Mn(n,e),Pn.set(r,n),Rt.delete(r)}}}function ea(t,e,r,n){if(Xs(r,t),Zs(n,e),r.length!==n.length)throw new Error("arrays of points and scalars must have equal length");const i=t.ZERO,o=Ls(BigInt(r.length)),a=o>12?o-3:o>4?o-2:o?2:1,c=(1<<a)-1,f=new Array(c+1).fill(i),s=Math.floor((e.BITS-1)/a)*a;let u=i;for(let l=s;l>=0;l-=a){f.fill(i);for(let w=0;w<n.length;w++){const d=n[w],p=Number(d>>BigInt(l)&BigInt(c));f[p]=f[p].add(r[w])}let h=i;for(let w=f.length-1,d=i;w>0;w--)d=d.add(f[w]),h=h.add(d);if(u=u.add(h),l!==0)for(let w=0;w<a;w++)u=u.double()}return u}function ta(t){return Ys(t.Fp),ar(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Rn(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}const te=BigInt(0),X=BigInt(1),Ze=BigInt(2),ra=BigInt(8),na={zip215:!0};function ia(t){const e=ta(t);return ar(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function oa(t){const e=ia(t),{Fp:r,n,prehash:i,hash:o,randomBytes:a,nByteLength:c,h:f}=e,s=Ze<<BigInt(c*8)-X,u=r.create,l=Nn(e.n,e.nBitLength),h=e.uvRatio||((v,y)=>{try{return{isValid:!0,value:r.sqrt(v*r.inv(y))}}catch{return{isValid:!1,value:te}}}),w=e.adjustScalarBytes||(v=>v),d=e.domain||((v,y,E)=>{if(Ct("phflag",E),y.length||E)throw new Error("Contexts/pre-hash are not supported");return v});function p(v,y){Re("coordinate "+v,y,te,s)}function b(v){if(!(v instanceof g))throw new Error("ExtendedPoint expected")}const D=Hr((v,y)=>{const{ex:E,ey:_,ez:U}=v,I=v.is0();y==null&&(y=I?ra:r.inv(U));const T=u(E*y),k=u(_*y),N=u(U*y);if(I)return{x:te,y:X};if(N!==X)throw new Error("invZ was invalid");return{x:T,y:k}}),x=Hr(v=>{const{a:y,d:E}=e;if(v.is0())throw new Error("bad point: ZERO");const{ex:_,ey:U,ez:I,et:T}=v,k=u(_*_),N=u(U*U),L=u(I*I),K=u(L*L),J=u(k*y),ne=u(L*u(J+N)),ie=u(K+u(E*u(k*N)));if(ne!==ie)throw new Error("bad point: equation left != right (1)");const ee=u(_*U),ce=u(I*T);if(ee!==ce)throw new Error("bad point: equation left != right (2)");return!0});class g{constructor(y,E,_,U){this.ex=y,this.ey=E,this.ez=_,this.et=U,p("x",y),p("y",E),p("z",_),p("t",U),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(y){if(y instanceof g)throw new Error("extended point not allowed");const{x:E,y:_}=y||{};return p("x",E),p("y",_),new g(E,_,X,u(E*_))}static normalizeZ(y){const E=r.invertBatch(y.map(_=>_.ez));return y.map((_,U)=>_.toAffine(E[U])).map(g.fromAffine)}static msm(y,E){return ea(g,l,y,E)}_setWindowSize(y){R.setWindowSize(this,y)}assertValidity(){x(this)}equals(y){b(y);const{ex:E,ey:_,ez:U}=this,{ex:I,ey:T,ez:k}=y,N=u(E*k),L=u(I*U),K=u(_*k),J=u(T*U);return N===L&&K===J}is0(){return this.equals(g.ZERO)}negate(){return new g(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){const{a:y}=e,{ex:E,ey:_,ez:U}=this,I=u(E*E),T=u(_*_),k=u(Ze*u(U*U)),N=u(y*I),L=E+_,K=u(u(L*L)-I-T),J=N+T,ne=J-k,ie=N-T,ee=u(K*ne),ce=u(J*ie),pe=u(K*ie),qe=u(ne*J);return new g(ee,ce,qe,pe)}add(y){b(y);const{a:E,d:_}=e,{ex:U,ey:I,ez:T,et:k}=this,{ex:N,ey:L,ez:K,et:J}=y;if(E===BigInt(-1)){const Dr=u((I-U)*(L+N)),mr=u((I+U)*(L-N)),xt=u(mr-Dr);if(xt===te)return this.double();const Er=u(T*Ze*J),xr=u(k*Ze*K),vr=xr+Er,_r=mr+Dr,Sr=xr-Er,ki=u(vr*xt),Li=u(_r*Sr),zi=u(vr*Sr),Wi=u(xt*_r);return new g(ki,Li,Wi,zi)}const ne=u(U*N),ie=u(I*L),ee=u(k*_*J),ce=u(T*K),pe=u((U+I)*(N+L)-ne-ie),qe=ce-ee,yr=ce+ee,br=u(ie-E*ne),Ri=u(pe*qe),Ni=u(yr*br),Mi=u(pe*br),Pi=u(qe*yr);return new g(Ri,Ni,Pi,Mi)}subtract(y){return this.add(y.negate())}wNAF(y){return R.wNAFCached(this,y,g.normalizeZ)}multiply(y){const E=y;Re("scalar",E,X,n);const{p:_,f:U}=this.wNAF(E);return g.normalizeZ([_,U])[0]}multiplyUnsafe(y,E=g.ZERO){const _=y;return Re("scalar",_,te,n),_===te?F:this.is0()||_===X?this:R.wNAFCachedUnsafe(this,_,g.normalizeZ,E)}isSmallOrder(){return this.multiplyUnsafe(f).is0()}isTorsionFree(){return R.unsafeLadder(this,n).is0()}toAffine(y){return D(this,y)}clearCofactor(){const{h:y}=e;return y===X?this:this.multiplyUnsafe(y)}static fromHex(y,E=!1){const{d:_,a:U}=e,I=r.BYTES;y=se("pointHex",y,I),Ct("zip215",E);const T=y.slice(),k=y[I-1];T[I-1]=k&-129;const N=ot(T),L=E?s:r.ORDER;Re("pointHex.y",N,te,L);const K=u(N*N),J=u(K-X),ne=u(_*K-U);let{isValid:ie,value:ee}=h(J,ne);if(!ie)throw new Error("Point.fromHex: invalid y coordinate");const ce=(ee&X)===X,pe=(k&128)!==0;if(!E&&ee===te&&pe)throw new Error("Point.fromHex: x=0 and x_0=1");return pe!==ce&&(ee=u(-ee)),g.fromAffine({x:ee,y:N})}static fromPrivateKey(y){return P(y).point}toRawBytes(){const{x:y,y:E}=this.toAffine(),_=Vt(E,r.BYTES);return _[_.length-1]|=y&X?128:0,_}toHex(){return sr(this.toRawBytes())}}g.BASE=new g(e.Gx,e.Gy,X,u(e.Gx*e.Gy)),g.ZERO=new g(te,X,X,te);const{BASE:m,ZERO:F}=g,R=Qs(g,c*8);function O(v){return W(v,n)}function B(v){return O(ot(v))}function P(v){const y=r.BYTES;v=se("private key",v,y);const E=se("hashed private key",o(v),2*y),_=w(E.slice(0,y)),U=E.slice(y,2*y),I=B(_),T=m.multiply(I),k=T.toRawBytes();return{head:_,prefix:U,scalar:I,point:T,pointBytes:k}}function _e(v){return P(v).pointBytes}function ge(v=new Uint8Array,...y){const E=jr(...y);return B(o(d(E,se("context",v),!!i)))}function Se(v,y,E={}){v=se("message",v),i&&(v=i(v));const{prefix:_,scalar:U,pointBytes:I}=P(y),T=ge(E.context,_,v),k=m.multiply(T).toRawBytes(),N=ge(E.context,k,I,v),L=O(T+N*U);Re("signature.s",L,te,n);const K=jr(k,Vt(L,r.BYTES));return se("result",K,r.BYTES*2)}const Ie=na;function Et(v,y,E,_=Ie){const{context:U,zip215:I}=_,T=r.BYTES;v=se("signature",v,2*T),y=se("message",y),E=se("publicKey",E,T),I!==void 0&&Ct("zip215",I),i&&(y=i(y));const k=ot(v.slice(T,2*T));let N,L,K;try{N=g.fromHex(E,I),L=g.fromHex(v.slice(0,T),I),K=m.multiplyUnsafe(k)}catch{return!1}if(!I&&N.isSmallOrder())return!1;const J=ge(U,L.toRawBytes(),N.toRawBytes(),y);return L.add(N.multiplyUnsafe(J)).subtract(K).clearCofactor().equals(g.ZERO)}return m._setWindowSize(8),{CURVE:e,getPublicKey:_e,sign:Se,verify:Et,ExtendedPoint:g,utils:{getExtendedPublicKey:P,randomPrivateKey:()=>a(r.BYTES),precompute(v=8,y=g.BASE){return y._setWindowSize(v),y.multiply(BigInt(3)),y}}}}BigInt(0),BigInt(1);const ur=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Yr=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const sa=BigInt(1),Gr=BigInt(2);BigInt(3);const aa=BigInt(5),ua=BigInt(8);function ca(t){const e=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),o=ur,a=t*t%o*t%o,c=re(a,Gr,o)*a%o,f=re(c,sa,o)*t%o,s=re(f,aa,o)*f%o,u=re(s,e,o)*s%o,l=re(u,r,o)*u%o,h=re(l,n,o)*l%o,w=re(h,i,o)*h%o,d=re(w,i,o)*h%o,p=re(d,e,o)*s%o;return{pow_p_5_8:re(p,Gr,o)*t%o,b2:a}}function fa(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}function la(t,e){const r=ur,n=W(e*e*e,r),i=W(n*n*e,r),o=ca(t*i).pow_p_5_8;let a=W(t*n*o,r);const c=W(e*a*a,r),f=a,s=W(a*Yr,r),u=c===t,l=c===W(-t,r),h=c===W(-t*Yr,r);return u&&(a=f),(l||h)&&(a=s),Vs(a,r)&&(a=W(-a,r)),{isValid:u||l,value:a}}const ha=Nn(ur,void 0,!0),da={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:ha,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:ua,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Rs,randomBytes:Bn,adjustScalarBytes:fa,uvRatio:la},kn=oa(da),wa="EdDSA",ga="JWT",at=".",yt="base64url",Ln="utf8",zn="utf8",pa=":",ya="did",ba="key",Jr="base58btc",Da="z",ma="K36",Ea=32;function cr(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function Wn(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?cr(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function jn(t,e){e||(e=t.reduce((i,o)=>i+o.length,0));const r=Wn(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return cr(r)}function xa(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var o=t.charAt(i),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var c=t.length,f=t.charAt(0),s=Math.log(c)/Math.log(256),u=Math.log(256)/Math.log(c);function l(d){if(d instanceof Uint8Array||(ArrayBuffer.isView(d)?d=new Uint8Array(d.buffer,d.byteOffset,d.byteLength):Array.isArray(d)&&(d=Uint8Array.from(d))),!(d instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(d.length===0)return"";for(var p=0,b=0,D=0,x=d.length;D!==x&&d[D]===0;)D++,p++;for(var g=(x-D)*u+1>>>0,m=new Uint8Array(g);D!==x;){for(var F=d[D],R=0,O=g-1;(F!==0||R<b)&&O!==-1;O--,R++)F+=256*m[O]>>>0,m[O]=F%c>>>0,F=F/c>>>0;if(F!==0)throw new Error("Non-zero carry");b=R,D++}for(var B=g-b;B!==g&&m[B]===0;)B++;for(var P=f.repeat(p);B<g;++B)P+=t.charAt(m[B]);return P}function h(d){if(typeof d!="string")throw new TypeError("Expected String");if(d.length===0)return new Uint8Array;var p=0;if(d[p]!==" "){for(var b=0,D=0;d[p]===f;)b++,p++;for(var x=(d.length-p)*s+1>>>0,g=new Uint8Array(x);d[p];){var m=r[d.charCodeAt(p)];if(m===255)return;for(var F=0,R=x-1;(m!==0||F<D)&&R!==-1;R--,F++)m+=c*g[R]>>>0,g[R]=m%256>>>0,m=m/256>>>0;if(m!==0)throw new Error("Non-zero carry");D=F,p++}if(d[p]!==" "){for(var O=x-D;O!==x&&g[O]===0;)O++;for(var B=new Uint8Array(b+(x-O)),P=b;O!==x;)B[P++]=g[O++];return B}}}function w(d){var p=h(d);if(p)return p;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:h,decode:w}}var va=xa,_a=va;const Hn=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},Sa=t=>new TextEncoder().encode(t),Aa=t=>new TextDecoder().decode(t);class Fa{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Ba{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Kn(this,e)}}class Ua{constructor(e){this.decoders=e}or(e){return Kn(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Kn=(t,e)=>new Ua({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class Ca{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Fa(e,r,n),this.decoder=new Ba(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const bt=({name:t,prefix:e,encode:r,decode:n})=>new Ca(t,e,r,n),$e=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=_a(r,e);return bt({prefix:t,name:e,encode:n,decode:o=>Hn(i(o))})},Ia=(t,e,r,n)=>{const i={};for(let u=0;u<e.length;++u)i[e[u]]=u;let o=t.length;for(;t[o-1]==="=";)--o;const a=new Uint8Array(o*r/8|0);let c=0,f=0,s=0;for(let u=0;u<o;++u){const l=i[t[u]];if(l===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<r|l,c+=r,c>=8&&(c-=8,a[s++]=255&f>>c)}if(c>=r||255&f<<8-c)throw new SyntaxError("Unexpected end of data");return a},Oa=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<<r)-1;let o="",a=0,c=0;for(let f=0;f<t.length;++f)for(c=c<<8|t[f],a+=8;a>r;)a-=r,o+=e[i&c>>a];if(a&&(o+=e[i&c<<r-a]),n)for(;o.length*r&7;)o+="=";return o},V=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>bt({prefix:e,name:t,encode(i){return Oa(i,n,r)},decode(i){return Ia(i,n,r,t)}}),Ta=bt({prefix:"\0",name:"identity",encode:t=>Aa(t),decode:t=>Sa(t)});var Ra=Object.freeze({__proto__:null,identity:Ta});const Na=V({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Ma=Object.freeze({__proto__:null,base2:Na});const Pa=V({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var ka=Object.freeze({__proto__:null,base8:Pa});const La=$e({prefix:"9",name:"base10",alphabet:"0123456789"});var za=Object.freeze({__proto__:null,base10:La});const Wa=V({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ja=V({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ha=Object.freeze({__proto__:null,base16:Wa,base16upper:ja});const Ka=V({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),$a=V({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Va=V({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),qa=V({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Ya=V({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Ga=V({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Ja=V({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Xa=V({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Za=V({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Qa=Object.freeze({__proto__:null,base32:Ka,base32upper:$a,base32pad:Va,base32padupper:qa,base32hex:Ya,base32hexupper:Ga,base32hexpad:Ja,base32hexpadupper:Xa,base32z:Za});const eu=$e({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),tu=$e({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var ru=Object.freeze({__proto__:null,base36:eu,base36upper:tu});const nu=$e({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),iu=$e({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var ou=Object.freeze({__proto__:null,base58btc:nu,base58flickr:iu});const su=V({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),au=V({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),uu=V({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),cu=V({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var fu=Object.freeze({__proto__:null,base64:su,base64pad:au,base64url:uu,base64urlpad:cu});const $n=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),lu=$n.reduce((t,e,r)=>(t[r]=e,t),[]),hu=$n.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function du(t){return t.reduce((e,r)=>(e+=lu[r],e),"")}function wu(t){const e=[];for(const r of t){const n=hu[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const gu=bt({prefix:"🚀",name:"base256emoji",encode:du,decode:wu});var pu=Object.freeze({__proto__:null,base256emoji:gu}),yu=Vn,Xr=128,bu=-128,Du=Math.pow(2,31);function Vn(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Du;)e[r++]=t&255|Xr,t/=128;for(;t&bu;)e[r++]=t&255|Xr,t>>>=7;return e[r]=t|0,Vn.bytes=r-n+1,e}var mu=Yt,Eu=128,Zr=127;function Yt(t,n){var r=0,n=n||0,i=0,o=n,a,c=t.length;do{if(o>=c)throw Yt.bytes=0,new RangeError("Could not decode varint");a=t[o++],r+=i<28?(a&Zr)<<i:(a&Zr)*Math.pow(2,i),i+=7}while(a>=Eu);return Yt.bytes=o-n,r}var xu=Math.pow(2,7),vu=Math.pow(2,14),_u=Math.pow(2,21),Su=Math.pow(2,28),Au=Math.pow(2,35),Fu=Math.pow(2,42),Bu=Math.pow(2,49),Uu=Math.pow(2,56),Cu=Math.pow(2,63),Iu=function(t){return t<xu?1:t<vu?2:t<_u?3:t<Su?4:t<Au?5:t<Fu?6:t<Bu?7:t<Uu?8:t<Cu?9:10},Ou={encode:yu,decode:mu,encodingLength:Iu},qn=Ou;const Qr=(t,e,r=0)=>(qn.encode(t,e,r),e),en=t=>qn.encodingLength(t),Gt=(t,e)=>{const r=e.byteLength,n=en(t),i=n+en(r),o=new Uint8Array(i+r);return Qr(t,o,0),Qr(r,o,n),o.set(e,i),new Tu(t,r,e,o)};class Tu{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const Yn=({name:t,code:e,encode:r})=>new Ru(t,e,r);class Ru{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?Gt(this.code,r):r.then(n=>Gt(this.code,n))}else throw Error("Unknown type, must be binary type")}}const Gn=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Nu=Yn({name:"sha2-256",code:18,encode:Gn("SHA-256")}),Mu=Yn({name:"sha2-512",code:19,encode:Gn("SHA-512")});var Pu=Object.freeze({__proto__:null,sha256:Nu,sha512:Mu});const Jn=0,ku="identity",Xn=Hn,Lu=t=>Gt(Jn,Xn(t)),zu={code:Jn,name:ku,encode:Xn,digest:Lu};var Wu=Object.freeze({__proto__:null,identity:zu});new TextEncoder,new TextDecoder;const tn={...Ra,...Ma,...ka,...za,...Ha,...Qa,...ru,...ou,...fu,...pu};({...Pu,...Wu});function Zn(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const rn=Zn("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Mt=Zn("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=Wn(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Qn={utf8:rn,"utf-8":rn,hex:tn.base16,latin1:Mt,ascii:Mt,binary:Mt,...tn};function Dt(t,e="utf8"){const r=Qn[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}function Ue(t,e="utf8"){const r=Qn[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?cr(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}function nn(t){return dt(Dt(Ue(t,yt),Ln))}function ut(t){return Dt(Ue(wt(t),Ln),yt)}function ju(t){const e=Ue(ma,Jr),r=Da+Dt(jn([e,t]),Jr);return[ya,ba,r].join(pa)}function Hu(t){return Dt(t,yt)}function Ku(t){return Ue(t,yt)}function $u(t){return Ue([ut(t.header),ut(t.payload)].join(at),zn)}function Vu(t){return[ut(t.header),ut(t.payload),Hu(t.signature)].join(at)}function bh(t){const e=t.split(at),r=nn(e[0]),n=nn(e[1]),i=Ku(e[2]),o=Ue(e.slice(0,2).join(at),zn);return{header:r,payload:n,signature:i,data:o}}function Dh(t=Bn(Ea)){const e=kn.getPublicKey(t);return{secretKey:jn([t,e]),publicKey:e}}async function mh(t,e,r,n,i=gt.fromMiliseconds(Date.now())){const o={alg:wa,typ:ga},a=ju(n.publicKey),c=i+r,f={iss:a,sub:t,aud:e,iat:i,exp:c},s=$u({header:o,payload:f}),u=kn.sign(s,n.secretKey.slice(0,32));return Vu({header:o,payload:f,signature:u})}var on=function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))},qu=function(){function t(e,r,n){this.name=e,this.version=r,this.os=n,this.type="browser"}return t}(),Yu=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=Ee.platform}return t}(),Gu=function(){function t(e,r,n,i){this.name=e,this.version=r,this.os=n,this.bot=i,this.type="bot-device"}return t}(),Ju=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),Xu=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),Zu=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,Qu=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,sn=3,ec=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",Zu]],an=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function Eh(t){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Xu:typeof navigator<"u"?rc(navigator.userAgent):ic()}function tc(t){return t!==""&&ec.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var o=i.exec(t);return!!o&&[n,o]},!1)}function rc(t){var e=tc(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new Ju;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<sn&&(i=on(on([],i,!0),oc(sn-i.length),!0)):i=[];var o=i.join("."),a=nc(t),c=Qu.exec(t);return c&&c[1]?new Gu(r,o,a,c[1]):new qu(r,o,a)}function nc(t){for(var e=0,r=an.length;e<r;e++){var n=an[e],i=n[0],o=n[1],a=o.exec(t);if(a)return i}return null}function ic(){var t=typeof Ee<"u"&&Ee.version;return t?new Yu(Ee.version.slice(1)):null}function oc(t){for(var e=[],r=0;r<t;r++)e.push("0");return e}var M={};Object.defineProperty(M,"__esModule",{value:!0});M.getLocalStorage=M.getLocalStorageOrThrow=M.getCrypto=M.getCryptoOrThrow=wc=M.getLocation=M.getLocationOrThrow=lc=M.getNavigator=M.getNavigatorOrThrow=uc=M.getDocument=M.getDocumentOrThrow=M.getFromWindowOrThrow=M.getFromWindow=void 0;function ve(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}M.getFromWindow=ve;function Ce(t){const e=ve(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}M.getFromWindowOrThrow=Ce;function sc(){return Ce("document")}M.getDocumentOrThrow=sc;function ac(){return ve("document")}var uc=M.getDocument=ac;function cc(){return Ce("navigator")}M.getNavigatorOrThrow=cc;function fc(){return ve("navigator")}var lc=M.getNavigator=fc;function hc(){return Ce("location")}M.getLocationOrThrow=hc;function dc(){return ve("location")}var wc=M.getLocation=dc;function gc(){return Ce("crypto")}M.getCryptoOrThrow=gc;function pc(){return ve("crypto")}M.getCrypto=pc;function yc(){return Ce("localStorage")}M.getLocalStorageOrThrow=yc;function bc(){return ve("localStorage")}M.getLocalStorage=bc;var fr={};Object.defineProperty(fr,"__esModule",{value:!0});var Dc=fr.getWindowMetadata=void 0;const un=M;function mc(){let t,e;try{t=un.getDocumentOrThrow(),e=un.getLocationOrThrow()}catch{return null}function r(){const l=t.getElementsByTagName("link"),h=[];for(let w=0;w<l.length;w++){const d=l[w],p=d.getAttribute("rel");if(p&&p.toLowerCase().indexOf("icon")>-1){const b=d.getAttribute("href");if(b)if(b.toLowerCase().indexOf("https:")===-1&&b.toLowerCase().indexOf("http:")===-1&&b.indexOf("//")!==0){let D=e.protocol+"//"+e.host;if(b.indexOf("/")===0)D+=b;else{const x=e.pathname.split("/");x.pop();const g=x.join("/");D+=g+"/"+b}h.push(D)}else if(b.indexOf("//")===0){const D=e.protocol+b;h.push(D)}else h.push(b)}}return h}function n(...l){const h=t.getElementsByTagName("meta");for(let w=0;w<h.length;w++){const d=h[w],p=["itemprop","property","name"].map(b=>d.getAttribute(b)).filter(b=>b?l.includes(b):!1);if(p.length&&p){const b=d.getAttribute("content");if(b)return b}}return""}function i(){let l=n("name","og:site_name","og:title","twitter:title");return l||(l=t.title),l}function o(){return n("description","og:description","twitter:description","keywords")}const a=i(),c=o(),f=e.origin,s=r();return{description:c,url:f,icons:s,name:a}}Dc=fr.getWindowMetadata=mc;/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ec(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function ei(t,e){return Array.isArray(e)?e.length===0?!0:t?e.every(r=>typeof r=="string"):e.every(r=>Number.isSafeInteger(r)):!1}function ct(t,e){if(typeof e!="string")throw new Error(`${t}: string expected`);return!0}function lr(t){if(!Number.isSafeInteger(t))throw new Error(`invalid integer: ${t}`)}function Jt(t){if(!Array.isArray(t))throw new Error("array expected")}function ft(t,e){if(!ei(!0,e))throw new Error(`${t}: array of strings expected`)}function xc(t,e){if(!ei(!1,e))throw new Error(`${t}: array of numbers expected`)}function vc(...t){const e=o=>o,r=(o,a)=>c=>o(a(c)),n=t.map(o=>o.encode).reduceRight(r,e),i=t.map(o=>o.decode).reduce(r,e);return{encode:n,decode:i}}function _c(t){const e=typeof t=="string"?t.split(""):t,r=e.length;ft("alphabet",e);const n=new Map(e.map((i,o)=>[i,o]));return{encode:i=>(Jt(i),i.map(o=>{if(!Number.isSafeInteger(o)||o<0||o>=r)throw new Error(`alphabet.encode: digit index outside alphabet "${o}". Allowed: ${t}`);return e[o]})),decode:i=>(Jt(i),i.map(o=>{ct("alphabet.decode",o);const a=n.get(o);if(a===void 0)throw new Error(`Unknown letter: "${o}". Allowed: ${t}`);return a}))}}function Sc(t=""){return ct("join",t),{encode:e=>(ft("join.decode",e),e.join(t)),decode:e=>(ct("join.decode",e),e.split(t))}}function Ac(t,e="="){return lr(t),ct("padding",e),{encode(r){for(ft("padding.encode",r);r.length*t%8;)r.push(e);return r},decode(r){ft("padding.decode",r);let n=r.length;if(n*t%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;n>0&&r[n-1]===e;n--)if((n-1)*t%8===0)throw new Error("padding: invalid, string has too much padding");return r.slice(0,n)}}}const ti=(t,e)=>e===0?t:ti(e,t%e),lt=(t,e)=>t+(e-ti(t,e)),Pt=(()=>{let t=[];for(let e=0;e<40;e++)t.push(2**e);return t})();function cn(t,e,r,n){if(Jt(t),e<=0||e>32)throw new Error(`convertRadix2: wrong from=${e}`);if(r<=0||r>32)throw new Error(`convertRadix2: wrong to=${r}`);if(lt(e,r)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${r} carryBits=${lt(e,r)}`);let i=0,o=0;const a=Pt[e],c=Pt[r]-1,f=[];for(const s of t){if(lr(s),s>=a)throw new Error(`convertRadix2: invalid data word=${s} from=${e}`);if(i=i<<e|s,o+e>32)throw new Error(`convertRadix2: carry overflow pos=${o} from=${e}`);for(o+=e;o>=r;o-=r)f.push((i>>o-r&c)>>>0);const u=Pt[o];if(u===void 0)throw new Error("invalid carry");i&=u-1}if(i=i<<r-o&c,!n&&o>=e)throw new Error("Excess padding");if(!n&&i>0)throw new Error(`Non-zero padding: ${i}`);return n&&o>0&&f.push(i>>>0),f}function Fc(t,e=!1){if(lr(t),t<=0||t>32)throw new Error("radix2: bits should be in (0..32]");if(lt(8,t)>32||lt(t,8)>32)throw new Error("radix2: carry overflow");return{encode:r=>{if(!Ec(r))throw new Error("radix2.encode input should be Uint8Array");return cn(Array.from(r),8,t,!e)},decode:r=>(xc("radix2.decode",r),Uint8Array.from(cn(r,t,8,e)))}}const xh=vc(Fc(5),_c("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),Ac(5),Sc(""));function Bc(t){if(t.length>=255)throw new TypeError("Alphabet too long");const e=new Uint8Array(256);for(let s=0;s<e.length;s++)e[s]=255;for(let s=0;s<t.length;s++){const u=t.charAt(s),l=u.charCodeAt(0);if(e[l]!==255)throw new TypeError(u+" is ambiguous");e[l]=s}const r=t.length,n=t.charAt(0),i=Math.log(r)/Math.log(256),o=Math.log(256)/Math.log(r);function a(s){if(s instanceof Uint8Array||(ArrayBuffer.isView(s)?s=new Uint8Array(s.buffer,s.byteOffset,s.byteLength):Array.isArray(s)&&(s=Uint8Array.from(s))),!(s instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(s.length===0)return"";let u=0,l=0,h=0;const w=s.length;for(;h!==w&&s[h]===0;)h++,u++;const d=(w-h)*o+1>>>0,p=new Uint8Array(d);for(;h!==w;){let x=s[h],g=0;for(let m=d-1;(x!==0||g<l)&&m!==-1;m--,g++)x+=256*p[m]>>>0,p[m]=x%r>>>0,x=x/r>>>0;if(x!==0)throw new Error("Non-zero carry");l=g,h++}let b=d-l;for(;b!==d&&p[b]===0;)b++;let D=n.repeat(u);for(;b<d;++b)D+=t.charAt(p[b]);return D}function c(s){if(typeof s!="string")throw new TypeError("Expected String");if(s.length===0)return new Uint8Array;let u=0,l=0,h=0;for(;s[u]===n;)l++,u++;const w=(s.length-u)*i+1>>>0,d=new Uint8Array(w);for(;u<s.length;){const x=s.charCodeAt(u);if(x>255)return;let g=e[x];if(g===255)return;let m=0;for(let F=w-1;(g!==0||m<h)&&F!==-1;F--,m++)g+=r*d[F]>>>0,d[F]=g%256>>>0,g=g/256>>>0;if(g!==0)throw new Error("Non-zero carry");h=m,u++}let p=w-h;for(;p!==w&&d[p]===0;)p++;const b=new Uint8Array(l+(w-p));let D=l;for(;p!==w;)b[D++]=d[p++];return b}function f(s){const u=c(s);if(u)return u;throw new Error("Non-base"+r+" character")}return{encode:a,decodeUnsafe:c,decode:f}}var Uc="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const vh=Bc(Uc);function Cc(t){const e=t.length;let r=0,n=0;for(;n<e;){let i=t.charCodeAt(n++);if(i&4294967168)if(!(i&4294965248))r+=2;else{if(i>=55296&&i<=56319&&n<e){const o=t.charCodeAt(n);(o&64512)===56320&&(++n,i=((i&1023)<<10)+(o&1023)+65536)}i&4294901760?r+=4:r+=3}else{r++;continue}}return r}function Ic(t,e,r){const n=t.length;let i=r,o=0;for(;o<n;){let a=t.charCodeAt(o++);if(a&4294967168)if(!(a&4294965248))e[i++]=a>>6&31|192;else{if(a>=55296&&a<=56319&&o<n){const c=t.charCodeAt(o);(c&64512)===56320&&(++o,a=((a&1023)<<10)+(c&1023)+65536)}a&4294901760?(e[i++]=a>>18&7|240,e[i++]=a>>12&63|128,e[i++]=a>>6&63|128):(e[i++]=a>>12&15|224,e[i++]=a>>6&63|128)}else{e[i++]=a;continue}e[i++]=a&63|128}}const Oc=new TextEncoder,Tc=50;function Rc(t,e,r){Oc.encodeInto(t,e.subarray(r))}function Nc(t,e,r){t.length>Tc?Rc(t,e,r):Ic(t,e,r)}const Mc=4096;function ri(t,e,r){let n=e;const i=n+r,o=[];let a="";for(;n<i;){const c=t[n++];if(!(c&128))o.push(c);else if((c&224)===192){const f=t[n++]&63;o.push((c&31)<<6|f)}else if((c&240)===224){const f=t[n++]&63,s=t[n++]&63;o.push((c&31)<<12|f<<6|s)}else if((c&248)===240){const f=t[n++]&63,s=t[n++]&63,u=t[n++]&63;let l=(c&7)<<18|f<<12|s<<6|u;l>65535&&(l-=65536,o.push(l>>>10&1023|55296),l=56320|l&1023),o.push(l)}else o.push(c);o.length>=Mc&&(a+=String.fromCharCode(...o),o.length=0)}return o.length>0&&(a+=String.fromCharCode(...o)),a}const Pc=new TextDecoder,kc=200;function Lc(t,e,r){const n=t.subarray(e,e+r);return Pc.decode(n)}function zc(t,e,r){return r>kc?Lc(t,e,r):ri(t,e,r)}class Qe{constructor(e,r){this.type=e,this.data=r}}class Q extends Error{constructor(e){super(e);const r=Object.create(Q.prototype);Object.setPrototypeOf(this,r),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:Q.name})}}const Ne=4294967295;function Wc(t,e,r){const n=r/4294967296,i=r;t.setUint32(e,n),t.setUint32(e+4,i)}function ni(t,e,r){const n=Math.floor(r/4294967296),i=r;t.setUint32(e,n),t.setUint32(e+4,i)}function ii(t,e){const r=t.getInt32(e),n=t.getUint32(e+4);return r*4294967296+n}function jc(t,e){const r=t.getUint32(e),n=t.getUint32(e+4);return r*4294967296+n}const Hc=-1,Kc=4294967296-1,$c=17179869184-1;function Vc({sec:t,nsec:e}){if(t>=0&&e>=0&&t<=$c)if(e===0&&t<=Kc){const r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t),r}else{const r=t/4294967296,n=t&4294967295,i=new Uint8Array(8),o=new DataView(i.buffer);return o.setUint32(0,e<<2|r&3),o.setUint32(4,n),i}else{const r=new Uint8Array(12),n=new DataView(r.buffer);return n.setUint32(0,e),ni(n,4,t),r}}function qc(t){const e=t.getTime(),r=Math.floor(e/1e3),n=(e-r*1e3)*1e6,i=Math.floor(n/1e9);return{sec:r+i,nsec:n-i*1e9}}function Yc(t){if(t instanceof Date){const e=qc(t);return Vc(e)}else return null}function Gc(t){const e=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 4:return{sec:e.getUint32(0),nsec:0};case 8:{const r=e.getUint32(0),n=e.getUint32(4),i=(r&3)*4294967296+n,o=r>>>2;return{sec:i,nsec:o}}case 12:{const r=ii(e,4),n=e.getUint32(0);return{sec:r,nsec:n}}default:throw new Q(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${t.length}`)}}function Jc(t){const e=Gc(t);return new Date(e.sec*1e3+e.nsec/1e6)}const Xc={type:Hc,encode:Yc,decode:Jc};class ht{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Xc)}register({type:e,encode:r,decode:n}){if(e>=0)this.encoders[e]=r,this.decoders[e]=n;else{const i=-1-e;this.builtInEncoders[i]=r,this.builtInDecoders[i]=n}}tryToEncode(e,r){for(let n=0;n<this.builtInEncoders.length;n++){const i=this.builtInEncoders[n];if(i!=null){const o=i(e,r);if(o!=null){const a=-1-n;return new Qe(a,o)}}}for(let n=0;n<this.encoders.length;n++){const i=this.encoders[n];if(i!=null){const o=i(e,r);if(o!=null){const a=n;return new Qe(a,o)}}}return e instanceof Qe?e:null}decode(e,r,n){const i=r<0?this.builtInDecoders[-1-r]:this.decoders[r];return i?i(e,r,n):new Qe(r,e)}}ht.defaultCodec=new ht;function Zc(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}function Xt(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Zc(t)?new Uint8Array(t):Uint8Array.from(t)}const Qc=100,ef=2048;let tf=class oi{constructor(e){this.entered=!1,this.extensionCodec=(e==null?void 0:e.extensionCodec)??ht.defaultCodec,this.context=e==null?void 0:e.context,this.useBigInt64=(e==null?void 0:e.useBigInt64)??!1,this.maxDepth=(e==null?void 0:e.maxDepth)??Qc,this.initialBufferSize=(e==null?void 0:e.initialBufferSize)??ef,this.sortKeys=(e==null?void 0:e.sortKeys)??!1,this.forceFloat32=(e==null?void 0:e.forceFloat32)??!1,this.ignoreUndefined=(e==null?void 0:e.ignoreUndefined)??!1,this.forceIntegerToFloat=(e==null?void 0:e.forceIntegerToFloat)??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new oi({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(e){if(this.entered)return this.clone().encodeSharedRef(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(e){if(this.entered)return this.clone().encode(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(e,r){if(r>this.maxDepth)throw new Error(`Too deep objects in depth ${r}`);e==null?this.encodeNil():typeof e=="boolean"?this.encodeBoolean(e):typeof e=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(e):this.encodeNumber(e):typeof e=="string"?this.encodeString(e):this.useBigInt64&&typeof e=="bigint"?this.encodeBigInt64(e):this.encodeObject(e,r)}ensureBufferSizeToWrite(e){const r=this.pos+e;this.view.byteLength<r&&this.resizeBuffer(r*2)}resizeBuffer(e){const r=new ArrayBuffer(e),n=new Uint8Array(r),i=new DataView(r);n.set(this.bytes),this.view=i,this.bytes=n}encodeNil(){this.writeU8(192)}encodeBoolean(e){e===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(e){!this.forceIntegerToFloat&&Number.isSafeInteger(e)?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(211),this.writeI64(e)):this.encodeNumberAsFloat(e)}encodeNumberAsFloat(e){this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))}encodeBigInt64(e){e>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(e)):(this.writeU8(211),this.writeBigInt64(e))}writeStringHeader(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else if(e<4294967296)this.writeU8(219),this.writeU32(e);else throw new Error(`Too long string: ${e} bytes in UTF-8`)}encodeString(e){const n=Cc(e);this.ensureBufferSizeToWrite(5+n),this.writeStringHeader(n),Nc(e,this.bytes,this.pos),this.pos+=n}encodeObject(e,r){const n=this.extensionCodec.tryToEncode(e,this.context);if(n!=null)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,r);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else if(typeof e=="object")this.encodeMap(e,r);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(e)}`)}encodeBinary(e){const r=e.byteLength;if(r<256)this.writeU8(196),this.writeU8(r);else if(r<65536)this.writeU8(197),this.writeU16(r);else if(r<4294967296)this.writeU8(198),this.writeU32(r);else throw new Error(`Too large binary: ${r}`);const n=Xt(e);this.writeU8a(n)}encodeArray(e,r){const n=e.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else if(n<4294967296)this.writeU8(221),this.writeU32(n);else throw new Error(`Too large array: ${n}`);for(const i of e)this.doEncode(i,r+1)}countWithoutUndefined(e,r){let n=0;for(const i of r)e[i]!==void 0&&n++;return n}encodeMap(e,r){const n=Object.keys(e);this.sortKeys&&n.sort();const i=this.ignoreUndefined?this.countWithoutUndefined(e,n):n.length;if(i<16)this.writeU8(128+i);else if(i<65536)this.writeU8(222),this.writeU16(i);else if(i<4294967296)this.writeU8(223),this.writeU32(i);else throw new Error(`Too large map object: ${i}`);for(const o of n){const a=e[o];this.ignoreUndefined&&a===void 0||(this.encodeString(o),this.doEncode(a,r+1))}}encodeExtension(e){if(typeof e.data=="function"){const n=e.data(this.pos+6),i=n.length;if(i>=4294967296)throw new Error(`Too large extension object: ${i}`);this.writeU8(201),this.writeU32(i),this.writeI8(e.type),this.writeU8a(n);return}const r=e.data.length;if(r===1)this.writeU8(212);else if(r===2)this.writeU8(213);else if(r===4)this.writeU8(214);else if(r===8)this.writeU8(215);else if(r===16)this.writeU8(216);else if(r<256)this.writeU8(199),this.writeU8(r);else if(r<65536)this.writeU8(200),this.writeU16(r);else if(r<4294967296)this.writeU8(201),this.writeU32(r);else throw new Error(`Too large extension object: ${r}`);this.writeI8(e.type),this.writeU8a(e.data)}writeU8(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++}writeU8a(e){const r=e.length;this.ensureBufferSizeToWrite(r),this.bytes.set(e,this.pos),this.pos+=r}writeI8(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++}writeU16(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2}writeI16(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2}writeU32(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4}writeI32(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4}writeF32(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4}writeF64(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8}writeU64(e){this.ensureBufferSizeToWrite(8),Wc(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),ni(this.view,this.pos,e),this.pos+=8}writeBigUint64(e){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,e),this.pos+=8}writeBigInt64(e){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,e),this.pos+=8}};function _h(t,e){return new tf(e).encodeSharedRef(t)}function kt(t){return`${t<0?"-":""}0x${Math.abs(t).toString(16).padStart(2,"0")}`}const rf=16,nf=16;class of{constructor(e=rf,r=nf){this.hit=0,this.miss=0,this.maxKeyLength=e,this.maxLengthPerKey=r,this.caches=[];for(let n=0;n<this.maxKeyLength;n++)this.caches.push([])}canBeCached(e){return e>0&&e<=this.maxKeyLength}find(e,r,n){const i=this.caches[n-1];e:for(const o of i){const a=o.bytes;for(let c=0;c<n;c++)if(a[c]!==e[r+c])continue e;return o.str}return null}store(e,r){const n=this.caches[e.length-1],i={bytes:e,str:r};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=i:n.push(i)}decode(e,r,n){const i=this.find(e,r,n);if(i!=null)return this.hit++,i;this.miss++;const o=ri(e,r,n),a=Uint8Array.prototype.slice.call(e,r,r+n);return this.store(a,o),o}}const Zt="array",ze="map_key",si="map_value",sf=t=>{if(typeof t=="string"||typeof t=="number")return t;throw new Q("The type of key must be string or number but "+typeof t)};class af{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){const r=this.getUninitializedStateFromPool();r.type=Zt,r.position=0,r.size=e,r.array=new Array(e)}pushMapState(e){const r=this.getUninitializedStateFromPool();r.type=ze,r.readCount=0,r.size=e,r.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const e={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(e)}return this.stack[this.stackHeadPosition]}release(e){if(this.stack[this.stackHeadPosition]!==e)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(e.type===Zt){const n=e;n.size=0,n.array=void 0,n.position=0,n.type=void 0}if(e.type===ze||e.type===si){const n=e;n.size=0,n.map=void 0,n.readCount=0,n.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const Me=-1,hr=new DataView(new ArrayBuffer(0)),uf=new Uint8Array(hr.buffer);try{hr.getInt8(0)}catch(t){if(!(t instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const fn=new RangeError("Insufficient data"),cf=new of;let ff=class ai{constructor(e){this.totalPos=0,this.pos=0,this.view=hr,this.bytes=uf,this.headByte=Me,this.stack=new af,this.entered=!1,this.extensionCodec=(e==null?void 0:e.extensionCodec)??ht.defaultCodec,this.context=e==null?void 0:e.context,this.useBigInt64=(e==null?void 0:e.useBigInt64)??!1,this.rawStrings=(e==null?void 0:e.rawStrings)??!1,this.maxStrLength=(e==null?void 0:e.maxStrLength)??Ne,this.maxBinLength=(e==null?void 0:e.maxBinLength)??Ne,this.maxArrayLength=(e==null?void 0:e.maxArrayLength)??Ne,this.maxMapLength=(e==null?void 0:e.maxMapLength)??Ne,this.maxExtLength=(e==null?void 0:e.maxExtLength)??Ne,this.keyDecoder=(e==null?void 0:e.keyDecoder)!==void 0?e.keyDecoder:cf,this.mapKeyConverter=(e==null?void 0:e.mapKeyConverter)??sf}clone(){return new ai({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=Me,this.stack.reset()}setBuffer(e){const r=Xt(e);this.bytes=r,this.view=new DataView(r.buffer,r.byteOffset,r.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===Me&&!this.hasRemaining(1))this.setBuffer(e);else{const r=this.bytes.subarray(this.pos),n=Xt(e),i=new Uint8Array(r.length+n.length);i.set(r),i.set(n,r.length),this.setBuffer(i)}}hasRemaining(e){return this.view.byteLength-this.pos>=e}createExtraByteError(e){const{view:r,pos:n}=this;return new RangeError(`Extra ${r.byteLength-n} of ${r.byteLength} byte(s) found at buffer[${e}]`)}decode(e){if(this.entered)return this.clone().decode(e);try{this.entered=!0,this.reinitializeState(),this.setBuffer(e);const r=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return r}finally{this.entered=!1}}*decodeMulti(e){if(this.entered){yield*this.clone().decodeMulti(e);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(e);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(e){if(this.entered)return this.clone().decodeAsync(e);try{this.entered=!0;let r=!1,n;for await(const c of e){if(r)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(c);try{n=this.doDecodeSync(),r=!0}catch(f){if(!(f instanceof RangeError))throw f}this.totalPos+=this.pos}if(r){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return n}const{headByte:i,pos:o,totalPos:a}=this;throw new RangeError(`Insufficient data in parsing ${kt(i)} at ${a} (${o} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(e){return this.decodeMultiAsync(e,!0)}decodeStream(e){return this.decodeMultiAsync(e,!1)}async*decodeMultiAsync(e,r){if(this.entered){yield*this.clone().decodeMultiAsync(e,r);return}try{this.entered=!0;let n=r,i=-1;for await(const o of e){if(r&&i===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(o),n&&(i=this.readArraySize(),n=!1,this.complete());try{for(;yield this.doDecodeSync(),--i!==0;);}catch(a){if(!(a instanceof RangeError))throw a}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){const e=this.readHeadByte();let r;if(e>=224)r=e-256;else if(e<192)if(e<128)r=e;else if(e<144){const i=e-128;if(i!==0){this.pushMapState(i),this.complete();continue e}else r={}}else if(e<160){const i=e-144;if(i!==0){this.pushArrayState(i),this.complete();continue e}else r=[]}else{const i=e-160;r=this.decodeString(i,0)}else if(e===192)r=null;else if(e===194)r=!1;else if(e===195)r=!0;else if(e===202)r=this.readF32();else if(e===203)r=this.readF64();else if(e===204)r=this.readU8();else if(e===205)r=this.readU16();else if(e===206)r=this.readU32();else if(e===207)this.useBigInt64?r=this.readU64AsBigInt():r=this.readU64();else if(e===208)r=this.readI8();else if(e===209)r=this.readI16();else if(e===210)r=this.readI32();else if(e===211)this.useBigInt64?r=this.readI64AsBigInt():r=this.readI64();else if(e===217){const i=this.lookU8();r=this.decodeString(i,1)}else if(e===218){const i=this.lookU16();r=this.decodeString(i,2)}else if(e===219){const i=this.lookU32();r=this.decodeString(i,4)}else if(e===220){const i=this.readU16();if(i!==0){this.pushArrayState(i),this.complete();continue e}else r=[]}else if(e===221){const i=this.readU32();if(i!==0){this.pushArrayState(i),this.complete();continue e}else r=[]}else if(e===222){const i=this.readU16();if(i!==0){this.pushMapState(i),this.complete();continue e}else r={}}else if(e===223){const i=this.readU32();if(i!==0){this.pushMapState(i),this.complete();continue e}else r={}}else if(e===196){const i=this.lookU8();r=this.decodeBinary(i,1)}else if(e===197){const i=this.lookU16();r=this.decodeBinary(i,2)}else if(e===198){const i=this.lookU32();r=this.decodeBinary(i,4)}else if(e===212)r=this.decodeExtension(1,0);else if(e===213)r=this.decodeExtension(2,0);else if(e===214)r=this.decodeExtension(4,0);else if(e===215)r=this.decodeExtension(8,0);else if(e===216)r=this.decodeExtension(16,0);else if(e===199){const i=this.lookU8();r=this.decodeExtension(i,1)}else if(e===200){const i=this.lookU16();r=this.decodeExtension(i,2)}else if(e===201){const i=this.lookU32();r=this.decodeExtension(i,4)}else throw new Q(`Unrecognized type byte: ${kt(e)}`);this.complete();const n=this.stack;for(;n.length>0;){const i=n.top();if(i.type===Zt)if(i.array[i.position]=r,i.position++,i.position===i.size)r=i.array,n.release(i);else continue e;else if(i.type===ze){if(r==="__proto__")throw new Q("The key __proto__ is not allowed");i.key=this.mapKeyConverter(r),i.type=si;continue e}else if(i.map[i.key]=r,i.readCount++,i.readCount===i.size)r=i.map,n.release(i);else{i.key=null,i.type=ze;continue e}}return r}}readHeadByte(){return this.headByte===Me&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=Me}readArraySize(){const e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:{if(e<160)return e-144;throw new Q(`Unrecognized array type byte: ${kt(e)}`)}}}pushMapState(e){if(e>this.maxMapLength)throw new Q(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new Q(`Max length exceeded: array length (${e}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(e)}decodeString(e,r){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(e,r):this.decodeBinary(e,r)}decodeUtf8String(e,r){var o;if(e>this.maxStrLength)throw new Q(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+r+e)throw fn;const n=this.pos+r;let i;return this.stateIsMapKey()&&((o=this.keyDecoder)!=null&&o.canBeCached(e))?i=this.keyDecoder.decode(this.bytes,n,e):i=zc(this.bytes,n,e),this.pos+=r+e,i}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===ze:!1}decodeBinary(e,r){if(e>this.maxBinLength)throw new Q(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+r))throw fn;const n=this.pos+r,i=this.bytes.subarray(n,n+e);return this.pos+=r+e,i}decodeExtension(e,r){if(e>this.maxExtLength)throw new Q(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);const n=this.view.getInt8(this.pos+r),i=this.decodeBinary(e,r+1);return this.extensionCodec.decode(i,n,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const e=this.view.getUint8(this.pos);return this.pos++,e}readI8(){const e=this.view.getInt8(this.pos);return this.pos++,e}readU16(){const e=this.view.getUint16(this.pos);return this.pos+=2,e}readI16(){const e=this.view.getInt16(this.pos);return this.pos+=2,e}readU32(){const e=this.view.getUint32(this.pos);return this.pos+=4,e}readI32(){const e=this.view.getInt32(this.pos);return this.pos+=4,e}readU64(){const e=jc(this.view,this.pos);return this.pos+=8,e}readI64(){const e=ii(this.view,this.pos);return this.pos+=8,e}readU64AsBigInt(){const e=this.view.getBigUint64(this.pos);return this.pos+=8,e}readI64AsBigInt(){const e=this.view.getBigInt64(this.pos);return this.pos+=8,e}readF32(){const e=this.view.getFloat32(this.pos);return this.pos+=4,e}readF64(){const e=this.view.getFloat64(this.pos);return this.pos+=8,e}};function Sh(t,e){return new ff(e).decode(t)}function dr(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function ui(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?dr(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function Ah(t,e){e||(e=t.reduce((i,o)=>i+o.length,0));const r=ui(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return dr(r)}function lf(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var o=t.charAt(i),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var c=t.length,f=t.charAt(0),s=Math.log(c)/Math.log(256),u=Math.log(256)/Math.log(c);function l(d){if(d instanceof Uint8Array||(ArrayBuffer.isView(d)?d=new Uint8Array(d.buffer,d.byteOffset,d.byteLength):Array.isArray(d)&&(d=Uint8Array.from(d))),!(d instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(d.length===0)return"";for(var p=0,b=0,D=0,x=d.length;D!==x&&d[D]===0;)D++,p++;for(var g=(x-D)*u+1>>>0,m=new Uint8Array(g);D!==x;){for(var F=d[D],R=0,O=g-1;(F!==0||R<b)&&O!==-1;O--,R++)F+=256*m[O]>>>0,m[O]=F%c>>>0,F=F/c>>>0;if(F!==0)throw new Error("Non-zero carry");b=R,D++}for(var B=g-b;B!==g&&m[B]===0;)B++;for(var P=f.repeat(p);B<g;++B)P+=t.charAt(m[B]);return P}function h(d){if(typeof d!="string")throw new TypeError("Expected String");if(d.length===0)return new Uint8Array;var p=0;if(d[p]!==" "){for(var b=0,D=0;d[p]===f;)b++,p++;for(var x=(d.length-p)*s+1>>>0,g=new Uint8Array(x);d[p];){var m=r[d.charCodeAt(p)];if(m===255)return;for(var F=0,R=x-1;(m!==0||F<D)&&R!==-1;R--,F++)m+=c*g[R]>>>0,g[R]=m%256>>>0,m=m/256>>>0;if(m!==0)throw new Error("Non-zero carry");D=F,p++}if(d[p]!==" "){for(var O=x-D;O!==x&&g[O]===0;)O++;for(var B=new Uint8Array(b+(x-O)),P=b;O!==x;)B[P++]=g[O++];return B}}}function w(d){var p=h(d);if(p)return p;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:h,decode:w}}var hf=lf,df=hf;const wf=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},gf=t=>new TextEncoder().encode(t),pf=t=>new TextDecoder().decode(t);class yf{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class bf{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return ci(this,e)}}class Df{constructor(e){this.decoders=e}or(e){return ci(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const ci=(t,e)=>new Df({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class mf{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new yf(e,r,n),this.decoder=new bf(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const mt=({name:t,prefix:e,encode:r,decode:n})=>new mf(t,e,r,n),Ve=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=df(r,e);return mt({prefix:t,name:e,encode:n,decode:o=>wf(i(o))})},Ef=(t,e,r,n)=>{const i={};for(let u=0;u<e.length;++u)i[e[u]]=u;let o=t.length;for(;t[o-1]==="=";)--o;const a=new Uint8Array(o*r/8|0);let c=0,f=0,s=0;for(let u=0;u<o;++u){const l=i[t[u]];if(l===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<r|l,c+=r,c>=8&&(c-=8,a[s++]=255&f>>c)}if(c>=r||255&f<<8-c)throw new SyntaxError("Unexpected end of data");return a},xf=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<<r)-1;let o="",a=0,c=0;for(let f=0;f<t.length;++f)for(c=c<<8|t[f],a+=8;a>r;)a-=r,o+=e[i&c>>a];if(a&&(o+=e[i&c<<r-a]),n)for(;o.length*r&7;)o+="=";return o},q=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>mt({prefix:e,name:t,encode(i){return xf(i,n,r)},decode(i){return Ef(i,n,r,t)}}),vf=mt({prefix:"\0",name:"identity",encode:t=>pf(t),decode:t=>gf(t)}),_f=Object.freeze(Object.defineProperty({__proto__:null,identity:vf},Symbol.toStringTag,{value:"Module"})),Sf=q({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),Af=Object.freeze(Object.defineProperty({__proto__:null,base2:Sf},Symbol.toStringTag,{value:"Module"})),Ff=q({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),Bf=Object.freeze(Object.defineProperty({__proto__:null,base8:Ff},Symbol.toStringTag,{value:"Module"})),Uf=Ve({prefix:"9",name:"base10",alphabet:"0123456789"}),Cf=Object.freeze(Object.defineProperty({__proto__:null,base10:Uf},Symbol.toStringTag,{value:"Module"})),If=q({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Of=q({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),Tf=Object.freeze(Object.defineProperty({__proto__:null,base16:If,base16upper:Of},Symbol.toStringTag,{value:"Module"})),Rf=q({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Nf=q({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Mf=q({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Pf=q({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),kf=q({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Lf=q({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),zf=q({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Wf=q({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),jf=q({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Hf=Object.freeze(Object.defineProperty({__proto__:null,base32:Rf,base32hex:kf,base32hexpad:zf,base32hexpadupper:Wf,base32hexupper:Lf,base32pad:Mf,base32padupper:Pf,base32upper:Nf,base32z:jf},Symbol.toStringTag,{value:"Module"})),Kf=Ve({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),$f=Ve({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Vf=Object.freeze(Object.defineProperty({__proto__:null,base36:Kf,base36upper:$f},Symbol.toStringTag,{value:"Module"})),qf=Ve({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Yf=Ve({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Gf=Object.freeze(Object.defineProperty({__proto__:null,base58btc:qf,base58flickr:Yf},Symbol.toStringTag,{value:"Module"})),Jf=q({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Xf=q({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Zf=q({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Qf=q({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),el=Object.freeze(Object.defineProperty({__proto__:null,base64:Jf,base64pad:Xf,base64url:Zf,base64urlpad:Qf},Symbol.toStringTag,{value:"Module"})),fi=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),tl=fi.reduce((t,e,r)=>(t[r]=e,t),[]),rl=fi.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function nl(t){return t.reduce((e,r)=>(e+=tl[r],e),"")}function il(t){const e=[];for(const r of t){const n=rl[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const ol=mt({prefix:"🚀",name:"base256emoji",encode:nl,decode:il}),sl=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:ol},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const ln={..._f,...Af,...Bf,...Cf,...Tf,...Hf,...Vf,...Gf,...el,...sl};function li(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const hn=li("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Lt=li("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=ui(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),hi={utf8:hn,"utf-8":hn,hex:ln.base16,latin1:Lt,ascii:Lt,binary:Lt,...ln};function Fh(t,e="utf8"){const r=hi[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?dr(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}function Bh(t,e="utf8"){const r=hi[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}const Uh={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}},al="Input must be an string, Buffer or Uint8Array";function ul(t){let e;if(t instanceof Uint8Array)e=t;else if(typeof t=="string")e=new TextEncoder().encode(t);else throw new Error(al);return e}function cl(t){return Array.prototype.map.call(t,function(e){return(e<16?"0":"")+e.toString(16)}).join("")}function et(t){return(4294967296+t).toString(16).substring(1)}function fl(t,e,r){let n=`
|
|
15
|
-
`+t+" = ";for(let i=0;i<e.length;i+=2){if(r===32)n+=et(e[i]).toUpperCase(),n+=" ",n+=et(e[i+1]).toUpperCase();else if(r===64)n+=et(e[i+1]).toUpperCase(),n+=et(e[i]).toUpperCase();else throw new Error("Invalid size "+r);i%6===4?n+=`
|
|
16
|
-
`+new Array(t.length+4).join(" "):i<e.length-2&&(n+=" ")}console.log(n)}function ll(t,e,r){let n=new Date().getTime();const i=new Uint8Array(e);for(let a=0;a<e;a++)i[a]=a%256;const o=new Date().getTime();console.log("Generated random input in "+(o-n)+"ms"),n=o;for(let a=0;a<r;a++){const c=t(i),f=new Date().getTime(),s=f-n;n=f,console.log("Hashed in "+s+"ms: "+c.substring(0,20)+"..."),console.log(Math.round(e/(1<<20)/(s/1e3)*100)/100+" MB PER SECOND")}}var di={normalizeInput:ul,toHex:cl,debugPrint:fl,testSpeed:ll};const st=di;function tt(t,e,r){const n=t[e]+t[r];let i=t[e+1]+t[r+1];n>=4294967296&&i++,t[e]=n,t[e+1]=i}function dn(t,e,r,n){let i=t[e]+r;r<0&&(i+=4294967296);let o=t[e+1]+n;i>=4294967296&&o++,t[e]=i,t[e+1]=o}function wi(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function he(t,e,r,n,i,o){const a=Le[i],c=Le[i+1],f=Le[o],s=Le[o+1];tt(S,t,e),dn(S,t,a,c);let u=S[n]^S[t],l=S[n+1]^S[t+1];S[n]=l,S[n+1]=u,tt(S,r,n),u=S[e]^S[r],l=S[e+1]^S[r+1],S[e]=u>>>24^l<<8,S[e+1]=l>>>24^u<<8,tt(S,t,e),dn(S,t,f,s),u=S[n]^S[t],l=S[n+1]^S[t+1],S[n]=u>>>16^l<<16,S[n+1]=l>>>16^u<<16,tt(S,r,n),u=S[e]^S[r],l=S[e+1]^S[r+1],S[e]=l>>>31^u<<1,S[e+1]=u>>>31^l<<1}const gi=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),hl=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],Y=new Uint8Array(hl.map(function(t){return t*2})),S=new Uint32Array(32),Le=new Uint32Array(32);function pi(t,e){let r=0;for(r=0;r<16;r++)S[r]=t.h[r],S[r+16]=gi[r];for(S[24]=S[24]^t.t,S[25]=S[25]^t.t/4294967296,e&&(S[28]=~S[28],S[29]=~S[29]),r=0;r<32;r++)Le[r]=wi(t.b,4*r);for(r=0;r<12;r++)he(0,8,16,24,Y[r*16+0],Y[r*16+1]),he(2,10,18,26,Y[r*16+2],Y[r*16+3]),he(4,12,20,28,Y[r*16+4],Y[r*16+5]),he(6,14,22,30,Y[r*16+6],Y[r*16+7]),he(0,10,20,30,Y[r*16+8],Y[r*16+9]),he(2,12,22,24,Y[r*16+10],Y[r*16+11]),he(4,14,16,26,Y[r*16+12],Y[r*16+13]),he(6,8,18,28,Y[r*16+14],Y[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^S[r]^S[r+16]}const de=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function yi(t,e,r,n){if(t===0||t>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(e&&e.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");if(r&&r.length!==16)throw new Error("Illegal salt, expected Uint8Array with length is 16");if(n&&n.length!==16)throw new Error("Illegal personal, expected Uint8Array with length is 16");const i={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:t};de.fill(0),de[0]=t,e&&(de[1]=e.length),de[2]=1,de[3]=1,r&&de.set(r,32),n&&de.set(n,48);for(let o=0;o<16;o++)i.h[o]=gi[o]^wi(de,o*4);return e&&(wr(i,e),i.c=128),i}function wr(t,e){for(let r=0;r<e.length;r++)t.c===128&&(t.t+=t.c,pi(t,!1),t.c=0),t.b[t.c++]=e[r]}function bi(t){for(t.t+=t.c;t.c<128;)t.b[t.c++]=0;pi(t,!0);const e=new Uint8Array(t.outlen);for(let r=0;r<t.outlen;r++)e[r]=t.h[r>>2]>>8*(r&3);return e}function Di(t,e,r,n,i){r=r||64,t=st.normalizeInput(t),n&&(n=st.normalizeInput(n)),i&&(i=st.normalizeInput(i));const o=yi(r,e,n,i);return wr(o,t),bi(o)}function dl(t,e,r,n,i){const o=Di(t,e,r,n,i);return st.toHex(o)}var wl={blake2b:Di,blake2bHex:dl,blake2bInit:yi,blake2bUpdate:wr,blake2bFinal:bi};const mi=di;function gl(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function we(t,e,r,n,i,o){C[t]=C[t]+C[e]+i,C[n]=rt(C[n]^C[t],16),C[r]=C[r]+C[n],C[e]=rt(C[e]^C[r],12),C[t]=C[t]+C[e]+o,C[n]=rt(C[n]^C[t],8),C[r]=C[r]+C[n],C[e]=rt(C[e]^C[r],7)}function rt(t,e){return t>>>e^t<<32-e}const Ei=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),G=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),C=new Uint32Array(16),$=new Uint32Array(16);function xi(t,e){let r=0;for(r=0;r<8;r++)C[r]=t.h[r],C[r+8]=Ei[r];for(C[12]^=t.t,C[13]^=t.t/4294967296,e&&(C[14]=~C[14]),r=0;r<16;r++)$[r]=gl(t.b,4*r);for(r=0;r<10;r++)we(0,4,8,12,$[G[r*16+0]],$[G[r*16+1]]),we(1,5,9,13,$[G[r*16+2]],$[G[r*16+3]]),we(2,6,10,14,$[G[r*16+4]],$[G[r*16+5]]),we(3,7,11,15,$[G[r*16+6]],$[G[r*16+7]]),we(0,5,10,15,$[G[r*16+8]],$[G[r*16+9]]),we(1,6,11,12,$[G[r*16+10]],$[G[r*16+11]]),we(2,7,8,13,$[G[r*16+12]],$[G[r*16+13]]),we(3,4,9,14,$[G[r*16+14]],$[G[r*16+15]]);for(r=0;r<8;r++)t.h[r]^=C[r]^C[r+8]}function vi(t,e){if(!(t>0&&t<=32))throw new Error("Incorrect output length, should be in [1, 32]");const r=e?e.length:0;if(e&&!(r>0&&r<=32))throw new Error("Incorrect key length, should be in [1, 32]");const n={h:new Uint32Array(Ei),b:new Uint8Array(64),c:0,t:0,outlen:t};return n.h[0]^=16842752^r<<8^t,r>0&&(gr(n,e),n.c=64),n}function gr(t,e){for(let r=0;r<e.length;r++)t.c===64&&(t.t+=t.c,xi(t,!1),t.c=0),t.b[t.c++]=e[r]}function _i(t){for(t.t+=t.c;t.c<64;)t.b[t.c++]=0;xi(t,!0);const e=new Uint8Array(t.outlen);for(let r=0;r<t.outlen;r++)e[r]=t.h[r>>2]>>8*(r&3)&255;return e}function Si(t,e,r){r=r||32,t=mi.normalizeInput(t);const n=vi(r,e);return gr(n,t),_i(n)}function pl(t,e,r){const n=Si(t,e,r);return mi.toHex(n)}var yl={blake2s:Si,blake2sHex:pl,blake2sInit:vi,blake2sUpdate:gr,blake2sFinal:_i};const Pe=wl,ke=yl;var Ch={blake2b:Pe.blake2b,blake2bHex:Pe.blake2bHex,blake2bInit:Pe.blake2bInit,blake2bUpdate:Pe.blake2bUpdate,blake2bFinal:Pe.blake2bFinal,blake2s:ke.blake2s,blake2sHex:ke.blake2sHex,blake2sInit:ke.blake2sInit,blake2sUpdate:ke.blake2sUpdate,blake2sFinal:ke.blake2sFinal};const bl="PARSE_ERROR",Dl="INVALID_REQUEST",ml="METHOD_NOT_FOUND",El="INVALID_PARAMS",Ai="INTERNAL_ERROR",pr="SERVER_ERROR",xl=[-32700,-32600,-32601,-32602,-32603],We={[bl]:{code:-32700,message:"Parse error"},[Dl]:{code:-32600,message:"Invalid Request"},[ml]:{code:-32601,message:"Method not found"},[El]:{code:-32602,message:"Invalid params"},[Ai]:{code:-32603,message:"Internal error"},[pr]:{code:-32e3,message:"Server error"}},Fi=pr;function vl(t){return xl.includes(t)}function wn(t){return Object.keys(We).includes(t)?We[t]:We[Fi]}function _l(t){const e=Object.values(We).find(r=>r.code===t);return e||We[Fi]}function Sl(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var Bi={};/*! *****************************************************************************
|
|
17
|
-
Copyright (c) Microsoft Corporation.
|
|
18
|
-
|
|
19
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
20
|
-
purpose with or without fee is hereby granted.
|
|
21
|
-
|
|
22
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
23
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
24
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
25
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
26
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
27
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
28
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
29
|
-
***************************************************************************** */var Qt=function(t,e){return Qt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Qt(t,e)};function Al(t,e){Qt(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var er=function(){return er=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},er.apply(this,arguments)};function Fl(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function Bl(t,e,r,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,r,n);else for(var c=t.length-1;c>=0;c--)(a=t[c])&&(o=(i<3?a(o):i>3?a(e,r,o):a(e,r))||o);return i>3&&o&&Object.defineProperty(e,r,o),o}function Ul(t,e){return function(r,n){e(r,n,t)}}function Cl(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Il(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function c(u){try{s(n.next(u))}catch(l){a(l)}}function f(u){try{s(n.throw(u))}catch(l){a(l)}}function s(u){u.done?o(u.value):i(u.value).then(c,f)}s((n=n.apply(t,e||[])).next())})}function Ol(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(s){return function(u){return f([s,u])}}function f(s){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=s[0]&2?i.return:s[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;switch(i=0,o&&(s=[s[0]&2,o.value]),s[0]){case 0:case 1:o=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,i=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(s[0]===6&&r.label<o[1]){r.label=o[1],o=s;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(s);break}o[2]&&r.ops.pop(),r.trys.pop();continue}s=e.call(t,r)}catch(u){s=[6,u],i=0}finally{n=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function Tl(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function Rl(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function tr(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ui(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){a={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o}function Nl(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Ui(arguments[e]));return t}function Ml(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var o=arguments[e],a=0,c=o.length;a<c;a++,i++)n[i]=o[a];return n}function He(t){return this instanceof He?(this.v=t,this):new He(t)}function Pl(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,o=[];return i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i;function a(h){n[h]&&(i[h]=function(w){return new Promise(function(d,p){o.push([h,w,d,p])>1||c(h,w)})})}function c(h,w){try{f(n[h](w))}catch(d){l(o[0][3],d)}}function f(h){h.value instanceof He?Promise.resolve(h.value.v).then(s,u):l(o[0][2],h)}function s(h){c("next",h)}function u(h){c("throw",h)}function l(h,w){h(w),o.shift(),o.length&&c(o[0][0],o[0][1])}}function kl(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,o){e[i]=t[i]?function(a){return(r=!r)?{value:He(t[i](a)),done:i==="return"}:o?o(a):a}:o}}function Ll(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof tr=="function"?tr(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=t[o]&&function(a){return new Promise(function(c,f){a=t[o](a),i(c,f,a.done,a.value)})}}function i(o,a,c,f){Promise.resolve(f).then(function(s){o({value:s,done:c})},a)}}function zl(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Wl(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function jl(t){return t&&t.__esModule?t:{default:t}}function Hl(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function Kl(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const $l=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return er},__asyncDelegator:kl,__asyncGenerator:Pl,__asyncValues:Ll,__await:He,__awaiter:Il,__classPrivateFieldGet:Hl,__classPrivateFieldSet:Kl,__createBinding:Tl,__decorate:Bl,__exportStar:Rl,__extends:Al,__generator:Ol,__importDefault:jl,__importStar:Wl,__makeTemplateObject:zl,__metadata:Cl,__param:Ul,__read:Ui,__rest:Fl,__spread:Nl,__spreadArrays:Ml,__values:tr},Symbol.toStringTag,{value:"Module"})),Vl=En($l);var ae={},gn;function ql(){if(gn)return ae;gn=1,Object.defineProperty(ae,"__esModule",{value:!0}),ae.isBrowserCryptoAvailable=ae.getSubtleCrypto=ae.getBrowerCrypto=void 0;function t(){return(Ae===null||Ae===void 0?void 0:Ae.crypto)||(Ae===null||Ae===void 0?void 0:Ae.msCrypto)||{}}ae.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}ae.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return ae.isBrowserCryptoAvailable=r,ae}var ue={},pn;function Yl(){if(pn)return ue;pn=1,Object.defineProperty(ue,"__esModule",{value:!0}),ue.isBrowser=ue.isNode=ue.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}ue.isReactNative=t;function e(){return typeof Ee<"u"&&typeof Ee.versions<"u"&&typeof Ee.versions.node<"u"}ue.isNode=e;function r(){return!t()&&!e()}return ue.isBrowser=r,ue}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Vl;e.__exportStar(ql(),t),e.__exportStar(Yl(),t)})(Bi);function Ci(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function Gl(t=6){return BigInt(Ci(t))}function Jl(t,e,r){return{id:r||Ci(),jsonrpc:"2.0",method:t,params:e}}function Ih(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Xl(t,e,r){return{id:t,jsonrpc:"2.0",error:Zl(e)}}function Zl(t,e){return typeof t>"u"?wn(Ai):(typeof t=="string"&&(t=Object.assign(Object.assign({},wn(pr)),{message:t})),vl(t.code)&&(t=_l(t.code)),t)}class Ql{}class eh extends Ql{constructor(){super()}}class th extends eh{constructor(e){super()}}const rh="^https?:",nh="^wss?:";function ih(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function Ii(t,e){const r=ih(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function Oh(t){return Ii(t,rh)}function yn(t){return Ii(t,nh)}function oh(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function Oi(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function Th(t){return Oi(t)&&"method"in t}function sh(t){return Oi(t)&&(ah(t)||Ti(t))}function ah(t){return"result"in t}function Ti(t){return"error"in t}class Rh extends th{constructor(e){super(e),this.events=new rr.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(Jl(e.method,e.params||[],e.id||Gl().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(o){i(o)}this.events.on(`${e.id}`,o=>{Ti(o)?i(o.error):n(o.result)});try{await this.connection.send(e,r)}catch(o){i(o)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),sh(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}}var zt,bn;function uh(){return bn||(bn=1,zt=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}),zt}const ch=()=>typeof WebSocket<"u"?WebSocket:typeof me<"u"&&typeof me.WebSocket<"u"?me.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:uh(),fh=()=>typeof WebSocket<"u"||typeof me<"u"&&typeof me.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",Dn=t=>t.split("?")[0],mn=10,lh=ch();class Nh{constructor(e){if(this.url=e,this.events=new rr.EventEmitter,this.registering=!1,!yn(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(wt(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!yn(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",o=>{this.resetMaxListeners(),i(o)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=Bi.isReactNative()?void 0:{rejectUnauthorized:!oh(e)},o=new lh(e,[],i);fh()?o.onerror=a=>{const c=a;n(this.emitError(c.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?dt(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),o=Xl(e,i);this.events.emit("payload",o)}parseError(e,r=this.url){return Sl(e,Dn(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>mn&&this.events.setMaxListeners(mn)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${Dn(this.url)}`));return this.events.emit("register_error",r),r}}export{vo as A,Nh as B,Uh as C,Th as D,sh as E,mh as F,Gl as G,ah as H,Eo as I,Ti as J,Ci as K,Sn as L,jo as M,Ho as N,kr as O,Dh as P,ju as Q,Jl as a,dt as b,Xl as c,Fh as d,gt as e,Ih as f,Dc as g,uc as h,Oh as i,lc as j,Eh as k,wc as l,Ah as m,bh as n,Rh as o,Sl as p,dh as q,vh as r,wt as s,Bh as t,Sh as u,_h as v,xh as w,Ch as x,_n as y,ph as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{k as Tt,B as M}from"./index-Fv-acDXO.js";import{J as Mt,K as Bt,L as ot,M as J,O as Lt,Y as R,P as $t,Q as B,V as F,R as z,S as At,T as Jt}from"./ThirdwebWalletManager-C0WgXnZx.js";import{f as zt,o as g,a as Et}from"./index.es-DkH7OFeN.js";import{f as P}from"./index.es-pnQCY6-7.js";import"./store-CraP4F4Y.js";import"./webauthn.min-CGpVStYZ.js";const ct="error",Gt="wss://relay.walletconnect.org",Vt="wc",Kt="universal_provider",x=`${Vt}@2:${Kt}:`,St="https://rpc.walletconnect.org/v1/",qt="generic",Wt=`${St}bundler`,_="call_status",Yt=86400,v={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};function it(i){return i==null||typeof i!="object"&&typeof i!="function"}function Nt(i){return Object.getOwnPropertySymbols(i).filter(t=>Object.prototype.propertyIsEnumerable.call(i,t))}function Dt(i){return i==null?i===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(i)}const Qt="[object RegExp]",_t="[object String]",Rt="[object Number]",Ft="[object Boolean]",xt="[object Arguments]",Xt="[object Symbol]",Zt="[object Date]",te="[object Map]",ee="[object Set]",ie="[object Array]",se="[object ArrayBuffer]",re="[object Object]",ne="[object DataView]",ae="[object Uint8Array]",oe="[object Uint8ClampedArray]",ce="[object Uint16Array]",he="[object Uint32Array]",pe="[object Int8Array]",ue="[object Int16Array]",le="[object Int32Array]",de="[object Float32Array]",fe="[object Float64Array]";function st(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function me(i,t){return D(i,void 0,i,new Map,t)}function D(i,t,e,s=new Map,n=void 0){const a=n==null?void 0:n(i,t,e,s);if(a!=null)return a;if(it(i))return i;if(s.has(i))return s.get(i);if(Array.isArray(i)){const r=new Array(i.length);s.set(i,r);for(let o=0;o<i.length;o++)r[o]=D(i[o],o,e,s,n);return Object.hasOwn(i,"index")&&(r.index=i.index),Object.hasOwn(i,"input")&&(r.input=i.input),r}if(i instanceof Date)return new Date(i.getTime());if(i instanceof RegExp){const r=new RegExp(i.source,i.flags);return r.lastIndex=i.lastIndex,r}if(i instanceof Map){const r=new Map;s.set(i,r);for(const[o,c]of i)r.set(o,D(c,o,e,s,n));return r}if(i instanceof Set){const r=new Set;s.set(i,r);for(const o of i)r.add(D(o,void 0,e,s,n));return r}if(typeof M<"u"&&M.isBuffer(i))return i.subarray();if(st(i)){const r=new(Object.getPrototypeOf(i)).constructor(i.length);s.set(i,r);for(let o=0;o<i.length;o++)r[o]=D(i[o],o,e,s,n);return r}if(i instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&i instanceof SharedArrayBuffer)return i.slice(0);if(i instanceof DataView){const r=new DataView(i.buffer.slice(0),i.byteOffset,i.byteLength);return s.set(i,r),y(r,i,e,s,n),r}if(typeof File<"u"&&i instanceof File){const r=new File([i],i.name,{type:i.type});return s.set(i,r),y(r,i,e,s,n),r}if(i instanceof Blob){const r=new Blob([i],{type:i.type});return s.set(i,r),y(r,i,e,s,n),r}if(i instanceof Error){const r=new i.constructor;return s.set(i,r),r.message=i.message,r.name=i.name,r.stack=i.stack,r.cause=i.cause,y(r,i,e,s,n),r}if(typeof i=="object"&&ve(i)){const r=Object.create(Object.getPrototypeOf(i));return s.set(i,r),y(r,i,e,s,n),r}return i}function y(i,t,e=i,s,n){const a=[...Object.keys(t),...Nt(t)];for(let r=0;r<a.length;r++){const o=a[r],c=Object.getOwnPropertyDescriptor(i,o);(c==null||c.writable)&&(i[o]=D(t[o],o,e,s,n))}}function ve(i){switch(Dt(i)){case xt:case ie:case se:case ne:case Ft:case Zt:case de:case fe:case pe:case ue:case le:case te:case Rt:case re:case Qt:case ee:case _t:case Xt:case ae:case oe:case ce:case he:return!0;default:return!1}}function ge(i,t){return me(i,(e,s,n,a)=>{if(typeof i=="object")switch(Object.prototype.toString.call(i)){case Rt:case _t:case Ft:{const r=new i.constructor(i==null?void 0:i.valueOf());return y(r,i),r}case xt:{const r={};return y(r,i),r.length=i.length,r[Symbol.iterator]=i[Symbol.iterator],r}default:return}})}function ht(i){return ge(i)}function pt(i){return i!==null&&typeof i=="object"&&Dt(i)==="[object Arguments]"}function ut(i){return typeof i=="object"&&i!==null}function Pe(){}function we(i){return st(i)}function be(i){var e;if(typeof i!="object"||i==null)return!1;if(Object.getPrototypeOf(i)===null)return!0;if(Object.prototype.toString.call(i)!=="[object Object]"){const s=i[Symbol.toStringTag];return s==null||!((e=Object.getOwnPropertyDescriptor(i,Symbol.toStringTag))!=null&&e.writable)?!1:i.toString()===`[object ${s}]`}let t=i;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(i)===t}function ye(i){if(it(i))return i;if(Array.isArray(i)||st(i)||i instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&i instanceof SharedArrayBuffer)return i.slice(0);const t=Object.getPrototypeOf(i),e=t.constructor;if(i instanceof Date||i instanceof Map||i instanceof Set)return new e(i);if(i instanceof RegExp){const s=new e(i);return s.lastIndex=i.lastIndex,s}if(i instanceof DataView)return new e(i.buffer.slice(0));if(i instanceof Error){const s=new e(i.message);return s.stack=i.stack,s.name=i.name,s.cause=i.cause,s}if(typeof File<"u"&&i instanceof File)return new e([i],i.name,{type:i.type,lastModified:i.lastModified});if(typeof i=="object"){const s=Object.create(t);return Object.assign(s,i)}return i}function Ce(i,...t){const e=t.slice(0,-1),s=t[t.length-1];let n=i;for(let a=0;a<e.length;a++){const r=e[a];n=Z(n,r,s,new Map)}return n}function Z(i,t,e,s){if(it(i)&&(i=Object(i)),t==null||typeof t!="object")return i;if(s.has(t))return ye(s.get(t));if(s.set(t,i),Array.isArray(t)){t=t.slice();for(let a=0;a<t.length;a++)t[a]=t[a]??void 0}const n=[...Object.keys(t),...Nt(t)];for(let a=0;a<n.length;a++){const r=n[a];let o=t[r],c=i[r];if(pt(o)&&(o={...o}),pt(c)&&(c={...c}),typeof M<"u"&&M.isBuffer(o)&&(o=ht(o)),Array.isArray(o))if(typeof c=="object"&&c!=null){const l=[],h=Reflect.ownKeys(c);for(let w=0;w<h.length;w++){const d=h[w];l[d]=c[d]}c=l}else c=[];const u=e(c,o,r,i,t,s);u!=null?i[r]=u:Array.isArray(o)||ut(c)&&ut(o)?i[r]=Z(c,o,e,s):c==null&&be(o)?i[r]=Z({},o,e,s):c==null&&we(o)?i[r]=ht(o):(c===void 0||o!==void 0)&&(i[r]=o)}return i}function Ie(i,...t){return Ce(i,...t,Pe)}var Oe=Object.defineProperty,je=Object.defineProperties,He=Object.getOwnPropertyDescriptors,lt=Object.getOwnPropertySymbols,$e=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,dt=(i,t,e)=>t in i?Oe(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,U=(i,t)=>{for(var e in t||(t={}))$e.call(t,e)&&dt(i,e,t[e]);if(lt)for(var e of lt(t))Ae.call(t,e)&&dt(i,e,t[e]);return i},Ee=(i,t)=>je(i,He(t));function f(i,t,e){var s;const n=B(i);return((s=t.rpcMap)==null?void 0:s[n.reference])||`${St}?chainId=${n.namespace}:${n.reference}&projectId=${e}`}function C(i){return i.includes(":")?i.split(":")[1]:i}function Ut(i){return i.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function Se(i,t){const e=Object.keys(t.namespaces).filter(n=>n.includes(i));if(!e.length)return[];const s=[];return e.forEach(n=>{const a=t.namespaces[n].accounts;s.push(...a)}),s}function ft(i){return Object.fromEntries(Object.entries(i).filter(([t,e])=>{var s,n;return((s=e==null?void 0:e.chains)==null?void 0:s.length)&&((n=e==null?void 0:e.chains)==null?void 0:n.length)>0}))}function k(i={},t={}){const e=ft(mt(i)),s=ft(mt(t));return Ie(e,s)}function mt(i){var t,e,s,n,a;const r={};if(!F(i))return r;for(const[o,c]of Object.entries(i)){const u=$t(o)?[o]:c.chains,l=c.methods||[],h=c.events||[],w=c.rpcMap||{},d=R(o);r[d]=Ee(U(U({},r[d]),c),{chains:z(u,(t=r[d])==null?void 0:t.chains),methods:z(l,(e=r[d])==null?void 0:e.methods),events:z(h,(s=r[d])==null?void 0:s.events)}),(F(w)||F(((n=r[d])==null?void 0:n.rpcMap)||{}))&&(r[d].rpcMap=U(U({},w),(a=r[d])==null?void 0:a.rpcMap))}return r}function vt(i){return i.includes(":")?i.split(":")[2]:i}function gt(i){const t={};for(const[e,s]of Object.entries(i)){const n=s.methods||[],a=s.events||[],r=s.accounts||[],o=$t(e)?[e]:s.chains?s.chains:Ut(s.accounts);t[e]={chains:o,methods:n,events:a,accounts:r}}return t}function G(i){return typeof i=="number"?i:i.includes("0x")?parseInt(i,16):(i=i.includes(":")?i.split(":")[1]:i,isNaN(Number(i))?i:Number(i))}function qe(i){try{const t=JSON.parse(i);return typeof t=="object"&&t!==null&&!Array.isArray(t)}catch{return!1}}const kt={},p=i=>kt[i],V=(i,t)=>{kt[i]=t};var Ne=Object.defineProperty,Pt=Object.getOwnPropertySymbols,De=Object.prototype.hasOwnProperty,_e=Object.prototype.propertyIsEnumerable,wt=(i,t,e)=>t in i?Ne(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,bt=(i,t)=>{for(var e in t||(t={}))De.call(t,e)&&wt(i,e,t[e]);if(Pt)for(var e of Pt(t))_e.call(t,e)&&wt(i,e,t[e]);return i};const yt="eip155",Re=["atomic","flow-control","paymasterService","sessionKeys","auxiliaryFunds"],Fe=i=>i&&i.startsWith("0x")?BigInt(i).toString(10):i,K=i=>i&&i.startsWith("0x")?i:`0x${BigInt(i).toString(16)}`,Ct=i=>Object.keys(i).filter(t=>Re.includes(t)).reduce((t,e)=>(t[e]=xe(i[e]),t),{}),xe=i=>typeof i=="string"&&qe(i)?JSON.parse(i):i,Ue=(i,t,e)=>{const{sessionProperties:s={},scopedProperties:n={}}=i,a={};if(!F(n)&&!F(s))return;const r=Ct(s);for(const o of e){const c=Fe(o);if(!c)continue;a[K(c)]=r;const u=n==null?void 0:n[`${yt}:${c}`];if(u){const l=u==null?void 0:u[`${yt}:${c}:${t}`];a[K(c)]=bt(bt({},a[K(c)]),Ct(l||u))}}for(const[o,c]of Object.entries(a))Object.keys(c).length===0&&delete a[o];return Object.keys(a).length>0?a:void 0};var ke=Object.defineProperty,Te=(i,t,e)=>t in i?ke(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Me=(i,t,e)=>Te(i,t+"",e);let W;class rt{constructor(t){Me(this,"storage"),this.storage=t}async getItem(t){return await this.storage.getItem(t)}async setItem(t,e){return await this.storage.setItem(t,e)}async removeItem(t){return await this.storage.removeItem(t)}static getStorage(t){return W||(W=new rt(t)),W}}var Be=Object.defineProperty,Le=Object.defineProperties,Je=Object.getOwnPropertyDescriptors,It=Object.getOwnPropertySymbols,ze=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable,Ot=(i,t,e)=>t in i?Be(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ve=(i,t)=>{for(var e in t||(t={}))ze.call(t,e)&&Ot(i,e,t[e]);if(It)for(var e of It(t))Ge.call(t,e)&&Ot(i,e,t[e]);return i},Ke=(i,t)=>Le(i,Je(t));async function We(i,t){const e=B(i.result.capabilities.caip345.caip2),s=i.result.capabilities.caip345.transactionHashes,n=await Promise.allSettled(s.map(h=>Ye(e.reference,h,t))),a=n.filter(h=>h.status==="fulfilled").map(h=>h.value).filter(h=>h);n.filter(h=>h.status==="rejected").forEach(h=>console.warn("Failed to fetch transaction receipt:",h.reason));const r=!a.length||a.some(h=>!h),o=a.every(h=>(h==null?void 0:h.status)==="0x1"),c=a.every(h=>(h==null?void 0:h.status)==="0x0"),u=a.some(h=>(h==null?void 0:h.status)==="0x0");let l;return r?l=100:o?l=200:c?l=500:u&&(l=600),{id:i.result.id,version:i.request.version,atomic:i.request.atomicRequired,chainId:i.request.chainId,capabilities:i.result.capabilities,receipts:a,status:l}}async function Ye(i,t,e){return await e(parseInt(i)).request(Et("eth_getTransactionReceipt",[t]))}async function Qe({sendCalls:i,storage:t}){const e=await t.getItem(_);await t.setItem(_,Ke(Ve({},e),{[i.result.id]:{request:i.request,result:i.result,expiry:Jt(Yt)}}))}async function Xe({resultId:i,storage:t}){const e=await t.getItem(_);if(e){delete e[i],await t.setItem(_,e);for(const s in e)At(e[s].expiry)&&delete e[s];await t.setItem(_,e)}}async function Ze({resultId:i,storage:t}){const e=await t.getItem(_),s=e==null?void 0:e[i];if(s&&!At(s.expiry))return s;await Xe({resultId:i,storage:t})}var ti=Object.defineProperty,ei=(i,t,e)=>t in i?ti(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,I=(i,t,e)=>ei(i,typeof t!="symbol"?t+"":t,e);class ii{constructor(t){I(this,"name","polkadot"),I(this,"client"),I(this,"httpProviders"),I(this,"events"),I(this,"namespace"),I(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("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,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=C(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var si=Object.defineProperty,ri=Object.defineProperties,ni=Object.getOwnPropertyDescriptors,jt=Object.getOwnPropertySymbols,ai=Object.prototype.hasOwnProperty,oi=Object.prototype.propertyIsEnumerable,tt=(i,t,e)=>t in i?si(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Y=(i,t)=>{for(var e in t||(t={}))ai.call(t,e)&&tt(i,e,t[e]);if(jt)for(var e of jt(t))oi.call(t,e)&&tt(i,e,t[e]);return i},Q=(i,t)=>ri(i,ni(t)),b=(i,t,e)=>tt(i,typeof t!="symbol"?t+"":t,e);class ci{constructor(t){b(this,"name","eip155"),b(this,"client"),b(this,"chainId"),b(this,"namespace"),b(this,"httpProviders"),b(this,"events"),b(this,"storage"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain()),this.storage=rt.getStorage(this.client.core.storage)}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());case"wallet_getCapabilities":return await this.getCapabilities(t);case"wallet_getCallsStatus":return await this.getCallStatus(t);case"wallet_sendCalls":return await this.sendCalls(t)}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,e){this.httpProviders[t]||this.setHttpProvider(parseInt(t),e),this.chainId=parseInt(t),this.events.emit(v.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,e){const s=e||f(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=parseInt(C(e));t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}getHttpProvider(t){const e=t||this.chainId;return this.httpProviders[e]||(this.httpProviders=Q(Y({},this.httpProviders),{[e]:this.createHttpProvider(e)}),this.httpProviders[e])}async handleSwitchChain(t){var e,s;let n=t.request.params?(e=t.request.params[0])==null?void 0:e.chainId:"0x0";n=n.startsWith("0x")?n:`0x${n}`;const a=parseInt(n,16);if(this.isChainApproved(a))this.setDefaultChain(`${a}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:n}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${a}`);else throw new Error(`Failed to switch to chain 'eip155:${a}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}async getCapabilities(t){var e,s,n,a,r;const o=(s=(e=t.request)==null?void 0:e.params)==null?void 0:s[0],c=((a=(n=t.request)==null?void 0:n.params)==null?void 0:a[1])||[];if(!o)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const u=this.client.session.get(t.topic),l=((r=u==null?void 0:u.sessionProperties)==null?void 0:r.capabilities)||{},h=`${o}${c.join(",")}`,w=l==null?void 0:l[h];if(w)return w;let d;try{d=Ue(u,o,c)}catch(L){console.warn("Failed to extract capabilities from session",L)}if(d)return d;const at=await this.client.request(t);try{await this.client.session.update(t.topic,{sessionProperties:Q(Y({},u.sessionProperties||{}),{capabilities:Q(Y({},l||{}),{[h]:at})})})}catch(L){console.warn("Failed to update session with capabilities",L)}return at}async getCallStatus(t){var e,s,n;const a=this.client.session.get(t.topic),r=(e=a.sessionProperties)==null?void 0:e.bundler_name;if(r){const u=this.getBundlerUrl(t.chainId,r);try{return await this.getUserOperationReceipt(u,t)}catch(l){console.warn("Failed to fetch call status from bundler",l,u)}}const o=(s=a.sessionProperties)==null?void 0:s.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,t)}catch(u){console.warn("Failed to fetch call status from custom bundler",u,o)}const c=await Ze({resultId:(n=t.request.params)==null?void 0:n[0],storage:this.storage});if(c)try{return await We(c,this.getHttpProvider.bind(this))}catch(u){console.warn("Failed to fetch call status from stored send calls",u,c)}if(this.namespace.methods.includes(t.request.method))return await this.client.request(t);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(t,e){var s;const n=new URL(t),a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Et("eth_getUserOperationReceipt",[(s=e.request.params)==null?void 0:s[0]]))});if(!a.ok)throw new Error(`Failed to fetch user operation receipt - ${a.status}`);return await a.json()}getBundlerUrl(t,e){return`${Wt}?projectId=${this.client.core.projectId}&chainId=${t}&bundler=${e}`}async sendCalls(t){var e,s,n;const a=await this.client.request(t),r=(e=t.request.params)==null?void 0:e[0],o=a==null?void 0:a.id,c=(a==null?void 0:a.capabilities)||{},u=(s=c==null?void 0:c.caip345)==null?void 0:s.caip2,l=(n=c==null?void 0:c.caip345)==null?void 0:n.transactionHashes;return!o||!u||!(l!=null&&l.length)||await Qe({sendCalls:{request:r,result:a},storage:this.storage}),a}}var hi=Object.defineProperty,pi=(i,t,e)=>t in i?hi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,O=(i,t,e)=>pi(i,typeof t!="symbol"?t+"":t,e);class ui{constructor(t){O(this,"name","solana"),O(this,"client"),O(this,"httpProviders"),O(this,"events"),O(this,"namespace"),O(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("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,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.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(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=C(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var li=Object.defineProperty,di=(i,t,e)=>t in i?li(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,j=(i,t,e)=>di(i,typeof t!="symbol"?t+"":t,e);class fi{constructor(t){j(this,"name","cosmos"),j(this,"client"),j(this,"httpProviders"),j(this,"events"),j(this,"namespace"),j(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("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,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=C(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var mi=Object.defineProperty,vi=(i,t,e)=>t in i?mi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,H=(i,t,e)=>vi(i,typeof t!="symbol"?t+"":t,e);class gi{constructor(t){H(this,"name","algorand"),H(this,"client"),H(this,"httpProviders"),H(this,"events"),H(this,"namespace"),H(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("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,e){if(!this.httpProviders[t]){const s=e||f(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}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(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;t[e]=this.createHttpProvider(e,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);return typeof s>"u"?void 0:new g(new P(s,p("disableProviderPing")))}}var Pi=Object.defineProperty,wi=(i,t,e)=>t in i?Pi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,$=(i,t,e)=>wi(i,typeof t!="symbol"?t+"":t,e);class bi{constructor(t){$(this,"name","cip34"),$(this,"client"),$(this,"httpProviders"),$(this,"events"),$(this,"namespace"),$(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("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,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{const s=this.getCardanoRPCUrl(e),n=C(e);t[n]=this.createHttpProvider(n,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}getCardanoRPCUrl(t){const e=this.namespace.rpcMap;if(e)return e[t]}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var yi=Object.defineProperty,Ci=(i,t,e)=>t in i?yi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,A=(i,t,e)=>Ci(i,typeof t!="symbol"?t+"":t,e);class Ii{constructor(t){A(this,"name","elrond"),A(this,"client"),A(this,"httpProviders"),A(this,"events"),A(this,"namespace"),A(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("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,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.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(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=C(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var Oi=Object.defineProperty,ji=(i,t,e)=>t in i?Oi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,E=(i,t,e)=>ji(i,typeof t!="symbol"?t+"":t,e);class Hi{constructor(t){E(this,"name","multiversx"),E(this,"client"),E(this,"httpProviders"),E(this,"events"),E(this,"namespace"),E(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("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,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.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(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=C(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var $i=Object.defineProperty,Ai=(i,t,e)=>t in i?$i(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,S=(i,t,e)=>Ai(i,typeof t!="symbol"?t+"":t,e);class Ei{constructor(t){S(this,"name","near"),S(this,"client"),S(this,"httpProviders"),S(this,"events"),S(this,"namespace"),S(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("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,e){if(this.chainId=t,!this.httpProviders[t]){const s=e||f(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;t[e]=this.createHttpProvider(e,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace);return typeof s>"u"?void 0:new g(new P(s,p("disableProviderPing")))}}var Si=Object.defineProperty,qi=(i,t,e)=>t in i?Si(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,q=(i,t,e)=>qi(i,typeof t!="symbol"?t+"":t,e);class Ni{constructor(t){q(this,"name","tezos"),q(this,"client"),q(this,"httpProviders"),q(this,"events"),q(this,"namespace"),q(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("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,e){if(this.chainId=t,!this.httpProviders[t]){const s=e||f(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{t[e]=this.createHttpProvider(e)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace);return typeof s>"u"?void 0:new g(new P(s))}}var Di=Object.defineProperty,_i=(i,t,e)=>t in i?Di(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,N=(i,t,e)=>_i(i,typeof t!="symbol"?t+"":t,e);class Ri{constructor(t){N(this,"name",qt),N(this,"client"),N(this,"httpProviders"),N(this,"events"),N(this,"namespace"),N(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.name=this.getNamespaceName(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(t.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(t.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(t.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(t.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider(t.chainId).request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.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]}getNamespaceName(){const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return B(t).namespace}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){var t,e;const s={};return(e=(t=this.namespace)==null?void 0:t.accounts)==null||e.forEach(n=>{const a=B(n);s[a.reference]=this.createHttpProvider(n)}),s}getHttpProvider(t){const e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var Fi=Object.defineProperty,xi=Object.defineProperties,Ui=Object.getOwnPropertyDescriptors,Ht=Object.getOwnPropertySymbols,ki=Object.prototype.hasOwnProperty,Ti=Object.prototype.propertyIsEnumerable,et=(i,t,e)=>t in i?Fi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,T=(i,t)=>{for(var e in t||(t={}))ki.call(t,e)&&et(i,e,t[e]);if(Ht)for(var e of Ht(t))Ti.call(t,e)&&et(i,e,t[e]);return i},X=(i,t)=>xi(i,Ui(t)),m=(i,t,e)=>et(i,typeof t!="symbol"?t+"":t,e);class nt{constructor(t){m(this,"client"),m(this,"namespaces"),m(this,"optionalNamespaces"),m(this,"sessionProperties"),m(this,"scopedProperties"),m(this,"events",new Tt),m(this,"rpcProviders",{}),m(this,"session"),m(this,"providerOpts"),m(this,"logger"),m(this,"uri"),m(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:Mt(Bt({level:(t==null?void 0:t.logger)||ct})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const e=new nt(t);return await e.initialize(),e}async request(t,e,s){const[n,a]=this.validateChain(e);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:T({},t),chainId:`${n}:${a}`,topic:this.session.topic,expiry:s})}sendAsync(t,e,s,n){const a=new Date().getTime();this.request(t,s,n).then(r=>e(null,zt(a,r))).catch(r=>e(r,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties}),await this.requestAccounts()}async disconnect(){var 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:ot("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}async authenticate(t,e){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(t),await this.cleanupPendingPairings();const{uri:s,response:n}=await this.client.authenticate(t,e);s&&(this.uri=s,this.events.emit("display_uri",s));const a=await n();if(this.session=a.session,this.session){const r=gt(this.session.namespaces);this.namespaces=k(this.namespaces,r),await this.persist("namespaces",this.namespaces),this.onConnect()}return a}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}removeListener(t,e){this.events.removeListener(t,e)}off(t,e){this.events.off(t,e)}get isWalletConnect(){return!0}async pair(t){const{uri:e,approval:s}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties});e&&(this.uri=e,this.events.emit("display_uri",e));const n=await s();this.session=n;const a=gt(n.namespaces);return this.namespaces=k(this.namespaces,a),await this.persist("namespaces",this.namespaces),await this.persist("optionalNamespaces",this.optionalNamespaces),this.onConnect(),this.session}setDefaultChain(t,e){try{if(!this.session)return;const[s,n]=this.validateChain(t);this.getProvider(s).setDefaultChain(n,e)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){try{this.logger.info("Cleaning up inactive pairings...");const e=this.client.pairing.getAll();if(!J(e))return;for(const s of e)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: ${e.length}`)}catch(e){this.logger.warn("Failed to cleanup pending pairings",e)}}abortPairingAttempt(){this.logger.warn("abortPairingAttempt is deprecated. This is now a no-op.")}async checkStorage(){this.namespaces=await this.getFromStore("namespaces")||{},this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.session&&this.createProviders()}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){var t,e;if(this.client=this.providerOpts.client||await Lt.init({core:this.providerOpts.core,logger:this.providerOpts.logger||ct,relayUrl:this.providerOpts.relayUrl||Gt,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.providerOpts.session)try{this.session=this.client.session.get(this.providerOpts.session.topic)}catch(s){throw this.logger.error("Failed to get session",s),new Error(`The provided session: ${(e=(t=this.providerOpts)==null?void 0:t.session)==null?void 0:e.topic} doesn't exist in the Sign client`)}else{const s=this.client.session.getAll();this.session=s[0]}this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(e=>R(e)))];V("client",this.client),V("events",this.events),V("disableProviderPing",this.disableProviderPing),t.forEach(e=>{if(!this.session)return;const s=Se(e,this.session);if((s==null?void 0:s.length)===0)return;const n=Ut(s),a=k(this.namespaces,this.optionalNamespaces),r=X(T({},a[e]),{accounts:s,chains:n});switch(e){case"eip155":this.rpcProviders[e]=new ci({namespace:r});break;case"algorand":this.rpcProviders[e]=new gi({namespace:r});break;case"solana":this.rpcProviders[e]=new ui({namespace:r});break;case"cosmos":this.rpcProviders[e]=new fi({namespace:r});break;case"polkadot":this.rpcProviders[e]=new ii({namespace:r});break;case"cip34":this.rpcProviders[e]=new bi({namespace:r});break;case"elrond":this.rpcProviders[e]=new Ii({namespace:r});break;case"multiversx":this.rpcProviders[e]=new Hi({namespace:r});break;case"near":this.rpcProviders[e]=new Ei({namespace:r});break;case"tezos":this.rpcProviders[e]=new Ni({namespace:r});break;default:this.rpcProviders[e]=new Ri({namespace:r})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{var e;const{topic:s}=t;s===((e=this.session)==null?void 0:e.topic)&&this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{var e;const{params:s,topic:n}=t;if(n!==((e=this.session)==null?void 0:e.topic))return;const{event:a}=s;if(a.name==="accountsChanged"){const r=a.data;r&&J(r)&&this.events.emit("accountsChanged",r.map(vt))}else if(a.name==="chainChanged"){const r=s.chainId,o=s.event.data,c=R(r),u=G(r)!==G(o)?`${c}:${G(o)}`:r;this.onChainChanged(u)}else this.events.emit(a.name,a.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:e})=>{var s,n;if(t!==((s=this.session)==null?void 0:s.topic))return;const{namespaces:a}=e,r=(n=this.client)==null?void 0:n.session.get(t);this.session=X(T({},r),{namespaces:a}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:e})}),this.client.on("session_delete",async t=>{var e;t.topic===((e=this.session)==null?void 0:e.topic)&&(await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",X(T({},ot("USER_DISCONNECTED")),{data:t.topic})))}),this.on(v.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){return this.rpcProviders[t]||this.rpcProviders[qt]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var e;this.getProvider(t).updateNamespace((e=this.session)==null?void 0:e.namespaces[t])})}setNamespaces(t){const{namespaces:e={},optionalNamespaces:s={},sessionProperties:n,scopedProperties:a}=t;this.optionalNamespaces=k(e,s),this.sessionProperties=n,this.scopedProperties=a}validateChain(t){const[e,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[e,s];if(e&&!Object.keys(this.namespaces||{}).map(r=>R(r)).includes(e))throw new Error(`Namespace '${e}' is not configured. Please call connect() first with namespace config.`);if(e&&s)return[e,s];const n=R(Object.keys(this.namespaces)[0]),a=this.rpcProviders[n].getDefaultChain();return[n,a]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}async onChainChanged(t,e=!1){if(!this.namespaces)return;const[s,n]=this.validateChain(t);if(!n)return;this.updateNamespaceChain(s,n);const a=this.getProvider(s).getDefaultChain();e?(this.events.emit("chainChanged",n),this.emitAccountsChangedOnChainChange({namespace:s,previousChainId:a,newChainId:t})):this.getProvider(s).setDefaultChain(n),await this.persist("namespaces",this.namespaces)}emitAccountsChangedOnChainChange({namespace:t,previousChainId:e,newChainId:s}){var n,a;try{if(e===s)return;const r=(a=(n=this.session)==null?void 0:n.namespaces[t])==null?void 0:a.accounts;if(!r)return;const o=r.filter(c=>c.includes(`${s}:`)).map(vt);if(!J(o))return;this.events.emit("accountsChanged",o)}catch(r){this.logger.warn("Failed to emit accountsChanged on chain change",r)}}updateNamespaceChain(t,e){if(!this.namespaces)return;const s=this.namespaces[t]?t:`${t}:${e}`,n={chains:[],methods:[],events:[],defaultChain:e};this.namespaces[s]?this.namespaces[s]&&(this.namespaces[s].defaultChain=e):this.namespaces[s]=n}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,await this.deleteFromStore("namespaces"),await this.deleteFromStore("optionalNamespaces"),await this.deleteFromStore("sessionProperties"),this.session=void 0,this.cleanupPendingPairings({deletePairings:!0}),await this.cleanupStorage()}async persist(t,e){var s;const n=((s=this.session)==null?void 0:s.topic)||"";await this.client.core.storage.setItem(`${x}/${t}${n}`,e)}async getFromStore(t){var e;const s=((e=this.session)==null?void 0:e.topic)||"";return await this.client.core.storage.getItem(`${x}/${t}${s}`)}async deleteFromStore(t){var e;const s=((e=this.session)==null?void 0:e.topic)||"";await this.client.core.storage.removeItem(`${x}/${t}${s}`)}async cleanupStorage(){var t;try{if(((t=this.client)==null?void 0:t.session.length)>0)return;const e=await this.client.core.storage.getKeys();for(const s of e)s.startsWith(x)&&await this.client.core.storage.removeItem(s)}catch(e){this.logger.warn("Failed to cleanup storage",e)}}}const Vi=nt;export{Vi as UniversalProvider,nt as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as p,W as y,X as c,r as w}from"./ThirdwebWalletManager-C0WgXnZx.js";import"./index-Fv-acDXO.js";import"./store-CraP4F4Y.js";import"./webauthn.min-CGpVStYZ.js";import"./index.es-DkH7OFeN.js";async function u({account:e,serializableTransaction:a,transaction:n,gasless:s}){const t=c({address:s.relayerForwarderAddress,chain:n.chain,client:n.client}),r=await w({contract:t,method:"function getNonce(address) view returns (uint256)",params:[e.address]}),[o,m]=await(async()=>{if(!a.to)throw new Error("OpenZeppelin transactions must have a 'to' address");if(!a.gas)throw new Error("OpenZeppelin transactions must have a 'gas' value");if(!a.data)throw new Error("OpenZeppelin transactions must have a 'data' value");if(s.experimentalChainlessSupport){const i={chainid:BigInt(n.chain.id),data:a.data,from:e.address,gas:a.gas,nonce:r,to:a.to,value:0n};return[await e.signTypedData({domain:{name:"GSNv2 Forwarder",verifyingContract:t.address,version:"0.0.1"},message:i,primaryType:"ForwardRequest",types:{ForwardRequest:g}}),i]}const d={data:a.data,from:e.address,gas:a.gas,nonce:r,to:a.to,value:0n};return[await e.signTypedData({domain:{chainId:n.chain.id,name:s.domainName??"GSNv2 Forwarder",verifyingContract:t.address,version:s.domainVersion??"0.0.1"},message:d,primaryType:"ForwardRequest",types:{ForwardRequest:h}}),d]})();return{message:m,messageType:"forward",signature:o}}const h=[{name:"from",type:"address"},{name:"to",type:"address"},{name:"value",type:"uint256"},{name:"gas",type:"uint256"},{name:"nonce",type:"uint256"},{name:"data",type:"bytes"}],g=[{name:"from",type:"address"},{name:"to",type:"address"},{name:"value",type:"uint256"},{name:"gas",type:"uint256"},{name:"nonce",type:"uint256"},{name:"data",type:"bytes"},{name:"chainid",type:"uint256"}];async function q(e){const{message:a,messageType:n,signature:s}=await u(e),t=await fetch(e.gasless.relayerUrl,{body:p({forwarderAddress:e.gasless.relayerForwarderAddress,request:a,signature:s,type:n}),method:"POST"});if(!t.ok)throw new Error(`Failed to send transaction: ${await t.text()}`);const r=await t.json();if(!r.result)throw new Error(`Relay transaction failed: ${r.message}`);const o=JSON.parse(r.result).txHash;if(y(o))return{chain:e.transaction.chain,client:e.transaction.client,transactionHash:o};throw new Error(`Failed to send transaction: ${p(r)}`)}export{u as prepareOpenZeppelinTransaction,q as relayOpenZeppelinTransaction};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{w as o,x as c,r as a}from"./ThirdwebWalletManager-C0WgXnZx.js";import{d}from"./detectExtension-BeXqHbY8.js";import"./index-Fv-acDXO.js";import"./store-CraP4F4Y.js";import"./webauthn.min-CGpVStYZ.js";import"./index.es-DkH7OFeN.js";const t="0x6352211e",r=[{name:"tokenId",type:"uint256"}],n=[{type:"address"}];function w(e){return d({availableSelectors:e,method:[t,r,n]})}function s(e){return o(r,[e.tokenId])}function P(e){return t+s(e).slice(2)}function I(e){return c(n,e)[0]}async function N(e){return a({contract:e.contract,method:[t,r,n],params:[e.tokenId]})}export{t as FN_SELECTOR,I as decodeOwnerOfResult,P as encodeOwnerOf,s as encodeOwnerOfParams,w as isOwnerOfSupported,N as ownerOf};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as p,az as d,X as l,aA as c,av as f,r as u}from"./ThirdwebWalletManager-C0WgXnZx.js";import"./index-Fv-acDXO.js";import"./store-CraP4F4Y.js";import"./webauthn.min-CGpVStYZ.js";import"./index.es-DkH7OFeN.js";async function r(e,t){return await e({method:"eth_getStorageAt",params:[p(t.address),t.position,t.blockTag??"latest"]})}function x(e){if(e.startsWith("0x")||(e=`0x${e}`),e.startsWith("0x363d3d373d3d3d363d73"))return`0x${e.slice(22,62)}`;if(e.startsWith("0x36603057343d5230"))return`0x${e.slice(122,162)}`;if(e.startsWith("0x3d3d3d3d363d3d37363d73"))return`0x${e.slice(24,64)}`;if(e.startsWith("0x366000600037611000600036600073"))return`0x${e.slice(32,72)}`;if(e.startsWith("0x36600080376020600036600073"))return`0x${e.slice(28,68)}`;if(e.startsWith("0x365f5f375f5f365f73"))return`0x${e.slice(20,60)}`;if(e.length===48&&e.startsWith("0xef0100"))return`0x${e.slice(8,48)}`}const o="0x0000000000000000000000000000000000000000",A="0x0000000000000000000000000000000000000000000000000000000000000000";async function I(e){const[t,s]=await Promise.all([d(e),g(e)]),n=x(t);if(n)return{address:n,bytecode:await d(l({...e,address:n}))};s&&s!==o&&(e=l({...e,address:s}));const a=await Promise.all([h(e),$(e)]);for(const i of a)if(i&&c(i)&&i!==o){const m=await d({...e,address:i});return m==="0x"?{address:e.address,bytecode:t}:{address:i,bytecode:m}}return{address:e.address,bytecode:t}}async function g(e){const t=f({chain:e.chain,client:e.client});try{const s=await r(t,{address:e.address,position:"0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50"});return s.length>=40?`0x${s.slice(-40)}`:void 0}catch{return}}async function h(e){const t=f({chain:e.chain,client:e.client});try{const s=[r(t,{address:e.address,position:"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc"}),r(t,{address:e.address,position:"0xbaab7dbf64751104133af04abc7d9979f0fda3b059a322a8333f533d3f32bf7f"}),r(t,{address:e.address,position:"0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3"})],a=(await Promise.all(s)).find(i=>i!==A);return a?`0x${a.slice(-40)}`:o}catch{return}}const S={inputs:[],name:"implementation",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"};async function $(e){try{return await u({contract:e,method:S})}catch{return}}export{I as resolveImplementation};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{bf as Qt,bg as At,bh as bt,bi as Jt,bj as te,bk as ye,bl as mt,bm as xe,bn as G,bo as Ee,bp as Be,bq as ve,br as Se}from"./ThirdwebWalletManager-C0WgXnZx.js";import"./index-Fv-acDXO.js";import"./store-CraP4F4Y.js";import"./webauthn.min-CGpVStYZ.js";import"./index.es-DkH7OFeN.js";function Ae(n,e,t,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(e,t,r);const i=BigInt(32),s=BigInt(4294967295),c=Number(t>>i&s),f=Number(t&s),o=r?4:0,l=r?0:4;n.setUint32(e+o,c,r),n.setUint32(e+l,f,r)}function Ie(n,e,t){return n&e^~n&t}function Ne(n,e,t){return n&e^n&t^e&t}class Oe extends Qt{constructor(e,t,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(e),this.view=At(this.buffer)}update(e){bt(this),e=Jt(e),te(e);const{view:t,buffer:r,blockLen:i}=this,s=e.length;for(let c=0;c<s;){const f=Math.min(i-this.pos,s-c);if(f===i){const o=At(e);for(;i<=s-c;c+=i)this.process(o,c);continue}r.set(e.subarray(c,c+f),this.pos),this.pos+=f,c+=f,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){bt(this),ye(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:i,isLE:s}=this;let{pos:c}=this;t[c++]=128,mt(this.buffer.subarray(c)),this.padOffset>i-c&&(this.process(r,0),c=0);for(let h=c;h<i;h++)t[h]=0;Ae(r,i-8,BigInt(this.length*8),s),this.process(r,0);const f=At(e),o=this.outputLen;if(o%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=o/4,g=this.get();if(l>g.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<l;h++)f.setUint32(4*h,g[h],s)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:i,finished:s,destroyed:c,pos:f}=this;return e.destroyed=c,e.finished=s,e.length=i,e.pos=f,i%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}}const J=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),qe=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),tt=new Uint32Array(64);class He extends Oe{constructor(e=32){super(64,e,8,!1),this.A=J[0]|0,this.B=J[1]|0,this.C=J[2]|0,this.D=J[3]|0,this.E=J[4]|0,this.F=J[5]|0,this.G=J[6]|0,this.H=J[7]|0}get(){const{A:e,B:t,C:r,D:i,E:s,F:c,G:f,H:o}=this;return[e,t,r,i,s,c,f,o]}set(e,t,r,i,s,c,f,o){this.A=e|0,this.B=t|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=c|0,this.G=f|0,this.H=o|0}process(e,t){for(let h=0;h<16;h++,t+=4)tt[h]=e.getUint32(t,!1);for(let h=16;h<64;h++){const B=tt[h-15],q=tt[h-2],_=G(B,7)^G(B,18)^B>>>3,p=G(q,17)^G(q,19)^q>>>10;tt[h]=p+tt[h-7]+_+tt[h-16]|0}let{A:r,B:i,C:s,D:c,E:f,F:o,G:l,H:g}=this;for(let h=0;h<64;h++){const B=G(f,6)^G(f,11)^G(f,25),q=g+B+Ie(f,o,l)+qe[h]+tt[h]|0,p=(G(r,2)^G(r,13)^G(r,22))+Ne(r,i,s)|0;g=l,l=o,o=f,f=c+q|0,c=s,s=i,i=r,r=q+p|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,c=c+this.D|0,f=f+this.E|0,o=o+this.F|0,l=l+this.G|0,g=g+this.H|0,this.set(r,i,s,c,f,o,l,g)}roundClean(){mt(tt)}destroy(){this.set(0,0,0,0,0,0,0,0),mt(this.buffer)}}const Le=xe(()=>new He);class ee extends Qt{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,Ee(e);const r=Jt(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(r.length>i?e.create().update(r).digest():r);for(let c=0;c<s.length;c++)s[c]^=54;this.iHash.update(s),this.oHash=e.create();for(let c=0;c<s.length;c++)s[c]^=106;this.oHash.update(s),mt(s)}update(e){return bt(this),this.iHash.update(e),this}digestInto(e){bt(this),te(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:r,finished:i,destroyed:s,blockLen:c,outputLen:f}=this;return e=e,e.finished=i,e.destroyed=s,e.blockLen=c,e.outputLen=f,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const ne=(n,e,t)=>new ee(n,e).update(t).digest();ne.create=(n,e)=>new ee(n,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ct=BigInt(0),Rt=BigInt(1);function wt(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function Vt(n){if(!wt(n))throw new Error("Uint8Array expected")}function dt(n,e){if(typeof e!="boolean")throw new Error(n+" boolean expected, got "+e)}function pt(n){const e=n.toString(16);return e.length&1?"0"+e:e}function re(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return n===""?Ct:BigInt("0x"+n)}const oe=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Ue=Array.from({length:256},(n,e)=>e.toString(16).padStart(2,"0"));function ht(n){if(Vt(n),oe)return n.toHex();let e="";for(let t=0;t<n.length;t++)e+=Ue[n[t]];return e}const $={_0:48,_9:57,A:65,F:70,a:97,f:102};function Yt(n){if(n>=$._0&&n<=$._9)return n-$._0;if(n>=$.A&&n<=$.F)return n-($.A-10);if(n>=$.a&&n<=$.f)return n-($.a-10)}function yt(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);if(oe)return Uint8Array.fromHex(n);const e=n.length,t=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(t);for(let i=0,s=0;i<t;i++,s+=2){const c=Yt(n.charCodeAt(s)),f=Yt(n.charCodeAt(s+1));if(c===void 0||f===void 0){const o=n[s]+n[s+1];throw new Error('hex string expected, got non-hex character "'+o+'" at index '+s)}r[i]=c*16+f}return r}function ot(n){return re(ht(n))}function ie(n){return Vt(n),re(ht(Uint8Array.from(n).reverse()))}function gt(n,e){return yt(n.toString(16).padStart(e*2,"0"))}function se(n,e){return gt(n,e).reverse()}function K(n,e,t){let r;if(typeof e=="string")try{r=yt(e)}catch(s){throw new Error(n+" must be hex string or Uint8Array, cause: "+s)}else if(wt(e))r=Uint8Array.from(e);else throw new Error(n+" must be hex string or Uint8Array");const i=r.length;if(typeof t=="number"&&i!==t)throw new Error(n+" of length "+t+" expected, got "+i);return r}function xt(...n){let e=0;for(let r=0;r<n.length;r++){const i=n[r];Vt(i),e+=i.length}const t=new Uint8Array(e);for(let r=0,i=0;r<n.length;r++){const s=n[r];t.set(s,i),i+=s.length}return t}const It=n=>typeof n=="bigint"&&Ct<=n;function Mt(n,e,t){return It(n)&&It(e)&&It(t)&&e<=n&&n<t}function ft(n,e,t,r){if(!Mt(e,t,r))throw new Error("expected valid "+n+": "+t+" <= n < "+r+", got "+e)}function _e(n){let e;for(e=0;n>Ct;n>>=Rt,e+=1);return e}const Et=n=>(Rt<<BigInt(n))-Rt,Nt=n=>new Uint8Array(n),Kt=n=>Uint8Array.from(n);function Re(n,e,t){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let r=Nt(n),i=Nt(n),s=0;const c=()=>{r.fill(1),i.fill(0),s=0},f=(...h)=>t(i,r,...h),o=(h=Nt(0))=>{i=f(Kt([0]),h),r=f(),h.length!==0&&(i=f(Kt([1]),h),r=f())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let h=0;const B=[];for(;h<e;){r=f();const q=r.slice();B.push(q),h+=r.length}return xt(...B)};return(h,B)=>{c(),o(h);let q;for(;!(q=B(l()));)o();return c(),q}}const ke={bigint:n=>typeof n=="bigint",function:n=>typeof n=="function",boolean:n=>typeof n=="boolean",string:n=>typeof n=="string",stringOrUint8Array:n=>typeof n=="string"||wt(n),isSafeInteger:n=>Number.isSafeInteger(n),array:n=>Array.isArray(n),field:(n,e)=>e.Fp.isValid(n),hash:n=>typeof n=="function"&&Number.isSafeInteger(n.outputLen)};function Bt(n,e,t={}){const r=(i,s,c)=>{const f=ke[s];if(typeof f!="function")throw new Error("invalid validator function");const o=n[i];if(!(c&&o===void 0)&&!f(o,n))throw new Error("param "+String(i)+" is invalid. Expected "+s+", got "+o)};for(const[i,s]of Object.entries(e))r(i,s,!1);for(const[i,s]of Object.entries(t))r(i,s,!0);return n}function Pt(n){const e=new WeakMap;return(t,...r)=>{const i=e.get(t);if(i!==void 0)return i;const s=n(t,...r);return e.set(t,s),s}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const j=BigInt(0),C=BigInt(1),rt=BigInt(2),Te=BigInt(3),ce=BigInt(4),fe=BigInt(5),ae=BigInt(8);function M(n,e){const t=n%e;return t>=j?t:e+t}function Y(n,e,t){let r=n;for(;e-- >j;)r*=r,r%=t;return r}function kt(n,e){if(n===j)throw new Error("invert: expected non-zero number");if(e<=j)throw new Error("invert: expected positive modulus, got "+e);let t=M(n,e),r=e,i=j,s=C;for(;t!==j;){const f=r/t,o=r%t,l=i-s*f;r=t,t=o,i=s,s=l}if(r!==C)throw new Error("invert: does not exist");return M(i,e)}function ue(n,e){const t=(n.ORDER+C)/ce,r=n.pow(e,t);if(!n.eql(n.sqr(r),e))throw new Error("Cannot find square root");return r}function Ze(n,e){const t=(n.ORDER-fe)/ae,r=n.mul(e,rt),i=n.pow(r,t),s=n.mul(e,i),c=n.mul(n.mul(s,rt),i),f=n.mul(s,n.sub(c,n.ONE));if(!n.eql(n.sqr(f),e))throw new Error("Cannot find square root");return f}function ze(n){if(n<BigInt(3))throw new Error("sqrt is not defined for small field");let e=n-C,t=0;for(;e%rt===j;)e/=rt,t++;let r=rt;const i=jt(n);for(;Dt(i,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(t===1)return ue;let s=i.pow(r,e);const c=(e+C)/rt;return function(o,l){if(o.is0(l))return l;if(Dt(o,l)!==1)throw new Error("Cannot find square root");let g=t,h=o.mul(o.ONE,s),B=o.pow(l,e),q=o.pow(l,c);for(;!o.eql(B,o.ONE);){if(o.is0(B))return o.ZERO;let _=1,p=o.sqr(B);for(;!o.eql(p,o.ONE);)if(_++,p=o.sqr(p),_===g)throw new Error("Cannot find square root");const Z=C<<BigInt(g-_-1),R=o.pow(h,Z);g=_,h=o.sqr(R),B=o.mul(B,h),q=o.mul(q,R)}return q}}function Ce(n){return n%ce===Te?ue:n%ae===fe?Ze:ze(n)}const Ve=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Me(n){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=Ve.reduce((r,i)=>(r[i]="function",r),e);return Bt(n,t)}function je(n,e,t){if(t<j)throw new Error("invalid exponent, negatives unsupported");if(t===j)return n.ONE;if(t===C)return e;let r=n.ONE,i=e;for(;t>j;)t&C&&(r=n.mul(r,i)),i=n.sqr(i),t>>=C;return r}function le(n,e,t=!1){const r=new Array(e.length).fill(t?n.ZERO:void 0),i=e.reduce((c,f,o)=>n.is0(f)?c:(r[o]=c,n.mul(c,f)),n.ONE),s=n.inv(i);return e.reduceRight((c,f,o)=>n.is0(f)?c:(r[o]=n.mul(c,r[o]),n.mul(c,f)),s),r}function Dt(n,e){const t=(n.ORDER-C)/rt,r=n.pow(e,t),i=n.eql(r,n.ONE),s=n.eql(r,n.ZERO),c=n.eql(r,n.neg(n.ONE));if(!i&&!s&&!c)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function de(n,e){e!==void 0&&Be(e);const t=e!==void 0?e:n.toString(2).length,r=Math.ceil(t/8);return{nBitLength:t,nByteLength:r}}function jt(n,e,t=!1,r={}){if(n<=j)throw new Error("invalid field: expected ORDER > 0, got "+n);const{nBitLength:i,nByteLength:s}=de(n,e);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let c;const f=Object.freeze({ORDER:n,isLE:t,BITS:i,BYTES:s,MASK:Et(i),ZERO:j,ONE:C,create:o=>M(o,n),isValid:o=>{if(typeof o!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof o);return j<=o&&o<n},is0:o=>o===j,isOdd:o=>(o&C)===C,neg:o=>M(-o,n),eql:(o,l)=>o===l,sqr:o=>M(o*o,n),add:(o,l)=>M(o+l,n),sub:(o,l)=>M(o-l,n),mul:(o,l)=>M(o*l,n),pow:(o,l)=>je(f,o,l),div:(o,l)=>M(o*kt(l,n),n),sqrN:o=>o*o,addN:(o,l)=>o+l,subN:(o,l)=>o-l,mulN:(o,l)=>o*l,inv:o=>kt(o,n),sqrt:r.sqrt||(o=>(c||(c=Ce(n)),c(f,o))),toBytes:o=>t?se(o,s):gt(o,s),fromBytes:o=>{if(o.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+o.length);return t?ie(o):ot(o)},invertBatch:o=>le(f,o),cmov:(o,l,g)=>g?l:o});return Object.freeze(f)}function he(n){if(typeof n!="bigint")throw new Error("field order must be bigint");const e=n.toString(2).length;return Math.ceil(e/8)}function we(n){const e=he(n);return e+Math.ceil(e/2)}function Ye(n,e,t=!1){const r=n.length,i=he(e),s=we(e);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const c=t?ie(n):ot(n),f=M(c,e-C)+C;return t?se(f,i):gt(f,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Gt=BigInt(0),Tt=BigInt(1);function Ot(n,e){const t=e.negate();return n?t:e}function ge(n,e){if(!Number.isSafeInteger(n)||n<=0||n>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+n)}function qt(n,e){ge(n,e);const t=Math.ceil(e/n)+1,r=2**(n-1),i=2**n,s=Et(n),c=BigInt(n);return{windows:t,windowSize:r,mask:s,maxNumber:i,shiftBy:c}}function Wt(n,e,t){const{windowSize:r,mask:i,maxNumber:s,shiftBy:c}=t;let f=Number(n&i),o=n>>c;f>r&&(f-=s,o+=Tt);const l=e*r,g=l+Math.abs(f)-1,h=f===0,B=f<0,q=e%2!==0;return{nextN:o,offset:g,isZero:h,isNeg:B,isNegF:q,offsetF:l}}function Ke(n,e){if(!Array.isArray(n))throw new Error("array expected");n.forEach((t,r)=>{if(!(t instanceof e))throw new Error("invalid point at index "+r)})}function Pe(n,e){if(!Array.isArray(n))throw new Error("array of scalars expected");n.forEach((t,r)=>{if(!e.isValid(t))throw new Error("invalid scalar at index "+r)})}const Ht=new WeakMap,pe=new WeakMap;function Lt(n){return pe.get(n)||1}function De(n,e){return{constTimeNegate:Ot,hasPrecomputes(t){return Lt(t)!==1},unsafeLadder(t,r,i=n.ZERO){let s=t;for(;r>Gt;)r&Tt&&(i=i.add(s)),s=s.double(),r>>=Tt;return i},precomputeWindow(t,r){const{windows:i,windowSize:s}=qt(r,e),c=[];let f=t,o=f;for(let l=0;l<i;l++){o=f,c.push(o);for(let g=1;g<s;g++)o=o.add(f),c.push(o);f=o.double()}return c},wNAF(t,r,i){let s=n.ZERO,c=n.BASE;const f=qt(t,e);for(let o=0;o<f.windows;o++){const{nextN:l,offset:g,isZero:h,isNeg:B,isNegF:q,offsetF:_}=Wt(i,o,f);i=l,h?c=c.add(Ot(q,r[_])):s=s.add(Ot(B,r[g]))}return{p:s,f:c}},wNAFUnsafe(t,r,i,s=n.ZERO){const c=qt(t,e);for(let f=0;f<c.windows&&i!==Gt;f++){const{nextN:o,offset:l,isZero:g,isNeg:h}=Wt(i,f,c);if(i=o,!g){const B=r[l];s=s.add(h?B.negate():B)}}return s},getPrecomputes(t,r,i){let s=Ht.get(r);return s||(s=this.precomputeWindow(r,t),t!==1&&Ht.set(r,i(s))),s},wNAFCached(t,r,i){const s=Lt(t);return this.wNAF(s,this.getPrecomputes(s,t,i),r)},wNAFCachedUnsafe(t,r,i,s){const c=Lt(t);return c===1?this.unsafeLadder(t,r,s):this.wNAFUnsafe(c,this.getPrecomputes(c,t,i),r,s)},setWindowSize(t,r){ge(r,e),pe.set(t,r),Ht.delete(t)}}}function Ge(n,e,t,r){Ke(t,n),Pe(r,e);const i=t.length,s=r.length;if(i!==s)throw new Error("arrays of points and scalars must have equal length");const c=n.ZERO,f=_e(BigInt(i));let o=1;f>12?o=f-3:f>4?o=f-2:f>0&&(o=2);const l=Et(o),g=new Array(Number(l)+1).fill(c),h=Math.floor((e.BITS-1)/o)*o;let B=c;for(let q=h;q>=0;q-=o){g.fill(c);for(let p=0;p<s;p++){const Z=r[p],R=Number(Z>>BigInt(q)&l);g[R]=g[R].add(t[p])}let _=c;for(let p=g.length-1,Z=c;p>0;p--)Z=Z.add(g[p]),_=_.add(Z);if(B=B.add(_),q!==0)for(let p=0;p<o;p++)B=B.double()}return B}function be(n){return Me(n.Fp),Bt(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...de(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function $t(n){n.lowS!==void 0&&dt("lowS",n.lowS),n.prehash!==void 0&&dt("prehash",n.prehash)}function We(n){const e=be(n);Bt(e,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:t,Fp:r,a:i}=e;if(t){if(!r.eql(i,r.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...e})}class $e extends Error{constructor(e=""){super(e)}}const F={Err:$e,_tlv:{encode:(n,e)=>{const{Err:t}=F;if(n<0||n>256)throw new t("tlv.encode: wrong tag");if(e.length&1)throw new t("tlv.encode: unpadded data");const r=e.length/2,i=pt(r);if(i.length/2&128)throw new t("tlv.encode: long form length too big");const s=r>127?pt(i.length/2|128):"";return pt(n)+s+i+e},decode(n,e){const{Err:t}=F;let r=0;if(n<0||n>256)throw new t("tlv.encode: wrong tag");if(e.length<2||e[r++]!==n)throw new t("tlv.decode: wrong tlv");const i=e[r++],s=!!(i&128);let c=0;if(!s)c=i;else{const o=i&127;if(!o)throw new t("tlv.decode(long): indefinite length not supported");if(o>4)throw new t("tlv.decode(long): byte length is too big");const l=e.subarray(r,r+o);if(l.length!==o)throw new t("tlv.decode: length bytes not complete");if(l[0]===0)throw new t("tlv.decode(long): zero leftmost byte");for(const g of l)c=c<<8|g;if(r+=o,c<128)throw new t("tlv.decode(long): not minimal encoding")}const f=e.subarray(r,r+c);if(f.length!==c)throw new t("tlv.decode: wrong value length");return{v:f,l:e.subarray(r+c)}}},_int:{encode(n){const{Err:e}=F;if(n<X)throw new e("integer: negative integers are not allowed");let t=pt(n);if(Number.parseInt(t[0],16)&8&&(t="00"+t),t.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return t},decode(n){const{Err:e}=F;if(n[0]&128)throw new e("invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return ot(n)}},toSig(n){const{Err:e,_int:t,_tlv:r}=F,i=K("signature",n),{v:s,l:c}=r.decode(48,i);if(c.length)throw new e("invalid signature: left bytes after parsing");const{v:f,l:o}=r.decode(2,s),{v:l,l:g}=r.decode(2,o);if(g.length)throw new e("invalid signature: left bytes after parsing");return{r:t.decode(f),s:t.decode(l)}},hexFromSig(n){const{_tlv:e,_int:t}=F,r=e.encode(2,t.encode(n.r)),i=e.encode(2,t.encode(n.s)),s=r+i;return e.encode(48,s)}};function Ut(n,e){return ht(gt(n,e))}const X=BigInt(0),k=BigInt(1);BigInt(2);const _t=BigInt(3),Fe=BigInt(4);function Xe(n){const e=We(n),{Fp:t}=e,r=jt(e.n,e.nBitLength),i=e.toBytes||((A,a,w)=>{const m=a.toAffine();return xt(Uint8Array.from([4]),t.toBytes(m.x),t.toBytes(m.y))}),s=e.fromBytes||(A=>{const a=A.subarray(1),w=t.fromBytes(a.subarray(0,t.BYTES)),m=t.fromBytes(a.subarray(t.BYTES,2*t.BYTES));return{x:w,y:m}});function c(A){const{a,b:w}=e,m=t.sqr(A),v=t.mul(m,A);return t.add(t.add(v,t.mul(A,a)),w)}function f(A,a){const w=t.sqr(a),m=c(A);return t.eql(w,m)}if(!f(e.Gx,e.Gy))throw new Error("bad curve params: generator point");const o=t.mul(t.pow(e.a,_t),Fe),l=t.mul(t.sqr(e.b),BigInt(27));if(t.is0(t.add(o,l)))throw new Error("bad curve params: a or b");function g(A){return Mt(A,k,e.n)}function h(A){const{allowedPrivateKeyLengths:a,nByteLength:w,wrapPrivateKey:m,n:v}=e;if(a&&typeof A!="bigint"){if(wt(A)&&(A=ht(A)),typeof A!="string"||!a.includes(A.length))throw new Error("invalid private key");A=A.padStart(w*2,"0")}let O;try{O=typeof A=="bigint"?A:ot(K("private key",A,w))}catch{throw new Error("invalid private key, expected hex or "+w+" bytes, got "+typeof A)}return m&&(O=M(O,v)),ft("private key",O,k,v),O}function B(A){if(!(A instanceof p))throw new Error("ProjectivePoint expected")}const q=Pt((A,a)=>{const{px:w,py:m,pz:v}=A;if(t.eql(v,t.ONE))return{x:w,y:m};const O=A.is0();a==null&&(a=O?t.ONE:t.inv(v));const L=t.mul(w,a),H=t.mul(m,a),y=t.mul(v,a);if(O)return{x:t.ZERO,y:t.ZERO};if(!t.eql(y,t.ONE))throw new Error("invZ was invalid");return{x:L,y:H}}),_=Pt(A=>{if(A.is0()){if(e.allowInfinityPoint&&!t.is0(A.py))return;throw new Error("bad point: ZERO")}const{x:a,y:w}=A.toAffine();if(!t.isValid(a)||!t.isValid(w))throw new Error("bad point: x or y not FE");if(!f(a,w))throw new Error("bad point: equation left != right");if(!A.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class p{constructor(a,w,m){if(a==null||!t.isValid(a))throw new Error("x required");if(w==null||!t.isValid(w)||t.is0(w))throw new Error("y required");if(m==null||!t.isValid(m))throw new Error("z required");this.px=a,this.py=w,this.pz=m,Object.freeze(this)}static fromAffine(a){const{x:w,y:m}=a||{};if(!a||!t.isValid(w)||!t.isValid(m))throw new Error("invalid affine point");if(a instanceof p)throw new Error("projective point not allowed");const v=O=>t.eql(O,t.ZERO);return v(w)&&v(m)?p.ZERO:new p(w,m,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(a){const w=le(t,a.map(m=>m.pz));return a.map((m,v)=>m.toAffine(w[v])).map(p.fromAffine)}static fromHex(a){const w=p.fromAffine(s(K("pointHex",a)));return w.assertValidity(),w}static fromPrivateKey(a){return p.BASE.multiply(h(a))}static msm(a,w){return Ge(p,r,a,w)}_setWindowSize(a){D.setWindowSize(this,a)}assertValidity(){_(this)}hasEvenY(){const{y:a}=this.toAffine();if(t.isOdd)return!t.isOdd(a);throw new Error("Field doesn't support isOdd")}equals(a){B(a);const{px:w,py:m,pz:v}=this,{px:O,py:L,pz:H}=a,y=t.eql(t.mul(w,H),t.mul(O,v)),N=t.eql(t.mul(m,H),t.mul(L,v));return y&&N}negate(){return new p(this.px,t.neg(this.py),this.pz)}double(){const{a,b:w}=e,m=t.mul(w,_t),{px:v,py:O,pz:L}=this;let H=t.ZERO,y=t.ZERO,N=t.ZERO,x=t.mul(v,v),T=t.mul(O,O),d=t.mul(L,L),u=t.mul(v,O);return u=t.add(u,u),N=t.mul(v,L),N=t.add(N,N),H=t.mul(a,N),y=t.mul(m,d),y=t.add(H,y),H=t.sub(T,y),y=t.add(T,y),y=t.mul(H,y),H=t.mul(u,H),N=t.mul(m,N),d=t.mul(a,d),u=t.sub(x,d),u=t.mul(a,u),u=t.add(u,N),N=t.add(x,x),x=t.add(N,x),x=t.add(x,d),x=t.mul(x,u),y=t.add(y,x),d=t.mul(O,L),d=t.add(d,d),x=t.mul(d,u),H=t.sub(H,x),N=t.mul(d,T),N=t.add(N,N),N=t.add(N,N),new p(H,y,N)}add(a){B(a);const{px:w,py:m,pz:v}=this,{px:O,py:L,pz:H}=a;let y=t.ZERO,N=t.ZERO,x=t.ZERO;const T=e.a,d=t.mul(e.b,_t);let u=t.mul(w,O),b=t.mul(m,L),I=t.mul(v,H),E=t.add(w,m),S=t.add(O,L);E=t.mul(E,S),S=t.add(u,b),E=t.sub(E,S),S=t.add(w,v);let U=t.add(O,H);return S=t.mul(S,U),U=t.add(u,I),S=t.sub(S,U),U=t.add(m,v),y=t.add(L,H),U=t.mul(U,y),y=t.add(b,I),U=t.sub(U,y),x=t.mul(T,S),y=t.mul(d,I),x=t.add(y,x),y=t.sub(b,x),x=t.add(b,x),N=t.mul(y,x),b=t.add(u,u),b=t.add(b,u),I=t.mul(T,I),S=t.mul(d,S),b=t.add(b,I),I=t.sub(u,I),I=t.mul(T,I),S=t.add(S,I),u=t.mul(b,S),N=t.add(N,u),u=t.mul(U,S),y=t.mul(E,y),y=t.sub(y,u),u=t.mul(E,b),x=t.mul(U,x),x=t.add(x,u),new p(y,N,x)}subtract(a){return this.add(a.negate())}is0(){return this.equals(p.ZERO)}wNAF(a){return D.wNAFCached(this,a,p.normalizeZ)}multiplyUnsafe(a){const{endo:w,n:m}=e;ft("scalar",a,X,m);const v=p.ZERO;if(a===X)return v;if(this.is0()||a===k)return this;if(!w||D.hasPrecomputes(this))return D.wNAFCachedUnsafe(this,a,p.normalizeZ);let{k1neg:O,k1:L,k2neg:H,k2:y}=w.splitScalar(a),N=v,x=v,T=this;for(;L>X||y>X;)L&k&&(N=N.add(T)),y&k&&(x=x.add(T)),T=T.double(),L>>=k,y>>=k;return O&&(N=N.negate()),H&&(x=x.negate()),x=new p(t.mul(x.px,w.beta),x.py,x.pz),N.add(x)}multiply(a){const{endo:w,n:m}=e;ft("scalar",a,k,m);let v,O;if(w){const{k1neg:L,k1:H,k2neg:y,k2:N}=w.splitScalar(a);let{p:x,f:T}=this.wNAF(H),{p:d,f:u}=this.wNAF(N);x=D.constTimeNegate(L,x),d=D.constTimeNegate(y,d),d=new p(t.mul(d.px,w.beta),d.py,d.pz),v=x.add(d),O=T.add(u)}else{const{p:L,f:H}=this.wNAF(a);v=L,O=H}return p.normalizeZ([v,O])[0]}multiplyAndAddUnsafe(a,w,m){const v=p.BASE,O=(H,y)=>y===X||y===k||!H.equals(v)?H.multiplyUnsafe(y):H.multiply(y),L=O(this,w).add(O(a,m));return L.is0()?void 0:L}toAffine(a){return q(this,a)}isTorsionFree(){const{h:a,isTorsionFree:w}=e;if(a===k)return!0;if(w)return w(p,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:a,clearCofactor:w}=e;return a===k?this:w?w(p,this):this.multiplyUnsafe(e.h)}toRawBytes(a=!0){return dt("isCompressed",a),this.assertValidity(),i(p,this,a)}toHex(a=!0){return dt("isCompressed",a),ht(this.toRawBytes(a))}}p.BASE=new p(e.Gx,e.Gy,t.ONE),p.ZERO=new p(t.ZERO,t.ONE,t.ZERO);const{endo:Z,nBitLength:R}=e,D=De(p,Z?Math.ceil(R/2):R);return{CURVE:e,ProjectivePoint:p,normPrivateKeyToScalar:h,weierstrassEquation:c,isWithinCurveOrder:g}}function Qe(n){const e=be(n);return Bt(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function Je(n){const e=Qe(n),{Fp:t,n:r,nByteLength:i,nBitLength:s}=e,c=t.BYTES+1,f=2*t.BYTES+1;function o(d){return M(d,r)}function l(d){return kt(d,r)}const{ProjectivePoint:g,normPrivateKeyToScalar:h,weierstrassEquation:B,isWithinCurveOrder:q}=Xe({...e,toBytes(d,u,b){const I=u.toAffine(),E=t.toBytes(I.x),S=xt;return dt("isCompressed",b),b?S(Uint8Array.from([u.hasEvenY()?2:3]),E):S(Uint8Array.from([4]),E,t.toBytes(I.y))},fromBytes(d){const u=d.length,b=d[0],I=d.subarray(1);if(u===c&&(b===2||b===3)){const E=ot(I);if(!Mt(E,k,t.ORDER))throw new Error("Point is not on curve");const S=B(E);let U;try{U=t.sqrt(S)}catch(P){const V=P instanceof Error?": "+P.message:"";throw new Error("Point is not on curve"+V)}const z=(U&k)===k;return(b&1)===1!==z&&(U=t.neg(U)),{x:E,y:U}}else if(u===f&&b===4){const E=t.fromBytes(I.subarray(0,t.BYTES)),S=t.fromBytes(I.subarray(t.BYTES,2*t.BYTES));return{x:E,y:S}}else{const E=c,S=f;throw new Error("invalid Point, expected length of "+E+", or uncompressed "+S+", got "+u)}}});function _(d){const u=r>>k;return d>u}function p(d){return _(d)?o(-d):d}const Z=(d,u,b)=>ot(d.slice(u,b));class R{constructor(u,b,I){ft("r",u,k,r),ft("s",b,k,r),this.r=u,this.s=b,I!=null&&(this.recovery=I),Object.freeze(this)}static fromCompact(u){const b=i;return u=K("compactSignature",u,b*2),new R(Z(u,0,b),Z(u,b,2*b))}static fromDER(u){const{r:b,s:I}=F.toSig(K("DER",u));return new R(b,I)}assertValidity(){}addRecoveryBit(u){return new R(this.r,this.s,u)}recoverPublicKey(u){const{r:b,s:I,recovery:E}=this,S=v(K("msgHash",u));if(E==null||![0,1,2,3].includes(E))throw new Error("recovery id invalid");const U=E===2||E===3?b+e.n:b;if(U>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const z=E&1?"03":"02",W=g.fromHex(z+Ut(U,t.BYTES)),P=l(U),V=o(-S*P),it=o(I*P),Q=g.BASE.multiplyAndAddUnsafe(W,V,it);if(!Q)throw new Error("point at infinify");return Q.assertValidity(),Q}hasHighS(){return _(this.s)}normalizeS(){return this.hasHighS()?new R(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return yt(this.toDERHex())}toDERHex(){return F.hexFromSig(this)}toCompactRawBytes(){return yt(this.toCompactHex())}toCompactHex(){const u=i;return Ut(this.r,u)+Ut(this.s,u)}}const D={isValidPrivateKey(d){try{return h(d),!0}catch{return!1}},normPrivateKeyToScalar:h,randomPrivateKey:()=>{const d=we(e.n);return Ye(e.randomBytes(d),e.n)},precompute(d=8,u=g.BASE){return u._setWindowSize(d),u.multiply(BigInt(3)),u}};function A(d,u=!0){return g.fromPrivateKey(d).toRawBytes(u)}function a(d){if(typeof d=="bigint")return!1;if(d instanceof g)return!0;const b=K("key",d).length,I=t.BYTES,E=I+1,S=2*I+1;if(!(e.allowedPrivateKeyLengths||i===E))return b===E||b===S}function w(d,u,b=!0){if(a(d)===!0)throw new Error("first arg must be private key");if(a(u)===!1)throw new Error("second arg must be public key");return g.fromHex(u).multiply(h(d)).toRawBytes(b)}const m=e.bits2int||function(d){if(d.length>8192)throw new Error("input is too large");const u=ot(d),b=d.length*8-s;return b>0?u>>BigInt(b):u},v=e.bits2int_modN||function(d){return o(m(d))},O=Et(s);function L(d){return ft("num < 2^"+s,d,X,O),gt(d,i)}function H(d,u,b=y){if(["recovered","canonical"].some(et=>et in b))throw new Error("sign() legacy options not supported");const{hash:I,randomBytes:E}=e;let{lowS:S,prehash:U,extraEntropy:z}=b;S==null&&(S=!0),d=K("msgHash",d),$t(b),U&&(d=K("prehashed msgHash",I(d)));const W=v(d),P=h(u),V=[L(P),L(W)];if(z!=null&&z!==!1){const et=z===!0?E(t.BYTES):z;V.push(K("extraEntropy",et))}const it=xt(...V),Q=W;function vt(et){const st=m(et);if(!q(st))return;const St=l(st),at=g.BASE.multiply(st).toAffine(),nt=o(at.x);if(nt===X)return;const ut=o(St*o(Q+nt*P));if(ut===X)return;let lt=(at.x===nt?0:2)|Number(at.y&k),ct=ut;return S&&_(ut)&&(ct=p(ut),lt^=1),new R(nt,ct,lt)}return{seed:it,k2sig:vt}}const y={lowS:e.lowS,prehash:!1},N={lowS:e.lowS,prehash:!1};function x(d,u,b=y){const{seed:I,k2sig:E}=H(d,u,b),S=e;return Re(S.hash.outputLen,S.nByteLength,S.hmac)(I,E)}g.BASE._setWindowSize(8);function T(d,u,b,I=N){var lt;const E=d;u=K("msgHash",u),b=K("publicKey",b);const{lowS:S,prehash:U,format:z}=I;if($t(I),"strict"in I)throw new Error("options.strict was renamed to lowS");if(z!==void 0&&z!=="compact"&&z!=="der")throw new Error("format must be compact or der");const W=typeof E=="string"||wt(E),P=!W&&!z&&typeof E=="object"&&E!==null&&typeof E.r=="bigint"&&typeof E.s=="bigint";if(!W&&!P)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let V,it;try{if(P&&(V=new R(E.r,E.s)),W){try{z!=="compact"&&(V=R.fromDER(E))}catch(ct){if(!(ct instanceof F.Err))throw ct}!V&&z!=="der"&&(V=R.fromCompact(E))}it=g.fromHex(b)}catch{return!1}if(!V||S&&V.hasHighS())return!1;U&&(u=e.hash(u));const{r:Q,s:vt}=V,et=v(u),st=l(vt),St=o(et*st),at=o(Q*st),nt=(lt=g.BASE.multiplyAndAddUnsafe(it,St,at))==null?void 0:lt.toAffine();return nt?o(nt.x)===Q:!1}return{CURVE:e,getPublicKey:A,getSharedSecret:w,sign:x,verify:T,ProjectivePoint:g,Signature:R,utils:D}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function tn(n){return{hash:n,hmac:(e,...t)=>ne(n,e,Se(...t)),randomBytes:ve}}function en(n,e){const t=r=>Je({...n,...tn(r)});return{...t(e),create:t}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const me=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Ft=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),nn=BigInt(0),rn=BigInt(1),Zt=BigInt(2),Xt=(n,e)=>(n+e/Zt)/e;function on(n){const e=me,t=BigInt(3),r=BigInt(6),i=BigInt(11),s=BigInt(22),c=BigInt(23),f=BigInt(44),o=BigInt(88),l=n*n*n%e,g=l*l*n%e,h=Y(g,t,e)*g%e,B=Y(h,t,e)*g%e,q=Y(B,Zt,e)*l%e,_=Y(q,i,e)*q%e,p=Y(_,s,e)*_%e,Z=Y(p,f,e)*p%e,R=Y(Z,o,e)*Z%e,D=Y(R,f,e)*p%e,A=Y(D,t,e)*g%e,a=Y(A,c,e)*_%e,w=Y(a,r,e)*l%e,m=Y(w,Zt,e);if(!zt.eql(zt.sqr(m),n))throw new Error("Cannot find square root");return m}const zt=jt(me,void 0,void 0,{sqrt:on}),ln=en({a:nn,b:BigInt(7),Fp:zt,n:Ft,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{const e=Ft,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-rn*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=t,c=BigInt("0x100000000000000000000000000000000"),f=Xt(s*n,e),o=Xt(-r*n,e);let l=M(n-f*t-o*i,e),g=M(-f*r-o*s,e);const h=l>c,B=g>c;if(h&&(l=e-l),B&&(g=e-g),l>c||g>c)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:h,k1:l,k2neg:B,k2:g}}}},Le);export{ln as secp256k1};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{E as h,F as r}from"./ThirdwebWalletManager-C0WgXnZx.js";import"./index-Fv-acDXO.js";import"./store-CraP4F4Y.js";import"./webauthn.min-CGpVStYZ.js";import"./index.es-DkH7OFeN.js";async function B(s){const{account:t,transactions:a}=s;if(!t)throw new Error("not connected");if(a.length===0)throw new Error("No transactions to send");const o=a[0];if(!o)throw new Error("No transactions to send");if(t.sendBatchTransaction){const e=await Promise.all(a.map(async n=>{const[i,c,l,d]=await Promise.all([h(n),r(n.to),r(n.accessList),r(n.value)]);return{accessList:l,chainId:n.chain.id,data:i,to:c,value:d}}));return{...await t.sendBatchTransaction(e),chain:o.chain,client:o.client}}throw new Error("Account doesn't implement sendBatchTransaction")}export{B as sendBatchTransaction};
|