import{jsxs as e,jsx as o,Fragment as r}from"react/jsx-runtime";import t from"@heroicons/react/24/outline/LockClosedIcon";import i from"@heroicons/react/24/outline/PencilSquareIcon";import s from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import{useState as c}from"react";import{styled as n}from"styled-components";import{u as l,g as a}from"./privy-context-Bi6vqCPc.mjs";import{M as m,B as p,P as d}from"./ModalHeader-DffkxvO4.mjs";import{C as u}from"./ScreenHeader-CHmc4-Lu.mjs";import{u as h}from"./context-BKnOUECq.mjs";import{u as v}from"./internal-context-dfitw7Ot.mjs";import{u as y}from"./modal-context-DBwfUxD-.mjs";import{o as g}from"./index-C5jxD-zy.mjs";import{R as j,A as f,G as w,a as C}from"./styles-BsotlekN.mjs";import{l as k}from"./useActiveWallet-BEfvREjE.mjs";import"@privy-io/are-addresses-equal";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@privy-io/js-sdk-core";import"tinycolor2";import"./toViemAccount-4iGGrW4w.mjs";import"jose";import"eventemitter3";import"./index-BtwxknTg.mjs";import"zustand";import"viem";import"viem/utils";import"./errors-Dd6zfYtp.mjs";import"ofetch";import"./wallet-connect-58EobR5U.mjs";import"./getPublicClient-D4yNgeGy.mjs";import"viem/chains";import"react-device-detect";import"@coinbase/wallet-sdk";import"@walletconnect/ethereum-provider";import"./pkce-BinverJO.mjs";import"./paths-BH8W4zMc.mjs";import"./PrivyPluginContext-DA-yS5vO.mjs";import"js-cookie";import"@privy-io/ethereum";import"viem/accounts";import"mipd";import"@scure/base";import"./usePrivy-BhL-ltvm.mjs";import"./use-unlink-wallet-oAguM2-k.mjs";import"./get-entropy-details-for-user-BIWg0YxF.mjs";import"./user-D5cqJNp9.mjs";import"@privy-io/popup";import"./events-context-BJ75xIIf.mjs";import"@headlessui/react";import"@privy-io/urls";import"./getEmbeddedConnectedWallet-Ba6LFHzY.mjs";import"./frame-DtizlaLu.mjs";import"@privy-io/routes";import"./use-deposit-address-BwThybOQ.mjs";import"x402/client";import"@privy-io/api-base";import"./use-sign-with-user-signer-CQI6hUH7.mjs";let S=n.div`
  width: 24px;
  height: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
`,x={"google-drive":"Google Drive",icloud:"iCloud","user-passcode":"password",privy:"Privy","privy-v2":"Privy"},A=({onClose:t})=>/*#__PURE__*/e(C,{children:[/*#__PURE__*/o(u,{title:"Why do I need to secure my account?",icon:/*#__PURE__*/o(s,{width:48}),description:/*#__PURE__*/e(r,{children:[/*#__PURE__*/o("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),/*#__PURE__*/o("p",{children:"To use this app on new devices, secure account secrets using a password, your Google or your Apple account. It’s important you don’t lose access to the method you choose."})]})}),/*#__PURE__*/o(d,{onClick:t,children:"Select backup method"})]});const P={component:()=>{let[s,n]=c(!1),{navigate:d,lastScreen:C,navigateBack:P,setModalData:b,data:I,onUserCloseViaDialogOrKeybindRef:M}=y(),{user:O}=l(),{embeddedWallets:R}=h(),{closePrivyModal:W}=v(),F=a(O),B=null===F,{isInAccountCreateFlow:D,isResettingPassword:E,shouldCreateEth:G,shouldCreateSol:q}=I.recoverySelection,U=F&&"privy"!==F.recoveryMethod,H=U?/*#__PURE__*/e("span",{children:["Your account is currently secured using"," ",/*#__PURE__*/o("strong",{children:x[F?.recoveryMethod||"user-passcode"]}),"."]}):"Select a method for logging in on new devices and recovering your account.";function L(e){b({recoveryOAuthStatus:{provider:e,action:B?"create-wallet":"set-recovery",isInAccountCreateFlow:D,shouldCreateEth:G,shouldCreateSol:q}}),d("RecoveryOAuthScreen")}function V(){I?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),W({shouldCallAuthOnSuccess:I?.setWalletPassword?.callAuthOnSuccessOnClose??!1})}return M.current=V,/*#__PURE__*/e(r,{children:[/*#__PURE__*/o(m,{onClose:V,backFn:s?()=>n(!1):C?P:void 0,infoFn:C||s?void 0:()=>n(!0)},"header"),s?/*#__PURE__*/o(A,{onClose:()=>n(!1)}):/*#__PURE__*/e(r,{children:[/*#__PURE__*/o(u,{title:U?"Update backup method":"Secure your account",icon:/*#__PURE__*/o(t,{width:48}),description:H}),/*#__PURE__*/o(j,{children:R.userOwnedRecoveryOptions.filter((e=>!["icloud","google-drive"].includes(F?.recoveryMethod||"")||e!==F?.recoveryMethod)).sort().map((r=>{switch(r){case"google-drive":/*#__PURE__*/return e(k,{onClick:()=>L("google-drive"),children:[/*#__PURE__*/o(S,{children:/*#__PURE__*/o(w,{style:{width:18}})}),"Back up to Google Drive"]},r);case"icloud":/*#__PURE__*/return e(k,{onClick:()=>L("icloud"),children:[/*#__PURE__*/o(S,{children:/*#__PURE__*/o(f,{style:{width:24}})}),"Back up to Apple iCloud"]},r);case"user-passcode":/*#__PURE__*/return e(k,{onClick:()=>{d(g({isCreatingWallet:B,skipSplashScreen:!0}))},children:[/*#__PURE__*/o(S,{children:/*#__PURE__*/o(i,{style:{width:18}})}),E?"Reset your":"Set a"," password"]},r);default:return null}}))})]}),/*#__PURE__*/o(p,{})]})}};export{P as RecoverySelectionScreen,P as default};
//# sourceMappingURL=RecoverySelectionScreen-NzevT3n3.mjs.map
