import{o as e}from"./rolldown-runtime.js";import{n as t,t as n}from"./jsx-runtime.js";import{j as r}from"./useActiveWallet-CEs8euQ3.js";import"./context-Cdw68BC2.js";import{t as i}from"./modal-context-DHfp-mFQ.js";import{c as a,u as o}from"./ModalHeader-BS54PZSj.js";import{t as s}from"./index-Dq_xe9dz.js";import{r as c}from"./Layouts-BlFm53ED.js";import{t as l}from"./FundWalletMethodHeader-Doi39iuD.js";import{t as u}from"./useGetTokenPrice-Bm_VkGB-.js";import{t as d}from"./Title-BnzYV3Is.js";import{a as f}from"./ethers-CvevhY2s.js";import{l as p,n as m,o as h,r as g,t as _}from"./styles-C_oGPfcb.js";var v=n(),y=e(t(),1);r();var b={component:()=>{let{data:e,setModalData:t}=i(),n=e?.funding,r=n.chainType===`solana`,b=(0,y.useRef)(null),{tokenPrice:x}=u(r?`solana`:n.chain.id),S=r?void 0:n,C=!(!S?.erc20Address||S?.erc20ContractInfo),w=r?n.isUSDC?`USDC`:`SOL`:n.erc20Address?n.erc20ContractInfo?.symbol:n.chain.nativeCurrency.symbol||`ETH`,T=parseFloat(n.amount),E=!isNaN(T)&&T>0,D=x?f(n.amount,x):void 0;return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(l,{}),(0,v.jsx)(d,{children:`Confirm or edit amount`}),(0,v.jsxs)(c,{style:{marginTop:`32px`},children:[(0,v.jsx)(_,{children:C?(0,v.jsx)(s,{size:`50px`}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(p,{onClick:()=>b.current?.focus(),children:[(0,v.jsx)(g,{ref:b,value:n.amount,onChange:r=>{let i=r.target.value;/^[0-9.]*$/.test(i)&&i.split(`.`).length-1<=1&&t({...e,funding:{...n,amount:i},solanaFundingData:e?.solanaFundingData?{...e.solanaFundingData,amount:i}:void 0})}}),(0,v.jsx)(m,{children:w})]}),!S?.erc20Address&&!(r&&n.isUSDC)&&(0,v.jsx)(h,{children:D&&E?`${D} USD`:``})]})}),(0,v.jsx)(a,{style:{marginTop:`1rem`},disabled:!E,onClick:n.onContinueWithExternalWallet,children:`Continue`})]}),(0,v.jsx)(o,{})]})}};export{b as FundingAmountEditScreen,b as default};