import{o as e}from"./rolldown-runtime.js";import{n as t,t as n}from"./jsx-runtime.js";import{Mt as r,T as i,Vt as a,d as o,j as s,jt as c}from"./useActiveWallet-CEs8euQ3.js";import{k as l}from"./context-Cdw68BC2.js";import{w as u}from"./index-CKYEOQWW.js";import{t as d}from"./modal-context-DHfp-mFQ.js";import{f,l as p,r as m,u as h}from"./ModalHeader-BS54PZSj.js";import{t as g}from"./LockClosedIcon.js";import{n as _}from"./ScreenHeader-CHmc4-Lu.js";import{i as v,n as y,r as b,t as x}from"./styles-BsotlekN.js";var S=n(),C=e(t());function w({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10`}))}var T=C.forwardRef(w);s();var E=i.div`
  width: 24px;
  height: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
`,D={"google-drive":`Google Drive`,icloud:`iCloud`,"user-passcode":`password`,privy:`Privy`,"privy-v2":`Privy`},O=({onClose:e})=>(0,S.jsxs)(v,{children:[(0,S.jsx)(_,{title:`Why do I need to secure my account?`,icon:(0,S.jsx)(f,{width:48}),description:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`p`,{children:`Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them.`}),(0,S.jsx)(`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.`})]})}),(0,S.jsx)(p,{onClick:e,children:`Select backup method`})]}),k={component:()=>{let[e,t]=(0,C.useState)(!1),{navigate:n,lastScreen:i,navigateBack:s,setModalData:f,data:p,onUserCloseViaDialogOrKeybindRef:v}=d(),{user:w}=r(),{embeddedWallets:k}=l(),{closePrivyModal:A}=a(),j=c(w),M=j===null,{isInAccountCreateFlow:N,isResettingPassword:P,shouldCreateEth:F,shouldCreateSol:I}=p.recoverySelection,L=j&&j.recoveryMethod!==`privy`,R=L?(0,S.jsxs)(`span`,{children:[`Your account is currently secured using`,` `,(0,S.jsx)(`strong`,{children:D[j?.recoveryMethod||`user-passcode`]}),`.`]}):`Select a method for logging in on new devices and recovering your account.`;function z(e){f({recoveryOAuthStatus:{provider:e,action:M?`create-wallet`:`set-recovery`,isInAccountCreateFlow:N,shouldCreateEth:F,shouldCreateSol:I}}),n(`RecoveryOAuthScreen`)}function B(){p?.setWalletPassword?.onFailure(Error(`User exited set recovery flow`)),A({shouldCallAuthOnSuccess:p?.setWalletPassword?.callAuthOnSuccessOnClose??!1})}return v.current=B,(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(m,{onClose:B,backFn:e?()=>t(!1):i?s:void 0,infoFn:i||e?void 0:()=>t(!0)},`header`),e?(0,S.jsx)(O,{onClose:()=>t(!1)}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(_,{title:L?`Update backup method`:`Secure your account`,icon:(0,S.jsx)(g,{width:48}),description:R}),(0,S.jsx)(b,{children:k.userOwnedRecoveryOptions.filter((e=>![`icloud`,`google-drive`].includes(j?.recoveryMethod||``)||e!==j?.recoveryMethod)).sort().map((e=>{switch(e){case`google-drive`:return(0,S.jsxs)(o,{onClick:()=>z(`google-drive`),children:[(0,S.jsx)(E,{children:(0,S.jsx)(y,{style:{width:18}})}),`Back up to Google Drive`]},e);case`icloud`:return(0,S.jsxs)(o,{onClick:()=>z(`icloud`),children:[(0,S.jsx)(E,{children:(0,S.jsx)(x,{style:{width:24}})}),`Back up to Apple iCloud`]},e);case`user-passcode`:return(0,S.jsxs)(o,{onClick:()=>{n(u({isCreatingWallet:M,skipSplashScreen:!0}))},children:[(0,S.jsx)(E,{children:(0,S.jsx)(T,{style:{width:18}})}),P?`Reset your`:`Set a`,` password`]},e);default:return null}}))})]}),(0,S.jsx)(h,{})]})}};export{k as RecoverySelectionScreen,k as default};