@nowramp/form 0.1.77 → 0.1.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -8,5 +8,5 @@
8
8
  }`;
9
9
  document.head.appendChild(s);
10
10
  })();
11
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),Ye=require("@nowramp/sdk"),Ut=require("react-dom");function Ot(t,a,n){const[r,i]=s.useState(null),[l,m]=s.useState(!0),[c,u]=s.useState(null),f=s.useRef(null);(!f.current||f.current!==t)&&(f.current=new Ye.RampApi({apiKey:"",...t}));const h=s.useCallback(async()=>{if(!t.projectId){u(new Error("projectId is required")),m(!1);return}m(!0),u(null);try{const d={};a&&(d.orderType=a),n&&(d.country=n);const p=await f.current.getSupported(d);i(p)}catch(d){u(d instanceof Error?d:new Error("Failed to fetch config"))}finally{m(!1)}},[t.projectId,a,n]);return s.useEffect(()=>{h()},[h]),{config:r,loading:l,error:c,refetch:h}}function Ht(t,a){const[n,r]=s.useState(null),[i,l]=s.useState(!1),[m,c]=s.useState(null),u=s.useRef(null),f=s.useRef(""),h=`${t.apiUrl}|${t.projectId}`;(!u.current||f.current!==h)&&(u.current=new Ye.RampApi({apiKey:"",...t}),f.current=h);const d=s.useRef(0);s.useEffect(()=>{const g=++d.current;if(!a||!t.projectId){r(null),l(!1);return}l(!0),c(null),u.current.getQuotes(a).then(E=>{d.current===g&&(r(E),l(!1))},E=>{d.current===g&&(c(E instanceof Error?E:new Error("Failed to fetch quotes")),r(null),l(!1))})},[t.projectId,a==null?void 0:a.fiatCurrency,a==null?void 0:a.fiatAmount,a==null?void 0:a.cryptoAmount,a==null?void 0:a.cryptoCurrency,a==null?void 0:a.network,a==null?void 0:a.paymentMethodId,a==null?void 0:a.country,a==null?void 0:a.orderType]);const p=s.useCallback(async()=>{if(!(!a||!t.projectId)){l(!0),c(null);try{const g=await u.current.getQuotes(a);r(g)}catch(g){c(g instanceof Error?g:new Error("Failed to fetch quotes"))}finally{l(!1)}}},[t.projectId,a]);return{quotes:n,loading:i,error:m,refetch:p}}function Pt(t){const[a,n]=s.useState(null),[r,i]=s.useState(!1),[l,m]=s.useState(null),c=s.useRef(null),u=s.useRef(""),f=`${t.apiUrl}|${t.projectId}`;(!c.current||u.current!==f)&&(c.current=new Ye.RampApi({apiKey:"",...t}),u.current=f);const h=s.useCallback(async p=>{i(!0),m(null);try{const g=await c.current.createCheckoutIntent(p);return n(g),g}catch(g){const E=g instanceof Error?g:new Error("Failed to create checkout intent");throw m(E),E}finally{i(!1)}},[]),d=s.useCallback(()=>{n(null),m(null)},[]);return{order:a,loading:r,error:l,createOrder:h,reset:d}}function Kt(t,a,n){const[r,i]=s.useState(null),[l,m]=s.useState(!1),[c,u]=s.useState(null),f=s.useRef(null);f.current||(f.current=new Ye.RampApi({apiKey:"",projectId:"",...t}));const h=s.useCallback(async()=>{if(a){m(!0),u(null);try{const d=await f.current.getTransaction(a);i(d)}catch(d){u(d instanceof Error?d:new Error("Failed to fetch status"))}finally{m(!1)}}},[a]);return s.useEffect(()=>{if(!a)return;const d=(n==null?void 0:n.initialDelay)??0;if(d>0){const p=setTimeout(h,d);return()=>clearTimeout(p)}h()},[h,a,n==null?void 0:n.initialDelay]),s.useEffect(()=>{if(!a||!(n!=null&&n.pollInterval)||!r||["completed","failed","cancelled","expired","refunded"].includes(r.status))return;const p=setInterval(h,n.pollInterval);return()=>clearInterval(p)},[a,n==null?void 0:n.pollInterval,r==null?void 0:r.status,h]),{status:r,loading:l,error:c,refetch:h}}const Fe=[{code:"ad",name:"Andorra",defaultFiat:"EUR"},{code:"ae",name:"United Arab Emirates",defaultFiat:"AED"},{code:"af",name:"Afghanistan",defaultFiat:"USD"},{code:"ag",name:"Antigua and Barbuda",defaultFiat:"USD"},{code:"al",name:"Albania",defaultFiat:"ALL"},{code:"am",name:"Armenia",defaultFiat:"USD"},{code:"ao",name:"Angola",defaultFiat:"USD"},{code:"ar",name:"Argentina",defaultFiat:"ARS"},{code:"at",name:"Austria",defaultFiat:"EUR"},{code:"au",name:"Australia",defaultFiat:"AUD"},{code:"az",name:"Azerbaijan",defaultFiat:"USD"},{code:"ba",name:"Bosnia and Herzegovina",defaultFiat:"EUR"},{code:"bb",name:"Barbados",defaultFiat:"USD"},{code:"bd",name:"Bangladesh",defaultFiat:"USD"},{code:"be",name:"Belgium",defaultFiat:"EUR"},{code:"bf",name:"Burkina Faso",defaultFiat:"USD"},{code:"bg",name:"Bulgaria",defaultFiat:"EUR"},{code:"bh",name:"Bahrain",defaultFiat:"USD"},{code:"bi",name:"Burundi",defaultFiat:"USD"},{code:"bj",name:"Benin",defaultFiat:"USD"},{code:"bn",name:"Brunei",defaultFiat:"USD"},{code:"bo",name:"Bolivia",defaultFiat:"USD"},{code:"br",name:"Brazil",defaultFiat:"BRL"},{code:"bs",name:"Bahamas",defaultFiat:"USD"},{code:"bt",name:"Bhutan",defaultFiat:"USD"},{code:"bw",name:"Botswana",defaultFiat:"USD"},{code:"by",name:"Belarus",defaultFiat:"USD"},{code:"bz",name:"Belize",defaultFiat:"USD"},{code:"ca",name:"Canada",defaultFiat:"CAD"},{code:"cd",name:"DR Congo",defaultFiat:"USD"},{code:"cf",name:"Central African Republic",defaultFiat:"USD"},{code:"ch",name:"Switzerland",defaultFiat:"CHF"},{code:"ci",name:"Cote d'Ivoire",defaultFiat:"USD"},{code:"cl",name:"Chile",defaultFiat:"CLP"},{code:"cm",name:"Cameroon",defaultFiat:"USD"},{code:"cn",name:"China",defaultFiat:"USD"},{code:"co",name:"Colombia",defaultFiat:"USD"},{code:"cr",name:"Costa Rica",defaultFiat:"USD"},{code:"cu",name:"Cuba",defaultFiat:"USD"},{code:"cv",name:"Cape Verde",defaultFiat:"USD"},{code:"cy",name:"Cyprus",defaultFiat:"EUR"},{code:"cz",name:"Czech Republic",defaultFiat:"CZK"},{code:"de",name:"Germany",defaultFiat:"EUR"},{code:"dj",name:"Djibouti",defaultFiat:"USD"},{code:"dk",name:"Denmark",defaultFiat:"DKK"},{code:"dm",name:"Dominica",defaultFiat:"USD"},{code:"do",name:"Dominican Republic",defaultFiat:"USD"},{code:"dz",name:"Algeria",defaultFiat:"USD"},{code:"ec",name:"Ecuador",defaultFiat:"USD"},{code:"ee",name:"Estonia",defaultFiat:"EUR"},{code:"eg",name:"Egypt",defaultFiat:"USD"},{code:"er",name:"Eritrea",defaultFiat:"USD"},{code:"es",name:"Spain",defaultFiat:"EUR"},{code:"et",name:"Ethiopia",defaultFiat:"USD"},{code:"fi",name:"Finland",defaultFiat:"EUR"},{code:"fj",name:"Fiji",defaultFiat:"USD"},{code:"fr",name:"France",defaultFiat:"EUR"},{code:"ga",name:"Gabon",defaultFiat:"USD"},{code:"gb",name:"United Kingdom",defaultFiat:"GBP"},{code:"gd",name:"Grenada",defaultFiat:"USD"},{code:"ge",name:"Georgia",defaultFiat:"USD"},{code:"gh",name:"Ghana",defaultFiat:"USD"},{code:"gm",name:"Gambia",defaultFiat:"USD"},{code:"gn",name:"Guinea",defaultFiat:"USD"},{code:"gq",name:"Equatorial Guinea",defaultFiat:"USD"},{code:"gr",name:"Greece",defaultFiat:"EUR"},{code:"gt",name:"Guatemala",defaultFiat:"USD"},{code:"gw",name:"Guinea-Bissau",defaultFiat:"USD"},{code:"gy",name:"Guyana",defaultFiat:"USD"},{code:"hk",name:"Hong Kong",defaultFiat:"HKD"},{code:"hn",name:"Honduras",defaultFiat:"USD"},{code:"hr",name:"Croatia",defaultFiat:"EUR"},{code:"ht",name:"Haiti",defaultFiat:"USD"},{code:"hu",name:"Hungary",defaultFiat:"EUR"},{code:"id",name:"Indonesia",defaultFiat:"IDR"},{code:"ie",name:"Ireland",defaultFiat:"EUR"},{code:"il",name:"Israel",defaultFiat:"USD"},{code:"in",name:"India",defaultFiat:"INR"},{code:"iq",name:"Iraq",defaultFiat:"USD"},{code:"ir",name:"Iran",defaultFiat:"USD"},{code:"is",name:"Iceland",defaultFiat:"EUR"},{code:"it",name:"Italy",defaultFiat:"EUR"},{code:"jm",name:"Jamaica",defaultFiat:"USD"},{code:"jo",name:"Jordan",defaultFiat:"USD"},{code:"jp",name:"Japan",defaultFiat:"JPY"},{code:"ke",name:"Kenya",defaultFiat:"USD"},{code:"kg",name:"Kyrgyzstan",defaultFiat:"USD"},{code:"kh",name:"Cambodia",defaultFiat:"USD"},{code:"ki",name:"Kiribati",defaultFiat:"USD"},{code:"km",name:"Comoros",defaultFiat:"USD"},{code:"kn",name:"Saint Kitts and Nevis",defaultFiat:"USD"},{code:"kr",name:"South Korea",defaultFiat:"KRW"},{code:"kw",name:"Kuwait",defaultFiat:"USD"},{code:"kz",name:"Kazakhstan",defaultFiat:"USD"},{code:"la",name:"Laos",defaultFiat:"USD"},{code:"lb",name:"Lebanon",defaultFiat:"USD"},{code:"lc",name:"Saint Lucia",defaultFiat:"USD"},{code:"li",name:"Liechtenstein",defaultFiat:"CHF"},{code:"lk",name:"Sri Lanka",defaultFiat:"USD"},{code:"lr",name:"Liberia",defaultFiat:"USD"},{code:"ls",name:"Lesotho",defaultFiat:"ZAR"},{code:"lt",name:"Lithuania",defaultFiat:"EUR"},{code:"lu",name:"Luxembourg",defaultFiat:"EUR"},{code:"lv",name:"Latvia",defaultFiat:"EUR"},{code:"ly",name:"Libya",defaultFiat:"USD"},{code:"ma",name:"Morocco",defaultFiat:"USD"},{code:"mc",name:"Monaco",defaultFiat:"EUR"},{code:"md",name:"Moldova",defaultFiat:"EUR"},{code:"me",name:"Montenegro",defaultFiat:"EUR"},{code:"mg",name:"Madagascar",defaultFiat:"USD"},{code:"mk",name:"North Macedonia",defaultFiat:"EUR"},{code:"ml",name:"Mali",defaultFiat:"USD"},{code:"mm",name:"Myanmar",defaultFiat:"USD"},{code:"mn",name:"Mongolia",defaultFiat:"USD"},{code:"mr",name:"Mauritania",defaultFiat:"USD"},{code:"mt",name:"Malta",defaultFiat:"EUR"},{code:"mu",name:"Mauritius",defaultFiat:"USD"},{code:"mv",name:"Maldives",defaultFiat:"USD"},{code:"mw",name:"Malawi",defaultFiat:"USD"},{code:"mx",name:"Mexico",defaultFiat:"MXN"},{code:"my",name:"Malaysia",defaultFiat:"USD"},{code:"mz",name:"Mozambique",defaultFiat:"USD"},{code:"na",name:"Namibia",defaultFiat:"ZAR"},{code:"ne",name:"Niger",defaultFiat:"USD"},{code:"ng",name:"Nigeria",defaultFiat:"NGN"},{code:"ni",name:"Nicaragua",defaultFiat:"USD"},{code:"nl",name:"Netherlands",defaultFiat:"EUR"},{code:"no",name:"Norway",defaultFiat:"NOK"},{code:"np",name:"Nepal",defaultFiat:"USD"},{code:"nr",name:"Nauru",defaultFiat:"AUD"},{code:"nz",name:"New Zealand",defaultFiat:"NZD"},{code:"om",name:"Oman",defaultFiat:"USD"},{code:"pa",name:"Panama",defaultFiat:"USD"},{code:"pe",name:"Peru",defaultFiat:"USD"},{code:"pg",name:"Papua New Guinea",defaultFiat:"USD"},{code:"ph",name:"Philippines",defaultFiat:"PHP"},{code:"pk",name:"Pakistan",defaultFiat:"USD"},{code:"pl",name:"Poland",defaultFiat:"PLN"},{code:"pt",name:"Portugal",defaultFiat:"EUR"},{code:"pw",name:"Palau",defaultFiat:"USD"},{code:"py",name:"Paraguay",defaultFiat:"USD"},{code:"qa",name:"Qatar",defaultFiat:"QAR"},{code:"ro",name:"Romania",defaultFiat:"EUR"},{code:"rs",name:"Serbia",defaultFiat:"EUR"},{code:"ru",name:"Russia",defaultFiat:"USD"},{code:"rw",name:"Rwanda",defaultFiat:"USD"},{code:"sa",name:"Saudi Arabia",defaultFiat:"SAR"},{code:"sb",name:"Solomon Islands",defaultFiat:"USD"},{code:"sc",name:"Seychelles",defaultFiat:"USD"},{code:"sd",name:"Sudan",defaultFiat:"USD"},{code:"se",name:"Sweden",defaultFiat:"SEK"},{code:"sg",name:"Singapore",defaultFiat:"SGD"},{code:"si",name:"Slovenia",defaultFiat:"EUR"},{code:"sk",name:"Slovakia",defaultFiat:"EUR"},{code:"sl",name:"Sierra Leone",defaultFiat:"USD"},{code:"sm",name:"San Marino",defaultFiat:"EUR"},{code:"sn",name:"Senegal",defaultFiat:"USD"},{code:"so",name:"Somalia",defaultFiat:"USD"},{code:"sr",name:"Suriname",defaultFiat:"USD"},{code:"ss",name:"South Sudan",defaultFiat:"USD"},{code:"sv",name:"El Salvador",defaultFiat:"USD"},{code:"sy",name:"Syria",defaultFiat:"USD"},{code:"sz",name:"Eswatini",defaultFiat:"ZAR"},{code:"td",name:"Chad",defaultFiat:"USD"},{code:"tg",name:"Togo",defaultFiat:"USD"},{code:"th",name:"Thailand",defaultFiat:"THB"},{code:"tj",name:"Tajikistan",defaultFiat:"USD"},{code:"tl",name:"Timor-Leste",defaultFiat:"USD"},{code:"tm",name:"Turkmenistan",defaultFiat:"USD"},{code:"tn",name:"Tunisia",defaultFiat:"USD"},{code:"to",name:"Tonga",defaultFiat:"USD"},{code:"tr",name:"Turkey",defaultFiat:"TRY"},{code:"tt",name:"Trinidad and Tobago",defaultFiat:"USD"},{code:"tv",name:"Tuvalu",defaultFiat:"AUD"},{code:"tw",name:"Taiwan",defaultFiat:"TWD"},{code:"tz",name:"Tanzania",defaultFiat:"USD"},{code:"ua",name:"Ukraine",defaultFiat:"USD"},{code:"ug",name:"Uganda",defaultFiat:"USD"},{code:"us",name:"United States",defaultFiat:"USD"},{code:"uy",name:"Uruguay",defaultFiat:"USD"},{code:"uz",name:"Uzbekistan",defaultFiat:"USD"},{code:"va",name:"Vatican City",defaultFiat:"EUR"},{code:"vc",name:"Saint Vincent and the Grenadines",defaultFiat:"USD"},{code:"ve",name:"Venezuela",defaultFiat:"USD"},{code:"vn",name:"Vietnam",defaultFiat:"VND"},{code:"vu",name:"Vanuatu",defaultFiat:"USD"},{code:"ws",name:"Samoa",defaultFiat:"USD"},{code:"ye",name:"Yemen",defaultFiat:"USD"},{code:"za",name:"South Africa",defaultFiat:"ZAR"},{code:"zm",name:"Zambia",defaultFiat:"USD"},{code:"zw",name:"Zimbabwe",defaultFiat:"USD"}],Ze=Object.fromEntries(Fe.map(t=>[t.code,t]));function Ve(t,a){if(!t)return"USD";const n=Ze[t.toLowerCase()],r=(n==null?void 0:n.defaultFiat)||"USD";return!a||a.length===0||a.includes(r)?r:a.includes("USD")?"USD":a[0]||"USD"}function Ft(t,a){if(!t)return t;const n=t.indexOf(".");if(n===-1)return t;let r=t;return r.length-n-1>a&&(r=r.slice(0,n+a+1)),r=r.replace(/0+$/,"").replace(/\.$/,""),r}const _t={step:"amount",flowType:"buy",fiatCurrency:"USD",fiatAmount:"",cryptoCurrency:"",cryptoAmount:"",network:"",paymentMethodId:"",walletAddress:"",walletError:null,selectedProvider:null,selectedQuote:null,customerId:"",email:"",country:"",countrySource:"",errorMessage:null};function Ba(t,a){switch(a.type){case"SET_STEP":return{...t,step:a.step,errorMessage:null};case"SET_FLOW_TYPE":return{...t,flowType:a.flowType,fiatAmount:"",cryptoAmount:"",paymentMethodId:"",selectedQuote:null,selectedProvider:null,errorMessage:null};case"SET_FIAT_CURRENCY":return{...t,fiatCurrency:a.currency};case"SET_FIAT_AMOUNT":return{...t,fiatAmount:a.amount};case"SET_CRYPTO_CURRENCY":return{...t,cryptoCurrency:a.currency,network:""};case"SET_CRYPTO_AMOUNT":return{...t,cryptoAmount:a.amount};case"SET_NETWORK":return{...t,network:a.network};case"SET_CRYPTO_CHAIN":return{...t,network:a.chain};case"SET_PAYMENT_METHOD":return{...t,paymentMethodId:a.methodId};case"SET_WALLET_ADDRESS":return{...t,walletAddress:a.address,walletError:null};case"SET_WALLET_ERROR":return{...t,walletError:a.message};case"SELECT_QUOTE":return{...t,selectedQuote:a.quote,selectedProvider:a.quote.gatewayId};case"SET_CUSTOMER_ID":return{...t,customerId:a.customerId};case"SET_EMAIL":return{...t,email:a.email};case"SET_COUNTRY":return{...t,country:a.country,countrySource:"manual"};case"SET_COUNTRY_AUTO":return{...t,country:a.country,countrySource:"auto"};case"SET_ERROR":return{...t,step:"error",errorMessage:a.message};case"CLEAR_ERROR":return{...t,errorMessage:null};case"RESET":return _t;default:return t}}const Vt=s.createContext(null);function Gt({projectId:t,apiUrl:a="https://api.nowramp.com",assetBaseUrl:n="",flowType:r="buy",customerId:i="",brandId:l,defaultFiatCurrency:m="USD",defaultCryptoCurrency:c="BTC",defaultNetwork:u="",defaultFiatAmount:f="",defaultCryptoAmount:h="",defaultWalletAddress:d="",defaultGateway:p,defaultCountry:g,fieldLocks:E,statusPollInterval:j=5e3,onComplete:R,onError:H,children:Q}){const P=s.useMemo(()=>({apiUrl:a,projectId:t}),[a,t]),$=u||(c?c.toLowerCase():""),W=r==="sell",_=W?!!h:!!f,x=(W?!!(_&&c&&$):!!(_&&c&&$&&d))&&p?"confirm":"amount",w=f||(r==="buy"?"250":""),[o,D]=s.useReducer(Ba,{..._t,step:x,flowType:r,fiatCurrency:m,cryptoCurrency:c,network:$,fiatAmount:Ft(w,2),cryptoAmount:Ft(h,6),walletAddress:d,customerId:i,...g?{country:g.toLowerCase(),countrySource:"manual"}:{}}),v=o.flowType==="sell",{config:S,loading:ue,error:me}=Ot(P,o.flowType,o.country||void 0),fe=s.useRef(!1);s.useEffect(()=>{var T;if(fe.current||!(S!=null&&S.detectedCountry)||o.country)return;fe.current=!0;const C=S.detectedCountry.toLowerCase();D({type:"SET_COUNTRY_AUTO",country:C});const N=(T=S.fiats)==null?void 0:T.map(L=>L.code),k=Ve(C,N);k!==o.fiatCurrency&&D({type:"SET_FIAT_CURRENCY",currency:k})},[S,o.country,o.fiatCurrency]);const q=s.useRef(!1);s.useEffect(()=>{var k;if(q.current||!g||!((k=S==null?void 0:S.fiats)!=null&&k.length))return;q.current=!0;const C=S.fiats.map(T=>T.code),N=Ve(g,C);N!==o.fiatCurrency&&D({type:"SET_FIAT_CURRENCY",currency:N})},[g,S,o.fiatCurrency]);const oe=s.useRef(o.country);s.useEffect(()=>{var k;if(o.country===oe.current||(oe.current=o.country,o.countrySource==="manual"&&(ee.current=!1),o.countrySource!=="manual")||!((k=S==null?void 0:S.fiats)!=null&&k.length))return;const C=S.fiats.map(T=>T.code),N=Ve(o.country,C);N!==o.fiatCurrency&&D({type:"SET_FIAT_CURRENCY",currency:N})},[o.country,o.countrySource,S,o.fiatCurrency]);const F=s.useRef(o.fiatCurrency);s.useEffect(()=>{var T;if(o.fiatCurrency===F.current||(F.current=o.fiatCurrency,v||!((T=S==null?void 0:S.fiats)!=null&&T.length)||!o.fiatAmount))return;const C=S.fiats.find(L=>L.code===o.fiatCurrency);if(!(C!=null&&C.minAmount))return;const N=parseFloat(o.fiatAmount),k=parseFloat(C.minAmount);!isNaN(N)&&!isNaN(k)&&N<k&&D({type:"SET_FIAT_AMOUNT",amount:String(Math.ceil(k))})},[o.fiatCurrency,o.fiatAmount,S,v]),s.useEffect(()=>{var k,T,L;if(!S||!o.cryptoCurrency||o.network)return;const C=(k=S.cryptos)==null?void 0:k.find(U=>U.code===o.cryptoCurrency),N=((T=C==null?void 0:C.networks)==null?void 0:T.find(U=>U.isDefault))||((L=C==null?void 0:C.networks)==null?void 0:L[0]);N!=null&&N.id&&D({type:"SET_NETWORK",network:N.id})},[S,o.cryptoCurrency,o.network]),s.useEffect(()=>{var L,U;if(!((L=S==null?void 0:S.paymentMethods)!=null&&L.length))return;const C=o.fiatCurrency,N=S.paymentMethods;if(o.paymentMethodId&&N.some(G=>G.id===o.paymentMethodId&&G.supportedFiats.includes(C)))return;const T=N.find(M=>M.supportedFiats.includes(C)&&(M.id.includes("card")||M.id.includes("debit")))||N.find(M=>M.supportedFiats.includes(C));D({type:"SET_PAYMENT_METHOD",methodId:(T==null?void 0:T.id)||((U=N[0])==null?void 0:U.id)||""})},[S,o.fiatCurrency,o.paymentMethodId]);const Y=s.useMemo(()=>{if(v){if(!o.cryptoAmount)return null;const L=parseFloat(o.cryptoAmount);return isNaN(L)||L<=0?"Enter a valid amount":null}if(!S||!o.fiatAmount)return null;const C=parseFloat(o.fiatAmount);if(isNaN(C))return null;const N=S.fiats.find(L=>L.code===o.fiatCurrency);if(!N)return null;const k=parseFloat(N.minAmount),T=parseFloat(N.maxAmount);return!isNaN(k)&&C<k?`Minimum amount is ${N.minAmount} ${o.fiatCurrency}`:!isNaN(T)&&C>T?`Maximum amount is ${N.maxAmount} ${o.fiatCurrency}`:null},[S,o.fiatAmount,o.fiatCurrency,o.cryptoAmount,v]),K=s.useMemo(()=>{const C=v?!!o.cryptoAmount:!!o.fiatAmount;return!S||!C||!o.cryptoCurrency||!o.network||Y||S.detectedCountry&&o.countrySource===""&&!g?null:{fiatCurrency:o.fiatCurrency,...v?{cryptoAmount:o.cryptoAmount}:{fiatAmount:o.fiatAmount},cryptoCurrency:o.cryptoCurrency,network:o.network,paymentMethodId:o.paymentMethodId||void 0,country:o.country||void 0,orderType:o.flowType}},[S,o.fiatCurrency,o.fiatAmount,o.cryptoAmount,o.cryptoCurrency,o.network,o.paymentMethodId,o.country,o.countrySource,Y,v,o.flowType,g]),{quotes:V,loading:se,error:ie,refetch:Ae}=Ht(P,K),ee=s.useRef(!1);s.useEffect(()=>{ee.current||o.countrySource==="auto"&&(se||!K||ie||!V||V.bestQuote||o.fiatCurrency!=="USD"&&(ee.current=!0,D({type:"SET_FIAT_CURRENCY",currency:"USD"}),D({type:"SET_FIAT_AMOUNT",amount:"250"})))},[V,se,ie,K,o.countrySource,o.fiatCurrency]);const{order:I,loading:we,error:Ce,createOrder:ke}=Pt(P),De=15e3,{status:z,loading:Me}=Kt({apiUrl:a},(I==null?void 0:I.orderId)??null,{pollInterval:j,initialDelay:De});s.useEffect(()=>{(z==null?void 0:z.status)==="completed"&&R&&R(z)},[z==null?void 0:z.status,R]),s.useEffect(()=>{const C=me||Ce;C&&H&&H(C)},[me,Ce,H]);const he=p||(S==null?void 0:S.defaultGateway)||null,Te=s.useRef(he);Te.current=he;const Ie=s.useRef(V);Ie.current=V;const te=s.useRef(l);te.current=l;const Le=s.useCallback(async()=>{var N,k,T;const C=((N=o.selectedQuote)==null?void 0:N.gatewayId)||((T=(k=Ie.current)==null?void 0:k.bestQuote)==null?void 0:T.gatewayId)||Te.current;if(!C||!o.walletAddress){const L=[!C&&"gateway",!o.walletAddress&&"walletAddress"].filter(Boolean).join(", ");D({type:"SET_ERROR",message:`Missing required fields: ${L}`});return}try{await ke({gateway:C,customerId:o.customerId||void 0,fiatCurrency:o.fiatCurrency,...v?{cryptoAmount:o.cryptoAmount}:{fiatAmount:o.fiatAmount},cryptoCurrency:o.cryptoCurrency,network:o.network,walletAddress:o.walletAddress,paymentMethodId:o.paymentMethodId||void 0,email:o.email||void 0,orderType:o.flowType,...te.current?{metadata:{brand:te.current}}:{}}),D({type:"SET_STEP",step:"checkout"})}catch(L){const U=L instanceof Error?L.message:"Failed to create order";/wallet|address/i.test(U)?D({type:"SET_WALLET_ERROR",message:U.replace(/^Failed to create checkout intent:\s*/i,"")}):D({type:"SET_ERROR",message:U})}},[o,ke,v]),ze=s.useCallback(C=>{D({type:"SET_STEP",step:C})},[]),Je=s.useCallback(()=>{const C=["confirm","amount","quotes","wallet","checkout","processing","complete"],N=C.indexOf(o.step);N>0&&D({type:"SET_STEP",step:C[N-1]})},[o.step,v]),Be=s.useMemo(()=>{const C=v?!!o.cryptoAmount:!!o.fiatAmount;switch(o.step){case"confirm":return!!(C&&o.cryptoCurrency&&o.network&&o.walletAddress&&!Y);case"amount":return!!(C&&o.cryptoCurrency&&o.network&&!Y);case"quotes":return!!o.selectedQuote;case"wallet":return!!o.walletAddress;default:return!1}},[o,Y,v]),ae={apiConfig:P,assetBaseUrl:n,config:S,configLoading:ue,configError:me,state:o,dispatch:D,quotes:V,quotesLoading:se,quotesError:ie,fetchQuotes:Ae,order:I,orderLoading:we,orderError:Ce,createOrder:Le,orderStatus:z,orderStatusLoading:Me,fieldLocks:E||null,defaultGateway:he,amountError:Y,goToStep:ze,goBack:Je,canProceed:Be};return e.jsx(Vt.Provider,{value:ae,children:Q})}function ye(){const t=s.useContext(Vt);if(!t)throw new Error("useRamp must be used within a RampProvider");return t}const je={ethereum:{name:"Ethereum (ERC20)",shortName:"Ethereum",icon:"eth"},bitcoin:{name:"Bitcoin",icon:"btc"},solana:{name:"Solana",icon:"sol"},polygon:{name:"Polygon",icon:"pol"},arbitrum:{name:"Arbitrum",icon:"arb"},avalanche:{name:"Avalanche C-Chain",shortName:"Avalanche",icon:"avax"},litecoin:{name:"Litecoin",icon:"ltc"},tezos:{name:"Tezos",icon:"xtz"},sei:{name:"SEI",icon:"sei"},imx:{name:"Immutable X",shortName:"Immutable",icon:"imx"},galachain:{name:"Gala",icon:"gala"},zksync2:{name:"zkSync Era",shortName:"zkSync",icon:"zksync"},zks:{name:"zkSpace",icon:"zks"},"flow-evm":{name:"Flow (EVM)",shortName:"Flow",icon:"flow"},vara:{name:"Vara",icon:"vara"},venom:{name:"Venom",icon:"venom"},hsk:{name:"HashKey Chain",shortName:"HashKey",icon:"hsk"},mck:{name:"MCK",icon:"mck"},peer:{name:"Peer",icon:"peer"},goerli:{name:"Goerli Testnet",shortName:"Goerli",icon:"eth"},hbartestnet:{name:"Hedera Testnet",shortName:"Hedera",icon:"hbar"},arbitrumrinkeby:{name:"Arbitrum Testnet",shortName:"Arbitrum",icon:"arb"},dydxtestnet:{name:"dYdX Testnet",shortName:"dYdX",icon:"stark"},"zksync-rinkeby":{name:"zkSync Testnet",shortName:"zkSync",icon:"zksync"},ETH:{name:"Ethereum (ERC20)",shortName:"Ethereum",icon:"eth"},BSC:{name:"Binance Smart Chain (BEP20)",shortName:"Binance",icon:"bnb"},BTC:{name:"Bitcoin",icon:"btc"},SOL:{name:"Solana",icon:"sol"},MATIC:{name:"Polygon",icon:"pol"},ARB:{name:"Arbitrum",icon:"arb"},BASE:{name:"Base",icon:"base"},OPTIMISM:{name:"Optimism",icon:"op"},AVAX_C:{name:"Avalanche C-Chain",shortName:"Avalanche C",icon:"avax"},AVAX_X:{name:"Avalanche X-Chain",shortName:"Avalanche X",icon:"avax"},ADA:{name:"Cardano",icon:"ada"},DOT:{name:"Polkadot",icon:"dot"},TRON:{name:"Tron (TRC20)",shortName:"Tron",icon:"trx"},XRP:{name:"Ripple",icon:"xrp"},XLM:{name:"Stellar",icon:"xlm"},ALGO:{name:"Algorand",icon:"algo"},ATOM:{name:"Cosmos",icon:"atom"},NEAR:{name:"NEAR Protocol",shortName:"NEAR",icon:"near"},SUI:{name:"Sui",icon:"sui"},APT:{name:"Aptos",icon:"apt"},TON:{name:"Ton",icon:"ton"},FIL:{name:"Filecoin",icon:"fil"},FLOW:{name:"Flow",icon:"flow"},HBAR:{name:"Hedera Hashgraph",shortName:"Hedera",icon:"hbar"},INJ:{name:"Injective",icon:"inj"},SEI_EVM:{name:"SEI (EVM)",shortName:"SEI",icon:"sei"},ZKSYNC:{name:"zkSync",icon:"zksync"},LINEA:{name:"Linea",icon:"linea"},STARK:{name:"StarkNet",icon:"strk"},LN:{name:"Lightning",icon:"btc"},CELO:{name:"Celo",icon:"celo"},CRO:{name:"Cronos",icon:"cro"},FTM:{name:"Fantom",icon:"ftm"},GLMR:{name:"Moonbeam",icon:"glmr"},MOVR:{name:"Moonriver",icon:"movr"},KSM:{name:"Kusama",icon:"ksm"},EOS:{name:"EOS",icon:"eos"},ETC:{name:"Ethereum Classic",shortName:"ETH Classic",icon:"etc"},LTC:{name:"Litecoin",icon:"ltc"},BCH:{name:"Bitcoin Cash",shortName:"BTC Cash",icon:"bch"},DOGE:{name:"Dogecoin",icon:"doge"},BNB:{name:"Binance Chain (BEP2)",shortName:"Binance",icon:"bnb"},ONE:{name:"Harmony",icon:"one"},KLAY:{name:"Kaia",icon:"kaia"},RON:{name:"Ronin",icon:"ron"},LRC:{name:"Loopring",icon:"lrc"},ICP:{name:"Internet Computer",shortName:"ICP",icon:"icp"},EGLD:{name:"MultiversX",icon:"egld"},FLUX:{name:"Flux",icon:"flux"},KDA:{name:"Kadena",icon:"kda"},WAVES:{name:"Waves",icon:"waves"},XTZ:{name:"Tezos",icon:"xtz"},ACA:{name:"Acala",icon:"aca"},ALEO:{name:"Aleo",icon:"aleo"},ALPH:{name:"Alephium",icon:"alph"},APE:{name:"ApeChain",icon:"ape"},ASTR:{name:"Astar",icon:"astr"},AZERO:{name:"Aleph Zero",icon:"azero"},AZERO_EVM:{name:"Aleph Zero EVM",shortName:"Aleph Zero",icon:"azero"},BAJU:{name:"Bajun Network",shortName:"Bajun",icon:"baju"},BNCPOLKA:{name:"Bifrost Polkadot",shortName:"Bifrost",icon:"bnc"},BNC:{name:"Bifrost Kusama",shortName:"Bifrost",icon:"bnc"},BOBA:{name:"Boba Network",shortName:"Boba",icon:"boba"},BSX:{name:"Basilisk",icon:"bsx"},CHZ:{name:"Chiliz",icon:"chz"},VIC:{name:"Viction",icon:"vic"},CCD:{name:"Concordium",icon:"ccd"},COREUM:{name:"Coreum",icon:"coreum"},DINGO:{name:"Dingocoin",icon:"dingo"},HDX:{name:"Hydration",icon:"hdx"},PLMC:{name:"Polimec",icon:"plmc"},MNT:{name:"Mantle",icon:"mnt"},ERG:{name:"Ergo",icon:"erg"},ECLIPSE:{name:"Eclipse",icon:"eclipse"},FUEL:{name:"Fuel Ignition",shortName:"Fuel",icon:"fuel"},INK:{name:"Ink",icon:"ink"},SOPHON:{name:"Sophon",icon:"sophon"},UNICHAIN:{name:"Unichain",icon:"unichain"},WLD:{name:"Worldchain",icon:"wld"},ETHERLINK:{name:"Etherlink",icon:"etherlink"},MOB:{name:"MobileCoin",icon:"mob"},GALA:{name:"Gala",icon:"gala"},GUNZ:{name:"Gunz",icon:"gun"},HNT:{name:"Helium",icon:"hnt"},BITKUB:{name:"BitKub",icon:"kub"},IMMUTABLE_ZKEVM:{name:"Immutable-zkEVM",shortName:"Immutable",icon:"imx"},INIT:{name:"Initia",icon:"init"},INTR:{name:"Interlay",icon:"intr"},KINESIS:{name:"Kinesis",icon:"kag"},KAR:{name:"Karura",icon:"kar"},KCC:{name:"KuCoin Community Chain",shortName:"KuCoin",icon:"kcs"},KILT:{name:"KILT Spiritnet",shortName:"KILT",icon:"kilt"},KINT:{name:"Kintsugi",icon:"kint"},KMD:{name:"Komodo",icon:"kmd"},LSK:{name:"Lisk",icon:"lsk"},METIS:{name:"Metis Andromeda",shortName:"Metis",icon:"metis"},MYTH:{name:"Myth",icon:"myth"},OAS:{name:"Oasys",icon:"oas"},PEAQ_EVM:{name:"Peaq (EVM)",shortName:"Peaq",icon:"peaq"},PEN:{name:"Pendulum",icon:"pen"},PI:{name:"Pi",icon:"pi"},POLYX:{name:"Polymesh",icon:"polyx"},Q:{name:"QuantumCoin",icon:"q"},QRL:{name:"Quantum Resistant Ledger",shortName:"QRL",icon:"qrl"},QUBIC:{name:"Qubic",icon:"qubic"},RBX:{name:"ReserveBlock",icon:"rbx"},ROLLUX:{name:"Rollux",icon:"rollux"},THORCHAIN:{name:"Thorchain",icon:"rune"},S:{name:"Sonic",icon:"s"},SONIC:{name:"Sonic",icon:"s"},TERNOA:{name:"Ternoa",icon:"caps"},SX:{name:"SX Network",icon:"sol"},WAX:{name:"WAX",icon:"waxp"},XCH:{name:"Chia Chain",icon:"xch"},XPRT:{name:"Persistence",icon:"xprt"},ZETACHAIN:{name:"ZetaChain",icon:"zeta"},ZTG:{name:"Zeitgeist",icon:"ztg"},PLS:{name:"Pulsechain",icon:"pulsechain"},MEZO:{name:"Mezo",icon:"mezo"},BSV:{name:"Bitcoin SV",shortName:"BTC SV",icon:"btc"},MONAD:{name:"Monad",icon:"mon"},SUPRA:{name:"Supra",icon:"supra"},SOMI:{name:"Somnia",icon:"somi"},VERIFIEDX:{name:"VerifiedX",icon:"vfx"},MOVE:{name:"Movement",icon:"move"},FLR:{name:"Flare",icon:"flr"},ASSETHUB:{name:"Asset Hub Polkadot",shortName:"Asset Hub",icon:"dot"},BOB:{name:"BOB",icon:"btc"},GLUE:{name:"Glue",icon:"eth"},DYDX:{name:"StarkEx",icon:"stark"},OKC:{name:"OKX Chain",icon:"eth"},UNI_CHAIN:{name:"UNI",icon:"uni"},ZEC:{name:"ZCash",icon:"zec"}},ct=[{code:"BTC",name:"Bitcoin",chains:["BTC","LN"],popular:!0},{code:"ETH",name:"Ethereum",chains:["ETH","ARB","BASE","BSC","OPTIMISM","LINEA","ZKSYNC","LRC","STARK","APE","ECLIPSE","FUEL","INK","SOPHON","UNICHAIN","WLD"],popular:!0},{code:"USDC",name:"USD Coin",chains:["ETH","SOL","ARB","BASE","BSC","MATIC","OPTIMISM","AVAX_C","ALGO","APT","CELO","FLOW","HBAR","LINEA","LRC","ZKSYNC","STARK","SUI","XLM","ECLIPSE","HDX","INK","LSK","METIS","MONAD","SEI_EVM","SONIC","SOPHON","SX","UNICHAIN","APE","BNCPOLKA","GLMR","PEAQ_EVM","PLMC","RON","UNI_CHAIN","WLD","BITKUB","BOB","DYDX","ETHERLINK","GLUE","ASSETHUB"],popular:!0},{code:"USDT",name:"Tether",chains:["ETH","BSC","TRON","ARB","MATIC","AVAX_C","SOL","OPTIMISM","ZKSYNC","STARK","APT","CELO","KLAY","LRC","LSK","ECLIPSE","ETHERLINK","OKC","PEAQ_EVM","BNCPOLKA","GLMR","HDX","PLMC","VIC","ASSETHUB"],popular:!0},{code:"SOL",name:"Solana",chains:["SOL"],popular:!0},{code:"XRP",name:"Ripple",chains:["XRP"],popular:!0},{code:"ADA",name:"Cardano",chains:["ADA"],popular:!0},{code:"DOGE",name:"Dogecoin",chains:["DOGE"],popular:!0},{code:"DOT",name:"Polkadot",chains:["DOT","BSC","BNCPOLKA","GLMR","HDX","PLMC"],popular:!0},{code:"AVAX",name:"Avalanche",chains:["AVAX_C","AVAX_X","BSC"],popular:!0},{code:"LINK",name:"ChainLink",chains:["ETH","BSC"],popular:!0},{code:"LTC",name:"Litecoin",chains:["LTC"],popular:!0},{code:"AAVE",name:"Aave",chains:["ETH","BSC"],popular:!1},{code:"ACA",name:"Acala",chains:["ACA"],popular:!1},{code:"ALEO",name:"Aleo",chains:["ALEO"],popular:!1},{code:"ALGO",name:"Algorand",chains:["ALGO"],popular:!1},{code:"ALPH",name:"Alephium",chains:["ALPH"],popular:!1},{code:"APE",name:"ApeCoin",chains:["APE","ETH"],popular:!1},{code:"APT",name:"Aptos",chains:["APT"],popular:!1},{code:"ARB",name:"Arbitrum",chains:["ARB"],popular:!1},{code:"ASTR",name:"Astar",chains:["ASTR"],popular:!1},{code:"ATOM",name:"Cosmos",chains:["ATOM"],popular:!1},{code:"AUDD",name:"Novatti Australian Digital Dollar",chains:["ETH"],popular:!1},{code:"AVT",name:"Aventus",chains:["ETH"],popular:!1},{code:"AXS",name:"Axie Infinity",chains:["ETH","RON"],popular:!1},{code:"AZERO",name:"Aleph Zero",chains:["AZERO","AZERO_EVM"],popular:!1},{code:"BAJU",name:"Bajun Network",chains:["BAJU"],popular:!1},{code:"BARSIK",name:"Hasbulla's Cat",chains:["SOL"],popular:!1},{code:"BAT",name:"Basic Attention Token",chains:["ETH","BSC"],popular:!1},{code:"BCH",name:"Bitcoin Cash",chains:["BCH"],popular:!1},{code:"BNB",name:"Binance Coin",chains:["BNB","BSC"],popular:!1},{code:"BNC",name:"Bifrost Native Coin",chains:["BNC","BNCPOLKA"],popular:!1},{code:"BOBA",name:"Boba Network",chains:["BOBA","ETH"],popular:!1},{code:"BORA",name:"Bora",chains:["KLAY"],popular:!1},{code:"BRETT",name:"Brett",chains:["BASE"],popular:!1},{code:"BSX",name:"Basilisk",chains:["BSX"],popular:!1},{code:"BZR",name:"Bazaars",chains:["ETH"],popular:!1},{code:"CAGA",name:"Crypto Asset Governance Alliance",chains:["ETH"],popular:!1},{code:"CAKE",name:"PancakeSwap",chains:["BSC"],popular:!1},{code:"CAPS",name:"Caps",chains:["TERNOA"],popular:!1},{code:"CELO",name:"Celo",chains:["CELO"],popular:!1},{code:"CHZ",name:"Chiliz",chains:["CHZ","BNB","ETH"],popular:!1},{code:"C98",name:"Coin98",chains:["VIC"],popular:!1},{code:"CCD",name:"Concordium",chains:["CCD"],popular:!1},{code:"COMP",name:"Compound",chains:["ETH","BSC"],popular:!1},{code:"COREUM",name:"Coreum",chains:["COREUM","XRP"],popular:!1},{code:"CRO",name:"Cronos",chains:["CRO"],popular:!1},{code:"CUSD",name:"Celo Dollar",chains:["CELO"],popular:!1},{code:"CVC",name:"Civic",chains:["ETH"],popular:!1},{code:"DAI",name:"Dai",chains:["ETH","BASE","MATIC"],popular:!1},{code:"DINGO",name:"Dingocoin",chains:["DINGO"],popular:!1},{code:"EGLD",name:"MultiversX",chains:["EGLD"],popular:!1},{code:"EMBER",name:"Ember Sword",chains:["MNT"],popular:!1},{code:"EOS",name:"EOS",chains:["EOS"],popular:!1},{code:"ERG",name:"Ergo",chains:["ERG"],popular:!1},{code:"ETC",name:"Ethereum Classic",chains:["ETC","BSC"],popular:!1},{code:"EUR",name:"EURC",chains:["BASE"],popular:!1},{code:"EUROC",name:"Euro Coin",chains:["ETH"],popular:!1},{code:"EURQ",name:"Quantoz EURQ",chains:["ETH"],popular:!1},{code:"EURR",name:"StablR EUR",chains:["ETH"],popular:!1},{code:"EUSD",name:"Electronic USD",chains:["MOB"],popular:!1},{code:"EXIT",name:"EXIT - Designer Token",chains:["BSC"],popular:!1},{code:"FDUSD",name:"First Digital USD",chains:["SUI"],popular:!1},{code:"FIL",name:"Filecoin",chains:["FIL","BSC"],popular:!1},{code:"FLOW",name:"Flow",chains:["FLOW"],popular:!1},{code:"FLR",name:"Flare",chains:["FLR"],popular:!1},{code:"FLUX",name:"Flux",chains:["FLUX"],popular:!1},{code:"FTM",name:"Fantom",chains:["FTM","ETH","BSC"],popular:!1},{code:"GALA",name:"Gala",chains:["GALA"],popular:!1},{code:"GLMR",name:"Moonbeam",chains:["GLMR"],popular:!1},{code:"GMX",name:"GMX",chains:["ARB"],popular:!1},{code:"GNUS",name:"Genius AI",chains:["ETH"],popular:!1},{code:"GRT",name:"The Graph",chains:["ETH","ARB"],popular:!1},{code:"GUN",name:"Gunz",chains:["GUNZ"],popular:!1},{code:"HBAR",name:"Hedera",chains:["HBAR"],popular:!1},{code:"HDX",name:"HydraDX",chains:["HDX"],popular:!1},{code:"HNT",name:"Helium",chains:["HNT"],popular:!1},{code:"HTP",name:"HowToPay",chains:["BSC"],popular:!1},{code:"HVLO",name:"Hivello",chains:["SOL"],popular:!1},{code:"ICP",name:"Internet Computer",chains:["ICP"],popular:!1},{code:"IMX",name:"Immutable X",chains:["ETH"],popular:!1},{code:"INIT",name:"Initia",chains:["INIT"],popular:!1},{code:"INJ",name:"Injective",chains:["INJ"],popular:!1},{code:"INTR",name:"Interlay",chains:["INTR"],popular:!1},{code:"JAM",name:"Jam Tune.FM",chains:["HBAR"],popular:!1},{code:"KAG",name:"Silver",chains:["KINESIS"],popular:!1},{code:"KAIA",name:"Kaia",chains:["KLAY"],popular:!1},{code:"KAR",name:"Karura",chains:["KAR"],popular:!1},{code:"KAU",name:"Gold",chains:["KINESIS"],popular:!1},{code:"KCS",name:"KuCoin Token",chains:["ETH","KCC"],popular:!1},{code:"KDA",name:"Kadena",chains:["KDA"],popular:!1},{code:"KILT",name:"KILT",chains:["KILT"],popular:!1},{code:"KINT",name:"Kintsugi",chains:["KINT"],popular:!1},{code:"KLV",name:"Klever",chains:["TRON"],popular:!1},{code:"KMD",name:"Komodo",chains:["KMD"],popular:!1},{code:"KSM",name:"Kusama",chains:["KSM"],popular:!1},{code:"KUB",name:"Bitkub Coin",chains:["BITKUB"],popular:!1},{code:"LOOKS",name:"LooksRare",chains:["ETH"],popular:!1},{code:"LRC",name:"Loopring",chains:["ETH","LRC"],popular:!1},{code:"LSK",name:"Lisk",chains:["LSK"],popular:!1},{code:"MANA",name:"Decentraland",chains:["ETH"],popular:!1},{code:"MBX",name:"Marblex",chains:["IMMUTABLE_ZKEVM","KLAY"],popular:!1},{code:"MELANIA",name:"Melania",chains:["SOL"],popular:!1},{code:"METAMASKUSD",name:"Metamask USD",chains:["ETH","LINEA"],popular:!1},{code:"METIS",name:"Metis",chains:["METIS"],popular:!1},{code:"MEZOUSD",name:"MUSD",chains:["ETH","MEZO"],popular:!1},{code:"MKR",name:"Maker",chains:["ETH","BSC"],popular:!1},{code:"MNEE",name:"MNEE",chains:["BSV","ETH"],popular:!1},{code:"MNT",name:"Mantle",chains:["ETH","MNT"],popular:!1},{code:"MOB",name:"MobileCoin",chains:["MOB"],popular:!1},{code:"MON",name:"Monad",chains:["MONAD"],popular:!1},{code:"MOVE",name:"Movement",chains:["MOVE"],popular:!1},{code:"MOVR",name:"Moonriver",chains:["MOVR"],popular:!1},{code:"MYTH",name:"Myth",chains:["MYTH"],popular:!1},{code:"NEAR",name:"NEAR Protocol",chains:["NEAR","BSC"],popular:!1},{code:"NEIRO",name:"NEIRO Ethereum",chains:["ETH"],popular:!1},{code:"OAS",name:"Oasys",chains:["OAS"],popular:!1},{code:"OMG",name:"OmiseGo",chains:["ETH"],popular:!1},{code:"OMUSD",name:"Open Money USD",chains:["ETH"],popular:!1},{code:"ONE",name:"Harmony",chains:["ONE","BNB","ETH"],popular:!1},{code:"OP",name:"Optimism",chains:["OPTIMISM"],popular:!1},{code:"ORDER",name:"Orderly Network",chains:["ETH"],popular:!1},{code:"PEAQ",name:"Peaq",chains:["PEAQ_EVM"],popular:!1},{code:"PEN",name:"Pendulum",chains:["PEN"],popular:!1},{code:"PERC",name:"Perion",chains:["ETH"],popular:!1},{code:"PI",name:"Pi",chains:["PI"],popular:!1},{code:"PLMC",name:"Polimec",chains:["PLMC"],popular:!1},{code:"POL",name:"Polygon",chains:["ETH","MATIC"],popular:!1},{code:"POLYX",name:"Polymesh",chains:["POLYX"],popular:!1},{code:"PROPC",name:"Propchain",chains:["ETH"],popular:!1},{code:"PSTAKE",name:"pSTAKE Finance",chains:["ETH"],popular:!1},{code:"Q",name:"QuantumCoin",chains:["Q"],popular:!1},{code:"QRDO",name:"Qredo",chains:["ETH"],popular:!1},{code:"QRL",name:"Quantum Resistant Ledger",chains:["QRL"],popular:!1},{code:"QUBIC",name:"QUBIC",chains:["QUBIC"],popular:!1},{code:"RBX",name:"ReserveBlock",chains:["RBX"],popular:!1},{code:"REVU",name:"Revuto",chains:["ADA"],popular:!1},{code:"RITE",name:"Ritestream",chains:["BSC"],popular:!1},{code:"RLUSD",name:"Ripple USD",chains:["ETH"],popular:!1},{code:"RON",name:"Ronin",chains:["RON"],popular:!1},{code:"RUNE",name:"THORChain",chains:["THORCHAIN"],popular:!1},{code:"S",name:"Sonic",chains:["S"],popular:!1},{code:"SAND",name:"The Sandbox",chains:["ETH","BSC"],popular:!1},{code:"SEI",name:"SEI",chains:["SEI_EVM"],popular:!1},{code:"SNX",name:"Synthetix",chains:["ETH"],popular:!1},{code:"SOIL",name:"Sun Minimeal",chains:["PLS"],popular:!1},{code:"SOLO",name:"Sologenic",chains:["XRP"],popular:!1},{code:"SOMI",name:"Somnia",chains:["SOMI"],popular:!1},{code:"STRK",name:"Starknet",chains:["STARK"],popular:!1},{code:"SUI",name:"Sui",chains:["SUI"],popular:!1},{code:"SUPR",name:"SuperDapp",chains:["ROLLUX"],popular:!1},{code:"SUPRA",name:"Supra",chains:["SUPRA"],popular:!1},{code:"SUSHI",name:"SushiSwap",chains:["ETH","BSC"],popular:!1},{code:"SYS",name:"Syscoin",chains:["ROLLUX"],popular:!1},{code:"TBTC",name:"tBTC",chains:["SUI","STARK"],popular:!1},{code:"TON",name:"Toncoin",chains:["TON"],popular:!1},{code:"TRUMP",name:"TRUMP",chains:["SOL"],popular:!1},{code:"TRX",name:"Tron",chains:["TRON","BSC"],popular:!1},{code:"TWT",name:"Trust Wallet Token",chains:["BSC"],popular:!1},{code:"UNI",name:"Uniswap",chains:["ETH","BSC"],popular:!1},{code:"URANIUM",name:"Uranium",chains:["ETHERLINK"],popular:!1},{code:"USD0",name:"Usual USD",chains:["ETH"],popular:!1},{code:"USD1",name:"World Liberty Financial USD",chains:["SOL"],popular:!1},{code:"USDE",name:"Ethena USDe",chains:["ETH"],popular:!1},{code:"USDP",name:"Pax Dollar",chains:["ETH"],popular:!1},{code:"USDQ",name:"Quantoz USDQ",chains:["ETH"],popular:!1},{code:"USDR",name:"StablR USD",chains:["ETH"],popular:!1},{code:"USDT0",name:"USDT0",chains:["INK"],popular:!1},{code:"VFX",name:"VerifiedX",chains:["VERIFIEDX"],popular:!1},{code:"VERSE",name:"Verse",chains:["ETH","MATIC"],popular:!1},{code:"VIC",name:"Viction",chains:["VIC"],popular:!1},{code:"WAL",name:"Walrus",chains:["SUI"],popular:!1},{code:"WAVES",name:"Waves",chains:["WAVES"],popular:!1},{code:"WAXP",name:"WAX",chains:["WAX"],popular:!1},{code:"WBTC",name:"Wrapped Bitcoin",chains:["ETH","STARK"],popular:!1},{code:"WETH",name:"Wrapped Ether",chains:["ETHERLINK"],popular:!1},{code:"WLD",name:"Worldcoin",chains:["WLD"],popular:!1},{code:"WLFI",name:"World Liberty Financial",chains:["ETH"],popular:!1},{code:"WOLF",name:"LandWolf",chains:["ETH"],popular:!1},{code:"WOMBAT",name:"Wombat",chains:["MATIC"],popular:!1},{code:"XCH",name:"Chia",chains:["XCH"],popular:!1},{code:"XLM",name:"Stellar Lumens",chains:["XLM","BSC"],popular:!1},{code:"XPRT",name:"Persistence",chains:["XPRT"],popular:!1},{code:"XTZ",name:"Tezos",chains:["XTZ","ETHERLINK"],popular:!1},{code:"YFI",name:"yearn.finance",chains:["ETH"],popular:!1},{code:"ZBU",name:"Zeebu",chains:["BSC"],popular:!1},{code:"ZEC",name:"ZCash",chains:["ZEC"],popular:!1},{code:"ZCHF",name:"Frankencoin",chains:["ETH"],popular:!1},{code:"ZETA",name:"Zeta",chains:["ETH","ZETACHAIN"],popular:!1},{code:"ZTG",name:"Zeitgeist",chains:["ZTG"],popular:!1}],Oa=Object.fromEntries(ct.map(t=>[t.code,t.name])),$t={AED:"ae",ALL:"al",ARS:"ar",AUD:"au",BRL:"br",CAD:"ca",CHF:"ch",CLP:"cl",CZK:"cz",DKK:"dk",EUR:"eu",GBP:"gb",HKD:"hk",IDR:"id",INR:"in",JPY:"jp",KRW:"kr",MXN:"mx",NGN:"ng",NOK:"no",NZD:"nz",PHP:"ph",PLN:"pl",QAR:"qa",SAR:"sa",SEK:"se",SGD:"sg",THB:"th",TRY:"tr",TWD:"tw",USD:"us",VND:"vn",ZAR:"za"};function dt(t,a=""){return`${a}/crypto-icons/${t.toLowerCase()}.svg`}function Xt(t,a=""){const n=$t[t]||"us";return`${a}/flags/${n}.svg`}function Ge(t){return je[t]||je[t.toLowerCase()]||je[t.toUpperCase()]||je[t.toUpperCase().replace(/-/g,"_")]||je[t.toLowerCase().replace(/-/g,"_")]}function $e(t,a=""){const n=Ge(t);return n?`${a}/crypto-icons/${n.icon}.svg`:`${a}/crypto-icons/${t.toLowerCase()}.svg`}const rt=[{code:"ALL",name:"Albania Lek"},{code:"ARS",name:"Argentina Peso"},{code:"AUD",name:"Australian Dollar"},{code:"BRL",name:"Brazilian Real"},{code:"CAD",name:"Canadian Dollar"},{code:"EUR",name:"Euro"},{code:"GBP",name:"British Pound"},{code:"JPY",name:"Japanese Yen"},{code:"USD",name:"US Dollar"},{code:"CHF",name:"Swiss Franc"},{code:"MXN",name:"Mexican Peso"},{code:"INR",name:"Indian Rupee"}],ot=[{id:"blue",name:"Blue",accent:"#0077FF"},{id:"violet",name:"Violet",accent:"#7C3AED"},{id:"green",name:"Green",accent:"#10B981"},{id:"orange",name:"Orange",accent:"#F59E0B"},{id:"rose",name:"Rose",accent:"#F43F5E"},{id:"mono",name:"Mono",accent:null}],st={USDC:{USD:.9962,EUR:1.0814,GBP:1.2573,JPY:.00667,CAD:.7198,AUD:.6384,BRL:.1726,CHF:1.1306,MXN:.0487,INR:.01187,ARS:855e-6,ALL:.01058},USDT:{USD:.9958,EUR:1.081,GBP:1.2568,JPY:.00666,CAD:.7194,AUD:.638,BRL:.1724,CHF:1.1301,MXN:.0486,INR:.01186,ARS:854e-6,ALL:.01057},BTC:{USD:104e-7,EUR:1129e-8,GBP:1313e-8,JPY:696e-10,CAD:751e-8,AUD:666e-8,BRL:18e-7,CHF:118e-7,MXN:508e-9,INR:124e-9,ARS:892e-11,ALL:11e-8},ETH:{USD:316e-6,EUR:343e-6,GBP:399e-6,JPY:211e-8,CAD:228e-6,AUD:202e-6,BRL:547e-7,CHF:358e-6,MXN:154e-7,INR:376e-8,ARS:271e-9,ALL:335e-8},SOL:{USD:.00424,EUR:.004607,GBP:.005356,JPY:284e-7,CAD:.003063,AUD:.002716,BRL:734e-6,CHF:.004812,MXN:207e-6,INR:505e-7,ARS:364e-8,ALL:45e-6},XRP:{USD:.4081,EUR:.4432,GBP:.5153,JPY:.00273,CAD:.2948,AUD:.2614,BRL:.0707,CHF:.463,MXN:.01992,INR:.00486,ARS:35e-5,ALL:.00433},DOGE:{USD:3.896,EUR:4.232,GBP:4.92,JPY:.02607,CAD:2.815,AUD:2.496,BRL:.675,CHF:4.421,MXN:.1902,INR:.04641,ARS:.003345,ALL:.04134},ADA:{USD:1.333,EUR:1.448,GBP:1.683,JPY:.00892,CAD:.963,AUD:.854,BRL:.2309,CHF:1.512,MXN:.0651,INR:.01588,ARS:.001145,ALL:.01414}},Ha=new Set(["USDC","USDT","DAI","BUSD","TUSD","FDUSD","PYUSD","USDP","USDE","USDQ","USDR","USDT0","RLUSD","CUSD","EUSD","OMUSD","MEZOUSD","METAMASKUSD","USD0","USD1","AUDD","EUROC","EURQ","EURR","ZCHF"]);function ut(t){return Ha.has(t.toUpperCase())}function Pa(t,a){var n,r;return((n=st[t])==null?void 0:n[a])??((r=st.USDC)==null?void 0:r[a])??1}function Wt(t){return parseFloat(t.replace(/,/g,""))||0}function Xe(t){if(t===0)return"0";if(t>=1e3)return t.toLocaleString("en-US",{maximumFractionDigits:2});if(t>=1)return t.toFixed(2);if(t>=.01)return t.toFixed(4);const a=t.toPrecision(4);return parseFloat(a).toString()}const re=t=>/^#([0-9A-Fa-f]{3}){1,2}$/.test(t),Dt=10,Mt=1e-4,Yt=(()=>{const t=[];for(const a of ct)for(const n of a.chains)t.push({code:a.code,name:a.name,chain:n,popular:a.popular});return t})();function Zt({src:t,alt:a,size:n,className:r="",background:i}){const[l,m]=s.useState(!1),[c,u]=s.useState(!1),f=s.useRef(t);f.current!==t&&(f.current=t,m(!1),u(!1));const h=s.useCallback(()=>m(!0),[]),d=s.useCallback(()=>u(!0),[]);return e.jsxs("div",{className:`relative rounded-full shrink-0 ${r}`,style:{width:n,height:n,background:i},children:[!l&&!c&&e.jsx("div",{className:"absolute inset-0 rounded-full animate-pulse",style:{background:"var(--t-pill-bg, #333)"}}),c?e.jsx("div",{className:"absolute inset-0 rounded-full flex items-center justify-center font-bold",style:{background:"var(--t-pill-bg, #333)",color:"var(--t-text-muted)",fontSize:Math.max(8,n*.35)},children:a.slice(0,3)}):e.jsx("img",{src:t,alt:a,width:n,height:n,onLoad:h,onError:d,className:`rounded-full ${l?"opacity-100":"opacity-0"}`,style:{width:n,height:n,transition:"opacity 0.15s ease-in"}})]})}function it({ticker:t,size:a=32,baseUrl:n=""}){return e.jsx(Zt,{src:dt(t,n),alt:t,size:a,background:"#ffffff"})}function We({currencyCode:t,size:a=16,baseUrl:n=""}){return e.jsx(Zt,{src:Xt(t,n),alt:t,size:a})}function Qe({size:t=32,color:a="#888"}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 32 32",fill:"none",children:[e.jsx("circle",{cx:"16",cy:"16",r:"16",fill:a}),e.jsx("circle",{cx:"16",cy:"16",r:"8",stroke:"white",strokeWidth:"1.5",fill:"none"})]})}function Qt({size:t=24}){return e.jsx("div",{className:"rounded-full flex items-center justify-center shrink-0",style:{width:t,height:t,background:"var(--t-card-icon-bg)"},children:e.jsxs("svg",{width:t*.6,height:t*.58,viewBox:"0 0 25 24",fill:"none",children:[e.jsx("path",{d:"M23.292 7.5H1.70801L12.5 0.592773L23.292 7.5Z",stroke:"var(--t-card-icon-stroke)",strokeWidth:"1"}),e.jsx("rect",{x:"3",y:"10",width:"1.5",height:"11",fill:"var(--t-card-icon-stroke)"}),e.jsx("rect",{x:"9",y:"10",width:"1.5",height:"11",fill:"var(--t-card-icon-stroke)"}),e.jsx("rect",{x:"15",y:"10",width:"1.5",height:"11",fill:"var(--t-card-icon-stroke)"}),e.jsx("rect",{x:"21",y:"10",width:"1.5",height:"11",fill:"var(--t-card-icon-stroke)"}),e.jsx("rect",{y:"23",width:"25",height:"1",fill:"var(--t-card-icon-stroke)"})]})})}function zt({size:t=32}){return e.jsx("div",{className:"rounded-full flex items-center justify-center text-white font-semibold shrink-0",style:{width:t,height:t,backgroundColor:"#333",fontSize:t*.45},children:"R"})}function Jt({size:t=32}){return e.jsx("div",{className:"flex items-center justify-center shrink-0",style:{width:t,height:t,background:"#000",borderRadius:t*.2},children:e.jsx("svg",{width:t*.72,height:t*.288,viewBox:"0 0 50 20",fill:"none",children:e.jsx("path",{d:"M9.14529 2.57901C8.55528 3.25398 7.61984 3.7887 6.68351 3.70976C6.56186 2.7971 7.02999 1.82591 7.55883 1.23105C8.14846 0.535892 9.166 0.0403839 9.9999 0C10.1017 0.952461 9.71518 1.88488 9.14529 2.57901ZM9.98932 3.88805C10.5171 3.92756 12.0384 4.08587 13.0125 5.48951C12.9312 5.54899 11.2066 6.51813 11.2267 8.55562C11.247 10.9883 13.4176 11.7995 13.4379 11.8193C13.4176 11.8787 13.0939 12.9667 12.3023 14.0939C11.6126 15.083 10.902 16.052 9.76606 16.0717C8.67023 16.0915 8.30483 15.4389 7.04742 15.4389C5.78949 15.4389 5.38394 16.052 4.34875 16.0915C3.25329 16.1307 2.42185 15.0429 1.73195 14.054C0.310872 12.0564 -0.764097 8.41705 0.696758 5.96431C1.40722 4.73809 2.70553 3.96677 4.10507 3.94695C5.18064 3.92756 6.17501 4.63962 6.82446 4.63962C7.47376 4.63962 8.62918 3.80889 9.98932 3.88805ZM23.544 1.13133C26.4989 1.13133 28.5569 3.11593 28.5569 6.00514C28.5569 8.90473 26.4567 10.8997 23.4702 10.8997H20.1987V15.9694H17.8349V1.13133H23.544ZM20.1987 8.96648H22.9108C24.9692 8.96648 26.1402 7.88694 26.1402 6.01552C26.1402 4.14448 24.9688 3.07467 22.9212 3.07467H20.1987V8.96648ZM29.1434 12.8945C29.1434 10.9923 30.6314 9.90226 33.375 9.7378L36.3194 9.56295V8.74027C36.3194 7.53753 35.5071 6.87939 34.0613 6.87939C32.8683 6.87939 32.0028 7.47564 31.8242 8.39042H29.6919C29.7556 6.46802 31.6126 5.06972 34.1246 5.06972C36.8262 5.06972 38.5886 6.44746 38.5886 8.58634V15.969H36.4042V14.1901H36.3515C35.7287 15.3518 34.3565 16.0817 32.8683 16.0817C30.6734 16.0817 29.1434 14.8072 29.1434 12.8945ZM36.3195 11.9385V11.1054L33.6918 11.27C32.2138 11.3624 31.4442 11.897 31.4442 12.8325C31.4442 13.7375 32.2459 14.3238 33.5018 14.3238C35.1055 14.3238 36.3195 13.3262 36.3195 11.9385ZM40.597 19.9377V18.1592C40.7449 18.1794 41.1032 18.1999 41.2935 18.1999C42.3381 18.1999 42.9291 17.7688 43.288 16.6575L43.4992 15.9997L39.4992 5.20338H41.9686L44.7548 13.9638H44.8077L47.5936 5.20338H50L45.8524 16.5445C44.9024 19.1463 43.8155 20 41.515 20C41.3354 20 40.7549 19.9793 40.597 19.9377Z",fill:"white"})})})}function qt({size:t=32}){return e.jsx("div",{className:"flex items-center justify-center shrink-0",style:{width:t,height:t,background:"#3C4043",borderRadius:t*.2},children:e.jsxs("svg",{width:t*.72,height:t*.296,viewBox:"0 0 51 21",fill:"none",children:[e.jsx("path",{d:"M50.9156 5.87122L44.6406 20.2837H42.6992L45.0289 15.2416L40.9009 5.87122H42.9451L45.929 13.0573H45.9689L48.8714 5.87122H50.9156Z",fill:"white"}),e.jsx("path",{d:"M39.3906 6.65832C38.5866 5.91563 37.4895 5.54547 36.0995 5.54547C34.314 5.54547 32.9657 6.19816 32.0513 7.50532L33.7084 8.54664C34.3211 7.66089 35.1512 7.21951 36.2011 7.21951C36.8967 7.21951 37.5008 7.44661 38.0194 7.9023C38.538 8.35948 38.7964 8.91352 38.7964 9.5665V9.99507C38.0751 9.58796 37.1536 9.38381 36.0366 9.38381C34.7297 9.38381 33.6839 9.68959 32.8998 10.3023C32.1172 10.9151 31.7256 11.738 31.7256 12.7706C31.7256 13.8033 32.0969 14.5675 32.8396 15.2216C33.5808 15.8758 34.5065 16.2016 35.6092 16.2016C36.9033 16.2016 37.9389 15.6302 38.7147 14.4876H38.7976V15.8761H40.5944V9.70955C40.5944 8.4167 40.1944 7.39982 39.3903 6.65862L39.3906 6.65832ZM37.8665 13.6501C37.2451 14.2343 36.5424 14.5272 35.7511 14.5272C35.1926 14.5272 34.7068 14.3645 34.2913 14.0387C33.8741 13.7103 33.6673 13.3032 33.6673 12.8132C33.6673 12.2675 33.923 11.8134 34.4344 11.4462C34.9443 11.079 35.5815 10.8948 36.3442 10.8948C37.3926 10.8948 38.211 11.1249 38.7967 11.5889C38.7967 12.3775 38.4867 13.0645 37.8668 13.6501H37.8665Z",fill:"white"}),e.jsx("path",{d:"M30.4166 2.52282C29.5296 1.67999 28.4552 1.25739 27.1883 1.25739H22.2017V15.8758H24.0813V9.95362H27.188C28.4678 9.95362 29.5448 9.53936 30.4163 8.70815C31.3175 7.87962 31.7661 6.84397 31.7661 5.60565C31.7661 4.36733 31.3175 3.36744 30.4163 2.52312L30.4166 2.52282ZM29.0895 7.40248C28.598 7.90525 27.9781 8.15798 27.2297 8.15798H24.0816V3.05272H27.2297C27.9781 3.05272 28.5983 3.31141 29.0895 3.82849C29.5937 4.33276 29.845 4.92554 29.845 5.60535C29.845 6.28516 29.5934 6.8994 29.0895 7.40218V7.40248Z",fill:"white"}),e.jsx("path",{d:"M16.2663 11.4026C15.8887 12.6964 15.1901 13.9058 14.2131 14.8354C14.1815 14.8655 14.1496 14.895 14.1178 14.9245C14.116 14.9263 14.1148 14.9277 14.113 14.9292C13.1524 15.8144 11.9487 16.4295 10.6737 16.7272C10.6621 16.7302 10.6502 16.7329 10.6385 16.7356C10.2484 16.8241 9.85204 16.8888 9.45357 16.929C8.81668 16.9928 8.17293 16.9928 7.53723 16.9222C7.22102 16.8873 6.9063 16.8348 6.59546 16.7639C6.49293 16.7407 6.39101 16.7156 6.28938 16.6882C5.16759 16.3884 4.11256 15.8564 3.20476 15.1337C3.0018 14.971 2.80599 14.7987 2.61823 14.6184C2.61257 14.613 2.60721 14.6077 2.60154 14.6026C1.93962 13.9657 1.38081 13.22 0.956413 12.4034C0.938829 12.3691 0.921246 12.3352 0.90396 12.3009C0.717393 11.9319 0.559138 11.5493 0.429793 11.1574C0.364822 10.9618 0.307302 10.7634 0.257233 10.5631C0.226834 10.443 0.199117 10.3226 0.174678 10.2013C0.141299 10.0397 0.112986 9.87702 0.0894411 9.714C-0.0509314 8.75165 -0.0267907 7.76517 0.166929 6.81118C0.176168 6.76468 0.185705 6.71879 0.195838 6.6723C0.345748 5.97997 0.582981 5.31 0.903662 4.67698C1.53102 3.42525 2.48025 2.33983 3.62498 1.53514H3.62528C3.73704 1.45616 3.85029 1.38076 3.96533 1.30775C3.99424 1.28957 4.02345 1.27169 4.05206 1.25351C4.11018 1.21774 4.16889 1.18257 4.2276 1.148C4.34562 1.07945 4.46513 1.01329 4.58643 0.950111C4.64723 0.918519 4.70773 0.887822 4.76912 0.858018C5.0755 0.707811 5.39111 0.576975 5.71418 0.466108C5.77021 0.446438 5.82624 0.427961 5.88227 0.409781C5.96661 0.38266 6.05095 0.356731 6.13619 0.332292C6.19312 0.315603 6.25064 0.300106 6.30786 0.284906C6.36448 0.269707 6.4217 0.255401 6.47863 0.241393C6.51111 0.233346 6.5433 0.225895 6.57579 0.218146C6.62764 0.206225 6.6792 0.194901 6.73136 0.183874C6.73464 0.183278 6.73762 0.182681 6.7406 0.181787C6.90481 0.147216 7.06992 0.117711 7.23593 0.093273C7.25262 0.0905907 7.2693 0.088205 7.28629 0.0861187C8.67482 -0.111774 10.114 0.0309834 11.4319 0.518561C12.4443 0.889311 13.3712 1.47882 14.1651 2.21048C13.899 2.4957 13.6138 2.76661 13.3378 3.04705C12.8151 3.56533 12.2971 4.08807 11.774 4.60605C11.7734 4.60545 11.7723 4.60486 11.7717 4.60367L11.7645 4.61082C11.2465 4.11639 10.6192 3.74564 9.9346 3.53642C9.1314 3.29412 8.26652 3.26044 7.44425 3.43658C7.14741 3.49946 6.85772 3.59066 6.57847 3.70779C6.57519 3.70898 6.57221 3.71047 6.56893 3.71166C5.95231 3.97393 5.38843 4.36047 4.92022 4.83881C4.3638 5.39941 3.94089 6.09352 3.68906 6.83979C3.68727 6.8386 3.68548 6.83711 3.68369 6.83591C3.31831 7.89571 3.32308 9.07889 3.68399 10.1384C3.68191 10.1402 3.67982 10.1417 3.67773 10.1435C3.67833 10.1446 3.67863 10.1458 3.67893 10.147C3.68071 10.1461 3.6822 10.1446 3.68399 10.1435C4.03567 11.1892 4.72501 12.1158 5.62835 12.7482C6.19371 13.1473 6.84014 13.428 7.51995 13.5654C8.18545 13.6987 8.87927 13.6844 9.54477 13.5705C10.2103 13.4564 10.8519 13.209 11.4128 12.8338C11.4128 12.8338 11.413 12.834 11.4134 12.8344C11.4164 12.8326 11.4194 12.8308 11.4221 12.8287C12.3081 12.2294 12.9301 11.2691 13.1095 10.2147H8.48467V6.90178H8.48944V6.89701H16.4797C16.7458 8.38955 16.6889 9.94378 16.2657 11.4029L16.2663 11.4026Z",fill:"white"})]})})}function ea({size:t=32}){return e.jsx("div",{className:"rounded-full flex items-center justify-center shrink-0",style:{width:t,height:t,background:"#003087"},children:e.jsx("span",{className:"text-white font-bold",style:{fontSize:t*.38},children:"P"})})}function Ka({size:t=32}){return e.jsx("div",{className:"flex items-center justify-center shrink-0",style:{width:t,height:t,background:"#1A1F71",borderRadius:t*.2},children:e.jsxs("svg",{width:t*.72,height:t*.234,viewBox:"0 0 43 14",fill:"none",children:[e.jsx("path",{d:"M18.3629 13.5165H14.9302L17.0772 0.240662H20.5097L18.3629 13.5165Z",fill:"white"}),e.jsx("path",{d:"M30.806 0.565203C30.1289 0.296586 29.055 0 27.7271 0C24.3372 0 21.95 1.80767 21.9354 4.3921C21.9072 6.29889 23.6445 7.35796 24.9439 7.99375C26.2719 8.64342 26.7234 9.06747 26.7234 9.64656C26.7099 10.5359 25.6502 10.9459 24.6619 10.9459C23.2914 10.9459 22.5571 10.7345 21.4412 10.2397L20.9891 10.0276L20.5088 13.0077C21.3139 13.3745 22.7972 13.7 24.3372 13.7143C27.939 13.7143 30.2839 11.9346 30.3117 9.18047C30.3254 7.66919 29.4081 6.51119 27.4303 5.56493C26.2297 4.95749 25.4944 4.54791 25.4944 3.92639C25.5085 3.36137 26.1163 2.78265 27.4716 2.78265C28.5876 2.75431 29.4075 3.02255 30.0286 3.29098L30.3391 3.43195L30.806 0.565203Z",fill:"white"}),e.jsx("path",{d:"M35.3681 8.81332C35.6508 8.05064 36.7386 5.09886 36.7386 5.09886C36.7243 5.1272 37.0207 4.3221 37.1902 3.82785L37.4301 4.97178C37.4301 4.97178 38.0802 8.14956 38.2213 8.81332C37.6848 8.81332 36.0461 8.81332 35.3681 8.81332ZM39.6053 0.240662H36.9501C36.1313 0.240662 35.5092 0.480559 35.156 1.34216L30.0571 13.5163H33.659C33.659 13.5163 34.2519 11.8777 34.3794 11.5248C34.7745 11.5248 38.2784 11.5248 38.7867 11.5248C38.8853 11.9909 39.1963 13.5163 39.1963 13.5163H42.3747L39.6053 0.240662Z",fill:"white"}),e.jsx("path",{d:"M12.0629 0.240662L8.70119 9.29349L8.33383 7.45747C7.71232 5.33894 5.76311 3.03721 3.58789 1.89272L6.66713 13.5024H10.2971L15.6927 0.240662H12.0629Z",fill:"white"}),e.jsx("path",{d:"M5.57939 0.240662H0.0565013L0 0.508903C4.3082 1.61059 7.16143 4.26616 8.3337 7.45803L7.13309 1.35661C6.93542 0.508715 6.32798 0.268631 5.57939 0.240662Z",fill:"white"})]})})}function _a({size:t=32}){const a=t*.8;return e.jsx("div",{className:"flex items-center justify-center shrink-0",style:{width:t,height:t},children:e.jsxs("svg",{width:a,height:a*.625,viewBox:"0 0 48 30",fill:"none",children:[e.jsx("circle",{cx:"18",cy:"15",r:"14",fill:"#EB001B"}),e.jsx("circle",{cx:"30",cy:"15",r:"14",fill:"#F79E1B"}),e.jsx("path",{d:"M24 2.35A14 14 0 0 1 24 27.65A14 14 0 0 1 24 2.35Z",fill:"#FF5F00"})]})})}function ta({size:t=32}){const a=t*.56,n=a*.65,r=Math.max(2,a*.1),i=a*.2;return e.jsxs("div",{className:"flex items-center justify-center shrink-0",style:{width:t,height:t},children:[e.jsx("div",{style:{width:a,height:n,background:"#1A1F71",borderRadius:r,position:"relative",zIndex:2,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("svg",{width:a*.7,height:n*.35,viewBox:"0 0 43 14",fill:"none",children:[e.jsx("path",{d:"M18.3629 13.5165H14.9302L17.0772 0.240662H20.5097L18.3629 13.5165Z",fill:"white"}),e.jsx("path",{d:"M12.0629 0.240662L8.70119 9.29349L8.33383 7.45747C7.71232 5.33894 5.76311 3.03721 3.58789 1.89272L6.66713 13.5024H10.2971L15.6927 0.240662H12.0629Z",fill:"white"}),e.jsx("path",{d:"M5.57939 0.240662H0.0565013L0 0.508903C4.3082 1.61059 7.16143 4.26616 8.3337 7.45803L7.13309 1.35661C6.93542 0.508715 6.32798 0.268631 5.57939 0.240662Z",fill:"white"}),e.jsx("path",{d:"M30.806 0.565203C30.1289 0.296586 29.055 0 27.7271 0C24.3372 0 21.95 1.80767 21.9354 4.3921C21.9072 6.29889 23.6445 7.35796 24.9439 7.99375C26.2719 8.64342 26.7234 9.06747 26.7234 9.64656C26.7099 10.5359 25.6502 10.9459 24.6619 10.9459C23.2914 10.9459 22.5571 10.7345 21.4412 10.2397L20.9891 10.0276L20.5088 13.0077C21.3139 13.3745 22.7972 13.7 24.3372 13.7143C27.939 13.7143 30.2839 11.9346 30.3117 9.18047C30.3254 7.66919 29.4081 6.51119 27.4303 5.56493C26.2297 4.95749 25.4944 4.54791 25.4944 3.92639C25.5085 3.36137 26.1163 2.78265 27.4716 2.78265C28.5876 2.75431 29.4075 3.02255 30.0286 3.29098L30.3391 3.43195L30.806 0.565203Z",fill:"white"}),e.jsx("path",{d:"M35.3681 8.81332C35.6508 8.05064 36.7386 5.09886 36.7386 5.09886C36.7243 5.1272 37.0207 4.3221 37.1902 3.82785L37.4301 4.97178C37.4301 4.97178 38.0802 8.14956 38.2213 8.81332C37.6848 8.81332 36.0461 8.81332 35.3681 8.81332ZM39.6053 0.240662H36.9501C36.1313 0.240662 35.5092 0.480559 35.156 1.34216L30.0571 13.5163H33.659C33.659 13.5163 34.2519 11.8777 34.3794 11.5248C34.7745 11.5248 38.2784 11.5248 38.7867 11.5248C38.8853 11.9909 39.1963 13.5163 39.1963 13.5163H42.3747L39.6053 0.240662Z",fill:"white"})]})}),e.jsx("div",{style:{width:a,height:n,background:"#252525",borderRadius:r,marginLeft:-i,position:"relative",zIndex:1,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},children:e.jsxs("svg",{width:n*.85,height:n*.6,viewBox:"0 0 48 30",fill:"none",children:[e.jsx("circle",{cx:"18",cy:"15",r:"14",fill:"#EB001B"}),e.jsx("circle",{cx:"30",cy:"15",r:"14",fill:"#F79E1B"}),e.jsx("path",{d:"M24 2.35A14 14 0 0 1 24 27.65A14 14 0 0 1 24 2.35Z",fill:"#FF5F00"})]})})]})}function Va({size:t=18}){return e.jsx("div",{className:"rounded-full bg-white flex items-center justify-center shrink-0",style:{width:t,height:t},children:e.jsx("span",{className:"text-black font-bold",style:{fontSize:t*.55},children:"C"})})}function Ee(){return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"var(--t-text-secondary)",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function lt(){return e.jsx("svg",{width:"8",height:"14",viewBox:"0 0 8 14",fill:"none",children:e.jsx("path",{d:"M1 1L7 7L1 13",stroke:"var(--t-icon-stroke)",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function aa({onClick:t}){return e.jsx("button",{onClick:t,className:"hover:opacity-70 transition-opacity",children:e.jsx("svg",{width:"24",height:"16",viewBox:"0 0 24 16",fill:"none",children:e.jsx("path",{d:"M22.4004 12V4C22.4004 2.67452 21.3255 1.59961 20 1.59961H6.7998V14.4004H20V16H4V14.4004H5.2002V1.59961H4C2.67452 1.59961 1.59961 2.67452 1.59961 4V12C1.59961 13.3255 2.67452 14.4004 4 14.4004V16L3.79395 15.9951C1.68056 15.8879 0 14.14 0 12V4C0 1.79086 1.79086 6.44266e-08 4 0H20C22.2091 0 24 1.79086 24 4V12L23.9951 12.2061C23.8913 14.2512 22.2512 15.8913 20.2061 15.9951L20 16V14.4004C21.3255 14.4004 22.4004 13.3255 22.4004 12Z",fill:"var(--t-icon-stroke)"})})})}function na({size:t=40}){return e.jsx("div",{className:"rounded-full flex items-center justify-center shrink-0",style:{width:t,height:t,background:"var(--t-surface)"},children:e.jsxs("svg",{width:t*.5,height:t*.5,viewBox:"0 0 20 20",fill:"none",children:[e.jsx("circle",{cx:"10",cy:"10",r:"7.5",stroke:"var(--t-text)",strokeWidth:"1.5"}),e.jsx("path",{d:"M10 2.5A7.5 7.5 0 0 1 10 17.5",fill:"var(--t-text)"})]})})}function ra(t,a=32){switch(t){case"revolut":return e.jsx(zt,{size:a});case"applepay":return e.jsx(Jt,{size:a});case"card":return e.jsx(ta,{size:a});case"googlepay":return e.jsx(qt,{size:a});case"paypal":return e.jsx(ea,{size:a});case"bank":return e.jsx(Qt,{size:a});case"visa":return e.jsx(Ka,{size:a});case"mastercard":return e.jsx(_a,{size:a});default:return e.jsx(Qe,{size:a})}}const Ga={"debit-credit-card":"card","bank-transfer":"bank","ach-bank-transfer":"bank","payid-bank-transfer":"bank","sepa-bank-transfer":"bank",sepa:"bank","apple-pay":"applepay","google-pay":"googlepay",paypal:"paypal",revolut:"revolut"},$a={"debit-credit-card":"Card","bank-transfer":"Bank Transfer","ach-bank-transfer":"ACH","apple-pay":"Apple Pay","google-pay":"Google Pay","payid-bank-transfer":"PayID",paypal:"PayPal",revolut:"Revolut"};function oa(t,a){return $a[t]||a}function sa(t,a,n=24){const r=Ga[t];return r?ra(r,n):a?e.jsx("img",{src:a,alt:"",width:n,height:n,style:{borderRadius:"50%"}}):e.jsx(Qe,{size:n})}function ia({methods:t,selectedId:a,onOpenModal:n,fiatCurrency:r}){const i=s.useMemo(()=>t.filter(m=>m.supportedFiats.includes(r)),[t,r]),l=i.find(m=>m.id===a)||i[0];return i.length===0?e.jsx("div",{className:"flex items-center justify-between px-[18px] pt-[12px] pb-[14px]",style:{background:"var(--t-surface)",borderBottomLeftRadius:5,borderBottomRightRadius:5},children:e.jsxs("span",{className:"text-[12px]",style:{color:"var(--t-text-muted)"},children:["No payment methods available for ",r]})}):e.jsx(e.Fragment,{children:e.jsxs("div",{role:"button",tabIndex:0,onClick:n,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&n()},className:"flex items-center justify-between w-full px-[18px] transition-colors",style:{background:"var(--t-surface)",borderBottomLeftRadius:5,borderBottomRightRadius:5,cursor:"pointer",height:42},children:[e.jsx("span",{className:"text-[12px]",style:{color:"var(--t-text-secondary)"},children:"Payment method"}),e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex items-center justify-center",style:{width:20,height:20},children:l&&sa(l.id,l.icon,20)}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:l?oa(l.id,l.name):"Select"}),e.jsx(Ee,{})]})]})})}function la({className:t="",autoRedirect:a=!1,redirectDelay:n=3e3}){var p;const{order:r,orderStatus:i,goToStep:l,goBack:m}=ye(),[c,u]=s.useState(!1),[f,h]=s.useState(null),d=r!=null&&r.checkout.expiresAt?Date.now()>r.checkout.expiresAt:!1;if(s.useEffect(()=>{if((r==null?void 0:r.checkout.method)==="redirect"&&a&&!d){h(Math.ceil(n/1e3));const g=setTimeout(()=>{window.location.href=r.checkout.url},n),E=setInterval(()=>{h(j=>j&&j>1?j-1:null)},1e3);return()=>{clearTimeout(g),clearInterval(E)}}},[r,a,n,d]),s.useEffect(()=>{i&&(i.status==="completed"?l("complete"):["failed","cancelled","expired"].includes(i.status)&&l("error"))},[i==null?void 0:i.status,l]),!r)return e.jsxs("div",{className:`flex flex-col items-center justify-center p-8 ${t}`,style:{color:"var(--t-text)"},children:[e.jsx("p",{className:"text-[15px] mb-4",children:"No order found"}),e.jsx("button",{className:"font-semibold text-[14px] transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)",paddingLeft:24,paddingRight:24},onClick:m,children:"Go Back"})]});if(d)return e.jsxs("div",{className:`flex flex-col items-center justify-center p-8 text-center ${t}`,style:{color:"var(--t-text)"},children:[e.jsx("h3",{className:"text-[18px] font-semibold mb-2",children:"Checkout expired"}),e.jsx("p",{className:"text-[14px] mb-6",style:{color:"var(--t-text-secondary)"},children:"The session has expired. Please try again."}),e.jsx("button",{className:"w-full font-semibold text-[16px] transition-all",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)"},onClick:m,children:"Start over"})]});if(r.checkout.method==="iframe"){const g=r.checkout.url,E=((p=r.checkout.allowedFeatures)==null?void 0:p.join("; "))||"payment; camera; microphone; geolocation; clipboard-read; clipboard-write; accelerometer; gyroscope; magnetometer; fullscreen; autoplay; encrypted-media; web-share";return Ut.createPortal(e.jsxs("div",{style:{position:"fixed",inset:0,zIndex:9999,display:"flex",flexDirection:"column",background:"#000"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",height:48,paddingLeft:8,paddingRight:16,background:"#111",flexShrink:0},children:e.jsxs("button",{onClick:m,style:{display:"flex",alignItems:"center",gap:6,background:"none",border:"none",color:"#fff",fontSize:14,fontWeight:500,cursor:"pointer",padding:"8px 12px",borderRadius:6},children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{d:"M10 12L6 8L10 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),"Cancel"]})}),e.jsxs("div",{style:{flex:1,position:"relative",overflow:"hidden"},children:[!c&&e.jsxs("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:[e.jsx("div",{className:"nramp-spinner"}),e.jsx("p",{style:{color:"#888",fontSize:14,marginTop:16},children:"Loading checkout..."})]}),e.jsx("iframe",{src:g,style:{display:c?"block":"none",width:"100%",height:"100%",border:"none"},allow:E,onLoad:()=>u(!0),title:"Provider Checkout"})]})]}),document.body)}if(r.checkout.method==="redirect")return e.jsxs("div",{className:`flex flex-col items-center justify-center p-8 text-center ${t}`,style:{color:"var(--t-text)"},children:[e.jsx("div",{className:"text-[48px] mb-4",children:"🔗"}),e.jsx("h3",{className:"text-[18px] font-semibold mb-2",children:"Complete Payment"}),e.jsxs("p",{className:"text-[14px] mb-4",style:{color:"var(--t-text-secondary)"},children:["You'll be redirected to ",r.gateway," to complete your payment."]}),f!==null&&e.jsxs("p",{className:"text-[13px] mb-4",style:{color:"var(--t-text-muted)"},children:["Redirecting in ",f,"..."]}),e.jsxs("a",{href:r.checkout.url,className:"w-full font-semibold text-[16px] flex items-center justify-center transition-all",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)",textDecoration:"none"},target:"_blank",rel:"noopener noreferrer",children:["Continue to ",r.gateway]}),e.jsx("button",{className:"w-full font-semibold text-[14px] mt-2 transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)"},onClick:m,children:"Cancel"})]});if(r.checkout.method==="widget"&&r.widgetConfig){const g=Xa(r.checkout.url,r.widgetConfig);return Ut.createPortal(e.jsxs("div",{style:{position:"fixed",inset:0,zIndex:9999,display:"flex",flexDirection:"column",background:"#000"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",height:48,paddingLeft:8,paddingRight:16,background:"#111",flexShrink:0},children:e.jsxs("button",{onClick:m,style:{display:"flex",alignItems:"center",gap:6,background:"none",border:"none",color:"#fff",fontSize:14,fontWeight:500,cursor:"pointer",padding:"8px 12px",borderRadius:6},children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{d:"M10 12L6 8L10 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),"Cancel"]})}),e.jsxs("div",{style:{flex:1,position:"relative",overflow:"hidden"},children:[!c&&e.jsxs("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:[e.jsx("div",{className:"nramp-spinner"}),e.jsx("p",{style:{color:"#888",fontSize:14,marginTop:16},children:"Loading checkout..."})]}),e.jsx("iframe",{src:g,style:{display:c?"block":"none",width:"100%",height:"100%",border:"none"},allow:"payment; camera; microphone; geolocation; clipboard-read; clipboard-write; accelerometer; gyroscope; magnetometer; fullscreen; autoplay; encrypted-media; web-share",onLoad:()=>u(!0),title:"Payment Checkout"})]})]}),document.body)}return e.jsxs("div",{className:`flex flex-col items-center justify-center p-8 ${t}`,style:{color:"var(--t-text)"},children:[e.jsx("p",{className:"text-[15px] mb-4",children:"Unknown checkout method"}),e.jsx("button",{className:"font-semibold text-[14px] transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)",paddingLeft:24,paddingRight:24},onClick:m,children:"Go Back"})]})}function Xa(t,a){const n=new URL("/en/partner/widget",t);for(const[r,i]of Object.entries(a))i!=null&&i!==""&&n.searchParams.set(r,String(i));return n.toString()}function ca({className:t=""}){const{orderStatus:a,orderStatusLoading:n,goToStep:r}=ye();s.useEffect(()=>{a&&(a.status==="completed"?r("complete"):["failed","cancelled","expired","refunded"].includes(a.status)&&r("error"))},[a==null?void 0:a.status,r]);const i=()=>{if(!a)return"Processing your order...";switch(a.status){case"pending":return"Waiting for payment confirmation...";case"processing":return"Processing your transaction...";default:return"Processing..."}};return e.jsxs("div",{className:`flex flex-col items-center justify-center px-8 py-12 text-center ${t}`,children:[e.jsx("div",{className:"mb-6",children:e.jsx("div",{className:"nramp-spinner-large nramp-spinner"})}),e.jsx("h2",{className:"text-[20px] font-semibold mb-3",style:{color:"var(--t-text)"},children:i()}),n&&e.jsx("p",{className:"text-[13px] mb-4",style:{color:"var(--t-text-muted)"},children:"Checking status..."}),a&&e.jsxs("div",{className:"w-full mt-6 text-left",style:{background:"var(--t-surface)",borderRadius:5,padding:16},children:[e.jsx(be,{label:"Order ID",value:a.orderId,mono:!0}),e.jsx(be,{label:"Provider",value:a.gateway}),e.jsx(be,{label:"Amount",value:`${a.fiatAmount} ${a.fiatCurrency}`}),e.jsx(be,{label:"Receiving",value:`${a.cryptoAmount||"..."} ${a.cryptoCurrency}`}),e.jsx(be,{label:"Network",value:a.network}),e.jsx(be,{label:"To Address",value:`${a.walletAddress.slice(0,10)}...${a.walletAddress.slice(-8)}`,mono:!0})]}),e.jsxs("div",{className:"mt-6",children:[e.jsx("p",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:"This usually takes a few minutes."}),e.jsx("p",{className:"text-[12px] mt-1",style:{color:"var(--t-text-muted)"},children:"You can safely close this page - we'll send you an email when complete."})]})]})}function be({label:t,value:a,mono:n}){return e.jsxs("div",{className:"flex justify-between items-center py-2",style:{borderBottom:"1px solid var(--t-divider)"},children:[e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:t}),e.jsx("span",{className:`text-[13px] font-medium ${n?"font-mono":""}`,style:{color:"var(--t-text)"},children:a})]})}function da({className:t="",explorerUrl:a,onDone:n,doneButtonText:r="Done"}){const{orderStatus:i,state:l,dispatch:m}=ye(),c=l.flowType==="sell",u=()=>{if(!(i!=null&&i.transactionHash))return null;if(!a){const d={ethereum:"https://etherscan.io/tx/{txHash}",polygon:"https://polygonscan.com/tx/{txHash}",arbitrum:"https://arbiscan.io/tx/{txHash}",optimism:"https://optimistic.etherscan.io/tx/{txHash}",base:"https://basescan.org/tx/{txHash}",bitcoin:"https://mempool.space/tx/{txHash}",solana:"https://solscan.io/tx/{txHash}",avalanche:"https://snowtrace.io/tx/{txHash}",fantom:"https://ftmscan.com/tx/{txHash}"};return(d[l.network]||d.ethereum).replace("{txHash}",i.transactionHash)}return a.replace("{txHash}",i.transactionHash)},f=()=>{n?n():m({type:"RESET"})},h=u();return e.jsxs("div",{className:`flex flex-col items-center px-8 py-12 text-center ${t}`,children:[e.jsx("div",{className:"flex items-center justify-center mb-5",style:{width:64,height:64,borderRadius:"50%",background:"var(--t-success, #10b981)"},children:e.jsx("svg",{viewBox:"0 0 24 24",width:"32",height:"32",fill:"white",children:e.jsx("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"})})}),e.jsx("h2",{className:"text-[20px] font-semibold mb-2",style:{color:"var(--t-text)"},children:c?"Sale Complete!":"Purchase Complete!"}),e.jsx("p",{className:"text-[14px] mb-6",style:{color:"var(--t-text-secondary)"},children:c?`Your ${(i==null?void 0:i.fiatCurrency)||l.fiatCurrency} payout is being processed.`:`Your ${(i==null?void 0:i.cryptoCurrency)||l.cryptoCurrency} has been sent to your wallet.`}),i&&e.jsxs("div",{className:"w-full text-left mb-6",style:{background:"var(--t-surface)",borderRadius:5,padding:16},children:[e.jsx(ce,{label:c?"Amount Sold":"Amount Received",value:`${i.cryptoAmount} ${i.cryptoCurrency}`,highlight:!0}),e.jsx(ce,{label:c?"Payout Amount":"Amount Paid",value:`${i.fiatAmount} ${i.fiatCurrency}`}),e.jsx(ce,{label:"Network",value:i.network}),e.jsx(ce,{label:"Wallet",value:`${i.walletAddress.slice(0,10)}...${i.walletAddress.slice(-8)}`,mono:!0}),i.transactionHash&&e.jsx(ce,{label:"Transaction",value:`${i.transactionHash.slice(0,10)}...${i.transactionHash.slice(-8)}`,mono:!0}),e.jsx(ce,{label:"Provider",value:i.gateway}),e.jsx(ce,{label:"Order ID",value:i.orderId,mono:!0}),i.completedAt&&e.jsx(ce,{label:"Completed",value:new Date(i.completedAt).toLocaleString()})]}),e.jsxs("div",{className:"w-full flex flex-col gap-2",children:[h&&e.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"w-full font-semibold text-[14px] flex items-center justify-center transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)",textDecoration:"none"},children:"View on Explorer"}),e.jsx("button",{className:"w-full font-semibold text-[16px] transition-all",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)"},onClick:f,children:r})]})]})}function ce({label:t,value:a,mono:n,highlight:r}){return e.jsxs("div",{className:"flex justify-between items-center py-2",style:{borderBottom:"1px solid var(--t-divider)"},children:[e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:t}),e.jsx("span",{className:`text-[13px] font-medium ${n?"font-mono":""}`,style:{color:r?"var(--t-success, #10b981)":"var(--t-text)"},children:a})]})}function ua({className:t="",onRetry:a,supportEmail:n="support@nowramp.com"}){const{state:r,orderStatus:i,dispatch:l,goToStep:m}=ye(),c=r.flowType==="sell",u=()=>{if(i)switch(i.status){case"failed":return"Payment Failed";case"cancelled":return"Order Cancelled";case"expired":return"Order Expired";case"refunded":return"Order Refunded";default:return"Something Went Wrong"}return"Something Went Wrong"},f=()=>{if(r.errorMessage)return r.errorMessage;if(i)switch(i.status){case"failed":return c?"Your sale could not be processed. Please try again.":"Your payment could not be processed. Please try again or use a different payment method.";case"cancelled":return c?"Your sale was cancelled. No crypto was transferred.":"Your order was cancelled. No payment was processed.";case"expired":return c?"Your order has expired. Please start a new sale.":"Your order has expired. Please start a new purchase.";case"refunded":return c?"Your crypto has been returned. The funds should appear in your wallet shortly.":"Your payment has been refunded. The funds should appear in your account within 5-10 business days.";default:return"An unexpected error occurred. Please try again."}return"An unexpected error occurred. Please try again."},h=()=>{l({type:"CLEAR_ERROR"}),a?a():(l({type:"RESET"}),m("amount"))},d=()=>{l({type:"RESET"}),m("amount")};return e.jsxs("div",{className:`flex flex-col items-center px-8 py-12 text-center ${t}`,children:[e.jsx("div",{className:"flex items-center justify-center mb-5",style:{width:64,height:64,borderRadius:"50%",background:"var(--t-error, #EF4444)"},children:e.jsx("svg",{viewBox:"0 0 24 24",width:"32",height:"32",fill:"white",children:e.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})})}),e.jsx("h2",{className:"text-[20px] font-semibold mb-2",style:{color:"var(--t-text)"},children:u()}),e.jsx("p",{className:"text-[14px] mb-6",style:{color:"var(--t-text-secondary)"},children:f()}),i&&e.jsx("div",{className:"w-full text-left mb-6",style:{background:"var(--t-surface)",borderRadius:5,padding:16},children:e.jsxs("div",{className:"flex justify-between items-center py-2",children:[e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:"Order ID"}),e.jsx("span",{className:"text-[13px] font-medium font-mono",style:{color:"var(--t-text)"},children:i.orderId})]})}),e.jsxs("div",{className:"w-full flex flex-col gap-2",children:[e.jsx("button",{className:"w-full font-semibold text-[16px] transition-all",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)"},onClick:h,children:"Try Again"}),e.jsx("button",{className:"w-full font-semibold text-[14px] transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)"},onClick:d,children:"Start Over"})]}),e.jsxs("div",{className:"mt-6",children:[e.jsxs("p",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:["Need help? Contact"," ",e.jsx("a",{href:`mailto:${n}`,className:"underline",style:{color:"var(--t-accent)"},children:n})]}),i&&e.jsxs("p",{className:"text-[12px] mt-1",style:{color:"var(--t-text-muted)"},children:["Reference: ",i.orderId]})]})]})}function It(t){return t.length<=12?t:`${t.slice(0,6)}...${t.slice(-6)}`}function ma({className:t="",stablecoinParity:a,partnerName:n}){var W;const{config:r,configLoading:i,state:l,defaultGateway:m,quotes:c,fetchQuotes:u,createOrder:f,orderLoading:h}=ye(),d=l.flowType==="sell",[p,g]=s.useState(null),E=r==null?void 0:r.gateways.find(_=>_.id===m),j=(W=c==null?void 0:c.bestQuote)!=null&&W.exchangeRate?parseFloat(c.bestQuote.exchangeRate):null,R=parseFloat(l.fiatAmount)||0,H=!!(a&&n&&!d&&ut(l.cryptoCurrency)&&j),Q=H&&l.cryptoCurrency.toUpperCase().includes(l.fiatCurrency.toUpperCase()),P=H&&R>0?Xe(Q?R:R/j):null,$=async()=>{g(null);try{u(),await f()}catch(_){const de=_ instanceof Error?_.message:"Failed to create order";g(de)}};return i?e.jsxs("div",{className:`flex flex-col items-center justify-center p-12 ${t}`,children:[e.jsx("div",{className:"nramp-spinner"}),e.jsx("p",{className:"text-[14px] mt-4",style:{color:"var(--t-text-secondary)"},children:"Loading..."})]}):e.jsxs("div",{className:`flex flex-col items-center px-8 py-12 ${t}`,children:[e.jsx("h2",{className:"text-[20px] font-semibold mb-6",style:{color:"var(--t-text)"},children:d?"Confirm Sale":"Confirm Purchase"}),e.jsxs("div",{className:"w-full text-left mb-6",style:{background:"var(--t-surface)",borderRadius:5,padding:16},children:[E&&e.jsxs("div",{className:"flex justify-between items-center py-2",style:{borderBottom:"1px solid var(--t-divider)"},children:[e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:"Provider"}),e.jsxs("span",{className:"flex items-center gap-2",children:[E.logo&&e.jsx("img",{src:E.logo,alt:E.name,width:20,height:20,style:{borderRadius:4}}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:E.name})]})]}),d?e.jsxs(e.Fragment,{children:[e.jsx(xe,{label:"You sell",value:`${l.cryptoAmount} ${l.cryptoCurrency}`,highlight:!0}),e.jsx(xe,{label:"You receive",value:`${l.fiatCurrency} payout`})]}):e.jsxs(e.Fragment,{children:[e.jsx(xe,{label:"You pay",value:`${l.fiatAmount} ${l.fiatCurrency}`,highlight:!0}),e.jsx(xe,{label:"You receive",value:P?`${P} ${l.cryptoCurrency}`:`${l.cryptoCurrency} on ${l.network}`}),e.jsx(xe,{label:"Wallet",value:It(l.walletAddress),mono:!0}),H&&P&&e.jsxs("div",{className:"py-2 text-[11px]",style:{color:"var(--t-text-muted)",lineHeight:"15px"},children:["Charged amount from provider may differ. The rest up to ",P," ",l.cryptoCurrency," will be credited to your ",n," account."]})]}),e.jsx(xe,{label:"Network",value:l.network}),d&&l.walletAddress&&e.jsx(xe,{label:"Refund address",value:It(l.walletAddress),mono:!0})]}),p&&e.jsx("p",{className:"text-[12px] mb-4",style:{color:"#EF4444"},children:p}),e.jsx("button",{className:"w-full font-semibold text-[16px] transition-all flex items-center justify-center gap-2",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)",opacity:h?.7:1},disabled:h,onClick:$,children:h?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"nramp-spinner-inline"}),"Processing..."]}):d?"Confirm & Sell":"Confirm & Pay"})]})}function xe({label:t,value:a,mono:n,highlight:r}){return e.jsxs("div",{className:"flex justify-between items-center py-2",style:{borderBottom:"1px solid var(--t-divider)"},children:[e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:t}),e.jsx("span",{className:`text-[13px] font-medium ${n?"font-mono":""}`,style:{color:r?"var(--t-success, #10b981)":"var(--t-text)"},children:a})]})}function Ne({isOpen:t,onClose:a,children:n}){const[r,i]=s.useState(!1),[l,m]=s.useState(!1);s.useEffect(()=>{if(t)i(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>m(!0)));else if(r){m(!1);const u=setTimeout(()=>i(!1),250);return()=>clearTimeout(u)}},[t]);const c=s.useCallback(()=>{m(!1),setTimeout(()=>a(),250)},[a]);return s.useEffect(()=>{if(!t)return;const u=f=>{f.key==="Escape"&&c()};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[t,c]),r?e.jsx("div",{className:"absolute inset-0 z-20 transition-opacity duration-250",style:{opacity:l?1:0},children:e.jsx("div",{className:"absolute inset-0 flex flex-col transition-transform duration-250 ease-out",style:{background:"var(--t-modal-bg)",transform:l?"translateY(0)":"translateY(24px)"},children:typeof n=="function"?n(c):n})}):null}function fa({char:t,height:a=38}){const n="0123456789",r=n.indexOf(t);return r===-1?e.jsx("span",{children:t}):e.jsx("span",{className:"digit-slot",style:{height:a,lineHeight:`${a}px`},children:e.jsx("span",{className:"digit-slot-inner block",style:{transform:`translateY(-${r*a}px)`},children:n.split("").map(i=>e.jsx("span",{className:"block",style:{height:a,lineHeight:`${a}px`},children:i},i))})})}function ha({value:t,height:a=38,className:n="",style:r={}}){return e.jsx("span",{className:n,style:{display:"inline-flex",...r},children:t.split("").map((i,l)=>e.jsx(fa,{char:i,height:a},l))})}function O({w:t,h:a,className:n=""}){return e.jsx("div",{className:`skeleton ${n}`,style:{width:t,height:a}})}function pa(){return e.jsxs("div",{className:"flex-1 px-5 flex flex-col",children:[e.jsxs("div",{className:"px-[18px] pt-[14px] pb-[18px]",style:{background:"var(--t-surface)",borderRadius:5},children:[e.jsx(O,{w:70,h:14,className:"mb-3"}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(O,{w:120,h:32}),e.jsx(O,{w:75,h:32})]})]}),e.jsxs("div",{className:"px-[18px] pt-[12px] pb-[18px]",style:{background:"var(--t-surface)",borderRadius:5,marginTop:4},children:[e.jsx(O,{w:50,h:14,className:"mb-3"}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(O,{w:180,h:32}),e.jsx(O,{w:85,h:32})]})]}),e.jsxs("div",{className:"flex justify-between mt-3 px-[2px]",children:[e.jsx(O,{w:140,h:12}),e.jsx(O,{w:90,h:12})]}),e.jsxs("div",{className:"mt-8",children:[e.jsx(O,{w:65,h:14,className:"mb-2.5"}),e.jsx(O,{w:"100%",h:47})]}),e.jsx("div",{className:"flex-1"}),e.jsx(O,{w:"100%",h:60,className:"mb-2"}),e.jsx("div",{className:"text-center py-3",children:e.jsx("span",{className:"text-[11px]",style:{color:"var(--t-text-tertiary)"},children:"Powered by NowRamp"})})]})}function ge({onClick:t}){return e.jsx("button",{onClick:t,className:"flex items-center justify-center transition-colors rounded-full shrink-0",style:{width:30,height:30,backgroundColor:"var(--t-close-bg)"},onMouseEnter:a=>a.currentTarget.style.backgroundColor="var(--t-close-hover)",onMouseLeave:a=>a.currentTarget.style.backgroundColor="var(--t-close-bg)",children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:e.jsx("path",{d:"M1 1L9 9M9 1L1 9",stroke:"var(--t-icon-close)",strokeWidth:"1.4",strokeLinecap:"round"})})})}function Re({value:t,onChange:a,placeholder:n=""}){const[r,i]=s.useState(!1);return e.jsxs("div",{className:"relative mx-5 mb-5",children:[e.jsx("input",{type:"text",value:t,onChange:l=>a(l.target.value),onFocus:()=>i(!0),onBlur:()=>i(!1),placeholder:n,style:{height:47,borderRadius:4.5,border:`1px solid ${r?"var(--t-border-focus)":"var(--t-border)"}`,outline:"none",boxShadow:"none",color:"var(--t-text)",padding:`0 ${t?40:14}px 0 14px`,fontSize:14,backgroundColor:"transparent"},className:"w-full outline-none transition-colors"}),t&&e.jsx("button",{onClick:()=>a(""),className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center justify-center transition-colors rounded",style:{width:22,height:22,backgroundColor:"var(--t-close-bg)",borderRadius:4},children:e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",children:e.jsx("path",{d:"M1 1L7 7M7 1L1 7",stroke:"var(--t-icon-close)",strokeWidth:"1.2",strokeLinecap:"round"})})})]})}function xa({onClose:t,onSelect:a,currencies:n,assetBaseUrl:r="",selectedCode:i}){const[l,m]=s.useState(""),c=s.useMemo(()=>{if(!n||n.length===0)return rt;const f=new Map(rt.map(h=>[h.code,h.name]));return n.map(h=>({code:h.code,name:h.name||f.get(h.code)||h.code}))},[n]),u=s.useMemo(()=>{const f=l.trim().toLowerCase();if(!f){if(i){const h=c.find(d=>d.code===i);if(h){const d=c.filter(p=>p.code!==i);return[h,...d]}}return c}return c.filter(h=>h.code.toLowerCase().includes(f)||h.name.toLowerCase().includes(f))},[c,l,i]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(ge,{onClick:t})}),e.jsx("h2",{className:"text-center text-[17px] font-medium mt-2 mb-6",style:{color:"var(--t-text)",fontSize:17,fontWeight:500,marginTop:8,marginBottom:24},children:"Select fiat currency"}),e.jsx(Re,{value:l,onChange:m}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[u.map((f,h)=>{const d=f.name!==f.code?f.name:"",p=i===f.code;return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>a(f.code),className:"flex items-center w-full transition-colors rounded-lg hover-item",style:{color:"var(--t-text)",gap:14,padding:"18px 8px",margin:"0 -8px"},children:[e.jsx(We,{currencyCode:f.code,size:32,baseUrl:r}),e.jsxs("div",{className:"text-left flex-1 flex items-center gap-2",children:[e.jsx("span",{className:"font-semibold text-[15px]",children:f.code}),d&&e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:d})]}),p&&e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"var(--t-success, #4CD964)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),h<u.length-1&&e.jsx("div",{style:{height:1,background:"var(--t-divider, rgba(255,255,255,0.08))"}})]},f.code)}),u.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No currencies found"})]})]})}function Bt({src:t,alt:a,size:n,className:r,style:i}){const[l,m]=s.useState(!1),[c,u]=s.useState(!1),f=s.useRef(t);f.current!==t&&(f.current=t,m(!1),u(!1));const h=s.useCallback(()=>m(!0),[]),d=s.useCallback(()=>u(!0),[]);return e.jsxs("div",{className:r,style:{...i,width:n,height:n,position:"relative"},children:[!l&&!c&&e.jsx("div",{className:"absolute inset-0 rounded-full animate-pulse",style:{background:"var(--t-pill-bg, #333)"}}),c?e.jsx("div",{className:"absolute inset-0 rounded-full flex items-center justify-center text-[10px] font-bold",style:{background:"var(--t-pill-bg, #333)",color:"var(--t-text-muted)"},children:a.slice(0,3)}):e.jsx("img",{src:t,alt:a,width:n,height:n,onLoad:h,onError:d,className:`rounded-full ${l?"opacity-100":"opacity-0"}`,style:{width:n,height:n,transition:"opacity 0.15s ease-in"}})]})}function ya({onClose:t,onSelect:a,cryptos:n,assetBaseUrl:r="",selectedCode:i,selectedChain:l}){const[m,c]=s.useState(""),u=s.useMemo(()=>{if(!n||n.length===0)return Yt;const d=[];for(const p of n){const g=p.networks||[],E=p.name||Oa[p.code]||p.code;if(g.length===0)d.push({code:p.code,name:E,chain:p.code,popular:!1});else for(const j of g){const R=j.code||j.id||j.name||p.code;d.push({code:p.code,name:E,chain:R,chainName:j.name,popular:!1})}}return d},[n]),f=s.useCallback((d,p)=>i===d&&l===p,[i,l]),h=s.useMemo(()=>{var E;const d=m.trim().toLowerCase();if(!d){if(i&&l){const j=u.find(R=>R.code===i&&R.chain===l);if(j){const R=u.filter(H=>!(H.code===i&&H.chain===l));return[j,...R]}}return u}const p=d.split(/\s+/),g=[];for(const j of u){const R=Ge(j.chain),H=R?R.name.toLowerCase():"",Q=((E=R==null?void 0:R.shortName)==null?void 0:E.toLowerCase())||"",P=j.chain.toLowerCase(),$=j.code.toLowerCase(),W=j.name.toLowerCase(),_=[$,W,H,Q,P];if(!p.every(w=>_.some(o=>o.includes(w))))continue;let x=0;$===d?x+=100:$.startsWith(p[0])&&(x+=50),j.popular&&(x+=10),p.length>1&&(H.includes(p[1])||Q.includes(p[1])||P.includes(p[1]))&&(x+=25),g.push({item:j,score:x})}return g.sort((j,R)=>R.score-j.score),g.map(j=>j.item)},[u,m,i,l]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(ge,{onClick:t})}),e.jsx("h2",{className:"text-center text-[17px] font-medium mt-2 mb-6",style:{color:"var(--t-text)",fontSize:17,fontWeight:500,marginTop:8,marginBottom:24},children:"Select crypto currency"}),e.jsx(Re,{value:m,onChange:c}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[h.map((d,p)=>{const g=Ge(d.chain),E=(g==null?void 0:g.name)||d.chainName||d.chain,j=d.name!==d.code?d.name:"",R=f(d.code,d.chain);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>a(d.code,d.chain),className:"flex items-center w-full transition-colors rounded-lg hover-item",style:{gap:14,padding:"18px 8px",margin:"0 -8px"},children:[e.jsxs("div",{className:"relative shrink-0",style:{width:40,height:40},children:[e.jsx("div",{className:"absolute top-0 left-0",style:{background:"#ffffff",borderRadius:"50%"},children:e.jsx(Bt,{src:dt(d.code,r),alt:d.code,size:32})}),e.jsx("div",{className:"absolute",style:{bottom:0,right:0,border:"2px solid var(--t-surface, #1C1C22)",borderRadius:"50%",background:"#ffffff"},children:e.jsx(Bt,{src:$e(d.chain,r),alt:d.chain,size:16})})]}),e.jsx("div",{className:"text-left flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-semibold text-[15px]",style:{color:"var(--t-text)"},children:d.code}),j&&e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:j})]})}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:E}),R&&e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"var(--t-success, #4CD964)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})]}),p<h.length-1&&e.jsx("div",{style:{height:1,background:"var(--t-divider, rgba(255,255,255,0.08))"}})]},`${d.code}-${d.chain}`)}),h.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No currencies found"})]})]})}function Wa({methods:t,selectedId:a,onSelect:n,onClose:r}){const[i,l]=s.useState(""),m=s.useMemo(()=>{const c=i.trim().toLowerCase();if(!c){if(a){const u=t.find(f=>f.id===a);if(u){const f=t.filter(h=>h.id!==a);return[u,...f]}}return t}return t.filter(u=>u.id.toLowerCase().includes(c)||u.name.toLowerCase().includes(c)||u.description&&u.description.toLowerCase().includes(c))},[t,i,a]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(ge,{onClick:r})}),e.jsx("h2",{className:"text-center text-[17px] font-medium mt-2 mb-6",style:{color:"var(--t-text)",fontSize:17,fontWeight:500,marginTop:8,marginBottom:24},children:"Choose payment method"}),e.jsx(Re,{value:i,onChange:l}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[m.map((c,u)=>{const f=c.id===a,h=oa(c.id,c.name);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>n(c.id),className:`flex w-full transition-colors rounded-lg hover-item ${c.description?"items-start":"items-center"}`,style:{color:"var(--t-text)",gap:14,padding:"18px 8px",margin:"0 -8px"},children:[e.jsx("span",{className:`flex items-center justify-center shrink-0 ${c.description?"mt-0.5":""}`,style:{width:32,height:32},children:sa(c.id,c.icon,32)}),e.jsxs("div",{className:"text-left flex-1",children:[e.jsx("div",{className:"font-semibold text-[15px] leading-tight",style:{color:"var(--t-text)"},children:h}),c.description&&e.jsx("div",{className:"text-[13px] leading-snug mt-1",style:{color:"var(--t-text-secondary)"},children:c.description})]}),f&&e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"shrink-0 mt-1",children:e.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"var(--t-success, #4CD964)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),u<m.length-1&&e.jsx("div",{style:{height:1,background:"var(--t-divider, rgba(255,255,255,0.08))"}})]},c.id)}),m.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No payment methods found"})]})]})}function ga({checked:t,onChange:a,accentColor:n="var(--t-accent)"}){return e.jsx("button",{onClick:()=>a(!t),className:"relative shrink-0 transition-colors duration-200",style:{width:48,height:28,borderRadius:14,backgroundColor:t?n:"var(--t-border)"},children:e.jsx("div",{className:"absolute top-[3px] rounded-full bg-white shadow transition-transform duration-200",style:{width:22,height:22,transform:t?"translateX(23px)":"translateX(3px)"}})})}const Ya=[{label:"Privacy policy",href:"https://nowramp.com/privacy-policy"},{label:"Terms of use",href:"https://nowramp.com/terms-and-conditions"}];function Ca({onClose:t,darkMode:a,onToggleDarkMode:n,skinId:r,onSelectSkin:i,showThemeToggle:l=!0,country:m,countryName:c,onLocationPress:u,assetBaseUrl:f=""}){const[h,d]=s.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end items-center px-5 pt-5",children:e.jsx(ge,{onClick:t})}),e.jsxs("div",{className:"px-5 flex-1 pt-6 overflow-y-auto custom-scroll",children:[u&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{borderTop:"1px solid var(--t-divider)"},children:e.jsxs("button",{onClick:u,className:"flex items-center justify-between w-full py-5 transition-colors",style:{color:"inherit",background:"none",border:"none",cursor:"pointer",padding:"20px 0"},children:[e.jsxs("div",{className:"flex items-center gap-3.5",children:[m&&!h?e.jsx("img",{src:`${f}/flags/${m.toLowerCase()}.svg`,alt:m,width:40,height:40,style:{width:40,height:40,borderRadius:"50%",objectFit:"cover"},onError:()=>d(!0)}):e.jsx(Za,{size:40}),e.jsxs("div",{className:"text-left",children:[e.jsx("span",{className:"font-medium text-[15px] block",style:{color:"var(--t-text)"},children:"Location"}),c&&e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:c})]})]}),e.jsx(lt,{})]})}),e.jsx("div",{style:{height:1,background:"var(--t-divider)"}})]}),l&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{borderTop:u?"none":"1px solid var(--t-divider)"},children:e.jsxs("div",{className:"flex items-center justify-between w-full py-5",children:[e.jsxs("div",{className:"flex items-center gap-3.5",children:[e.jsx(na,{size:40}),e.jsx("span",{className:"font-medium text-[15px]",style:{color:"var(--t-text)"},children:"Dark Mode"})]}),e.jsx(ga,{checked:a,onChange:n,accentColor:"#4CD964"})]})}),e.jsx("div",{style:{height:1,background:"var(--t-divider)"}})]}),Ya.map(p=>e.jsxs("div",{children:[e.jsxs("a",{href:p.href,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between w-full py-5 transition-colors",style:{color:"inherit",textDecoration:"none"},children:[e.jsx("span",{className:"font-medium text-[15px]",style:{color:"var(--t-text)"},children:p.label}),e.jsx(lt,{})]}),e.jsx("div",{style:{height:1,background:"var(--t-divider)"}})]},p.label))]})]})}function Za({size:t=40}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 40 40",fill:"none",children:[e.jsx("circle",{cx:"20",cy:"20",r:"18",stroke:"var(--t-text-secondary)",strokeWidth:"1.5",fill:"none"}),e.jsx("ellipse",{cx:"20",cy:"20",rx:"9",ry:"18",stroke:"var(--t-text-secondary)",strokeWidth:"1.5",fill:"none"}),e.jsx("line",{x1:"2",y1:"20",x2:"38",y2:"20",stroke:"var(--t-text-secondary)",strokeWidth:"1.5"}),e.jsx("path",{d:"M5 12h30M5 28h30",stroke:"var(--t-text-secondary)",strokeWidth:"1.2"})]})}function Sa({onClose:t,onSelect:a,assetBaseUrl:n="",selectedCode:r}){const[i,l]=s.useState(""),m=s.useMemo(()=>{const c=i.trim().toLowerCase();if(!c){if(r){const u=r.toLowerCase(),f=Ze[u];if(f){const h=Fe.filter(d=>d.code!==u);return[f,...h]}}return Fe}return Fe.filter(u=>u.name.toLowerCase().includes(c)||u.code.includes(c)||u.defaultFiat.toLowerCase().includes(c))},[i,r]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(ge,{onClick:t})}),e.jsx("h2",{className:"text-center text-[17px] font-medium mt-2 mb-6",style:{color:"var(--t-text)",fontSize:17,fontWeight:500,marginTop:8,marginBottom:24},children:"Select your country"}),e.jsx(Re,{value:i,onChange:l}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[m.map((c,u)=>{const f=(r==null?void 0:r.toLowerCase())===c.code;return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>a(c.code),className:"flex items-center w-full transition-colors rounded-lg hover-item",style:{color:"var(--t-text)",gap:14,padding:"18px 8px",margin:"0 -8px"},children:[e.jsx(Qa,{code:c.code,size:32,baseUrl:n}),e.jsxs("div",{className:"text-left flex-1",children:[e.jsx("span",{className:"font-semibold text-[15px]",children:c.name}),e.jsx("span",{className:"text-[13px] ml-2",style:{color:"var(--t-text-secondary)"},children:c.defaultFiat})]}),f&&e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"var(--t-success, #4CD964)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),u<m.length-1&&e.jsx("div",{style:{height:1,background:"var(--t-divider, rgba(255,255,255,0.08))"}})]},c.code)}),m.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No countries found"})]})]})}function Qa({code:t,size:a=32,baseUrl:n=""}){const[r,i]=s.useState(!1);return r?e.jsx("div",{style:{width:a,height:a,borderRadius:"50%",background:"var(--t-pill-bg, #333)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:a*.4,color:"var(--t-text-muted)"},children:t.toUpperCase().slice(0,2)}):e.jsx("img",{src:`${n}/flags/${t}.svg`,alt:t,width:a,height:a,style:{width:a,height:a,borderRadius:"50%",objectFit:"cover"},onError:()=>i(!0)})}function za({className:t="",theme:a="dark",skinId:n="mono",accentColor:r,bgColor:i,bgImage:l,borderColor:m,borderRadius:c,surfaceColor:u,inputBgColor:f,textColor:h,textSecondaryColor:d,textMutedColor:p,successColor:g,showFlowToggle:E=!0,showSettings:j=!0,showThemeToggle:R=!0,autoRedirect:H=!1,explorerUrl:Q,doneButtonText:P="Done",supportEmail:$,stablecoinParity:W,partnerName:_,onDone:de}){var jt,Nt,Et,Rt,At,wt,kt,Tt,Lt;const{state:x,dispatch:w,config:o,configLoading:D,quotes:v,quotesLoading:S,quotesError:ue,fetchQuotes:me,createOrder:fe,orderLoading:q,amountError:oe,fieldLocks:F,apiConfig:Y,assetBaseUrl:K}=ye(),[V,se]=s.useState(a==="dark"),[ie,Ae]=s.useState(n),[ee,I]=s.useState(null),[we,Ce]=s.useState(!1),[ke,De]=s.useState(!1),[z,Me]=s.useState(!1),[he,Te]=s.useState(!1),[Ie,te]=s.useState(null),[Le,ze]=s.useState(!0),[Je,Be]=s.useState(!1),[ae,C]=s.useState(!1),N=s.useRef(null),k=s.useRef(),T=s.useRef(x.flowType);s.useEffect(()=>{se(a==="dark")},[a]),s.useEffect(()=>{const y=setTimeout(()=>ze(!1),D?0:800);return()=>clearTimeout(y)},[D]),s.useEffect(()=>{if(T.current!==x.flowType&&!Le){T.current=x.flowType,Be(!0),Ce(!1),De(!1);const y=setTimeout(()=>Be(!1),350);return()=>clearTimeout(y)}T.current=x.flowType},[x.flowType,Le]);const L=x.flowType,U=L==="buy",M=x.cryptoCurrency||"BTC",G=x.fiatCurrency||"USD",qe=U?x.fiatAmount:x.cryptoAmount,X=Wt(qe),le=(jt=v==null?void 0:v.bestQuote)!=null&&jt.exchangeRate?parseFloat(v.bestQuote.exchangeRate):null,Oe=s.useRef(null);le&&M&&G&&(Oe.current={rate:le,crypto:M,fiat:G});const mt=s.useMemo(()=>{if(v!=null&&v.bestQuote){const y=U?v.bestQuote.cryptoAmount:v.bestQuote.fiatAmount;if(y)return y}return"0"},[v,U]),Ue=!!(W&&_&&U&&ut(M)&&le),ba=Ue&&M.toUpperCase().includes(G.toUpperCase()),ft=Ue&&X>0?Xe(ba?X:X/le):null,ja=Ue&&ft?ft:mt,Na=s.useMemo(()=>{var B,J,ve;const y=le||((B=Oe.current)==null?void 0:B.rate),b=le?M:(J=Oe.current)==null?void 0:J.crypto,A=le?G:(ve=Oe.current)==null?void 0:ve.fiat;return!y||!b||!A?"":`1 ${b} ≈ ${y.toFixed(2)} ${A}`},[M,G,le]);s.useEffect(()=>{const y=x.walletAddress.trim(),b=x.network;if(!y||y.length<10){te(null),w({type:"SET_WALLET_ERROR",message:""});return}Te(!0),te(null);const A=new AbortController;return clearTimeout(k.current),k.current=setTimeout(async()=>{var B,J,ve;try{const at=await(await fetch(`${Y.apiUrl}/public/validate/address`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:y,...b?{network:b}:{}}),signal:A.signal})).json(),nt=((B=at.data)==null?void 0:B.attributes)||at.data||at;if(nt.isValid)te(!0),w({type:"SET_WALLET_ERROR",message:""});else{te(!1);const Ia=((J=nt.errors)==null?void 0:J[0])||((ve=nt.details)==null?void 0:ve.formatMessage)||"Invalid wallet address";w({type:"SET_WALLET_ERROR",message:Ia})}}catch(tt){if(tt instanceof DOMException&&tt.name==="AbortError")return;te(null)}finally{A.signal.aborted||Te(!1)}},500),()=>{clearTimeout(k.current),A.abort()}},[x.walletAddress,x.network,Y.apiUrl]);const ht=!qe||X===0,pt=X>0&&(U?X<Dt:X<Mt),xt=!!oe||pt||we&&ht,Ea=X>0&&!oe&&!pt,et=x.walletAddress.trim().length>=10&&Ie!==!1&&!he,He=Ea&&et&&!!x.cryptoCurrency&&!!x.network,Ra=y=>{let b=y.target.value.replace(/[^0-9.,]/g,"");const A=U?2:6,B=b.indexOf(".");B!==-1&&b.length-B-1>A&&(b=b.slice(0,B+A+1)),w(U?{type:"SET_FIAT_AMOUNT",amount:b}:{type:"SET_CRYPTO_AMOUNT",amount:b})},yt=y=>{y!==L&&w({type:"SET_FLOW_TYPE",flowType:y})},Aa=s.useCallback(y=>{w({type:"SET_FIAT_CURRENCY",currency:y})},[w]),wa=s.useCallback((y,b)=>{w({type:"SET_CRYPTO_CURRENCY",currency:y}),w({type:"SET_CRYPTO_CHAIN",chain:b})},[w]),ka=s.useCallback(y=>{w({type:"SET_PAYMENT_METHOD",methodId:y})},[w]),Ta=s.useCallback(y=>{w({type:"SET_COUNTRY",country:y}),I(null)},[w]),La=s.useCallback(()=>{I(null),setTimeout(()=>I("country"),280)},[]),Ua=x.country?(Nt=Ze[x.country.toLowerCase()])==null?void 0:Nt.name:void 0,Fa=()=>{He&&(C(!0),me())};s.useEffect(()=>{var y;if(!(!ae||S)){if(v!=null&&v.bestQuote)C(!1),w({type:"SELECT_QUOTE",quote:v.bestQuote}),fe().catch(()=>{});else if(ue)C(!1),w({type:"SET_ERROR",message:ue.message||"No quotes available"});else if(v&&!v.bestQuote){C(!1);const b=(y=v.unavailableGateways)==null?void 0:y.map(B=>B.reason).filter(Boolean),A=b!=null&&b.length?`No providers available: ${b.join("; ")}`:"No providers available for this currency/network combination";w({type:"SET_ERROR",message:A})}}},[ae,v,S,ue,w,fe]);const gt=V?"theme-dark":"theme-light",Pe=ot.find(y=>y.id===ie)||ot[0],Da=Pe.accent===null,Ma=r?re(r):!1,Ct=y=>{const b=y.replace("#",""),A=parseInt(b.substring(0,2),16),B=parseInt(b.substring(2,4),16),J=parseInt(b.substring(4,6),16);return(.299*A+.587*B+.114*J)/255>.5?"#000000":"#ffffff"},St=Ma?{"--t-accent":r,"--t-cta-bg":r,"--t-cta-text":Ct(r)}:Da?{"--t-accent":V?"#ffffff":"#111111","--t-cta-bg":V?"#ffffff":"#111111","--t-cta-text":V?"#000000":"#ffffff"}:{"--t-accent":Pe.accent,"--t-cta-bg":Pe.accent,"--t-cta-text":Ct(Pe.accent)},Z={};u&&re(u)&&(Z["--t-surface"]=u,Z["--t-modal-bg"]=u),f&&re(f)&&(Z["--t-pill-bg"]=f,Z["--t-close-bg"]=f),h&&re(h)&&(Z["--t-text"]=h),d&&re(d)&&(Z["--t-text-secondary"]=d),p&&re(p)&&(Z["--t-text-muted"]=p,Z["--t-text-tertiary"]=p),g&&re(g)&&(Z["--t-success"]=g);const pe={};i&&re(i)?pe.backgroundColor=i:pe.backgroundColor="var(--t-bg)",l&&(l.startsWith("https://")||l.startsWith("data:image/"))&&(pe.backgroundImage=`url(${l})`,pe.backgroundSize="cover",pe.backgroundPosition="center");const Ke=V?"#ffffff":"#111111",_e={};m&&re(m)&&(_e.border=`1px solid ${m}`),c&&(_e.borderRadius=c);const vt=x.step==="checkout"?e.jsx(la,{autoRedirect:H}):x.step==="processing"?e.jsx(ca,{}):x.step==="complete"?e.jsx(da,{explorerUrl:Q,doneButtonText:P,onDone:de}):x.step==="error"?e.jsx(ua,{supportEmail:$}):x.step==="confirm"?e.jsx(ma,{stablecoinParity:Ue,partnerName:_}):null;if(vt)return e.jsx("div",{className:`${gt} relative w-full max-w-[390px] h-[640px] overflow-hidden flex flex-col select-none transition-colors duration-300 ${t}`,style:{fontFamily:"'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",...pe,...St,...Z,..._e},children:vt});const ne=x.network,Se=ne?Ge(ne):null,bt=(Se==null?void 0:Se.shortName)||(Se==null?void 0:Se.name)||ne;return e.jsxs("div",{className:`${gt} relative w-full max-w-[390px] min-h-[640px] overflow-hidden flex flex-col select-none transition-colors duration-300 ${t}`,style:{fontFamily:"'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",...pe,...St,...Z,..._e},children:[j&&e.jsx("div",{className:`flex justify-end items-center px-5 pt-3 ${E?"pb-1":"pb-5"}`,children:e.jsx(aa,{onClick:()=>I("settings")})}),E?e.jsxs("div",{className:"flex flex-col items-center pt-3 pb-5",children:[e.jsxs("div",{className:"flex",style:{width:165},children:[e.jsx("button",{onClick:()=>yt("buy"),className:"flex-1 pb-2.5 text-[16px] font-medium text-center transition-colors duration-200",style:{color:L==="buy"?"var(--t-text)":"var(--t-text-secondary)"},children:"Buy"}),e.jsx("button",{onClick:()=>yt("sell"),className:"flex-1 pb-2.5 text-[16px] font-medium text-center transition-colors duration-200",style:{color:L==="sell"?"var(--t-text)":"var(--t-text-secondary)"},children:"Sell"})]}),e.jsxs("div",{className:"relative",style:{width:165,height:1},children:[e.jsx("div",{className:"absolute inset-0",style:{background:"var(--t-divider)"}}),e.jsx("div",{className:"absolute top-0 h-full transition-all duration-300 ease-in-out",style:{width:"50%",left:L==="buy"?"0%":"50%",background:"var(--t-accent)"}})]})]}):null,Le||Je||D?e.jsx(pa,{}):e.jsxs("div",{className:"flex-1 overflow-hidden px-5 flex flex-col tab-fade-in",children:[e.jsxs("div",{className:"px-[18px] pt-[14px] pb-[18px]",style:{background:"var(--t-surface)",borderRadius:5,border:we&&xt?"1px solid #EF4444":"1px solid transparent",minHeight:102},children:[e.jsx("div",{className:"text-[13px] mb-2.5",style:{color:"var(--t-text-secondary)"},children:"You spend"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("input",{ref:N,type:"text",value:qe,onChange:Ra,onBlur:()=>Ce(!0),placeholder:U?"250":"0.01",className:"bg-transparent outline-none w-0 flex-1 mr-3",style:{color:"var(--t-text)",fontSize:24,fontWeight:600,lineHeight:"32px",padding:0,border:"none",borderRadius:0,backgroundColor:"transparent",height:"auto",width:0},inputMode:"decimal",disabled:!!((Et=F==null?void 0:F.sourceAmount)!=null&&Et.locked)}),U?e.jsxs("button",{onClick:()=>I("fiat"),className:"flex items-center gap-1.5 shrink-0 transition-colors",style:{background:"var(--t-pill-bg)",borderRadius:4,height:32,paddingLeft:10,paddingRight:10},disabled:!!((Rt=F==null?void 0:F.sourceCurrency)!=null&&Rt.locked),children:[e.jsx(We,{currencyCode:G,size:16,baseUrl:K}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:Ke},children:G}),e.jsx(Ee,{})]}):e.jsxs("div",{className:"flex flex-col items-end shrink-0",children:[e.jsxs("button",{onClick:()=>I("crypto"),className:"flex items-center gap-1.5 transition-colors",style:{background:"var(--t-pill-bg)",borderRadius:4,height:32,paddingLeft:10,paddingRight:10},disabled:!!((At=F==null?void 0:F.destinationCurrency)!=null&&At.locked),children:[e.jsx(it,{ticker:M,size:16,baseUrl:K}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:Ke},children:M}),e.jsx(Ee,{})]}),ne&&e.jsxs("div",{className:"flex items-center gap-1 mt-1.5 mr-0.5",children:[e.jsx("div",{className:"rounded-full",style:{width:14,height:14,background:"#ffffff"},children:e.jsx("img",{src:$e(ne,K),alt:ne,width:14,height:14,className:"rounded-full",style:{width:14,height:14}})}),e.jsx("span",{className:"text-[12px]",style:{color:"var(--t-text-secondary)"},children:bt})]})]})]})]}),we&&xt&&e.jsx("div",{className:"text-[12px] mt-1.5 px-[2px]",style:{color:"#EF4444"},children:oe||(ht?"Amount should be more than 0":U?`Minimum amount is ${Dt} ${G}`:`Minimum amount is ${Mt} ${M}`)}),e.jsxs("div",{className:"px-[18px] pt-[12px] pb-[14px]",style:{background:"var(--t-surface)",borderTopLeftRadius:5,borderTopRightRadius:5,borderBottomLeftRadius:0,borderBottomRightRadius:0,marginTop:4,minHeight:102},children:[e.jsx("div",{className:"text-[13px] mb-2.5",style:{color:"var(--t-text-secondary)"},children:"You get"}),e.jsxs("div",{className:"flex items-start justify-between",children:[S&&!ae?e.jsx(O,{w:180,h:32}):e.jsx(ha,{value:X>0?ja:"0",height:32,className:"font-semibold",style:{color:X>0?"var(--t-text)":"var(--t-text-muted)",fontSize:24}}),U?e.jsxs("div",{className:"flex flex-col items-end shrink-0",children:[e.jsxs("button",{onClick:()=>I("crypto"),className:"flex items-center gap-1.5 transition-colors",style:{background:"var(--t-pill-bg)",borderRadius:4,height:32,paddingLeft:10,paddingRight:10},disabled:!!((wt=F==null?void 0:F.destinationCurrency)!=null&&wt.locked),children:[e.jsx(it,{ticker:M,size:16,baseUrl:K}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:Ke},children:M}),e.jsx(Ee,{})]}),ne&&e.jsxs("div",{className:"flex items-center gap-1 mt-1.5 mr-0.5",children:[e.jsx("div",{className:"rounded-full",style:{width:14,height:14,background:"#ffffff"},children:e.jsx("img",{src:$e(ne,K),alt:ne,width:14,height:14,className:"rounded-full",style:{width:14,height:14}})}),e.jsx("span",{className:"text-[12px]",style:{color:"var(--t-text-secondary)"},children:bt})]})]}):e.jsxs("button",{onClick:()=>I("fiat"),className:"flex items-center gap-1.5 shrink-0 transition-colors",style:{background:"var(--t-pill-bg)",borderRadius:4,height:32,paddingLeft:10,paddingRight:10},disabled:!!((kt=F==null?void 0:F.sourceCurrency)!=null&&kt.locked),children:[e.jsx(We,{currencyCode:G,size:16,baseUrl:K}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:Ke},children:G}),e.jsx(Ee,{})]})]})]}),Ue&&X>0&&(v==null?void 0:v.bestQuote)&&e.jsxs("div",{className:"flex items-start gap-2 mt-[2px] px-[14px] py-[10px]",style:{background:"var(--t-surface)",fontSize:12,color:"var(--t-text-secondary)",lineHeight:"16px"},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0,marginTop:1},children:[e.jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("path",{d:"M8 7v4M8 5.5v-.01",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e.jsxs("span",{children:["You will be charged for ",mt," ",M,", the rest up to ",Xe(X)," ",G," will be credited to your ",_," account"]})]}),e.jsx("div",{className:"flex items-center justify-between mt-[2px] px-[18px] pt-[12px] pb-[14px]",style:{background:"var(--t-surface)",...(Tt=o==null?void 0:o.paymentMethods)!=null&&Tt.length?{}:{borderBottomLeftRadius:5,borderBottomRightRadius:5}},children:e.jsx("span",{className:"text-[12px]",style:{color:g?"var(--t-success)":"var(--t-text-secondary)"},children:Na||" "})}),(o==null?void 0:o.paymentMethods)&&o.paymentMethods.length>0&&e.jsx("div",{className:"mt-[2px]",children:e.jsx(ia,{methods:o.paymentMethods,selectedId:x.paymentMethodId,onOpenModal:()=>I("payment"),fiatCurrency:x.fiatCurrency})}),e.jsxs("div",{className:"mt-8",children:[e.jsx("div",{className:"text-[13px] mb-2.5",style:{color:"var(--t-text-secondary)"},children:U?"Receiving wallet address":"Sending wallet address"}),e.jsx("input",{type:"text",value:x.walletAddress,onChange:y=>w({type:"SET_WALLET_ADDRESS",address:y.target.value}),onFocus:()=>Me(!0),onBlur:()=>{Me(!1),De(!0)},placeholder:U?"Enter your receiving address":"Enter your sending address",spellCheck:!1,autoComplete:"off",className:"w-full bg-transparent text-[13px] outline-none transition-colors",style:{border:x.walletError||ke&&!et?"1px solid #EF4444":z?"1px solid var(--t-border-focus)":"1px solid var(--t-border)",outline:"none",boxShadow:"none",borderRadius:3.5,height:47,padding:"0 14px",color:"var(--t-text)",fontSize:13,backgroundColor:"transparent"},disabled:!!((Lt=F==null?void 0:F.destinationAddress)!=null&&Lt.locked)}),x.walletError?e.jsx("div",{className:"text-[12px] mt-1.5",style:{color:"#EF4444"},children:x.walletError}):ke&&!et&&!he?e.jsx("div",{className:"text-[12px] mt-1.5",style:{color:"#EF4444"},children:"Enter a valid wallet address"}):he&&x.walletAddress.trim().length>=10?e.jsx("div",{className:"text-[12px] mt-1.5",style:{color:"var(--t-text-muted)"},children:"Validating address..."}):null]}),e.jsx("div",{className:"flex-1",style:{minHeight:16}}),e.jsx("button",{disabled:!He||q||ae,onClick:Fa,className:"w-full font-semibold text-[16px] transition-all",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)",opacity:He&&!q&&!ae?1:.4,cursor:He&&!q&&!ae?"pointer":"not-allowed"},children:ae?"Getting best price...":q?"Processing...":U?`Buy ${M}`:`Sell ${M}`}),e.jsx("div",{className:"text-center py-3",children:e.jsx("span",{className:"text-[11px]",style:{color:"var(--t-text-tertiary)"},children:"Powered by NowRamp"})})]},L),e.jsx(Ne,{isOpen:ee==="fiat",onClose:()=>I(null),children:y=>{var b;return e.jsx(xa,{onClose:y,onSelect:A=>{Aa(A),y()},currencies:(b=o==null?void 0:o.fiats)==null?void 0:b.map(A=>({code:A.code,name:A.code})),assetBaseUrl:K,selectedCode:x.fiatCurrency})}}),e.jsx(Ne,{isOpen:ee==="crypto",onClose:()=>I(null),children:y=>{var b;return e.jsx(ya,{onClose:y,onSelect:(A,B)=>{wa(A,B),y()},cryptos:(b=o==null?void 0:o.cryptos)==null?void 0:b.map(A=>{var B;return{code:A.code,name:A.code,networks:(B=A.networks)==null?void 0:B.map(J=>({code:J.id,name:J.name}))}}),assetBaseUrl:K,selectedCode:x.cryptoCurrency,selectedChain:x.network})}}),e.jsx(Ne,{isOpen:ee==="payment",onClose:()=>I(null),children:y=>{var b;return e.jsx(Wa,{methods:((b=o==null?void 0:o.paymentMethods)==null?void 0:b.filter(A=>A.supportedFiats.includes(x.fiatCurrency)))||[],selectedId:x.paymentMethodId,onSelect:A=>{ka(A),y()},onClose:y})}}),e.jsx(Ne,{isOpen:ee==="settings",onClose:()=>I(null),children:y=>e.jsx(Ca,{onClose:y,darkMode:V,onToggleDarkMode:se,skinId:ie,onSelectSkin:b=>{Ae(b)},showThemeToggle:R,country:x.country,countryName:Ua,onLocationPress:La,assetBaseUrl:K})}),e.jsx(Ne,{isOpen:ee==="country",onClose:()=>I(null),children:y=>e.jsx(Sa,{onClose:y,onSelect:b=>{Ta(b),y()},assetBaseUrl:K,selectedCode:x.country})})]})}function va({projectId:t,apiUrl:a,assetBaseUrl:n,flowType:r,customerId:i,brandId:l,defaultFiatCurrency:m,defaultCryptoCurrency:c,defaultNetwork:u,defaultFiatAmount:f,defaultCryptoAmount:h,defaultWalletAddress:d,defaultGateway:p,defaultCountry:g,fieldLocks:E,statusPollInterval:j,onComplete:R,onError:H,className:Q,theme:P,skinId:$,accentColor:W,bgColor:_,bgImage:de,borderColor:x,borderRadius:w,surfaceColor:o,inputBgColor:D,textColor:v,textSecondaryColor:S,textMutedColor:ue,successColor:me,showFlowToggle:fe,showSettings:q,showThemeToggle:oe,autoRedirect:F,explorerUrl:Y,doneButtonText:K,supportEmail:V,stablecoinParity:se,partnerName:ie,onDone:Ae}){return e.jsx(Gt,{projectId:t,apiUrl:a,assetBaseUrl:n,flowType:r,customerId:i,brandId:l,defaultFiatCurrency:m,defaultCryptoCurrency:c,defaultNetwork:u,defaultFiatAmount:f,defaultCryptoAmount:h,defaultWalletAddress:d,defaultGateway:p,defaultCountry:g,fieldLocks:E,statusPollInterval:j,onComplete:R,onError:H,children:e.jsx(za,{className:Q,theme:P,skinId:$,accentColor:W,bgColor:_,bgImage:de,borderColor:x,borderRadius:w,surfaceColor:o,inputBgColor:D,textColor:v,textSecondaryColor:S,textMutedColor:ue,successColor:me,showFlowToggle:fe,showSettings:q,showThemeToggle:oe,autoRedirect:F,explorerUrl:Y,doneButtonText:K,supportEmail:V,stablecoinParity:se,partnerName:ie,onDone:Ae})})}function Ja({submitButtonText:t,rateRefreshInterval:a,...n}){return e.jsx(va,{...n})}function qa({skin:t,active:a,onClick:n,darkMode:r,dimmed:i}){const l=t.accent===null,m=32;return e.jsxs("button",{onClick:n,className:"relative shrink-0",style:{width:m,height:m,opacity:i?.4:1,transition:"opacity 0.2s"},children:[l?e.jsxs("svg",{width:m,height:m,viewBox:"0 0 32 32",children:[e.jsx("clipPath",{id:"mono-left",children:e.jsx("rect",{x:"0",y:"0",width:"16",height:"32"})}),e.jsx("clipPath",{id:"mono-right",children:e.jsx("rect",{x:"16",y:"0",width:"16",height:"32"})}),e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:"#111111",clipPath:"url(#mono-left)"}),e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:"#ffffff",clipPath:"url(#mono-right)"}),e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:"none",stroke:r?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.1)",strokeWidth:"1"})]}):e.jsx("svg",{width:m,height:m,viewBox:"0 0 32 32",children:e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:t.accent})}),a&&!i&&e.jsx("div",{className:"absolute inset-0 rounded-full",style:{boxShadow:"0 0 0 2px var(--t-bg), 0 0 0 4px var(--t-text)"}})]})}function en({quote:t}){return t.isBestRate?e.jsx("div",{className:"text-[12px]",style:{color:"var(--t-text-secondary)"},children:"Best price"}):t.isRecommended?e.jsx("div",{className:"text-[12px]",style:{color:"var(--t-text-secondary)"},children:"Recommended"}):t.rank&&t.rank<=3?e.jsxs("div",{className:"text-[12px]",style:{color:"var(--t-text-secondary)"},children:["#",t.rank]}):null}function tn({quote:t}){return t.gatewayLogo?e.jsx("img",{src:t.gatewayLogo,alt:t.gatewayName,width:36,height:36,className:"rounded-full shrink-0",style:{width:36,height:36}}):e.jsx(Qe,{size:36})}function an(){return e.jsx("div",{className:"space-y-2",children:[0,1,2].map(t=>e.jsxs("div",{className:"w-full flex items-center gap-3.5",style:{borderRadius:5,height:64,paddingLeft:16,paddingRight:16,background:"var(--t-surface)"},children:[e.jsx(O,{w:36,h:36,className:"rounded-full shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx(O,{w:90,h:14,className:"mb-1.5"}),e.jsx(O,{w:60,h:12})]}),e.jsxs("div",{className:"text-right",children:[e.jsx(O,{w:40,h:10,className:"mb-1.5"}),e.jsx(O,{w:80,h:14})]})]},t))})}function nn({onClose:t,onSelect:a,quotes:n,quotesLoading:r,cryptoCurrency:i}){const[l,m]=s.useState(""),c=s.useMemo(()=>{if(!(n!=null&&n.quotes))return[];const u=l.trim().toLowerCase();return u?n.quotes.filter(f=>f.gatewayName.toLowerCase().includes(u)):n.quotes},[n,l]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(ge,{onClick:t})}),e.jsx("h2",{className:"text-center text-[17px] font-medium mt-2 mb-6",style:{color:"var(--t-text)",fontSize:17,fontWeight:500,marginTop:8,marginBottom:24},children:"Choose Ramp"}),e.jsx(Re,{value:l,onChange:m}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5 space-y-2",children:[r?e.jsx(an,{}):c.length===0?e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:n&&n.quotes.length===0?"No quotes available for this request":"No providers found"}):c.map((u,f)=>{const h=f===0,d=parseFloat(u.cryptoAmount),p=d>=1?d.toFixed(4):d.toPrecision(6);return e.jsxs("button",{onClick:()=>a(u),className:"w-full flex items-center gap-3.5 transition-colors",style:{borderRadius:h?4.5:5,height:h?63:64,paddingLeft:16,paddingRight:16,border:h?"1px solid var(--t-border)":"1px solid transparent",background:h?"transparent":"var(--t-surface)"},children:[e.jsx(tn,{quote:u}),e.jsxs("div",{className:"text-left flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-[15px]",style:{color:"var(--t-text)"},children:u.gatewayName}),e.jsx(en,{quote:u})]}),e.jsxs("div",{className:"text-right shrink-0",children:[e.jsx("div",{className:"text-[11px]",style:{color:"var(--t-text-secondary)"},children:"You get"}),e.jsxs("div",{className:"font-medium text-[14px]",style:{color:"var(--t-text)"},children:[i," ",p]})]})]},u.gatewayId)}),!r&&(n==null?void 0:n.unavailableGateways)&&n.unavailableGateways.length>0&&e.jsx("div",{className:"pt-3",children:n.unavailableGateways.map(u=>e.jsxs("div",{className:"flex items-center justify-between py-2 text-[12px]",style:{color:"var(--t-text-muted)"},children:[e.jsx("span",{children:u.gatewayName}),e.jsx("span",{children:u.reason})]},u.gatewayId))})]})]})}exports.AnimatedDigit=fa;exports.AnimatedNumber=ha;exports.ApplePayIcon=Jt;exports.BLOCKCHAINS=je;exports.BankIcon=Qt;exports.COUNTRIES=Fe;exports.COUNTRY_MAP=Ze;exports.CRYPTO_CHAIN_COMBOS=Yt;exports.CRYPTO_CURRENCIES=ct;exports.CardIcon=ta;exports.CheckoutForm=Ja;exports.CheckoutStep=la;exports.ChevronDown=Ee;exports.ChevronRight=lt;exports.ChooseRampModal=nn;exports.CloseButton=ge;exports.CoinifyIcon=Va;exports.CompleteStep=da;exports.ConfirmStep=ma;exports.CountryPickerModal=Sa;exports.CryptoCurrencyModal=ya;exports.CryptoIcon=it;exports.DarkModeIcon=na;exports.ErrorStep=ua;exports.FIAT_CURRENCIES=rt;exports.FIAT_TO_COUNTRY=$t;exports.FiatCurrencyModal=xa;exports.FiatFlag=We;exports.FormSkeleton=pa;exports.GenericCoinIcon=Qe;exports.GooglePayIcon=qt;exports.MOCK_RATES=st;exports.MenuIcon=aa;exports.Modal=Ne;exports.PayPalIcon=ea;exports.PaymentMethodSelector=ia;exports.ProcessingStep=ca;exports.RampForm=va;exports.RampProvider=Gt;exports.RevolutIcon=zt;exports.SKINS=ot;exports.SearchInput=Re;exports.SettingsScreen=Ca;exports.Skeleton=O;exports.SkinSwatch=qa;exports.ToggleSwitch=ga;exports.formatOutput=Xe;exports.getChainIconUrl=$e;exports.getCryptoIconUrl=dt;exports.getDefaultFiatForCountry=Ve;exports.getFiatFlagUrl=Xt;exports.getMockRate=Pa;exports.getPaymentIcon=ra;exports.isStablecoin=ut;exports.parseAmount=Wt;exports.useCheckoutIntent=Pt;exports.useQuotes=Ht;exports.useRamp=ye;exports.useRampConfig=Ot;exports.useTransaction=Kt;
11
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("react"),ze=require("@nowramp/sdk"),Ot=require("react-dom");function Gt(t,a,n){const[r,o]=c.useState(null),[d,u]=c.useState(!0),[s,l]=c.useState(null),m=c.useRef(null);(!m.current||m.current!==t)&&(m.current=new ze.RampApi({apiKey:"",...t}));const h=c.useCallback(async()=>{if(!t.projectId){l(new Error("projectId is required")),u(!1);return}u(!0),l(null);try{const f={};a&&(f.orderType=a),n&&(f.country=n);const p=await m.current.getSupported(f);o(p)}catch(f){l(f instanceof Error?f:new Error("Failed to fetch config"))}finally{u(!1)}},[t.projectId,a,n]);return c.useEffect(()=>{h()},[h]),{config:r,loading:d,error:s,refetch:h}}function Yt(t,a){const[n,r]=c.useState(null),[o,d]=c.useState(!1),[u,s]=c.useState(null),l=c.useRef(null),m=c.useRef(""),h=`${t.apiUrl}|${t.projectId}`;(!l.current||m.current!==h)&&(l.current=new ze.RampApi({apiKey:"",...t}),m.current=h);const f=c.useRef(0);c.useEffect(()=>{const g=++f.current;if(!a||!t.projectId){r(null),d(!1);return}d(!0),s(null),l.current.getQuotes(a).then(y=>{f.current===g&&(r(y),d(!1))},y=>{f.current===g&&(s(y instanceof Error?y:new Error("Failed to fetch quotes")),r(null),d(!1))})},[t.projectId,a==null?void 0:a.fiatCurrency,a==null?void 0:a.fiatAmount,a==null?void 0:a.cryptoAmount,a==null?void 0:a.cryptoCurrency,a==null?void 0:a.network,a==null?void 0:a.paymentMethodId,a==null?void 0:a.country,a==null?void 0:a.orderType]);const p=c.useCallback(async()=>{if(!(!a||!t.projectId)){d(!0),s(null);try{const g=await l.current.getQuotes(a);r(g)}catch(g){s(g instanceof Error?g:new Error("Failed to fetch quotes"))}finally{d(!1)}}},[t.projectId,a]);return{quotes:n,loading:o,error:u,refetch:p}}function $t(t){const[a,n]=c.useState(null),[r,o]=c.useState(!1),[d,u]=c.useState(null),s=c.useRef(null),l=c.useRef(""),m=`${t.apiUrl}|${t.projectId}`;(!s.current||l.current!==m)&&(s.current=new ze.RampApi({apiKey:"",...t}),l.current=m);const h=c.useCallback(async p=>{o(!0),u(null);try{const g=await s.current.createCheckoutIntent(p);return n(g),g}catch(g){const y=g instanceof Error?g:new Error("Failed to create checkout intent");throw u(y),y}finally{o(!1)}},[]),f=c.useCallback(()=>{n(null),u(null)},[]);return{order:a,loading:r,error:d,createOrder:h,reset:f}}function Wt(t,a,n){const[r,o]=c.useState(null),[d,u]=c.useState(!1),[s,l]=c.useState(null),m=c.useRef(null);m.current||(m.current=new ze.RampApi({apiKey:"",projectId:"",...t}));const h=c.useCallback(async()=>{if(a){u(!0),l(null);try{const f=await m.current.getTransaction(a);o(f)}catch(f){l(f instanceof Error?f:new Error("Failed to fetch status"))}finally{u(!1)}}},[a]);return c.useEffect(()=>{if(!a)return;const f=(n==null?void 0:n.initialDelay)??0;if(f>0){const p=setTimeout(h,f);return()=>clearTimeout(p)}h()},[h,a,n==null?void 0:n.initialDelay]),c.useEffect(()=>{if(!a||!(n!=null&&n.pollInterval)||!r||["completed","failed","cancelled","expired","refunded"].includes(r.status))return;const p=setInterval(h,n.pollInterval);return()=>clearInterval(p)},[a,n==null?void 0:n.pollInterval,r==null?void 0:r.status,h]),{status:r,loading:d,error:s,refetch:h}}const Ie=[{code:"ad",name:"Andorra",defaultFiat:"EUR"},{code:"ae",name:"United Arab Emirates",defaultFiat:"AED"},{code:"af",name:"Afghanistan",defaultFiat:"USD"},{code:"ag",name:"Antigua and Barbuda",defaultFiat:"USD"},{code:"al",name:"Albania",defaultFiat:"ALL"},{code:"am",name:"Armenia",defaultFiat:"USD"},{code:"ao",name:"Angola",defaultFiat:"USD"},{code:"ar",name:"Argentina",defaultFiat:"ARS"},{code:"at",name:"Austria",defaultFiat:"EUR"},{code:"au",name:"Australia",defaultFiat:"AUD"},{code:"az",name:"Azerbaijan",defaultFiat:"USD"},{code:"ba",name:"Bosnia and Herzegovina",defaultFiat:"EUR"},{code:"bb",name:"Barbados",defaultFiat:"USD"},{code:"bd",name:"Bangladesh",defaultFiat:"USD"},{code:"be",name:"Belgium",defaultFiat:"EUR"},{code:"bf",name:"Burkina Faso",defaultFiat:"USD"},{code:"bg",name:"Bulgaria",defaultFiat:"EUR"},{code:"bh",name:"Bahrain",defaultFiat:"USD"},{code:"bi",name:"Burundi",defaultFiat:"USD"},{code:"bj",name:"Benin",defaultFiat:"USD"},{code:"bn",name:"Brunei",defaultFiat:"USD"},{code:"bo",name:"Bolivia",defaultFiat:"USD"},{code:"br",name:"Brazil",defaultFiat:"BRL"},{code:"bs",name:"Bahamas",defaultFiat:"USD"},{code:"bt",name:"Bhutan",defaultFiat:"USD"},{code:"bw",name:"Botswana",defaultFiat:"USD"},{code:"by",name:"Belarus",defaultFiat:"USD"},{code:"bz",name:"Belize",defaultFiat:"USD"},{code:"ca",name:"Canada",defaultFiat:"CAD"},{code:"cd",name:"DR Congo",defaultFiat:"USD"},{code:"cf",name:"Central African Republic",defaultFiat:"USD"},{code:"ch",name:"Switzerland",defaultFiat:"CHF"},{code:"ci",name:"Cote d'Ivoire",defaultFiat:"USD"},{code:"cl",name:"Chile",defaultFiat:"CLP"},{code:"cm",name:"Cameroon",defaultFiat:"USD"},{code:"cn",name:"China",defaultFiat:"USD"},{code:"co",name:"Colombia",defaultFiat:"USD"},{code:"cr",name:"Costa Rica",defaultFiat:"USD"},{code:"cu",name:"Cuba",defaultFiat:"USD"},{code:"cv",name:"Cape Verde",defaultFiat:"USD"},{code:"cy",name:"Cyprus",defaultFiat:"EUR"},{code:"cz",name:"Czech Republic",defaultFiat:"CZK"},{code:"de",name:"Germany",defaultFiat:"EUR"},{code:"dj",name:"Djibouti",defaultFiat:"USD"},{code:"dk",name:"Denmark",defaultFiat:"DKK"},{code:"dm",name:"Dominica",defaultFiat:"USD"},{code:"do",name:"Dominican Republic",defaultFiat:"USD"},{code:"dz",name:"Algeria",defaultFiat:"USD"},{code:"ec",name:"Ecuador",defaultFiat:"USD"},{code:"ee",name:"Estonia",defaultFiat:"EUR"},{code:"eg",name:"Egypt",defaultFiat:"USD"},{code:"er",name:"Eritrea",defaultFiat:"USD"},{code:"es",name:"Spain",defaultFiat:"EUR"},{code:"et",name:"Ethiopia",defaultFiat:"USD"},{code:"fi",name:"Finland",defaultFiat:"EUR"},{code:"fj",name:"Fiji",defaultFiat:"USD"},{code:"fr",name:"France",defaultFiat:"EUR"},{code:"ga",name:"Gabon",defaultFiat:"USD"},{code:"gb",name:"United Kingdom",defaultFiat:"GBP"},{code:"gd",name:"Grenada",defaultFiat:"USD"},{code:"ge",name:"Georgia",defaultFiat:"USD"},{code:"gh",name:"Ghana",defaultFiat:"USD"},{code:"gm",name:"Gambia",defaultFiat:"USD"},{code:"gn",name:"Guinea",defaultFiat:"USD"},{code:"gq",name:"Equatorial Guinea",defaultFiat:"USD"},{code:"gr",name:"Greece",defaultFiat:"EUR"},{code:"gt",name:"Guatemala",defaultFiat:"USD"},{code:"gw",name:"Guinea-Bissau",defaultFiat:"USD"},{code:"gy",name:"Guyana",defaultFiat:"USD"},{code:"hk",name:"Hong Kong",defaultFiat:"HKD"},{code:"hn",name:"Honduras",defaultFiat:"USD"},{code:"hr",name:"Croatia",defaultFiat:"EUR"},{code:"ht",name:"Haiti",defaultFiat:"USD"},{code:"hu",name:"Hungary",defaultFiat:"EUR"},{code:"id",name:"Indonesia",defaultFiat:"IDR"},{code:"ie",name:"Ireland",defaultFiat:"EUR"},{code:"il",name:"Israel",defaultFiat:"USD"},{code:"in",name:"India",defaultFiat:"INR"},{code:"iq",name:"Iraq",defaultFiat:"USD"},{code:"ir",name:"Iran",defaultFiat:"USD"},{code:"is",name:"Iceland",defaultFiat:"EUR"},{code:"it",name:"Italy",defaultFiat:"EUR"},{code:"jm",name:"Jamaica",defaultFiat:"USD"},{code:"jo",name:"Jordan",defaultFiat:"USD"},{code:"jp",name:"Japan",defaultFiat:"JPY"},{code:"ke",name:"Kenya",defaultFiat:"USD"},{code:"kg",name:"Kyrgyzstan",defaultFiat:"USD"},{code:"kh",name:"Cambodia",defaultFiat:"USD"},{code:"ki",name:"Kiribati",defaultFiat:"USD"},{code:"km",name:"Comoros",defaultFiat:"USD"},{code:"kn",name:"Saint Kitts and Nevis",defaultFiat:"USD"},{code:"kr",name:"South Korea",defaultFiat:"KRW"},{code:"kw",name:"Kuwait",defaultFiat:"USD"},{code:"kz",name:"Kazakhstan",defaultFiat:"USD"},{code:"la",name:"Laos",defaultFiat:"USD"},{code:"lb",name:"Lebanon",defaultFiat:"USD"},{code:"lc",name:"Saint Lucia",defaultFiat:"USD"},{code:"li",name:"Liechtenstein",defaultFiat:"CHF"},{code:"lk",name:"Sri Lanka",defaultFiat:"USD"},{code:"lr",name:"Liberia",defaultFiat:"USD"},{code:"ls",name:"Lesotho",defaultFiat:"ZAR"},{code:"lt",name:"Lithuania",defaultFiat:"EUR"},{code:"lu",name:"Luxembourg",defaultFiat:"EUR"},{code:"lv",name:"Latvia",defaultFiat:"EUR"},{code:"ly",name:"Libya",defaultFiat:"USD"},{code:"ma",name:"Morocco",defaultFiat:"USD"},{code:"mc",name:"Monaco",defaultFiat:"EUR"},{code:"md",name:"Moldova",defaultFiat:"EUR"},{code:"me",name:"Montenegro",defaultFiat:"EUR"},{code:"mg",name:"Madagascar",defaultFiat:"USD"},{code:"mk",name:"North Macedonia",defaultFiat:"EUR"},{code:"ml",name:"Mali",defaultFiat:"USD"},{code:"mm",name:"Myanmar",defaultFiat:"USD"},{code:"mn",name:"Mongolia",defaultFiat:"USD"},{code:"mr",name:"Mauritania",defaultFiat:"USD"},{code:"mt",name:"Malta",defaultFiat:"EUR"},{code:"mu",name:"Mauritius",defaultFiat:"USD"},{code:"mv",name:"Maldives",defaultFiat:"USD"},{code:"mw",name:"Malawi",defaultFiat:"USD"},{code:"mx",name:"Mexico",defaultFiat:"MXN"},{code:"my",name:"Malaysia",defaultFiat:"USD"},{code:"mz",name:"Mozambique",defaultFiat:"USD"},{code:"na",name:"Namibia",defaultFiat:"ZAR"},{code:"ne",name:"Niger",defaultFiat:"USD"},{code:"ng",name:"Nigeria",defaultFiat:"NGN"},{code:"ni",name:"Nicaragua",defaultFiat:"USD"},{code:"nl",name:"Netherlands",defaultFiat:"EUR"},{code:"no",name:"Norway",defaultFiat:"NOK"},{code:"np",name:"Nepal",defaultFiat:"USD"},{code:"nr",name:"Nauru",defaultFiat:"AUD"},{code:"nz",name:"New Zealand",defaultFiat:"NZD"},{code:"om",name:"Oman",defaultFiat:"USD"},{code:"pa",name:"Panama",defaultFiat:"USD"},{code:"pe",name:"Peru",defaultFiat:"USD"},{code:"pg",name:"Papua New Guinea",defaultFiat:"USD"},{code:"ph",name:"Philippines",defaultFiat:"PHP"},{code:"pk",name:"Pakistan",defaultFiat:"USD"},{code:"pl",name:"Poland",defaultFiat:"PLN"},{code:"pt",name:"Portugal",defaultFiat:"EUR"},{code:"pw",name:"Palau",defaultFiat:"USD"},{code:"py",name:"Paraguay",defaultFiat:"USD"},{code:"qa",name:"Qatar",defaultFiat:"QAR"},{code:"ro",name:"Romania",defaultFiat:"EUR"},{code:"rs",name:"Serbia",defaultFiat:"EUR"},{code:"ru",name:"Russia",defaultFiat:"USD"},{code:"rw",name:"Rwanda",defaultFiat:"USD"},{code:"sa",name:"Saudi Arabia",defaultFiat:"SAR"},{code:"sb",name:"Solomon Islands",defaultFiat:"USD"},{code:"sc",name:"Seychelles",defaultFiat:"USD"},{code:"sd",name:"Sudan",defaultFiat:"USD"},{code:"se",name:"Sweden",defaultFiat:"SEK"},{code:"sg",name:"Singapore",defaultFiat:"SGD"},{code:"si",name:"Slovenia",defaultFiat:"EUR"},{code:"sk",name:"Slovakia",defaultFiat:"EUR"},{code:"sl",name:"Sierra Leone",defaultFiat:"USD"},{code:"sm",name:"San Marino",defaultFiat:"EUR"},{code:"sn",name:"Senegal",defaultFiat:"USD"},{code:"so",name:"Somalia",defaultFiat:"USD"},{code:"sr",name:"Suriname",defaultFiat:"USD"},{code:"ss",name:"South Sudan",defaultFiat:"USD"},{code:"sv",name:"El Salvador",defaultFiat:"USD"},{code:"sy",name:"Syria",defaultFiat:"USD"},{code:"sz",name:"Eswatini",defaultFiat:"ZAR"},{code:"td",name:"Chad",defaultFiat:"USD"},{code:"tg",name:"Togo",defaultFiat:"USD"},{code:"th",name:"Thailand",defaultFiat:"THB"},{code:"tj",name:"Tajikistan",defaultFiat:"USD"},{code:"tl",name:"Timor-Leste",defaultFiat:"USD"},{code:"tm",name:"Turkmenistan",defaultFiat:"USD"},{code:"tn",name:"Tunisia",defaultFiat:"USD"},{code:"to",name:"Tonga",defaultFiat:"USD"},{code:"tr",name:"Turkey",defaultFiat:"TRY"},{code:"tt",name:"Trinidad and Tobago",defaultFiat:"USD"},{code:"tv",name:"Tuvalu",defaultFiat:"AUD"},{code:"tw",name:"Taiwan",defaultFiat:"TWD"},{code:"tz",name:"Tanzania",defaultFiat:"USD"},{code:"ua",name:"Ukraine",defaultFiat:"USD"},{code:"ug",name:"Uganda",defaultFiat:"USD"},{code:"us",name:"United States",defaultFiat:"USD"},{code:"uy",name:"Uruguay",defaultFiat:"USD"},{code:"uz",name:"Uzbekistan",defaultFiat:"USD"},{code:"va",name:"Vatican City",defaultFiat:"EUR"},{code:"vc",name:"Saint Vincent and the Grenadines",defaultFiat:"USD"},{code:"ve",name:"Venezuela",defaultFiat:"USD"},{code:"vn",name:"Vietnam",defaultFiat:"VND"},{code:"vu",name:"Vanuatu",defaultFiat:"USD"},{code:"ws",name:"Samoa",defaultFiat:"USD"},{code:"ye",name:"Yemen",defaultFiat:"USD"},{code:"za",name:"South Africa",defaultFiat:"ZAR"},{code:"zm",name:"Zambia",defaultFiat:"USD"},{code:"zw",name:"Zimbabwe",defaultFiat:"USD"}],Je=Object.fromEntries(Ie.map(t=>[t.code,t]));function $e(t,a){if(!t)return"USD";const n=Je[t.toLowerCase()],r=(n==null?void 0:n.defaultFiat)||"USD";return!a||a.length===0||a.includes(r)?r:a.includes("USD")?"USD":a[0]||"USD"}const qe=!0;function ht(t,a,n=qe){return t===void 0||a===void 0?n:t.length===0||a.length===0?!1:t.some(r=>a.includes(r))}function Va(t,a,n=qe){return t.filter(r=>ht(r.providers,a,n))}function Ga(t,a,n=qe){const r=[];for(const o of t){const d=o.networks.filter(u=>ht(u.providers,a,n));d.length>0&&r.push(d.length===o.networks.length?o:{...o,networks:d})}return r}function Ya(t,a,n,r=qe){return n?t.filter(o=>o.supportedFiats.includes(n)&&ht(o.providers,a,r)):[]}function $a(t,a,n){const r={};let o=!1;if(!n.cryptoLocked&&!n.networkLocked){if(!(t.cryptoCurrency&&a.availableCryptos.some(s=>s.code===t.cryptoCurrency&&s.networks.some(l=>l.id===t.network)))&&a.availableCryptos.length>0){const s=a.availableCryptos[0],l=s.networks.find(m=>m.isDefault)||s.networks[0];s.code!==t.cryptoCurrency&&(r.cryptoCurrency=s.code,o=!0),l&&l.id!==t.network&&(r.network=l.id,o=!0)}}else if(!n.cryptoLocked&&n.networkLocked){if(!(t.cryptoCurrency&&a.availableCryptos.some(s=>s.code===t.cryptoCurrency&&s.networks.some(l=>l.id===t.network)))){const s=a.availableCryptos.find(l=>l.networks.some(m=>m.id===t.network));s&&s.code!==t.cryptoCurrency&&(r.cryptoCurrency=s.code,o=!0)}}else if(n.cryptoLocked&&!n.networkLocked){const u=a.availableCryptos.find(s=>s.code===t.cryptoCurrency);if(u&&!u.networks.some(l=>l.id===t.network)&&u.networks.length>0){const l=u.networks.find(m=>m.isDefault)||u.networks[0];l.id!==t.network&&(r.network=l.id,o=!0)}}if(!n.fiatLocked&&!(t.fiatCurrency&&a.availableFiats.some(s=>s.code===t.fiatCurrency))&&a.availableFiats.length>0){const l=a.availableFiats.find(m=>m.code==="USD")||a.availableFiats[0];l.code!==t.fiatCurrency&&(r.fiatCurrency=l.code,o=!0)}if(!(t.paymentMethodId&&a.availablePaymentMethods.some(u=>u.id===t.paymentMethodId))&&a.availablePaymentMethods.length>0){const s=a.availablePaymentMethods.find(l=>l.id.includes("card")||l.id.includes("debit"))||a.availablePaymentMethods[0];s.id!==t.paymentMethodId&&(r.paymentMethodId=s.id,o=!0)}return o?r:null}function Wa(t,a,n,r){var o,d,u;if(n.cryptoLocked){const s=(o=t.cryptos)==null?void 0:o.find(m=>m.code===a.cryptoCurrency);if(!s)return!0;const l=(d=s.networks)==null?void 0:d.find(m=>m.id===a.network);if(!l||l.providers!==void 0&&l.providers.length===0||l.providers!==void 0&&(r.availableFiats.length===0||r.availablePaymentMethods.length===0))return!0}if(n.networkLocked&&!n.cryptoLocked&&!r.availableCryptos.some(l=>l.networks.some(m=>m.id===a.network)))return!0;if(n.fiatLocked){const s=(u=t.fiats)==null?void 0:u.find(l=>l.code===a.fiatCurrency);if(!s||s.providers!==void 0&&s.providers.length===0||s.providers!==void 0&&r.availableCryptos.length===0)return!0}return!1}function Ht(t,a){if(!t)return t;const n=t.indexOf(".");if(n===-1)return t;let r=t;return r.length-n-1>a&&(r=r.slice(0,n+a+1)),r=r.replace(/0+$/,"").replace(/\.$/,""),r}const Xt={step:"amount",flowType:"buy",fiatCurrency:"USD",fiatAmount:"",cryptoCurrency:"",cryptoAmount:"",network:"",paymentMethodId:"",walletAddress:"",walletError:null,selectedProvider:null,selectedQuote:null,customerId:"",email:"",country:"",countrySource:"",errorMessage:null};function Xa(t,a){var n,r,o,d,u,s,l,m;switch(a.type){case"SET_STEP":return{...t,step:a.step,errorMessage:null};case"SET_FLOW_TYPE":return{...t,flowType:a.flowType,fiatAmount:"",cryptoAmount:"",fiatCurrency:(r=(n=a.fieldLocks)==null?void 0:n.sourceCurrency)!=null&&r.locked?t.fiatCurrency:"",cryptoCurrency:(d=(o=a.fieldLocks)==null?void 0:o.destinationCurrency)!=null&&d.locked?t.cryptoCurrency:"",network:(s=(u=a.fieldLocks)==null?void 0:u.network)!=null&&s.locked||(m=(l=a.fieldLocks)==null?void 0:l.destinationCurrency)!=null&&m.locked?t.network:"",paymentMethodId:"",selectedQuote:null,selectedProvider:null,errorMessage:null};case"SET_FIAT_CURRENCY":return{...t,fiatCurrency:a.currency};case"SET_FIAT_AMOUNT":return{...t,fiatAmount:a.amount};case"SET_CRYPTO_CURRENCY":return{...t,cryptoCurrency:a.currency,network:""};case"SET_CRYPTO_AMOUNT":return{...t,cryptoAmount:a.amount};case"SET_NETWORK":return{...t,network:a.network};case"SET_CRYPTO_CHAIN":return{...t,network:a.chain};case"SET_PAYMENT_METHOD":return{...t,paymentMethodId:a.methodId};case"SET_WALLET_ADDRESS":return{...t,walletAddress:a.address,walletError:null};case"SET_WALLET_ERROR":return{...t,walletError:a.message};case"SELECT_QUOTE":return{...t,selectedQuote:a.quote,selectedProvider:a.quote.gatewayId};case"SET_CUSTOMER_ID":return{...t,customerId:a.customerId};case"SET_EMAIL":return{...t,email:a.email};case"SET_COUNTRY":return{...t,country:a.country,countrySource:"manual"};case"SET_COUNTRY_AUTO":return{...t,country:a.country,countrySource:"auto"};case"SET_ERROR":return{...t,step:"error",errorMessage:a.message};case"CLEAR_ERROR":return{...t,errorMessage:null};case"RESET":return Xt;default:return t}}const Zt=c.createContext(null);function Qt({projectId:t,apiUrl:a="https://api.nowramp.com",assetBaseUrl:n="",flowType:r="buy",customerId:o="",brandId:d,defaultFiatCurrency:u="USD",defaultCryptoCurrency:s="BTC",defaultNetwork:l="",defaultFiatAmount:m="",defaultCryptoAmount:h="",defaultWalletAddress:f="",defaultGateway:p,defaultCountry:g,fieldLocks:y,statusPollInterval:N=5e3,onComplete:R,onError:H,children:J}){const P=c.useMemo(()=>({apiUrl:a,projectId:t}),[a,t]),Y=l||(s?s.toLowerCase():""),X=r==="sell",_=X?!!h:!!m,S=(X?!!(_&&s&&Y):!!(_&&s&&Y&&f))&&p?"confirm":"amount",k=m||(r==="buy"?"250":""),[i,T]=c.useReducer(Xa,{...Xt,step:S,flowType:r,fiatCurrency:u,cryptoCurrency:s,network:Y,fiatAmount:Ht(k,2),cryptoAmount:Ht(h,6),walletAddress:f,customerId:o,...g?{country:g.toLowerCase(),countrySource:"manual"}:{}}),j=i.flowType==="sell",{config:v,loading:Z,error:me}=Gt(P,i.flowType,i.country||void 0),fe=c.useRef(!1);c.useEffect(()=>{var L;if(fe.current||!(v!=null&&v.detectedCountry)||i.country)return;fe.current=!0;const x=v.detectedCountry.toLowerCase();T({type:"SET_COUNTRY_AUTO",country:x});const w=(L=v.fiats)==null?void 0:L.map(F=>F.code),E=$e(x,w);E!==i.fiatCurrency&&T({type:"SET_FIAT_CURRENCY",currency:E})},[v,i.country,i.fiatCurrency]);const te=c.useRef(!1);c.useEffect(()=>{var E;if(te.current||!g||!((E=v==null?void 0:v.fiats)!=null&&E.length))return;te.current=!0;const x=v.fiats.map(L=>L.code),w=$e(g,x);w!==i.fiatCurrency&&T({type:"SET_FIAT_CURRENCY",currency:w})},[g,v,i.fiatCurrency]);const le=c.useRef(i.country);c.useEffect(()=>{var E;if(i.country===le.current||(le.current=i.country,i.countrySource==="manual"&&(ne.current=!1),i.countrySource!=="manual")||!((E=v==null?void 0:v.fiats)!=null&&E.length))return;const x=v.fiats.map(L=>L.code),w=$e(i.country,x);w!==i.fiatCurrency&&T({type:"SET_FIAT_CURRENCY",currency:w})},[i.country,i.countrySource,v,i.fiatCurrency]);const U=c.useRef(i.fiatCurrency);c.useEffect(()=>{var L;if(i.fiatCurrency===U.current||(U.current=i.fiatCurrency,j||!((L=v==null?void 0:v.fiats)!=null&&L.length)||!i.fiatAmount))return;const x=v.fiats.find(F=>F.code===i.fiatCurrency);if(!(x!=null&&x.minAmount))return;const w=parseFloat(i.fiatAmount),E=parseFloat(x.minAmount);!isNaN(w)&&!isNaN(E)&&w<E&&T({type:"SET_FIAT_AMOUNT",amount:String(Math.ceil(E))})},[i.fiatCurrency,i.fiatAmount,v,j]);const{availableFiats:Q,availableCryptos:D,availablePaymentMethods:ae}=c.useMemo(()=>{var E,L,F;if(!v)return{availableFiats:[],availableCryptos:[],availablePaymentMethods:[]};let x;if(i.cryptoCurrency&&i.network){const A=(E=v.cryptos)==null?void 0:E.find(V=>V.code===i.cryptoCurrency),I=(L=A==null?void 0:A.networks)==null?void 0:L.find(V=>V.id===i.network);!A||!I?x=[]:x=I.providers}let w;if(i.fiatCurrency){const A=(F=v.fiats)==null?void 0:F.find(I=>I.code===i.fiatCurrency);A?w=A.providers:w=[]}return{availableFiats:Va(v.fiats??[],x),availableCryptos:Ga(v.cryptos??[],w),availablePaymentMethods:Ya(v.paymentMethods??[],x,i.fiatCurrency)}},[v,i.cryptoCurrency,i.network,i.fiatCurrency]),Te=c.useMemo(()=>{var x,w,E;return Z||!v?!1:Wa(v,{cryptoCurrency:i.cryptoCurrency,network:i.network,fiatCurrency:i.fiatCurrency},{cryptoLocked:!!((x=y==null?void 0:y.destinationCurrency)!=null&&x.locked),networkLocked:!!((w=y==null?void 0:y.network)!=null&&w.locked),fiatLocked:!!((E=y==null?void 0:y.sourceCurrency)!=null&&E.locked)},{availableFiats:Q,availableCryptos:D,availablePaymentMethods:ae})},[Z,v,y,i.cryptoCurrency,i.network,i.fiatCurrency,Q,D,ae]);c.useEffect(()=>{var w,E,L;if(Z||Q.length===0&&D.length===0)return;const x=$a({cryptoCurrency:i.cryptoCurrency,network:i.network,fiatCurrency:i.fiatCurrency,paymentMethodId:i.paymentMethodId},{availableFiats:Q,availableCryptos:D,availablePaymentMethods:ae},{cryptoLocked:!!((w=y==null?void 0:y.destinationCurrency)!=null&&w.locked),networkLocked:!!((E=y==null?void 0:y.network)!=null&&E.locked),fiatLocked:!!((L=y==null?void 0:y.sourceCurrency)!=null&&L.locked)});x&&(x.cryptoCurrency!==void 0&&T({type:"SET_CRYPTO_CURRENCY",currency:x.cryptoCurrency}),x.network!==void 0&&T({type:"SET_NETWORK",network:x.network}),x.fiatCurrency!==void 0&&T({type:"SET_FIAT_CURRENCY",currency:x.fiatCurrency}),x.paymentMethodId!==void 0&&T({type:"SET_PAYMENT_METHOD",methodId:x.paymentMethodId}))},[Z,Q,D,ae,i.cryptoCurrency,i.network,i.fiatCurrency,i.paymentMethodId,y,T]);const G=c.useMemo(()=>{if(j){if(!i.cryptoAmount)return null;const F=parseFloat(i.cryptoAmount);return isNaN(F)||F<=0?"Enter a valid amount":null}if(!v||!i.fiatAmount)return null;const x=parseFloat(i.fiatAmount);if(isNaN(x))return null;const w=v.fiats.find(F=>F.code===i.fiatCurrency);if(!w)return null;const E=parseFloat(w.minAmount),L=parseFloat(w.maxAmount);return!isNaN(E)&&x<E?`Minimum amount is ${w.minAmount} ${i.fiatCurrency}`:!isNaN(L)&&x>L?`Maximum amount is ${w.maxAmount} ${i.fiatCurrency}`:null},[v,i.fiatAmount,i.fiatCurrency,i.cryptoAmount,j]),q=c.useMemo(()=>{const x=j?!!i.cryptoAmount:!!i.fiatAmount;return!v||!x||!i.fiatCurrency||!i.cryptoCurrency||!i.network||G||v.detectedCountry&&i.countrySource===""&&!g?null:{fiatCurrency:i.fiatCurrency,...j?{cryptoAmount:i.cryptoAmount}:{fiatAmount:i.fiatAmount},cryptoCurrency:i.cryptoCurrency,network:i.network,paymentMethodId:i.paymentMethodId||void 0,country:i.country||void 0,orderType:i.flowType}},[v,i.fiatCurrency,i.fiatAmount,i.cryptoAmount,i.cryptoCurrency,i.network,i.paymentMethodId,i.country,i.countrySource,G,j,i.flowType,g]),{quotes:$,loading:Se,error:ve,refetch:tt}=Yt(P,q),ne=c.useRef(!1);c.useEffect(()=>{ne.current||i.countrySource==="auto"&&(Se||!q||ve||!$||$.bestQuote||i.fiatCurrency!=="USD"&&(ne.current=!0,T({type:"SET_FIAT_CURRENCY",currency:"USD"}),T({type:"SET_FIAT_AMOUNT",amount:"250"})))},[$,Se,ve,q,i.countrySource,i.fiatCurrency]);const{order:M,loading:Le,error:be,createOrder:Ue}=$t(P),Be=15e3,{status:ee,loading:Oe}=Wt({apiUrl:a},(M==null?void 0:M.orderId)??null,{pollInterval:N,initialDelay:Be});c.useEffect(()=>{(ee==null?void 0:ee.status)==="completed"&&R&&R(ee)},[ee==null?void 0:ee.status,R]),c.useEffect(()=>{const x=me||be;x&&H&&H(x)},[me,be,H]);const he=p||(v==null?void 0:v.defaultGateway)||null,Fe=c.useRef(he);Fe.current=he;const He=c.useRef($);He.current=$;const re=c.useRef(d);re.current=d;const De=c.useCallback(async()=>{var w,E,L;const x=((w=i.selectedQuote)==null?void 0:w.gatewayId)||((L=(E=He.current)==null?void 0:E.bestQuote)==null?void 0:L.gatewayId)||Fe.current;if(!x||!i.walletAddress){const F=[!x&&"gateway",!i.walletAddress&&"walletAddress"].filter(Boolean).join(", ");T({type:"SET_ERROR",message:`Missing required fields: ${F}`});return}try{await Ue({gateway:x,customerId:i.customerId||void 0,fiatCurrency:i.fiatCurrency,...j?{cryptoAmount:i.cryptoAmount}:{fiatAmount:i.fiatAmount},cryptoCurrency:i.cryptoCurrency,network:i.network,walletAddress:i.walletAddress,paymentMethodId:i.paymentMethodId||void 0,email:i.email||void 0,orderType:i.flowType,...re.current?{metadata:{brand:re.current}}:{}}),T({type:"SET_STEP",step:"checkout"})}catch(F){const A=F instanceof Error?F.message:"Failed to create order";/wallet|address/i.test(A)?T({type:"SET_WALLET_ERROR",message:A.replace(/^Failed to create checkout intent:\s*/i,"")}):T({type:"SET_ERROR",message:A})}},[i,Ue,j]),at=c.useCallback(x=>{T({type:"SET_STEP",step:x})},[]),nt=c.useCallback(()=>{const x=["confirm","amount","quotes","wallet","checkout","processing","complete"],w=x.indexOf(i.step);w>0&&T({type:"SET_STEP",step:x[w-1]})},[i.step,j]),Pe=c.useMemo(()=>{const x=j?!!i.cryptoAmount:!!i.fiatAmount;switch(i.step){case"confirm":return!!(x&&i.cryptoCurrency&&i.network&&i.walletAddress&&!G);case"amount":return!!(x&&i.cryptoCurrency&&i.network&&!G);case"quotes":return!!i.selectedQuote;case"wallet":return!!i.walletAddress;default:return!1}},[i,G,j]),oe={apiConfig:P,assetBaseUrl:n,config:v,configLoading:Z,configError:me,state:i,dispatch:T,quotes:$,quotesLoading:Se,quotesError:ve,fetchQuotes:tt,order:M,orderLoading:Le,orderError:be,createOrder:De,orderStatus:ee,orderStatusLoading:Oe,fieldLocks:y||null,defaultGateway:he,availableFiats:Q,availableCryptos:D,availablePaymentMethods:ae,selectionUnsupported:Te,amountError:G,goToStep:at,goBack:nt,canProceed:Pe};return e.jsx(Zt.Provider,{value:oe,children:J})}function Ce(){const t=c.useContext(Zt);if(!t)throw new Error("useRamp must be used within a RampProvider");return t}const Ee={ethereum:{name:"Ethereum (ERC20)",shortName:"Ethereum",icon:"eth"},bitcoin:{name:"Bitcoin",icon:"btc"},solana:{name:"Solana",icon:"sol"},polygon:{name:"Polygon",icon:"pol"},arbitrum:{name:"Arbitrum",icon:"arb"},avalanche:{name:"Avalanche C-Chain",shortName:"Avalanche",icon:"avax"},litecoin:{name:"Litecoin",icon:"ltc"},tezos:{name:"Tezos",icon:"xtz"},sei:{name:"SEI",icon:"sei"},imx:{name:"Immutable X",shortName:"Immutable",icon:"imx"},galachain:{name:"Gala",icon:"gala"},zksync2:{name:"zkSync Era",shortName:"zkSync",icon:"zksync"},zks:{name:"zkSpace",icon:"zks"},"flow-evm":{name:"Flow (EVM)",shortName:"Flow",icon:"flow"},vara:{name:"Vara",icon:"vara"},venom:{name:"Venom",icon:"venom"},hsk:{name:"HashKey Chain",shortName:"HashKey",icon:"hsk"},mck:{name:"MCK",icon:"mck"},peer:{name:"Peer",icon:"peer"},goerli:{name:"Goerli Testnet",shortName:"Goerli",icon:"eth"},hbartestnet:{name:"Hedera Testnet",shortName:"Hedera",icon:"hbar"},arbitrumrinkeby:{name:"Arbitrum Testnet",shortName:"Arbitrum",icon:"arb"},dydxtestnet:{name:"dYdX Testnet",shortName:"dYdX",icon:"stark"},"zksync-rinkeby":{name:"zkSync Testnet",shortName:"zkSync",icon:"zksync"},ETH:{name:"Ethereum (ERC20)",shortName:"Ethereum",icon:"eth"},BSC:{name:"Binance Smart Chain (BEP20)",shortName:"Binance",icon:"bnb"},BTC:{name:"Bitcoin",icon:"btc"},SOL:{name:"Solana",icon:"sol"},MATIC:{name:"Polygon",icon:"pol"},ARB:{name:"Arbitrum",icon:"arb"},BASE:{name:"Base",icon:"base"},OPTIMISM:{name:"Optimism",icon:"op"},AVAX_C:{name:"Avalanche C-Chain",shortName:"Avalanche C",icon:"avax"},AVAX_X:{name:"Avalanche X-Chain",shortName:"Avalanche X",icon:"avax"},ADA:{name:"Cardano",icon:"ada"},DOT:{name:"Polkadot",icon:"dot"},TRON:{name:"Tron (TRC20)",shortName:"Tron",icon:"trx"},XRP:{name:"Ripple",icon:"xrp"},XLM:{name:"Stellar",icon:"xlm"},ALGO:{name:"Algorand",icon:"algo"},ATOM:{name:"Cosmos",icon:"atom"},NEAR:{name:"NEAR Protocol",shortName:"NEAR",icon:"near"},SUI:{name:"Sui",icon:"sui"},APT:{name:"Aptos",icon:"apt"},TON:{name:"Ton",icon:"ton"},FIL:{name:"Filecoin",icon:"fil"},FLOW:{name:"Flow",icon:"flow"},HBAR:{name:"Hedera Hashgraph",shortName:"Hedera",icon:"hbar"},INJ:{name:"Injective",icon:"inj"},SEI_EVM:{name:"SEI (EVM)",shortName:"SEI",icon:"sei"},ZKSYNC:{name:"zkSync",icon:"zksync"},LINEA:{name:"Linea",icon:"linea"},STARK:{name:"StarkNet",icon:"strk"},LN:{name:"Lightning",icon:"btc"},CELO:{name:"Celo",icon:"celo"},CRO:{name:"Cronos",icon:"cro"},FTM:{name:"Fantom",icon:"ftm"},GLMR:{name:"Moonbeam",icon:"glmr"},MOVR:{name:"Moonriver",icon:"movr"},KSM:{name:"Kusama",icon:"ksm"},EOS:{name:"EOS",icon:"eos"},ETC:{name:"Ethereum Classic",shortName:"ETH Classic",icon:"etc"},LTC:{name:"Litecoin",icon:"ltc"},BCH:{name:"Bitcoin Cash",shortName:"BTC Cash",icon:"bch"},DOGE:{name:"Dogecoin",icon:"doge"},BNB:{name:"Binance Chain (BEP2)",shortName:"Binance",icon:"bnb"},ONE:{name:"Harmony",icon:"one"},KLAY:{name:"Kaia",icon:"kaia"},RON:{name:"Ronin",icon:"ron"},LRC:{name:"Loopring",icon:"lrc"},ICP:{name:"Internet Computer",shortName:"ICP",icon:"icp"},EGLD:{name:"MultiversX",icon:"egld"},FLUX:{name:"Flux",icon:"flux"},KDA:{name:"Kadena",icon:"kda"},WAVES:{name:"Waves",icon:"waves"},XTZ:{name:"Tezos",icon:"xtz"},ACA:{name:"Acala",icon:"aca"},ALEO:{name:"Aleo",icon:"aleo"},ALPH:{name:"Alephium",icon:"alph"},APE:{name:"ApeChain",icon:"ape"},ASTR:{name:"Astar",icon:"astr"},AZERO:{name:"Aleph Zero",icon:"azero"},AZERO_EVM:{name:"Aleph Zero EVM",shortName:"Aleph Zero",icon:"azero"},BAJU:{name:"Bajun Network",shortName:"Bajun",icon:"baju"},BNCPOLKA:{name:"Bifrost Polkadot",shortName:"Bifrost",icon:"bnc"},BNC:{name:"Bifrost Kusama",shortName:"Bifrost",icon:"bnc"},BOBA:{name:"Boba Network",shortName:"Boba",icon:"boba"},BSX:{name:"Basilisk",icon:"bsx"},CHZ:{name:"Chiliz",icon:"chz"},VIC:{name:"Viction",icon:"vic"},CCD:{name:"Concordium",icon:"ccd"},COREUM:{name:"Coreum",icon:"coreum"},DINGO:{name:"Dingocoin",icon:"dingo"},HDX:{name:"Hydration",icon:"hdx"},PLMC:{name:"Polimec",icon:"plmc"},MNT:{name:"Mantle",icon:"mnt"},ERG:{name:"Ergo",icon:"erg"},ECLIPSE:{name:"Eclipse",icon:"eclipse"},FUEL:{name:"Fuel Ignition",shortName:"Fuel",icon:"fuel"},INK:{name:"Ink",icon:"ink"},SOPHON:{name:"Sophon",icon:"sophon"},UNICHAIN:{name:"Unichain",icon:"unichain"},WLD:{name:"Worldchain",icon:"wld"},ETHERLINK:{name:"Etherlink",icon:"etherlink"},MOB:{name:"MobileCoin",icon:"mob"},GALA:{name:"Gala",icon:"gala"},GUNZ:{name:"Gunz",icon:"gun"},HNT:{name:"Helium",icon:"hnt"},BITKUB:{name:"BitKub",icon:"kub"},IMMUTABLE_ZKEVM:{name:"Immutable-zkEVM",shortName:"Immutable",icon:"imx"},INIT:{name:"Initia",icon:"init"},INTR:{name:"Interlay",icon:"intr"},KINESIS:{name:"Kinesis",icon:"kag"},KAR:{name:"Karura",icon:"kar"},KCC:{name:"KuCoin Community Chain",shortName:"KuCoin",icon:"kcs"},KILT:{name:"KILT Spiritnet",shortName:"KILT",icon:"kilt"},KINT:{name:"Kintsugi",icon:"kint"},KMD:{name:"Komodo",icon:"kmd"},LSK:{name:"Lisk",icon:"lsk"},METIS:{name:"Metis Andromeda",shortName:"Metis",icon:"metis"},MYTH:{name:"Myth",icon:"myth"},OAS:{name:"Oasys",icon:"oas"},PEAQ_EVM:{name:"Peaq (EVM)",shortName:"Peaq",icon:"peaq"},PEN:{name:"Pendulum",icon:"pen"},PI:{name:"Pi",icon:"pi"},POLYX:{name:"Polymesh",icon:"polyx"},Q:{name:"QuantumCoin",icon:"q"},QRL:{name:"Quantum Resistant Ledger",shortName:"QRL",icon:"qrl"},QUBIC:{name:"Qubic",icon:"qubic"},RBX:{name:"ReserveBlock",icon:"rbx"},ROLLUX:{name:"Rollux",icon:"rollux"},THORCHAIN:{name:"Thorchain",icon:"rune"},S:{name:"Sonic",icon:"s"},SONIC:{name:"Sonic",icon:"s"},TERNOA:{name:"Ternoa",icon:"caps"},SX:{name:"SX Network",icon:"sol"},WAX:{name:"WAX",icon:"waxp"},XCH:{name:"Chia Chain",icon:"xch"},XPRT:{name:"Persistence",icon:"xprt"},ZETACHAIN:{name:"ZetaChain",icon:"zeta"},ZTG:{name:"Zeitgeist",icon:"ztg"},PLS:{name:"Pulsechain",icon:"pulsechain"},MEZO:{name:"Mezo",icon:"mezo"},BSV:{name:"Bitcoin SV",shortName:"BTC SV",icon:"btc"},MONAD:{name:"Monad",icon:"mon"},SUPRA:{name:"Supra",icon:"supra"},SOMI:{name:"Somnia",icon:"somi"},VERIFIEDX:{name:"VerifiedX",icon:"vfx"},MOVE:{name:"Movement",icon:"move"},FLR:{name:"Flare",icon:"flr"},ASSETHUB:{name:"Asset Hub Polkadot",shortName:"Asset Hub",icon:"dot"},BOB:{name:"BOB",icon:"btc"},GLUE:{name:"Glue",icon:"eth"},DYDX:{name:"StarkEx",icon:"stark"},OKC:{name:"OKX Chain",icon:"eth"},UNI_CHAIN:{name:"UNI",icon:"uni"},ZEC:{name:"ZCash",icon:"zec"}},pt=[{code:"BTC",name:"Bitcoin",chains:["BTC","LN"],popular:!0},{code:"ETH",name:"Ethereum",chains:["ETH","ARB","BASE","BSC","OPTIMISM","LINEA","ZKSYNC","LRC","STARK","APE","ECLIPSE","FUEL","INK","SOPHON","UNICHAIN","WLD"],popular:!0},{code:"USDC",name:"USD Coin",chains:["ETH","SOL","ARB","BASE","BSC","MATIC","OPTIMISM","AVAX_C","ALGO","APT","CELO","FLOW","HBAR","LINEA","LRC","ZKSYNC","STARK","SUI","XLM","ECLIPSE","HDX","INK","LSK","METIS","MONAD","SEI_EVM","SONIC","SOPHON","SX","UNICHAIN","APE","BNCPOLKA","GLMR","PEAQ_EVM","PLMC","RON","UNI_CHAIN","WLD","BITKUB","BOB","DYDX","ETHERLINK","GLUE","ASSETHUB"],popular:!0},{code:"USDT",name:"Tether",chains:["ETH","BSC","TRON","ARB","MATIC","AVAX_C","SOL","OPTIMISM","ZKSYNC","STARK","APT","CELO","KLAY","LRC","LSK","ECLIPSE","ETHERLINK","OKC","PEAQ_EVM","BNCPOLKA","GLMR","HDX","PLMC","VIC","ASSETHUB"],popular:!0},{code:"SOL",name:"Solana",chains:["SOL"],popular:!0},{code:"XRP",name:"Ripple",chains:["XRP"],popular:!0},{code:"ADA",name:"Cardano",chains:["ADA"],popular:!0},{code:"DOGE",name:"Dogecoin",chains:["DOGE"],popular:!0},{code:"DOT",name:"Polkadot",chains:["DOT","BSC","BNCPOLKA","GLMR","HDX","PLMC"],popular:!0},{code:"AVAX",name:"Avalanche",chains:["AVAX_C","AVAX_X","BSC"],popular:!0},{code:"LINK",name:"ChainLink",chains:["ETH","BSC"],popular:!0},{code:"LTC",name:"Litecoin",chains:["LTC"],popular:!0},{code:"AAVE",name:"Aave",chains:["ETH","BSC"],popular:!1},{code:"ACA",name:"Acala",chains:["ACA"],popular:!1},{code:"ALEO",name:"Aleo",chains:["ALEO"],popular:!1},{code:"ALGO",name:"Algorand",chains:["ALGO"],popular:!1},{code:"ALPH",name:"Alephium",chains:["ALPH"],popular:!1},{code:"APE",name:"ApeCoin",chains:["APE","ETH"],popular:!1},{code:"APT",name:"Aptos",chains:["APT"],popular:!1},{code:"ARB",name:"Arbitrum",chains:["ARB"],popular:!1},{code:"ASTR",name:"Astar",chains:["ASTR"],popular:!1},{code:"ATOM",name:"Cosmos",chains:["ATOM"],popular:!1},{code:"AUDD",name:"Novatti Australian Digital Dollar",chains:["ETH"],popular:!1},{code:"AVT",name:"Aventus",chains:["ETH"],popular:!1},{code:"AXS",name:"Axie Infinity",chains:["ETH","RON"],popular:!1},{code:"AZERO",name:"Aleph Zero",chains:["AZERO","AZERO_EVM"],popular:!1},{code:"BAJU",name:"Bajun Network",chains:["BAJU"],popular:!1},{code:"BARSIK",name:"Hasbulla's Cat",chains:["SOL"],popular:!1},{code:"BAT",name:"Basic Attention Token",chains:["ETH","BSC"],popular:!1},{code:"BCH",name:"Bitcoin Cash",chains:["BCH"],popular:!1},{code:"BNB",name:"Binance Coin",chains:["BNB","BSC"],popular:!1},{code:"BNC",name:"Bifrost Native Coin",chains:["BNC","BNCPOLKA"],popular:!1},{code:"BOBA",name:"Boba Network",chains:["BOBA","ETH"],popular:!1},{code:"BORA",name:"Bora",chains:["KLAY"],popular:!1},{code:"BRETT",name:"Brett",chains:["BASE"],popular:!1},{code:"BSX",name:"Basilisk",chains:["BSX"],popular:!1},{code:"BZR",name:"Bazaars",chains:["ETH"],popular:!1},{code:"CAGA",name:"Crypto Asset Governance Alliance",chains:["ETH"],popular:!1},{code:"CAKE",name:"PancakeSwap",chains:["BSC"],popular:!1},{code:"CAPS",name:"Caps",chains:["TERNOA"],popular:!1},{code:"CELO",name:"Celo",chains:["CELO"],popular:!1},{code:"CHZ",name:"Chiliz",chains:["CHZ","BNB","ETH"],popular:!1},{code:"C98",name:"Coin98",chains:["VIC"],popular:!1},{code:"CCD",name:"Concordium",chains:["CCD"],popular:!1},{code:"COMP",name:"Compound",chains:["ETH","BSC"],popular:!1},{code:"COREUM",name:"Coreum",chains:["COREUM","XRP"],popular:!1},{code:"CRO",name:"Cronos",chains:["CRO"],popular:!1},{code:"CUSD",name:"Celo Dollar",chains:["CELO"],popular:!1},{code:"CVC",name:"Civic",chains:["ETH"],popular:!1},{code:"DAI",name:"Dai",chains:["ETH","BASE","MATIC"],popular:!1},{code:"DINGO",name:"Dingocoin",chains:["DINGO"],popular:!1},{code:"EGLD",name:"MultiversX",chains:["EGLD"],popular:!1},{code:"EMBER",name:"Ember Sword",chains:["MNT"],popular:!1},{code:"EOS",name:"EOS",chains:["EOS"],popular:!1},{code:"ERG",name:"Ergo",chains:["ERG"],popular:!1},{code:"ETC",name:"Ethereum Classic",chains:["ETC","BSC"],popular:!1},{code:"EUR",name:"EURC",chains:["BASE"],popular:!1},{code:"EUROC",name:"Euro Coin",chains:["ETH"],popular:!1},{code:"EURQ",name:"Quantoz EURQ",chains:["ETH"],popular:!1},{code:"EURR",name:"StablR EUR",chains:["ETH"],popular:!1},{code:"EUSD",name:"Electronic USD",chains:["MOB"],popular:!1},{code:"EXIT",name:"EXIT - Designer Token",chains:["BSC"],popular:!1},{code:"FDUSD",name:"First Digital USD",chains:["SUI"],popular:!1},{code:"FIL",name:"Filecoin",chains:["FIL","BSC"],popular:!1},{code:"FLOW",name:"Flow",chains:["FLOW"],popular:!1},{code:"FLR",name:"Flare",chains:["FLR"],popular:!1},{code:"FLUX",name:"Flux",chains:["FLUX"],popular:!1},{code:"FTM",name:"Fantom",chains:["FTM","ETH","BSC"],popular:!1},{code:"GALA",name:"Gala",chains:["GALA"],popular:!1},{code:"GLMR",name:"Moonbeam",chains:["GLMR"],popular:!1},{code:"GMX",name:"GMX",chains:["ARB"],popular:!1},{code:"GNUS",name:"Genius AI",chains:["ETH"],popular:!1},{code:"GRT",name:"The Graph",chains:["ETH","ARB"],popular:!1},{code:"GUN",name:"Gunz",chains:["GUNZ"],popular:!1},{code:"HBAR",name:"Hedera",chains:["HBAR"],popular:!1},{code:"HDX",name:"HydraDX",chains:["HDX"],popular:!1},{code:"HNT",name:"Helium",chains:["HNT"],popular:!1},{code:"HTP",name:"HowToPay",chains:["BSC"],popular:!1},{code:"HVLO",name:"Hivello",chains:["SOL"],popular:!1},{code:"ICP",name:"Internet Computer",chains:["ICP"],popular:!1},{code:"IMX",name:"Immutable X",chains:["ETH"],popular:!1},{code:"INIT",name:"Initia",chains:["INIT"],popular:!1},{code:"INJ",name:"Injective",chains:["INJ"],popular:!1},{code:"INTR",name:"Interlay",chains:["INTR"],popular:!1},{code:"JAM",name:"Jam Tune.FM",chains:["HBAR"],popular:!1},{code:"KAG",name:"Silver",chains:["KINESIS"],popular:!1},{code:"KAIA",name:"Kaia",chains:["KLAY"],popular:!1},{code:"KAR",name:"Karura",chains:["KAR"],popular:!1},{code:"KAU",name:"Gold",chains:["KINESIS"],popular:!1},{code:"KCS",name:"KuCoin Token",chains:["ETH","KCC"],popular:!1},{code:"KDA",name:"Kadena",chains:["KDA"],popular:!1},{code:"KILT",name:"KILT",chains:["KILT"],popular:!1},{code:"KINT",name:"Kintsugi",chains:["KINT"],popular:!1},{code:"KLV",name:"Klever",chains:["TRON"],popular:!1},{code:"KMD",name:"Komodo",chains:["KMD"],popular:!1},{code:"KSM",name:"Kusama",chains:["KSM"],popular:!1},{code:"KUB",name:"Bitkub Coin",chains:["BITKUB"],popular:!1},{code:"LOOKS",name:"LooksRare",chains:["ETH"],popular:!1},{code:"LRC",name:"Loopring",chains:["ETH","LRC"],popular:!1},{code:"LSK",name:"Lisk",chains:["LSK"],popular:!1},{code:"MANA",name:"Decentraland",chains:["ETH"],popular:!1},{code:"MBX",name:"Marblex",chains:["IMMUTABLE_ZKEVM","KLAY"],popular:!1},{code:"MELANIA",name:"Melania",chains:["SOL"],popular:!1},{code:"METAMASKUSD",name:"Metamask USD",chains:["ETH","LINEA"],popular:!1},{code:"METIS",name:"Metis",chains:["METIS"],popular:!1},{code:"MEZOUSD",name:"MUSD",chains:["ETH","MEZO"],popular:!1},{code:"MKR",name:"Maker",chains:["ETH","BSC"],popular:!1},{code:"MNEE",name:"MNEE",chains:["BSV","ETH"],popular:!1},{code:"MNT",name:"Mantle",chains:["ETH","MNT"],popular:!1},{code:"MOB",name:"MobileCoin",chains:["MOB"],popular:!1},{code:"MON",name:"Monad",chains:["MONAD"],popular:!1},{code:"MOVE",name:"Movement",chains:["MOVE"],popular:!1},{code:"MOVR",name:"Moonriver",chains:["MOVR"],popular:!1},{code:"MYTH",name:"Myth",chains:["MYTH"],popular:!1},{code:"NEAR",name:"NEAR Protocol",chains:["NEAR","BSC"],popular:!1},{code:"NEIRO",name:"NEIRO Ethereum",chains:["ETH"],popular:!1},{code:"OAS",name:"Oasys",chains:["OAS"],popular:!1},{code:"OMG",name:"OmiseGo",chains:["ETH"],popular:!1},{code:"OMUSD",name:"Open Money USD",chains:["ETH"],popular:!1},{code:"ONE",name:"Harmony",chains:["ONE","BNB","ETH"],popular:!1},{code:"OP",name:"Optimism",chains:["OPTIMISM"],popular:!1},{code:"ORDER",name:"Orderly Network",chains:["ETH"],popular:!1},{code:"PEAQ",name:"Peaq",chains:["PEAQ_EVM"],popular:!1},{code:"PEN",name:"Pendulum",chains:["PEN"],popular:!1},{code:"PERC",name:"Perion",chains:["ETH"],popular:!1},{code:"PI",name:"Pi",chains:["PI"],popular:!1},{code:"PLMC",name:"Polimec",chains:["PLMC"],popular:!1},{code:"POL",name:"Polygon",chains:["ETH","MATIC"],popular:!1},{code:"POLYX",name:"Polymesh",chains:["POLYX"],popular:!1},{code:"PROPC",name:"Propchain",chains:["ETH"],popular:!1},{code:"PSTAKE",name:"pSTAKE Finance",chains:["ETH"],popular:!1},{code:"Q",name:"QuantumCoin",chains:["Q"],popular:!1},{code:"QRDO",name:"Qredo",chains:["ETH"],popular:!1},{code:"QRL",name:"Quantum Resistant Ledger",chains:["QRL"],popular:!1},{code:"QUBIC",name:"QUBIC",chains:["QUBIC"],popular:!1},{code:"RBX",name:"ReserveBlock",chains:["RBX"],popular:!1},{code:"REVU",name:"Revuto",chains:["ADA"],popular:!1},{code:"RITE",name:"Ritestream",chains:["BSC"],popular:!1},{code:"RLUSD",name:"Ripple USD",chains:["ETH"],popular:!1},{code:"RON",name:"Ronin",chains:["RON"],popular:!1},{code:"RUNE",name:"THORChain",chains:["THORCHAIN"],popular:!1},{code:"S",name:"Sonic",chains:["S"],popular:!1},{code:"SAND",name:"The Sandbox",chains:["ETH","BSC"],popular:!1},{code:"SEI",name:"SEI",chains:["SEI_EVM"],popular:!1},{code:"SNX",name:"Synthetix",chains:["ETH"],popular:!1},{code:"SOIL",name:"Sun Minimeal",chains:["PLS"],popular:!1},{code:"SOLO",name:"Sologenic",chains:["XRP"],popular:!1},{code:"SOMI",name:"Somnia",chains:["SOMI"],popular:!1},{code:"STRK",name:"Starknet",chains:["STARK"],popular:!1},{code:"SUI",name:"Sui",chains:["SUI"],popular:!1},{code:"SUPR",name:"SuperDapp",chains:["ROLLUX"],popular:!1},{code:"SUPRA",name:"Supra",chains:["SUPRA"],popular:!1},{code:"SUSHI",name:"SushiSwap",chains:["ETH","BSC"],popular:!1},{code:"SYS",name:"Syscoin",chains:["ROLLUX"],popular:!1},{code:"TBTC",name:"tBTC",chains:["SUI","STARK"],popular:!1},{code:"TON",name:"Toncoin",chains:["TON"],popular:!1},{code:"TRUMP",name:"TRUMP",chains:["SOL"],popular:!1},{code:"TRX",name:"Tron",chains:["TRON","BSC"],popular:!1},{code:"TWT",name:"Trust Wallet Token",chains:["BSC"],popular:!1},{code:"UNI",name:"Uniswap",chains:["ETH","BSC"],popular:!1},{code:"URANIUM",name:"Uranium",chains:["ETHERLINK"],popular:!1},{code:"USD0",name:"Usual USD",chains:["ETH"],popular:!1},{code:"USD1",name:"World Liberty Financial USD",chains:["SOL"],popular:!1},{code:"USDE",name:"Ethena USDe",chains:["ETH"],popular:!1},{code:"USDP",name:"Pax Dollar",chains:["ETH"],popular:!1},{code:"USDQ",name:"Quantoz USDQ",chains:["ETH"],popular:!1},{code:"USDR",name:"StablR USD",chains:["ETH"],popular:!1},{code:"USDT0",name:"USDT0",chains:["INK"],popular:!1},{code:"VFX",name:"VerifiedX",chains:["VERIFIEDX"],popular:!1},{code:"VERSE",name:"Verse",chains:["ETH","MATIC"],popular:!1},{code:"VIC",name:"Viction",chains:["VIC"],popular:!1},{code:"WAL",name:"Walrus",chains:["SUI"],popular:!1},{code:"WAVES",name:"Waves",chains:["WAVES"],popular:!1},{code:"WAXP",name:"WAX",chains:["WAX"],popular:!1},{code:"WBTC",name:"Wrapped Bitcoin",chains:["ETH","STARK"],popular:!1},{code:"WETH",name:"Wrapped Ether",chains:["ETHERLINK"],popular:!1},{code:"WLD",name:"Worldcoin",chains:["WLD"],popular:!1},{code:"WLFI",name:"World Liberty Financial",chains:["ETH"],popular:!1},{code:"WOLF",name:"LandWolf",chains:["ETH"],popular:!1},{code:"WOMBAT",name:"Wombat",chains:["MATIC"],popular:!1},{code:"XCH",name:"Chia",chains:["XCH"],popular:!1},{code:"XLM",name:"Stellar Lumens",chains:["XLM","BSC"],popular:!1},{code:"XPRT",name:"Persistence",chains:["XPRT"],popular:!1},{code:"XTZ",name:"Tezos",chains:["XTZ","ETHERLINK"],popular:!1},{code:"YFI",name:"yearn.finance",chains:["ETH"],popular:!1},{code:"ZBU",name:"Zeebu",chains:["BSC"],popular:!1},{code:"ZEC",name:"ZCash",chains:["ZEC"],popular:!1},{code:"ZCHF",name:"Frankencoin",chains:["ETH"],popular:!1},{code:"ZETA",name:"Zeta",chains:["ETH","ZETACHAIN"],popular:!1},{code:"ZTG",name:"Zeitgeist",chains:["ZTG"],popular:!1}],Za=Object.fromEntries(pt.map(t=>[t.code,t.name])),zt={AED:"ae",ALL:"al",ARS:"ar",AUD:"au",BRL:"br",CAD:"ca",CHF:"ch",CLP:"cl",CZK:"cz",DKK:"dk",EUR:"eu",GBP:"gb",HKD:"hk",IDR:"id",INR:"in",JPY:"jp",KRW:"kr",MXN:"mx",NGN:"ng",NOK:"no",NZD:"nz",PHP:"ph",PLN:"pl",QAR:"qa",SAR:"sa",SEK:"se",SGD:"sg",THB:"th",TRY:"tr",TWD:"tw",USD:"us",VND:"vn",ZAR:"za"};function xt(t,a=""){return`${a}/crypto-icons/${t.toLowerCase()}.svg`}function Jt(t,a=""){const n=zt[t]||"us";return`${a}/flags/${n}.svg`}function We(t){return Ee[t]||Ee[t.toLowerCase()]||Ee[t.toUpperCase()]||Ee[t.toUpperCase().replace(/-/g,"_")]||Ee[t.toLowerCase().replace(/-/g,"_")]}function Xe(t,a=""){const n=We(t);return n?`${a}/crypto-icons/${n.icon}.svg`:`${a}/crypto-icons/${t.toLowerCase()}.svg`}const ct=[{code:"ALL",name:"Albania Lek"},{code:"ARS",name:"Argentina Peso"},{code:"AUD",name:"Australian Dollar"},{code:"BRL",name:"Brazilian Real"},{code:"CAD",name:"Canadian Dollar"},{code:"EUR",name:"Euro"},{code:"GBP",name:"British Pound"},{code:"JPY",name:"Japanese Yen"},{code:"USD",name:"US Dollar"},{code:"CHF",name:"Swiss Franc"},{code:"MXN",name:"Mexican Peso"},{code:"INR",name:"Indian Rupee"}],dt=[{id:"blue",name:"Blue",accent:"#0077FF"},{id:"violet",name:"Violet",accent:"#7C3AED"},{id:"green",name:"Green",accent:"#10B981"},{id:"orange",name:"Orange",accent:"#F59E0B"},{id:"rose",name:"Rose",accent:"#F43F5E"},{id:"mono",name:"Mono",accent:null}],ut={USDC:{USD:.9962,EUR:1.0814,GBP:1.2573,JPY:.00667,CAD:.7198,AUD:.6384,BRL:.1726,CHF:1.1306,MXN:.0487,INR:.01187,ARS:855e-6,ALL:.01058},USDT:{USD:.9958,EUR:1.081,GBP:1.2568,JPY:.00666,CAD:.7194,AUD:.638,BRL:.1724,CHF:1.1301,MXN:.0486,INR:.01186,ARS:854e-6,ALL:.01057},BTC:{USD:104e-7,EUR:1129e-8,GBP:1313e-8,JPY:696e-10,CAD:751e-8,AUD:666e-8,BRL:18e-7,CHF:118e-7,MXN:508e-9,INR:124e-9,ARS:892e-11,ALL:11e-8},ETH:{USD:316e-6,EUR:343e-6,GBP:399e-6,JPY:211e-8,CAD:228e-6,AUD:202e-6,BRL:547e-7,CHF:358e-6,MXN:154e-7,INR:376e-8,ARS:271e-9,ALL:335e-8},SOL:{USD:.00424,EUR:.004607,GBP:.005356,JPY:284e-7,CAD:.003063,AUD:.002716,BRL:734e-6,CHF:.004812,MXN:207e-6,INR:505e-7,ARS:364e-8,ALL:45e-6},XRP:{USD:.4081,EUR:.4432,GBP:.5153,JPY:.00273,CAD:.2948,AUD:.2614,BRL:.0707,CHF:.463,MXN:.01992,INR:.00486,ARS:35e-5,ALL:.00433},DOGE:{USD:3.896,EUR:4.232,GBP:4.92,JPY:.02607,CAD:2.815,AUD:2.496,BRL:.675,CHF:4.421,MXN:.1902,INR:.04641,ARS:.003345,ALL:.04134},ADA:{USD:1.333,EUR:1.448,GBP:1.683,JPY:.00892,CAD:.963,AUD:.854,BRL:.2309,CHF:1.512,MXN:.0651,INR:.01588,ARS:.001145,ALL:.01414}},Qa=new Set(["USDC","USDT","DAI","BUSD","TUSD","FDUSD","PYUSD","USDP","USDE","USDQ","USDR","USDT0","RLUSD","CUSD","EUSD","OMUSD","MEZOUSD","METAMASKUSD","USD0","USD1","AUDD","EUROC","EURQ","EURR","ZCHF"]);function yt(t){return Qa.has(t.toUpperCase())}function za(t,a){var n,r;return((n=ut[t])==null?void 0:n[a])??((r=ut.USDC)==null?void 0:r[a])??1}function qt(t){return parseFloat(t.replace(/,/g,""))||0}function Ze(t){if(t===0)return"0";if(t>=1e3)return t.toLocaleString("en-US",{maximumFractionDigits:2});if(t>=1)return t.toFixed(2);if(t>=.01)return t.toFixed(4);const a=t.toPrecision(4);return parseFloat(a).toString()}const ie=t=>/^#([0-9A-Fa-f]{3}){1,2}$/.test(t),Pt=10,Kt=1e-4,ea=(()=>{const t=[];for(const a of pt)for(const n of a.chains)t.push({code:a.code,name:a.name,chain:n,popular:a.popular});return t})();function ta({src:t,alt:a,size:n,className:r="",background:o}){const[d,u]=c.useState(!1),[s,l]=c.useState(!1),m=c.useRef(t);m.current!==t&&(m.current=t,u(!1),l(!1));const h=c.useCallback(()=>u(!0),[]),f=c.useCallback(()=>l(!0),[]);return e.jsxs("div",{className:`relative rounded-full shrink-0 ${r}`,style:{width:n,height:n,background:o},children:[!d&&!s&&e.jsx("div",{className:"absolute inset-0 rounded-full animate-pulse",style:{background:"var(--t-pill-bg, #333)"}}),s?e.jsx("div",{className:"absolute inset-0 rounded-full flex items-center justify-center font-bold",style:{background:"var(--t-pill-bg, #333)",color:"var(--t-text-muted)",fontSize:Math.max(8,n*.35)},children:a.slice(0,3)}):e.jsx("img",{src:t,alt:a,width:n,height:n,onLoad:h,onError:f,className:`rounded-full ${d?"opacity-100":"opacity-0"}`,style:{width:n,height:n,transition:"opacity 0.15s ease-in"}})]})}function mt({ticker:t,size:a=32,baseUrl:n=""}){return e.jsx(ta,{src:xt(t,n),alt:t,size:a,background:"#ffffff"})}function Qe({currencyCode:t,size:a=16,baseUrl:n=""}){return e.jsx(ta,{src:Jt(t,n),alt:t,size:a})}function et({size:t=32,color:a="#888"}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 32 32",fill:"none",children:[e.jsx("circle",{cx:"16",cy:"16",r:"16",fill:a}),e.jsx("circle",{cx:"16",cy:"16",r:"8",stroke:"white",strokeWidth:"1.5",fill:"none"})]})}function aa({size:t=24}){return e.jsx("div",{className:"rounded-full flex items-center justify-center shrink-0",style:{width:t,height:t,background:"var(--t-card-icon-bg)"},children:e.jsxs("svg",{width:t*.6,height:t*.58,viewBox:"0 0 25 24",fill:"none",children:[e.jsx("path",{d:"M23.292 7.5H1.70801L12.5 0.592773L23.292 7.5Z",stroke:"var(--t-card-icon-stroke)",strokeWidth:"1"}),e.jsx("rect",{x:"3",y:"10",width:"1.5",height:"11",fill:"var(--t-card-icon-stroke)"}),e.jsx("rect",{x:"9",y:"10",width:"1.5",height:"11",fill:"var(--t-card-icon-stroke)"}),e.jsx("rect",{x:"15",y:"10",width:"1.5",height:"11",fill:"var(--t-card-icon-stroke)"}),e.jsx("rect",{x:"21",y:"10",width:"1.5",height:"11",fill:"var(--t-card-icon-stroke)"}),e.jsx("rect",{y:"23",width:"25",height:"1",fill:"var(--t-card-icon-stroke)"})]})})}function na({size:t=32}){return e.jsx("div",{className:"rounded-full flex items-center justify-center text-white font-semibold shrink-0",style:{width:t,height:t,backgroundColor:"#333",fontSize:t*.45},children:"R"})}function ra({size:t=32}){return e.jsx("div",{className:"flex items-center justify-center shrink-0",style:{width:t,height:t,background:"#000",borderRadius:t*.2},children:e.jsx("svg",{width:t*.72,height:t*.288,viewBox:"0 0 50 20",fill:"none",children:e.jsx("path",{d:"M9.14529 2.57901C8.55528 3.25398 7.61984 3.7887 6.68351 3.70976C6.56186 2.7971 7.02999 1.82591 7.55883 1.23105C8.14846 0.535892 9.166 0.0403839 9.9999 0C10.1017 0.952461 9.71518 1.88488 9.14529 2.57901ZM9.98932 3.88805C10.5171 3.92756 12.0384 4.08587 13.0125 5.48951C12.9312 5.54899 11.2066 6.51813 11.2267 8.55562C11.247 10.9883 13.4176 11.7995 13.4379 11.8193C13.4176 11.8787 13.0939 12.9667 12.3023 14.0939C11.6126 15.083 10.902 16.052 9.76606 16.0717C8.67023 16.0915 8.30483 15.4389 7.04742 15.4389C5.78949 15.4389 5.38394 16.052 4.34875 16.0915C3.25329 16.1307 2.42185 15.0429 1.73195 14.054C0.310872 12.0564 -0.764097 8.41705 0.696758 5.96431C1.40722 4.73809 2.70553 3.96677 4.10507 3.94695C5.18064 3.92756 6.17501 4.63962 6.82446 4.63962C7.47376 4.63962 8.62918 3.80889 9.98932 3.88805ZM23.544 1.13133C26.4989 1.13133 28.5569 3.11593 28.5569 6.00514C28.5569 8.90473 26.4567 10.8997 23.4702 10.8997H20.1987V15.9694H17.8349V1.13133H23.544ZM20.1987 8.96648H22.9108C24.9692 8.96648 26.1402 7.88694 26.1402 6.01552C26.1402 4.14448 24.9688 3.07467 22.9212 3.07467H20.1987V8.96648ZM29.1434 12.8945C29.1434 10.9923 30.6314 9.90226 33.375 9.7378L36.3194 9.56295V8.74027C36.3194 7.53753 35.5071 6.87939 34.0613 6.87939C32.8683 6.87939 32.0028 7.47564 31.8242 8.39042H29.6919C29.7556 6.46802 31.6126 5.06972 34.1246 5.06972C36.8262 5.06972 38.5886 6.44746 38.5886 8.58634V15.969H36.4042V14.1901H36.3515C35.7287 15.3518 34.3565 16.0817 32.8683 16.0817C30.6734 16.0817 29.1434 14.8072 29.1434 12.8945ZM36.3195 11.9385V11.1054L33.6918 11.27C32.2138 11.3624 31.4442 11.897 31.4442 12.8325C31.4442 13.7375 32.2459 14.3238 33.5018 14.3238C35.1055 14.3238 36.3195 13.3262 36.3195 11.9385ZM40.597 19.9377V18.1592C40.7449 18.1794 41.1032 18.1999 41.2935 18.1999C42.3381 18.1999 42.9291 17.7688 43.288 16.6575L43.4992 15.9997L39.4992 5.20338H41.9686L44.7548 13.9638H44.8077L47.5936 5.20338H50L45.8524 16.5445C44.9024 19.1463 43.8155 20 41.515 20C41.3354 20 40.7549 19.9793 40.597 19.9377Z",fill:"white"})})})}function oa({size:t=32}){return e.jsx("div",{className:"flex items-center justify-center shrink-0",style:{width:t,height:t,background:"#3C4043",borderRadius:t*.2},children:e.jsxs("svg",{width:t*.72,height:t*.296,viewBox:"0 0 51 21",fill:"none",children:[e.jsx("path",{d:"M50.9156 5.87122L44.6406 20.2837H42.6992L45.0289 15.2416L40.9009 5.87122H42.9451L45.929 13.0573H45.9689L48.8714 5.87122H50.9156Z",fill:"white"}),e.jsx("path",{d:"M39.3906 6.65832C38.5866 5.91563 37.4895 5.54547 36.0995 5.54547C34.314 5.54547 32.9657 6.19816 32.0513 7.50532L33.7084 8.54664C34.3211 7.66089 35.1512 7.21951 36.2011 7.21951C36.8967 7.21951 37.5008 7.44661 38.0194 7.9023C38.538 8.35948 38.7964 8.91352 38.7964 9.5665V9.99507C38.0751 9.58796 37.1536 9.38381 36.0366 9.38381C34.7297 9.38381 33.6839 9.68959 32.8998 10.3023C32.1172 10.9151 31.7256 11.738 31.7256 12.7706C31.7256 13.8033 32.0969 14.5675 32.8396 15.2216C33.5808 15.8758 34.5065 16.2016 35.6092 16.2016C36.9033 16.2016 37.9389 15.6302 38.7147 14.4876H38.7976V15.8761H40.5944V9.70955C40.5944 8.4167 40.1944 7.39982 39.3903 6.65862L39.3906 6.65832ZM37.8665 13.6501C37.2451 14.2343 36.5424 14.5272 35.7511 14.5272C35.1926 14.5272 34.7068 14.3645 34.2913 14.0387C33.8741 13.7103 33.6673 13.3032 33.6673 12.8132C33.6673 12.2675 33.923 11.8134 34.4344 11.4462C34.9443 11.079 35.5815 10.8948 36.3442 10.8948C37.3926 10.8948 38.211 11.1249 38.7967 11.5889C38.7967 12.3775 38.4867 13.0645 37.8668 13.6501H37.8665Z",fill:"white"}),e.jsx("path",{d:"M30.4166 2.52282C29.5296 1.67999 28.4552 1.25739 27.1883 1.25739H22.2017V15.8758H24.0813V9.95362H27.188C28.4678 9.95362 29.5448 9.53936 30.4163 8.70815C31.3175 7.87962 31.7661 6.84397 31.7661 5.60565C31.7661 4.36733 31.3175 3.36744 30.4163 2.52312L30.4166 2.52282ZM29.0895 7.40248C28.598 7.90525 27.9781 8.15798 27.2297 8.15798H24.0816V3.05272H27.2297C27.9781 3.05272 28.5983 3.31141 29.0895 3.82849C29.5937 4.33276 29.845 4.92554 29.845 5.60535C29.845 6.28516 29.5934 6.8994 29.0895 7.40218V7.40248Z",fill:"white"}),e.jsx("path",{d:"M16.2663 11.4026C15.8887 12.6964 15.1901 13.9058 14.2131 14.8354C14.1815 14.8655 14.1496 14.895 14.1178 14.9245C14.116 14.9263 14.1148 14.9277 14.113 14.9292C13.1524 15.8144 11.9487 16.4295 10.6737 16.7272C10.6621 16.7302 10.6502 16.7329 10.6385 16.7356C10.2484 16.8241 9.85204 16.8888 9.45357 16.929C8.81668 16.9928 8.17293 16.9928 7.53723 16.9222C7.22102 16.8873 6.9063 16.8348 6.59546 16.7639C6.49293 16.7407 6.39101 16.7156 6.28938 16.6882C5.16759 16.3884 4.11256 15.8564 3.20476 15.1337C3.0018 14.971 2.80599 14.7987 2.61823 14.6184C2.61257 14.613 2.60721 14.6077 2.60154 14.6026C1.93962 13.9657 1.38081 13.22 0.956413 12.4034C0.938829 12.3691 0.921246 12.3352 0.90396 12.3009C0.717393 11.9319 0.559138 11.5493 0.429793 11.1574C0.364822 10.9618 0.307302 10.7634 0.257233 10.5631C0.226834 10.443 0.199117 10.3226 0.174678 10.2013C0.141299 10.0397 0.112986 9.87702 0.0894411 9.714C-0.0509314 8.75165 -0.0267907 7.76517 0.166929 6.81118C0.176168 6.76468 0.185705 6.71879 0.195838 6.6723C0.345748 5.97997 0.582981 5.31 0.903662 4.67698C1.53102 3.42525 2.48025 2.33983 3.62498 1.53514H3.62528C3.73704 1.45616 3.85029 1.38076 3.96533 1.30775C3.99424 1.28957 4.02345 1.27169 4.05206 1.25351C4.11018 1.21774 4.16889 1.18257 4.2276 1.148C4.34562 1.07945 4.46513 1.01329 4.58643 0.950111C4.64723 0.918519 4.70773 0.887822 4.76912 0.858018C5.0755 0.707811 5.39111 0.576975 5.71418 0.466108C5.77021 0.446438 5.82624 0.427961 5.88227 0.409781C5.96661 0.38266 6.05095 0.356731 6.13619 0.332292C6.19312 0.315603 6.25064 0.300106 6.30786 0.284906C6.36448 0.269707 6.4217 0.255401 6.47863 0.241393C6.51111 0.233346 6.5433 0.225895 6.57579 0.218146C6.62764 0.206225 6.6792 0.194901 6.73136 0.183874C6.73464 0.183278 6.73762 0.182681 6.7406 0.181787C6.90481 0.147216 7.06992 0.117711 7.23593 0.093273C7.25262 0.0905907 7.2693 0.088205 7.28629 0.0861187C8.67482 -0.111774 10.114 0.0309834 11.4319 0.518561C12.4443 0.889311 13.3712 1.47882 14.1651 2.21048C13.899 2.4957 13.6138 2.76661 13.3378 3.04705C12.8151 3.56533 12.2971 4.08807 11.774 4.60605C11.7734 4.60545 11.7723 4.60486 11.7717 4.60367L11.7645 4.61082C11.2465 4.11639 10.6192 3.74564 9.9346 3.53642C9.1314 3.29412 8.26652 3.26044 7.44425 3.43658C7.14741 3.49946 6.85772 3.59066 6.57847 3.70779C6.57519 3.70898 6.57221 3.71047 6.56893 3.71166C5.95231 3.97393 5.38843 4.36047 4.92022 4.83881C4.3638 5.39941 3.94089 6.09352 3.68906 6.83979C3.68727 6.8386 3.68548 6.83711 3.68369 6.83591C3.31831 7.89571 3.32308 9.07889 3.68399 10.1384C3.68191 10.1402 3.67982 10.1417 3.67773 10.1435C3.67833 10.1446 3.67863 10.1458 3.67893 10.147C3.68071 10.1461 3.6822 10.1446 3.68399 10.1435C4.03567 11.1892 4.72501 12.1158 5.62835 12.7482C6.19371 13.1473 6.84014 13.428 7.51995 13.5654C8.18545 13.6987 8.87927 13.6844 9.54477 13.5705C10.2103 13.4564 10.8519 13.209 11.4128 12.8338C11.4128 12.8338 11.413 12.834 11.4134 12.8344C11.4164 12.8326 11.4194 12.8308 11.4221 12.8287C12.3081 12.2294 12.9301 11.2691 13.1095 10.2147H8.48467V6.90178H8.48944V6.89701H16.4797C16.7458 8.38955 16.6889 9.94378 16.2657 11.4029L16.2663 11.4026Z",fill:"white"})]})})}function sa({size:t=32}){return e.jsx("div",{className:"rounded-full flex items-center justify-center shrink-0",style:{width:t,height:t,background:"#003087"},children:e.jsx("span",{className:"text-white font-bold",style:{fontSize:t*.38},children:"P"})})}function Ja({size:t=32}){return e.jsx("div",{className:"flex items-center justify-center shrink-0",style:{width:t,height:t,background:"#1A1F71",borderRadius:t*.2},children:e.jsxs("svg",{width:t*.72,height:t*.234,viewBox:"0 0 43 14",fill:"none",children:[e.jsx("path",{d:"M18.3629 13.5165H14.9302L17.0772 0.240662H20.5097L18.3629 13.5165Z",fill:"white"}),e.jsx("path",{d:"M30.806 0.565203C30.1289 0.296586 29.055 0 27.7271 0C24.3372 0 21.95 1.80767 21.9354 4.3921C21.9072 6.29889 23.6445 7.35796 24.9439 7.99375C26.2719 8.64342 26.7234 9.06747 26.7234 9.64656C26.7099 10.5359 25.6502 10.9459 24.6619 10.9459C23.2914 10.9459 22.5571 10.7345 21.4412 10.2397L20.9891 10.0276L20.5088 13.0077C21.3139 13.3745 22.7972 13.7 24.3372 13.7143C27.939 13.7143 30.2839 11.9346 30.3117 9.18047C30.3254 7.66919 29.4081 6.51119 27.4303 5.56493C26.2297 4.95749 25.4944 4.54791 25.4944 3.92639C25.5085 3.36137 26.1163 2.78265 27.4716 2.78265C28.5876 2.75431 29.4075 3.02255 30.0286 3.29098L30.3391 3.43195L30.806 0.565203Z",fill:"white"}),e.jsx("path",{d:"M35.3681 8.81332C35.6508 8.05064 36.7386 5.09886 36.7386 5.09886C36.7243 5.1272 37.0207 4.3221 37.1902 3.82785L37.4301 4.97178C37.4301 4.97178 38.0802 8.14956 38.2213 8.81332C37.6848 8.81332 36.0461 8.81332 35.3681 8.81332ZM39.6053 0.240662H36.9501C36.1313 0.240662 35.5092 0.480559 35.156 1.34216L30.0571 13.5163H33.659C33.659 13.5163 34.2519 11.8777 34.3794 11.5248C34.7745 11.5248 38.2784 11.5248 38.7867 11.5248C38.8853 11.9909 39.1963 13.5163 39.1963 13.5163H42.3747L39.6053 0.240662Z",fill:"white"}),e.jsx("path",{d:"M12.0629 0.240662L8.70119 9.29349L8.33383 7.45747C7.71232 5.33894 5.76311 3.03721 3.58789 1.89272L6.66713 13.5024H10.2971L15.6927 0.240662H12.0629Z",fill:"white"}),e.jsx("path",{d:"M5.57939 0.240662H0.0565013L0 0.508903C4.3082 1.61059 7.16143 4.26616 8.3337 7.45803L7.13309 1.35661C6.93542 0.508715 6.32798 0.268631 5.57939 0.240662Z",fill:"white"})]})})}function qa({size:t=32}){const a=t*.8;return e.jsx("div",{className:"flex items-center justify-center shrink-0",style:{width:t,height:t},children:e.jsxs("svg",{width:a,height:a*.625,viewBox:"0 0 48 30",fill:"none",children:[e.jsx("circle",{cx:"18",cy:"15",r:"14",fill:"#EB001B"}),e.jsx("circle",{cx:"30",cy:"15",r:"14",fill:"#F79E1B"}),e.jsx("path",{d:"M24 2.35A14 14 0 0 1 24 27.65A14 14 0 0 1 24 2.35Z",fill:"#FF5F00"})]})})}function ia({size:t=32}){const a=t*.56,n=a*.65,r=Math.max(2,a*.1),o=a*.2;return e.jsxs("div",{className:"flex items-center justify-center shrink-0",style:{width:t,height:t},children:[e.jsx("div",{style:{width:a,height:n,background:"#1A1F71",borderRadius:r,position:"relative",zIndex:2,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("svg",{width:a*.7,height:n*.35,viewBox:"0 0 43 14",fill:"none",children:[e.jsx("path",{d:"M18.3629 13.5165H14.9302L17.0772 0.240662H20.5097L18.3629 13.5165Z",fill:"white"}),e.jsx("path",{d:"M12.0629 0.240662L8.70119 9.29349L8.33383 7.45747C7.71232 5.33894 5.76311 3.03721 3.58789 1.89272L6.66713 13.5024H10.2971L15.6927 0.240662H12.0629Z",fill:"white"}),e.jsx("path",{d:"M5.57939 0.240662H0.0565013L0 0.508903C4.3082 1.61059 7.16143 4.26616 8.3337 7.45803L7.13309 1.35661C6.93542 0.508715 6.32798 0.268631 5.57939 0.240662Z",fill:"white"}),e.jsx("path",{d:"M30.806 0.565203C30.1289 0.296586 29.055 0 27.7271 0C24.3372 0 21.95 1.80767 21.9354 4.3921C21.9072 6.29889 23.6445 7.35796 24.9439 7.99375C26.2719 8.64342 26.7234 9.06747 26.7234 9.64656C26.7099 10.5359 25.6502 10.9459 24.6619 10.9459C23.2914 10.9459 22.5571 10.7345 21.4412 10.2397L20.9891 10.0276L20.5088 13.0077C21.3139 13.3745 22.7972 13.7 24.3372 13.7143C27.939 13.7143 30.2839 11.9346 30.3117 9.18047C30.3254 7.66919 29.4081 6.51119 27.4303 5.56493C26.2297 4.95749 25.4944 4.54791 25.4944 3.92639C25.5085 3.36137 26.1163 2.78265 27.4716 2.78265C28.5876 2.75431 29.4075 3.02255 30.0286 3.29098L30.3391 3.43195L30.806 0.565203Z",fill:"white"}),e.jsx("path",{d:"M35.3681 8.81332C35.6508 8.05064 36.7386 5.09886 36.7386 5.09886C36.7243 5.1272 37.0207 4.3221 37.1902 3.82785L37.4301 4.97178C37.4301 4.97178 38.0802 8.14956 38.2213 8.81332C37.6848 8.81332 36.0461 8.81332 35.3681 8.81332ZM39.6053 0.240662H36.9501C36.1313 0.240662 35.5092 0.480559 35.156 1.34216L30.0571 13.5163H33.659C33.659 13.5163 34.2519 11.8777 34.3794 11.5248C34.7745 11.5248 38.2784 11.5248 38.7867 11.5248C38.8853 11.9909 39.1963 13.5163 39.1963 13.5163H42.3747L39.6053 0.240662Z",fill:"white"})]})}),e.jsx("div",{style:{width:a,height:n,background:"#252525",borderRadius:r,marginLeft:-o,position:"relative",zIndex:1,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},children:e.jsxs("svg",{width:n*.85,height:n*.6,viewBox:"0 0 48 30",fill:"none",children:[e.jsx("circle",{cx:"18",cy:"15",r:"14",fill:"#EB001B"}),e.jsx("circle",{cx:"30",cy:"15",r:"14",fill:"#F79E1B"}),e.jsx("path",{d:"M24 2.35A14 14 0 0 1 24 27.65A14 14 0 0 1 24 2.35Z",fill:"#FF5F00"})]})})]})}function en({size:t=18}){return e.jsx("div",{className:"rounded-full bg-white flex items-center justify-center shrink-0",style:{width:t,height:t},children:e.jsx("span",{className:"text-black font-bold",style:{fontSize:t*.55},children:"C"})})}function Ae(){return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"var(--t-text-secondary)",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function ft(){return e.jsx("svg",{width:"8",height:"14",viewBox:"0 0 8 14",fill:"none",children:e.jsx("path",{d:"M1 1L7 7L1 13",stroke:"var(--t-icon-stroke)",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function la({onClick:t}){return e.jsx("button",{onClick:t,className:"hover:opacity-70 transition-opacity",children:e.jsx("svg",{width:"24",height:"16",viewBox:"0 0 24 16",fill:"none",children:e.jsx("path",{d:"M22.4004 12V4C22.4004 2.67452 21.3255 1.59961 20 1.59961H6.7998V14.4004H20V16H4V14.4004H5.2002V1.59961H4C2.67452 1.59961 1.59961 2.67452 1.59961 4V12C1.59961 13.3255 2.67452 14.4004 4 14.4004V16L3.79395 15.9951C1.68056 15.8879 0 14.14 0 12V4C0 1.79086 1.79086 6.44266e-08 4 0H20C22.2091 0 24 1.79086 24 4V12L23.9951 12.2061C23.8913 14.2512 22.2512 15.8913 20.2061 15.9951L20 16V14.4004C21.3255 14.4004 22.4004 13.3255 22.4004 12Z",fill:"var(--t-icon-stroke)"})})})}function ca({size:t=40}){return e.jsx("div",{className:"rounded-full flex items-center justify-center shrink-0",style:{width:t,height:t,background:"var(--t-surface)"},children:e.jsxs("svg",{width:t*.5,height:t*.5,viewBox:"0 0 20 20",fill:"none",children:[e.jsx("circle",{cx:"10",cy:"10",r:"7.5",stroke:"var(--t-text)",strokeWidth:"1.5"}),e.jsx("path",{d:"M10 2.5A7.5 7.5 0 0 1 10 17.5",fill:"var(--t-text)"})]})})}function da(t,a=32){switch(t){case"revolut":return e.jsx(na,{size:a});case"applepay":return e.jsx(ra,{size:a});case"card":return e.jsx(ia,{size:a});case"googlepay":return e.jsx(oa,{size:a});case"paypal":return e.jsx(sa,{size:a});case"bank":return e.jsx(aa,{size:a});case"visa":return e.jsx(Ja,{size:a});case"mastercard":return e.jsx(qa,{size:a});default:return e.jsx(et,{size:a})}}const tn={"debit-credit-card":"card","bank-transfer":"bank","ach-bank-transfer":"bank","payid-bank-transfer":"bank","sepa-bank-transfer":"bank",sepa:"bank","apple-pay":"applepay","google-pay":"googlepay",paypal:"paypal",revolut:"revolut"},an={"debit-credit-card":"Card","bank-transfer":"Bank Transfer","ach-bank-transfer":"ACH","apple-pay":"Apple Pay","google-pay":"Google Pay","payid-bank-transfer":"PayID",paypal:"PayPal",revolut:"Revolut"};function ua(t,a){return an[t]||a}function ma(t,a,n=24){const r=tn[t];return r?da(r,n):a?e.jsx("img",{src:a,alt:"",width:n,height:n,style:{borderRadius:"50%"}}):e.jsx(et,{size:n})}function fa({methods:t,selectedId:a,onOpenModal:n,fiatCurrency:r}){const o=c.useMemo(()=>t.filter(u=>u.supportedFiats.includes(r)),[t,r]),d=o.find(u=>u.id===a)||o[0];return o.length===0?e.jsx("div",{className:"flex items-center justify-between px-[18px] pt-[12px] pb-[14px]",style:{background:"var(--t-surface)",borderBottomLeftRadius:5,borderBottomRightRadius:5},children:e.jsxs("span",{className:"text-[12px]",style:{color:"var(--t-text-muted)"},children:["No payment methods available for ",r]})}):e.jsx(e.Fragment,{children:e.jsxs("div",{role:"button",tabIndex:0,onClick:n,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&n()},className:"flex items-center justify-between w-full px-[18px] transition-colors",style:{background:"var(--t-surface)",borderBottomLeftRadius:5,borderBottomRightRadius:5,cursor:"pointer",height:42},children:[e.jsx("span",{className:"text-[12px]",style:{color:"var(--t-text-secondary)"},children:"Payment method"}),e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex items-center justify-center",style:{width:20,height:20},children:d&&ma(d.id,d.icon,20)}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:d?ua(d.id,d.name):"Select"}),e.jsx(Ae,{})]})]})})}function ha({className:t="",autoRedirect:a=!1,redirectDelay:n=3e3}){var p;const{order:r,orderStatus:o,goToStep:d,goBack:u}=Ce(),[s,l]=c.useState(!1),[m,h]=c.useState(null),f=r!=null&&r.checkout.expiresAt?Date.now()>r.checkout.expiresAt:!1;if(c.useEffect(()=>{if((r==null?void 0:r.checkout.method)==="redirect"&&a&&!f){h(Math.ceil(n/1e3));const g=setTimeout(()=>{window.location.href=r.checkout.url},n),y=setInterval(()=>{h(N=>N&&N>1?N-1:null)},1e3);return()=>{clearTimeout(g),clearInterval(y)}}},[r,a,n,f]),c.useEffect(()=>{o&&(o.status==="completed"?d("complete"):["failed","cancelled","expired"].includes(o.status)&&d("error"))},[o==null?void 0:o.status,d]),!r)return e.jsxs("div",{className:`flex flex-col items-center justify-center p-8 ${t}`,style:{color:"var(--t-text)"},children:[e.jsx("p",{className:"text-[15px] mb-4",children:"No order found"}),e.jsx("button",{className:"font-semibold text-[14px] transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)",paddingLeft:24,paddingRight:24},onClick:u,children:"Go Back"})]});if(f)return e.jsxs("div",{className:`flex flex-col items-center justify-center p-8 text-center ${t}`,style:{color:"var(--t-text)"},children:[e.jsx("h3",{className:"text-[18px] font-semibold mb-2",children:"Checkout expired"}),e.jsx("p",{className:"text-[14px] mb-6",style:{color:"var(--t-text-secondary)"},children:"The session has expired. Please try again."}),e.jsx("button",{className:"w-full font-semibold text-[16px] transition-all",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)"},onClick:u,children:"Start over"})]});if(r.checkout.method==="iframe"){const g=r.checkout.url,y=((p=r.checkout.allowedFeatures)==null?void 0:p.join("; "))||"payment; camera; microphone; geolocation; clipboard-read; clipboard-write; accelerometer; gyroscope; magnetometer; fullscreen; autoplay; encrypted-media; web-share";return Ot.createPortal(e.jsxs("div",{style:{position:"fixed",inset:0,zIndex:9999,display:"flex",flexDirection:"column",background:"#000"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",height:48,paddingLeft:8,paddingRight:16,background:"#111",flexShrink:0},children:e.jsxs("button",{onClick:u,style:{display:"flex",alignItems:"center",gap:6,background:"none",border:"none",color:"#fff",fontSize:14,fontWeight:500,cursor:"pointer",padding:"8px 12px",borderRadius:6},children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{d:"M10 12L6 8L10 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),"Cancel"]})}),e.jsxs("div",{style:{flex:1,position:"relative",overflow:"hidden"},children:[!s&&e.jsxs("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:[e.jsx("div",{className:"nramp-spinner"}),e.jsx("p",{style:{color:"#888",fontSize:14,marginTop:16},children:"Loading checkout..."})]}),e.jsx("iframe",{src:g,style:{display:s?"block":"none",width:"100%",height:"100%",border:"none"},allow:y,onLoad:()=>l(!0),title:"Provider Checkout"})]})]}),document.body)}if(r.checkout.method==="redirect")return e.jsxs("div",{className:`flex flex-col items-center justify-center p-8 text-center ${t}`,style:{color:"var(--t-text)"},children:[e.jsx("div",{className:"text-[48px] mb-4",children:"🔗"}),e.jsx("h3",{className:"text-[18px] font-semibold mb-2",children:"Complete Payment"}),e.jsxs("p",{className:"text-[14px] mb-4",style:{color:"var(--t-text-secondary)"},children:["You'll be redirected to ",r.gateway," to complete your payment."]}),m!==null&&e.jsxs("p",{className:"text-[13px] mb-4",style:{color:"var(--t-text-muted)"},children:["Redirecting in ",m,"..."]}),e.jsxs("a",{href:r.checkout.url,className:"w-full font-semibold text-[16px] flex items-center justify-center transition-all",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)",textDecoration:"none"},target:"_blank",rel:"noopener noreferrer",children:["Continue to ",r.gateway]}),e.jsx("button",{className:"w-full font-semibold text-[14px] mt-2 transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)"},onClick:u,children:"Cancel"})]});if(r.checkout.method==="widget"&&r.widgetConfig){const g=nn(r.checkout.url,r.widgetConfig);return Ot.createPortal(e.jsxs("div",{style:{position:"fixed",inset:0,zIndex:9999,display:"flex",flexDirection:"column",background:"#000"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",height:48,paddingLeft:8,paddingRight:16,background:"#111",flexShrink:0},children:e.jsxs("button",{onClick:u,style:{display:"flex",alignItems:"center",gap:6,background:"none",border:"none",color:"#fff",fontSize:14,fontWeight:500,cursor:"pointer",padding:"8px 12px",borderRadius:6},children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{d:"M10 12L6 8L10 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),"Cancel"]})}),e.jsxs("div",{style:{flex:1,position:"relative",overflow:"hidden"},children:[!s&&e.jsxs("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:[e.jsx("div",{className:"nramp-spinner"}),e.jsx("p",{style:{color:"#888",fontSize:14,marginTop:16},children:"Loading checkout..."})]}),e.jsx("iframe",{src:g,style:{display:s?"block":"none",width:"100%",height:"100%",border:"none"},allow:"payment; camera; microphone; geolocation; clipboard-read; clipboard-write; accelerometer; gyroscope; magnetometer; fullscreen; autoplay; encrypted-media; web-share",onLoad:()=>l(!0),title:"Payment Checkout"})]})]}),document.body)}return e.jsxs("div",{className:`flex flex-col items-center justify-center p-8 ${t}`,style:{color:"var(--t-text)"},children:[e.jsx("p",{className:"text-[15px] mb-4",children:"Unknown checkout method"}),e.jsx("button",{className:"font-semibold text-[14px] transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)",paddingLeft:24,paddingRight:24},onClick:u,children:"Go Back"})]})}function nn(t,a){const n=new URL("/en/partner/widget",t);for(const[r,o]of Object.entries(a))o!=null&&o!==""&&n.searchParams.set(r,String(o));return n.toString()}function pa({className:t=""}){const{orderStatus:a,orderStatusLoading:n,goToStep:r}=Ce();c.useEffect(()=>{a&&(a.status==="completed"?r("complete"):["failed","cancelled","expired","refunded"].includes(a.status)&&r("error"))},[a==null?void 0:a.status,r]);const o=()=>{if(!a)return"Processing your order...";switch(a.status){case"pending":return"Waiting for payment confirmation...";case"processing":return"Processing your transaction...";default:return"Processing..."}};return e.jsxs("div",{className:`flex flex-col items-center justify-center px-8 py-12 text-center ${t}`,children:[e.jsx("div",{className:"mb-6",children:e.jsx("div",{className:"nramp-spinner-large nramp-spinner"})}),e.jsx("h2",{className:"text-[20px] font-semibold mb-3",style:{color:"var(--t-text)"},children:o()}),n&&e.jsx("p",{className:"text-[13px] mb-4",style:{color:"var(--t-text-muted)"},children:"Checking status..."}),a&&e.jsxs("div",{className:"w-full mt-6 text-left",style:{background:"var(--t-surface)",borderRadius:5,padding:16},children:[e.jsx(we,{label:"Order ID",value:a.orderId,mono:!0}),e.jsx(we,{label:"Provider",value:a.gateway}),e.jsx(we,{label:"Amount",value:`${a.fiatAmount} ${a.fiatCurrency}`}),e.jsx(we,{label:"Receiving",value:`${a.cryptoAmount||"..."} ${a.cryptoCurrency}`}),e.jsx(we,{label:"Network",value:a.network}),e.jsx(we,{label:"To Address",value:`${a.walletAddress.slice(0,10)}...${a.walletAddress.slice(-8)}`,mono:!0})]}),e.jsxs("div",{className:"mt-6",children:[e.jsx("p",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:"This usually takes a few minutes."}),e.jsx("p",{className:"text-[12px] mt-1",style:{color:"var(--t-text-muted)"},children:"You can safely close this page - we'll send you an email when complete."})]})]})}function we({label:t,value:a,mono:n}){return e.jsxs("div",{className:"flex justify-between items-center py-2",style:{borderBottom:"1px solid var(--t-divider)"},children:[e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:t}),e.jsx("span",{className:`text-[13px] font-medium ${n?"font-mono":""}`,style:{color:"var(--t-text)"},children:a})]})}function xa({className:t="",explorerUrl:a,onDone:n,doneButtonText:r="Done"}){const{orderStatus:o,state:d,dispatch:u}=Ce(),s=d.flowType==="sell",l=()=>{if(!(o!=null&&o.transactionHash))return null;if(!a){const f={ethereum:"https://etherscan.io/tx/{txHash}",polygon:"https://polygonscan.com/tx/{txHash}",arbitrum:"https://arbiscan.io/tx/{txHash}",optimism:"https://optimistic.etherscan.io/tx/{txHash}",base:"https://basescan.org/tx/{txHash}",bitcoin:"https://mempool.space/tx/{txHash}",solana:"https://solscan.io/tx/{txHash}",avalanche:"https://snowtrace.io/tx/{txHash}",fantom:"https://ftmscan.com/tx/{txHash}"};return(f[d.network]||f.ethereum).replace("{txHash}",o.transactionHash)}return a.replace("{txHash}",o.transactionHash)},m=()=>{n?n():u({type:"RESET"})},h=l();return e.jsxs("div",{className:`flex flex-col items-center px-8 py-12 text-center ${t}`,children:[e.jsx("div",{className:"flex items-center justify-center mb-5",style:{width:64,height:64,borderRadius:"50%",background:"var(--t-success, #10b981)"},children:e.jsx("svg",{viewBox:"0 0 24 24",width:"32",height:"32",fill:"white",children:e.jsx("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"})})}),e.jsx("h2",{className:"text-[20px] font-semibold mb-2",style:{color:"var(--t-text)"},children:s?"Sale Complete!":"Purchase Complete!"}),e.jsx("p",{className:"text-[14px] mb-6",style:{color:"var(--t-text-secondary)"},children:s?`Your ${(o==null?void 0:o.fiatCurrency)||d.fiatCurrency} payout is being processed.`:`Your ${(o==null?void 0:o.cryptoCurrency)||d.cryptoCurrency} has been sent to your wallet.`}),o&&e.jsxs("div",{className:"w-full text-left mb-6",style:{background:"var(--t-surface)",borderRadius:5,padding:16},children:[e.jsx(de,{label:s?"Amount Sold":"Amount Received",value:`${o.cryptoAmount} ${o.cryptoCurrency}`,highlight:!0}),e.jsx(de,{label:s?"Payout Amount":"Amount Paid",value:`${o.fiatAmount} ${o.fiatCurrency}`}),e.jsx(de,{label:"Network",value:o.network}),e.jsx(de,{label:"Wallet",value:`${o.walletAddress.slice(0,10)}...${o.walletAddress.slice(-8)}`,mono:!0}),o.transactionHash&&e.jsx(de,{label:"Transaction",value:`${o.transactionHash.slice(0,10)}...${o.transactionHash.slice(-8)}`,mono:!0}),e.jsx(de,{label:"Provider",value:o.gateway}),e.jsx(de,{label:"Order ID",value:o.orderId,mono:!0}),o.completedAt&&e.jsx(de,{label:"Completed",value:new Date(o.completedAt).toLocaleString()})]}),e.jsxs("div",{className:"w-full flex flex-col gap-2",children:[h&&e.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"w-full font-semibold text-[14px] flex items-center justify-center transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)",textDecoration:"none"},children:"View on Explorer"}),e.jsx("button",{className:"w-full font-semibold text-[16px] transition-all",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)"},onClick:m,children:r})]})]})}function de({label:t,value:a,mono:n,highlight:r}){return e.jsxs("div",{className:"flex justify-between items-center py-2",style:{borderBottom:"1px solid var(--t-divider)"},children:[e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:t}),e.jsx("span",{className:`text-[13px] font-medium ${n?"font-mono":""}`,style:{color:r?"var(--t-success, #10b981)":"var(--t-text)"},children:a})]})}function ya({className:t="",onRetry:a,supportEmail:n="support@nowramp.com"}){const{state:r,orderStatus:o,dispatch:d,goToStep:u}=Ce(),s=r.flowType==="sell",l=()=>{if(o)switch(o.status){case"failed":return"Payment Failed";case"cancelled":return"Order Cancelled";case"expired":return"Order Expired";case"refunded":return"Order Refunded";default:return"Something Went Wrong"}return"Something Went Wrong"},m=()=>{if(r.errorMessage)return r.errorMessage;if(o)switch(o.status){case"failed":return s?"Your sale could not be processed. Please try again.":"Your payment could not be processed. Please try again or use a different payment method.";case"cancelled":return s?"Your sale was cancelled. No crypto was transferred.":"Your order was cancelled. No payment was processed.";case"expired":return s?"Your order has expired. Please start a new sale.":"Your order has expired. Please start a new purchase.";case"refunded":return s?"Your crypto has been returned. The funds should appear in your wallet shortly.":"Your payment has been refunded. The funds should appear in your account within 5-10 business days.";default:return"An unexpected error occurred. Please try again."}return"An unexpected error occurred. Please try again."},h=()=>{d({type:"CLEAR_ERROR"}),a?a():(d({type:"RESET"}),u("amount"))},f=()=>{d({type:"RESET"}),u("amount")};return e.jsxs("div",{className:`flex flex-col items-center px-8 py-12 text-center ${t}`,children:[e.jsx("div",{className:"flex items-center justify-center mb-5",style:{width:64,height:64,borderRadius:"50%",background:"var(--t-error, #EF4444)"},children:e.jsx("svg",{viewBox:"0 0 24 24",width:"32",height:"32",fill:"white",children:e.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})})}),e.jsx("h2",{className:"text-[20px] font-semibold mb-2",style:{color:"var(--t-text)"},children:l()}),e.jsx("p",{className:"text-[14px] mb-6",style:{color:"var(--t-text-secondary)"},children:m()}),o&&e.jsx("div",{className:"w-full text-left mb-6",style:{background:"var(--t-surface)",borderRadius:5,padding:16},children:e.jsxs("div",{className:"flex justify-between items-center py-2",children:[e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:"Order ID"}),e.jsx("span",{className:"text-[13px] font-medium font-mono",style:{color:"var(--t-text)"},children:o.orderId})]})}),e.jsxs("div",{className:"w-full flex flex-col gap-2",children:[e.jsx("button",{className:"w-full font-semibold text-[16px] transition-all",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)"},onClick:h,children:"Try Again"}),e.jsx("button",{className:"w-full font-semibold text-[14px] transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)"},onClick:f,children:"Start Over"})]}),e.jsxs("div",{className:"mt-6",children:[e.jsxs("p",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:["Need help? Contact"," ",e.jsx("a",{href:`mailto:${n}`,className:"underline",style:{color:"var(--t-accent)"},children:n})]}),o&&e.jsxs("p",{className:"text-[12px] mt-1",style:{color:"var(--t-text-muted)"},children:["Reference: ",o.orderId]})]})]})}function _t(t){return t.length<=12?t:`${t.slice(0,6)}...${t.slice(-6)}`}function Ca({className:t="",stablecoinParity:a,partnerName:n}){var X;const{config:r,configLoading:o,state:d,defaultGateway:u,quotes:s,fetchQuotes:l,createOrder:m,orderLoading:h}=Ce(),f=d.flowType==="sell",[p,g]=c.useState(null),y=r==null?void 0:r.gateways.find(_=>_.id===u),N=(X=s==null?void 0:s.bestQuote)!=null&&X.exchangeRate?parseFloat(s.bestQuote.exchangeRate):null,R=parseFloat(d.fiatAmount)||0,H=!!(a&&n&&!f&&yt(d.cryptoCurrency)&&N),J=H&&d.cryptoCurrency.toUpperCase().includes(d.fiatCurrency.toUpperCase()),P=H&&R>0?Ze(J?R:R/N):null,Y=async()=>{g(null);try{l(),await m()}catch(_){const ue=_ instanceof Error?_.message:"Failed to create order";g(ue)}};return o?e.jsxs("div",{className:`flex flex-col items-center justify-center p-12 ${t}`,children:[e.jsx("div",{className:"nramp-spinner"}),e.jsx("p",{className:"text-[14px] mt-4",style:{color:"var(--t-text-secondary)"},children:"Loading..."})]}):e.jsxs("div",{className:`flex flex-col items-center px-8 py-12 ${t}`,children:[e.jsx("h2",{className:"text-[20px] font-semibold mb-6",style:{color:"var(--t-text)"},children:f?"Confirm Sale":"Confirm Purchase"}),e.jsxs("div",{className:"w-full text-left mb-6",style:{background:"var(--t-surface)",borderRadius:5,padding:16},children:[y&&e.jsxs("div",{className:"flex justify-between items-center py-2",style:{borderBottom:"1px solid var(--t-divider)"},children:[e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:"Provider"}),e.jsxs("span",{className:"flex items-center gap-2",children:[y.logo&&e.jsx("img",{src:y.logo,alt:y.name,width:20,height:20,style:{borderRadius:4}}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:y.name})]})]}),f?e.jsxs(e.Fragment,{children:[e.jsx(ye,{label:"You sell",value:`${d.cryptoAmount} ${d.cryptoCurrency}`,highlight:!0}),e.jsx(ye,{label:"You receive",value:`${d.fiatCurrency} payout`})]}):e.jsxs(e.Fragment,{children:[e.jsx(ye,{label:"You pay",value:`${d.fiatAmount} ${d.fiatCurrency}`,highlight:!0}),e.jsx(ye,{label:"You receive",value:P?`${P} ${d.cryptoCurrency}`:`${d.cryptoCurrency} on ${d.network}`}),e.jsx(ye,{label:"Wallet",value:_t(d.walletAddress),mono:!0}),H&&P&&e.jsxs("div",{className:"py-2 text-[11px]",style:{color:"var(--t-text-muted)",lineHeight:"15px"},children:["Charged amount from provider may differ. The rest up to ",P," ",d.cryptoCurrency," will be credited to your ",n," account."]})]}),e.jsx(ye,{label:"Network",value:d.network}),f&&d.walletAddress&&e.jsx(ye,{label:"Refund address",value:_t(d.walletAddress),mono:!0})]}),p&&e.jsx("p",{className:"text-[12px] mb-4",style:{color:"#EF4444"},children:p}),e.jsx("button",{className:"w-full font-semibold text-[16px] transition-all flex items-center justify-center gap-2",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)",opacity:h?.7:1},disabled:h,onClick:Y,children:h?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"nramp-spinner-inline"}),"Processing..."]}):f?"Confirm & Sell":"Confirm & Pay"})]})}function ye({label:t,value:a,mono:n,highlight:r}){return e.jsxs("div",{className:"flex justify-between items-center py-2",style:{borderBottom:"1px solid var(--t-divider)"},children:[e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:t}),e.jsx("span",{className:`text-[13px] font-medium ${n?"font-mono":""}`,style:{color:r?"var(--t-success, #10b981)":"var(--t-text)"},children:a})]})}function Re({isOpen:t,onClose:a,children:n}){const[r,o]=c.useState(!1),[d,u]=c.useState(!1);c.useEffect(()=>{if(t)o(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>u(!0)));else if(r){u(!1);const l=setTimeout(()=>o(!1),250);return()=>clearTimeout(l)}},[t]);const s=c.useCallback(()=>{u(!1),setTimeout(()=>a(),250)},[a]);return c.useEffect(()=>{if(!t)return;const l=m=>{m.key==="Escape"&&s()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[t,s]),r?e.jsx("div",{className:"absolute inset-0 z-20 transition-opacity duration-250",style:{opacity:d?1:0},children:e.jsx("div",{className:"absolute inset-0 flex flex-col transition-transform duration-250 ease-out",style:{background:"var(--t-modal-bg)",transform:d?"translateY(0)":"translateY(24px)"},children:typeof n=="function"?n(s):n})}):null}function ga({char:t,height:a=38}){const n="0123456789",r=n.indexOf(t);return r===-1?e.jsx("span",{children:t}):e.jsx("span",{className:"digit-slot",style:{height:a,lineHeight:`${a}px`},children:e.jsx("span",{className:"digit-slot-inner block",style:{transform:`translateY(-${r*a}px)`},children:n.split("").map(o=>e.jsx("span",{className:"block",style:{height:a,lineHeight:`${a}px`},children:o},o))})})}function Sa({value:t,height:a=38,className:n="",style:r={}}){return e.jsx("span",{className:n,style:{display:"inline-flex",...r},children:t.split("").map((o,d)=>e.jsx(ga,{char:o,height:a},d))})}function O({w:t,h:a,className:n=""}){return e.jsx("div",{className:`skeleton ${n}`,style:{width:t,height:a}})}function va(){return e.jsxs("div",{className:"flex-1 px-5 flex flex-col",children:[e.jsxs("div",{className:"px-[18px] pt-[14px] pb-[18px]",style:{background:"var(--t-surface)",borderRadius:5},children:[e.jsx(O,{w:70,h:14,className:"mb-3"}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(O,{w:120,h:32}),e.jsx(O,{w:75,h:32})]})]}),e.jsxs("div",{className:"px-[18px] pt-[12px] pb-[18px]",style:{background:"var(--t-surface)",borderRadius:5,marginTop:4},children:[e.jsx(O,{w:50,h:14,className:"mb-3"}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(O,{w:180,h:32}),e.jsx(O,{w:85,h:32})]})]}),e.jsxs("div",{className:"flex justify-between mt-3 px-[2px]",children:[e.jsx(O,{w:140,h:12}),e.jsx(O,{w:90,h:12})]}),e.jsxs("div",{className:"mt-8",children:[e.jsx(O,{w:65,h:14,className:"mb-2.5"}),e.jsx(O,{w:"100%",h:47})]}),e.jsx("div",{className:"flex-1"}),e.jsx(O,{w:"100%",h:60,className:"mb-2"}),e.jsx("div",{className:"text-center py-3",children:e.jsx("span",{className:"text-[11px]",style:{color:"var(--t-text-tertiary)"},children:"Powered by NowRamp"})})]})}function ge({onClick:t}){return e.jsx("button",{onClick:t,className:"flex items-center justify-center transition-colors rounded-full shrink-0",style:{width:30,height:30,backgroundColor:"var(--t-close-bg)"},onMouseEnter:a=>a.currentTarget.style.backgroundColor="var(--t-close-hover)",onMouseLeave:a=>a.currentTarget.style.backgroundColor="var(--t-close-bg)",children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:e.jsx("path",{d:"M1 1L9 9M9 1L1 9",stroke:"var(--t-icon-close)",strokeWidth:"1.4",strokeLinecap:"round"})})})}function ke({value:t,onChange:a,placeholder:n=""}){const[r,o]=c.useState(!1);return e.jsxs("div",{className:"relative mx-5 mb-5",children:[e.jsx("input",{type:"text",value:t,onChange:d=>a(d.target.value),onFocus:()=>o(!0),onBlur:()=>o(!1),placeholder:n,style:{height:47,borderRadius:4.5,border:`1px solid ${r?"var(--t-border-focus)":"var(--t-border)"}`,outline:"none",boxShadow:"none",color:"var(--t-text)",padding:`0 ${t?40:14}px 0 14px`,fontSize:14,backgroundColor:"transparent"},className:"w-full outline-none transition-colors"}),t&&e.jsx("button",{onClick:()=>a(""),className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center justify-center transition-colors rounded",style:{width:22,height:22,backgroundColor:"var(--t-close-bg)",borderRadius:4},children:e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",children:e.jsx("path",{d:"M1 1L7 7M7 1L1 7",stroke:"var(--t-icon-close)",strokeWidth:"1.2",strokeLinecap:"round"})})})]})}function ba({onClose:t,onSelect:a,currencies:n,assetBaseUrl:r="",selectedCode:o}){const[d,u]=c.useState(""),s=c.useMemo(()=>{if(!n||n.length===0)return ct;const m=new Map(ct.map(h=>[h.code,h.name]));return n.map(h=>({code:h.code,name:h.name||m.get(h.code)||h.code}))},[n]),l=c.useMemo(()=>{const m=d.trim().toLowerCase();if(!m){if(o){const h=s.find(f=>f.code===o);if(h){const f=s.filter(p=>p.code!==o);return[h,...f]}}return s}return s.filter(h=>h.code.toLowerCase().includes(m)||h.name.toLowerCase().includes(m))},[s,d,o]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(ge,{onClick:t})}),e.jsx("h2",{className:"text-center text-[17px] font-medium mt-2 mb-6",style:{color:"var(--t-text)",fontSize:17,fontWeight:500,marginTop:8,marginBottom:24},children:"Select fiat currency"}),e.jsx(ke,{value:d,onChange:u}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[l.map((m,h)=>{const f=m.name!==m.code?m.name:"",p=o===m.code;return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>a(m.code),className:"flex items-center w-full transition-colors rounded-lg hover-item",style:{color:"var(--t-text)",gap:14,padding:"18px 8px",margin:"0 -8px"},children:[e.jsx(Qe,{currencyCode:m.code,size:32,baseUrl:r}),e.jsxs("div",{className:"text-left flex-1 flex items-center gap-2",children:[e.jsx("span",{className:"font-semibold text-[15px]",children:m.code}),f&&e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:f})]}),p&&e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"var(--t-success, #4CD964)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),h<l.length-1&&e.jsx("div",{style:{height:1,background:"var(--t-divider, rgba(255,255,255,0.08))"}})]},m.code)}),l.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No currencies found"})]})]})}function Vt({src:t,alt:a,size:n,className:r,style:o}){const[d,u]=c.useState(!1),[s,l]=c.useState(!1),m=c.useRef(t);m.current!==t&&(m.current=t,u(!1),l(!1));const h=c.useCallback(()=>u(!0),[]),f=c.useCallback(()=>l(!0),[]);return e.jsxs("div",{className:r,style:{...o,width:n,height:n,position:"relative"},children:[!d&&!s&&e.jsx("div",{className:"absolute inset-0 rounded-full animate-pulse",style:{background:"var(--t-pill-bg, #333)"}}),s?e.jsx("div",{className:"absolute inset-0 rounded-full flex items-center justify-center text-[10px] font-bold",style:{background:"var(--t-pill-bg, #333)",color:"var(--t-text-muted)"},children:a.slice(0,3)}):e.jsx("img",{src:t,alt:a,width:n,height:n,onLoad:h,onError:f,className:`rounded-full ${d?"opacity-100":"opacity-0"}`,style:{width:n,height:n,transition:"opacity 0.15s ease-in"}})]})}function ja({onClose:t,onSelect:a,cryptos:n,assetBaseUrl:r="",selectedCode:o,selectedChain:d}){const[u,s]=c.useState(""),l=c.useMemo(()=>{if(!n||n.length===0)return ea;const f=[];for(const p of n){const g=p.networks||[],y=p.name||Za[p.code]||p.code;if(g.length===0)f.push({code:p.code,name:y,chain:p.code,popular:!1});else for(const N of g){const R=N.code||N.id||N.name||p.code;f.push({code:p.code,name:y,chain:R,chainName:N.name,popular:!1})}}return f},[n]),m=c.useCallback((f,p)=>o===f&&d===p,[o,d]),h=c.useMemo(()=>{var y;const f=u.trim().toLowerCase();if(!f){if(o&&d){const N=l.find(R=>R.code===o&&R.chain===d);if(N){const R=l.filter(H=>!(H.code===o&&H.chain===d));return[N,...R]}}return l}const p=f.split(/\s+/),g=[];for(const N of l){const R=We(N.chain),H=R?R.name.toLowerCase():"",J=((y=R==null?void 0:R.shortName)==null?void 0:y.toLowerCase())||"",P=N.chain.toLowerCase(),Y=N.code.toLowerCase(),X=N.name.toLowerCase(),_=[Y,X,H,J,P];if(!p.every(k=>_.some(i=>i.includes(k))))continue;let S=0;Y===f?S+=100:Y.startsWith(p[0])&&(S+=50),N.popular&&(S+=10),p.length>1&&(H.includes(p[1])||J.includes(p[1])||P.includes(p[1]))&&(S+=25),g.push({item:N,score:S})}return g.sort((N,R)=>R.score-N.score),g.map(N=>N.item)},[l,u,o,d]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(ge,{onClick:t})}),e.jsx("h2",{className:"text-center text-[17px] font-medium mt-2 mb-6",style:{color:"var(--t-text)",fontSize:17,fontWeight:500,marginTop:8,marginBottom:24},children:"Select crypto currency"}),e.jsx(ke,{value:u,onChange:s}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[h.map((f,p)=>{const g=We(f.chain),y=(g==null?void 0:g.name)||f.chainName||f.chain,N=f.name!==f.code?f.name:"",R=m(f.code,f.chain);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>a(f.code,f.chain),className:"flex items-center w-full transition-colors rounded-lg hover-item",style:{gap:14,padding:"18px 8px",margin:"0 -8px"},children:[e.jsxs("div",{className:"relative shrink-0",style:{width:40,height:40},children:[e.jsx("div",{className:"absolute top-0 left-0",style:{background:"#ffffff",borderRadius:"50%"},children:e.jsx(Vt,{src:xt(f.code,r),alt:f.code,size:32})}),e.jsx("div",{className:"absolute",style:{bottom:0,right:0,border:"2px solid var(--t-surface, #1C1C22)",borderRadius:"50%",background:"#ffffff"},children:e.jsx(Vt,{src:Xe(f.chain,r),alt:f.chain,size:16})})]}),e.jsx("div",{className:"text-left flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-semibold text-[15px]",style:{color:"var(--t-text)"},children:f.code}),N&&e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:N})]})}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:y}),R&&e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"var(--t-success, #4CD964)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})]}),p<h.length-1&&e.jsx("div",{style:{height:1,background:"var(--t-divider, rgba(255,255,255,0.08))"}})]},`${f.code}-${f.chain}`)}),h.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No currencies found"})]})]})}function rn({methods:t,selectedId:a,onSelect:n,onClose:r}){const[o,d]=c.useState(""),u=c.useMemo(()=>{const s=o.trim().toLowerCase();if(!s){if(a){const l=t.find(m=>m.id===a);if(l){const m=t.filter(h=>h.id!==a);return[l,...m]}}return t}return t.filter(l=>l.id.toLowerCase().includes(s)||l.name.toLowerCase().includes(s)||l.description&&l.description.toLowerCase().includes(s))},[t,o,a]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(ge,{onClick:r})}),e.jsx("h2",{className:"text-center text-[17px] font-medium mt-2 mb-6",style:{color:"var(--t-text)",fontSize:17,fontWeight:500,marginTop:8,marginBottom:24},children:"Choose payment method"}),e.jsx(ke,{value:o,onChange:d}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[u.map((s,l)=>{const m=s.id===a,h=ua(s.id,s.name);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>n(s.id),className:`flex w-full transition-colors rounded-lg hover-item ${s.description?"items-start":"items-center"}`,style:{color:"var(--t-text)",gap:14,padding:"18px 8px",margin:"0 -8px"},children:[e.jsx("span",{className:`flex items-center justify-center shrink-0 ${s.description?"mt-0.5":""}`,style:{width:32,height:32},children:ma(s.id,s.icon,32)}),e.jsxs("div",{className:"text-left flex-1",children:[e.jsx("div",{className:"font-semibold text-[15px] leading-tight",style:{color:"var(--t-text)"},children:h}),s.description&&e.jsx("div",{className:"text-[13px] leading-snug mt-1",style:{color:"var(--t-text-secondary)"},children:s.description})]}),m&&e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"shrink-0 mt-1",children:e.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"var(--t-success, #4CD964)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),l<u.length-1&&e.jsx("div",{style:{height:1,background:"var(--t-divider, rgba(255,255,255,0.08))"}})]},s.id)}),u.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No payment methods found"})]})]})}function Na({checked:t,onChange:a,accentColor:n="var(--t-accent)"}){return e.jsx("button",{onClick:()=>a(!t),className:"relative shrink-0 transition-colors duration-200",style:{width:48,height:28,borderRadius:14,backgroundColor:t?n:"var(--t-border)"},children:e.jsx("div",{className:"absolute top-[3px] rounded-full bg-white shadow transition-transform duration-200",style:{width:22,height:22,transform:t?"translateX(23px)":"translateX(3px)"}})})}const on=[{label:"Privacy policy",href:"https://nowramp.com/privacy-policy"},{label:"Terms of use",href:"https://nowramp.com/terms-and-conditions"}];function wa({onClose:t,darkMode:a,onToggleDarkMode:n,skinId:r,onSelectSkin:o,showThemeToggle:d=!0,country:u,countryName:s,onLocationPress:l,assetBaseUrl:m=""}){const[h,f]=c.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end items-center px-5 pt-5",children:e.jsx(ge,{onClick:t})}),e.jsxs("div",{className:"px-5 flex-1 pt-6 overflow-y-auto custom-scroll",children:[l&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{borderTop:"1px solid var(--t-divider)"},children:e.jsxs("button",{onClick:l,className:"flex items-center justify-between w-full py-5 transition-colors",style:{color:"inherit",background:"none",border:"none",cursor:"pointer",padding:"20px 0"},children:[e.jsxs("div",{className:"flex items-center gap-3.5",children:[u&&!h?e.jsx("img",{src:`${m}/flags/${u.toLowerCase()}.svg`,alt:u,width:40,height:40,style:{width:40,height:40,borderRadius:"50%",objectFit:"cover"},onError:()=>f(!0)}):e.jsx(sn,{size:40}),e.jsxs("div",{className:"text-left",children:[e.jsx("span",{className:"font-medium text-[15px] block",style:{color:"var(--t-text)"},children:"Location"}),s&&e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:s})]})]}),e.jsx(ft,{})]})}),e.jsx("div",{style:{height:1,background:"var(--t-divider)"}})]}),d&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{borderTop:l?"none":"1px solid var(--t-divider)"},children:e.jsxs("div",{className:"flex items-center justify-between w-full py-5",children:[e.jsxs("div",{className:"flex items-center gap-3.5",children:[e.jsx(ca,{size:40}),e.jsx("span",{className:"font-medium text-[15px]",style:{color:"var(--t-text)"},children:"Dark Mode"})]}),e.jsx(Na,{checked:a,onChange:n,accentColor:"#4CD964"})]})}),e.jsx("div",{style:{height:1,background:"var(--t-divider)"}})]}),on.map(p=>e.jsxs("div",{children:[e.jsxs("a",{href:p.href,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between w-full py-5 transition-colors",style:{color:"inherit",textDecoration:"none"},children:[e.jsx("span",{className:"font-medium text-[15px]",style:{color:"var(--t-text)"},children:p.label}),e.jsx(ft,{})]}),e.jsx("div",{style:{height:1,background:"var(--t-divider)"}})]},p.label))]})]})}function sn({size:t=40}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 40 40",fill:"none",children:[e.jsx("circle",{cx:"20",cy:"20",r:"18",stroke:"var(--t-text-secondary)",strokeWidth:"1.5",fill:"none"}),e.jsx("ellipse",{cx:"20",cy:"20",rx:"9",ry:"18",stroke:"var(--t-text-secondary)",strokeWidth:"1.5",fill:"none"}),e.jsx("line",{x1:"2",y1:"20",x2:"38",y2:"20",stroke:"var(--t-text-secondary)",strokeWidth:"1.5"}),e.jsx("path",{d:"M5 12h30M5 28h30",stroke:"var(--t-text-secondary)",strokeWidth:"1.2"})]})}function Ea({onClose:t,onSelect:a,assetBaseUrl:n="",selectedCode:r}){const[o,d]=c.useState(""),u=c.useMemo(()=>{const s=o.trim().toLowerCase();if(!s){if(r){const l=r.toLowerCase(),m=Je[l];if(m){const h=Ie.filter(f=>f.code!==l);return[m,...h]}}return Ie}return Ie.filter(l=>l.name.toLowerCase().includes(s)||l.code.includes(s)||l.defaultFiat.toLowerCase().includes(s))},[o,r]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(ge,{onClick:t})}),e.jsx("h2",{className:"text-center text-[17px] font-medium mt-2 mb-6",style:{color:"var(--t-text)",fontSize:17,fontWeight:500,marginTop:8,marginBottom:24},children:"Select your country"}),e.jsx(ke,{value:o,onChange:d}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[u.map((s,l)=>{const m=(r==null?void 0:r.toLowerCase())===s.code;return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>a(s.code),className:"flex items-center w-full transition-colors rounded-lg hover-item",style:{color:"var(--t-text)",gap:14,padding:"18px 8px",margin:"0 -8px"},children:[e.jsx(ln,{code:s.code,size:32,baseUrl:n}),e.jsxs("div",{className:"text-left flex-1",children:[e.jsx("span",{className:"font-semibold text-[15px]",children:s.name}),e.jsx("span",{className:"text-[13px] ml-2",style:{color:"var(--t-text-secondary)"},children:s.defaultFiat})]}),m&&e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"var(--t-success, #4CD964)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),l<u.length-1&&e.jsx("div",{style:{height:1,background:"var(--t-divider, rgba(255,255,255,0.08))"}})]},s.code)}),u.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No countries found"})]})]})}function ln({code:t,size:a=32,baseUrl:n=""}){const[r,o]=c.useState(!1);return r?e.jsx("div",{style:{width:a,height:a,borderRadius:"50%",background:"var(--t-pill-bg, #333)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:a*.4,color:"var(--t-text-muted)"},children:t.toUpperCase().slice(0,2)}):e.jsx("img",{src:`${n}/flags/${t}.svg`,alt:t,width:a,height:a,style:{width:a,height:a,borderRadius:"50%",objectFit:"cover"},onError:()=>o(!0)})}function cn({className:t="",theme:a="dark",skinId:n="mono",accentColor:r,bgColor:o,bgImage:d,borderColor:u,borderRadius:s,surfaceColor:l,inputBgColor:m,textColor:h,textSecondaryColor:f,textMutedColor:p,successColor:g,showFlowToggle:y=!0,showSettings:N=!0,showThemeToggle:R=!0,autoRedirect:H=!1,explorerUrl:J,doneButtonText:P="Done",supportEmail:Y,stablecoinParity:X,partnerName:_,onDone:ue}){var kt,Tt,Lt,Ut,Ft,Dt,Mt,It,Bt;const{state:S,dispatch:k,config:i,configLoading:T,quotes:j,quotesLoading:v,quotesError:Z,fetchQuotes:me,createOrder:fe,orderLoading:te,amountError:le,fieldLocks:U,apiConfig:Q,assetBaseUrl:D,availableFiats:ae,availableCryptos:Te,availablePaymentMethods:G,selectionUnsupported:q}=Ce(),[$,Se]=c.useState(a==="dark"),[ve,tt]=c.useState(n),[ne,M]=c.useState(null),[Le,be]=c.useState(!1),[Ue,Be]=c.useState(!1),[ee,Oe]=c.useState(!1),[he,Fe]=c.useState(!1),[He,re]=c.useState(null),[De,at]=c.useState(!0),[nt,Pe]=c.useState(!1),[oe,x]=c.useState(!1),w=c.useRef(null),E=c.useRef(),L=c.useRef(S.flowType);c.useEffect(()=>{Se(a==="dark")},[a]),c.useEffect(()=>{const C=setTimeout(()=>at(!1),T?0:800);return()=>clearTimeout(C)},[T]),c.useEffect(()=>{if(L.current!==S.flowType&&!De){L.current=S.flowType,Pe(!0),be(!1),Be(!1);const C=setTimeout(()=>Pe(!1),350);return()=>clearTimeout(C)}L.current=S.flowType},[S.flowType,De]);const F=S.flowType,A=F==="buy",I=S.cryptoCurrency||"BTC",V=S.fiatCurrency||"USD",rt=A?S.fiatAmount:S.cryptoAmount,W=qt(rt),ce=(kt=j==null?void 0:j.bestQuote)!=null&&kt.exchangeRate?parseFloat(j.bestQuote.exchangeRate):null,Ke=c.useRef(null);ce&&I&&V&&(Ke.current={rate:ce,crypto:I,fiat:V});const Ct=c.useMemo(()=>{if(j!=null&&j.bestQuote){const C=A?j.bestQuote.cryptoAmount:j.bestQuote.fiatAmount;if(C)return C}return"0"},[j,A]),Me=!!(X&&_&&A&&yt(I)&&ce),Aa=Me&&I.toUpperCase().includes(V.toUpperCase()),gt=Me&&W>0?Ze(Aa?W:W/ce):null,ka=Me&&gt?gt:Ct,Ta=c.useMemo(()=>{var K,xe,Ne;const C=ce||((K=Ke.current)==null?void 0:K.rate),b=ce?I:(xe=Ke.current)==null?void 0:xe.crypto,B=ce?V:(Ne=Ke.current)==null?void 0:Ne.fiat;return!C||!b||!B?"":`1 ${b} ≈ ${C.toFixed(2)} ${B}`},[I,V,ce]);c.useEffect(()=>{const C=S.walletAddress.trim(),b=S.network;if(!C||C.length<10){re(null),k({type:"SET_WALLET_ERROR",message:""});return}Fe(!0),re(null);const B=new AbortController;return clearTimeout(E.current),E.current=setTimeout(async()=>{var K,xe,Ne;try{const it=await(await fetch(`${Q.apiUrl}/public/validate/address`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:C,...b?{network:b}:{}}),signal:B.signal})).json(),lt=((K=it.data)==null?void 0:K.attributes)||it.data||it;if(lt.isValid)re(!0),k({type:"SET_WALLET_ERROR",message:""});else{re(!1);const _a=((xe=lt.errors)==null?void 0:xe[0])||((Ne=lt.details)==null?void 0:Ne.formatMessage)||"Invalid wallet address";k({type:"SET_WALLET_ERROR",message:_a})}}catch(st){if(st instanceof DOMException&&st.name==="AbortError")return;re(null)}finally{B.signal.aborted||Fe(!1)}},500),()=>{clearTimeout(E.current),B.abort()}},[S.walletAddress,S.network,Q.apiUrl]);const St=!rt||W===0,vt=W>0&&(A?W<Pt:W<Kt),bt=!!le||vt||Le&&St,La=W>0&&!le&&!vt,ot=S.walletAddress.trim().length>=10&&He!==!1&&!he,_e=La&&ot&&!!S.cryptoCurrency&&!!S.network,Ua=C=>{let b=C.target.value.replace(/[^0-9.,]/g,"");const B=A?2:6,K=b.indexOf(".");K!==-1&&b.length-K-1>B&&(b=b.slice(0,K+B+1)),k(A?{type:"SET_FIAT_AMOUNT",amount:b}:{type:"SET_CRYPTO_AMOUNT",amount:b})},jt=C=>{C!==F&&k({type:"SET_FLOW_TYPE",flowType:C,fieldLocks:U})},Fa=c.useCallback(C=>{k({type:"SET_FIAT_CURRENCY",currency:C})},[k]),Da=c.useCallback((C,b)=>{k({type:"SET_CRYPTO_CURRENCY",currency:C}),k({type:"SET_CRYPTO_CHAIN",chain:b})},[k]),Ma=c.useCallback(C=>{k({type:"SET_PAYMENT_METHOD",methodId:C})},[k]),Ia=c.useCallback(C=>{k({type:"SET_COUNTRY",country:C}),M(null)},[k]),Ba=c.useCallback(()=>{M(null),setTimeout(()=>M("country"),280)},[]),Oa=S.country?(Tt=Je[S.country.toLowerCase()])==null?void 0:Tt.name:void 0,Ha=()=>{_e&&(x(!0),me())};c.useEffect(()=>{var C;if(!(!oe||v)){if(j!=null&&j.bestQuote)x(!1),k({type:"SELECT_QUOTE",quote:j.bestQuote}),fe().catch(()=>{});else if(Z)x(!1),k({type:"SET_ERROR",message:Z.message||"No quotes available"});else if(j&&!j.bestQuote){x(!1);const b=(C=j.unavailableGateways)==null?void 0:C.map(K=>K.reason).filter(Boolean),B=b!=null&&b.length?`No providers available: ${b.join("; ")}`:"No providers available for this currency/network combination";k({type:"SET_ERROR",message:B})}}},[oe,j,v,Z,k,fe]);const Nt=$?"theme-dark":"theme-light",Ve=dt.find(C=>C.id===ve)||dt[0],Pa=Ve.accent===null,Ka=r?ie(r):!1,wt=C=>{const b=C.replace("#",""),B=parseInt(b.substring(0,2),16),K=parseInt(b.substring(2,4),16),xe=parseInt(b.substring(4,6),16);return(.299*B+.587*K+.114*xe)/255>.5?"#000000":"#ffffff"},Et=Ka?{"--t-accent":r,"--t-cta-bg":r,"--t-cta-text":wt(r)}:Pa?{"--t-accent":$?"#ffffff":"#111111","--t-cta-bg":$?"#ffffff":"#111111","--t-cta-text":$?"#000000":"#ffffff"}:{"--t-accent":Ve.accent,"--t-cta-bg":Ve.accent,"--t-cta-text":wt(Ve.accent)},z={};l&&ie(l)&&(z["--t-surface"]=l,z["--t-modal-bg"]=l),m&&ie(m)&&(z["--t-pill-bg"]=m,z["--t-close-bg"]=m),h&&ie(h)&&(z["--t-text"]=h),f&&ie(f)&&(z["--t-text-secondary"]=f),p&&ie(p)&&(z["--t-text-muted"]=p,z["--t-text-tertiary"]=p),g&&ie(g)&&(z["--t-success"]=g);const pe={};o&&ie(o)?pe.backgroundColor=o:pe.backgroundColor="var(--t-bg)",d&&(d.startsWith("https://")||d.startsWith("data:image/"))&&(pe.backgroundImage=`url(${d})`,pe.backgroundSize="cover",pe.backgroundPosition="center");const Ge=$?"#ffffff":"#111111",Ye={};u&&ie(u)&&(Ye.border=`1px solid ${u}`),s&&(Ye.borderRadius=s);const Rt=S.step==="checkout"?e.jsx(ha,{autoRedirect:H}):S.step==="processing"?e.jsx(pa,{}):S.step==="complete"?e.jsx(xa,{explorerUrl:J,doneButtonText:P,onDone:ue}):S.step==="error"?e.jsx(ya,{supportEmail:Y}):S.step==="confirm"?e.jsx(Ca,{stablecoinParity:Me,partnerName:_}):null;if(Rt)return e.jsx("div",{className:`${Nt} relative w-full max-w-[390px] h-[640px] overflow-hidden flex flex-col select-none transition-colors duration-300 ${t}`,style:{fontFamily:"'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",...pe,...Et,...z,...Ye},children:Rt});const se=S.network,je=se?We(se):null,At=(je==null?void 0:je.shortName)||(je==null?void 0:je.name)||se;return e.jsxs("div",{className:`${Nt} relative w-full max-w-[390px] min-h-[640px] overflow-hidden flex flex-col select-none transition-colors duration-300 ${t}`,style:{fontFamily:"'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",...pe,...Et,...z,...Ye},children:[N&&e.jsx("div",{className:`flex justify-end items-center px-5 pt-3 ${y?"pb-1":"pb-5"}`,children:e.jsx(la,{onClick:()=>M("settings")})}),y?e.jsxs("div",{className:"flex flex-col items-center pt-3 pb-5",children:[e.jsxs("div",{className:"flex",style:{width:165},children:[e.jsx("button",{onClick:()=>jt("buy"),className:"flex-1 pb-2.5 text-[16px] font-medium text-center transition-colors duration-200",style:{color:F==="buy"?"var(--t-text)":"var(--t-text-secondary)"},children:"Buy"}),e.jsx("button",{onClick:()=>jt("sell"),className:"flex-1 pb-2.5 text-[16px] font-medium text-center transition-colors duration-200",style:{color:F==="sell"?"var(--t-text)":"var(--t-text-secondary)"},children:"Sell"})]}),e.jsxs("div",{className:"relative",style:{width:165,height:1},children:[e.jsx("div",{className:"absolute inset-0",style:{background:"var(--t-divider)"}}),e.jsx("div",{className:"absolute top-0 h-full transition-all duration-300 ease-in-out",style:{width:"50%",left:F==="buy"?"0%":"50%",background:"var(--t-accent)"}})]})]}):null,De||nt||T?e.jsx(va,{}):e.jsxs("div",{className:"flex-1 overflow-hidden px-5 flex flex-col tab-fade-in",children:[e.jsxs("div",{className:"px-[18px] pt-[14px] pb-[18px]",style:{background:"var(--t-surface)",borderRadius:5,border:Le&&bt?"1px solid #EF4444":"1px solid transparent",minHeight:102},children:[e.jsx("div",{className:"text-[13px] mb-2.5",style:{color:"var(--t-text-secondary)"},children:"You spend"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("input",{ref:w,type:"text",value:rt,onChange:Ua,onBlur:()=>be(!0),placeholder:A?"250":"0.01",className:"bg-transparent outline-none w-0 flex-1 mr-3",style:{color:"var(--t-text)",fontSize:24,fontWeight:600,lineHeight:"32px",padding:0,border:"none",borderRadius:0,backgroundColor:"transparent",height:"auto",width:0},inputMode:"decimal",disabled:!!((Lt=U==null?void 0:U.sourceAmount)!=null&&Lt.locked)}),A?e.jsxs("button",{onClick:()=>M("fiat"),className:"flex items-center gap-1.5 shrink-0 transition-colors",style:{background:"var(--t-pill-bg)",borderRadius:4,height:32,paddingLeft:10,paddingRight:10},disabled:!!((Ut=U==null?void 0:U.sourceCurrency)!=null&&Ut.locked),children:[e.jsx(Qe,{currencyCode:V,size:16,baseUrl:D}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:Ge},children:V}),e.jsx(Ae,{})]}):e.jsxs("div",{className:"flex flex-col items-end shrink-0",children:[e.jsxs("button",{onClick:()=>M("crypto"),className:"flex items-center gap-1.5 transition-colors",style:{background:"var(--t-pill-bg)",borderRadius:4,height:32,paddingLeft:10,paddingRight:10},disabled:!!((Ft=U==null?void 0:U.destinationCurrency)!=null&&Ft.locked),children:[e.jsx(mt,{ticker:I,size:16,baseUrl:D}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:Ge},children:I}),e.jsx(Ae,{})]}),se&&e.jsxs("div",{className:"flex items-center gap-1 mt-1.5 mr-0.5",children:[e.jsx("div",{className:"rounded-full",style:{width:14,height:14,background:"#ffffff"},children:e.jsx("img",{src:Xe(se,D),alt:se,width:14,height:14,className:"rounded-full",style:{width:14,height:14}})}),e.jsx("span",{className:"text-[12px]",style:{color:"var(--t-text-secondary)"},children:At})]})]})]})]}),Le&&bt&&e.jsx("div",{className:"text-[12px] mt-1.5 px-[2px]",style:{color:"#EF4444"},children:le||(St?"Amount should be more than 0":A?`Minimum amount is ${Pt} ${V}`:`Minimum amount is ${Kt} ${I}`)}),e.jsxs("div",{className:"px-[18px] pt-[12px] pb-[14px]",style:{background:"var(--t-surface)",borderTopLeftRadius:5,borderTopRightRadius:5,borderBottomLeftRadius:0,borderBottomRightRadius:0,marginTop:4,minHeight:102},children:[e.jsx("div",{className:"text-[13px] mb-2.5",style:{color:"var(--t-text-secondary)"},children:"You get"}),e.jsxs("div",{className:"flex items-start justify-between",children:[v&&!oe?e.jsx(O,{w:180,h:32}):e.jsx(Sa,{value:W>0?ka:"0",height:32,className:"font-semibold",style:{color:W>0?"var(--t-text)":"var(--t-text-muted)",fontSize:24}}),A?e.jsxs("div",{className:"flex flex-col items-end shrink-0",children:[e.jsxs("button",{onClick:()=>M("crypto"),className:"flex items-center gap-1.5 transition-colors",style:{background:"var(--t-pill-bg)",borderRadius:4,height:32,paddingLeft:10,paddingRight:10},disabled:!!((Dt=U==null?void 0:U.destinationCurrency)!=null&&Dt.locked),children:[e.jsx(mt,{ticker:I,size:16,baseUrl:D}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:Ge},children:I}),e.jsx(Ae,{})]}),se&&e.jsxs("div",{className:"flex items-center gap-1 mt-1.5 mr-0.5",children:[e.jsx("div",{className:"rounded-full",style:{width:14,height:14,background:"#ffffff"},children:e.jsx("img",{src:Xe(se,D),alt:se,width:14,height:14,className:"rounded-full",style:{width:14,height:14}})}),e.jsx("span",{className:"text-[12px]",style:{color:"var(--t-text-secondary)"},children:At})]})]}):e.jsxs("button",{onClick:()=>M("fiat"),className:"flex items-center gap-1.5 shrink-0 transition-colors",style:{background:"var(--t-pill-bg)",borderRadius:4,height:32,paddingLeft:10,paddingRight:10},disabled:!!((Mt=U==null?void 0:U.sourceCurrency)!=null&&Mt.locked),children:[e.jsx(Qe,{currencyCode:V,size:16,baseUrl:D}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:Ge},children:V}),e.jsx(Ae,{})]})]})]}),Me&&W>0&&(j==null?void 0:j.bestQuote)&&e.jsxs("div",{className:"flex items-start gap-2 mt-[2px] px-[14px] py-[10px]",style:{background:"var(--t-surface)",fontSize:12,color:"var(--t-text-secondary)",lineHeight:"16px"},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0,marginTop:1},children:[e.jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("path",{d:"M8 7v4M8 5.5v-.01",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e.jsxs("span",{children:["You will be charged for ",Ct," ",I,", the rest up to ",Ze(W)," ",V," will be credited to your ",_," account"]})]}),e.jsx("div",{className:"flex items-center justify-between mt-[2px] px-[18px] pt-[12px] pb-[14px]",style:{background:"var(--t-surface)",...!G.length&&!((It=i==null?void 0:i.paymentMethods)!=null&&It.length)?{borderBottomLeftRadius:5,borderBottomRightRadius:5}:{}},children:e.jsx("span",{className:"text-[12px]",style:{color:g?"var(--t-success)":"var(--t-text-secondary)"},children:Ta||" "})}),(G.length>0||(i==null?void 0:i.paymentMethods)&&i.paymentMethods.length>0)&&e.jsx("div",{className:"mt-[2px]",children:G.length>0?e.jsx(fa,{methods:G,selectedId:S.paymentMethodId,onOpenModal:()=>M("payment"),fiatCurrency:S.fiatCurrency}):e.jsx("div",{className:"flex items-center justify-between px-[18px] pt-[12px] pb-[14px]",style:{background:"var(--t-surface)",borderBottomLeftRadius:5,borderBottomRightRadius:5},children:e.jsx("span",{className:"text-[12px]",style:{color:"var(--t-text-muted)"},children:"No payment methods for this pair"})})}),e.jsxs("div",{className:"mt-8",children:[e.jsx("div",{className:"text-[13px] mb-2.5",style:{color:"var(--t-text-secondary)"},children:A?"Receiving wallet address":"Sending wallet address"}),e.jsx("input",{type:"text",value:S.walletAddress,onChange:C=>k({type:"SET_WALLET_ADDRESS",address:C.target.value}),onFocus:()=>Oe(!0),onBlur:()=>{Oe(!1),Be(!0)},placeholder:A?"Enter your receiving address":"Enter your sending address",spellCheck:!1,autoComplete:"off",className:"w-full bg-transparent text-[13px] outline-none transition-colors",style:{border:S.walletError||Ue&&!ot?"1px solid #EF4444":ee?"1px solid var(--t-border-focus)":"1px solid var(--t-border)",outline:"none",boxShadow:"none",borderRadius:3.5,height:47,padding:"0 14px",color:"var(--t-text)",fontSize:13,backgroundColor:"transparent"},disabled:!!((Bt=U==null?void 0:U.destinationAddress)!=null&&Bt.locked)}),S.walletError?e.jsx("div",{className:"text-[12px] mt-1.5",style:{color:"#EF4444"},children:S.walletError}):Ue&&!ot&&!he?e.jsx("div",{className:"text-[12px] mt-1.5",style:{color:"#EF4444"},children:"Enter a valid wallet address"}):he&&S.walletAddress.trim().length>=10?e.jsx("div",{className:"text-[12px] mt-1.5",style:{color:"var(--t-text-muted)"},children:"Validating address..."}):null]}),e.jsx("div",{className:"flex-1",style:{minHeight:16}}),q&&e.jsxs("div",{className:"text-[12px] text-center mb-2",style:{color:"#EF4444"},children:["This currency is not available for ",A?"buy":"sell"," orders"]}),e.jsx("button",{disabled:!_e||te||oe||q,onClick:Ha,className:"w-full font-semibold text-[16px] transition-all",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)",opacity:_e&&!te&&!oe&&!q?1:.4,cursor:_e&&!te&&!oe&&!q?"pointer":"not-allowed"},children:oe?"Getting best price...":te?"Processing...":A?`Buy ${I}`:`Sell ${I}`}),e.jsx("div",{className:"text-center py-3",children:e.jsx("span",{className:"text-[11px]",style:{color:"var(--t-text-tertiary)"},children:"Powered by NowRamp"})})]},F),e.jsx(Re,{isOpen:ne==="fiat",onClose:()=>M(null),children:C=>e.jsx(ba,{onClose:C,onSelect:b=>{Fa(b),C()},currencies:ae.map(b=>({code:b.code,name:b.code})),assetBaseUrl:D,selectedCode:S.fiatCurrency})}),e.jsx(Re,{isOpen:ne==="crypto",onClose:()=>M(null),children:C=>e.jsx(ja,{onClose:C,onSelect:(b,B)=>{Da(b,B),C()},cryptos:Te.map(b=>{var B;return{code:b.code,name:b.code,networks:(B=b.networks)==null?void 0:B.map(K=>({code:K.id,name:K.name}))}}),assetBaseUrl:D,selectedCode:S.cryptoCurrency,selectedChain:S.network})}),e.jsx(Re,{isOpen:ne==="payment",onClose:()=>M(null),children:C=>e.jsx(rn,{methods:G,selectedId:S.paymentMethodId,onSelect:b=>{Ma(b),C()},onClose:C})}),e.jsx(Re,{isOpen:ne==="settings",onClose:()=>M(null),children:C=>e.jsx(wa,{onClose:C,darkMode:$,onToggleDarkMode:Se,skinId:ve,onSelectSkin:b=>{tt(b)},showThemeToggle:R,country:S.country,countryName:Oa,onLocationPress:Ba,assetBaseUrl:D})}),e.jsx(Re,{isOpen:ne==="country",onClose:()=>M(null),children:C=>e.jsx(Ea,{onClose:C,onSelect:b=>{Ia(b),C()},assetBaseUrl:D,selectedCode:S.country})})]})}function Ra({projectId:t,apiUrl:a,assetBaseUrl:n,flowType:r,customerId:o,brandId:d,defaultFiatCurrency:u,defaultCryptoCurrency:s,defaultNetwork:l,defaultFiatAmount:m,defaultCryptoAmount:h,defaultWalletAddress:f,defaultGateway:p,defaultCountry:g,fieldLocks:y,statusPollInterval:N,onComplete:R,onError:H,className:J,theme:P,skinId:Y,accentColor:X,bgColor:_,bgImage:ue,borderColor:S,borderRadius:k,surfaceColor:i,inputBgColor:T,textColor:j,textSecondaryColor:v,textMutedColor:Z,successColor:me,showFlowToggle:fe,showSettings:te,showThemeToggle:le,autoRedirect:U,explorerUrl:Q,doneButtonText:D,supportEmail:ae,stablecoinParity:Te,partnerName:G,onDone:q}){return e.jsx(Qt,{projectId:t,apiUrl:a,assetBaseUrl:n,flowType:r,customerId:o,brandId:d,defaultFiatCurrency:u,defaultCryptoCurrency:s,defaultNetwork:l,defaultFiatAmount:m,defaultCryptoAmount:h,defaultWalletAddress:f,defaultGateway:p,defaultCountry:g,fieldLocks:y,statusPollInterval:N,onComplete:R,onError:H,children:e.jsx(cn,{className:J,theme:P,skinId:Y,accentColor:X,bgColor:_,bgImage:ue,borderColor:S,borderRadius:k,surfaceColor:i,inputBgColor:T,textColor:j,textSecondaryColor:v,textMutedColor:Z,successColor:me,showFlowToggle:fe,showSettings:te,showThemeToggle:le,autoRedirect:U,explorerUrl:Q,doneButtonText:D,supportEmail:ae,stablecoinParity:Te,partnerName:G,onDone:q})})}function dn({submitButtonText:t,rateRefreshInterval:a,...n}){return e.jsx(Ra,{...n})}function un({skin:t,active:a,onClick:n,darkMode:r,dimmed:o}){const d=t.accent===null,u=32;return e.jsxs("button",{onClick:n,className:"relative shrink-0",style:{width:u,height:u,opacity:o?.4:1,transition:"opacity 0.2s"},children:[d?e.jsxs("svg",{width:u,height:u,viewBox:"0 0 32 32",children:[e.jsx("clipPath",{id:"mono-left",children:e.jsx("rect",{x:"0",y:"0",width:"16",height:"32"})}),e.jsx("clipPath",{id:"mono-right",children:e.jsx("rect",{x:"16",y:"0",width:"16",height:"32"})}),e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:"#111111",clipPath:"url(#mono-left)"}),e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:"#ffffff",clipPath:"url(#mono-right)"}),e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:"none",stroke:r?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.1)",strokeWidth:"1"})]}):e.jsx("svg",{width:u,height:u,viewBox:"0 0 32 32",children:e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:t.accent})}),a&&!o&&e.jsx("div",{className:"absolute inset-0 rounded-full",style:{boxShadow:"0 0 0 2px var(--t-bg), 0 0 0 4px var(--t-text)"}})]})}function mn({quote:t}){return t.isBestRate?e.jsx("div",{className:"text-[12px]",style:{color:"var(--t-text-secondary)"},children:"Best price"}):t.isRecommended?e.jsx("div",{className:"text-[12px]",style:{color:"var(--t-text-secondary)"},children:"Recommended"}):t.rank&&t.rank<=3?e.jsxs("div",{className:"text-[12px]",style:{color:"var(--t-text-secondary)"},children:["#",t.rank]}):null}function fn({quote:t}){return t.gatewayLogo?e.jsx("img",{src:t.gatewayLogo,alt:t.gatewayName,width:36,height:36,className:"rounded-full shrink-0",style:{width:36,height:36}}):e.jsx(et,{size:36})}function hn(){return e.jsx("div",{className:"space-y-2",children:[0,1,2].map(t=>e.jsxs("div",{className:"w-full flex items-center gap-3.5",style:{borderRadius:5,height:64,paddingLeft:16,paddingRight:16,background:"var(--t-surface)"},children:[e.jsx(O,{w:36,h:36,className:"rounded-full shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx(O,{w:90,h:14,className:"mb-1.5"}),e.jsx(O,{w:60,h:12})]}),e.jsxs("div",{className:"text-right",children:[e.jsx(O,{w:40,h:10,className:"mb-1.5"}),e.jsx(O,{w:80,h:14})]})]},t))})}function pn({onClose:t,onSelect:a,quotes:n,quotesLoading:r,cryptoCurrency:o}){const[d,u]=c.useState(""),s=c.useMemo(()=>{if(!(n!=null&&n.quotes))return[];const l=d.trim().toLowerCase();return l?n.quotes.filter(m=>m.gatewayName.toLowerCase().includes(l)):n.quotes},[n,d]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(ge,{onClick:t})}),e.jsx("h2",{className:"text-center text-[17px] font-medium mt-2 mb-6",style:{color:"var(--t-text)",fontSize:17,fontWeight:500,marginTop:8,marginBottom:24},children:"Choose Ramp"}),e.jsx(ke,{value:d,onChange:u}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5 space-y-2",children:[r?e.jsx(hn,{}):s.length===0?e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:n&&n.quotes.length===0?"No quotes available for this request":"No providers found"}):s.map((l,m)=>{const h=m===0,f=parseFloat(l.cryptoAmount),p=f>=1?f.toFixed(4):f.toPrecision(6);return e.jsxs("button",{onClick:()=>a(l),className:"w-full flex items-center gap-3.5 transition-colors",style:{borderRadius:h?4.5:5,height:h?63:64,paddingLeft:16,paddingRight:16,border:h?"1px solid var(--t-border)":"1px solid transparent",background:h?"transparent":"var(--t-surface)"},children:[e.jsx(fn,{quote:l}),e.jsxs("div",{className:"text-left flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-[15px]",style:{color:"var(--t-text)"},children:l.gatewayName}),e.jsx(mn,{quote:l})]}),e.jsxs("div",{className:"text-right shrink-0",children:[e.jsx("div",{className:"text-[11px]",style:{color:"var(--t-text-secondary)"},children:"You get"}),e.jsxs("div",{className:"font-medium text-[14px]",style:{color:"var(--t-text)"},children:[o," ",p]})]})]},l.gatewayId)}),!r&&(n==null?void 0:n.unavailableGateways)&&n.unavailableGateways.length>0&&e.jsx("div",{className:"pt-3",children:n.unavailableGateways.map(l=>e.jsxs("div",{className:"flex items-center justify-between py-2 text-[12px]",style:{color:"var(--t-text-muted)"},children:[e.jsx("span",{children:l.gatewayName}),e.jsx("span",{children:l.reason})]},l.gatewayId))})]})]})}exports.AnimatedDigit=ga;exports.AnimatedNumber=Sa;exports.ApplePayIcon=ra;exports.BLOCKCHAINS=Ee;exports.BankIcon=aa;exports.COUNTRIES=Ie;exports.COUNTRY_MAP=Je;exports.CRYPTO_CHAIN_COMBOS=ea;exports.CRYPTO_CURRENCIES=pt;exports.CardIcon=ia;exports.CheckoutForm=dn;exports.CheckoutStep=ha;exports.ChevronDown=Ae;exports.ChevronRight=ft;exports.ChooseRampModal=pn;exports.CloseButton=ge;exports.CoinifyIcon=en;exports.CompleteStep=xa;exports.ConfirmStep=Ca;exports.CountryPickerModal=Ea;exports.CryptoCurrencyModal=ja;exports.CryptoIcon=mt;exports.DarkModeIcon=ca;exports.ErrorStep=ya;exports.FIAT_CURRENCIES=ct;exports.FIAT_TO_COUNTRY=zt;exports.FiatCurrencyModal=ba;exports.FiatFlag=Qe;exports.FormSkeleton=va;exports.GenericCoinIcon=et;exports.GooglePayIcon=oa;exports.MOCK_RATES=ut;exports.MenuIcon=la;exports.Modal=Re;exports.PayPalIcon=sa;exports.PaymentMethodSelector=fa;exports.ProcessingStep=pa;exports.RampForm=Ra;exports.RampProvider=Qt;exports.RevolutIcon=na;exports.SKINS=dt;exports.SearchInput=ke;exports.SettingsScreen=wa;exports.Skeleton=O;exports.SkinSwatch=un;exports.ToggleSwitch=Na;exports.formatOutput=Ze;exports.getChainIconUrl=Xe;exports.getCryptoIconUrl=xt;exports.getDefaultFiatForCountry=$e;exports.getFiatFlagUrl=Jt;exports.getMockRate=za;exports.getPaymentIcon=da;exports.isStablecoin=yt;exports.parseAmount=qt;exports.useCheckoutIntent=$t;exports.useQuotes=Yt;exports.useRamp=Ce;exports.useRampConfig=Gt;exports.useTransaction=Wt;
12
12
  //# sourceMappingURL=index.cjs.map