import{o as e}from"./rolldown-runtime.js";import{n as t,t as n}from"./jsx-runtime.js";import{T as r,Vt as i,j as a,l as o,y as s}from"./useActiveWallet-CEs8euQ3.js";import{k as c}from"./context-Cdw68BC2.js";import{t as l}from"./modal-context-DHfp-mFQ.js";import{l as u,r as d,u as f}from"./ModalHeader-BS54PZSj.js";import{t as p}from"./Layouts-BlFm53ED.js";import{t as m}from"./ArrowsRightLeftIcon.js";import{t as h}from"./CheckCircleIcon2.js";import{n as g}from"./index-BQp5SIi_.js";var _=n(),v=e(t(),1);a();var y=({size:e=61,...t})=>(0,_.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 61 61`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...t,children:(0,_.jsxs)(`g`,{id:`moonpay_symbol_wht 2`,children:[(0,_.jsx)(`rect`,{x:`1.3374`,y:`1`,width:`59`,height:`59`,rx:`11.5`,fill:`#7715F5`}),(0,_.jsx)(`path`,{id:`Vector`,d:`M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z`,fill:`white`})]})}),b={component:()=>{let{data:e,setModalData:t,navigateBack:n}=l(),r=c(),{closePrivyModal:a}=i(),o=g(e?.moonpayStatus?.externalTransactionId||null,r.fundingMethodConfig.moonpay.useSandbox??!1);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(d,{title:`Fund account`,backFn:()=>{let r={...e?.funding,showAlternateFundingMethod:!0};r.usingDefaultFundingMethod&&=!1,t({funding:r,solanaFundingData:e?.solanaFundingData}),n()}}),(0,_.jsx)(x,{status:o,onClickCta:a}),(0,_.jsx)(f,{})]})}},x=({status:e,onClickCta:t})=>{let{title:n,body:r,cta:i}=(0,v.useMemo)((()=>(e=>{switch(e){case`completed`:return{title:`You've funded your account!`,body:`It may take a few minutes for the assets to appear.`,cta:`Continue`};case`waitingAuthorization`:return{title:`Processing payment`,body:`This may take up to a few hours. You will receive an email when the purchase is complete.`,cta:`Continue`};default:return{title:`In Progress`,body:`Go back to MoonPay to finish funding your account.`,cta:``}}})(e)),[e]);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(w,{children:[(0,_.jsx)(S,{status:e}),(0,_.jsxs)(p,{children:[(0,_.jsx)(`h3`,{children:n}),(0,_.jsx)(C,{children:r})]})]}),i&&(0,_.jsx)(u,{onClick:t,children:i})]})},S=({status:e})=>{if(!e||e===`pending`){let e=`var(--privy-color-foreground-4)`;return(0,_.jsxs)(`div`,{style:{position:`relative`},children:[(0,_.jsx)(s,{color:e,style:{position:`absolute`}}),(0,_.jsx)(o,{color:e}),(0,_.jsx)(y,{size:`3rem`,style:{position:`absolute`,top:`1rem`,left:`1rem`}})]})}let t=(e=>{switch(e){case`completed`:return h;case`waitingAuthorization`:return()=>(0,_.jsx)(m,{width:`3rem`,height:`3rem`,style:{backgroundColor:`var(--privy-color-foreground-4)`,color:`var(--privy-color-background)`,borderRadius:`100%`,padding:`0.5rem`,margin:`0.5rem`}});default:return}})(e),n=(r=e)?{completed:`var(--privy-color-success)`,failed:`var(--privy-color-error)`,serviceFailure:`var(--privy-color-error)`,waitingAuthorization:`var(--privy-color-accent)`,pending:`var(--privy-color-foreground-4)`}[r]:`var(--privy-color-foreground-4)`;var r;return(0,_.jsx)(`div`,{style:{borderColor:n,display:`flex`,justifyContent:`center`,alignItems:`center`,borderRadius:`100%`,borderWidth:2,padding:`0.5rem`,marginBottom:`0.5rem`},children:t&&(0,_.jsx)(t,{width:`4rem`,height:`4rem`,color:n})})},C=r.p`
  font-size: 1rem;
  color: var(--privy-color-foreground-3);
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
`,w=r.div`
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-left: 1.75rem;
  margin-right: 1.75rem;
  padding: 2rem 0;
`;export{b as MoonpayStatusScreen,b as default};