import{jsx as r,jsxs as e}from"react/jsx-runtime";import{Banknote as t,CreditCard as o,QrCode as i}from"lucide-react";import{useRef as m,useEffect as n,useCallback as s}from"react";import{styled as a}from"styled-components";import{u as c}from"./context-BKnOUECq.mjs";import{u as l}from"./modal-context-DBwfUxD-.mjs";import{S as p}from"./styles-DVyDvTdj.mjs";import{C as u,O as d,a as h}from"./styles-BLvulMYf.mjs";import{J as y,K as j}from"./index-C5jxD-zy.mjs";import"@privy-io/js-sdk-core";import"tinycolor2";import"./internal-context-dfitw7Ot.mjs";import"./useActiveWallet-BEfvREjE.mjs";import"viem/utils";import"./wallet-connect-58EobR5U.mjs";import"./errors-Dd6zfYtp.mjs";import"ofetch";import"./getPublicClient-D4yNgeGy.mjs";import"viem";import"viem/chains";import"eventemitter3";import"./events-context-BJ75xIIf.mjs";import"./privy-context-Bi6vqCPc.mjs";import"@privy-io/are-addresses-equal";import"./index-BtwxknTg.mjs";import"zustand";import"react-device-detect";import"./get-entropy-details-for-user-BIWg0YxF.mjs";import"./user-D5cqJNp9.mjs";import"./ScreenLayout-Caq5mGD8.mjs";import"./ModalHeader-DffkxvO4.mjs";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"./Screen-D8KNyGVj.mjs";import"./index-Dq_xe9dz.mjs";import"./toViemAccount-4iGGrW4w.mjs";import"jose";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"@privy-io/popup";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";const f={component:()=>{let a=y(),{onUserCloseViaDialogOrKeybindRef:f}=l(),C=c(),b=m(!1);n((()=>{a&&(b.current=!1)}),[a]);let x=s((async()=>{!b.current&&a&&(b.current=!0,j(),await a.onCancel())}),[a]);if(n((()=>(f.current=x,()=>{f.current===x&&(f.current=null)})),[x,f]),!a)return null;if(a.error)/*#__PURE__*/return r(u,{icon:t,iconVariant:"warning",title:"Unable to add funds",subtitle:a.error,showClose:!0,onClose:x,primaryCta:{label:"Close",onClick:x}});/*#__PURE__*/return r(u,{icon:t,iconVariant:"subtle",title:"Select method",subtitle:"Choose how to fund your wallet",showClose:!0,onClose:x,children:/*#__PURE__*/e(p,{style:{marginTop:"1rem"},$colorScheme:C.appearance.palette.colorScheme,children:[a.startFiat&&/*#__PURE__*/e(d,{onClick:async()=>{b.current||(b.current=!0,await(a.startFiat?.()))},children:[/*#__PURE__*/r(v,{children:/*#__PURE__*/r(o,{})}),/*#__PURE__*/e(g,{children:[/*#__PURE__*/r(h,{children:"Pay with fiat"}),/*#__PURE__*/r(w,{children:"Apple Pay, Google Pay, or debit card"})]})]}),a.startCrypto&&/*#__PURE__*/e(d,{onClick:async()=>{b.current||(b.current=!0,await(a.startCrypto?.()))},children:[/*#__PURE__*/r(v,{children:/*#__PURE__*/r(i,{})}),/*#__PURE__*/e(g,{children:[/*#__PURE__*/r(h,{children:"Transfer from wallet"}),/*#__PURE__*/r(w,{children:"Send crypto from any wallet"})]})]})]})})}};let v=a.span`
  width: 2rem;
  height: 2rem;
  border-radius: var(--privy-border-radius-full);
  background-color: var(--privy-color-background-2);
  color: var(--color-icon-muted, #64668b);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;

  svg {
    width: 1.125rem;
    height: 1.125rem;
  }
`,g=a.span`
  display: flex;
  flex-direction: column;
  align-items: flex-start;
`,w=a.span`
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--privy-color-foreground-3);
`;export{f as AddFundsSelectionScreen,f as default};
//# sourceMappingURL=AddFundsSelectionScreen-Cq8rPoJw.mjs.map
