hardhat-airsign 0.1.1 → 2.0.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/README.md +15 -10
- package/app-dist/assets/{add-CRSDwB2e.js → add-B1O0pD4h.js} +2 -2
- package/app-dist/assets/{add-CRSDwB2e.js.map → add-B1O0pD4h.js.map} +1 -1
- package/app-dist/assets/{all-wallets-DgqGjhs6.js → all-wallets-BcziYGZ_.js} +2 -2
- package/app-dist/assets/{all-wallets-DgqGjhs6.js.map → all-wallets-BcziYGZ_.js.map} +1 -1
- package/app-dist/assets/{app-store-BShzSz5b.js → app-store-DTZWqmmw.js} +2 -2
- package/app-dist/assets/{app-store-BShzSz5b.js.map → app-store-DTZWqmmw.js.map} +1 -1
- package/app-dist/assets/{apple-B_-sOHVN.js → apple-DnCGgNDe.js} +2 -2
- package/app-dist/assets/{apple-B_-sOHVN.js.map → apple-DnCGgNDe.js.map} +1 -1
- package/app-dist/assets/{arrow-bottom-DF5A1caW.js → arrow-bottom-DXZcPFiW.js} +2 -2
- package/app-dist/assets/{arrow-bottom-DF5A1caW.js.map → arrow-bottom-DXZcPFiW.js.map} +1 -1
- package/app-dist/assets/{arrow-bottom-circle-DIuZ8lC1.js → arrow-bottom-circle-1VxgUNV2.js} +2 -2
- package/app-dist/assets/{arrow-bottom-circle-DIuZ8lC1.js.map → arrow-bottom-circle-1VxgUNV2.js.map} +1 -1
- package/app-dist/assets/{arrow-left-CwTRYhiP.js → arrow-left-UpOOX78-.js} +2 -2
- package/app-dist/assets/{arrow-left-CwTRYhiP.js.map → arrow-left-UpOOX78-.js.map} +1 -1
- package/app-dist/assets/{arrow-right-CxBc1Z9Y.js → arrow-right-BgZSbrSb.js} +2 -2
- package/app-dist/assets/{arrow-right-CxBc1Z9Y.js.map → arrow-right-BgZSbrSb.js.map} +1 -1
- package/app-dist/assets/{arrow-top-DsqFntWs.js → arrow-top-CFitTuMQ.js} +2 -2
- package/app-dist/assets/{arrow-top-DsqFntWs.js.map → arrow-top-CFitTuMQ.js.map} +1 -1
- package/app-dist/assets/{bank-DaZBNytp.js → bank-Rx-cZHky.js} +2 -2
- package/app-dist/assets/{bank-DaZBNytp.js.map → bank-Rx-cZHky.js.map} +1 -1
- package/app-dist/assets/{basic-uYjQL5PS.js → basic-BqBpZO5u.js} +2 -2
- package/app-dist/assets/{basic-uYjQL5PS.js.map → basic-BqBpZO5u.js.map} +1 -1
- package/app-dist/assets/{browser-C1c_DZTT.js → browser-CxT64RYX.js} +2 -2
- package/app-dist/assets/{browser-C1c_DZTT.js.map → browser-CxT64RYX.js.map} +1 -1
- package/app-dist/assets/{card-Drom7Tv5.js → card-wzpea_VN.js} +2 -2
- package/app-dist/assets/{card-Drom7Tv5.js.map → card-wzpea_VN.js.map} +1 -1
- package/app-dist/assets/{ccip-DvVERuyo.js → ccip-8vMs6YOX.js} +2 -2
- package/app-dist/assets/{ccip-DvVERuyo.js.map → ccip-8vMs6YOX.js.map} +1 -1
- package/app-dist/assets/{checkmark-bWnoU59f.js → checkmark-5ZvdJ4cE.js} +2 -2
- package/app-dist/assets/{checkmark-bWnoU59f.js.map → checkmark-5ZvdJ4cE.js.map} +1 -1
- package/app-dist/assets/{checkmark-bold-xdhuFcVd.js → checkmark-bold-BYMoYpV3.js} +2 -2
- package/app-dist/assets/{checkmark-bold-xdhuFcVd.js.map → checkmark-bold-BYMoYpV3.js.map} +1 -1
- package/app-dist/assets/{chevron-bottom-g8RZtvvg.js → chevron-bottom-B6KoLsrA.js} +2 -2
- package/app-dist/assets/{chevron-bottom-g8RZtvvg.js.map → chevron-bottom-B6KoLsrA.js.map} +1 -1
- package/app-dist/assets/{chevron-left-CHq90J3p.js → chevron-left-UNWSh_Nj.js} +2 -2
- package/app-dist/assets/{chevron-left-CHq90J3p.js.map → chevron-left-UNWSh_Nj.js.map} +1 -1
- package/app-dist/assets/{chevron-right-DucMuosL.js → chevron-right-CLj5tStC.js} +2 -2
- package/app-dist/assets/{chevron-right-DucMuosL.js.map → chevron-right-CLj5tStC.js.map} +1 -1
- package/app-dist/assets/{chevron-top-jMvIimGH.js → chevron-top-DlIr11pX.js} +2 -2
- package/app-dist/assets/{chevron-top-jMvIimGH.js.map → chevron-top-DlIr11pX.js.map} +1 -1
- package/app-dist/assets/{chrome-store-DOAtVsxB.js → chrome-store-DSK4e2pT.js} +2 -2
- package/app-dist/assets/{chrome-store-DOAtVsxB.js.map → chrome-store-DSK4e2pT.js.map} +1 -1
- package/app-dist/assets/{clock-ByhfgiIa.js → clock-BFabU289.js} +2 -2
- package/app-dist/assets/{clock-ByhfgiIa.js.map → clock-BFabU289.js.map} +1 -1
- package/app-dist/assets/{close-kCTB-L29.js → close-BUfuggox.js} +2 -2
- package/app-dist/assets/{close-kCTB-L29.js.map → close-BUfuggox.js.map} +1 -1
- package/app-dist/assets/{coinPlaceholder-Nn0hvSA9.js → coinPlaceholder-DISCc80i.js} +2 -2
- package/app-dist/assets/{coinPlaceholder-Nn0hvSA9.js.map → coinPlaceholder-DISCc80i.js.map} +1 -1
- package/app-dist/assets/{compass-CbGNPMoI.js → compass-BoZDQj8C.js} +2 -2
- package/app-dist/assets/{compass-CbGNPMoI.js.map → compass-BoZDQj8C.js.map} +1 -1
- package/app-dist/assets/{copy-CAKeZlqs.js → copy-B7bketHz.js} +2 -2
- package/app-dist/assets/{copy-CAKeZlqs.js.map → copy-B7bketHz.js.map} +1 -1
- package/app-dist/assets/{core-BYSbgSRm.js → core-DPYRoLAn.js} +5 -5
- package/app-dist/assets/{core-BYSbgSRm.js.map → core-DPYRoLAn.js.map} +1 -1
- package/app-dist/assets/{cursor-Bt2rMzub.js → cursor-Dm0JxInY.js} +2 -2
- package/app-dist/assets/{cursor-Bt2rMzub.js.map → cursor-Dm0JxInY.js.map} +1 -1
- package/app-dist/assets/{cursor-transparent-B9I7l5HE.js → cursor-transparent-2ch9c1jg.js} +2 -2
- package/app-dist/assets/{cursor-transparent-B9I7l5HE.js.map → cursor-transparent-2ch9c1jg.js.map} +1 -1
- package/app-dist/assets/{desktop-Be_5H0x-.js → desktop-CIwtNj0u.js} +2 -2
- package/app-dist/assets/{desktop-Be_5H0x-.js.map → desktop-CIwtNj0u.js.map} +1 -1
- package/app-dist/assets/{disconnect-Dgoh7Tjm.js → disconnect-BOp-awMm.js} +2 -2
- package/app-dist/assets/{disconnect-Dgoh7Tjm.js.map → disconnect-BOp-awMm.js.map} +1 -1
- package/app-dist/assets/{discord-hBwKNnvZ.js → discord-BV0ggy08.js} +2 -2
- package/app-dist/assets/{discord-hBwKNnvZ.js.map → discord-BV0ggy08.js.map} +1 -1
- package/app-dist/assets/{etherscan-D0htYnpR.js → etherscan-t7Ki-QEK.js} +2 -2
- package/app-dist/assets/{etherscan-D0htYnpR.js.map → etherscan-t7Ki-QEK.js.map} +1 -1
- package/app-dist/assets/{events-pn7_SzwY.js → events-CavTDrjb.js} +2 -2
- package/app-dist/assets/{events-pn7_SzwY.js.map → events-CavTDrjb.js.map} +1 -1
- package/app-dist/assets/{exclamation-triangle-DOILyuF7.js → exclamation-triangle-Ccoe4UL9.js} +2 -2
- package/app-dist/assets/{exclamation-triangle-DOILyuF7.js.map → exclamation-triangle-Ccoe4UL9.js.map} +1 -1
- package/app-dist/assets/{extension-C9VDzCuK.js → extension-ChDmttRe.js} +2 -2
- package/app-dist/assets/{extension-C9VDzCuK.js.map → extension-ChDmttRe.js.map} +1 -1
- package/app-dist/assets/{external-link-CHYUmCEz.js → external-link-DubRbP6I.js} +2 -2
- package/app-dist/assets/{external-link-CHYUmCEz.js.map → external-link-DubRbP6I.js.map} +1 -1
- package/app-dist/assets/{facebook-Bsw-oFCw.js → facebook-CJcCYN5s.js} +2 -2
- package/app-dist/assets/{facebook-Bsw-oFCw.js.map → facebook-CJcCYN5s.js.map} +1 -1
- package/app-dist/assets/{farcaster-1gUIAUSw.js → farcaster-B4THrfxr.js} +2 -2
- package/app-dist/assets/{farcaster-1gUIAUSw.js.map → farcaster-B4THrfxr.js.map} +1 -1
- package/app-dist/assets/{filters-DDG3UMYY.js → filters-CuA9h5f-.js} +2 -2
- package/app-dist/assets/{filters-DDG3UMYY.js.map → filters-CuA9h5f-.js.map} +1 -1
- package/app-dist/assets/{github-CdtDuNaw.js → github-_wOQdqR_.js} +2 -2
- package/app-dist/assets/{github-CdtDuNaw.js.map → github-_wOQdqR_.js.map} +1 -1
- package/app-dist/assets/{google-BsG5fyrR.js → google-BETdiWIY.js} +2 -2
- package/app-dist/assets/{google-BsG5fyrR.js.map → google-BETdiWIY.js.map} +1 -1
- package/app-dist/assets/{help-circle-BCv1YqDB.js → help-circle-DGL5kFly.js} +2 -2
- package/app-dist/assets/{help-circle-BCv1YqDB.js.map → help-circle-DGL5kFly.js.map} +1 -1
- package/app-dist/assets/{id-CuxXJxny.js → id-BAmiPiG3.js} +2 -2
- package/app-dist/assets/{id-CuxXJxny.js.map → id-BAmiPiG3.js.map} +1 -1
- package/app-dist/assets/{image-B6FZSvkt.js → image-DBuiW2ya.js} +2 -2
- package/app-dist/assets/{image-B6FZSvkt.js.map → image-DBuiW2ya.js.map} +1 -1
- package/app-dist/assets/{index-BV0j_tJd.js → index-B7r6Bd0d.js} +2 -2
- package/app-dist/assets/{index-BV0j_tJd.js.map → index-B7r6Bd0d.js.map} +1 -1
- package/app-dist/assets/{index-CqsmC2RT.js → index-BgHayQna.js} +2 -2
- package/app-dist/assets/{index-CqsmC2RT.js.map → index-BgHayQna.js.map} +1 -1
- package/app-dist/assets/{index-COvL4P9m.js → index-BjRfNTdk.js} +2 -2
- package/app-dist/assets/{index-COvL4P9m.js.map → index-BjRfNTdk.js.map} +1 -1
- package/app-dist/assets/{index-Bu_XtD5E.css → index-C31w0EhJ.css} +1 -1
- package/app-dist/assets/index-D2ubWGvc.js +1753 -0
- package/app-dist/assets/index-D2ubWGvc.js.map +1 -0
- package/app-dist/assets/{index-DgGGl0Fe.js → index-DStAvMlI.js} +4 -4
- package/app-dist/assets/{index-DgGGl0Fe.js.map → index-DStAvMlI.js.map} +1 -1
- package/app-dist/assets/{index-DCjRGeb3.js → index-Dt_15Vcx.js} +2 -2
- package/app-dist/assets/{index-DCjRGeb3.js.map → index-Dt_15Vcx.js.map} +1 -1
- package/app-dist/assets/{index.es-DO7evs6Y.js → index.es-BaHcVq9H.js} +5 -5
- package/app-dist/assets/{index.es-DO7evs6Y.js.map → index.es-BaHcVq9H.js.map} +1 -1
- package/app-dist/assets/{info-Cywbxt_C.js → info-BGwX-8wC.js} +2 -2
- package/app-dist/assets/{info-Cywbxt_C.js.map → info-BGwX-8wC.js.map} +1 -1
- package/app-dist/assets/{info-circle-C86J6rkz.js → info-circle-BVE7L9LU.js} +2 -2
- package/app-dist/assets/{info-circle-C86J6rkz.js.map → info-circle-BVE7L9LU.js.map} +1 -1
- package/app-dist/assets/{lightbulb-CrZ_HglP.js → lightbulb-wyn0YT99.js} +2 -2
- package/app-dist/assets/{lightbulb-CrZ_HglP.js.map → lightbulb-wyn0YT99.js.map} +1 -1
- package/app-dist/assets/{mail-C3L0F8f-.js → mail-CqURWsZw.js} +2 -2
- package/app-dist/assets/{mail-C3L0F8f-.js.map → mail-CqURWsZw.js.map} +1 -1
- package/app-dist/assets/{metamask-sdk-CF6XpUqS.js → metamask-sdk-CCICWViI.js} +2 -2
- package/app-dist/assets/{metamask-sdk-CF6XpUqS.js.map → metamask-sdk-CCICWViI.js.map} +1 -1
- package/app-dist/assets/{mobile-D15vpxIp.js → mobile-DxekcR5S.js} +2 -2
- package/app-dist/assets/{mobile-D15vpxIp.js.map → mobile-DxekcR5S.js.map} +1 -1
- package/app-dist/assets/{more-B7ExUA9_.js → more-B2xjqArO.js} +2 -2
- package/app-dist/assets/{more-B7ExUA9_.js.map → more-B2xjqArO.js.map} +1 -1
- package/app-dist/assets/{network-placeholder-CcVy_R0p.js → network-placeholder-xy3H4Mg-.js} +2 -2
- package/app-dist/assets/{network-placeholder-CcVy_R0p.js.map → network-placeholder-xy3H4Mg-.js.map} +1 -1
- package/app-dist/assets/{nftPlaceholder-BACi0fly.js → nftPlaceholder-kGyQv4gE.js} +2 -2
- package/app-dist/assets/{nftPlaceholder-BACi0fly.js.map → nftPlaceholder-kGyQv4gE.js.map} +1 -1
- package/app-dist/assets/{off-Duwf9ts8.js → off-CSqaEbkD.js} +2 -2
- package/app-dist/assets/{off-Duwf9ts8.js.map → off-CSqaEbkD.js.map} +1 -1
- package/app-dist/assets/{play-store-4-EkI0KV.js → play-store-EIdU_7Z6.js} +2 -2
- package/app-dist/assets/{play-store-4-EkI0KV.js.map → play-store-EIdU_7Z6.js.map} +1 -1
- package/app-dist/assets/{plus-aeb5pwem.js → plus-CPg4pjRj.js} +2 -2
- package/app-dist/assets/{plus-aeb5pwem.js.map → plus-CPg4pjRj.js.map} +1 -1
- package/app-dist/assets/{qr-code-Cz7L38yy.js → qr-code-QAMIsYXK.js} +2 -2
- package/app-dist/assets/{qr-code-Cz7L38yy.js.map → qr-code-QAMIsYXK.js.map} +1 -1
- package/app-dist/assets/{recycle-horizontal-yjJpXq0U.js → recycle-horizontal-CV5Qhw2Q.js} +2 -2
- package/app-dist/assets/{recycle-horizontal-yjJpXq0U.js.map → recycle-horizontal-CV5Qhw2Q.js.map} +1 -1
- package/app-dist/assets/{refresh-fCA8pyDR.js → refresh-CJiM3xIB.js} +2 -2
- package/app-dist/assets/{refresh-fCA8pyDR.js.map → refresh-CJiM3xIB.js.map} +1 -1
- package/app-dist/assets/{reown-logo-YZnn6vkB.js → reown-logo-2D0oWXpD.js} +2 -2
- package/app-dist/assets/{reown-logo-YZnn6vkB.js.map → reown-logo-2D0oWXpD.js.map} +1 -1
- package/app-dist/assets/{search-BTh-Taun.js → search-DaHshq-U.js} +2 -2
- package/app-dist/assets/{search-BTh-Taun.js.map → search-DaHshq-U.js.map} +1 -1
- package/app-dist/assets/{secp256k1-DHeNy7w5.js → secp256k1-Od6Yo9wC.js} +2 -2
- package/app-dist/assets/{secp256k1-DHeNy7w5.js.map → secp256k1-Od6Yo9wC.js.map} +1 -1
- package/app-dist/assets/{secp256k1-BmolwVbs.js → secp256k1-RfsuBfnr.js} +2 -2
- package/app-dist/assets/{secp256k1-BmolwVbs.js.map → secp256k1-RfsuBfnr.js.map} +1 -1
- package/app-dist/assets/{send-n_iRWU2b.js → send-CYoNJcmR.js} +2 -2
- package/app-dist/assets/{send-n_iRWU2b.js.map → send-CYoNJcmR.js.map} +1 -1
- package/app-dist/assets/{swapHorizontal-BP6PC_Z_.js → swapHorizontal-CZlBSPys.js} +2 -2
- package/app-dist/assets/{swapHorizontal-BP6PC_Z_.js.map → swapHorizontal-CZlBSPys.js.map} +1 -1
- package/app-dist/assets/{swapHorizontalBold-CFegHLnf.js → swapHorizontalBold-CRZWDopS.js} +2 -2
- package/app-dist/assets/{swapHorizontalBold-CFegHLnf.js.map → swapHorizontalBold-CRZWDopS.js.map} +1 -1
- package/app-dist/assets/{swapHorizontalMedium-SMFfM3Zt.js → swapHorizontalMedium-CnvLAErw.js} +2 -2
- package/app-dist/assets/{swapHorizontalMedium-SMFfM3Zt.js.map → swapHorizontalMedium-CnvLAErw.js.map} +1 -1
- package/app-dist/assets/{swapHorizontalRoundedBold-BFRiRjq3.js → swapHorizontalRoundedBold-dSf21G7J.js} +2 -2
- package/app-dist/assets/{swapHorizontalRoundedBold-BFRiRjq3.js.map → swapHorizontalRoundedBold-dSf21G7J.js.map} +1 -1
- package/app-dist/assets/{swapVertical-DDYPFhjA.js → swapVertical-VhVxJU3T.js} +2 -2
- package/app-dist/assets/{swapVertical-DDYPFhjA.js.map → swapVertical-VhVxJU3T.js.map} +1 -1
- package/app-dist/assets/{telegram-CgxOCx9n.js → telegram-B-C9jpHB.js} +2 -2
- package/app-dist/assets/{telegram-CgxOCx9n.js.map → telegram-B-C9jpHB.js.map} +1 -1
- package/app-dist/assets/{three-dots-D1ACjz76.js → three-dots-FILuNYsd.js} +2 -2
- package/app-dist/assets/{three-dots-D1ACjz76.js.map → three-dots-FILuNYsd.js.map} +1 -1
- package/app-dist/assets/{twitch-B2cSw5Dv.js → twitch-DzwaF4Xb.js} +2 -2
- package/app-dist/assets/{twitch-B2cSw5Dv.js.map → twitch-DzwaF4Xb.js.map} +1 -1
- package/app-dist/assets/{twitterIcon-Y2aP57GN.js → twitterIcon-BlKnBtTW.js} +2 -2
- package/app-dist/assets/{twitterIcon-Y2aP57GN.js.map → twitterIcon-BlKnBtTW.js.map} +1 -1
- package/app-dist/assets/{verify-DLqSD1rk.js → verify-CmtNTJ_r.js} +2 -2
- package/app-dist/assets/{verify-DLqSD1rk.js.map → verify-CmtNTJ_r.js.map} +1 -1
- package/app-dist/assets/{verify-filled-M4ZQNUx-.js → verify-filled-DqUbrpnW.js} +2 -2
- package/app-dist/assets/{verify-filled-M4ZQNUx-.js.map → verify-filled-DqUbrpnW.js.map} +1 -1
- package/app-dist/assets/{w3m-modal-DO_pwuIZ.js → w3m-modal-CACYy1Ye.js} +2 -2
- package/app-dist/assets/{w3m-modal-DO_pwuIZ.js.map → w3m-modal-CACYy1Ye.js.map} +1 -1
- package/app-dist/assets/{wallet-BK-Vsgfk.js → wallet-DG-gDy5_.js} +2 -2
- package/app-dist/assets/{wallet-BK-Vsgfk.js.map → wallet-DG-gDy5_.js.map} +1 -1
- package/app-dist/assets/{wallet-placeholder-Dz0rtjLT.js → wallet-placeholder-C5F1lcuc.js} +2 -2
- package/app-dist/assets/{wallet-placeholder-Dz0rtjLT.js.map → wallet-placeholder-C5F1lcuc.js.map} +1 -1
- package/app-dist/assets/{walletconnect-EGqMGNfn.js → walletconnect-D9ToqDlh.js} +2 -2
- package/app-dist/assets/{walletconnect-EGqMGNfn.js.map → walletconnect-D9ToqDlh.js.map} +1 -1
- package/app-dist/assets/{warning-circle-BL_LsWzv.js → warning-circle-5kuvvJFh.js} +2 -2
- package/app-dist/assets/{warning-circle-BL_LsWzv.js.map → warning-circle-5kuvvJFh.js.map} +1 -1
- package/app-dist/assets/{x-Ck4eRtmA.js → x-B1dqvWvO.js} +2 -2
- package/app-dist/assets/{x-Ck4eRtmA.js.map → x-B1dqvWvO.js.map} +1 -1
- package/app-dist/index.html +2 -2
- package/dist/ContractService.d.ts +159 -0
- package/dist/ContractService.d.ts.map +1 -0
- package/dist/ContractService.js +530 -0
- package/dist/ContractService.js.map +1 -0
- package/dist/SigningServer.d.ts +6 -0
- package/dist/SigningServer.d.ts.map +1 -1
- package/dist/SigningServer.js +395 -0
- package/dist/SigningServer.js.map +1 -1
- package/dist/adapters/ethers-adapter.d.ts +34 -0
- package/dist/adapters/ethers-adapter.d.ts.map +1 -0
- package/dist/adapters/ethers-adapter.js +106 -0
- package/dist/adapters/ethers-adapter.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/dist/tasks/start.js +1 -1
- package/package.json +6 -3
- package/app-dist/assets/index-StZFkTrD.js +0 -1753
- package/app-dist/assets/index-StZFkTrD.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{B as tr,_ as q,h as hi,y as Jo}from"./hooks.module-Dz_XB4AG.js";import{A as Qo,v as Ur,x as $t,I as Xo,y as he,z as ga,C as ec,D as tc,F as D,G as nc,J as rc,K as ic,L as ac,M as sc,f as xt,N as hn,O as ba,P as oc,Q as cc,e as ut,R as wa,p as Cn,S as Le,V as Re,X as va,Y as nr,Z as uc,B as j,$ as dc,a0 as mi,d as lc,a1 as fc,a2 as pc,a3 as hc,a4 as Qe,a5 as Hr,n as He,a6 as mc,a7 as yc,a8 as Gr,a9 as xa,aa as gc,ab as bc,ac as wc,s as vc,ad as xc,ae as Ec,af as Sc,ag as kc,t as yi,h as bt,o as Ea,ah as Ac,u as Et,ai as Sa,aj as gi,ak as bi,al as ka,am as wi,an as vi,ao as Aa,ap as _c,aq as Un,i as Ic,g as Oc}from"./index-StZFkTrD.js";import{c as Pc,s as Cc,d as Tc,g as Bc}from"./index-nibyPLVP.js";function Lc(e,t){if(e.length!==t.length)throw new Qo({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const i=e[r],a=t[r];n.push(_a(i,a))}return Ur(n)}function _a(e,t,n=!1){if(e==="address"){const s=t;if(!$t(s))throw new Xo({address:s});return he(s.toLowerCase(),{size:n?32:null})}if(e==="string")return ga(t);if(e==="bytes")return t;if(e==="bool")return he(ec(t),{size:n?32:1});const r=e.match(tc);if(r){const[s,o,c="256"]=r,u=Number.parseInt(c,10)/8;return D(t,{size:n?32:u,signed:o==="int"})}const i=e.match(nc);if(i){const[s,o]=i;if(Number.parseInt(o,10)!==(t.length-2)/2)throw new rc({expectedSize:Number.parseInt(o,10),givenSize:(t.length-2)/2});return he(t,{dir:"right",size:n?32:null})}const a=e.match(ic);if(a&&Array.isArray(t)){const[s,o]=a,c=[];for(let u=0;u<t.length;u++)c.push(_a(o,t[u],!0));return c.length===0?"0x":Ur(c)}throw new ac(e)}function Mc(e){const{source:t}=e,n=new Map,r=new sc(8192),i=new Map,a=({address:s,chainId:o})=>`${s}.${o}`;return{async consume({address:s,chainId:o,client:c}){const u=a({address:s,chainId:o}),p=this.get({address:s,chainId:o,client:c});this.increment({address:s,chainId:o});const d=await p;return await t.set({address:s,chainId:o},d),r.set(u,d),d},async increment({address:s,chainId:o}){const c=a({address:s,chainId:o}),u=n.get(c)??0;n.set(c,u+1)},async get({address:s,chainId:o,client:c}){const u=a({address:s,chainId:o});let p=i.get(u);return p||(p=(async()=>{try{const l=await t.get({address:s,chainId:o,client:c}),f=r.get(u)??0;return f>0&&l<=f?f+1:(r.delete(u),l)}finally{this.reset({address:s,chainId:o})}})(),i.set(u,p)),(n.get(u)??0)+await p},reset({address:s,chainId:o}){const c=a({address:s,chainId:o});n.delete(c),i.delete(c)}}}const jc="0x6492649264926492649264926492649264926492649264926492649264926492";function Hn(e){const{address:t,data:n,signature:r,to:i="hex"}=e,a=Ur([xt([{type:"address"},{type:"bytes"},{type:"bytes"}],[t,n,r]),jc]);return i==="hex"?a:hn(a)}function Nc(e){const{key:t="public",name:n="Public Client"}=e;return ba({...e,key:t,name:n,type:"publicClient"}).extend(oc)}function Dc(e){const{r:t,s:n}=cc.Signature.fromCompact(e.slice(2,130)),r=+`0x${e.slice(130)}`,[i,a]=(()=>{if(r===0||r===1)return[void 0,r];if(r===27)return[BigInt(r),0];if(r===28)return[BigInt(r),1];throw new Error("Invalid yParityOrV value")})();return typeof i<"u"?{r:D(t,{size:32}),s:D(n,{size:32}),v:i,yParity:a}:{r:D(t,{size:32}),s:D(n,{size:32}),yParity:a}}function Ia(e,t){let n;try{n=e()}catch{return}return{getItem:i=>{var a;const s=c=>c===null?null:JSON.parse(c,void 0),o=(a=n.getItem(i))!=null?a:null;return o instanceof Promise?o.then(s):s(o)},setItem:(i,a)=>n.setItem(i,JSON.stringify(a,void 0)),removeItem:i=>n.removeItem(i)}}const rr=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return rr(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return rr(r)(n)}}}},Rc=(e,t)=>(n,r,i)=>{let a={storage:Ia(()=>localStorage),partialize:m=>m,version:0,merge:(m,v)=>({...v,...m}),...t},s=!1;const o=new Set,c=new Set;let u=a.storage;if(!u)return e((...m)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...m)},r,i);const p=()=>{const m=a.partialize({...r()});return u.setItem(a.name,{state:m,version:a.version})},d=i.setState;i.setState=(m,v)=>{d(m,v),p()};const l=e((...m)=>{n(...m),p()},r,i);i.getInitialState=()=>l;let f;const h=()=>{var m,v;if(!u)return;s=!1,o.forEach(P=>{var x;return P((x=r())!=null?x:l)});const k=((v=a.onRehydrateStorage)==null?void 0:v.call(a,(m=r())!=null?m:l))||void 0;return rr(u.getItem.bind(u))(a.name).then(P=>{if(P)if(typeof P.version=="number"&&P.version!==a.version){if(a.migrate){const x=a.migrate(P.state,P.version);return x instanceof Promise?x.then(O=>[!0,O]):[!0,x]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,P.state];return[!1,void 0]}).then(P=>{var x;const[O,N]=P;if(f=a.merge(N,(x=r())!=null?x:l),n(f,!0),O)return p()}).then(()=>{k==null||k(f,void 0),f=r(),s=!0,c.forEach(P=>P(f))}).catch(P=>{k==null||k(void 0,P)})};return i.persist={setOptions:m=>{a={...a,...m},m.storage&&(u=m.storage)},clearStorage:()=>{u==null||u.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>h(),hasHydrated:()=>s,onHydrate:m=>(o.add(m),()=>{o.delete(m)}),onFinishHydration:m=>(c.add(m),()=>{c.delete(m)})},a.skipHydration||h(),f||l},Uc=Rc,xi=e=>{let t;const n=new Set,r=(u,p)=>{const d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){const l=t;t=p??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(f=>f(t,l))}},i=()=>t,o={setState:r,getState:i,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u))},c=t=e(r,i,o);return o},Fr=e=>e?xi(e):xi,Hc=[{inputs:[{name:"preOpGas",type:"uint256"},{name:"paid",type:"uint256"},{name:"validAfter",type:"uint48"},{name:"validUntil",type:"uint48"},{name:"targetSuccess",type:"bool"},{name:"targetResult",type:"bytes"}],name:"ExecutionResult",type:"error"},{inputs:[{name:"opIndex",type:"uint256"},{name:"reason",type:"string"}],name:"FailedOp",type:"error"},{inputs:[{name:"sender",type:"address"}],name:"SenderAddressResult",type:"error"},{inputs:[{name:"aggregator",type:"address"}],name:"SignatureValidationFailed",type:"error"},{inputs:[{components:[{name:"preOpGas",type:"uint256"},{name:"prefund",type:"uint256"},{name:"sigFailed",type:"bool"},{name:"validAfter",type:"uint48"},{name:"validUntil",type:"uint48"},{name:"paymasterContext",type:"bytes"}],name:"returnInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"senderInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"factoryInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"paymasterInfo",type:"tuple"}],name:"ValidationResult",type:"error"},{inputs:[{components:[{name:"preOpGas",type:"uint256"},{name:"prefund",type:"uint256"},{name:"sigFailed",type:"bool"},{name:"validAfter",type:"uint48"},{name:"validUntil",type:"uint48"},{name:"paymasterContext",type:"bytes"}],name:"returnInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"senderInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"factoryInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"paymasterInfo",type:"tuple"},{components:[{name:"aggregator",type:"address"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"stakeInfo",type:"tuple"}],name:"aggregatorInfo",type:"tuple"}],name:"ValidationResultWithAggregation",type:"error"},{anonymous:!1,inputs:[{indexed:!0,name:"userOpHash",type:"bytes32"},{indexed:!0,name:"sender",type:"address"},{indexed:!1,name:"factory",type:"address"},{indexed:!1,name:"paymaster",type:"address"}],name:"AccountDeployed",type:"event"},{anonymous:!1,inputs:[],name:"BeforeExecution",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"totalDeposit",type:"uint256"}],name:"Deposited",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"aggregator",type:"address"}],name:"SignatureAggregatorChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"totalStaked",type:"uint256"},{indexed:!1,name:"unstakeDelaySec",type:"uint256"}],name:"StakeLocked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"withdrawTime",type:"uint256"}],name:"StakeUnlocked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"withdrawAddress",type:"address"},{indexed:!1,name:"amount",type:"uint256"}],name:"StakeWithdrawn",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"userOpHash",type:"bytes32"},{indexed:!0,name:"sender",type:"address"},{indexed:!0,name:"paymaster",type:"address"},{indexed:!1,name:"nonce",type:"uint256"},{indexed:!1,name:"success",type:"bool"},{indexed:!1,name:"actualGasCost",type:"uint256"},{indexed:!1,name:"actualGasUsed",type:"uint256"}],name:"UserOperationEvent",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"userOpHash",type:"bytes32"},{indexed:!0,name:"sender",type:"address"},{indexed:!1,name:"nonce",type:"uint256"},{indexed:!1,name:"revertReason",type:"bytes"}],name:"UserOperationRevertReason",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"withdrawAddress",type:"address"},{indexed:!1,name:"amount",type:"uint256"}],name:"Withdrawn",type:"event"},{inputs:[],name:"SIG_VALIDATION_FAILED",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"initCode",type:"bytes"},{name:"sender",type:"address"},{name:"paymasterAndData",type:"bytes"}],name:"_validateSenderAndPaymaster",outputs:[],stateMutability:"view",type:"function"},{inputs:[{name:"unstakeDelaySec",type:"uint32"}],name:"addStake",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"account",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"address"}],name:"depositTo",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"",type:"address"}],name:"deposits",outputs:[{name:"deposit",type:"uint112"},{name:"staked",type:"bool"},{name:"stake",type:"uint112"},{name:"unstakeDelaySec",type:"uint32"},{name:"withdrawTime",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"address"}],name:"getDepositInfo",outputs:[{components:[{name:"deposit",type:"uint112"},{name:"staked",type:"bool"},{name:"stake",type:"uint112"},{name:"unstakeDelaySec",type:"uint32"},{name:"withdrawTime",type:"uint48"}],name:"info",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{name:"sender",type:"address"},{name:"key",type:"uint192"}],name:"getNonce",outputs:[{name:"nonce",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"initCode",type:"bytes"}],name:"getSenderAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"}],name:"getUserOpHash",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{components:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOps",type:"tuple[]"},{name:"aggregator",type:"address"},{name:"signature",type:"bytes"}],name:"opsPerAggregator",type:"tuple[]"},{name:"beneficiary",type:"address"}],name:"handleAggregatedOps",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"ops",type:"tuple[]"},{name:"beneficiary",type:"address"}],name:"handleOps",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"key",type:"uint192"}],name:"incrementNonce",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"callData",type:"bytes"},{components:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"paymaster",type:"address"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"}],name:"mUserOp",type:"tuple"},{name:"userOpHash",type:"bytes32"},{name:"prefund",type:"uint256"},{name:"contextOffset",type:"uint256"},{name:"preOpGas",type:"uint256"}],name:"opInfo",type:"tuple"},{name:"context",type:"bytes"}],name:"innerHandleOp",outputs:[{name:"actualGasCost",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"",type:"address"},{name:"",type:"uint192"}],name:"nonceSequenceNumber",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"op",type:"tuple"},{name:"target",type:"address"},{name:"targetCallData",type:"bytes"}],name:"simulateHandleOp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"}],name:"simulateValidation",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unlockStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"withdrawAddress",type:"address"}],name:"withdrawStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"withdrawAddress",type:"address"},{name:"withdrawAmount",type:"uint256"}],name:"withdrawTo",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],Gc="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789";function Oa(e,t={}){const{forHash:n}=t,{authorization:r,factory:i,factoryData:a}=e;return n&&(i==="0x7702"||i==="0x7702000000000000000000000000000000000000")?r?ut([r.address,a??"0x"]):"0x7702000000000000000000000000000000000000":i?ut([i,a??"0x"]):"0x"}const Ei="0x22e325a297439656";function Pa(e,t={}){const{callGasLimit:n,callData:r,maxPriorityFeePerGas:i,maxFeePerGas:a,paymaster:s,paymasterData:o,paymasterPostOpGasLimit:c,paymasterSignature:u,paymasterVerificationGasLimit:p,sender:d,signature:l="0x",verificationGasLimit:f}=e,h=ut([he(D(f||0n),{size:16}),he(D(n||0n),{size:16})]),m=Oa(e,t),v=ut([he(D(i||0n),{size:16}),he(D(a||0n),{size:16})]),k=e.nonce??0n,P=s?ut([s,he(D(p||0n),{size:16}),he(D(c||0n),{size:16}),o||"0x",...u?t.forHash?[Ei]:[u,he(D(wa(u)),{size:2}),Ei]:[]]):"0x",x=e.preVerificationGas??0n;return{accountGasLimits:h,callData:r,initCode:m,gasFees:v,nonce:k,paymasterAndData:P,preVerificationGas:x,sender:d,signature:l}}const Fc={PackedUserOperation:[{type:"address",name:"sender"},{type:"uint256",name:"nonce"},{type:"bytes",name:"initCode"},{type:"bytes",name:"callData"},{type:"bytes32",name:"accountGasLimits"},{type:"uint256",name:"preVerificationGas"},{type:"bytes32",name:"gasFees"},{type:"bytes",name:"paymasterAndData"}]};function zc(e){const{chainId:t,entryPointAddress:n,userOperation:r}=e,i=Pa(r,{forHash:!0});return{types:Fc,primaryType:"PackedUserOperation",domain:{name:"ERC4337",version:"1",chainId:t,verifyingContract:n},message:i}}function $c(e){const{chainId:t,entryPointAddress:n,entryPointVersion:r}=e,i=e.userOperation,{authorization:a,callData:s="0x",callGasLimit:o,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:p,paymasterAndData:d="0x",preVerificationGas:l,sender:f,verificationGasLimit:h}=i;if(r==="0.8"||r==="0.9")return Cn(zc({chainId:t,entryPointAddress:n,userOperation:i}));const m=(()=>{var v,k;if(r==="0.6"){const P=(v=i.initCode)==null?void 0:v.slice(0,42),x=(k=i.initCode)==null?void 0:k.slice(42),O=Oa({authorization:a,factory:P,factoryData:x},{forHash:!0});return xt([{type:"address"},{type:"uint256"},{type:"bytes32"},{type:"bytes32"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"bytes32"}],[f,p,Le(O),Le(s),o,h,l,c,u,Le(d)])}if(r==="0.7"){const P=Pa(i,{forHash:!0});return xt([{type:"address"},{type:"uint256"},{type:"bytes32"},{type:"bytes32"},{type:"bytes32"},{type:"uint256"},{type:"bytes32"},{type:"bytes32"}],[P.sender,P.nonce,Le(P.initCode),Le(P.callData),P.accountGasLimits,P.preVerificationGas,P.gasFees,Le(P.paymasterAndData)])}throw new Error(`entryPointVersion "${r}" not supported.`)})();return Le(xt([{type:"bytes32"},{type:"address"},{type:"uint256"}],[Le(m),n,BigInt(t)]))}async function qc(e){const{extend:t,nonceKeyManager:n=Mc({source:{get(){return Date.now()},set(){}}}),...r}=e;let i=!1;const a=await e.getAddress();return{...t,...r,address:a,async getFactoryArgs(){return"isDeployed"in this&&await this.isDeployed()?{factory:void 0,factoryData:void 0}:e.getFactoryArgs()},async getNonce(s){const o=(s==null?void 0:s.key)??BigInt(await n.consume({address:a,chainId:e.client.chain.id,client:e.client}));return e.getNonce?await e.getNonce({...s,key:o}):await nr(e.client,{abi:uc(["function getNonce(address, uint192) pure returns (uint256)"]),address:e.entryPoint.address,functionName:"getNonce",args:[a,o]})},async isDeployed(){return i?!0:(i=!!await Re(e.client,va,"getCode")({address:a}),i)},...e.sign?{async sign(s){const[{factory:o,factoryData:c},u]=await Promise.all([this.getFactoryArgs(),e.sign(s)]);return o&&c?Hn({address:o,data:c,signature:u}):u}}:{},async signMessage(s){const[{factory:o,factoryData:c},u]=await Promise.all([this.getFactoryArgs(),e.signMessage(s)]);return o&&c&&o!=="0x7702"?Hn({address:o,data:c,signature:u}):u},async signTypedData(s){const[{factory:o,factoryData:c},u]=await Promise.all([this.getFactoryArgs(),e.signTypedData(s)]);return o&&c&&o!=="0x7702"?Hn({address:o,data:c,signature:u}):u},type:"smart"}}class ir extends j{constructor({cause:t}){super("Smart Account is not deployed.",{cause:t,metaMessages:["This could arise when:","- No `factory`/`factoryData` or `initCode` properties are provided for Smart Account deployment.","- An incorrect `sender` address is provided."],name:"AccountNotDeployedError"})}}Object.defineProperty(ir,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa20/});class Ot extends j{constructor({cause:t,data:n,message:r}={}){var a;const i=(a=r==null?void 0:r.replace("execution reverted: ",""))==null?void 0:a.replace("execution reverted","");super(`Execution reverted ${i?`with reason: ${i}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n}}Object.defineProperty(Ot,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32521});Object.defineProperty(Ot,"message",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class ar extends j{constructor({cause:t}){super("Failed to send funds to beneficiary.",{cause:t,name:"FailedToSendToBeneficiaryError"})}}Object.defineProperty(ar,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa91/});class sr extends j{constructor({cause:t}){super("Gas value overflowed.",{cause:t,metaMessages:["This could arise when:","- one of the gas values exceeded 2**120 (uint120)"].filter(Boolean),name:"GasValuesOverflowError"})}}Object.defineProperty(sr,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa94/});class or extends j{constructor({cause:t}){super("The `handleOps` function was called by the Bundler with a gas limit too low.",{cause:t,name:"HandleOpsOutOfGasError"})}}Object.defineProperty(or,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa95/});class cr extends j{constructor({cause:t,factory:n,factoryData:r,initCode:i}){super("Failed to simulate deployment for Smart Account.",{cause:t,metaMessages:["This could arise when:","- Invalid `factory`/`factoryData` or `initCode` properties are present","- Smart Account deployment execution ran out of gas (low `verificationGasLimit` value)",`- Smart Account deployment execution reverted with an error
|
|
1
|
+
import{B as tr,_ as q,h as hi,y as Jo}from"./hooks.module-Dz_XB4AG.js";import{A as Qo,v as Ur,x as $t,I as Xo,y as he,z as ga,C as ec,D as tc,F as D,G as nc,J as rc,K as ic,L as ac,M as sc,f as xt,N as hn,O as ba,P as oc,Q as cc,e as ut,R as wa,p as Cn,S as Le,V as Re,X as va,Y as nr,Z as uc,B as j,$ as dc,a0 as mi,d as lc,a1 as fc,a2 as pc,a3 as hc,a4 as Qe,a5 as Hr,n as He,a6 as mc,a7 as yc,a8 as Gr,a9 as xa,aa as gc,ab as bc,ac as wc,s as vc,ad as xc,ae as Ec,af as Sc,ag as kc,t as yi,h as bt,o as Ea,ah as Ac,u as Et,ai as Sa,aj as gi,ak as bi,al as ka,am as wi,an as vi,ao as Aa,ap as _c,aq as Un,i as Ic,g as Oc}from"./index-D2ubWGvc.js";import{c as Pc,s as Cc,d as Tc,g as Bc}from"./index-nibyPLVP.js";function Lc(e,t){if(e.length!==t.length)throw new Qo({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const i=e[r],a=t[r];n.push(_a(i,a))}return Ur(n)}function _a(e,t,n=!1){if(e==="address"){const s=t;if(!$t(s))throw new Xo({address:s});return he(s.toLowerCase(),{size:n?32:null})}if(e==="string")return ga(t);if(e==="bytes")return t;if(e==="bool")return he(ec(t),{size:n?32:1});const r=e.match(tc);if(r){const[s,o,c="256"]=r,u=Number.parseInt(c,10)/8;return D(t,{size:n?32:u,signed:o==="int"})}const i=e.match(nc);if(i){const[s,o]=i;if(Number.parseInt(o,10)!==(t.length-2)/2)throw new rc({expectedSize:Number.parseInt(o,10),givenSize:(t.length-2)/2});return he(t,{dir:"right",size:n?32:null})}const a=e.match(ic);if(a&&Array.isArray(t)){const[s,o]=a,c=[];for(let u=0;u<t.length;u++)c.push(_a(o,t[u],!0));return c.length===0?"0x":Ur(c)}throw new ac(e)}function Mc(e){const{source:t}=e,n=new Map,r=new sc(8192),i=new Map,a=({address:s,chainId:o})=>`${s}.${o}`;return{async consume({address:s,chainId:o,client:c}){const u=a({address:s,chainId:o}),p=this.get({address:s,chainId:o,client:c});this.increment({address:s,chainId:o});const d=await p;return await t.set({address:s,chainId:o},d),r.set(u,d),d},async increment({address:s,chainId:o}){const c=a({address:s,chainId:o}),u=n.get(c)??0;n.set(c,u+1)},async get({address:s,chainId:o,client:c}){const u=a({address:s,chainId:o});let p=i.get(u);return p||(p=(async()=>{try{const l=await t.get({address:s,chainId:o,client:c}),f=r.get(u)??0;return f>0&&l<=f?f+1:(r.delete(u),l)}finally{this.reset({address:s,chainId:o})}})(),i.set(u,p)),(n.get(u)??0)+await p},reset({address:s,chainId:o}){const c=a({address:s,chainId:o});n.delete(c),i.delete(c)}}}const jc="0x6492649264926492649264926492649264926492649264926492649264926492";function Hn(e){const{address:t,data:n,signature:r,to:i="hex"}=e,a=Ur([xt([{type:"address"},{type:"bytes"},{type:"bytes"}],[t,n,r]),jc]);return i==="hex"?a:hn(a)}function Nc(e){const{key:t="public",name:n="Public Client"}=e;return ba({...e,key:t,name:n,type:"publicClient"}).extend(oc)}function Dc(e){const{r:t,s:n}=cc.Signature.fromCompact(e.slice(2,130)),r=+`0x${e.slice(130)}`,[i,a]=(()=>{if(r===0||r===1)return[void 0,r];if(r===27)return[BigInt(r),0];if(r===28)return[BigInt(r),1];throw new Error("Invalid yParityOrV value")})();return typeof i<"u"?{r:D(t,{size:32}),s:D(n,{size:32}),v:i,yParity:a}:{r:D(t,{size:32}),s:D(n,{size:32}),yParity:a}}function Ia(e,t){let n;try{n=e()}catch{return}return{getItem:i=>{var a;const s=c=>c===null?null:JSON.parse(c,void 0),o=(a=n.getItem(i))!=null?a:null;return o instanceof Promise?o.then(s):s(o)},setItem:(i,a)=>n.setItem(i,JSON.stringify(a,void 0)),removeItem:i=>n.removeItem(i)}}const rr=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return rr(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return rr(r)(n)}}}},Rc=(e,t)=>(n,r,i)=>{let a={storage:Ia(()=>localStorage),partialize:m=>m,version:0,merge:(m,v)=>({...v,...m}),...t},s=!1;const o=new Set,c=new Set;let u=a.storage;if(!u)return e((...m)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...m)},r,i);const p=()=>{const m=a.partialize({...r()});return u.setItem(a.name,{state:m,version:a.version})},d=i.setState;i.setState=(m,v)=>{d(m,v),p()};const l=e((...m)=>{n(...m),p()},r,i);i.getInitialState=()=>l;let f;const h=()=>{var m,v;if(!u)return;s=!1,o.forEach(P=>{var x;return P((x=r())!=null?x:l)});const k=((v=a.onRehydrateStorage)==null?void 0:v.call(a,(m=r())!=null?m:l))||void 0;return rr(u.getItem.bind(u))(a.name).then(P=>{if(P)if(typeof P.version=="number"&&P.version!==a.version){if(a.migrate){const x=a.migrate(P.state,P.version);return x instanceof Promise?x.then(O=>[!0,O]):[!0,x]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,P.state];return[!1,void 0]}).then(P=>{var x;const[O,N]=P;if(f=a.merge(N,(x=r())!=null?x:l),n(f,!0),O)return p()}).then(()=>{k==null||k(f,void 0),f=r(),s=!0,c.forEach(P=>P(f))}).catch(P=>{k==null||k(void 0,P)})};return i.persist={setOptions:m=>{a={...a,...m},m.storage&&(u=m.storage)},clearStorage:()=>{u==null||u.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>h(),hasHydrated:()=>s,onHydrate:m=>(o.add(m),()=>{o.delete(m)}),onFinishHydration:m=>(c.add(m),()=>{c.delete(m)})},a.skipHydration||h(),f||l},Uc=Rc,xi=e=>{let t;const n=new Set,r=(u,p)=>{const d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){const l=t;t=p??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(f=>f(t,l))}},i=()=>t,o={setState:r,getState:i,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u))},c=t=e(r,i,o);return o},Fr=e=>e?xi(e):xi,Hc=[{inputs:[{name:"preOpGas",type:"uint256"},{name:"paid",type:"uint256"},{name:"validAfter",type:"uint48"},{name:"validUntil",type:"uint48"},{name:"targetSuccess",type:"bool"},{name:"targetResult",type:"bytes"}],name:"ExecutionResult",type:"error"},{inputs:[{name:"opIndex",type:"uint256"},{name:"reason",type:"string"}],name:"FailedOp",type:"error"},{inputs:[{name:"sender",type:"address"}],name:"SenderAddressResult",type:"error"},{inputs:[{name:"aggregator",type:"address"}],name:"SignatureValidationFailed",type:"error"},{inputs:[{components:[{name:"preOpGas",type:"uint256"},{name:"prefund",type:"uint256"},{name:"sigFailed",type:"bool"},{name:"validAfter",type:"uint48"},{name:"validUntil",type:"uint48"},{name:"paymasterContext",type:"bytes"}],name:"returnInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"senderInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"factoryInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"paymasterInfo",type:"tuple"}],name:"ValidationResult",type:"error"},{inputs:[{components:[{name:"preOpGas",type:"uint256"},{name:"prefund",type:"uint256"},{name:"sigFailed",type:"bool"},{name:"validAfter",type:"uint48"},{name:"validUntil",type:"uint48"},{name:"paymasterContext",type:"bytes"}],name:"returnInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"senderInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"factoryInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"paymasterInfo",type:"tuple"},{components:[{name:"aggregator",type:"address"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"stakeInfo",type:"tuple"}],name:"aggregatorInfo",type:"tuple"}],name:"ValidationResultWithAggregation",type:"error"},{anonymous:!1,inputs:[{indexed:!0,name:"userOpHash",type:"bytes32"},{indexed:!0,name:"sender",type:"address"},{indexed:!1,name:"factory",type:"address"},{indexed:!1,name:"paymaster",type:"address"}],name:"AccountDeployed",type:"event"},{anonymous:!1,inputs:[],name:"BeforeExecution",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"totalDeposit",type:"uint256"}],name:"Deposited",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"aggregator",type:"address"}],name:"SignatureAggregatorChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"totalStaked",type:"uint256"},{indexed:!1,name:"unstakeDelaySec",type:"uint256"}],name:"StakeLocked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"withdrawTime",type:"uint256"}],name:"StakeUnlocked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"withdrawAddress",type:"address"},{indexed:!1,name:"amount",type:"uint256"}],name:"StakeWithdrawn",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"userOpHash",type:"bytes32"},{indexed:!0,name:"sender",type:"address"},{indexed:!0,name:"paymaster",type:"address"},{indexed:!1,name:"nonce",type:"uint256"},{indexed:!1,name:"success",type:"bool"},{indexed:!1,name:"actualGasCost",type:"uint256"},{indexed:!1,name:"actualGasUsed",type:"uint256"}],name:"UserOperationEvent",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"userOpHash",type:"bytes32"},{indexed:!0,name:"sender",type:"address"},{indexed:!1,name:"nonce",type:"uint256"},{indexed:!1,name:"revertReason",type:"bytes"}],name:"UserOperationRevertReason",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"withdrawAddress",type:"address"},{indexed:!1,name:"amount",type:"uint256"}],name:"Withdrawn",type:"event"},{inputs:[],name:"SIG_VALIDATION_FAILED",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"initCode",type:"bytes"},{name:"sender",type:"address"},{name:"paymasterAndData",type:"bytes"}],name:"_validateSenderAndPaymaster",outputs:[],stateMutability:"view",type:"function"},{inputs:[{name:"unstakeDelaySec",type:"uint32"}],name:"addStake",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"account",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"address"}],name:"depositTo",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"",type:"address"}],name:"deposits",outputs:[{name:"deposit",type:"uint112"},{name:"staked",type:"bool"},{name:"stake",type:"uint112"},{name:"unstakeDelaySec",type:"uint32"},{name:"withdrawTime",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"address"}],name:"getDepositInfo",outputs:[{components:[{name:"deposit",type:"uint112"},{name:"staked",type:"bool"},{name:"stake",type:"uint112"},{name:"unstakeDelaySec",type:"uint32"},{name:"withdrawTime",type:"uint48"}],name:"info",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{name:"sender",type:"address"},{name:"key",type:"uint192"}],name:"getNonce",outputs:[{name:"nonce",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"initCode",type:"bytes"}],name:"getSenderAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"}],name:"getUserOpHash",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{components:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOps",type:"tuple[]"},{name:"aggregator",type:"address"},{name:"signature",type:"bytes"}],name:"opsPerAggregator",type:"tuple[]"},{name:"beneficiary",type:"address"}],name:"handleAggregatedOps",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"ops",type:"tuple[]"},{name:"beneficiary",type:"address"}],name:"handleOps",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"key",type:"uint192"}],name:"incrementNonce",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"callData",type:"bytes"},{components:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"paymaster",type:"address"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"}],name:"mUserOp",type:"tuple"},{name:"userOpHash",type:"bytes32"},{name:"prefund",type:"uint256"},{name:"contextOffset",type:"uint256"},{name:"preOpGas",type:"uint256"}],name:"opInfo",type:"tuple"},{name:"context",type:"bytes"}],name:"innerHandleOp",outputs:[{name:"actualGasCost",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"",type:"address"},{name:"",type:"uint192"}],name:"nonceSequenceNumber",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"op",type:"tuple"},{name:"target",type:"address"},{name:"targetCallData",type:"bytes"}],name:"simulateHandleOp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"}],name:"simulateValidation",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unlockStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"withdrawAddress",type:"address"}],name:"withdrawStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"withdrawAddress",type:"address"},{name:"withdrawAmount",type:"uint256"}],name:"withdrawTo",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],Gc="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789";function Oa(e,t={}){const{forHash:n}=t,{authorization:r,factory:i,factoryData:a}=e;return n&&(i==="0x7702"||i==="0x7702000000000000000000000000000000000000")?r?ut([r.address,a??"0x"]):"0x7702000000000000000000000000000000000000":i?ut([i,a??"0x"]):"0x"}const Ei="0x22e325a297439656";function Pa(e,t={}){const{callGasLimit:n,callData:r,maxPriorityFeePerGas:i,maxFeePerGas:a,paymaster:s,paymasterData:o,paymasterPostOpGasLimit:c,paymasterSignature:u,paymasterVerificationGasLimit:p,sender:d,signature:l="0x",verificationGasLimit:f}=e,h=ut([he(D(f||0n),{size:16}),he(D(n||0n),{size:16})]),m=Oa(e,t),v=ut([he(D(i||0n),{size:16}),he(D(a||0n),{size:16})]),k=e.nonce??0n,P=s?ut([s,he(D(p||0n),{size:16}),he(D(c||0n),{size:16}),o||"0x",...u?t.forHash?[Ei]:[u,he(D(wa(u)),{size:2}),Ei]:[]]):"0x",x=e.preVerificationGas??0n;return{accountGasLimits:h,callData:r,initCode:m,gasFees:v,nonce:k,paymasterAndData:P,preVerificationGas:x,sender:d,signature:l}}const Fc={PackedUserOperation:[{type:"address",name:"sender"},{type:"uint256",name:"nonce"},{type:"bytes",name:"initCode"},{type:"bytes",name:"callData"},{type:"bytes32",name:"accountGasLimits"},{type:"uint256",name:"preVerificationGas"},{type:"bytes32",name:"gasFees"},{type:"bytes",name:"paymasterAndData"}]};function zc(e){const{chainId:t,entryPointAddress:n,userOperation:r}=e,i=Pa(r,{forHash:!0});return{types:Fc,primaryType:"PackedUserOperation",domain:{name:"ERC4337",version:"1",chainId:t,verifyingContract:n},message:i}}function $c(e){const{chainId:t,entryPointAddress:n,entryPointVersion:r}=e,i=e.userOperation,{authorization:a,callData:s="0x",callGasLimit:o,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:p,paymasterAndData:d="0x",preVerificationGas:l,sender:f,verificationGasLimit:h}=i;if(r==="0.8"||r==="0.9")return Cn(zc({chainId:t,entryPointAddress:n,userOperation:i}));const m=(()=>{var v,k;if(r==="0.6"){const P=(v=i.initCode)==null?void 0:v.slice(0,42),x=(k=i.initCode)==null?void 0:k.slice(42),O=Oa({authorization:a,factory:P,factoryData:x},{forHash:!0});return xt([{type:"address"},{type:"uint256"},{type:"bytes32"},{type:"bytes32"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"bytes32"}],[f,p,Le(O),Le(s),o,h,l,c,u,Le(d)])}if(r==="0.7"){const P=Pa(i,{forHash:!0});return xt([{type:"address"},{type:"uint256"},{type:"bytes32"},{type:"bytes32"},{type:"bytes32"},{type:"uint256"},{type:"bytes32"},{type:"bytes32"}],[P.sender,P.nonce,Le(P.initCode),Le(P.callData),P.accountGasLimits,P.preVerificationGas,P.gasFees,Le(P.paymasterAndData)])}throw new Error(`entryPointVersion "${r}" not supported.`)})();return Le(xt([{type:"bytes32"},{type:"address"},{type:"uint256"}],[Le(m),n,BigInt(t)]))}async function qc(e){const{extend:t,nonceKeyManager:n=Mc({source:{get(){return Date.now()},set(){}}}),...r}=e;let i=!1;const a=await e.getAddress();return{...t,...r,address:a,async getFactoryArgs(){return"isDeployed"in this&&await this.isDeployed()?{factory:void 0,factoryData:void 0}:e.getFactoryArgs()},async getNonce(s){const o=(s==null?void 0:s.key)??BigInt(await n.consume({address:a,chainId:e.client.chain.id,client:e.client}));return e.getNonce?await e.getNonce({...s,key:o}):await nr(e.client,{abi:uc(["function getNonce(address, uint192) pure returns (uint256)"]),address:e.entryPoint.address,functionName:"getNonce",args:[a,o]})},async isDeployed(){return i?!0:(i=!!await Re(e.client,va,"getCode")({address:a}),i)},...e.sign?{async sign(s){const[{factory:o,factoryData:c},u]=await Promise.all([this.getFactoryArgs(),e.sign(s)]);return o&&c?Hn({address:o,data:c,signature:u}):u}}:{},async signMessage(s){const[{factory:o,factoryData:c},u]=await Promise.all([this.getFactoryArgs(),e.signMessage(s)]);return o&&c&&o!=="0x7702"?Hn({address:o,data:c,signature:u}):u},async signTypedData(s){const[{factory:o,factoryData:c},u]=await Promise.all([this.getFactoryArgs(),e.signTypedData(s)]);return o&&c&&o!=="0x7702"?Hn({address:o,data:c,signature:u}):u},type:"smart"}}class ir extends j{constructor({cause:t}){super("Smart Account is not deployed.",{cause:t,metaMessages:["This could arise when:","- No `factory`/`factoryData` or `initCode` properties are provided for Smart Account deployment.","- An incorrect `sender` address is provided."],name:"AccountNotDeployedError"})}}Object.defineProperty(ir,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa20/});class Ot extends j{constructor({cause:t,data:n,message:r}={}){var a;const i=(a=r==null?void 0:r.replace("execution reverted: ",""))==null?void 0:a.replace("execution reverted","");super(`Execution reverted ${i?`with reason: ${i}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n}}Object.defineProperty(Ot,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32521});Object.defineProperty(Ot,"message",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class ar extends j{constructor({cause:t}){super("Failed to send funds to beneficiary.",{cause:t,name:"FailedToSendToBeneficiaryError"})}}Object.defineProperty(ar,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa91/});class sr extends j{constructor({cause:t}){super("Gas value overflowed.",{cause:t,metaMessages:["This could arise when:","- one of the gas values exceeded 2**120 (uint120)"].filter(Boolean),name:"GasValuesOverflowError"})}}Object.defineProperty(sr,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa94/});class or extends j{constructor({cause:t}){super("The `handleOps` function was called by the Bundler with a gas limit too low.",{cause:t,name:"HandleOpsOutOfGasError"})}}Object.defineProperty(or,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa95/});class cr extends j{constructor({cause:t,factory:n,factoryData:r,initCode:i}){super("Failed to simulate deployment for Smart Account.",{cause:t,metaMessages:["This could arise when:","- Invalid `factory`/`factoryData` or `initCode` properties are present","- Smart Account deployment execution ran out of gas (low `verificationGasLimit` value)",`- Smart Account deployment execution reverted with an error
|
|
2
2
|
`,n&&`factory: ${n}`,r&&`factoryData: ${r}`,i&&`initCode: ${i}`].filter(Boolean),name:"InitCodeFailedError"})}}Object.defineProperty(cr,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa13/});class ur extends j{constructor({cause:t,factory:n,factoryData:r,initCode:i}){super("Smart Account initialization implementation did not create an account.",{cause:t,metaMessages:["This could arise when:","- `factory`/`factoryData` or `initCode` properties are invalid",`- Smart Account initialization implementation is incorrect
|
|
3
3
|
`,n&&`factory: ${n}`,r&&`factoryData: ${r}`,i&&`initCode: ${i}`].filter(Boolean),name:"InitCodeMustCreateSenderError"})}}Object.defineProperty(ur,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa15/});class dr extends j{constructor({cause:t,factory:n,factoryData:r,initCode:i,sender:a}){super("Smart Account initialization implementation does not return the expected sender.",{cause:t,metaMessages:["This could arise when:",`Smart Account initialization implementation does not return a sender address
|
|
4
4
|
`,n&&`factory: ${n}`,r&&`factoryData: ${r}`,i&&`initCode: ${i}`,a&&`sender: ${a}`].filter(Boolean),name:"InitCodeMustReturnSenderError"})}}Object.defineProperty(dr,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa14/});class lr extends j{constructor({cause:t}){super("Smart Account does not have sufficient funds to execute the User Operation.",{cause:t,metaMessages:["This could arise when:","- the Smart Account does not have sufficient funds to cover the required prefund, or","- a Paymaster was not provided"].filter(Boolean),name:"InsufficientPrefundError"})}}Object.defineProperty(lr,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa21/});class fr extends j{constructor({cause:t}){super("Bundler attempted to call an invalid function on the EntryPoint.",{cause:t,name:"InternalCallOnlyError"})}}Object.defineProperty(fr,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa92/});class pr extends j{constructor({cause:t}){super("Bundler used an invalid aggregator for handling aggregated User Operations.",{cause:t,name:"InvalidAggregatorError"})}}Object.defineProperty(pr,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa96/});class hr extends j{constructor({cause:t,nonce:n}){super("Invalid Smart Account nonce used for User Operation.",{cause:t,metaMessages:[n&&`nonce: ${n}`].filter(Boolean),name:"InvalidAccountNonceError"})}}Object.defineProperty(hr,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa25/});class mr extends j{constructor({cause:t}){super("Bundler has not set a beneficiary address.",{cause:t,name:"InvalidBeneficiaryError"})}}Object.defineProperty(mr,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa90/});class mn extends j{constructor({cause:t}){super("Invalid fields set on User Operation.",{cause:t,name:"InvalidFieldsError"})}}Object.defineProperty(mn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class yr extends j{constructor({cause:t,paymasterAndData:n}){super("Paymaster properties provided are invalid.",{cause:t,metaMessages:["This could arise when:","- the `paymasterAndData` property is of an incorrect length\n",n&&`paymasterAndData: ${n}`].filter(Boolean),name:"InvalidPaymasterAndDataError"})}}Object.defineProperty(yr,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa93/});class at extends j{constructor({cause:t}){super("Paymaster deposit for the User Operation is too low.",{cause:t,metaMessages:["This could arise when:","- the Paymaster has deposited less than the expected amount via the `deposit` function"].filter(Boolean),name:"PaymasterDepositTooLowError"})}}Object.defineProperty(at,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32508});Object.defineProperty(at,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa31/});class gr extends j{constructor({cause:t}){super("The `validatePaymasterUserOp` function on the Paymaster reverted.",{cause:t,name:"PaymasterFunctionRevertedError"})}}Object.defineProperty(gr,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa33/});class br extends j{constructor({cause:t}){super("The Paymaster contract has not been deployed.",{cause:t,name:"PaymasterNotDeployedError"})}}Object.defineProperty(br,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa30/});class yn extends j{constructor({cause:t}){super("UserOperation rejected because paymaster (or signature aggregator) is throttled/banned.",{cause:t,name:"PaymasterRateLimitError"})}}Object.defineProperty(yn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32504});class gn extends j{constructor({cause:t}){super("UserOperation rejected because paymaster (or signature aggregator) stake or unstake-delay is too low.",{cause:t,name:"PaymasterStakeTooLowError"})}}Object.defineProperty(gn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32505});class wr extends j{constructor({cause:t}){super("Paymaster `postOp` function reverted.",{cause:t,name:"PaymasterPostOpFunctionRevertedError"})}}Object.defineProperty(wr,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa50/});class vr extends j{constructor({cause:t,factory:n,factoryData:r,initCode:i}){super("Smart Account has already been deployed.",{cause:t,metaMessages:["Remove the following properties and try again:",n&&"`factory`",r&&"`factoryData`",i&&"`initCode`"].filter(Boolean),name:"SenderAlreadyConstructedError"})}}Object.defineProperty(vr,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa10/});class bn extends j{constructor({cause:t}){super("UserOperation rejected because account signature check failed (or paymaster signature, if the paymaster uses its data as signature).",{cause:t,name:"SignatureCheckFailedError"})}}Object.defineProperty(bn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32507});class xr extends j{constructor({cause:t}){super("The `validateUserOp` function on the Smart Account reverted.",{cause:t,name:"SmartAccountFunctionRevertedError"})}}Object.defineProperty(xr,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa23/});class wn extends j{constructor({cause:t}){super("UserOperation rejected because account specified unsupported signature aggregator.",{cause:t,name:"UnsupportedSignatureAggregatorError"})}}Object.defineProperty(wn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32506});class Er extends j{constructor({cause:t}){super("User Operation expired.",{cause:t,metaMessages:["This could arise when:","- the `validAfter` or `validUntil` values returned from `validateUserOp` on the Smart Account are not satisfied"].filter(Boolean),name:"UserOperationExpiredError"})}}Object.defineProperty(Er,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa22/});class Sr extends j{constructor({cause:t}){super("Paymaster for User Operation expired.",{cause:t,metaMessages:["This could arise when:","- the `validAfter` or `validUntil` values returned from `validatePaymasterUserOp` on the Paymaster are not satisfied"].filter(Boolean),name:"UserOperationPaymasterExpiredError"})}}Object.defineProperty(Sr,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa32/});class kr extends j{constructor({cause:t}){super("Signature provided for the User Operation is invalid.",{cause:t,metaMessages:["This could arise when:","- the `signature` for the User Operation is incorrectly computed, and unable to be verified by the Smart Account"].filter(Boolean),name:"UserOperationSignatureError"})}}Object.defineProperty(kr,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa24/});class Ar extends j{constructor({cause:t}){super("Signature provided for the User Operation is invalid.",{cause:t,metaMessages:["This could arise when:","- the `signature` for the User Operation is incorrectly computed, and unable to be verified by the Paymaster"].filter(Boolean),name:"UserOperationPaymasterSignatureError"})}}Object.defineProperty(Ar,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa34/});class vn extends j{constructor({cause:t}){super("User Operation rejected by EntryPoint's `simulateValidation` during account creation or validation.",{cause:t,name:"UserOperationRejectedByEntryPointError"})}}Object.defineProperty(vn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32500});class xn extends j{constructor({cause:t}){super("User Operation rejected by Paymaster's `validatePaymasterUserOp`.",{cause:t,name:"UserOperationRejectedByPaymasterError"})}}Object.defineProperty(xn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32501});class En extends j{constructor({cause:t}){super("User Operation rejected with op code validation error.",{cause:t,name:"UserOperationRejectedByOpCodeError"})}}Object.defineProperty(En,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32502});class Sn extends j{constructor({cause:t}){super("UserOperation out of time-range: either wallet or paymaster returned a time-range, and it is already expired (or will expire soon).",{cause:t,name:"UserOperationOutOfTimeRangeError"})}}Object.defineProperty(Sn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32503});class Wc extends j{constructor({cause:t}){super(`An error occurred while executing user operation: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownBundlerError"})}}class _r extends j{constructor({cause:t}){super("User Operation verification gas limit exceeded.",{cause:t,metaMessages:["This could arise when:","- the gas used for verification exceeded the `verificationGasLimit`"].filter(Boolean),name:"VerificationGasLimitExceededError"})}}Object.defineProperty(_r,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa40/});class Ir extends j{constructor({cause:t}){super("User Operation verification gas limit is too low.",{cause:t,metaMessages:["This could arise when:","- the `verificationGasLimit` is too low to verify the User Operation"].filter(Boolean),name:"VerificationGasLimitTooLowError"})}}Object.defineProperty(Ir,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa41/});class Vc extends j{constructor(t,{callData:n,callGasLimit:r,docsPath:i,factory:a,factoryData:s,initCode:o,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:p,paymaster:d,paymasterAndData:l,paymasterData:f,paymasterPostOpGasLimit:h,paymasterVerificationGasLimit:m,preVerificationGas:v,sender:k,signature:P,verificationGasLimit:x}){const O=dc({callData:n,callGasLimit:r,factory:a,factoryData:s,initCode:o,maxFeePerGas:typeof c<"u"&&`${mi(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${mi(u)} gwei`,nonce:p,paymaster:d,paymasterAndData:l,paymasterData:f,paymasterPostOpGasLimit:h,paymasterVerificationGasLimit:m,preVerificationGas:v,sender:k,signature:P,verificationGasLimit:x});super(t.shortMessage,{cause:t,docsPath:i,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",O].filter(Boolean),name:"UserOperationExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class Kc extends j{constructor({hash:t}){super(`User Operation receipt with hash "${t}" could not be found. The User Operation may not have been processed yet.`,{name:"UserOperationReceiptNotFoundError"})}}class Zc extends j{constructor({hash:t}){super(`User Operation with hash "${t}" could not be found.`,{name:"UserOperationNotFoundError"})}}class Si extends j{constructor({hash:t}){super(`Timed out while waiting for User Operation with hash "${t}" to be confirmed.`,{name:"WaitForUserOperationReceiptTimeoutError"})}}const Yc=[Ot,mn,at,yn,gn,bn,wn,Sn,vn,xn,En];function Jc(e,t){const n=(e.details||"").toLowerCase();if(ir.message.test(n))return new ir({cause:e});if(ar.message.test(n))return new ar({cause:e});if(sr.message.test(n))return new sr({cause:e});if(or.message.test(n))return new or({cause:e});if(cr.message.test(n))return new cr({cause:e,factory:t.factory,factoryData:t.factoryData,initCode:t.initCode});if(ur.message.test(n))return new ur({cause:e,factory:t.factory,factoryData:t.factoryData,initCode:t.initCode});if(dr.message.test(n))return new dr({cause:e,factory:t.factory,factoryData:t.factoryData,initCode:t.initCode,sender:t.sender});if(lr.message.test(n))return new lr({cause:e});if(fr.message.test(n))return new fr({cause:e});if(hr.message.test(n))return new hr({cause:e,nonce:t.nonce});if(pr.message.test(n))return new pr({cause:e});if(mr.message.test(n))return new mr({cause:e});if(yr.message.test(n))return new yr({cause:e});if(at.message.test(n))return new at({cause:e});if(gr.message.test(n))return new gr({cause:e});if(br.message.test(n))return new br({cause:e});if(wr.message.test(n))return new wr({cause:e});if(xr.message.test(n))return new xr({cause:e});if(vr.message.test(n))return new vr({cause:e,factory:t.factory,factoryData:t.factoryData,initCode:t.initCode});if(Er.message.test(n))return new Er({cause:e});if(Sr.message.test(n))return new Sr({cause:e});if(Ar.message.test(n))return new Ar({cause:e});if(kr.message.test(n))return new kr({cause:e});if(_r.message.test(n))return new _r({cause:e});if(Ir.message.test(n))return new Ir({cause:e});const r=e.walk(i=>Yc.some(a=>a.code===i.code));if(r){if(r.code===Ot.code)return new Ot({cause:e,data:r.data,message:r.details});if(r.code===mn.code)return new mn({cause:e});if(r.code===at.code)return new at({cause:e});if(r.code===yn.code)return new yn({cause:e});if(r.code===gn.code)return new gn({cause:e});if(r.code===bn.code)return new bn({cause:e});if(r.code===wn.code)return new wn({cause:e});if(r.code===Sn.code)return new Sn({cause:e});if(r.code===vn.code)return new vn({cause:e});if(r.code===xn.code)return new xn({cause:e});if(r.code===En.code)return new En({cause:e})}return new Wc({cause:e})}function Ca(e,{calls:t,docsPath:n,...r}){const i=(()=>{const a=Jc(e,r);if(t&&a instanceof Ot){const s=Qc(a),o=t==null?void 0:t.filter(c=>c.abi);if(s&&o.length>0)return Xc({calls:o,revertData:s})}return a})();return new Vc(i,{docsPath:n,...r})}function Qc(e){let t;return e.walk(n=>{var i,a,s,o;const r=n;if(typeof r.data=="string"||typeof((i=r.data)==null?void 0:i.revertData)=="string"||!(r instanceof j)&&typeof r.message=="string"){const c=(o=(s=((a=r.data)==null?void 0:a.revertData)||r.data||r.message).match)==null?void 0:o.call(s,/(0x[A-Za-z0-9]*)/);if(c)return t=c[1],!0}return!1}),t}function Xc(e){const{calls:t,revertData:n}=e,{abi:r,functionName:i,args:a,to:s}=(()=>{const c=t==null?void 0:t.filter(p=>!!p.abi);if(c.length===1)return c[0];const u=c.filter(p=>{try{return!!lc({abi:p.abi,data:n})}catch{return!1}});return u.length===1?u[0]:{abi:[],functionName:c.reduce((p,d)=>`${p?`${p} | `:""}${d.functionName}`,""),args:void 0,to:void 0}})(),o=n==="0x"?new fc({functionName:i}):new pc({abi:r,data:n,functionName:i});return new hc(o,{abi:r,args:a,contractAddress:s,functionName:i})}function eu(e){const t={};return e.callGasLimit&&(t.callGasLimit=BigInt(e.callGasLimit)),e.preVerificationGas&&(t.preVerificationGas=BigInt(e.preVerificationGas)),e.verificationGasLimit&&(t.verificationGasLimit=BigInt(e.verificationGasLimit)),e.paymasterPostOpGasLimit&&(t.paymasterPostOpGasLimit=BigInt(e.paymasterPostOpGasLimit)),e.paymasterVerificationGasLimit&&(t.paymasterVerificationGasLimit=BigInt(e.paymasterVerificationGasLimit)),t}function Tn(e){const t={};return typeof e.callData<"u"&&(t.callData=e.callData),typeof e.callGasLimit<"u"&&(t.callGasLimit=D(e.callGasLimit)),typeof e.factory<"u"&&(t.factory=e.factory),typeof e.factoryData<"u"&&(t.factoryData=e.factoryData),typeof e.initCode<"u"&&(t.initCode=e.initCode),typeof e.maxFeePerGas<"u"&&(t.maxFeePerGas=D(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(t.maxPriorityFeePerGas=D(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(t.nonce=D(e.nonce)),typeof e.paymaster<"u"&&(t.paymaster=e.paymaster),typeof e.paymasterAndData<"u"&&(t.paymasterAndData=e.paymasterAndData||"0x"),typeof e.paymasterData<"u"&&(t.paymasterData=e.paymasterData),typeof e.paymasterPostOpGasLimit<"u"&&(t.paymasterPostOpGasLimit=D(e.paymasterPostOpGasLimit)),typeof e.paymasterSignature<"u"&&(t.paymasterSignature=e.paymasterSignature),typeof e.paymasterVerificationGasLimit<"u"&&(t.paymasterVerificationGasLimit=D(e.paymasterVerificationGasLimit)),typeof e.preVerificationGas<"u"&&(t.preVerificationGas=D(e.preVerificationGas)),typeof e.sender<"u"&&(t.sender=e.sender),typeof e.signature<"u"&&(t.signature=e.signature),typeof e.verificationGasLimit<"u"&&(t.verificationGasLimit=D(e.verificationGasLimit)),typeof e.authorization<"u"&&(t.eip7702Auth=tu(e.authorization)),t}function tu(e){return{address:e.address,chainId:D(e.chainId),nonce:D(e.nonce),r:e.r?D(BigInt(e.r),{size:32}):he("0x",{size:32}),s:e.s?D(BigInt(e.s),{size:32}):he("0x",{size:32}),yParity:e.yParity?D(e.yParity,{size:1}):he("0x",{size:32})}}async function nu(e,t){const{chainId:n,entryPointAddress:r,context:i,...a}=t,s=Tn(a),{paymasterPostOpGasLimit:o,paymasterVerificationGasLimit:c,...u}=await e.request({method:"pm_getPaymasterData",params:[{...s,callGasLimit:s.callGasLimit??"0x0",verificationGasLimit:s.verificationGasLimit??"0x0",preVerificationGas:s.preVerificationGas??"0x0"},r,D(n),i]});return{...u,...o&&{paymasterPostOpGasLimit:Qe(o)},...c&&{paymasterVerificationGasLimit:Qe(c)}}}async function ru(e,t){const{chainId:n,entryPointAddress:r,context:i,...a}=t,s=Tn(a),{paymasterPostOpGasLimit:o,paymasterVerificationGasLimit:c,...u}=await e.request({method:"pm_getPaymasterStubData",params:[{...s,callGasLimit:s.callGasLimit??"0x0",verificationGasLimit:s.verificationGasLimit??"0x0",preVerificationGas:s.preVerificationGas??"0x0"},r,D(n),i]});return{...u,...o&&{paymasterPostOpGasLimit:Qe(o)},...c&&{paymasterVerificationGasLimit:Qe(c)}}}const iu=["factory","fees","gas","paymaster","nonce","signature","authorization"];async function zr(e,t){var te,V;const n=t,{account:r=e.account,dataSuffix:i=typeof e.dataSuffix=="string"?e.dataSuffix:(te=e.dataSuffix)==null?void 0:te.value,parameters:a=iu,stateOverride:s}=n;if(!r)throw new Hr;const o=Gr(r),c=e,u=n.paymaster??(c==null?void 0:c.paymaster),p=typeof u=="string"?u:void 0,{getPaymasterStubData:d,getPaymasterData:l}=(()=>{if(u===!0)return{getPaymasterStubData:A=>Re(c,ru,"getPaymasterStubData")(A),getPaymasterData:A=>Re(c,nu,"getPaymasterData")(A)};if(typeof u=="object"){const{getPaymasterStubData:A,getPaymasterData:z}=u;return{getPaymasterStubData:z&&A?A:z,getPaymasterData:z&&A?z:void 0}}return{getPaymasterStubData:void 0,getPaymasterData:void 0}})(),f=n.paymasterContext?n.paymasterContext:c==null?void 0:c.paymasterContext;let h={...n,paymaster:p,sender:o.address};const[m,v,k,P,x]=await Promise.all([(async()=>n.calls?o.encodeCalls(n.calls.map(A=>{const z=A;return z.abi?{data:He(z),to:z.to,value:z.value}:z})):n.callData)(),(async()=>{if(!a.includes("factory"))return;if(n.initCode)return{initCode:n.initCode};if(n.factory&&n.factoryData)return{factory:n.factory,factoryData:n.factoryData};const{factory:A,factoryData:z}=await o.getFactoryArgs();return o.entryPoint.version==="0.6"?{initCode:A&&z?ut([A,z]):void 0}:{factory:A,factoryData:z}})(),(async()=>{var A;if(a.includes("fees")){if(typeof n.maxFeePerGas=="bigint"&&typeof n.maxPriorityFeePerGas=="bigint")return h;if((A=c==null?void 0:c.userOperation)!=null&&A.estimateFeesPerGas){const z=await c.userOperation.estimateFeesPerGas({account:o,bundlerClient:c,userOperation:h});return{...h,...z}}try{const z=c.client??e,ie=await Re(z,mc,"estimateFeesPerGas")({chain:z.chain,type:"eip1559"});return{maxFeePerGas:typeof n.maxFeePerGas=="bigint"?n.maxFeePerGas:BigInt(2n*ie.maxFeePerGas),maxPriorityFeePerGas:typeof n.maxPriorityFeePerGas=="bigint"?n.maxPriorityFeePerGas:BigInt(2n*ie.maxPriorityFeePerGas)}}catch{return}}})(),(async()=>{if(a.includes("nonce"))return typeof n.nonce=="bigint"?n.nonce:o.getNonce()})(),(async()=>{if(a.includes("authorization")){if(typeof n.authorization=="object")return n.authorization;if(o.authorization&&!await o.isDeployed())return{...await yc(o.client,o.authorization),r:"0xfffffffffffffffffffffffffffffff000000000000000000000000000000000",s:"0x7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",yParity:1}}})()]);typeof m<"u"&&(h.callData=i?ut([m,i]):m),typeof v<"u"&&(h={...h,...v}),typeof k<"u"&&(h={...h,...k}),typeof P<"u"&&(h.nonce=P),typeof x<"u"&&(h.authorization=x),a.includes("signature")&&(typeof n.signature<"u"?h.signature=n.signature:h.signature=await o.getStubSignature(h)),o.entryPoint.version==="0.6"&&!h.initCode&&(h.initCode="0x");let O;async function N(){return O||(e.chain?e.chain.id:(O=await Re(e,xa,"getChainId")({}),O))}let ee=!1;if(a.includes("paymaster")&&d&&!p&&!n.paymasterAndData){const{isFinal:A=!1,sponsor:z,...ie}=await d({chainId:await N(),entryPointAddress:o.entryPoint.address,context:f,...h});ee=A,h={...h,...ie}}if(o.entryPoint.version==="0.6"&&!h.paymasterAndData&&(h.paymasterAndData="0x"),a.includes("gas")){if((V=o.userOperation)!=null&&V.estimateGas){const A=await o.userOperation.estimateGas(h);h={...h,...A}}if(typeof h.callGasLimit>"u"||typeof h.preVerificationGas>"u"||typeof h.verificationGasLimit>"u"||h.paymaster&&typeof h.paymasterPostOpGasLimit>"u"||h.paymaster&&typeof h.paymasterVerificationGasLimit>"u"){const A=await Re(c,Ta,"estimateUserOperationGas")({account:o,callGasLimit:0n,preVerificationGas:0n,verificationGasLimit:0n,stateOverride:s,...h.paymaster?{paymasterPostOpGasLimit:0n,paymasterVerificationGasLimit:0n}:{},...h});h={...h,callGasLimit:h.callGasLimit??A.callGasLimit,preVerificationGas:h.preVerificationGas??A.preVerificationGas,verificationGasLimit:h.verificationGasLimit??A.verificationGasLimit,paymasterPostOpGasLimit:h.paymasterPostOpGasLimit??A.paymasterPostOpGasLimit,paymasterVerificationGasLimit:h.paymasterVerificationGasLimit??A.paymasterVerificationGasLimit}}}if(a.includes("paymaster")&&l&&!p&&!n.paymasterAndData&&!ee){const A=await l({chainId:await N(),entryPointAddress:o.entryPoint.address,context:f,...h});h={...h,...A}}return delete h.calls,delete h.parameters,delete h.paymasterContext,typeof h.paymaster!="string"&&delete h.paymaster,h}async function Ta(e,t){var c;const{account:n=e.account,entryPointAddress:r,stateOverride:i}=t;if(!n&&!t.sender)throw new Hr;const a=n?Gr(n):void 0,s=gc(i),o=a?await Re(e,zr,"prepareUserOperation")({...t,parameters:["authorization","factory","nonce","paymaster","signature"]}):t;try{const u=[Tn(o),r??((c=a==null?void 0:a.entryPoint)==null?void 0:c.address)],p=await e.request({method:"eth_estimateUserOperationGas",params:s?[...u,s]:[...u]});return eu(p)}catch(u){const p=t.calls;throw Ca(u,{...o,...p?{calls:p}:{}})}}function au(e){return e.request({method:"eth_supportedEntryPoints"})}function su(e){const t={...e};return e.callGasLimit&&(t.callGasLimit=BigInt(e.callGasLimit)),e.maxFeePerGas&&(t.maxFeePerGas=BigInt(e.maxFeePerGas)),e.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=BigInt(e.maxPriorityFeePerGas)),e.nonce&&(t.nonce=BigInt(e.nonce)),e.paymasterPostOpGasLimit&&(t.paymasterPostOpGasLimit=BigInt(e.paymasterPostOpGasLimit)),e.paymasterVerificationGasLimit&&(t.paymasterVerificationGasLimit=BigInt(e.paymasterVerificationGasLimit)),e.preVerificationGas&&(t.preVerificationGas=BigInt(e.preVerificationGas)),e.verificationGasLimit&&(t.verificationGasLimit=BigInt(e.verificationGasLimit)),t}async function ou(e,{hash:t}){const n=await e.request({method:"eth_getUserOperationByHash",params:[t]},{dedupe:!0});if(!n)throw new Zc({hash:t});const{blockHash:r,blockNumber:i,entryPoint:a,transactionHash:s,userOperation:o}=n;return{blockHash:r,blockNumber:BigInt(i),entryPoint:a,transactionHash:s,userOperation:su(o)}}function cu(e){const t={...e};return e.actualGasCost&&(t.actualGasCost=BigInt(e.actualGasCost)),e.actualGasUsed&&(t.actualGasUsed=BigInt(e.actualGasUsed)),e.logs&&(t.logs=e.logs.map(n=>bc(n))),e.receipt&&(t.receipt=wc(t.receipt)),t}async function Ba(e,{hash:t}){const n=await e.request({method:"eth_getUserOperationReceipt",params:[t]},{dedupe:!0});if(!n)throw new Kc({hash:t});return cu(n)}async function uu(e,t){var c,u;const{account:n=e.account,entryPointAddress:r}=t;if(!n&&!t.sender)throw new Hr;const i=n?Gr(n):void 0,a=i?await Re(e,zr,"prepareUserOperation")(t):t,s=t.signature||await((c=i==null?void 0:i.signUserOperation)==null?void 0:c.call(i,a)),o=Tn({...a,signature:s});try{return await e.request({method:"eth_sendUserOperation",params:[o,r??((u=i==null?void 0:i.entryPoint)==null?void 0:u.address)]},{retryCount:0})}catch(p){const d=t.calls;throw Ca(p,{...a,...d?{calls:d}:{},signature:s})}}function du(e,t){const{hash:n,pollingInterval:r=e.pollingInterval,retryCount:i,timeout:a=12e4}=t;let s=0;const o=vc(["waitForUserOperationReceipt",e.uid,n]);return new Promise((c,u)=>{const p=xc(o,{resolve:c,reject:u},d=>{const l=m=>{h(),m(),p()},f=a?setTimeout(()=>l(()=>d.reject(new Si({hash:n}))),a):void 0,h=Ec(async()=>{i&&s>=i&&(clearTimeout(f),l(()=>d.reject(new Si({hash:n}))));try{const m=await Re(e,Ba,"getUserOperationReceipt")({hash:n});clearTimeout(f),l(()=>d.resolve(m))}catch(m){const v=m;v.name!=="UserOperationReceiptNotFoundError"&&(clearTimeout(f),l(()=>d.reject(v)))}s++},{emitOnBegin:!0,interval:r});return h})})}function lu(e){return{estimateUserOperationGas:t=>Ta(e,t),getChainId:()=>xa(e),getSupportedEntryPoints:()=>au(e),getUserOperation:t=>ou(e,t),getUserOperationReceipt:t=>Ba(e,t),prepareUserOperation:t=>zr(e,t),sendUserOperation:t=>uu(e,t),waitForUserOperationReceipt:t=>du(e,t)}}function fu(e){const{client:t,dataSuffix:n,key:r="bundler",name:i="Bundler Client",paymaster:a,paymasterContext:s,transport:o,userOperation:c}=e;return Object.assign(ba({...e,chain:e.chain??(t==null?void 0:t.chain),key:r,name:i,transport:o,type:"bundlerClient"}),{client:t,dataSuffix:n??(t==null?void 0:t.dataSuffix),paymaster:a,paymasterContext:s,userOperation:c}).extend(lu)}const Mt="4.3.6",La="@coinbase/wallet-sdk",pu=()=>({chains:[]}),hu=()=>({keys:{}}),mu=()=>({account:{}}),yu=()=>({subAccount:void 0}),gu=()=>({subAccountConfig:{}}),bu=()=>({spendPermissions:[]}),wu=()=>({config:{version:Mt}}),X=Fr(Uc((...e)=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},pu(...e)),hu(...e)),mu(...e)),yu(...e)),bu(...e)),wu(...e)),gu(...e)),{name:"cbwsdk.store",storage:Ia(()=>localStorage),partialize:e=>({chains:e.chains,keys:e.keys,account:e.account,subAccount:e.subAccount,spendPermissions:e.spendPermissions,config:e.config})})),vu={get:()=>X.getState().subAccountConfig,set:e=>{X.setState(t=>({subAccountConfig:Object.assign(Object.assign({},t.subAccountConfig),e)}))},clear:()=>{X.setState({subAccountConfig:{}})}},xu={get:()=>X.getState().subAccount,set:e=>{X.setState(t=>({subAccount:t.subAccount?Object.assign(Object.assign({},t.subAccount),e):Object.assign({address:e.address},e)}))},clear:()=>{X.setState({subAccount:void 0})}},Eu={get:()=>X.getState().spendPermissions,set:e=>{X.setState({spendPermissions:e})},clear:()=>{X.setState({spendPermissions:[]})}},Su={get:()=>X.getState().account,set:e=>{X.setState(t=>({account:Object.assign(Object.assign({},t.account),e)}))},clear:()=>{X.setState({account:{}})}},ku={get:()=>X.getState().chains,set:e=>{X.setState({chains:e})},clear:()=>{X.setState({chains:[]})}},Au={get:e=>X.getState().keys[e],set:(e,t)=>{X.setState(n=>({keys:Object.assign(Object.assign({},n.keys),{[e]:t})}))},clear:()=>{X.setState({keys:{}})}},Ma={get:()=>X.getState().config,set:e=>{X.setState(t=>({config:Object.assign(Object.assign({},t.config),e)}))}},_u={subAccounts:xu,subAccountsConfig:vu,spendPermissions:Eu,account:Su,chains:ku,keys:Au,config:Ma},_=Object.assign(Object.assign({},X),_u),Iu='!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ClientAnalytics=t():e.ClientAnalytics=t()}(this,(function(){return(()=>{var e={792:e=>{var t={utf8:{stringToBytes:function(e){return t.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(t.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join("")}}};e.exports=t},562:e=>{var t,n;t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&n.rotl(e,8)|4278255360&n.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=n.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,r=0;n<e.length;n++,r+=8)t[r>>>5]|=e[n]<<24-r%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(e){for(var n=[],r=0;r<e.length;r+=3)for(var i=e[r]<<16|e[r+1]<<8|e[r+2],a=0;a<4;a++)8*r+6*a<=8*e.length?n.push(t.charAt(i>>>6*(3-a)&63)):n.push("=");return n.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\\/]/gi,"");for(var n=[],r=0,i=0;r<e.length;i=++r%4)0!=i&&n.push((t.indexOf(e.charAt(r-1))&Math.pow(2,-2*i+8)-1)<<2*i|t.indexOf(e.charAt(r))>>>6-2*i);return n}},e.exports=n},335:e=>{function t(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}e.exports=function(e){return null!=e&&(t(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&t(e.slice(0,0))}(e)||!!e._isBuffer)}},762:(e,t,n)=>{var r,i,a,o,s;r=n(562),i=n(792).utf8,a=n(335),o=n(792).bin,(s=function(e,t){e.constructor==String?e=t&&"binary"===t.encoding?o.stringToBytes(e):i.stringToBytes(e):a(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||e.constructor===Uint8Array||(e=e.toString());for(var n=r.bytesToWords(e),c=8*e.length,u=1732584193,l=-271733879,d=-1732584194,p=271733878,m=0;m<n.length;m++)n[m]=16711935&(n[m]<<8|n[m]>>>24)|4278255360&(n[m]<<24|n[m]>>>8);n[c>>>5]|=128<<c%32,n[14+(c+64>>>9<<4)]=c;var f=s._ff,v=s._gg,g=s._hh,b=s._ii;for(m=0;m<n.length;m+=16){var h=u,w=l,y=d,T=p;u=f(u,l,d,p,n[m+0],7,-680876936),p=f(p,u,l,d,n[m+1],12,-389564586),d=f(d,p,u,l,n[m+2],17,606105819),l=f(l,d,p,u,n[m+3],22,-1044525330),u=f(u,l,d,p,n[m+4],7,-176418897),p=f(p,u,l,d,n[m+5],12,1200080426),d=f(d,p,u,l,n[m+6],17,-1473231341),l=f(l,d,p,u,n[m+7],22,-45705983),u=f(u,l,d,p,n[m+8],7,1770035416),p=f(p,u,l,d,n[m+9],12,-1958414417),d=f(d,p,u,l,n[m+10],17,-42063),l=f(l,d,p,u,n[m+11],22,-1990404162),u=f(u,l,d,p,n[m+12],7,1804603682),p=f(p,u,l,d,n[m+13],12,-40341101),d=f(d,p,u,l,n[m+14],17,-1502002290),u=v(u,l=f(l,d,p,u,n[m+15],22,1236535329),d,p,n[m+1],5,-165796510),p=v(p,u,l,d,n[m+6],9,-1069501632),d=v(d,p,u,l,n[m+11],14,643717713),l=v(l,d,p,u,n[m+0],20,-373897302),u=v(u,l,d,p,n[m+5],5,-701558691),p=v(p,u,l,d,n[m+10],9,38016083),d=v(d,p,u,l,n[m+15],14,-660478335),l=v(l,d,p,u,n[m+4],20,-405537848),u=v(u,l,d,p,n[m+9],5,568446438),p=v(p,u,l,d,n[m+14],9,-1019803690),d=v(d,p,u,l,n[m+3],14,-187363961),l=v(l,d,p,u,n[m+8],20,1163531501),u=v(u,l,d,p,n[m+13],5,-1444681467),p=v(p,u,l,d,n[m+2],9,-51403784),d=v(d,p,u,l,n[m+7],14,1735328473),u=g(u,l=v(l,d,p,u,n[m+12],20,-1926607734),d,p,n[m+5],4,-378558),p=g(p,u,l,d,n[m+8],11,-2022574463),d=g(d,p,u,l,n[m+11],16,1839030562),l=g(l,d,p,u,n[m+14],23,-35309556),u=g(u,l,d,p,n[m+1],4,-1530992060),p=g(p,u,l,d,n[m+4],11,1272893353),d=g(d,p,u,l,n[m+7],16,-155497632),l=g(l,d,p,u,n[m+10],23,-1094730640),u=g(u,l,d,p,n[m+13],4,681279174),p=g(p,u,l,d,n[m+0],11,-358537222),d=g(d,p,u,l,n[m+3],16,-722521979),l=g(l,d,p,u,n[m+6],23,76029189),u=g(u,l,d,p,n[m+9],4,-640364487),p=g(p,u,l,d,n[m+12],11,-421815835),d=g(d,p,u,l,n[m+15],16,530742520),u=b(u,l=g(l,d,p,u,n[m+2],23,-995338651),d,p,n[m+0],6,-198630844),p=b(p,u,l,d,n[m+7],10,1126891415),d=b(d,p,u,l,n[m+14],15,-1416354905),l=b(l,d,p,u,n[m+5],21,-57434055),u=b(u,l,d,p,n[m+12],6,1700485571),p=b(p,u,l,d,n[m+3],10,-1894986606),d=b(d,p,u,l,n[m+10],15,-1051523),l=b(l,d,p,u,n[m+1],21,-2054922799),u=b(u,l,d,p,n[m+8],6,1873313359),p=b(p,u,l,d,n[m+15],10,-30611744),d=b(d,p,u,l,n[m+6],15,-1560198380),l=b(l,d,p,u,n[m+13],21,1309151649),u=b(u,l,d,p,n[m+4],6,-145523070),p=b(p,u,l,d,n[m+11],10,-1120210379),d=b(d,p,u,l,n[m+2],15,718787259),l=b(l,d,p,u,n[m+9],21,-343485551),u=u+h>>>0,l=l+w>>>0,d=d+y>>>0,p=p+T>>>0}return r.endian([u,l,d,p])})._ff=function(e,t,n,r,i,a,o){var s=e+(t&n|~t&r)+(i>>>0)+o;return(s<<a|s>>>32-a)+t},s._gg=function(e,t,n,r,i,a,o){var s=e+(t&r|n&~r)+(i>>>0)+o;return(s<<a|s>>>32-a)+t},s._hh=function(e,t,n,r,i,a,o){var s=e+(t^n^r)+(i>>>0)+o;return(s<<a|s>>>32-a)+t},s._ii=function(e,t,n,r,i,a,o){var s=e+(n^(t|~r))+(i>>>0)+o;return(s<<a|s>>>32-a)+t},s._blocksize=16,s._digestsize=16,e.exports=function(e,t){if(null==e)throw new Error("Illegal argument "+e);var n=r.wordsToBytes(s(e,t));return t&&t.asBytes?n:t&&t.asString?o.bytesToString(n):r.bytesToHex(n)}},2:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Perfume:()=>ze,incrementUjNavigation:()=>Le,markStep:()=>Re,markStepOnce:()=>qe});var r,i,a={isResourceTiming:!1,isElementTiming:!1,maxTime:3e4,reportOptions:{},enableNavigationTracking:!0},o=window,s=o.console,c=o.navigator,u=o.performance,l=function(){return c.deviceMemory},d=function(){return c.hardwareConcurrency},p="mark.",m=function(){return u&&!!u.getEntriesByType&&!!u.now&&!!u.mark},f="4g",v=!1,g={},b={value:0},h={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},w={value:0},y={value:0},T={},k={isHidden:!1,didChange:!1},_=function(){k.isHidden=!1,document.hidden&&(k.isHidden=document.hidden,k.didChange=!0)},S=function(e,t){try{var n=new PerformanceObserver((function(e){t(e.getEntries())}));return n.observe({type:e,buffered:!0}),n}catch(e){s.warn("Perfume.js:",e)}return null},E=function(){return!!(d()&&d()<=4)||!!(l()&&l()<=4)},x=function(e,t){switch(e){case"slow-2g":case"2g":case"3g":return!0;default:return E()||t}},O=function(e){return parseFloat(e.toFixed(4))},j=function(e){return"number"!=typeof e?null:O(e/Math.pow(1024,2))},N=function(e,t,n,r,i){var s,u=function(){a.analyticsTracker&&(k.isHidden&&!["CLS","INP"].includes(e)||a.analyticsTracker({attribution:r,metricName:e,data:t,navigatorInformation:c?{deviceMemory:l()||0,hardwareConcurrency:d()||0,serviceWorkerStatus:"serviceWorker"in c?c.serviceWorker.controller?"controlled":"supported":"unsupported",isLowEndDevice:E(),isLowEndExperience:x(f,v)}:{},rating:n,navigationType:i}))};["CLS","INP"].includes(e)?u():(s=u,"requestIdleCallback"in o?o.requestIdleCallback(s,{timeout:3e3}):s())},I=function(e){e.forEach((function(e){if(!("self"!==e.name||e.startTime<b.value)){var t=e.duration-50;t>0&&(w.value+=t,y.value+=t)}}))};!function(e){e.instant="instant",e.quick="quick",e.moderate="moderate",e.slow="slow",e.unavoidable="unavoidable"}(r||(r={}));var P,M,B,C,D,A=((i={})[r.instant]={vitalsThresholds:[100,200],maxOutlierThreshold:1e4},i[r.quick]={vitalsThresholds:[200,500],maxOutlierThreshold:1e4},i[r.moderate]={vitalsThresholds:[500,1e3],maxOutlierThreshold:1e4},i[r.slow]={vitalsThresholds:[1e3,2e3],maxOutlierThreshold:1e4},i[r.unavoidable]={vitalsThresholds:[2e3,5e3],maxOutlierThreshold:2e4},i),L={RT:[100,200],TBT:[200,600],NTBT:[200,600]},U=function(e,t){return L[e]?t<=L[e][0]?"good":t<=L[e][1]?"needsImprovement":"poor":null},R=function(e,t,n){Object.keys(t).forEach((function(e){"number"==typeof t[e]&&(t[e]=O(t[e]))})),N(e,t,null,n||{})},q=function(e){var t=e.attribution,n=e.name,r=e.rating,i=e.value,o=e.navigationType;"FCP"===n&&(b.value=i),["FCP","LCP"].includes(n)&&!T[0]&&(T[0]=S("longtask",I)),"FID"===n&&setTimeout((function(){k.didChange||(q({attribution:t,name:"TBT",rating:U("TBT",w.value),value:w.value,navigationType:o}),R("dataConsumption",h.value))}),1e4);var s=O(i);s<=a.maxTime&&s>=0&&N(n,s,r,t,o)},F=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},z=function(e){if("loading"===document.readyState)return"loading";var t=F();if(t){if(e<t.domInteractive)return"loading";if(0===t.domContentLoadedEventStart||e<t.domContentLoadedEventStart)return"dom-interactive";if(0===t.domComplete||e<t.domComplete)return"dom-content-loaded"}return"complete"},K=function(e){var t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},$=function(e,t){var n="";try{for(;e&&9!==e.nodeType;){var r=e,i=r.id?"#"+r.id:K(r)+(r.className&&r.className.length?"."+r.className.replace(/\\s+/g,"."):"");if(n.length+i.length>(t||100)-1)return n||i;if(n=n?i+">"+n:i,r.id)break;e=r.parentNode}}catch(e){}return n},Q=-1,W=function(){return Q},H=function(e){addEventListener("pageshow",(function(t){t.persisted&&(Q=t.timeStamp,e(t))}),!0)},V=function(){var e=F();return e&&e.activationStart||0},J=function(e,t){var n=F(),r="navigate";return W()>=0?r="back-forward-cache":n&&(r=document.prerendering||V()>0?"prerender":document.wasDiscarded?"restore":n.type.replace(/_/g,"-")),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},X=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var r=new PerformanceObserver((function(e){Promise.resolve().then((function(){t(e.getEntries())}))}));return r.observe(Object.assign({type:e,buffered:!0},n||{})),r}}catch(e){}},G=function(e,t){var n=function n(r){"pagehide"!==r.type&&"hidden"!==document.visibilityState||(e(r),t&&(removeEventListener("visibilitychange",n,!0),removeEventListener("pagehide",n,!0)))};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},Z=function(e,t,n,r){var i,a;return function(o){t.value>=0&&(o||r)&&((a=t.value-(i||0))||void 0===i)&&(i=t.value,t.delta=a,t.rating=function(e,t){return e>t[1]?"poor":e>t[0]?"needs-improvement":"good"}(t.value,n),e(t))}},Y=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},ee=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},te=-1,ne=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},re=function(e){"hidden"===document.visibilityState&&te>-1&&(te="visibilitychange"===e.type?e.timeStamp:0,ae())},ie=function(){addEventListener("visibilitychange",re,!0),addEventListener("prerenderingchange",re,!0)},ae=function(){removeEventListener("visibilitychange",re,!0),removeEventListener("prerenderingchange",re,!0)},oe=function(){return te<0&&(te=ne(),ie(),H((function(){setTimeout((function(){te=ne(),ie()}),0)}))),{get firstHiddenTime(){return te}}},se=function(e,t){t=t||{},ee((function(){var n,r=[1800,3e3],i=oe(),a=J("FCP"),o=X("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(o.disconnect(),e.startTime<i.firstHiddenTime&&(a.value=Math.max(e.startTime-V(),0),a.entries.push(e),n(!0)))}))}));o&&(n=Z(e,a,r,t.reportAllChanges),H((function(i){a=J("FCP"),n=Z(e,a,r,t.reportAllChanges),Y((function(){a.value=performance.now()-i.timeStamp,n(!0)}))})))}))},ce={passive:!0,capture:!0},ue=new Date,le=function(e,t){P||(P=t,M=e,B=new Date,me(removeEventListener),de())},de=function(){if(M>=0&&M<B-ue){var e={entryType:"first-input",name:P.type,target:P.target,cancelable:P.cancelable,startTime:P.timeStamp,processingStart:P.timeStamp+M};C.forEach((function(t){t(e)})),C=[]}},pe=function(e){if(e.cancelable){var t=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,t){var n=function(){le(e,t),i()},r=function(){i()},i=function(){removeEventListener("pointerup",n,ce),removeEventListener("pointercancel",r,ce)};addEventListener("pointerup",n,ce),addEventListener("pointercancel",r,ce)}(t,e):le(t,e)}},me=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return e(t,pe,ce)}))},fe=0,ve=1/0,ge=0,be=function(e){e.forEach((function(e){e.interactionId&&(ve=Math.min(ve,e.interactionId),ge=Math.max(ge,e.interactionId),fe=ge?(ge-ve)/7+1:0)}))},he=function(){return D?fe:performance.interactionCount||0},we=0,ye=function(){return he()-we},Te=[],ke={},_e=function(e){var t=Te[Te.length-1],n=ke[e.interactionId];if(n||Te.length<10||e.duration>t.latency){if(n)n.entries.push(e),n.latency=Math.max(n.latency,e.duration);else{var r={id:e.interactionId,latency:e.duration,entries:[e]};ke[r.id]=r,Te.push(r)}Te.sort((function(e,t){return t.latency-e.latency})),Te.splice(10).forEach((function(e){delete ke[e.id]}))}},Se={},Ee=function e(t){document.prerendering?ee((function(){return e(t)})):"complete"!==document.readyState?addEventListener("load",(function(){return e(t)}),!0):setTimeout(t,0)},xe=function(e,t){t=t||{};var n=[800,1800],r=J("TTFB"),i=Z(e,r,n,t.reportAllChanges);Ee((function(){var a=F();if(a){var o=a.responseStart;if(o<=0||o>performance.now())return;r.value=Math.max(o-V(),0),r.entries=[a],i(!0),H((function(){r=J("TTFB",0),(i=Z(e,r,n,t.reportAllChanges))(!0)}))}}))},Oe=function(e){e.forEach((function(e){e.identifier&&q({attribution:{identifier:e.identifier},name:"ET",rating:null,value:e.startTime})}))},je=function(e){e.forEach((function(e){if(a.isResourceTiming&&R("resourceTiming",e),e.decodedBodySize&&e.initiatorType){var t=e.decodedBodySize/1e3;h.value[e.initiatorType]+=t,h.value.total+=t}}))},Ne=function(){!function(e,t){xe((function(e){!function(e){if(e.entries.length){var t=e.entries[0],n=t.activationStart||0,r=Math.max(t.domainLookupStart-n,0),i=Math.max(t.connectStart-n,0),a=Math.max(t.requestStart-n,0);e.attribution={waitingTime:r,dnsTime:i-r,connectionTime:a-i,requestTime:e.value-a,navigationEntry:t}}else e.attribution={waitingTime:0,dnsTime:0,connectionTime:0,requestTime:0}}(e),function(e){e.value>0&&q(e)}(e)}),t)}(0,a.reportOptions.ttfb),function(e,t){!function(e,t){t=t||{},ee((function(){var e,n=[.1,.25],r=J("CLS"),i=-1,a=0,o=[],s=function(e){i>-1&&function(e){!function(e){if(e.entries.length){var t=e.entries.reduce((function(e,t){return e&&e.value>t.value?e:t}));if(t&&t.sources&&t.sources.length){var n=(r=t.sources).find((function(e){return e.node&&1===e.node.nodeType}))||r[0];if(n)return void(e.attribution={largestShiftTarget:$(n.node),largestShiftTime:t.startTime,largestShiftValue:t.value,largestShiftSource:n,largestShiftEntry:t,loadState:z(t.startTime)})}}var r;e.attribution={}}(e),function(e){q(e)}(e)}(e)},c=function(t){t.forEach((function(t){if(!t.hadRecentInput){var n=o[0],i=o[o.length-1];a&&t.startTime-i.startTime<1e3&&t.startTime-n.startTime<5e3?(a+=t.value,o.push(t)):(a=t.value,o=[t]),a>r.value&&(r.value=a,r.entries=o,e())}}))},u=X("layout-shift",c);u&&(e=Z(s,r,n,t.reportAllChanges),se((function(t){i=t.value,r.value<0&&(r.value=0,e())})),G((function(){c(u.takeRecords()),e(!0)})),H((function(){a=0,i=-1,r=J("CLS",0),e=Z(s,r,n,t.reportAllChanges),Y((function(){return e()}))})))}))}(0,t)}(0,a.reportOptions.cls),function(e,t){se((function(e){!function(e){if(e.entries.length){var t=F(),n=e.entries[e.entries.length-1];if(t){var r=t.activationStart||0,i=Math.max(0,t.responseStart-r);return void(e.attribution={timeToFirstByte:i,firstByteToFCP:e.value-i,loadState:z(e.entries[0].startTime),navigationEntry:t,fcpEntry:n})}}e.attribution={timeToFirstByte:0,firstByteToFCP:e.value,loadState:z(W())}}(e),function(e){q(e)}(e)}),t)}(0,a.reportOptions.fcp),function(e,t){!function(e,t){t=t||{},ee((function(){var n,r=[100,300],i=oe(),a=J("FID"),o=function(e){e.startTime<i.firstHiddenTime&&(a.value=e.processingStart-e.startTime,a.entries.push(e),n(!0))},s=function(e){e.forEach(o)},c=X("first-input",s);n=Z(e,a,r,t.reportAllChanges),c&&G((function(){s(c.takeRecords()),c.disconnect()}),!0),c&&H((function(){var i;a=J("FID"),n=Z(e,a,r,t.reportAllChanges),C=[],M=-1,P=null,me(addEventListener),i=o,C.push(i),de()}))}))}((function(e){!function(e){var t=e.entries[0];e.attribution={eventTarget:$(t.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:z(t.startTime)}}(e),function(e){q(e)}(e)}),t)}(0,a.reportOptions.fid),function(e,t){!function(e,t){t=t||{},ee((function(){var n,r=[2500,4e3],i=oe(),a=J("LCP"),o=function(e){var t=e[e.length-1];if(t){var r=Math.max(t.startTime-V(),0);r<i.firstHiddenTime&&(a.value=r,a.entries=[t],n())}},s=X("largest-contentful-paint",o);if(s){n=Z(e,a,r,t.reportAllChanges);var c=function(){Se[a.id]||(o(s.takeRecords()),s.disconnect(),Se[a.id]=!0,n(!0))};["keydown","click"].forEach((function(e){addEventListener(e,c,{once:!0,capture:!0})})),G(c,!0),H((function(i){a=J("LCP"),n=Z(e,a,r,t.reportAllChanges),Y((function(){a.value=performance.now()-i.timeStamp,Se[a.id]=!0,n(!0)}))}))}}))}((function(e){!function(e){if(e.entries.length){var t=F();if(t){var n=t.activationStart||0,r=e.entries[e.entries.length-1],i=r.url&&performance.getEntriesByType("resource").filter((function(e){return e.name===r.url}))[0],a=Math.max(0,t.responseStart-n),o=Math.max(a,i?(i.requestStart||i.startTime)-n:0),s=Math.max(o,i?i.responseEnd-n:0),c=Math.max(s,r?r.startTime-n:0),u={element:$(r.element),timeToFirstByte:a,resourceLoadDelay:o-a,resourceLoadTime:s-o,elementRenderDelay:c-s,navigationEntry:t,lcpEntry:r};return r.url&&(u.url=r.url),i&&(u.lcpResourceEntry=i),void(e.attribution=u)}}e.attribution={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadTime:0,elementRenderDelay:e.value}}(e),function(e){q(e)}(e)}),t)}(0,a.reportOptions.lcp),function(e,t){!function(e,t){t=t||{},ee((function(){var n=[200,500];"interactionCount"in performance||D||(D=X("event",be,{type:"event",buffered:!0,durationThreshold:0}));var r,i=J("INP"),a=function(e){e.forEach((function(e){e.interactionId&&_e(e),"first-input"===e.entryType&&!Te.some((function(t){return t.entries.some((function(t){return e.duration===t.duration&&e.startTime===t.startTime}))}))&&_e(e)}));var t,n=(t=Math.min(Te.length-1,Math.floor(ye()/50)),Te[t]);n&&n.latency!==i.value&&(i.value=n.latency,i.entries=n.entries,r())},o=X("event",a,{durationThreshold:t.durationThreshold||40});r=Z(e,i,n,t.reportAllChanges),o&&(o.observe({type:"first-input",buffered:!0}),G((function(){a(o.takeRecords()),i.value<0&&ye()>0&&(i.value=0,i.entries=[]),r(!0)})),H((function(){Te=[],we=he(),i=J("INP"),r=Z(e,i,n,t.reportAllChanges)})))}))}((function(t){!function(e){if(e.entries.length){var t=e.entries.sort((function(e,t){return t.duration-e.duration||t.processingEnd-t.processingStart-(e.processingEnd-e.processingStart)}))[0];e.attribution={eventTarget:$(t.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:z(t.startTime)}}else e.attribution={}}(t),e(t)}),t)}((function(e){return q(e)}),a.reportOptions.inp),a.isResourceTiming&&S("resource",je),a.isElementTiming&&S("element",Oe)},Ie=function(e){var t="usageDetails"in e?e.usageDetails:{};R("storageEstimate",{quota:j(e.quota),usage:j(e.usage),caches:j(t.caches),indexedDB:j(t.indexedDB),serviceWorker:j(t.serviceWorkerRegistrations)})},Pe={finalMarkToStepsMap:{},startMarkToStepsMap:{},active:{},navigationSteps:{}},Me=function(e){delete Pe.active[e]},Be=function(){return Pe.navigationSteps},Ce=function(e){var t;return null!==(t=Be()[e])&&void 0!==t?t:{}},De=function(e,t,n){var r="step."+e,i=u.getEntriesByName(p+t).length>0;if(u.getEntriesByName(p+n).length>0&&a.steps){var o=A[a.steps[e].threshold],s=o.maxOutlierThreshold,c=o.vitalsThresholds;if(i){var l=u.measure(r,p+t,p+n),d=l.duration;if(d<=s){var m=function(e,t){return e<=t[0]?"good":e<=t[1]?"needsImprovement":"poor"}(d,c);d>=0&&(N("userJourneyStep",d,m,{stepName:e},void 0),u.measure("step.".concat(e,"_vitals_").concat(m),{start:l.startTime+l.duration,end:l.startTime+l.duration,detail:{type:"stepVital",duration:d}}))}}}},Ae=function(){var e=Be(),t=Pe.startMarkToStepsMap,n=Object.keys(e).length;if(0===n)return{};var r={},i=n-1,a=Ce(i);if(Object.keys(a).forEach((function(e){var n,i=null!==(n=t[e])&&void 0!==n?n:[];Object.keys(i).forEach((function(e){r[e]=!0}))})),n>1){var o=Ce(i-1);Object.keys(o).forEach((function(e){var n,i=null!==(n=t[e])&&void 0!==n?n:[];Object.keys(i).forEach((function(e){r[e]=!0}))}))}return r},Le=function(){var e,t=Object.keys(Pe.navigationSteps).length;Pe.navigationSteps[t]={};var n=Ae();null===(e=a.onMarkStep)||void 0===e||e.call(a,"",Object.keys(n))},Ue=function(e){var t,n,r,i,o,s,c;if(Pe.finalMarkToStepsMap[e]){!function(e){var t=Pe.navigationSteps,n=Pe.finalMarkToStepsMap,r=Object.keys(t).length;if(0!==r){var i=r-1,a=Ce(i);if(a&&n[e]){var o=n[e];o&&Object.keys(o).forEach((function(e){if(a[e]){var n=Ce(i)||{};n[e]=!1,t[i]=n}if(r>1){var o=i-1,s=Ce(o);s[e]&&(s[e]=!1,t[o]=s)}}))}}}(e);var u=Pe.finalMarkToStepsMap[e];Object.keys(u).forEach((function(t){var n=u[t];n.forEach(Me),Promise.all(n.map((function(n){return function(e,t,n,r){return new(n||(n=Promise))((function(e,t){function i(e){try{o(r.next(e))}catch(e){t(e)}}function a(e){try{o(r.throw(e))}catch(e){t(e)}}function o(t){var r;t.done?e(t.value):(r=t.value,r instanceof n?r:new n((function(e){e(r)}))).then(i,a)}o((r=r.apply(undefined,[])).next())}))}(0,0,void 0,(function(){return function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}(this,(function(r){switch(r.label){case 0:return[4,De(n,t,e)];case 1:return r.sent(),[2]}}))}))}))).catch((function(){}))}))}else r=e,i=Pe.navigationSteps,o=Object.keys(i).length,(c=Ce(s=(o>0?o:1)-1)||[])[r]=!0,i[s]=c,function(e){var t,n=null!==(t=Pe.startMarkToStepsMap[e])&&void 0!==t?t:[];Object.keys(n).forEach((function(e){Pe.active[e]||(Pe.active[e]=!0)}))}(e);if(a.enableNavigationTracking){var l=Ae();null===(t=a.onMarkStep)||void 0===t||t.call(a,e,Object.keys(l))}else null===(n=a.onMarkStep)||void 0===n||n.call(a,e,Object.keys(Pe.active))},Re=function(e){u.mark(p+e),Ue(e)},qe=function(e){0===u.getEntriesByName(p+e).length&&(u.mark(p+e),Ue(e))},Fe=0,ze=function(){function e(e){if(void 0===e&&(e={}),this.v="9.0.0-rc.3",a.analyticsTracker=e.analyticsTracker,a.isResourceTiming=!!e.resourceTiming,a.isElementTiming=!!e.elementTiming,a.maxTime=e.maxMeasureTime||a.maxTime,a.reportOptions=e.reportOptions||a.reportOptions,a.steps=e.steps,a.onMarkStep=e.onMarkStep,a.enableNavigationTracking=e.enableNavigationTracking,m()){"PerformanceObserver"in o&&Ne(),void 0!==document.hidden&&document.addEventListener("visibilitychange",_);var t=function(){if(!m())return{};var e=u.getEntriesByType("navigation")[0];if(!e)return{};var t=e.responseStart,n=e.responseEnd;return{fetchTime:n-e.fetchStart,workerTime:e.workerStart>0?n-e.workerStart:0,totalTime:n-e.requestStart,downloadTime:n-t,timeToFirstByte:t-e.requestStart,headerSize:e.transferSize-e.encodedBodySize||0,dnsLookupTime:e.domainLookupEnd-e.domainLookupStart,redirectTime:e.redirectEnd-e.redirectStart}}();R("navigationTiming",t),t.redirectTime&&q({attribution:{},name:"RT",rating:U("RT",t.redirectTime),value:t.redirectTime}),R("networkInformation",function(){if("connection"in c){var e=c.connection;return"object"!=typeof e?{}:(f=e.effectiveType,v=!!e.saveData,{downlink:e.downlink,effectiveType:e.effectiveType,rtt:e.rtt,saveData:!!e.saveData})}return{}}()),c&&c.storage&&"function"==typeof c.storage.estimate&&c.storage.estimate().then(Ie),a.steps&&a.steps&&(Pe.startMarkToStepsMap={},Pe.finalMarkToStepsMap={},Pe.active={},Pe.navigationSteps={},Object.entries(a.steps).forEach((function(e){var t,n,r=e[0],i=e[1].marks,a=i[0],o=i[1],s=null!==(n=Pe.startMarkToStepsMap[a])&&void 0!==n?n:{};if(s[r]=!0,Pe.startMarkToStepsMap[a]=s,Pe.finalMarkToStepsMap[o]){var c=Pe.finalMarkToStepsMap[o][a]||[];c.push(r),Pe.finalMarkToStepsMap[o][a]=c}else Pe.finalMarkToStepsMap[o]=((t={})[a]=[r],t)})))}}return e.prototype.start=function(e){m()&&!g[e]&&(g[e]=!0,u.mark("mark_".concat(e,"_start")))},e.prototype.end=function(e,t,n){if(void 0===t&&(t={}),void 0===n&&(n=!0),m()&&g[e]){u.mark("mark_".concat(e,"_end")),delete g[e];var r=function(e){u.measure(e,"mark_".concat(e,"_start"),"mark_".concat(e,"_end"));var t=u.getEntriesByName(e).pop();return t&&"measure"===t.entryType?t.duration:-1}(e);n&&R(e,O(r),t)}},e.prototype.endPaint=function(e,t){var n=this;setTimeout((function(){n.end(e,t)}))},e.prototype.clear=function(e){delete g[e],u.clearMarks&&(u.clearMarks("mark_".concat(e,"_start")),u.clearMarks("mark_".concat(e,"_end")))},e.prototype.markNTBT=function(){var e=this;this.start("ntbt"),y.value=0,clearTimeout(Fe),Fe=setTimeout((function(){e.end("ntbt",{},!1),q({attribution:{},name:"NTBT",rating:U("NTBT",y.value),value:y.value}),y.value=0}),2e3)},e}()},426:(e,t)=>{"use strict";Symbol.for("react.element"),Symbol.for("react.portal"),Symbol.for("react.fragment"),Symbol.for("react.strict_mode"),Symbol.for("react.profiler"),Symbol.for("react.provider"),Symbol.for("react.context"),Symbol.for("react.forward_ref"),Symbol.for("react.suspense"),Symbol.for("react.memo"),Symbol.for("react.lazy"),Symbol.iterator;var n={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},r=Object.assign,i={};function a(e,t,r){this.props=e,this.context=t,this.refs=i,this.updater=r||n}function o(){}function s(e,t,r){this.props=e,this.context=t,this.refs=i,this.updater=r||n}a.prototype.isReactComponent={},a.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},a.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},o.prototype=a.prototype;var c=s.prototype=new o;c.constructor=s,r(c,a.prototype),c.isPureReactComponent=!0;Array.isArray,Object.prototype.hasOwnProperty;var u={current:null};t.useCallback=function(e,t){return u.current.useCallback(e,t)},t.useEffect=function(e,t){return u.current.useEffect(e,t)},t.useRef=function(e){return u.current.useRef(e)}},784:(e,t,n)=>{"use strict";e.exports=n(426)},353:function(e,t,n){var r;!function(i,a){"use strict";var o="function",s="undefined",c="object",u="string",l="major",d="model",p="name",m="type",f="vendor",v="version",g="architecture",b="console",h="mobile",w="tablet",y="smarttv",T="wearable",k="embedded",_="Amazon",S="Apple",E="ASUS",x="BlackBerry",O="Browser",j="Chrome",N="Firefox",I="Google",P="Huawei",M="LG",B="Microsoft",C="Motorola",D="Opera",A="Samsung",L="Sharp",U="Sony",R="Xiaomi",q="Zebra",F="Facebook",z="Chromium OS",K="Mac OS",$=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},Q=function(e,t){return typeof e===u&&-1!==W(t).indexOf(W(e))},W=function(e){return e.toLowerCase()},H=function(e,t){if(typeof e===u)return e=e.replace(/^\\s\\s*/,""),typeof t===s?e:e.substring(0,350)},V=function(e,t){for(var n,r,i,s,u,l,d=0;d<t.length&&!u;){var p=t[d],m=t[d+1];for(n=r=0;n<p.length&&!u&&p[n];)if(u=p[n++].exec(e))for(i=0;i<m.length;i++)l=u[++r],typeof(s=m[i])===c&&s.length>0?2===s.length?typeof s[1]==o?this[s[0]]=s[1].call(this,l):this[s[0]]=s[1]:3===s.length?typeof s[1]!==o||s[1].exec&&s[1].test?this[s[0]]=l?l.replace(s[1],s[2]):a:this[s[0]]=l?s[1].call(this,l,s[2]):a:4===s.length&&(this[s[0]]=l?s[3].call(this,l.replace(s[1],s[2])):a):this[s]=l||a;d+=2}},J=function(e,t){for(var n in t)if(typeof t[n]===c&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(Q(t[n][r],e))return"?"===n?a:n}else if(Q(t[n],e))return"?"===n?a:n;return e},X={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},G={browser:[[/\\b(?:crmo|crios)\\/([\\w\\.]+)/i],[v,[p,"Chrome"]],[/edg(?:e|ios|a)?\\/([\\w\\.]+)/i],[v,[p,"Edge"]],[/(opera mini)\\/([-\\w\\.]+)/i,/(opera [mobiletab]{3,6})\\b.+version\\/([-\\w\\.]+)/i,/(opera)(?:.+version\\/|[\\/ ]+)([\\w\\.]+)/i],[p,v],[/opios[\\/ ]+([\\w\\.]+)/i],[v,[p,D+" Mini"]],[/\\bopr\\/([\\w\\.]+)/i],[v,[p,D]],[/(kindle)\\/([\\w\\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\\/ ]?([\\w\\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\\/ ]?([\\w\\.]*)/i,/(ba?idubrowser)[\\/ ]?([\\w\\.]+)/i,/(?:ms|\\()(ie) ([\\w\\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\\/([-\\w\\.]+)/i,/(heytap|ovi)browser\\/([\\d\\.]+)/i,/(weibo)__([\\d\\.]+)/i],[p,v],[/(?:\\buc? ?browser|(?:juc.+)ucweb)[\\/ ]?([\\w\\.]+)/i],[v,[p,"UC"+O]],[/microm.+\\bqbcore\\/([\\w\\.]+)/i,/\\bqbcore\\/([\\w\\.]+).+microm/i],[v,[p,"WeChat(Win) Desktop"]],[/micromessenger\\/([\\w\\.]+)/i],[v,[p,"WeChat"]],[/konqueror\\/([\\w\\.]+)/i],[v,[p,"Konqueror"]],[/trident.+rv[: ]([\\w\\.]{1,9})\\b.+like gecko/i],[v,[p,"IE"]],[/ya(?:search)?browser\\/([\\w\\.]+)/i],[v,[p,"Yandex"]],[/(avast|avg)\\/([\\w\\.]+)/i],[[p,/(.+)/,"$1 Secure "+O],v],[/\\bfocus\\/([\\w\\.]+)/i],[v,[p,N+" Focus"]],[/\\bopt\\/([\\w\\.]+)/i],[v,[p,D+" Touch"]],[/coc_coc\\w+\\/([\\w\\.]+)/i],[v,[p,"Coc Coc"]],[/dolfin\\/([\\w\\.]+)/i],[v,[p,"Dolphin"]],[/coast\\/([\\w\\.]+)/i],[v,[p,D+" Coast"]],[/miuibrowser\\/([\\w\\.]+)/i],[v,[p,"MIUI "+O]],[/fxios\\/([-\\w\\.]+)/i],[v,[p,N]],[/\\bqihu|(qi?ho?o?|360)browser/i],[[p,"360 "+O]],[/(oculus|samsung|sailfish|huawei)browser\\/([\\w\\.]+)/i],[[p,/(.+)/,"$1 "+O],v],[/(comodo_dragon)\\/([\\w\\.]+)/i],[[p,/_/g," "],v],[/(electron)\\/([\\w\\.]+) safari/i,/(tesla)(?: qtcarbrowser|\\/(20\\d\\d\\.[-\\w\\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\\/ ]?([\\w\\.]+)/i],[p,v],[/(metasr)[\\/ ]?([\\w\\.]+)/i,/(lbbrowser)/i,/\\[(linkedin)app\\]/i],[p],[/((?:fban\\/fbios|fb_iab\\/fb4a)(?!.+fbav)|;fbav\\/([\\w\\.]+);)/i],[[p,F],v],[/(kakao(?:talk|story))[\\/ ]([\\w\\.]+)/i,/(naver)\\(.*?(\\d+\\.[\\w\\.]+).*\\)/i,/safari (line)\\/([\\w\\.]+)/i,/\\b(line)\\/([\\w\\.]+)\\/iab/i,/(chromium|instagram)[\\/ ]([-\\w\\.]+)/i],[p,v],[/\\bgsa\\/([\\w\\.]+) .*safari\\//i],[v,[p,"GSA"]],[/musical_ly(?:.+app_?version\\/|_)([\\w\\.]+)/i],[v,[p,"TikTok"]],[/headlesschrome(?:\\/([\\w\\.]+)| )/i],[v,[p,j+" Headless"]],[/ wv\\).+(chrome)\\/([\\w\\.]+)/i],[[p,j+" WebView"],v],[/droid.+ version\\/([\\w\\.]+)\\b.+(?:mobile safari|safari)/i],[v,[p,"Android "+O]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\\/v?([\\w\\.]+)/i],[p,v],[/version\\/([\\w\\.\\,]+) .*mobile\\/\\w+ (safari)/i],[v,[p,"Mobile Safari"]],[/version\\/([\\w(\\.|\\,)]+) .*(mobile ?safari|safari)/i],[v,p],[/webkit.+?(mobile ?safari|safari)(\\/[\\w\\.]+)/i],[p,[v,J,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\\/([\\w\\.]+)/i],[p,v],[/(navigator|netscape\\d?)\\/([-\\w\\.]+)/i],[[p,"Netscape"],v],[/mobile vr; rv:([\\w\\.]+)\\).+firefox/i],[v,[p,N+" Reality"]],[/ekiohf.+(flow)\\/([\\w\\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\\/ ]?([\\w\\.\\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\\/([-\\w\\.]+)$/i,/(firefox)\\/([\\w\\.]+)/i,/(mozilla)\\/([\\w\\.]+) .+rv\\:.+gecko\\/\\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\\. ]?browser)[-\\/ ]?v?([\\w\\.]+)/i,/(links) \\(([\\w\\.]+)/i,/panasonic;(viera)/i],[p,v],[/(cobalt)\\/([\\w\\.]+)/i],[p,[v,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\\)]/i],[[g,"amd64"]],[/(ia32(?=;))/i],[[g,W]],[/((?:i[346]|x)86)[;\\)]/i],[[g,"ia32"]],[/\\b(aarch64|arm(v?8e?l?|_?64))\\b/i],[[g,"arm64"]],[/\\b(arm(?:v[67])?ht?n?[fl]p?)\\b/i],[[g,"armhf"]],[/windows (ce|mobile); ppc;/i],[[g,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\\))/i],[[g,/ower/,"",W]],[/(sun4\\w)[;\\)]/i],[[g,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\\))|\\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\\b|pa-risc)/i],[[g,W]]],device:[[/\\b(sch-i[89]0\\d|shw-m380s|sm-[ptx]\\w{2,4}|gt-[pn]\\d{2,4}|sgh-t8[56]9|nexus 10)/i],[d,[f,A],[m,w]],[/\\b((?:s[cgp]h|gt|sm)-\\w+|sc[g-]?[\\d]+a?|galaxy nexus)/i,/samsung[- ]([-\\w]+)/i,/sec-(sgh\\w+)/i],[d,[f,A],[m,h]],[/(?:\\/|\\()(ip(?:hone|od)[\\w, ]*)(?:\\/|;)/i],[d,[f,S],[m,h]],[/\\((ipad);[-\\w\\),; ]+apple/i,/applecoremedia\\/[\\w\\.]+ \\((ipad)/i,/\\b(ipad)\\d\\d?,\\d\\d?[;\\]].+ios/i],[d,[f,S],[m,w]],[/(macintosh);/i],[d,[f,S]],[/\\b(sh-?[altvz]?\\d\\d[a-ekm]?)/i],[d,[f,L],[m,h]],[/\\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\\d{2})\\b(?!.+d\\/s)/i],[d,[f,P],[m,w]],[/(?:huawei|honor)([-\\w ]+)[;\\)]/i,/\\b(nexus 6p|\\w{2,4}e?-[atu]?[ln][\\dx][012359c][adn]?)\\b(?!.+d\\/s)/i],[d,[f,P],[m,h]],[/\\b(poco[\\w ]+)(?: bui|\\))/i,/\\b; (\\w+) build\\/hm\\1/i,/\\b(hm[-_ ]?note?[_ ]?(?:\\d\\w)?) bui/i,/\\b(redmi[\\-_ ]?(?:note|k)?[\\w_ ]+)(?: bui|\\))/i,/\\b(mi[-_ ]?(?:a\\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\\d?\\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\\))/i],[[d,/_/g," "],[f,R],[m,h]],[/\\b(mi[-_ ]?(?:pad)(?:[\\w_ ]+))(?: bui|\\))/i],[[d,/_/g," "],[f,R],[m,w]],[/; (\\w+) bui.+ oppo/i,/\\b(cph[12]\\d{3}|p(?:af|c[al]|d\\w|e[ar])[mt]\\d0|x9007|a101op)\\b/i],[d,[f,"OPPO"],[m,h]],[/vivo (\\w+)(?: bui|\\))/i,/\\b(v[12]\\d{3}\\w?[at])(?: bui|;)/i],[d,[f,"Vivo"],[m,h]],[/\\b(rmx[12]\\d{3})(?: bui|;|\\))/i],[d,[f,"Realme"],[m,h]],[/\\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\\b[\\w ]+build\\//i,/\\bmot(?:orola)?[- ](\\w*)/i,/((?:moto[\\w\\(\\) ]+|xt\\d{3,4}|nexus 6)(?= bui|\\)))/i],[d,[f,C],[m,h]],[/\\b(mz60\\d|xoom[2 ]{0,2}) build\\//i],[d,[f,C],[m,w]],[/((?=lg)?[vl]k\\-?\\d{3}) bui| 3\\.[-\\w; ]{10}lg?-([06cv9]{3,4})/i],[d,[f,M],[m,w]],[/(lm(?:-?f100[nv]?|-[\\w\\.]+)(?= bui|\\))|nexus [45])/i,/\\blg[-e;\\/ ]+((?!browser|netcast|android tv)\\w+)/i,/\\blg-?([\\d\\w]+) bui/i],[d,[f,M],[m,h]],[/(ideatab[-\\w ]+)/i,/lenovo ?(s[56]000[-\\w]+|tab(?:[\\w ]+)|yt[-\\d\\w]{6}|tb[-\\d\\w]{6})/i],[d,[f,"Lenovo"],[m,w]],[/(?:maemo|nokia).*(n900|lumia \\d+)/i,/nokia[-_ ]?([-\\w\\.]*)/i],[[d,/_/g," "],[f,"Nokia"],[m,h]],[/(pixel c)\\b/i],[d,[f,I],[m,w]],[/droid.+; (pixel[\\daxl ]{0,6})(?: bui|\\))/i],[d,[f,I],[m,h]],[/droid.+ (a?\\d[0-2]{2}so|[c-g]\\d{4}|so[-gl]\\w+|xq-a\\w[4-7][12])(?= bui|\\).+chrome\\/(?![1-6]{0,1}\\d\\.))/i],[d,[f,U],[m,h]],[/sony tablet [ps]/i,/\\b(?:sony)?sgp\\w+(?: bui|\\))/i],[[d,"Xperia Tablet"],[f,U],[m,w]],[/ (kb2005|in20[12]5|be20[12][59])\\b/i,/(?:one)?(?:plus)? (a\\d0\\d\\d)(?: b|\\))/i],[d,[f,"OnePlus"],[m,h]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\\))/i,/(kf[a-z]+)( bui|\\)).+silk\\//i],[d,[f,_],[m,w]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\\)).+silk\\//i],[[d,/(.+)/g,"Fire Phone $1"],[f,_],[m,h]],[/(playbook);[-\\w\\),; ]+(rim)/i],[d,f,[m,w]],[/\\b((?:bb[a-f]|st[hv])100-\\d)/i,/\\(bb10; (\\w+)/i],[d,[f,x],[m,h]],[/(?:\\b|asus_)(transfo[prime ]{4,10} \\w+|eeepc|slider \\w+|nexus 7|padfone|p00[cj])/i],[d,[f,E],[m,w]],[/ (z[bes]6[027][012][km][ls]|zenfone \\d\\w?)\\b/i],[d,[f,E],[m,h]],[/(nexus 9)/i],[d,[f,"HTC"],[m,w]],[/(htc)[-;_ ]{1,2}([\\w ]+(?=\\)| bui)|\\w+)/i,/(zte)[- ]([\\w ]+?)(?: bui|\\/|\\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\\.))|sony(?!-bra))[-_ ]?([-\\w]*)/i],[f,[d,/_/g," "],[m,h]],[/droid.+; ([ab][1-7]-?[0178a]\\d\\d?)/i],[d,[f,"Acer"],[m,w]],[/droid.+; (m[1-5] note) bui/i,/\\bmz-([-\\w]{2,})/i],[d,[f,"Meizu"],[m,h]],[/(blackberry|benq|palm(?=\\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\\w]*)/i,/(hp) ([\\w ]+\\w)/i,/(asus)-?(\\w+)/i,/(microsoft); (lumia[\\w ]+)/i,/(lenovo)[-_ ]?([-\\w]+)/i,/(jolla)/i,/(oppo) ?([\\w ]+) bui/i],[f,d,[m,h]],[/(kobo)\\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\\/([\\w\\.]+)/i,/(nook)[\\w ]+build\\/(\\w+)/i,/(dell) (strea[kpr\\d ]*[\\dko])/i,/(le[- ]+pan)[- ]+(\\w{1,9}) bui/i,/(trinity)[- ]*(t\\d{3}) bui/i,/(gigaset)[- ]+(q\\w{1,9}) bui/i,/(vodafone) ([\\w ]+)(?:\\)| bui)/i],[f,d,[m,w]],[/(surface duo)/i],[d,[f,B],[m,w]],[/droid [\\d\\.]+; (fp\\du?)(?: b|\\))/i],[d,[f,"Fairphone"],[m,h]],[/(u304aa)/i],[d,[f,"AT&T"],[m,h]],[/\\bsie-(\\w*)/i],[d,[f,"Siemens"],[m,h]],[/\\b(rct\\w+) b/i],[d,[f,"RCA"],[m,w]],[/\\b(venue[\\d ]{2,7}) b/i],[d,[f,"Dell"],[m,w]],[/\\b(q(?:mv|ta)\\w+) b/i],[d,[f,"Verizon"],[m,w]],[/\\b(?:barnes[& ]+noble |bn[rt])([\\w\\+ ]*) b/i],[d,[f,"Barnes & Noble"],[m,w]],[/\\b(tm\\d{3}\\w+) b/i],[d,[f,"NuVision"],[m,w]],[/\\b(k88) b/i],[d,[f,"ZTE"],[m,w]],[/\\b(nx\\d{3}j) b/i],[d,[f,"ZTE"],[m,h]],[/\\b(gen\\d{3}) b.+49h/i],[d,[f,"Swiss"],[m,h]],[/\\b(zur\\d{3}) b/i],[d,[f,"Swiss"],[m,w]],[/\\b((zeki)?tb.*\\b) b/i],[d,[f,"Zeki"],[m,w]],[/\\b([yr]\\d{2}) b/i,/\\b(dragon[- ]+touch |dt)(\\w{5}) b/i],[[f,"Dragon Touch"],d,[m,w]],[/\\b(ns-?\\w{0,9}) b/i],[d,[f,"Insignia"],[m,w]],[/\\b((nxa|next)-?\\w{0,9}) b/i],[d,[f,"NextBook"],[m,w]],[/\\b(xtreme\\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[f,"Voice"],d,[m,h]],[/\\b(lvtel\\-)?(v1[12]) b/i],[[f,"LvTel"],d,[m,h]],[/\\b(ph-1) /i],[d,[f,"Essential"],[m,h]],[/\\b(v(100md|700na|7011|917g).*\\b) b/i],[d,[f,"Envizen"],[m,w]],[/\\b(trio[-\\w\\. ]+) b/i],[d,[f,"MachSpeed"],[m,w]],[/\\btu_(1491) b/i],[d,[f,"Rotor"],[m,w]],[/(shield[\\w ]+) b/i],[d,[f,"Nvidia"],[m,w]],[/(sprint) (\\w+)/i],[f,d,[m,h]],[/(kin\\.[onetw]{3})/i],[[d,/\\./g," "],[f,B],[m,h]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\\)/i],[d,[f,q],[m,w]],[/droid.+; (ec30|ps20|tc[2-8]\\d[kx])\\)/i],[d,[f,q],[m,h]],[/smart-tv.+(samsung)/i],[f,[m,y]],[/hbbtv.+maple;(\\d+)/i],[[d,/^/,"SmartTV"],[f,A],[m,y]],[/(nux; netcast.+smarttv|lg (netcast\\.tv-201\\d|android tv))/i],[[f,M],[m,y]],[/(apple) ?tv/i],[f,[d,S+" TV"],[m,y]],[/crkey/i],[[d,j+"cast"],[f,I],[m,y]],[/droid.+aft(\\w)( bui|\\))/i],[d,[f,_],[m,y]],[/\\(dtv[\\);].+(aquos)/i,/(aquos-tv[\\w ]+)\\)/i],[d,[f,L],[m,y]],[/(bravia[\\w ]+)( bui|\\))/i],[d,[f,U],[m,y]],[/(mitv-\\w{5}) bui/i],[d,[f,R],[m,y]],[/Hbbtv.*(technisat) (.*);/i],[f,d,[m,y]],[/\\b(roku)[\\dx]*[\\)\\/]((?:dvp-)?[\\d\\.]*)/i,/hbbtv\\/\\d+\\.\\d+\\.\\d+ +\\([\\w\\+ ]*; *([\\w\\d][^;]*);([^;]*)/i],[[f,H],[d,H],[m,y]],[/\\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\\b/i],[[m,y]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[f,d,[m,b]],[/droid.+; (shield) bui/i],[d,[f,"Nvidia"],[m,b]],[/(playstation [345portablevi]+)/i],[d,[f,U],[m,b]],[/\\b(xbox(?: one)?(?!; xbox))[\\); ]/i],[d,[f,B],[m,b]],[/((pebble))app/i],[f,d,[m,T]],[/(watch)(?: ?os[,\\/]|\\d,\\d\\/)[\\d\\.]+/i],[d,[f,S],[m,T]],[/droid.+; (glass) \\d/i],[d,[f,I],[m,T]],[/droid.+; (wt63?0{2,3})\\)/i],[d,[f,q],[m,T]],[/(quest( 2| pro)?)/i],[d,[f,F],[m,T]],[/(tesla)(?: qtcarbrowser|\\/[-\\w\\.]+)/i],[f,[m,k]],[/(aeobc)\\b/i],[d,[f,_],[m,k]],[/droid .+?; ([^;]+?)(?: bui|\\) applew).+? mobile safari/i],[d,[m,h]],[/droid .+?; ([^;]+?)(?: bui|\\) applew).+?(?! mobile) safari/i],[d,[m,w]],[/\\b((tablet|tab)[;\\/]|focus\\/\\d(?!.+mobile))/i],[[m,w]],[/(phone|mobile(?:[;\\/]| [ \\w\\/\\.]*safari)|pda(?=.+windows ce))/i],[[m,h]],[/(android[-\\w\\. ]{0,9});.+buil/i],[d,[f,"Generic"]]],engine:[[/windows.+ edge\\/([\\w\\.]+)/i],[v,[p,"EdgeHTML"]],[/webkit\\/537\\.36.+chrome\\/(?!27)([\\w\\.]+)/i],[v,[p,"Blink"]],[/(presto)\\/([\\w\\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\\/([\\w\\.]+)/i,/ekioh(flow)\\/([\\w\\.]+)/i,/(khtml|tasman|links)[\\/ ]\\(?([\\w\\.]+)/i,/(icab)[\\/ ]([23]\\.[\\d\\.]+)/i,/\\b(libweb)/i],[p,v],[/rv\\:([\\w\\.]{1,9})\\b.+(gecko)/i],[v,p]],os:[[/microsoft (windows) (vista|xp)/i],[p,v],[/(windows) nt 6\\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\\/ ]?([\\d\\.\\w ]*)/i,/(windows)[\\/ ]?([ntce\\d\\. ]+\\w)(?!.+xbox)/i],[p,[v,J,X]],[/(win(?=3|9|n)|win 9x )([nt\\d\\.]+)/i],[[p,"Windows"],[v,J,X]],[/ip[honead]{2,4}\\b(?:.*os ([\\w]+) like mac|; opera)/i,/ios;fbsv\\/([\\d\\.]+)/i,/cfnetwork\\/.+darwin/i],[[v,/_/g,"."],[p,"iOS"]],[/(mac os x) ?([\\w\\. ]*)/i,/(macintosh|mac_powerpc\\b)(?!.+haiku)/i],[[p,K],[v,/_/g,"."]],[/droid ([\\w\\.]+)\\b.+(android[- ]x86|harmonyos)/i],[v,p],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\\/ ]?([\\w\\.]*)/i,/(blackberry)\\w*\\/([\\w\\.]*)/i,/(tizen|kaios)[\\/ ]([\\w\\.]+)/i,/\\((series40);/i],[p,v],[/\\(bb(10);/i],[v,[p,x]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\\/ ]?([\\w\\.]*)/i],[v,[p,"Symbian"]],[/mozilla\\/[\\d\\.]+ \\((?:mobile|tablet|tv|mobile; [\\w ]+); rv:.+ gecko\\/([\\w\\.]+)/i],[v,[p,N+" OS"]],[/web0s;.+rt(tv)/i,/\\b(?:hp)?wos(?:browser)?\\/([\\w\\.]+)/i],[v,[p,"webOS"]],[/watch(?: ?os[,\\/]|\\d,\\d\\/)([\\d\\.]+)/i],[v,[p,"watchOS"]],[/crkey\\/([\\d\\.]+)/i],[v,[p,j+"cast"]],[/(cros) [\\w]+(?:\\)| ([\\w\\.]+)\\b)/i],[[p,z],v],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\\/(\\d+\\.[\\w\\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\\);]+)/i,/\\b(joli|palm)\\b ?(?:os)?\\/?([\\w\\.]*)/i,/(mint)[\\/\\(\\) ]?(\\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\\/ ]?(?!chrom|package)([-\\w\\.]*)/i,/(hurd|linux) ?([\\w\\.]*)/i,/(gnu) ?([\\w\\.]*)/i,/\\b([-frentopcghs]{0,5}bsd|dragonfly)[\\/ ]?(?!amd|[ix346]{1,2}86)([\\w\\.]*)/i,/(haiku) (\\w+)/i],[p,v],[/(sunos) ?([\\w\\.\\d]*)/i],[[p,"Solaris"],v],[/((?:open)?solaris)[-\\/ ]?([\\w\\.]*)/i,/(aix) ((\\d)(?=\\.|\\)| )[\\w\\.])*/i,/\\b(beos|os\\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\\w\\.]*)/i],[p,v]]},Z=function(e,t){if(typeof e===c&&(t=e,e=a),!(this instanceof Z))return new Z(e,t).getResult();var n=typeof i!==s&&i.navigator?i.navigator:a,r=e||(n&&n.userAgent?n.userAgent:""),b=n&&n.userAgentData?n.userAgentData:a,y=t?function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2==0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n}(G,t):G,T=n&&n.userAgent==r;return this.getBrowser=function(){var e,t={};return t[p]=a,t[v]=a,V.call(t,r,y.browser),t[l]=typeof(e=t[v])===u?e.replace(/[^\\d\\.]/g,"").split(".")[0]:a,T&&n&&n.brave&&typeof n.brave.isBrave==o&&(t[p]="Brave"),t},this.getCPU=function(){var e={};return e[g]=a,V.call(e,r,y.cpu),e},this.getDevice=function(){var e={};return e[f]=a,e[d]=a,e[m]=a,V.call(e,r,y.device),T&&!e[m]&&b&&b.mobile&&(e[m]=h),T&&"Macintosh"==e[d]&&n&&typeof n.standalone!==s&&n.maxTouchPoints&&n.maxTouchPoints>2&&(e[d]="iPad",e[m]=w),e},this.getEngine=function(){var e={};return e[p]=a,e[v]=a,V.call(e,r,y.engine),e},this.getOS=function(){var e={};return e[p]=a,e[v]=a,V.call(e,r,y.os),T&&!e[p]&&b&&"Unknown"!=b.platform&&(e[p]=b.platform.replace(/chrome os/i,z).replace(/macos/i,K)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return r},this.setUA=function(e){return r=typeof e===u&&e.length>350?H(e,350):e,this},this.setUA(r),this};Z.VERSION="1.0.35",Z.BROWSER=$([p,v,l]),Z.CPU=$([g]),Z.DEVICE=$([d,f,m,b,h,y,w,T,k]),Z.ENGINE=Z.OS=$([p,v]),typeof t!==s?(e.exports&&(t=e.exports=Z),t.UAParser=Z):n.amdO?(r=function(){return Z}.call(t,n,t,e))===a||(e.exports=r):typeof i!==s&&(i.UAParser=Z);var Y=typeof i!==s&&(i.jQuery||i.Zepto);if(Y&&!Y.ua){var ee=new Z;Y.ua=ee.getResult(),Y.ua.get=function(){return ee.getUA()},Y.ua.set=function(e){ee.setUA(e);var t=ee.getResult();for(var n in t)Y.ua[n]=t[n]}}}("object"==typeof window?window:this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";n.r(r),n.d(r,{ActionType:()=>f,AmplitudePlatformName:()=>g,AnalyticsEventImportance:()=>l,AnalyticsQueries:()=>e,AuthStatus:()=>b,ComponentType:()=>m,IThresholdTier:()=>Jt,MetricType:()=>d,PlatformName:()=>v,SessionActions:()=>h,SessionAutomatedEvents:()=>w,SessionRank:()=>y,SubjectType:()=>p,UserTypeCommerce:()=>c,UserTypeInsto:()=>i,UserTypeRetail:()=>t,UserTypeRetailBusinessBanking:()=>s,UserTypeRetailEmployeeInternal:()=>a,UserTypeRetailEmployeePersonal:()=>o,UserTypeWallet:()=>u,automatedEvents:()=>xn,automatedMappingConfig:()=>In,clearMarkEntry:()=>Vn,clearPerformanceMarkEntries:()=>Xn,config:()=>A,createEventConfig:()=>On,createNewSpan:()=>Ln,createNewTrace:()=>Un,device:()=>W,endPerfMark:()=>Jn,exposeExperiment:()=>wn,flushQueue:()=>or,generateUUID:()=>V,getAnalyticsHeaders:()=>sr,getReferrerData:()=>le,getTracingHeaders:()=>An,getTracingId:()=>Dn,getUrlHostname:()=>pe,getUrlParams:()=>me,getUrlPathname:()=>fe,getUserContext:()=>ar,identify:()=>Tn,identifyFlow:()=>xe,identity:()=>H,identityFlow:()=>Se,incrementUjNavigation:()=>an,init:()=>yn,initNextJsTrackPageview:()=>_n,initTrackPageview:()=>kn,isEventKeyFormatValid:()=>we,isSessionEnded:()=>pt,location:()=>re,logEvent:()=>$t,logMetric:()=>Ht,logPageView:()=>on,logTrace:()=>Rn,markNTBT:()=>tn,markStep:()=>nn,markStepOnce:()=>rn,onVisibilityChange:()=>ln,optIn:()=>En,optOut:()=>Sn,perfMark:()=>Wn,persistentData:()=>oe,postMessage:()=>K,recordSessionDuration:()=>pn,removeFromIdentifyFlow:()=>Ee,savePersistentData:()=>st,sendScheduledEvents:()=>Bt,setBreadcrumbs:()=>ie,setConfig:()=>U,setLocation:()=>ae,setPagePath:()=>ve,setPageview:()=>Kt,setPersistentData:()=>se,setSessionStart:()=>dt,setTime:()=>Ue,startPerfMark:()=>Hn,timeStone:()=>Le,useEventLogger:()=>Yn,useLogEventOnMount:()=>tr,usePerformanceMarks:()=>rr});let e=function(e){return e.fbclid="fbclid",e.gclid="gclid",e.msclkid="msclkid",e.ptclid="ptclid",e.ttclid="ttclid",e.utm_source="utm_source",e.utm_medium="utm_medium",e.utm_campaign="utm_campaign",e.utm_term="utm_term",e.utm_content="utm_content",e}({});const t=0,i=1,a=2,o=3,s=4,c=5,u=6;let l=function(e){return e.low="low",e.high="high",e}({}),d=function(e){return e.count="count",e.rate="rate",e.gauge="gauge",e.distribution="distribution",e.histogram="histogram",e}({}),p=function(e){return e.commerce_merchant="commerce_merchant",e.device="device",e.edp_fingerprint_id="edp_fingerprint_id",e.nft_user="nft_user",e.user="user",e.wallet_user="wallet_user",e.uuid="user_uuid",e}({}),m=function(e){return e.unknown="unknown",e.banner="banner",e.button="button",e.card="card",e.chart="chart",e.content_script="content_script",e.dropdown="dropdown",e.link="link",e.page="page",e.modal="modal",e.table="table",e.search_bar="search_bar",e.service_worker="service_worker",e.text="text",e.text_input="text_input",e.tray="tray",e.checkbox="checkbox",e.icon="icon",e}({}),f=function(e){return e.unknown="unknown",e.blur="blur",e.click="click",e.change="change",e.dismiss="dismiss",e.focus="focus",e.hover="hover",e.select="select",e.measurement="measurement",e.move="move",e.process="process",e.render="render",e.scroll="scroll",e.view="view",e.search="search",e.keyPress="keyPress",e}({}),v=function(e){return e.unknown="unknown",e.web="web",e.android="android",e.ios="ios",e.mobile_web="mobile_web",e.tablet_web="tablet_web",e.server="server",e.windows="windows",e.macos="macos",e.extension="extension",e}({}),g=function(e){return e.web="Web",e.ios="iOS",e.android="Android",e}({}),b=function(e){return e[e.notLoggedIn=0]="notLoggedIn",e[e.loggedIn=1]="loggedIn",e}({}),h=function(e){return e.ac="ac",e.af="af",e.ah="ah",e.al="al",e.am="am",e.ar="ar",e.as="as",e}({}),w=function(e){return e.pv="pv",e}({}),y=function(e){return e.xs="xs",e.s="s",e.m="m",e.l="l",e.xl="xl",e.xxl="xxl",e}({});const T="https://analytics-service-dev.cbhq.net",k=3e5,_=5e3,S="analytics-db",E="experiment-exposure-db",x="Analytics SDK:",O=Object.values(e),j="pageview",N="session_duration",I={navigationTiming:{eventName:"perf_navigation_timing"},redirectTime:{eventName:"perf_redirect_time"},RT:{eventName:"perf_redirect_time"},TTFB:{eventName:"perf_time_to_first_byte"},networkInformation:{eventName:"perf_network_information"},storageEstimate:{eventName:"perf_storage_estimate"},FCP:{eventName:"perf_first_contentful_paint"},FID:{eventName:"perf_first_input_delay"},LCP:{eventName:"perf_largest_contentful_paint"},CLS:{eventName:"perf_cumulative_layout_shift"},TBT:{eventName:"perf_total_blocking_time"},NTBT:{eventName:"perf_navigation_total_blocking_time"},INP:{eventName:"perf_interact_to_next_paint"},ET:{eventName:"perf_element_timing"},userJourneyStep:{eventName:"perf_user_journey_step"}},P="1",M="web";function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},B.apply(this,arguments)}const C=/^(https?:\\/\\/)/;function D(e){return{eventsEndpoint:e+"/amp",metricsEndPoint:e+"/metrics",exposureEndpoint:e+"/track-exposures",tracesEndpoint:e+"/traces"}}const A=B({authCookie:"logged_in",amplitudeApiKey:"",batchEventsPeriod:_,batchEventsThreshold:30,batchMetricsPeriod:_,batchMetricsThreshold:30,batchTracesPeriod:_,batchTracesThreshold:30,headers:{},interactionManager:null,isAlwaysAuthed:!1,isProd:!1,isInternalApplication:!1,onError:(e,t)=>{console.error(x,e,t)},platform:v.unknown,projectName:"",ricTimeoutScheduleEvent:1e3,ricTimeoutSetDevice:500,showDebugLogging:!1,trackUserId:!1,version:null,apiEndpoint:T},D(T),{steps:{}}),L=[].reduce(((e,t)=>n=>e(t(n))),(e=>{if(!e.isProd)return e.isInternalApplication?(e.apiEndpoint="https://analytics-service-internal-dev.cbhq.net",B({},e,D(e.apiEndpoint))):e;const t=(e=>e.apiEndpoint?C.test(e.apiEndpoint)?e.apiEndpoint:`https://${e.apiEndpoint}`:e.isInternalApplication?"https://analytics-service-internal.cbhq.net":"https://as.coinbase.com")(e);return B({},e,{apiEndpoint:t},D(t))})),U=e=>{const{batchEventsThreshold:t,batchMetricsThreshold:n,batchTracesThreshold:r}=e,i=[t,n,r];for(const e of i)if((e||0)>30){console.warn("You are setting the threshhold for the batch limit to be greater than 30. This may cause request overload.");break}Object.assign(A,L(e))},R=[v.web,v.mobile_web,v.tablet_web];function q(){return"android"===A.platform}function F(){return"ios"===A.platform}function z(){return R.includes(A.platform)}function K(e){if(z()&&navigator&&"serviceWorker"in navigator&&navigator.serviceWorker.controller)try{navigator.serviceWorker.controller.postMessage(e)}catch(e){e instanceof Error&&A.onError(e)}}var $=n(353),Q=n.n($);const W={amplitudeOSName:null,amplitudeOSVersion:null,amplitudeDeviceModel:null,amplitudePlatform:null,browserName:null,browserMajor:null,osName:null,userAgent:null,width:null,height:null},H={countryCode:null,deviceId:null,device_os:null,isOptOut:!1,languageCode:null,locale:null,jwt:null,session_lcc_id:null,userAgent:null,userId:null},V=e=>e?(e^16*Math.random()>>e/4).toString(16):"10000000-1000-4000-8000-100000000000".replace(/[018]/g,V),J=()=>A.isAlwaysAuthed||!!H.userId,X=()=>{const e={};return H.countryCode&&(e.country_code=H.countryCode),e},G=()=>{const{platform:e}=A;if(e===v.web)switch(!0){case window.matchMedia("(max-width: 560px)").matches:return v.mobile_web;case window.matchMedia("(max-width: 1024px, min-width: 561px)").matches:return v.tablet_web}return e},Z=()=>{var e,t,n,r,i;z()?("requestIdleCallback"in window?window.requestIdleCallback(ne,{timeout:A.ricTimeoutSetDevice}):ne(),W.amplitudePlatform=g.web,W.userAgent=(null==(e=window)||null==(e=e.navigator)?void 0:e.userAgent)||null,ee({height:null!=(t=null==(n=window)?void 0:n.innerHeight)?t:null,width:null!=(r=null==(i=window)?void 0:i.innerWidth)?r:null})):F()?(W.amplitudePlatform=g.ios,W.userAgent=H.userAgent,W.userAgent&&ne()):q()&&(W.userAgent=H.userAgent,W.amplitudePlatform=g.android,W.userAgent&&ne())},Y=e=>{Object.assign(H,e),z()&&K({identity:{isAuthed:!!H.userId,locale:H.locale||null}})},ee=e=>{W.height=e.height,W.width=e.width},te=()=>{U({platform:G()}),z()&&K({config:{platform:A.platform}})},ne=()=>{var e;performance.mark&&performance.mark("ua_parser_start");const t=new(Q())(null!=(e=W.userAgent)?e:"").getResult();W.browserName=t.browser.name||null,W.browserMajor=t.browser.major||null,W.osName=t.os.name||null,W.amplitudeOSName=W.browserName,W.amplitudeOSVersion=W.browserMajor,W.amplitudeDeviceModel=W.osName,K({device:{browserName:W.browserName,osName:W.osName}}),performance.mark&&(performance.mark("ua_parser_end"),performance.measure("ua_parser","ua_parser_start","ua_parser_end"))},re={breadcrumbs:[],initialUAAData:{},pageKey:"",pageKeyRegex:{},pagePath:"",prevPageKey:"",prevPagePath:""};function ie(e){Object.assign(re,{breadcrumbs:e})}function ae(e){Object.assign(re,e)}const oe={eventId:0,sequenceNumber:0,sessionId:0,lastEventTime:0,sessionStart:0,sessionUUID:null,userId:null,ac:0,af:0,ah:0,al:0,am:0,ar:0,as:0,pv:0};function se(e){Object.assign(oe,e)}function ce(){var e,t;return null!=(e=null==(t=document)?void 0:t.referrer)?e:""}function ue(){return ue=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ue.apply(this,arguments)}const le=()=>{const e=ce();if(!e)return{};const t=new URL(e);return t.hostname===pe()?{}:{referrer:e,referring_domain:t.hostname}},de=()=>{const e=new URLSearchParams(me()),t={};return O.forEach((n=>{e.has(n)&&(t[n]=(e.get(n)||"").toLowerCase())})),t},pe=()=>{var e;return(null==(e=window)||null==(e=e.location)?void 0:e.hostname)||""},me=()=>{var e;return(null==(e=window)||null==(e=e.location)?void 0:e.search)||""},fe=()=>{var e;return(null==(e=window)||null==(e=e.location)?void 0:e.pathname)||""},ve=()=>{const e=A.overrideWindowLocation?re.pagePath:fe()+me();e&&e!==re.pagePath&&(e!==re.pagePath&&ge(),re.pagePath=e,re.pageKeyRegex&&Object.keys(re.pageKeyRegex).some((e=>{if(re.pageKeyRegex[e].test(re.pagePath))return re.pageKey=e,!0})))},ge=()=>{if(z()){const e=ce();if(!re.prevPagePath&&e){const t=new URL(e);if(t.hostname===pe())return void(re.prevPagePath=t.pathname)}}re.prevPagePath=re.pagePath,re.prevPageKey=re.pageKey},be=e=>{z()&&Object.assign(e,z()?(Object.keys(re.initialUAAData).length>0||(new URLSearchParams(me()),re.initialUAAData=ue({},(()=>{const e={};return O.forEach((t=>{oe[t]&&(e[t]=oe[t])})),e})(),de(),le())),re.initialUAAData):re.initialUAAData)},he=/^[a-zd]+(_[a-zd]+)*$/;function we(e){return he.test(e)}function ye(){return ye=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ye.apply(this,arguments)}const Te=["action","component_type","component_name","context","logging_id"],ke=["num_non_hardware_accounts","ujs"],_e="ujs_",Se={};function Ee(e){e.forEach((e=>{ke.includes(e)&&delete Se[e]}))}function xe(e){var t;const n=Object.entries(e).reduce(((e,t)=>{const[n,r]=t;return!Te.includes(n)&&ke.includes(n)?we(n)?ye({},e,{[n]:r}):(A.onError(new Error("IdentityFlow property names must have snake case format"),{[n]:r}),e):e}),{});null!=(t=n.ujs)&&t.length&&(n.ujs=n.ujs.map((e=>`${_e}${e}`))),Object.assign(Se,n)}function Oe(){return A.platform!==v.unknown||(A.onError(new Error("SDK platform not initialized")),!1)}const je={eventsQueue:[],eventsScheduled:!1,metricsQueue:[],metricsScheduled:!1,tracesQueue:[],tracesScheduled:!1};function Ne(e){Object.assign(je,e)}const Ie={ac:0,af:0,ah:0,al:0,am:0,ar:0,as:0,pv:0,sqs:0},Pe={ac:20,af:5,ah:1,al:1,am:0,ar:10,as:20},Me={pv:25},Be={xs:0,s:1,m:1,l:2,xl:2,xxl:2},Ce=e=>e<15?y.xs:e<60?y.s:e<240?y.m:e<960?y.l:e<3840?y.xl:y.xxl,De=e=>{Object.assign(Ie,e)};function Ae(){return(new Date).getTime()}const Le={timeStart:Ae(),timeOnPagePath:0,timeOnPageKey:0,prevTimeOnPagePath:0,prevTimeOnPageKey:0,sessionDuration:0,sessionEnd:0,sessionStart:0,prevSessionDuration:0};function Ue(e){Object.assign(Le,e)}const Re=(e,t)=>t.some((t=>e instanceof t));let qe,Fe;const ze=new WeakMap,Ke=new WeakMap,$e=new WeakMap,Qe=new WeakMap,We=new WeakMap;let He={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return Ke.get(e);if("objectStoreNames"===t)return e.objectStoreNames||$e.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Je(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function Ve(e){return"function"==typeof e?(t=e)!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(Fe||(Fe=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(Xe(this),e),Je(ze.get(this))}:function(...e){return Je(t.apply(Xe(this),e))}:function(e,...n){const r=t.call(Xe(this),e,...n);return $e.set(r,e.sort?e.sort():[e]),Je(r)}:(e instanceof IDBTransaction&&function(e){if(Ke.has(e))return;const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",a),e.removeEventListener("abort",a)},i=()=>{t(),r()},a=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",a),e.addEventListener("abort",a)}));Ke.set(e,t)}(e),Re(e,qe||(qe=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,He):e);var t}function Je(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",a)},i=()=>{t(Je(e.result)),r()},a=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",a)}));return t.then((t=>{t instanceof IDBCursor&&ze.set(t,e)})).catch((()=>{})),We.set(t,e),t}(e);if(Qe.has(e))return Qe.get(e);const t=Ve(e);return t!==e&&(Qe.set(e,t),We.set(t,e)),t}const Xe=e=>We.get(e),Ge=["get","getKey","getAll","getAllKeys","count"],Ze=["put","add","delete","clear"],Ye=new Map;function et(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(Ye.get(t))return Ye.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=Ze.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!Ge.includes(n))return;const a=async function(e,...t){const a=this.transaction(e,i?"readwrite":"readonly");let o=a.store;return r&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),i&&a.done]))[0]};return Ye.set(t,a),a}var tt;tt=He,He={...tt,get:(e,t,n)=>et(e,t)||tt.get(e,t,n),has:(e,t)=>!!et(e,t)||tt.has(e,t)};const nt={isReady:!1,idbKeyval:null};function rt(e){Object.assign(nt,e)}const it={},at=async e=>{if(!nt.idbKeyval)return Promise.resolve(null);try{return await nt.idbKeyval.get(e)}catch(e){return A.onError(new Error("IndexedDB:Get:InternalError")),Promise.resolve(null)}},ot=async(e,t)=>{if(nt.idbKeyval)try{await nt.idbKeyval.set(e,t)}catch(e){A.onError(new Error("IndexedDB:Set:InternalError"))}},st=()=>{"server"!==A.platform&&(se({sessionStart:Le.sessionStart,ac:Ie.ac,af:Ie.af,ah:Ie.ah,al:Ie.al,am:Ie.am,ar:Ie.ar,as:Ie.as,pv:Ie.pv}),H.userId&&se({userId:H.userId}),ot(S,oe))},ct="rgb(5,177,105)",ut=e=>{const{metricName:t,data:n}=e,r=e.importance||l.low;if(!A.showDebugLogging||!console)return;const i=`%c ${x}`,a=`color:${ct};font-size:11px;`,o=`Importance: ${r}`;console.group(i,a,t,o),n.forEach((e=>{e.event_type?console.log(e.event_type,e):console.log(e)})),console.groupEnd()},lt=e=>{const{metricName:t,data:n}=e,r=e.importance||l.low;if(!A.showDebugLogging||!console)return;const i=`color:${ct};font-size:11px;`,a=`%c ${x}`,o=`Importance: ${r}`;console.log(a,i,t,n,o)},dt=()=>{const e=Ae();oe.sessionId&&oe.lastEventTime&&oe.sessionUUID&&!pt(e)||(oe.sessionId=e,oe.sessionUUID=V(),Ue({sessionStart:e}),lt({metricName:"Started new session:",data:{persistentData:oe,timeStone:Le}})),oe.lastEventTime=e},pt=e=>e-oe.lastEventTime>18e5;function mt(){return mt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},mt.apply(this,arguments)}const ft=e=>{var t;(e=>{switch(e.action){case f.click:Ie.ac+=1;break;case f.focus:Ie.af+=1;break;case f.hover:Ie.ah+=1;break;case f.move:Ie.am+=1;break;case f.scroll:Ie.al+=1;break;case f.search:Ie.ar+=1;break;case f.select:Ie.as+=1}})(t=e),t.event_type!==j?t.event_type===N&&((e=>{if(!e.session_rank)return;const t=e.session_rank;Object.values(h).forEach((e=>{Ie.sqs+=Ie[e]*Pe[e]})),Object.values(w).forEach((e=>{Ie.sqs+=Ie[e]*Me[e]})),Ie.sqs*=Be[t]})(t),Object.assign(t,Ie),De({ac:0,af:0,ah:0,al:0,am:0,ar:0,as:0,pv:0,sqs:0})):Ie.pv+=1;const n=e.event_type;delete e.event_type;const r=e.deviceId?e.deviceId:null,i=e.timestamp;return delete e.timestamp,se({eventId:oe.eventId+1}),se({sequenceNumber:oe.sequenceNumber+1}),dt(),st(),{device_id:H.deviceId||r||null,user_id:H.userId,timestamp:i,event_id:oe.eventId,session_id:oe.sessionId||-1,event_type:n,version_name:A.version||null,platform:W.amplitudePlatform,os_name:W.amplitudeOSName,os_version:W.amplitudeOSVersion,device_model:W.amplitudeDeviceModel,language:H.languageCode,event_properties:mt({},e,{session_uuid:oe.sessionUUID,height:W.height,width:W.width}),user_properties:X(),uuid:V(),library:{name:"@cbhq/client-analytics",version:"10.6.0"},sequence_number:oe.sequenceNumber,user_agent:W.userAgent||H.userAgent}},vt=e=>e.map((e=>ft(e)));function gt(){return gt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gt.apply(this,arguments)}const bt=e=>e.map((e=>(e=>{const t=e.tags||{},n=gt({authed:J()?"true":"false",platform:A.platform},t,{project_name:A.projectName,version_name:A.version||null});return{metric_name:e.metricName,page_path:e.pagePath||null,value:e.value,tags:n,type:e.metricType}})(e))),ht=e=>0!==je.metricsQueue.length&&(je.metricsQueue.length>=A.batchMetricsThreshold||(je.metricsScheduled||(je.metricsScheduled=!0,setTimeout((()=>{je.metricsScheduled=!1,e(bt(je.metricsQueue)),je.metricsQueue=[]}),A.batchMetricsPeriod)),!1)),wt=e=>0!==je.tracesQueue.length&&(je.tracesQueue.length>=A.batchTracesThreshold||(je.tracesScheduled||(je.tracesScheduled=!0,setTimeout((()=>{je.tracesScheduled=!1,e(je.tracesQueue),je.tracesQueue=[]}),A.batchTracesPeriod)),!1)),yt=e=>{var t;z()&&null!=(t=window)&&t.requestIdleCallback?window.requestIdleCallback(e,{timeout:A.ricTimeoutScheduleEvent}):(q()||F())&&A.interactionManager?A.interactionManager.runAfterInteractions(e):e()};function Tt(){return Tt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Tt.apply(this,arguments)}const kt="application/x-www-form-urlencoded; charset=UTF-8",_t=e=>{const{data:t,importance:n,isJSON:r,onError:i,url:a}=e,o=r?"application/json":kt,s=n||l.low,c=r?JSON.stringify(t):new URLSearchParams(t).toString();function u(){const e=new XMLHttpRequest;e.open("POST",a,!0),Object.keys(A.headers||{}).forEach((t=>{e.setRequestHeader(t,A.headers[t])})),e.setRequestHeader("Content-Type",kt),H.jwt&&e.setRequestHeader("authorization",`Bearer ${H.jwt}`),e.send(c)}if(!z()||r||!("sendBeacon"in navigator)||s!==l.low||A.headers&&0!==Object.keys(A.headers).length)if(z()&&!r)u();else{const e=Tt({},A.headers,{"Content-Type":o});H.jwt&&(e.Authorization=`Bearer ${H.jwt}`),fetch(a,{method:"POST",mode:"no-cors",headers:e,body:c}).catch((e=>{i(e,{context:"AnalyticsSDKApiError"})}))}else{const e=new Blob([c],{type:kt});try{navigator.sendBeacon.bind(navigator)(a,e)||u()}catch(e){console.error(e),u()}}};var St=n(762),Et=n.n(St);const xt=(e,t,n)=>{const r=e||"";return Et()("2"+r+t+n)};function Ot(){return Ot=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ot.apply(this,arguments)}class jt extends Error{constructor(e){super(e),this.name="CircularJsonReference",this.message=e,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error(e).stack}}class Nt extends jt{constructor(...e){super(...e),this.name="DomReferenceInAnalyticsEvent"}}function It(){return It=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},It.apply(this,arguments)}const Pt=(e,t=l.low)=>{var n;e&&je.eventsQueue.push(e),nt.isReady&&(!A.trackUserId||H.userId?(t===l.high||(n=Mt,0!==je.eventsQueue.length&&(je.eventsQueue.length>=A.batchEventsThreshold||(je.eventsScheduled||(je.eventsScheduled=!0,setTimeout((()=>{je.eventsScheduled=!1,n(vt(je.eventsQueue)),je.eventsQueue=[]}),A.batchEventsPeriod)),0))))&&Bt():je.eventsQueue.length>10&&(A.trackUserId=!1,A.onError(new Error("userId not set in Logged-in"))))},Mt=(e,t=l.low)=>{if(H.isOptOut||0===e.length)return;let n;try{n=JSON.stringify(e)}catch(t){const r=e.map((e=>e.event_type)).join(", "),[i,a]=(e=>{try{const n=[];for(const r of e){const e=Ot({},r);r.event_properties&&(e.event_properties=Ot({},e.event_properties,{currentTarget:null,target:null,relatedTarget:null,_dispatchInstances:null,_targetInst:null,view:(t=r.event_properties.view,["string","number","boolean"].includes(typeof t)?r.event_properties.view:null)})),n.push(e)}return[!0,JSON.stringify(n)]}catch(e){return[!1,""]}var t})(e);if(!i)return void A.onError(new jt(t instanceof Error?t.message:"unknown"),{listEventType:r});n=a,A.onError(new Nt("Found DOM element reference"),{listEventType:r,stringifiedEventData:n})}const r=Ae().toString(),i=It({},{e:n,v:"2",upload_time:r},{client:A.amplitudeApiKey,checksum:xt(A.amplitudeApiKey,n,r)});_t({url:A.eventsEndpoint,data:i,importance:t,onError:A.onError}),ut({metricName:"Batch Events",data:e,importance:t})},Bt=()=>{Mt(vt(je.eventsQueue)),Ne({eventsQueue:[]})};function Ct(){return Ct=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ct.apply(this,arguments)}const Dt=Object.values(f),At=Object.values(m),Lt=e=>Dt.includes(e)?e:f.unknown,Ut=e=>At.includes(e)?e:m.unknown,Rt=(e,t,n)=>{const r={auth:J()?b.loggedIn:b.notLoggedIn,action:Lt(e),component_type:Ut(t),logging_id:n,platform:A.platform,project_name:A.projectName};return"number"==typeof H.userTypeEnum&&(r.user_type_enum=H.userTypeEnum),r},qt=e=>{const t=Ae();if(!e)return A.onError(new Error("missing logData")),Ct({},Rt(f.unknown,m.unknown),{locale:H.locale,session_lcc_id:H.session_lcc_id,timestamp:t,time_start:Le.timeStart});const n=Ct({},e,Rt(e.action,e.componentType,e.loggingId),{locale:H.locale,session_lcc_id:H.session_lcc_id,timestamp:t,time_start:Le.timeStart});return delete n.componentType,delete n.loggingId,n},Ft={blacklistRegex:[],isEnabled:!1};function zt(){return{page_key:re.pageKey,page_path:re.pagePath,prev_page_key:re.prevPageKey,prev_page_path:re.prevPagePath}}function Kt(e){Object.assign(Ft,e)}function $t(e,t,n=l.low){if(H.isOptOut)return;if(!Oe())return;const r=qt(t);!function(e){Ft.isEnabled&&(ve(),Object.assign(e,zt()))}(r),be(r),function(e){Object.keys(Se).length>0&&Object.assign(e,Se)}(r),r.has_double_fired=!1,r.event_type=e,n===l.high?Pt(r,n):yt((()=>{Pt(r)}))}function Qt(e,t=!1){t?_t({url:A.metricsEndPoint,data:{metrics:e},isJSON:!0,onError:A.onError}):yt((()=>{_t({url:A.metricsEndPoint,data:{metrics:e},isJSON:!0,onError:A.onError})})),ut({metricName:"Batch Metrics",data:e})}function Wt(){return Wt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Wt.apply(this,arguments)}function Ht(e){if(!Oe())return;v.server!==A.platform&&!e.pagePath&&re.pagePath&&(e.pagePath=re.pagePath);const t=Object.keys(Se).length?Wt({},e.tags,Se):e.tags;t&&Object.assign(e,{tags:t}),je.metricsQueue.push(e),ht(Qt)&&(Qt(bt(je.metricsQueue)),je.metricsQueue=[])}function Vt(){return Vt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Vt.apply(this,arguments)}let Jt=function(e){return e.instant="instant",e.quick="quick",e.moderate="moderate",e.slow="slow",e.unavoidable="unavoidable",e}({});function Xt(e){return e.toLowerCase()}let Gt={};const Zt=(e,t)=>{null!=A&&A.onMarkStep&&A.onMarkStep(e,t),xe({ujs:t})};let Yt;const en={Perfume:()=>{},markStep:e=>{},markStepOnce:e=>{},incrementUjNavigation:()=>{}},tn=()=>{z()&&Yt&&Yt.markNTBT&&Yt.markNTBT()},nn=e=>{z()&&Yt&&en.markStep&&en.markStep(e)},rn=e=>{z()&&Yt&&en.markStepOnce&&en.markStepOnce(e)},an=()=>{z()&&Yt&&en.incrementUjNavigation&&en.incrementUjNavigation()};function on(e={callMarkNTBT:!0}){"unknown"!==A.platform&&(Ft.blacklistRegex.some((e=>e.test(fe())))||($t(j,{action:f.render,componentType:m.page}),e.callMarkNTBT&&tn()))}let sn=!1,cn=!1;const un=e=>{sn=!e.persisted},ln=(e,t="hidden",n=!1)=>{cn||(addEventListener("pagehide",un),addEventListener("beforeunload",(()=>{})),cn=!0),addEventListener("visibilitychange",(({timeStamp:n})=>{document.visibilityState===t&&e({timeStamp:n,isUnloading:sn})}),{capture:!0,once:n})},dn=36e3;function pn(){const e=pt(Ae());if(e&&(O.forEach((e=>{oe[e]&&delete oe[e]})),st()),!oe.lastEventTime||!Le.sessionStart||!e)return;const t=Math.round((oe.lastEventTime-Le.sessionStart)/1e3);if(t<1||t>dn)return;const n=Ce(t);$t(N,{action:f.measurement,componentType:m.page,session_duration:t,session_end:oe.lastEventTime,session_start:Le.sessionStart,session_rank:n})}function mn(){return mn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},mn.apply(this,arguments)}const fn=[],vn=[],gn=()=>{const e=fn.shift();e&&e()},bn=()=>{const e=vn.shift();e&&e()};let hn={};function wn(e){const t=function(e){return{test_name:e.testName,group_name:e.group,subject_id:e.subjectId,exposed_at:Ae(),subject_type:e.subjectType,platform:A.platform}}(e);hn[e.testName]=hn[e.testName]||0,hn[e.testName]+k>Ae()?lt({metricName:`Event: exposeExperiment ${e.testName} not sent`,data:t}):(hn[e.testName]=Ae(),ot(E,hn),lt({metricName:`Event: exposeExperiment ${e.testName} sent`,data:t}),_t({url:A.exposureEndpoint,data:[t],onError:(t,n)=>{hn[e.testName]=0,ot(E,hn),A.onError(t,n)},isJSON:!0,importance:l.high}))}const yn=e=>{var t,r,i;U(e),z()&&(H.languageCode=(null==(t=navigator)?void 0:t.languages[0])||(null==(r=navigator)?void 0:r.language)||""),te(),(()=>{var e;if(z()&&null!=(e=window)&&e.indexedDB){const e=function(e,t,{blocked:n,upgrade:r,blocking:i,terminated:a}={}){const o=indexedDB.open(e,t),s=Je(o);return r&&o.addEventListener("upgradeneeded",(e=>{r(Je(o.result),e.oldVersion,e.newVersion,Je(o.transaction),e)})),n&&o.addEventListener("blocked",(e=>n(e.oldVersion,e.newVersion,e))),s.then((e=>{a&&e.addEventListener("close",(()=>a())),i&&e.addEventListener("versionchange",(e=>i(e.oldVersion,e.newVersion,e)))})).catch((()=>{})),s}("keyval-store",1,{upgrade(e){e.createObjectStore("keyval")}});rt({idbKeyval:{get:async t=>(await e).get("keyval",t),set:async(t,n)=>(await e).put("keyval",n,t),delete:async t=>(await e).delete("keyval",t),keys:async()=>(await e).getAllKeys("keyval")}})}else rt({idbKeyval:{get:async e=>new Promise((t=>{t(it[e])})),set:async(e,t)=>new Promise((n=>{it[e]=t,n(e)})),delete:async e=>new Promise((()=>{delete it[e]})),keys:async()=>new Promise((e=>{e(Object.keys(it))}))}})})(),lt({metricName:"Initialized Analytics:",data:{deviceId:H.deviceId}}),fn.push((()=>{Pt()})),(async()=>{const e=await at(S);rt({isReady:!0}),gn(),e&&(bn(),se({eventId:e.eventId||oe.eventId,sequenceNumber:e.sequenceNumber||oe.sequenceNumber,sessionId:e.sessionId||oe.sessionId,lastEventTime:e.lastEventTime||oe.lastEventTime,sessionUUID:e.sessionUUID||oe.sessionUUID}),function(e){se(mn({},function(e){const t={};return O.forEach((n=>{e[n]&&(t[n]=e[n])})),t}(e),de()))}(e),Ue({sessionStart:e.sessionStart||oe.sessionStart}),De({ac:e.ac||Ie.ac,af:e.af||Ie.af,ah:e.ah||Ie.ah,al:e.al||Ie.al,am:e.am||Ie.am,ar:e.ar||Ie.ar,as:e.as||Ie.as,pv:e.pv||Ie.pv}),A.trackUserId&&Y({userId:e.userId||H.userId}),pn(),lt({metricName:"Initialized Analytics IndexedDB:",data:e}))})(),async function(){at(E).then((e=>{hn=null!=e?e:{}})).catch((e=>{e instanceof Error&&A.onError(e)}))}(),Z(),z()&&(ln((()=>{se({lastEventTime:Ae()}),st(),Bt()}),"hidden"),ln((()=>{pn()}),"visible")),z()&&(i=()=>{var e,t,n,r;te(),ee({width:null!=(e=null==(t=window)?void 0:t.innerWidth)?e:null,height:null!=(n=null==(r=window)?void 0:r.innerHeight)?n:null})},addEventListener("resize",(()=>{requestAnimationFrame((()=>{i()}))}))),(()=>{if(z())try{const e=n(2);en.markStep=e.markStep,en.markStepOnce=e.markStepOnce,en.incrementUjNavigation=e.incrementUjNavigation,Yt=new e.Perfume({analyticsTracker:e=>{const{data:t,attribution:n,metricName:r,navigatorInformation:i,rating:a}=e,o=I[r],s=(null==n?void 0:n.category)||null;if(!o&&!s)return;const c=(null==i?void 0:i.deviceMemory)||0,u=(null==i?void 0:i.hardwareConcurrency)||0,l=(null==i?void 0:i.isLowEndDevice)||!1,p=(null==i?void 0:i.isLowEndExperience)||!1,v=(null==i?void 0:i.serviceWorkerStatus)||"unsupported",g=Vt({deviceMemory:c,hardwareConcurrency:u,isLowEndDevice:l,isLowEndExperience:p,serviceWorkerStatus:v},Gt),b={is_low_end_device:l,is_low_end_experience:p,page_key:re.pageKey||"",save_data:t.saveData||!1,service_worker:v,is_perf_metric:!0};if("navigationTiming"===r)t&&"number"==typeof t.redirectTime&&Ht({metricName:I.redirectTime.eventName,metricType:d.histogram,tags:b,value:t.redirectTime||0});else if("TTFB"===r)$t(o.eventName,Vt({action:f.measurement,componentType:m.page,duration:t||null,vitalsScore:a||null},g)),Ht({metricName:I.TTFB.eventName,metricType:d.histogram,tags:Vt({},b),value:t}),a&&Ht({metricName:`perf_web_vitals_ttfb_${a}`,metricType:d.count,tags:b,value:1});else if("networkInformation"===r)null!=t&&t.effectiveType&&(Gt=t,$t(o.eventName,{action:f.measurement,componentType:m.page,networkInformationDownlink:t.downlink,networkInformationEffectiveType:t.effectiveType,networkInformationRtt:t.rtt,networkInformationSaveData:t.saveData,navigatorDeviceMemory:c,navigatorHardwareConcurrency:u}));else if("storageEstimate"===r)$t(o.eventName,Vt({action:f.measurement,componentType:m.page},t,g)),Ht({metricName:"perf_storage_estimate_caches",metricType:d.histogram,tags:b,value:t.caches}),Ht({metricName:"perf_storage_estimate_indexed_db",metricType:d.histogram,tags:b,value:t.indexedDB});else if("CLS"===r)$t(o.eventName,Vt({action:f.measurement,componentType:m.page,score:100*t||null,vitalsScore:a||null},g)),a&&Ht({metricName:`perf_web_vitals_cls_${a}`,metricType:d.count,tags:b,value:1});else if("FID"===r){const e=(null==n?void 0:n.performanceEntry)||null,r=parseInt((null==e?void 0:e.processingStart)||"");$t(o.eventName,Vt({action:f.measurement,componentType:m.page,duration:t||null,processingStart:null!=e&&e.processingStart?r:null,startTime:null!=e&&e.startTime?parseInt(e.startTime):null,vitalsScore:a||null},g)),a&&Ht({metricName:`perf_web_vitals_fidVitals_${a}`,metricType:d.count,tags:b,value:1})}else"userJourneyStep"===r?($t("perf_user_journey_step",Vt({action:f.measurement,componentType:m.page,duration:t||null,rating:null!=a?a:null,step_name:(null==n?void 0:n.stepName)||""},g)),Ht({metricName:`user_journey_step.${A.projectName}.${A.platform}.${(null==n?void 0:n.stepName)||""}_vitals_${a}`,metricType:d.count,tags:b,value:1}),Ht({metricName:`user_journey_step.${A.projectName}.${A.platform}.${(null==n?void 0:n.stepName)||""}`,metricType:d.distribution,tags:b,value:t||null})):I[r]&&t&&($t(o.eventName,Vt({action:f.measurement,componentType:m.page,duration:t||null,vitalsScore:a||null},g)),a&&(Ht({metricName:`perf_web_vitals_${Xt(r)}_${a}`,metricType:d.count,tags:b,value:1}),"LCP"===r&&Ht({metricName:`perf_web_vitals_${Xt(r)}`,metricType:d.distribution,tags:b,value:t})))},maxMeasureTime:3e4,steps:A.steps,onMarkStep:Zt})}catch(e){e instanceof Error&&A.onError(e)}})()},Tn=e=>{Y(e),e.userAgent&&Z(),lt({metricName:"Identify:",data:{countryCode:H.countryCode,deviceId:H.deviceId,userId:H.userId}})},kn=({blacklistRegex:e,pageKeyRegex:t,browserHistory:n})=>{Kt({blacklistRegex:e||[],isEnabled:!0}),ae({pageKeyRegex:t}),on({callMarkNTBT:!1}),n.listen((()=>{on()}))},_n=({blacklistRegex:e,pageKeyRegex:t,nextJsRouter:n})=>{Kt({blacklistRegex:e||[],isEnabled:!0}),ae({pageKeyRegex:t}),on({callMarkNTBT:!1}),n.events.on("routeChangeComplete",(()=>{on()}))},Sn=()=>{Y({isOptOut:!0}),ot(S,{})},En=()=>{Y({isOptOut:!1})},xn={Button:{label:"cb_button",uuid:"e921a074-40e6-4371-8700-134d5cd633e6",componentType:m.button}};function On(e,t,n){return{componentName:e,actions:t,data:n}}function jn(){return jn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jn.apply(this,arguments)}function Nn(e,t,n){const{componentName:r,data:i}=n;$t(e.label,jn({componentType:e.componentType,action:t,loggingId:e.uuid,component_name:r},i))}const In={actionMapping:{onPress:f.click,onHover:f.hover},handlers:{Button:{[f.click]:e=>Nn(xn.Button,f.click,e),[f.hover]:e=>Nn(xn.Button,f.hover,e)}}};function Pn(e,t=!1){t?_t({url:A.tracesEndpoint,data:{traces:e},isJSON:!0,onError:A.onError}):yt((()=>{_t({url:A.tracesEndpoint,data:{traces:e},isJSON:!0,onError:A.onError})})),ut({metricName:"Batch Traces",data:e})}function Mn(){return Mn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Mn.apply(this,arguments)}const Bn=1e6;function Cn(e){return e*Bn}function Dn(e=function(){var e;return null==(e=window)?void 0:e.crypto}()){const t=new Uint32Array(2);return null==e||e.getRandomValues(t),((BigInt(t[0])<<BigInt(32))+BigInt(t[1])).toString()}function An(e,t){return{"x-datadog-origin":"rum","x-datadog-parent-id":t,"x-datadog-sampling-priority":"1","x-datadog-trace-id":e}}function Ln(e){var t;const{name:n,traceId:r,spanId:i,start:a,duration:o,resource:s,meta:c}=e;return{duration:o?Cn(o):0,name:n,resource:s,service:A.projectName,span_id:null!=i?i:Dn(),start:a?Cn(a):0,trace_id:null!=r?r:Dn(),parent_id:P,type:M,meta:Mn({platform:A.platform},re.pageKey?{page_key:re.pageKey}:{},null!=(t=Se.ujs)&&t.length?{last_ujs:Se.ujs[Se.ujs.length-1]}:{},null!=c?c:{})}}function Un(e){return[Ln(e)]}function Rn(e,t){Oe()&&function(e){return e.length>0}(e)&&(t&&function(e,t){e.forEach((e=>function(e,t){const n=Mn({},e.meta,t.meta),r={start:t.start?Cn(t.start):e.start,duration:t.duration?Cn(t.duration):e.duration};Object.assign(e,t,Mn({meta:n},r))}(e,t)))}(e,t),je.tracesQueue.push(e),wt(Pn)&&(Pn(je.tracesQueue),je.tracesQueue=[]))}function qn(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function Fn(){return Fn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Fn.apply(this,arguments)}function zn(){return void 0!==typeof window&&"performance"in window&&"mark"in performance&&"getEntriesByName"in performance}function Kn(e,t){return`perf_${e}${null!=t&&t.label?`_${t.label}`:""}`}function $n(e,t,n){return`${Kn(e,n)}__${t}`}let Qn={};function Wn(e,t,n){if(!zn())return;const r=$n(e,t,n);if(performance.mark(r),"end"===t){const t=Kn(e,n);!function(e,t,n){try{performance.measure(e,t,n)}catch(e){A.onError(e)}}(t,$n(e,"start",n),r);const i=performance.getEntriesByName(t).pop();i&&Ht(Fn({metricName:e,metricType:d.distribution,value:i.duration},null!=n&&n.tags?{tags:n.tags}:{}))}}function Hn(e,t){if(!zn())return;const n=$n(e,"start",t);Qn[n]||(Wn(e,"start",t),Qn[n]=!0)}function Vn(e,t){const n=$n(e,"start",t),r=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(Qn,[n].map(qn));Qn=r}function Jn(e,t){if(!zn())return;const n=$n(e,"start",t);Qn[n]&&(Wn(e,"end",t),Vn(e,t))}function Xn(){zn()&&(performance.clearMarks(),Qn={})}var Gn=n(784);function Zn(){return Zn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Zn.apply(this,arguments)}function Yn(e,t,n=l.low){const r=(0,Gn.useRef)(t);return(0,Gn.useEffect)((()=>{r.current=t}),[t]),(0,Gn.useCallback)((t=>{$t(e,Zn({},r.current,t),n)}),[e,n])}function er(){return er=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},er.apply(this,arguments)}function tr(e,t,n=l.low){(0,Gn.useEffect)((()=>{const r=er({},t,{action:f.render});$t(e,r,n)}),[])}function nr(){return nr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},nr.apply(this,arguments)}const rr=function(e,t){return{markStartPerf:(0,Gn.useCallback)((()=>Hn(e,t)),[e,t]),markEndPerf:(0,Gn.useCallback)((n=>Jn(e,nr({},t,n))),[e,t])}};function ir(){return ir=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ir.apply(this,arguments)}function ar(){return Object.entries(ir({},Se,zt(),{sessionUUID:oe.sessionUUID,userId:oe.userId})).reduce(((e,t)=>{return null!=(n=t[1])&&""!==n?ir({},e,{[t[0]]:t[1]}):e;var n}),{})}async function or(){return new Promise((e=>{Mt(vt(je.eventsQueue)),Qt(bt(je.metricsQueue),!0),Pn(je.tracesQueue,!0),Ne({eventsQueue:[],metricsQueue:[],tracesQueue:[]}),e()}))}function sr(){return{"X-CB-Device-ID":H.deviceId||"unknown","X-CB-Is-Logged-In":H.userId?"true":"false","X-CB-Pagekey":re.pageKey||"unknown","X-CB-UJS":(e=Se.ujs,void 0===e||0===e.length?"":e.join(",")),"X-CB-Platform":A.platform||"unknown","X-CB-Project-Name":A.projectName||"unknown","X-CB-Session-UUID":oe.sessionUUID||"unknown","X-CB-Version-Name":A.version?String(A.version):"unknown"};var e}})(),r})()}));',Ou=()=>new Promise((e,t)=>{if(window.ClientAnalytics)return e();try{const n=document.createElement("script");n.textContent=Iu,n.type="text/javascript",document.head.appendChild(n),Pu(),document.head.removeChild(n),e()}catch{console.error("Failed to execute inlined telemetry script"),t()}}),Pu=()=>{var e,t,n;if(typeof window<"u"){const r=(n=(e=_.config.get().deviceId)!==null&&e!==void 0?e:(t=window.crypto)===null||t===void 0?void 0:t.randomUUID())!==null&&n!==void 0?n:"";if(window.ClientAnalytics){const{init:i,identify:a,PlatformName:s}=window.ClientAnalytics;i({isProd:!0,amplitudeApiKey:"c66737ad47ec354ced777935b0af822e",platform:s.web,projectName:"base_account_sdk",showDebugLogging:!1,version:"1.0.0",apiEndpoint:"https://cca-lite.coinbase.com"}),a({deviceId:r}),_.config.set({deviceId:r})}}},Q={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},Or={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}},ja="Unspecified error message.",Cu="Unspecified server error.";function $r(e,t=ja){if(e&&Number.isInteger(e)){const n=e.toString();if(Pr(Or,n))return Or[n].message;if(Na(e))return Cu}return t}function Tu(e){if(!Number.isInteger(e))return!1;const t=e.toString();return!!(Or[t]||Na(e))}function Bu(e,{shouldIncludeStack:t=!1}={}){const n={};if(e&&typeof e=="object"&&!Array.isArray(e)&&Pr(e,"code")&&Tu(e.code)){const r=e;n.code=r.code,r.message&&typeof r.message=="string"?(n.message=r.message,Pr(r,"data")&&(n.data=r.data)):(n.message=$r(n.code),n.data={originalError:ki(e)})}else n.code=Q.rpc.internal,n.message=Ai(e,"message")?e.message:ja,n.data={originalError:ki(e)};return t&&(n.stack=Ai(e,"stack")?e.stack:void 0),n}function Na(e){return e>=-32099&&e<=-32e3}function ki(e){return e&&typeof e=="object"&&!Array.isArray(e)?Object.assign({},e):e}function Pr(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ai(e,t){return typeof e=="object"&&e!==null&&t in e&&typeof e[t]=="string"}const S={rpc:{parse:e=>be(Q.rpc.parse,e),invalidRequest:e=>be(Q.rpc.invalidRequest,e),invalidParams:e=>be(Q.rpc.invalidParams,e),methodNotFound:e=>be(Q.rpc.methodNotFound,e),internal:e=>be(Q.rpc.internal,e),server:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return be(t,e)},invalidInput:e=>be(Q.rpc.invalidInput,e),resourceNotFound:e=>be(Q.rpc.resourceNotFound,e),resourceUnavailable:e=>be(Q.rpc.resourceUnavailable,e),transactionRejected:e=>be(Q.rpc.transactionRejected,e),methodNotSupported:e=>be(Q.rpc.methodNotSupported,e),limitExceeded:e=>be(Q.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>pt(Q.provider.userRejectedRequest,e),unauthorized:e=>pt(Q.provider.unauthorized,e),unsupportedMethod:e=>pt(Q.provider.unsupportedMethod,e),disconnected:e=>pt(Q.provider.disconnected,e),chainDisconnected:e=>pt(Q.provider.chainDisconnected,e),unsupportedChain:e=>pt(Q.provider.unsupportedChain,e),custom:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:n,data:r}=e;if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string');return new Ra(t,n,r)}}};function be(e,t){const[n,r]=Da(t);return new qr(e,n||$r(e),r)}function pt(e,t){const[n,r]=Da(t);return new Ra(e,n||$r(e),r)}function Da(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t||void 0,n]}}return[]}class qr extends Error{constructor(t,n,r){if(!Number.isInteger(t))throw new Error('"code" must be an integer.');if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string.');super(n),this.code=t,r!==void 0&&(this.data=r)}}class Ra extends qr{constructor(t,n,r){if(!Lu(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,n,r)}}function Lu(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}function _i(e){return typeof e=="object"&&e!==null&&"code"in e&&"data"in e&&e.code===-32090&&typeof e.data=="object"&&e.data!==null&&"type"in e.data&&e.data.type==="INSUFFICIENT_FUNDS"}function Ua(e){return typeof e=="object"&&e!==null&&"details"in e}function Mu(e){try{const t=JSON.parse(e.details);return new qr(t.code,t.message,t.data)}catch{return null}}function Ha(){return e=>e}const qt=Ha(),ju=Ha();function je(e){return Math.floor(e)}const Ga=/^[0-9]*$/,Fa=/^[a-f0-9]*$/;function nt(e){return Wr(crypto.getRandomValues(new Uint8Array(e)))}function Wr(e){return[...e].map(t=>t.toString(16).padStart(2,"0")).join("")}function pn(e){return new Uint8Array(e.match(/.{1,2}/g).map(t=>Number.parseInt(t,16)))}function Ut(e,t=!1){const n=e.toString("hex");return qt(t?`0x${n}`:n)}function Gn(e){return Ut(Tr(e),!0)}function ke(e){return ju(e.toString(10))}function wt(e){return qt(`0x${BigInt(e).toString(16)}`)}function za(e){return e.startsWith("0x")||e.startsWith("0X")}function Vr(e){return za(e)?e.slice(2):e}function $a(e){return za(e)?`0x${e.slice(2)}`:`0x${e}`}function Bn(e){if(typeof e!="string")return!1;const t=Vr(e).toLowerCase();return Fa.test(t)}function Cr(e,t=!1){if(typeof e=="string"){const n=Vr(e).toLowerCase();if(Fa.test(n))return qt(t?`0x${n}`:n)}throw S.rpc.invalidParams(`"${String(e)}" is not a hexadecimal string`)}function Kr(e,t=!1){let n=Cr(e,!1);return n.length%2===1&&(n=qt(`0${n}`)),t?qt(`0x${n}`):n}function Ge(e){if(typeof e=="string"){const t=Vr(e).toLowerCase();if(Bn(t)&&t.length===40)return $a(t)}throw S.rpc.invalidParams(`Invalid Ethereum address: ${String(e)}`)}function Tr(e){if(Buffer.isBuffer(e))return e;if(typeof e=="string"){if(Bn(e)){const t=Kr(e,!1);return Buffer.from(t,"hex")}return Buffer.from(e,"utf8")}throw S.rpc.invalidParams(`Not binary data: ${String(e)}`)}function Ht(e){if(typeof e=="number"&&Number.isInteger(e))return je(e);if(typeof e=="string"){if(Ga.test(e))return je(Number(e));if(Bn(e))return je(Number(BigInt(Kr(e,!0))))}throw S.rpc.invalidParams(`Not an integer: ${String(e)}`)}function jt(e){if(e!==null&&(typeof e=="bigint"||Du(e)))return BigInt(e.toString(10));if(typeof e=="number")return BigInt(Ht(e));if(typeof e=="string"){if(Ga.test(e))return BigInt(e);if(Bn(e))return BigInt(Kr(e,!0))}throw S.rpc.invalidParams(`Not an integer: ${String(e)}`)}function Nu(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw S.rpc.invalidParams(`Not a JSON string or an object: ${String(e)}`)}function Du(e){if(e==null||typeof e.constructor!="function")return!1;const{constructor:t}=e;return typeof t.config=="function"&&typeof t.EUCLID=="number"}const Ru=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app.
|
|
5
5
|
|
|
6
6
|
Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,Uu=()=>{let e;return{getCrossOriginOpenerPolicy:()=>e===void 0?"undefined":e,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){e="non-browser-env";return}try{const t=`${window.location.origin}${window.location.pathname}`,n=await fetch(t,{method:"HEAD"});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const r=n.headers.get("Cross-Origin-Opener-Policy");e=r??"null",e==="same-origin"&&console.error(Ru)}catch(t){console.error("Error checking Cross-Origin-Opener-Policy:",t.message),e="error"}}}},{checkCrossOriginOpenerPolicy:Hu,getCrossOriginOpenerPolicy:Gu}=Uu();async function Gt(e,t){const n=Object.assign(Object.assign({},e),{jsonrpc:"2.0",id:crypto.randomUUID()}),r=await window.fetch(t,{method:"POST",body:JSON.stringify(n),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":Mt,"X-Cbw-Sdk-Platform":La}}),{result:i,error:a}=await r.json();if(a)throw a;return i}function Fu(){return globalThis.coinbaseWalletExtension}function zu(){var e,t;try{const n=globalThis;return(e=n.ethereum)!==null&&e!==void 0?e:(t=n.top)===null||t===void 0?void 0:t.ethereum}catch{return}}function $u({metadata:e,preference:t}){var n,r;const{appName:i,appLogoUrl:a,appChainIds:s}=e;if(t.options!=="smartWalletOnly"){const c=Fu();if(c)return(n=c.setAppInfo)===null||n===void 0||n.call(c,i,a,s,t),c}const o=zu();if(o!=null&&o.isCoinbaseBrowser)return(r=o.setAppInfo)===null||r===void 0||r.call(o,i,a,s,t),o}function qu(e){if(!e||typeof e!="object"||Array.isArray(e))throw S.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:e});const{method:t,params:n}=e;if(typeof t!="string"||t.length===0)throw S.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:e});if(n!==void 0&&!Array.isArray(n)&&(typeof n!="object"||n===null))throw S.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:e});switch(t){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw S.provider.unsupportedMethod()}}function Wu(e){if(e){if(!["all","smartWalletOnly","eoaOnly"].includes(e.options))throw new Error(`Invalid options: ${e.options}`);if(e.attribution&&e.attribution.auto!==void 0&&e.attribution.dataSuffix!==void 0)throw new Error("Attribution cannot contain both auto and dataSuffix properties");if(e.telemetry&&typeof e.telemetry!="boolean")throw new Error("Telemetry must be a boolean")}}function Ii(e){if(typeof e!="function")throw new Error("toAccount is not a function")}const Vu="https://keys.coinbase.com/connect",qa="https://rpc.wallet.coinbase.com",Oi="https://www.walletlink.org",Ku="https://go.cb-w.com/walletlink";var U;(function(e){e.unknown="unknown",e.banner="banner",e.button="button",e.card="card",e.chart="chart",e.content_script="content_script",e.dropdown="dropdown",e.link="link",e.page="page",e.modal="modal",e.table="table",e.search_bar="search_bar",e.service_worker="service_worker",e.text="text",e.text_input="text_input",e.tray="tray",e.checkbox="checkbox",e.icon="icon"})(U||(U={}));var H;(function(e){e.unknown="unknown",e.blur="blur",e.click="click",e.change="change",e.dismiss="dismiss",e.focus="focus",e.hover="hover",e.select="select",e.measurement="measurement",e.move="move",e.process="process",e.render="render",e.scroll="scroll",e.view="view",e.search="search",e.keyPress="keyPress",e.error="error"})(H||(H={}));var G;(function(e){e.low="low",e.high="high"})(G||(G={}));function F(e,t,n){var r,i,a,s;window.ClientAnalytics&&((r=window.ClientAnalytics)===null||r===void 0||r.logEvent(e,Object.assign(Object.assign({},t),{sdkVersion:Mt,appName:(a=(i=_.config.get().metadata)===null||i===void 0?void 0:i.appName)!==null&&a!==void 0?a:"",appOrigin:window.location.origin,appPreferredSigner:(s=_.config.get().preference)===null||s===void 0?void 0:s.options}),n))}const Zu=()=>{F("communicator.popup_setup.started",{action:H.unknown,componentType:U.unknown},G.high)},Yu=()=>{F("communicator.popup_setup.completed",{action:H.unknown,componentType:U.unknown},G.high)},Ju=()=>{F("communicator.popup_unload.received",{action:H.unknown,componentType:U.unknown},G.high)},Zr=({snackbarContext:e})=>{F(`snackbar.${e}.shown`,{action:H.render,componentType:U.modal,snackbarContext:e},G.high)},St=({snackbarContext:e,snackbarAction:t})=>{F(`snackbar.${e}.action_clicked`,{action:H.click,componentType:U.button,snackbarContext:e,snackbarAction:t},G.high)},Qu='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';function Wa(){const e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode(Qu)),document.documentElement.appendChild(e)}function Va(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Va(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Ft(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=Va(e))&&(r&&(r+=" "),r+=t);return r}function Xu(){try{return window.frameElement!==null}catch{return!1}}function ed(){try{return Xu()&&window.top?window.top.location:window.location}catch{return window.location}}function td(){var e;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((e=window==null?void 0:window.navigator)===null||e===void 0?void 0:e.userAgent)}function Ka(){var e,t;return(t=(e=window==null?void 0:window.matchMedia)===null||e===void 0?void 0:e.call(window,"(prefers-color-scheme: dark)").matches)!==null&&t!==void 0?t:!1}const nd=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",rd="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",id="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class Za{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=Ka()}attach(t){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",t.appendChild(this.root),this.render()}presentItem(t){const n=this.nextItemKey++;return this.items.set(n,t),this.render(),()=>{this.items.delete(n),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&tr(q("div",null,q(Ya,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([t,n])=>q(ad,Object.assign({},n,{key:t}))))),this.root)}}const Ya=e=>q("div",{class:Ft("-cbwsdk-snackbar-container")},q("style",null,nd),q("div",{class:"-cbwsdk-snackbar"},e.children)),ad=({autoExpand:e,message:t,menuItems:n})=>{const[r,i]=hi(!0),[a,s]=hi(e??!1);Jo(()=>{const c=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{s(!0)},1e4)];return()=>{c.forEach(window.clearTimeout)}});const o=()=>{s(!a)};return q("div",{class:Ft("-cbwsdk-snackbar-instance",r&&"-cbwsdk-snackbar-instance-hidden",a&&"-cbwsdk-snackbar-instance-expanded")},q("div",{class:"-cbwsdk-snackbar-instance-header",onClick:o},q("img",{src:rd,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",q("div",{class:"-cbwsdk-snackbar-instance-header-message"},t),q("div",{class:"-gear-container"},!a&&q("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},q("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),q("img",{src:id,class:"-gear-icon",title:"Expand"}))),n&&n.length>0&&q("div",{class:"-cbwsdk-snackbar-instance-menu"},n.map((c,u)=>q("div",{class:Ft("-cbwsdk-snackbar-instance-menu-item",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:c.onClick,key:u},q("svg",{width:c.svgWidth,height:c.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},q("path",{"fill-rule":c.defaultFillRule,"clip-rule":c.defaultClipRule,d:c.path,fill:"#AAAAAA"})),q("span",{class:Ft("-cbwsdk-snackbar-instance-menu-item-info",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},c.info)))))},Ja="M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z";class sd{constructor(){this.attached=!1,this.snackbar=new Za}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const t=document.documentElement,n=document.createElement("div");n.className="-cbwsdk-css-reset",t.appendChild(n),this.snackbar.attach(n),this.attached=!0,Wa()}showConnecting(t){let n;return t.isUnlinkedErrorState?n={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:t.onResetConnection}]}:n={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:t.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:Ja,defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:t.onResetConnection}]},this.snackbar.presentItem(n)}}const Pi=420,Ci=700,od={isRed:!1,info:"Retry",svgWidth:"10",svgHeight:"11",path:Ja,defaultFillRule:"evenodd",defaultClipRule:"evenodd"},cd="Popup was blocked. Try again.";let Yt=null;function ud(e){const t=(window.innerWidth-Pi)/2+window.screenX,n=(window.innerHeight-Ci)/2+window.screenY;ld(e);function r(){const a=`wallet_${crypto.randomUUID()}`,s=window.open(e,a,`width=${Pi}, height=${Ci}, left=${t}, top=${n}`);return s==null||s.focus(),s||null}let i=r();if(!i){const a=Yr();return new Promise((s,o)=>{Zr({snackbarContext:"popup_blocked"}),a.presentItem({autoExpand:!0,message:cd,menuItems:[Object.assign(Object.assign({},od),{onClick:()=>{St({snackbarContext:"popup_blocked",snackbarAction:"confirm"}),i=r(),i?s(i):o(S.rpc.internal("Popup window was blocked")),a.clear()}})]})})}return Promise.resolve(i)}function dd(e){e&&!e.closed&&e.close()}function ld(e){const t={sdkName:La,sdkVersion:Mt,origin:window.location.origin,coop:Gu()};for(const[n,r]of Object.entries(t))e.searchParams.has(n)||e.searchParams.append(n,r.toString())}function Yr(){if(!Yt){const e=document.createElement("div");e.className="-cbwsdk-css-reset",document.body.appendChild(e),Yt=new Za,Yt.attach(e)}return Yt}class fd{constructor({url:t=Vu,metadata:n,preference:r}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const a=this.onMessage(({requestId:s})=>s===i.id);return this.postMessage(i),await a},this.onMessage=async i=>new Promise((a,s)=>{const o=c=>{if(c.origin!==this.url.origin)return;const u=c.data;i(u)&&(a(u),window.removeEventListener("message",o),this.listeners.delete(o))};window.addEventListener("message",o),this.listeners.set(o,{reject:s})}),this.disconnect=()=>{dd(this.popup),this.popup=null,this.listeners.forEach(({reject:i},a)=>{i(S.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",a)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(Zu(),this.popup=await ud(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(()=>{this.disconnect(),Ju()}).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:Mt,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw S.rpc.internal();return Yu(),this.popup})),this.url=new URL(t),this.metadata=n,this.preference=r}}function se(e){return e.errorMessage!==void 0}function pd(e){const t=Bu(hd(e),{shouldIncludeStack:!0}),n=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return n.searchParams.set("version",Mt),n.searchParams.set("code",t.code.toString()),n.searchParams.set("message",t.message),Object.assign(Object.assign({},t),{docUrl:n.href})}function hd(e){var t;if(typeof e=="string")return{message:e,code:Q.rpc.internal};if(se(e)){const n=e.errorMessage,r=(t=e.errorCode)!==null&&t!==void 0?t:n.match(/(denied|rejected)/i)?Q.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},e),{message:n,code:r,data:{method:e.method}})}return e}class md extends Sc{}class dt{constructor(t,n){this.scope=t,this.module=n}storeObject(t,n){this.setItem(t,JSON.stringify(n))}loadObject(t){const n=this.getItem(t);return n?JSON.parse(n):void 0}setItem(t,n){localStorage.setItem(this.scopedKey(t),n)}getItem(t){return localStorage.getItem(this.scopedKey(t))}removeItem(t){localStorage.removeItem(this.scopedKey(t))}clear(){const t=this.scopedKey(""),n=[];for(let r=0;r<localStorage.length;r++){const i=localStorage.key(r);typeof i=="string"&&i.startsWith(t)&&n.push(i)}n.forEach(r=>localStorage.removeItem(r))}scopedKey(t){return`-${this.scope}${this.module?`:${this.module}`:""}:${t}`}static clearAll(){new dt("CBWSDK").clear(),new dt("walletlink").clear()}}const yd=({signerType:e})=>{F("provider.signer.loaded_from_storage",{action:H.measurement,componentType:U.unknown,signerType:e},G.low)},gd=({method:e,correlationId:t})=>{F("provider.request.started",{action:H.unknown,componentType:U.unknown,method:e,correlationId:t},G.high)},bd=({method:e,correlationId:t,signerType:n,errorMessage:r})=>{F("provider.request.error",{action:H.error,componentType:U.unknown,method:e,signerType:n,correlationId:t,errorMessage:r},G.high)},wd=({method:e,signerType:t,correlationId:n})=>{F("provider.request.responded",{action:H.unknown,componentType:U.unknown,method:e,signerType:t,correlationId:n},G.high)},vd=()=>{F("provider.enable_function.called",{action:H.measurement,componentType:U.unknown},G.high)},xd=()=>{F("signer.selection.requested",{action:H.unknown,componentType:U.unknown},G.high)},Ed=e=>{F("signer.selection.responded",{action:H.unknown,componentType:U.unknown,signerType:e},G.high)},Jt=Fr(()=>({correlationIds:new Map})),Ee={get:e=>Jt.getState().correlationIds.get(e),set:(e,t)=>{Jt.setState(n=>{const r=new Map(n.correlationIds);return r.set(e,t),{correlationIds:r}})},delete:e=>{Jt.setState(t=>{const n=new Map(t.correlationIds);return n.delete(e),{correlationIds:n}})},clear:()=>{Jt.setState({correlationIds:new Map})}},Sd=({method:e,correlationId:t})=>{var n;F("scw_signer.handshake.started",{action:H.unknown,componentType:U.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=_.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},G.high)},kd=({method:e,correlationId:t,errorMessage:n})=>{var r;F("scw_signer.handshake.error",{action:H.error,componentType:U.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=_.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},G.high)},Ad=({method:e,correlationId:t})=>{var n;F("scw_signer.handshake.completed",{action:H.unknown,componentType:U.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=_.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},G.high)},_d=({method:e,correlationId:t})=>{var n;F("scw_signer.request.started",{action:H.unknown,componentType:U.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=_.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},G.high)},Id=({method:e,correlationId:t,errorMessage:n})=>{var r;F("scw_signer.request.error",{action:H.error,componentType:U.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=_.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},G.high)},Od=({method:e,correlationId:t})=>{var n;F("scw_signer.request.completed",{action:H.unknown,componentType:U.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=_.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},G.high)},Pd=({method:e,correlationId:t})=>{var n;F("scw_sub_account.request.started",{action:H.unknown,componentType:U.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=_.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},G.high)},Cd=({method:e,correlationId:t})=>{var n;F("scw_sub_account.request.completed",{action:H.unknown,componentType:U.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=_.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},G.high)},Td=({method:e,correlationId:t,errorMessage:n})=>{var r;F("scw_sub_account.request.error",{action:H.error,componentType:U.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=_.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},G.high)},Bd=({method:e,correlationId:t})=>{var n;F("scw_sub_account.add_owner.started",{action:H.unknown,componentType:U.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=_.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},G.high)},Ld=({method:e,correlationId:t})=>{var n;F("scw_sub_account.add_owner.completed",{action:H.unknown,componentType:U.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=_.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},G.high)},Md=({method:e,correlationId:t,errorMessage:n})=>{var r;F("scw_sub_account.add_owner.error",{action:H.error,componentType:U.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=_.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},G.high)},jd=({method:e,correlationId:t})=>{var n;F("scw_sub_account.insufficient_balance.error_handling.started",{action:H.unknown,componentType:U.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=_.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},G.high)},Nd=({method:e,correlationId:t})=>{var n;F("scw_sub_account.insufficient_balance.error_handling.completed",{action:H.unknown,componentType:U.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=_.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},G.high)},Dd=({method:e,correlationId:t,errorMessage:n})=>{var r;F("scw_sub_account.insufficient_balance.error_handling.error",{action:H.error,componentType:U.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=_.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},G.high)},rt=e=>"message"in e&&typeof e.message=="string"?e.message:"",Qa=Fr(()=>({}));function Ti(e){e.forEach(t=>{var n,r,i,a,s,o,c,u;if(!t.rpcUrl)return;const p=kc({id:t.id,rpcUrls:{default:{http:[t.rpcUrl]}},name:(r=(n=t.nativeCurrency)===null||n===void 0?void 0:n.name)!==null&&r!==void 0?r:"",nativeCurrency:{name:(a=(i=t.nativeCurrency)===null||i===void 0?void 0:i.name)!==null&&a!==void 0?a:"",symbol:(o=(s=t.nativeCurrency)===null||s===void 0?void 0:s.symbol)!==null&&o!==void 0?o:"",decimals:(u=(c=t.nativeCurrency)===null||c===void 0?void 0:c.decimal)!==null&&u!==void 0?u:18}}),d=Nc({chain:p,transport:yi(t.rpcUrl)}),l=fu({client:d,transport:yi(t.rpcUrl)});Qa.setState({[t.id]:{client:d,bundlerClient:l}})})}function Xa(e){var t;return(t=Qa.getState()[e])===null||t===void 0?void 0:t.client}function ye(e,t,n){if(e==null)throw t??S.rpc.invalidParams({message:"value must be present",data:e})}function Ye(e,t){if(!Array.isArray(e))throw S.rpc.invalidParams({message:t??"value must be an array",data:e})}function Qt(e){if(typeof e!="object"||e===null)throw S.rpc.internal("sub account info is not an object");if(!("address"in e))throw S.rpc.internal("sub account is invalid");if("address"in e&&typeof e.address=="string"&&!$t(e.address))throw S.rpc.internal("sub account address is invalid");if("factory"in e&&typeof e.factory=="string"&&!$t(e.factory))throw S.rpc.internal("sub account factory address is invalid");if("factoryData"in e&&typeof e.factoryData=="string"&&!bt(e.factoryData))throw S.rpc.internal("sub account factory data is invalid")}async function Rd(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function Ud(e,t){return crypto.subtle.deriveKey({name:"ECDH",public:t},e,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function Hd(e,t){const n=crypto.getRandomValues(new Uint8Array(12)),r=await crypto.subtle.encrypt({name:"AES-GCM",iv:n},e,new TextEncoder().encode(t));return{iv:n,cipherText:r}}async function Gd(e,{iv:t,cipherText:n}){const r=await crypto.subtle.decrypt({name:"AES-GCM",iv:t},e,n);return new TextDecoder().decode(r)}function es(e){switch(e){case"public":return"spki";case"private":return"pkcs8"}}async function ts(e,t){const n=es(e),r=await crypto.subtle.exportKey(n,t);return Wr(new Uint8Array(r))}async function ns(e,t){const n=es(e),r=pn(t).buffer;return await crypto.subtle.importKey(n,new Uint8Array(r),{name:"ECDH",namedCurve:"P-256"},!0,e==="private"?["deriveKey"]:[])}async function Fd(e,t){const n=JSON.stringify(e,(r,i)=>{if(!(i instanceof Error))return i;const a=i;return Object.assign(Object.assign({},a.code?{code:a.code}:{}),{message:a.message})});return Hd(t,n)}async function zd(e,t){return JSON.parse(await Gd(t,e))}const $d="0.1.1";function qd(){return $d}class Z extends Error{constructor(t,n={}){const r=(()=>{var c;if(n.cause instanceof Z){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),i=n.cause instanceof Z&&n.cause.docsPath||n.docsPath,s=`https://oxlib.sh${i??""}`,o=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||i?["",r?`Details: ${r}`:void 0,i?`See: ${s}`:void 0]:[]].filter(c=>typeof c=="string").join(`
|
|
7
7
|
`);super(o,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${qd()}`}),this.cause=n.cause,this.details=r,this.docs=s,this.docsPath=i,this.shortMessage=t}walk(t){return rs(this,t)}}function rs(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?rs(e.cause,t):t?null:e}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Wd(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Jr(e,...t){if(!Wd(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Bi(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Vd(e,t){Jr(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Br(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Fn(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ae(e,t){return e<<32-t|e>>>t}function Kd(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function is(e){return typeof e=="string"&&(e=Kd(e)),Jr(e),e}let Zd=class{};function Yd(e){const t=r=>e().update(is(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Jd(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const i=BigInt(32),a=BigInt(4294967295),s=Number(n>>i&a),o=Number(n&a),c=r?4:0,u=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+u,o,r)}function Qd(e,t,n){return e&t^~e&n}function Xd(e,t,n){return e&t^e&n^t&n}let el=class extends Zd{constructor(t,n,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=Fn(this.buffer)}update(t){Bi(this),t=is(t),Jr(t);const{view:n,buffer:r,blockLen:i}=this,a=t.length;for(let s=0;s<a;){const o=Math.min(i-this.pos,a-s);if(o===i){const c=Fn(t);for(;i<=a-s;s+=i)this.process(c,s);continue}r.set(t.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Bi(this),Vd(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:a}=this;let{pos:s}=this;n[s++]=128,Br(this.buffer.subarray(s)),this.padOffset>i-s&&(this.process(r,0),s=0);for(let d=s;d<i;d++)n[d]=0;Jd(r,i-8,BigInt(this.length*8),a),this.process(r,0);const o=Fn(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,p=this.get();if(u>p.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)o.setUint32(4*d,p[d],a)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:i,finished:a,destroyed:s,pos:o}=this;return t.destroyed=s,t.finished=a,t.length=i,t.pos=o,i%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}};const Fe=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),tl=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]),ze=new Uint32Array(64);let nl=class extends el{constructor(t=32){super(64,t,8,!1),this.A=Fe[0]|0,this.B=Fe[1]|0,this.C=Fe[2]|0,this.D=Fe[3]|0,this.E=Fe[4]|0,this.F=Fe[5]|0,this.G=Fe[6]|0,this.H=Fe[7]|0}get(){const{A:t,B:n,C:r,D:i,E:a,F:s,G:o,H:c}=this;return[t,n,r,i,a,s,o,c]}set(t,n,r,i,a,s,o,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=a|0,this.F=s|0,this.G=o|0,this.H=c|0}process(t,n){for(let d=0;d<16;d++,n+=4)ze[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const l=ze[d-15],f=ze[d-2],h=Ae(l,7)^Ae(l,18)^l>>>3,m=Ae(f,17)^Ae(f,19)^f>>>10;ze[d]=m+ze[d-7]+h+ze[d-16]|0}let{A:r,B:i,C:a,D:s,E:o,F:c,G:u,H:p}=this;for(let d=0;d<64;d++){const l=Ae(o,6)^Ae(o,11)^Ae(o,25),f=p+l+Qd(o,c,u)+tl[d]+ze[d]|0,m=(Ae(r,2)^Ae(r,13)^Ae(r,22))+Xd(r,i,a)|0;p=u,u=c,c=o,o=s+f|0,s=a,a=i,i=r,r=f+m|0}r=r+this.A|0,i=i+this.B|0,a=a+this.C|0,s=s+this.D|0,o=o+this.E|0,c=c+this.F|0,u=u+this.G|0,p=p+this.H|0,this.set(r,i,a,s,o,c,u,p)}roundClean(){Br(ze)}destroy(){this.set(0,0,0,0,0,0,0,0),Br(this.buffer)}};const rl=Yd(()=>new nl),il=rl,ht=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ln(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Lr(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function lt(e,...t){if(!Ln(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function as(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Lr(e.outputLen),Lr(e.blockLen)}function kn(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function al(e,t){lt(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Pt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function zn(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function _e(e,t){return e<<32-t|e>>>t}const ss=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",sl=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function kt(e){if(lt(e),ss)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=sl[e[n]];return t}const Ce={_0:48,_9:57,A:65,F:70,a:97,f:102};function Li(e){if(e>=Ce._0&&e<=Ce._9)return e-Ce._0;if(e>=Ce.A&&e<=Ce.F)return e-(Ce.A-10);if(e>=Ce.a&&e<=Ce.f)return e-(Ce.a-10)}function An(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(ss)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let i=0,a=0;i<n;i++,a+=2){const s=Li(e.charCodeAt(a)),o=Li(e.charCodeAt(a+1));if(s===void 0||o===void 0){const c=e[a]+e[a+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+a)}r[i]=s*16+o}return r}function ol(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Qr(e){return typeof e=="string"&&(e=ol(e)),lt(e),e}function Je(...e){let t=0;for(let r=0;r<e.length;r++){const i=e[r];lt(i),t+=i.length}const n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){const a=e[r];n.set(a,i),i+=a.length}return n}let os=class{};function Xr(e){const t=r=>e().update(Qr(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function cs(e=32){if(ht&&typeof ht.getRandomValues=="function")return ht.getRandomValues(new Uint8Array(e));if(ht&&typeof ht.randomBytes=="function")return Uint8Array.from(ht.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ei=BigInt(0),Mr=BigInt(1);function _n(e,t=""){if(typeof e!="boolean"){const n=t&&`"${t}"`;throw new Error(n+"expected boolean, got type="+typeof e)}return e}function st(e,t,n=""){const r=Ln(e),i=e==null?void 0:e.length,a=t!==void 0;if(!r||a&&i!==t){const s=n&&`"${n}" `,o=a?` of length ${t}`:"",c=r?`length=${i}`:`type=${typeof e}`;throw new Error(s+"expected Uint8Array"+o+", got "+c)}return e}function Xt(e){const t=e.toString(16);return t.length&1?"0"+t:t}function us(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?ei:BigInt("0x"+e)}function Mn(e){return us(kt(e))}function ds(e){return lt(e),us(kt(Uint8Array.from(e).reverse()))}function ti(e,t){return An(e.toString(16).padStart(t*2,"0"))}function ls(e,t){return ti(e,t).reverse()}function pe(e,t,n){let r;if(typeof t=="string")try{r=An(t)}catch(i){throw new Error(e+" must be hex string or Uint8Array, cause: "+i)}else if(Ln(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");return r.length,r}const $n=e=>typeof e=="bigint"&&ei<=e;function cl(e,t,n){return $n(e)&&$n(t)&&$n(n)&&t<=e&&e<n}function ul(e,t,n,r){if(!cl(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function fs(e){let t;for(t=0;e>ei;e>>=Mr,t+=1);return t}const Vt=e=>(Mr<<BigInt(e))-Mr;function dl(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");const r=f=>new Uint8Array(f),i=f=>Uint8Array.of(f);let a=r(e),s=r(e),o=0;const c=()=>{a.fill(1),s.fill(0),o=0},u=(...f)=>n(s,a,...f),p=(f=r(0))=>{s=u(i(0),f),a=u(),f.length!==0&&(s=u(i(1),f),a=u())},d=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const h=[];for(;f<t;){a=u();const m=a.slice();h.push(m),f+=a.length}return Je(...h)};return(f,h)=>{c(),p(f);let m;for(;!(m=h(d()));)p();return c(),m}}function ni(e,t,n={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function r(i,a,s){const o=e[i];if(s&&o===void 0)return;const c=typeof o;if(c!==a||o===null)throw new Error(`param "${i}" is invalid: expected ${a}, got ${c}`)}Object.entries(t).forEach(([i,a])=>r(i,a,!1)),Object.entries(n).forEach(([i,a])=>r(i,a,!0))}function Mi(e){const t=new WeakMap;return(n,...r)=>{const i=t.get(n);if(i!==void 0)return i;const a=e(n,...r);return t.set(n,a),a}}const ll="#__bigint";function jn(e,t,n){return JSON.stringify(e,(r,i)=>typeof i=="bigint"?i.toString()+ll:i,n)}function fl(e,t){if(Tt(e)>t)throw new Ol({givenSize:Tt(e),maxSize:t})}function pl(e,t){if(typeof t=="number"&&t>0&&t>Tt(e)-1)throw new xs({offset:t,position:"start",size:Tt(e)})}function hl(e,t,n){if(typeof t=="number"&&typeof n=="number"&&Tt(e)!==n-t)throw new xs({offset:n,position:"end",size:Tt(e)})}const Te={zero:48,nine:57,A:65,F:70,a:97,f:102};function ji(e){if(e>=Te.zero&&e<=Te.nine)return e-Te.zero;if(e>=Te.A&&e<=Te.F)return e-(Te.A-10);if(e>=Te.a&&e<=Te.f)return e-(Te.a-10)}function ri(e,t){if(et(e)>t)throw new kl({givenSize:et(e),maxSize:t})}function ml(e,t){if(typeof t=="number"&&t>0&&t>et(e)-1)throw new gs({offset:t,position:"start",size:et(e)})}function yl(e,t,n){if(typeof t=="number"&&typeof n=="number"&&et(e)!==n-t)throw new gs({offset:n,position:"end",size:et(e)})}function ps(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const i=e.replace("0x","");if(i.length>r*2)throw new Al({size:Math.ceil(i.length/2),targetSize:r,type:"Hex"});return`0x${i[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const gl=new TextEncoder,bl=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function wl(e,t={}){const{strict:n=!1}=t;if(!e)throw new Ni(e);if(typeof e!="string")throw new Ni(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new Di(e);if(!e.startsWith("0x"))throw new Di(e)}function Nn(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function hs(e){return e instanceof Uint8Array?Ct(e):Array.isArray(e)?Ct(new Uint8Array(e)):e}function Ct(e,t={}){let n="";for(let i=0;i<e.length;i++)n+=bl[e[i]];const r=`0x${n}`;return typeof t.size=="number"?(ri(r,t.size),ys(r,t.size)):r}function Xe(e,t={}){const{signed:n,size:r}=t,i=BigInt(e);let a;r?n?a=(1n<<BigInt(r)*8n-1n)-1n:a=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(a=BigInt(Number.MAX_SAFE_INTEGER));const s=typeof a=="bigint"&&n?-a-1n:0;if(a&&i>a||i<s){const u=typeof e=="bigint"?"n":"";throw new Sl({max:a?`${a}${u}`:void 0,min:`${s}${u}`,signed:n,size:r,value:`${e}${u}`})}const c=`0x${(n&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?vl(c,r):c}function ms(e,t={}){return Ct(gl.encode(e),t)}function vl(e,t){return ps(e,{dir:"left",size:t})}function ys(e,t){return ps(e,{dir:"right",size:t})}function we(e,t,n,r={}){const{strict:i}=r;ml(e,t);const a=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return i&&yl(a,t,n),a}function et(e){return Math.ceil((e.length-2)/2)}function xl(e,t={}){const{signed:n}=t;t.size&&ri(e,t.size);const r=BigInt(e);if(!n)return r;const i=(e.length-2)/2,a=(1n<<BigInt(i)*8n)-1n,s=a>>1n;return r<=s?r:r-a-1n}function El(e,t={}){const{strict:n=!1}=t;try{return wl(e,{strict:n}),!0}catch{return!1}}class Sl extends Z{constructor({max:t,min:n,signed:r,size:i,value:a}){super(`Number \`${a}\` is not in safe${i?` ${i*8}-bit`:""}${r?" signed":" unsigned"} integer range ${t?`(\`${n}\` to \`${t}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class Ni extends Z{constructor(t){super(`Value \`${typeof t=="object"?jn(t):t}\` of type \`${typeof t}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}}class Di extends Z{constructor(t){super(`Value \`${t}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}}let kl=class extends Z{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}},gs=class extends Z{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}};class Al extends Z{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}function _l(e){if(!(e instanceof Uint8Array)){if(!e)throw new en(e);if(typeof e!="object")throw new en(e);if(!("BYTES_PER_ELEMENT"in e))throw new en(e);if(e.BYTES_PER_ELEMENT!==1||e.constructor.name!=="Uint8Array")throw new en(e)}}function bs(e){return e instanceof Uint8Array?e:typeof e=="string"?vs(e):ws(e)}function ws(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function vs(e,t={}){const{size:n}=t;let r=e;n&&(ri(e,n),r=ys(e,n));let i=r.slice(2);i.length%2&&(i=`0${i}`);const a=i.length/2,s=new Uint8Array(a);for(let o=0,c=0;o<a;o++){const u=ji(i.charCodeAt(c++)),p=ji(i.charCodeAt(c++));if(u===void 0||p===void 0)throw new Z(`Invalid byte sequence ("${i[c-2]}${i[c-1]}" in "${i}").`);s[o]=u*16+p}return s}function Tt(e){return e.length}function Ri(e,t,n,r={}){const{strict:i}=r;pl(e,t);const a=e.slice(t,n);return i&&hl(a,t,n),a}function Ui(e,t={}){const{size:n}=t;typeof n<"u"&&fl(e,n);const r=Ct(e,t);return xl(r,t)}function Il(e){try{return _l(e),!0}catch{return!1}}class en extends Z{constructor(t){super(`Value \`${typeof t=="object"?jn(t):t}\` of type \`${typeof t}\` is an invalid Bytes value.`,{metaMessages:["Bytes values must be of type `Bytes`."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesTypeError"})}}class Ol extends Z{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}}class xs extends Z{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SliceOffsetOutOfBoundsError"})}}function Es(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=il(bs(e));return n==="Bytes"?r:Ct(r)}function Ss(e,t={}){const{compressed:n}=t,{prefix:r,x:i,y:a}=e;if(n===!1||typeof i=="bigint"&&typeof a=="bigint"){if(r!==4)throw new Hi({prefix:r,cause:new Ll});return}if(n===!0||typeof i=="bigint"&&typeof a>"u"){if(r!==3&&r!==2)throw new Hi({prefix:r,cause:new Bl});return}throw new Tl({publicKey:e})}function Pl(e){const t=(()=>{if(El(e))return ks(e);if(Il(e))return Cl(e);const{prefix:n,x:r,y:i}=e;return typeof r=="bigint"&&typeof i=="bigint"?{prefix:n??4,x:r,y:i}:{prefix:n,x:r}})();return Ss(t),t}function Cl(e){return ks(Ct(e))}function ks(e){if(e.length!==132&&e.length!==130&&e.length!==68)throw new Ml({publicKey:e});if(e.length===130){const r=BigInt(we(e,0,32)),i=BigInt(we(e,32,64));return{prefix:4,x:r,y:i}}if(e.length===132){const r=Number(we(e,0,1)),i=BigInt(we(e,1,33)),a=BigInt(we(e,33,65));return{prefix:r,x:i,y:a}}const t=Number(we(e,0,1)),n=BigInt(we(e,1,33));return{prefix:t,x:n}}function ii(e,t={}){Ss(e);const{prefix:n,x:r,y:i}=e,{includePrefix:a=!0}=t;return Nn(a?Xe(n,{size:1}):"0x",Xe(r,{size:32}),typeof i=="bigint"?Xe(i,{size:32}):"0x")}class Tl extends Z{constructor({publicKey:t}){super(`Value \`${jn(t)}\` is not a valid public key.`,{metaMessages:["Public key must contain:","- an `x` and `prefix` value (compressed)","- an `x`, `y`, and `prefix` value (uncompressed)"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidError"})}}class Hi extends Z{constructor({prefix:t,cause:n}){super(`Prefix "${t}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidPrefixError"})}}class Bl extends Z{constructor(){super("Prefix must be 2 or 3 for compressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidCompressedPrefixError"})}}class Ll extends Z{constructor(){super("Prefix must be 4 for uncompressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidUncompressedPrefixError"})}}let Ml=class extends Z{constructor({publicKey:t}){super(`Value \`${t}\` is an invalid public key size.`,{metaMessages:["Expected: 33 bytes (compressed + prefix), 64 bytes (uncompressed) or 65 bytes (uncompressed + prefix).",`Received ${et(hs(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidSerializedSizeError"})}};const Gi=2n**256n-1n;function jl(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const i=BigInt(32),a=BigInt(4294967295),s=Number(n>>i&a),o=Number(n&a),c=r?4:0,u=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+u,o,r)}function Nl(e,t,n){return e&t^~e&n}function Dl(e,t,n){return e&t^e&n^t&n}let As=class extends os{constructor(t,n,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=zn(this.buffer)}update(t){kn(this),t=Qr(t),lt(t);const{view:n,buffer:r,blockLen:i}=this,a=t.length;for(let s=0;s<a;){const o=Math.min(i-this.pos,a-s);if(o===i){const c=zn(t);for(;i<=a-s;s+=i)this.process(c,s);continue}r.set(t.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){kn(this),al(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:a}=this;let{pos:s}=this;n[s++]=128,Pt(this.buffer.subarray(s)),this.padOffset>i-s&&(this.process(r,0),s=0);for(let d=s;d<i;d++)n[d]=0;jl(r,i-8,BigInt(this.length*8),a),this.process(r,0);const o=zn(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,p=this.get();if(u>p.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)o.setUint32(4*d,p[d],a)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:i,finished:a,destroyed:s,pos:o}=this;return t.destroyed=s,t.finished=a,t.length=i,t.pos=o,i%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}};const $e=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ce=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),ue=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),tn=BigInt(2**32-1),Fi=BigInt(32);function Rl(e,t=!1){return t?{h:Number(e&tn),l:Number(e>>Fi&tn)}:{h:Number(e>>Fi&tn)|0,l:Number(e&tn)|0}}function Ul(e,t=!1){const n=e.length;let r=new Uint32Array(n),i=new Uint32Array(n);for(let a=0;a<n;a++){const{h:s,l:o}=Rl(e[a],t);[r[a],i[a]]=[s,o]}return[r,i]}const zi=(e,t,n)=>e>>>n,$i=(e,t,n)=>e<<32-n|t>>>n,mt=(e,t,n)=>e>>>n|t<<32-n,yt=(e,t,n)=>e<<32-n|t>>>n,nn=(e,t,n)=>e<<64-n|t>>>n-32,rn=(e,t,n)=>e>>>n-32|t<<64-n;function Be(e,t,n,r){const i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:i|0}}const Hl=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),Gl=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,Fl=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),zl=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0,$l=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0),ql=(e,t,n,r,i,a)=>t+n+r+i+a+(e/2**32|0)|0,Wl=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]),qe=new Uint32Array(64);let Vl=class extends As{constructor(t=32){super(64,t,8,!1),this.A=$e[0]|0,this.B=$e[1]|0,this.C=$e[2]|0,this.D=$e[3]|0,this.E=$e[4]|0,this.F=$e[5]|0,this.G=$e[6]|0,this.H=$e[7]|0}get(){const{A:t,B:n,C:r,D:i,E:a,F:s,G:o,H:c}=this;return[t,n,r,i,a,s,o,c]}set(t,n,r,i,a,s,o,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=a|0,this.F=s|0,this.G=o|0,this.H=c|0}process(t,n){for(let d=0;d<16;d++,n+=4)qe[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const l=qe[d-15],f=qe[d-2],h=_e(l,7)^_e(l,18)^l>>>3,m=_e(f,17)^_e(f,19)^f>>>10;qe[d]=m+qe[d-7]+h+qe[d-16]|0}let{A:r,B:i,C:a,D:s,E:o,F:c,G:u,H:p}=this;for(let d=0;d<64;d++){const l=_e(o,6)^_e(o,11)^_e(o,25),f=p+l+Nl(o,c,u)+Wl[d]+qe[d]|0,m=(_e(r,2)^_e(r,13)^_e(r,22))+Dl(r,i,a)|0;p=u,u=c,c=o,o=s+f|0,s=a,a=i,i=r,r=f+m|0}r=r+this.A|0,i=i+this.B|0,a=a+this.C|0,s=s+this.D|0,o=o+this.E|0,c=c+this.F|0,u=u+this.G|0,p=p+this.H|0,this.set(r,i,a,s,o,c,u,p)}roundClean(){Pt(qe)}destroy(){this.set(0,0,0,0,0,0,0,0),Pt(this.buffer)}};const _s=Ul(["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(e=>BigInt(e))),Kl=_s[0],Zl=_s[1],We=new Uint32Array(80),Ve=new Uint32Array(80);class Is extends As{constructor(t=64){super(128,t,16,!1),this.Ah=ue[0]|0,this.Al=ue[1]|0,this.Bh=ue[2]|0,this.Bl=ue[3]|0,this.Ch=ue[4]|0,this.Cl=ue[5]|0,this.Dh=ue[6]|0,this.Dl=ue[7]|0,this.Eh=ue[8]|0,this.El=ue[9]|0,this.Fh=ue[10]|0,this.Fl=ue[11]|0,this.Gh=ue[12]|0,this.Gl=ue[13]|0,this.Hh=ue[14]|0,this.Hl=ue[15]|0}get(){const{Ah:t,Al:n,Bh:r,Bl:i,Ch:a,Cl:s,Dh:o,Dl:c,Eh:u,El:p,Fh:d,Fl:l,Gh:f,Gl:h,Hh:m,Hl:v}=this;return[t,n,r,i,a,s,o,c,u,p,d,l,f,h,m,v]}set(t,n,r,i,a,s,o,c,u,p,d,l,f,h,m,v){this.Ah=t|0,this.Al=n|0,this.Bh=r|0,this.Bl=i|0,this.Ch=a|0,this.Cl=s|0,this.Dh=o|0,this.Dl=c|0,this.Eh=u|0,this.El=p|0,this.Fh=d|0,this.Fl=l|0,this.Gh=f|0,this.Gl=h|0,this.Hh=m|0,this.Hl=v|0}process(t,n){for(let x=0;x<16;x++,n+=4)We[x]=t.getUint32(n),Ve[x]=t.getUint32(n+=4);for(let x=16;x<80;x++){const O=We[x-15]|0,N=Ve[x-15]|0,ee=mt(O,N,1)^mt(O,N,8)^zi(O,N,7),te=yt(O,N,1)^yt(O,N,8)^$i(O,N,7),V=We[x-2]|0,A=Ve[x-2]|0,z=mt(V,A,19)^nn(V,A,61)^zi(V,A,6),ie=yt(V,A,19)^rn(V,A,61)^$i(V,A,6),b=Fl(te,ie,Ve[x-7],Ve[x-16]),y=zl(b,ee,z,We[x-7],We[x-16]);We[x]=y|0,Ve[x]=b|0}let{Ah:r,Al:i,Bh:a,Bl:s,Ch:o,Cl:c,Dh:u,Dl:p,Eh:d,El:l,Fh:f,Fl:h,Gh:m,Gl:v,Hh:k,Hl:P}=this;for(let x=0;x<80;x++){const O=mt(d,l,14)^mt(d,l,18)^nn(d,l,41),N=yt(d,l,14)^yt(d,l,18)^rn(d,l,41),ee=d&f^~d&m,te=l&h^~l&v,V=$l(P,N,te,Zl[x],Ve[x]),A=ql(V,k,O,ee,Kl[x],We[x]),z=V|0,ie=mt(r,i,28)^nn(r,i,34)^nn(r,i,39),b=yt(r,i,28)^rn(r,i,34)^rn(r,i,39),y=r&a^r&o^a&o,w=i&s^i&c^s&c;k=m|0,P=v|0,m=f|0,v=h|0,f=d|0,h=l|0,{h:d,l}=Be(u|0,p|0,A|0,z|0),u=o|0,p=c|0,o=a|0,c=s|0,a=r|0,s=i|0;const g=Hl(z,b,w);r=Gl(g,A,ie,y),i=g|0}({h:r,l:i}=Be(this.Ah|0,this.Al|0,r|0,i|0)),{h:a,l:s}=Be(this.Bh|0,this.Bl|0,a|0,s|0),{h:o,l:c}=Be(this.Ch|0,this.Cl|0,o|0,c|0),{h:u,l:p}=Be(this.Dh|0,this.Dl|0,u|0,p|0),{h:d,l}=Be(this.Eh|0,this.El|0,d|0,l|0),{h:f,l:h}=Be(this.Fh|0,this.Fl|0,f|0,h|0),{h:m,l:v}=Be(this.Gh|0,this.Gl|0,m|0,v|0),{h:k,l:P}=Be(this.Hh|0,this.Hl|0,k|0,P|0),this.set(r,i,a,s,o,c,u,p,d,l,f,h,m,v,k,P)}roundClean(){Pt(We,Ve)}destroy(){Pt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class Yl extends Is{constructor(){super(48),this.Ah=ce[0]|0,this.Al=ce[1]|0,this.Bh=ce[2]|0,this.Bl=ce[3]|0,this.Ch=ce[4]|0,this.Cl=ce[5]|0,this.Dh=ce[6]|0,this.Dl=ce[7]|0,this.Eh=ce[8]|0,this.El=ce[9]|0,this.Fh=ce[10]|0,this.Fl=ce[11]|0,this.Gh=ce[12]|0,this.Gl=ce[13]|0,this.Hh=ce[14]|0,this.Hl=ce[15]|0}}const Jl=Xr(()=>new Vl),Ql=Xr(()=>new Is),Xl=Xr(()=>new Yl);class Os extends os{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,as(t);const r=Qr(n);if(this.iHash=t.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,a=new Uint8Array(i);a.set(r.length>i?t.create().update(r).digest():r);for(let s=0;s<a.length;s++)a[s]^=54;this.iHash.update(a),this.oHash=t.create();for(let s=0;s<a.length;s++)a[s]^=106;this.oHash.update(a),Pt(a)}update(t){return kn(this),this.iHash.update(t),this}digestInto(t){kn(this),lt(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:i,destroyed:a,blockLen:s,outputLen:o}=this;return t=t,t.finished=i,t.destroyed=a,t.blockLen=s,t.outputLen=o,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Ps=(e,t,n)=>new Os(e,t).update(n).digest();Ps.create=(e,t)=>new Os(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ge=BigInt(0),le=BigInt(1),ot=BigInt(2),Cs=BigInt(3),Ts=BigInt(4),Bs=BigInt(5),ef=BigInt(7),Ls=BigInt(8),tf=BigInt(9),Ms=BigInt(16);function xe(e,t){const n=e%t;return n>=ge?n:t+n}function qi(e,t){if(e===ge)throw new Error("invert: expected non-zero number");if(t<=ge)throw new Error("invert: expected positive modulus, got "+t);let n=xe(e,t),r=t,i=ge,a=le;for(;n!==ge;){const o=r/n,c=r%n,u=i-a*o;r=n,n=c,i=a,a=u}if(r!==le)throw new Error("invert: does not exist");return xe(i,t)}function ai(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function js(e,t){const n=(e.ORDER+le)/Ts,r=e.pow(t,n);return ai(e,r,t),r}function nf(e,t){const n=(e.ORDER-Bs)/Ls,r=e.mul(t,ot),i=e.pow(r,n),a=e.mul(t,i),s=e.mul(e.mul(a,ot),i),o=e.mul(a,e.sub(s,e.ONE));return ai(e,o,t),o}function rf(e){const t=ft(e),n=Ns(e),r=n(t,t.neg(t.ONE)),i=n(t,r),a=n(t,t.neg(r)),s=(e+ef)/Ms;return(o,c)=>{let u=o.pow(c,s),p=o.mul(u,r);const d=o.mul(u,i),l=o.mul(u,a),f=o.eql(o.sqr(p),c),h=o.eql(o.sqr(d),c);u=o.cmov(u,p,f),p=o.cmov(l,d,h);const m=o.eql(o.sqr(p),c),v=o.cmov(u,p,m);return ai(o,v,c),v}}function Ns(e){if(e<Cs)throw new Error("sqrt is not defined for small field");let t=e-le,n=0;for(;t%ot===ge;)t/=ot,n++;let r=ot;const i=ft(e);for(;Wi(i,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return js;let a=i.pow(r,t);const s=(t+le)/ot;return function(c,u){if(c.is0(u))return u;if(Wi(c,u)!==1)throw new Error("Cannot find square root");let p=n,d=c.mul(c.ONE,a),l=c.pow(u,t),f=c.pow(u,s);for(;!c.eql(l,c.ONE);){if(c.is0(l))return c.ZERO;let h=1,m=c.sqr(l);for(;!c.eql(m,c.ONE);)if(h++,m=c.sqr(m),h===p)throw new Error("Cannot find square root");const v=le<<BigInt(p-h-1),k=c.pow(d,v);p=h,d=c.sqr(k),l=c.mul(l,d),f=c.mul(f,k)}return f}}function af(e){return e%Ts===Cs?js:e%Ls===Bs?nf:e%Ms===tf?rf(e):Ns(e)}const sf=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function of(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=sf.reduce((r,i)=>(r[i]="function",r),t);return ni(e,n),e}function cf(e,t,n){if(n<ge)throw new Error("invalid exponent, negatives unsupported");if(n===ge)return e.ONE;if(n===le)return t;let r=e.ONE,i=t;for(;n>ge;)n&le&&(r=e.mul(r,i)),i=e.sqr(i),n>>=le;return r}function Ds(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),i=t.reduce((s,o,c)=>e.is0(o)?s:(r[c]=s,e.mul(s,o)),e.ONE),a=e.inv(i);return t.reduceRight((s,o,c)=>e.is0(o)?s:(r[c]=e.mul(s,r[c]),e.mul(s,o)),a),r}function Wi(e,t){const n=(e.ORDER-le)/ot,r=e.pow(t,n),i=e.eql(r,e.ONE),a=e.eql(r,e.ZERO),s=e.eql(r,e.neg(e.ONE));if(!i&&!a&&!s)throw new Error("invalid Legendre symbol result");return i?1:a?0:-1}function Rs(e,t){t!==void 0&&Lr(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function ft(e,t,n=!1,r={}){if(e<=ge)throw new Error("invalid field: expected ORDER > 0, got "+e);let i,a,s=!1,o;if(typeof t=="object"&&t!=null){if(r.sqrt||n)throw new Error("cannot specify opts in two arguments");const l=t;l.BITS&&(i=l.BITS),l.sqrt&&(a=l.sqrt),typeof l.isLE=="boolean"&&(n=l.isLE),typeof l.modFromBytes=="boolean"&&(s=l.modFromBytes),o=l.allowedLengths}else typeof t=="number"&&(i=t),r.sqrt&&(a=r.sqrt);const{nBitLength:c,nByteLength:u}=Rs(e,i);if(u>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let p;const d=Object.freeze({ORDER:e,isLE:n,BITS:c,BYTES:u,MASK:Vt(c),ZERO:ge,ONE:le,allowedLengths:o,create:l=>xe(l,e),isValid:l=>{if(typeof l!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof l);return ge<=l&&l<e},is0:l=>l===ge,isValidNot0:l=>!d.is0(l)&&d.isValid(l),isOdd:l=>(l&le)===le,neg:l=>xe(-l,e),eql:(l,f)=>l===f,sqr:l=>xe(l*l,e),add:(l,f)=>xe(l+f,e),sub:(l,f)=>xe(l-f,e),mul:(l,f)=>xe(l*f,e),pow:(l,f)=>cf(d,l,f),div:(l,f)=>xe(l*qi(f,e),e),sqrN:l=>l*l,addN:(l,f)=>l+f,subN:(l,f)=>l-f,mulN:(l,f)=>l*f,inv:l=>qi(l,e),sqrt:a||(l=>(p||(p=af(e)),p(d,l))),toBytes:l=>n?ls(l,u):ti(l,u),fromBytes:(l,f=!0)=>{if(o){if(!o.includes(l.length)||l.length>u)throw new Error("Field.fromBytes: expected "+o+" bytes, got "+l.length);const m=new Uint8Array(u);m.set(l,n?0:m.length-l.length),l=m}if(l.length!==u)throw new Error("Field.fromBytes: expected "+u+" bytes, got "+l.length);let h=n?ds(l):Mn(l);if(s&&(h=xe(h,e)),!f&&!d.isValid(h))throw new Error("invalid field element: outside of range 0..ORDER");return h},invertBatch:l=>Ds(d,l),cmov:(l,f,h)=>h?f:l});return Object.freeze(d)}function Us(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function Hs(e){const t=Us(e);return t+Math.ceil(t/2)}function uf(e,t,n=!1){const r=e.length,i=Us(t),a=Hs(t);if(r<16||r<a||r>1024)throw new Error("expected "+a+"-1024 bytes of input, got "+r);const s=n?ds(e):Mn(e),o=xe(s,t-le)+le;return n?ls(o,i):ti(o,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Bt=BigInt(0),ct=BigInt(1);function In(e,t){const n=t.negate();return e?n:t}function qn(e,t){const n=Ds(e.Fp,t.map(r=>r.Z));return t.map((r,i)=>e.fromAffine(r.toAffine(n[i])))}function Gs(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Wn(e,t){Gs(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),i=2**e,a=Vt(e),s=BigInt(e);return{windows:n,windowSize:r,mask:a,maxNumber:i,shiftBy:s}}function Vi(e,t,n){const{windowSize:r,mask:i,maxNumber:a,shiftBy:s}=n;let o=Number(e&i),c=e>>s;o>r&&(o-=a,c+=ct);const u=t*r,p=u+Math.abs(o)-1,d=o===0,l=o<0,f=t%2!==0;return{nextN:c,offset:p,isZero:d,isNeg:l,isNegF:f,offsetF:u}}function df(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((n,r)=>{if(!(n instanceof t))throw new Error("invalid point at index "+r)})}function lf(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const Vn=new WeakMap,Fs=new WeakMap;function Kn(e){return Fs.get(e)||1}function Ki(e){if(e!==Bt)throw new Error("invalid wNAF")}class ff{constructor(t,n){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,r=this.ZERO){let i=t;for(;n>Bt;)n&ct&&(r=r.add(i)),i=i.double(),n>>=ct;return r}precomputeWindow(t,n){const{windows:r,windowSize:i}=Wn(n,this.bits),a=[];let s=t,o=s;for(let c=0;c<r;c++){o=s,a.push(o);for(let u=1;u<i;u++)o=o.add(s),a.push(o);s=o.double()}return a}wNAF(t,n,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let i=this.ZERO,a=this.BASE;const s=Wn(t,this.bits);for(let o=0;o<s.windows;o++){const{nextN:c,offset:u,isZero:p,isNeg:d,isNegF:l,offsetF:f}=Vi(r,o,s);r=c,p?a=a.add(In(l,n[f])):i=i.add(In(d,n[u]))}return Ki(r),{p:i,f:a}}wNAFUnsafe(t,n,r,i=this.ZERO){const a=Wn(t,this.bits);for(let s=0;s<a.windows&&r!==Bt;s++){const{nextN:o,offset:c,isZero:u,isNeg:p}=Vi(r,s,a);if(r=o,!u){const d=n[c];i=i.add(p?d.negate():d)}}return Ki(r),i}getPrecomputes(t,n,r){let i=Vn.get(n);return i||(i=this.precomputeWindow(n,t),t!==1&&(typeof r=="function"&&(i=r(i)),Vn.set(n,i))),i}cached(t,n,r){const i=Kn(t);return this.wNAF(i,this.getPrecomputes(i,t,r),n)}unsafe(t,n,r,i){const a=Kn(t);return a===1?this._unsafeLadder(t,n,i):this.wNAFUnsafe(a,this.getPrecomputes(a,t,r),n,i)}createCache(t,n){Gs(n,this.bits),Fs.set(t,n),Vn.delete(t)}hasCache(t){return Kn(t)!==1}}function pf(e,t,n,r){let i=t,a=e.ZERO,s=e.ZERO;for(;n>Bt||r>Bt;)n&ct&&(a=a.add(i)),r&ct&&(s=s.add(i)),i=i.double(),n>>=ct,r>>=ct;return{p1:a,p2:s}}function hf(e,t,n,r){df(n,e),lf(r,t);const i=n.length,a=r.length;if(i!==a)throw new Error("arrays of points and scalars must have equal length");const s=e.ZERO,o=fs(BigInt(i));let c=1;o>12?c=o-3:o>4?c=o-2:o>0&&(c=2);const u=Vt(c),p=new Array(Number(u)+1).fill(s),d=Math.floor((t.BITS-1)/c)*c;let l=s;for(let f=d;f>=0;f-=c){p.fill(s);for(let m=0;m<a;m++){const v=r[m],k=Number(v>>BigInt(f)&u);p[k]=p[k].add(n[m])}let h=s;for(let m=p.length-1,v=s;m>0;m--)v=v.add(p[m]),h=h.add(v);if(l=l.add(h),f!==0)for(let m=0;m<c;m++)l=l.double()}return l}function Zi(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return of(t),t}else return ft(e,{isLE:n})}function mf(e,t,n={},r){if(r===void 0&&(r=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const c of["p","n","h"]){const u=t[c];if(!(typeof u=="bigint"&&u>Bt))throw new Error(`CURVE.${c} must be positive bigint`)}const i=Zi(t.p,n.Fp,r),a=Zi(t.n,n.Fn,r),o=["Gx","Gy","a","b"];for(const c of o)if(!i.isValid(t[c]))throw new Error(`CURVE.${c} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:i,Fn:a}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Yi=(e,t)=>(e+(e>=0?t:-t)/zs)/t;function yf(e,t,n){const[[r,i],[a,s]]=t,o=Yi(s*e,n),c=Yi(-i*e,n);let u=e-o*r-c*a,p=-o*i-c*s;const d=u<Ue,l=p<Ue;d&&(u=-u),l&&(p=-p);const f=Vt(Math.ceil(fs(n)/2))+At;if(u<Ue||u>=f||p<Ue||p>=f)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:d,k1:u,k2neg:l,k2:p}}function jr(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function Zn(e,t){const n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return _n(n.lowS,"lowS"),_n(n.prehash,"prehash"),n.format!==void 0&&jr(n.format),n}class gf extends Error{constructor(t=""){super(t)}}const Ne={Err:gf,_tlv:{encode:(e,t)=>{const{Err:n}=Ne;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,i=Xt(r);if(i.length/2&128)throw new n("tlv.encode: long form length too big");const a=r>127?Xt(i.length/2|128):"";return Xt(e)+a+i+t},decode(e,t){const{Err:n}=Ne;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const i=t[r++],a=!!(i&128);let s=0;if(!a)s=i;else{const c=i&127;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const u=t.subarray(r,r+c);if(u.length!==c)throw new n("tlv.decode: length bytes not complete");if(u[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const p of u)s=s<<8|p;if(r+=c,s<128)throw new n("tlv.decode(long): not minimal encoding")}const o=t.subarray(r,r+s);if(o.length!==s)throw new n("tlv.decode: wrong value length");return{v:o,l:t.subarray(r+s)}}},_int:{encode(e){const{Err:t}=Ne;if(e<Ue)throw new t("integer: negative integers are not allowed");let n=Xt(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=Ne;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Mn(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=Ne,i=pe("signature",e),{v:a,l:s}=r.decode(48,i);if(s.length)throw new t("invalid signature: left bytes after parsing");const{v:o,l:c}=r.decode(2,a),{v:u,l:p}=r.decode(2,c);if(p.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(o),s:n.decode(u)}},hexFromSig(e){const{_tlv:t,_int:n}=Ne,r=t.encode(2,n.encode(e.r)),i=t.encode(2,n.encode(e.s)),a=r+i;return t.encode(48,a)}},Ue=BigInt(0),At=BigInt(1),zs=BigInt(2),an=BigInt(3),bf=BigInt(4);function vt(e,t){const{BYTES:n}=e;let r;if(typeof t=="bigint")r=t;else{let i=pe("private key",t);try{r=e.fromBytes(i)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof t}`)}}if(!e.isValidNot0(r))throw new Error("invalid private key: out of range [1..N-1]");return r}function wf(e,t={}){const n=mf("weierstrass",e,t),{Fp:r,Fn:i}=n;let a=n.CURVE;const{h:s,n:o}=a;ni(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:c}=t;if(c&&(!r.is0(a.a)||typeof c.beta!="bigint"||!Array.isArray(c.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const u=qs(r,i);function p(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function d(b,y,w){const{x:g,y:E}=y.toAffine(),I=r.toBytes(g);if(_n(w,"isCompressed"),w){p();const B=!r.isOdd(E);return Je($s(B),I)}else return Je(Uint8Array.of(4),I,r.toBytes(E))}function l(b){st(b,void 0,"Point");const{publicKey:y,publicKeyUncompressed:w}=u,g=b.length,E=b[0],I=b.subarray(1);if(g===y&&(E===2||E===3)){const B=r.fromBytes(I);if(!r.isValid(B))throw new Error("bad point: is not on curve, wrong x");const T=m(B);let C;try{C=r.sqrt(T)}catch(ne){const K=ne instanceof Error?": "+ne.message:"";throw new Error("bad point: is not on curve, sqrt error"+K)}p();const M=r.isOdd(C);return(E&1)===1!==M&&(C=r.neg(C)),{x:B,y:C}}else if(g===w&&E===4){const B=r.BYTES,T=r.fromBytes(I.subarray(0,B)),C=r.fromBytes(I.subarray(B,B*2));if(!v(T,C))throw new Error("bad point: is not on curve");return{x:T,y:C}}else throw new Error(`bad point: got length ${g}, expected compressed=${y} or uncompressed=${w}`)}const f=t.toBytes||d,h=t.fromBytes||l;function m(b){const y=r.sqr(b),w=r.mul(y,b);return r.add(r.add(w,r.mul(b,a.a)),a.b)}function v(b,y){const w=r.sqr(y),g=m(b);return r.eql(w,g)}if(!v(a.Gx,a.Gy))throw new Error("bad curve params: generator point");const k=r.mul(r.pow(a.a,an),bf),P=r.mul(r.sqr(a.b),BigInt(27));if(r.is0(r.add(k,P)))throw new Error("bad curve params: a or b");function x(b,y,w=!1){if(!r.isValid(y)||w&&r.is0(y))throw new Error(`bad point coordinate ${b}`);return y}function O(b){if(!(b instanceof A))throw new Error("ProjectivePoint expected")}function N(b){if(!c||!c.basises)throw new Error("no endo");return yf(b,c.basises,i.ORDER)}const ee=Mi((b,y)=>{const{X:w,Y:g,Z:E}=b;if(r.eql(E,r.ONE))return{x:w,y:g};const I=b.is0();y==null&&(y=I?r.ONE:r.inv(E));const B=r.mul(w,y),T=r.mul(g,y),C=r.mul(E,y);if(I)return{x:r.ZERO,y:r.ZERO};if(!r.eql(C,r.ONE))throw new Error("invZ was invalid");return{x:B,y:T}}),te=Mi(b=>{if(b.is0()){if(t.allowInfinityPoint&&!r.is0(b.Y))return;throw new Error("bad point: ZERO")}const{x:y,y:w}=b.toAffine();if(!r.isValid(y)||!r.isValid(w))throw new Error("bad point: x or y not field elements");if(!v(y,w))throw new Error("bad point: equation left != right");if(!b.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function V(b,y,w,g,E){return w=new A(r.mul(w.X,b),w.Y,w.Z),y=In(g,y),w=In(E,w),y.add(w)}class A{constructor(y,w,g){this.X=x("x",y),this.Y=x("y",w,!0),this.Z=x("z",g),Object.freeze(this)}static CURVE(){return a}static fromAffine(y){const{x:w,y:g}=y||{};if(!y||!r.isValid(w)||!r.isValid(g))throw new Error("invalid affine point");if(y instanceof A)throw new Error("projective point not allowed");return r.is0(w)&&r.is0(g)?A.ZERO:new A(w,g,r.ONE)}static fromBytes(y){const w=A.fromAffine(h(st(y,void 0,"point")));return w.assertValidity(),w}static fromHex(y){return A.fromBytes(pe("pointHex",y))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(y=8,w=!0){return ie.createCache(this,y),w||this.multiply(an),this}assertValidity(){te(this)}hasEvenY(){const{y}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(y)}equals(y){O(y);const{X:w,Y:g,Z:E}=this,{X:I,Y:B,Z:T}=y,C=r.eql(r.mul(w,T),r.mul(I,E)),M=r.eql(r.mul(g,T),r.mul(B,E));return C&&M}negate(){return new A(this.X,r.neg(this.Y),this.Z)}double(){const{a:y,b:w}=a,g=r.mul(w,an),{X:E,Y:I,Z:B}=this;let T=r.ZERO,C=r.ZERO,M=r.ZERO,R=r.mul(E,E),ne=r.mul(I,I),K=r.mul(B,B),$=r.mul(E,I);return $=r.add($,$),M=r.mul(E,B),M=r.add(M,M),T=r.mul(y,M),C=r.mul(g,K),C=r.add(T,C),T=r.sub(ne,C),C=r.add(ne,C),C=r.mul(T,C),T=r.mul($,T),M=r.mul(g,M),K=r.mul(y,K),$=r.sub(R,K),$=r.mul(y,$),$=r.add($,M),M=r.add(R,R),R=r.add(M,R),R=r.add(R,K),R=r.mul(R,$),C=r.add(C,R),K=r.mul(I,B),K=r.add(K,K),R=r.mul(K,$),T=r.sub(T,R),M=r.mul(K,ne),M=r.add(M,M),M=r.add(M,M),new A(T,C,M)}add(y){O(y);const{X:w,Y:g,Z:E}=this,{X:I,Y:B,Z:T}=y;let C=r.ZERO,M=r.ZERO,R=r.ZERO;const ne=a.a,K=r.mul(a.b,an);let $=r.mul(w,I),Y=r.mul(g,B),re=r.mul(E,T),fe=r.add(w,g),J=r.add(I,B);fe=r.mul(fe,J),J=r.add($,Y),fe=r.sub(fe,J),J=r.add(w,E);let oe=r.add(I,T);return J=r.mul(J,oe),oe=r.add($,re),J=r.sub(J,oe),oe=r.add(g,E),C=r.add(B,T),oe=r.mul(oe,C),C=r.add(Y,re),oe=r.sub(oe,C),R=r.mul(ne,J),C=r.mul(K,re),R=r.add(C,R),C=r.sub(Y,R),R=r.add(Y,R),M=r.mul(C,R),Y=r.add($,$),Y=r.add(Y,$),re=r.mul(ne,re),J=r.mul(K,J),Y=r.add(Y,re),re=r.sub($,re),re=r.mul(ne,re),J=r.add(J,re),$=r.mul(Y,J),M=r.add(M,$),$=r.mul(oe,J),C=r.mul(fe,C),C=r.sub(C,$),$=r.mul(fe,Y),R=r.mul(oe,R),R=r.add(R,$),new A(C,M,R)}subtract(y){return this.add(y.negate())}is0(){return this.equals(A.ZERO)}multiply(y){const{endo:w}=t;if(!i.isValidNot0(y))throw new Error("invalid scalar: out of range");let g,E;const I=B=>ie.cached(this,B,T=>qn(A,T));if(w){const{k1neg:B,k1:T,k2neg:C,k2:M}=N(y),{p:R,f:ne}=I(T),{p:K,f:$}=I(M);E=ne.add($),g=V(w.beta,R,K,B,C)}else{const{p:B,f:T}=I(y);g=B,E=T}return qn(A,[g,E])[0]}multiplyUnsafe(y){const{endo:w}=t,g=this;if(!i.isValid(y))throw new Error("invalid scalar: out of range");if(y===Ue||g.is0())return A.ZERO;if(y===At)return g;if(ie.hasCache(this))return this.multiply(y);if(w){const{k1neg:E,k1:I,k2neg:B,k2:T}=N(y),{p1:C,p2:M}=pf(A,g,I,T);return V(w.beta,C,M,E,B)}else return ie.unsafe(g,y)}multiplyAndAddUnsafe(y,w,g){const E=this.multiplyUnsafe(w).add(y.multiplyUnsafe(g));return E.is0()?void 0:E}toAffine(y){return ee(this,y)}isTorsionFree(){const{isTorsionFree:y}=t;return s===At?!0:y?y(A,this):ie.unsafe(this,o).is0()}clearCofactor(){const{clearCofactor:y}=t;return s===At?this:y?y(A,this):this.multiplyUnsafe(s)}isSmallOrder(){return this.multiplyUnsafe(s).is0()}toBytes(y=!0){return _n(y,"isCompressed"),this.assertValidity(),f(A,this,y)}toHex(y=!0){return kt(this.toBytes(y))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(y=!0){return this.toBytes(y)}_setWindowSize(y){this.precompute(y)}static normalizeZ(y){return qn(A,y)}static msm(y,w){return hf(A,i,y,w)}static fromPrivateKey(y){return A.BASE.multiply(vt(i,y))}}A.BASE=new A(a.Gx,a.Gy,r.ONE),A.ZERO=new A(r.ZERO,r.ONE,r.ZERO),A.Fp=r,A.Fn=i;const z=i.BITS,ie=new ff(A,t.endo?Math.ceil(z/2):z);return A.BASE.precompute(8),A}function $s(e){return Uint8Array.of(e?2:3)}function qs(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function vf(e,t={}){const{Fn:n}=e,r=t.randomBytes||cs,i=Object.assign(qs(e.Fp,n),{seed:Hs(n.ORDER)});function a(f){try{return!!vt(n,f)}catch{return!1}}function s(f,h){const{publicKey:m,publicKeyUncompressed:v}=i;try{const k=f.length;return h===!0&&k!==m||h===!1&&k!==v?!1:!!e.fromBytes(f)}catch{return!1}}function o(f=r(i.seed)){return uf(st(f,i.seed,"seed"),n.ORDER)}function c(f,h=!0){return e.BASE.multiply(vt(n,f)).toBytes(h)}function u(f){const h=o(f);return{secretKey:h,publicKey:c(h)}}function p(f){if(typeof f=="bigint")return!1;if(f instanceof e)return!0;const{secretKey:h,publicKey:m,publicKeyUncompressed:v}=i;if(n.allowedLengths||h===m)return;const k=pe("key",f).length;return k===m||k===v}function d(f,h,m=!0){if(p(f)===!0)throw new Error("first arg must be private key");if(p(h)===!1)throw new Error("second arg must be public key");const v=vt(n,f);return e.fromHex(h).multiply(v).toBytes(m)}return Object.freeze({getPublicKey:c,getSharedSecret:d,keygen:u,Point:e,utils:{isValidSecretKey:a,isValidPublicKey:s,randomSecretKey:o,isValidPrivateKey:a,randomPrivateKey:o,normPrivateKeyToScalar:f=>vt(n,f),precompute(f=8,h=e.BASE){return h.precompute(f,!1)}},lengths:i})}function xf(e,t,n={}){as(t),ni(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=n.randomBytes||cs,i=n.hmac||((w,...g)=>Ps(t,w,Je(...g))),{Fp:a,Fn:s}=e,{ORDER:o,BITS:c}=s,{keygen:u,getPublicKey:p,getSharedSecret:d,utils:l,lengths:f}=vf(e,n),h={prehash:!1,lowS:typeof n.lowS=="boolean"?n.lowS:!1,format:void 0,extraEntropy:!1},m="compact";function v(w){const g=o>>At;return w>g}function k(w,g){if(!s.isValidNot0(g))throw new Error(`invalid signature ${w}: out of range 1..Point.Fn.ORDER`);return g}function P(w,g){jr(g);const E=f.signature,I=g==="compact"?E:g==="recovered"?E+1:void 0;return st(w,I,`${g} signature`)}class x{constructor(g,E,I){this.r=k("r",g),this.s=k("s",E),I!=null&&(this.recovery=I),Object.freeze(this)}static fromBytes(g,E=m){P(g,E);let I;if(E==="der"){const{r:M,s:R}=Ne.toSig(st(g));return new x(M,R)}E==="recovered"&&(I=g[0],E="compact",g=g.subarray(1));const B=s.BYTES,T=g.subarray(0,B),C=g.subarray(B,B*2);return new x(s.fromBytes(T),s.fromBytes(C),I)}static fromHex(g,E){return this.fromBytes(An(g),E)}addRecoveryBit(g){return new x(this.r,this.s,g)}recoverPublicKey(g){const E=a.ORDER,{r:I,s:B,recovery:T}=this;if(T==null||![0,1,2,3].includes(T))throw new Error("recovery id invalid");if(o*zs<E&&T>1)throw new Error("recovery id is ambiguous for h>1 curve");const M=T===2||T===3?I+o:I;if(!a.isValid(M))throw new Error("recovery id 2 or 3 invalid");const R=a.toBytes(M),ne=e.fromBytes(Je($s((T&1)===0),R)),K=s.inv(M),$=N(pe("msgHash",g)),Y=s.create(-$*K),re=s.create(B*K),fe=e.BASE.multiplyUnsafe(Y).add(ne.multiplyUnsafe(re));if(fe.is0())throw new Error("point at infinify");return fe.assertValidity(),fe}hasHighS(){return v(this.s)}toBytes(g=m){if(jr(g),g==="der")return An(Ne.hexFromSig(this));const E=s.toBytes(this.r),I=s.toBytes(this.s);if(g==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return Je(Uint8Array.of(this.recovery),E,I)}return Je(E,I)}toHex(g){return kt(this.toBytes(g))}assertValidity(){}static fromCompact(g){return x.fromBytes(pe("sig",g),"compact")}static fromDER(g){return x.fromBytes(pe("sig",g),"der")}normalizeS(){return this.hasHighS()?new x(this.r,s.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return kt(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return kt(this.toBytes("compact"))}}const O=n.bits2int||function(g){if(g.length>8192)throw new Error("input is too large");const E=Mn(g),I=g.length*8-c;return I>0?E>>BigInt(I):E},N=n.bits2int_modN||function(g){return s.create(O(g))},ee=Vt(c);function te(w){return ul("num < 2^"+c,w,Ue,ee),s.toBytes(w)}function V(w,g){return st(w,void 0,"message"),g?st(t(w),void 0,"prehashed message"):w}function A(w,g,E){if(["recovered","canonical"].some(Y=>Y in E))throw new Error("sign() legacy options not supported");const{lowS:I,prehash:B,extraEntropy:T}=Zn(E,h);w=V(w,B);const C=N(w),M=vt(s,g),R=[te(M),te(C)];if(T!=null&&T!==!1){const Y=T===!0?r(f.secretKey):T;R.push(pe("extraEntropy",Y))}const ne=Je(...R),K=C;function $(Y){const re=O(Y);if(!s.isValidNot0(re))return;const fe=s.inv(re),J=e.BASE.multiply(re).toAffine(),oe=s.create(J.x);if(oe===Ue)return;const Zt=s.create(fe*s.create(K+oe*M));if(Zt===Ue)return;let fi=(J.x===oe?0:2)|Number(J.y&At),pi=Zt;return I&&v(Zt)&&(pi=s.neg(Zt),fi^=1),new x(oe,pi,fi)}return{seed:ne,k2sig:$}}function z(w,g,E={}){w=pe("message",w);const{seed:I,k2sig:B}=A(w,g,E);return dl(t.outputLen,s.BYTES,i)(I,B)}function ie(w){let g;const E=typeof w=="string"||Ln(w),I=!E&&w!==null&&typeof w=="object"&&typeof w.r=="bigint"&&typeof w.s=="bigint";if(!E&&!I)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(I)g=new x(w.r,w.s);else if(E){try{g=x.fromBytes(pe("sig",w),"der")}catch(B){if(!(B instanceof Ne.Err))throw B}if(!g)try{g=x.fromBytes(pe("sig",w),"compact")}catch{return!1}}return g||!1}function b(w,g,E,I={}){const{lowS:B,prehash:T,format:C}=Zn(I,h);if(E=pe("publicKey",E),g=V(pe("message",g),T),"strict"in I)throw new Error("options.strict was renamed to lowS");const M=C===void 0?ie(w):x.fromBytes(pe("sig",w),C);if(M===!1)return!1;try{const R=e.fromBytes(E);if(B&&M.hasHighS())return!1;const{r:ne,s:K}=M,$=N(g),Y=s.inv(K),re=s.create($*Y),fe=s.create(ne*Y),J=e.BASE.multiplyUnsafe(re).add(R.multiplyUnsafe(fe));return J.is0()?!1:s.create(J.x)===ne}catch{return!1}}function y(w,g,E={}){const{prehash:I}=Zn(E,h);return g=V(g,I),x.fromBytes(w,"recovered").recoverPublicKey(g).toBytes()}return Object.freeze({keygen:u,getPublicKey:p,getSharedSecret:d,utils:l,lengths:f,Point:e,sign:z,verify:b,recoverPublicKey:y,Signature:x,hash:t})}function Ef(e){const t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},n=e.Fp;let r=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map(s=>Math.ceil(s/2)))):void 0;const i=ft(t.n,{BITS:e.nBitLength,allowedLengths:r,modFromBytes:e.wrapPrivateKey}),a={Fp:n,Fn:i,allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes};return{CURVE:t,curveOpts:a}}function Sf(e){const{CURVE:t,curveOpts:n}=Ef(e),r={hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:t,curveOpts:n,hash:e.hash,ecdsaOpts:r}}function kf(e,t){const n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},e,Rs(n.Fn.ORDER,n.Fn.BITS))})}function Af(e){const{CURVE:t,curveOpts:n,hash:r,ecdsaOpts:i}=Sf(e),a=wf(t,n),s=xf(a,r,i);return kf(e,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function si(e,t){const n=r=>Af({...e,hash:r});return{...n(t),create:n}}function _f(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new Yn({signature:e});if(typeof e.s>"u")throw new Yn({signature:e});if(n&&typeof e.yParity>"u")throw new Yn({signature:e});if(e.r<0n||e.r>Gi)throw new Tf({value:e.r});if(e.s<0n||e.s>Gi)throw new Bf({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new oi({value:e.yParity})}function Ws(e){if(e.length!==130&&e.length!==132)throw new Cf({signature:e});const t=BigInt(we(e,0,32)),n=BigInt(we(e,32,64)),r=(()=>{const i=+`0x${e.slice(130)}`;if(!Number.isNaN(i))try{return Of(i)}catch{throw new oi({value:i})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function If(e){_f(e);const t=e.r,n=e.s;return Nn(Xe(t,{size:32}),Xe(n,{size:32}),typeof e.yParity=="number"?Xe(Pf(e.yParity),{size:1}):"0x")}function Of(e){if(e===0||e===27)return 0;if(e===1||e===28)return 1;if(e>=35)return e%2===0?1:0;throw new Lf({value:e})}function Pf(e){if(e===0)return 27;if(e===1)return 28;throw new oi({value:e})}class Cf extends Z{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${et(hs(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class Yn extends Z{constructor({signature:t}){super(`Signature \`${jn(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}}class Tf extends Z{constructor({value:t}){super(`Value \`${t}\` is an invalid r value. r must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidRError"})}}class Bf extends Z{constructor({value:t}){super(`Value \`${t}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}}class oi extends Z{constructor({value:t}){super(`Value \`${t}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}}class Lf extends Z{constructor({value:t}){super(`Value \`${t}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}}const Mf=new TextDecoder,sn=Object.fromEntries(Array.from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").map((e,t)=>[t,e.charCodeAt(0)]));({...Object.fromEntries(Array.from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").map((e,t)=>[e.charCodeAt(0),t]))});function jf(e,t={}){const{pad:n=!0,url:r=!1}=t,i=new Uint8Array(Math.ceil(e.length/3)*4);for(let c=0,u=0;u<e.length;c+=4,u+=3){const p=(e[u]<<16)+(e[u+1]<<8)+(e[u+2]|0);i[c]=sn[p>>18],i[c+1]=sn[p>>12&63],i[c+2]=sn[p>>6&63],i[c+3]=sn[p&63]}const a=e.length%3,s=Math.floor(e.length/3)*4+(a&&a+1);let o=Mf.decode(new Uint8Array(i.buffer,0,s));return n&&a===1&&(o+="=="),n&&a===2&&(o+="="),r&&(o=o.replaceAll("+","-").replaceAll("/","_")),o}function Nf(e,t={}){return jf(vs(e),t)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Vs={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},Ks={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")},Zs={p:BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),h:BigInt(1),a:BigInt("0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc"),b:BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")},Df=ft(Vs.p),Rf=ft(Ks.p),Uf=ft(Zs.p),Hf=si({...Vs,Fp:Df,lowS:!1},Jl);si({...Ks,Fp:Rf,lowS:!1},Xl);si({...Zs,Fp:Uf,lowS:!1,allowedPrivateKeyLengths:[130,131,132]},Ql);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ji=Hf;Uint8Array.from([105,171,180,181,160,222,75,198,42,42,32,31,141,37,186,233]);function Gf(e={}){const{flag:t=5,rpId:n=window.location.hostname,signCount:r=0}=e,i=Es(ms(n)),a=Xe(t,{size:1}),s=Xe(r,{size:4});return Nn(i,a,s)}function Ff(e){const{challenge:t,crossOrigin:n=!1,extraClientData:r,origin:i=window.location.origin}=e;return JSON.stringify({type:"webauthn.get",challenge:Nf(t,{url:!0,pad:!1}),origin:i,crossOrigin:n,...r})}function zf(e){const{challenge:t,crossOrigin:n,extraClientData:r,flag:i,origin:a,rpId:s,signCount:o,userVerification:c="required"}=e,u=Gf({flag:i,rpId:s,signCount:o}),p=Ff({challenge:t,crossOrigin:n,extraClientData:r,origin:a}),d=Es(ms(p)),l=p.indexOf('"challenge"'),f=p.indexOf('"type"'),h={authenticatorData:u,clientDataJSON:p,challengeIndex:l,typeIndex:f,userVerificationRequired:c==="required"},m=Nn(u,d);return{metadata:h,payload:m}}async function $f(e={}){const{extractable:t=!1}=e,n=await globalThis.crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},t,["sign","verify"]),r=await globalThis.crypto.subtle.exportKey("raw",n.publicKey),i=Pl(new Uint8Array(r));return{privateKey:n.privateKey,publicKey:i}}async function qf(e){const{payload:t,privateKey:n}=e,r=await globalThis.crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},n,bs(t)),i=ws(new Uint8Array(r)),a=Ui(Ri(i,0,32));let s=Ui(Ri(i,32,64));return s>Ji.CURVE.n/2n&&(s=Ji.CURVE.n-s),{r:a,s}}function Wf(e,t){const n=typeof indexedDB<"u"?Pc(e,t):void 0;return{getItem:async r=>{const i=await Bc(r,n);return i||null},removeItem:async r=>Tc(r,n),setItem:async(r,i)=>Cc(r,i,n)}}const Vf="cbwsdk",Kf="keys",ci="activeId",Lt=Wf(Vf,Kf);async function Zf(){const e=await $f({extractable:!1}),t=we(ii(e.publicKey),1);return await Lt.setItem(t,e),await Lt.setItem(ci,t),e}async function Yf(){const e=await Lt.getItem(ci);if(!e)return null;const t=await Lt.getItem(e);return t||null}async function Jf(){const e=await Yf();if(!e){const t=await Zf(),n=we(ii(t.publicKey),1);return await Lt.setItem(n,t),await Lt.setItem(ci,n),t}return e}async function Qf(){const e=await Jf(),t=we(ii(e.publicKey),1),n=async r=>{const{payload:i,metadata:a}=zf({challenge:r,origin:"https://keys.coinbase.com",userVerification:"preferred"}),s=await qf({payload:i,privateKey:e.privateKey});return{signature:If(s),raw:{},webauthn:a}};return{id:t,publicKey:t,async sign({hash:r}){return n(r)},async signMessage({message:r}){return n(Ea(r))},async signTypedData(r){return n(Cn(r))},type:"webAuthn"}}async function Nr(){return{account:await Qf()}}const Qi={storageKey:"ownPrivateKey",keyType:"private"},Xi={storageKey:"ownPublicKey",keyType:"public"},ea={storageKey:"peerPublicKey",keyType:"public"};class Xf{constructor(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(t){this.sharedSecret=null,this.peerPublicKey=t,await this.storeKey(ea,t),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,_.keys.clear()}async generateKeyPair(){const t=await Rd();this.ownPrivateKey=t.privateKey,this.ownPublicKey=t.publicKey,await this.storeKey(Qi,t.privateKey),await this.storeKey(Xi,t.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(Qi)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(Xi)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(ea)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await Ud(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(t){const n=_.keys.get(t.storageKey);return n?ns(t.keyType,n):null}async storeKey(t,n){const r=await ts(t.keyType,n);_.keys.set(t.storageKey,r)}}function Rt(e,t){if(!(typeof e!="object"||e===null))return t.split(/[.[\]]+/).filter(Boolean).reduce((n,r)=>{if(typeof n=="object"&&n!==null)return n[r]},e)}const Ys="0x0ba5ed0c6aa8c49038f819e587e2633c4a9f428a",Js="0xf85210B21cC50302F477BA56686d2019dC9b67Ad",Se=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"owner",type:"bytes"}],name:"AlreadyOwner",type:"error"},{inputs:[],name:"Initialized",type:"error"},{inputs:[{name:"owner",type:"bytes"}],name:"InvalidEthereumAddressOwner",type:"error"},{inputs:[{name:"key",type:"uint256"}],name:"InvalidNonceKey",type:"error"},{inputs:[{name:"owner",type:"bytes"}],name:"InvalidOwnerBytesLength",type:"error"},{inputs:[],name:"LastOwner",type:"error"},{inputs:[{name:"index",type:"uint256"}],name:"NoOwnerAtIndex",type:"error"},{inputs:[{name:"ownersRemaining",type:"uint256"}],name:"NotLastOwner",type:"error"},{inputs:[{name:"selector",type:"bytes4"}],name:"SelectorNotAllowed",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{inputs:[],name:"UnauthorizedCallContext",type:"error"},{inputs:[],name:"UpgradeFailed",type:"error"},{inputs:[{name:"index",type:"uint256"},{name:"expectedOwner",type:"bytes"},{name:"actualOwner",type:"bytes"}],name:"WrongOwnerAtIndex",type:"error"},{anonymous:!1,inputs:[{indexed:!0,name:"index",type:"uint256"},{indexed:!1,name:"owner",type:"bytes"}],name:"AddOwner",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"index",type:"uint256"},{indexed:!1,name:"owner",type:"bytes"}],name:"RemoveOwner",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{stateMutability:"payable",type:"fallback"},{inputs:[],name:"REPLAYABLE_NONCE_KEY",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"owner",type:"address"}],name:"addOwnerAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"x",type:"bytes32"},{name:"y",type:"bytes32"}],name:"addOwnerPublicKey",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"functionSelector",type:"bytes4"}],name:"canSkipChainIdValidation",outputs:[{name:"",type:"bool"}],stateMutability:"pure",type:"function"},{inputs:[],name:"domainSeparator",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"entryPoint",outputs:[{name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{name:"target",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"}],name:"execute",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{name:"target",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"executeBatch",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"calls",type:"bytes[]"}],name:"executeWithoutChainIdValidation",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"}],name:"getUserOpHashWithoutChainId",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"implementation",outputs:[{name:"$",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{name:"owners",type:"bytes[]"}],name:"initialize",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"account",type:"address"}],name:"isOwnerAddress",outputs:[{name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"bytes"}],name:"isOwnerBytes",outputs:[{name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{name:"x",type:"bytes32"},{name:"y",type:"bytes32"}],name:"isOwnerPublicKey",outputs:[{name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"result",type:"bytes4"}],stateMutability:"view",type:"function"},{inputs:[],name:"nextOwnerIndex",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"index",type:"uint256"}],name:"ownerAtIndex",outputs:[{name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[],name:"ownerCount",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{name:"index",type:"uint256"},{name:"owner",type:"bytes"}],name:"removeLastOwner",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"index",type:"uint256"},{name:"owner",type:"bytes"}],name:"removeOwnerAtIndex",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"removedOwnersCount",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"hash",type:"bytes32"}],name:"replaySafeHash",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{name:"newImplementation",type:"address"},{name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"},{name:"userOpHash",type:"bytes32"},{name:"missingAccountFunds",type:"uint256"}],name:"validateUserOp",outputs:[{name:"validationData",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],Qs=[{inputs:[{name:"implementation_",type:"address"}],stateMutability:"payable",type:"constructor"},{inputs:[],name:"OwnerRequired",type:"error"},{inputs:[{name:"owners",type:"bytes[]"},{name:"nonce",type:"uint256"}],name:"createAccount",outputs:[{name:"account",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{name:"owners",type:"bytes[]"},{name:"nonce",type:"uint256"}],name:"getAddress",outputs:[{name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"implementation",outputs:[{name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"initCodeHash",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"}];function ta(e){var t;if(!Array.isArray(e.params))return null;switch(e.method){case"personal_sign":return e.params[1];case"eth_signTypedData_v4":return e.params[0];case"eth_signTransaction":case"eth_sendTransaction":case"wallet_sendCalls":return(t=e.params[0])===null||t===void 0?void 0:t.from;default:return null}}function ep(e,t){if(!Array.isArray(e.params))throw S.rpc.invalidParams();const n=[...e.params];switch(e.method){case"eth_signTransaction":case"eth_sendTransaction":case"wallet_sendCalls":n[0].from=t;break;case"eth_signTypedData_v4":n[0]=t;break;case"personal_sign":n[1]=t;break}return Object.assign(Object.assign({},e),{params:n})}function na(e){var t;if(!e||!Array.isArray(e)||!(!((t=e[0])===null||t===void 0)&&t.chainId)||typeof e[0].chainId!="string"&&typeof e[0].chainId!="number")throw S.rpc.invalidParams()}function tp(e){if(!e||!Array.isArray(e)||e.length!==1&&e.length!==2||typeof e[0]!="string"||!$t(e[0]))throw S.rpc.invalidParams();if(e.length===2){if(!Array.isArray(e[1]))throw S.rpc.invalidParams();for(const t of e[1])if(typeof t!="string"||!t.startsWith("0x"))throw S.rpc.invalidParams()}}function On(e,t){const n=Object.assign({},e);if(t&&e.method.startsWith("wallet_")){let r=Rt(n,"params.0.capabilities");if(typeof r>"u"&&(r={}),typeof r!="object")throw S.rpc.invalidParams();r=Object.assign(Object.assign({},t),r),n.params&&Array.isArray(n.params)&&(n.params[0]=Object.assign(Object.assign({},n.params[0]),{capabilities:r}))}return n}async function Jn(){var e;const t=(e=_.subAccountsConfig.get())!==null&&e!==void 0?e:{},n={};if(t.enableAutoSubAccounts){const{account:r}=t.toOwnerAccount?await t.toOwnerAccount():await Nr();if(!r)throw S.provider.unauthorized("No owner account found");n.addSubAccount={account:{type:"create",keys:[{type:r.address?"address":"webauthn-p256",publicKey:r.address||r.publicKey}]}}}_.subAccountsConfig.set({capabilities:n})}function np(e){if(!(e.method==="coinbase_fetchPermissions"&&e.params===void 0)){if(e.method==="coinbase_fetchPermissions"&&Array.isArray(e.params)&&e.params.length===1&&typeof e.params[0]=="object"){if(typeof e.params[0].account!="string"||!e.params[0].chainId.startsWith("0x"))throw S.rpc.invalidParams("FetchPermissions - Invalid params: params[0].account must be a hex string");if(typeof e.params[0].chainId!="string"||!e.params[0].chainId.startsWith("0x"))throw S.rpc.invalidParams("FetchPermissions - Invalid params: params[0].chainId must be a hex string");if(typeof e.params[0].spender!="string"||!e.params[0].spender.startsWith("0x"))throw S.rpc.invalidParams("FetchPermissions - Invalid params: params[0].spender must be a hex string");return}throw S.rpc.invalidParams()}}function rp(e){var t,n,r;if(e.params!==void 0)return e;const i=(t=_.getState().account.accounts)===null||t===void 0?void 0:t[0],a=(n=_.getState().account.chain)===null||n===void 0?void 0:n.id,s=(r=_.getState().subAccount)===null||r===void 0?void 0:r.address;if(!i||!s||!a)throw S.rpc.invalidParams("FetchPermissions - one or more of account, sub account, or chain id is missing, connect to sub account via wallet_connect first");return{method:"coinbase_fetchPermissions",params:[{account:i,chainId:D(a),spender:s}]}}function ip({spendPermission:e,chainId:t}){return{domain:{name:"Spend Permission Manager",version:"1",chainId:t,verifyingContract:Js},types:{SpendPermission:[{name:"account",type:"address"},{name:"spender",type:"address"},{name:"token",type:"address"},{name:"allowance",type:"uint160"},{name:"period",type:"uint48"},{name:"start",type:"uint48"},{name:"end",type:"uint48"},{name:"salt",type:"uint256"},{name:"extraData",type:"bytes"}]},primaryType:"SpendPermission",message:{account:e.account,spender:e.spender,token:e.token,allowance:e.allowance,period:e.period,start:e.start,end:e.end,salt:e.salt,extraData:e.extraData}}}function ap({spendPermissionBatch:e,chainId:t}){return{domain:{name:"Spend Permission Manager",version:"1",chainId:t,verifyingContract:Js},types:{SpendPermissionBatch:[{name:"account",type:"address"},{name:"period",type:"uint48"},{name:"start",type:"uint48"},{name:"end",type:"uint48"},{name:"permissions",type:"PermissionDetails[]"}],PermissionDetails:[{name:"spender",type:"address"},{name:"token",type:"address"},{name:"allowance",type:"uint160"},{name:"salt",type:"uint256"},{name:"extraData",type:"bytes"}]},primaryType:"SpendPermissionBatch",message:{account:e.account,period:e.period,start:e.start,end:e.end,permissions:e.permissions.map(n=>({spender:n.spender,token:n.token,allowance:n.allowance,salt:n.salt,extraData:n.extraData}))}}}async function Xs({client:e,id:t}){var n;const r=await Sa(e,{id:t});if(r.status==="success")return(n=r.receipts)===null||n===void 0?void 0:n[0].transactionHash;throw S.rpc.internal("failed to send transaction")}function eo({calls:e,from:t,chainId:n,capabilities:r}){const i=Ma.get().paymasterUrls;let a={method:"wallet_sendCalls",params:[{version:"1.0",calls:e,chainId:D(n),from:t,atomicRequired:!0,capabilities:r}]};return i!=null&&i[n]&&(a=On(a,{paymasterService:{url:i==null?void 0:i[n]}})),a}async function sp(){const e=Yr();return await new Promise(n=>{Zr({snackbarContext:"sub_account_insufficient_balance"}),e.presentItem({autoExpand:!0,message:"Insufficient spend permission. Choose how to proceed:",menuItems:[{isRed:!1,info:"Create new Spend Permission",svgWidth:"10",svgHeight:"11",path:"",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:()=>{St({snackbarContext:"sub_account_insufficient_balance",snackbarAction:"create_permission"}),e.clear(),n("update_permission")}},{isRed:!1,info:"Continue in Popup",svgWidth:"10",svgHeight:"11",path:"",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:()=>{St({snackbarContext:"sub_account_insufficient_balance",snackbarAction:"continue_in_popup"}),e.clear(),n("continue_popup")}},{isRed:!0,info:"Cancel",svgWidth:"10",svgHeight:"11",path:"",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:()=>{St({snackbarContext:"sub_account_insufficient_balance",snackbarAction:"cancel"}),e.clear(),n("cancel")}}]})})}function op({errorData:e,sourceAddress:t}){var n;const r=[];for(const[i,{amount:a,sources:s}]of Object.entries((n=e==null?void 0:e.required)!==null&&n!==void 0?n:{})){if(s.filter(c=>Qe(c.balance)>=Qe(a)&&c.address.toLowerCase()===(t==null?void 0:t.toLowerCase())).length===0)throw new Error("Source address has insufficient balance for a token");r.push({token:i,requiredAmount:Qe(a)})}return r}function cp(e){return typeof e=="object"&&e!==null&&"calls"in e}function up(e){return Array.isArray(e)&&e.length===1&&typeof e[0]=="object"&&e[0]!==null&&"to"in e[0]}function dp(e){return Ac(Le(Et(e)),0,16)}function lp({attribution:e,dappOrigin:t}){if(e){if("auto"in e&&e.auto&&t)return dp(t);if("dataSuffix"in e)return e.dataSuffix}}function fp(e,t){var n;if(!Array.isArray(e==null?void 0:e.params))return!1;const r=(n=e.params[0])===null||n===void 0?void 0:n.capabilities;return!r||typeof r!="object"?!1:t in r}function on(e,t){const n=e.filter(r=>r!==t);return[t,...n]}function cn(e,t){return[...e.filter(r=>r!==t),t]}async function pp(){const e=_.spendPermissions.get(),t=_.subAccounts.get(),n=_.account.get().accounts;return n?{accounts:n==null?void 0:n.map(i=>({address:i,capabilities:{subAccounts:t?[t]:void 0,spendPermissions:e.length>0?{permissions:e}:void 0}}))}:null}function hp(e){return e.replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function un(e){const t=btoa(String.fromCharCode(...new Uint8Array(e)));return hp(t)}function mp({webauthn:e,signature:t,id:n}){const r=Ws(t);return{id:n,rawId:un(gi(n)),response:{authenticatorData:un(hn(e.authenticatorData)),clientDataJSON:un(gi(e.clientDataJSON)),signature:un(yp(r.r,r.s))},type:JSON.parse(e.clientDataJSON).type}}function yp(e,t){const n=hn(bi(D(e))),r=hn(bi(D(t))),i=n.length,a=r.length,s=i+a+4,o=new Uint8Array(s+2);return o[0]=48,o[1]=s,o[2]=2,o[3]=i,o.set(n,4),o[i+4]=2,o[i+5]=a,o.set(r,i+6),o}var gp=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};async function bp(e){const{owner:t,ownerIndex:n,address:r,client:i,factoryData:a}=e,s={abi:Hc,address:Gc,version:"0.6"},o={abi:Qs,address:Ys};return qc({client:i,entryPoint:s,extend:{abi:Se,factory:o},async decodeCalls(c){const u=ka({abi:Se,data:c});if(u.functionName==="execute")return[{to:u.args[0],value:u.args[1],data:u.args[2]}];if(u.functionName==="executeBatch")return u.args[0].map(p=>({to:p.target,value:p.value,data:p.data}));throw new j(`unable to decode calls for "${u.functionName}"`)},async encodeCalls(c){var u,p;return c.length===1?He({abi:Se,functionName:"execute",args:[c[0].to,(u=c[0].value)!==null&&u!==void 0?u:BigInt(0),(p=c[0].data)!==null&&p!==void 0?p:"0x"]}):He({abi:Se,functionName:"executeBatch",args:[c.map(d=>{var l,f;return{data:(l=d.data)!==null&&l!==void 0?l:"0x",target:d.to,value:(f=d.value)!==null&&f!==void 0?f:BigInt(0)}})]})},async getAddress(){return r},async getFactoryArgs(){return a?{factory:o.address,factoryData:a}:{factory:o.address,factoryData:a}},async getStubSignature(){return t.type==="webAuthn"?"0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001949fc7c88032b9fcb5f6efc7a7b8c63668eae9871b765e23123bb473ff57aa831a7c0d9276168ebcc29f2875a0239cffdf2a9cd1c2007c5c77c071db9264df1d000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008a7b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2273496a396e6164474850596759334b7156384f7a4a666c726275504b474f716d59576f4d57516869467773222c226f726967696e223a2268747470733a2f2f7369676e2e636f696e626173652e636f6d222c2263726f73734f726967696e223a66616c73657d00000000000000000000000000000000000000000000":Nt({ownerIndex:n,signature:"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c"})},async sign(c){const u=await this.getAddress(),p=Qn({address:u,chainId:i.chain.id,hash:c.hash}),d=await dn({hash:p,owner:t});return Nt({ownerIndex:n,signature:d})},async signMessage(c){const{message:u}=c,p=await this.getAddress(),d=Qn({address:p,chainId:i.chain.id,hash:Ea(u)}),l=await dn({hash:d,owner:t});return Nt({ownerIndex:n,signature:l})},async signTypedData(c){const{domain:u,types:p,primaryType:d,message:l}=c,f=await this.getAddress(),h=Qn({address:f,chainId:i.chain.id,hash:Cn({domain:u,message:l,primaryType:d,types:p})}),m=await dn({hash:h,owner:t});return Nt({ownerIndex:n,signature:m})},async signUserOperation(c){const{chainId:u=i.chain.id}=c,p=gp(c,["chainId"]),d=await this.getAddress(),l=$c({chainId:u,entryPointAddress:s.address,entryPointVersion:s.version,userOperation:Object.assign(Object.assign({},p),{sender:d})}),f=await dn({hash:l,owner:t});return Nt({ownerIndex:n,signature:f})},userOperation:{async estimateGas(c){var u;if(t.type==="webAuthn")return{verificationGasLimit:BigInt(Math.max(Number((u=c.verificationGasLimit)!==null&&u!==void 0?u:BigInt(0)),8e5))}}}})}async function dn({hash:e,owner:t}){if(t.type==="webAuthn"){const{signature:n,webauthn:r}=await t.sign({hash:e});return wp({signature:n,webauthn:r})}if(t.sign)return t.sign({hash:e});throw new j("`owner` does not support raw sign.")}function Qn({address:e,chainId:t,hash:n}){return Cn({domain:{chainId:t,name:"Coinbase Smart Wallet",verifyingContract:e,version:"1"},types:{CoinbaseSmartWalletMessage:[{name:"hash",type:"bytes32"}]},primaryType:"CoinbaseSmartWalletMessage",message:{hash:n}})}function wp({webauthn:e,signature:t}){const{r:n,s:r}=Ws(t);return xt([{components:[{name:"authenticatorData",type:"bytes"},{name:"clientDataJSON",type:"bytes"},{name:"challengeIndex",type:"uint256"},{name:"typeIndex",type:"uint256"},{name:"r",type:"uint256"},{name:"s",type:"uint256"}],type:"tuple"}],[{authenticatorData:e.authenticatorData,clientDataJSON:ga(e.clientDataJSON),challengeIndex:BigInt(e.challengeIndex),typeIndex:BigInt(e.typeIndex),r:n,s:r}])}function Nt(e){const{ownerIndex:t=0}=e,n=(()=>{if(wa(e.signature)!==65)return e.signature;const r=Dc(e.signature);return Lc(["bytes32","bytes32","uint8"],[r.r,r.s,r.yParity===0?27:28])})();return xt([{components:[{name:"ownerIndex",type:"uint8"},{name:"signatureData",type:"bytes"}],type:"tuple"}],[{ownerIndex:t,signatureData:n}])}async function vp({address:e,client:t,factory:n,factoryData:r,owner:i,ownerIndex:a,parentAddress:s,attribution:o}){var c;const u={address:e,factory:n,factoryData:r},p=(c=t.chain)===null||c===void 0?void 0:c.id;if(!p)throw S.rpc.internal("chainId not found");const d=await bp({owner:i,ownerIndex:a??1,address:e,client:t,factoryData:r}),l=async f=>{var h,m,v,k,P,x;try{switch(f.method){case"wallet_addSubAccount":return u;case"eth_accounts":return[u.address];case"eth_coinbase":return u.address;case"net_version":return p.toString();case"eth_chainId":return D(p);case"eth_sendTransaction":{Ye(f.params);const O=f.params[0];ye(O.to,S.rpc.invalidParams("to is required"));const N={to:O.to,data:Cr((h=O.data)!==null&&h!==void 0?h:"0x",!0),value:Cr((m=O.value)!==null&&m!==void 0?m:"0x",!0),from:(v=O.from)!==null&&v!==void 0?v:u.address},ee=eo({calls:[N],chainId:p,from:N.from}),te=await l(ee);return Xs({client:t,id:te})}case"wallet_sendCalls":{Ye(f.params);const O=Rt(f.params[0],"chainId");if(!O)throw S.rpc.invalidParams("chainId is required");if(!bt(O))throw S.rpc.invalidParams("chainId must be a hex encoded integer");if(!f.params[0])throw S.rpc.invalidParams("params are required");if(!("calls"in f.params[0]))throw S.rpc.invalidParams("calls are required");let N={method:"wallet_prepareCalls",params:[{version:"1.0",calls:f.params[0].calls,chainId:O,from:u.address,capabilities:"capabilities"in f.params[0]?f.params[0].capabilities:{}}]};s&&(N=On(N,{funding:[{type:"spendPermission",data:{autoApply:!0,sources:[s],preference:"PREFER_DIRECT_BALANCE"}}]}));let ee=await l(N);const te=await((P=(k=i).sign)===null||P===void 0?void 0:P.call(k,{hash:wi(ee.signatureRequest.hash)}));let V;if(!te)throw S.rpc.internal("signature not found");return bt(te)?V={type:"secp256k1",data:{address:i.address,signature:te}}:V={type:"webauthn",data:{signature:JSON.stringify(mp(Object.assign({id:(x=i.id)!==null&&x!==void 0?x:"1"},te))),publicKey:i.publicKey}},(await l({method:"wallet_sendPreparedCalls",params:[{version:"1.0",type:ee.type,data:ee.userOp,chainId:ee.chainId,signature:V}]}))[0]}case"wallet_sendPreparedCalls":{Ye(f.params);const O=Rt(f.params[0],"chainId");if(!O)throw S.rpc.invalidParams("chainId is required");if(!bt(O))throw S.rpc.invalidParams("chainId must be a hex encoded integer");return await t.request({method:"wallet_sendPreparedCalls",params:f.params})}case"wallet_prepareCalls":{Ye(f.params);const O=Rt(f.params[0],"chainId");if(!O)throw S.rpc.invalidParams("chainId is required");if(!bt(O))throw S.rpc.invalidParams("chainId must be a hex encoded integer");if(!f.params[0])throw S.rpc.invalidParams("params are required");if(!Rt(f.params[0],"calls"))throw S.rpc.invalidParams("calls are required");const N=f.params[0];return o&&N.capabilities&&!("attribution"in N.capabilities)&&(N.capabilities.attribution=o),await t.request({method:"wallet_prepareCalls",params:[Object.assign(Object.assign({},f.params[0]),{chainId:O})]})}case"personal_sign":{if(Ye(f.params),!bt(f.params[0]))throw S.rpc.invalidParams("message must be a hex encoded string");const O=wi(f.params[0]);return d.signMessage({message:O})}case"eth_signTypedData_v4":{Ye(f.params);const O=typeof f.params[1]=="string"?JSON.parse(f.params[1]):f.params[1];return d.signTypedData(O)}case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"wallet_addEthereumChain":case"wallet_switchEthereumChain":default:throw S.rpc.methodNotSupported()}}catch(O){if(Ua(O)){const N=Mu(O);if(N)throw N}throw O}};return{request:l}}async function to({address:e,client:t,publicKey:n,factory:r,factoryData:i}){if(!await va(t,{address:e})&&r&&i){if(vi(r)!==vi(Ys))throw S.rpc.internal("unknown factory address");const o=ka({abi:Qs,data:i});if(o.functionName!=="createAccount")throw S.rpc.internal("unknown factory function");const[c]=o.args;return c.findIndex(u=>u.toLowerCase()===ra(n).toLowerCase())}const s=await nr(t,{address:e,abi:Se,functionName:"ownerCount"});for(let o=Number(s)-1;o>=0;o--){const c=await nr(t,{address:e,abi:Se,functionName:"ownerAtIndex",args:[BigInt(o)]}),u=ra(n);if(c.toLowerCase()===u.toLowerCase())return o}return-1}function ra(e){return $t(e)?he(e):e}async function xp(){const e=Yr();return new Promise(t=>{Zr({snackbarContext:"sub_account_add_owner"}),e.presentItem({autoExpand:!0,message:"App requires a signer update",menuItems:[{isRed:!1,info:"Confirm",svgWidth:"10",svgHeight:"11",path:"",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:()=>{St({snackbarContext:"sub_account_add_owner",snackbarAction:"confirm"}),e.clear(),t("authenticate")}},{isRed:!0,info:"Cancel",svgWidth:"10",svgHeight:"11",path:"",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:()=>{St({snackbarContext:"sub_account_add_owner",snackbarAction:"cancel"}),e.clear(),t("cancel")}}]})})}async function Ep({ownerAccount:e,globalAccountRequest:t}){var n,r;const i=_.account.get(),a=_.subAccounts.get(),s=(n=i.accounts)===null||n===void 0?void 0:n.find(h=>h.toLowerCase()!==(a==null?void 0:a.address.toLowerCase()));ye(s,S.provider.unauthorized("no global account")),ye((r=i.chain)===null||r===void 0?void 0:r.id,S.provider.unauthorized("no chain id")),ye(a==null?void 0:a.address,S.provider.unauthorized("no sub account"));const o=[];if(e.type==="local"&&e.address&&o.push({to:a.address,data:He({abi:Se,functionName:"addOwnerAddress",args:[e.address]}),value:Et(0)}),e.publicKey){const[h,m]=Aa([{type:"bytes32"},{type:"bytes32"}],e.publicKey);o.push({to:a.address,data:He({abi:Se,functionName:"addOwnerPublicKey",args:[h,m]}),value:Et(0)})}const c={method:"wallet_sendCalls",params:[{version:"1",calls:o,chainId:D(84532),from:s}]};if(await xp()==="cancel")throw S.provider.unauthorized("user cancelled");const p=await t(c),d=Xa(i.chain.id);if(ye(d,S.rpc.internal(`client not found for chainId ${i.chain.id}`)),(await Sa(d,{id:p})).status!=="success")throw S.rpc.internal("add owner call failed");const f=await to({address:a.address,publicKey:e.type==="local"&&e.address?e.address:e.publicKey,client:d});if(f===-1)throw S.rpc.internal("failed to find owner index");return f}async function Sp({errorData:e,globalAccountAddress:t,subAccountAddress:n,client:r,request:i,subAccountRequest:a,globalAccountRequest:s}){var o;const c=(o=r.chain)===null||o===void 0?void 0:o.id;ye(c,S.rpc.internal("invalid chainId"));const u=op({errorData:e,sourceAddress:t}),p=await sp();if(p==="cancel")throw new Error("User cancelled funding");let d;const l=60*60*24,f=3;if(p==="update_permission"){if(u.length===1){const x=u[0],O=ip({spendPermission:{token:x.token,allowance:D(x.requiredAmount*BigInt(f)),period:l,account:t,spender:n,start:0,end:0xffffffffffff,salt:D(BigInt(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER))),extraData:"0x"},chainId:c});d={method:"eth_signTypedData_v4",params:[t,O]}}else{const x=ap({spendPermissionBatch:{account:t,period:l,start:0,end:0xffffffffffff,permissions:u.map(O=>({token:O.token,allowance:D(O.requiredAmount*BigInt(f)),period:l,account:t,spender:n,salt:"0x0",extraData:"0x"}))},chainId:c});d={method:"eth_signTypedData_v4",params:[t,x]}}try{await s(d)}catch(x){throw console.error(x),new Error("User denied spend permission request")}return a(i)}const h=u.map(x=>x.token.toLowerCase()==="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE".toLowerCase()?{to:n,value:D(x.requiredAmount),data:"0x"}:{to:x.token,value:"0x0",data:He({abi:_c,functionName:"transfer",args:[n,x.requiredAmount]})});let m;if(i.method==="wallet_sendCalls"&&cp(i.params))m=i.params[0];else if(i.method==="eth_sendTransaction"&&up(i.params))m=eo({calls:[i.params[0]],chainId:c,from:i.params[0].from}).params[0];else throw new Error("Could not get original call");const v=He({abi:Se,functionName:"executeBatch",args:[m.calls.map(x=>{var O,N;return{target:x.to,value:Qe((O=x.value)!==null&&O!==void 0?O:"0x0"),data:(N=x.data)!==null&&N!==void 0?N:"0x"}})]}),k=[...h,{data:v,to:n,value:"0x0"}],P=await s({method:"wallet_sendCalls",params:[Object.assign(Object.assign({},m),{calls:k,from:t})]});return i.method==="eth_sendTransaction"?Xs({client:r,id:P}):P}class no{constructor(t){var n,r,i,a;this.communicator=t.communicator,this.callback=t.callback,this.keyManager=new Xf;const{account:s,chains:o}=_.getState();this.accounts=(n=s.accounts)!==null&&n!==void 0?n:[],this.chain=(r=s.chain)!==null&&r!==void 0?r:{id:(a=(i=t.metadata.appChainIds)===null||i===void 0?void 0:i[0])!==null&&a!==void 0?a:1},o&&Ti(o)}async handshake(t){var n,r,i;const a=Ee.get(t);Sd({method:t.method,correlationId:a});try{await((r=(n=this.communicator).waitForPopupLoaded)===null||r===void 0?void 0:r.call(n));const s=await this.createRequestMessage({handshake:{method:t.method,params:(i=t.params)!==null&&i!==void 0?i:[]}},a),o=await this.communicator.postRequestAndWaitForResponse(s);if("failure"in o.content)throw o.content.failure;const c=await ns("public",o.sender);await this.keyManager.setPeerPublicKey(c);const u=await this.decryptResponseMessage(o);this.handleResponse(t,u),Ad({method:t.method,correlationId:a})}catch(s){throw kd({method:t.method,correlationId:a,errorMessage:rt(s)}),s}}async request(t){const n=Ee.get(t);_d({method:t.method,correlationId:n});try{const r=await this._request(t);return Od({method:t.method,correlationId:n}),r}catch(r){throw Id({method:t.method,correlationId:n,errorMessage:rt(r)}),r}}async _request(t){var n,r,i,a,s,o,c,u,p,d,l,f,h,m;if(this.accounts.length===0)switch(t.method){case"eth_requestAccounts":return await((r=(n=this.communicator).waitForPopupLoaded)===null||r===void 0?void 0:r.call(n)),await Jn(),await this.request({method:"wallet_connect",params:[{version:"1",capabilities:Object.assign({},(a=(i=_.subAccountsConfig.get())===null||i===void 0?void 0:i.capabilities)!==null&&a!==void 0?a:{})}]}),this.accounts;case"wallet_switchEthereumChain":{na(t.params),this.chain.id=Number(t.params[0].chainId);return}case"wallet_connect":{await((o=(s=this.communicator).waitForPopupLoaded)===null||o===void 0?void 0:o.call(s)),await Jn();let v={};fp(t,"addSubAccount")&&(v=(u=(c=_.subAccountsConfig.get())===null||c===void 0?void 0:c.capabilities)!==null&&u!==void 0?u:{});const k=On(t,v);return this.sendRequestToPopup(k)}case"wallet_sendCalls":case"wallet_sign":return this.sendRequestToPopup(t);default:throw S.provider.unauthorized()}if(this.shouldRequestUseSubAccountSigner(t)){const v=Ee.get(t);Pd({method:t.method,correlationId:v});try{const k=await this.sendRequestToSubAccountSigner(t);return Cd({method:t.method,correlationId:v}),k}catch(k){throw Td({method:t.method,correlationId:v,errorMessage:rt(k)}),k}}switch(t.method){case"eth_requestAccounts":case"eth_accounts":{const v=_.subAccounts.get(),k=_.subAccountsConfig.get();return v!=null&&v.address&&(this.accounts=k!=null&&k.enableAutoSubAccounts?on(this.accounts,v.address):cn(this.accounts,v.address)),(p=this.callback)===null||p===void 0||p.call(this,"connect",{chainId:D(this.chain.id)}),this.accounts}case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return D(this.chain.id);case"wallet_getCapabilities":return this.handleGetCapabilitiesRequest(t);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(t);case"eth_ecRecover":case"personal_sign":case"wallet_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(t);case"wallet_connect":{const v=await pp();if(v)return v;await((l=(d=this.communicator).waitForPopupLoaded)===null||l===void 0?void 0:l.call(d)),await Jn();const k=_.subAccountsConfig.get(),P=On(t,(f=k==null?void 0:k.capabilities)!==null&&f!==void 0?f:{});return(h=this.callback)===null||h===void 0||h.call(this,"connect",{chainId:D(this.chain.id)}),this.sendRequestToPopup(P)}case"wallet_getSubAccounts":{const v=_.subAccounts.get();if(v!=null&&v.address)return{subAccounts:[v]};if(!this.chain.rpcUrl)throw S.rpc.internal("No RPC URL set for chain");const k=await Gt(t,this.chain.rpcUrl);if(Ye(k.subAccounts,"subAccounts"),k.subAccounts.length>0){Qt(k.subAccounts[0]);const P=k.subAccounts[0];_.subAccounts.set({address:P.address,factory:P.factory,factoryData:P.factoryData})}return k}case"wallet_addSubAccount":return this.addSubAccount(t);case"coinbase_fetchPermissions":{np(t);const v=rp(t),k=await Gt(v,qa),P=Un((m=v.params)===null||m===void 0?void 0:m[0].chainId);return _.spendPermissions.set(k.permissions.map(x=>Object.assign(Object.assign({},x),{chainId:P}))),k}default:if(!this.chain.rpcUrl)throw S.rpc.internal("No RPC URL set for chain");return Gt(t,this.chain.rpcUrl)}}async sendRequestToPopup(t){var n,r;await((r=(n=this.communicator).waitForPopupLoaded)===null||r===void 0?void 0:r.call(n));const i=await this.sendEncryptedRequest(t),a=await this.decryptResponseMessage(i);return this.handleResponse(t,a)}async handleResponse(t,n){var r,i,a,s,o;const c=n.result;if("error"in c)throw c.error;switch(t.method){case"eth_requestAccounts":{const u=c.value;this.accounts=u,_.account.set({accounts:u,chain:this.chain}),(r=this.callback)===null||r===void 0||r.call(this,"accountsChanged",u);break}case"wallet_connect":{const u=c.value,p=u.accounts.map(k=>k.address);this.accounts=p,_.account.set({accounts:p});const d=u.accounts.at(0),l=d==null?void 0:d.capabilities;if(l!=null&&l.subAccounts){const k=l==null?void 0:l.subAccounts;Ye(k,"subAccounts"),Qt(k[0]),_.subAccounts.set({address:k[0].address,factory:k[0].factory,factoryData:k[0].factoryData})}let f=[this.accounts[0]];const h=_.subAccounts.get(),m=_.subAccountsConfig.get();h!=null&&h.address&&(this.accounts=m!=null&&m.enableAutoSubAccounts?on(this.accounts,h.address):cn(this.accounts,h.address));const v=(a=(i=u==null?void 0:u.accounts)===null||i===void 0?void 0:i[0].capabilities)===null||a===void 0?void 0:a.spendPermissions;v&&"permissions"in v&&_.spendPermissions.set(v==null?void 0:v.permissions),(s=this.callback)===null||s===void 0||s.call(this,"accountsChanged",f);break}case"wallet_addSubAccount":{Qt(c.value);const u=c.value;_.subAccounts.set(u);const p=_.subAccountsConfig.get();this.accounts=p!=null&&p.enableAutoSubAccounts?on(this.accounts,u.address):cn(this.accounts,u.address),(o=this.callback)===null||o===void 0||o.call(this,"accountsChanged",this.accounts);break}}return c.value}async cleanup(){var t,n;const r=_.config.get().metadata;await this.keyManager.clear(),_.account.clear(),_.subAccounts.clear(),_.spendPermissions.clear(),_.chains.clear(),this.accounts=[],this.chain={id:(n=(t=r==null?void 0:r.appChainIds)===null||t===void 0?void 0:t[0])!==null&&n!==void 0?n:1}}async handleSwitchChainRequest(t){na(t.params);const n=Ht(t.params[0].chainId);if(this.updateChain(n))return null;const i=await this.sendRequestToPopup(t);return i===null&&this.updateChain(n),i}async handleGetCapabilitiesRequest(t){tp(t.params);const n=t.params[0],r=t.params[1];if(!this.accounts.some(o=>Ic(o,n)))throw S.provider.unauthorized("no active account found when getting capabilities");const i=_.getState().account.capabilities;if(!i)return{};if(!r||r.length===0)return i;const a=new Set(r.map(o=>Un(o)));return Object.fromEntries(Object.entries(i).filter(([o])=>{try{const c=Un(o);return a.has(c)}catch{return!1}}))}async sendEncryptedRequest(t){const n=await this.keyManager.getSharedSecret();if(!n)throw S.provider.unauthorized("No shared secret found when encrypting request");const r=await Fd({action:t,chainId:this.chain.id},n),i=Ee.get(t),a=await this.createRequestMessage({encrypted:r},i);return this.communicator.postRequestAndWaitForResponse(a)}async createRequestMessage(t,n){const r=await ts("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),correlationId:n,sender:r,content:t,timestamp:new Date}}async decryptResponseMessage(t){var n,r,i;const a=t.content;if("failure"in a)throw a.failure;const s=await this.keyManager.getSharedSecret();if(!s)throw S.provider.unauthorized("Invalid session: no shared secret found when decrypting response");const o=await zd(a.encrypted,s),c=(n=o.data)===null||n===void 0?void 0:n.chains;if(c){const p=(r=o.data)===null||r===void 0?void 0:r.nativeCurrencies,d=Object.entries(c).map(([l,f])=>{const h=p==null?void 0:p[Number(l)];return Object.assign({id:Number(l),rpcUrl:f},h?{nativeCurrency:h}:{})});_.chains.set(d),this.updateChain(this.chain.id,d),Ti(d)}const u=(i=o.data)===null||i===void 0?void 0:i.capabilities;return u&&_.account.set({capabilities:u}),o}updateChain(t,n){var r;const i=_.getState(),a=n??i.chains,s=a==null?void 0:a.find(o=>o.id===t);return s?(s!==this.chain&&(this.chain=s,_.account.set({chain:s}),(r=this.callback)===null||r===void 0||r.call(this,"chainChanged",wt(s.id))),!0):!1}async addSubAccount(t){var n,r,i,a;const o=_.getState().subAccount,c=_.subAccountsConfig.get();if(o!=null&&o.address)return this.accounts=c!=null&&c.enableAutoSubAccounts?on(this.accounts,o.address):cn(this.accounts,o.address),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",this.accounts),o;if(await((i=(r=this.communicator).waitForPopupLoaded)===null||i===void 0?void 0:i.call(r)),Array.isArray(t.params)&&t.params.length>0&&t.params[0].account&&t.params[0].account.type==="create"){let p;if(t.params[0].account.keys&&t.params[0].account.keys.length>0)p=t.params[0].account.keys;else{const d=(a=_.subAccountsConfig.get())!==null&&a!==void 0?a:{},{account:l}=d.toOwnerAccount?await d.toOwnerAccount():await Nr();if(!l)throw S.provider.unauthorized("could not get subaccount owner account when adding sub account");p=[{type:l.address?"address":"webauthn-p256",publicKey:l.address||l.publicKey}]}t.params[0].account.keys=p}const u=await this.sendRequestToPopup(t);return Qt(u),u}shouldRequestUseSubAccountSigner(t){const n=ta(t),r=_.subAccounts.get();return n?n.toLowerCase()===(r==null?void 0:r.address.toLowerCase()):!1}async sendRequestToSubAccountSigner(t){var n;const r=_.subAccounts.get(),i=_.subAccountsConfig.get(),a=_.config.get();ye(r==null?void 0:r.address,S.provider.unauthorized("no active sub account when sending request to sub account signer"));const s=i!=null&&i.toOwnerAccount?await i.toOwnerAccount():await Nr();ye(s==null?void 0:s.account,S.provider.unauthorized("no active sub account owner when sending request to sub account signer")),ta(t)===void 0&&(t=ep(t,r.address));const c=Xa(this.chain.id);ye(c,S.rpc.internal(`client not found for chainId ${this.chain.id} when sending request to sub account signer`));const u=this.accounts.find(h=>h.toLowerCase()!==r.address.toLowerCase());ye(u,S.provider.unauthorized("no global account found when sending request to sub account signer"));const p=lp({attribution:(n=a.preference)===null||n===void 0?void 0:n.attribution,dappOrigin:window.location.origin}),d=s.account.type==="local"?s.account.address:s.account.publicKey;let l=await to({address:r.address,factory:r.factory,factoryData:r.factoryData,publicKey:d,client:c});if(l===-1){const h=Ee.get(t);Bd({method:t.method,correlationId:h});try{l=await Ep({ownerAccount:s.account,globalAccountRequest:this.sendRequestToPopup.bind(this)}),Ld({method:t.method,correlationId:h})}catch(m){return Md({method:t.method,correlationId:h,errorMessage:rt(m)}),S.provider.unauthorized("failed to add sub account owner when sending request to sub account signer")}}const{request:f}=await vp({address:r.address,owner:s.account,client:c,factory:r.factory,factoryData:r.factoryData,parentAddress:u,attribution:p?{suffix:p}:void 0,ownerIndex:l});try{return await f(t)}catch(h){let m;if(Ua(h))m=JSON.parse(h.details);else if(_i(h))m=h;else throw h;if(!(_i(m)&&m.data)||!m.data)throw h;const v=Ee.get(t);jd({method:t.method,correlationId:v});try{const k=await Sp({errorData:m.data,globalAccountAddress:u,subAccountAddress:r.address,client:c,request:t,subAccountRequest:f,globalAccountRequest:this.request.bind(this)});return Nd({method:t.method,correlationId:v}),k}catch(k){throw console.error(k),Dd({method:t.method,correlationId:v,errorMessage:rt(k)}),h}}}}const kp=({method:e,correlationId:t})=>{F("walletlink_signer.handshake.started",{action:H.unknown,componentType:U.unknown,method:e,correlationId:t},G.high)},Ap=({method:e,correlationId:t,errorMessage:n})=>{F("walletlink_signer.handshake.error",{action:H.error,componentType:U.unknown,method:e,correlationId:t,errorMessage:n},G.high)},_p=({method:e,correlationId:t})=>{F("walletlink_signer.handshake.completed",{action:H.unknown,componentType:U.unknown,method:e,correlationId:t},G.high)},Ip=({method:e,correlationId:t})=>{F("walletlink_signer.request.started",{action:H.unknown,componentType:U.unknown,method:e,correlationId:t},G.high)},Op=({method:e,correlationId:t,errorMessage:n})=>{F("walletlink_signer.request.error",{action:H.error,componentType:U.unknown,method:e,correlationId:t,errorMessage:n},G.high)},Pp=({method:e,correlationId:t})=>{F("walletlink_signer.request.completed",{action:H.unknown,componentType:U.unknown,method:e,correlationId:t},G.high)},ia=()=>{F("walletlink_signer.walletlink_connection.connection_failed",{action:H.measurement,componentType:U.unknown},G.high)},Cp=()=>{F("walletlink_signer.walletlink_connection.fetch_unseen_events_failed",{action:H.measurement,componentType:U.unknown},G.high)};var W={},ae={};Object.defineProperty(ae,"__esModule",{value:!0});ae.output=ae.exists=ae.hash=ae.bytes=ae.bool=ae.number=ae.isBytes=void 0;function Pn(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}ae.number=Pn;function ro(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}ae.bool=ro;function io(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}ae.isBytes=io;function ui(e,...t){if(!io(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}ae.bytes=ui;function ao(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Pn(e.outputLen),Pn(e.blockLen)}ae.hash=ao;function so(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}ae.exists=so;function oo(e,t){ui(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}ae.output=oo;const Tp={number:Pn,bool:ro,bytes:ui,hash:ao,exists:so,output:oo};ae.default=Tp;var L={};Object.defineProperty(L,"__esModule",{value:!0});L.add5L=L.add5H=L.add4H=L.add4L=L.add3H=L.add3L=L.add=L.rotlBL=L.rotlBH=L.rotlSL=L.rotlSH=L.rotr32L=L.rotr32H=L.rotrBL=L.rotrBH=L.rotrSL=L.rotrSH=L.shrSL=L.shrSH=L.toBig=L.split=L.fromBig=void 0;const ln=BigInt(2**32-1),Dr=BigInt(32);function di(e,t=!1){return t?{h:Number(e&ln),l:Number(e>>Dr&ln)}:{h:Number(e>>Dr&ln)|0,l:Number(e&ln)|0}}L.fromBig=di;function co(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:a,l:s}=di(e[i],t);[n[i],r[i]]=[a,s]}return[n,r]}L.split=co;const uo=(e,t)=>BigInt(e>>>0)<<Dr|BigInt(t>>>0);L.toBig=uo;const lo=(e,t,n)=>e>>>n;L.shrSH=lo;const fo=(e,t,n)=>e<<32-n|t>>>n;L.shrSL=fo;const po=(e,t,n)=>e>>>n|t<<32-n;L.rotrSH=po;const ho=(e,t,n)=>e<<32-n|t>>>n;L.rotrSL=ho;const mo=(e,t,n)=>e<<64-n|t>>>n-32;L.rotrBH=mo;const yo=(e,t,n)=>e>>>n-32|t<<64-n;L.rotrBL=yo;const go=(e,t)=>t;L.rotr32H=go;const bo=(e,t)=>e;L.rotr32L=bo;const wo=(e,t,n)=>e<<n|t>>>32-n;L.rotlSH=wo;const vo=(e,t,n)=>t<<n|e>>>32-n;L.rotlSL=vo;const xo=(e,t,n)=>t<<n-32|e>>>64-n;L.rotlBH=xo;const Eo=(e,t,n)=>e<<n-32|t>>>64-n;L.rotlBL=Eo;function So(e,t,n,r){const i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:i|0}}L.add=So;const ko=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0);L.add3L=ko;const Ao=(e,t,n,r)=>t+n+r+(e/2**32|0)|0;L.add3H=Ao;const _o=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0);L.add4L=_o;const Io=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0;L.add4H=Io;const Oo=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0);L.add5L=Oo;const Po=(e,t,n,r,i,a)=>t+n+r+i+a+(e/2**32|0)|0;L.add5H=Po;const Bp={fromBig:di,split:co,toBig:uo,shrSH:lo,shrSL:fo,rotrSH:po,rotrSL:ho,rotrBH:mo,rotrBL:yo,rotr32H:go,rotr32L:bo,rotlSH:wo,rotlSL:vo,rotlBH:xo,rotlBL:Eo,add:So,add3L:ko,add3H:Ao,add4L:_o,add4H:Io,add5H:Po,add5L:Oo};L.default=Bp;var Co={},Dn={};Object.defineProperty(Dn,"__esModule",{value:!0});Dn.crypto=void 0;Dn.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;(function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.randomBytes=e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.byteSwap32=e.byteSwapIfBE=e.byteSwap=e.isLE=e.rotl=e.rotr=e.createView=e.u32=e.u8=e.isBytes=void 0;const t=Dn,n=ae;function r(b){return b instanceof Uint8Array||b!=null&&typeof b=="object"&&b.constructor.name==="Uint8Array"}e.isBytes=r;const i=b=>new Uint8Array(b.buffer,b.byteOffset,b.byteLength);e.u8=i;const a=b=>new Uint32Array(b.buffer,b.byteOffset,Math.floor(b.byteLength/4));e.u32=a;const s=b=>new DataView(b.buffer,b.byteOffset,b.byteLength);e.createView=s;const o=(b,y)=>b<<32-y|b>>>y;e.rotr=o;const c=(b,y)=>b<<y|b>>>32-y>>>0;e.rotl=c,e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;const u=b=>b<<24&4278190080|b<<8&16711680|b>>>8&65280|b>>>24&255;e.byteSwap=u,e.byteSwapIfBE=e.isLE?b=>b:b=>(0,e.byteSwap)(b);function p(b){for(let y=0;y<b.length;y++)b[y]=(0,e.byteSwap)(b[y])}e.byteSwap32=p;const d=Array.from({length:256},(b,y)=>y.toString(16).padStart(2,"0"));function l(b){(0,n.bytes)(b);let y="";for(let w=0;w<b.length;w++)y+=d[b[w]];return y}e.bytesToHex=l;const f={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function h(b){if(b>=f._0&&b<=f._9)return b-f._0;if(b>=f._A&&b<=f._F)return b-(f._A-10);if(b>=f._a&&b<=f._f)return b-(f._a-10)}function m(b){if(typeof b!="string")throw new Error("hex string expected, got "+typeof b);const y=b.length,w=y/2;if(y%2)throw new Error("padded hex string expected, got unpadded hex of length "+y);const g=new Uint8Array(w);for(let E=0,I=0;E<w;E++,I+=2){const B=h(b.charCodeAt(I)),T=h(b.charCodeAt(I+1));if(B===void 0||T===void 0){const C=b[I]+b[I+1];throw new Error('hex string expected, got non-hex character "'+C+'" at index '+I)}g[E]=B*16+T}return g}e.hexToBytes=m;const v=async()=>{};e.nextTick=v;async function k(b,y,w){let g=Date.now();for(let E=0;E<b;E++){w(E);const I=Date.now()-g;I>=0&&I<y||(await(0,e.nextTick)(),g+=I)}}e.asyncLoop=k;function P(b){if(typeof b!="string")throw new Error(`utf8ToBytes expected string, got ${typeof b}`);return new Uint8Array(new TextEncoder().encode(b))}e.utf8ToBytes=P;function x(b){return typeof b=="string"&&(b=P(b)),(0,n.bytes)(b),b}e.toBytes=x;function O(...b){let y=0;for(let g=0;g<b.length;g++){const E=b[g];(0,n.bytes)(E),y+=E.length}const w=new Uint8Array(y);for(let g=0,E=0;g<b.length;g++){const I=b[g];w.set(I,E),E+=I.length}return w}e.concatBytes=O;class N{clone(){return this._cloneInto()}}e.Hash=N;const ee={}.toString;function te(b,y){if(y!==void 0&&ee.call(y)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(b,y)}e.checkOpts=te;function V(b){const y=g=>b().update(x(g)).digest(),w=b();return y.outputLen=w.outputLen,y.blockLen=w.blockLen,y.create=()=>b(),y}e.wrapConstructor=V;function A(b){const y=(g,E)=>b(E).update(x(g)).digest(),w=b({});return y.outputLen=w.outputLen,y.blockLen=w.blockLen,y.create=g=>b(g),y}e.wrapConstructorWithOpts=A;function z(b){const y=(g,E)=>b(E).update(x(g)).digest(),w=b({});return y.outputLen=w.outputLen,y.blockLen=w.blockLen,y.create=g=>b(g),y}e.wrapXOFConstructorWithOpts=z;function ie(b=32){if(t.crypto&&typeof t.crypto.getRandomValues=="function")return t.crypto.getRandomValues(new Uint8Array(b));throw new Error("crypto.getRandomValues must be defined")}e.randomBytes=ie})(Co);Object.defineProperty(W,"__esModule",{value:!0});W.shake256=W.shake128=W.keccak_512=W.keccak_384=W.keccak_256=W.keccak_224=W.sha3_512=W.sha3_384=W.sha3_256=W.sha3_224=W.Keccak=W.keccakP=void 0;const gt=ae,Wt=L,Me=Co,To=[],Bo=[],Lo=[],Lp=BigInt(0),Dt=BigInt(1),Mp=BigInt(2),jp=BigInt(7),Np=BigInt(256),Dp=BigInt(113);for(let e=0,t=Dt,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],To.push(2*(5*r+n)),Bo.push((e+1)*(e+2)/2%64);let i=Lp;for(let a=0;a<7;a++)t=(t<<Dt^(t>>jp)*Dp)%Np,t&Mp&&(i^=Dt<<(Dt<<BigInt(a))-Dt);Lo.push(i)}const[Rp,Up]=(0,Wt.split)(Lo,!0),aa=(e,t,n)=>n>32?(0,Wt.rotlBH)(e,t,n):(0,Wt.rotlSH)(e,t,n),sa=(e,t,n)=>n>32?(0,Wt.rotlBL)(e,t,n):(0,Wt.rotlSL)(e,t,n);function Mo(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let s=0;s<10;s++)n[s]=e[s]^e[s+10]^e[s+20]^e[s+30]^e[s+40];for(let s=0;s<10;s+=2){const o=(s+8)%10,c=(s+2)%10,u=n[c],p=n[c+1],d=aa(u,p,1)^n[o],l=sa(u,p,1)^n[o+1];for(let f=0;f<50;f+=10)e[s+f]^=d,e[s+f+1]^=l}let i=e[2],a=e[3];for(let s=0;s<24;s++){const o=Bo[s],c=aa(i,a,o),u=sa(i,a,o),p=To[s];i=e[p],a=e[p+1],e[p]=c,e[p+1]=u}for(let s=0;s<50;s+=10){for(let o=0;o<10;o++)n[o]=e[s+o];for(let o=0;o<10;o++)e[s+o]^=~n[(o+2)%10]&n[(o+4)%10]}e[0]^=Rp[r],e[1]^=Up[r]}n.fill(0)}W.keccakP=Mo;class Kt extends Me.Hash{constructor(t,n,r,i=!1,a=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=i,this.rounds=a,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,gt.number)(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,Me.u32)(this.state)}keccak(){Me.isLE||(0,Me.byteSwap32)(this.state32),Mo(this.state32,this.rounds),Me.isLE||(0,Me.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(t){(0,gt.exists)(this);const{blockLen:n,state:r}=this;t=(0,Me.toBytes)(t);const i=t.length;for(let a=0;a<i;){const s=Math.min(n-this.pos,i-a);for(let o=0;o<s;o++)r[this.pos++]^=t[a++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:i}=this;t[r]^=n,n&128&&r===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){(0,gt.exists)(this,!1),(0,gt.bytes)(t),this.finish();const n=this.state,{blockLen:r}=this;for(let i=0,a=t.length;i<a;){this.posOut>=r&&this.keccak();const s=Math.min(r-this.posOut,a-i);t.set(n.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return(0,gt.number)(t),this.xofInto(new Uint8Array(t))}digestInto(t){if((0,gt.output)(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:i,rounds:a,enableXOF:s}=this;return t||(t=new Kt(n,r,i,s,a)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=a,t.suffix=r,t.outputLen=i,t.enableXOF=s,t.destroyed=this.destroyed,t}}W.Keccak=Kt;const tt=(e,t,n)=>(0,Me.wrapConstructor)(()=>new Kt(t,e,n));W.sha3_224=tt(6,144,224/8);W.sha3_256=tt(6,136,256/8);W.sha3_384=tt(6,104,384/8);W.sha3_512=tt(6,72,512/8);W.keccak_224=tt(1,144,224/8);W.keccak_256=tt(1,136,256/8);W.keccak_384=tt(1,104,384/8);W.keccak_512=tt(1,72,512/8);const jo=(e,t,n)=>(0,Me.wrapXOFConstructorWithOpts)((r={})=>new Kt(t,e,r.dkLen===void 0?n:r.dkLen,!0));W.shake128=jo(31,168,128/8);W.shake256=jo(31,136,256/8);const{keccak_256:Hp}=W;function No(e){return Buffer.allocUnsafe(e).fill(0)}function Gp(e){return`0x${e.toString(16)}`}function Fp(e){const t=Gp(e);return new Buffer(Uo(t.slice(2)),"hex")}function zp(e){return e.toString(2).length}function Do(e,t){let n=e.toString(16);n.length%2!==0&&(n="0"+n);const r=n.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;r.length<t;)r.unshift(0);return Buffer.from(r)}function $p(e,t){const n=e<0n;let r;if(n){const i=(1n<<BigInt(t))-1n;r=(~e&i)+1n}else r=e;return r&=(1n<<BigInt(t))-1n,r}function Ro(e,t,n){const r=No(t);return e=Rn(e),n?e.length<t?(e.copy(r),r):e.slice(0,t):e.length<t?(e.copy(r,t-e.length),r):e.slice(-t)}function qp(e,t){return Ro(e,t,!0)}function Rn(e){if(!Buffer.isBuffer(e))if(Array.isArray(e))e=Buffer.from(e);else if(typeof e=="string")Ho(e)?e=Buffer.from(Uo(Go(e)),"hex"):e=Buffer.from(e);else if(typeof e=="number")e=Fp(e);else if(e==null)e=Buffer.allocUnsafe(0);else if(typeof e=="bigint")e=Do(e);else if(e.toArray)e=Buffer.from(e.toArray());else throw new Error("invalid type");return e}function Wp(e){return e=Rn(e),"0x"+e.toString("hex")}function Vp(e,t){if(e=Rn(e),t||(t=256),t!==256)throw new Error("unsupported");return Buffer.from(Hp(new Uint8Array(e)))}function Uo(e){return e.length%2?"0"+e:e}function Ho(e){return typeof e=="string"&&e.match(/^0x[0-9A-Fa-f]*$/)}function Go(e){return typeof e=="string"&&e.startsWith("0x")?e.slice(2):e}var Fo={zeros:No,setLength:Ro,setLengthRight:qp,isHexString:Ho,stripHexPrefix:Go,toBuffer:Rn,bufferToHex:Wp,keccak:Vp,bitLengthFromBigInt:zp,bufferBEFromBigInt:Do,twosFromBigInt:$p};const de=Fo;function zo(e){return e.startsWith("int[")?"int256"+e.slice(3):e==="int"?"int256":e.startsWith("uint[")?"uint256"+e.slice(4):e==="uint"?"uint256":e.startsWith("fixed[")?"fixed128x128"+e.slice(5):e==="fixed"?"fixed128x128":e.startsWith("ufixed[")?"ufixed128x128"+e.slice(6):e==="ufixed"?"ufixed128x128":e}function _t(e){return Number.parseInt(/^\D+(\d+)$/.exec(e)[1],10)}function oa(e){var t=/^\D+(\d+)x(\d+)$/.exec(e);return[Number.parseInt(t[1],10),Number.parseInt(t[2],10)]}function $o(e){var t=e.match(/(.*)\[(.*?)\]$/);return t?t[2]===""?"dynamic":Number.parseInt(t[2],10):null}function it(e){var t=typeof e;if(t==="string"||t==="number")return BigInt(e);if(t==="bigint")return e;throw new Error("Argument is not a number")}function Oe(e,t){var n,r,i,a;if(e==="address")return Oe("uint160",it(t));if(e==="bool")return Oe("uint8",t?1:0);if(e==="string")return Oe("bytes",new Buffer(t,"utf8"));if(Zp(e)){if(typeof t.length>"u")throw new Error("Not an array?");if(n=$o(e),n!=="dynamic"&&n!==0&&t.length>n)throw new Error("Elements exceed array size: "+n);i=[],e=e.slice(0,e.lastIndexOf("[")),typeof t=="string"&&(t=JSON.parse(t));for(a in t)i.push(Oe(e,t[a]));if(n==="dynamic"){var s=Oe("uint256",t.length);i.unshift(s)}return Buffer.concat(i)}else{if(e==="bytes")return t=new Buffer(t),i=Buffer.concat([Oe("uint256",t.length),t]),t.length%32!==0&&(i=Buffer.concat([i,de.zeros(32-t.length%32)])),i;if(e.startsWith("bytes")){if(n=_t(e),n<1||n>32)throw new Error("Invalid bytes<N> width: "+n);return de.setLengthRight(t,32)}else if(e.startsWith("uint")){if(n=_t(e),n%8||n<8||n>256)throw new Error("Invalid uint<N> width: "+n);r=it(t);const o=de.bitLengthFromBigInt(r);if(o>n)throw new Error("Supplied uint exceeds width: "+n+" vs "+o);if(r<0)throw new Error("Supplied uint is negative");return de.bufferBEFromBigInt(r,32)}else if(e.startsWith("int")){if(n=_t(e),n%8||n<8||n>256)throw new Error("Invalid int<N> width: "+n);r=it(t);const o=de.bitLengthFromBigInt(r);if(o>n)throw new Error("Supplied int exceeds width: "+n+" vs "+o);const c=de.twosFromBigInt(r,256);return de.bufferBEFromBigInt(c,32)}else if(e.startsWith("ufixed")){if(n=oa(e),r=it(t),r<0)throw new Error("Supplied ufixed is negative");return Oe("uint256",r*BigInt(2)**BigInt(n[1]))}else if(e.startsWith("fixed"))return n=oa(e),Oe("int256",it(t)*BigInt(2)**BigInt(n[1]))}throw new Error("Unsupported or invalid type: "+e)}function Kp(e){return e==="string"||e==="bytes"||$o(e)==="dynamic"}function Zp(e){return e.lastIndexOf("]")===e.length-1}function Yp(e,t){var n=[],r=[],i=32*e.length;for(var a in e){var s=zo(e[a]),o=t[a],c=Oe(s,o);Kp(s)?(n.push(Oe("uint256",i)),r.push(c),i+=c.length):n.push(c)}return Buffer.concat(n.concat(r))}function qo(e,t){if(e.length!==t.length)throw new Error("Number of types are not matching the values");for(var n,r,i=[],a=0;a<e.length;a++){var s=zo(e[a]),o=t[a];if(s==="bytes")i.push(o);else if(s==="string")i.push(new Buffer(o,"utf8"));else if(s==="bool")i.push(new Buffer(o?"01":"00","hex"));else if(s==="address")i.push(de.setLength(o,20));else if(s.startsWith("bytes")){if(n=_t(s),n<1||n>32)throw new Error("Invalid bytes<N> width: "+n);i.push(de.setLengthRight(o,n))}else if(s.startsWith("uint")){if(n=_t(s),n%8||n<8||n>256)throw new Error("Invalid uint<N> width: "+n);r=it(o);const c=de.bitLengthFromBigInt(r);if(c>n)throw new Error("Supplied uint exceeds width: "+n+" vs "+c);i.push(de.bufferBEFromBigInt(r,n/8))}else if(s.startsWith("int")){if(n=_t(s),n%8||n<8||n>256)throw new Error("Invalid int<N> width: "+n);r=it(o);const c=de.bitLengthFromBigInt(r);if(c>n)throw new Error("Supplied int exceeds width: "+n+" vs "+c);const u=de.twosFromBigInt(r,n);i.push(de.bufferBEFromBigInt(u,n/8))}else throw new Error("Unsupported or invalid type: "+s)}return Buffer.concat(i)}function Jp(e,t){return de.keccak(qo(e,t))}var Qp={rawEncode:Yp,solidityPack:qo,soliditySHA3:Jp};const ve=Fo,zt=Qp,Wo={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},Xn={encodeData(e,t,n,r=!0){const i=["bytes32"],a=[this.hashType(e,n)];if(r){const s=(o,c,u)=>{if(n[c]!==void 0)return["bytes32",u==null?"0x0000000000000000000000000000000000000000000000000000000000000000":ve.keccak(this.encodeData(c,u,n,r))];if(u===void 0)throw new Error(`missing value for field ${o} of type ${c}`);if(c==="bytes")return["bytes32",ve.keccak(u)];if(c==="string")return typeof u=="string"&&(u=Buffer.from(u,"utf8")),["bytes32",ve.keccak(u)];if(c.lastIndexOf("]")===c.length-1){const p=c.slice(0,c.lastIndexOf("[")),d=u.map(l=>s(o,p,l));return["bytes32",ve.keccak(zt.rawEncode(d.map(([l])=>l),d.map(([,l])=>l)))]}return[c,u]};for(const o of n[e]){const[c,u]=s(o.name,o.type,t[o.name]);i.push(c),a.push(u)}}else for(const s of n[e]){let o=t[s.name];if(o!==void 0)if(s.type==="bytes")i.push("bytes32"),o=ve.keccak(o),a.push(o);else if(s.type==="string")i.push("bytes32"),typeof o=="string"&&(o=Buffer.from(o,"utf8")),o=ve.keccak(o),a.push(o);else if(n[s.type]!==void 0)i.push("bytes32"),o=ve.keccak(this.encodeData(s.type,o,n,r)),a.push(o);else{if(s.type.lastIndexOf("]")===s.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(s.type),a.push(o)}}return zt.rawEncode(i,a)},encodeType(e,t){let n="",r=this.findTypeDependencies(e,t).filter(i=>i!==e);r=[e].concat(r.sort());for(const i of r){if(!t[i])throw new Error("No type definition specified: "+i);n+=i+"("+t[i].map(({name:s,type:o})=>o+" "+s).join(",")+")"}return n},findTypeDependencies(e,t,n=[]){if(e=e.match(/^\w*/)[0],n.includes(e)||t[e]===void 0)return n;n.push(e);for(const r of t[e])for(const i of this.findTypeDependencies(r.type,t,n))!n.includes(i)&&n.push(i);return n},hashStruct(e,t,n,r=!0){return ve.keccak(this.encodeData(e,t,n,r))},hashType(e,t){return ve.keccak(this.encodeType(e,t))},sanitizeData(e){const t={};for(const n in Wo.properties)e[n]&&(t[n]=e[n]);return t.types&&(t.types=Object.assign({EIP712Domain:[]},t.types)),t},hash(e,t=!0){const n=this.sanitizeData(e),r=[Buffer.from("1901","hex")];return r.push(this.hashStruct("EIP712Domain",n.domain,n.types,t)),n.primaryType!=="EIP712Domain"&&r.push(this.hashStruct(n.primaryType,n.message,n.types,t)),ve.keccak(Buffer.concat(r))}};var Xp={TYPED_MESSAGE_SCHEMA:Wo,TypedDataUtils:Xn,hashForSignTypedDataLegacy:function(e){return eh(e.data)},hashForSignTypedData_v3:function(e){return Xn.hash(e.data,!1)},hashForSignTypedData_v4:function(e){return Xn.hash(e.data)}};function eh(e){const t=new Error("Expect argument to be non-empty array");if(typeof e!="object"||!e.length)throw t;const n=e.map(function(a){return a.type==="bytes"?ve.toBuffer(a.value):a.value}),r=e.map(function(a){return a.type}),i=e.map(function(a){if(!a.name)throw t;return a.type+" "+a.name});return zt.soliditySHA3(["bytes32","bytes32"],[zt.soliditySHA3(new Array(e.length).fill("string"),i),zt.soliditySHA3(r,n)])}const fn=Oc(Xp),th="walletUsername",Rr="Addresses",nh="AppVersion";class rh{constructor(t){this.secret=t}async encrypt(t){const n=this.secret;if(n.length!==64)throw new Error("secret must be 256 bits");const r=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",pn(n),{name:"aes-gcm"},!1,["encrypt","decrypt"]),a=new TextEncoder,s=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:r},i,a.encode(t)),o=16,c=s.slice(s.byteLength-o),u=s.slice(0,s.byteLength-o),p=new Uint8Array(c),d=new Uint8Array(u),l=new Uint8Array([...r,...p,...d]);return Wr(l)}async decrypt(t){const n=this.secret;if(n.length!==64)throw new Error("secret must be 256 bits");return new Promise((r,i)=>{(async()=>{const a=await crypto.subtle.importKey("raw",pn(n),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=pn(t),o=s.slice(0,12),c=s.slice(12,28),u=s.slice(28),p=new Uint8Array([...u,...c]),d={name:"AES-GCM",iv:new Uint8Array(o)};try{const l=await window.crypto.subtle.decrypt(d,a,p),f=new TextDecoder;r(f.decode(l))}catch(l){i(l)}})()})}}class ih{constructor(t,n,r){this.linkAPIUrl=t,this.sessionId=n;const i=`${n}:${r}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(t){return Promise.all(t.map(n=>fetch(`${this.linkAPIUrl}/events/${n.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(n=>console.error("Unable to mark events as seen:",n))}async fetchUnseenEvents(){var t;const n=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(n.ok){const{events:r,error:i}=await n.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const a=(t=r==null?void 0:r.filter(s=>s.event==="Web3Response").map(s=>({type:"Event",sessionId:this.sessionId,eventId:s.id,event:s.event,data:s.data})))!==null&&t!==void 0?t:[];return this.markUnseenEventsAsSeen(a),a}throw new Error(`Check unseen events failed: ${n.status}`)}}var Pe;(function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED"})(Pe||(Pe={}));class me{setConnectionStateListener(t){this.connectionStateListener=t}setIncomingDataListener(t){this.incomingDataListener=t}constructor(t,n=WebSocket){this.WebSocketClass=n,this.webSocket=null,this.isDisconnecting=!1,this.url=t.replace(/^http/,"ws"),this.instanceId=me.instanceCounter++,me.activeInstances.add(this.instanceId)}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");if(this.isDisconnecting)throw new Error("WebSocket is disconnecting, cannot reconnect on same instance");return new Promise((t,n)=>{var r;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(a){n(a);return}(r=this.connectionStateListener)===null||r===void 0||r.call(this,Pe.CONNECTING),i.onclose=a=>{var s;this.clearWebSocket(),i.readyState!==WebSocket.OPEN&&n(new Error(`websocket error ${a.code}: ${a.reason}`)),(s=this.connectionStateListener)===null||s===void 0||s.call(this,Pe.DISCONNECTED)},i.onopen=a=>{var s;t(),(s=this.connectionStateListener)===null||s===void 0||s.call(this,Pe.CONNECTED),me.pendingData.length>0&&([...me.pendingData].forEach(c=>this.sendData(c)),me.pendingData=[])},i.onmessage=a=>{var s,o;if(a.data==="h")(s=this.incomingDataListener)===null||s===void 0||s.call(this,{type:"Heartbeat"});else try{const c=JSON.parse(a.data);(o=this.incomingDataListener)===null||o===void 0||o.call(this,c)}catch{}}})}disconnect(){var t;const{webSocket:n}=this;if(n){this.isDisconnecting=!0,this.clearWebSocket(),(t=this.connectionStateListener)===null||t===void 0||t.call(this,Pe.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{n.close()}catch{}}}sendData(t){const{webSocket:n}=this;if(!n){me.pendingData.push(t),this.isDisconnecting||this.connect();return}if(n.readyState!==WebSocket.OPEN){me.pendingData.push(t);return}n.send(t)}clearWebSocket(){const{webSocket:t}=this;t&&(this.webSocket=null,t.onclose=null,t.onerror=null,t.onmessage=null,t.onopen=null)}cleanup(){me.activeInstances.delete(this.instanceId)}}me.instanceCounter=0;me.activeInstances=new Set;me.pendingData=[];const ca=1e4,ah=6e4;class sh{constructor({session:t,linkAPIUrl:n,listener:r}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=je(1),this.reconnectAttempts=0,this.isReconnecting=!1,this._connected=!1,this._linked=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=a=>{if(!a)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",o=>a.JsonRpcUrl&&this.handleChainUpdated(o,a.JsonRpcUrl)]]).forEach((o,c)=>{const u=a[c];u!==void 0&&o(u)})},this.handleDestroyed=a=>{var s;a==="1"&&((s=this.listener)===null||s===void 0||s.resetAndReload())},this.handleAccountUpdated=async a=>{var s;try{const o=await this.cipher.decrypt(a);(s=this.listener)===null||s===void 0||s.accountUpdated(o)}catch{}},this.handleMetadataUpdated=async(a,s)=>{var o;try{const c=await this.cipher.decrypt(s);(o=this.listener)===null||o===void 0||o.metadataUpdated(a,c)}catch{}},this.handleWalletUsernameUpdated=async a=>{this.handleMetadataUpdated(th,a)},this.handleAppVersionUpdated=async a=>{this.handleMetadataUpdated(nh,a)},this.handleChainUpdated=async(a,s)=>{var o;try{const c=await this.cipher.decrypt(a),u=await this.cipher.decrypt(s);(o=this.listener)===null||o===void 0||o.chainUpdated(c,u)}catch{}},this.session=t,this.cipher=new rh(t.secret),this.listener=r,this.linkAPIUrl=n,this.WebSocketClass=WebSocket;const i=this.createWebSocket();this.ws=i,this.http=new ih(n,t.id,t.key),this.setupVisibilityChangeHandler()}createWebSocket(){const t=new me(`${this.linkAPIUrl}/rpc`,this.WebSocketClass);return this.activeWsInstance=t,t.setConnectionStateListener(async n=>{if(t!==this.activeWsInstance)return;let r=!1;switch(n){case Pe.DISCONNECTED:this.heartbeatIntervalId&&(clearInterval(this.heartbeatIntervalId),this.heartbeatIntervalId=void 0),this.lastHeartbeatResponse=0,r=!1,this.destroyed||(async()=>{if(this.isReconnecting)return;this.isReconnecting=!0;const a=this.reconnectAttempts===0?0:3e3;await new Promise(s=>setTimeout(s,a)),!this.destroyed&&t===this.activeWsInstance?(this.reconnectAttempts++,"cleanup"in this.ws&&typeof this.ws.cleanup=="function"&&this.ws.cleanup(),this.ws=this.createWebSocket(),this.ws.connect().catch(()=>{ia()}).finally(()=>{this.isReconnecting=!1})):this.isReconnecting=!1})();break;case Pe.CONNECTED:this.reconnectAttempts=0;try{r=await this.handleConnected(),this.fetchUnseenEventsAPI().catch(()=>{})}catch{break}this.connected=r,this.updateLastHeartbeat(),this.heartbeatIntervalId&&clearInterval(this.heartbeatIntervalId),this.heartbeatIntervalId=window.setInterval(()=>{this.heartbeat()},ca),setTimeout(()=>{this.heartbeat()},100);break;case Pe.CONNECTING:break}n!==Pe.CONNECTED&&(this.connected=r)}),t.setIncomingDataListener(n=>{var r;switch(n.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const i=n.type==="IsLinkedOK"?n.linked:void 0;this.linked=i||n.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(n.metadata);break}case"Event":{this.handleIncomingEvent(n);break}}n.id!==void 0&&((r=this.requestResolutions.get(n.id))===null||r===void 0||r(n))}),t}setupVisibilityChangeHandler(){this.visibilityChangeHandler=()=>{!document.hidden&&!this.destroyed&&(this.connected?this.heartbeat():this.reconnectWithFreshWebSocket())},this.focusHandler=()=>{!this.destroyed&&!this.connected&&this.reconnectWithFreshWebSocket()},document.addEventListener("visibilitychange",this.visibilityChangeHandler),window.addEventListener("focus",this.focusHandler),window.addEventListener("pageshow",t=>{t.persisted&&this.focusHandler&&this.focusHandler()})}reconnectWithFreshWebSocket(){if(this.destroyed)return;const t=this.ws;this.activeWsInstance=void 0,t.disconnect(),"cleanup"in t&&typeof t.cleanup=="function"&&t.cleanup(),this.ws=this.createWebSocket(),this.ws.connect().catch(()=>{ia()})}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:je(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.activeWsInstance=void 0,this.heartbeatIntervalId&&(clearInterval(this.heartbeatIntervalId),this.heartbeatIntervalId=void 0),this.visibilityChangeHandler&&document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.focusHandler&&window.removeEventListener("focus",this.focusHandler),this.ws.disconnect(),"cleanup"in this.ws&&typeof this.ws.cleanup=="function"&&this.ws.cleanup(),this.listener=void 0)}get connected(){return this._connected}set connected(t){this._connected=t}get linked(){return this._linked}set linked(t){var n,r;this._linked=t,t&&((n=this.onceLinked)===null||n===void 0||n.call(this)),(r=this.listener)===null||r===void 0||r.linkedUpdated(t)}setOnceLinked(t){return new Promise(n=>{this.linked?t().then(n):this.onceLinked=()=>{t().then(n),this.onceLinked=void 0}})}async handleIncomingEvent(t){var n;if(!(t.type!=="Event"||t.event!=="Web3Response"))try{const r=await this.cipher.decrypt(t.data),i=JSON.parse(r);if(i.type!=="WEB3_RESPONSE")return;(n=this.listener)===null||n===void 0||n.handleWeb3ResponseMessage(i.id,i.response)}catch{}}async checkUnseenEvents(){await new Promise(t=>setTimeout(t,250));try{await this.fetchUnseenEventsAPI()}catch(t){console.error("Unable to check for unseen events",t)}}async fetchUnseenEventsAPI(){try{(await this.http.fetchUnseenEvents()).forEach(n=>{this.handleIncomingEvent(n)})}catch{Cp()}}async publishEvent(t,n,r=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},n),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),a={type:"PublishEvent",id:je(this.nextReqId++),sessionId:this.session.id,event:t,data:i,callWebhook:r};return this.setOnceLinked(async()=>{const s=await this.makeRequest(a);if(s.type==="Fail")throw new Error(s.error||"failed to publish event");return s.eventId})}sendData(t){this.ws.sendData(JSON.stringify(t))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>ca*2){this.ws.disconnect();return}if(this.connected)try{this.ws.sendData("h")}catch{}}async makeRequest(t,n={timeout:ah}){const r=t.id;this.sendData(t);let i;return Promise.race([new Promise((a,s)=>{i=window.setTimeout(()=>{s(new Error(`request ${r} timed out`))},n.timeout)}),new Promise(a=>{this.requestResolutions.set(r,s=>{clearTimeout(i),a(s),this.requestResolutions.delete(r)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:je(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:je(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:je(this.nextReqId++),sessionId:this.session.id}),!0)}}class oh{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const t=this._nextRequestId,n=$a(t.toString(16));return this.callbacks.get(n)&&this.callbacks.delete(n),t}}function ch(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function li(e,...t){if(!ch(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function ua(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function uh(e,t){li(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const er=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),Ie=(e,t)=>e<<32-t|e>>>t;new Uint8Array(new Uint32Array([287454020]).buffer)[0];const dh=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function lh(e){li(e);let t="";for(let n=0;n<e.length;n++)t+=dh[e[n]];return t}function fh(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Vo(e){return typeof e=="string"&&(e=fh(e)),li(e),e}class ph{clone(){return this._cloneInto()}}function hh(e){const t=r=>e().update(Vo(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function mh(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const i=BigInt(32),a=BigInt(4294967295),s=Number(n>>i&a),o=Number(n&a),c=r?4:0,u=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+u,o,r)}const yh=(e,t,n)=>e&t^~e&n,gh=(e,t,n)=>e&t^e&n^t&n;class bh extends ph{constructor(t,n,r,i){super(),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=er(this.buffer)}update(t){ua(this);const{view:n,buffer:r,blockLen:i}=this;t=Vo(t);const a=t.length;for(let s=0;s<a;){const o=Math.min(i-this.pos,a-s);if(o===i){const c=er(t);for(;i<=a-s;s+=i)this.process(c,s);continue}r.set(t.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){ua(this),uh(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:a}=this;let{pos:s}=this;n[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>i-s&&(this.process(r,0),s=0);for(let d=s;d<i;d++)n[d]=0;mh(r,i-8,BigInt(this.length*8),a),this.process(r,0);const o=er(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,p=this.get();if(u>p.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)o.setUint32(4*d,p[d],a)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:i,finished:a,destroyed:s,pos:o}=this;return t.length=i,t.pos=o,t.finished=a,t.destroyed=s,i%n&&t.buffer.set(r),t}}const wh=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ke=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ze=new Uint32Array(64);class vh extends bh{constructor(){super(64,32,8,!1),this.A=Ke[0]|0,this.B=Ke[1]|0,this.C=Ke[2]|0,this.D=Ke[3]|0,this.E=Ke[4]|0,this.F=Ke[5]|0,this.G=Ke[6]|0,this.H=Ke[7]|0}get(){const{A:t,B:n,C:r,D:i,E:a,F:s,G:o,H:c}=this;return[t,n,r,i,a,s,o,c]}set(t,n,r,i,a,s,o,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=a|0,this.F=s|0,this.G=o|0,this.H=c|0}process(t,n){for(let d=0;d<16;d++,n+=4)Ze[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const l=Ze[d-15],f=Ze[d-2],h=Ie(l,7)^Ie(l,18)^l>>>3,m=Ie(f,17)^Ie(f,19)^f>>>10;Ze[d]=m+Ze[d-7]+h+Ze[d-16]|0}let{A:r,B:i,C:a,D:s,E:o,F:c,G:u,H:p}=this;for(let d=0;d<64;d++){const l=Ie(o,6)^Ie(o,11)^Ie(o,25),f=p+l+yh(o,c,u)+wh[d]+Ze[d]|0,m=(Ie(r,2)^Ie(r,13)^Ie(r,22))+gh(r,i,a)|0;p=u,u=c,c=o,o=s+f|0,s=a,a=i,i=r,r=f+m|0}r=r+this.A|0,i=i+this.B|0,a=a+this.C|0,s=s+this.D|0,o=o+this.E|0,c=c+this.F|0,u=u+this.G|0,p=p+this.H|0,this.set(r,i,a,s,o,c,u,p)}roundClean(){Ze.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const xh=hh(()=>new vh),da="session:id",la="session:secret",fa="session:linked";class It{constructor(t,n,r,i=!1){this.storage=t,this.id=n,this.secret=r,this.key=lh(xh(`${n}, ${r} WalletLink`)),this._linked=!!i}static create(t){const n=nt(16),r=nt(32);return new It(t,n,r).save()}static load(t){const n=t.getItem(da),r=t.getItem(fa),i=t.getItem(la);return n&&i?new It(t,n,i,r==="1"):null}get linked(){return this._linked}set linked(t){this._linked=t,this.persistLinked()}save(){return this.storage.setItem(da,this.id),this.storage.setItem(la,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(fa,this._linked?"1":"0")}}const Eh=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";class Sh{constructor(){this.root=null,this.darkMode=Ka()}attach(){const t=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",t.appendChild(this.root),Wa()}present(t){this.render(t)}clear(){this.render(null)}render(t){this.root&&(tr(null,this.root),t&&tr(q(kh,Object.assign({},t,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const kh=({title:e,buttonText:t,darkMode:n,onButtonClick:r,onDismiss:i})=>{const a=n?"dark":"light";return q(Ya,{darkMode:n},q("div",{class:"-cbwsdk-redirect-dialog"},q("style",null,Eh),q("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),q("div",{class:Ft("-cbwsdk-redirect-dialog-box",a)},q("p",null,e),q("button",{onClick:r},t))))};class pa{constructor(){this.attached=!1,this.redirectDialog=new Sh}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(t){const n=new URL(Ku);n.searchParams.append("redirect_url",ed().href),t&&n.searchParams.append("wl_url",t);const r=document.createElement("a");r.target="cbw-opener",r.href=n.href,r.rel="noreferrer noopener",r.click()}openCoinbaseWalletDeeplink(t){this.redirectToCoinbaseWallet(t),setTimeout(()=>{this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(t)}})},99)}showConnecting(t){return()=>{this.redirectDialog.clear()}}}class De{constructor(t){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=td(),this.linkedUpdated=a=>{this.isLinked=a;const s=this.storage.getItem(Rr);if(a&&(this._session.linked=a),this.isUnlinkedErrorState=!1,s){const o=s.split(" "),c=this.storage.getItem("IsStandaloneSigning")==="true";o[0]!==""&&!a&&this._session.linked&&!c&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(a,s)=>{this.storage.setItem(a,s)},this.chainUpdated=(a,s)=>{this.chainCallbackParams.chainId===a&&this.chainCallbackParams.jsonRpcUrl===s||(this.chainCallbackParams={chainId:a,jsonRpcUrl:s},this.chainCallback&&this.chainCallback(s,Number.parseInt(a,10)))},this.accountUpdated=a=>{this.accountsCallback&&this.accountsCallback([a]),De.accountRequestCallbackIds.size>0&&(Array.from(De.accountRequestCallbackIds.values()).forEach(s=>{this.invokeCallback(s,{method:"requestEthereumAccounts",result:[a]})}),De.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=t.linkAPIUrl,this.storage=t.storage,this.metadata=t.metadata,this.accountsCallback=t.accountsCallback,this.chainCallback=t.chainCallback;const{session:n,ui:r,connection:i}=this.subscribe();this._session=n,this.connection=i,this.relayEventManager=new oh,this.ui=r,this.ui.attach()}subscribe(){const t=It.load(this.storage)||It.create(this.storage),{linkAPIUrl:n}=this,r=new sh({session:t,linkAPIUrl:n,listener:this}),i=this.isMobileWeb?new pa:new sd;return r.connect(),{session:t,ui:i,connection:r}}resetAndReload(){this.connection.destroy().then(()=>{const t=It.load(this.storage);(t==null?void 0:t.id)===this._session.id&&dt.clearAll(),document.location.reload()}).catch(t=>{})}signEthereumTransaction(t){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:t.fromAddress,toAddress:t.toAddress,weiValue:ke(t.weiValue),data:Ut(t.data,!0),nonce:t.nonce,gasPriceInWei:t.gasPriceInWei?ke(t.gasPriceInWei):null,maxFeePerGas:t.gasPriceInWei?ke(t.gasPriceInWei):null,maxPriorityFeePerGas:t.gasPriceInWei?ke(t.gasPriceInWei):null,gasLimit:t.gasLimit?ke(t.gasLimit):null,chainId:t.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(t){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:t.fromAddress,toAddress:t.toAddress,weiValue:ke(t.weiValue),data:Ut(t.data,!0),nonce:t.nonce,gasPriceInWei:t.gasPriceInWei?ke(t.gasPriceInWei):null,maxFeePerGas:t.maxFeePerGas?ke(t.maxFeePerGas):null,maxPriorityFeePerGas:t.maxPriorityFeePerGas?ke(t.maxPriorityFeePerGas):null,gasLimit:t.gasLimit?ke(t.gasLimit):null,chainId:t.chainId,shouldSubmit:!0}})}submitEthereumTransaction(t,n){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:Ut(t,!0),chainId:n}})}getWalletLinkSession(){return this._session}sendRequest(t){let n=null;const r=nt(8),i=a=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,t.method,a),n==null||n()};return new Promise((a,s)=>{n=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(r,o=>{if(n==null||n(),se(o))return s(new Error(o.errorMessage));a(o)}),this.publishWeb3RequestEvent(r,t)})}publishWeb3RequestEvent(t,n){const r={type:"WEB3_REQUEST",id:t,request:n};this.publishEvent("Web3Request",r,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(r.id,{method:n.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(n.method)}openCoinbaseWalletDeeplink(t){if(this.ui instanceof pa)switch(t){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(t){const n={type:"WEB3_REQUEST_CANCELED",id:t};this.publishEvent("Web3RequestCanceled",n,!1).then()}publishEvent(t,n,r){return this.connection.publishEvent(t,n,r)}handleWeb3ResponseMessage(t,n){if(n.method==="requestEthereumAccounts"){De.accountRequestCallbackIds.forEach(r=>this.invokeCallback(r,n)),De.accountRequestCallbackIds.clear();return}this.invokeCallback(t,n)}handleErrorResponse(t,n,r){var i;const a=(i=r==null?void 0:r.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(t,{method:n,errorMessage:a})}invokeCallback(t,n){const r=this.relayEventManager.callbacks.get(t);r&&(r(n),this.relayEventManager.callbacks.delete(t))}requestEthereumAccounts(){const{appName:t,appLogoUrl:n}=this.metadata,r={method:"requestEthereumAccounts",params:{appName:t,appLogoUrl:n}},i=nt(8);return new Promise((a,s)=>{this.relayEventManager.callbacks.set(i,o=>{if(se(o))return s(new Error(o.errorMessage));a(o)}),De.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,r)})}watchAsset(t,n,r,i,a,s){const o={method:"watchAsset",params:{type:t,options:{address:n,symbol:r,decimals:i,image:a},chainId:s}};let c=null;const u=nt(8),p=d=>{this.publishWeb3RequestCanceledEvent(u),this.handleErrorResponse(u,o.method,d),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:p,onResetConnection:this.resetAndReload}),new Promise((d,l)=>{this.relayEventManager.callbacks.set(u,f=>{if(c==null||c(),se(f))return l(new Error(f.errorMessage));d(f)}),this.publishWeb3RequestEvent(u,o)})}addEthereumChain(t,n,r,i,a,s){const o={method:"addEthereumChain",params:{chainId:t,rpcUrls:n,blockExplorerUrls:i,chainName:a,iconUrls:r,nativeCurrency:s}};let c=null;const u=nt(8),p=d=>{this.publishWeb3RequestCanceledEvent(u),this.handleErrorResponse(u,o.method,d),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:p,onResetConnection:this.resetAndReload}),new Promise((d,l)=>{this.relayEventManager.callbacks.set(u,f=>{if(c==null||c(),se(f))return l(new Error(f.errorMessage));d(f)}),this.publishWeb3RequestEvent(u,o)})}switchEthereumChain(t,n){const r={method:"switchEthereumChain",params:Object.assign({chainId:t},{address:n})};let i=null;const a=nt(8),s=o=>{this.publishWeb3RequestCanceledEvent(a),this.handleErrorResponse(a,r.method,o),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:s,onResetConnection:this.resetAndReload}),new Promise((o,c)=>{this.relayEventManager.callbacks.set(a,u=>{if(i==null||i(),se(u)&&u.errorCode)return c(S.provider.custom({code:u.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(se(u))return c(new Error(u.errorMessage));o(u)}),this.publishWeb3RequestEvent(a,r)})}}De.accountRequestCallbackIds=new Set;const ha="DefaultChainId",ma="DefaultJsonRpcUrl";class Ko{constructor(t){this._relay=null,this._addresses=[],this.metadata=t.metadata,this._storage=new dt("walletlink",Oi),this.callback=t.callback||null;const n=this._storage.getItem(Rr);if(n){const r=n.split(" ");r[0]!==""&&(this._addresses=r.map(i=>Ge(i)))}this.initializeRelay()}getSession(){const t=this.initializeRelay(),{id:n,secret:r}=t.getWalletLinkSession();return{id:n,secret:r}}async handshake(t){const n="eth_requestAccounts",r=Ee.get(t);kp({method:n,correlationId:r});try{await this._eth_requestAccounts(),_p({method:n,correlationId:r})}catch(i){throw Ap({method:n,correlationId:r,errorMessage:rt(i)}),i}}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var t;return(t=this._storage.getItem(ma))!==null&&t!==void 0?t:void 0}set jsonRpcUrl(t){this._storage.setItem(ma,t)}updateProviderInfo(t,n){var r;this.jsonRpcUrl=t;const i=this.getChainId();this._storage.setItem(ha,n.toString(10)),Ht(n)!==i&&((r=this.callback)===null||r===void 0||r.call(this,"chainChanged",wt(n)))}async watchAsset(t){const n=Array.isArray(t)?t[0]:t;if(!n.type)throw S.rpc.invalidParams("Type is required");if((n==null?void 0:n.type)!=="ERC20")throw S.rpc.invalidParams(`Asset of type '${n.type}' is not supported`);if(!(n!=null&&n.options))throw S.rpc.invalidParams("Options are required");if(!(n!=null&&n.options.address))throw S.rpc.invalidParams("Address is required");const r=this.getChainId(),{address:i,symbol:a,image:s,decimals:o}=n.options,u=await this.initializeRelay().watchAsset(n.type,i,a,o,s,r==null?void 0:r.toString());return se(u)?!1:!!u.result}async addEthereumChain(t){var n,r;const i=t[0];if(((n=i.rpcUrls)===null||n===void 0?void 0:n.length)===0)throw S.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw S.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw S.rpc.invalidParams("nativeCurrency is a required field");const a=Number.parseInt(i.chainId,16);if(a===this.getChainId())return!1;const s=this.initializeRelay(),{rpcUrls:o=[],blockExplorerUrls:c=[],chainName:u,iconUrls:p=[],nativeCurrency:d}=i,l=await s.addEthereumChain(a.toString(),o,p,c,u,d);if(se(l))return!1;if(((r=l.result)===null||r===void 0?void 0:r.isApproved)===!0)return this.updateProviderInfo(o[0],a),null;throw S.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(t){const n=t[0],r=Number.parseInt(n.chainId,16),a=await this.initializeRelay().switchEthereumChain(r.toString(10),this.selectedAddress||void 0);if(se(a))throw a;const s=a.result;return s.isApproved&&s.rpcUrl.length>0&&this.updateProviderInfo(s.rpcUrl,r),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(t,n){var r;if(!Array.isArray(t))throw new Error("addresses is not an array");const i=t.map(a=>Ge(a));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(r=this.callback)===null||r===void 0||r.call(this,"accountsChanged",i),this._storage.setItem(Rr,i.join(" ")))}async request(t){const n=Ee.get(t);Ip({method:t.method,correlationId:n});try{const r=await this._request(t);return Pp({method:t.method,correlationId:n}),r}catch(r){throw Op({method:t.method,correlationId:n,errorMessage:rt(r)}),r}}async _request(t){const n=t.params||[];switch(t.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return wt(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(t);case"personal_sign":return this.personalSign(t);case"eth_signTransaction":return this._eth_signTransaction(n);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(n);case"eth_sendTransaction":return this._eth_sendTransaction(n);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(t);case"wallet_addEthereumChain":return this.addEthereumChain(n);case"wallet_switchEthereumChain":return this.switchEthereumChain(n);case"wallet_watchAsset":return this.watchAsset(n);default:if(!this.jsonRpcUrl)throw S.rpc.internal("No RPC URL set for chain");return Gt(t,this.jsonRpcUrl)}}_ensureKnownAddress(t){const n=Ge(t);if(!this._addresses.map(i=>Ge(i)).includes(n))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(t){const n=t.from?Ge(t.from):this.selectedAddress;if(!n)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(n);const r=t.to?Ge(t.to):null,i=t.value!=null?jt(t.value):BigInt(0),a=t.data?Tr(t.data):Buffer.alloc(0),s=t.nonce!=null?Ht(t.nonce):null,o=t.gasPrice!=null?jt(t.gasPrice):null,c=t.maxFeePerGas!=null?jt(t.maxFeePerGas):null,u=t.maxPriorityFeePerGas!=null?jt(t.maxPriorityFeePerGas):null,p=t.gas!=null?jt(t.gas):null,d=t.chainId?Ht(t.chainId):this.getChainId();return{fromAddress:n,toAddress:r,weiValue:i,data:a,nonce:s,gasPriceInWei:o,maxFeePerGas:c,maxPriorityFeePerGas:u,gasLimit:p,chainId:d}}async ecRecover(t){const{method:n,params:r}=t;if(!Array.isArray(r))throw S.rpc.invalidParams();const a=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:Gn(r[0]),signature:Gn(r[1]),addPrefix:n==="personal_ecRecover"}});if(se(a))throw a;return a.result}getChainId(){var t;return Number.parseInt((t=this._storage.getItem(ha))!==null&&t!==void 0?t:"1",10)}async _eth_requestAccounts(){var t,n;if(this._addresses.length>0)return(t=this.callback)===null||t===void 0||t.call(this,"connect",{chainId:wt(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(se(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(n=this.callback)===null||n===void 0||n.call(this,"connect",{chainId:wt(this.getChainId())}),this._addresses}async personalSign({params:t}){if(!Array.isArray(t))throw S.rpc.invalidParams();const n=t[1],r=t[0];this._ensureKnownAddress(n);const a=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:Ge(n),message:Gn(r),addPrefix:!0,typedDataJson:null}});if(se(a))throw a;return a.result}async _eth_signTransaction(t){const n=this._prepareTransactionParams(t[0]||{}),i=await this.initializeRelay().signEthereumTransaction(n);if(se(i))throw i;return i.result}async _eth_sendRawTransaction(t){const n=Tr(t[0]),i=await this.initializeRelay().submitEthereumTransaction(n,this.getChainId());if(se(i))throw i;return i.result}async _eth_sendTransaction(t){const n=this._prepareTransactionParams(t[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(n);if(se(i))throw i;return i.result}async signTypedData(t){const{method:n,params:r}=t;if(!Array.isArray(r))throw S.rpc.invalidParams();const i=u=>{const p={eth_signTypedData_v1:fn.hashForSignTypedDataLegacy,eth_signTypedData_v3:fn.hashForSignTypedData_v3,eth_signTypedData_v4:fn.hashForSignTypedData_v4,eth_signTypedData:fn.hashForSignTypedData_v4};return Ut(p[n]({data:Nu(u)}),!0)},a=r[n==="eth_signTypedData_v1"?1:0],s=r[n==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(a);const c=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:Ge(a),message:i(s),typedDataJson:JSON.stringify(s,null,2),addPrefix:!1}});if(se(c))throw c;return c.result}initializeRelay(){return this._relay||(this._relay=new De({linkAPIUrl:Oi,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const Zo="SignerType",Yo=new dt("CBWSDK","SignerConfigurator");function Ah(){return Yo.getItem(Zo)}function _h(e){Yo.setItem(Zo,e)}function ya(e){if(e)return e instanceof no?"scw":"walletlink"}async function Ih(e){const{communicator:t,metadata:n,handshakeRequest:r,callback:i}=e;Ph(t,n,i,r).catch(()=>{});const a={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},e.preference),{handshakeRequest:r})},{data:s}=await t.postRequestAndWaitForResponse(a);return s}function Oh(e){const{signerType:t,metadata:n,communicator:r,callback:i}=e;switch(t){case"scw":return new no({metadata:n,callback:i,communicator:r});case"walletlink":return new Ko({metadata:n,callback:i})}}async function Ph(e,t,n,r){await e.onMessage(({event:a})=>a==="WalletLinkSessionRequest");const i=new Ko({metadata:t,callback:n});e.postMessage({event:"WalletLinkUpdate",data:{session:i.getSession()}}),await i.handshake(r),e.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}var Ch=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};class Th extends md{constructor(t){var{metadata:n}=t,r=t.preference,{keysUrl:i}=r,a=Ch(r,["keysUrl"]);super(),this.signer=null,this.isCoinbaseWallet=!0,this.metadata=n,this.preference=a,this.communicator=new fd({url:i,metadata:n,preference:a});const s=Ah();s&&(this.signer=this.initSigner(s),yd({signerType:s}))}async request(t){const n=crypto.randomUUID();Ee.set(t,n),gd({method:t.method,correlationId:n});try{const r=await this._request(t);return wd({method:t.method,signerType:ya(this.signer),correlationId:n}),r}catch(r){throw bd({method:t.method,correlationId:n,signerType:ya(this.signer),errorMessage:r instanceof Error?r.message:""}),r}finally{Ee.delete(t)}}async _request(t){try{if(qu(t),!this.signer)switch(t.method){case"eth_requestAccounts":{let r;const i=_.subAccountsConfig.get();i!=null&&i.enableAutoSubAccounts?r="scw":r=await this.requestSignerSelection(t);const a=this.initSigner(r);r==="scw"&&(i!=null&&i.enableAutoSubAccounts)?(await a.handshake({method:"handshake"}),await a.request(t)):await a.handshake(t),this.signer=a,_h(r);break}case"wallet_connect":{const r=this.initSigner("scw");await r.handshake({method:"handshake"});const i=await r.request(t);return this.signer=r,i}case"wallet_sendCalls":case"wallet_sign":{const r=this.initSigner("scw");await r.handshake({method:"handshake"});const i=await r.request(t);return await r.cleanup(),i}case"wallet_getCallsStatus":return await Gt(t,qa);case"net_version":return 1;case"eth_chainId":return wt(1);default:throw S.provider.unauthorized("Must call 'eth_requestAccounts' before other methods")}return await this.signer.request(t)}catch(n){const{code:r}=n;return r===Q.provider.unauthorized&&this.disconnect(),Promise.reject(pd(n))}}async enable(){return console.warn('.enable() has been deprecated. Please use .request({ method: "eth_requestAccounts" }) instead.'),vd(),await this.request({method:"eth_requestAccounts"})}async disconnect(){var t;await((t=this.signer)===null||t===void 0?void 0:t.cleanup()),this.signer=null,dt.clearAll(),Ee.clear(),this.emit("disconnect",S.provider.disconnected("User initiated disconnection"))}async requestSignerSelection(t){xd();const n=await Ih({communicator:this.communicator,preference:this.preference,metadata:this.metadata,handshakeRequest:t,callback:this.emit.bind(this)});return Ed(n),n}initSigner(t){return Oh({signerType:t,metadata:this.metadata,communicator:this.communicator,callback:this.emit.bind(this)})}}function Bh(e){var t;const n={metadata:e.metadata,preference:e.preference};return(t=$u(n))!==null&&t!==void 0?t:new Th(n)}const Lh={options:"all"};function Wh(e){var t,n,r,i;const a={metadata:{appName:e.appName||"Dapp",appLogoUrl:e.appLogoUrl||"",appChainIds:e.appChainIds||[]},preference:Object.assign(Lh,(t=e.preference)!==null&&t!==void 0?t:{}),paymasterUrls:e.paymasterUrls};!((n=e.subAccounts)===null||n===void 0)&&n.toOwnerAccount&&Ii(e.subAccounts.toOwnerAccount),_.subAccountsConfig.set({toOwnerAccount:(r=e.subAccounts)===null||r===void 0?void 0:r.toOwnerAccount,enableAutoSubAccounts:(i=e.subAccounts)===null||i===void 0?void 0:i.enableAutoSubAccounts}),_.config.set(a),_.persist.rehydrate(),Hu(),a.preference.telemetry!==!1&&Ou(),Wu(a.preference);let s=null;const o={getProvider(){return s||(s=Bh(a)),s.sdk=o,s},subAccount:{async create(c){var u,p;const d=_.getState();return ye((u=d.subAccount)===null||u===void 0?void 0:u.address,new Error("subaccount already exists")),await((p=o.getProvider())===null||p===void 0?void 0:p.request({method:"wallet_addSubAccount",params:[{version:"1",account:c}]}))},async get(){var c,u;const p=_.subAccounts.get();if(p!=null&&p.address)return p;const l=(u=(await((c=o.getProvider())===null||c===void 0?void 0:c.request({method:"wallet_connect",params:[{version:"1",capabilities:{}}]}))).accounts[0].capabilities)===null||u===void 0?void 0:u.subAccounts;return Array.isArray(l)?l[0]:null},async addOwner({address:c,publicKey:u,chainId:p}){var d,l;const f=_.subAccounts.get(),h=_.account.get();ye(h,new Error("account does not exist")),ye(f==null?void 0:f.address,new Error("subaccount does not exist"));const m=[];if(u){const[v,k]=Aa([{type:"bytes32"},{type:"bytes32"}],u);m.push({to:f.address,data:He({abi:Se,functionName:"addOwnerPublicKey",args:[v,k]}),value:Et(0)})}return c&&m.push({to:f.address,data:He({abi:Se,functionName:"addOwnerAddress",args:[c]}),value:Et(0)}),await((d=o.getProvider())===null||d===void 0?void 0:d.request({method:"wallet_sendCalls",params:[{calls:m,chainId:Et(p),from:(l=h.accounts)===null||l===void 0?void 0:l[0],version:"1"}]}))},setToOwnerAccount(c){Ii(c),_.subAccountsConfig.set({toOwnerAccount:c})}}};return o}export{Wh as createCoinbaseWalletSDK,Nr as getCryptoKeyAccount};
|
|
8
|
-
//# sourceMappingURL=index-
|
|
8
|
+
//# sourceMappingURL=index-B7r6Bd0d.js.map
|