@nowramp/form 0.1.81 → 0.1.82
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 +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +439 -428
- package/dist/index.js.map +1 -1
- package/dist/nowramp-form.iife.js +10 -10
- package/dist/nowramp-form.iife.js.map +1 -1
- package/package.json +2 -2
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"),c=require("react"),qe=require("@nowramp/sdk"),Pt=require("react-dom");function $t(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 qe.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 Wt(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 qe.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 Xt(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 qe.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 Zt(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 qe.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 Oe=[{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"}],et=Object.fromEntries(Oe.map(t=>[t.code,t]));function Xe(t,a){if(!t)return"USD";const n=et[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 tt=!0;function xt(t,a,n=tt){return t===void 0||a===void 0?n:t.length===0||a.length===0?!1:t.some(r=>a.includes(r))}function Ya(t,a,n=tt){return t.filter(r=>xt(r.providers,a,n))}function $a(t,a,n=tt){const r=[];for(const o of t){const d=o.networks.filter(u=>xt(u.providers,a,n));d.length>0&&r.push(d.length===o.networks.length?o:{...o,networks:d})}return r}function Wa(t,a,n,r=tt){return n?t.filter(o=>o.supportedFiats.includes(n)&&xt(o.providers,a,r)):[]}function Xa(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 Za(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 Kt(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}function Qa(t,a,n){return!t&&!!a&&!a.bestQuote&&!!n}const Qt={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 za(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 Qt;default:return t}}const zt=c.createContext(null);function Jt({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:w=5e3,onComplete:R,onError:P,children:q}){const K=c.useMemo(()=>({apiUrl:a,projectId:t}),[a,t]),$=l||(s?s.toLowerCase():""),Z=r==="sell",V=Z?!!h:!!m,S=(Z?!!(V&&s&&$):!!(V&&s&&$&&f))&&p?"confirm":"amount",k=m||(r==="buy"?"250":""),[i,T]=c.useReducer(za,{...Qt,step:S,flowType:r,fiatCurrency:u,cryptoCurrency:s,network:$,fiatAmount:Kt(k,2),cryptoAmount:Kt(h,6),walletAddress:f,customerId:o,...g?{country:g.toLowerCase(),countrySource:"manual"}:{}}),j=i.flowType==="sell",{config:v,loading:W,error:fe}=$t(K,i.flowType,i.country||void 0),he=c.useRef(!1);c.useEffect(()=>{var L;if(he.current||!(v!=null&&v.detectedCountry)||i.country)return;he.current=!0;const x=v.detectedCountry.toLowerCase();T({type:"SET_COUNTRY_AUTO",country:x});const N=(L=v.fiats)==null?void 0:L.map(F=>F.code),E=Xe(x,N);E!==i.fiatCurrency&&T({type:"SET_FIAT_CURRENCY",currency:E})},[v,i.country,i.fiatCurrency]);const ae=c.useRef(!1);c.useEffect(()=>{var E;if(ae.current||!g||!((E=v==null?void 0:v.fiats)!=null&&E.length))return;ae.current=!0;const x=v.fiats.map(L=>L.code),N=Xe(g,x);N!==i.fiatCurrency&&T({type:"SET_FIAT_CURRENCY",currency:N})},[g,v,i.fiatCurrency]);const ce=c.useRef(i.country);c.useEffect(()=>{var E;if(i.country===ce.current||(ce.current=i.country,i.countrySource==="manual"&&(re.current=!1),i.countrySource!=="manual")||!((E=v==null?void 0:v.fiats)!=null&&E.length))return;const x=v.fiats.map(L=>L.code),N=Xe(i.country,x);N!==i.fiatCurrency&&T({type:"SET_FIAT_CURRENCY",currency:N})},[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 N=parseFloat(i.fiatAmount),E=parseFloat(x.minAmount);!isNaN(N)&&!isNaN(E)&&N<E&&T({type:"SET_FIAT_AMOUNT",amount:String(Math.ceil(E))})},[i.fiatCurrency,i.fiatAmount,v,j]);const{availableFiats:Q,availableCryptos:D,availablePaymentMethods:ne}=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(G=>G.code===i.cryptoCurrency),B=(L=A==null?void 0:A.networks)==null?void 0:L.find(G=>G.id===i.network);!A||!B?x=[]:x=B.providers}let N;if(i.fiatCurrency){const A=(F=v.fiats)==null?void 0:F.find(B=>B.code===i.fiatCurrency);A?N=A.providers:N=[]}return{availableFiats:Ya(v.fiats??[],x),availableCryptos:$a(v.cryptos??[],N),availablePaymentMethods:Wa(v.paymentMethods??[],x,i.fiatCurrency)}},[v,i.cryptoCurrency,i.network,i.fiatCurrency]),Le=c.useMemo(()=>{var x,N,E;return W||!v?!1:Za(v,{cryptoCurrency:i.cryptoCurrency,network:i.network,fiatCurrency:i.fiatCurrency},{cryptoLocked:!!((x=y==null?void 0:y.destinationCurrency)!=null&&x.locked),networkLocked:!!((N=y==null?void 0:y.network)!=null&&N.locked),fiatLocked:!!((E=y==null?void 0:y.sourceCurrency)!=null&&E.locked)},{availableFiats:Q,availableCryptos:D,availablePaymentMethods:ne})},[W,v,y,i.cryptoCurrency,i.network,i.fiatCurrency,Q,D,ne]);c.useEffect(()=>{var N,E,L;if(W||Q.length===0&&D.length===0)return;const x=Xa({cryptoCurrency:i.cryptoCurrency,network:i.network,fiatCurrency:i.fiatCurrency,paymentMethodId:i.paymentMethodId},{availableFiats:Q,availableCryptos:D,availablePaymentMethods:ne},{cryptoLocked:!!((N=y==null?void 0:y.destinationCurrency)!=null&&N.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}))},[W,Q,D,ne,i.cryptoCurrency,i.network,i.fiatCurrency,i.paymentMethodId,y,T]);const Y=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 N=v.fiats.find(F=>F.code===i.fiatCurrency);if(!N)return null;const E=parseFloat(N.minAmount),L=parseFloat(N.maxAmount);return!isNaN(E)&&x<E?`Minimum amount is ${N.minAmount} ${i.fiatCurrency}`:!isNaN(L)&&x>L?`Maximum amount is ${N.maxAmount} ${i.fiatCurrency}`:null},[v,i.fiatAmount,i.fiatCurrency,i.cryptoAmount,j]),z=c.useMemo(()=>{const x=j?!!i.cryptoAmount:!!i.fiatAmount;return!v||!x||!i.fiatCurrency||!i.cryptoCurrency||!i.network||Y||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,Y,j,i.flowType,g]),{quotes:M,loading:ve,error:ee,refetch:He}=Wt(K,z),be=Qa(ve,M,z),nt=c.useMemo(()=>!be||!(M!=null&&M.unavailableGateways)?[]:[...new Set(M.unavailableGateways.map(N=>N.reason).filter(Boolean))].slice(0,2),[be,M]),re=c.useRef(!1);c.useEffect(()=>{re.current||i.countrySource==="auto"&&(ve||!z||ee||!M||M.bestQuote||i.fiatCurrency!=="USD"&&(re.current=!0,T({type:"SET_FIAT_CURRENCY",currency:"USD"}),T({type:"SET_FIAT_AMOUNT",amount:"250"})))},[M,ve,ee,z,i.countrySource,i.fiatCurrency]);const{order:I,loading:Ue,error:je,createOrder:Fe}=Xt(K),Pe=15e3,{status:te,loading:Ke}=Zt({apiUrl:a},(I==null?void 0:I.orderId)??null,{pollInterval:w,initialDelay:Pe});c.useEffect(()=>{(te==null?void 0:te.status)==="completed"&&R&&R(te)},[te==null?void 0:te.status,R]),c.useEffect(()=>{const x=fe||je;x&&P&&P(x)},[fe,je,P]);const pe=p||(v==null?void 0:v.defaultGateway)||null,De=c.useRef(pe);De.current=pe;const _e=c.useRef(M);_e.current=M;const oe=c.useRef(d);oe.current=d;const Me=c.useCallback(async()=>{var N,E,L;const x=((N=i.selectedQuote)==null?void 0:N.gatewayId)||((L=(E=_e.current)==null?void 0:E.bestQuote)==null?void 0:L.gatewayId)||De.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 Fe({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,...oe.current?{metadata:{brand:oe.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,Fe,j]),rt=c.useCallback(x=>{T({type:"SET_STEP",step:x})},[]),ot=c.useCallback(()=>{const x=["confirm","amount","quotes","wallet","checkout","processing","complete"],N=x.indexOf(i.step);N>0&&T({type:"SET_STEP",step:x[N-1]})},[i.step,j]),Ve=c.useMemo(()=>{const x=j?!!i.cryptoAmount:!!i.fiatAmount;switch(i.step){case"confirm":return!!(x&&i.cryptoCurrency&&i.network&&i.walletAddress&&!Y);case"amount":return!!(x&&i.cryptoCurrency&&i.network&&!Y);case"quotes":return!!i.selectedQuote;case"wallet":return!!i.walletAddress;default:return!1}},[i,Y,j]),se={apiConfig:K,assetBaseUrl:n,config:v,configLoading:W,configError:fe,state:i,dispatch:T,quotes:M,quotesLoading:ve,quotesError:ee,fetchQuotes:He,order:I,orderLoading:Ue,orderError:je,createOrder:Me,orderStatus:te,orderStatusLoading:Ke,fieldLocks:y||null,defaultGateway:pe,availableFiats:Q,availableCryptos:D,availablePaymentMethods:ne,selectionUnsupported:Le,quotesEmpty:be,unavailableReasons:nt,amountError:Y,goToStep:rt,goBack:ot,canProceed:Ve};return e.jsx(zt.Provider,{value:se,children:q})}function ge(){const t=c.useContext(zt);if(!t)throw new Error("useRamp must be used within a RampProvider");return t}const Re={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"}},yt=[{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}],Ja=Object.fromEntries(yt.map(t=>[t.code,t.name])),qt={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 Ct(t,a=""){return`${a}/crypto-icons/${t.toLowerCase()}.svg`}function ea(t,a=""){const n=qt[t]||"us";return`${a}/flags/${n}.svg`}function Ze(t){return Re[t]||Re[t.toLowerCase()]||Re[t.toUpperCase()]||Re[t.toUpperCase().replace(/-/g,"_")]||Re[t.toLowerCase().replace(/-/g,"_")]}function Qe(t,a=""){const n=Ze(t);return n?`${a}/crypto-icons/${n.icon}.svg`:`${a}/crypto-icons/${t.toLowerCase()}.svg`}const ut=[{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"}],mt=[{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}],ft={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 gt(t){return qa.has(t.toUpperCase())}function en(t,a){var n,r;return((n=ft[t])==null?void 0:n[a])??((r=ft.USDC)==null?void 0:r[a])??1}function ta(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 le=t=>/^#([0-9A-Fa-f]{3}){1,2}$/.test(t),_t=10,Vt=1e-4,aa=(()=>{const t=[];for(const a of yt)for(const n of a.chains)t.push({code:a.code,name:a.name,chain:n,popular:a.popular});return t})();function na({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 ht({ticker:t,size:a=32,baseUrl:n=""}){return e.jsx(na,{src:Ct(t,n),alt:t,size:a,background:"#ffffff"})}function Je({currencyCode:t,size:a=16,baseUrl:n=""}){return e.jsx(na,{src:ea(t,n),alt:t,size:a})}function at({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 ra({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 oa({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 sa({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 ia({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 la({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 tn({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 an({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 ca({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 nn({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 ke(){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 pt(){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 da({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 ua({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 ma(t,a=32){switch(t){case"revolut":return e.jsx(oa,{size:a});case"applepay":return e.jsx(sa,{size:a});case"card":return e.jsx(ca,{size:a});case"googlepay":return e.jsx(ia,{size:a});case"paypal":return e.jsx(la,{size:a});case"bank":return e.jsx(ra,{size:a});case"visa":return e.jsx(tn,{size:a});case"mastercard":return e.jsx(an,{size:a});default:return e.jsx(at,{size:a})}}const rn={"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"},on={"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 fa(t,a){return on[t]||a}function ha(t,a,n=24){const r=rn[t];return r?ma(r,n):a?e.jsx("img",{src:a,alt:"",width:n,height:n,style:{borderRadius:"50%"}}):e.jsx(at,{size:n})}function pa({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&&ha(d.id,d.icon,20)}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:d?fa(d.id,d.name):"Select"}),e.jsx(ke,{})]})]})})}function xa({className:t="",autoRedirect:a=!1,redirectDelay:n=3e3}){var p;const{order:r,orderStatus:o,goToStep:d,goBack:u}=ge(),[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(w=>w&&w>1?w-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 Pt.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=sn(r.checkout.url,r.widgetConfig);return Pt.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 sn(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 ya({className:t=""}){const{orderStatus:a,orderStatusLoading:n,goToStep:r}=ge();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(Ee,{label:"Order ID",value:a.orderId,mono:!0}),e.jsx(Ee,{label:"Provider",value:a.gateway}),e.jsx(Ee,{label:"Amount",value:`${a.fiatAmount} ${a.fiatCurrency}`}),e.jsx(Ee,{label:"Receiving",value:`${a.cryptoAmount||"..."} ${a.cryptoCurrency}`}),e.jsx(Ee,{label:"Network",value:a.network}),e.jsx(Ee,{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 Ee({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 Ca({className:t="",explorerUrl:a,onDone:n,doneButtonText:r="Done"}){const{orderStatus:o,state:d,dispatch:u}=ge(),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(ue,{label:s?"Amount Sold":"Amount Received",value:`${o.cryptoAmount} ${o.cryptoCurrency}`,highlight:!0}),e.jsx(ue,{label:s?"Payout Amount":"Amount Paid",value:`${o.fiatAmount} ${o.fiatCurrency}`}),e.jsx(ue,{label:"Network",value:o.network}),e.jsx(ue,{label:"Wallet",value:`${o.walletAddress.slice(0,10)}...${o.walletAddress.slice(-8)}`,mono:!0}),o.transactionHash&&e.jsx(ue,{label:"Transaction",value:`${o.transactionHash.slice(0,10)}...${o.transactionHash.slice(-8)}`,mono:!0}),e.jsx(ue,{label:"Provider",value:o.gateway}),e.jsx(ue,{label:"Order ID",value:o.orderId,mono:!0}),o.completedAt&&e.jsx(ue,{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 ue({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 ga({className:t="",onRetry:a,supportEmail:n="support@nowramp.com"}){const{state:r,orderStatus:o,dispatch:d,goToStep:u}=ge(),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 Gt(t){return t.length<=12?t:`${t.slice(0,6)}...${t.slice(-6)}`}function Sa({className:t="",stablecoinParity:a,partnerName:n}){var Z;const{config:r,configLoading:o,state:d,defaultGateway:u,quotes:s,fetchQuotes:l,createOrder:m,orderLoading:h}=ge(),f=d.flowType==="sell",[p,g]=c.useState(null),y=r==null?void 0:r.gateways.find(V=>V.id===u),w=(Z=s==null?void 0:s.bestQuote)!=null&&Z.exchangeRate?parseFloat(s.bestQuote.exchangeRate):null,R=parseFloat(d.fiatAmount)||0,P=!!(a&&n&&!f&>(d.cryptoCurrency)&&w),q=P&&d.cryptoCurrency.toUpperCase().includes(d.fiatCurrency.toUpperCase()),K=P&&R>0?ze(q?R:R/w):null,$=async()=>{g(null);try{l(),await m()}catch(V){const me=V instanceof Error?V.message:"Failed to create order";g(me)}};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(Ce,{label:"You sell",value:`${d.cryptoAmount} ${d.cryptoCurrency}`,highlight:!0}),e.jsx(Ce,{label:"You receive",value:`${d.fiatCurrency} payout`})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ce,{label:"You pay",value:`${d.fiatAmount} ${d.fiatCurrency}`,highlight:!0}),e.jsx(Ce,{label:"You receive",value:K?`${K} ${d.cryptoCurrency}`:`${d.cryptoCurrency} on ${d.network}`}),e.jsx(Ce,{label:"Wallet",value:Gt(d.walletAddress),mono:!0}),P&&K&&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 ",K," ",d.cryptoCurrency," will be credited to your ",n," account."]})]}),e.jsx(Ce,{label:"Network",value:d.network}),f&&d.walletAddress&&e.jsx(Ce,{label:"Refund address",value:Gt(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:$,children:h?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"nramp-spinner-inline"}),"Processing..."]}):f?"Confirm & Sell":"Confirm & Pay"})]})}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 Ae({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 va({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 ba({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(va,{char:o,height:a},d))})}function H({w:t,h:a,className:n=""}){return e.jsx("div",{className:`skeleton ${n}`,style:{width:t,height:a}})}function ja(){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(H,{w:70,h:14,className:"mb-3"}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(H,{w:120,h:32}),e.jsx(H,{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(H,{w:50,h:14,className:"mb-3"}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(H,{w:180,h:32}),e.jsx(H,{w:85,h:32})]})]}),e.jsxs("div",{className:"flex justify-between mt-3 px-[2px]",children:[e.jsx(H,{w:140,h:12}),e.jsx(H,{w:90,h:12})]}),e.jsxs("div",{className:"mt-8",children:[e.jsx(H,{w:65,h:14,className:"mb-2.5"}),e.jsx(H,{w:"100%",h:47})]}),e.jsx("div",{className:"flex-1"}),e.jsx(H,{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 Se({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 Te({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 Na({onClose:t,onSelect:a,currencies:n,assetBaseUrl:r="",selectedCode:o}){const[d,u]=c.useState(""),s=c.useMemo(()=>{if(!n||n.length===0)return ut;const m=new Map(ut.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(Se,{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(Te,{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(Je,{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 Yt({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 wa({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 aa;const f=[];for(const p of n){const g=p.networks||[],y=p.name||Ja[p.code]||p.code;if(g.length===0)f.push({code:p.code,name:y,chain:p.code,popular:!1});else for(const w of g){const R=w.code||w.id||w.name||p.code;f.push({code:p.code,name:y,chain:R,chainName:w.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 w=l.find(R=>R.code===o&&R.chain===d);if(w){const R=l.filter(P=>!(P.code===o&&P.chain===d));return[w,...R]}}return l}const p=f.split(/\s+/),g=[];for(const w of l){const R=Ze(w.chain),P=R?R.name.toLowerCase():"",q=((y=R==null?void 0:R.shortName)==null?void 0:y.toLowerCase())||"",K=w.chain.toLowerCase(),$=w.code.toLowerCase(),Z=w.name.toLowerCase(),V=[$,Z,P,q,K];if(!p.every(k=>V.some(i=>i.includes(k))))continue;let S=0;$===f?S+=100:$.startsWith(p[0])&&(S+=50),w.popular&&(S+=10),p.length>1&&(P.includes(p[1])||q.includes(p[1])||K.includes(p[1]))&&(S+=25),g.push({item:w,score:S})}return g.sort((w,R)=>R.score-w.score),g.map(w=>w.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(Se,{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(Te,{value:u,onChange:s}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[h.map((f,p)=>{const g=Ze(f.chain),y=(g==null?void 0:g.name)||f.chainName||f.chain,w=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(Yt,{src:Ct(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(Yt,{src:Qe(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}),w&&e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:w})]})}),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 ln({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(Se,{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(Te,{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=fa(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:ha(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 Ea({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 cn=[{label:"Privacy policy",href:"https://nowramp.com/privacy-policy"},{label:"Terms of use",href:"https://nowramp.com/terms-and-conditions"}];function Ra({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(Se,{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(dn,{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(pt,{})]})}),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(ua,{size:40}),e.jsx("span",{className:"font-medium text-[15px]",style:{color:"var(--t-text)"},children:"Dark Mode"})]}),e.jsx(Ea,{checked:a,onChange:n,accentColor:"#4CD964"})]})}),e.jsx("div",{style:{height:1,background:"var(--t-divider)"}})]}),cn.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(pt,{})]}),e.jsx("div",{style:{height:1,background:"var(--t-divider)"}})]},p.label))]})]})}function dn({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 Aa({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=et[l];if(m){const h=Oe.filter(f=>f.code!==l);return[m,...h]}}return Oe}return Oe.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(Se,{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(Te,{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(un,{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 un({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 mn({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:w=!0,showThemeToggle:R=!0,autoRedirect:P=!1,explorerUrl:q,doneButtonText:K="Done",supportEmail:$,stablecoinParity:Z,partnerName:V,onDone:me}){var Lt,Ut,Ft,Dt,Mt,It,Bt,Ot,Ht;const{state:S,dispatch:k,config:i,configLoading:T,quotes:j,quotesLoading:v,quotesError:W,fetchQuotes:fe,createOrder:he,orderLoading:ae,amountError:ce,fieldLocks:U,apiConfig:Q,assetBaseUrl:D,availableFiats:ne,availableCryptos:Le,availablePaymentMethods:Y,selectionUnsupported:z,quotesEmpty:M,unavailableReasons:ve}=ge(),[ee,He]=c.useState(a==="dark"),[be,nt]=c.useState(n),[re,I]=c.useState(null),[Ue,je]=c.useState(!1),[Fe,Pe]=c.useState(!1),[te,Ke]=c.useState(!1),[pe,De]=c.useState(!1),[_e,oe]=c.useState(null),[Me,rt]=c.useState(!0),[ot,Ve]=c.useState(!1),[se,x]=c.useState(!1),N=c.useRef(null),E=c.useRef(),L=c.useRef(S.flowType);c.useEffect(()=>{He(a==="dark")},[a]),c.useEffect(()=>{const C=setTimeout(()=>rt(!1),T?0:800);return()=>clearTimeout(C)},[T]),c.useEffect(()=>{if(L.current!==S.flowType&&!Me){L.current=S.flowType,Ve(!0),je(!1),Pe(!1);const C=setTimeout(()=>Ve(!1),350);return()=>clearTimeout(C)}L.current=S.flowType},[S.flowType,Me]);const F=S.flowType,A=F==="buy",B=S.cryptoCurrency||"BTC",G=S.fiatCurrency||"USD",st=A?S.fiatAmount:S.cryptoAmount,X=ta(st),de=(Lt=j==null?void 0:j.bestQuote)!=null&&Lt.exchangeRate?parseFloat(j.bestQuote.exchangeRate):null,Ie=c.useRef(null);de&&B&&G&&(Ie.current={rate:de,crypto:B,fiat:G}),c.useEffect(()=>{(M||W)&&(Ie.current=null)},[M,W]);const St=c.useMemo(()=>{if(j!=null&&j.bestQuote){const C=A?j.bestQuote.cryptoAmount:j.bestQuote.fiatAmount;if(C)return C}return"0"},[j,A]),Be=!!(Z&&V&&A&>(B)&&de),Ta=Be&&B.toUpperCase().includes(G.toUpperCase()),vt=Be&&X>0?ze(Ta?X:X/de):null,La=Be&&vt?vt:St,Ua=c.useMemo(()=>{var _,ye,we;const C=de||((_=Ie.current)==null?void 0:_.rate),b=de?B:(ye=Ie.current)==null?void 0:ye.crypto,O=de?G:(we=Ie.current)==null?void 0:we.fiat;return!C||!b||!O?"":`1 ${b} ≈ ${C.toFixed(2)} ${O}`},[B,G,de]);c.useEffect(()=>{const C=S.walletAddress.trim(),b=S.network;if(!C||C.length<10){oe(null),k({type:"SET_WALLET_ERROR",message:""});return}De(!0),oe(null);const O=new AbortController;return clearTimeout(E.current),E.current=setTimeout(async()=>{var _,ye,we;try{const ct=await(await fetch(`${Q.apiUrl}/public/validate/address`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:C,...b?{network:b}:{}}),signal:O.signal})).json(),dt=((_=ct.data)==null?void 0:_.attributes)||ct.data||ct;if(dt.isValid)oe(!0),k({type:"SET_WALLET_ERROR",message:""});else{oe(!1);const Ga=((ye=dt.errors)==null?void 0:ye[0])||((we=dt.details)==null?void 0:we.formatMessage)||"Invalid wallet address";k({type:"SET_WALLET_ERROR",message:Ga})}}catch(lt){if(lt instanceof DOMException&<.name==="AbortError")return;oe(null)}finally{O.signal.aborted||De(!1)}},500),()=>{clearTimeout(E.current),O.abort()}},[S.walletAddress,S.network,Q.apiUrl]);const bt=!st||X===0,jt=X>0&&(A?X<_t:X<Vt),Nt=!!ce||jt||Ue&&bt,Fa=X>0&&!ce&&!jt,it=S.walletAddress.trim().length>=10&&_e!==!1&&!pe,Ge=Fa&&it&&!!S.cryptoCurrency&&!!S.network,Da=C=>{let b=C.target.value.replace(/[^0-9.,]/g,"");const O=A?2:6,_=b.indexOf(".");_!==-1&&b.length-_-1>O&&(b=b.slice(0,_+O+1)),k(A?{type:"SET_FIAT_AMOUNT",amount:b}:{type:"SET_CRYPTO_AMOUNT",amount:b})},wt=C=>{C!==F&&k({type:"SET_FLOW_TYPE",flowType:C,fieldLocks:U})},Ma=c.useCallback(C=>{k({type:"SET_FIAT_CURRENCY",currency:C})},[k]),Ia=c.useCallback((C,b)=>{k({type:"SET_CRYPTO_CURRENCY",currency:C}),k({type:"SET_CRYPTO_CHAIN",chain:b})},[k]),Ba=c.useCallback(C=>{k({type:"SET_PAYMENT_METHOD",methodId:C})},[k]),Oa=c.useCallback(C=>{k({type:"SET_COUNTRY",country:C}),I(null)},[k]),Ha=c.useCallback(()=>{I(null),setTimeout(()=>I("country"),280)},[]),Pa=S.country?(Ut=et[S.country.toLowerCase()])==null?void 0:Ut.name:void 0,Ka=()=>{Ge&&(x(!0),fe())};c.useEffect(()=>{var C;if(!(!se||v)){if(j!=null&&j.bestQuote)x(!1),k({type:"SELECT_QUOTE",quote:j.bestQuote}),he().catch(()=>{});else if(W)x(!1),k({type:"SET_ERROR",message:W.message||"No quotes available"});else if(j&&!j.bestQuote){x(!1);const b=(C=j.unavailableGateways)==null?void 0:C.map(_=>_.reason).filter(Boolean),O=b!=null&&b.length?`No providers available: ${b.join("; ")}`:"No providers available for this currency/network combination";k({type:"SET_ERROR",message:O})}}},[se,j,v,W,k,he]);const Et=ee?"theme-dark":"theme-light",Ye=mt.find(C=>C.id===be)||mt[0],_a=Ye.accent===null,Va=r?le(r):!1,Rt=C=>{const b=C.replace("#",""),O=parseInt(b.substring(0,2),16),_=parseInt(b.substring(2,4),16),ye=parseInt(b.substring(4,6),16);return(.299*O+.587*_+.114*ye)/255>.5?"#000000":"#ffffff"},At=Va?{"--t-accent":r,"--t-cta-bg":r,"--t-cta-text":Rt(r)}:_a?{"--t-accent":ee?"#ffffff":"#111111","--t-cta-bg":ee?"#ffffff":"#111111","--t-cta-text":ee?"#000000":"#ffffff"}:{"--t-accent":Ye.accent,"--t-cta-bg":Ye.accent,"--t-cta-text":Rt(Ye.accent)},J={};l&&le(l)&&(J["--t-surface"]=l,J["--t-modal-bg"]=l),m&&le(m)&&(J["--t-pill-bg"]=m,J["--t-close-bg"]=m),h&&le(h)&&(J["--t-text"]=h),f&&le(f)&&(J["--t-text-secondary"]=f),p&&le(p)&&(J["--t-text-muted"]=p,J["--t-text-tertiary"]=p),g&&le(g)&&(J["--t-success"]=g);const xe={};o&&le(o)?xe.backgroundColor=o:xe.backgroundColor="var(--t-bg)",d&&(d.startsWith("https://")||d.startsWith("data:image/"))&&(xe.backgroundImage=`url(${d})`,xe.backgroundSize="cover",xe.backgroundPosition="center");const $e=ee?"#ffffff":"#111111",We={};u&&le(u)&&(We.border=`1px solid ${u}`),s&&(We.borderRadius=s);const kt=S.step==="checkout"?e.jsx(xa,{autoRedirect:P}):S.step==="processing"?e.jsx(ya,{}):S.step==="complete"?e.jsx(Ca,{explorerUrl:q,doneButtonText:K,onDone:me}):S.step==="error"?e.jsx(ga,{supportEmail:$}):S.step==="confirm"?e.jsx(Sa,{stablecoinParity:Be,partnerName:V}):null;if(kt)return e.jsx("div",{className:`${Et} 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",...xe,...At,...J,...We},children:kt});const ie=S.network,Ne=ie?Ze(ie):null,Tt=(Ne==null?void 0:Ne.shortName)||(Ne==null?void 0:Ne.name)||ie;return e.jsxs("div",{className:`${Et} 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",...xe,...At,...J,...We},children:[w&&e.jsx("div",{className:`flex justify-end items-center px-5 pt-3 ${y?"pb-1":"pb-5"}`,children:e.jsx(da,{onClick:()=>I("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:()=>wt("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:()=>wt("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,Me||ot||T?e.jsx(ja,{}):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:Ue&&Nt?"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:st,onChange:Da,onBlur:()=>je(!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:!!((Ft=U==null?void 0:U.sourceAmount)!=null&&Ft.locked)}),A?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:!!((Dt=U==null?void 0:U.sourceCurrency)!=null&&Dt.locked),children:[e.jsx(Je,{currencyCode:G,size:16,baseUrl:D}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:$e},children:G}),e.jsx(ke,{})]}):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:!!((Mt=U==null?void 0:U.destinationCurrency)!=null&&Mt.locked),children:[e.jsx(ht,{ticker:B,size:16,baseUrl:D}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:$e},children:B}),e.jsx(ke,{})]}),ie&&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:Qe(ie,D),alt:ie,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:Tt})]})]})]})]}),Ue&&Nt&&e.jsx("div",{className:"text-[12px] mt-1.5 px-[2px]",style:{color:"#EF4444"},children:ce||(bt?"Amount should be more than 0":A?`Minimum amount is ${_t} ${G}`:`Minimum amount is ${Vt} ${B}`)}),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&&!se?e.jsx(H,{w:180,h:32}):e.jsx(ba,{value:X>0?La:"0",height:32,className:"font-semibold",style:{color:X>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:()=>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:!!((It=U==null?void 0:U.destinationCurrency)!=null&&It.locked),children:[e.jsx(ht,{ticker:B,size:16,baseUrl:D}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:$e},children:B}),e.jsx(ke,{})]}),ie&&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:Qe(ie,D),alt:ie,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:Tt})]})]}):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:!!((Bt=U==null?void 0:U.sourceCurrency)!=null&&Bt.locked),children:[e.jsx(Je,{currencyCode:G,size:16,baseUrl:D}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:$e},children:G}),e.jsx(ke,{})]})]})]}),M&&X>0&&e.jsx("div",{className:"px-[18px] py-[10px] mt-[2px]",style:{background:"var(--t-surface)",fontSize:12,color:"#EF4444",lineHeight:"16px"},children:ve[0]||"No providers available for this combination"}),Be&&X>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 ",St," ",B,", the rest up to ",ze(X)," ",G," will be credited to your ",V," account"]})]}),e.jsx("div",{className:"flex items-center justify-between mt-[2px] px-[18px] pt-[12px] pb-[14px]",style:{background:"var(--t-surface)",...!Y.length&&!((Ot=i==null?void 0:i.paymentMethods)!=null&&Ot.length)?{borderBottomLeftRadius:5,borderBottomRightRadius:5}:{}},children:e.jsx("span",{className:"text-[12px]",style:{color:g?"var(--t-success)":"var(--t-text-secondary)"},children:Ua||" "})}),(Y.length>0||(i==null?void 0:i.paymentMethods)&&i.paymentMethods.length>0)&&e.jsx("div",{className:"mt-[2px]",children:Y.length>0?e.jsx(pa,{methods:Y,selectedId:S.paymentMethodId,onOpenModal:()=>I("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:()=>Ke(!0),onBlur:()=>{Ke(!1),Pe(!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||Fe&&!it?"1px solid #EF4444":te?"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:!!((Ht=U==null?void 0:U.destinationAddress)!=null&&Ht.locked)}),S.walletError?e.jsx("div",{className:"text-[12px] mt-1.5",style:{color:"#EF4444"},children:S.walletError}):Fe&&!it&&!pe?e.jsx("div",{className:"text-[12px] mt-1.5",style:{color:"#EF4444"},children:"Enter a valid wallet address"}):pe&&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}}),z&&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:!Ge||ae||se||z||M,onClick:Ka,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:Ge&&!ae&&!se&&!z&&!M?1:.4,cursor:Ge&&!ae&&!se&&!z&&!M?"pointer":"not-allowed"},children:se?"Getting best price...":ae?"Processing...":A?`Buy ${B}`:`Sell ${B}`}),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(Ae,{isOpen:re==="fiat",onClose:()=>I(null),children:C=>e.jsx(Na,{onClose:C,onSelect:b=>{Ma(b),C()},currencies:ne.map(b=>({code:b.code,name:b.code})),assetBaseUrl:D,selectedCode:S.fiatCurrency})}),e.jsx(Ae,{isOpen:re==="crypto",onClose:()=>I(null),children:C=>e.jsx(wa,{onClose:C,onSelect:(b,O)=>{Ia(b,O),C()},cryptos:Le.map(b=>{var O;return{code:b.code,name:b.code,networks:(O=b.networks)==null?void 0:O.map(_=>({code:_.id,name:_.name}))}}),assetBaseUrl:D,selectedCode:S.cryptoCurrency,selectedChain:S.network})}),e.jsx(Ae,{isOpen:re==="payment",onClose:()=>I(null),children:C=>e.jsx(ln,{methods:Y,selectedId:S.paymentMethodId,onSelect:b=>{Ba(b),C()},onClose:C})}),e.jsx(Ae,{isOpen:re==="settings",onClose:()=>I(null),children:C=>e.jsx(Ra,{onClose:C,darkMode:ee,onToggleDarkMode:He,skinId:be,onSelectSkin:b=>{nt(b)},showThemeToggle:R,country:S.country,countryName:Pa,onLocationPress:Ha,assetBaseUrl:D})}),e.jsx(Ae,{isOpen:re==="country",onClose:()=>I(null),children:C=>e.jsx(Aa,{onClose:C,onSelect:b=>{Oa(b),C()},assetBaseUrl:D,selectedCode:S.country})})]})}function ka({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:w,onComplete:R,onError:P,className:q,theme:K,skinId:$,accentColor:Z,bgColor:V,bgImage:me,borderColor:S,borderRadius:k,surfaceColor:i,inputBgColor:T,textColor:j,textSecondaryColor:v,textMutedColor:W,successColor:fe,showFlowToggle:he,showSettings:ae,showThemeToggle:ce,autoRedirect:U,explorerUrl:Q,doneButtonText:D,supportEmail:ne,stablecoinParity:Le,partnerName:Y,onDone:z}){return e.jsx(Jt,{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:w,onComplete:R,onError:P,children:e.jsx(mn,{className:q,theme:K,skinId:$,accentColor:Z,bgColor:V,bgImage:me,borderColor:S,borderRadius:k,surfaceColor:i,inputBgColor:T,textColor:j,textSecondaryColor:v,textMutedColor:W,successColor:fe,showFlowToggle:he,showSettings:ae,showThemeToggle:ce,autoRedirect:U,explorerUrl:Q,doneButtonText:D,supportEmail:ne,stablecoinParity:Le,partnerName:Y,onDone:z})})}function fn({submitButtonText:t,rateRefreshInterval:a,...n}){return e.jsx(ka,{...n})}function hn({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 pn({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 xn({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(at,{size:36})}function yn(){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(H,{w:36,h:36,className:"rounded-full shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx(H,{w:90,h:14,className:"mb-1.5"}),e.jsx(H,{w:60,h:12})]}),e.jsxs("div",{className:"text-right",children:[e.jsx(H,{w:40,h:10,className:"mb-1.5"}),e.jsx(H,{w:80,h:14})]})]},t))})}function Cn({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(Se,{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(Te,{value:d,onChange:u}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5 space-y-2",children:[r?e.jsx(yn,{}):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(xn,{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(pn,{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=va;exports.AnimatedNumber=ba;exports.ApplePayIcon=sa;exports.BLOCKCHAINS=Re;exports.BankIcon=ra;exports.COUNTRIES=Oe;exports.COUNTRY_MAP=et;exports.CRYPTO_CHAIN_COMBOS=aa;exports.CRYPTO_CURRENCIES=yt;exports.CardIcon=ca;exports.CheckoutForm=fn;exports.CheckoutStep=xa;exports.ChevronDown=ke;exports.ChevronRight=pt;exports.ChooseRampModal=Cn;exports.CloseButton=Se;exports.CoinifyIcon=nn;exports.CompleteStep=Ca;exports.ConfirmStep=Sa;exports.CountryPickerModal=Aa;exports.CryptoCurrencyModal=wa;exports.CryptoIcon=ht;exports.DarkModeIcon=ua;exports.ErrorStep=ga;exports.FIAT_CURRENCIES=ut;exports.FIAT_TO_COUNTRY=qt;exports.FiatCurrencyModal=Na;exports.FiatFlag=Je;exports.FormSkeleton=ja;exports.GenericCoinIcon=at;exports.GooglePayIcon=ia;exports.MOCK_RATES=ft;exports.MenuIcon=da;exports.Modal=Ae;exports.PayPalIcon=la;exports.PaymentMethodSelector=pa;exports.ProcessingStep=ya;exports.RampForm=ka;exports.RampProvider=Jt;exports.RevolutIcon=oa;exports.SKINS=mt;exports.SearchInput=Te;exports.SettingsScreen=Ra;exports.Skeleton=H;exports.SkinSwatch=hn;exports.ToggleSwitch=Ea;exports.formatOutput=ze;exports.getChainIconUrl=Qe;exports.getCryptoIconUrl=Ct;exports.getDefaultFiatForCountry=Xe;exports.getFiatFlagUrl=ea;exports.getMockRate=en;exports.getPaymentIcon=ma;exports.isStablecoin=gt;exports.parseAmount=ta;exports.useCheckoutIntent=Xt;exports.useQuotes=Wt;exports.useRamp=ge;exports.useRampConfig=$t;exports.useTransaction=Zt;
|
|
11
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("react"),qe=require("@nowramp/sdk"),Pt=require("react-dom");function $t(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 qe.RampApi({apiKey:"",...t}));const p=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 h=await m.current.getSupported(f);o(h)}catch(f){l(f instanceof Error?f:new Error("Failed to fetch config"))}finally{u(!1)}},[t.projectId,a,n]);return c.useEffect(()=>{p()},[p]),{config:r,loading:d,error:s,refetch:p}}function Wt(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(""),p=`${t.apiUrl}|${t.projectId}`;(!l.current||m.current!==p)&&(l.current=new qe.RampApi({apiKey:"",...t}),m.current=p);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 h=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:h}}function Xt(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 qe.RampApi({apiKey:"",...t}),l.current=m);const p=c.useCallback(async h=>{o(!0),u(null);try{const g=await s.current.createCheckoutIntent(h);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:p,reset:f}}function Zt(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 qe.RampApi({apiKey:"",projectId:"",...t}));const p=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 h=setTimeout(p,f);return()=>clearTimeout(h)}p()},[p,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 h=setInterval(p,n.pollInterval);return()=>clearInterval(h)},[a,n==null?void 0:n.pollInterval,r==null?void 0:r.status,p]),{status:r,loading:d,error:s,refetch:p}}const He=[{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"}],et=Object.fromEntries(He.map(t=>[t.code,t]));function Xe(t,a){if(!t)return"USD";const n=et[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 tt=!0;function xt(t,a,n=tt){return t===void 0||a===void 0?n:t.length===0||a.length===0?!1:t.some(r=>a.includes(r))}function Ya(t,a,n=tt){return t.filter(r=>xt(r.providers,a,n))}function $a(t,a,n=tt){const r=[];for(const o of t){const d=o.networks.filter(u=>xt(u.providers,a,n));d.length>0&&r.push(d.length===o.networks.length?o:{...o,networks:d})}return r}function Wa(t,a,n,r=tt){return n?t.filter(o=>o.supportedFiats.includes(n)&&xt(o.providers,a,r)):[]}function Xa(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 Za(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 Kt(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}function Qa(t,a,n){return!t&&!!a&&!a.bestQuote&&!!n}function za(t,a){if(!t.length)return null;if(a){const r=t.find(o=>o.gatewayId===a);if(r!=null&&r.reason)return r.reason}const n=t.map((r,o)=>({reason:r.reason,score:r.reason?Ja(r.reason):99,idx:o})).filter(r=>r.reason);return n.length?(n.sort((r,o)=>r.score-o.score||r.idx-o.idx),n[0].reason):null}function Ja(t){const a=t.toLowerCase();return/amount|out of range for|minimum|maximum/.test(a)?1:/currency|pair|network|chain/.test(a)?2:/country|region|location/.test(a)?3:/does not support|unsupported/.test(a)?4:5}const Qt={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 qa(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 Qt;default:return t}}const zt=c.createContext(null);function Jt({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:p="",defaultWalletAddress:f="",defaultGateway:h,defaultCountry:g,fieldLocks:y,statusPollInterval:N=5e3,onComplete:R,onError:H,children:ee}){const P=c.useMemo(()=>({apiUrl:a,projectId:t}),[a,t]),$=l||(s?s.toLowerCase():""),Z=r==="sell",V=Z?!!p:!!m,S=(Z?!!(V&&s&&$):!!(V&&s&&$&&f))&&h?"confirm":"amount",k=m||(r==="buy"?"250":""),[i,T]=c.useReducer(qa,{...Qt,step:S,flowType:r,fiatCurrency:u,cryptoCurrency:s,network:$,fiatAmount:Kt(k,2),cryptoAmount:Kt(p,6),walletAddress:f,customerId:o,...g?{country:g.toLowerCase(),countrySource:"manual"}:{}}),j=i.flowType==="sell",{config:v,loading:W,error:pe}=$t(P,i.flowType,i.country||void 0),he=c.useRef(!1);c.useEffect(()=>{var L;if(he.current||!(v!=null&&v.detectedCountry)||i.country)return;he.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=Xe(x,w);E!==i.fiatCurrency&&T({type:"SET_FIAT_CURRENCY",currency:E})},[v,i.country,i.fiatCurrency]);const ne=c.useRef(!1);c.useEffect(()=>{var E;if(ne.current||!g||!((E=v==null?void 0:v.fiats)!=null&&E.length))return;ne.current=!0;const x=v.fiats.map(L=>L.code),w=Xe(g,x);w!==i.fiatCurrency&&T({type:"SET_FIAT_CURRENCY",currency:w})},[g,v,i.fiatCurrency]);const ce=c.useRef(i.country);c.useEffect(()=>{var E;if(i.country===ce.current||(ce.current=i.country,i.countrySource==="manual"&&(Ue.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=Xe(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:re}=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(G=>G.code===i.cryptoCurrency),I=(L=A==null?void 0:A.networks)==null?void 0:L.find(G=>G.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:Ya(v.fiats??[],x),availableCryptos:$a(v.cryptos??[],w),availablePaymentMethods:Wa(v.paymentMethods??[],x,i.fiatCurrency)}},[v,i.cryptoCurrency,i.network,i.fiatCurrency]),Le=c.useMemo(()=>{var x,w,E;return W||!v?!1:Za(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:re})},[W,v,y,i.cryptoCurrency,i.network,i.fiatCurrency,Q,D,re]);c.useEffect(()=>{var w,E,L;if(W||Q.length===0&&D.length===0)return;const x=Xa({cryptoCurrency:i.cryptoCurrency,network:i.network,fiatCurrency:i.fiatCurrency,paymentMethodId:i.paymentMethodId},{availableFiats:Q,availableCryptos:D,availablePaymentMethods:re},{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}))},[W,Q,D,re,i.cryptoCurrency,i.network,i.fiatCurrency,i.paymentMethodId,y,T]);const Y=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]),z=c.useMemo(()=>{const x=j?!!i.cryptoAmount:!!i.fiatAmount;return!v||!x||!i.fiatCurrency||!i.cryptoCurrency||!i.network||Y||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,Y,j,i.flowType,g]),{quotes:M,loading:be,error:te,refetch:Pe}=Wt(P,z),je=Qa(be,M,z),Ue=c.useRef(!1);c.useEffect(()=>{Ue.current||i.countrySource==="auto"&&(be||!z||te||!M||M.bestQuote||i.fiatCurrency!=="USD"&&(Ue.current=!0,T({type:"SET_FIAT_CURRENCY",currency:"USD"}),T({type:"SET_FIAT_AMOUNT",amount:"250"})))},[M,be,te,z,i.countrySource,i.fiatCurrency]);const{order:ae,loading:K,error:xe,createOrder:Fe}=Xt(P),Ke=15e3,{status:J,loading:nt}=Zt({apiUrl:a},(ae==null?void 0:ae.orderId)??null,{pollInterval:N,initialDelay:Ke});c.useEffect(()=>{(J==null?void 0:J.status)==="completed"&&R&&R(J)},[J==null?void 0:J.status,R]),c.useEffect(()=>{const x=pe||xe;x&&H&&H(x)},[pe,xe,H]);const de=h||(v==null?void 0:v.defaultGateway)||null,De=c.useMemo(()=>!je||!(M!=null&&M.unavailableGateways)?null:za(M.unavailableGateways,de),[je,M,de]),Me=c.useRef(de);Me.current=de;const _e=c.useRef(M);_e.current=M;const oe=c.useRef(d);oe.current=d;const Ie=c.useCallback(async()=>{var w,E,L;const x=((w=i.selectedQuote)==null?void 0:w.gatewayId)||((L=(E=_e.current)==null?void 0:E.bestQuote)==null?void 0:L.gatewayId)||Me.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 Fe({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,...oe.current?{metadata:{brand:oe.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,Fe,j]),rt=c.useCallback(x=>{T({type:"SET_STEP",step:x})},[]),ot=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]),Ve=c.useMemo(()=>{const x=j?!!i.cryptoAmount:!!i.fiatAmount;switch(i.step){case"confirm":return!!(x&&i.cryptoCurrency&&i.network&&i.walletAddress&&!Y);case"amount":return!!(x&&i.cryptoCurrency&&i.network&&!Y);case"quotes":return!!i.selectedQuote;case"wallet":return!!i.walletAddress;default:return!1}},[i,Y,j]),se={apiConfig:P,assetBaseUrl:n,config:v,configLoading:W,configError:pe,state:i,dispatch:T,quotes:M,quotesLoading:be,quotesError:te,fetchQuotes:Pe,order:ae,orderLoading:K,orderError:xe,createOrder:Ie,orderStatus:J,orderStatusLoading:nt,fieldLocks:y||null,defaultGateway:de,availableFiats:Q,availableCryptos:D,availablePaymentMethods:re,selectionUnsupported:Le,quotesEmpty:je,bestUnavailableReason:De,amountError:Y,goToStep:rt,goBack:ot,canProceed:Ve};return e.jsx(zt.Provider,{value:se,children:ee})}function Se(){const t=c.useContext(zt);if(!t)throw new Error("useRamp must be used within a RampProvider");return t}const Re={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"}},yt=[{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}],en=Object.fromEntries(yt.map(t=>[t.code,t.name])),qt={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 Ct(t,a=""){return`${a}/crypto-icons/${t.toLowerCase()}.svg`}function ea(t,a=""){const n=qt[t]||"us";return`${a}/flags/${n}.svg`}function Ze(t){return Re[t]||Re[t.toLowerCase()]||Re[t.toUpperCase()]||Re[t.toUpperCase().replace(/-/g,"_")]||Re[t.toLowerCase().replace(/-/g,"_")]}function Qe(t,a=""){const n=Ze(t);return n?`${a}/crypto-icons/${n.icon}.svg`:`${a}/crypto-icons/${t.toLowerCase()}.svg`}const ut=[{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"}],mt=[{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}],ft={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}},tn=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 gt(t){return tn.has(t.toUpperCase())}function an(t,a){var n,r;return((n=ft[t])==null?void 0:n[a])??((r=ft.USDC)==null?void 0:r[a])??1}function ta(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 le=t=>/^#([0-9A-Fa-f]{3}){1,2}$/.test(t),_t=10,Vt=1e-4,aa=(()=>{const t=[];for(const a of yt)for(const n of a.chains)t.push({code:a.code,name:a.name,chain:n,popular:a.popular});return t})();function na({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 p=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:p,onError:f,className:`rounded-full ${d?"opacity-100":"opacity-0"}`,style:{width:n,height:n,transition:"opacity 0.15s ease-in"}})]})}function pt({ticker:t,size:a=32,baseUrl:n=""}){return e.jsx(na,{src:Ct(t,n),alt:t,size:a,background:"#ffffff"})}function Je({currencyCode:t,size:a=16,baseUrl:n=""}){return e.jsx(na,{src:ea(t,n),alt:t,size:a})}function at({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 ra({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 oa({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 sa({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 ia({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 la({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 nn({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 rn({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 ca({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 on({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 ke(){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 ht(){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 da({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 ua({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 ma(t,a=32){switch(t){case"revolut":return e.jsx(oa,{size:a});case"applepay":return e.jsx(sa,{size:a});case"card":return e.jsx(ca,{size:a});case"googlepay":return e.jsx(ia,{size:a});case"paypal":return e.jsx(la,{size:a});case"bank":return e.jsx(ra,{size:a});case"visa":return e.jsx(nn,{size:a});case"mastercard":return e.jsx(rn,{size:a});default:return e.jsx(at,{size:a})}}const sn={"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"},ln={"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 fa(t,a){return ln[t]||a}function pa(t,a,n=24){const r=sn[t];return r?ma(r,n):a?e.jsx("img",{src:a,alt:"",width:n,height:n,style:{borderRadius:"50%"}}):e.jsx(at,{size:n})}function ha({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&&pa(d.id,d.icon,20)}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:d?fa(d.id,d.name):"Select"}),e.jsx(ke,{})]})]})})}function xa({className:t="",autoRedirect:a=!1,redirectDelay:n=3e3}){var h;const{order:r,orderStatus:o,goToStep:d,goBack:u}=Se(),[s,l]=c.useState(!1),[m,p]=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){p(Math.ceil(n/1e3));const g=setTimeout(()=>{window.location.href=r.checkout.url},n),y=setInterval(()=>{p(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=((h=r.checkout.allowedFeatures)==null?void 0:h.join("; "))||"payment; camera; microphone; geolocation; clipboard-read; clipboard-write; accelerometer; gyroscope; magnetometer; fullscreen; autoplay; encrypted-media; web-share";return Pt.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=cn(r.checkout.url,r.widgetConfig);return Pt.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 cn(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 ya({className:t=""}){const{orderStatus:a,orderStatusLoading:n,goToStep:r}=Se();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(Ee,{label:"Order ID",value:a.orderId,mono:!0}),e.jsx(Ee,{label:"Provider",value:a.gateway}),e.jsx(Ee,{label:"Amount",value:`${a.fiatAmount} ${a.fiatCurrency}`}),e.jsx(Ee,{label:"Receiving",value:`${a.cryptoAmount||"..."} ${a.cryptoCurrency}`}),e.jsx(Ee,{label:"Network",value:a.network}),e.jsx(Ee,{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 Ee({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 Ca({className:t="",explorerUrl:a,onDone:n,doneButtonText:r="Done"}){const{orderStatus:o,state:d,dispatch:u}=Se(),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"})},p=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(me,{label:s?"Amount Sold":"Amount Received",value:`${o.cryptoAmount} ${o.cryptoCurrency}`,highlight:!0}),e.jsx(me,{label:s?"Payout Amount":"Amount Paid",value:`${o.fiatAmount} ${o.fiatCurrency}`}),e.jsx(me,{label:"Network",value:o.network}),e.jsx(me,{label:"Wallet",value:`${o.walletAddress.slice(0,10)}...${o.walletAddress.slice(-8)}`,mono:!0}),o.transactionHash&&e.jsx(me,{label:"Transaction",value:`${o.transactionHash.slice(0,10)}...${o.transactionHash.slice(-8)}`,mono:!0}),e.jsx(me,{label:"Provider",value:o.gateway}),e.jsx(me,{label:"Order ID",value:o.orderId,mono:!0}),o.completedAt&&e.jsx(me,{label:"Completed",value:new Date(o.completedAt).toLocaleString()})]}),e.jsxs("div",{className:"w-full flex flex-col gap-2",children:[p&&e.jsx("a",{href:p,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 me({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 ga({className:t="",onRetry:a,supportEmail:n="support@nowramp.com"}){const{state:r,orderStatus:o,dispatch:d,goToStep:u}=Se(),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."},p=()=>{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:p,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 Gt(t){return t.length<=12?t:`${t.slice(0,6)}...${t.slice(-6)}`}function Sa({className:t="",stablecoinParity:a,partnerName:n}){var Z;const{config:r,configLoading:o,state:d,defaultGateway:u,quotes:s,fetchQuotes:l,createOrder:m,orderLoading:p}=Se(),f=d.flowType==="sell",[h,g]=c.useState(null),y=r==null?void 0:r.gateways.find(V=>V.id===u),N=(Z=s==null?void 0:s.bestQuote)!=null&&Z.exchangeRate?parseFloat(s.bestQuote.exchangeRate):null,R=parseFloat(d.fiatAmount)||0,H=!!(a&&n&&!f&>(d.cryptoCurrency)&&N),ee=H&&d.cryptoCurrency.toUpperCase().includes(d.fiatCurrency.toUpperCase()),P=H&&R>0?ze(ee?R:R/N):null,$=async()=>{g(null);try{l(),await m()}catch(V){const fe=V instanceof Error?V.message:"Failed to create order";g(fe)}};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(ge,{label:"You sell",value:`${d.cryptoAmount} ${d.cryptoCurrency}`,highlight:!0}),e.jsx(ge,{label:"You receive",value:`${d.fiatCurrency} payout`})]}):e.jsxs(e.Fragment,{children:[e.jsx(ge,{label:"You pay",value:`${d.fiatAmount} ${d.fiatCurrency}`,highlight:!0}),e.jsx(ge,{label:"You receive",value:P?`${P} ${d.cryptoCurrency}`:`${d.cryptoCurrency} on ${d.network}`}),e.jsx(ge,{label:"Wallet",value:Gt(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(ge,{label:"Network",value:d.network}),f&&d.walletAddress&&e.jsx(ge,{label:"Refund address",value:Gt(d.walletAddress),mono:!0})]}),h&&e.jsx("p",{className:"text-[12px] mb-4",style:{color:"#EF4444"},children:h}),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:p?.7:1},disabled:p,onClick:$,children:p?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"nramp-spinner-inline"}),"Processing..."]}):f?"Confirm & Sell":"Confirm & Pay"})]})}function ge({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 Ae({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 va({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 ba({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(va,{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 ja(){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 ve({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 Te({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 Na({onClose:t,onSelect:a,currencies:n,assetBaseUrl:r="",selectedCode:o}){const[d,u]=c.useState(""),s=c.useMemo(()=>{if(!n||n.length===0)return ut;const m=new Map(ut.map(p=>[p.code,p.name]));return n.map(p=>({code:p.code,name:p.name||m.get(p.code)||p.code}))},[n]),l=c.useMemo(()=>{const m=d.trim().toLowerCase();if(!m){if(o){const p=s.find(f=>f.code===o);if(p){const f=s.filter(h=>h.code!==o);return[p,...f]}}return s}return s.filter(p=>p.code.toLowerCase().includes(m)||p.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(ve,{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(Te,{value:d,onChange:u}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[l.map((m,p)=>{const f=m.name!==m.code?m.name:"",h=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(Je,{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})]}),h&&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"})})]}),p<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 Yt({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 p=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:p,onError:f,className:`rounded-full ${d?"opacity-100":"opacity-0"}`,style:{width:n,height:n,transition:"opacity 0.15s ease-in"}})]})}function wa({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 aa;const f=[];for(const h of n){const g=h.networks||[],y=h.name||en[h.code]||h.code;if(g.length===0)f.push({code:h.code,name:y,chain:h.code,popular:!1});else for(const N of g){const R=N.code||N.id||N.name||h.code;f.push({code:h.code,name:y,chain:R,chainName:N.name,popular:!1})}}return f},[n]),m=c.useCallback((f,h)=>o===f&&d===h,[o,d]),p=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 h=f.split(/\s+/),g=[];for(const N of l){const R=Ze(N.chain),H=R?R.name.toLowerCase():"",ee=((y=R==null?void 0:R.shortName)==null?void 0:y.toLowerCase())||"",P=N.chain.toLowerCase(),$=N.code.toLowerCase(),Z=N.name.toLowerCase(),V=[$,Z,H,ee,P];if(!h.every(k=>V.some(i=>i.includes(k))))continue;let S=0;$===f?S+=100:$.startsWith(h[0])&&(S+=50),N.popular&&(S+=10),h.length>1&&(H.includes(h[1])||ee.includes(h[1])||P.includes(h[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(ve,{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(Te,{value:u,onChange:s}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[p.map((f,h)=>{const g=Ze(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(Yt,{src:Ct(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(Yt,{src:Qe(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"})})]})]}),h<p.length-1&&e.jsx("div",{style:{height:1,background:"var(--t-divider, rgba(255,255,255,0.08))"}})]},`${f.code}-${f.chain}`)}),p.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No currencies found"})]})]})}function dn({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(p=>p.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(ve,{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(Te,{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,p=fa(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:pa(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:p}),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 Ea({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 un=[{label:"Privacy policy",href:"https://nowramp.com/privacy-policy"},{label:"Terms of use",href:"https://nowramp.com/terms-and-conditions"}];function Ra({onClose:t,darkMode:a,onToggleDarkMode:n,skinId:r,onSelectSkin:o,showThemeToggle:d=!0,country:u,countryName:s,onLocationPress:l,assetBaseUrl:m=""}){const[p,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(ve,{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&&!p?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(mn,{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(ht,{})]})}),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(ua,{size:40}),e.jsx("span",{className:"font-medium text-[15px]",style:{color:"var(--t-text)"},children:"Dark Mode"})]}),e.jsx(Ea,{checked:a,onChange:n,accentColor:"#4CD964"})]})}),e.jsx("div",{style:{height:1,background:"var(--t-divider)"}})]}),un.map(h=>e.jsxs("div",{children:[e.jsxs("a",{href:h.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:h.label}),e.jsx(ht,{})]}),e.jsx("div",{style:{height:1,background:"var(--t-divider)"}})]},h.label))]})]})}function mn({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 Aa({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=et[l];if(m){const p=He.filter(f=>f.code!==l);return[m,...p]}}return He}return He.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(ve,{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(Te,{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(fn,{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 fn({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 pn({className:t="",theme:a="dark",skinId:n="mono",accentColor:r,bgColor:o,bgImage:d,borderColor:u,borderRadius:s,surfaceColor:l,inputBgColor:m,textColor:p,textSecondaryColor:f,textMutedColor:h,successColor:g,showFlowToggle:y=!0,showSettings:N=!0,showThemeToggle:R=!0,autoRedirect:H=!1,explorerUrl:ee,doneButtonText:P="Done",supportEmail:$,stablecoinParity:Z,partnerName:V,onDone:fe}){var Lt,Ut,Ft,Dt,Mt,It,Bt,Ot,Ht;const{state:S,dispatch:k,config:i,configLoading:T,quotes:j,quotesLoading:v,quotesError:W,fetchQuotes:pe,createOrder:he,orderLoading:ne,amountError:ce,fieldLocks:U,apiConfig:Q,assetBaseUrl:D,availableFiats:re,availableCryptos:Le,availablePaymentMethods:Y,selectionUnsupported:z,quotesEmpty:M,bestUnavailableReason:be}=Se(),[te,Pe]=c.useState(a==="dark"),[je,Ue]=c.useState(n),[ae,K]=c.useState(null),[xe,Fe]=c.useState(!1),[Ke,J]=c.useState(!1),[nt,de]=c.useState(!1),[De,Me]=c.useState(!1),[_e,oe]=c.useState(null),[Ie,rt]=c.useState(!0),[ot,Ve]=c.useState(!1),[se,x]=c.useState(!1),w=c.useRef(null),E=c.useRef(),L=c.useRef(S.flowType);c.useEffect(()=>{Pe(a==="dark")},[a]),c.useEffect(()=>{const C=setTimeout(()=>rt(!1),T?0:800);return()=>clearTimeout(C)},[T]),c.useEffect(()=>{if(L.current!==S.flowType&&!Ie){L.current=S.flowType,Ve(!0),Fe(!1),J(!1);const C=setTimeout(()=>Ve(!1),350);return()=>clearTimeout(C)}L.current=S.flowType},[S.flowType,Ie]);const F=S.flowType,A=F==="buy",I=S.cryptoCurrency||"BTC",G=S.fiatCurrency||"USD",st=A?S.fiatAmount:S.cryptoAmount,X=ta(st),ue=(Lt=j==null?void 0:j.bestQuote)!=null&&Lt.exchangeRate?parseFloat(j.bestQuote.exchangeRate):null,Be=c.useRef(null);ue&&I&&G&&(Be.current={rate:ue,crypto:I,fiat:G}),c.useEffect(()=>{(M||W)&&(Be.current=null)},[M,W]);const St=c.useMemo(()=>{if(j!=null&&j.bestQuote){const C=A?j.bestQuote.cryptoAmount:j.bestQuote.fiatAmount;if(C)return C}return"0"},[j,A]),Oe=!!(Z&&V&&A&>(I)&&ue),Ta=Oe&&I.toUpperCase().includes(G.toUpperCase()),vt=Oe&&X>0?ze(Ta?X:X/ue):null,La=Oe&&vt?vt:St,Ua=c.useMemo(()=>{var _,Ce,we;const C=ue||((_=Be.current)==null?void 0:_.rate),b=ue?I:(Ce=Be.current)==null?void 0:Ce.crypto,B=ue?G:(we=Be.current)==null?void 0:we.fiat;return!C||!b||!B?"":`1 ${b} ≈ ${C.toFixed(2)} ${B}`},[I,G,ue]);c.useEffect(()=>{const C=S.walletAddress.trim(),b=S.network;if(!C||C.length<10){oe(null),k({type:"SET_WALLET_ERROR",message:""});return}Me(!0),oe(null);const B=new AbortController;return clearTimeout(E.current),E.current=setTimeout(async()=>{var _,Ce,we;try{const ct=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(),dt=((_=ct.data)==null?void 0:_.attributes)||ct.data||ct;if(dt.isValid)oe(!0),k({type:"SET_WALLET_ERROR",message:""});else{oe(!1);const Ga=((Ce=dt.errors)==null?void 0:Ce[0])||((we=dt.details)==null?void 0:we.formatMessage)||"Invalid wallet address";k({type:"SET_WALLET_ERROR",message:Ga})}}catch(lt){if(lt instanceof DOMException&<.name==="AbortError")return;oe(null)}finally{B.signal.aborted||Me(!1)}},500),()=>{clearTimeout(E.current),B.abort()}},[S.walletAddress,S.network,Q.apiUrl]);const bt=!st||X===0,jt=X>0&&(A?X<_t:X<Vt),Nt=!!ce||jt||xe&&bt,Fa=X>0&&!ce&&!jt,it=S.walletAddress.trim().length>=10&&_e!==!1&&!De,Ge=Fa&&it&&!!S.cryptoCurrency&&!!S.network,Da=C=>{let b=C.target.value.replace(/[^0-9.,]/g,"");const B=A?2:6,_=b.indexOf(".");_!==-1&&b.length-_-1>B&&(b=b.slice(0,_+B+1)),k(A?{type:"SET_FIAT_AMOUNT",amount:b}:{type:"SET_CRYPTO_AMOUNT",amount:b})},wt=C=>{C!==F&&k({type:"SET_FLOW_TYPE",flowType:C,fieldLocks:U})},Ma=c.useCallback(C=>{k({type:"SET_FIAT_CURRENCY",currency:C})},[k]),Ia=c.useCallback((C,b)=>{k({type:"SET_CRYPTO_CURRENCY",currency:C}),k({type:"SET_CRYPTO_CHAIN",chain:b})},[k]),Ba=c.useCallback(C=>{k({type:"SET_PAYMENT_METHOD",methodId:C})},[k]),Oa=c.useCallback(C=>{k({type:"SET_COUNTRY",country:C}),K(null)},[k]),Ha=c.useCallback(()=>{K(null),setTimeout(()=>K("country"),280)},[]),Pa=S.country?(Ut=et[S.country.toLowerCase()])==null?void 0:Ut.name:void 0,Ka=()=>{Ge&&(x(!0),pe())};c.useEffect(()=>{var C;if(!(!se||v)){if(j!=null&&j.bestQuote)x(!1),k({type:"SELECT_QUOTE",quote:j.bestQuote}),he().catch(()=>{});else if(W)x(!1),k({type:"SET_ERROR",message:W.message||"No quotes available"});else if(j&&!j.bestQuote){x(!1);const b=(C=j.unavailableGateways)==null?void 0:C.map(_=>_.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})}}},[se,j,v,W,k,he]);const Et=te?"theme-dark":"theme-light",Ye=mt.find(C=>C.id===je)||mt[0],_a=Ye.accent===null,Va=r?le(r):!1,Rt=C=>{const b=C.replace("#",""),B=parseInt(b.substring(0,2),16),_=parseInt(b.substring(2,4),16),Ce=parseInt(b.substring(4,6),16);return(.299*B+.587*_+.114*Ce)/255>.5?"#000000":"#ffffff"},At=Va?{"--t-accent":r,"--t-cta-bg":r,"--t-cta-text":Rt(r)}:_a?{"--t-accent":te?"#ffffff":"#111111","--t-cta-bg":te?"#ffffff":"#111111","--t-cta-text":te?"#000000":"#ffffff"}:{"--t-accent":Ye.accent,"--t-cta-bg":Ye.accent,"--t-cta-text":Rt(Ye.accent)},q={};l&&le(l)&&(q["--t-surface"]=l,q["--t-modal-bg"]=l),m&&le(m)&&(q["--t-pill-bg"]=m,q["--t-close-bg"]=m),p&&le(p)&&(q["--t-text"]=p),f&&le(f)&&(q["--t-text-secondary"]=f),h&&le(h)&&(q["--t-text-muted"]=h,q["--t-text-tertiary"]=h),g&&le(g)&&(q["--t-success"]=g);const ye={};o&&le(o)?ye.backgroundColor=o:ye.backgroundColor="var(--t-bg)",d&&(d.startsWith("https://")||d.startsWith("data:image/"))&&(ye.backgroundImage=`url(${d})`,ye.backgroundSize="cover",ye.backgroundPosition="center");const $e=te?"#ffffff":"#111111",We={};u&&le(u)&&(We.border=`1px solid ${u}`),s&&(We.borderRadius=s);const kt=S.step==="checkout"?e.jsx(xa,{autoRedirect:H}):S.step==="processing"?e.jsx(ya,{}):S.step==="complete"?e.jsx(Ca,{explorerUrl:ee,doneButtonText:P,onDone:fe}):S.step==="error"?e.jsx(ga,{supportEmail:$}):S.step==="confirm"?e.jsx(Sa,{stablecoinParity:Oe,partnerName:V}):null;if(kt)return e.jsx("div",{className:`${Et} 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",...ye,...At,...q,...We},children:kt});const ie=S.network,Ne=ie?Ze(ie):null,Tt=(Ne==null?void 0:Ne.shortName)||(Ne==null?void 0:Ne.name)||ie;return e.jsxs("div",{className:`${Et} 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",...ye,...At,...q,...We},children:[N&&e.jsx("div",{className:`flex justify-end items-center px-5 pt-3 ${y?"pb-1":"pb-5"}`,children:e.jsx(da,{onClick:()=>K("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:()=>wt("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:()=>wt("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,Ie||ot||T?e.jsx(ja,{}):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:xe&&Nt?"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:st,onChange:Da,onBlur:()=>Fe(!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:!!((Ft=U==null?void 0:U.sourceAmount)!=null&&Ft.locked)}),A?e.jsxs("button",{onClick:()=>K("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:!!((Dt=U==null?void 0:U.sourceCurrency)!=null&&Dt.locked),children:[e.jsx(Je,{currencyCode:G,size:16,baseUrl:D}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:$e},children:G}),e.jsx(ke,{})]}):e.jsxs("div",{className:"flex flex-col items-end shrink-0",children:[e.jsxs("button",{onClick:()=>K("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:!!((Mt=U==null?void 0:U.destinationCurrency)!=null&&Mt.locked),children:[e.jsx(pt,{ticker:I,size:16,baseUrl:D}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:$e},children:I}),e.jsx(ke,{})]}),ie&&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:Qe(ie,D),alt:ie,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:Tt})]})]})]})]}),xe&&Nt&&e.jsx("div",{className:"text-[12px] mt-1.5 px-[2px]",style:{color:"#EF4444"},children:ce||(bt?"Amount should be more than 0":A?`Minimum amount is ${_t} ${G}`:`Minimum amount is ${Vt} ${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&&!se?e.jsx(O,{w:180,h:32}):e.jsx(ba,{value:X>0?La:"0",height:32,className:"font-semibold",style:{color:X>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:()=>K("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:!!((It=U==null?void 0:U.destinationCurrency)!=null&&It.locked),children:[e.jsx(pt,{ticker:I,size:16,baseUrl:D}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:$e},children:I}),e.jsx(ke,{})]}),ie&&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:Qe(ie,D),alt:ie,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:Tt})]})]}):e.jsxs("button",{onClick:()=>K("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:!!((Bt=U==null?void 0:U.sourceCurrency)!=null&&Bt.locked),children:[e.jsx(Je,{currencyCode:G,size:16,baseUrl:D}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:$e},children:G}),e.jsx(ke,{})]})]})]}),M&&X>0&&e.jsx("div",{className:"px-[18px] py-[10px] mt-[2px]",style:{background:"var(--t-surface)",fontSize:12,color:"#EF4444",lineHeight:"16px"},children:be||"No providers available for this combination"}),Oe&&X>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 ",St," ",I,", the rest up to ",ze(X)," ",G," will be credited to your ",V," account"]})]}),e.jsx("div",{className:"flex items-center justify-between mt-[2px] px-[18px] pt-[12px] pb-[14px]",style:{background:"var(--t-surface)",...!Y.length&&!((Ot=i==null?void 0:i.paymentMethods)!=null&&Ot.length)?{borderBottomLeftRadius:5,borderBottomRightRadius:5}:{}},children:e.jsx("span",{className:"text-[12px]",style:{color:g?"var(--t-success)":"var(--t-text-secondary)"},children:Ua||" "})}),(Y.length>0||(i==null?void 0:i.paymentMethods)&&i.paymentMethods.length>0)&&e.jsx("div",{className:"mt-[2px]",children:Y.length>0?e.jsx(ha,{methods:Y,selectedId:S.paymentMethodId,onOpenModal:()=>K("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:()=>de(!0),onBlur:()=>{de(!1),J(!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||Ke&&!it?"1px solid #EF4444":nt?"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:!!((Ht=U==null?void 0:U.destinationAddress)!=null&&Ht.locked)}),S.walletError?e.jsx("div",{className:"text-[12px] mt-1.5",style:{color:"#EF4444"},children:S.walletError}):Ke&&!it&&!De?e.jsx("div",{className:"text-[12px] mt-1.5",style:{color:"#EF4444"},children:"Enter a valid wallet address"}):De&&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}}),z&&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:!Ge||ne||se||z||M,onClick:Ka,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:Ge&&!ne&&!se&&!z&&!M?1:.4,cursor:Ge&&!ne&&!se&&!z&&!M?"pointer":"not-allowed"},children:se?"Getting best price...":ne?"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(Ae,{isOpen:ae==="fiat",onClose:()=>K(null),children:C=>e.jsx(Na,{onClose:C,onSelect:b=>{Ma(b),C()},currencies:re.map(b=>({code:b.code,name:b.code})),assetBaseUrl:D,selectedCode:S.fiatCurrency})}),e.jsx(Ae,{isOpen:ae==="crypto",onClose:()=>K(null),children:C=>e.jsx(wa,{onClose:C,onSelect:(b,B)=>{Ia(b,B),C()},cryptos:Le.map(b=>{var B;return{code:b.code,name:b.code,networks:(B=b.networks)==null?void 0:B.map(_=>({code:_.id,name:_.name}))}}),assetBaseUrl:D,selectedCode:S.cryptoCurrency,selectedChain:S.network})}),e.jsx(Ae,{isOpen:ae==="payment",onClose:()=>K(null),children:C=>e.jsx(dn,{methods:Y,selectedId:S.paymentMethodId,onSelect:b=>{Ba(b),C()},onClose:C})}),e.jsx(Ae,{isOpen:ae==="settings",onClose:()=>K(null),children:C=>e.jsx(Ra,{onClose:C,darkMode:te,onToggleDarkMode:Pe,skinId:je,onSelectSkin:b=>{Ue(b)},showThemeToggle:R,country:S.country,countryName:Pa,onLocationPress:Ha,assetBaseUrl:D})}),e.jsx(Ae,{isOpen:ae==="country",onClose:()=>K(null),children:C=>e.jsx(Aa,{onClose:C,onSelect:b=>{Oa(b),C()},assetBaseUrl:D,selectedCode:S.country})})]})}function ka({projectId:t,apiUrl:a,assetBaseUrl:n,flowType:r,customerId:o,brandId:d,defaultFiatCurrency:u,defaultCryptoCurrency:s,defaultNetwork:l,defaultFiatAmount:m,defaultCryptoAmount:p,defaultWalletAddress:f,defaultGateway:h,defaultCountry:g,fieldLocks:y,statusPollInterval:N,onComplete:R,onError:H,className:ee,theme:P,skinId:$,accentColor:Z,bgColor:V,bgImage:fe,borderColor:S,borderRadius:k,surfaceColor:i,inputBgColor:T,textColor:j,textSecondaryColor:v,textMutedColor:W,successColor:pe,showFlowToggle:he,showSettings:ne,showThemeToggle:ce,autoRedirect:U,explorerUrl:Q,doneButtonText:D,supportEmail:re,stablecoinParity:Le,partnerName:Y,onDone:z}){return e.jsx(Jt,{projectId:t,apiUrl:a,assetBaseUrl:n,flowType:r,customerId:o,brandId:d,defaultFiatCurrency:u,defaultCryptoCurrency:s,defaultNetwork:l,defaultFiatAmount:m,defaultCryptoAmount:p,defaultWalletAddress:f,defaultGateway:h,defaultCountry:g,fieldLocks:y,statusPollInterval:N,onComplete:R,onError:H,children:e.jsx(pn,{className:ee,theme:P,skinId:$,accentColor:Z,bgColor:V,bgImage:fe,borderColor:S,borderRadius:k,surfaceColor:i,inputBgColor:T,textColor:j,textSecondaryColor:v,textMutedColor:W,successColor:pe,showFlowToggle:he,showSettings:ne,showThemeToggle:ce,autoRedirect:U,explorerUrl:Q,doneButtonText:D,supportEmail:re,stablecoinParity:Le,partnerName:Y,onDone:z})})}function hn({submitButtonText:t,rateRefreshInterval:a,...n}){return e.jsx(ka,{...n})}function xn({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 yn({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 Cn({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(at,{size:36})}function gn(){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 Sn({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(ve,{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(Te,{value:d,onChange:u}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5 space-y-2",children:[r?e.jsx(gn,{}):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 p=m===0,f=parseFloat(l.cryptoAmount),h=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:p?4.5:5,height:p?63:64,paddingLeft:16,paddingRight:16,border:p?"1px solid var(--t-border)":"1px solid transparent",background:p?"transparent":"var(--t-surface)"},children:[e.jsx(Cn,{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(yn,{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," ",h]})]})]},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=va;exports.AnimatedNumber=ba;exports.ApplePayIcon=sa;exports.BLOCKCHAINS=Re;exports.BankIcon=ra;exports.COUNTRIES=He;exports.COUNTRY_MAP=et;exports.CRYPTO_CHAIN_COMBOS=aa;exports.CRYPTO_CURRENCIES=yt;exports.CardIcon=ca;exports.CheckoutForm=hn;exports.CheckoutStep=xa;exports.ChevronDown=ke;exports.ChevronRight=ht;exports.ChooseRampModal=Sn;exports.CloseButton=ve;exports.CoinifyIcon=on;exports.CompleteStep=Ca;exports.ConfirmStep=Sa;exports.CountryPickerModal=Aa;exports.CryptoCurrencyModal=wa;exports.CryptoIcon=pt;exports.DarkModeIcon=ua;exports.ErrorStep=ga;exports.FIAT_CURRENCIES=ut;exports.FIAT_TO_COUNTRY=qt;exports.FiatCurrencyModal=Na;exports.FiatFlag=Je;exports.FormSkeleton=ja;exports.GenericCoinIcon=at;exports.GooglePayIcon=ia;exports.MOCK_RATES=ft;exports.MenuIcon=da;exports.Modal=Ae;exports.PayPalIcon=la;exports.PaymentMethodSelector=ha;exports.ProcessingStep=ya;exports.RampForm=ka;exports.RampProvider=Jt;exports.RevolutIcon=oa;exports.SKINS=mt;exports.SearchInput=Te;exports.SettingsScreen=Ra;exports.Skeleton=O;exports.SkinSwatch=xn;exports.ToggleSwitch=Ea;exports.formatOutput=ze;exports.getChainIconUrl=Qe;exports.getCryptoIconUrl=Ct;exports.getDefaultFiatForCountry=Xe;exports.getFiatFlagUrl=ea;exports.getMockRate=an;exports.getPaymentIcon=ma;exports.isStablecoin=gt;exports.parseAmount=ta;exports.useCheckoutIntent=Xt;exports.useQuotes=Wt;exports.useRamp=Se;exports.useRampConfig=$t;exports.useTransaction=Zt;
|
|
12
12
|
//# sourceMappingURL=index.cjs.map
|