@nowramp/form 0.1.49 → 0.1.51
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 +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +712 -622
- package/dist/index.js.map +1 -1
- package/dist/nowramp-form.iife.js +12 -12
- package/dist/nowramp-form.iife.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
if(document.getElementById(id))return;
|
|
5
5
|
var s=document.createElement('style');
|
|
6
6
|
s.id=id;
|
|
7
|
-
s.textContent=`@layer nowramp-form{.theme-dark{--t-bg: #000000;--t-surface: rgba(255,255,255,.1);--t-surface-hover: rgba(255,255,255,.14);--t-text: #ffffff;--t-text-secondary: rgba(255,255,255,.4);--t-text-tertiary: rgba(255,255,255,.3);--t-text-muted: rgba(255,255,255,.5);--t-border: rgba(255,255,255,.2);--t-border-focus: rgba(255,255,255,.5);--t-pill-bg: rgba(255,255,255,.1);--t-pill-hover: rgba(255,255,255,.15);--t-badge-bg: rgba(255,255,255,.15);--t-divider: rgba(255,255,255,.2);--t-close-bg: rgba(255,255,255,.1);--t-close-hover: rgba(255,255,255,.2);--t-icon-stroke: rgba(255,255,255,.4);--t-icon-close: rgba(255,255,255,.6);--t-accent: #0077FF;--t-cta-bg: var(--t-accent);--t-cta-text: #ffffff;--t-cta-hover: rgba(255,255,255,.9);--t-cta-active: rgba(255,255,255,.8);--t-modal-bg: #000000;--t-chain-border: #000000;--t-skeleton-from: rgba(255,255,255,.06);--t-skeleton-mid: rgba(255,255,255,.12);--t-scrollbar: rgba(255,255,255,.15);--t-card-icon-bg: rgba(255,255,255,.1);--t-card-icon-stroke: rgba(255,255,255,.6);--t-success: #10b981;--t-error: #EF4444}.theme-light{--t-bg: #F2F3F5;--t-surface: rgba(0,0,0,.05);--t-surface-hover: rgba(0,0,0,.08);--t-text: #111111;--t-text-secondary: rgba(0,0,0,.45);--t-text-tertiary: rgba(0,0,0,.3);--t-text-muted: rgba(0,0,0,.5);--t-border: rgba(0,0,0,.12);--t-border-focus: rgba(0,0,0,.3);--t-pill-bg: rgba(0,0,0,.06);--t-pill-hover: rgba(0,0,0,.1);--t-badge-bg: rgba(0,0,0,.08);--t-divider: rgba(0,0,0,.1);--t-close-bg: rgba(0,0,0,.06);--t-close-hover: rgba(0,0,0,.12);--t-icon-stroke: rgba(0,0,0,.35);--t-icon-close: rgba(0,0,0,.5);--t-accent: #0077FF;--t-cta-bg: var(--t-accent);--t-cta-text: #ffffff;--t-cta-hover: #222222;--t-cta-active: #333333;--t-modal-bg: #F2F3F5;--t-chain-border: #F2F3F5;--t-skeleton-from: rgba(0,0,0,.04);--t-skeleton-mid: rgba(0,0,0,.08);--t-scrollbar: rgba(0,0,0,.12);--t-card-icon-bg: rgba(0,0,0,.06);--t-card-icon-stroke: rgba(0,0,0,.5);--t-success: #10b981;--t-error: #EF4444}.custom-scroll::-webkit-scrollbar{width:4px}.custom-scroll::-webkit-scrollbar-track{background:transparent}.custom-scroll::-webkit-scrollbar-thumb{background:var(--t-scrollbar);border-radius:2px}@keyframes shimmer{0%{background-position:-200% 0}to{background-position:200% 0}}.skeleton{background:linear-gradient(90deg,var(--t-skeleton-from) 25%,var(--t-skeleton-mid) 50%,var(--t-skeleton-from) 75%);background-size:200% 100%;animation:shimmer 1.5s ease-in-out infinite;border-radius:4px}@keyframes fadeIn{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}.tab-fade-in{animation:fadeIn .3s ease-out both}.digit-slot{display:inline-block;overflow:hidden;vertical-align:top}.digit-slot-inner{transition:transform .35s cubic-bezier(.33,1,.68,1)}@keyframes nramp-spin{to{transform:rotate(360deg)}}.nramp-spinner{width:40px;height:40px;border:3px solid var(--t-border);border-top-color:var(--t-accent);border-radius:50%;animation:nramp-spin .8s linear infinite;margin:0 auto}.nramp-spinner-large{width:60px;height:60px;border-width:4px}.nramp-spinner-inline{width:16px;height:16px;border-width:2px;display:inline-block}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.left-0{left:0}.right-3{right:.75rem}.top-0{top:0}.top-1\\/2{top:50%}.top-\\[3px\\]{top:3px}.z-20{z-index:20}.mx-5{margin-left:1.25rem;margin-right:1.25rem}.mb-1\\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-2\\.5{margin-bottom:.625rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mr-0\\.5{margin-right:.125rem}.mr-3{margin-right:.75rem}.mt-0\\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-\\[2px\\]{margin-top:2px}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.hidden{display:none}.h-\\[640px\\]{height:640px}.h-full{height:100%}.min-h-\\[640px\\]{min-height:640px}.w-0{width:0px}.w-full{width:100%}.min-w-0{min-width:0px}.max-w-\\[390px\\]{max-width:390px}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.-translate-y-1\\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-3\\.5{gap:.875rem}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.border{border-width:1px}.
|
|
7
|
+
s.textContent=`@layer nowramp-form{.theme-dark{--t-bg: #000000;--t-surface: rgba(255,255,255,.1);--t-surface-hover: rgba(255,255,255,.14);--t-text: #ffffff;--t-text-secondary: rgba(255,255,255,.4);--t-text-tertiary: rgba(255,255,255,.3);--t-text-muted: rgba(255,255,255,.5);--t-border: rgba(255,255,255,.2);--t-border-focus: rgba(255,255,255,.5);--t-pill-bg: rgba(255,255,255,.1);--t-pill-hover: rgba(255,255,255,.15);--t-badge-bg: rgba(255,255,255,.15);--t-divider: rgba(255,255,255,.2);--t-close-bg: rgba(255,255,255,.1);--t-close-hover: rgba(255,255,255,.2);--t-icon-stroke: rgba(255,255,255,.4);--t-icon-close: rgba(255,255,255,.6);--t-accent: #0077FF;--t-cta-bg: var(--t-accent);--t-cta-text: #ffffff;--t-cta-hover: rgba(255,255,255,.9);--t-cta-active: rgba(255,255,255,.8);--t-modal-bg: #000000;--t-chain-border: #000000;--t-skeleton-from: rgba(255,255,255,.06);--t-skeleton-mid: rgba(255,255,255,.12);--t-scrollbar: rgba(255,255,255,.15);--t-card-icon-bg: rgba(255,255,255,.1);--t-card-icon-stroke: rgba(255,255,255,.6);--t-success: #10b981;--t-error: #EF4444}.theme-light{--t-bg: #F2F3F5;--t-surface: rgba(0,0,0,.05);--t-surface-hover: rgba(0,0,0,.08);--t-text: #111111;--t-text-secondary: rgba(0,0,0,.45);--t-text-tertiary: rgba(0,0,0,.3);--t-text-muted: rgba(0,0,0,.5);--t-border: rgba(0,0,0,.12);--t-border-focus: rgba(0,0,0,.3);--t-pill-bg: rgba(0,0,0,.06);--t-pill-hover: rgba(0,0,0,.1);--t-badge-bg: rgba(0,0,0,.08);--t-divider: rgba(0,0,0,.1);--t-close-bg: rgba(0,0,0,.06);--t-close-hover: rgba(0,0,0,.12);--t-icon-stroke: rgba(0,0,0,.35);--t-icon-close: rgba(0,0,0,.5);--t-accent: #0077FF;--t-cta-bg: var(--t-accent);--t-cta-text: #ffffff;--t-cta-hover: #222222;--t-cta-active: #333333;--t-modal-bg: #F2F3F5;--t-chain-border: #F2F3F5;--t-skeleton-from: rgba(0,0,0,.04);--t-skeleton-mid: rgba(0,0,0,.08);--t-scrollbar: rgba(0,0,0,.12);--t-card-icon-bg: rgba(0,0,0,.06);--t-card-icon-stroke: rgba(0,0,0,.5);--t-success: #10b981;--t-error: #EF4444}.custom-scroll::-webkit-scrollbar{width:4px}.custom-scroll::-webkit-scrollbar-track{background:transparent}.custom-scroll::-webkit-scrollbar-thumb{background:var(--t-scrollbar);border-radius:2px}@keyframes shimmer{0%{background-position:-200% 0}to{background-position:200% 0}}.skeleton{background:linear-gradient(90deg,var(--t-skeleton-from) 25%,var(--t-skeleton-mid) 50%,var(--t-skeleton-from) 75%);background-size:200% 100%;animation:shimmer 1.5s ease-in-out infinite;border-radius:4px}@keyframes fadeIn{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}.tab-fade-in{animation:fadeIn .3s ease-out both}.digit-slot{display:inline-block;overflow:hidden;vertical-align:top}.digit-slot-inner{transition:transform .35s cubic-bezier(.33,1,.68,1)}@keyframes nramp-spin{to{transform:rotate(360deg)}}.nramp-spinner{width:40px;height:40px;border:3px solid var(--t-border);border-top-color:var(--t-accent);border-radius:50%;animation:nramp-spin .8s linear infinite;margin:0 auto}.nramp-spinner-large{width:60px;height:60px;border-width:4px}.nramp-spinner-inline{width:16px;height:16px;border-width:2px;display:inline-block}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.left-0{left:0}.right-3{right:.75rem}.top-0{top:0}.top-1\\/2{top:50%}.top-\\[3px\\]{top:3px}.z-20{z-index:20}.mx-5{margin-left:1.25rem;margin-right:1.25rem}.mb-1\\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-2\\.5{margin-bottom:.625rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mr-0\\.5{margin-right:.125rem}.mr-3{margin-right:.75rem}.mt-0\\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-\\[2px\\]{margin-top:2px}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.hidden{display:none}.h-\\[640px\\]{height:640px}.h-full{height:100%}.min-h-\\[640px\\]{min-height:640px}.w-0{width:0px}.w-full{width:100%}.min-w-0{min-width:0px}.max-w-\\[390px\\]{max-width:390px}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.-translate-y-1\\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-3\\.5{gap:.875rem}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.border{border-width:1px}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.p-12{padding:3rem}.p-8{padding:2rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-8{padding-left:2rem;padding-right:2rem}.px-\\[18px\\]{padding-left:18px;padding-right:18px}.px-\\[2px\\]{padding-left:2px;padding-right:2px}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.pb-1{padding-bottom:.25rem}.pb-2\\.5{padding-bottom:.625rem}.pb-5{padding-bottom:1.25rem}.pb-\\[14px\\]{padding-bottom:14px}.pb-\\[18px\\]{padding-bottom:18px}.pt-3{padding-top:.75rem}.pt-5{padding-top:1.25rem}.pt-6{padding-top:1.5rem}.pt-\\[12px\\]{padding-top:12px}.pt-\\[14px\\]{padding-top:14px}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.text-\\[12px\\]{font-size:12px}.text-\\[13px\\]{font-size:13px}.text-\\[14px\\]{font-size:14px}.text-\\[15px\\]{font-size:15px}.text-\\[16px\\]{font-size:16px}.text-\\[17px\\]{font-size:17px}.text-\\[18px\\]{font-size:18px}.text-\\[20px\\]{font-size:20px}.text-\\[48px\\]{font-size:48px}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.lowercase{text-transform:lowercase}.leading-snug{line-height:1.375}.leading-tight{line-height:1.25}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.opacity-0{opacity:0}.opacity-100{opacity:1}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.hover-item{transition:background-color .15s ease}.hover-item:hover{background-color:var(--t-hover-bg, rgba(255, 255, 255, .05))}.hover\\:opacity-70:hover{opacity:.7}
|
|
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"),o=require("react"),Pe=require("@nowramp/sdk"),ft=require("react-dom");function bt(t,n){const[a,s]=o.useState(null),[r,u]=o.useState(!0),[m,l]=o.useState(null),c=o.useRef(null);(!c.current||c.current!==t)&&(c.current=new Pe.RampApi({apiKey:"",...t}));const h=o.useCallback(async()=>{if(!t.projectId){l(new Error("projectId is required")),u(!1);return}u(!0),l(null);try{const p=await c.current.getSupported(n);s(p)}catch(p){l(p instanceof Error?p:new Error("Failed to fetch config"))}finally{u(!1)}},[t.projectId,n]);return o.useEffect(()=>{h()},[h]),{config:a,loading:r,error:m,refetch:h}}function Nt(t,n){const[a,s]=o.useState(null),[r,u]=o.useState(!1),[m,l]=o.useState(null),c=o.useRef(null),h=o.useRef(""),p=`${t.apiUrl}|${t.projectId}`;(!c.current||h.current!==p)&&(c.current=new Pe.RampApi({apiKey:"",...t}),h.current=p);const d=o.useRef(0);o.useEffect(()=>{const x=++d.current;if(!n||!t.projectId){s(null),u(!1);return}u(!0),l(null),c.current.getQuotes(n).then(S=>{d.current===x&&(s(S),u(!1))},S=>{d.current===x&&(l(S instanceof Error?S:new Error("Failed to fetch quotes")),s(null),u(!1))})},[t.projectId,n==null?void 0:n.fiatCurrency,n==null?void 0:n.fiatAmount,n==null?void 0:n.cryptoAmount,n==null?void 0:n.cryptoCurrency,n==null?void 0:n.network,n==null?void 0:n.paymentMethodId,n==null?void 0:n.country,n==null?void 0:n.orderType]);const f=o.useCallback(async()=>{if(!(!n||!t.projectId)){u(!0),l(null);try{const x=await c.current.getQuotes(n);s(x)}catch(x){l(x instanceof Error?x:new Error("Failed to fetch quotes"))}finally{u(!1)}}},[t.projectId,n]);return{quotes:a,loading:r,error:m,refetch:f}}function jt(t){const[n,a]=o.useState(null),[s,r]=o.useState(!1),[u,m]=o.useState(null),l=o.useRef(null),c=o.useRef(""),h=`${t.apiUrl}|${t.projectId}`;(!l.current||c.current!==h)&&(l.current=new Pe.RampApi({apiKey:"",...t}),c.current=h);const p=o.useCallback(async f=>{r(!0),m(null);try{const x=await l.current.createCheckoutIntent(f);return a(x),x}catch(x){const S=x instanceof Error?x:new Error("Failed to create checkout intent");throw m(S),S}finally{r(!1)}},[]),d=o.useCallback(()=>{a(null),m(null)},[]);return{order:n,loading:s,error:u,createOrder:p,reset:d}}function St(t,n,a){const[s,r]=o.useState(null),[u,m]=o.useState(!1),[l,c]=o.useState(null),h=o.useRef(null);h.current||(h.current=new Pe.RampApi({apiKey:"",projectId:"",...t}));const p=o.useCallback(async()=>{if(n){m(!0),c(null);try{const d=await h.current.getTransaction(n);r(d)}catch(d){c(d instanceof Error?d:new Error("Failed to fetch status"))}finally{m(!1)}}},[n]);return o.useEffect(()=>{if(!n)return;const d=(a==null?void 0:a.initialDelay)??0;if(d>0){const f=setTimeout(p,d);return()=>clearTimeout(f)}p()},[p,n,a==null?void 0:a.initialDelay]),o.useEffect(()=>{if(!n||!(a!=null&&a.pollInterval)||!s||["completed","failed","cancelled","expired","refunded"].includes(s.status))return;const f=setInterval(p,a.pollInterval);return()=>clearInterval(f)},[n,a==null?void 0:a.pollInterval,s==null?void 0:s.status,p]),{status:s,loading:u,error:l,refetch:p}}function xt(t,n){if(!t)return t;const a=t.indexOf(".");if(a===-1)return t;let s=t;return s.length-a-1>n&&(s=s.slice(0,a+n+1)),s=s.replace(/0+$/,"").replace(/\.$/,""),s}const Et={step:"amount",flowType:"buy",fiatCurrency:"USD",fiatAmount:"",cryptoCurrency:"",cryptoAmount:"",network:"",paymentMethodId:"",walletAddress:"",walletError:null,selectedProvider:null,selectedQuote:null,customerId:"",email:"",country:"",errorMessage:null};function xn(t,n){switch(n.type){case"SET_STEP":return{...t,step:n.step,errorMessage:null};case"SET_FLOW_TYPE":return{...t,flowType:n.flowType,fiatAmount:"",cryptoAmount:"",paymentMethodId:"",selectedQuote:null,selectedProvider:null,errorMessage:null};case"SET_FIAT_CURRENCY":return{...t,fiatCurrency:n.currency};case"SET_FIAT_AMOUNT":return{...t,fiatAmount:n.amount};case"SET_CRYPTO_CURRENCY":return{...t,cryptoCurrency:n.currency,network:""};case"SET_CRYPTO_AMOUNT":return{...t,cryptoAmount:n.amount};case"SET_NETWORK":return{...t,network:n.network};case"SET_CRYPTO_CHAIN":return{...t,network:n.chain};case"SET_PAYMENT_METHOD":return{...t,paymentMethodId:n.methodId};case"SET_WALLET_ADDRESS":return{...t,walletAddress:n.address,walletError:null};case"SET_WALLET_ERROR":return{...t,walletError:n.message};case"SELECT_QUOTE":return{...t,selectedQuote:n.quote,selectedProvider:n.quote.gatewayId};case"SET_CUSTOMER_ID":return{...t,customerId:n.customerId};case"SET_EMAIL":return{...t,email:n.email};case"SET_COUNTRY":return{...t,country:n.country};case"SET_ERROR":return{...t,step:"error",errorMessage:n.message};case"CLEAR_ERROR":return{...t,errorMessage:null};case"RESET":return Et;default:return t}}const At=o.createContext(null);function Rt({projectId:t,apiUrl:n="https://api.nowramp.com",assetBaseUrl:a="",flowType:s="buy",customerId:r="",brandId:u,defaultFiatCurrency:m="USD",defaultCryptoCurrency:l="BTC",defaultNetwork:c="",defaultFiatAmount:h="",defaultCryptoAmount:p="",defaultWalletAddress:d="",defaultGateway:f,fieldLocks:x,statusPollInterval:S=5e3,onComplete:C,onError:R,children:$}){const W=o.useMemo(()=>({apiUrl:n,projectId:t}),[n,t]),Y=c||(l?l.toLowerCase():""),Q=s==="sell",te=Q?!!p:!!h,T=(Q?!!(te&&l&&Y):!!(te&&l&&Y&&d))&&f?"confirm":"amount",E=h||(s==="buy"?"250":""),[i,b]=o.useReducer(xn,{...Et,step:T,flowType:s,fiatCurrency:m,cryptoCurrency:l,network:Y,fiatAmount:xt(E,2),cryptoAmount:xt(p,6),walletAddress:d,customerId:r}),M=i.flowType==="sell",{config:k,loading:Ne,error:ne}=bt(W,i.flowType);o.useEffect(()=>{var P,D,L;if(!k||!i.cryptoCurrency||i.network)return;const v=(P=k.cryptos)==null?void 0:P.find(H=>H.code===i.cryptoCurrency),j=((D=v==null?void 0:v.networks)==null?void 0:D.find(H=>H.isDefault))||((L=v==null?void 0:v.networks)==null?void 0:L[0]);j!=null&&j.id&&b({type:"SET_NETWORK",network:j.id})},[k,i.cryptoCurrency,i.network]),o.useEffect(()=>{var L,H;if(!((L=k==null?void 0:k.paymentMethods)!=null&&L.length))return;const v=i.fiatCurrency,j=k.paymentMethods;if(i.paymentMethodId&&j.some(B=>B.id===i.paymentMethodId&&B.supportedFiats.includes(v)))return;const D=j.find(F=>F.supportedFiats.includes(v)&&(F.id.includes("card")||F.id.includes("debit")))||j.find(F=>F.supportedFiats.includes(v));b({type:"SET_PAYMENT_METHOD",methodId:(D==null?void 0:D.id)||((H=j[0])==null?void 0:H.id)||""})},[k,i.fiatCurrency,i.paymentMethodId]);const U=o.useMemo(()=>{if(M){if(!i.cryptoAmount)return null;const L=parseFloat(i.cryptoAmount);return isNaN(L)||L<=0?"Enter a valid amount":null}if(!k||!i.fiatAmount)return null;const v=parseFloat(i.fiatAmount);if(isNaN(v))return null;const j=k.fiats.find(L=>L.code===i.fiatCurrency);if(!j)return null;const P=parseFloat(j.minAmount),D=parseFloat(j.maxAmount);return!isNaN(P)&&v<P?`Minimum amount is ${j.minAmount} ${i.fiatCurrency}`:!isNaN(D)&&v>D?`Maximum amount is ${j.maxAmount} ${i.fiatCurrency}`:null},[k,i.fiatAmount,i.fiatCurrency,i.cryptoAmount,M]),re=o.useMemo(()=>{const v=M?!!i.cryptoAmount:!!i.fiatAmount;return!k||!v||!i.cryptoCurrency||!i.network||U?null:{fiatCurrency:i.fiatCurrency,...M?{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}},[k,i.fiatCurrency,i.fiatAmount,i.cryptoAmount,i.cryptoCurrency,i.network,i.paymentMethodId,i.country,U,M,i.flowType]),{quotes:w,loading:me,error:K,refetch:Z}=Nt(W,re),{order:z,loading:pe,error:je,createOrder:oe}=jt(W),_=15e3,{status:X,loading:we}=St({apiUrl:n},(z==null?void 0:z.orderId)??null,{pollInterval:S,initialDelay:_});o.useEffect(()=>{(X==null?void 0:X.status)==="completed"&&C&&C(X)},[X==null?void 0:X.status,C]),o.useEffect(()=>{const v=ne||je;v&&R&&R(v)},[ne,je,R]);const he=f||(k==null?void 0:k.defaultGateway)||null,Se=o.useRef(he);Se.current=he;const fe=o.useRef(w);fe.current=w;const xe=o.useRef(u);xe.current=u;const He=o.useCallback(async()=>{var j,P,D;const v=((j=i.selectedQuote)==null?void 0:j.gatewayId)||((D=(P=fe.current)==null?void 0:P.bestQuote)==null?void 0:D.gatewayId)||Se.current;if(!v||!i.walletAddress){const L=[!v&&"gateway",!i.walletAddress&&"walletAddress"].filter(Boolean).join(", ");b({type:"SET_ERROR",message:`Missing required fields: ${L}`});return}try{await oe({gateway:v,customerId:i.customerId||void 0,fiatCurrency:i.fiatCurrency,...M?{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,...xe.current?{metadata:{brand:xe.current}}:{}}),b({type:"SET_STEP",step:"checkout"})}catch(L){const H=L instanceof Error?L.message:"Failed to create order";/wallet|address/i.test(H)?b({type:"SET_WALLET_ERROR",message:H.replace(/^Failed to create checkout intent:\s*/i,"")}):b({type:"SET_ERROR",message:H})}},[i,oe,M]),le=o.useCallback(v=>{b({type:"SET_STEP",step:v})},[]),Ee=o.useCallback(()=>{const v=["confirm","amount","quotes","wallet","checkout","processing","complete"],j=v.indexOf(i.step);j>0&&b({type:"SET_STEP",step:v[j-1]})},[i.step,M]),Ue=o.useMemo(()=>{const v=M?!!i.cryptoAmount:!!i.fiatAmount;switch(i.step){case"confirm":return!!(v&&i.cryptoCurrency&&i.network&&i.walletAddress&&!U);case"amount":return!!(v&&i.cryptoCurrency&&i.network&&!U);case"quotes":return!!i.selectedQuote;case"wallet":return!!i.walletAddress;default:return!1}},[i,U,M]),Fe={apiConfig:W,assetBaseUrl:a,config:k,configLoading:Ne,configError:ne,state:i,dispatch:b,quotes:w,quotesLoading:me,quotesError:K,fetchQuotes:Z,order:z,orderLoading:pe,orderError:je,createOrder:He,orderStatus:X,orderStatusLoading:we,fieldLocks:x||null,defaultGateway:he,amountError:U,goToStep:le,goBack:Ee,canProceed:Ue};return e.jsx(At.Provider,{value:Fe,children:$})}function ue(){const t=o.useContext(At);if(!t)throw new Error("useRamp must be used within a RampProvider");return t}const Ie={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"}},ze=[{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}],yn=Object.fromEntries(ze.map(t=>[t.code,t.name])),wt={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 Je(t,n=""){return`${n}/crypto-icons/${t.toLowerCase()}.svg`}function Tt(t,n=""){const a=wt[t]||"us";return`${n}/flags/${a}.svg`}function Me(t){return Ie[t]||Ie[t.toUpperCase()]||Ie[t.toUpperCase().replace(/-/g,"_")]}function Be(t,n=""){const a=Me(t);return a?`${n}/crypto-icons/${a.icon}.svg`:`${n}/crypto-icons/${t.toLowerCase()}.svg`}const Ve=[{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"}],Ye=[{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}],Qe={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}};function gn(t,n){var a,s;return((a=Qe[t])==null?void 0:a[n])??((s=Qe.USDC)==null?void 0:s[n])??1}function kt(t){return parseFloat(t.replace(/,/g,""))||0}function vn(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 n=t.toPrecision(4);return parseFloat(n).toString()}const ee=t=>/^#([0-9A-Fa-f]{3}){1,2}$/.test(t),yt=10,gt=1e-4,Lt=(()=>{const t=[];for(const n of ze)for(const a of n.chains)t.push({code:n.code,name:n.name,chain:a,popular:n.popular});return t})();function It({src:t,alt:n,size:a,className:s="",background:r}){const[u,m]=o.useState(!1),[l,c]=o.useState(!1),h=o.useCallback(()=>m(!0),[]),p=o.useCallback(()=>c(!0),[]);return e.jsxs("div",{className:`relative rounded-full shrink-0 ${s}`,style:{width:a,height:a,background:r},children:[!u&&!l&&e.jsx("div",{className:"absolute inset-0 rounded-full animate-pulse",style:{background:"var(--t-pill-bg, #333)"}}),l?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,a*.35)},children:n.slice(0,3)}):e.jsx("img",{src:t,alt:n,width:a,height:a,loading:"lazy",onLoad:h,onError:p,className:`rounded-full ${u?"opacity-100":"opacity-0"}`,style:{width:a,height:a,transition:"opacity 0.15s ease-in"}})]})}function Ze({ticker:t,size:n=32,baseUrl:a=""}){return e.jsx(It,{src:Je(t,a),alt:t,size:n,background:"#ffffff"})}function Oe({currencyCode:t,size:n=16,baseUrl:a=""}){return e.jsx(It,{src:Tt(t,a),alt:t,size:n})}function De({size:t=32,color:n="#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:n}),e.jsx("circle",{cx:"16",cy:"16",r:"8",stroke:"white",strokeWidth:"1.5",fill:"none"})]})}function Mt({size:t=24}){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:"#0077FF"}),e.jsx("path",{d:"M8 15l8-6 8 6H8z",fill:"white"}),e.jsx("rect",{x:"10",y:"16",width:"2",height:"6",fill:"white"}),e.jsx("rect",{x:"15",y:"16",width:"2",height:"6",fill:"white"}),e.jsx("rect",{x:"20",y:"16",width:"2",height:"6",fill:"white"}),e.jsx("rect",{x:"8",y:"22",width:"16",height:"2",rx:"0.5",fill:"white"})]})}function Bt({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 Ot({size:t=32}){return e.jsx("div",{className:"rounded-full bg-black border border-white/20 flex items-center justify-center text-white shrink-0",style:{width:t,height:t,fontSize:t*.3},children:e.jsx("span",{style:{fontFamily:"-apple-system, system-ui, sans-serif",fontWeight:600},children:"Pay"})})}function Pt({size:t=32}){return e.jsxs("div",{className:"rounded-full bg-white flex items-center justify-center shrink-0",style:{width:t,height:t,fontSize:t*.28,fontWeight:700,color:"#333"},children:["G",e.jsx("span",{style:{color:"#4285F4",fontSize:t*.2},children:"Pay"})]})}function Dt({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 Ht({size:t=32}){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*.55,height:t*.55,viewBox:"0 0 18 14",fill:"none",children:[e.jsx("rect",{x:"0.5",y:"0.5",width:"17",height:"13",rx:"2",stroke:"var(--t-card-icon-stroke)"}),e.jsx("rect",{y:"3",width:"18",height:"3",fill:"var(--t-card-icon-stroke)"})]})})}function Cn({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 Ce(){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 Ut(){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 Ft({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 Kt({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 _t(t,n=32){switch(t){case"revolut":return e.jsx(Bt,{size:n});case"applepay":return e.jsx(Ot,{size:n});case"card":return e.jsx(Ht,{size:n});case"googlepay":return e.jsx(Pt,{size:n});case"paypal":return e.jsx(Dt,{size:n});case"bank":return e.jsx(Mt,{size:n});default:return e.jsx(De,{size:n})}}const bn={"debit-credit-card":"card","bank-transfer":"bank","apple-pay":"applepay","google-pay":"googlepay",paypal:"paypal",revolut:"revolut"},Nn={"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 Xt(t,n){return Nn[t]||n}function $t(t,n,a=24){const s=bn[t];return s?_t(s,a):n?e.jsx("img",{src:n,alt:"",width:a,height:a,style:{borderRadius:"50%"}}):e.jsx(De,{size:a})}function Wt({methods:t,selectedId:n,onOpenModal:a,fiatCurrency:s}){const r=o.useMemo(()=>t.filter(m=>m.supportedFiats.includes(s)),[t,s]),u=r.find(m=>m.id===n)||r[0];return r.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 ",s]})}):e.jsx(e.Fragment,{children:e.jsxs("div",{role:"button",tabIndex:0,onClick:a,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&a()},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:u&&$t(u.id,u.icon,20)}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:u?Xt(u.id,u.name):"Select"}),e.jsx(Ce,{})]})]})})}function Gt({className:t="",autoRedirect:n=!1,redirectDelay:a=3e3}){var f;const{order:s,orderStatus:r,goToStep:u,goBack:m}=ue(),[l,c]=o.useState(!1),[h,p]=o.useState(null),d=s!=null&&s.checkout.expiresAt?Date.now()>s.checkout.expiresAt:!1;if(o.useEffect(()=>{if((s==null?void 0:s.checkout.method)==="redirect"&&n&&!d){p(Math.ceil(a/1e3));const x=setTimeout(()=>{window.location.href=s.checkout.url},a),S=setInterval(()=>{p(C=>C&&C>1?C-1:null)},1e3);return()=>{clearTimeout(x),clearInterval(S)}}},[s,n,a,d]),o.useEffect(()=>{r&&(r.status==="completed"?u("complete"):["failed","cancelled","expired"].includes(r.status)&&u("error"))},[r==null?void 0:r.status,u]),!s)return e.jsxs("div",{className:`flex flex-col items-center justify-center p-8 ${t}`,style:{color:"var(--t-text)"},children:[e.jsx("p",{className:"text-[15px] mb-4",children:"No order found"}),e.jsx("button",{className:"font-semibold text-[14px] transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)",paddingLeft:24,paddingRight:24},onClick:m,children:"Go Back"})]});if(d)return e.jsxs("div",{className:`flex flex-col items-center justify-center p-8 text-center ${t}`,style:{color:"var(--t-text)"},children:[e.jsx("h3",{className:"text-[18px] font-semibold mb-2",children:"Checkout expired"}),e.jsx("p",{className:"text-[14px] mb-6",style:{color:"var(--t-text-secondary)"},children:"The session has expired. Please try again."}),e.jsx("button",{className:"w-full font-semibold text-[16px] transition-all",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)"},onClick:m,children:"Start over"})]});if(s.checkout.method==="iframe"){const x=s.checkout.url,S=((f=s.checkout.allowedFeatures)==null?void 0:f.join("; "))||"payment; camera; microphone; geolocation; clipboard-read; clipboard-write; accelerometer; gyroscope; magnetometer; fullscreen; autoplay; encrypted-media; web-share";return ft.createPortal(e.jsxs("div",{style:{position:"fixed",inset:0,zIndex:9999,display:"flex",flexDirection:"column",background:"#000"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",height:48,paddingLeft:8,paddingRight:16,background:"#111",flexShrink:0},children:e.jsxs("button",{onClick:m,style:{display:"flex",alignItems:"center",gap:6,background:"none",border:"none",color:"#fff",fontSize:14,fontWeight:500,cursor:"pointer",padding:"8px 12px",borderRadius:6},children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{d:"M10 12L6 8L10 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),"Cancel"]})}),e.jsxs("div",{style:{flex:1,position:"relative",overflow:"hidden"},children:[!l&&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:x,style:{display:l?"block":"none",width:"100%",height:"100%",border:"none"},allow:S,onLoad:()=>c(!0),title:"Provider Checkout"})]})]}),document.body)}if(s.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 ",s.gateway," to complete your payment."]}),h!==null&&e.jsxs("p",{className:"text-[13px] mb-4",style:{color:"var(--t-text-muted)"},children:["Redirecting in ",h,"..."]}),e.jsxs("a",{href:s.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 ",s.gateway]}),e.jsx("button",{className:"w-full font-semibold text-[14px] mt-2 transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)"},onClick:m,children:"Cancel"})]});if(s.checkout.method==="widget"&&s.widgetConfig){const x=jn(s.checkout.url,s.widgetConfig);return ft.createPortal(e.jsxs("div",{style:{position:"fixed",inset:0,zIndex:9999,display:"flex",flexDirection:"column",background:"#000"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",height:48,paddingLeft:8,paddingRight:16,background:"#111",flexShrink:0},children:e.jsxs("button",{onClick:m,style:{display:"flex",alignItems:"center",gap:6,background:"none",border:"none",color:"#fff",fontSize:14,fontWeight:500,cursor:"pointer",padding:"8px 12px",borderRadius:6},children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{d:"M10 12L6 8L10 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),"Cancel"]})}),e.jsxs("div",{style:{flex:1,position:"relative",overflow:"hidden"},children:[!l&&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:x,style:{display:l?"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:()=>c(!0),title:"Payment Checkout"})]})]}),document.body)}return e.jsxs("div",{className:`flex flex-col items-center justify-center p-8 ${t}`,style:{color:"var(--t-text)"},children:[e.jsx("p",{className:"text-[15px] mb-4",children:"Unknown checkout method"}),e.jsx("button",{className:"font-semibold text-[14px] transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)",paddingLeft:24,paddingRight:24},onClick:m,children:"Go Back"})]})}function jn(t,n){const a=new URL("/en/partner/widget",t);for(const[s,r]of Object.entries(n))r!=null&&r!==""&&a.searchParams.set(s,String(r));return a.toString()}function Vt({className:t=""}){const{orderStatus:n,orderStatusLoading:a,goToStep:s}=ue();o.useEffect(()=>{n&&(n.status==="completed"?s("complete"):["failed","cancelled","expired","refunded"].includes(n.status)&&s("error"))},[n==null?void 0:n.status,s]);const r=()=>{if(!n)return"Processing your order...";switch(n.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:r()}),a&&e.jsx("p",{className:"text-[13px] mb-4",style:{color:"var(--t-text-muted)"},children:"Checking status..."}),n&&e.jsxs("div",{className:"w-full mt-6 text-left",style:{background:"var(--t-surface)",borderRadius:5,padding:16},children:[e.jsx(ve,{label:"Order ID",value:n.orderId,mono:!0}),e.jsx(ve,{label:"Provider",value:n.gateway}),e.jsx(ve,{label:"Amount",value:`${n.fiatAmount} ${n.fiatCurrency}`}),e.jsx(ve,{label:"Receiving",value:`${n.cryptoAmount||"..."} ${n.cryptoCurrency}`}),e.jsx(ve,{label:"Network",value:n.network}),e.jsx(ve,{label:"To Address",value:`${n.walletAddress.slice(0,10)}...${n.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 ve({label:t,value:n,mono:a}){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 ${a?"font-mono":""}`,style:{color:"var(--t-text)"},children:n})]})}function Yt({className:t="",explorerUrl:n,onDone:a,doneButtonText:s="Done"}){const{orderStatus:r,state:u,dispatch:m}=ue(),l=u.flowType==="sell",c=()=>{if(!(r!=null&&r.transactionHash))return null;if(!n){const d={ethereum:"https://etherscan.io/tx/{txHash}",polygon:"https://polygonscan.com/tx/{txHash}",arbitrum:"https://arbiscan.io/tx/{txHash}",optimism:"https://optimistic.etherscan.io/tx/{txHash}",base:"https://basescan.org/tx/{txHash}",bitcoin:"https://mempool.space/tx/{txHash}",solana:"https://solscan.io/tx/{txHash}",avalanche:"https://snowtrace.io/tx/{txHash}",fantom:"https://ftmscan.com/tx/{txHash}"};return(d[u.network]||d.ethereum).replace("{txHash}",r.transactionHash)}return n.replace("{txHash}",r.transactionHash)},h=()=>{a?a():m({type:"RESET"})},p=c();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:l?"Sale Complete!":"Purchase Complete!"}),e.jsx("p",{className:"text-[14px] mb-6",style:{color:"var(--t-text-secondary)"},children:l?`Your ${(r==null?void 0:r.fiatCurrency)||u.fiatCurrency} payout is being processed.`:`Your ${(r==null?void 0:r.cryptoCurrency)||u.cryptoCurrency} has been sent to your wallet.`}),r&&e.jsxs("div",{className:"w-full text-left mb-6",style:{background:"var(--t-surface)",borderRadius:5,padding:16},children:[e.jsx(se,{label:l?"Amount Sold":"Amount Received",value:`${r.cryptoAmount} ${r.cryptoCurrency}`,highlight:!0}),e.jsx(se,{label:l?"Payout Amount":"Amount Paid",value:`${r.fiatAmount} ${r.fiatCurrency}`}),e.jsx(se,{label:"Network",value:r.network}),e.jsx(se,{label:"Wallet",value:`${r.walletAddress.slice(0,10)}...${r.walletAddress.slice(-8)}`,mono:!0}),r.transactionHash&&e.jsx(se,{label:"Transaction",value:`${r.transactionHash.slice(0,10)}...${r.transactionHash.slice(-8)}`,mono:!0}),e.jsx(se,{label:"Provider",value:r.gateway}),e.jsx(se,{label:"Order ID",value:r.orderId,mono:!0}),r.completedAt&&e.jsx(se,{label:"Completed",value:new Date(r.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:h,children:s})]})]})}function se({label:t,value:n,mono:a,highlight:s}){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 ${a?"font-mono":""}`,style:{color:s?"var(--t-success, #10b981)":"var(--t-text)"},children:n})]})}function Qt({className:t="",onRetry:n,supportEmail:a="support@nowramp.com"}){const{state:s,orderStatus:r,dispatch:u,goToStep:m}=ue(),l=s.flowType==="sell",c=()=>{if(r)switch(r.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"},h=()=>{if(s.errorMessage)return s.errorMessage;if(r)switch(r.status){case"failed":return l?"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 l?"Your sale was cancelled. No crypto was transferred.":"Your order was cancelled. No payment was processed.";case"expired":return l?"Your order has expired. Please start a new sale.":"Your order has expired. Please start a new purchase.";case"refunded":return l?"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=()=>{u({type:"CLEAR_ERROR"}),n?n():(u({type:"RESET"}),m("amount"))},d=()=>{u({type:"RESET"}),m("amount")};return e.jsxs("div",{className:`flex flex-col items-center px-8 py-12 text-center ${t}`,children:[e.jsx("div",{className:"flex items-center justify-center mb-5",style:{width:64,height:64,borderRadius:"50%",background:"var(--t-error, #EF4444)"},children:e.jsx("svg",{viewBox:"0 0 24 24",width:"32",height:"32",fill:"white",children:e.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})})}),e.jsx("h2",{className:"text-[20px] font-semibold mb-2",style:{color:"var(--t-text)"},children:c()}),e.jsx("p",{className:"text-[14px] mb-6",style:{color:"var(--t-text-secondary)"},children:h()}),r&&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:r.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:d,children:"Start Over"})]}),e.jsxs("div",{className:"mt-6",children:[e.jsxs("p",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:["Need help? Contact"," ",e.jsx("a",{href:`mailto:${a}`,className:"underline",style:{color:"var(--t-accent)"},children:a})]}),r&&e.jsxs("p",{className:"text-[12px] mt-1",style:{color:"var(--t-text-muted)"},children:["Reference: ",r.orderId]})]})]})}function vt(t){return t.length<=12?t:`${t.slice(0,6)}...${t.slice(-6)}`}function Zt({className:t=""}){const{config:n,configLoading:a,state:s,defaultGateway:r,fetchQuotes:u,createOrder:m,orderLoading:l}=ue(),c=s.flowType==="sell",[h,p]=o.useState(null),d=n==null?void 0:n.gateways.find(x=>x.id===r),f=async()=>{p(null);try{u(),await m()}catch(x){const S=x instanceof Error?x.message:"Failed to create order";p(S)}};return a?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:c?"Confirm Sale":"Confirm Purchase"}),e.jsxs("div",{className:"w-full text-left mb-6",style:{background:"var(--t-surface)",borderRadius:5,padding:16},children:[d&&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:[d.logo&&e.jsx("img",{src:d.logo,alt:d.name,width:20,height:20,style:{borderRadius:4}}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:d.name})]})]}),c?e.jsxs(e.Fragment,{children:[e.jsx(de,{label:"You sell",value:`${s.cryptoAmount} ${s.cryptoCurrency}`,highlight:!0}),e.jsx(de,{label:"You receive",value:`${s.fiatCurrency} payout`})]}):e.jsxs(e.Fragment,{children:[e.jsx(de,{label:"You pay",value:`${s.fiatAmount} ${s.fiatCurrency}`,highlight:!0}),e.jsx(de,{label:"You receive",value:`${s.cryptoCurrency} on ${s.network}`}),e.jsx(de,{label:"Wallet",value:vt(s.walletAddress),mono:!0})]}),e.jsx(de,{label:"Network",value:s.network}),c&&s.walletAddress&&e.jsx(de,{label:"Refund address",value:vt(s.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:l?.7:1},disabled:l,onClick:f,children:l?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"nramp-spinner-inline"}),"Processing..."]}):c?"Confirm & Sell":"Confirm & Pay"})]})}function de({label:t,value:n,mono:a,highlight:s}){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 ${a?"font-mono":""}`,style:{color:s?"var(--t-success, #10b981)":"var(--t-text)"},children:n})]})}function Ae({isOpen:t,onClose:n,children:a}){const[s,r]=o.useState(!1),[u,m]=o.useState(!1);o.useEffect(()=>{if(t)r(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>m(!0)));else if(s){m(!1);const c=setTimeout(()=>r(!1),250);return()=>clearTimeout(c)}},[t]);const l=o.useCallback(()=>{m(!1),setTimeout(()=>n(),250)},[n]);return o.useEffect(()=>{if(!t)return;const c=h=>{h.key==="Escape"&&l()};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[t,l]),s?e.jsx("div",{className:"absolute inset-0 z-20 transition-opacity duration-250",style:{opacity:u?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:u?"translateY(0)":"translateY(24px)"},children:typeof a=="function"?a(l):a})}):null}function zt({char:t,height:n=38}){const a="0123456789",s=a.indexOf(t);return s===-1?e.jsx("span",{children:t}):e.jsx("span",{className:"digit-slot",style:{height:n,lineHeight:`${n}px`},children:e.jsx("span",{className:"digit-slot-inner block",style:{transform:`translateY(-${s*n}px)`},children:a.split("").map(r=>e.jsx("span",{className:"block",style:{height:n,lineHeight:`${n}px`},children:r},r))})})}function Jt({value:t,height:n=38,className:a="",style:s={}}){return e.jsx("span",{className:a,style:{display:"inline-flex",...s},children:t.split("").map((r,u)=>e.jsx(zt,{char:r,height:n},u))})}function I({w:t,h:n,className:a=""}){return e.jsx("div",{className:`skeleton ${a}`,style:{width:t,height:n}})}function qt(){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(I,{w:70,h:14,className:"mb-3"}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(I,{w:120,h:32}),e.jsx(I,{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(I,{w:50,h:14,className:"mb-3"}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(I,{w:180,h:32}),e.jsx(I,{w:85,h:32})]})]}),e.jsxs("div",{className:"flex justify-between mt-3 px-[2px]",children:[e.jsx(I,{w:140,h:12}),e.jsx(I,{w:90,h:12})]}),e.jsxs("div",{className:"mt-8",children:[e.jsx(I,{w:65,h:14,className:"mb-2.5"}),e.jsx(I,{w:"100%",h:47})]}),e.jsx("div",{className:"flex-1"}),e.jsx(I,{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 be({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:n=>n.currentTarget.style.backgroundColor="var(--t-close-hover)",onMouseLeave:n=>n.currentTarget.style.backgroundColor="var(--t-close-bg)",children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:e.jsx("path",{d:"M1 1L9 9M9 1L1 9",stroke:"var(--t-icon-close)",strokeWidth:"1.4",strokeLinecap:"round"})})})}function Re({value:t,onChange:n,placeholder:a=""}){return e.jsxs("div",{className:"relative mx-5 mb-5",children:[e.jsx("input",{type:"text",value:t,onChange:s=>n(s.target.value),placeholder:a,style:{height:47,borderRadius:4.5,border:"1px solid var(--t-border)",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:()=>n(""),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 en({onClose:t,onSelect:n,currencies:a,assetBaseUrl:s="",selectedCode:r}){const[u,m]=o.useState(""),l=o.useMemo(()=>{if(!a||a.length===0)return Ve;const h=new Map(Ve.map(p=>[p.code,p.name]));return a.map(p=>({code:p.code,name:p.name||h.get(p.code)||p.code}))},[a]),c=o.useMemo(()=>{const h=u.trim().toLowerCase();if(!h){if(r){const p=l.find(d=>d.code===r);if(p){const d=l.filter(f=>f.code!==r);return[p,...d]}}return l}return l.filter(p=>p.code.toLowerCase().includes(h)||p.name.toLowerCase().includes(h))},[l,u,r]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(be,{onClick:t})}),e.jsx("h2",{className:"text-center text-[17px] font-medium mt-2 mb-6",style:{color:"var(--t-text)",fontSize:17,fontWeight:500,marginTop:8,marginBottom:24},children:"Select fiat currency"}),e.jsx(Re,{value:u,onChange:m}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[c.map((h,p)=>{const d=h.name!==h.code?h.name:"",f=r===h.code;return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>n(h.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(Oe,{currencyCode:h.code,size:32,baseUrl:s}),e.jsxs("div",{className:"text-left flex-1 flex items-center gap-2",children:[e.jsx("span",{className:"font-semibold text-[15px]",children:h.code}),d&&e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:d})]}),f&&e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"var(--t-success, #4CD964)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),p<c.length-1&&e.jsx("div",{style:{height:1,background:"var(--t-divider, rgba(255,255,255,0.08))"}})]},h.code)}),c.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No currencies found"})]})]})}function Ct({src:t,alt:n,size:a,className:s,style:r}){const[u,m]=o.useState(!1),[l,c]=o.useState(!1),h=o.useCallback(()=>m(!0),[]),p=o.useCallback(()=>c(!0),[]);return e.jsxs("div",{className:s,style:{...r,width:a,height:a,position:"relative"},children:[!u&&!l&&e.jsx("div",{className:"absolute inset-0 rounded-full animate-pulse",style:{background:"var(--t-pill-bg, #333)"}}),l?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:n.slice(0,3)}):e.jsx("img",{src:t,alt:n,width:a,height:a,loading:"lazy",onLoad:h,onError:p,className:`rounded-full ${u?"opacity-100":"opacity-0"}`,style:{width:a,height:a,transition:"opacity 0.15s ease-in"}})]})}function tn({onClose:t,onSelect:n,cryptos:a,assetBaseUrl:s="",selectedCode:r,selectedChain:u}){const[m,l]=o.useState(""),c=o.useMemo(()=>{if(!a||a.length===0)return Lt;const d=[];for(const f of a){const x=f.networks||[],S=f.name||yn[f.code]||f.code;if(x.length===0)d.push({code:f.code,name:S,chain:f.code,popular:!1});else for(const C of x){const R=C.code||C.id||C.name||f.code;d.push({code:f.code,name:S,chain:R,chainName:C.name,popular:!1})}}return d},[a]),h=o.useCallback((d,f)=>r===d&&u===f,[r,u]),p=o.useMemo(()=>{var S;const d=m.trim().toLowerCase();if(!d){if(r&&u){const C=c.find(R=>R.code===r&&R.chain===u);if(C){const R=c.filter($=>!($.code===r&&$.chain===u));return[C,...R]}}return c}const f=d.split(/\s+/),x=[];for(const C of c){const R=Me(C.chain),$=R?R.name.toLowerCase():"",W=((S=R==null?void 0:R.shortName)==null?void 0:S.toLowerCase())||"",Y=C.chain.toLowerCase(),Q=C.code.toLowerCase(),te=C.name.toLowerCase(),g=[Q,te,$,W,Y];if(!f.every(i=>g.some(b=>b.includes(i))))continue;let E=0;Q===d?E+=100:Q.startsWith(f[0])&&(E+=50),C.popular&&(E+=10),f.length>1&&($.includes(f[1])||W.includes(f[1])||Y.includes(f[1]))&&(E+=25),x.push({item:C,score:E})}return x.sort((C,R)=>R.score-C.score),x.map(C=>C.item)},[c,m,r,u]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(be,{onClick:t})}),e.jsx("h2",{className:"text-center text-[17px] font-medium mt-2 mb-6",style:{color:"var(--t-text)",fontSize:17,fontWeight:500,marginTop:8,marginBottom:24},children:"Select crypto currency"}),e.jsx(Re,{value:m,onChange:l}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[p.map((d,f)=>{const x=Me(d.chain),S=(x==null?void 0:x.name)||d.chainName||d.chain,C=d.name!==d.code?d.name:"",R=h(d.code,d.chain);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>n(d.code,d.chain),className:"flex items-center w-full transition-colors rounded-lg hover-item",style:{gap:14,padding:"18px 8px",margin:"0 -8px"},children:[e.jsxs("div",{className:"relative shrink-0",style:{width:40,height:40},children:[e.jsx("div",{className:"absolute top-0 left-0",style:{background:"#ffffff",borderRadius:"50%"},children:e.jsx(Ct,{src:Je(d.code,s),alt:d.code,size:32})}),e.jsx("div",{className:"absolute",style:{bottom:0,right:0,border:"2px solid var(--t-surface, #1C1C22)",borderRadius:"50%",background:"#ffffff"},children:e.jsx(Ct,{src:Be(d.chain,s),alt:d.chain,size:16})})]}),e.jsx("div",{className:"text-left flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-semibold text-[15px]",style:{color:"var(--t-text)"},children:d.code}),C&&e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:C})]})}),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:S}),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"})})]})]}),f<p.length-1&&e.jsx("div",{style:{height:1,background:"var(--t-divider, rgba(255,255,255,0.08))"}})]},`${d.code}-${d.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 Sn({methods:t,selectedId:n,onSelect:a,onClose:s}){const[r,u]=o.useState(""),m=o.useMemo(()=>{const l=r.trim().toLowerCase();if(!l){if(n){const c=t.find(h=>h.id===n);if(c){const h=t.filter(p=>p.id!==n);return[c,...h]}}return t}return t.filter(c=>c.id.toLowerCase().includes(l)||c.name.toLowerCase().includes(l)||c.description&&c.description.toLowerCase().includes(l))},[t,r,n]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(be,{onClick:s})}),e.jsx("h2",{className:"text-center text-[17px] font-medium mt-2 mb-6",style:{color:"var(--t-text)",fontSize:17,fontWeight:500,marginTop:8,marginBottom:24},children:"Choose payment method"}),e.jsx(Re,{value:r,onChange:u}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[m.map((l,c)=>{const h=l.id===n,p=Xt(l.id,l.name);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>a(l.id),className:`flex w-full transition-colors rounded-lg hover-item ${l.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 ${l.description?"mt-0.5":""}`,style:{width:32,height:32},children:$t(l.id,l.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}),l.description&&e.jsx("div",{className:"text-[13px] leading-snug mt-1",style:{color:"var(--t-text-secondary)"},children:l.description})]}),h&&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"})})]}),c<m.length-1&&e.jsx("div",{style:{height:1,background:"var(--t-divider, rgba(255,255,255,0.08))"}})]},l.id)}),m.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No payment methods found"})]})]})}function nn({checked:t,onChange:n,accentColor:a="var(--t-accent)"}){return e.jsx("button",{onClick:()=>n(!t),className:"relative shrink-0 transition-colors duration-200",style:{width:48,height:28,borderRadius:14,backgroundColor:t?a:"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 En=[{label:"Privacy policy",href:"https://nowramp.com/privacy-policy"},{label:"Terms of use",href:"https://nowramp.com/terms-and-conditions"}];function an({onClose:t,darkMode:n,onToggleDarkMode:a,skinId:s,onSelectSkin:r,showThemeToggle:u=!0}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end items-center px-5 pt-5",children:e.jsx(be,{onClick:t})}),e.jsxs("div",{className:"px-5 flex-1 pt-6 overflow-y-auto custom-scroll",children:[u&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{borderTop:"1px solid var(--t-divider)"},children:e.jsxs("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(Kt,{size:40}),e.jsx("span",{className:"font-medium text-[15px]",style:{color:"var(--t-text)"},children:"Dark Mode"})]}),e.jsx(nn,{checked:n,onChange:a,accentColor:"#4CD964"})]})}),e.jsx("div",{style:{height:1,background:"var(--t-divider)"}})]}),En.map(m=>e.jsxs("div",{children:[e.jsxs("a",{href:m.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:m.label}),e.jsx(Ut,{})]}),e.jsx("div",{style:{height:1,background:"var(--t-divider)"}})]},m.label))]})]})}function An({className:t="",theme:n="dark",skinId:a="mono",accentColor:s,bgColor:r,bgImage:u,borderColor:m,borderRadius:l,surfaceColor:c,inputBgColor:h,textColor:p,textSecondaryColor:d,textMutedColor:f,successColor:x,showFlowToggle:S=!0,showSettings:C=!0,showThemeToggle:R=!0,autoRedirect:$=!1,explorerUrl:W,doneButtonText:Y="Done",supportEmail:Q,onDone:te}){var lt,ct,it,dt,ut,mt,pt,ht;const{state:g,dispatch:T,config:E,configLoading:i,quotes:b,quotesLoading:M,quotesError:k,fetchQuotes:Ne,createOrder:ne,orderLoading:U,amountError:re,fieldLocks:w,apiConfig:me,assetBaseUrl:K}=ue(),[Z,z]=o.useState(n==="dark"),[pe,je]=o.useState(a),[oe,_]=o.useState(null),[X,we]=o.useState(!1),[he,Se]=o.useState(!1),[fe,xe]=o.useState(!1),[He,le]=o.useState(null),[Ee,Ue]=o.useState(!0),[Fe,v]=o.useState(!1),[j,P]=o.useState(!1),D=o.useRef(null),L=o.useRef(),H=o.useRef(g.flowType);o.useEffect(()=>{z(n==="dark")},[n]),o.useEffect(()=>{const y=setTimeout(()=>Ue(!1),i?0:800);return()=>clearTimeout(y)},[i]),o.useEffect(()=>{if(H.current!==g.flowType&&!Ee){H.current=g.flowType,v(!0),we(!1),Se(!1);const y=setTimeout(()=>v(!1),350);return()=>clearTimeout(y)}H.current=g.flowType},[g.flowType,Ee]);const F=g.flowType,B=F==="buy",G=g.cryptoCurrency||"BTC",J=g.fiatCurrency||"USD",Ke=B?g.fiatAmount:g.cryptoAmount,ce=kt(Ke),ye=(lt=b==null?void 0:b.bestQuote)!=null&<.exchangeRate?parseFloat(b.bestQuote.exchangeRate):null,Te=o.useRef(null);ye&&G&&J&&(Te.current={rate:ye,crypto:G,fiat:J});const rn=o.useMemo(()=>{if(b!=null&&b.bestQuote){const y=B?b.bestQuote.cryptoAmount:b.bestQuote.fiatAmount;if(y)return y}return"0"},[b,B]),on=o.useMemo(()=>{var O,ae,$e;const y=ye||((O=Te.current)==null?void 0:O.rate),N=ye?G:(ae=Te.current)==null?void 0:ae.crypto,A=ye?J:($e=Te.current)==null?void 0:$e.fiat;return!y||!N||!A?"":`1 ${N} ≈ ${y.toFixed(2)} ${A}`},[G,J,ye]);o.useEffect(()=>{const y=g.walletAddress.trim(),N=g.network;if(!y||y.length<10){le(null),T({type:"SET_WALLET_ERROR",message:""});return}return xe(!0),le(null),clearTimeout(L.current),L.current=setTimeout(async()=>{var A,O,ae;try{const We=await(await fetch(`${me.apiUrl}/public/validate/address`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:y,...N?{network:N}:{}})})).json(),Ge=((A=We.data)==null?void 0:A.attributes)||We.data||We;if(Ge.isValid)le(!0),T({type:"SET_WALLET_ERROR",message:""});else{le(!1);const fn=((O=Ge.errors)==null?void 0:O[0])||((ae=Ge.details)==null?void 0:ae.formatMessage)||"Invalid wallet address";T({type:"SET_WALLET_ERROR",message:fn})}}catch{le(null)}finally{xe(!1)}},500),()=>clearTimeout(L.current)},[g.walletAddress,g.network,me.apiUrl]);const qe=!Ke||ce===0,et=ce>0&&(B?ce<yt:ce<gt),tt=!!re||et||X&&qe,ln=ce>0&&!re&&!et,_e=g.walletAddress.trim().length>=10&&He!==!1&&!fe,ke=ln&&_e&&!!g.cryptoCurrency&&!!g.network,cn=y=>{let N=y.target.value.replace(/[^0-9.,]/g,"");const A=B?2:6,O=N.indexOf(".");O!==-1&&N.length-O-1>A&&(N=N.slice(0,O+A+1)),T(B?{type:"SET_FIAT_AMOUNT",amount:N}:{type:"SET_CRYPTO_AMOUNT",amount:N})},nt=y=>{y!==F&&T({type:"SET_FLOW_TYPE",flowType:y})},dn=o.useCallback(y=>{T({type:"SET_FIAT_CURRENCY",currency:y})},[T]),un=o.useCallback((y,N)=>{T({type:"SET_CRYPTO_CURRENCY",currency:y}),T({type:"SET_CRYPTO_CHAIN",chain:N})},[T]),mn=o.useCallback(y=>{T({type:"SET_PAYMENT_METHOD",methodId:y})},[T]),pn=()=>{ke&&(P(!0),Ne())};o.useEffect(()=>{var y;if(!(!j||M)){if(b!=null&&b.bestQuote)P(!1),T({type:"SELECT_QUOTE",quote:b.bestQuote}),ne().catch(()=>{});else if(k)P(!1),T({type:"SET_ERROR",message:k.message||"No quotes available"});else if(b&&!b.bestQuote){P(!1);const N=(y=b.unavailableGateways)==null?void 0:y.map(O=>O.reason).filter(Boolean),A=N!=null&&N.length?`No providers available: ${N.join("; ")}`:"No providers available for this currency/network combination";T({type:"SET_ERROR",message:A})}}},[j,b,M,k,T,ne]);const at=Z?"theme-dark":"theme-light",Xe=Ye.find(y=>y.id===pe)||Ye[0],hn=Xe.accent===null,st=(s?ee(s):!1)?{"--t-accent":s,"--t-cta-bg":s,"--t-cta-text":"#ffffff"}:hn?{"--t-accent":Z?"#ffffff":"#111111","--t-cta-bg":Z?"#ffffff":"#111111","--t-cta-text":Z?"#000000":"#ffffff"}:{"--t-accent":Xe.accent,"--t-cta-bg":Xe.accent,"--t-cta-text":"#ffffff"},V={};c&&ee(c)&&(V["--t-surface"]=c,V["--t-modal-bg"]=c),h&&ee(h)&&(V["--t-pill-bg"]=h,V["--t-close-bg"]=h),p&&ee(p)&&(V["--t-text"]=p),d&&ee(d)&&(V["--t-text-secondary"]=d),f&&ee(f)&&(V["--t-text-muted"]=f,V["--t-text-tertiary"]=f),x&&ee(x)&&(V["--t-success"]=x);const ie={};r&&ee(r)?ie.backgroundColor=r:ie.backgroundColor="var(--t-bg)",u&&(ie.backgroundImage=`url(${u})`,ie.backgroundSize="cover",ie.backgroundPosition="center");const Le={};m&&ee(m)&&(Le.border=`1px solid ${m}`),l&&(Le.borderRadius=l);const rt=g.step==="checkout"?e.jsx(Gt,{autoRedirect:$}):g.step==="processing"?e.jsx(Vt,{}):g.step==="complete"?e.jsx(Yt,{explorerUrl:W,doneButtonText:Y,onDone:te}):g.step==="error"?e.jsx(Qt,{supportEmail:Q}):g.step==="confirm"?e.jsx(Zt,{}):null;if(rt)return e.jsx("div",{className:`${at} relative w-full max-w-[390px] h-[640px] overflow-hidden flex flex-col select-none transition-colors duration-300 ${t}`,style:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',...ie,...st,...V,...Le},children:rt});const q=g.network,ge=q?Me(q):null,ot=(ge==null?void 0:ge.shortName)||(ge==null?void 0:ge.name)||q;return e.jsxs("div",{className:`${at} relative w-full max-w-[390px] min-h-[640px] overflow-hidden flex flex-col select-none transition-colors duration-300 ${t}`,style:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',...ie,...st,...V,...Le},children:[C&&e.jsx("div",{className:`flex justify-end items-center px-5 pt-3 ${S?"pb-1":"pb-5"}`,children:e.jsx(Ft,{onClick:()=>_("settings")})}),S?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:()=>nt("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:()=>nt("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,Ee||Fe||i?e.jsx(qt,{}):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:X&&tt?"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:D,type:"text",value:Ke,onChange:cn,onBlur:()=>we(!0),placeholder:B?"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:!!((ct=w==null?void 0:w.sourceAmount)!=null&&ct.locked)}),B?e.jsxs("button",{onClick:()=>_("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:!!((it=w==null?void 0:w.sourceCurrency)!=null&&it.locked),children:[e.jsx(Oe,{currencyCode:J,size:16,baseUrl:K}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:J}),e.jsx(Ce,{})]}):e.jsxs("div",{className:"flex flex-col items-end shrink-0",children:[e.jsxs("button",{onClick:()=>_("crypto"),className:"flex items-center gap-1.5 transition-colors",style:{background:"var(--t-pill-bg)",borderRadius:4,height:32,paddingLeft:10,paddingRight:10},disabled:!!((dt=w==null?void 0:w.destinationCurrency)!=null&&dt.locked),children:[e.jsx(Ze,{ticker:G,size:16,baseUrl:K}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:G}),e.jsx(Ce,{})]}),q&&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:Be(q,K),alt:q,width:14,height:14,className:"rounded-full",style:{width:14,height:14}})}),e.jsx("span",{className:"text-[12px]",style:{color:"var(--t-text-muted)"},children:ot})]})]})]})]}),X&&tt&&e.jsx("div",{className:"text-[12px] mt-1.5 px-[2px]",style:{color:"#EF4444"},children:re||(qe?"Amount should be more than 0":B?`Minimum amount is ${yt} ${J}`:`Minimum amount is ${gt} ${G}`)}),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:[M&&!j?e.jsx(I,{w:180,h:32}):e.jsx(Jt,{value:ce>0?rn:"0",height:32,className:"font-semibold",style:{color:ce>0?"var(--t-text)":"var(--t-text-muted)",fontSize:24}}),B?e.jsxs("div",{className:"flex flex-col items-end shrink-0",children:[e.jsxs("button",{onClick:()=>_("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:!!((ut=w==null?void 0:w.destinationCurrency)!=null&&ut.locked),children:[e.jsx(Ze,{ticker:G,size:16,baseUrl:K}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:G}),e.jsx(Ce,{})]}),q&&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:Be(q,K),alt:q,width:14,height:14,className:"rounded-full",style:{width:14,height:14}})}),e.jsx("span",{className:"text-[12px]",style:{color:"var(--t-text-muted)"},children:ot})]})]}):e.jsxs("button",{onClick:()=>_("fiat"),className:"flex items-center gap-1.5 shrink-0 transition-colors",style:{background:"var(--t-pill-bg)",borderRadius:4,height:32,paddingLeft:10,paddingRight:10},disabled:!!((mt=w==null?void 0:w.sourceCurrency)!=null&&mt.locked),children:[e.jsx(Oe,{currencyCode:J,size:16,baseUrl:K}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:J}),e.jsx(Ce,{})]})]})]}),e.jsx("div",{className:"flex items-center justify-between mt-[2px] px-[18px] pt-[12px] pb-[14px]",style:{background:"var(--t-surface)",...(pt=E==null?void 0:E.paymentMethods)!=null&&pt.length?{}:{borderBottomLeftRadius:5,borderBottomRightRadius:5}},children:e.jsx("span",{className:"text-[12px]",style:{color:x?"var(--t-success)":"var(--t-text-secondary)"},children:on||" "})}),(E==null?void 0:E.paymentMethods)&&E.paymentMethods.length>0&&e.jsx("div",{className:"mt-[2px]",children:e.jsx(Wt,{methods:E.paymentMethods,selectedId:g.paymentMethodId,onOpenModal:()=>_("payment"),fiatCurrency:g.fiatCurrency})}),e.jsxs("div",{className:"mt-8",children:[e.jsx("div",{className:"text-[13px] mb-2.5",style:{color:"var(--t-text-secondary)"},children:B?"Receiving wallet address":"Sending wallet address"}),e.jsx("input",{type:"text",value:g.walletAddress,onChange:y=>T({type:"SET_WALLET_ADDRESS",address:y.target.value}),onBlur:()=>Se(!0),placeholder:B?"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:g.walletError||he&&!_e?"1px solid #EF4444":"1px solid var(--t-border)",borderRadius:3.5,height:47,padding:"0 14px",color:"var(--t-text)",fontSize:13,backgroundColor:"transparent"},disabled:!!((ht=w==null?void 0:w.destinationAddress)!=null&&ht.locked)}),g.walletError?e.jsx("div",{className:"text-[12px] mt-1.5",style:{color:"#EF4444"},children:g.walletError}):he&&!_e&&!fe?e.jsx("div",{className:"text-[12px] mt-1.5",style:{color:"#EF4444"},children:"Enter a valid wallet address"}):fe&&g.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"}),e.jsx("button",{disabled:!ke||U||j,onClick:pn,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:ke&&!U&&!j?1:.4,cursor:ke&&!U&&!j?"pointer":"not-allowed"},children:j?"Getting best price...":U?"Processing...":B?`Buy ${G}`:`Sell ${G}`}),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:oe==="fiat",onClose:()=>_(null),children:y=>{var N;return e.jsx(en,{onClose:y,onSelect:A=>{dn(A),y()},currencies:(N=E==null?void 0:E.fiats)==null?void 0:N.map(A=>({code:A.code,name:A.code})),assetBaseUrl:K,selectedCode:g.fiatCurrency})}}),e.jsx(Ae,{isOpen:oe==="crypto",onClose:()=>_(null),children:y=>{var N;return e.jsx(tn,{onClose:y,onSelect:(A,O)=>{un(A,O),y()},cryptos:(N=E==null?void 0:E.cryptos)==null?void 0:N.map(A=>{var O;return{code:A.code,name:A.code,networks:(O=A.networks)==null?void 0:O.map(ae=>({code:ae.id,name:ae.name}))}}),assetBaseUrl:K,selectedCode:g.cryptoCurrency,selectedChain:g.network})}}),e.jsx(Ae,{isOpen:oe==="payment",onClose:()=>_(null),children:y=>{var N;return e.jsx(Sn,{methods:((N=E==null?void 0:E.paymentMethods)==null?void 0:N.filter(A=>A.supportedFiats.includes(g.fiatCurrency)))||[],selectedId:g.paymentMethodId,onSelect:A=>{mn(A),y()},onClose:y})}}),e.jsx(Ae,{isOpen:oe==="settings",onClose:()=>_(null),children:y=>e.jsx(an,{onClose:y,darkMode:Z,onToggleDarkMode:z,skinId:pe,onSelectSkin:N=>{je(N)},showThemeToggle:R})})]})}function sn({projectId:t,apiUrl:n,assetBaseUrl:a,flowType:s,customerId:r,brandId:u,defaultFiatCurrency:m,defaultCryptoCurrency:l,defaultNetwork:c,defaultFiatAmount:h,defaultCryptoAmount:p,defaultWalletAddress:d,defaultGateway:f,fieldLocks:x,statusPollInterval:S,onComplete:C,onError:R,className:$,theme:W,skinId:Y,accentColor:Q,bgColor:te,bgImage:g,borderColor:T,borderRadius:E,surfaceColor:i,inputBgColor:b,textColor:M,textSecondaryColor:k,textMutedColor:Ne,successColor:ne,showFlowToggle:U,showSettings:re,showThemeToggle:w,autoRedirect:me,explorerUrl:K,doneButtonText:Z,supportEmail:z,onDone:pe}){return e.jsx(Rt,{projectId:t,apiUrl:n,assetBaseUrl:a,flowType:s,customerId:r,brandId:u,defaultFiatCurrency:m,defaultCryptoCurrency:l,defaultNetwork:c,defaultFiatAmount:h,defaultCryptoAmount:p,defaultWalletAddress:d,defaultGateway:f,fieldLocks:x,statusPollInterval:S,onComplete:C,onError:R,children:e.jsx(An,{className:$,theme:W,skinId:Y,accentColor:Q,bgColor:te,bgImage:g,borderColor:T,borderRadius:E,surfaceColor:i,inputBgColor:b,textColor:M,textSecondaryColor:k,textMutedColor:Ne,successColor:ne,showFlowToggle:U,showSettings:re,showThemeToggle:w,autoRedirect:me,explorerUrl:K,doneButtonText:Z,supportEmail:z,onDone:pe})})}function Rn({submitButtonText:t,rateRefreshInterval:n,...a}){return e.jsx(sn,{...a})}function wn({skin:t,active:n,onClick:a,darkMode:s,dimmed:r}){const u=t.accent===null,m=32;return e.jsxs("button",{onClick:a,className:"relative shrink-0",style:{width:m,height:m,opacity:r?.4:1,transition:"opacity 0.2s"},children:[u?e.jsxs("svg",{width:m,height:m,viewBox:"0 0 32 32",children:[e.jsx("clipPath",{id:"mono-left",children:e.jsx("rect",{x:"0",y:"0",width:"16",height:"32"})}),e.jsx("clipPath",{id:"mono-right",children:e.jsx("rect",{x:"16",y:"0",width:"16",height:"32"})}),e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:"#111111",clipPath:"url(#mono-left)"}),e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:"#ffffff",clipPath:"url(#mono-right)"}),e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:"none",stroke:s?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.1)",strokeWidth:"1"})]}):e.jsx("svg",{width:m,height:m,viewBox:"0 0 32 32",children:e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:t.accent})}),n&&!r&&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 Tn({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 kn({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(De,{size:36})}function Ln(){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(I,{w:36,h:36,className:"rounded-full shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx(I,{w:90,h:14,className:"mb-1.5"}),e.jsx(I,{w:60,h:12})]}),e.jsxs("div",{className:"text-right",children:[e.jsx(I,{w:40,h:10,className:"mb-1.5"}),e.jsx(I,{w:80,h:14})]})]},t))})}function In({onClose:t,onSelect:n,quotes:a,quotesLoading:s,cryptoCurrency:r}){const[u,m]=o.useState(""),l=o.useMemo(()=>{if(!(a!=null&&a.quotes))return[];const c=u.trim().toLowerCase();return c?a.quotes.filter(h=>h.gatewayName.toLowerCase().includes(c)):a.quotes},[a,u]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(be,{onClick:t})}),e.jsx("h2",{className:"text-center text-[17px] font-medium mt-2 mb-6",style:{color:"var(--t-text)",fontSize:17,fontWeight:500,marginTop:8,marginBottom:24},children:"Choose Ramp"}),e.jsx(Re,{value:u,onChange:m}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5 space-y-2",children:[s?e.jsx(Ln,{}):l.length===0?e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:a&&a.quotes.length===0?"No quotes available for this request":"No providers found"}):l.map((c,h)=>{const p=h===0,d=parseFloat(c.cryptoAmount),f=d>=1?d.toFixed(4):d.toPrecision(6);return e.jsxs("button",{onClick:()=>n(c),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(kn,{quote:c}),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:c.gatewayName}),e.jsx(Tn,{quote:c})]}),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:[r," ",f]})]})]},c.gatewayId)}),!s&&(a==null?void 0:a.unavailableGateways)&&a.unavailableGateways.length>0&&e.jsx("div",{className:"pt-3",children:a.unavailableGateways.map(c=>e.jsxs("div",{className:"flex items-center justify-between py-2 text-[12px]",style:{color:"var(--t-text-muted)"},children:[e.jsx("span",{children:c.gatewayName}),e.jsx("span",{children:c.reason})]},c.gatewayId))})]})]})}exports.AnimatedDigit=zt;exports.AnimatedNumber=Jt;exports.ApplePayIcon=Ot;exports.BLOCKCHAINS=Ie;exports.BankIcon=Mt;exports.CRYPTO_CHAIN_COMBOS=Lt;exports.CRYPTO_CURRENCIES=ze;exports.CardIcon=Ht;exports.CheckoutForm=Rn;exports.CheckoutStep=Gt;exports.ChevronDown=Ce;exports.ChevronRight=Ut;exports.ChooseRampModal=In;exports.CloseButton=be;exports.CoinifyIcon=Cn;exports.CompleteStep=Yt;exports.ConfirmStep=Zt;exports.CryptoCurrencyModal=tn;exports.CryptoIcon=Ze;exports.DarkModeIcon=Kt;exports.ErrorStep=Qt;exports.FIAT_CURRENCIES=Ve;exports.FIAT_TO_COUNTRY=wt;exports.FiatCurrencyModal=en;exports.FiatFlag=Oe;exports.FormSkeleton=qt;exports.GenericCoinIcon=De;exports.GooglePayIcon=Pt;exports.MOCK_RATES=Qe;exports.MenuIcon=Ft;exports.Modal=Ae;exports.PayPalIcon=Dt;exports.PaymentMethodSelector=Wt;exports.ProcessingStep=Vt;exports.RampForm=sn;exports.RampProvider=Rt;exports.RevolutIcon=Bt;exports.SKINS=Ye;exports.SearchInput=Re;exports.SettingsScreen=an;exports.Skeleton=I;exports.SkinSwatch=wn;exports.ToggleSwitch=nn;exports.formatOutput=vn;exports.getChainIconUrl=Be;exports.getCryptoIconUrl=Je;exports.getFiatFlagUrl=Tt;exports.getMockRate=gn;exports.getPaymentIcon=_t;exports.parseAmount=kt;exports.useCheckoutIntent=jt;exports.useQuotes=Nt;exports.useRamp=ue;exports.useRampConfig=bt;exports.useTransaction=St;
|
|
11
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("react"),He=require("@nowramp/sdk"),ft=require("react-dom");function jt(t,n){const[a,s]=o.useState(null),[r,u]=o.useState(!0),[m,l]=o.useState(null),i=o.useRef(null);(!i.current||i.current!==t)&&(i.current=new He.RampApi({apiKey:"",...t}));const p=o.useCallback(async()=>{if(!t.projectId){l(new Error("projectId is required")),u(!1);return}u(!0),l(null);try{const h=await i.current.getSupported(n);s(h)}catch(h){l(h instanceof Error?h:new Error("Failed to fetch config"))}finally{u(!1)}},[t.projectId,n]);return o.useEffect(()=>{p()},[p]),{config:a,loading:r,error:m,refetch:p}}function bt(t,n){const[a,s]=o.useState(null),[r,u]=o.useState(!1),[m,l]=o.useState(null),i=o.useRef(null),p=o.useRef(""),h=`${t.apiUrl}|${t.projectId}`;(!i.current||p.current!==h)&&(i.current=new He.RampApi({apiKey:"",...t}),p.current=h);const d=o.useRef(0);o.useEffect(()=>{const x=++d.current;if(!n||!t.projectId){s(null),u(!1);return}u(!0),l(null),i.current.getQuotes(n).then(S=>{d.current===x&&(s(S),u(!1))},S=>{d.current===x&&(l(S instanceof Error?S:new Error("Failed to fetch quotes")),s(null),u(!1))})},[t.projectId,n==null?void 0:n.fiatCurrency,n==null?void 0:n.fiatAmount,n==null?void 0:n.cryptoAmount,n==null?void 0:n.cryptoCurrency,n==null?void 0:n.network,n==null?void 0:n.paymentMethodId,n==null?void 0:n.country,n==null?void 0:n.orderType]);const f=o.useCallback(async()=>{if(!(!n||!t.projectId)){u(!0),l(null);try{const x=await i.current.getQuotes(n);s(x)}catch(x){l(x instanceof Error?x:new Error("Failed to fetch quotes"))}finally{u(!1)}}},[t.projectId,n]);return{quotes:a,loading:r,error:m,refetch:f}}function Nt(t){const[n,a]=o.useState(null),[s,r]=o.useState(!1),[u,m]=o.useState(null),l=o.useRef(null),i=o.useRef(""),p=`${t.apiUrl}|${t.projectId}`;(!l.current||i.current!==p)&&(l.current=new He.RampApi({apiKey:"",...t}),i.current=p);const h=o.useCallback(async f=>{r(!0),m(null);try{const x=await l.current.createCheckoutIntent(f);return a(x),x}catch(x){const S=x instanceof Error?x:new Error("Failed to create checkout intent");throw m(S),S}finally{r(!1)}},[]),d=o.useCallback(()=>{a(null),m(null)},[]);return{order:n,loading:s,error:u,createOrder:h,reset:d}}function St(t,n,a){const[s,r]=o.useState(null),[u,m]=o.useState(!1),[l,i]=o.useState(null),p=o.useRef(null);p.current||(p.current=new He.RampApi({apiKey:"",projectId:"",...t}));const h=o.useCallback(async()=>{if(n){m(!0),i(null);try{const d=await p.current.getTransaction(n);r(d)}catch(d){i(d instanceof Error?d:new Error("Failed to fetch status"))}finally{m(!1)}}},[n]);return o.useEffect(()=>{if(!n)return;const d=(a==null?void 0:a.initialDelay)??0;if(d>0){const f=setTimeout(h,d);return()=>clearTimeout(f)}h()},[h,n,a==null?void 0:a.initialDelay]),o.useEffect(()=>{if(!n||!(a!=null&&a.pollInterval)||!s||["completed","failed","cancelled","expired","refunded"].includes(s.status))return;const f=setInterval(h,a.pollInterval);return()=>clearInterval(f)},[n,a==null?void 0:a.pollInterval,s==null?void 0:s.status,h]),{status:s,loading:u,error:l,refetch:h}}function xt(t,n){if(!t)return t;const a=t.indexOf(".");if(a===-1)return t;let s=t;return s.length-a-1>n&&(s=s.slice(0,a+n+1)),s=s.replace(/0+$/,"").replace(/\.$/,""),s}const Et={step:"amount",flowType:"buy",fiatCurrency:"USD",fiatAmount:"",cryptoCurrency:"",cryptoAmount:"",network:"",paymentMethodId:"",walletAddress:"",walletError:null,selectedProvider:null,selectedQuote:null,customerId:"",email:"",country:"",errorMessage:null};function xn(t,n){switch(n.type){case"SET_STEP":return{...t,step:n.step,errorMessage:null};case"SET_FLOW_TYPE":return{...t,flowType:n.flowType,fiatAmount:"",cryptoAmount:"",paymentMethodId:"",selectedQuote:null,selectedProvider:null,errorMessage:null};case"SET_FIAT_CURRENCY":return{...t,fiatCurrency:n.currency};case"SET_FIAT_AMOUNT":return{...t,fiatAmount:n.amount};case"SET_CRYPTO_CURRENCY":return{...t,cryptoCurrency:n.currency,network:""};case"SET_CRYPTO_AMOUNT":return{...t,cryptoAmount:n.amount};case"SET_NETWORK":return{...t,network:n.network};case"SET_CRYPTO_CHAIN":return{...t,network:n.chain};case"SET_PAYMENT_METHOD":return{...t,paymentMethodId:n.methodId};case"SET_WALLET_ADDRESS":return{...t,walletAddress:n.address,walletError:null};case"SET_WALLET_ERROR":return{...t,walletError:n.message};case"SELECT_QUOTE":return{...t,selectedQuote:n.quote,selectedProvider:n.quote.gatewayId};case"SET_CUSTOMER_ID":return{...t,customerId:n.customerId};case"SET_EMAIL":return{...t,email:n.email};case"SET_COUNTRY":return{...t,country:n.country};case"SET_ERROR":return{...t,step:"error",errorMessage:n.message};case"CLEAR_ERROR":return{...t,errorMessage:null};case"RESET":return Et;default:return t}}const At=o.createContext(null);function wt({projectId:t,apiUrl:n="https://api.nowramp.com",assetBaseUrl:a="",flowType:s="buy",customerId:r="",brandId:u,defaultFiatCurrency:m="USD",defaultCryptoCurrency:l="BTC",defaultNetwork:i="",defaultFiatAmount:p="",defaultCryptoAmount:h="",defaultWalletAddress:d="",defaultGateway:f,fieldLocks:x,statusPollInterval:S=5e3,onComplete:v,onError:w,children:X}){const $=o.useMemo(()=>({apiUrl:n,projectId:t}),[n,t]),Y=i||(l?l.toLowerCase():""),Z=s==="sell",te=Z?!!h:!!p,T=(Z?!!(te&&l&&Y):!!(te&&l&&Y&&d))&&f?"confirm":"amount",E=p||(s==="buy"?"250":""),[c,j]=o.useReducer(xn,{...Et,step:T,flowType:s,fiatCurrency:m,cryptoCurrency:l,network:Y,fiatAmount:xt(E,2),cryptoAmount:xt(h,6),walletAddress:d,customerId:r}),M=c.flowType==="sell",{config:k,loading:be,error:ne}=jt($,c.flowType);o.useEffect(()=>{var H,P,L;if(!k||!c.cryptoCurrency||c.network)return;const g=(H=k.cryptos)==null?void 0:H.find(D=>D.code===c.cryptoCurrency),N=((P=g==null?void 0:g.networks)==null?void 0:P.find(D=>D.isDefault))||((L=g==null?void 0:g.networks)==null?void 0:L[0]);N!=null&&N.id&&j({type:"SET_NETWORK",network:N.id})},[k,c.cryptoCurrency,c.network]),o.useEffect(()=>{var L,D;if(!((L=k==null?void 0:k.paymentMethods)!=null&&L.length))return;const g=c.fiatCurrency,N=k.paymentMethods;if(c.paymentMethodId&&N.some(B=>B.id===c.paymentMethodId&&B.supportedFiats.includes(g)))return;const P=N.find(F=>F.supportedFiats.includes(g)&&(F.id.includes("card")||F.id.includes("debit")))||N.find(F=>F.supportedFiats.includes(g));j({type:"SET_PAYMENT_METHOD",methodId:(P==null?void 0:P.id)||((D=N[0])==null?void 0:D.id)||""})},[k,c.fiatCurrency,c.paymentMethodId]);const U=o.useMemo(()=>{if(M){if(!c.cryptoAmount)return null;const L=parseFloat(c.cryptoAmount);return isNaN(L)||L<=0?"Enter a valid amount":null}if(!k||!c.fiatAmount)return null;const g=parseFloat(c.fiatAmount);if(isNaN(g))return null;const N=k.fiats.find(L=>L.code===c.fiatCurrency);if(!N)return null;const H=parseFloat(N.minAmount),P=parseFloat(N.maxAmount);return!isNaN(H)&&g<H?`Minimum amount is ${N.minAmount} ${c.fiatCurrency}`:!isNaN(P)&&g>P?`Maximum amount is ${N.maxAmount} ${c.fiatCurrency}`:null},[k,c.fiatAmount,c.fiatCurrency,c.cryptoAmount,M]),re=o.useMemo(()=>{const g=M?!!c.cryptoAmount:!!c.fiatAmount;return!k||!g||!c.cryptoCurrency||!c.network||U?null:{fiatCurrency:c.fiatCurrency,...M?{cryptoAmount:c.cryptoAmount}:{fiatAmount:c.fiatAmount},cryptoCurrency:c.cryptoCurrency,network:c.network,paymentMethodId:c.paymentMethodId||void 0,country:c.country||void 0,orderType:c.flowType}},[k,c.fiatCurrency,c.fiatAmount,c.cryptoAmount,c.cryptoCurrency,c.network,c.paymentMethodId,c.country,U,M,c.flowType]),{quotes:R,loading:me,error:K,refetch:Q}=bt($,re),{order:J,loading:he,error:Ne,createOrder:oe}=Nt($),_=15e3,{status:V,loading:Re}=St({apiUrl:n},(J==null?void 0:J.orderId)??null,{pollInterval:S,initialDelay:_});o.useEffect(()=>{(V==null?void 0:V.status)==="completed"&&v&&v(V)},[V==null?void 0:V.status,v]),o.useEffect(()=>{const g=ne||Ne;g&&w&&w(g)},[ne,Ne,w]);const pe=f||(k==null?void 0:k.defaultGateway)||null,Se=o.useRef(pe);Se.current=pe;const fe=o.useRef(R);fe.current=R;const xe=o.useRef(u);xe.current=u;const De=o.useCallback(async()=>{var N,H,P;const g=((N=c.selectedQuote)==null?void 0:N.gatewayId)||((P=(H=fe.current)==null?void 0:H.bestQuote)==null?void 0:P.gatewayId)||Se.current;if(!g||!c.walletAddress){const L=[!g&&"gateway",!c.walletAddress&&"walletAddress"].filter(Boolean).join(", ");j({type:"SET_ERROR",message:`Missing required fields: ${L}`});return}try{await oe({gateway:g,customerId:c.customerId||void 0,fiatCurrency:c.fiatCurrency,...M?{cryptoAmount:c.cryptoAmount}:{fiatAmount:c.fiatAmount},cryptoCurrency:c.cryptoCurrency,network:c.network,walletAddress:c.walletAddress,paymentMethodId:c.paymentMethodId||void 0,email:c.email||void 0,orderType:c.flowType,...xe.current?{metadata:{brand:xe.current}}:{}}),j({type:"SET_STEP",step:"checkout"})}catch(L){const D=L instanceof Error?L.message:"Failed to create order";/wallet|address/i.test(D)?j({type:"SET_WALLET_ERROR",message:D.replace(/^Failed to create checkout intent:\s*/i,"")}):j({type:"SET_ERROR",message:D})}},[c,oe,M]),le=o.useCallback(g=>{j({type:"SET_STEP",step:g})},[]),Ee=o.useCallback(()=>{const g=["confirm","amount","quotes","wallet","checkout","processing","complete"],N=g.indexOf(c.step);N>0&&j({type:"SET_STEP",step:g[N-1]})},[c.step,M]),Ue=o.useMemo(()=>{const g=M?!!c.cryptoAmount:!!c.fiatAmount;switch(c.step){case"confirm":return!!(g&&c.cryptoCurrency&&c.network&&c.walletAddress&&!U);case"amount":return!!(g&&c.cryptoCurrency&&c.network&&!U);case"quotes":return!!c.selectedQuote;case"wallet":return!!c.walletAddress;default:return!1}},[c,U,M]),Fe={apiConfig:$,assetBaseUrl:a,config:k,configLoading:be,configError:ne,state:c,dispatch:j,quotes:R,quotesLoading:me,quotesError:K,fetchQuotes:Q,order:J,orderLoading:he,orderError:Ne,createOrder:De,orderStatus:V,orderStatusLoading:Re,fieldLocks:x||null,defaultGateway:pe,amountError:U,goToStep:le,goBack:Ee,canProceed:Ue};return e.jsx(At.Provider,{value:Fe,children:X})}function ue(){const t=o.useContext(At);if(!t)throw new Error("useRamp must be used within a RampProvider");return t}const Ie={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"}},Je=[{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}],yn=Object.fromEntries(Je.map(t=>[t.code,t.name])),Rt={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 ze(t,n=""){return`${n}/crypto-icons/${t.toLowerCase()}.svg`}function Tt(t,n=""){const a=Rt[t]||"us";return`${n}/flags/${a}.svg`}function Me(t){return Ie[t]||Ie[t.toUpperCase()]||Ie[t.toUpperCase().replace(/-/g,"_")]}function Be(t,n=""){const a=Me(t);return a?`${n}/crypto-icons/${a.icon}.svg`:`${n}/crypto-icons/${t.toLowerCase()}.svg`}const Ge=[{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"}],Ye=[{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}],Ze={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}};function Cn(t,n){var a,s;return((a=Ze[t])==null?void 0:a[n])??((s=Ze.USDC)==null?void 0:s[n])??1}function kt(t){return parseFloat(t.replace(/,/g,""))||0}function gn(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 n=t.toPrecision(4);return parseFloat(n).toString()}const ee=t=>/^#([0-9A-Fa-f]{3}){1,2}$/.test(t),yt=10,Ct=1e-4,Lt=(()=>{const t=[];for(const n of Je)for(const a of n.chains)t.push({code:n.code,name:n.name,chain:a,popular:n.popular});return t})();function It({src:t,alt:n,size:a,className:s="",background:r}){const[u,m]=o.useState(!1),[l,i]=o.useState(!1),p=o.useCallback(()=>m(!0),[]),h=o.useCallback(()=>i(!0),[]);return e.jsxs("div",{className:`relative rounded-full shrink-0 ${s}`,style:{width:a,height:a,background:r},children:[!u&&!l&&e.jsx("div",{className:"absolute inset-0 rounded-full animate-pulse",style:{background:"var(--t-pill-bg, #333)"}}),l?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,a*.35)},children:n.slice(0,3)}):e.jsx("img",{src:t,alt:n,width:a,height:a,loading:"lazy",onLoad:p,onError:h,className:`rounded-full ${u?"opacity-100":"opacity-0"}`,style:{width:a,height:a,transition:"opacity 0.15s ease-in"}})]})}function Qe({ticker:t,size:n=32,baseUrl:a=""}){return e.jsx(It,{src:ze(t,a),alt:t,size:n,background:"#ffffff"})}function Oe({currencyCode:t,size:n=16,baseUrl:a=""}){return e.jsx(It,{src:Tt(t,a),alt:t,size:n})}function Pe({size:t=32,color:n="#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:n}),e.jsx("circle",{cx:"16",cy:"16",r:"8",stroke:"white",strokeWidth:"1.5",fill:"none"})]})}function Mt({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 Bt({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 Ot({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 Ht({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 Pt({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 vn({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 jn({size:t=32}){const n=t*.8;return e.jsx("div",{className:"flex items-center justify-center shrink-0",style:{width:t,height:t},children:e.jsxs("svg",{width:n,height:n*.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 Dt({size:t=32}){const n=t*.56,a=n*.65,s=Math.max(2,n*.1),r=n*.2;return e.jsxs("div",{className:"flex items-center justify-center shrink-0",style:{width:t,height:t},children:[e.jsx("div",{style:{width:n,height:a,background:"#1A1F71",borderRadius:s,position:"relative",zIndex:2,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("svg",{width:n*.7,height:a*.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:n,height:a,background:"#252525",borderRadius:s,marginLeft:-r,position:"relative",zIndex:1,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},children:e.jsxs("svg",{width:a*.85,height:a*.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 bn({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 ve(){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 Ut(){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 Ft({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 Kt({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 _t(t,n=32){switch(t){case"revolut":return e.jsx(Bt,{size:n});case"applepay":return e.jsx(Ot,{size:n});case"card":return e.jsx(Dt,{size:n});case"googlepay":return e.jsx(Ht,{size:n});case"paypal":return e.jsx(Pt,{size:n});case"bank":return e.jsx(Mt,{size:n});case"visa":return e.jsx(vn,{size:n});case"mastercard":return e.jsx(jn,{size:n});default:return e.jsx(Pe,{size:n})}}const Nn={"debit-credit-card":"card","bank-transfer":"bank","ach-bank-transfer":"bank","payid-bank-transfer":"bank","apple-pay":"applepay","google-pay":"googlepay",paypal:"paypal",revolut:"revolut"},Sn={"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 Vt(t,n){return Sn[t]||n}function Xt(t,n,a=24){const s=Nn[t];return s?_t(s,a):n?e.jsx("img",{src:n,alt:"",width:a,height:a,style:{borderRadius:"50%"}}):e.jsx(Pe,{size:a})}function $t({methods:t,selectedId:n,onOpenModal:a,fiatCurrency:s}){const r=o.useMemo(()=>t.filter(m=>m.supportedFiats.includes(s)),[t,s]),u=r.find(m=>m.id===n)||r[0];return r.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 ",s]})}):e.jsx(e.Fragment,{children:e.jsxs("div",{role:"button",tabIndex:0,onClick:a,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&a()},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:u&&Xt(u.id,u.icon,20)}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:u?Vt(u.id,u.name):"Select"}),e.jsx(ve,{})]})]})})}function Wt({className:t="",autoRedirect:n=!1,redirectDelay:a=3e3}){var f;const{order:s,orderStatus:r,goToStep:u,goBack:m}=ue(),[l,i]=o.useState(!1),[p,h]=o.useState(null),d=s!=null&&s.checkout.expiresAt?Date.now()>s.checkout.expiresAt:!1;if(o.useEffect(()=>{if((s==null?void 0:s.checkout.method)==="redirect"&&n&&!d){h(Math.ceil(a/1e3));const x=setTimeout(()=>{window.location.href=s.checkout.url},a),S=setInterval(()=>{h(v=>v&&v>1?v-1:null)},1e3);return()=>{clearTimeout(x),clearInterval(S)}}},[s,n,a,d]),o.useEffect(()=>{r&&(r.status==="completed"?u("complete"):["failed","cancelled","expired"].includes(r.status)&&u("error"))},[r==null?void 0:r.status,u]),!s)return e.jsxs("div",{className:`flex flex-col items-center justify-center p-8 ${t}`,style:{color:"var(--t-text)"},children:[e.jsx("p",{className:"text-[15px] mb-4",children:"No order found"}),e.jsx("button",{className:"font-semibold text-[14px] transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)",paddingLeft:24,paddingRight:24},onClick:m,children:"Go Back"})]});if(d)return e.jsxs("div",{className:`flex flex-col items-center justify-center p-8 text-center ${t}`,style:{color:"var(--t-text)"},children:[e.jsx("h3",{className:"text-[18px] font-semibold mb-2",children:"Checkout expired"}),e.jsx("p",{className:"text-[14px] mb-6",style:{color:"var(--t-text-secondary)"},children:"The session has expired. Please try again."}),e.jsx("button",{className:"w-full font-semibold text-[16px] transition-all",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)"},onClick:m,children:"Start over"})]});if(s.checkout.method==="iframe"){const x=s.checkout.url,S=((f=s.checkout.allowedFeatures)==null?void 0:f.join("; "))||"payment; camera; microphone; geolocation; clipboard-read; clipboard-write; accelerometer; gyroscope; magnetometer; fullscreen; autoplay; encrypted-media; web-share";return ft.createPortal(e.jsxs("div",{style:{position:"fixed",inset:0,zIndex:9999,display:"flex",flexDirection:"column",background:"#000"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",height:48,paddingLeft:8,paddingRight:16,background:"#111",flexShrink:0},children:e.jsxs("button",{onClick:m,style:{display:"flex",alignItems:"center",gap:6,background:"none",border:"none",color:"#fff",fontSize:14,fontWeight:500,cursor:"pointer",padding:"8px 12px",borderRadius:6},children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{d:"M10 12L6 8L10 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),"Cancel"]})}),e.jsxs("div",{style:{flex:1,position:"relative",overflow:"hidden"},children:[!l&&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:x,style:{display:l?"block":"none",width:"100%",height:"100%",border:"none"},allow:S,onLoad:()=>i(!0),title:"Provider Checkout"})]})]}),document.body)}if(s.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 ",s.gateway," to complete your payment."]}),p!==null&&e.jsxs("p",{className:"text-[13px] mb-4",style:{color:"var(--t-text-muted)"},children:["Redirecting in ",p,"..."]}),e.jsxs("a",{href:s.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 ",s.gateway]}),e.jsx("button",{className:"w-full font-semibold text-[14px] mt-2 transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)"},onClick:m,children:"Cancel"})]});if(s.checkout.method==="widget"&&s.widgetConfig){const x=En(s.checkout.url,s.widgetConfig);return ft.createPortal(e.jsxs("div",{style:{position:"fixed",inset:0,zIndex:9999,display:"flex",flexDirection:"column",background:"#000"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",height:48,paddingLeft:8,paddingRight:16,background:"#111",flexShrink:0},children:e.jsxs("button",{onClick:m,style:{display:"flex",alignItems:"center",gap:6,background:"none",border:"none",color:"#fff",fontSize:14,fontWeight:500,cursor:"pointer",padding:"8px 12px",borderRadius:6},children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{d:"M10 12L6 8L10 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),"Cancel"]})}),e.jsxs("div",{style:{flex:1,position:"relative",overflow:"hidden"},children:[!l&&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:x,style:{display:l?"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:()=>i(!0),title:"Payment Checkout"})]})]}),document.body)}return e.jsxs("div",{className:`flex flex-col items-center justify-center p-8 ${t}`,style:{color:"var(--t-text)"},children:[e.jsx("p",{className:"text-[15px] mb-4",children:"Unknown checkout method"}),e.jsx("button",{className:"font-semibold text-[14px] transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)",paddingLeft:24,paddingRight:24},onClick:m,children:"Go Back"})]})}function En(t,n){const a=new URL("/en/partner/widget",t);for(const[s,r]of Object.entries(n))r!=null&&r!==""&&a.searchParams.set(s,String(r));return a.toString()}function Gt({className:t=""}){const{orderStatus:n,orderStatusLoading:a,goToStep:s}=ue();o.useEffect(()=>{n&&(n.status==="completed"?s("complete"):["failed","cancelled","expired","refunded"].includes(n.status)&&s("error"))},[n==null?void 0:n.status,s]);const r=()=>{if(!n)return"Processing your order...";switch(n.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:r()}),a&&e.jsx("p",{className:"text-[13px] mb-4",style:{color:"var(--t-text-muted)"},children:"Checking status..."}),n&&e.jsxs("div",{className:"w-full mt-6 text-left",style:{background:"var(--t-surface)",borderRadius:5,padding:16},children:[e.jsx(ge,{label:"Order ID",value:n.orderId,mono:!0}),e.jsx(ge,{label:"Provider",value:n.gateway}),e.jsx(ge,{label:"Amount",value:`${n.fiatAmount} ${n.fiatCurrency}`}),e.jsx(ge,{label:"Receiving",value:`${n.cryptoAmount||"..."} ${n.cryptoCurrency}`}),e.jsx(ge,{label:"Network",value:n.network}),e.jsx(ge,{label:"To Address",value:`${n.walletAddress.slice(0,10)}...${n.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 ge({label:t,value:n,mono:a}){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 ${a?"font-mono":""}`,style:{color:"var(--t-text)"},children:n})]})}function Yt({className:t="",explorerUrl:n,onDone:a,doneButtonText:s="Done"}){const{orderStatus:r,state:u,dispatch:m}=ue(),l=u.flowType==="sell",i=()=>{if(!(r!=null&&r.transactionHash))return null;if(!n){const d={ethereum:"https://etherscan.io/tx/{txHash}",polygon:"https://polygonscan.com/tx/{txHash}",arbitrum:"https://arbiscan.io/tx/{txHash}",optimism:"https://optimistic.etherscan.io/tx/{txHash}",base:"https://basescan.org/tx/{txHash}",bitcoin:"https://mempool.space/tx/{txHash}",solana:"https://solscan.io/tx/{txHash}",avalanche:"https://snowtrace.io/tx/{txHash}",fantom:"https://ftmscan.com/tx/{txHash}"};return(d[u.network]||d.ethereum).replace("{txHash}",r.transactionHash)}return n.replace("{txHash}",r.transactionHash)},p=()=>{a?a():m({type:"RESET"})},h=i();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:l?"Sale Complete!":"Purchase Complete!"}),e.jsx("p",{className:"text-[14px] mb-6",style:{color:"var(--t-text-secondary)"},children:l?`Your ${(r==null?void 0:r.fiatCurrency)||u.fiatCurrency} payout is being processed.`:`Your ${(r==null?void 0:r.cryptoCurrency)||u.cryptoCurrency} has been sent to your wallet.`}),r&&e.jsxs("div",{className:"w-full text-left mb-6",style:{background:"var(--t-surface)",borderRadius:5,padding:16},children:[e.jsx(se,{label:l?"Amount Sold":"Amount Received",value:`${r.cryptoAmount} ${r.cryptoCurrency}`,highlight:!0}),e.jsx(se,{label:l?"Payout Amount":"Amount Paid",value:`${r.fiatAmount} ${r.fiatCurrency}`}),e.jsx(se,{label:"Network",value:r.network}),e.jsx(se,{label:"Wallet",value:`${r.walletAddress.slice(0,10)}...${r.walletAddress.slice(-8)}`,mono:!0}),r.transactionHash&&e.jsx(se,{label:"Transaction",value:`${r.transactionHash.slice(0,10)}...${r.transactionHash.slice(-8)}`,mono:!0}),e.jsx(se,{label:"Provider",value:r.gateway}),e.jsx(se,{label:"Order ID",value:r.orderId,mono:!0}),r.completedAt&&e.jsx(se,{label:"Completed",value:new Date(r.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:p,children:s})]})]})}function se({label:t,value:n,mono:a,highlight:s}){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 ${a?"font-mono":""}`,style:{color:s?"var(--t-success, #10b981)":"var(--t-text)"},children:n})]})}function Zt({className:t="",onRetry:n,supportEmail:a="support@nowramp.com"}){const{state:s,orderStatus:r,dispatch:u,goToStep:m}=ue(),l=s.flowType==="sell",i=()=>{if(r)switch(r.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"},p=()=>{if(s.errorMessage)return s.errorMessage;if(r)switch(r.status){case"failed":return l?"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 l?"Your sale was cancelled. No crypto was transferred.":"Your order was cancelled. No payment was processed.";case"expired":return l?"Your order has expired. Please start a new sale.":"Your order has expired. Please start a new purchase.";case"refunded":return l?"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=()=>{u({type:"CLEAR_ERROR"}),n?n():(u({type:"RESET"}),m("amount"))},d=()=>{u({type:"RESET"}),m("amount")};return e.jsxs("div",{className:`flex flex-col items-center px-8 py-12 text-center ${t}`,children:[e.jsx("div",{className:"flex items-center justify-center mb-5",style:{width:64,height:64,borderRadius:"50%",background:"var(--t-error, #EF4444)"},children:e.jsx("svg",{viewBox:"0 0 24 24",width:"32",height:"32",fill:"white",children:e.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})})}),e.jsx("h2",{className:"text-[20px] font-semibold mb-2",style:{color:"var(--t-text)"},children:i()}),e.jsx("p",{className:"text-[14px] mb-6",style:{color:"var(--t-text-secondary)"},children:p()}),r&&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:r.orderId})]})}),e.jsxs("div",{className:"w-full flex flex-col gap-2",children:[e.jsx("button",{className:"w-full font-semibold text-[16px] transition-all",style:{height:60,borderRadius:5,background:"var(--t-cta-bg)",color:"var(--t-cta-text)"},onClick:h,children:"Try Again"}),e.jsx("button",{className:"w-full font-semibold text-[14px] transition-all",style:{height:48,borderRadius:5,background:"var(--t-surface)",color:"var(--t-text)"},onClick:d,children:"Start Over"})]}),e.jsxs("div",{className:"mt-6",children:[e.jsxs("p",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:["Need help? Contact"," ",e.jsx("a",{href:`mailto:${a}`,className:"underline",style:{color:"var(--t-accent)"},children:a})]}),r&&e.jsxs("p",{className:"text-[12px] mt-1",style:{color:"var(--t-text-muted)"},children:["Reference: ",r.orderId]})]})]})}function gt(t){return t.length<=12?t:`${t.slice(0,6)}...${t.slice(-6)}`}function Qt({className:t=""}){const{config:n,configLoading:a,state:s,defaultGateway:r,fetchQuotes:u,createOrder:m,orderLoading:l}=ue(),i=s.flowType==="sell",[p,h]=o.useState(null),d=n==null?void 0:n.gateways.find(x=>x.id===r),f=async()=>{h(null);try{u(),await m()}catch(x){const S=x instanceof Error?x.message:"Failed to create order";h(S)}};return a?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:i?"Confirm Sale":"Confirm Purchase"}),e.jsxs("div",{className:"w-full text-left mb-6",style:{background:"var(--t-surface)",borderRadius:5,padding:16},children:[d&&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:[d.logo&&e.jsx("img",{src:d.logo,alt:d.name,width:20,height:20,style:{borderRadius:4}}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:d.name})]})]}),i?e.jsxs(e.Fragment,{children:[e.jsx(de,{label:"You sell",value:`${s.cryptoAmount} ${s.cryptoCurrency}`,highlight:!0}),e.jsx(de,{label:"You receive",value:`${s.fiatCurrency} payout`})]}):e.jsxs(e.Fragment,{children:[e.jsx(de,{label:"You pay",value:`${s.fiatAmount} ${s.fiatCurrency}`,highlight:!0}),e.jsx(de,{label:"You receive",value:`${s.cryptoCurrency} on ${s.network}`}),e.jsx(de,{label:"Wallet",value:gt(s.walletAddress),mono:!0})]}),e.jsx(de,{label:"Network",value:s.network}),i&&s.walletAddress&&e.jsx(de,{label:"Refund address",value:gt(s.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:l?.7:1},disabled:l,onClick:f,children:l?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"nramp-spinner-inline"}),"Processing..."]}):i?"Confirm & Sell":"Confirm & Pay"})]})}function de({label:t,value:n,mono:a,highlight:s}){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 ${a?"font-mono":""}`,style:{color:s?"var(--t-success, #10b981)":"var(--t-text)"},children:n})]})}function Ae({isOpen:t,onClose:n,children:a}){const[s,r]=o.useState(!1),[u,m]=o.useState(!1);o.useEffect(()=>{if(t)r(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>m(!0)));else if(s){m(!1);const i=setTimeout(()=>r(!1),250);return()=>clearTimeout(i)}},[t]);const l=o.useCallback(()=>{m(!1),setTimeout(()=>n(),250)},[n]);return o.useEffect(()=>{if(!t)return;const i=p=>{p.key==="Escape"&&l()};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[t,l]),s?e.jsx("div",{className:"absolute inset-0 z-20 transition-opacity duration-250",style:{opacity:u?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:u?"translateY(0)":"translateY(24px)"},children:typeof a=="function"?a(l):a})}):null}function Jt({char:t,height:n=38}){const a="0123456789",s=a.indexOf(t);return s===-1?e.jsx("span",{children:t}):e.jsx("span",{className:"digit-slot",style:{height:n,lineHeight:`${n}px`},children:e.jsx("span",{className:"digit-slot-inner block",style:{transform:`translateY(-${s*n}px)`},children:a.split("").map(r=>e.jsx("span",{className:"block",style:{height:n,lineHeight:`${n}px`},children:r},r))})})}function zt({value:t,height:n=38,className:a="",style:s={}}){return e.jsx("span",{className:a,style:{display:"inline-flex",...s},children:t.split("").map((r,u)=>e.jsx(Jt,{char:r,height:n},u))})}function I({w:t,h:n,className:a=""}){return e.jsx("div",{className:`skeleton ${a}`,style:{width:t,height:n}})}function qt(){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(I,{w:70,h:14,className:"mb-3"}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(I,{w:120,h:32}),e.jsx(I,{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(I,{w:50,h:14,className:"mb-3"}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(I,{w:180,h:32}),e.jsx(I,{w:85,h:32})]})]}),e.jsxs("div",{className:"flex justify-between mt-3 px-[2px]",children:[e.jsx(I,{w:140,h:12}),e.jsx(I,{w:90,h:12})]}),e.jsxs("div",{className:"mt-8",children:[e.jsx(I,{w:65,h:14,className:"mb-2.5"}),e.jsx(I,{w:"100%",h:47})]}),e.jsx("div",{className:"flex-1"}),e.jsx(I,{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 je({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:n=>n.currentTarget.style.backgroundColor="var(--t-close-hover)",onMouseLeave:n=>n.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 we({value:t,onChange:n,placeholder:a=""}){return e.jsxs("div",{className:"relative mx-5 mb-5",children:[e.jsx("input",{type:"text",value:t,onChange:s=>n(s.target.value),placeholder:a,style:{height:47,borderRadius:4.5,border:"1px solid var(--t-border)",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:()=>n(""),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 en({onClose:t,onSelect:n,currencies:a,assetBaseUrl:s="",selectedCode:r}){const[u,m]=o.useState(""),l=o.useMemo(()=>{if(!a||a.length===0)return Ge;const p=new Map(Ge.map(h=>[h.code,h.name]));return a.map(h=>({code:h.code,name:h.name||p.get(h.code)||h.code}))},[a]),i=o.useMemo(()=>{const p=u.trim().toLowerCase();if(!p){if(r){const h=l.find(d=>d.code===r);if(h){const d=l.filter(f=>f.code!==r);return[h,...d]}}return l}return l.filter(h=>h.code.toLowerCase().includes(p)||h.name.toLowerCase().includes(p))},[l,u,r]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(je,{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(we,{value:u,onChange:m}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[i.map((p,h)=>{const d=p.name!==p.code?p.name:"",f=r===p.code;return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>n(p.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(Oe,{currencyCode:p.code,size:32,baseUrl:s}),e.jsxs("div",{className:"text-left flex-1 flex items-center gap-2",children:[e.jsx("span",{className:"font-semibold text-[15px]",children:p.code}),d&&e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:d})]}),f&&e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"var(--t-success, #4CD964)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),h<i.length-1&&e.jsx("div",{style:{height:1,background:"var(--t-divider, rgba(255,255,255,0.08))"}})]},p.code)}),i.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No currencies found"})]})]})}function vt({src:t,alt:n,size:a,className:s,style:r}){const[u,m]=o.useState(!1),[l,i]=o.useState(!1),p=o.useCallback(()=>m(!0),[]),h=o.useCallback(()=>i(!0),[]);return e.jsxs("div",{className:s,style:{...r,width:a,height:a,position:"relative"},children:[!u&&!l&&e.jsx("div",{className:"absolute inset-0 rounded-full animate-pulse",style:{background:"var(--t-pill-bg, #333)"}}),l?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:n.slice(0,3)}):e.jsx("img",{src:t,alt:n,width:a,height:a,loading:"lazy",onLoad:p,onError:h,className:`rounded-full ${u?"opacity-100":"opacity-0"}`,style:{width:a,height:a,transition:"opacity 0.15s ease-in"}})]})}function tn({onClose:t,onSelect:n,cryptos:a,assetBaseUrl:s="",selectedCode:r,selectedChain:u}){const[m,l]=o.useState(""),i=o.useMemo(()=>{if(!a||a.length===0)return Lt;const d=[];for(const f of a){const x=f.networks||[],S=f.name||yn[f.code]||f.code;if(x.length===0)d.push({code:f.code,name:S,chain:f.code,popular:!1});else for(const v of x){const w=v.code||v.id||v.name||f.code;d.push({code:f.code,name:S,chain:w,chainName:v.name,popular:!1})}}return d},[a]),p=o.useCallback((d,f)=>r===d&&u===f,[r,u]),h=o.useMemo(()=>{var S;const d=m.trim().toLowerCase();if(!d){if(r&&u){const v=i.find(w=>w.code===r&&w.chain===u);if(v){const w=i.filter(X=>!(X.code===r&&X.chain===u));return[v,...w]}}return i}const f=d.split(/\s+/),x=[];for(const v of i){const w=Me(v.chain),X=w?w.name.toLowerCase():"",$=((S=w==null?void 0:w.shortName)==null?void 0:S.toLowerCase())||"",Y=v.chain.toLowerCase(),Z=v.code.toLowerCase(),te=v.name.toLowerCase(),C=[Z,te,X,$,Y];if(!f.every(c=>C.some(j=>j.includes(c))))continue;let E=0;Z===d?E+=100:Z.startsWith(f[0])&&(E+=50),v.popular&&(E+=10),f.length>1&&(X.includes(f[1])||$.includes(f[1])||Y.includes(f[1]))&&(E+=25),x.push({item:v,score:E})}return x.sort((v,w)=>w.score-v.score),x.map(v=>v.item)},[i,m,r,u]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(je,{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(we,{value:m,onChange:l}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[h.map((d,f)=>{const x=Me(d.chain),S=(x==null?void 0:x.name)||d.chainName||d.chain,v=d.name!==d.code?d.name:"",w=p(d.code,d.chain);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>n(d.code,d.chain),className:"flex items-center w-full transition-colors rounded-lg hover-item",style:{gap:14,padding:"18px 8px",margin:"0 -8px"},children:[e.jsxs("div",{className:"relative shrink-0",style:{width:40,height:40},children:[e.jsx("div",{className:"absolute top-0 left-0",style:{background:"#ffffff",borderRadius:"50%"},children:e.jsx(vt,{src:ze(d.code,s),alt:d.code,size:32})}),e.jsx("div",{className:"absolute",style:{bottom:0,right:0,border:"2px solid var(--t-surface, #1C1C22)",borderRadius:"50%",background:"#ffffff"},children:e.jsx(vt,{src:Be(d.chain,s),alt:d.chain,size:16})})]}),e.jsx("div",{className:"text-left flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-semibold text-[15px]",style:{color:"var(--t-text)"},children:d.code}),v&&e.jsx("span",{className:"text-[13px]",style:{color:"var(--t-text-secondary)"},children:v})]})}),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:S}),w&&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"})})]})]}),f<h.length-1&&e.jsx("div",{style:{height:1,background:"var(--t-divider, rgba(255,255,255,0.08))"}})]},`${d.code}-${d.chain}`)}),h.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No currencies found"})]})]})}function An({methods:t,selectedId:n,onSelect:a,onClose:s}){const[r,u]=o.useState(""),m=o.useMemo(()=>{const l=r.trim().toLowerCase();if(!l){if(n){const i=t.find(p=>p.id===n);if(i){const p=t.filter(h=>h.id!==n);return[i,...p]}}return t}return t.filter(i=>i.id.toLowerCase().includes(l)||i.name.toLowerCase().includes(l)||i.description&&i.description.toLowerCase().includes(l))},[t,r,n]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(je,{onClick:s})}),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(we,{value:r,onChange:u}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5",children:[m.map((l,i)=>{const p=l.id===n,h=Vt(l.id,l.name);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>a(l.id),className:`flex w-full transition-colors rounded-lg hover-item ${l.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 ${l.description?"mt-0.5":""}`,style:{width:32,height:32},children:Xt(l.id,l.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}),l.description&&e.jsx("div",{className:"text-[13px] leading-snug mt-1",style:{color:"var(--t-text-secondary)"},children:l.description})]}),p&&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"})})]}),i<m.length-1&&e.jsx("div",{style:{height:1,background:"var(--t-divider, rgba(255,255,255,0.08))"}})]},l.id)}),m.length===0&&e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:"No payment methods found"})]})]})}function nn({checked:t,onChange:n,accentColor:a="var(--t-accent)"}){return e.jsx("button",{onClick:()=>n(!t),className:"relative shrink-0 transition-colors duration-200",style:{width:48,height:28,borderRadius:14,backgroundColor:t?a:"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 wn=[{label:"Privacy policy",href:"https://nowramp.com/privacy-policy"},{label:"Terms of use",href:"https://nowramp.com/terms-and-conditions"}];function an({onClose:t,darkMode:n,onToggleDarkMode:a,skinId:s,onSelectSkin:r,showThemeToggle:u=!0}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end items-center px-5 pt-5",children:e.jsx(je,{onClick:t})}),e.jsxs("div",{className:"px-5 flex-1 pt-6 overflow-y-auto custom-scroll",children:[u&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{borderTop:"1px solid var(--t-divider)"},children:e.jsxs("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(Kt,{size:40}),e.jsx("span",{className:"font-medium text-[15px]",style:{color:"var(--t-text)"},children:"Dark Mode"})]}),e.jsx(nn,{checked:n,onChange:a,accentColor:"#4CD964"})]})}),e.jsx("div",{style:{height:1,background:"var(--t-divider)"}})]}),wn.map(m=>e.jsxs("div",{children:[e.jsxs("a",{href:m.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:m.label}),e.jsx(Ut,{})]}),e.jsx("div",{style:{height:1,background:"var(--t-divider)"}})]},m.label))]})]})}function Rn({className:t="",theme:n="dark",skinId:a="mono",accentColor:s,bgColor:r,bgImage:u,borderColor:m,borderRadius:l,surfaceColor:i,inputBgColor:p,textColor:h,textSecondaryColor:d,textMutedColor:f,successColor:x,showFlowToggle:S=!0,showSettings:v=!0,showThemeToggle:w=!0,autoRedirect:X=!1,explorerUrl:$,doneButtonText:Y="Done",supportEmail:Z,onDone:te}){var lt,it,ct,dt,ut,mt,ht,pt;const{state:C,dispatch:T,config:E,configLoading:c,quotes:j,quotesLoading:M,quotesError:k,fetchQuotes:be,createOrder:ne,orderLoading:U,amountError:re,fieldLocks:R,apiConfig:me,assetBaseUrl:K}=ue(),[Q,J]=o.useState(n==="dark"),[he,Ne]=o.useState(a),[oe,_]=o.useState(null),[V,Re]=o.useState(!1),[pe,Se]=o.useState(!1),[fe,xe]=o.useState(!1),[De,le]=o.useState(null),[Ee,Ue]=o.useState(!0),[Fe,g]=o.useState(!1),[N,H]=o.useState(!1),P=o.useRef(null),L=o.useRef(),D=o.useRef(C.flowType);o.useEffect(()=>{J(n==="dark")},[n]),o.useEffect(()=>{const y=setTimeout(()=>Ue(!1),c?0:800);return()=>clearTimeout(y)},[c]),o.useEffect(()=>{if(D.current!==C.flowType&&!Ee){D.current=C.flowType,g(!0),Re(!1),Se(!1);const y=setTimeout(()=>g(!1),350);return()=>clearTimeout(y)}D.current=C.flowType},[C.flowType,Ee]);const F=C.flowType,B=F==="buy",W=C.cryptoCurrency||"BTC",z=C.fiatCurrency||"USD",Ke=B?C.fiatAmount:C.cryptoAmount,ie=kt(Ke),ye=(lt=j==null?void 0:j.bestQuote)!=null&<.exchangeRate?parseFloat(j.bestQuote.exchangeRate):null,Te=o.useRef(null);ye&&W&&z&&(Te.current={rate:ye,crypto:W,fiat:z});const rn=o.useMemo(()=>{if(j!=null&&j.bestQuote){const y=B?j.bestQuote.cryptoAmount:j.bestQuote.fiatAmount;if(y)return y}return"0"},[j,B]),on=o.useMemo(()=>{var O,ae,Xe;const y=ye||((O=Te.current)==null?void 0:O.rate),b=ye?W:(ae=Te.current)==null?void 0:ae.crypto,A=ye?z:(Xe=Te.current)==null?void 0:Xe.fiat;return!y||!b||!A?"":`1 ${b} ≈ ${y.toFixed(2)} ${A}`},[W,z,ye]);o.useEffect(()=>{const y=C.walletAddress.trim(),b=C.network;if(!y||y.length<10){le(null),T({type:"SET_WALLET_ERROR",message:""});return}return xe(!0),le(null),clearTimeout(L.current),L.current=setTimeout(async()=>{var A,O,ae;try{const $e=await(await fetch(`${me.apiUrl}/public/validate/address`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:y,...b?{network:b}:{}})})).json(),We=((A=$e.data)==null?void 0:A.attributes)||$e.data||$e;if(We.isValid)le(!0),T({type:"SET_WALLET_ERROR",message:""});else{le(!1);const fn=((O=We.errors)==null?void 0:O[0])||((ae=We.details)==null?void 0:ae.formatMessage)||"Invalid wallet address";T({type:"SET_WALLET_ERROR",message:fn})}}catch{le(null)}finally{xe(!1)}},500),()=>clearTimeout(L.current)},[C.walletAddress,C.network,me.apiUrl]);const qe=!Ke||ie===0,et=ie>0&&(B?ie<yt:ie<Ct),tt=!!re||et||V&&qe,ln=ie>0&&!re&&!et,_e=C.walletAddress.trim().length>=10&&De!==!1&&!fe,ke=ln&&_e&&!!C.cryptoCurrency&&!!C.network,cn=y=>{let b=y.target.value.replace(/[^0-9.,]/g,"");const A=B?2:6,O=b.indexOf(".");O!==-1&&b.length-O-1>A&&(b=b.slice(0,O+A+1)),T(B?{type:"SET_FIAT_AMOUNT",amount:b}:{type:"SET_CRYPTO_AMOUNT",amount:b})},nt=y=>{y!==F&&T({type:"SET_FLOW_TYPE",flowType:y})},dn=o.useCallback(y=>{T({type:"SET_FIAT_CURRENCY",currency:y})},[T]),un=o.useCallback((y,b)=>{T({type:"SET_CRYPTO_CURRENCY",currency:y}),T({type:"SET_CRYPTO_CHAIN",chain:b})},[T]),mn=o.useCallback(y=>{T({type:"SET_PAYMENT_METHOD",methodId:y})},[T]),hn=()=>{ke&&(H(!0),be())};o.useEffect(()=>{var y;if(!(!N||M)){if(j!=null&&j.bestQuote)H(!1),T({type:"SELECT_QUOTE",quote:j.bestQuote}),ne().catch(()=>{});else if(k)H(!1),T({type:"SET_ERROR",message:k.message||"No quotes available"});else if(j&&!j.bestQuote){H(!1);const b=(y=j.unavailableGateways)==null?void 0:y.map(O=>O.reason).filter(Boolean),A=b!=null&&b.length?`No providers available: ${b.join("; ")}`:"No providers available for this currency/network combination";T({type:"SET_ERROR",message:A})}}},[N,j,M,k,T,ne]);const at=Q?"theme-dark":"theme-light",Ve=Ye.find(y=>y.id===he)||Ye[0],pn=Ve.accent===null,st=(s?ee(s):!1)?{"--t-accent":s,"--t-cta-bg":s,"--t-cta-text":"#ffffff"}:pn?{"--t-accent":Q?"#ffffff":"#111111","--t-cta-bg":Q?"#ffffff":"#111111","--t-cta-text":Q?"#000000":"#ffffff"}:{"--t-accent":Ve.accent,"--t-cta-bg":Ve.accent,"--t-cta-text":"#ffffff"},G={};i&&ee(i)&&(G["--t-surface"]=i,G["--t-modal-bg"]=i),p&&ee(p)&&(G["--t-pill-bg"]=p,G["--t-close-bg"]=p),h&&ee(h)&&(G["--t-text"]=h),d&&ee(d)&&(G["--t-text-secondary"]=d),f&&ee(f)&&(G["--t-text-muted"]=f,G["--t-text-tertiary"]=f),x&&ee(x)&&(G["--t-success"]=x);const ce={};r&&ee(r)?ce.backgroundColor=r:ce.backgroundColor="var(--t-bg)",u&&(ce.backgroundImage=`url(${u})`,ce.backgroundSize="cover",ce.backgroundPosition="center");const Le={};m&&ee(m)&&(Le.border=`1px solid ${m}`),l&&(Le.borderRadius=l);const rt=C.step==="checkout"?e.jsx(Wt,{autoRedirect:X}):C.step==="processing"?e.jsx(Gt,{}):C.step==="complete"?e.jsx(Yt,{explorerUrl:$,doneButtonText:Y,onDone:te}):C.step==="error"?e.jsx(Zt,{supportEmail:Z}):C.step==="confirm"?e.jsx(Qt,{}):null;if(rt)return e.jsx("div",{className:`${at} relative w-full max-w-[390px] h-[640px] overflow-hidden flex flex-col select-none transition-colors duration-300 ${t}`,style:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',...ce,...st,...G,...Le},children:rt});const q=C.network,Ce=q?Me(q):null,ot=(Ce==null?void 0:Ce.shortName)||(Ce==null?void 0:Ce.name)||q;return e.jsxs("div",{className:`${at} relative w-full max-w-[390px] min-h-[640px] overflow-hidden flex flex-col select-none transition-colors duration-300 ${t}`,style:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',...ce,...st,...G,...Le},children:[v&&e.jsx("div",{className:`flex justify-end items-center px-5 pt-3 ${S?"pb-1":"pb-5"}`,children:e.jsx(Ft,{onClick:()=>_("settings")})}),S?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:()=>nt("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:()=>nt("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,Ee||Fe||c?e.jsx(qt,{}):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:V&&tt?"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:P,type:"text",value:Ke,onChange:cn,onBlur:()=>Re(!0),placeholder:B?"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:!!((it=R==null?void 0:R.sourceAmount)!=null&&it.locked)}),B?e.jsxs("button",{onClick:()=>_("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:!!((ct=R==null?void 0:R.sourceCurrency)!=null&&ct.locked),children:[e.jsx(Oe,{currencyCode:z,size:16,baseUrl:K}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:z}),e.jsx(ve,{})]}):e.jsxs("div",{className:"flex flex-col items-end shrink-0",children:[e.jsxs("button",{onClick:()=>_("crypto"),className:"flex items-center gap-1.5 transition-colors",style:{background:"var(--t-pill-bg)",borderRadius:4,height:32,paddingLeft:10,paddingRight:10},disabled:!!((dt=R==null?void 0:R.destinationCurrency)!=null&&dt.locked),children:[e.jsx(Qe,{ticker:W,size:16,baseUrl:K}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:W}),e.jsx(ve,{})]}),q&&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:Be(q,K),alt:q,width:14,height:14,className:"rounded-full",style:{width:14,height:14}})}),e.jsx("span",{className:"text-[12px]",style:{color:"var(--t-text-muted)"},children:ot})]})]})]})]}),V&&tt&&e.jsx("div",{className:"text-[12px] mt-1.5 px-[2px]",style:{color:"#EF4444"},children:re||(qe?"Amount should be more than 0":B?`Minimum amount is ${yt} ${z}`:`Minimum amount is ${Ct} ${W}`)}),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:[M&&!N?e.jsx(I,{w:180,h:32}):e.jsx(zt,{value:ie>0?rn:"0",height:32,className:"font-semibold",style:{color:ie>0?"var(--t-text)":"var(--t-text-muted)",fontSize:24}}),B?e.jsxs("div",{className:"flex flex-col items-end shrink-0",children:[e.jsxs("button",{onClick:()=>_("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:!!((ut=R==null?void 0:R.destinationCurrency)!=null&&ut.locked),children:[e.jsx(Qe,{ticker:W,size:16,baseUrl:K}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:W}),e.jsx(ve,{})]}),q&&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:Be(q,K),alt:q,width:14,height:14,className:"rounded-full",style:{width:14,height:14}})}),e.jsx("span",{className:"text-[12px]",style:{color:"var(--t-text-muted)"},children:ot})]})]}):e.jsxs("button",{onClick:()=>_("fiat"),className:"flex items-center gap-1.5 shrink-0 transition-colors",style:{background:"var(--t-pill-bg)",borderRadius:4,height:32,paddingLeft:10,paddingRight:10},disabled:!!((mt=R==null?void 0:R.sourceCurrency)!=null&&mt.locked),children:[e.jsx(Oe,{currencyCode:z,size:16,baseUrl:K}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--t-text)"},children:z}),e.jsx(ve,{})]})]})]}),e.jsx("div",{className:"flex items-center justify-between mt-[2px] px-[18px] pt-[12px] pb-[14px]",style:{background:"var(--t-surface)",...(ht=E==null?void 0:E.paymentMethods)!=null&&ht.length?{}:{borderBottomLeftRadius:5,borderBottomRightRadius:5}},children:e.jsx("span",{className:"text-[12px]",style:{color:x?"var(--t-success)":"var(--t-text-secondary)"},children:on||" "})}),(E==null?void 0:E.paymentMethods)&&E.paymentMethods.length>0&&e.jsx("div",{className:"mt-[2px]",children:e.jsx($t,{methods:E.paymentMethods,selectedId:C.paymentMethodId,onOpenModal:()=>_("payment"),fiatCurrency:C.fiatCurrency})}),e.jsxs("div",{className:"mt-8",children:[e.jsx("div",{className:"text-[13px] mb-2.5",style:{color:"var(--t-text-secondary)"},children:B?"Receiving wallet address":"Sending wallet address"}),e.jsx("input",{type:"text",value:C.walletAddress,onChange:y=>T({type:"SET_WALLET_ADDRESS",address:y.target.value}),onBlur:()=>Se(!0),placeholder:B?"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:C.walletError||pe&&!_e?"1px solid #EF4444":"1px solid var(--t-border)",borderRadius:3.5,height:47,padding:"0 14px",color:"var(--t-text)",fontSize:13,backgroundColor:"transparent"},disabled:!!((pt=R==null?void 0:R.destinationAddress)!=null&&pt.locked)}),C.walletError?e.jsx("div",{className:"text-[12px] mt-1.5",style:{color:"#EF4444"},children:C.walletError}):pe&&!_e&&!fe?e.jsx("div",{className:"text-[12px] mt-1.5",style:{color:"#EF4444"},children:"Enter a valid wallet address"}):fe&&C.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"}),e.jsx("button",{disabled:!ke||U||N,onClick:hn,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:ke&&!U&&!N?1:.4,cursor:ke&&!U&&!N?"pointer":"not-allowed"},children:N?"Getting best price...":U?"Processing...":B?`Buy ${W}`:`Sell ${W}`}),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:oe==="fiat",onClose:()=>_(null),children:y=>{var b;return e.jsx(en,{onClose:y,onSelect:A=>{dn(A),y()},currencies:(b=E==null?void 0:E.fiats)==null?void 0:b.map(A=>({code:A.code,name:A.code})),assetBaseUrl:K,selectedCode:C.fiatCurrency})}}),e.jsx(Ae,{isOpen:oe==="crypto",onClose:()=>_(null),children:y=>{var b;return e.jsx(tn,{onClose:y,onSelect:(A,O)=>{un(A,O),y()},cryptos:(b=E==null?void 0:E.cryptos)==null?void 0:b.map(A=>{var O;return{code:A.code,name:A.code,networks:(O=A.networks)==null?void 0:O.map(ae=>({code:ae.id,name:ae.name}))}}),assetBaseUrl:K,selectedCode:C.cryptoCurrency,selectedChain:C.network})}}),e.jsx(Ae,{isOpen:oe==="payment",onClose:()=>_(null),children:y=>{var b;return e.jsx(An,{methods:((b=E==null?void 0:E.paymentMethods)==null?void 0:b.filter(A=>A.supportedFiats.includes(C.fiatCurrency)))||[],selectedId:C.paymentMethodId,onSelect:A=>{mn(A),y()},onClose:y})}}),e.jsx(Ae,{isOpen:oe==="settings",onClose:()=>_(null),children:y=>e.jsx(an,{onClose:y,darkMode:Q,onToggleDarkMode:J,skinId:he,onSelectSkin:b=>{Ne(b)},showThemeToggle:w})})]})}function sn({projectId:t,apiUrl:n,assetBaseUrl:a,flowType:s,customerId:r,brandId:u,defaultFiatCurrency:m,defaultCryptoCurrency:l,defaultNetwork:i,defaultFiatAmount:p,defaultCryptoAmount:h,defaultWalletAddress:d,defaultGateway:f,fieldLocks:x,statusPollInterval:S,onComplete:v,onError:w,className:X,theme:$,skinId:Y,accentColor:Z,bgColor:te,bgImage:C,borderColor:T,borderRadius:E,surfaceColor:c,inputBgColor:j,textColor:M,textSecondaryColor:k,textMutedColor:be,successColor:ne,showFlowToggle:U,showSettings:re,showThemeToggle:R,autoRedirect:me,explorerUrl:K,doneButtonText:Q,supportEmail:J,onDone:he}){return e.jsx(wt,{projectId:t,apiUrl:n,assetBaseUrl:a,flowType:s,customerId:r,brandId:u,defaultFiatCurrency:m,defaultCryptoCurrency:l,defaultNetwork:i,defaultFiatAmount:p,defaultCryptoAmount:h,defaultWalletAddress:d,defaultGateway:f,fieldLocks:x,statusPollInterval:S,onComplete:v,onError:w,children:e.jsx(Rn,{className:X,theme:$,skinId:Y,accentColor:Z,bgColor:te,bgImage:C,borderColor:T,borderRadius:E,surfaceColor:c,inputBgColor:j,textColor:M,textSecondaryColor:k,textMutedColor:be,successColor:ne,showFlowToggle:U,showSettings:re,showThemeToggle:R,autoRedirect:me,explorerUrl:K,doneButtonText:Q,supportEmail:J,onDone:he})})}function Tn({submitButtonText:t,rateRefreshInterval:n,...a}){return e.jsx(sn,{...a})}function kn({skin:t,active:n,onClick:a,darkMode:s,dimmed:r}){const u=t.accent===null,m=32;return e.jsxs("button",{onClick:a,className:"relative shrink-0",style:{width:m,height:m,opacity:r?.4:1,transition:"opacity 0.2s"},children:[u?e.jsxs("svg",{width:m,height:m,viewBox:"0 0 32 32",children:[e.jsx("clipPath",{id:"mono-left",children:e.jsx("rect",{x:"0",y:"0",width:"16",height:"32"})}),e.jsx("clipPath",{id:"mono-right",children:e.jsx("rect",{x:"16",y:"0",width:"16",height:"32"})}),e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:"#111111",clipPath:"url(#mono-left)"}),e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:"#ffffff",clipPath:"url(#mono-right)"}),e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:"none",stroke:s?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.1)",strokeWidth:"1"})]}):e.jsx("svg",{width:m,height:m,viewBox:"0 0 32 32",children:e.jsx("circle",{cx:"16",cy:"16",r:"15",fill:t.accent})}),n&&!r&&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 Ln({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 In({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(Pe,{size:36})}function Mn(){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(I,{w:36,h:36,className:"rounded-full shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx(I,{w:90,h:14,className:"mb-1.5"}),e.jsx(I,{w:60,h:12})]}),e.jsxs("div",{className:"text-right",children:[e.jsx(I,{w:40,h:10,className:"mb-1.5"}),e.jsx(I,{w:80,h:14})]})]},t))})}function Bn({onClose:t,onSelect:n,quotes:a,quotesLoading:s,cryptoCurrency:r}){const[u,m]=o.useState(""),l=o.useMemo(()=>{if(!(a!=null&&a.quotes))return[];const i=u.trim().toLowerCase();return i?a.quotes.filter(p=>p.gatewayName.toLowerCase().includes(i)):a.quotes},[a,u]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end px-5 pt-5",children:e.jsx(je,{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(we,{value:u,onChange:m}),e.jsxs("div",{className:"flex-1 overflow-y-auto custom-scroll px-5 space-y-2",children:[s?e.jsx(Mn,{}):l.length===0?e.jsx("div",{className:"text-center py-10 text-[14px]",style:{color:"var(--t-text-muted)"},children:a&&a.quotes.length===0?"No quotes available for this request":"No providers found"}):l.map((i,p)=>{const h=p===0,d=parseFloat(i.cryptoAmount),f=d>=1?d.toFixed(4):d.toPrecision(6);return e.jsxs("button",{onClick:()=>n(i),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(In,{quote:i}),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:i.gatewayName}),e.jsx(Ln,{quote:i})]}),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:[r," ",f]})]})]},i.gatewayId)}),!s&&(a==null?void 0:a.unavailableGateways)&&a.unavailableGateways.length>0&&e.jsx("div",{className:"pt-3",children:a.unavailableGateways.map(i=>e.jsxs("div",{className:"flex items-center justify-between py-2 text-[12px]",style:{color:"var(--t-text-muted)"},children:[e.jsx("span",{children:i.gatewayName}),e.jsx("span",{children:i.reason})]},i.gatewayId))})]})]})}exports.AnimatedDigit=Jt;exports.AnimatedNumber=zt;exports.ApplePayIcon=Ot;exports.BLOCKCHAINS=Ie;exports.BankIcon=Mt;exports.CRYPTO_CHAIN_COMBOS=Lt;exports.CRYPTO_CURRENCIES=Je;exports.CardIcon=Dt;exports.CheckoutForm=Tn;exports.CheckoutStep=Wt;exports.ChevronDown=ve;exports.ChevronRight=Ut;exports.ChooseRampModal=Bn;exports.CloseButton=je;exports.CoinifyIcon=bn;exports.CompleteStep=Yt;exports.ConfirmStep=Qt;exports.CryptoCurrencyModal=tn;exports.CryptoIcon=Qe;exports.DarkModeIcon=Kt;exports.ErrorStep=Zt;exports.FIAT_CURRENCIES=Ge;exports.FIAT_TO_COUNTRY=Rt;exports.FiatCurrencyModal=en;exports.FiatFlag=Oe;exports.FormSkeleton=qt;exports.GenericCoinIcon=Pe;exports.GooglePayIcon=Ht;exports.MOCK_RATES=Ze;exports.MenuIcon=Ft;exports.Modal=Ae;exports.PayPalIcon=Pt;exports.PaymentMethodSelector=$t;exports.ProcessingStep=Gt;exports.RampForm=sn;exports.RampProvider=wt;exports.RevolutIcon=Bt;exports.SKINS=Ye;exports.SearchInput=we;exports.SettingsScreen=an;exports.Skeleton=I;exports.SkinSwatch=kn;exports.ToggleSwitch=nn;exports.formatOutput=gn;exports.getChainIconUrl=Be;exports.getCryptoIconUrl=ze;exports.getFiatFlagUrl=Tt;exports.getMockRate=Cn;exports.getPaymentIcon=_t;exports.parseAmount=kt;exports.useCheckoutIntent=Nt;exports.useQuotes=bt;exports.useRamp=ue;exports.useRampConfig=jt;exports.useTransaction=St;
|
|
12
12
|
//# sourceMappingURL=index.cjs.map
|