@unifold/connect-react-native 0.1.44-beta.1 → 0.1.44
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.js +3 -3
- package/dist/index.mjs +3 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var ni=require('react'),reactNative=require('react-native'),Pt=require('react-native-svg'),jsxRuntime=require('react/jsx-runtime'),reactNativeGestureHandler=require('react-native-gesture-handler'),ap=require('react-native-reanimated'),stripeReactNative=require('@stripe/stripe-react-native'),Fd=require('@react-native-async-storage/async-storage'),Py=require('expo-constants'),db=require('react-native-qrcode-svg'),reactNativeWebview=require('react-native-webview');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var ni__namespace=/*#__PURE__*/_interopNamespace(ni);var Pt__default=/*#__PURE__*/_interopDefault(Pt);var ap__default=/*#__PURE__*/_interopDefault(ap);var Fd__default=/*#__PURE__*/_interopDefault(Fd);var Py__default=/*#__PURE__*/_interopDefault(Py);var db__default=/*#__PURE__*/_interopDefault(db);var Zu=e=>{throw TypeError(e)};var hh=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Nc=(e,t,r)=>t.has(e)||Zu("Cannot "+r);var f=(e,t,r)=>(Nc(e,t,"read from private field"),r?r.call(e):t.get(e)),te=(e,t,r)=>t.has(e)?Zu("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),A=(e,t,r,o)=>(Nc(e,t,"write to private field"),t.set(e,r),r),Ue=(e,t,r)=>(Nc(e,t,"access private method"),r);var Js=(e,t,r,o)=>({set _(n){A(e,t,n);},get _(){return f(e,t,o)}});var jc={light:{background:"#FFFFFF",card:"#F8FAFC",cardHover:"#F1F5F9",foreground:"#0F172A",foregroundMuted:"#64748B",foregroundSubtle:"#94A3B8",border:"#E2E8F0",borderSecondary:"#CBD5E1",primary:"#3B82F6",primaryForeground:"#FFFFFF",success:"#22C55E",successBackground:"#DCFCE7",warning:"#F59E0B",warningBackground:"#FEF3C7",error:"#EF4444",errorBackground:"#FEE2E2",overlay:"rgba(0, 0, 0, 0.5)"},dark:{background:"#2D2C2F",card:"#3A393C",cardHover:"#48474A",foreground:"#F8FAFC",foregroundMuted:"#94A3B8",foregroundSubtle:"#64748B",border:"#38383A",borderSecondary:"#48484A",primary:"#3B82F6",primaryForeground:"#FFFFFF",success:"#22C55E",successBackground:"rgba(34, 197, 94, 0.1)",warning:"#F59E0B",warningBackground:"rgba(245, 158, 11, 0.1)",error:"#EF4444",errorBackground:"rgba(239, 68, 68, 0.1)",overlay:"rgba(0, 0, 0, 0.7)"}},$c=jc;function ol(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function Zs(e,t,r){let o=r?t?.[r]:void 0,n=(c,y,T)=>{let w=o?.[c]?.[y];if(w!==void 0)return w;let m=t?.[c]?.[y];return m!==void 0?m:T},i={backgroundColor:n("card","backgroundColor",e.card),titleColor:n("card","titleColor",e.foreground),subtitleColor:n("card","subtitleColor",e.foregroundMuted),labelColor:n("card","labelColor",e.foregroundMuted),headerColor:n("card","headerColor",e.foregroundMuted),labelRightColor:n("card","labelRightColor",e.foregroundMuted),labelHighlightRightColor:n("card","labelHighlightRightColor",e.warning),textRightColor:n("card","textRightColor",e.foreground),subtextRightColor:n("card","subtextRightColor",e.foregroundMuted),rowLeftLabel:n("card","rowLeftLabel",e.foregroundMuted),rowRightLabel:n("card","rowRightLabel",e.foreground),iconColor:n("card","iconColor",e.primary),iconBackgroundColor:n("card","iconBackgroundColor",e.primary+"26"),actionColor:n("card","actionColor",e.foregroundMuted),actionIcon:n("card","actionIcon",e.foregroundMuted),descriptionColor:n("card","descriptionColor",e.foregroundMuted),borderRadius:n("card","borderRadius",12),borderWidth:n("card","borderWidth",0),borderColor:n("card","borderColor",e.border),shadowColor:n("card","shadowColor","#000"),shadowOffset:n("card","shadowOffset",{width:0,height:-4}),shadowOpacity:n("card","shadowOpacity",0),shadowRadius:n("card","shadowRadius",12),elevation:n("card","elevation",0),iconContainerBorderRadius:n("card","iconContainerBorderRadius",12),backShadowColor:"transparent",backShadowOffset:{top:4,left:4,right:-4,bottom:-4},backShadowSpacing:8},s=(o?.depositMenu??t?.depositMenu)?.card,a=(o?.transferCrypto??t?.transferCrypto)?.depositAddress?.card,l=(o?.depositCard??t?.depositCard)?.quoteProvider?.card,u=(o?.depositTracker??t?.depositTracker)?.executionRow?.card;return {header:{titleColor:n("header","titleColor",e.foreground),buttonColor:n("header","buttonColor",e.foreground)},card:i,input:{backgroundColor:n("input","backgroundColor",n("search","backgroundColor",e.card)),textColor:n("input","textColor",n("search","inputColor",e.foreground)),placeholderColor:n("input","placeholderColor",n("search","placeholderColor",e.foregroundMuted)),borderColor:n("input","borderColor",e.border),borderRadius:n("input","borderRadius",n("search","borderRadius",8)),borderWidth:n("input","borderWidth",1)},button:{primaryBackground:n("button","primaryBackground",e.primary),primaryText:n("button","primaryText",e.primaryForeground),secondaryBackground:n("button","secondaryBackground",e.card),secondaryText:n("button","secondaryText",e.foreground),borderRadius:n("button","borderRadius",12),borderWidth:n("button","borderWidth",0),borderColor:n("button","borderColor",e.border)},container:{titleColor:n("container","titleColor",e.foreground),subtitleColor:n("container","subtitleColor",e.foregroundMuted),actionColor:n("container","actionColor",e.foregroundMuted),actionTitle:n("container","actionTitle",e.foregroundMuted),buttonColor:n("container","buttonColor",e.primary),buttonTitleColor:n("container","buttonTitleColor",e.primaryForeground),iconBackgroundColor:n("container","iconBackgroundColor",e.success),iconColor:n("container","iconColor",e.foreground)},search:{backgroundColor:n("search","backgroundColor",e.card),inputColor:n("search","inputColor",e.foreground),placeholderColor:n("search","placeholderColor",e.foregroundMuted),borderRadius:n("search","borderRadius",8)},list:{titleSectionColor:n("list","titleSectionColor",e.foregroundMuted),rowBorderRadius:n("list","rowBorderRadius",12)},badge:{borderRadius:n("badge","borderRadius",8)},sheet:{shadowColor:n("sheet","shadowColor","#000"),shadowOffset:n("sheet","shadowOffset",{width:0,height:-4}),shadowOpacity:n("sheet","shadowOpacity",.1),shadowRadius:n("sheet","shadowRadius",12),elevation:n("sheet","elevation",16)},depositMenu:{card:ol(i,s)},transferCrypto:{depositAddress:{card:ol(i,a)}},depositCard:{quoteProvider:{card:ol(i,l)}},depositTracker:{executionRow:{card:ol(i,u)}}}}function qc(e,t,r){let n={...jc[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var Kc=ni.createContext(null);function V(){let e=ni.useContext(Kc);if(!e){let t=$c.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:Zs(t,void 0,"dark"),isDark:true}}return e}function nt({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:i,gradientTo:s}){let{colors:a}=V(),l=i??a.warning,u=s??"#FBBF24",c=ni.useRef(new reactNative.Animated.Value(0)).current,y=ni.useId(),T=ni.useMemo(()=>`circularProgressGrad_${y.replace(/[^a-zA-Z0-9_-]/g,"")}`,[y]),w=(e-t)/2,m=2*Math.PI*w,g=e/2,h=o??Math.max(0,Math.round(e-t*2-8)),S=(e-h)/2;ni.useEffect(()=>{let p=reactNative.Animated.loop(reactNative.Animated.timing(c,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true})),d=requestAnimationFrame(()=>p.start());return ()=>{cancelAnimationFrame(d),p.stop();}},[c]);let b=c.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsxs(reactNative.View,{style:[{width:e,height:e},n],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:b}]},children:jsxRuntime.jsxs(Pt__default.default,{width:e,height:e,children:[jsxRuntime.jsx(Pt.Defs,{children:jsxRuntime.jsxs(Pt.LinearGradient,{id:T,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(Pt.Stop,{offset:"0%",stopColor:l}),jsxRuntime.jsx(Pt.Stop,{offset:"100%",stopColor:u})]})}),jsxRuntime.jsx(Pt.Circle,{cx:g,cy:g,r:w,stroke:`url(#${T})`,strokeWidth:t,fill:"none",strokeDasharray:`${m*.75} ${m*.25}`,strokeLinecap:"round",rotation:-90,origin:`${g}, ${g}`})]})}),r!=null?jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:S+1.5,left:S,width:h,height:h},children:r}):null]})}function Yc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Pt.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ji({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pt.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Nr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Xs({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pt.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function st({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pt.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function _r({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Pt.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Zi({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Pt.Polyline,{points:"15 18 9 12 15 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Gt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Pt.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function ln({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pt.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Path,{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Le({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Pt.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function ea({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Gc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pt.Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Do({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pt.Path,{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function An({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pt.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Path,{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function il({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pt.Path,{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Vo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Pt.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Xi({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pt.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Path,{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function es({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function jr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pt.Path,{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function sl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pt.Path,{d:"M3 7V5a2 2 0 0 1 2-2h2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Path,{d:"M17 3h2a2 2 0 0 1 2 2v2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Path,{d:"M21 17v2a2 2 0 0 1-2 2h-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Path,{d:"M7 21H5a2 2 0 0 1-2-2v-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Path,{d:"M8 14s1.5 2 4 2 4-2 4-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Path,{d:"M9 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Path,{d:"M15 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function al({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pt.Path,{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Path,{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ta({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pt.Path,{d:"M5.43 5.43A8.06 8.06 0 0 0 4 10c0 6 8 12 8 12a29.94 29.94 0 0 0 5-5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Path,{d:"M19.18 13.52A8.66 8.66 0 0 0 20 10a8 8 0 0 0-8-8 7.88 7.88 0 0 0-3.52.82",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Path,{d:"M9.13 9.13A2.78 2.78 0 0 0 9 10a3 3 0 0 0 3 3 2.78 2.78 0 0 0 .87-.13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function rp({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pt.Path,{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Path,{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function op({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pt.Circle,{cx:12,cy:5,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(Pt.Circle,{cx:12,cy:12,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(Pt.Circle,{cx:12,cy:19,r:1,stroke:t,strokeWidth:r,fill:t})]})}function np({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pt.Path,{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Polyline,{points:"16 17 21 12 16 7",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pt.Line,{x1:21,y1:12,x2:9,y2:12,stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ip({height:e=24,color:t="#011e0f"}){let o=e*2.985416666666667;return jsxRuntime.jsxs(Pt__default.default,{width:o,height:e,viewBox:"0 0 71.65 24",fill:"none",children:[jsxRuntime.jsx(Pt.Path,{d:"M36.12,3.68c0-1.13.95-2.04,2.07-2.04s2.07.92,2.07,2.04-.92,2.07-2.07,2.07-2.07-.92-2.07-2.07ZM29.98,1.92h3.6v20.16h-3.6s0-20.16,0-20.16ZM40.01,7.68h-3.63v14.4h3.63V7.68ZM66.1,14.39c2.73-1.68,4.59-4.18,5.32-6.72h-3.63c-.95,2.42-3.12,4.24-5.5,5.01V1.92h-3.63v20.16h3.63v-6c2.77.69,4.96,3.09,5.71,6h3.65c-.56-3.05-2.64-5.91-5.55-7.68ZM46.44,9.29c.95-1.26,2.8-2,4.31-2,2.8,0,5.12,2.05,5.13,5.15v9.63h-3.63v-8.83c0-1.27-.57-2.74-2.4-2.74-2.16,0-3.4,1.92-3.4,4.16v7.43h-3.63V7.69h3.63v1.6Z",fill:t}),jsxRuntime.jsx(Pt.Circle,{cx:12,cy:12,r:12,fill:"#00d66f"}),jsxRuntime.jsx(Pt.Path,{d:"M11.45,4.8h-3.7c.72,3.01,2.82,5.58,5.45,7.2-2.64,1.62-4.73,4.19-5.45,7.2h3.7c.92-2.78,3.46-5.2,6.58-5.7v-3.01c-3.12-.49-5.66-2.91-6.58-5.69Z",fill:"#011e0f"})]})}function ts({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:i,components:s}){let a=reactNative.useColorScheme(),l=ni.useMemo(()=>t==="auto"?a==="dark"?"dark":"light":t,[t,a]),u=ni.useMemo(()=>{let w=o?.[l];return qc(l,w,r)},[l,o,r]),c=ni.useMemo(()=>Zs(u,s,l),[u,s,l]),y=ni.useMemo(()=>i?{regular:i.regular||n,medium:i.medium||n,semibold:i.semibold||n,bold:i.bold||n}:n?{regular:n,medium:n,semibold:n,bold:n}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[n,i]),T=ni.useMemo(()=>({mode:l,colors:u,fonts:y,components:c,isDark:l==="dark"}),[l,u,y,c]);return jsxRuntime.jsx(Kc.Provider,{value:T,children:e})}var ia={damping:28,stiffness:300,mass:.8},$h=80,qh=500;function bt({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,enablePanDownToClose:n=true,showHandle:i=true,heightPercent:s,maxHeightPercent:a,startExpanded:l=false,noPadding:u=false,borderTopLeftRadius:c=24,borderTopRightRadius:y=24}){let{colors:T}=V(),{height:w}=reactNative.useWindowDimensions(),[m,g]=ni.useState(false),h=ni.useRef(e);h.current=e;let S=ni.useRef(0),b=s!=null&&s>=1,p=b||u?0:reactNative.Platform.OS==="ios"?34:24,d=a!=null&&s!=null&&a>s,C=s!=null?(d?a:s)*w:void 0,x=d?(a-s)*w:0,_=l?0:x,k=ap.useSharedValue(w),v=ni.useRef(null),M=ni.useCallback(()=>{v.current&&(clearTimeout(v.current),v.current=null),h.current||g(false);},[]);ni.useEffect(()=>{e?(v.current&&(clearTimeout(v.current),v.current=null),g(true),k.value=ap.withSpring(_,ia)):m&&(k.value=ap.withTiming(w,{duration:250},j=>{j&&ap.runOnJS(M)();}),v.current=setTimeout(()=>{v.current=null,M();},350));},[e]),ni.useEffect(()=>()=>{v.current&&clearTimeout(v.current);},[]),ni.useEffect(()=>{m&&e&&(k.value=ap.withSpring(_,ia));},[_]);let W=ni.useCallback(()=>{o&&t();},[o,t]),O=ni.useMemo(()=>{if(!(!n&&!d))return reactNative.PanResponder.create({onStartShouldSetPanResponder:()=>true,onMoveShouldSetPanResponder:()=>true,onPanResponderGrant:()=>{S.current=k.value;},onPanResponderMove:(j,le)=>{if(Math.abs(le.dy)<4)return;let Ye=S.current+le.dy;k.value=Math.max(0,Ye);},onPanResponderRelease:(j,le)=>{if(!(Math.abs(le.dy)<4)){if(n&&(le.dy>$h||le.vy>qh)){t();return}if(d){let Ye=x/2,_e=k.value<Ye?0:x;k.value=ap.withSpring(_e,ia);}else k.value=ap.withSpring(_,ia);}},onPanResponderTerminate:()=>{k.value=ap.withSpring(_,ia);}}).panHandlers},[n,d,x,_,k,t]),F=ap.useAnimatedStyle(()=>({transform:[{translateY:k.value}]})),U=ap.useAnimatedStyle(()=>({opacity:ap.interpolate(k.value,[0,w*.5,w],[.5,.25,0],ap.Extrapolation.CLAMP)}));return m?jsxRuntime.jsx(reactNative.Modal,{transparent:true,visible:true,animationType:"none",onRequestClose:t,children:jsxRuntime.jsxs(reactNative.View,{style:bi.root,pointerEvents:e?"auto":"none",children:[jsxRuntime.jsx(ap__default.default.View,{style:[bi.backdrop,U],pointerEvents:e?"auto":"none",children:jsxRuntime.jsx(reactNative.Pressable,{style:reactNative.StyleSheet.absoluteFill,onPress:W})}),jsxRuntime.jsxs(ap__default.default.View,{style:[bi.sheet,F,{height:C,backgroundColor:T.background,borderTopLeftRadius:b?0:c,borderTopRightRadius:b?0:y}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.GestureHandlerRootView,{style:bi.gestureRoot,children:[i&&jsxRuntime.jsx(reactNative.View,{style:bi.handleContainer,pointerEvents:"none",children:jsxRuntime.jsx(reactNative.View,{style:[bi.handle,{backgroundColor:T.foreground+"33"}]})}),r,p>0&&jsxRuntime.jsx(reactNative.View,{style:{height:p}})]}),O&&jsxRuntime.jsx(reactNative.View,{...O,style:bi.dragOverlay})]})]})}):null}var bi=reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},backdrop:{...reactNative.StyleSheet.absoluteFillObject,backgroundColor:"#000"},sheet:{overflow:"hidden"},gestureRoot:{flex:1},handleContainer:{alignItems:"center",paddingTop:10,paddingBottom:4,zIndex:1},dragOverlay:{position:"absolute",top:0,left:0,right:0,height:40,zIndex:2},handle:{width:36,height:5,borderRadius:2.5}}),at=ni__namespace.default.forwardRef((e,t)=>jsxRuntime.jsx(reactNative.ScrollView,{ref:t,...e}));at.displayName="BottomSheetScrollView";function rs(e){return jsxRuntime.jsx(reactNative.FlatList,{...e})}var Kh="https://api.unifold.io",td="__UnifoldDevApiBaseUrl__",Er="pk_test_123",ll={};function Qh(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[td];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function fr(){return Qh()??Kh}function cl(e){if(e.publishableKey!==void 0){if(!e.publishableKey||e.publishableKey.trim()==="")throw new Error("Unifold SDK: publishableKey cannot be empty. Please provide a valid publishable key.");!e.publishableKey.startsWith("pk_test_")&&!e.publishableKey.startsWith("pk_live_")&&console.warn('Unifold SDK: publishableKey should start with "pk_test_" or "pk_live_". Please ensure you are using a valid publishable key.'),Er=e.publishableKey;}e.defaultConfig&&(ll=e.defaultConfig);}function cp(e){if(typeof __DEV__>"u"||!__DEV__){console.warn("[Unifold] setDevApiUrl() is only available in development mode");return}if(typeof globalThis>"u")return;let t=e.trim();t.length>0?globalThis[td]=t:delete globalThis[td];}function sa(){return fr()}function dl(){return Er}function to(e){if(!e||e.trim()==="")throw new Error("Unifold SDK: No publishable key configured. Please provide a valid publishable key via setApiConfig() or pass it directly to the API function.");e==="pk_test_123"&&console.warn('Unifold SDK: Using default test key "pk_test_123". This should only be used for local development. Please use a real publishable key in production.');}function cr(e){let t=e.startsWith("/")?e:`/${e}`;return `${fr()}/api/public${t}`}function oe(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,fr()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${fr()}${e}`:`${fr()}/api/public${e}`:""}async function dn(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||ll.recipientAddress;if(!r)throw new Error("[Unifold] recipient_address is required for createDepositAddress. Pass recipientAddress in your beginDeposit() config.");let o={external_user_id:e.external_user_id,destination_chain_type:e?.destination_chain_type||"ethereum",destination_chain_id:e?.destination_chain_id||ll.destinationChainId||"8453",destination_token_address:e?.destination_token_address||ll.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||Er;to(n);let i=await fetch(`${fr()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok)throw new Error(`Failed to create deposit address: ${i.statusText}`);return await i.json()}function un(e,t){return e.find(r=>r.chain_type===t)}async function pn(e,t,r){let o=t||Er;to(o);let n=await fetch(`${fr()}/v1/public/direct_executions/query`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify({external_user_id:e,...r&&{action_type:r}})});if(!n.ok)throw new Error(`Failed to query executions: ${n.statusText}`);return n.json()}async function ul(e,t){let r=t||Er;to(r);let o=await fetch(`${fr()}/v1/public/direct_executions/poll`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify({deposit_wallet_id:e})});if(!o.ok)throw new Error(`Failed to poll executions: ${o.statusText}`);return o.json()}function Te(e,t="svg"){if(!e)return "";if(t==="svg"||!e.icon_urls||e.icon_urls.length===0)return e.icon_url;let r=e.icon_urls.find(o=>o.format===t);return r?r.url:e.icon_url}async function Ci(e,t){let r=e||Er;to(r);let o=`${fr()}/v1/public/tokens/supported_deposit_tokens`;if(t?.destination_token_address&&t?.destination_chain_id&&t?.destination_chain_type){let i=new URLSearchParams({destination_token_address:t.destination_token_address,destination_chain_id:t.destination_chain_id,destination_chain_type:t.destination_chain_type});o=`${o}?${i.toString()}`;}let n=await fetch(o,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch supported deposit tokens: ${n.statusText}`);return n.json()}async function rd(e,t){let r=t||Er;to(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${fr()}/v1/public/tokens/token?${o.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch token metadata: ${n.statusText}`);return n.json()}function pl(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function od(e,t){let r=t||Er;to(r);let o=await fetch(`${fr()}/v1/public/onramps/quotes`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to fetch onramp quotes: ${o.statusText}`);return o.json()}async function nd(e,t){let r=t||Er;to(r);let o=await fetch(`${fr()}/v1/public/onramps/sessions`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to create onramp session: ${o.statusText}`);return o.json()}async function id(e,t){let r=t||Er;to(r);let o=new URLSearchParams;e.country_code&&o.append("country_code",e.country_code),e.subdivision_code&&o.append("subdivision_code",e.subdivision_code),o.append("token_address",e.token_address),o.append("chain_id",e.chain_id),o.append("chain_type",e.chain_type);let n=await fetch(`${fr()}/v1/public/onramps/default_token?${o.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch default onramp token: ${n.statusText}`);return n.json()}async function aa(e){let t=e||Er;to(t);let r=await fetch(`${fr()}/v1/public/onramps/fiat_currencies`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch fiat currencies: ${r.statusText}`);return r.json()}function os(e,t="png"){if(!e||e.length===0)return;let r=e.find(o=>o.format===t);return r?r.url:e[0]?.url}async function la(e){let t=e||Er;to(t);let r=await fetch(`${fr()}/v1/public/projects/config`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch project config: ${r.statusText}`);return r.json()}async function sd(){let e=await fetch(`${fr()}/v1/public/tokens/chains`,{method:"GET",headers:{accept:"application/json"}});if(!e.ok)throw new Error(`Failed to fetch token chains: ${e.statusText}`);return e.json()}function ml(e,t,r){let o=e.find(i=>i.chain_id===r);if(o)return o.chain_name;let n=e.find(i=>i.chain_type===t);return n?n.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}async function ca(){let e=await fetch(`${fr()}/v1/public/ip_address`,{method:"GET",headers:{accept:"application/json"}});if(!e.ok)throw new Error(`Failed to fetch IP address information: ${e.statusText}`);return e.json()}async function fl(e){let t=e||Er;to(t);let r=await fetch(`${fr()}/v1/public/tokens/supported_destination_tokens`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch supported destination tokens: ${r.statusText}`);return r.json()}async function ad(e,t){let r=t||Er;to(r);let o=await fetch(`${fr()}/v1/public/addresses/verify`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to verify address: ${o.statusText}`);return o.json()}async function ld(e,t){return ul(e.deposit_wallet_id,t)}async function hl(e,t,r,o,n){let i=n||Er;to(i);let s=await fetch(`${fr()}/v1/public/addresses/balance`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":i},body:JSON.stringify({address:e,chain_type:t,chain_id:r,token_address:o})});if(!s.ok)throw new Error(`Failed to fetch address balance: ${s.statusText}`);return s.json()}function up({size:e=28}){return jsxRuntime.jsx(Pt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxRuntime.jsxs(Pt.G,{fillRule:"evenodd",children:[jsxRuntime.jsx(Pt.Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsxRuntime.jsx(Pt.Path,{fill:"#FFF",d:"M13.967 23.86c5.445 0 9.86-4.415 9.86-9.86s-4.415-9.86-9.86-9.86c-5.166 0-9.403 3.974-9.825 9.03h14.63v1.642H4.142c.413 5.065 4.654 9.047 9.826 9.047Z"})]})})}function mp({size:e=28}){return jsxRuntime.jsxs(Pt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Pt.G,{clipPath:"url(#eth_clip)",children:[jsxRuntime.jsx(Pt.Path,{d:"M14 28C21.732 28 28 21.732 28 14C28 6.26801 21.732 0 14 0C6.26801 0 0 6.26801 0 14C0 21.732 6.26801 28 14 28Z",fill:"#627EEA"}),jsxRuntime.jsx(Pt.Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Pt.Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsxRuntime.jsx(Pt.Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Pt.Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsxRuntime.jsx(Pt.Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsxRuntime.jsx(Pt.Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsxRuntime.jsx(Pt.Defs,{children:jsxRuntime.jsx(Pt.ClipPath,{id:"eth_clip",children:jsxRuntime.jsx(Pt.Rect,{width:28,height:28,fill:"white"})})})]})}function gp({size:e=28}){return jsxRuntime.jsxs(Pt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Pt.G,{clipPath:"url(#btc_clip)",children:[jsxRuntime.jsx(Pt.Path,{d:"M14 28C21.732 28 28 21.732 28 14C28 6.26801 21.732 0 14 0C6.26801 0 0 6.26801 0 14C0 21.732 6.26801 28 14 28Z",fill:"#F7931A"}),jsxRuntime.jsx(Pt.Path,{d:"M20.0594 12.1625C20.3438 10.2594 18.9 9.23124 16.9203 8.55311L17.5656 5.97186L15.9906 5.57811L15.3672 8.09374C14.9516 7.9953 14.525 7.89686 14.0985 7.79843L14.7328 5.27186L13.1578 4.87811L12.5125 7.45936C12.1735 7.3828 11.8344 7.30624 11.5063 7.22968V7.21874L9.34065 6.67186L8.92502 8.35624C8.92502 8.35624 10.0844 8.61874 10.0625 8.64061C10.6969 8.79374 10.8063 9.2203 10.7844 9.54843L10.0625 12.4578C10.1063 12.4687 10.161 12.4797 10.2266 12.5125C10.1828 12.5016 10.1281 12.4906 10.0735 12.4687L9.05627 16.5375C8.97971 16.7344 8.78284 17.0187 8.34534 16.9094C8.36721 16.9312 7.20784 16.625 7.20784 16.625L6.43127 18.4297L8.47659 18.9437C8.8594 19.0422 9.23127 19.1406 9.59221 19.2281L8.9469 21.8422L10.5219 22.2359L11.1672 19.6547C11.5938 19.775 12.0094 19.8734 12.4141 19.9828L11.7688 22.5531L13.3438 22.9469L13.9891 20.3328C16.6578 20.8359 18.6594 20.6281 19.5016 18.2219C20.1797 16.2859 19.4688 15.1703 18.0688 14.4375C19.086 14.2078 19.8516 13.5406 20.0594 12.1625ZM16.4938 17.1609C16.0125 19.0969 12.7531 18.0469 11.6922 17.7844L12.5453 14.35C13.6063 14.6125 16.9969 15.1484 16.4938 17.1609ZM16.975 12.1297C16.5375 13.8906 13.825 12.9937 12.95 12.775L13.7266 9.6578C14.6016 9.87655 17.4344 10.2812 16.975 12.1297Z",fill:"white"})]}),jsxRuntime.jsx(Pt.Defs,{children:jsxRuntime.jsx(Pt.ClipPath,{id:"btc_clip",children:jsxRuntime.jsx(Pt.Rect,{width:28,height:28,fill:"white"})})})]})}function yp({size:e=28}){return jsxRuntime.jsxs(Pt__default.default,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxRuntime.jsxs(Pt.Defs,{children:[jsxRuntime.jsxs(Pt.LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Pt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Pt.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Pt.LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Pt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Pt.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Pt.LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Pt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Pt.Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsxRuntime.jsx(Pt.Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxRuntime.jsxs(Pt.G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsxRuntime.jsx(Pt.Path,{fill:"url(#sol2)",d:"M64.6,3.8C67.1,1.4,70.4,0,73.8,0h317.4c5.8,0,8.7,7,4.6,11.1l-62.7,62.7c-2.4,2.4-5.7,3.8-9.2,3.8H6.5c-5.8,0-8.7-7-4.6-11.1L64.6,3.8z"}),jsxRuntime.jsx(Pt.Path,{fill:"url(#sol3)",d:"M333.1,120.1c-2.4-2.4-5.7-3.8-9.2-3.8H6.5c-5.8,0-8.7,7-4.6,11.1l62.7,62.7c2.4,2.4,5.7,3.8,9.2,3.8h317.4c5.8,0,8.7-7,4.6-11.1L333.1,120.1z"}),jsxRuntime.jsx(Pt.Path,{fill:"url(#sol1)",d:"M64.6,237.9c2.4-2.4,5.7-3.8,9.2-3.8h317.4c5.8,0,8.7,7,4.6,11.1l-62.7,62.7c-2.4,2.4-5.7,3.8-9.2,3.8H6.5c-5.8,0-8.7-7-4.6-11.1L64.6,237.9z"})]})]})}function bp({size:e=28}){return jsxRuntime.jsx(Pt__default.default,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxRuntime.jsxs(Pt.G,{children:[jsxRuntime.jsx(Pt.Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsxRuntime.jsx(Pt.Path,{fill:"#FFF",d:"M21.092 12.693c-.369-.215-.848-.215-1.254 0l-2.879 1.654-1.955 1.078-2.879 1.653c-.369.216-.848.216-1.254 0l-2.288-1.294c-.369-.215-.627-.61-.627-1.042V12.19c0-.431.221-.826.627-1.042l2.25-1.258c.37-.216.85-.216 1.256 0l2.25 1.258c.37.216.628.611.628 1.042v1.654l1.955-1.115v-1.653a1.16 1.16 0 0 0-.627-1.042l-4.17-2.372c-.369-.216-.848-.216-1.254 0l-4.244 2.372A1.16 1.16 0 0 0 6 11.076v4.78c0 .432.221.827.627 1.043l4.244 2.372c.369.215.849.215 1.254 0l2.879-1.618 1.955-1.114 2.879-1.617c.369-.216.848-.216 1.254 0l2.251 1.258c.37.215.627.61.627 1.042v2.552c0 .431-.22.826-.627 1.042l-2.25 1.294c-.37.216-.85.216-1.255 0l-2.251-1.258c-.37-.216-.628-.611-.628-1.042v-1.654l-1.955 1.115v1.653c0 .431.221.827.627 1.042l4.244 2.372c.369.216.848.216 1.254 0l4.244-2.372c.369-.215.627-.61.627-1.042v-4.78a1.16 1.16 0 0 0-.627-1.042l-4.28-2.409z"})]})})}var gl=[{label:"Base",value:stripeReactNative.Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:up},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:mp},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:gp},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:yp},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:bp}];function yl(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function bl(e,t){let r=parseFloat(e);if(isNaN(r))return e;let o=t.toLowerCase(),n=["eth","btc"].includes(o)?4:2;return r.toFixed(n)}function ss(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=gl.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=gl.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function St({onPress:e,title:t,variant:r="close",leftAction:o}){let{components:n,fonts:i}=V(),s=r==="back",a=s?jsxRuntime.jsx(Zi,{size:22,color:n.header.buttonColor,strokeWidth:2.5}):jsxRuntime.jsx(st,{size:20,color:n.header.buttonColor,strokeWidth:2}),l=jsxRuntime.jsx(reactNative.TouchableOpacity,{style:En.closeBtn,onPress:e,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:s?"Back":"Close",children:a});return t?jsxRuntime.jsxs(reactNative.View,{style:En.headerWithTitle,children:[s?l:o??jsxRuntime.jsx(reactNative.View,{style:En.headerSide}),jsxRuntime.jsx(reactNative.Text,{style:[En.headerTitleText,{color:n.header.titleColor},...i.bold?[{fontFamily:i.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),s?jsxRuntime.jsx(reactNative.View,{style:En.headerSide}):l]}):jsxRuntime.jsxs(reactNative.View,{style:s?En.headerWithTitle:En.header,children:[s?l:jsxRuntime.jsx(reactNative.View,{style:En.headerSpacer}),!s&&l]})}var Cl={paddingTop:8,paddingBottom:8},En=reactNative.StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...Cl},headerWithTitle:{flexDirection:"row",alignItems:"center",...Cl,zIndex:9999,overflow:"visible"},headerSpacer:{flex:1},headerSide:{width:28},headerTitleText:{flex:1,textAlign:"center",fontSize:17},closeBtn:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"}});function Mr({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=V();return e?jsxRuntime.jsx(reactNative.Text,{style:[Cp.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[Cp.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var Cp=reactNative.StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function To({quote:e,label:t,value:r,last:o,hideDivider:n}){return jsxRuntime.jsxs(ni.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:e.row,children:[jsxRuntime.jsx(reactNative.Text,{style:e.rowLabel,children:t}),jsxRuntime.jsx(reactNative.Text,{style:[e.rowValue],children:r})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}function fd({quote:e,label:t,address:r,last:o,hideDivider:n}){let[i,s]=ni.useState(false),{colors:a,components:l}=V(),u=()=>{reactNative.Clipboard.setString(r),s(true),setTimeout(()=>s(false),2e3);},c=yl(r);return jsxRuntime.jsxs(ni.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:e.row,children:[jsxRuntime.jsx(reactNative.Text,{style:e.rowLabel,children:t}),jsxRuntime.jsxs(reactNative.View,{style:e.rowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[e.rowValue,{flexShrink:1,minWidth:0}],numberOfLines:1,ellipsizeMode:"middle",selectable:true,children:c}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:u,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:i?jsxRuntime.jsx(Le,{size:14,color:a.success,strokeWidth:2.5}):jsxRuntime.jsx(ln,{size:14,color:l.card.actionIcon,strokeWidth:2})})]})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}var wl={usdc:"#2775CA",usdt:"#26A17B",eth:"#627EEA",btc:"#F7931A",sol:"#9945FF",matic:"#8247E5",dai:"#F5AC37"};function as({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=V(),i=e.toLowerCase(),s=wl[i]??n.primary,a=Math.round(o*.42);return jsxRuntime.jsxs(reactNative.View,{style:{width:o,height:o,position:"relative"},children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:t},style:{width:o,height:o,borderRadius:o/2}}):jsxRuntime.jsx(reactNative.View,{style:{width:o,height:o,borderRadius:o/2,backgroundColor:s,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"#FFFFFF",fontWeight:"700",fontSize:o*.38},children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),r?jsxRuntime.jsx(reactNative.Image,{source:{uri:r},style:{position:"absolute",bottom:-2,right:-4,width:a,height:a,borderRadius:a/2,borderWidth:2,borderColor:n.background}}):null]})}function Sl({sourceCurrency:e,destinationCurrency:t,destinationNetwork:r,tokenIconUrl:o,networkIconUrl:n,style:i}){let{colors:s,components:a,fonts:l}=V(),u=cr(`/icons/currencies/png/${e.toLowerCase()}.png`),c=ss(r);return jsxRuntime.jsxs(reactNative.View,{style:[mo.diagram,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor},i],children:[jsxRuntime.jsxs(reactNative.View,{style:mo.step,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:u},style:mo.iconImage}),jsxRuntime.jsx(reactNative.Text,{style:[mo.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You paid"}),jsxRuntime.jsx(reactNative.Text,{style:[mo.value,{color:a.card.titleColor,fontFamily:l.medium}],children:e.toUpperCase()})]}),jsxRuntime.jsx(_r,{size:16,color:s.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:mo.step,children:[jsxRuntime.jsxs(reactNative.View,{style:mo.iconWithBadge,children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:o},style:mo.tokenIcon}):jsxRuntime.jsx(reactNative.View,{style:[mo.tokenIcon,{backgroundColor:wl[t.toLowerCase()]??s.primary}]}),n?jsxRuntime.jsx(reactNative.Image,{source:{uri:n},style:[mo.networkBadge,{borderColor:s.background}]}):null]}),jsxRuntime.jsx(reactNative.Text,{style:[mo.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You receive"}),jsxRuntime.jsxs(reactNative.Text,{style:[mo.value,{color:a.card.titleColor,fontFamily:l.medium}],children:[t.toUpperCase()," ",c]})]})]})}var mo=reactNative.StyleSheet.create({diagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-around",paddingVertical:20,paddingHorizontal:24,width:"100%"},step:{alignItems:"center"},iconImage:{width:24,height:24,borderRadius:12,marginBottom:4},iconWithBadge:{position:"relative",width:24,height:24,marginBottom:4},tokenIcon:{width:24,height:24,borderRadius:12},networkBadge:{position:"absolute",bottom:-4,right:-6,width:14,height:14,borderRadius:7,borderWidth:2},label:{fontSize:10},value:{fontSize:14,fontWeight:"500",paddingTop:4}});function Wo(){let{colors:e,fonts:t,components:r}=V(),o=r.input,n=r.button,i=r.container,s=r.card,a=r.header;return ni.useMemo(()=>{let l=s.borderRadius,u={flex:{flex:1},screen:{flex:1,backgroundColor:e.background,paddingHorizontal:24,paddingBottom:16},content:{flex:1,paddingTop:16},title:{fontSize:18,color:a.titleColor,marginBottom:8,...t.bold?{fontFamily:t.bold}:{}},subtitle:{fontSize:15,color:e.foregroundMuted,marginBottom:36,lineHeight:22,...t.regular?{fontFamily:t.regular}:{}},fieldWrap:{marginBottom:20},fieldLabel:{fontSize:14,color:e.foregroundSubtle,marginBottom:8,...t.semibold?{fontFamily:t.semibold}:{}},input:{backgroundColor:o.backgroundColor,borderRadius:o.borderRadius,padding:16,fontSize:17,color:o.textColor,borderWidth:o.borderWidth,borderColor:o.borderColor,...t.regular?{fontFamily:t.regular}:{}},hint:{fontSize:12,color:e.foregroundSubtle,marginTop:8,...t.regular?{fontFamily:t.regular}:{}},emailRow:{flexDirection:"row",alignItems:"center",gap:6,marginTop:4,backgroundColor:e.card,paddingHorizontal:14,paddingVertical:10,borderRadius:Math.min(l,12)},emailLabel:{fontSize:13,color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},emailValue:{fontSize:13,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},footer:{gap:4},continueBtn:{backgroundColor:i.buttonColor,borderRadius:n.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:i.buttonTitleColor,fontSize:17,...t.bold?{fontFamily:t.bold}:{}},continueBtnTextDisabled:{color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},ghostBtn:{paddingVertical:16,alignItems:"center"},ghostBtnText:{color:e.foregroundMuted,fontSize:15,...t.medium?{fontFamily:t.medium}:{}},loaderInButton:{justifyContent:"center",alignItems:"center"}},c={amountContainer:{flex:1,alignItems:"center",justifyContent:"center",gap:8},amountText:{fontSize:64,color:e.foreground,letterSpacing:-2,minWidth:80,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},amountPlaceholder:{color:e.foregroundSubtle},currencyLabel:{fontSize:15,color:e.foregroundMuted,letterSpacing:1,...t.medium?{fontFamily:t.medium}:{}},minAmountText:{fontSize:13,textAlign:"center",marginTop:8,...t.regular?{fontFamily:t.regular}:{}},quickRow:{flexDirection:"row",gap:10,marginBottom:12},quickPill:{flex:1,paddingVertical:12,alignItems:"center",borderRadius:s.borderRadius,backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:s.borderColor},quickPillText:{fontSize:14,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},numpad:{gap:4,marginBottom:12},numpadRow:{flexDirection:"row",justifyContent:"space-between"},numpadKey:{flex:1,height:56,alignItems:"center",justifyContent:"center",marginHorizontal:4},numpadKeyText:{fontSize:28,color:e.foreground,...t.regular?{fontFamily:t.regular}:{}},backspaceText:{fontSize:22,color:e.foregroundMuted,...t.regular?{fontFamily:t.regular}:{}},paymentRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,borderRadius:999,backgroundColor:"transparent",alignSelf:"flex-start",marginBottom:12},paymentRowHeader:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:16,borderRadius:s.borderRadius,backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:s.borderColor,alignSelf:"center"},paymentLeft:{flexDirection:"row",alignItems:"center",gap:6},applePayIcon:{fontSize:20,color:e.foreground},paymentLabel:{fontSize:15,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},paymentHint:{fontSize:13,color:e.foregroundMuted,marginLeft:12,...t.regular?{fontFamily:t.regular}:{}},inlineError:{fontSize:13,color:e.error,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},inlineStatus:{fontSize:13,color:e.foregroundMuted,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},sheetContent:{flex:1,paddingHorizontal:24,paddingTop:8,gap:12},sheetHeader:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:4},sheetBackBtn:{width:32,height:32,borderRadius:16,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:s.borderWidth,borderColor:e.border},sheetTitleRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},sheetCloseBtn:{width:28,height:28,borderRadius:14,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:s.borderWidth,borderColor:e.border},sheetTitle:{fontSize:18,color:e.foreground,...t.bold?{fontFamily:t.bold}:{}},sheetOption:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border},sheetOptionLeft:{flex:1,flexDirection:"row",alignItems:"center",gap:12},sheetOptionIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},sheetOptionLabel:{fontSize:16,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},sheetOptionHint:{fontSize:13,color:e.foregroundMuted,marginTop:2,...t.regular?{fontFamily:t.regular}:{}},sheetLoading:{alignItems:"center",paddingVertical:32,gap:12},sheetStatusText:{fontSize:15,color:e.foregroundMuted,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},sheetError:{flex:1,justifyContent:"center",paddingVertical:20},sheetErrorText:{fontSize:14,color:e.error,textAlign:"center",lineHeight:20,...t.regular?{fontFamily:t.regular}:{}},addPaymentBtn:{marginTop:12,paddingVertical:14,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center"},addPaymentBtnText:{fontSize:15,color:e.primary,...t.semibold?{fontFamily:t.semibold}:{}}},y={heroBox:{backgroundColor:s.backgroundColor,borderRadius:l,padding:24,alignItems:"center",marginBottom:16,marginTop:8,borderWidth:s.borderWidth,borderColor:s.borderColor,gap:4},heroLabel:{fontSize:12,color:e.foregroundSubtle,letterSpacing:.5,textTransform:"uppercase",...t.semibold?{fontFamily:t.semibold}:{}},heroAmount:{fontSize:48,color:e.foreground,letterSpacing:-1,...t.bold?{fontFamily:t.bold}:{}},heroCurrency:{fontSize:22,color:e.primary,...t.medium?{fontFamily:t.medium}:{}},heroNetwork:{fontSize:15,color:e.foregroundSubtle,marginTop:2,...t.medium?{fontFamily:t.medium}:{}},card:{backgroundColor:s.backgroundColor,borderRadius:l,borderWidth:s.borderWidth,borderColor:s.borderColor,overflow:"hidden",marginBottom:12,marginTop:16},row:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},rowRight:{flex:1,minWidth:0,flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:8},rowDivider:{height:1,marginHorizontal:16,backgroundColor:e.border},rowLabel:{fontSize:14,color:s.rowLeftLabel,...t.regular?{fontFamily:t.regular}:{}},rowValue:{fontSize:14,fontWeight:"500",color:s.rowRightLabel,...t.medium?{fontFamily:t.medium}:{}}},T=Math.max(16,Math.min(l,22)),w={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius:T,borderTopRightRadius:T,borderBottomLeftRadius:10,borderBottomRightRadius:10},swapCardBottom:{borderBottomLeftRadius:T,borderBottomRightRadius:T,borderTopLeftRadius:10,borderTopRightRadius:10,marginTop:16},swapConnectorWrap:{alignSelf:"center",zIndex:3,marginTop:-24,marginBottom:-32},swapConnectorCircle:{width:48,height:48,borderRadius:24,backgroundColor:e.primary,alignItems:"center",justifyContent:"center",borderWidth:4,borderColor:e.background},swapRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginTop:8,gap:12},swapLeftCol:{flex:1,minWidth:0},swapSpendAmount:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceivePrimary:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceiveSub:{fontSize:13,color:e.foregroundMuted,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},swapPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:10,paddingHorizontal:14,borderRadius:999,backgroundColor:e.cardHover,borderWidth:s.borderWidth,borderColor:e.border},swapPillText:{fontSize:16,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},payHint:{fontSize:15,color:e.foregroundMuted,textAlign:"center",marginBottom:18,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},summaryLabel:{fontSize:12,color:e.foregroundSubtle,textTransform:"uppercase",letterSpacing:.3,...t.semibold?{fontFamily:t.semibold}:{}},applePayBtn:{backgroundColor:n.secondaryBackground,borderRadius:n.borderRadius,borderWidth:n.borderWidth>0?n.borderWidth:1,borderColor:n.borderWidth>0?n.borderColor:e.border,paddingVertical:18,alignItems:"center",marginBottom:10},applePayBtnText:{color:n.secondaryText,fontSize:17,...t.bold?{fontFamily:t.bold}:{}}},m={input:{fontSize:14,...t.regular?{fontFamily:t.regular}:{}},list:{gap:8},row:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),borderWidth:s.borderWidth,borderColor:e.border,backgroundColor:e.card},rowSelected:{borderColor:e.primary,backgroundColor:e.successBackground},iconWrap:{width:32,height:32,alignItems:"center",justifyContent:"center",marginRight:12},rowText:{flex:1,fontSize:15,color:e.foregroundMuted,...t.medium?{fontFamily:t.medium}:{}},rowTextSelected:{color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},checkCircle:{width:24,height:24,borderRadius:12,backgroundColor:e.primary,alignItems:"center",justifyContent:"center"}},g={centered:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24},spinnerWrap:{width:80,height:80,borderRadius:40,backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center",marginBottom:28},idIcon:{fontSize:36},checkCircle:{width:80,height:80,borderRadius:40,backgroundColor:e.successBackground,borderWidth:2,borderColor:e.success,alignItems:"center",justifyContent:"center",marginBottom:28},heading:{fontSize:28,color:a.titleColor,textAlign:"center",marginBottom:10,...t.bold?{fontFamily:t.bold}:{}},sub:{fontSize:15,color:e.foregroundMuted,textAlign:"center",lineHeight:22,marginBottom:36,...t.regular?{fontFamily:t.regular}:{}},successScrollContent:{flexGrow:1,width:"100%",alignItems:"center",paddingBottom:24},detailCard:{width:"100%"}};return {form:u,quote:y,pm:w,wallet:m,flow:g,amount:c}},[e,t,o,n,i,s,a])}var kp="",Tp;function kl(e){kp=e;}function Tl(e){Tp=e;}function $r(){let e=kp||dl();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function qr(){return Tp??sa()}async function xl(){let e=`${qr()}/v1/public/onramps/headless/stripe/config`,t=$r(),r=await fetch(e,{method:"GET",headers:{"x-publishable-key":t,"Content-Type":"application/json"}});if(!r.ok)throw new Error(`Failed to load Stripe config: ${r.status}`);let o=await r.json();if(!o?.publishable_key)throw new Error("Missing Stripe publishable key in config response");return o.publishable_key}async function hd(e){let t=await fetch(`${qr()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":$r(),"Content-Type":"application/json"},body:JSON.stringify({email:e})});if(!t.ok)throw new Error(`Failed to create auth intent: ${t.status}`);let r=await t.json();return r.auth_intent_id??r.id}async function xp(e,t){let r=await fetch(`${qr()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":$r(),"Content-Type":"application/json"},body:JSON.stringify({auth_intent_id:e,...t&&{crypto_customer_id:t}})});if(!r.ok)throw new Error(`Failed to exchange auth intent for tokens: ${r.status}`);return r.json()}async function gd(e,t){let r=await fetch(`${qr()}/v1/public/onramps/headless/stripe/oauth/token/refresh`,{method:"POST",headers:{"x-publishable-key":$r(),"Content-Type":"application/json"},body:JSON.stringify({refresh_token:e,...t&&{crypto_customer_id:t}})}),o=await r.json().catch(()=>({}));if(!r.ok)throw new Error(o?.message??`Failed to refresh OAuth token: ${r.status}`);return o}async function _p(e,t){let r={crypto_customer_id:e.cryptoCustomerId,payment_token:e.paymentToken,source_amount:e.sourceAmount,source_currency:e.sourceCurrency,destination_currency:e.destinationCurrency,wallet_address:e.walletAddress,destination_network:e.destinationNetwork},o=await fetch(`${qr()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":$r(),"x-stripe-oauth-token":t,"Content-Type":"application/json"},body:JSON.stringify(r)}),n=await o.text();if(!o.ok)throw new Error(`Failed to create onramp session: ${o.status} ${n}`);return JSON.parse(n)}async function Rp(e,t){let r=await fetch(`${qr()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":$r(),"x-stripe-oauth-token":t,"Content-Type":"application/json"}}),o=await r.text();if(!r.ok)throw new Error(`Failed to confirm onramp session: ${r.status} ${o}`);return JSON.parse(o)}async function Mn(e,t){let r=`${qr()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":$r(),"x-stripe-oauth-token":t}}),n=await o.text();if(!o.ok)throw new Error(`Failed to get onramp customer: ${o.status} ${n}`);return JSON.parse(n)}async function vp(e){let t=`${qr()}/v1/public/onramps/headless/stripe/sessions`,r=await fetch(t,{method:"GET",headers:{"x-publishable-key":$r(),"x-stripe-oauth-token":e}}),o=await r.text();if(!r.ok)throw new Error(`Failed to list onramp sessions: ${r.status} ${o}`);return JSON.parse(o)}async function Ip(e,t){let r=`${qr()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":$r(),"x-stripe-oauth-token":t}}),n=await o.text();if(!o.ok)throw new Error(`Failed to get onramp session: ${o.status} ${n}`);return JSON.parse(n)}async function yd(e,t){let r=await fetch(`${qr()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":$r(),"x-stripe-oauth-token":t,"Content-Type":"application/json"}});if(!r.ok){let o=await r.text();throw new Error(`Failed to refresh quote: ${r.status} ${o}`)}return r.json()}async function bd(e){let t=new URLSearchParams({destinationNetwork:e.destinationNetwork,walletAddress:e.walletAddress});e.destinationTag&&t.set("destinationTag",e.destinationTag),e.cryptoCustomerId&&t.set("crypto_customer_id",e.cryptoCustomerId);let r=await fetch(`${qr()}/v1/public/onramps/headless/stripe/transaction_limits?${t.toString()}`,{method:"GET",headers:{"x-publishable-key":$r(),"x-stripe-oauth-token":e.accessToken}});if(!r.ok){let o=await r.text();throw new Error(`Failed to fetch transaction limits: ${r.status} ${o}`)}return r.json()}async function Cd(e,t){let r=await fetch(`${qr()}/v1/public/onramps/headless/stripe/customers/${e}/payment_tokens`,{method:"GET",headers:{"x-publishable-key":$r(),"x-stripe-oauth-token":t}});if(!r.ok){let o=await r.text();throw new Error(`Failed to fetch payment tokens: ${r.status} ${o}`)}return r.json()}async function Pp(e){if(!e.recipient_address)throw new Error("[Unifold] recipient_address is required for fetchDepositAddress. Pass recipientAddress in your onramp config.");let t={external_user_id:e.external_user_id,destination_chain_type:e.destination_chain_type||"ethereum",destination_chain_id:e.destination_chain_id||"8453",destination_token_address:e.destination_token_address||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:e.recipient_address,client_metadata:{}},r=await fetch(`${qr()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":$r(),"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(`Failed to create deposit address: ${r.status}`);return r.json()}function zn(e,t){if(e?.length){let r=e.find(n=>n.format==="png");if(r)return r.url;let o=e.find(n=>n.format==="svg");if(o)return o.url}return t}async function Op(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await fetch(`${qr()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":$r()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}function Sg({size:e=24}){let t=e,r=e*(471/750);return jsxRuntime.jsxs(Pt__default.default,{width:t,height:r,viewBox:"0 0 750 471",children:[jsxRuntime.jsx(Pt.Rect,{width:"750",height:"471",rx:"40",fill:"#1A1F71"}),jsxRuntime.jsx(Pt.Path,{fill:"#FFFFFF",d:"M278.198,334.228l33.36-195.763h53.358l-33.384,195.763H278.198z"}),jsxRuntime.jsx(Pt.Path,{fill:"#FFFFFF",d:"M524.307,142.687c-10.57-3.966-27.135-8.222-47.822-8.222c-52.725,0-89.863,26.551-90.18,64.604c-0.297,28.129,26.514,43.821,46.754,53.185c20.77,9.597,27.752,15.716,27.652,24.283c-0.133,13.123-16.586,19.116-31.924,19.116c-21.355,0-32.701-2.967-50.225-10.274l-6.877-3.112l-7.488,43.823c12.463,5.466,35.508,10.199,59.438,10.445c56.09,0,92.502-26.248,92.916-66.884c0.199-22.27-14.016-39.216-44.801-53.188c-18.65-9.056-30.072-15.099-29.951-24.269c0-8.137,9.668-16.838,30.559-16.838c17.447-0.271,30.088,3.534,39.936,7.5l4.781,2.259L524.307,142.687"}),jsxRuntime.jsx(Pt.Path,{fill:"#FFFFFF",d:"M661.615,138.464h-41.23c-12.773,0-22.332,3.486-27.941,16.234l-79.244,179.402h56.031c0,0,9.16-24.121,11.232-29.418c6.123,0,60.555,0.084,68.336,0.084c1.596,6.854,6.492,29.334,6.492,29.334h49.512L661.615,138.464z M596.198,264.872c4.414-11.279,21.26-54.724,21.26-54.724c-0.314,0.521,4.381-11.334,7.074-18.684l3.607,16.878c0,0,10.217,46.729,12.352,56.527h-44.293V264.872z"}),jsxRuntime.jsx(Pt.Path,{fill:"#FFFFFF",d:"M45.879,138.465l-0.682,4.073c21.093,5.106,39.932,12.496,56.426,21.689l47.346,169.688h56.455l83.004-195.45h-56.526l-52.238,133.496l-5.564-27.131c-0.261-0.838-0.544-1.678-0.834-2.52L156.106,154.992c-3.229-12.396-12.597-16.095-24.186-16.528H45.879z"})]})}function kg({size:e=24}){return jsxRuntime.jsx(Pt__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsxs(Pt.G,{fill:"none",fillRule:"evenodd",children:[jsxRuntime.jsx(Pt.Circle,{cx:"7",cy:"12",r:"7",fill:"#EA001B"}),jsxRuntime.jsx(Pt.Circle,{cx:"17",cy:"12",r:"7",fill:"#FFA200",fillOpacity:.8})]})})}function Tg({size:e=24}){return jsxRuntime.jsx(Pt__default.default,{width:e,height:e,viewBox:"0 0 1152 1152",children:jsxRuntime.jsxs(Pt.G,{transform:"matrix(1.3333333,0,0,-1.3333333,0,1152)",children:[jsxRuntime.jsx(Pt.Path,{fill:"#006FCF",d:"M 0,0 H 863.998 V 864 H 0 Z"}),jsxRuntime.jsx(Pt.G,{transform:"translate(312.9867,136.7145)",children:jsxRuntime.jsx(Pt.Path,{fill:"#FFFFFF",d:"m 0,0 341.634,-0.725 53.654,59.858 54.038,-59.632 h 101.685 v 87.332 l -63.687,68.682 63.687,68.059 V 309.09 L 0,309.585 Z"})}),jsxRuntime.jsx(Pt.G,{transform:"translate(349.7917,170.655)",children:jsxRuntime.jsx(Pt.Path,{fill:"#006FCF",fillRule:"evenodd",d:"m 0,0 v 241.575 h 204.832 v -55.65 H 66.318 V 148.15 H 201.529 V 93.423 H 66.318 V 56.319 H 204.832 V 10e-4 Z"})}),jsxRuntime.jsx(Pt.G,{transform:"translate(780.0408,412.227)",children:jsxRuntime.jsx(Pt.Path,{fill:"#006FCF",d:"M 0,0 -69.456,-76.568 -138.713,0 h -87.729 l 113.343,-120.647 -113.341,-120.925 h 85.343 l 69.764,77.335 70.487,-77.335 h 84.803 v 3.43 L -26.971,-120.647 83.957,-1.903 V 0 Z"})}),jsxRuntime.jsx(Pt.G,{transform:"translate(738.7857,721.0845)",children:jsxRuntime.jsx(Pt.Path,{fill:"#FFFFFF",d:"M 0,0 -28.373,-79.366 -56.65,0 H -220.625 V -105.93 L -267.278,0 H -400.1 l -136.414,-309.586 h 661.726 l 0,309.586 z"})}),jsxRuntime.jsx(Pt.G,{transform:"translate(373.0462,548.583)",children:jsxRuntime.jsx(Pt.Path,{fill:"#006FCF",fillRule:"evenodd",d:"M 0,0 32.145,76.837 64.268,0 Z m -9.212,138.867 -107.187,-241.37 h 73.518 l 20.22,48.332 H 86.914 l 20.207,-48.332 h 75.345 L 75.723,138.867 Z"})}),jsxRuntime.jsx(Pt.G,{transform:"translate(554.5071,446.121)",children:jsxRuntime.jsx(Pt.Path,{fill:"#006FCF",d:"M 0,0 64.997,-0.001 V 165.796 L 126.661,-0.001 h 58.418 L 245.49,165.233 V -0.564 l 64,0.563 V 241.368 H 210.032 L 156.513,92.624 103.342,241.012 0,241.369 Z"})})]})})}function Sd({sublabel:e,size:t=24,fallbackColor:r="#888"}){if(!e)return jsxRuntime.jsx(Ji,{size:t*.75,color:r,strokeWidth:1.75});let o=e.toLowerCase();return o.includes("visa")?jsxRuntime.jsx(Sg,{size:t}):o.includes("mastercard")?jsxRuntime.jsx(kg,{size:t}):o.includes("amex")||o.includes("american express")?jsxRuntime.jsx(Tg,{size:t}):jsxRuntime.jsx(Ji,{size:t*.75,color:r,strokeWidth:1.75})}function _l(e){if(!e)return "";let t=new Date(e*1e3);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:true})}var Td={initialized:"Initialized",requires_payment:"Awaiting Payment",fulfillment_processing:"Processing",fulfillment_complete:"Complete",rejected:"Rejected"};function xd(e,t){switch(e){case "fulfillment_complete":return t.success;case "fulfillment_processing":case "requires_payment":return t.warning;case "rejected":return t.error;default:return t.foregroundMuted}}function Bp({status:e,colors:t,fontFamily:r}){let o=xd(e,t);return jsxRuntime.jsx(reactNative.View,{style:{paddingHorizontal:8,paddingVertical:2,borderRadius:6,backgroundColor:o+"20"},children:jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:o,fontFamily:r},children:Td[e]??e})})}function Wp({count:e=4}){let{colors:t,components:r}=V(),o=ni.useRef(new reactNative.Animated.Value(.5)).current,n=t.cardHover??t.border,i=Math.min(r.card.borderRadius??12,14);return ni.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[o]),jsxRuntime.jsx(reactNative.View,{style:ls.list,children:Array.from({length:e}).map((s,a)=>jsxRuntime.jsxs(reactNative.View,{style:[ls.row,{backgroundColor:t.card,borderRadius:i,borderWidth:r.card.borderWidth,borderColor:t.border}],children:[jsxRuntime.jsxs(reactNative.View,{style:ls.left,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[ls.amountBar,{backgroundColor:n,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ls.subtitleBar,{backgroundColor:n,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ls.badgeBar,{backgroundColor:n,opacity:o}]})]},a))})}var ls=reactNative.StyleSheet.create({list:{gap:8},row:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16},left:{flex:1,gap:6},amountBar:{height:16,width:"40%",borderRadius:8},subtitleBar:{height:12,width:"55%",borderRadius:6},badgeBar:{height:20,width:80,borderRadius:6,marginLeft:12}});function Ap({active:e,interval:t=15e3,color:r}){let o=ni.useRef(new reactNative.Animated.Value(0)).current;return ni.useEffect(()=>{if(!e){o.setValue(0);return}let n=()=>{o.setValue(0),reactNative.Animated.timing(o,{toValue:1,duration:t,useNativeDriver:false}).start(({finished:i})=>{i&&n();});};return n(),()=>o.stopAnimation()},[e,t,o]),e?jsxRuntime.jsx(reactNative.View,{style:{height:2,borderRadius:1,overflow:"hidden",opacity:.5},children:jsxRuntime.jsx(reactNative.Animated.View,{style:{height:2,borderRadius:1,backgroundColor:r,width:o.interpolate({inputRange:[0,1],outputRange:["0%","100%"]})}})}):null}function Ep({session:e,onBack:t}){let{colors:r,components:o,fonts:n}=V(),[i,s]=ni.useState(false),a=()=>{reactNative.Clipboard.setString(e.id),s(true),setTimeout(()=>s(false),2e3);},l=e.transaction_details,u=e.status!=="fulfillment_complete"&&e.status!=="rejected",c=xd(e.status,r),y=l?.source_amount?`$${parseFloat(l.source_amount).toFixed(2)}`:"\u2014",T=l?.destination_amount?parseFloat(l.destination_amount).toFixed(2):"\u2014",w=(l?.destination_currency??"").toUpperCase(),m=e.destination_token_metadata,g=zn(m?.icon_urls,m?.icon_url),h=ss(l?.destination_network??""),S=l?.wallet_address?yl(l.wallet_address):null,b=l?.fees?.network_fee_amount?`$${parseFloat(l.fees.network_fee_amount).toFixed(2)}`:null,p=l?.fees?.transaction_fee_amount?`$${parseFloat(l.fees.transaction_fee_amount).toFixed(2)}`:null,d=e.payment_method?e.payment_method.replace(/_/g," ").replace(/\b\w/g,x=>x.toUpperCase()):null,C=[{label:"Amount",value:y},{label:"Received",value:`${T} ${w}`},...d?[{label:"Payment",value:d}]:[],{label:"Network",value:h},...S?[{label:"Wallet",value:S}]:[],...b?[{label:"Network Fee",value:b}]:[],...p?[{label:"Transaction Fee",value:p}]:[]];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:{paddingLeft:16,paddingTop:8},children:jsxRuntime.jsx(St,{onPress:t,title:"Purchase Details",variant:"back"})}),jsxRuntime.jsxs(at,{style:wr.scroll,contentContainerStyle:wr.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:wr.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:{marginBottom:12,width:64,height:64},children:[jsxRuntime.jsx(as,{currency:w||"USD",tokenIconUrl:g,size:64}),jsxRuntime.jsx(reactNative.View,{style:[wr.statusBadge,{backgroundColor:c,borderColor:o.card.backgroundColor??r.background}],children:u?jsxRuntime.jsx(Nr,{size:14,color:"#FFFFFF",strokeWidth:2.5}):e.status==="rejected"?jsxRuntime.jsx(st,{size:14,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(Le,{size:14,color:"#FFFFFF",strokeWidth:2.5})})]}),jsxRuntime.jsxs(reactNative.View,{style:wr.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[wr.statusDot,{backgroundColor:c}]}),jsxRuntime.jsx(reactNative.Text,{style:[wr.statusText,{color:o.container.titleColor,fontFamily:n.semibold}],children:Td[e.status]??e.status})]}),e.created?jsxRuntime.jsx(reactNative.Text,{style:[wr.dateText,{color:o.container.subtitleColor,fontFamily:n.regular}],children:_l(e.created)}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[wr.card,{backgroundColor:o.card.backgroundColor,borderRadius:o.card.borderRadius,borderWidth:o.card.borderWidth,borderColor:o.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:wr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[wr.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:"ID"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:a,activeOpacity:.7,style:{flexDirection:"row",alignItems:"center",gap:6,flexShrink:1},children:[jsxRuntime.jsx(reactNative.Text,{style:[wr.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium,fontSize:12}],numberOfLines:1,children:e.id.length>12?e.id.slice(0,12)+"\u2026":e.id}),i?jsxRuntime.jsx(Le,{size:14,color:r.primary,strokeWidth:2}):jsxRuntime.jsx(ln,{size:14,color:r.foregroundMuted,strokeWidth:2})]})]}),C.map(x=>jsxRuntime.jsx(ni__namespace.default.Fragment,{children:jsxRuntime.jsxs(reactNative.View,{style:wr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[wr.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:x.label}),jsxRuntime.jsx(reactNative.Text,{style:[wr.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium}],selectable:true,children:x.value})]})},x.label))]}),l?.last_error?jsxRuntime.jsx(reactNative.View,{style:[wr.card,{backgroundColor:r.errorBackground,borderRadius:o.card.borderRadius}],children:jsxRuntime.jsxs(reactNative.View,{style:wr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[wr.cardLabel,{color:r.error,fontFamily:n.regular}],children:"Error"}),jsxRuntime.jsx(reactNative.Text,{style:[wr.cardValue,{color:r.error,fontFamily:n.medium,flex:1,textAlign:"right"}],selectable:true,children:l.last_error})]})}):null]})]})}var wr=reactNative.StyleSheet.create({scroll:{flex:1,paddingTop:8},scrollContent:{paddingHorizontal:24,paddingBottom:32},iconSection:{alignItems:"center",marginBottom:24},statusBadge:{position:"absolute",bottom:-4,right:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center",borderWidth:2},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16,fontWeight:"600"},dateText:{fontSize:14,marginBottom:2},card:{borderRadius:12,marginBottom:12,overflow:"hidden"},cardRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"}});function zp({onSelect:e,showKycOption:t=true}){let{colors:r,fonts:o,components:n}=V(),[i,s]=ni.useState(false),a=l=>{s(false),e(l);};return jsxRuntime.jsxs(reactNative.View,{style:Eo.wrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Eo.trigger,onPress:()=>s(l=>!l),hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"More options",children:jsxRuntime.jsx(op,{size:20,color:r.foreground,strokeWidth:2})}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Pressable,{style:Eo.backdrop,onPress:()=>s(false)}),jsxRuntime.jsxs(reactNative.View,{style:[Eo.menu,{backgroundColor:n.card.backgroundColor,borderRadius:n.card.borderRadius??12,borderWidth:n.card.borderWidth,borderColor:n.card.borderColor,...reactNative.Platform.select({ios:{shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.15,shadowRadius:12},android:{elevation:8}})}],children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Eo.menuItem,onPress:()=>a("history"),activeOpacity:.6,children:[jsxRuntime.jsx(Nr,{size:18,color:r.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Eo.menuLabel,{color:r.foreground,fontFamily:o.regular}],children:"Purchase History"})]}),t&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Eo.menuItem,onPress:()=>a("kyc"),activeOpacity:.6,children:[jsxRuntime.jsx(jr,{size:18,color:r.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Eo.menuLabel,{color:r.foreground,fontFamily:o.regular}],children:"Increase Limits (KYC)"})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Eo.menuItem,onPress:()=>a("logout"),activeOpacity:.6,children:[jsxRuntime.jsx(np,{size:18,color:r.error,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Eo.menuLabel,{color:r.error,fontFamily:o.regular}],children:"Disconnect Stripe Link"})]})]})]})]})}var Eo=reactNative.StyleSheet.create({wrapper:{zIndex:9999},trigger:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},backdrop:{position:"absolute",top:-500,left:-500,width:2e3,height:2e3,zIndex:9998},menu:{position:"absolute",top:32,left:0,minWidth:200,paddingVertical:6,zIndex:9999},menuItem:{flexDirection:"row",alignItems:"center",paddingHorizontal:14,paddingVertical:12,gap:12},menuLabel:{fontSize:15}});var Ag=[50,100,500],Eg=[["1","2","3"],["4","5","6"],["7","8","9"],[".","0","\u232B"]];function Hp(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Mg(e){return e.card?`${Hp(e.card.brand)} ${Hp(e.card.funding)} \u2022\u2022\u2022\u2022 ${e.card.last4}`:e.type}function Pl({initialAmount:e="",currency:t="USD",applePaySupported:r=false,hideQuickAmounts:o=false,minAmount:n,maxAmount:i,paymentSelectorPosition:s="inline",onCollectPayment:a,paymentLoading:l=false,paymentStatus:u,paymentError:c,paymentTokens:y=[],onAddPaymentMethod:T,onConfirm:w,onCancel:m,sheetBorderTopLeftRadius:g,sheetBorderTopRightRadius:h,accessToken:S,showHistoryProgressBar:b=true,onLogout:p,onRequestKYC:d}){let C=Wo(),{colors:x,components:_,fonts:k}=V(),v=g??_.card.borderRadius,M=h??_.card.borderRadius,[W,O]=ni.useState(e),[F,U]=ni.useState(r?"apple_pay":y.length>0?y[0].id:null),j=ni.useRef(false),le=I=>{j.current=true,U(I);};ni.useEffect(()=>{j.current||r||y.length>0&&U(y[0].id);},[y,r]);let[Ye,_e]=ni.useState(false),[ne,we]=ni.useState("select"),[fe,Pe]=ni.useState(null),$e=ni.useRef(false);ni.useEffect(()=>{l&&u&&/saving/i.test(u)&&we("card");},[l,u]);let ue=i,J=ue!=null&&ue>0,be=ni.useMemo(()=>{if(o)return [];let I=Ag.map(D=>({label:`$${D}`,amount:String(D),disabled:false}));return I.push({label:"MAX",amount:J?String(ue):"0",disabled:!J}),I},[o,J,ue]),vt=I=>{if(I==="\u232B"){O(D=>D.slice(0,-1));return}if(I==="."){if(W.includes("."))return;O(D=>D===""?"0.":D+".");return}O(D=>{let q=D.indexOf(".");return q!==-1&&D.length-q>2?D:D==="0"&&I!=="."?I:D+I});},ve=W===""?"0":W,qe=parseFloat(W),Ne=n!=null&&!isNaN(qe)&&qe>0&&qe<n,Ve=ue!=null&&ue>0&&!isNaN(qe)&&qe>ue,ze=W!==""&&!isNaN(qe)&&qe>0&&!Ne&&!Ve,it=r||y.length>0,ie=s==="header",pe=ni.useMemo(()=>{let I=[];r&&I.push({id:"apple_pay",label:"Apple Pay",hint:"Pay with Apple Pay",isApplePay:true});for(let D of y)I.push({id:D.id,label:Mg(D),hint:D.card?`Expires ${D.card.exp_month}/${D.card.exp_year}`:D.type,brand:D.card?.brand,isApplePay:false});return I},[r,y]),et=pe.find(I=>I.id===F),Ke=F!=null&&F!=="apple_pay",$t=et?et.label:Ke&&fe?fe:Ke?"Card":"Pay With",Ee=et?!et.isApplePay:Ke,Oe=et?.brand??fe??void 0,[ar,he]=ni.useState(false),[X,Ce]=ni.useState([]),[pt,It]=ni.useState(false),[me,je]=ni.useState(null),[Vt,ot]=ni.useState(null),Lt=ni.useRef(null);Lt.current=Vt;let Bt=ni.useRef(false);Bt.current=ar;let yt=ni.useCallback(async(I=false)=>{if(S){I||(It(true),je(null));try{let D=await vp(S);if(!Bt.current)return;let q=Array.isArray(D.data)?D.data:Array.isArray(D)?D:[];Ce(q),I||je(null);let Fe=Lt.current?.id;if(Fe){let ke=q.find(pr=>pr.id===Fe);ke&&ot(ke);}}catch(D){if(!Bt.current)return;I||je(D?.message??"Failed to load history");}finally{!I&&Bt.current&&It(false);}}},[S]),Se=ni.useCallback(()=>{he(true),yt();},[yt]);ni.useEffect(()=>{if(!ar||!S)return;let I=setInterval(()=>yt(true),15e3);return ()=>clearInterval(I)},[ar,S,yt]);let Z=ni.useCallback(I=>{switch(I){case "history":Se();break;case "kyc":d?.();break;case "logout":p?.();break}},[Se,d,p]),Q=S?jsxRuntime.jsx(zp,{onSelect:Z,showKycOption:!!d}):void 0,L=it?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ie?C.amount.paymentRowHeader:C.amount.paymentRow,l&&{opacity:.5}],onPress:()=>{l||(we("select"),_e(true));},activeOpacity:.7,disabled:l,children:jsxRuntime.jsxs(reactNative.View,{style:C.amount.paymentLeft,children:[et?.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:C.amount.applePayIcon,children:"\uF8FF"}):Ee?jsxRuntime.jsx(Sd,{sublabel:Oe,size:20}):null,jsxRuntime.jsx(reactNative.Text,{style:C.amount.paymentLabel,children:$t}),jsxRuntime.jsx(Gt,{size:12,color:C.amount.currencyLabel.color,strokeWidth:2.5})]})}):null;return jsxRuntime.jsxs(reactNative.View,{style:C.form.screen,children:[jsxRuntime.jsx(St,{onPress:m,title:"Enter amount",leftAction:Q}),ie&&L,jsxRuntime.jsxs(reactNative.View,{style:C.form.content,children:[jsxRuntime.jsxs(reactNative.View,{style:C.amount.amountContainer,children:[jsxRuntime.jsxs(reactNative.Text,{style:[C.amount.amountText,ve==="0"&&C.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",ve]}),jsxRuntime.jsx(reactNative.Text,{style:C.amount.currencyLabel,children:t.toUpperCase()}),Ne&&n!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[C.amount.minAmountText,{color:x.warning}],children:["Minimum amount is $",n.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]}),Ve&&ue!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[C.amount.minAmountText,{color:x.warning}],children:["Maximum amount is $",ue.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]})]}),!ie&&L,be.length>0&&jsxRuntime.jsx(reactNative.View,{style:C.amount.quickRow,children:be.map(I=>{let D=!I.disabled&&W===I.amount&&W!=="";return jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[C.amount.quickPill,D&&{backgroundColor:x.primary},I.disabled&&{opacity:.4}],activeOpacity:.7,disabled:I.disabled||l,onPress:()=>O(I.amount),children:jsxRuntime.jsx(reactNative.Text,{style:[C.amount.quickPillText,D&&{color:x.primaryForeground}],children:I.label})},I.label)})}),jsxRuntime.jsx(reactNative.View,{style:C.amount.numpad,children:Eg.map((I,D)=>jsxRuntime.jsx(reactNative.View,{style:C.amount.numpadRow,children:I.map(q=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[C.amount.numpadKey,l&&{opacity:.3}],onPress:()=>vt(q),activeOpacity:.6,disabled:l,children:jsxRuntime.jsx(reactNative.Text,{style:q==="\u232B"?C.amount.backspaceText:C.amount.numpadKeyText,children:q})},q))},D))}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[C.form.continueBtn,(!ze||l)&&C.form.continueBtnDisabled],onPress:()=>ze&&!l&&w(W,F),disabled:!ze||l,children:l?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:x.primaryForeground}):jsxRuntime.jsx(reactNative.Text,{style:[C.form.continueBtnText,!ze&&C.form.continueBtnTextDisabled],children:"Continue"})}),!Ye&&c?jsxRuntime.jsx(reactNative.Text,{style:C.amount.inlineError,children:c}):!Ye&&l&&u&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:C.amount.inlineStatus,children:u}):null]}),jsxRuntime.jsx(bt,{visible:Ye,onClose:()=>{l||(_e(false),we("select"));},closeOnBackdropPress:!l,enablePanDownToClose:!l,showHandle:!l,heightPercent:.44,maxHeightPercent:.9,borderTopLeftRadius:v,borderTopRightRadius:M,children:jsxRuntime.jsx(reactNative.View,{style:C.amount.sheetContent,children:ne==="select"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:C.amount.sheetTitleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:C.amount.sheetTitle,children:"Pay With"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>_e(false),activeOpacity:.7,style:C.amount.sheetCloseBtn,children:jsxRuntime.jsx(st,{size:16,color:x.foregroundMuted,strokeWidth:2.5})})]}),jsxRuntime.jsxs(at,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[pe.map(I=>{let D=F===I.id;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:[C.amount.sheetOption,D&&{borderColor:x.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{le(I.id),Pe(I.isApplePay?null:I.label),_e(false);},children:[jsxRuntime.jsxs(reactNative.View,{style:C.amount.sheetOptionLeft,children:[jsxRuntime.jsx(reactNative.View,{style:C.amount.sheetOptionIcon,children:I.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:C.amount.applePayIcon,children:"\uF8FF"}):jsxRuntime.jsx(Sd,{sublabel:I.brand,size:24})}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1},children:[jsxRuntime.jsx(reactNative.Text,{style:C.amount.sheetOptionLabel,children:I.label}),jsxRuntime.jsx(reactNative.Text,{style:C.amount.sheetOptionHint,children:I.hint})]})]}),D&&jsxRuntime.jsx(Le,{size:18,color:x.primary,strokeWidth:2.5})]},I.id)}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:C.amount.addPaymentBtn,activeOpacity:.7,onPress:async()=>{if(!$e.current){$e.current=true;try{let I=await T?.();I&&(le(I.token),Pe(I.sublabel),_e(!1));}finally{$e.current=false;}}},children:jsxRuntime.jsx(reactNative.Text,{style:C.amount.addPaymentBtnText,children:"Add Payment Method"})})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:C.amount.sheetHeader,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{l||we("select");},activeOpacity:.7,style:C.amount.sheetBackBtn,children:jsxRuntime.jsx(Zi,{size:20,color:x.foreground,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:C.amount.sheetTitle,children:"Pay With"})]}),l?jsxRuntime.jsxs(reactNative.View,{style:C.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:x.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:C.amount.sheetStatusText,children:u||"Loading Stripe Link..."}):null]}):c?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:C.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:C.amount.sheetErrorText,children:c})}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:C.form.continueBtn,onPress:()=>{a&&ze&&a(false,W);},children:jsxRuntime.jsx(reactNative.Text,{style:C.form.continueBtnText,children:"Retry"})})]}):jsxRuntime.jsxs(reactNative.View,{style:C.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:x.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:C.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})}),jsxRuntime.jsx(bt,{visible:ar,onClose:()=>{he(false),ot(null);},closeOnBackdropPress:true,enablePanDownToClose:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:v,borderTopRightRadius:M,children:Vt?jsxRuntime.jsx(Ep,{session:Vt,onBack:()=>ot(null)}):jsxRuntime.jsxs(reactNative.View,{style:C.amount.sheetContent,children:[jsxRuntime.jsx(St,{onPress:()=>he(false),title:"Purchase History"}),b&&jsxRuntime.jsx(Ap,{active:ar&&!pt&&X.length>0,color:x.primary}),pt?jsxRuntime.jsx(Wp,{}):me?jsxRuntime.jsx(reactNative.View,{style:C.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:C.amount.sheetErrorText,children:me})}):X.length===0?jsxRuntime.jsx(reactNative.View,{style:C.amount.sheetLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[C.amount.sheetStatusText,{color:x.foregroundMuted}],children:"No purchases yet"})}):jsxRuntime.jsx(at,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:X.map(I=>{let D=I.transaction_details,q=D?.source_amount?`$${parseFloat(D.source_amount).toFixed(2)}`:"\u2014",Fe=(D?.destination_currency??"").toUpperCase(),ke=D?.destination_amount?`${parseFloat(D.destination_amount).toFixed(2)} ${Fe}`:"",pr=_l(I.created),ce=I.destination_token_metadata,xt=zn(ce?.icon_urls,ce?.icon_url),Ct=zn(ce?.chain?.icon_urls,ce?.chain?.icon_url);return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:C.amount.sheetOption,activeOpacity:.7,onPress:()=>ot(I),children:[jsxRuntime.jsx(as,{currency:Fe||"USD",tokenIconUrl:xt,networkIconUrl:Ct,size:36}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1,gap:2,marginLeft:12},children:[jsxRuntime.jsx(reactNative.Text,{style:C.amount.sheetOptionLabel,children:q}),ke?jsxRuntime.jsx(reactNative.Text,{style:C.amount.sheetOptionHint,children:ke}):null]}),jsxRuntime.jsxs(reactNative.View,{style:{flexDirection:"row",alignItems:"center",gap:8},children:[jsxRuntime.jsxs(reactNative.View,{style:{alignItems:"flex-end",gap:2},children:[jsxRuntime.jsx(Bp,{status:I.status,colors:x,fontFamily:k.regular}),pr?jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:x.foregroundMuted,fontFamily:k.regular},children:pr}):null]}),jsxRuntime.jsx(_r,{size:14,color:x.foregroundMuted,strokeWidth:2})]})]},I.id)})})]})})]})}function Ol({initialData:e={},loading:t=false,level:r="L0",onComplete:o,onCancel:n}){let i=Wo(),{colors:s,fonts:a,components:l}=V(),u=l.input.placeholderColor,c=r==="L0"?["name","address"]:["name","dob","address","ssn"],y=c.length,[T,w]=ni.useState(1),[m,g]=ni.useState(e.firstName??""),[h,S]=ni.useState(e.lastName??""),[b,p]=ni.useState(e.dobMonth??""),[d,C]=ni.useState(e.dobDay??""),[x,_]=ni.useState(e.dobYear??""),[k,v]=ni.useState(e.addressLine1??""),[M,W]=ni.useState(e.addressLine2??""),[O,F]=ni.useState(e.city??""),[U,j]=ni.useState(e.state??""),[le,Ye]=ni.useState(e.postalCode??""),[_e,ne]=ni.useState(e.country??"US"),[we,fe]=ni.useState(e.idNumber??""),Pe=ni.useRef(null),$e=ni.useRef(null),ue=ni.useRef(null),J=ni.useRef(null),be=ni.useRef(null),vt=ni.useRef(null),ve=ni.useRef(null),qe=ni.useRef(null),Ne=c[T-1],Ve=()=>{switch(Ne){case "name":return m.trim().length>0&&h.trim().length>0;case "dob":return b.length===2&&d.length===2&&x.length===4;case "address":return k.trim().length>0&&O.trim().length>0&&U.trim().length>0&&le.trim().length>0;case "ssn":return we.trim().length>0;default:return false}},ze=()=>{Ve()&&(T<y?w(Ae=>Ae+1):o({firstName:m,lastName:h,idNumber:we,dobMonth:b,dobDay:d,dobYear:x,addressLine1:k,addressLine2:M,city:O,state:U,postalCode:le,country:_e}));},it=()=>{T>1?w(Ae=>Ae-1):n();},ie={name:{title:"Enter your name",subtitle:"Use your full legal name as it appears on your ID."},dob:{title:"Enter your date of birth",subtitle:"We use this to verify your identity."},address:{title:"Enter your address",subtitle:"Enter the address associated with your ID."},ssn:{title:"Enter your SSN",subtitle:"Your SSN is encrypted and used only for identity verification."}},{subtitle:pe}=ie[Ne],et=[or.stepCounter,{color:s.foregroundMuted},...a.semibold?[{fontFamily:a.semibold}]:[]];return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:i.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:i.form.screen,children:[jsxRuntime.jsxs(reactNative.View,{style:or.header,children:[jsxRuntime.jsx(reactNative.View,{style:or.headerSide,children:!t&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:or.iconButton,onPress:it,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:T>1?"Back":"Cancel",children:jsxRuntime.jsx(Xs,{size:20,color:l.header.buttonColor,strokeWidth:2})})}),jsxRuntime.jsx(reactNative.View,{style:or.headerCenter,children:jsxRuntime.jsxs(reactNative.Text,{style:et,children:[T," of ",y]})}),jsxRuntime.jsx(reactNative.View,{style:or.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:or.iconButton,onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx(st,{size:20,color:l.header.buttonColor,strokeWidth:2})})})]}),jsxRuntime.jsx(reactNative.View,{style:or.progressTrack,children:Array.from({length:y}).map((Ae,Ke)=>jsxRuntime.jsx(reactNative.View,{style:[or.progressSegment,{backgroundColor:Ke<T||Ke+1===T?s.primary:s.border}]},Ke))}),jsxRuntime.jsx(at,{style:i.form.flex,contentContainerStyle:or.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:jsxRuntime.jsxs(reactNative.View,{pointerEvents:t?"none":"auto",style:[i.form.flex,t&&{opacity:.5}],children:[jsxRuntime.jsx(reactNative.Text,{style:i.form.subtitle,children:pe}),Ne==="name"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(fn,{form:i.form,label:"First name",children:jsxRuntime.jsx(reactNative.TextInput,{style:i.form.input,placeholder:"Jane",placeholderTextColor:u,value:m,onChangeText:g,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>Pe.current?.focus()})}),jsxRuntime.jsx(fn,{form:i.form,label:"Last name",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Pe,style:i.form.input,placeholder:"Doe",placeholderTextColor:u,value:h,onChangeText:S,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:ze})})]}),Ne==="dob"&&jsxRuntime.jsxs(reactNative.View,{style:or.dobRow,children:[jsxRuntime.jsxs(reactNative.View,{style:or.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,or.dobLabel],children:"Month"}),jsxRuntime.jsx(reactNative.TextInput,{style:[i.form.input,or.dobInput],placeholder:"MM",placeholderTextColor:u,value:b,onChangeText:Ae=>{let Ke=Ae.replace(/\D/g,"").slice(0,2);p(Ke),Ke.length===2&&$e.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:or.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,or.dobLabel],children:"Day"}),jsxRuntime.jsx(reactNative.TextInput,{ref:$e,style:[i.form.input,or.dobInput],placeholder:"DD",placeholderTextColor:u,value:d,onChangeText:Ae=>{let Ke=Ae.replace(/\D/g,"").slice(0,2);C(Ke),Ke.length===2&&ue.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:or.dobColWide,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,or.dobLabel],children:"Year"}),jsxRuntime.jsx(reactNative.TextInput,{ref:ue,style:[i.form.input,or.dobInput],placeholder:"YYYY",placeholderTextColor:u,value:x,onChangeText:Ae=>{let Ke=Ae.replace(/\D/g,"").slice(0,4);_(Ke);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:ze})]})]}),Ne==="address"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(fn,{form:i.form,label:"Street address",children:jsxRuntime.jsx(reactNative.TextInput,{style:i.form.input,placeholder:"123 Main St",placeholderTextColor:u,value:k,onChangeText:v,returnKeyType:"next",onSubmitEditing:()=>J.current?.focus()})}),jsxRuntime.jsx(fn,{form:i.form,label:"Apt, suite, etc. (optional)",children:jsxRuntime.jsx(reactNative.TextInput,{ref:J,style:i.form.input,placeholder:"Apt 2",placeholderTextColor:u,value:M,onChangeText:W,returnKeyType:"next",onSubmitEditing:()=>be.current?.focus()})}),jsxRuntime.jsx(fn,{form:i.form,label:"City",children:jsxRuntime.jsx(reactNative.TextInput,{ref:be,style:i.form.input,placeholder:"San Francisco",placeholderTextColor:u,value:O,onChangeText:F,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>vt.current?.focus()})}),jsxRuntime.jsxs(reactNative.View,{style:or.row,children:[jsxRuntime.jsx(reactNative.View,{style:[i.form.flex,{marginRight:8}],children:jsxRuntime.jsx(fn,{form:i.form,label:"State",children:jsxRuntime.jsx(reactNative.TextInput,{ref:vt,style:i.form.input,placeholder:"CA",placeholderTextColor:u,value:U,onChangeText:Ae=>j(Ae.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>ve.current?.focus()})})}),jsxRuntime.jsx(reactNative.View,{style:i.form.flex,children:jsxRuntime.jsx(fn,{form:i.form,label:"ZIP code",children:jsxRuntime.jsx(reactNative.TextInput,{ref:ve,style:i.form.input,placeholder:"94001",placeholderTextColor:u,value:le,onChangeText:Ye,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>qe.current?.focus()})})})]}),jsxRuntime.jsx(fn,{form:i.form,label:"Country",children:jsxRuntime.jsx(reactNative.TextInput,{ref:qe,style:i.form.input,placeholder:"US",placeholderTextColor:u,value:_e,onChangeText:Ae=>ne(Ae.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:ze})})]}),Ne==="ssn"&&jsxRuntime.jsxs(fn,{form:i.form,label:"Social Security Number",children:[jsxRuntime.jsx(reactNative.TextInput,{style:i.form.input,placeholder:"123-45-6789",placeholderTextColor:u,value:we,onChangeText:fe,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:ze}),jsxRuntime.jsx(reactNative.Text,{style:[i.form.hint,or.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]})}),jsxRuntime.jsx(reactNative.View,{style:i.form.footer,children:t&&T>=y?jsxRuntime.jsx(reactNative.View,{style:[i.form.continueBtn,i.form.loaderInButton],children:jsxRuntime.jsx(nt,{size:28,strokeWidth:2,gradientFrom:s.primaryForeground,gradientTo:s.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[i.form.continueBtn,!Ve()&&i.form.continueBtnDisabled],onPress:ze,disabled:!Ve(),children:jsxRuntime.jsx(reactNative.Text,{style:[i.form.continueBtnText,!Ve()&&i.form.continueBtnTextDisabled],children:T>=y?"Submit":"Continue"})})})]})})}function fn({form:e,label:t,children:r}){return jsxRuntime.jsxs(reactNative.View,{style:e.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.fieldLabel,children:t}),r]})}var or=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingTop:16,paddingBottom:16},headerSide:{width:40,alignItems:"center"},headerCenter:{flex:1,alignItems:"center",justifyContent:"center"},iconButton:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"},stepCounter:{fontSize:15},progressTrack:{flexDirection:"row",gap:4,marginBottom:12},progressSegment:{flex:1,height:3,borderRadius:2},scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:4},dobRow:{flexDirection:"row",gap:10,marginBottom:20},dobCol:{flex:1},dobColWide:{flex:1.5},dobLabel:{textAlign:"center"},dobInput:{textAlign:"center"},row:{flexDirection:"row"},ssnHint:{marginTop:10,lineHeight:18}});var Dd="@unifold/stripe_oauth";async function jp(){try{let e=await Fd__default.default.getItem(Dd);return e?JSON.parse(e):null}catch{return null}}async function Vd(e){try{await Fd__default.default.setItem(Dd,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function hn(){try{await Fd__default.default.removeItem(Dd);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var Kg=5,Kn=null,$p={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function Fl(e){let t=e?.flowOrder==="amount_first",r=t?"session_params":"email",{configure:o,hasLinkAccount:n,registerLinkUser:i,authorize:s,attachKycInfo:a,presentKycInfoVerification:l,verifyIdentity:u,registerWalletAddress:c,collectPaymentMethod:y,createCryptoPaymentToken:T}=stripeReactNative.useOnramp(),[w,m]=ni.useState(r),[g,h]=ni.useState(!!e?.externalUserId),[S,b]=ni.useState(false),[p,d]=ni.useState(""),[C,x]=ni.useState(null),[_,k]=ni.useState(e?.email??""),[v,M]=ni.useState(e?.phone??""),[W,O]=ni.useState(""),[F,U]=ni.useState("US"),[j,le]=ni.useState(""),[Ye,_e]=ni.useState(""),ne=ni.useRef(""),we=ni.useRef(""),fe=ni.useRef(""),[Pe,$e]=ni.useState(false),[ue,J]=ni.useState(false),be=ni.useRef(0),vt=ni.useRef(false),ve=ni.useRef(false),qe=ni.useRef(false),Ne=ni.useRef(e?.email??""),Ve=ni.useRef(false),ze=ni.useRef(null),it=ni.useRef(""),ie=ni.useRef(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),pe=ni.useRef(null),[et,Ae]=ni.useState(0),[Ke,$t]=ni.useState($p),[Ee,Oe]=ni.useState(e?.defaultWalletAddress??""),[ar,he]=ni.useState(""),[X,Ce]=ni.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[pt,It]=ni.useState(e?.defaultSourceAmount??"100"),[me,je]=ni.useState(e?.defaultSourceCurrency??"usd"),[Vt,ot]=ni.useState(e?.defaultDestinationCurrency??"usdc"),[Lt,Bt]=ni.useState(null),[yt,Se]=ni.useState(),[Z,Q]=ni.useState(),[L,I]=ni.useState(false),D=ni.useRef(null),q=ni.useRef(false),Fe=ni.useRef(0),ke=ni.useRef(e?.onComplete),pr=ni.useRef(e?.onError),ce=ni.useRef(e?.onStepChange),xt=ni.useRef(r);ni.useEffect(()=>{ke.current=e?.onComplete;},[e?.onComplete]),ni.useEffect(()=>{pr.current=e?.onError;},[e?.onError]),ni.useEffect(()=>{ce.current=e?.onStepChange;},[e?.onStepChange]);let Ct=ni.useRef(r);ni.useEffect(()=>{w!==Ct.current&&(ce.current?.(w,Ct.current),Ct.current=w),xt.current=w;},[w]),ni.useEffect(()=>{g&&w!==r&&h(false);},[g,w,r]);let z=ni.useCallback((R,P,$)=>{let G={code:R,message:P,step:xt.current,stripeErrorCode:$};x(G),d(""),pr.current?.(G);},[]),Xr=ni.useCallback(R=>{let P={sessionId:R.id,status:R.status,sourceAmount:R.transaction_details.source_amount,sourceCurrency:R.transaction_details.source_currency,destinationAmount:R.transaction_details.destination_amount,destinationCurrency:R.transaction_details.destination_currency,destinationNetwork:R.transaction_details.destination_network,walletAddress:R.transaction_details.wallet_address,fees:{networkFee:R.transaction_details.fees.network_fee_amount,transactionFee:R.transaction_details.fees.transaction_fee_amount}};return ke.current?.(P),P},[]),dt=ni.useCallback(()=>x(null),[]),Ga=R=>R.refresh_token??R.refresh?.refresh_token??"",Yi=ni.useCallback((R,P,$,G,de)=>{we.current=P,ne.current=$,e?.externalUserId&&Vd({accessToken:P,refreshToken:$,customerId:R,externalUserId:e.externalUserId,email:de||_,expiresAt:Date.now()+G*1e3});},[e?.externalUserId,_]),Y=ni.useCallback(async()=>{let R=ne.current;if(!R)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{console.log("[tryRefreshAccessToken] refreshing OAuth token...");let P=await gd(R,fe.current??void 0),$=P.access_token,G=Ga(P)||R;return _e($),Yi(fe.current,$,G,P.expires_in??3600),console.log("[tryRefreshAccessToken] token refreshed successfully"),$}catch(P){return console.error("[tryRefreshAccessToken] refresh failed:",P?.message),await hn(),Kn=null,we.current="",ne.current="",fe.current="",_e(""),le(""),null}},[Yi]),ae=ni.useCallback(async R=>{try{return await R(we.current)}catch(P){let $=P?.message??"";if($.includes("stripe_onramp_forbidden")||$.includes("403")){console.log("[withTokenRefresh] forbidden error, attempting token refresh...");let G=await Y();if(!G)throw z("authorization_error","Session expired. Please sign in again."),m("email"),P;return await R(G)}throw P}},[Y,z]);ni.useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){I(false);return}let P=false;return stripeReactNative.isPlatformPaySupported().then($=>{P||I($);}),()=>{P=true;}},[e?.merchantIdentifier]),ni.useEffect(()=>(q.current=false,()=>{q.current=true,D.current&&clearTimeout(D.current);}),[]);let qt=ni.useRef(false);ni.useEffect(()=>{if(qt.current)return;if(!e?.externalUserId){console.log("[useStripeOnramp] no externalUserId provided \u2014 clearing stored tokens, forcing login"),hn(),Kn=null,h(false);return}let R=false;return (async()=>{try{let P=await jp();if(R||!P){R||h(!1);return}if(P.externalUserId!==e.externalUserId){console.log("[useStripeOnramp] user mismatch \u2014 stored:",P.externalUserId,"current:",e.externalUserId),await hn(),Kn=null,R||h(!1);return}console.log("[useStripeOnramp] found stored OAuth credentials for customer:",P.customerId);let $=Date.now()>=P.expiresAt,G=P.accessToken,de=P.refreshToken;if($){console.log("[useStripeOnramp] stored token expired, attempting refresh...");try{let ye=await gd(P.refreshToken,P.customerId);if(R)return;G=ye.access_token,de=ye.refresh_token??ye.refresh?.refresh_token??P.refreshToken,await Vd({accessToken:G,refreshToken:de,customerId:P.customerId,externalUserId:e.externalUserId,email:P.email,expiresAt:Date.now()+(ye.expires_in??3600)*1e3}),console.log("[useStripeOnramp] token refreshed successfully on mount");}catch(ye){console.warn("[useStripeOnramp] refresh failed on mount, user must re-login:",ye?.message),await hn(),Kn=null,R||h(!1);return}}if(R)return;if(qt.current=!0,le(P.customerId),fe.current=P.customerId,_e(G),we.current=G,ne.current=de,console.log("[useStripeOnramp] restore email from storage:",P.email??"(not stored)"),P.email&&(k(P.email),Ne.current=P.email),Kn===P.customerId)console.log("[useStripeOnramp] SDK already configured for customer:",P.customerId,"\u2014 skipping configure()"),pe.current=Promise.resolve({error:void 0});else {console.log("[useStripeOnramp] configuring SDK with cryptoCustomerId:",P.customerId);let ye=await o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}},cryptoCustomerId:P.customerId});ye.error?console.error("[useStripeOnramp] restore configureSDK error:",ye.error.message):Kn=P.customerId,pe.current=Promise.resolve(ye);}if(R)return;let _t=()=>new Promise(ye=>{let tt=()=>{Ve.current&&it.current?ye():setTimeout(tt,200);};tt();});try{if(await Promise.race([_t(),new Promise((tt,Wt)=>setTimeout(()=>Wt(new Error("timeout")),1e4))]),R)return;let ye=it.current.toLowerCase();console.log("[useStripeOnramp] re-registering wallet on restore:",ye,"network:",ie.current),await c(ye,ie.current);}catch(ye){console.warn("[useStripeOnramp] wallet re-registration on restore failed (non-fatal):",ye?.message);}if(R)return;try{(await Mn(fe.current,we.current)).verifications.find(Wt=>Wt.name==="kyc_verified")?.status!=="verified"?(console.log("[useStripeOnramp] credentials restored but KYC not verified \u2014 going to kyc"),m("kyc")):(console.log("[useStripeOnramp] credentials restored, KYC verified \u2014 skipping to session_params"),m("session_params"));}catch{console.log("[useStripeOnramp] credentials restored, could not check KYC \u2014 defaulting to kyc"),m("kyc");}}finally{R||h(false);}})(),()=>{R=true;}},[]),ni.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress){console.log("[resolveWallet] skipping \u2014 missing:",e?.publishableKey?"":"publishableKey",e?.externalUserId?"":"externalUserId",e?.recipientAddress?"":"recipientAddress");return}if(Pe)return;let R=false;J(true);async function P(){try{console.log("[resolveWallet] fetching deposit address for:",e.externalUserId,e.recipientAddress);let[$,G]=await Promise.all([Pp({external_user_id:e.externalUserId,recipient_address:e.recipientAddress,destination_chain_type:e?.destinationChainType,destination_chain_id:e?.destinationChainId,destination_token_address:e?.destinationTokenAddress}),e?.destinationTokenAddress&&e?.destinationChainId&&e?.destinationChainType?Op({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(Et=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",Et?.message),null)):Promise.resolve(null)]);if(R){console.log("[resolveWallet] cancelled after fetch \u2014 discarding stale result");return}let de=e?.destinationChainType??"ethereum",_t=$.data.find(Et=>Et.chain_type===de);if(_t?.address){let Et=_t.address.toLowerCase();console.log("[resolveWallet] resolved deposit address:",Et,"recipient:",_t.recipient_address),Oe(Et),it.current=Et,_t.recipient_address&&he(_t.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",de,"in",$.data?.length,"wallets");let ye={base:stripeReactNative.Onramp.CryptoNetwork.base,ethereum:stripeReactNative.Onramp.CryptoNetwork.ethereum,solana:stripeReactNative.Onramp.CryptoNetwork.solana,bitcoin:stripeReactNative.Onramp.CryptoNetwork.bitcoin,polygon:stripeReactNative.Onramp.CryptoNetwork.polygon},tt={8453:"base",1:"ethereum",137:"polygon"},Wt=G?.destination_network,xr="none";if(Wt&&ye[Wt])Ce(ye[Wt]),ie.current=ye[Wt],xr=Wt+" (from default_token API)";else if(e?.destinationChainId&&tt[e.destinationChainId]){let Et=tt[e.destinationChainId];ye[Et]&&(Ce(ye[Et]),ie.current=ye[Et]),xr=Et+" (from chain_id "+e.destinationChainId+")";}else ye[de]&&(Ce(ye[de]),ie.current=ye[de],xr=de+" (from chain_type fallback)");G?.destination_currency&&ot(G.destination_currency.toLowerCase());let At=G?.destination_token_metadata,lr=zn(At?.icon_urls,At?.icon_url),Vr=zn(At?.chain?.icon_urls,At?.chain?.icon_url);console.log("[resolveWallet] icon_urls \u2014 token:",lr,"network:",Vr),lr&&Se(lr),Vr&&Q(Vr),console.log("[resolveWallet] \u2705 setting walletReady = true"),$e(!0),Ve.current=!0;}catch($){if(R)return;console.error("[resolveWallet] Failed to resolve wallet:",$?.message),$e(true),Ve.current=true;}finally{R||J(false);}}return ze.current=P(),()=>{R=true;}},[e?.publishableKey,e?.externalUserId,et]);let Tr=ni.useCallback(async()=>{if(pe.current)return pe.current;let R=o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(P=>(P.error&&(console.error("[useStripeOnramp] configureSDK error:",P.error.message,P.error.code),pe.current=null),P)).catch(P=>{throw console.error("[useStripeOnramp] configureSDK threw:",P?.message??P),pe.current=null,P});return pe.current=R,R},[o,e?.merchantDisplayName]);ni.useEffect(()=>{e?.externalUserId||Tr();},[]);let an=ni.useCallback(async R=>{if(!vt.current){vt.current=true,b(true),dt(),d("Creating auth intent...");try{let P=await hd(R);d("Waiting for authorization...");let $=await s(P);if($?.error){console.log("[proceedToAuthorize] authorize error:",$.error.message),z("authorization_error","Something went wrong during authorization. Please try again."),m("email");return}if($?.status==="Denied"){z("authorization_error","Authorization denied by user."),m("email");return}if($?.status!=="Consented"||!$.customerId){z("authorization_error","Authorization was canceled."),m("email");return}d("Exchanging tokens...");let G=$.customerId,de=await xp(P,G),_t=de.access_token,ye=Ga(de);console.log("[useStripeOnramp] customerId:",G),console.log("[useStripeOnramp] accessToken acquired, length:",_t.length),k(R),Ne.current=R,le(G),fe.current=G,Kn=G,_e(_t),Yi(G,_t,ye,de.expires_in??3600,R),d("Checking verification status...");try{let tt=await Mn(G,_t),Wt=tt.verifications.find(Vr=>Vr.name==="kyc_verified"),xr=Wt?.status==="verified",At=Wt?.status==="rejected",lr=tt.provided_fields.includes("first_name");if(d(""),At&&!lr)z("kyc_error","KYC was previously rejected. Please submit with correct info."),m("kyc");else if(!xr)m("kyc");else {ze.current&&(d("Resolving wallet..."),await ze.current,d(""));let Vr=it.current;if(Vr)try{let Et=Vr.toLowerCase(),Gs=ie.current;console.log("[proceedToAuthorize] registering wallet:",Et,"network:",Gs);let gi=await c(Et,Gs);gi?.error?(console.warn("[proceedToAuthorize] wallet registration error:",gi.error.message),z("wallet_error",gi.error.message,gi.error.code),m("wallet")):(console.log("[proceedToAuthorize] wallet registered successfully"),m("kyc_offer"));}catch(Et){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",Et?.message),m("wallet");}else console.log("[proceedToAuthorize] no resolved deposit address available, going to wallet step"),m("wallet");}}catch(tt){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",tt?.message),d(""),m("kyc");}}catch(P){z("authorization_error",P?.message??String(P)),m("email");}finally{vt.current=false,b(false);}}},[s,dt,z,Yi,c,X]),Bn=ni.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!_){z("validation_error","Please enter an email address.");return}b(true),dt(),d("");try{d("Configuring...");let R=await Tr();if(R.error){z("configuration_error",R.error.message,R.error.code);return}d("Checking Link account...");let P=await n(_);if(P.error){z("authorization_error",P.error.message,P.error.code);return}console.log("[checkEmail] link.hasLinkAccount:",P.hasLinkAccount),P.hasLinkAccount?await an(_):(d(""),m("disclaimer"));}catch(R){z("unknown_error",R?.message??String(R));}finally{b(false);}},[dt,Tr,_,z,n,an]),Wn=ni.useCallback(async()=>{if(!qe.current){if(!v){z("validation_error","Please enter your phone number.");return}qe.current=true,b(true),dt(),d("");try{d("Creating Link account...");let R=await i({email:_,phone:v,fullName:W||_,country:F||"US"});if(R.error){z("registration_error",R.error.message,R.error.code);return}await an(_);}catch(R){z("registration_error",R?.message??String(R));}finally{qe.current=false,b(false);}}},[dt,F,_,z,W,v,i,an]);ni.useEffect(()=>{if(w!=="email"||!e?.email||g)return;let R=++be.current,P=false,$=()=>P||be.current!==R;return e?.phone?(async()=>{b(true),dt();try{d("Configuring...");let G=await Tr();if($())return;if(G.error){z("configuration_error",G.error.message,G.error.code);return}d("Checking Link account...");let de=await n(e.email);if($())return;if(de.error){z("authorization_error",de.error.message,de.error.code);return}if(de.hasLinkAccount){if($())return;await an(e.email);}else {if($())return;d(""),m("disclaimer");}}catch(G){$()||z("unknown_error",G?.message??String(G));}finally{b(false);}})():(async()=>{b(true),dt();try{d("Configuring...");let G=await Tr();if($())return;if(G.error){z("configuration_error",G.error.message,G.error.code);return}d("Checking Link account...");let de=await n(e.email);if($())return;if(de.error){z("authorization_error",de.error.message,de.error.code);return}if(de.hasLinkAccount){if($())return;await an(e.email);}else {if($())return;d(""),m("disclaimer");}}catch(G){$()||z("unknown_error",G?.message??String(G));}finally{b(false);}})(),()=>{P=true;}},[w,e?.email,e?.phone,g]);let Ja=ni.useCallback(async()=>{ze.current&&(d("Resolving wallet..."),await ze.current);let R=it.current;if(R)try{d("Registering wallet...");let P=R.toLowerCase(),$=ie.current;console.log("[resolveAndRegisterWallet] registering wallet:",P,"network:",$),await c(P,$);}catch(P){console.warn("[resolveAndRegisterWallet] wallet registration failed (non-fatal):",P?.message);}else console.warn("[resolveAndRegisterWallet] no resolved deposit address \u2014 skipping registration");},[c]),sh=ni.useCallback(async(R,P)=>{b(true),dt(),d(""),$t(de=>({...de,...R}));let $=P??"kyc_offer",G=P?"kyc_l1":"kyc";try{let de=R.dobDay&&R.dobMonth&&R.dobYear,_t=R.firstName&&R.lastName,ye={};_t&&(ye.firstName=R.firstName,ye.lastName=R.lastName),R.addressLine1&&(ye.address={line1:R.addressLine1,line2:R.addressLine2||void 0,city:R.city,state:R.state,postalCode:R.postalCode,country:R.country}),R.idNumber&&(ye.idNumber=R.idNumber),de&&(ye.dateOfBirth={day:parseInt(R.dobDay,10),month:parseInt(R.dobMonth,10),year:parseInt(R.dobYear,10)}),console.log("[attachKyc] sending kycInfo:",JSON.stringify(ye,null,2));let tt=await a(ye);if(console.log("[attachKyc] attachKycInfo result:",JSON.stringify(tt,null,2)),tt?.error?.message&&(/no active link consumer/i.test(tt.error.message)||/not be verified/i.test(tt.error.message))){if(console.log("[attachKyc] Link session invalid \u2014 re-establishing session"),d("Verifying identity..."),!await Ys()){z("kyc_error","Please verify your identity to continue."),m(G);return}tt=await a(ye),console.log("[attachKyc] retry attachKycInfo result:",JSON.stringify(tt,null,2));}if(tt?.error){if(tt.error.stripeErrorCode==="consumer_person_already_verified"){console.log("[attachKyc] already verified, resolving wallet before",$),await Ja(),d(""),m($);return}z("kyc_error",tt.error.message,tt.error.stripeErrorCode??tt.error.code),m(G);return}if(!(tt&&Object.keys(tt).length>0&&!tt.error)){let lr=P?"l1":"l0";if(console.log(`[attachKyc] success (no verification needed), waiting for ${lr} verified...`),d("Verifying identity..."),!fe.current||!we.current){console.warn(`[attachKyc] \u274C cannot poll ${lr} \u2014 missing customerIdRef or accessTokenRef`),z("kyc_error","Unable to verify identity. Please try again."),m(G);return}let Vr=fe.current,Et=we.current,Gs=10,gi=!1;for(let Hc=0;Hc<Gs;Hc++){try{let rl=(await Mn(Vr,Et)).kyc_tiers?.find(fh=>fh.tier===lr);if(console.log(`[attachKyc] ${lr} poll #${Hc+1}: verification_status=${rl?.verification_status}`),rl?.verification_status==="verified"){console.log(`[attachKyc] \u2705 ${lr} verified!`),gi=!0;break}if(rl?.verification_status==="rejected"){console.warn(`[attachKyc] \u274C ${lr} rejected:`,rl?.verification_errors),z("kyc_error","KYC verification was rejected. Please try again."),m(G);return}}catch(tl){console.warn(`[attachKyc] ${lr} poll error:`,tl?.message);}await new Promise(tl=>setTimeout(tl,2e3));}if(!gi){console.warn(`[attachKyc] \u274C ${lr} verification timed out after`,Gs,"attempts"),z("kyc_error","Identity verification is taking longer than expected. Please try again."),m(G);return}await Ja(),d(""),m($);return}console.log("[attachKyc] calling presentKycInfoVerification..."),d("Please review your KYC information...");let At=await l(null);if(console.log("[attachKyc] presentKycInfoVerification result:",JSON.stringify(At,null,2)),At?.error){z("kyc_error",At.error.message,At.error.stripeErrorCode??At.error.code),m(G);return}if(At?.status==="UpdateAddress"){z("kyc_error","Please update your address and resubmit."),m(G);return}await Ja(),d(""),console.log("[attachKyc] success, navigating to:",$),m($);}catch(de){z("kyc_error",de?.message??String(de)),m(G);}finally{b(false);}},[a,dt,z,l,Ja]),Ys=ni.useCallback(async()=>{let R=Ne.current||e?.email;if(!R)return console.warn("[reestablishLinkSession] no email available \u2014 emailRef:",JSON.stringify(Ne.current),"config.email:",e?.email),false;try{console.log("[reestablishLinkSession] re-establishing Link session for:",R);let P=await hd(R),$=await s(P);return $?.status==="Consented"&&$.customerId?(console.log("[reestablishLinkSession] success, customerId:",$.customerId),fe.current=$.customerId,le($.customerId),!0):(console.warn("[reestablishLinkSession] authorize did not consent:",$?.status),!1)}catch(P){return console.warn("[reestablishLinkSession] failed:",P?.message),false}},[s,e?.email]),Gu=ni.useCallback(async()=>{if(!ve.current){ve.current=true,b(true),dt(),d("Launching identity verification...");try{let R=await u();if(R?.error?.message&&(/no active link consumer/i.test(R.error.message)||/not be verified/i.test(R.error.message))){if(console.log("[verifyIdentity] Link session invalid \u2014 re-establishing session"),d("Verifying identity..."),!await Ys()){z("identity_error","Please verify your identity to continue.");return}R=await u();}if(R?.error){let $=R.error.message??"";if(/cancel/i.test($)){console.log("[verifyIdentity] cancelled by user, returning silently"),d("");return}z("identity_error",$,R.error.code);return}d(""),Za.current?(Za.current=!1,m("session_params")):m("wallet");}catch(R){z("identity_error",R?.message??String(R));}finally{ve.current=false,b(false);}}},[dt,z,Ys,u]),Za=ni.useRef(false);ni.useEffect(()=>{w==="identity"&&!S&&Gu();},[w]);let Ju=ni.useCallback(async()=>{if(console.log("[registerWallet] called. walletAddress:",Ee,"walletNetwork:",X),!Ee){z("validation_error","Please enter a wallet address.");return}b(true),dt(),d("");try{let R=Ee.toLowerCase();console.log("[registerWallet] registering wallet:",R,"network:",X);let P=await c(R,X);if(console.log("[registerWallet] result:",JSON.stringify(P,null,2)),P?.error){console.warn("[registerWallet] error:",P.error.message),z("wallet_error",P.error.message,P.error.code);return}console.log("[registerWallet] wallet registered successfully \u2192 kyc_offer"),d(""),m("kyc_offer");}catch(R){console.error("[registerWallet] exception:",R?.message??String(R)),z("wallet_error",R?.message??String(R));}finally{b(false);}},[dt,z,Ee,X,c]);ni.useEffect(()=>{console.log("[auto-register] step:",w,"walletReady:",Pe,"walletAddress:",Ee||"(empty)"),w==="wallet"&&Pe&&Ee&&(console.log("[auto-register] triggering registerWallet() with address:",Ee),Ju());},[w,Pe,Ee]);let Xa=ni.useCallback(R=>{q.current=false,Fe.current=0;let P=0,$=async()=>{P+=1;let G=we.current;try{let de=await Ip(R,G);if(console.log(`[pollSessionStatus] poll #${P} session=${R} status="${de.status}"`),q.current)return;Fe.current=0,de.status==="fulfillment_complete"?(Bt(de),m("success")):D.current=setTimeout($,3e3);}catch(de){if(q.current)return;let _t=de?.message??"";if((_t.includes("stripe_onramp_forbidden")||_t.includes("403"))&&(console.log("[pollSessionStatus] token expired during polling, refreshing..."),await Y()&&!q.current)){D.current=setTimeout($,1e3);return}if(Fe.current+=1,console.error(`[pollSessionStatus] poll #${P} error:`,_t),Fe.current>=Kg){z("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}D.current=setTimeout($,5e3);}};D.current=setTimeout($,3e3);},[z,Y]),ah=ni.useCallback(()=>{if(xt.current==="processing"&&Lt?.id){if(!we.current){z("session_error","Your session has expired. Your purchase may still complete \u2014 close and check your wallet.");return}dt(),Fe.current=0,D.current&&(clearTimeout(D.current),D.current=null),Xa(Lt.id);}},[dt,z,Xa,Lt?.id]),el=ni.useCallback(async R=>{b(true),dt(),d("");try{d("Confirming purchase...");let P=await ae($=>Rp(R,$));console.log("[finalizeOnrampSession] confirmed session:",P.id,"status:",P.status),Bt(P),m("processing"),d(""),console.log("[finalizeOnrampSession] starting fulfillment polling for session:",P.id),Xa(P.id);}finally{b(false);}},[dt,Xa,ae]),zc=ni.useRef(false),lh=ni.useCallback(async()=>{if(!(!Lt||zc.current)){zc.current=true;try{b(!0),dt(),d("Refreshing quote...");let R=await ae(P=>yd(Lt.id,P));Bt(R),await el(R.id);}catch(R){console.log("[confirmCheckout] error:",R?.message),z("session_error","Something went wrong. Please try again."),m("quote");}finally{b(false),zc.current=false;}}},[dt,z,el,Lt,ae]),ch=ni.useCallback(async(R=false,P,$)=>{let G=P??pt;if(console.log("[collectPaymentMethod] called:",{useApplePay:R,amt:G,amountOverride:P,sourceAmount:pt,hasSavedToken:!!$}),!G||isNaN(Number(G))||Number(G)<=0){console.log("[collectPaymentMethod] validation failed \u2014 no valid amount"),z("validation_error","Please enter a valid amount.");return}P&&It(P),b(true),dt(),d("");try{let de=await Tr();if(de.error){z("configuration_error",de.error.message,de.error.code);return}let _t;if($)console.log("[collectPaymentMethod] using saved payment token"),_t=$;else if(R){if(!e?.merchantIdentifier?.trim()){console.log("[collectPaymentMethod] no merchantIdentifier"),z("configuration_error","Apple Pay is not configured. Pass merchantIdentifier on StripeOnramp or in onramp config."),m("session_params");return}d("Opening Apple Pay..."),console.log("[collectPaymentMethod] calling stripeCollectPM(PlatformPay)...");let Wt={applePay:{merchantCountryCode:"US",currencyCode:me.toUpperCase(),cartItems:[{paymentType:stripeReactNative.PlatformPay.PaymentType.Immediate,label:`${Vt.toUpperCase()} purchase + fees`,amount:G}]}},xr=await y("PlatformPay",Wt);if(console.log("[collectPaymentMethod] PlatformPay result ok:",!xr?.error),xr?.error){let lr=xr.error.message??"",Vr=xr.error.code??"",Et=/cancel/i.test(lr)||/cancel/i.test(Vr);console.log("[collectPaymentMethod] pmResult error:",xr.error,"isCancellation:",Et),Et||(z("payment_error",lr,Vr),m("session_params"));return}if(!xr?.displayData){console.log("[collectPaymentMethod] no displayData \u2014 canceled");return}d("Creating payment token...");let At=await T();if(console.log("[collectPaymentMethod] tokenResult ok:",!At?.error),At?.error){z("payment_error",At.error.message,At.error.code),m("session_params");return}_t=At.cryptoPaymentToken;}else {d("Select a payment method...");let Wt=await y("Card");if(console.log("[collectPaymentMethod] Card result ok:",!Wt?.error),Wt?.error){let lr=Wt.error.message??"",Vr=Wt.error.code??"",Et=/cancel/i.test(lr)||/cancel/i.test(Vr);console.log("[collectPaymentMethod] pmResult error:",Wt.error,"isCancellation:",Et),Et||(z("payment_error",lr,Vr),m("session_params"));return}if(!Wt?.displayData){console.log("[collectPaymentMethod] no displayData \u2014 canceled");return}let xr=Wt.displayData;console.log("[collectPaymentMethod] displayData:",{type:xr.type,label:xr.label,sublabel:xr.sublabel,hasIcon:!!xr.icon}),d("Creating payment token...");let At=await T();if(console.log("[collectPaymentMethod] tokenResult ok:",!At?.error),At?.error){z("payment_error",At.error.message,At.error.code),m("session_params");return}_t=At.cryptoPaymentToken;}d("Creating onramp session...");let ye=it.current||Ee;if(console.log("[collectPaymentMethod] creating onramp session, sessionWalletAddress:",ye),!ye){z("wallet_error","No wallet address available. Please go back and enter a wallet address.");return}let tt=await ae(Wt=>_p({cryptoCustomerId:fe.current,paymentToken:_t,sourceAmount:Number(G),sourceCurrency:me,destinationCurrency:Vt,walletAddress:ye,destinationNetwork:X},Wt));console.log("[collectPaymentMethod] session created:",tt?.id,"useApplePay:",R),Bt(tt),d(""),R?(console.log("[collectPaymentMethod] finalizing Apple Pay session..."),await el(tt.id),console.log("[collectPaymentMethod] confirmation done, polling for fulfillment in background")):m("quote");}catch(de){console.log("[collectPaymentMethod] error caught:",de?.message),z("session_error","Something went wrong. Please try again."),m("session_params");}finally{b(false),d("");}},[dt,Tr,y,T,Vt,z,el,It,pt,me,Ee,X,ae,e?.merchantIdentifier]),dh=ni.useCallback(async()=>{b(true),dt(),d("Select a payment method...");try{let R=await Tr();if(R.error)return z("configuration_error",R.error.message,R.error.code),null;let P=await y("Card");if(console.log("[addPaymentMethod] Card result ok:",!P?.error),P?.error?.message&&(/no active link consumer/i.test(P.error.message)||/not be verified/i.test(P.error.message))){if(console.log("[addPaymentMethod] Link session invalid \u2014 re-establishing session"),!await Ys())return z("authorization_error","Please verify your identity to add a payment method."),null;P=await y("Card"),console.log("[addPaymentMethod] Card result after re-auth ok:",!P?.error);}if(P?.error){let _t=P.error.message??"",ye=P.error.code??"",tt=/cancel/i.test(_t)||/cancel/i.test(ye);return console.log("[addPaymentMethod] pmResult error:",P.error,"isCancellation:",tt),tt||z("payment_error",_t,ye),null}if(!P?.displayData)return console.log("[addPaymentMethod] no displayData \u2014 canceled"),null;let G=P.displayData;console.log("[addPaymentMethod] displayData:",{type:G.type,label:G.label,sublabel:G.sublabel,hasIcon:!!G.icon}),d("Saving payment method...");let de=await T();return console.log("[addPaymentMethod] tokenResult ok:",!de?.error),de?.error?(z("payment_error",de.error.message,de.error.code),null):(console.log("[addPaymentMethod] payment method added successfully"),{token:de.cryptoPaymentToken,sublabel:G.sublabel??""})}catch(R){return console.log("[addPaymentMethod] error:",R?.message),z("session_error",R?.message??String(R)),null}finally{b(false),d("");}},[dt,Tr,y,T,z,Ys]),uh=ni.useCallback(async()=>{if(Lt){b(true),dt(),d("");try{let R=await ae(P=>yd(Lt.id,P));Bt(R);}catch(R){console.log("[refreshQuote] error:",R?.message),z("session_error","Something went wrong. Please try again.");}finally{b(false);}}},[dt,z,Lt,ae]),Uc=ni.useCallback(()=>{q.current=true,Fe.current=0,D.current&&(clearTimeout(D.current),D.current=null),m(r),b(false),d(""),x(null),k(e?.email??""),Ne.current=e?.email??"",M(e?.phone??""),O(""),U("US"),le(""),fe.current="",_e(""),we.current="",ne.current="",$e(false),J(false),ze.current=null,Ae(R=>R+1),$t($p),Oe(""),it.current="",Ve.current=false,Ce(stripeReactNative.Onramp.CryptoNetwork.ethereum),It(e?.defaultSourceAmount??"100"),je(e?.defaultSourceCurrency??"usd"),ot(e?.defaultDestinationCurrency??"usdc"),he(""),Se(void 0),Q(void 0),Bt(null),be.current+=1,vt.current=false,ve.current=false,qe.current=false;},[e,r]),ph=ni.useCallback(()=>{Za.current=true,m("kyc_offer");},[]),mh=ni.useCallback(async()=>{await hn(),Kn=null,Uc();},[Uc]);return {step:w,restoring:g,loading:S,status:p,error:C,email:_,phone:v,fullName:W,country:F,customerId:j,accessToken:Ye,session:Lt,kycData:Ke,walletAddress:Ee,resolvedRecipientAddress:ar,walletNetwork:X,sourceAmount:pt,sourceCurrency:me,destinationCurrency:Vt,tokenIconUrl:yt,networkIconUrl:Z,applePaySupported:L,walletReady:Pe,walletLoading:ue,setStep:m,setStatus:d,setEmail:k,setPhone:M,setFullName:O,setCountry:U,setWalletAddress:Oe,setWalletNetwork:Ce,setSourceAmount:It,setSourceCurrency:je,setDestinationCurrency:ot,checkEmail:Bn,register:Wn,attachKyc:sh,verifyIdentity:Gu,requestKYCUpgrade:ph,kycUpgradeMode:Za,logout:mh,registerWallet:Ju,collectPaymentMethod:ch,addPaymentMethod:dh,refreshQuote:uh,confirmCheckout:lh,reset:Uc,clearError:dt,emitComplete:Xr,resumeFulfillmentPolling:ah,amountFirst:t}}function qp({initialData:e={},loading:t=false,onComplete:r,onCancel:o,onClose:n}){let i=Wo(),{colors:s,fonts:a,components:l}=V(),u=l.input.placeholderColor,[c,y]=ni.useState(e.dobMonth??""),[T,w]=ni.useState(e.dobDay??""),[m,g]=ni.useState(e.dobYear??""),[h,S]=ni.useState(e.idNumber??""),b=ni.useRef(null),p=ni.useRef(null),d=ni.useRef(null),C=c.length===2&&T.length===2&&m.length===4&&h.trim().length>0,x=()=>{console.log("[KYCL1Screen] handleSubmit \u2014 canSubmit:",C,"dobMonth:",c,"dobDay:",T,"dobYear:",m,"idNumber:",h?"set":"empty"),C&&r({dobMonth:c,dobDay:T,dobYear:m,idNumber:h});};return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:i.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:i.form.screen,children:[jsxRuntime.jsx(St,{onPress:t?n??o:o,title:"Increase Your Limits",variant:t?"close":"back"}),jsxRuntime.jsx(at,{style:i.form.flex,contentContainerStyle:Uo.scrollContent,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{pointerEvents:t?"none":"auto",style:{opacity:t?.5:1},children:[jsxRuntime.jsx(reactNative.Text,{style:i.form.title,children:"Date of birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:i.form.subtitle,children:"This information is used to verify your identity and increase your transaction limits."}),jsxRuntime.jsxs(reactNative.View,{style:Uo.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Date of birth"}),jsxRuntime.jsxs(reactNative.View,{style:Uo.dobRow,children:[jsxRuntime.jsx(reactNative.View,{style:Uo.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{style:[i.form.input,Uo.dobInput],placeholder:"MM",placeholderTextColor:u,value:c,onChangeText:_=>{let k=_.replace(/\D/g,"").slice(0,2);y(k),k.length===2&&b.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:Uo.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{ref:b,style:[i.form.input,Uo.dobInput],placeholder:"DD",placeholderTextColor:u,value:T,onChangeText:_=>{let k=_.replace(/\D/g,"").slice(0,2);w(k),k.length===2&&p.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:Uo.dobColWide,children:jsxRuntime.jsx(reactNative.TextInput,{ref:p,style:[i.form.input,Uo.dobInput],placeholder:"YYYY",placeholderTextColor:u,value:m,onChangeText:_=>{let k=_.replace(/\D/g,"").slice(0,4);g(k),k.length===4&&d.current?.focus();},keyboardType:"number-pad",maxLength:4,editable:!t})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Uo.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Social Security Number"}),jsxRuntime.jsx(reactNative.TextInput,{ref:d,style:i.form.input,placeholder:"123-45-6789",placeholderTextColor:u,value:h,onChangeText:S,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:x,editable:!t}),jsxRuntime.jsx(reactNative.Text,{style:[i.form.hint,{marginTop:10,lineHeight:18}],children:"Your SSN is transmitted securely and never stored on this device."})]})]})}),jsxRuntime.jsx(reactNative.View,{style:i.form.footer,children:t?jsxRuntime.jsx(reactNative.View,{style:[i.form.continueBtn,i.form.loaderInButton],children:jsxRuntime.jsx(nt,{size:28,strokeWidth:2,gradientFrom:s.primaryForeground,gradientTo:s.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[i.form.continueBtn,!C&&i.form.continueBtnDisabled],onPress:x,disabled:!C,children:jsxRuntime.jsx(reactNative.Text,{style:[i.form.continueBtnText,!C&&i.form.continueBtnTextDisabled],children:"Submit"})})})]})})}var Uo=reactNative.StyleSheet.create({scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:16},section:{marginTop:20},dobRow:{flexDirection:"row",gap:10},dobCol:{flex:1},dobColWide:{flex:1.5},dobInput:{textAlign:"center"}});function Bd({borderRadius:e,backgroundColor:t,borderColor:r,borderWidth:o}){let n=ni.useRef(new reactNative.Animated.Value(.3)).current;return ni.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[n]),jsxRuntime.jsxs(reactNative.Animated.View,{style:[Ge.card,{backgroundColor:t,borderRadius:e,borderColor:r,borderWidth:o,opacity:n}],children:[jsxRuntime.jsx(reactNative.View,{style:Ge.skeletonLine}),jsxRuntime.jsx(reactNative.View,{style:[Ge.skeletonLine,{width:"60%"}]})]})}function Kp({onRefresh:e,colors:t,fonts:r}){let[o,n]=ni.useState(10),i=ni.useRef(null);ni.useEffect(()=>(i.current=setInterval(()=>{n(a=>a<=1?(i.current&&clearInterval(i.current),0):a-1);},1e3),()=>{i.current&&clearInterval(i.current);}),[]);let s=ni.useCallback(()=>{o>0||(e(),n(10),i.current=setInterval(()=>{n(a=>a<=1?(i.current&&clearInterval(i.current),0):a-1);},1e3));},[o,e]);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:s,disabled:o>0,style:[Ge.refreshBtn,{opacity:o>0?.4:1}],activeOpacity:.7,children:[jsxRuntime.jsx(Xi,{size:14,color:t.foregroundMuted,strokeWidth:2}),o>0?jsxRuntime.jsxs(reactNative.Text,{style:[Ge.refreshText,{color:t.foregroundMuted,fontFamily:r.regular}],children:[o,"s"]}):null]})}function Jp({onSelectL1:e,onSelectL2:t,onSkip:r,onClose:o,onRefresh:n,loading:i=false,loadingTiers:s=false,error:a,l0Status:l="not_started",l1Status:u="not_started",l2Status:c="not_started",l1Completed:y=false,l2Completed:T=false,currentLimit:w}){let m=Wo(),{colors:g,fonts:h,components:S}=V(),b=[Ge.card,{backgroundColor:S.card.backgroundColor,borderRadius:S.card.borderRadius??12,borderWidth:S.card.borderWidth,borderColor:S.card.borderColor}],p=[...b,{opacity:.5}],d=l==="verified",C=u==="verified",x=c==="verified",_=u==="pending"||d&&y&&!C,k=c==="pending"||d&&T&&!x,v=x,M=d&&!C,W=d&&!x,O=!v,F=U=>`$${U.toLocaleString()}`;return jsxRuntime.jsxs(reactNative.View,{style:m.form.screen,children:[jsxRuntime.jsx(St,{onPress:o,title:"Increase Your Limits"}),jsxRuntime.jsxs(reactNative.View,{style:Ge.content,children:[w!==void 0?jsxRuntime.jsxs(reactNative.View,{style:[Ge.limitBadge,{backgroundColor:S.card.backgroundColor,borderColor:S.card.borderColor,borderWidth:S.card.borderWidth,borderRadius:S.card.borderRadius??12}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Ge.limitLabel,{color:g.foregroundMuted,fontFamily:h.regular}],children:"Current transaction limit"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ge.limitValue,{color:g.foreground,fontFamily:h.semibold}],children:[F(w)," USD"]})]}):jsxRuntime.jsx(Bd,{borderRadius:S.card.borderRadius??12,backgroundColor:S.card.backgroundColor,borderColor:S.card.borderColor,borderWidth:S.card.borderWidth}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.subtitle,{color:g.foregroundMuted,fontFamily:h.regular}],children:s?"Checking your verification status...":v?"All verification levels have been completed. Your limits are at the maximum available.":"Complete additional verification to increase your transaction limits."}),s?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Bd,{borderRadius:S.card.borderRadius??12,backgroundColor:S.card.backgroundColor,borderColor:S.card.borderColor,borderWidth:S.card.borderWidth}),jsxRuntime.jsx(Bd,{borderRadius:S.card.borderRadius??12,backgroundColor:S.card.backgroundColor,borderColor:S.card.borderColor,borderWidth:S.card.borderWidth})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[M&&(C?jsxRuntime.jsxs(reactNative.View,{style:p,children:[jsxRuntime.jsxs(reactNative.View,{style:Ge.completedRow,children:[jsxRuntime.jsx(jr,{size:20,color:g.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.cardTitle,{color:g.foreground,fontFamily:h.semibold,flex:1}],children:"Date of Birth & SSN"}),jsxRuntime.jsx(Le,{size:18,color:g.primary,strokeWidth:2.5})]}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.cardBody,{color:g.foregroundMuted,fontFamily:h.regular,marginLeft:28}],children:"Completed"})]}):_?jsxRuntime.jsxs(reactNative.View,{style:b,children:[jsxRuntime.jsxs(reactNative.View,{style:Ge.pendingHeader,children:[jsxRuntime.jsx(jr,{size:20,color:g.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.cardTitle,{color:g.foreground,fontFamily:h.semibold,flex:1}],children:"Date of Birth & SSN"}),n?jsxRuntime.jsx(Kp,{onRefresh:n,colors:g,fonts:h}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[Ge.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Ge.cardBody,{color:g.foregroundMuted,fontFamily:h.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(nt,{size:18,strokeWidth:2,gradientFrom:g.primary,gradientTo:g.primary})]})]}):jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[b,Ge.cardRow],onPress:e,activeOpacity:.7,children:[jsxRuntime.jsx(jr,{size:20,color:g.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:Ge.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ge.cardTitle,{color:g.foreground,fontFamily:h.semibold}],children:"Provide Date of Birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.cardBody,{color:g.foregroundMuted,fontFamily:h.regular}],children:"Increases your per-transaction and weekly limits."})]}),jsxRuntime.jsx(_r,{size:18,color:g.foregroundMuted,strokeWidth:2})]})),W&&(x?jsxRuntime.jsxs(reactNative.View,{style:p,children:[jsxRuntime.jsxs(reactNative.View,{style:Ge.completedRow,children:[jsxRuntime.jsx(sl,{size:20,color:g.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.cardTitle,{color:g.foreground,fontFamily:h.semibold,flex:1}],children:"Photo ID & Selfie"}),jsxRuntime.jsx(Le,{size:18,color:g.primary,strokeWidth:2.5})]}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.cardBody,{color:g.foregroundMuted,fontFamily:h.regular,marginLeft:28}],children:"Completed"})]}):k?jsxRuntime.jsxs(reactNative.View,{style:b,children:[jsxRuntime.jsxs(reactNative.View,{style:Ge.pendingHeader,children:[jsxRuntime.jsx(sl,{size:20,color:g.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.cardTitle,{color:g.foreground,fontFamily:h.semibold,flex:1}],children:"Photo ID & Selfie"}),n?jsxRuntime.jsx(Kp,{onRefresh:n,colors:g,fonts:h}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[Ge.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Ge.cardBody,{color:g.foregroundMuted,fontFamily:h.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(nt,{size:18,strokeWidth:2,gradientFrom:g.primary,gradientTo:g.primary})]})]}):jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[b,Ge.cardRow],onPress:t,activeOpacity:.7,children:[jsxRuntime.jsx(sl,{size:20,color:g.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:Ge.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ge.cardTitle,{color:g.foreground,fontFamily:h.semibold}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.cardBody,{color:g.foregroundMuted,fontFamily:h.regular}],children:"Unlocks the highest transaction limits available."})]}),jsxRuntime.jsx(_r,{size:18,color:g.foregroundMuted,strokeWidth:2})]}))]})]}),jsxRuntime.jsxs(reactNative.View,{style:Ge.footer,children:[a?jsxRuntime.jsx(reactNative.Text,{style:[m.form.subtitle,{marginBottom:12,textAlign:"center",color:"red"}],children:a}):null,i?jsxRuntime.jsxs(reactNative.View,{style:Ge.loaderRow,children:[jsxRuntime.jsx(nt,{size:24,strokeWidth:2,gradientFrom:g.primary,gradientTo:g.primary}),jsxRuntime.jsx(reactNative.Text,{style:[m.form.ghostBtnText,{marginLeft:8}],children:"Verifying..."})]}):O?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:m.form.ghostBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:m.form.ghostBtnText,children:"Skip for now"})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:m.form.continueBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:m.form.continueBtnText,children:"Done"})})]})]})}var Ge=reactNative.StyleSheet.create({content:{flex:1,paddingTop:24,gap:16},limitBadge:{alignItems:"center",paddingVertical:24,paddingHorizontal:20,gap:4},limitLabel:{fontSize:13},limitValue:{fontSize:20,paddingTop:8},subtitle:{fontSize:15,lineHeight:22,textAlign:"center",paddingHorizontal:16,paddingVertical:24},card:{padding:20,gap:6},cardRow:{flexDirection:"row",alignItems:"center",gap:16},cardContent:{flex:1,gap:6},cardTitle:{fontSize:16},cardBody:{fontSize:14,lineHeight:20},completedRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8},skeletonLine:{height:14,borderRadius:7,backgroundColor:"rgba(128, 128, 128, 0.15)",width:"80%",marginBottom:6},pendingHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:4,gap:8},pendingFooter:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},refreshBtn:{flexDirection:"row",alignItems:"center",gap:4,paddingVertical:2,paddingHorizontal:4},refreshText:{fontSize:12},footer:{paddingTop:12,gap:4},loaderRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:12}});var Bl={linkOnrampTerms:"https://link.com/terms/crypto-onramp",bridgeTerms:"https://www.bridge.xyz/legal/us-terms/bridge-building-inc",linkPrivacy:"https://link.com/privacy",bridgePrivacy:"https://www.bridge.xyz/legal/us-privacy-policy/bridge-building-inc"};function Xp({styles:e,merchantDisplayName:t="This app",onContinue:r,onClose:o}){let{colors:n,fonts:i,components:s}=V(),a=[vo.link,{color:n.primary,fontFamily:i.medium}],l=s.card.borderRadius??12;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(St,{onPress:o,title:"Verify Your Identity"}),jsxRuntime.jsx(reactNative.View,{style:vo.logoRow,children:jsxRuntime.jsx(ip,{height:20,color:n.foreground})}),jsxRuntime.jsxs(reactNative.ScrollView,{style:vo.scroll,contentContainerStyle:vo.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:[vo.card,{backgroundColor:s.card.backgroundColor,borderRadius:l,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[vo.sectionTitle,{color:n.foreground,fontFamily:i.semibold}],children:"Description"}),jsxRuntime.jsxs(reactNative.Text,{style:[vo.body,{color:n.foregroundMuted,fontFamily:i.regular}],children:["You must verify your identity using Link. ",t," will create or access your Link account on your behalf."]})]}),jsxRuntime.jsxs(reactNative.View,{style:[vo.card,{backgroundColor:s.card.backgroundColor,borderRadius:l,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[vo.sectionTitle,{color:n.foreground,fontFamily:i.semibold}],children:"Terms"}),jsxRuntime.jsxs(reactNative.Text,{style:[vo.body,{color:n.foregroundMuted,fontFamily:i.regular}],children:["Your data will be encrypted and processed by our partner, Stripe. Funds transfer services are provided by Stripe Payments Company. Cryptocurrency conversion services are provided by Bridge. By continuing you agree to the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(Bl.linkOnrampTerms),children:"Link Onramp Terms"}),","," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(Bl.bridgeTerms),children:"Bridge Terms"})," ","and you acknowledge receipt of the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(Bl.linkPrivacy),children:"Link US Consumer Privacy Notice"})," ","and the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(Bl.bridgePrivacy),children:"Bridge Privacy Notice"}),"."]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:vo.footer,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Continue"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:o,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Cancel"})})]})]})}var vo=reactNative.StyleSheet.create({logoRow:{paddingVertical:24,alignItems:"center"},scroll:{flex:1},scrollContent:{paddingTop:16,paddingBottom:16,gap:12},card:{padding:20,gap:10},sectionTitle:{fontSize:15},body:{fontSize:14,lineHeight:21},link:{textDecorationLine:"underline"},footer:{paddingTop:12,gap:4}});function em({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:i,email:s,setEmail:a,checkEmail:l,onClose:u}){let{colors:c}=V();return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(St,{onPress:u}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(nt,{size:56,strokeWidth:3}),jsxRuntime.jsx(Mr,{error:n,progress:i,loading:o})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(St,{onPress:u}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your email"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll check if you have a Link account or create one for you."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Email address"}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,o&&{opacity:.5}],placeholder:"jane@example.com",placeholderTextColor:t,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,value:s,onChangeText:a,autoFocus:true,returnKeyType:"done",onSubmitEditing:l,editable:!o})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[o?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(nt,{size:28,strokeWidth:2,gradientFrom:c.primaryForeground,gradientTo:c.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!s&&e.form.continueBtnDisabled],onPress:l,disabled:!s,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!s&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Mr,{error:n,progress:i,loading:o})]})]})})}function rm({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:i}){return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(St,{onPress:i}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(nt,{size:48,strokeWidth:3})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Verifying identity"}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:r||"Preparing identity verification..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(reactNative.Text,{style:e.flow.idIcon,children:"\u{1FAAA}"})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Identity verification"}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:r||"Tap below to continue verification."})]}),jsxRuntime.jsx(Mr,{error:o,progress:r,loading:false})]}),!t&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:n,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Continue Verification"})})})]})}function nm({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:i,destinationNetwork:s,tokenIconUrl:a,networkIconUrl:l,onClose:u,onRetryStatusCheck:c}){let{colors:y}=V(),T=!!t;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[T?jsxRuntime.jsx(St,{onPress:u}):jsxRuntime.jsx(reactNative.View,{style:Cl}),jsxRuntime.jsx(reactNative.View,{style:e.flow.centered,children:t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Could not confirm status"}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:"Your payment may still be completing. Try checking again, or close this screen and verify your wallet balance."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(nt,{size:48,strokeWidth:3,gradientFrom:y.primary,gradientTo:y.primary})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Processing your purchase"}),jsxRuntime.jsxs(reactNative.Text,{style:e.flow.sub,children:["Your payment has been confirmed.",`
|
|
2
|
-
`,"We're sending your crypto \u2014 this usually takes less than a minute."]}),n&&i&&s&&jsxRuntime.jsx(Sl,{sourceCurrency:n,destinationCurrency:i,destinationNetwork:s,tokenIconUrl:a,networkIconUrl:l,style:{marginTop:24,marginHorizontal:24}})]})}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[jsxRuntime.jsx(Mr,{error:t,progress:r,loading:o}),t?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:c,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function im({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:i,tokenIconUrl:s,networkIconUrl:a,onClose:l,onBack:u}){let{colors:c}=V(),y=t.transaction_details,T=bl(y.destination_amount,y.destination_currency);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(St,{onPress:u??l,title:"Review your purchase",variant:u?"back":"close"}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.View,{style:{alignItems:"center",marginTop:24,marginBottom:20},children:jsxRuntime.jsx(as,{currency:y.destination_currency,tokenIconUrl:s,networkIconUrl:a,size:64})}),jsxRuntime.jsxs(reactNative.View,{style:e.quote.card,children:[jsxRuntime.jsx(To,{quote:e.quote,label:"You pay",value:`${y.source_amount} ${y.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(To,{quote:e.quote,label:"You receive",value:`${T} ${y.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(To,{quote:e.quote,label:"Network fee",value:`$${y.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(To,{quote:e.quote,label:"Transaction fee",value:`$${y.fees.transaction_fee_amount}`,last:true})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(nt,{size:28,strokeWidth:2,gradientFrom:c.primaryForeground,gradientTo:c.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:i,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsxRuntime.jsx(Mr,{error:o,progress:n,loading:r})]})]})}function sm({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:i,phone:s,setPhone:a,register:l,onClose:u}){let c=V(),{colors:y,fonts:T,components:w}=c,[m,g]=ni.useState("");ni.useEffect(()=>{if(t)return;let b=m?`+1${m}`:"";a(b);},[m,a,t]);let h=ni.useCallback(b=>{g(b.replace(/[^\d]/g,""));},[]);if(t)return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(St,{onPress:u}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(nt,{size:56,strokeWidth:3}),jsxRuntime.jsx(Mr,{error:o,progress:n,loading:r})]})]});let S=m.length>=4;return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(St,{onPress:u}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your phone"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll send a verification code to confirm your number."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Phone number"}),jsxRuntime.jsxs(reactNative.View,{style:Sa.phoneRow,children:[jsxRuntime.jsxs(reactNative.View,{style:[Sa.countryPrefix,{backgroundColor:w.card.backgroundColor,borderColor:w.input.borderColor,borderRadius:w.input.borderRadius,borderWidth:w.card.borderWidth}],children:[jsxRuntime.jsx(reactNative.Text,{style:Sa.flag,children:"\u{1F1FA}\u{1F1F8}"}),jsxRuntime.jsx(reactNative.Text,{style:[Sa.dialCode,{color:y.foreground,fontFamily:T.medium}],children:"+1"})]}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,Sa.phoneInput,r&&{opacity:.5}],placeholder:"Phone number",placeholderTextColor:c.components.input.placeholderColor,keyboardType:"phone-pad",value:m,onChangeText:h,autoFocus:true,returnKeyType:"done",onSubmitEditing:()=>S&&l(),editable:!r})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.emailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.emailLabel,children:"Signing up as"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.emailValue,children:i})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(nt,{size:28,strokeWidth:2,gradientFrom:y.primaryForeground,gradientTo:y.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!S&&e.form.continueBtnDisabled],onPress:l,disabled:!S,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!S&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Mr,{error:o,progress:n,loading:r})]})]})})}var Sa=reactNative.StyleSheet.create({phoneRow:{flexDirection:"row",gap:8,alignItems:"stretch"},countryPrefix:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,gap:8},flag:{fontSize:20},dialCode:{fontSize:16,fontWeight:"600"},phoneInput:{flex:1}});function ky({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=V(),n=e.toLowerCase(),i=wl[n]??o.primary,s=Math.round(r*.36);return jsxRuntime.jsxs(reactNative.View,{style:{width:r,height:r,position:"relative"},children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:t},style:{width:r,height:r,borderRadius:r/2}}):jsxRuntime.jsx(reactNative.View,{style:[$o.tokenCircle,{width:r,height:r,borderRadius:r/2,backgroundColor:i}],children:jsxRuntime.jsx(reactNative.Text,{style:[$o.tokenLetter,{fontSize:r*.38}],children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),jsxRuntime.jsx(reactNative.View,{style:[$o.checkBadge,{width:s,height:s,borderRadius:s/2,backgroundColor:o.success,borderColor:o.background}],children:jsxRuntime.jsx(Le,{size:s*.55,color:"#FFFFFF",strokeWidth:3})})]})}function am({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:i,onDone:s}){let {colors:a,components:l,fonts:u}=V(),c=t.transaction_details,y=bl(c.destination_amount,c.destination_currency),T=r||o||"";ss(c.destination_network);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(St,{onPress:s,title:"Purchase complete"}),jsxRuntime.jsx(reactNative.View,{style:e.form.content,children:jsxRuntime.jsxs(at,{style:e.form.flex,contentContainerStyle:$o.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:$o.iconSection,children:[jsxRuntime.jsx(ky,{currency:c.destination_currency,tokenIconUrl:n,size:72}),jsxRuntime.jsxs(reactNative.View,{style:$o.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[$o.statusDot,{backgroundColor:a.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[$o.statusText,{color:a.foreground,fontFamily:u.semibold}],children:"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[$o.subtitle,{color:a.foregroundMuted}],children:"Your crypto is on its way to your wallet."})]}),jsxRuntime.jsx(Sl,{sourceCurrency:c.source_currency,destinationCurrency:c.destination_currency,destinationNetwork:c.destination_network,tokenIconUrl:n,networkIconUrl:i,style:{marginBottom:12}}),jsxRuntime.jsxs(reactNative.View,{style:[e.quote.card,{borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor},$o.detailCard],children:[jsxRuntime.jsx(To,{quote:e.quote,label:"You Paid",value:`${c.source_amount} ${c.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(To,{quote:e.quote,label:"You Received",value:`${y} ${c.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(To,{quote:e.quote,label:"Network Fee",value:`$${c.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(To,{quote:e.quote,label:"Transaction Fee",value:`$${c.fees.transaction_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(fd,{quote:e.quote,label:"Intent Address",address:c.wallet_address,hideDivider:true}),T?jsxRuntime.jsx(fd,{quote:e.quote,label:"Recipient Address",address:T,last:true}):jsxRuntime.jsx(To,{quote:e.quote,label:"Session",value:t.id.slice(0,8)+"..."+t.id.slice(-6),last:true})]})]})}),jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:s,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Done"})})})]})}var $o=reactNative.StyleSheet.create({scrollContent:{paddingBottom:24,alignItems:"center"},iconSection:{alignItems:"center",marginTop:24,marginBottom:24},tokenCircle:{alignItems:"center",justifyContent:"center"},tokenLetter:{color:"#FFFFFF",fontWeight:"700",letterSpacing:.5},checkBadge:{position:"absolute",bottom:0,right:0,alignItems:"center",justifyContent:"center",borderWidth:3},statusRow:{flexDirection:"row",alignItems:"center",marginTop:16,gap:6},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},subtitle:{fontSize:14,marginTop:4},detailCard:{width:"100%"}});function lm({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:i,walletNetwork:s,setWalletAddress:a,setWalletNetwork:l,setDestinationCurrency:u,registerWallet:c,onClose:y}){let{colors:T,components:w}=V();if(t){let m=!r&&!!o;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(St,{onPress:y}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[!m&&jsxRuntime.jsx(nt,{size:56,strokeWidth:3}),jsxRuntime.jsx(Mr,{error:o,progress:n,loading:r})]}),m&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:c,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Retry"})})})]})}return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(St,{onPress:y}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Your crypto wallet"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"Enter the wallet address where you'd like to receive your crypto."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Wallet address"}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,e.wallet.input],placeholder:"0x...",placeholderTextColor:w.input.placeholderColor,autoCapitalize:"none",autoCorrect:false,value:i,onChangeText:a})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Network"}),jsxRuntime.jsx(reactNative.View,{style:e.wallet.list,children:gl.map(m=>{let g=s===m.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,g&&e.wallet.rowSelected],onPress:()=>{l(m.value),u(m.defaultCrypto);},children:[jsxRuntime.jsx(reactNative.View,{style:e.wallet.iconWrap,children:jsxRuntime.jsx(m.Icon,{size:24})}),jsxRuntime.jsx(reactNative.Text,{style:[e.wallet.rowText,g&&e.wallet.rowTextSelected],children:m.label}),g&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx(Le,{size:14,color:w.container.buttonTitleColor,strokeWidth:2.5})})]},m.value)})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(nt,{size:28,strokeWidth:2,gradientFrom:T.primaryForeground,gradientTo:T.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:c,disabled:!i,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Mr,{error:o,progress:n,loading:r})]})]})})}function Ul({config:e,onClose:t}){let r=V(),o=Wo(),{step:n,restoring:i,loading:s,status:a,error:l,email:u,phone:c,session:y,kycData:T,walletAddress:w,resolvedRecipientAddress:m,walletNetwork:g,sourceAmount:h,sourceCurrency:S,destinationCurrency:b,tokenIconUrl:p,networkIconUrl:d,applePaySupported:C,setStep:x,setEmail:_,setPhone:k,setWalletAddress:v,setWalletNetwork:M,setSourceAmount:W,setDestinationCurrency:O,checkEmail:F,register:U,attachKyc:j,verifyIdentity:le,registerWallet:Ye,collectPaymentMethod:_e,addPaymentMethod:ne,confirmCheckout:we,reset:fe,emitComplete:Pe,resumeFulfillmentPolling:$e,amountFirst:ue,customerId:J,accessToken:be,requestKYCUpgrade:vt,kycUpgradeMode:ve,logout:qe}=Fl(e),Ne=!!e?.email,Ve=!!e?.phone,ze=!!e?.publishableKey&&!!e?.externalUserId,[it,ie]=ni.useState(void 0),[pe,et]=ni.useState(void 0),[Ae,Ke]=ni.useState([]),[$t,Ee]=ni.useState(false),[Oe,ar]=ni.useState(false),[he,X]=ni.useState("not_started"),[Ce,pt]=ni.useState("not_started"),[It,me]=ni.useState("not_started"),[je,Vt]=ni.useState(false);ni.useEffect(()=>{n!=="kyc_offer"||!J||!be||(Vt(true),Mn(J,be).then(Se=>{let Z=Se.kyc_tiers??[],Q=Z.find(D=>D.tier==="l0"),L=Z.find(D=>D.tier==="l1"),I=Z.find(D=>D.tier==="l2");Q?.verification_status&&X(Q.verification_status),L?.verification_status&&pt(L.verification_status),I?.verification_status&&me(I.verification_status),console.log("[OnrampScreen] kyc_tiers \u2014 l0:",Q?.verification_status,"l1:",L?.verification_status,"l2:",I?.verification_status);}).catch(Se=>{console.warn("[OnrampScreen] kyc_offer customer fetch error:",Se?.message);}).finally(()=>Vt(false)),w&&bd({destinationNetwork:g||"ethereum",walletAddress:w,accessToken:be,cryptoCustomerId:J}).then(Se=>{let Z=Se.limits?.usd;if(Z?.card?.length){let Q=Math.max(...Z.card.map(L=>L.limit));ie(Q),console.log("[OnrampScreen] kyc_offer card max amount:",Q);}}).catch(Se=>{console.warn("[OnrampScreen] kyc_offer transaction_limits error:",Se?.message);}));},[n,J,be,w,g]),ni.useEffect(()=>{if(i||n!=="session_params"||!J||!be)return;console.log("[OnrampScreen] customerId:",J);let Se=Q=>{let L=Q?.message??"";return L.includes("stripe_onramp_forbidden")||L.includes("403")},Z=Q=>{Se(Q)&&(hn(),fe());};Mn(J,be).then(Q=>{console.log("[OnrampScreen] customer:",JSON.stringify(Q,null,2));let L=Q.provided_fields??[],I=Q.verifications??[],D=L.includes("date_of_birth")||L.includes("id_number"),Fe=I.find(ke=>ke.name==="id_document_verified")?.status==="verified";Ee(D),ar(!!Fe);}).catch(Q=>{console.warn("[OnrampScreen] customer fetch error:",Q?.message),Z(Q);}),Cd(J,be).then(Q=>{console.log("[OnrampScreen] payment_tokens fetched, count:",Q.data?.length??0),Ke(Q.data??[]);}).catch(Q=>{console.warn("[OnrampScreen] payment_tokens error:",Q?.message),Z(Q);}),console.log("[OnrampScreen] walletAddress:",w,"walletNetwork:",g),w&&(console.log("[OnrampScreen] calling getTransactionLimits..."),bd({destinationNetwork:g||"ethereum",walletAddress:w,accessToken:be,cryptoCustomerId:J}).then(Q=>{console.log("[OnrampScreen] transaction_limits fetched");let L=Q.limits?.usd;if(L?.card?.length){let I=Math.max(...L.card.map(D=>D.limit));ie(I),console.log("[OnrampScreen] card max amount:",I);}}).catch(Q=>{console.warn("[OnrampScreen] transaction_limits error:",Q?.message),Z(Q);})),aa(e?.publishableKey).then(Q=>{let L=Q.data?.find(I=>I.currency_code==="usd");L&&(et(L.minimum_amount),console.log("[OnrampScreen] fiat min amount:",L.minimum_amount));}).catch(Q=>{console.warn("[OnrampScreen] fiat_currencies error:",Q?.message);});},[i,n,J,be,w,g,fe]);let ot=async()=>{if(!(!J||!be))try{let Se=await Cd(J,be);console.log("[OnrampScreen] payment_tokens refreshed, count:",Se.data?.length??0),Ke(Se.data??[]);}catch(Se){console.warn("[OnrampScreen] payment_tokens refresh error:",Se?.message);let Z=Se?.message??"";(Z.includes("stripe_onramp_forbidden")||Z.includes("403"))&&(hn(),fe());}},Lt=async()=>{let Se=await ne();return Se&&await ot(),Se},Bt=e?.skipSuccessConfirmation===true;ni.useEffect(()=>{n==="success"&&Bt&&y&&(Pe(y),fe(),t?.());},[n,Bt,y,Pe,fe,t]),ni.useEffect(()=>{n==="register"&&Ve&&U();},[n,Ve,U]);let yt=()=>{fe(),t?.();};if(i)return jsxRuntime.jsx(reactNative.View,{style:[Iy.container,{backgroundColor:r.colors.background}],children:jsxRuntime.jsx(nt,{size:56,strokeWidth:3,gradientFrom:r.colors.primary,gradientTo:r.colors.primary})});if(n==="disclaimer")return jsxRuntime.jsx(Xp,{styles:o,merchantDisplayName:e?.merchantDisplayName,onContinue:()=>x("register"),onClose:()=>x("email")});if(n==="email")return jsxRuntime.jsx(em,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:Ne,loading:s,error:l,status:a,email:u,setEmail:_,checkEmail:F,onClose:yt});if(n==="register")return jsxRuntime.jsx(sm,{styles:o,hasPrefilledPhone:Ve,loading:s,error:l,status:a,email:u,phone:c,setPhone:k,register:U,onClose:yt});if(n==="kyc")return jsxRuntime.jsx(Ol,{initialData:T,loading:s,onComplete:j,onCancel:yt});if(n==="kyc_offer"){let Se=()=>{ve.current&&(ve.current=false),x("session_params");};return jsxRuntime.jsx(Jp,{onSelectL1:()=>x("kyc_l1"),onSelectL2:()=>{ve.current=true,x("identity");},onSkip:Se,onClose:()=>{ve.current?(ve.current=false,x("session_params")):Se();},onRefresh:()=>{!J||!be||(Vt(true),Mn(J,be).then(L=>{let I=L.kyc_tiers??[],D=I.find(ke=>ke.tier==="l0"),q=I.find(ke=>ke.tier==="l1"),Fe=I.find(ke=>ke.tier==="l2");D?.verification_status&&X(D.verification_status),q?.verification_status&&pt(q.verification_status),Fe?.verification_status&&me(Fe.verification_status),console.log("[OnrampScreen] refresh kyc_tiers \u2014 l0:",D?.verification_status,"l1:",q?.verification_status,"l2:",Fe?.verification_status);}).catch(L=>{console.warn("[OnrampScreen] refresh customer fetch error:",L?.message);}).finally(()=>Vt(false)));},loading:s,loadingTiers:je,error:l?.message,l0Status:he,l1Status:Ce,l2Status:It,l1Completed:$t,l2Completed:Oe,currentLimit:it})}if(n==="kyc_l1"){let Se=ve.current?"session_params":"wallet";return jsxRuntime.jsx(qp,{initialData:T,loading:s,onComplete:Z=>{console.log("[KYCL1] onComplete called with:",JSON.stringify(Z)),ve.current&&(ve.current=false),j(Z,Se);},onCancel:()=>x("kyc_offer"),onClose:yt})}return n==="identity"?jsxRuntime.jsx(rm,{styles:o,loading:s,status:a,error:l,verifyIdentity:le,onClose:()=>{ve.current?(ve.current=false,x("session_params")):yt();}}):n==="wallet"?jsxRuntime.jsx(lm,{styles:o,hasAutoWallet:ze,loading:s,error:l,status:a,walletAddress:w,walletNetwork:g,setWalletAddress:v,setWalletNetwork:M,setDestinationCurrency:O,registerWallet:Ye,onClose:yt}):n==="session_params"?jsxRuntime.jsx(Pl,{initialAmount:h,currency:S,applePaySupported:C,paymentSelectorPosition:e?.paymentSelectorPosition??"header",minAmount:pe,maxAmount:it,paymentTokens:Ae,onAddPaymentMethod:Lt,onCollectPayment:(Se,Z)=>{_e(Se,Z);},paymentLoading:s,paymentStatus:a,paymentError:l?.message??null,onConfirm:(Se,Z)=>{if(console.log("[OnrampScreen] onConfirm called:",{amount:Se,selectedMethod:Z,amountFirst:ue}),ue&&!J)W(Se),x("email");else {let Q=Z==="apple_pay",L=!Q&&Z?Z:void 0;console.log("[OnrampScreen] isApplePay:",Q,"hasSavedToken:",!!L),_e(Q,Se,L);}},onCancel:yt,accessToken:be,showHistoryProgressBar:e?.showHistoryProgressBar,onLogout:qe,onRequestKYC:vt}):n==="quote"&&y?jsxRuntime.jsx(im,{styles:o,session:y,loading:s,error:l,status:a,confirmCheckout:we,tokenIconUrl:p,networkIconUrl:d,onClose:yt,onBack:()=>x("session_params")}):n==="processing"?jsxRuntime.jsx(nm,{styles:o,error:l,status:a,loading:s,sourceCurrency:y?.transaction_details.source_currency,destinationCurrency:y?.transaction_details.destination_currency??b,destinationNetwork:y?.transaction_details.destination_network??"base",tokenIconUrl:p,networkIconUrl:d,onClose:yt,onRetryStatusCheck:$e}):n==="success"&&y&&!Bt?jsxRuntime.jsx(am,{styles:o,session:y,resolvedRecipientAddress:m,recipientFromConfig:e?.recipientAddress,tokenIconUrl:p,networkIconUrl:d,onDone:()=>{Pe(y),fe(),t?.();}}):null}var Iy=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center"}});function cm(){try{let e=Py__default.default.expoConfig?.plugins;if(!Array.isArray(e))return;for(let t of e){if(!Array.isArray(t))continue;let[r,o]=t;if(r!=="@stripe/stripe-react-native"||!o||typeof o!="object")continue;let n=o.merchantIdentifier;if(typeof n=="string"){let i=n.trim();if(i.length>0)return i}}}catch{}}function Hl({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:i="ethereum",destinationChainId:s="8453",destinationTokenAddress:a,recipientAddress:l,onComplete:u,onError:c,onStepChange:y,onClose:T,merchantIdentifier:w="",urlScheme:m="unifoldOnramp",paymentSelectorPosition:g,skipSuccessConfirmation:h=false,appName:S}){let{colors:b,fonts:p,components:d}=V(),C=e||dl(),x=ni.useMemo(()=>{let O=w.trim();return O.length>0?O:cm()??""},[w]),[_,k]=ni.useState("loading"),[v,M]=ni.useState(null);ni.useEffect(()=>{let O=false;async function F(){try{C&&(kl(C),Tl(sa()));let U=await xl();if(O)return;let j=x.trim();if(await stripeReactNative.initStripe({publishableKey:U,urlScheme:m,...j?{merchantIdentifier:j}:{}}),O)return;k("ready");}catch(U){if(O)return;console.error("[StripeOnramp] Init failed:",U),M(U?.message??"Failed to load Stripe configuration"),k("error");}}return F(),()=>{O=true;}},[C,x,m]);let W=ni.useMemo(()=>{let O={publishableKey:C,externalUserId:o,destinationChainType:i,destinationChainId:s,onComplete:u,onError:c,onStepChange:y};return a&&(O.destinationTokenAddress=a),l&&(O.recipientAddress=l),t&&(O.email=t),r&&(O.phone=r),n&&(O.flowOrder=n),g&&(O.paymentSelectorPosition=g),O.skipSuccessConfirmation=h,O.merchantIdentifier=x,S&&(O.merchantDisplayName=S),O},[C,o,i,s,a,l,t,r,n,g,h,x,S,u,c,y]);return _==="error"?jsxRuntime.jsxs(reactNative.View,{style:[ys.centered,{backgroundColor:b.background}],children:[jsxRuntime.jsx(reactNative.Text,{style:[ys.errorText,{color:b.error,fontFamily:p.medium}],children:"Unable to initialize"}),jsxRuntime.jsx(reactNative.Text,{style:[ys.errorDetail,{color:b.foregroundMuted,fontFamily:p.regular}],children:v}),T&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ys.retryBtn,{backgroundColor:d.button.primaryBackground,borderRadius:d.button.borderRadius}],onPress:T,children:jsxRuntime.jsx(reactNative.Text,{style:[ys.retryBtnText,{color:d.button.primaryText,fontFamily:p.medium}],children:"Go Back"})})]}):_==="loading"?jsxRuntime.jsx(reactNative.View,{style:[ys.centered,{backgroundColor:b.background}],children:jsxRuntime.jsx(nt,{size:56,strokeWidth:3,gradientFrom:b.primary,gradientTo:b.primary})}):jsxRuntime.jsx(Ul,{config:W,onClose:T})}var ys=reactNative.StyleSheet.create({centered:{flex:1,justifyContent:"center",alignItems:"center",paddingHorizontal:24},errorText:{fontSize:18,marginBottom:8},errorDetail:{fontSize:14,textAlign:"center",marginBottom:24},retryBtn:{paddingVertical:14,paddingHorizontal:32},retryBtnText:{fontSize:16}});function mm(){let{configure:e}=stripeReactNative.useOnramp(),t=ni.useRef(false);return ni.useEffect(()=>{t.current||(t.current=true,e({merchantDisplayName:"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(r=>{r.error&&console.error("[StripeOnrampPreconfigure] error:",r.error.message);}).catch(r=>{console.error("[StripeOnrampPreconfigure] threw:",r?.message);}));},[e]),null}var fm="__unifold_stripe_onramp__";function Nl(e){globalThis[fm]=e;}function hm(){return globalThis[fm]}Nl(Hl);var qo=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this);}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe();}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var _i,Gn,bs,gm,Ey=(gm=class extends qo{constructor(){super();te(this,_i);te(this,Gn);te(this,bs);A(this,bs,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){f(this,Gn)||this.setEventListener(f(this,bs));}onUnsubscribe(){var t;this.hasListeners()||((t=f(this,Gn))==null||t.call(this),A(this,Gn,void 0));}setEventListener(t){var r;A(this,bs,t),(r=f(this,Gn))==null||r.call(this),A(this,Gn,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){f(this,_i)!==t&&(A(this,_i,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof f(this,_i)=="boolean"?f(this,_i):globalThis.document?.visibilityState!=="hidden"}},_i=new WeakMap,Gn=new WeakMap,bs=new WeakMap,gm),Cs=new Ey;var My={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Ko,Ri,ym,zy=(ym=class{constructor(){te(this,Ko,My);te(this,Ri,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&f(this,Ri)&&e!==f(this,Ko)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:f(this,Ko),provider:e}),A(this,Ko,e),process.env.NODE_ENV!=="production"&&A(this,Ri,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&A(this,Ri,true),f(this,Ko).setTimeout(e,t)}clearTimeout(e){f(this,Ko).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&A(this,Ri,true),f(this,Ko).setInterval(e,t)}clearInterval(e){f(this,Ko).clearInterval(e);}},Ko=new WeakMap,Ri=new WeakMap,ym),Qo=new zy;function bm(e){setTimeout(e,0);}var Md=typeof window>"u"||"Deno"in globalThis;function br(){}function Sm(e,t){return typeof e=="function"?e(t):e}function ka(e){return typeof e=="number"&&e>=0&&e!==1/0}function $l(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Io(e,t){return typeof e=="function"?e(t):e}function Yr(e,t){return typeof e=="function"?e(t):e}function ql(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:i,queryKey:s,stale:a}=e;if(s){if(o){if(t.queryHash!==Ta(s,t.options))return false}else if(!Pi(t.queryKey,s))return false}if(r!=="all"){let l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return false}return !(typeof a=="boolean"&&t.isStale()!==a||n&&n!==t.state.fetchStatus||i&&!i(t))}function Kl(e,t){let{exact:r,status:o,predicate:n,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return false;if(r){if(vi(t.options.mutationKey)!==vi(i))return false}else if(!Pi(t.options.mutationKey,i))return false}return !(o&&t.state.status!==o||n&&!n(t))}function Ta(e,t){return (t?.queryKeyHashFn||vi)(e)}function vi(e){return JSON.stringify(e,(t,r)=>Ed(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function Pi(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Pi(e[r],t[r])):false}var Uy=Object.prototype.hasOwnProperty;function jl(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=Cm(e)&&Cm(t);if(!o&&!(Ed(e)&&Ed(t)))return t;let i=(o?e:Object.keys(e)).length,s=o?t:Object.keys(t),a=s.length,l=o?new Array(a):{},u=0;for(let c=0;c<a;c++){let y=o?c:s[c],T=e[y],w=t[y];if(T===w){l[y]=T,(o?c<i:Uy.call(e,y))&&u++;continue}if(T===null||w===null||typeof T!="object"||typeof w!="object"){l[y]=w;continue}let m=jl(T,w,r+1);l[y]=m,m===T&&u++;}return i===a&&u===i?e:l}function Ql(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return false;for(let r in e)if(e[r]!==t[r])return false;return true}function Cm(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ed(e){if(!wm(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!wm(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function wm(e){return Object.prototype.toString.call(e)==="[object Object]"}function km(e){return new Promise(t=>{Qo.setTimeout(t,e);})}function xa(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==false){if(process.env.NODE_ENV!=="production")try{return jl(e,t)}catch(o){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${o}`),o}return jl(e,t)}return t}function Tm(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function xm(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var Ii=Symbol();function Yl(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Ii&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Ii?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Gl(e,t){return typeof e=="function"?e(...t):!!e}function _m(e,t,r){let o=false,n;return Object.defineProperty(e,"signal",{enumerable:true,get:()=>(n??(n=t()),o||(o=true,n.aborted?r():n.addEventListener("abort",r,{once:true})),n)}),e}var Yo=(()=>{let e=()=>Md;return {isServer(){return e()},setIsServer(t){e=t;}}})();function _a(){let e,t,r=new Promise((n,i)=>{e=n,t=i;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var Rm=bm;function Hy(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=Rm,i=a=>{t?e.push(a):n(()=>{r(a);});},s=()=>{let a=e;e=[],a.length&&n(()=>{o(()=>{a.forEach(l=>{r(l);});});});};return {batch:a=>{let l;t++;try{l=a();}finally{t--,t||s();}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l);});},schedule:i,setNotifyFunction:a=>{r=a;},setBatchNotifyFunction:a=>{o=a;},setScheduler:a=>{n=a;}}}var Ht=Hy();var ws,Jn,Ss,vm,Ny=(vm=class extends qo{constructor(){super();te(this,ws,true);te(this,Jn);te(this,Ss);A(this,Ss,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t(true),o=()=>t(false);return window.addEventListener("online",r,false),window.addEventListener("offline",o,false),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o);}}});}onSubscribe(){f(this,Jn)||this.setEventListener(f(this,Ss));}onUnsubscribe(){var t;this.hasListeners()||((t=f(this,Jn))==null||t.call(this),A(this,Jn,void 0));}setEventListener(t){var r;A(this,Ss,t),(r=f(this,Jn))==null||r.call(this),A(this,Jn,t(this.setOnline.bind(this)));}setOnline(t){f(this,ws)!==t&&(A(this,ws,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return f(this,ws)}},ws=new WeakMap,Jn=new WeakMap,Ss=new WeakMap,vm),ks=new Ny;function jy(e){return Math.min(1e3*2**e,3e4)}function zd(e){return (e??"online")==="online"?ks.isOnline():true}var Jl=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function Zl(e){let t=false,r=0,o,n=_a(),i=()=>n.status!=="pending",s=g=>{if(!i()){let h=new Jl(g);T(h),e.onCancel?.(h);}},a=()=>{t=true;},l=()=>{t=false;},u=()=>Cs.isFocused()&&(e.networkMode==="always"||ks.isOnline())&&e.canRun(),c=()=>zd(e.networkMode)&&e.canRun(),y=g=>{i()||(o?.(),n.resolve(g));},T=g=>{i()||(o?.(),n.reject(g));},w=()=>new Promise(g=>{o=h=>{(i()||u())&&g(h);},e.onPause?.();}).then(()=>{o=void 0,i()||e.onContinue?.();}),m=()=>{if(i())return;let g,h=r===0?e.initialPromise:void 0;try{g=h??e.fn();}catch(S){g=Promise.reject(S);}Promise.resolve(g).then(y).catch(S=>{if(i())return;let b=e.retry??(Yo.isServer()?0:3),p=e.retryDelay??jy,d=typeof p=="function"?p(r,S):p,C=b===true||typeof b=="number"&&r<b||typeof b=="function"&&b(r,S);if(t||!C){T(S);return}r++,e.onFail?.(r,S),km(d).then(()=>u()?void 0:w()).then(()=>{t?T(S):m();});});};return {promise:n,status:()=>n.status,cancel:s,continue:()=>(o?.(),n),cancelRetry:a,continueRetry:l,canStart:c,start:()=>(c()?m():w().then(m),n)}}var Oi,Im,Xl=(Im=class{constructor(){te(this,Oi);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),ka(this.gcTime)&&A(this,Oi,Qo.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Yo.isServer()?1/0:300*1e3));}clearGcTimeout(){f(this,Oi)!==void 0&&(Qo.clearTimeout(f(this,Oi)),A(this,Oi,void 0));}},Oi=new WeakMap,Im);var Fi,Ts,Co,Di,Ir,Ra,Vi,lo,Vm,bn,Fm,Dm=(Fm=class extends Xl{constructor(t){super();te(this,lo);te(this,Fi);te(this,Ts);te(this,Co);te(this,Di);te(this,Ir);te(this,Ra);te(this,Vi);A(this,Vi,false),A(this,Ra,t.defaultOptions),this.setOptions(t.options),this.observers=[],A(this,Di,t.client),A(this,Co,f(this,Di).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,A(this,Fi,Om(this.options)),this.state=t.state??f(this,Fi),this.scheduleGc();}get meta(){return this.options.meta}get promise(){return f(this,Ir)?.promise}setOptions(t){if(this.options={...f(this,Ra),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=Om(this.options);r.data!==void 0&&(this.setState(Pm(r.data,r.dataUpdatedAt)),A(this,Fi,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&f(this,Co).remove(this);}setData(t,r){let o=xa(this.state.data,t,this.options);return Ue(this,lo,bn).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t,r){Ue(this,lo,bn).call(this,{type:"setState",state:t,setStateOptions:r});}cancel(t){let r=f(this,Ir)?.promise;return f(this,Ir)?.cancel(t),r?r.then(br).catch(br):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return f(this,Fi)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>Yr(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ii||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Io(t.options.staleTime,this)==="static"):false}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?true:t==="static"?false:this.state.isInvalidated?true:!$l(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),f(this,Ir)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),f(this,Ir)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),f(this,Co).notify({type:"observerAdded",query:this,observer:t}));}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(f(this,Ir)&&(f(this,Vi)||Ue(this,lo,Vm).call(this)?f(this,Ir).cancel({revert:true}):f(this,Ir).cancelRetry()),this.scheduleGc()),f(this,Co).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ue(this,lo,bn).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&f(this,Ir)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(f(this,Ir))return f(this,Ir).continueRetry(),f(this,Ir).promise}if(t&&this.setOptions(t),!this.options.queryFn){let l=this.observers.find(u=>u.options.queryFn);l&&this.setOptions(l.options);}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));let o=new AbortController,n=l=>{Object.defineProperty(l,"signal",{enumerable:true,get:()=>(A(this,Vi,true),o.signal)});},i=()=>{let l=Yl(this.options,r),c=(()=>{let y={client:f(this,Di),queryKey:this.queryKey,meta:this.meta};return n(y),y})();return A(this,Vi,false),this.options.persister?this.options.persister(l,c,this):l(c)},a=(()=>{let l={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:f(this,Di),state:this.state,fetchFn:i};return n(l),l})();this.options.behavior?.onFetch(a,this),A(this,Ts,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&Ue(this,lo,bn).call(this,{type:"fetch",meta:a.fetchOptions?.meta}),A(this,Ir,Zl({initialPromise:r?.initialPromise,fn:a.fetchFn,onCancel:l=>{l instanceof Jl&&l.revert&&this.setState({...f(this,Ts),fetchStatus:"idle"}),o.abort();},onFail:(l,u)=>{Ue(this,lo,bn).call(this,{type:"failed",failureCount:l,error:u});},onPause:()=>{Ue(this,lo,bn).call(this,{type:"pause"});},onContinue:()=>{Ue(this,lo,bn).call(this,{type:"continue"});},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>true}));try{let l=await f(this,Ir).start();if(l===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(l),f(this,Co).config.onSuccess?.(l,this),f(this,Co).config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof Jl){if(l.silent)return f(this,Ir).promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw Ue(this,lo,bn).call(this,{type:"error",error:l}),f(this,Co).config.onError?.(l,this),f(this,Co).config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc();}}},Fi=new WeakMap,Ts=new WeakMap,Co=new WeakMap,Di=new WeakMap,Ir=new WeakMap,Ra=new WeakMap,Vi=new WeakMap,lo=new WeakSet,Vm=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},bn=function(t){let r=o=>{switch(t.type){case "failed":return {...o,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case "pause":return {...o,fetchStatus:"paused"};case "continue":return {...o,fetchStatus:"fetching"};case "fetch":return {...o,...Ud(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...Pm(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return A(this,Ts,t.manual?n:void 0),n;case "error":let i=t.error;return {...o,error:i,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:true};case "invalidate":return {...o,isInvalidated:true};case "setState":return {...o,...t.state}}};this.state=r(this.state),Ht.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),f(this,Co).notify({query:this,type:"updated",action:t});});},Fm);function Ud(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:zd(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Pm(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function Om(e){let t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,o=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return {data:t,dataUpdateCount:0,dataUpdatedAt:r?o??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:false,status:r?"success":"pending",fetchStatus:"idle"}}var Gr,Je,Ia,zr,Li,xs,Cn,Zn,Pa,_s,Rs,Bi,Wi,Xn,vs,ft,va,Hd,Nd,jd,$d,qd,Kd,Qd,Am,Wm,Gd=(Wm=class extends qo{constructor(t,r){super();te(this,ft);te(this,Gr);te(this,Je);te(this,Ia);te(this,zr);te(this,Li);te(this,xs);te(this,Cn);te(this,Zn);te(this,Pa);te(this,_s);te(this,Rs);te(this,Bi);te(this,Wi);te(this,Xn);te(this,vs,new Set);this.options=r,A(this,Gr,t),A(this,Zn,null),A(this,Cn,_a()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(f(this,Je).addObserver(this),Lm(f(this,Je),this.options)?Ue(this,ft,va).call(this):this.updateResult(),Ue(this,ft,$d).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return Yd(f(this,Je),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Yd(f(this,Je),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ue(this,ft,qd).call(this),Ue(this,ft,Kd).call(this),f(this,Je).removeObserver(this);}setOptions(t){let r=this.options,o=f(this,Je);if(this.options=f(this,Gr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Yr(this.options.enabled,f(this,Je))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ue(this,ft,Qd).call(this),f(this,Je).setOptions(this.options),r._defaulted&&!Ql(this.options,r)&&f(this,Gr).getQueryCache().notify({type:"observerOptionsUpdated",query:f(this,Je),observer:this});let n=this.hasListeners();n&&Bm(f(this,Je),o,this.options,r)&&Ue(this,ft,va).call(this),this.updateResult(),n&&(f(this,Je)!==o||Yr(this.options.enabled,f(this,Je))!==Yr(r.enabled,f(this,Je))||Io(this.options.staleTime,f(this,Je))!==Io(r.staleTime,f(this,Je)))&&Ue(this,ft,Hd).call(this);let i=Ue(this,ft,Nd).call(this);n&&(f(this,Je)!==o||Yr(this.options.enabled,f(this,Je))!==Yr(r.enabled,f(this,Je))||i!==f(this,Xn))&&Ue(this,ft,jd).call(this,i);}getOptimisticResult(t){let r=f(this,Gr).getQueryCache().build(f(this,Gr),t),o=this.createResult(r,t);return qy(this,o)&&(A(this,zr,o),A(this,xs,this.options),A(this,Li,f(this,Je).state)),o}getCurrentResult(){return f(this,zr)}trackResult(t,r){return new Proxy(t,{get:(o,n)=>(this.trackProp(n),r?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&f(this,Cn).status==="pending"&&f(this,Cn).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){f(this,vs).add(t);}getCurrentQuery(){return f(this,Je)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=f(this,Gr).defaultQueryOptions(t),o=f(this,Gr).getQueryCache().build(f(this,Gr),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return Ue(this,ft,va).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),f(this,zr)))}createResult(t,r){let o=f(this,Je),n=this.options,i=f(this,zr),s=f(this,Li),a=f(this,xs),u=t!==o?t.state:f(this,Ia),{state:c}=t,y={...c},T=false,w;if(r._optimisticResults){let v=this.hasListeners(),M=!v&&Lm(t,r),W=v&&Bm(t,o,r,n);(M||W)&&(y={...y,...Ud(c.data,t.options)}),r._optimisticResults==="isRestoring"&&(y.fetchStatus="idle");}let{error:m,errorUpdatedAt:g,status:h}=y;w=y.data;let S=false;if(r.placeholderData!==void 0&&w===void 0&&h==="pending"){let v;i?.isPlaceholderData&&r.placeholderData===a?.placeholderData?(v=i.data,S=true):v=typeof r.placeholderData=="function"?r.placeholderData(f(this,Rs)?.state.data,f(this,Rs)):r.placeholderData,v!==void 0&&(h="success",w=xa(i?.data,v,r),T=true);}if(r.select&&w!==void 0&&!S)if(i&&w===s?.data&&r.select===f(this,Pa))w=f(this,_s);else try{A(this,Pa,r.select),w=r.select(w),w=xa(i?.data,w,r),A(this,_s,w),A(this,Zn,null);}catch(v){A(this,Zn,v);}f(this,Zn)&&(m=f(this,Zn),w=f(this,_s),g=Date.now(),h="error");let b=y.fetchStatus==="fetching",p=h==="pending",d=h==="error",C=p&&b,x=w!==void 0,k={status:h,fetchStatus:y.fetchStatus,isPending:p,isSuccess:h==="success",isError:d,isInitialLoading:C,isLoading:C,data:w,dataUpdatedAt:y.dataUpdatedAt,error:m,errorUpdatedAt:g,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:y.dataUpdateCount>u.dataUpdateCount||y.errorUpdateCount>u.errorUpdateCount,isFetching:b,isRefetching:b&&!p,isLoadingError:d&&!x,isPaused:y.fetchStatus==="paused",isPlaceholderData:T,isRefetchError:d&&x,isStale:Jd(t,r),refetch:this.refetch,promise:f(this,Cn),isEnabled:Yr(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let v=k.data!==void 0,M=k.status==="error"&&!v,W=U=>{M?U.reject(k.error):v&&U.resolve(k.data);},O=()=>{let U=A(this,Cn,k.promise=_a());W(U);},F=f(this,Cn);switch(F.status){case "pending":t.queryHash===o.queryHash&&W(F);break;case "fulfilled":(M||k.data!==F.value)&&O();break;case "rejected":(!M||k.error!==F.reason)&&O();break}}return k}updateResult(){let t=f(this,zr),r=this.createResult(f(this,Je),this.options);if(A(this,Li,f(this,Je).state),A(this,xs,this.options),f(this,Li).data!==void 0&&A(this,Rs,f(this,Je)),Ql(r,t))return;A(this,zr,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,i=typeof n=="function"?n():n;if(i==="all"||!i&&!f(this,vs).size)return true;let s=new Set(i??f(this,vs));return this.options.throwOnError&&s.add("error"),Object.keys(f(this,zr)).some(a=>{let l=a;return f(this,zr)[l]!==t[l]&&s.has(l)})};Ue(this,ft,Am).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ue(this,ft,$d).call(this);}},Gr=new WeakMap,Je=new WeakMap,Ia=new WeakMap,zr=new WeakMap,Li=new WeakMap,xs=new WeakMap,Cn=new WeakMap,Zn=new WeakMap,Pa=new WeakMap,_s=new WeakMap,Rs=new WeakMap,Bi=new WeakMap,Wi=new WeakMap,Xn=new WeakMap,vs=new WeakMap,ft=new WeakSet,va=function(t){Ue(this,ft,Qd).call(this);let r=f(this,Je).fetch(this.options,t);return t?.throwOnError||(r=r.catch(br)),r},Hd=function(){Ue(this,ft,qd).call(this);let t=Io(this.options.staleTime,f(this,Je));if(Yo.isServer()||f(this,zr).isStale||!ka(t))return;let o=$l(f(this,zr).dataUpdatedAt,t)+1;A(this,Bi,Qo.setTimeout(()=>{f(this,zr).isStale||this.updateResult();},o));},Nd=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(f(this,Je)):this.options.refetchInterval)??false},jd=function(t){Ue(this,ft,Kd).call(this),A(this,Xn,t),!(Yo.isServer()||Yr(this.options.enabled,f(this,Je))===false||!ka(f(this,Xn))||f(this,Xn)===0)&&A(this,Wi,Qo.setInterval(()=>{(this.options.refetchIntervalInBackground||Cs.isFocused())&&Ue(this,ft,va).call(this);},f(this,Xn)));},$d=function(){Ue(this,ft,Hd).call(this),Ue(this,ft,jd).call(this,Ue(this,ft,Nd).call(this));},qd=function(){f(this,Bi)!==void 0&&(Qo.clearTimeout(f(this,Bi)),A(this,Bi,void 0));},Kd=function(){f(this,Wi)!==void 0&&(Qo.clearInterval(f(this,Wi)),A(this,Wi,void 0));},Qd=function(){let t=f(this,Gr).getQueryCache().build(f(this,Gr),this.options);if(t===f(this,Je))return;let r=f(this,Je);A(this,Je,t),A(this,Ia,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},Am=function(t){Ht.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(f(this,zr));}),f(this,Gr).getQueryCache().notify({query:f(this,Je),type:"observerResultsUpdated"});});},Wm);function $y(e,t){return Yr(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===false)}function Lm(e,t){return $y(e,t)||e.state.data!==void 0&&Yd(e,t,t.refetchOnMount)}function Yd(e,t,r){if(Yr(t.enabled,e)!==false&&Io(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&Jd(e,t)}return false}function Bm(e,t,r,o){return (e!==t||Yr(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&Jd(e,r)}function Jd(e,t){return Yr(t.enabled,e)!==false&&e.isStaleByTime(Io(t.staleTime,e))}function qy(e,t){return !Ql(e.getCurrentResult(),t)}function Zd(e){return {onFetch:(t,r)=>{let o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],s=t.state.data?.pageParams||[],a={pages:[],pageParams:[]},l=0,u=async()=>{let c=false,y=m=>{_m(m,()=>t.signal,()=>c=true);},T=Yl(t.options,t.fetchOptions),w=async(m,g,h)=>{if(c)return Promise.reject();if(g==null&&m.pages.length)return Promise.resolve(m);let b=(()=>{let x={client:t.client,queryKey:t.queryKey,pageParam:g,direction:h?"backward":"forward",meta:t.options.meta};return y(x),x})(),p=await T(b),{maxPages:d}=t.options,C=h?xm:Tm;return {pages:C(m.pages,p,d),pageParams:C(m.pageParams,g,d)}};if(n&&i.length){let m=n==="backward",g=m?Ky:Em,h={pages:i,pageParams:s},S=g(o,h);a=await w(h,S,m);}else {let m=e??i.length;do{let g=l===0?s[0]??o.initialPageParam:Em(o,a);if(l>0&&g==null)break;a=await w(a,g),l++;}while(l<m)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u;}}}function Em(e,{pages:t,pageParams:r}){let o=t.length-1;return t.length>0?e.getNextPageParam(t[o],t,r[o],r):void 0}function Ky(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Oa,Go,Lr,Ai,Jo,ei,Mm,zm=(Mm=class extends Xl{constructor(t){super();te(this,Jo);te(this,Oa);te(this,Go);te(this,Lr);te(this,Ai);A(this,Oa,t.client),this.mutationId=t.mutationId,A(this,Lr,t.mutationCache),A(this,Go,[]),this.state=t.state||Qy(),this.setOptions(t.options),this.scheduleGc();}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime);}get meta(){return this.options.meta}addObserver(t){f(this,Go).includes(t)||(f(this,Go).push(t),this.clearGcTimeout(),f(this,Lr).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){A(this,Go,f(this,Go).filter(r=>r!==t)),this.scheduleGc(),f(this,Lr).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){f(this,Go).length||(this.state.status==="pending"?this.scheduleGc():f(this,Lr).remove(this));}continue(){return f(this,Ai)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{Ue(this,Jo,ei).call(this,{type:"continue"});},o={client:f(this,Oa),meta:this.options.meta,mutationKey:this.options.mutationKey};A(this,Ai,Zl({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(s,a)=>{Ue(this,Jo,ei).call(this,{type:"failed",failureCount:s,error:a});},onPause:()=>{Ue(this,Jo,ei).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>f(this,Lr).canRun(this)}));let n=this.state.status==="pending",i=!f(this,Ai).canStart();try{if(n)r();else {Ue(this,Jo,ei).call(this,{type:"pending",variables:t,isPaused:i}),f(this,Lr).config.onMutate&&await f(this,Lr).config.onMutate(t,this,o);let a=await this.options.onMutate?.(t,o);a!==this.state.context&&Ue(this,Jo,ei).call(this,{type:"pending",context:a,variables:t,isPaused:i});}let s=await f(this,Ai).start();return await f(this,Lr).config.onSuccess?.(s,t,this.state.context,this,o),await this.options.onSuccess?.(s,t,this.state.context,o),await f(this,Lr).config.onSettled?.(s,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(s,null,t,this.state.context,o),Ue(this,Jo,ei).call(this,{type:"success",data:s}),s}catch(s){try{await f(this,Lr).config.onError?.(s,t,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onError?.(s,t,this.state.context,o);}catch(a){Promise.reject(a);}try{await f(this,Lr).config.onSettled?.(void 0,s,this.state.variables,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onSettled?.(void 0,s,t,this.state.context,o);}catch(a){Promise.reject(a);}throw Ue(this,Jo,ei).call(this,{type:"error",error:s}),s}finally{f(this,Lr).runNext(this);}}},Oa=new WeakMap,Go=new WeakMap,Lr=new WeakMap,Ai=new WeakMap,Jo=new WeakSet,ei=function(t){let r=o=>{switch(t.type){case "failed":return {...o,failureCount:t.failureCount,failureReason:t.error};case "pause":return {...o,isPaused:true};case "continue":return {...o,isPaused:false};case "pending":return {...o,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case "success":return {...o,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:false};case "error":return {...o,data:void 0,error:t.error,failureCount:o.failureCount+1,failureReason:t.error,isPaused:false,status:"error"}}};this.state=r(this.state),Ht.batch(()=>{f(this,Go).forEach(o=>{o.onMutationUpdate(t);}),f(this,Lr).notify({mutation:this,type:"updated",action:t});});},Mm);function Qy(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var wn,Po,Fa,Um,Hm=(Um=class extends qo{constructor(t={}){super();te(this,wn);te(this,Po);te(this,Fa);this.config=t,A(this,wn,new Set),A(this,Po,new Map),A(this,Fa,0);}build(t,r,o){let n=new zm({client:t,mutationCache:this,mutationId:++Js(this,Fa)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){f(this,wn).add(t);let r=ec(t);if(typeof r=="string"){let o=f(this,Po).get(r);o?o.push(t):f(this,Po).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(f(this,wn).delete(t)){let r=ec(t);if(typeof r=="string"){let o=f(this,Po).get(r);if(o)if(o.length>1){let n=o.indexOf(t);n!==-1&&o.splice(n,1);}else o[0]===t&&f(this,Po).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=ec(t);if(typeof r=="string"){let n=f(this,Po).get(r)?.find(i=>i.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=ec(t);return typeof r=="string"?f(this,Po).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Ht.batch(()=>{f(this,wn).forEach(t=>{this.notify({type:"removed",mutation:t});}),f(this,wn).clear(),f(this,Po).clear();});}getAll(){return Array.from(f(this,wn))}find(t){let r={exact:true,...t};return this.getAll().find(o=>Kl(r,o))}findAll(t={}){return this.getAll().filter(r=>Kl(t,r))}notify(t){Ht.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return Ht.batch(()=>Promise.all(t.map(r=>r.continue().catch(br))))}},wn=new WeakMap,Po=new WeakMap,Fa=new WeakMap,Um);function ec(e){return e.options.scope?.id}var Zo,Nm,jm=(Nm=class extends qo{constructor(t={}){super();te(this,Zo);this.config=t,A(this,Zo,new Map);}build(t,r,o){let n=r.queryKey,i=r.queryHash??Ta(n,r),s=this.get(i);return s||(s=new Dm({client:t,queryKey:n,queryHash:i,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(s)),s}add(t){f(this,Zo).has(t.queryHash)||(f(this,Zo).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=f(this,Zo).get(t.queryHash);r&&(t.destroy(),r===t&&f(this,Zo).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){Ht.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return f(this,Zo).get(t)}getAll(){return [...f(this,Zo).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>ql(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>ql(t,o)):r}notify(t){Ht.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){Ht.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){Ht.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},Zo=new WeakMap,Nm);var ir,ti,ri,Is,Ps,oi,Os,Fs,$m,Xd=($m=class{constructor(e={}){te(this,ir);te(this,ti);te(this,ri);te(this,Is);te(this,Ps);te(this,oi);te(this,Os);te(this,Fs);A(this,ir,e.queryCache||new jm),A(this,ti,e.mutationCache||new Hm),A(this,ri,e.defaultOptions||{}),A(this,Is,new Map),A(this,Ps,new Map),A(this,oi,0);}mount(){Js(this,oi)._++,f(this,oi)===1&&(A(this,Os,Cs.subscribe(async e=>{e&&(await this.resumePausedMutations(),f(this,ir).onFocus());})),A(this,Fs,ks.subscribe(async e=>{e&&(await this.resumePausedMutations(),f(this,ir).onOnline());})));}unmount(){var e,t;Js(this,oi)._--,f(this,oi)===0&&((e=f(this,Os))==null||e.call(this),A(this,Os,void 0),(t=f(this,Fs))==null||t.call(this),A(this,Fs,void 0));}isFetching(e){return f(this,ir).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return f(this,ti).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return f(this,ir).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=f(this,ir).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Io(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return f(this,ir).findAll(e).map(({queryKey:t,state:r})=>{let o=r.data;return [t,o]})}setQueryData(e,t,r){let o=this.defaultQueryOptions({queryKey:e}),i=f(this,ir).get(o.queryHash)?.state.data,s=Sm(t,i);if(s!==void 0)return f(this,ir).build(this,o).setData(s,{...r,manual:true})}setQueriesData(e,t,r){return Ht.batch(()=>f(this,ir).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return f(this,ir).get(t.queryHash)?.state}removeQueries(e){let t=f(this,ir);Ht.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=f(this,ir);return Ht.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=Ht.batch(()=>f(this,ir).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(br).catch(br)}invalidateQueries(e,t={}){return Ht.batch(()=>(f(this,ir).findAll(e).forEach(r=>{r.invalidate();}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??true},o=Ht.batch(()=>f(this,ir).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let i=n.fetch(void 0,r);return r.throwOnError||(i=i.catch(br)),n.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(o).then(br)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=f(this,ir).build(this,t);return r.isStaleByTime(Io(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(br).catch(br)}fetchInfiniteQuery(e){return e.behavior=Zd(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(br).catch(br)}ensureInfiniteQueryData(e){return e.behavior=Zd(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ks.isOnline()?f(this,ti).resumePausedMutations():Promise.resolve()}getQueryCache(){return f(this,ir)}getMutationCache(){return f(this,ti)}getDefaultOptions(){return f(this,ri)}setDefaultOptions(e){A(this,ri,e);}setQueryDefaults(e,t){f(this,Is).set(vi(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...f(this,Is).values()],r={};return t.forEach(o=>{Pi(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){f(this,Ps).set(vi(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...f(this,Ps).values()],r={};return t.forEach(o=>{Pi(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...f(this,ri).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=Ta(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Ii&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...f(this,ri).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){f(this,ir).clear(),f(this,ti).clear();}},ir=new WeakMap,ti=new WeakMap,ri=new WeakMap,Is=new WeakMap,Ps=new WeakMap,oi=new WeakMap,Os=new WeakMap,Fs=new WeakMap,$m);var eu=ni__namespace.createContext(void 0),tu=e=>{let t=ni__namespace.useContext(eu);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},ru=({client:e,children:t})=>(ni__namespace.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsxRuntime.jsx(eu.Provider,{value:e,children:t}));var qm=ni__namespace.createContext(false),Km=()=>ni__namespace.useContext(qm);qm.Provider;function Gy(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var Jy=ni__namespace.createContext(Gy()),Qm=()=>ni__namespace.useContext(Jy);var Gm=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?Gl(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},Jm=e=>{ni__namespace.useEffect(()=>{e.clearReset();},[e]);},Zm=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||Gl(r,[e.error,o]));var Xm=e=>{if(e.suspense){let r=n=>n==="static"?n:Math.max(n??1e3,1e3),o=e.staleTime;e.staleTime=typeof o=="function"?(...n)=>r(o(...n)):r(o),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3));}},ef=(e,t)=>e.isLoading&&e.isFetching&&!t,tf=(e,t)=>e?.suspense&&t.isPending,ou=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function rf(e,t,r){if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');let o=Km(),n=Qm(),i=tu(),s=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(s);let a=i.getQueryCache().get(s.queryHash);process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),s._optimisticResults=o?"isRestoring":"optimistic",Xm(s),Gm(s,n,a),Jm(n);let l=!i.getQueryCache().get(s.queryHash),[u]=ni__namespace.useState(()=>new t(i,s)),c=u.getOptimisticResult(s),y=!o&&e.subscribed!==false;if(ni__namespace.useSyncExternalStore(ni__namespace.useCallback(T=>{let w=y?u.subscribe(Ht.batchCalls(T)):br;return u.updateResult(),w},[u,y]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),ni__namespace.useEffect(()=>{u.setOptions(s);},[s,u]),tf(s,c))throw ou(s,u,n);if(Zm({result:c,errorResetBoundary:n,throwOnError:s.throwOnError,query:a,suspense:s.suspense}))throw c.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(s,c),s.experimental_prefetchInRender&&!Yo.isServer()&&ef(c,o)&&(l?ou(s,u,n):a?.promise)?.catch(br).finally(()=>{u.updateResult();}),s.notifyOnChangeProps?c:u.trackResult(c)}function Sn(e,t){return rf(e,Gd)}var Ls=new Map;function of({width:e,height:t,borderRadius:r,color:o}){let n=ni.useRef(new reactNative.Animated.Value(.3)).current;return ni.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:.7,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[n]),jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",width:e,height:t,borderRadius:r,backgroundColor:o,opacity:n}})}function si({uri:e,width:t,height:r,borderRadius:o=0,borderWidth:n=0,borderColor:i="transparent",backgroundColor:s="transparent",style:a}){let{colors:l}=V(),[u,c]=ni.useState(false),[y,T]=ni.useState(false),[w,m]=ni.useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let C=Ls.get(e);return C?{uri:e,xml:C}:null}),g=e?.toLowerCase().endsWith(".svg"),h=g&&e&&w?.uri===e?w.xml:null;ni.useEffect(()=>{c(false),T(false);},[e]),ni.useEffect(()=>{if(!g||!e)return;if(Ls.has(e)){m({uri:e,xml:Ls.get(e)});return}let C=false;return fetch(e).then(x=>{if(!x.ok)throw new Error(`HTTP ${x.status}`);return x.text()}).then(x=>{C||(Ls.set(e,x),m({uri:e,xml:x}));}).catch(()=>{C||c(true);}),()=>{C=true;}},[e,g]);let S=l.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:S},a]});let b={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:i,backgroundColor:s,overflow:"hidden",alignItems:"center",justifyContent:"center",...a},p=t-n*2,d=r-n*2;return u?jsxRuntime.jsx(reactNative.View,{style:[b,{backgroundColor:s||S}]}):g?jsxRuntime.jsxs(reactNative.View,{style:b,children:[!!!h&&jsxRuntime.jsx(of,{width:p,height:d,borderRadius:o,color:S}),h?jsxRuntime.jsx(Pt.SvgXml,{xml:h,width:p,height:d,onError:()=>c(true)}):jsxRuntime.jsx(Pt.SvgUri,{uri:e,width:p,height:d,onError:()=>c(true)})]}):jsxRuntime.jsxs(reactNative.View,{style:b,children:[!y&&jsxRuntime.jsx(of,{width:p,height:d,borderRadius:o,color:S}),jsxRuntime.jsx(reactNative.Image,{source:{uri:e,cache:"force-cache"},style:{width:p,height:d},resizeMode:"contain",onLoad:()=>T(true),onError:()=>c(true)})]})}function su(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(Ls.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{Ls.set(r,o);}).catch(()=>{}));}else t.push(reactNative.Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function Ur({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:i,badge:s,showBalance:a=false,balanceAddress:l,balanceChainType:u,balanceChainId:c,balanceTokenAddress:y,publishableKey:T,projectName:w,leftIcon:m,onLeftAction:g}){let{colors:h,fonts:S,components:b}=V(),[p,d]=ni.useState(null),[C,x]=ni.useState(false),_=ni.useState(()=>new reactNative.Animated.Value(0))[0];ni.useEffect(()=>{if(!C)return;let v=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(_,{toValue:1,duration:700,useNativeDriver:true}),reactNative.Animated.timing(_,{toValue:0,duration:700,useNativeDriver:true})]));return v.start(),()=>v.stop()},[C,_]),ni.useEffect(()=>{if(!a||!l||!u||!c||!y||!T){d(null),x(false);return}let v=false;return x(true),hl(l,u,c,y,T).then(M=>{if(v)return;let W=M.balance,O=null;W&&(W.amount_usd!=null&&W.amount_usd!==""?O=`$${W.amount_usd}`:O="$0.00"),d(O);}).catch(()=>{v||d(null);}).finally(()=>{v||x(false);}),()=>{v=true;}},[a,l,u,c,y,T]);let k=_.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxRuntime.jsxs(reactNative.View,{style:Br.header,children:[jsxRuntime.jsx(reactNative.View,{style:Br.leftContainer,children:r&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[Br.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Xs,{size:20,color:b.header.buttonColor,strokeWidth:2})}):m&&g?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:g,style:[Br.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:m}):jsxRuntime.jsx(reactNative.View,{style:Br.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:Br.titleContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:Br.titleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Br.title,{color:b.header.titleColor,fontFamily:S.medium}],children:e}),s&&s.count>0&&jsxRuntime.jsx(reactNative.View,{style:[Br.titleBadge,{backgroundColor:h.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[Br.titleBadgeText,{color:h.foregroundMuted,fontFamily:S.regular}],children:s.count})})]}),t?jsxRuntime.jsx(reactNative.Text,{style:[Br.balanceText,{color:h.foregroundMuted,fontFamily:S.regular}],children:t}):null,a&&(C?jsxRuntime.jsx(reactNative.Animated.View,{style:[Br.balanceSkeleton,{backgroundColor:h.cardHover,opacity:k}]}):p!=null?jsxRuntime.jsxs(reactNative.Text,{style:[Br.balanceText,{color:h.foregroundMuted,fontFamily:S.regular}],children:[w?`${w} `:"","Balance: ",p]}):null)]}),jsxRuntime.jsx(reactNative.View,{style:Br.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:i,style:[Br.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(st,{size:20,color:b.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:Br.spacer})})]})}var Br=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},leftContainer:{width:40,alignItems:"flex-start"},rightContainer:{width:40,alignItems:"flex-end"},titleContainer:{flex:1,alignItems:"center"},titleRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},title:{fontSize:16,textAlign:"center"},titleBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:12},titleBadgeText:{fontSize:10,fontWeight:"400"},balanceSkeleton:{height:10,width:120,borderRadius:5,marginTop:4},balanceText:{fontSize:14,marginTop:3,textAlign:"center"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function Cr({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:i}){let{components:s}=V(),a=i??s.card,l=a.backShadowColor!=="transparent",u={backgroundColor:a.backgroundColor,borderRadius:a.borderRadius,borderWidth:a.borderWidth,borderColor:a.borderColor},c=[lf.wrapper,t,l&&{marginBottom:a.backShadowSpacing}],y=[u,r];return jsxRuntime.jsxs(reactNative.View,{style:c,children:[l&&jsxRuntime.jsx(reactNative.View,{style:[lf.backShadow,{top:a.backShadowOffset.top,left:a.backShadowOffset.left,right:a.backShadowOffset.right,bottom:a.backShadowOffset.bottom,backgroundColor:a.backShadowColor,borderRadius:a.borderRadius}]}),o!=null?jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:o,activeOpacity:n,style:y,children:e}):jsxRuntime.jsx(reactNative.View,{style:y,children:e})]})}var lf=reactNative.StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function Va({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:i}=V(),s=i.depositMenu.card,a=o?[...o].sort((l,u)=>l.position-u.position):[];return jsxRuntime.jsxs(Cr,{cardTokens:s,onPress:e,style:Xo.wrapper,contentStyle:Xo.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Xo.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Xo.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(Yc,{size:20,color:s.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Xo.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Xo.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Xo.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Xo.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Xo.networkIcons,children:a.map((l,u)=>{let c=l.icon_urls.find(y=>y.format==="png")?.url||l.icon_urls.find(y=>y.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[Xo.networkIconWrapper,{marginLeft:u===0?0:-6,zIndex:a.length-u}],children:jsxRuntime.jsx(si,{uri:oe(c),width:20,height:20})},l.name)})})})]})}var Xo=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},networkIcons:{flexDirection:"row",alignItems:"center"},networkIconWrapper:{}});function Ba({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:i}=V(),s=i.depositMenu.card;return jsxRuntime.jsxs(Cr,{cardTokens:s,onPress:e,style:kn.wrapper,contentStyle:kn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:kn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[kn.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(Ji,{size:20,color:s.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:kn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[kn.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[kn.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:kn.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:kn.paymentIcons,children:o?.map(a=>{let l=a.icon_urls.find(u=>u.format==="png")?.url||a.icon_urls.find(u=>u.format==="svg")?.url;return jsxRuntime.jsx(si,{uri:oe(l),width:32,height:20,borderRadius:4},a.name)})})})]})}var kn=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},paymentIcons:{flexDirection:"row",alignItems:"center",gap:6}});function Wa({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:i}=V(),s=i.depositMenu.card;return jsxRuntime.jsx(Cr,{cardTokens:s,onPress:e,style:Tn.wrapper,contentStyle:Tn.container,children:jsxRuntime.jsxs(reactNative.View,{style:Tn.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[Tn.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:[jsxRuntime.jsx(Nr,{size:20,color:s.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsxRuntime.jsx(reactNative.View,{style:[Tn.badge,{backgroundColor:s.iconColor,borderRadius:i.badge.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[Tn.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),jsxRuntime.jsxs(reactNative.View,{style:Tn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Tn.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Tn.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var Tn=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center",position:"relative"},badge:{position:"absolute",top:-4,right:-4,minWidth:18,height:18,alignItems:"center",justifyContent:"center",paddingHorizontal:4},badgeText:{color:"#FFFFFF",fontSize:10,fontWeight:"600"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});function Ea({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=V(),i=n.depositMenu.card;return jsxRuntime.jsxs(Cr,{cardTokens:i,onPress:e,style:en.wrapper,contentStyle:en.container,children:[jsxRuntime.jsxs(reactNative.View,{style:en.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[en.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(al,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:en.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[en.title,{color:i.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[en.subtitle,{color:i.subtitleColor,fontFamily:o.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:en.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:en.badge,children:jsxRuntime.jsx(reactNative.Text,{style:[en.badgeText,{fontFamily:o.regular}],children:"Stripe"})})})]})}var en=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},badge:{paddingHorizontal:10,paddingVertical:4,borderRadius:6,backgroundColor:"#635BFF"},badgeText:{fontSize:12,fontWeight:"600",color:"#FFFFFF"}});var pf=1e4,mf=2500,ff=3e3,hf=6e4;function Ma(e){let{depositConfirmationMode:t,depositAddress:r,chain:o,externalUserId:n,publishableKey:i,modalOpenedAt:s,depositWalletId:a,depositExecutions:l,trackedExecutions:u,setDepositExecutions:c,setTrackedExecutions:y,setLatestExecution:T,setShowStatusSheet:w,onDepositSuccess:m,onExecutionsChange:g,onDepositError:h}=e,[S,b]=ni.useState(false),[p,d]=ni.useState(false);return ni.useEffect(()=>{if(t!=="auto_ui"&&t!=="auto_silent"||!r)return;b(false),t==="auto_ui"&&d(false);let x=setTimeout(()=>{b(true),t==="auto_ui"&&d(true);},pf);return ()=>clearTimeout(x)},[t,r,o]),ni.useEffect(()=>{if(!n||!s)return;let x=new Date(s.getTime()-hf),_=setInterval(async()=>{try{let M=[...(await pn(n,i)).data??[]].sort((O,F)=>{let U=O.created_at?new Date(O.created_at).getTime():0;return (F.created_at?new Date(F.created_at).getTime():0)-U}),W=null;for(let O of M){let F=O.created_at?new Date(O.created_at):null;if(!F||F<=x)continue;let U=u.get(O.id);if(!U){W=O;break}if(["pending","waiting","delayed"].includes(U)&&O.status==="succeeded"){W=O;break}}if(W){let O=W;c(F=>{let U=F.findIndex(j=>j.id===O.id);if(U>=0){let j=[...F];return j[U]=O,j}return [...F,O]}),y(F=>{let U=new Map(F);return U.set(O.id,O.status),U}),T(O),w(!0),O.status==="succeeded"&&m?.({message:"Deposit completed successfully",executionId:O.id}),g?.([...l,O]);}}catch(k){h?.({message:"Failed to check deposit status",error:k});}},mf);return ()=>clearInterval(_)},[n,i,s,u,l,g,m,h]),ni.useEffect(()=>{if(!S||!a)return;let x=async()=>{try{await ul(a,i);}catch{}};x();let _=setInterval(x,ff);return ()=>clearInterval(_)},[S,a,i]),{pollingEnabled:S,showWaitingUi:p,handleIveDeposited:()=>{b(true),d(true);}}}function Es({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n}){let{colors:i,isDark:s}=V(),a=s?"#1a1a1a":"#ffffff",l=s?"#ffffff":"#000000",u=n||a;return jsxRuntime.jsxs(reactNative.View,{style:[yf.container,{width:t,height:t}],children:[jsxRuntime.jsx(db__default.default,{value:e||"placeholder",size:t,backgroundColor:a,color:l,ecl:"H",quietZone:4}),r&&jsxRuntime.jsx(reactNative.View,{style:[yf.logoContainer,{width:o+12,height:o+12,backgroundColor:u,borderRadius:(o+12)/2}],children:jsxRuntime.jsx(si,{uri:r,width:o,height:o,borderRadius:o/2})})]})}var yf=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function wf(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function fb(e){let r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],o=e.getDate(),n=e.getFullYear(),i=e.getHours(),s=e.getMinutes(),a=i>=12?"pm":"am";i=i%12,i=i||12;let l=s<10?`0${s}`:s;return `${r} ${o}, ${n} at ${i}:${l}${a}`}function Ms({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:i,amountUsd:s,onClose:a,borderTopLeftRadius:l,borderTopRightRadius:u}){let{colors:c,fonts:y,components:T}=V(),[w,m]=ni.useState(false),g=t==="pending"||t==="waiting"||t==="delayed",h=t==="succeeded",S=()=>{o&&reactNative.Linking.openURL(o);},b=()=>{n&&reactNative.Linking.openURL(n);};return jsxRuntime.jsx(bt,{visible:e,onClose:a,closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:l,borderTopRightRadius:u,children:jsxRuntime.jsxs(reactNative.View,{style:Zt.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Zt.closeButton,onPress:a,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(st,{size:20,color:T.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:Zt.iconContainer,children:g?jsxRuntime.jsx(nt,{size:80,strokeWidth:4,iconSize:68,children:r?jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(r)},style:Zt.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[Zt.tokenIconFill,{backgroundColor:c.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r?jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(r)},style:Zt.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[Zt.tokenIconLarge,{backgroundColor:c.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[Zt.statusBadge,{backgroundColor:T.container.iconBackgroundColor}],children:jsxRuntime.jsx(Le,{size:16,color:T.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[Zt.title,{color:T.container.titleColor,fontFamily:y.semibold}],children:g?"Deposit Processing":"Deposit Complete"}),s!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[Zt.amount,{color:T.container.titleColor,fontFamily:y.bold}],children:["$",s.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),i&&jsxRuntime.jsx(reactNative.Text,{style:[Zt.date,{color:T.container.subtitleColor,fontFamily:y.regular}],children:fb(i)}),jsxRuntime.jsx(reactNative.Text,{style:[Zt.subtitle,{color:T.container.subtitleColor,fontFamily:y.regular}],children:g?"This usually takes less than a minute.":"Your account has been credited successfully!"}),h&&(o||n)&&jsxRuntime.jsxs(reactNative.View,{style:Zt.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[Zt.divider,{backgroundColor:c.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Zt.detailsToggle,onPress:()=>m(!w),children:[jsxRuntime.jsx(reactNative.Text,{style:[Zt.detailsToggleText,{color:T.container.actionTitle,fontFamily:y.medium}],children:w?"See less":"See more details"}),w?jsxRuntime.jsx(Vo,{size:18,color:T.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Gt,{size:18,color:T.container.actionColor,strokeWidth:2})]}),w&&jsxRuntime.jsxs(reactNative.View,{style:Zt.txButtonsContainer,children:[o&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Zt.txButton,{backgroundColor:T.card.backgroundColor,borderColor:c.border}],onPress:S,children:[jsxRuntime.jsx(reactNative.Text,{style:[Zt.txLabel,{color:T.card.titleColor,fontFamily:y.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Zt.txHash,{color:T.card.subtitleColor,fontFamily:y.regular}],children:wf(o)}),jsxRuntime.jsx(Do,{size:16,color:T.card.actionColor,strokeWidth:2})]}),n&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Zt.txButton,{backgroundColor:T.card.backgroundColor,borderColor:c.border}],onPress:b,children:[jsxRuntime.jsx(reactNative.Text,{style:[Zt.txLabel,{color:T.card.titleColor,fontFamily:y.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Zt.txHash,{color:T.card.subtitleColor,fontFamily:y.regular}],children:wf(n)}),jsxRuntime.jsx(Do,{size:16,color:T.card.actionColor,strokeWidth:2})]})]})]})]})})}var Zt=reactNative.StyleSheet.create({container:{alignItems:"center",paddingHorizontal:24,paddingTop:40},closeButton:{position:"absolute",top:16,right:16,padding:4,zIndex:1},iconContainer:{position:"relative",marginBottom:16},tokenIcon:{width:64,height:64,borderRadius:32},tokenIconLarge:{width:68,height:68,borderRadius:34},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});function ac({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){let{colors:i,fonts:s,components:a}=V();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e==="manual"&&t&&!r&&jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,activeOpacity:.8,style:[zi.iveDepositedButton,{backgroundColor:i.primary,borderRadius:a.button.borderRadius,borderWidth:a.button.borderWidth,borderColor:a.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[zi.iveDepositedButtonText,{color:i.primaryForeground??"#FFF",fontFamily:s.semibold}],children:"I've made the deposit"})}),r&&!o&&jsxRuntime.jsxs(reactNative.View,{style:[zi.processingCard,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor,shadowColor:a.card.shadowOpacity>0?a.card.shadowColor:void 0,shadowOffset:a.card.shadowOpacity>0?a.card.shadowOffset:void 0,shadowOpacity:a.card.shadowOpacity,shadowRadius:a.card.shadowRadius,elevation:a.card.elevation}],children:[jsxRuntime.jsx(reactNative.View,{style:[zi.detailIcon,{backgroundColor:a.card.iconBackgroundColor,borderRadius:a.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Gc,{size:14,color:a.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:zi.processingCardText,children:[jsxRuntime.jsx(reactNative.Text,{style:[zi.processingCardTitle,{color:a.card.titleColor,fontFamily:s.semibold}],children:"Processing deposit transactions."}),jsxRuntime.jsx(reactNative.Text,{style:[zi.processingCardSubtitle,{color:a.card.subtitleColor,fontFamily:s.regular}],children:"We're checking if your deposit has landed."})]})]})]})}var zi=reactNative.StyleSheet.create({iveDepositedButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginBottom:12},iveDepositedButtonText:{fontSize:16},processingCard:{flexDirection:"row",alignItems:"center",padding:12,marginBottom:12,gap:12},processingCardText:{flex:1,gap:4},processingCardTitle:{fontSize:14},processingCardSubtitle:{fontSize:12,lineHeight:18},detailIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"}});var za=(e,t)=>`${t}:${e}`,Tb=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function cc({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:i,destinationTokenSymbol:s,defaultChainType:a,defaultChainId:l,defaultTokenAddress:u,depositConfirmationMode:c="auto_ui",onExecutionsChange:y,onDepositSuccess:T,onDepositError:w,borderTopLeftRadius:m,borderTopRightRadius:g,sheetBorderRadius:h}){let{colors:S,fonts:b,components:p}=V(),d=a&&l?`${a}:${l}`:"solana:mainnet",[C,x]=ni.useState("USDC"),[_,k]=ni.useState(d),[v,M]=ni.useState([]),[W,O]=ni.useState(true),[F,U]=ni.useState([]),[j,le]=ni.useState(true),[Ye,_e]=ni.useState(false),[ne,we]=ni.useState(false),[fe,Pe]=ni.useState(false),[$e,ue]=ni.useState(false),[J,be]=ni.useState([]),[vt,ve]=ni.useState(new Map),[qe]=ni.useState(()=>new Date),[Ne,Ve]=ni.useState(null),[ze,it]=ni.useState(false),[ie,pe]=ni.useState(null),[et,Ae]=ni.useState(false),Ke=new Map;F.forEach(L=>{L.chains.forEach(I=>{let D=`${I.chain_type}:${I.chain_id}`;Ke.has(D)||Ke.set(D,I);});});let $t=Array.from(Ke.values()),Ee=Tb(_),ar=$t.find(L=>L.chain_type===Ee.chainType&&L.chain_id===Ee.chainId)?.chain_type||"ethereum",he=un(v,ar),X=he?.address||"",Ce=ni.useRef(false);ni.useEffect(()=>{async function L(){try{le(!0),Ve(null);let D=await Ci(t,i&&n&&o?{destination_token_address:i,destination_chain_id:n,destination_chain_type:o}:void 0);if(U(D.data),D.data.length>0&&!Ce.current){Ce.current=!0;let q,Fe;if(a&&l)if(u)for(let ke of D.data){let pr=ke.chains.find(ce=>ce.chain_type===a&&ce.chain_id===l&&ce.token_address.toLowerCase()===u.toLowerCase());if(pr){q=ke,Fe=pr;break}}else for(let ke of D.data){let pr=ke.chains.find(ce=>ce.chain_type===a&&ce.chain_id===l);if(pr){q=ke,Fe=pr;break}}if(!q&&i)for(let ke of D.data){let pr=ke.chains.find(ce=>ce.token_address.toLowerCase()===i.toLowerCase());if(pr){q=ke,Fe=pr;break}}q||(q=D.data.find(ke=>ke.symbol==="USDC"),q&&q.chains.length>0&&(Fe=q.chains[0])),q||(q=D.data.find(ke=>ke.symbol==="USDT"),q&&q.chains.length>0&&(Fe=q.chains[0])),q||(q=D.data[0],q.chains.length>0&&(Fe=q.chains[0])),q&&x(q.symbol),Fe&&k(za(Fe.chain_id,Fe.chain_type));}}catch(I){console.error("Error fetching supported tokens:",I),Ve("Failed to load supported tokens"),w?.({message:"Failed to load supported tokens",error:I});}finally{le(false);}}L();},[t,w,a,l,u,i,n,o]),ni.useEffect(()=>{async function L(){try{O(!0),Ve(null);let I=await dn({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:i},t);M(I.data);}catch(I){console.error("Error fetching wallets:",I),Ve("Failed to load wallets"),w?.({message:"Failed to load wallets",error:I});}finally{O(false);}}L();},[e,r,o,n,i,t,w]);let pt=he?.id??"",{showWaitingUi:It,handleIveDeposited:me}=Ma({depositConfirmationMode:c,depositAddress:X,chain:_,externalUserId:e,publishableKey:t,modalOpenedAt:qe,depositWalletId:pt,depositExecutions:J,trackedExecutions:vt,setDepositExecutions:be,setTrackedExecutions:ve,setLatestExecution:pe,setShowStatusSheet:it,onDepositSuccess:T,onExecutionsChange:y,onDepositError:w});ni.useEffect(()=>{if(!F.length)return;let L=F.find(D=>D.symbol===C);if(!L||L.chains.length===0)return;if(!L.chains.some(D=>za(D.chain_id,D.chain_type)===_)){let D=L.chains[0];k(za(D.chain_id,D.chain_type));}},[C,F,_]);let je=F.find(L=>L.symbol===C),Vt=je?.chains||[],ot=Vt.find(L=>za(L.chain_id,L.chain_type)===_),Lt=async()=>{if(X)try{reactNative.Clipboard.setString(X),_e(!0),setTimeout(()=>_e(!1),2e3);}catch(L){console.error("Failed to copy:",L);}},Bt=ot?.estimated_price_impact_percent??0,yt=ot?.max_slippage_percent??.25,Se=ot?.minimum_deposit_amount_usd??3;if(j)return jsxRuntime.jsxs(reactNative.View,{style:B.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:S.primary}),jsxRuntime.jsx(reactNative.Text,{style:[B.loadingText,{color:S.foregroundMuted,fontFamily:b.regular}],children:"Loading currencies..."})]});if(Ne&&F.length===0)return jsxRuntime.jsxs(reactNative.View,{style:B.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[B.errorText,{color:S.error,fontFamily:b.regular}],children:Ne}),jsxRuntime.jsx(reactNative.Text,{style:[B.errorHint,{color:S.foregroundMuted,fontFamily:b.regular}],children:"Please check your network connection and try again."})]});let Z=()=>jsxRuntime.jsxs(bt,{visible:fe,onClose:()=>Pe(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:h?.tokenSelector?.borderTopLeftRadius??m,borderTopRightRadius:h?.tokenSelector?.borderTopRightRadius??g,children:[jsxRuntime.jsxs(reactNative.View,{style:[B.sheetHeader,{borderBottomColor:S.border}],children:[jsxRuntime.jsx(reactNative.View,{style:B.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[B.sheetTitle,{color:p.header.titleColor,fontFamily:b.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Pe(false),style:B.sheetCloseButton,children:jsxRuntime.jsx(st,{size:20,color:p.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(at,{style:B.sheetList,contentContainerStyle:B.sheetListContent,showsVerticalScrollIndicator:false,children:F.map(L=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{x(L.symbol),Pe(false);},activeOpacity:.7,style:[B.sheetItem,{backgroundColor:C===L.symbol?p.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Te(L,"png"))},style:B.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:B.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[B.sheetItemTitle,{color:p.card.titleColor,fontFamily:b.medium}],children:L.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[B.sheetItemSubtitle,{color:p.card.subtitleColor,fontFamily:b.regular}],children:[L.chains.length," network",L.chains.length!==1?"s":""," available"]})]}),C===L.symbol&&jsxRuntime.jsx(Le,{size:20,color:S.primary,strokeWidth:2})]},L.symbol))})]}),Q=()=>jsxRuntime.jsxs(bt,{visible:$e,onClose:()=>ue(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:h?.chainSelector?.borderTopLeftRadius??m,borderTopRightRadius:h?.chainSelector?.borderTopRightRadius??g,children:[jsxRuntime.jsxs(reactNative.View,{style:[B.sheetHeader,{borderBottomColor:S.border}],children:[jsxRuntime.jsx(reactNative.View,{style:B.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[B.sheetTitle,{color:p.header.titleColor,fontFamily:b.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ue(false),style:B.sheetCloseButton,children:jsxRuntime.jsx(st,{size:20,color:p.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(at,{style:B.sheetList,contentContainerStyle:B.sheetListContent,showsVerticalScrollIndicator:false,children:Vt.map(L=>{let I=za(L.chain_id,L.chain_type),D=_===I;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{k(I),ue(false);},activeOpacity:.7,style:[B.sheetItem,{backgroundColor:D?p.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Te(L,"png"))},style:B.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:B.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[B.sheetItemTitle,{color:p.card.titleColor,fontFamily:b.medium}],children:L.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[B.sheetItemSubtitle,{color:p.card.subtitleColor,fontFamily:b.regular}],children:["Min deposit: $",L.minimum_deposit_amount_usd]})]}),D&&jsxRuntime.jsx(Le,{size:20,color:S.primary,strokeWidth:2})]},I)})})]});return jsxRuntime.jsxs(reactNative.View,{style:B.container,children:[jsxRuntime.jsxs(reactNative.View,{style:B.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[B.selectorLabel,{color:p.card.labelColor,fontFamily:b.regular}],children:"Token"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Pe(true),style:[B.selector,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[je&&jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Te(je,"png"))},style:B.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[B.selectorText,{color:p.card.titleColor,fontFamily:b.medium}],children:C}),jsxRuntime.jsx(Gt,{size:16,color:p.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:B.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[B.selectorLabel,{color:p.card.labelColor,fontFamily:b.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[B.minDeposit,{fontFamily:b.regular}],children:["($",Se," min)"]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ue(true),style:[B.selector,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[ot&&jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Te(ot,"png"))},style:B.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[B.selectorText,{color:p.card.titleColor,fontFamily:b.medium}],numberOfLines:1,children:ot?.chain_name||"Select network"}),jsxRuntime.jsx(Gt,{size:16,color:p.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:B.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[B.qrWrapper,{backgroundColor:S.background,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth>0?p.card.borderWidth:1,borderColor:p.card.borderColor}],children:W?jsxRuntime.jsxs(reactNative.View,{style:B.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:S.primary}),jsxRuntime.jsx(reactNative.Text,{style:[B.loadingText,{color:S.foregroundMuted,fontFamily:b.regular}],children:"Loading..."})]}):X?jsxRuntime.jsx(Es,{value:X,size:160,logoUri:oe(Te(ot,"png")||cr("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:B.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[B.errorText,{color:S.error,fontFamily:b.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:B.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:B.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[B.addressLabel,{color:p.card.labelColor,fontFamily:b.medium}],children:"Deposit Address"}),Ye&&jsxRuntime.jsxs(reactNative.View,{style:B.copiedIndicator,children:[jsxRuntime.jsx(Le,{size:14,color:S.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[B.copiedText,{color:S.success,fontFamily:b.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(Cr,{cardTokens:p.transferCrypto.depositAddress.card,onPress:!W&&X?Lt:void 0,contentStyle:B.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[B.addressText,{color:p.card.titleColor,fontFamily:b.regular}],numberOfLines:2,children:W?"Loading...":X||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:B.addressCopyIcon,children:jsxRuntime.jsx(ln,{size:16,color:p.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[B.detailsCard,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>we(!ne),style:B.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:B.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[B.detailIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Nr,{size:12,color:p.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[B.detailsLabel,{color:p.card.titleColor,fontFamily:b.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:B.chevronContainer,children:ne?jsxRuntime.jsx(Vo,{size:16,color:p.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Gt,{size:16,color:p.card.actionColor,strokeWidth:2})})]}),ne&&jsxRuntime.jsxs(reactNative.View,{style:B.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:B.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[B.detailIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(An,{size:12,color:p.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[B.detailsLabel,{color:p.card.titleColor,fontFamily:b.regular}],children:["Price impact: ",Bt.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ae(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(es,{size:14,color:p.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:B.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[B.detailIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(jr,{size:12,color:p.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[B.detailsLabel,{color:p.card.titleColor,fontFamily:b.regular}],children:["Slippage: Auto \u2022 ",yt.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ae(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(es,{size:14,color:p.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:B.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[B.detailIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(il,{size:12,color:p.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[B.detailsLabel,{color:p.card.titleColor,fontFamily:b.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(ac,{depositConfirmationMode:c,depositAddress:X,showWaitingUi:It,latestExecution:ie,onIveDeposited:me}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:B.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[B.termsText,{color:S.primary,fontFamily:b.regular}],children:"Terms apply"})}),Z(),Q(),jsxRuntime.jsxs(bt,{visible:et,onClose:()=>Ae(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:h?.infoSheet?.borderTopLeftRadius??m,borderTopRightRadius:h?.infoSheet?.borderTopRightRadius??g,children:[jsxRuntime.jsxs(reactNative.View,{style:[B.sheetHeader,{borderBottomColor:S.border}],children:[jsxRuntime.jsx(reactNative.View,{style:B.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[B.sheetTitle,{color:p.header.titleColor,fontFamily:b.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ae(false),style:B.sheetCloseButton,children:jsxRuntime.jsx(st,{size:20,color:p.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:B.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[B.infoCard,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:B.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[B.infoCardIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(An,{size:16,color:p.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[B.infoCardTitle,{color:p.card.titleColor,fontFamily:b.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[B.infoCardValue,{color:p.card.titleColor,fontFamily:b.medium}],children:[Bt.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[B.infoCardDescription,{color:p.card.descriptionColor,fontFamily:b.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[B.infoCard,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:B.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[B.infoCardIcon,{backgroundColor:p.card.iconBackgroundColor,borderRadius:p.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(jr,{size:16,color:p.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[B.infoCardTitle,{color:p.card.titleColor,fontFamily:b.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[B.infoCardValue,{color:p.card.titleColor,fontFamily:b.medium}],children:[yt.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[B.infoCardDescription,{color:p.card.descriptionColor,fontFamily:b.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]}),ie&&jsxRuntime.jsx(Ms,{visible:ze,status:ie.status,tokenIconUrl:ie.destination_token_metadata?.icon_urls?.find(L=>L.format==="png")?.url||ie.destination_token_metadata?.icon_url||Te(je,"png"),explorerUrl:ie.explorer_url,completionExplorerUrl:ie.destination_explorer_url,date:ie.created_at?new Date(ie.created_at):void 0,amountUsd:ie.source_amount_usd?parseFloat(ie.source_amount_usd):void 0,onClose:()=>it(false),borderTopLeftRadius:h?.depositStatus?.borderTopLeftRadius??m,borderTopRightRadius:h?.depositStatus?.borderTopRightRadius??g})]})}var B=reactNative.StyleSheet.create({container:{flex:1,padding:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:13,marginBottom:8},minDeposit:{fontSize:10},selector:{flexDirection:"row",alignItems:"center",gap:10,padding:12,borderRadius:12},selectorIcon:{width:24,height:24,borderRadius:12},selectorText:{flex:1,fontSize:14,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:16},qrWrapper:{padding:16},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:13},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{position:"relative",paddingHorizontal:12,paddingVertical:16},addressText:{fontSize:12,fontFamily:"monospace"},addressCopyIcon:{position:"absolute",right:12,top:0,bottom:0,justifyContent:"center"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},spacer:{flex:1},termsContainer:{alignItems:"center"},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},sheetList:{flex:1,paddingTop:8},sheetListContent:{paddingBottom:56},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:8,borderRadius:12,gap:12},sheetItemIcon:{width:40,height:40,borderRadius:20},sheetItemText:{flex:1},sheetItemTitle:{fontSize:16,fontWeight:"500"},sheetItemSubtitle:{fontSize:12,marginTop:2},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});function dc({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:i}=V();return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[Ui.container,{backgroundColor:i.card.backgroundColor,borderRadius:i.list.rowBorderRadius,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ui.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Ui.iconContainer,{backgroundColor:o.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Te(e,"png"))},style:Ui.icon})}),jsxRuntime.jsxs(reactNative.View,{style:Ui.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ui.name,{color:i.card.titleColor,fontFamily:n.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[Ui.code,{color:i.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(Le,{size:16,color:o.primary,strokeWidth:2})]})}var Ui=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,marginHorizontal:8,marginVertical:4},leftContent:{flexDirection:"row",alignItems:"center",gap:12},iconContainer:{width:40,height:40,borderRadius:20,overflow:"hidden",alignItems:"center",justifyContent:"center"},icon:{width:40,height:40,borderRadius:20},textContainer:{gap:2},name:{fontSize:14,fontWeight:"400"},code:{fontSize:12,fontWeight:"300"}});function Ha({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:i}=V();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:xf.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[xf.title,{color:i.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(s=>jsxRuntime.jsx(dc,{currency:s,isSelected:r.toLowerCase()===s.currency_code.toLowerCase(),onSelect:o},s.currency_code))]})}var xf=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function pc({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:i,borderTopLeftRadius:s,borderTopRightRadius:a}){let{colors:l,fonts:u,components:c}=V(),[y,T]=ni.useState(""),w=o.map(d=>r.find(C=>C.currency_code.toLowerCase()===d.toLowerCase())).filter(d=>d!==void 0),m=r.filter(d=>!o.includes(d.currency_code.toLowerCase())),g=d=>{if(!y)return d;let C=y.toLowerCase();return d.filter(x=>x.name.toLowerCase().includes(C)||x.currency_code.toLowerCase().includes(C))},h=g(w),S=g(m),b=d=>{i(d),t(false),T("");},p=()=>{t(false),T("");};return jsxRuntime.jsxs(bt,{visible:e,onClose:p,closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:s,borderTopRightRadius:a,children:[jsxRuntime.jsx(Ur,{title:"Currency",showBack:false,onClose:p}),jsxRuntime.jsx(reactNative.View,{style:Hi.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Hi.searchInput,{backgroundColor:c.search.backgroundColor,color:c.search.inputColor,fontFamily:u.regular,borderRadius:c.input.borderRadius,borderWidth:c.input.borderWidth,borderColor:c.input.borderColor}],value:y,onChangeText:T,placeholder:"Search",placeholderTextColor:c.search.placeholderColor})}),jsxRuntime.jsx(at,{style:Hi.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{style:Hi.listContent,children:[jsxRuntime.jsx(Ha,{title:"Popular currencies",currencies:h,selectedCurrency:n,onSelect:b}),h.length>0&&S.length>0&&jsxRuntime.jsx(reactNative.View,{style:Hi.sectionSpacer}),jsxRuntime.jsx(Ha,{title:"All currencies",currencies:S,selectedCurrency:n,onSelect:b}),h.length===0&&S.length===0&&jsxRuntime.jsx(reactNative.View,{style:Hi.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Hi.noResultsText,{color:c.container.subtitleColor,fontFamily:u.regular}],children:"No currencies found"})})]})})]})}var Hi=reactNative.StyleSheet.create({searchContainer:{marginTop:8,paddingHorizontal:18,paddingBottom:12},searchInput:{padding:16,fontSize:14},listContainer:{flex:1,paddingHorizontal:12},listContent:{paddingBottom:72},sectionSpacer:{height:8},noResultsContainer:{paddingVertical:32,alignItems:"center"},noResultsText:{fontSize:14}});function vu(e){try{return new Intl.NumberFormat("en",{style:"currency",currency:e.toUpperCase(),minimumFractionDigits:0,maximumFractionDigits:0}).format(0).replace(/\d/g,"").trim()}catch{return e.toUpperCase()}}function hc({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:i,destinationChainType:s,destinationChainId:a,destinationTokenAddress:l,onDepositSuccess:u,onDepositError:c,borderTopLeftRadius:y,borderTopRightRadius:T,sheetBorderRadius:w}){let{colors:m,fonts:g,components:h}=V(),[S,b]=ni.useState(""),[p,d]=ni.useState("usd"),[C,x]=ni.useState(false),[_,k]=ni.useState(false),[v,M]=ni.useState([]),[W,O]=ni.useState(false),[F,U]=ni.useState(null),[j,le]=ni.useState(null),[Ye,_e]=ni.useState("amount"),[ne,we]=ni.useState(null),[fe,Pe]=ni.useState(true),[$e,ue]=ni.useState(null),[J,be]=ni.useState(false),vt=ni.useRef(null),ve=ni.useRef(false);ni.useEffect(()=>{vt.current=ne;},[ne]),ni.useEffect(()=>{ve.current=J;},[J]);let[qe,Ne]=ni.useState([]),[Ve,ze]=ni.useState(true),[it,ie]=ni.useState(60),[pe,et]=ni.useState([]),[Ae,Ke]=ni.useState([]),[$t,Ee]=ni.useState(null),[Oe,ar]=ni.useState(null),[he,X]=ni.useState(true),[Ce,pt]=ni.useState(null),[It,me]=ni.useState(false),[je,Vt]=ni.useState(null),[ot,Lt]=ni.useState(false),[Bt,yt]=ni.useState(false),[Se,Z]=ni.useState(false),[Q,L]=ni.useState(null),I=r??Ye,D=ni.useRef(null),q=pe.find(Y=>Y.currency_code.toLowerCase()===p.toLowerCase()),Fe=ni.useCallback(Y=>{_e(Y),Y==="quotes"?o?.(Y,v.length):o?.(Y);},[v.length,o]);ni.useEffect(()=>{async function Y(){try{let ae=await ca();ar(ae);}catch(ae){console.error("Error fetching user IP:",ae);}finally{X(false);}}Y();},[]),ni.useEffect(()=>{async function Y(){try{let ae=await dn({external_user_id:e,recipient_address:i,destination_chain_type:s,destination_chain_id:a,destination_token_address:l},t);Ne(ae.data);}catch(ae){console.error("Error fetching wallets:",ae),U("Failed to load wallet addresses");}finally{ze(false);}}Y();},[e,i,s,a,l,t]);let ke=n||$t?.symbol.toUpperCase()||"USDC",pr=os($t?.icon_urls,"png")||$t?.icon_url,ce=os($t?.chain_icon_urls,"png")||$t?.chain_icon_url;ni.useEffect(()=>{async function Y(){try{let ae=await aa(t);et(ae.data),Ke(ae.preferred||[]);}catch(ae){console.error("Error fetching fiat currencies:",ae);}}Y();},[t]),ni.useEffect(()=>{if(C||pe.length===0||!Oe?.alpha2)return;let Y=Oe.alpha2.toUpperCase(),ae=pe.find(qt=>qt.country_codes.includes(Y));if(ae)d(ae.currency_code.toLowerCase()),!S&&!_&&b(String(ae.default_amount??100));else if(!S&&!_){let qt=pe.find(Tr=>Tr.currency_code.toLowerCase()==="usd");qt&&b(String(qt.default_amount??100));}},[pe,Oe,C,S,_]),ni.useEffect(()=>{if(pe.length!==0){if(D.current!==null&&D.current!==p){let Y=pe.find(ae=>ae.currency_code.toLowerCase()===p.toLowerCase());Y&&b(String(Y.default_amount??100));}D.current=p;}},[p,pe]),ni.useEffect(()=>{async function Y(){try{let ae=await rd({chain_type:s||"",chain_id:a||"",token_address:l||""},t);Ee(ae);}catch(ae){console.error("Error fetching supported tokens:",ae);}}Y();},[s,a,l,t]),ni.useEffect(()=>{async function Y(){if(!(!l||!a||!s)&&!he){me(true);try{let ae=await id({country_code:Oe?.alpha2?.toUpperCase()||"US",subdivision_code:Oe?.state||void 0,token_address:l,chain_id:a,chain_type:s},t);pt(ae);}catch(ae){console.error("Error fetching default onramp token:",ae);}finally{me(false);}}}Y();},[l,a,s,Oe,he,t]),ni.useEffect(()=>{let Y=parseFloat(S);if(isNaN(Y)||Y<=0){M([]),le(null);return}if(!Ce||It){M([]),we(null);return}let ae=pe.find(Tr=>Tr.currency_code.toLowerCase()===p.toLowerCase());if(ae){if(Y<ae.minimum_amount){M([]),we(null),le(`Minimum amount is ${vu(p)}${ae.minimum_amount.toLocaleString()}`);return}if(Y>ae.maximum_amount){M([]),we(null),le(`Maximum amount is ${vu(p)}${ae.maximum_amount.toLocaleString()}`);return}}le(null);let qt=setTimeout(()=>{xt(Y);},500);return ()=>clearTimeout(qt)},[S,p,t,Ce,It,pe]);let xt=async Y=>{if(!Ce){U("Loading token information...");return}O(true),U(null);try{let ae={country_code:Oe?.alpha2?.toUpperCase()||"US",source_amount:Y.toString(),source_currency:p.toLowerCase(),destination_currency:Ce.destination_currency,destination_network:Ce.destination_network,subdivision_code:Oe?.state||void 0},qt=await od(ae,t);M(qt.data);let Tr=ve.current,an=vt.current;if(Tr&&an){let Bn=qt.data.find(Wn=>Wn.service_provider===an.service_provider);if(Bn){if(we(Bn),qt.data.length>0){let Wn=qt.data[0];$e||ue(Wn.service_provider),Pe(Bn.service_provider===$e);}}else if(qt.data.length>0){let Wn=qt.data[0];we(Wn),ue(Wn.service_provider),Pe(!0),be(!1);}}else if(qt.data.length>0){let Bn=qt.data[0];we(Bn),ue(Bn.service_provider),Pe(!0);}ie(60);}catch(ae){console.error("Failed to fetch quotes:",ae),U("Failed to fetch quotes. Please try again."),M([]);}finally{O(false);}};ni.useEffect(()=>{if(v.length===0)return;let Y=setInterval(()=>{ie(ae=>{if(ae<=1){let qt=parseFloat(S);return !isNaN(qt)&&qt>0&&xt(qt),60}return ae-1});},1e3);return ()=>clearInterval(Y)},[v.length,S]);let Ct=Y=>{(/^\d*\.?\d{0,2}$/.test(Y)||Y==="")&&(b(Y),k(true));},z=Y=>{b(Y.toString()),k(true);},Xr=async()=>{if(ne&&Ce)try{let Y=Ce.destination_token_metadata.chain_type,ae=un(qe,Y);if(!ae?.address){U("Wallet address not available");return}let qt={service_provider:ne.service_provider,country_code:ne.country_code?.toUpperCase()||Oe?.alpha2?.toUpperCase()||"US",source_currency:ne.source_currency,source_amount:S,destination_currency:ne.destination_currency,destination_network:ne.destination_network,wallet_address:ae.address,subdivision_code:Oe?.state||void 0},Tr=await nd(qt,t);Vt({provider:ne,sourceCurrency:p,sourceAmount:S,sessionUrl:Tr.url}),L(Tr.url),Z(!0);}catch(Y){console.error("Failed to create session:",Y),U("Failed to start payment flow"),c?.({message:"Failed to start payment flow",error:Y});}},dt=vu(p),Ga=()=>{Z(false),Fe("onramp"),u?.({message:"Payment flow completed"});},Yi=()=>jsxRuntime.jsx(Ab,{visible:Se,onClose:Ga,url:Q,providerName:ne?.service_provider_display_name||"Complete Payment",colors:m,fonts:g,borderTopLeftRadius:w?.webView?.borderTopLeftRadius??y,borderTopRightRadius:w?.webView?.borderTopRightRadius??T});return I==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:K.amountViewContainer,children:[jsxRuntime.jsxs(at,{style:K.scrollContainer,contentContainerStyle:K.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:K.currencySelector,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Lt(true),style:[K.currencyButton,{backgroundColor:h.card.backgroundColor,borderRadius:h.input.borderRadius,borderWidth:h.input.borderWidth,borderColor:h.input.borderColor}],children:[q&&jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Te(q,"png"))},style:K.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[K.currencyText,{color:h.card.titleColor,fontFamily:g.medium}],children:p.toUpperCase()}),jsxRuntime.jsx(Gt,{size:16,color:h.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(pc,{open:ot,onOpenChange:Lt,currencies:pe,preferredCurrencyCodes:Ae,selectedCurrency:p,onSelectCurrency:Y=>{d(Y.toLowerCase()),x(true);},borderTopLeftRadius:w?.currencyModal?.borderTopLeftRadius??y,borderTopRightRadius:w?.currencyModal?.borderTopRightRadius??T}),jsxRuntime.jsx(reactNative.View,{style:K.amountContainer,children:jsxRuntime.jsxs(reactNative.View,{style:K.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[K.currencySymbol,{color:h.container.titleColor,fontFamily:g.medium}],children:dt}),jsxRuntime.jsx(reactNative.TextInput,{style:[K.amountInput,{color:h.container.titleColor,fontFamily:g.medium}],value:S,onChangeText:Ct,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:m.foregroundMuted})]})}),q?.suggested_amounts&&q.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:K.quickAmounts,children:q.suggested_amounts.map(Y=>jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>z(Y),style:[K.quickAmountButton,{backgroundColor:h.card.backgroundColor,borderRadius:h.button.borderRadius,borderWidth:parseFloat(S)===Y?2:h.button.borderWidth,borderColor:parseFloat(S)===Y?m.primary:h.button.borderColor}],children:jsxRuntime.jsxs(reactNative.Text,{style:[K.quickAmountText,{color:h.card.titleColor,fontFamily:g.medium}],children:[dt,Y.toLocaleString()]})},Y))}),j&&jsxRuntime.jsx(reactNative.Text,{style:[K.validationError,{color:m.error,fontFamily:g.regular}],children:j}),jsxRuntime.jsxs(reactNative.View,{style:K.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:K.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[K.providerLabel,{color:h.card.labelColor,fontFamily:g.medium}],children:"Provider"}),v.length>0&&!W&&jsxRuntime.jsxs(reactNative.Text,{style:[K.refreshText,{color:h.card.labelRightColor,fontFamily:g.regular}],children:["Refreshing in ",it,"s"]})]}),jsxRuntime.jsx(Cr,{cardTokens:h.depositCard.quoteProvider.card,onPress:W||v.length===0?void 0:()=>yt(true),contentStyle:reactNative.StyleSheet.flatten([K.providerButton,(W||v.length===0)&&K.disabled]),children:W?jsxRuntime.jsxs(reactNative.View,{style:K.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:m.primary}),jsxRuntime.jsx(reactNative.Text,{style:[K.loadingText,{color:h.container.subtitleColor,fontFamily:g.regular}],children:"Finding best rates..."})]}):ne?jsxRuntime.jsxs(reactNative.View,{style:K.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:K.providerInfo,children:[fe&&jsxRuntime.jsx(reactNative.Text,{style:[K.autoPickedText,{color:h.container.subtitleColor,fontFamily:g.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:K.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(pl(ne.icon_urls,"png",ne.icon_url))},style:K.providerIconImage},`provider-${ne.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[K.providerName,{color:h.card.titleColor,fontFamily:g.medium}],children:ne.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[K.bestPriceText,{color:h.container.subtitleColor,fontFamily:g.regular}],children:[ne.destination_amount.toFixed(2)," ",ke]})]})]})]}),jsxRuntime.jsx(_r,{size:20,color:h.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[K.noProviderText,{color:h.container.subtitleColor,fontFamily:g.regular}],children:parseFloat(S)>0?"No providers available":"Enter an amount to see providers"})}),F&&jsxRuntime.jsx(reactNative.Text,{style:[K.errorText,{color:m.error,fontFamily:g.regular}],children:F})]}),jsxRuntime.jsxs(bt,{visible:Bt,onClose:()=>yt(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:w?.providerModal?.borderTopLeftRadius??y,borderTopRightRadius:w?.providerModal?.borderTopRightRadius??T,children:[jsxRuntime.jsx(Ur,{title:"Select Provider",showBack:false,onClose:()=>yt(false)}),jsxRuntime.jsx(at,{style:K.providerModalList,contentContainerStyle:K.providerModalListContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:K.quotesList,children:v.map(Y=>{let ae=ne?.service_provider===Y.service_provider;return jsxRuntime.jsxs(Cr,{cardTokens:h.depositCard.quoteProvider.card,onPress:()=>{we(Y),be(true),Pe(Y.service_provider===$e),yt(false);},contentStyle:reactNative.StyleSheet.flatten([K.quoteItem,ae&&{borderWidth:2,borderColor:m.primary}]),children:[jsxRuntime.jsxs(reactNative.View,{style:K.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(pl(Y.icon_urls,"png",Y.icon_url))},style:K.providerIconImage}),jsxRuntime.jsx(reactNative.View,{children:jsxRuntime.jsx(reactNative.Text,{style:[K.quoteName,{color:h.card.titleColor,fontFamily:g.medium}],children:Y.service_provider_display_name})})]}),jsxRuntime.jsxs(reactNative.View,{style:K.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[K.quoteAmount,{color:h.card.textRightColor,fontFamily:g.medium}],children:[Y.destination_amount.toFixed(2)," ",ke]}),jsxRuntime.jsxs(reactNative.Text,{style:[K.quoteSource,{color:h.card.subtextRightColor,fontFamily:g.regular}],children:["Fee: ",dt,Y.total_fee.toFixed(2)]})]})]},Y.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[K.continueButtonContainer,{backgroundColor:m.background}],children:jsxRuntime.jsx(reactNative.View,{style:{opacity:W||Ve||!ne||parseFloat(S)<=0?.5:1},children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:Xr,disabled:W||Ve||!ne||parseFloat(S)<=0,style:[K.continueButton,{backgroundColor:h.container.buttonColor,borderRadius:h.button.borderRadius,borderWidth:h.button.borderWidth,borderColor:h.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[K.continueButtonText,{color:h.container.buttonTitleColor,fontFamily:g.medium}],children:Ve?"Loading...":"Continue"})})})})]}),Yi()]}):I==="onramp"&&je?jsxRuntime.jsxs(reactNative.View,{style:K.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(pl(je.provider.icon_urls,"png",je.provider.icon_url))},style:K.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[K.onrampTitle,{color:h.container.titleColor,fontFamily:g.medium}],children:["Complete transaction with ",je.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[K.onrampSubtitle,{color:h.container.subtitleColor,fontFamily:g.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[K.flowDiagram,{backgroundColor:h.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:K.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:cr(`/icons/currencies/png/${je.sourceCurrency.toLowerCase()}.png`)},style:K.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[K.flowLabel,{color:h.card.subtitleColor,fontFamily:g.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[K.flowValue,{color:h.card.titleColor,fontFamily:g.medium}],children:je.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(_r,{size:16,color:h.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:K.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:K.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:os(Ce?.destination_token_metadata?.icon_urls,"png")||Ce?.destination_token_metadata?.icon_url||cr("/icons/tokens/png/usdc.png")},style:K.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:os(Ce?.destination_token_metadata?.chain?.icon_urls,"png")||Ce?.destination_token_metadata?.chain?.icon_url||cr("/icons/networks/png/polygon.png")},style:[K.flowNetworkBadge,{borderColor:m.background,borderRadius:h.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[K.flowLabel,{color:h.card.subtitleColor,fontFamily:g.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[K.flowValue,{color:h.card.titleColor,fontFamily:g.medium}],children:"USDC"})]}),jsxRuntime.jsx(_r,{size:16,color:h.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:K.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:K.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:pr||cr("/icons/tokens/png/usdc.png")},style:K.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:ce||cr("/icons/networks/png/polygon.png")},style:[K.flowNetworkBadge,{borderColor:m.background,borderRadius:h.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[K.flowLabel,{color:h.card.subtitleColor,fontFamily:g.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[K.flowValue,{color:h.card.titleColor,fontFamily:g.medium}],children:ke})]})]}),jsxRuntime.jsx(reactNative.View,{style:[K.onrampInfoBox,{backgroundColor:h.card.backgroundColor,borderRadius:h.card.borderRadius,borderWidth:h.card.borderWidth,borderColor:h.card.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[K.onrampInfoText,{color:h.card.descriptionColor,fontFamily:g.regular}],children:"The wallet address displayed in the payment provider is a temporary deposit address. Your funds will be automatically converted and deposited into your account."})})]}):null}function Ab({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:i,borderTopLeftRadius:s,borderTopRightRadius:a}){return jsxRuntime.jsxs(bt,{visible:e,onClose:t,closeOnBackdropPress:false,enablePanDownToClose:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:s,borderTopRightRadius:a,children:[jsxRuntime.jsxs(reactNative.View,{style:Ni.header,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:Ni.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Le,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Ni.headerTitle,{color:n.foreground,fontFamily:i.medium}],children:o}),jsxRuntime.jsx(reactNative.View,{style:Ni.headerSpacer})]}),r&&jsxRuntime.jsx(reactNative.View,{style:Ni.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:r},style:Ni.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:Ni.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:n.primary})})})})]})}var Ni=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},headerButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},headerSpacer:{width:28,height:28},container:{flex:1},webView:{flex:1},loading:{position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"center"}}),K=reactNative.StyleSheet.create({amountViewContainer:{flex:1},scrollContainer:{flex:1},scrollContent:{padding:16,paddingBottom:16},currencySelector:{alignItems:"center",marginBottom:16},currencyButton:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:12,paddingVertical:8},currencyText:{fontSize:14,fontWeight:"500"},currencyIcon:{width:24,height:24,borderRadius:12},amountContainer:{alignItems:"center",marginBottom:24},amountInputRow:{flexDirection:"row",alignItems:"center",marginBottom:8},currencySymbol:{fontSize:48,fontWeight:"300"},amountInput:{fontSize:48,fontWeight:"300",minWidth:50},usdcPreview:{fontSize:14},quickAmounts:{flexDirection:"row",justifyContent:"center",gap:12,marginBottom:24},quickAmountButton:{paddingHorizontal:20,paddingVertical:10},quickAmountText:{fontSize:14,fontWeight:"500"},validationError:{fontSize:12,textAlign:"center",marginTop:12,paddingHorizontal:16},providerSection:{marginBottom:24},providerHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},providerLabel:{fontSize:12,fontWeight:"500"},refreshText:{fontSize:10},providerButton:{padding:16},disabled:{opacity:.5},providerLoading:{flexDirection:"row",alignItems:"center",gap:12},loadingText:{fontSize:14},providerContent:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},providerInfo:{flex:1},autoPickedText:{fontSize:12,marginBottom:6},providerRow:{flexDirection:"row",alignItems:"center",gap:12},providerIcon:{width:32,height:32,borderRadius:16},providerIconPlaceholder:{width:32,height:32,borderRadius:8},providerIconImage:{width:32,height:32,borderRadius:8},providerName:{fontSize:14,fontWeight:"500"},bestPriceText:{fontSize:11,marginTop:2},noProviderText:{fontSize:14,textAlign:"center"},errorText:{fontSize:12,marginTop:8},continueButtonContainer:{padding:16,paddingBottom:48},continueButton:{paddingVertical:16,alignItems:"center"},continueButtonText:{fontSize:16,fontWeight:"600"},webViewHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},webViewHeaderButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},webViewHeaderTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},webViewHeaderSpacer:{width:28,height:28},webViewContainer:{flex:1},webView:{flex:1},webViewLoading:{position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"center"},providerModalList:{flex:1,paddingHorizontal:12,marginTop:8},providerModalListContent:{paddingBottom:72},quotesList:{gap:8,paddingBottom:24,minHeight:468},quoteItem:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",padding:12},quoteLeft:{flexDirection:"row",alignItems:"center",gap:12},quoteIcon:{width:40,height:40,borderRadius:20},quoteName:{fontSize:14,fontWeight:"500"},quoteRight:{alignItems:"flex-end"},quoteAmount:{fontSize:14,fontWeight:"500"},quoteSource:{fontSize:12},onrampContainer:{flex:1,padding:16,alignItems:"center",paddingTop:24},onrampProviderIcon:{width:64,height:64,borderRadius:16},onrampTitle:{fontSize:18,fontWeight:"600",textAlign:"center",marginTop:20,marginBottom:8,paddingHorizontal:16},onrampSubtitle:{fontSize:14,textAlign:"center",marginBottom:24},flowDiagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:20,paddingHorizontal:24,borderRadius:12,width:"100%"},flowIconWithBadge:{position:"relative",width:24,height:24,marginBottom:4},flowIconImageNoBadge:{width:24,height:24,borderRadius:12},flowNetworkBadge:{position:"absolute",bottom:-4,right:-6,width:14,height:14,borderWidth:2},onrampInfoBox:{marginTop:16,padding:16,width:"100%"},onrampInfoText:{fontSize:13,lineHeight:20},flowStep:{alignItems:"center"},flowIcon:{width:28,height:28,borderRadius:14,marginBottom:4},flowIconImage:{width:24,height:24,borderRadius:12,marginBottom:4},flowLabel:{fontSize:10},flowValue:{fontSize:14,fontWeight:"500"}});function Ub(e){try{let t=new Date(e);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}catch{return e}}function Hb(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function bc({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=V(),i=n.depositTracker.executionRow.card,s=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=oe(Te(e.destination_token_metadata,"png")||cr("/icons/tokens/png/usdc.png")),u=s?"Deposit Processing":"Deposit Completed",c=Ub(e.created_at||new Date().toISOString()),y=Hb(e.source_amount_usd);return jsxRuntime.jsxs(Cr,{cardTokens:i,onPress:t,contentStyle:vn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:vn.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:l},style:vn.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[vn.statusBadge,{backgroundColor:s?r.warning:r.success,borderColor:i.backgroundColor}],children:s?jsxRuntime.jsx(Xi,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(Le,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:vn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[vn.title,{color:i.titleColor,fontFamily:o.medium}],children:u}),jsxRuntime.jsx(reactNative.Text,{style:[vn.dateTime,{color:i.subtitleColor,fontFamily:o.regular}],children:c})]}),jsxRuntime.jsxs(reactNative.View,{style:vn.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[vn.amount,{color:i.textRightColor,fontFamily:o.medium}],children:y}),jsxRuntime.jsx(_r,{size:20,color:i.actionColor,strokeWidth:2})]})]})}var vn=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-4,right:-4,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center",borderWidth:2},textContainer:{flex:1,gap:2},title:{fontSize:16,fontWeight:"500"},dateTime:{fontSize:13},rightContainer:{flexDirection:"row",alignItems:"center",gap:8},amount:{fontSize:16,fontWeight:"500"}});function If(e,t){let r={solana:"Solana",ethereum:"Ethereum",bitcoin:"Bitcoin"};return e==="ethereum"?{1:"Ethereum",137:"Polygon",8453:"Base",42161:"Arbitrum",10:"Optimism"}[t]||r[e]||e:r[e]||e}function Pf(e,t=6){if(!e)return "\u2014";try{let r=Number(e)/Math.pow(10,t);return r===0?"0.00":r>=1?r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:8,minimumSignificantDigits:2,maximumSignificantDigits:6})}catch{return "0.00"}}function jb(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var Of=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function Ff(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function $b(e){try{let t=new Date(e);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}catch{return e}}function qb({count:e=4}){let{colors:t,components:r}=V(),o=ni.useRef(new reactNative.Animated.Value(.5)).current,n=r.depositTracker.executionRow.card,i=t.cardHover;return ni.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[o]),jsxRuntime.jsx(reactNative.View,{style:ji.list,children:Array.from({length:e}).map((s,a)=>jsxRuntime.jsxs(reactNative.View,{style:[ji.row,{backgroundColor:n.backgroundColor,borderRadius:n.borderRadius??12,borderWidth:n.borderWidth,borderColor:n.borderColor}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[ji.icon,{backgroundColor:i,opacity:o}]}),jsxRuntime.jsxs(reactNative.View,{style:ji.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[ji.titleBar,{backgroundColor:i,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ji.subtitleBar,{backgroundColor:i,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ji.amountBar,{backgroundColor:i,opacity:o}]})]},a))})}var ji=reactNative.StyleSheet.create({list:{paddingTop:16,paddingHorizontal:16,gap:12},row:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},icon:{width:40,height:40,borderRadius:20,marginRight:12},textBlock:{flex:1,gap:6},titleBar:{height:14,width:"65%",borderRadius:7},subtitleBar:{height:11,width:"45%",borderRadius:5.5},amountBar:{height:14,width:50,borderRadius:7,marginLeft:12}});function Ou({active:e,onClose:t,executions:r,externalUserId:o,publishableKey:n}){let{colors:i,fonts:s,components:a}=V(),[l,u]=ni.useState(r),[c,y]=ni.useState(false),[T,w]=ni.useState(null),[m,g]=ni.useState(false),h=ni.useRef(null);ni.useEffect(()=>{if(!e||!o)return;let _=async()=>{y(true);try{let M=[...(await pn(o,n)).data].sort((W,O)=>{let F=W.created_at?new Date(W.created_at).getTime():0;return (O.created_at?new Date(O.created_at).getTime():0)-F});u(M);}catch(v){console.error("Failed to fetch executions:",v),u(r);}finally{y(false);}};_();let k=setInterval(_,1e4);return ()=>clearInterval(k)},[e,o,n,r]),ni.useEffect(()=>{r.length>0&&u(_=>{let k=new Set(_.map(M=>M.id)),v=r.filter(M=>!k.has(M.id));return v.length>0?[...v,..._]:_});},[r]),ni.useEffect(()=>{e||w(null);},[e]);let S=_=>{w(_);},b=()=>{w(null),g(false);},p=()=>{w(null),t();},d=()=>{if(!T)return null;let _=T,k=_.status==="pending"||_.status==="waiting"||_.status==="delayed",v=_.status==="succeeded",M=oe(Te(_.destination_token_metadata,"png")||cr("/icons/tokens/png/usdc.png")),W=_.provider_metadata?.details,O=W?.currencyIn,F=W?.currencyOut;O?.currency?.symbol||"USDC";F?.currency?.symbol||"USDC";let le=Pf(_.source_amount_base_unit,_.source_token_metadata?.decimals),Ye=Pf(_.destination_amount_base_unit,_.destination_token_metadata?.decimals),_e=jb(_.source_amount_usd),ne=If(_.source_chain_type,_.source_chain_id),we=If(_.destination_chain_type,_.destination_chain_id),fe=()=>{_.explorer_url&&reactNative.Linking.openURL(_.explorer_url);},Pe=()=>{_.destination_explorer_url&&reactNative.Linking.openURL(_.destination_explorer_url);};return jsxRuntime.jsxs(at,{ref:h,style:ge.scrollContainer,contentContainerStyle:ge.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:ge.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:ge.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:M},style:ge.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[ge.statusBadge,{backgroundColor:k?i.warning:i.success,borderColor:i.background}],children:k?jsxRuntime.jsx(Gt,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(Le,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ge.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ge.statusDot,{backgroundColor:k?i.warning:i.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[ge.statusText,{color:a.container.titleColor,fontFamily:s.semibold}],children:k?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[ge.dateText,{color:a.container.subtitleColor,fontFamily:s.regular}],children:$b(_.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[ge.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ge.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ge.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[ge.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:[le," ",Ff(_.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[ge.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:ge.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ge.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[ge.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:[Ye," ",Ff(_.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[ge.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:ge.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ge.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[ge.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:_e})]}),jsxRuntime.jsx(reactNative.View,{style:[ge.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:ge.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ge.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[ge.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:ne})]}),jsxRuntime.jsx(reactNative.View,{style:[ge.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:ge.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ge.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[ge.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:we})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let $e=!m;g($e),$e?setTimeout(()=>{h.current?.scrollToEnd({animated:true});},100):h.current?.scrollTo({y:0,animated:true});},style:ge.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[ge.toggleText,{color:a.container.actionTitle,fontFamily:s.regular}],children:m?"See less":"See more details"}),m?jsxRuntime.jsx(Vo,{size:14,color:a.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Gt,{size:14,color:a.container.actionColor,strokeWidth:2})]}),m&&jsxRuntime.jsxs(reactNative.View,{style:[ge.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[_.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:fe,style:ge.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ge.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:ge.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[ge.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:Of(_.transaction_hash)}),jsxRuntime.jsx(Do,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[ge.cardDivider,{backgroundColor:i.border}]})]}),_.destination_explorer_url&&v&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:Pe,style:ge.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ge.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:ge.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[ge.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:Of(_.destination_transaction_hashes[0])}),jsxRuntime.jsx(Do,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]})]})]})},C=c&&l.length===0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ur,{title:T?"Deposit Details":"Deposit Tracker",onClose:p,showClose:!T,showBack:!!T,onBack:b}),T?d():C?jsxRuntime.jsx(qb,{}):jsxRuntime.jsx(at,{style:ge.scrollContainer,contentContainerStyle:ge.scrollContent,showsVerticalScrollIndicator:false,children:l.length===0?jsxRuntime.jsxs(reactNative.View,{style:ge.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ge.emptyText,{color:a.container.titleColor,fontFamily:s.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[ge.emptySubtext,{color:a.container.subtitleColor,fontFamily:s.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:ge.executionsList,children:l.map(_=>jsxRuntime.jsx(bc,{execution:_,onPress:()=>S(_)},_.id))})})]})}var ge=reactNative.StyleSheet.create({scrollContainer:{flex:1,paddingTop:16},scrollContent:{paddingHorizontal:16,paddingBottom:40},emptyContainer:{paddingVertical:40,paddingHorizontal:16,alignItems:"center"},emptyText:{fontSize:14,marginBottom:4},emptySubtext:{fontSize:12},executionsList:{paddingTop:8,gap:12},detailsContent:{paddingHorizontal:16,paddingBottom:32},iconSection:{alignItems:"center",marginBottom:24},iconWrapper:{position:"relative",marginBottom:12},tokenIcon:{width:72,height:72,borderRadius:36},statusBadge:{position:"absolute",bottom:0,right:0,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center",borderWidth:3},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16,fontWeight:"600"},dateText:{fontSize:14},card:{borderRadius:12,marginBottom:12,overflow:"hidden"},cardRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},cardRowRight:{flexDirection:"row",alignItems:"center",gap:8},cardDivider:{height:1,marginHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"},toggleButton:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12,paddingHorizontal:4},toggleText:{fontSize:14},buttonSection:{marginTop:12,gap:10},actionButton:{flexDirection:"row",alignItems:"center",paddingVertical:16,paddingHorizontal:16,borderRadius:12},buttonIconLeft:{marginRight:12},buttonIconRight:{marginLeft:12},buttonText:{color:"#FFFFFF",fontSize:14,fontWeight:"600",flex:1,textAlign:"left"},hintText:{fontSize:12,textAlign:"center",marginTop:8}});function Na(e,t=true){let[r,o]=ni.useState(null),[n,i]=ni.useState(null),[s,a]=ni.useState(false),[l,u]=ni.useState(false),[c,y]=ni.useState(null),[T,w]=ni.useState(null);ni.useEffect(()=>{!t||r||(a(true),ca().then(S=>{o(S),y(null);}).catch(S=>{y(S instanceof Error?S:new Error(String(S)));}).finally(()=>{a(false);}));},[t,r]),ni.useEffect(()=>{!t||!e||n||(u(true),la(e).then(S=>{i(S),w(null);}).catch(S=>{w(S instanceof Error?S:new Error(String(S)));}).finally(()=>{u(false);}));},[t,e,n]);let m=s||l,g=c||T||null,h=null;if(r&&n){let S=n.blocked_country_codes||[],b=r.alpha2.toUpperCase();h=!S.some(p=>p.toUpperCase()===b);}return {isAllowed:h,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:m,error:g}}var Vu="unifold_recent_tokens",Jb=5,Af=[{symbol:"ETH",chainType:"ethereum",chainId:"1"},{symbol:"SOL",chainType:"solana",chainId:"mainnet"},{symbol:"USDC",chainType:"solana",chainId:"mainnet"},{symbol:"POL",chainType:"ethereum",chainId:"137"},{symbol:"BNB",chainType:"ethereum",chainId:"56"},{symbol:"BTC",chainType:"bitcoin",chainId:"mainnet"}];async function Tc(){try{let e=await Fd__default.default.getItem(Vu);return e?JSON.parse(e):[]}catch{return []}}async function Zb(e){try{let r=(await Tc()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,Jb);await Fd__default.default.setItem(Vu,JSON.stringify(o));}catch{}}async function Xb(e){try{let r=(await Tc()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await Fd__default.default.setItem(Vu,JSON.stringify(r)),r}catch{return []}}function Lu({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:i,borderTopLeftRadius:s,borderTopRightRadius:a}){let{colors:l,fonts:u,components:c}=V(),[y,T]=ni.useState(""),[w,m]=ni.useState([]);ni.useEffect(()=>{e&&Tc().then(m);},[e]),ni.useEffect(()=>{e||T("");},[e]);let g=ni.useMemo(()=>{let C=[];return r.forEach(x=>{x.chains.forEach(_=>{C.push({token:x,chain:_});});}),C},[r]),h=ni.useMemo(()=>{let C=[],x=new Set,_=(k,v,M,W)=>{let O=`${k}-${v}:${M}`;if(x.has(O))return;let F=r.find(j=>j.symbol===k);if(!F)return;let U=F.chains.find(j=>j.chain_type===v&&j.chain_id===M);U&&(x.add(O),C.push({token:F,chain:U,isRecent:W}));};return w.forEach(k=>{_(k.symbol,k.chainType,k.chainId,true);}),Af.forEach(k=>{_(k.symbol,k.chainType,k.chainId,false);}),C},[r,w]),S=ni.useMemo(()=>{if(!y.trim())return g;let C=y.toLowerCase();return g.filter(({token:x,chain:_})=>x.symbol.toLowerCase().includes(C)||x.name.toLowerCase().includes(C)||_.chain_name.toLowerCase().includes(C))},[g,y]),b=(C,x,_)=>Af.some(k=>k.symbol===C&&k.chainType===x&&k.chainId===_),p=async(C,x)=>{let _=`${x.chain_type}:${x.chain_id}`;if(!b(C.symbol,x.chain_type,x.chain_id)){await Zb({symbol:C.symbol,chainType:x.chain_type,chainId:x.chain_id});let k=await Tc();m(k);}T(""),i(C.symbol,_),t();},d=async(C,x)=>{let _=await Xb({symbol:C.symbol,chainType:x.chain_type,chainId:x.chain_id});m(_);};return jsxRuntime.jsxs(bt,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,startExpanded:false,borderTopLeftRadius:s,borderTopRightRadius:a,children:[jsxRuntime.jsxs(reactNative.View,{style:gt.header,children:[jsxRuntime.jsx(reactNative.View,{style:gt.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[gt.headerTitle,{color:c.header.titleColor,fontFamily:u.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:gt.closeButton,children:jsxRuntime.jsx(st,{size:20,color:c.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:gt.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[gt.searchInput,{backgroundColor:c.search.backgroundColor,color:c.search.inputColor,fontFamily:u.regular,borderRadius:c.input.borderRadius,borderWidth:c.input.borderWidth,borderColor:c.input.borderColor}],placeholder:"Search",placeholderTextColor:c.search.placeholderColor,value:y,onChangeText:T,autoCapitalize:"none",autoCorrect:false})}),h.length>0&&!y&&jsxRuntime.jsxs(reactNative.View,{style:gt.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[gt.sectionLabel,{color:c.list.titleSectionColor,fontFamily:u.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:gt.quickSelectScroll,children:h.map(({token:C,chain:x,isRecent:_})=>{let k=`${x.chain_type}:${x.chain_id}`;C.symbol===o&&k===n;return jsxRuntime.jsxs(reactNative.View,{children:[_&&jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>d(C,x),style:gt.removeButton,children:jsxRuntime.jsx(st,{size:12,color:l.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>p(C,x),activeOpacity:.7,style:[gt.quickSelectItem,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:gt.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Te(C,"png"))},style:gt.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Te(x,"png"))},style:[gt.quickSelectChainBadge,{borderColor:c.card.backgroundColor,borderRadius:c.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:gt.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[gt.quickSelectSymbol,{color:c.card.titleColor,fontFamily:u.medium}],children:C.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[gt.quickSelectChain,{color:c.card.subtitleColor,fontFamily:u.regular}],children:x.chain_name})]})]})]},`quick-${C.symbol}-${k}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[gt.sectionLabel,{color:c.list.titleSectionColor,fontFamily:u.regular}],children:"All supported tokens"}),jsxRuntime.jsx(at,{style:gt.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:gt.tokenListContent,children:S.length===0?jsxRuntime.jsx(reactNative.View,{style:gt.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[gt.emptyText,{color:l.foregroundMuted,fontFamily:u.regular}],children:"No tokens found"})}):S.map(({token:C,chain:x})=>{let _=`${x.chain_type}:${x.chain_id}`,k=C.symbol===o&&_===n;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>p(C,x),activeOpacity:.7,style:[gt.tokenItem,{backgroundColor:k?c.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:gt.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Te(C,"png"))},style:gt.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Te(x,"png"))},style:[gt.tokenChainBadge,{borderColor:c.card.backgroundColor,borderRadius:c.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:gt.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[gt.tokenSymbol,{color:c.card.titleColor,fontFamily:u.medium}],children:C.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[gt.tokenChainName,{color:c.card.subtitleColor,fontFamily:u.regular}],children:x.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[gt.minDeposit,{color:c.card.labelColor,fontFamily:u.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:c.card.labelHighlightRightColor,fontFamily:u.regular},children:["$",x.minimum_deposit_amount_usd]})]})]},`${C.symbol}-${_}`)})})]})}var gt=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},closeButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",textAlign:"center",flex:1},headerSpacer:{width:28},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:40,paddingHorizontal:16,fontSize:14},quickSelectSection:{marginBottom:12},sectionLabel:{fontSize:12,paddingHorizontal:16,marginBottom:8},quickSelectScroll:{paddingHorizontal:16,gap:8},quickSelectItem:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:8,paddingHorizontal:12},removeButton:{position:"absolute",top:-2,right:-6,zIndex:1,padding:2},tokenIconContainer:{position:"relative"},quickSelectIcon:{width:28,height:28,borderRadius:14},quickSelectChainBadge:{position:"absolute",bottom:-2,right:-2,width:14,height:14,borderRadius:7,borderWidth:2},quickSelectText:{alignItems:"flex-start"},quickSelectSymbol:{fontSize:12,fontWeight:"500"},quickSelectChain:{fontSize:10},tokenList:{flex:1},tokenListContent:{paddingHorizontal:16,paddingBottom:72,gap:4},emptyState:{padding:32,alignItems:"center"},emptyText:{fontSize:14},tokenItem:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:12},tokenIconContainerLarge:{position:"relative"},tokenIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenInfo:{flex:1},tokenSymbol:{fontSize:14,fontWeight:"500"},tokenChainName:{fontSize:12},minDeposit:{fontSize:12}});var _c=(e,t)=>`${t}:${e}`,nC=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function Bu({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:i,destinationTokenSymbol:s,defaultChainType:a,defaultChainId:l,defaultTokenAddress:u,depositConfirmationMode:c="auto_ui",onExecutionsChange:y,onDepositSuccess:T,onDepositError:w,wallets:m,borderTopLeftRadius:g,borderTopRightRadius:h,sheetBorderRadius:S}){let{colors:b,fonts:p,components:d}=V(),C=a&&l?`${a}:${l}`:"solana:mainnet",[x,_]=ni.useState("USDC"),[k,v]=ni.useState(C),[M,W]=ni.useState([]),[O,F]=ni.useState(!m?.length),U=m?.length?m:M,[j,le]=ni.useState([]),[Ye,_e]=ni.useState(true),[ne,we]=ni.useState(false),[fe,Pe]=ni.useState(false),[$e,ue]=ni.useState(false),[J,be]=ni.useState([]),[vt,ve]=ni.useState(new Map),[qe]=ni.useState(()=>new Date),[Ne,Ve]=ni.useState(null),[ze,it]=ni.useState(false),[ie,pe]=ni.useState(null),[et,Ae]=ni.useState(false),Ke=new Map;j.forEach(Z=>{Z.chains.forEach(Q=>{let L=`${Q.chain_type}:${Q.chain_id}`;Ke.has(L)||Ke.set(L,Q);});});let $t=Array.from(Ke.values()),Ee=nC(k),Oe=$t.find(Z=>Z.chain_type===Ee.chainType&&Z.chain_id===Ee.chainId),ar=Oe?.chain_type||"ethereum",he=un(U,ar),X=he?.address||"",Ce=ni.useRef(false);ni.useEffect(()=>{async function Z(){try{_e(!0),Ve(null);let L=await Ci(t,i&&n&&o?{destination_token_address:i,destination_chain_id:n,destination_chain_type:o}:void 0);if(le(L.data),L.data.length>0&&!Ce.current){Ce.current=!0;let I,D;if(a&&l)if(u)for(let q of L.data){let Fe=q.chains.find(ke=>ke.chain_type===a&&ke.chain_id===l&&ke.token_address.toLowerCase()===u.toLowerCase());if(Fe){I=q,D=Fe;break}}else for(let q of L.data){let Fe=q.chains.find(ke=>ke.chain_type===a&&ke.chain_id===l);if(Fe){I=q,D=Fe;break}}if(!I&&i)for(let q of L.data){let Fe=q.chains.find(ke=>ke.token_address.toLowerCase()===i.toLowerCase());if(Fe){I=q,D=Fe;break}}I||(I=L.data.find(q=>q.symbol==="USDC"),I&&I.chains.length>0&&(D=I.chains[0])),I||(I=L.data.find(q=>q.symbol==="USDT"),I&&I.chains.length>0&&(D=I.chains[0])),I||(I=L.data[0],I.chains.length>0&&(D=I.chains[0])),I&&_(I.symbol),D&&v(_c(D.chain_id,D.chain_type));}}catch(Q){console.error("Error fetching supported tokens:",Q),Ve("Failed to load supported tokens"),w?.({message:"Failed to load supported tokens",error:Q});}finally{_e(false);}}Z();},[t,i,n,o,a,l,u,w]),ni.useEffect(()=>{y&&y(J);},[J,y]),ni.useEffect(()=>{if(m?.length){F(false);return}if(M.length>0){F(false);return}let Z=null,Q=false,L=async()=>{if(!Q){F(true);try{let I=await dn({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:i},t);Q||(W(I.data),Ve(null),F(!1));}catch(I){console.error("Error fetching wallets, retrying in 5s:",I),Q||(Ve(I instanceof Error?I.message:"Failed to load wallets"),F(false),Z=setTimeout(L,5e3));}}};return L(),()=>{Q=true,Z&&clearTimeout(Z);}},[e,r,o,n,i,t,m,M.length]);let pt=he?.id??"",{showWaitingUi:It,handleIveDeposited:me}=Ma({depositConfirmationMode:c,depositAddress:X,chain:k,externalUserId:e,publishableKey:t,modalOpenedAt:qe,depositWalletId:pt,depositExecutions:J,trackedExecutions:vt,setDepositExecutions:be,setTrackedExecutions:ve,setLatestExecution:pe,setShowStatusSheet:it,onDepositSuccess:T,onExecutionsChange:y,onDepositError:w});ni.useEffect(()=>{if(!j.length)return;let Z=j.find(L=>L.symbol===x);if(!Z||Z.chains.length===0)return;if(!Z.chains.some(L=>_c(L.chain_id,L.chain_type)===k)){let L=Z.chains[0];v(_c(L.chain_id,L.chain_type));}},[x,j,k]);let je=j.find(Z=>Z.symbol===x),ot=(je?.chains||[]).find(Z=>_c(Z.chain_id,Z.chain_type)===k),Lt=async()=>{if(X)try{reactNative.Clipboard.setString(X),we(!0),setTimeout(()=>we(!1),2e3);}catch(Z){console.error("Failed to copy:",Z);}},Bt=ot?.estimated_price_impact_percent??0,yt=ot?.max_slippage_percent??.25,Se=ot?.minimum_deposit_amount_usd??3;return Ye?jsxRuntime.jsxs(reactNative.View,{style:N.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:b.primary}),jsxRuntime.jsx(reactNative.Text,{style:[N.loadingText,{color:b.foregroundMuted,fontFamily:p.regular}],children:"Loading currencies..."})]}):Ne&&j.length===0?jsxRuntime.jsxs(reactNative.View,{style:N.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.errorText,{color:b.error,fontFamily:p.regular}],children:Ne}),jsxRuntime.jsx(reactNative.Text,{style:[N.errorHint,{color:b.foregroundMuted,fontFamily:p.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:N.container,children:[jsxRuntime.jsxs(reactNative.View,{style:N.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.selectorLabel,{color:d.card.labelColor,fontFamily:p.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ue(true),disabled:Ye||j.length===0,style:[N.tokenSelectorButton,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],activeOpacity:.7,children:Ye?jsxRuntime.jsxs(reactNative.View,{style:N.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[N.loadingIcon,{backgroundColor:b.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:N.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[N.loadingLine,{backgroundColor:b.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[N.loadingLine,{backgroundColor:b.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:N.tokenIconWrapper,children:[je&&jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Te(je,"png"))},style:N.tokenMainIcon}),(ot||Oe)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Te(ot||Oe,"png"))},style:[N.tokenChainBadge,{borderColor:d.card.backgroundColor,borderRadius:d.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:N.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.tokenSelectorSymbol,{color:d.card.titleColor,fontFamily:p.semibold}],children:je?.symbol||x}),jsxRuntime.jsx(reactNative.Text,{style:[N.tokenSelectorNetwork,{color:d.card.subtitleColor,fontFamily:p.regular}],numberOfLines:1,children:ot?.chain_name||Oe?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:N.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[N.minDepositText,{color:d.card.labelHighlightRightColor,fontFamily:p.medium}],children:["$",Se," min"]}),jsxRuntime.jsx(_r,{size:16,color:d.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(Lu,{visible:$e,onClose:()=>ue(false),tokens:j,selectedToken:x,selectedChainKey:k,onSelect:(Z,Q)=>{_(Z),v(Q);},borderTopLeftRadius:S?.tokenSelector?.borderTopLeftRadius??g,borderTopRightRadius:S?.tokenSelector?.borderTopRightRadius??h}),jsxRuntime.jsx(reactNative.View,{style:N.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[N.qrWrapper,{backgroundColor:b.background,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth>0?d.card.borderWidth:1,borderColor:d.card.borderColor}],children:O?jsxRuntime.jsxs(reactNative.View,{style:N.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:b.primary}),jsxRuntime.jsx(reactNative.Text,{style:[N.loadingText,{color:b.foregroundMuted,fontFamily:p.regular}],children:"Loading..."})]}):X?jsxRuntime.jsx(Es,{value:X,size:180,logoUri:oe(Te(ot,"png")||cr("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:N.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[N.errorText,{color:b.error,fontFamily:p.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:N.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:N.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.addressLabel,{color:d.card.labelColor,fontFamily:p.medium}],children:"Deposit Address"}),ne&&jsxRuntime.jsxs(reactNative.View,{style:N.copiedIndicator,children:[jsxRuntime.jsx(Le,{size:14,color:b.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[N.copiedText,{color:b.success,fontFamily:p.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(Cr,{cardTokens:d.transferCrypto.depositAddress.card,onPress:!O&&X?Lt:void 0,contentStyle:N.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.addressText,{color:d.card.titleColor,fontFamily:p.regular}],numberOfLines:2,children:O?"Loading...":X||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:N.addressCopyIcon,children:jsxRuntime.jsx(ln,{size:16,color:d.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[N.detailsCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Pe(!fe),style:N.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:N.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[N.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Nr,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[N.detailsLabel,{color:d.card.titleColor,fontFamily:p.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:N.chevronContainer,children:fe?jsxRuntime.jsx(Vo,{size:16,color:d.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Gt,{size:16,color:d.card.actionColor,strokeWidth:2})})]}),fe&&jsxRuntime.jsxs(reactNative.View,{style:N.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:N.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[N.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(An,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[N.detailsLabel,{color:d.card.titleColor,fontFamily:p.regular}],children:["Price impact: ",Bt.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ae(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(es,{size:14,color:d.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:N.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[N.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(jr,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[N.detailsLabel,{color:d.card.titleColor,fontFamily:p.regular}],children:["Slippage: Auto \u2022 ",yt.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ae(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(es,{size:14,color:d.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:N.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[N.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(il,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[N.detailsLabel,{color:d.card.titleColor,fontFamily:p.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(ac,{depositConfirmationMode:c,depositAddress:X,showWaitingUi:It,latestExecution:ie,onIveDeposited:me}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:N.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[N.termsText,{color:b.primary,fontFamily:p.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(bt,{visible:et,onClose:()=>Ae(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:S?.infoSheet?.borderTopLeftRadius??g,borderTopRightRadius:S?.infoSheet?.borderTopRightRadius??h,children:[jsxRuntime.jsxs(reactNative.View,{style:[N.sheetHeader,{borderBottomColor:b.border}],children:[jsxRuntime.jsx(reactNative.View,{style:N.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[N.sheetTitle,{color:d.header.titleColor,fontFamily:p.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ae(false),style:N.sheetCloseButton,children:jsxRuntime.jsx(st,{size:20,color:d.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:N.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[N.infoCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:N.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[N.infoCardIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(An,{size:16,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[N.infoCardTitle,{color:d.card.titleColor,fontFamily:p.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[N.infoCardValue,{color:d.card.titleColor,fontFamily:p.medium}],children:[Bt.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[N.infoCardDescription,{color:d.card.descriptionColor,fontFamily:p.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[N.infoCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:N.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[N.infoCardIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(jr,{size:16,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[N.infoCardTitle,{color:d.card.titleColor,fontFamily:p.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[N.infoCardValue,{color:d.card.titleColor,fontFamily:p.medium}],children:[yt.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[N.infoCardDescription,{color:d.card.descriptionColor,fontFamily:p.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]}),ie&&jsxRuntime.jsx(Ms,{visible:ze,status:ie.status,tokenIconUrl:ie.destination_token_metadata?.icon_urls?.find(Z=>Z.format==="png")?.url||ie.destination_token_metadata?.icon_url||Te(je,"png"),explorerUrl:ie.explorer_url,completionExplorerUrl:ie.destination_explorer_url,date:ie.created_at?new Date(ie.created_at):void 0,amountUsd:ie.source_amount_usd?parseFloat(ie.source_amount_usd):void 0,onClose:()=>it(false),borderTopLeftRadius:S?.depositStatus?.borderTopLeftRadius??g,borderTopRightRadius:S?.depositStatus?.borderTopRightRadius??h})]})}var N=reactNative.StyleSheet.create({container:{flex:1,paddingHorizontal:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:12,marginBottom:8},tokenSelectorButton:{flexDirection:"row",alignItems:"center",gap:12,padding:12},tokenSelectorLoading:{flexDirection:"row",alignItems:"center",gap:12,flex:1},loadingIcon:{width:40,height:40,borderRadius:20},loadingTextContainer:{flex:1},loadingLine:{height:12,borderRadius:6},tokenIconWrapper:{position:"relative"},tokenMainIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenSelectorInfo:{flex:1},tokenSelectorSymbol:{fontSize:14,fontWeight:"500"},tokenSelectorNetwork:{fontSize:12,marginTop:2},tokenSelectorRight:{flexDirection:"row",alignItems:"center",gap:8},minDepositText:{fontSize:12,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:8},qrWrapper:{padding:16},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:12},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{position:"relative",paddingHorizontal:12,paddingVertical:16},addressText:{fontSize:12,fontFamily:"monospace"},addressCopyIcon:{position:"absolute",right:12,top:0,bottom:0,justifyContent:"center"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},termsContainer:{alignItems:"center",paddingVertical:8},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});var On={transferCrypto:{title:"Transfer Crypto",subtitle:"No limit \u2022 Instant"},depositWithCard:{title:"Deposit with Card",subtitle:"$50,000 limit \u2022 2 min"},stripeLinkPay:{title:"Pay with Stripe Link",subtitle:"Apple Pay or Card"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"}};function cC(){let{colors:e,components:t}=V(),r=ni.useRef(new reactNative.Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;ni.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(r,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(r,{toValue:.5,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[r]);let i=({rightIcons:s=2})=>jsxRuntime.jsxs(reactNative.View,{style:[mi.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[mi.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxRuntime.jsxs(reactNative.View,{style:mi.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[mi.titleBar,{backgroundColor:n,opacity:r}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[mi.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsxRuntime.jsx(reactNative.View,{style:mi.rightIcons,children:Array.from({length:s}).map((a,l)=>jsxRuntime.jsx(reactNative.Animated.View,{style:[mi.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxRuntime.jsxs(reactNative.View,{style:mi.container,children:[jsxRuntime.jsx(i,{rightIcons:3}),jsxRuntime.jsx(i,{rightIcons:2}),jsxRuntime.jsx(i,{rightIcons:0})]})}var mi=reactNative.StyleSheet.create({container:{paddingTop:8,paddingBottom:24,gap:8},card:{marginHorizontal:16,flexDirection:"row",alignItems:"center",paddingVertical:16,paddingHorizontal:12,gap:12},leftIcon:{width:36,height:36},textBlock:{flex:1,gap:6},titleBar:{height:12,width:"70%",borderRadius:6},subtitleBar:{height:10,width:"50%",borderRadius:5},rightIcons:{flexDirection:"row",alignItems:"center",gap:4},rightIcon:{width:20,height:20,borderRadius:10}});function dC({visible:e,onClose:t,externalUserId:r,publishableKey:o,modalTitle:n="Deposit",destinationTokenSymbol:i,recipientAddress:s,destinationChainType:a,destinationChainId:l,destinationTokenAddress:u,defaultChainType:c,defaultChainId:y,defaultTokenAddress:T,showBalance:w=false,hideDepositTracker:m=false,enableStripeLinkPay:g=false,StripeOnrampComponent:h,stripeOnrampEmail:S,stripeOnrampPhone:b,stripeMerchantIdentifier:p,stripePaymentSelectorPosition:d,stripeSkipSuccessConfirmation:C,stripeTheme:x,depositConfirmationMode:_="auto_ui",transferInputVariant:k="double_input",initialScreen:v="main",onDepositSuccess:M,onDepositError:W,sheetBorderRadius:O}){let F=O?.globalBorderTopLeftRadius,U=O?.globalBorderTopRightRadius,{colors:j,fonts:le}=V(),[Ye,_e]=ni.useState([]),[ne,we]=ni.useState(null),[fe,Pe]=ni.useState("amount"),$e=v==="tracker"&&!m?"tracker":v==="transfer"?"transfer":v==="card"?"card":"main",ue=$e==="main",[J,be]=ni.useState($e),{isAllowed:vt,isLoading:ve}=Na(o,e);ni.useEffect(()=>{if(!e||ne)return;let he=false;return la(o).then(async X=>{if(he)return;let Ce=[];for(let pt of X?.transfer_crypto?.networks??[]){let It=pt.icon_urls.find(me=>me.format==="png")?.url||pt.icon_urls.find(me=>me.format==="svg")?.url;It&&Ce.push(oe(It));}for(let pt of X?.payment_networks?.networks??[]){let It=pt.icon_urls.find(me=>me.format==="png")?.url||pt.icon_urls.find(me=>me.format==="svg")?.url;It&&Ce.push(oe(It));}Ce.length>0&&await su(Ce),he||we(X);}).catch(console.error),()=>{he=true;}},[e,ne,o]);let qe=()=>{t();};ni.useEffect(()=>{e&&(be($e),Pe("amount"));},[e,$e]);let Ne=ni.useCallback(()=>{ue?(be("main"),Pe("amount")):qe();},[ue,qe]),Ve=Ye.filter(he=>he.status==="pending"||he.status==="waiting").length,it=!!(s&&a&&l&&u&&o)&&w!==false&&!!ne,ie=ve||e&&!ne,pe=vt===false,et=null;if(J==="stripe"&&h){let he=jsxRuntime.jsx(h,{publishableKey:o,email:S,phone:b,externalUserId:r,recipientAddress:s??"",destinationChainType:a,destinationChainId:l,destinationTokenAddress:u,merchantIdentifier:p,paymentSelectorPosition:d,skipSuccessConfirmation:C,appName:ne?.project_name??"",onClose:Ne});et=x?jsxRuntime.jsx(ts,{...x,children:he}):he;}let Ae=J==="stripe"?.9:J==="transfer"||J==="card"?.94:J==="tracker"?.6:J==="main"?.5:void 0,Ke=J==="tracker"||J==="main"?.9:void 0,Ee={main:O?.main,transfer:O?.transferCrypto,card:O?.buyWithCard,stripe:O?.stripeLinkPay,tracker:O?.depositsTracker}[J],Oe=Ee?.borderTopLeftRadius??F,ar=Ee?.borderTopRightRadius??U;return jsxRuntime.jsxs(bt,{visible:e,onClose:J==="main"?qe:Ne,closeOnBackdropPress:false,enablePanDownToClose:true,showHandle:true,heightPercent:Ae,maxHeightPercent:Ke,borderTopLeftRadius:Oe,borderTopRightRadius:ar,children:[J==="main"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ur,{title:n,showBack:false,onClose:qe,showBalance:it,balanceAddress:s,balanceChainType:a,balanceChainId:l,balanceTokenAddress:u,publishableKey:o,projectName:ne?.project_name}),ie&&jsxRuntime.jsx(cC,{}),!ie&&pe&&jsxRuntime.jsxs(reactNative.View,{style:Ar.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[Ar.iconContainer,{backgroundColor:j.cardHover}],children:jsxRuntime.jsx(ta,{size:32,color:j.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Ar.blockedTitle,{color:j.foreground,fontFamily:le.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[Ar.blockedDescription,{color:j.foreground,opacity:.7,fontFamily:le.regular}],children:"There are no supported tokens available from your current location."})]}),!ie&&!pe&&jsxRuntime.jsxs(reactNative.View,{style:Ar.optionsContainer,children:[jsxRuntime.jsx(Va,{onPress:()=>be("transfer"),title:On.transferCrypto.title,subtitle:On.transferCrypto.subtitle,featuredTokens:ne?.transfer_crypto?.networks}),jsxRuntime.jsx(Ba,{onPress:()=>be("card"),title:On.depositWithCard.title,subtitle:On.depositWithCard.subtitle,paymentNetworks:ne?.payment_networks?.networks}),g&&h&&jsxRuntime.jsx(Ea,{onPress:()=>be("stripe"),title:On.stripeLinkPay.title,subtitle:On.stripeLinkPay.subtitle}),!m&&jsxRuntime.jsx(Wa,{onPress:()=>be("tracker"),title:On.depositTracker.title,subtitle:On.depositTracker.subtitle,badge:Ve>0?Ve:void 0})]})]}),J==="transfer"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ur,{title:On.transferCrypto.title,showBack:false,onClose:Ne,showBalance:it,balanceAddress:s,balanceChainType:a,balanceChainId:l,balanceTokenAddress:u,publishableKey:o,projectName:ne?.project_name}),ve&&jsxRuntime.jsx(reactNative.View,{style:[Ar.centeredContainer,Ar.centeredFlex],children:jsxRuntime.jsx(reactNative.ActivityIndicator,{color:j.primary})}),!ve&&pe&&jsxRuntime.jsxs(reactNative.View,{style:[Ar.centeredContainer,Ar.centeredFlex],children:[jsxRuntime.jsx(reactNative.View,{style:[Ar.iconContainer,{backgroundColor:j.cardHover}],children:jsxRuntime.jsx(ta,{size:32,color:j.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Ar.blockedTitle,{color:j.foreground,fontFamily:le.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[Ar.blockedDescription,{color:j.foreground,opacity:.7,fontFamily:le.regular}],children:"There are no supported tokens available from your current location."})]}),!ve&&!pe&&jsxRuntime.jsx(at,{style:Ar.transferScrollContainer,contentContainerStyle:Ar.scrollContent,showsVerticalScrollIndicator:false,children:k==="single_input"?jsxRuntime.jsx(Bu,{externalUserId:r,publishableKey:o,recipientAddress:s,destinationChainType:a,destinationChainId:l,destinationTokenAddress:u,destinationTokenSymbol:i,defaultChainType:c,defaultChainId:y,defaultTokenAddress:T,depositConfirmationMode:_,onExecutionsChange:_e,onDepositSuccess:M,onDepositError:W,borderTopLeftRadius:F,borderTopRightRadius:U,sheetBorderRadius:{tokenSelector:O?.tokenSelector,infoSheet:O?.infoSheet,depositStatus:O?.depositStatus}}):jsxRuntime.jsx(cc,{externalUserId:r,publishableKey:o,recipientAddress:s,destinationChainType:a,destinationChainId:l,destinationTokenAddress:u,destinationTokenSymbol:i,defaultChainType:c,defaultChainId:y,defaultTokenAddress:T,depositConfirmationMode:_,onExecutionsChange:_e,onDepositSuccess:M,onDepositError:W,borderTopLeftRadius:F,borderTopRightRadius:U,sheetBorderRadius:{tokenSelector:O?.tokenSelector,chainSelector:O?.chainSelector,infoSheet:O?.infoSheet,depositStatus:O?.depositStatus}})})]}),J==="card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ur,{title:`Deposit ${i||"USDC"}`,showBack:fe==="onramp",onBack:()=>Pe("amount"),onClose:Ne,showBalance:it,balanceAddress:s,balanceChainType:a,balanceChainId:l,balanceTokenAddress:u,publishableKey:o,projectName:ne?.project_name}),jsxRuntime.jsx(reactNative.View,{style:Ar.buyWithCardContainer,children:jsxRuntime.jsx(hc,{externalUserId:r,publishableKey:o,destinationTokenSymbol:i,recipientAddress:s,destinationChainType:a,destinationChainId:l,destinationTokenAddress:u,onDepositSuccess:M,onDepositError:W,view:fe,onViewChange:he=>Pe(he),borderTopLeftRadius:F,borderTopRightRadius:U,sheetBorderRadius:{providerModal:O?.providerModal,webView:O?.webView,currencyModal:O?.currencyModal}})})]}),J==="stripe"&&et&&jsxRuntime.jsx(reactNative.View,{style:Ar.stripeLinkPayContainer,children:et}),J==="tracker"&&jsxRuntime.jsx(Ou,{active:J==="tracker",onClose:Ne,executions:Ye,externalUserId:r,publishableKey:o})]})}function Ic({theme:e="auto",...t}){return jsxRuntime.jsx(dC,{...t})}var Ar=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},buyWithCardContainer:{flex:1},stripeLinkPayContainer:{flex:1},centeredContainer:{alignItems:"center",justifyContent:"center",paddingVertical:48,paddingHorizontal:16,minHeight:200},centeredFlex:{flex:1},iconContainer:{width:64,height:64,borderRadius:32,alignItems:"center",justifyContent:"center",marginBottom:16},blockedTitle:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},blockedDescription:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20}});function Pc(e,t=true){return Sn({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>fl(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function Eu(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:i,enabled:s=true}=e;return Sn({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,i],queryFn:async()=>{let l=await Ci(i),u=null,c=null,y=null,T=null,w,m,g,h=l.data.some(S=>S.chains.some(b=>{let p=b.chain_type===t&&b.chain_id===r&&b.token_address.toLowerCase()===o.toLowerCase();return p&&(u=b.minimum_deposit_amount_usd,c=b.estimated_processing_time,y=b.max_slippage_percent,T=b.estimated_price_impact_percent,g=b.chain_name,m=S),p}));if(m){let S=Te(m,"png");S&&(w=oe(S));}return {isSupported:h,minimumAmountUsd:u,estimatedProcessingTime:c,maxSlippagePercent:y,priceImpactPercent:T,errorMessage:h?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:w,chainName:g}},enabled:s&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function Mu(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:i,enabled:s=true}=e;return Sn({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,i],queryFn:async()=>{let l=await hl(t,r,o,n,i);if(l.balance){let u=l.balance.token?.decimals??6,c=l.balance.token?.symbol??"",y=l.balance.amount,T=BigInt(y),w=BigInt(10**u),m=T/w,h=(T%w).toString().padStart(u,"0").replace(/0+$/,""),S=h?`${m}.${h}`:m.toString();return {balanceBaseUnit:y,balanceHuman:S,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:u,symbol:c}}return {balanceBaseUnit:"0",balanceHuman:"0",balanceUsd:"0",exchangeRate:null,decimals:6,symbol:""}},enabled:s&&(!!t&&!!r&&!!o&&!!n),staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,refetchOnMount:"always"})}var pC=2500,mC=3e3,fC=6e4;function zu({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:i}){let[s,a]=ni.useState([]),[l,u]=ni.useState(false),c=ni.useRef(new Date),y=ni.useRef(new Map),T=ni.useRef(false),w=ni.useRef(n),m=ni.useRef(i);return ni.useEffect(()=>{w.current=n;},[n]),ni.useEffect(()=>{m.current=i;},[i]),ni.useEffect(()=>{o&&!T.current&&(c.current=new Date,y.current.clear()),o||y.current.clear(),T.current=o;},[o]),ni.useEffect(()=>{if(!e||!o)return;let g=c.current,h=async()=>{try{let b=await pn(e,t,"withdraw"),p=new Date(g.getTime()-fC),d=[...b.data].sort((k,v)=>{let M=k.created_at?new Date(k.created_at).getTime():0;return (v.created_at?new Date(v.created_at).getTime():0)-M}),C=["pending","waiting","delayed"],x=["succeeded","failed"],_=null;for(let k of d){let v=k.created_at?new Date(k.created_at):null;if(!v||v<p)continue;let M=y.current.get(k.id);if(!M){_=k;break}if(C.includes(M)&&x.includes(k.status)){_=k;break}}if(_){let k=_,v=k.created_at?new Date(k.created_at):null;if(!v||v<c.current)return;let M=y.current.get(k.id);y.current.set(k.id,k.status),a(W=>{let O=W.findIndex(F=>F.id===k.id);if(O>=0){let F=[...W];return F[O]=k,F}return [...W,k]}),k.status==="succeeded"&&(!M||C.includes(M))?w.current?.({message:"Withdrawal completed successfully",transaction:k}):k.status==="failed"&&M!=="failed"&&m.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:k});}}catch(b){console.error("Failed to fetch withdraw executions:",b),m.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:b});}};h();let S=setInterval(h,pC);return u(true),()=>{clearInterval(S),u(false);}},[e,t,o]),ni.useEffect(()=>{if(!o||!r)return;let g=async()=>{try{await ld({deposit_wallet_id:r},t);}catch{}};g();let h=setInterval(g,mC);return ()=>clearInterval(h)},[o,r,t]),{executions:s,isPolling:l}}var Uu=(e,t)=>`${t}:${e}`;function qa({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:i=false,tokenLabel:s="Receive token",chainLabel:a="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:u,chainPickerBorderTopLeftRadius:c,chainPickerBorderTopRightRadius:y}){let{colors:T,fonts:w,components:m}=V(),[g,h]=ni.useState(false),[S,b]=ni.useState(false),p=m.card,d=t?e.find(k=>k.symbol===t):void 0,C=d?.chains||[],x=r?C.find(k=>Uu(k.chain_id,k.chain_type)===r):void 0,_={backgroundColor:p.backgroundColor,borderRadius:p.borderRadius,borderWidth:p.borderWidth||1,borderColor:p.borderColor};return jsxRuntime.jsxs(reactNative.View,{style:rt.row,children:[jsxRuntime.jsxs(reactNative.View,{style:rt.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[rt.label,{color:p.labelColor,fontFamily:w.medium}],children:s}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[rt.selectButton,_],onPress:()=>!i&&e.length>0&&h(true),activeOpacity:.7,disabled:i||e.length===0,children:[i?jsxRuntime.jsx(reactNative.Text,{style:[rt.placeholder,{color:p.subtitleColor,fontFamily:w.regular}],children:"Loading..."}):d?jsxRuntime.jsxs(reactNative.View,{style:rt.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Te(d,"png"))},style:rt.icon}),jsxRuntime.jsx(reactNative.Text,{style:[rt.selectedText,{color:p.titleColor,fontFamily:w.medium}],numberOfLines:1,children:d.symbol})]}):jsxRuntime.jsx(reactNative.Text,{style:[rt.placeholder,{color:p.subtitleColor,fontFamily:w.regular}],children:"Select receive token"}),jsxRuntime.jsx(Gt,{size:16,color:p.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:rt.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[rt.label,{color:p.labelColor,fontFamily:w.medium}],children:a}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[rt.selectButton,_,(!d||C.length===0)&&rt.disabled],onPress:()=>!i&&d&&C.length>0&&b(true),activeOpacity:.7,disabled:i||!d||C.length===0,children:[x?jsxRuntime.jsxs(reactNative.View,{style:rt.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Te(x,"png"))},style:rt.icon}),jsxRuntime.jsx(reactNative.Text,{style:[rt.selectedText,{color:p.titleColor,fontFamily:w.medium}],numberOfLines:1,children:x.chain_name})]}):jsxRuntime.jsx(reactNative.Text,{style:[rt.placeholder,{color:p.subtitleColor,fontFamily:w.regular}],children:"Chain"}),jsxRuntime.jsx(Gt,{size:16,color:p.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(bt,{visible:g,onClose:()=>h(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:l,borderTopRightRadius:u,children:[jsxRuntime.jsxs(reactNative.View,{style:rt.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:rt.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[rt.pickerTitle,{color:T.foreground,fontFamily:w.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:rt.pickerHeaderClose,onPress:()=>h(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(st,{size:20,color:T.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(rs,{data:e,keyExtractor:k=>k.symbol,contentContainerStyle:rt.listContent,showsVerticalScrollIndicator:false,renderItem:({item:k})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[rt.pickerItem,{backgroundColor:k.symbol===t?T.cardHover:"transparent"}],onPress:()=>{o(k.symbol),h(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Te(k,"png"))},style:rt.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[rt.pickerItemText,{color:T.foreground,fontFamily:w.medium}],children:k.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[rt.pickerItemSub,{color:T.foregroundMuted,fontFamily:w.regular}],children:k.name}),k.symbol===t&&jsxRuntime.jsx(Le,{size:18,color:T.primary,strokeWidth:2.5})]})})]}),jsxRuntime.jsxs(bt,{visible:S,onClose:()=>b(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:c,borderTopRightRadius:y,children:[jsxRuntime.jsxs(reactNative.View,{style:rt.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:rt.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[rt.pickerTitle,{color:T.foreground,fontFamily:w.medium}],children:"Select Chain"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:rt.pickerHeaderClose,onPress:()=>b(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(st,{size:20,color:T.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(rs,{data:C,keyExtractor:k=>Uu(k.chain_id,k.chain_type),contentContainerStyle:rt.listContent,showsVerticalScrollIndicator:false,renderItem:({item:k})=>{let v=Uu(k.chain_id,k.chain_type);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[rt.pickerItem,{backgroundColor:v===r?T.cardHover:"transparent"}],onPress:()=>{n(v),b(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(Te(k,"png"))},style:rt.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[rt.pickerItemText,{color:T.foreground,fontFamily:w.medium}],children:k.chain_name}),v===r&&jsxRuntime.jsx(Le,{size:18,color:T.primary,strokeWidth:2.5})]})}})]})]})}var rt=reactNative.StyleSheet.create({row:{flexDirection:"column",gap:10},col:{},label:{fontSize:12,marginBottom:6},selectButton:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:12,gap:6,minHeight:48},selectedItem:{flex:1,flexDirection:"row",alignItems:"center",gap:6},icon:{width:20,height:20,borderRadius:10},selectedText:{fontSize:13,flexShrink:1},placeholder:{flex:1,fontSize:13},disabled:{opacity:.4},pickerHeader:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingTop:16,paddingBottom:12},pickerHeaderSpacer:{width:28},pickerHeaderClose:{width:28,alignItems:"flex-end"},pickerTitle:{flex:1,fontSize:16,textAlign:"center"},listContent:{paddingHorizontal:16,paddingVertical:8},pickerItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:12,borderRadius:10,gap:10},pickerIcon:{width:32,height:32,borderRadius:16},pickerItemText:{fontSize:15,flex:1},pickerItemSub:{fontSize:13}});function Hu(e){let{chainType:t,chainId:r,tokenAddress:o,recipientAddress:n,publishableKey:i,enabled:s=true}=e,a=n?.trim()||"",l=!!t&&!!r&&!!o&&a.length>0;return Sn({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,a,i],queryFn:()=>ad({chain_type:t,chain_id:r,token_address:o,recipient_address:a},i),enabled:s&&l,staleTime:1e3*60*5,gcTime:1e3*60*30,retry:1,refetchOnMount:false})}function bC(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function CC(e,t){if(e<=0)return "0";if(t===0)return BigInt(Math.round(e)).toString();let r=e.toFixed(t),[o,n=""]=r.split("."),i=n.padEnd(t,"0").slice(0,t);return (BigInt(o)*BigInt(10**t)+BigInt(i)).toString()}function wC(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function Fc({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:i,sourceTokenIconUrl:s,recipientAddressProp:a,selectedToken:l,selectedChain:u,balanceData:c,isLoadingBalance:y,minimumWithdrawAmountUsd:T,estimatedProcessingTime:w,maxSlippagePercent:m,priceImpactPercent:g,canWithdraw:h,onDepositWalletCreation:S,onWithdraw:b,onWithdrawError:p,onWithdrawSubmitted:d,onViewTracker:C}){let x="https://unifold.io/terms",_="https://unifold.io/support",{colors:k,fonts:v,components:M}=V(),[W,O]=ni.useState(a||""),[F,U]=ni.useState(""),[j,le]=ni.useState(false),[Ye,_e]=ni.useState(null),[ne,we]=ni.useState(false),[fe,Pe]=ni.useState(""),$e=ni.useRef(null);ni.useEffect(()=>{O(a||""),U(""),_e(null);},[a]);let ue=W.trim();ni.useEffect(()=>{let me=setTimeout(()=>Pe(ue),500);return ()=>clearTimeout(me)},[ue]);let{data:J,isLoading:be,error:vt}=Hu({chainType:u?.chain_type,chainId:u?.chain_id,tokenAddress:u?.token_address,recipientAddress:fe,publishableKey:e,enabled:fe.length>5&&!!u}),ve=ue!==fe,qe=ni.useMemo(()=>!ue||ue.length<=5||ve||be?null:vt?"Invalid address":J&&!J.valid?J.failure_code==="account_not_found"?`Account not found on ${u?.chain_name}`:J.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${u?.chain_name}`:"Invalid address":null,[ue,ve,be,vt,J,u,l]),Ne=!ve&&!!J?.valid&&!qe,Ve=ni.useMemo(()=>c?.exchangeRate?parseFloat(c.exchangeRate):0,[c]),ze=ni.useMemo(()=>c?.balanceHuman?parseFloat(c.balanceHuman):0,[c]),it=n||c?.symbol||"TOKEN",ie=c?.decimals??6,pe=ni.useMemo(()=>{let me=parseFloat(F);return !me||me<=0?0:me},[F]),et=ni.useMemo(()=>{let me=parseFloat(F);return !me||me<=0?0:me*Ve},[F,Ve]),Ae=ni.useCallback(async()=>{try{let je=await hh("expo-clipboard").getStringAsync();je&&(O(je.trim()),_e(null));}catch{}},[]),Ke=ni.useCallback(()=>{ze<=0||U(c?.balanceHuman??"0");},[ze,c]),$t=T!==null&&et>0&&et<T,Ee=pe>0&&ze>0&&pe>ze,Oe=ue.length>0&&F.trim().length>0&&pe>0&&Ne&&!$t&&!Ee&&!!c,ar=ni.useCallback(async()=>{if(!(!l||!u||!Oe||!h)){le(true),_e(null);try{let me=await S({destinationChainType:u.chain_type,destinationChainId:u.chain_id,destinationTokenAddress:u.token_address,recipientAddress:ue}),je=CC(pe,ie),Vt=wC(pe,ie),ot={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:it,sourceTokenIconUrl:s,destinationChainType:u.chain_type,destinationChainId:u.chain_id,destinationTokenAddress:u.token_address,destinationTokenSymbol:l.symbol,destinationChainName:u.chain_name,destinationTokenIconUrl:l?oe(Te(l,"png")):void 0,amount:Vt,amountBaseUnit:je,submittedAt:new Date,withdrawIntentAddress:me.address,recipientAddress:ue};await b(ot),d(ot);}catch(me){let je=me instanceof Error?me.message:"Withdrawal failed. Please try again.",Vt=je.length>120?"Withdrawal failed. Please try again.":je;_e(Vt),p?.({message:je,error:me,code:"WITHDRAW_FAILED"});}finally{le(false);}}},[l,u,Oe,h,ue,t,r,o,it,s,F,ze,c,pe,ie,et,S,b,p,d]),he=M.input,X=M.card,Ce=M.button,pt=qe?k.error:he.borderColor,It=ni.useMemo(()=>j?"Processing...":Ee?"Insufficient balance":$t?`Minimum $${T?.toFixed(2)}`:Ye?"Withdrawal failed \u2014 try again":"Withdraw",[j,Ee,$t,T,Ye]);return jsxRuntime.jsxs(reactNative.View,{style:Xe.container,children:[jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.View,{style:Xe.labelRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Xe.label,{color:X.labelColor,fontFamily:v.medium}],children:"Recipient address"}),(ve||be)&&ue.length>5?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:k.primary}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:Ae,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsxRuntime.jsx(rp,{size:16,color:k.foregroundMuted,strokeWidth:1.75})})]}),jsxRuntime.jsx(reactNative.View,{style:[Xe.inputRow,{backgroundColor:he.backgroundColor,borderRadius:he.borderRadius,borderWidth:he.borderWidth,borderColor:pt}],children:jsxRuntime.jsx(reactNative.TextInput,{style:[Xe.textInput,{color:he.textColor,fontFamily:v.regular}],placeholder:"Enter wallet address",placeholderTextColor:he.placeholderColor,value:W,onChangeText:me=>{O(me),_e(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>$e.current?.focus()})}),qe?jsxRuntime.jsx(reactNative.Text,{style:[Xe.errorText,{color:k.error,fontFamily:v.regular}],children:qe}):null]}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.Text,{style:[Xe.label,{color:X.labelColor,fontFamily:v.medium,paddingBottom:8}],children:["Amount",T!=null&&T>0&&jsxRuntime.jsx(reactNative.Text,{style:{color:k.warning,fontFamily:v.regular},children:` ($${T.toFixed(2)} min)`})]}),jsxRuntime.jsxs(reactNative.View,{style:[Xe.amountRow,{backgroundColor:he.backgroundColor,borderRadius:he.borderRadius,borderWidth:he.borderWidth,borderColor:he.borderColor}],children:[jsxRuntime.jsx(reactNative.TextInput,{ref:$e,style:[Xe.amountInput,{color:he.textColor,fontFamily:v.regular}],placeholder:"0.00",placeholderTextColor:he.placeholderColor,value:F,onChangeText:me=>{(me===""||/^\d*\.?\d*$/.test(me))&&(U(me),_e(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.unitLabel,{color:k.foregroundMuted,fontFamily:v.medium}],children:it}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Xe.maxButton,{backgroundColor:`${k.primary}20`}],onPress:Ke,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Xe.maxText,{color:k.primary,fontFamily:v.medium}],children:"Max"})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[Xe.detailsCard,{marginTop:24,backgroundColor:X.backgroundColor,borderRadius:X.borderRadius,borderWidth:X.borderWidth||1,borderColor:X.borderColor}],children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Xe.detailsToggle,onPress:()=>we(!ne),activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.View,{style:Xe.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Xe.detailIcon,{backgroundColor:X.iconBackgroundColor,borderRadius:X.iconContainerBorderRadius}],children:jsxRuntime.jsx(Nr,{size:12,color:X.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Xe.detailsLabel,{color:X.titleColor,fontFamily:v.regular}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{fontFamily:v.medium},children:bC(w)})]}),jsxRuntime.jsx(reactNative.View,{style:{transform:[{rotate:ne?"180deg":"0deg"}]},children:jsxRuntime.jsx(Gt,{size:16,color:X.actionColor,strokeWidth:2})})]})}),ne&&jsxRuntime.jsxs(reactNative.View,{style:Xe.detailsExpanded,children:[jsxRuntime.jsxs(reactNative.View,{style:Xe.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Xe.detailIcon,{backgroundColor:X.iconBackgroundColor,borderRadius:X.iconContainerBorderRadius}],children:jsxRuntime.jsx(jr,{size:12,color:X.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Xe.detailsLabel,{color:X.titleColor,fontFamily:v.regular}],children:["Slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:v.medium},children:["Auto \u2022 ",(m??.25).toFixed(2),"%"]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Xe.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Xe.detailIcon,{backgroundColor:X.iconBackgroundColor,borderRadius:X.iconContainerBorderRadius}],children:jsxRuntime.jsx(An,{size:12,color:X.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Xe.detailsLabel,{color:X.titleColor,fontFamily:v.regular}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:v.medium},children:[(g??0).toFixed(2),"%"]})]})]})]})]}),Ye&&jsxRuntime.jsx(reactNative.Text,{style:[Xe.errorText,{color:k.error,fontFamily:v.regular,textAlign:"center"}],children:Ye}),jsxRuntime.jsxs(reactNative.View,{style:Xe.withdrawRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Xe.withdrawButton,{backgroundColor:Ce.primaryBackground,borderRadius:Ce.borderRadius,borderWidth:Ce.borderWidth,borderColor:Ce.borderColor,opacity:!Oe||!h||j?.5:1}],onPress:ar,disabled:!Oe||!h||j,activeOpacity:.8,children:[j&&jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:Ce.primaryText}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.withdrawButtonText,{color:Ce.primaryText,fontFamily:v.medium}],children:It})]}),jsxRuntime.jsxs(reactNative.View,{style:Xe.footerRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Xe.historyLink,onPress:C,activeOpacity:.7,children:[jsxRuntime.jsx(Nr,{size:14,color:k.foregroundMuted,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.historyText,{color:k.foregroundMuted,fontFamily:v.regular}],children:"Withdrawal history"})]}),jsxRuntime.jsxs(reactNative.View,{style:Xe.legalLinks,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(x),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Xe.legalText,{color:k.foregroundMuted,fontFamily:v.regular}],children:"Terms"})}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.legalSeparator,{color:k.foregroundMuted,fontFamily:v.regular}],children:"|"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(_),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Xe.legalText,{color:k.foregroundMuted,fontFamily:v.regular}],children:"Help"})})]})]})]})]})}var Xe=reactNative.StyleSheet.create({container:{gap:12,paddingHorizontal:16,paddingBottom:16},label:{fontSize:12},labelRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:6},inputRow:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:6,minHeight:48},textInput:{flex:1,fontSize:14,paddingVertical:8},errorText:{fontSize:12,marginTop:4},amountRow:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:6,minHeight:48,gap:8},amountInput:{flex:1,fontSize:14,paddingVertical:8},unitLabel:{fontSize:14,flexShrink:0},maxButton:{paddingHorizontal:8,paddingVertical:4,borderRadius:6},maxText:{fontSize:12,fontWeight:"600"},withdrawRow:{gap:12},footerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},historyLink:{flexDirection:"row",alignItems:"center",gap:6},historyText:{fontSize:13},legalLinks:{flexDirection:"row",alignItems:"center",gap:6},legalText:{fontSize:13},legalSeparator:{fontSize:13},detailsCard:{paddingHorizontal:12,overflow:"hidden"},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13,flex:1},detailsExpanded:{gap:10,paddingBottom:12},withdrawButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:15,gap:8},withdrawButtonText:{fontSize:16,fontWeight:"600"}});function TC(e){try{let t=new Date(e);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}catch{return e}}function xC(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Lc({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=V(),i=n.depositTracker.executionRow.card,s=e.status==="pending"||e.status==="waiting"||e.status==="delayed",a=e.status==="failed"||e.status==="refunded",l=a?r.error:s?r.warning:r.success,u=oe(Te(e.destination_token_metadata,"png")||cr("/icons/tokens/png/usdc.png")),c=a?"Withdrawal Failed":s?"Withdrawal Processing":"Withdrawal Completed",y=TC(e.created_at||new Date().toISOString()),T=xC(e.source_amount_usd);return jsxRuntime.jsxs(Cr,{cardTokens:i,onPress:t,contentStyle:Dn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Dn.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:u},style:Dn.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Dn.statusBadge,{backgroundColor:l,borderColor:i.backgroundColor}],children:a?jsxRuntime.jsx(ea,{size:12,color:"#FFFFFF",strokeWidth:2.5}):s?jsxRuntime.jsx(Xi,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(Le,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Dn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Dn.title,{color:i.titleColor,fontFamily:o.medium}],children:c}),jsxRuntime.jsx(reactNative.Text,{style:[Dn.dateTime,{color:i.subtitleColor,fontFamily:o.regular}],children:y})]}),jsxRuntime.jsxs(reactNative.View,{style:Dn.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Dn.amount,{color:i.textRightColor,fontFamily:o.medium}],children:T}),jsxRuntime.jsx(_r,{size:20,color:i.actionColor,strokeWidth:2})]})]})}var Dn=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-4,right:-4,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center",borderWidth:2},textContainer:{flex:1,gap:2},title:{fontSize:16},dateTime:{fontSize:13},rightContainer:{flexDirection:"row",alignItems:"center",gap:8},amount:{fontSize:16}});function $u(e){try{let t=new Date(e),o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],n=t.getDate(),i=t.getFullYear(),s=t.getHours(),a=t.getMinutes(),l=s>=12?"PM":"AM";s=s%12||12;let u=a<10?`0${a}`:`${a}`;return `${o} ${n}, ${i} at ${s}:${u} ${l}`}catch{return e}}function Zf(e,t=6){if(!e)return "\u2014";try{let r=Number(e)/Math.pow(10,t);return r===0?"0.00":r>=1?r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:8,minimumSignificantDigits:2,maximumSignificantDigits:6})}catch{return "0.00"}}function RC(e,t){if(e)try{return `$${Number(e).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}catch{}if(t)try{return `$${(Number(t)/1e6).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}catch{}return "$0.00"}function Xf(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function eh(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function Ka({label:e,value:t,isLast:r}){let{fonts:o,components:n}=V(),i=n.card;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:He.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[He.detailLabel,{color:i.subtitleColor,fontFamily:o.regular}],children:e}),jsxRuntime.jsx(reactNative.Text,{style:[He.detailValue,{color:i.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsxRuntime.jsx(reactNative.View,{style:[He.divider,{backgroundColor:i.borderColor}]})]})}function Ku({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:i}){let{colors:s,fonts:a,components:l}=V(),[u,c]=ni.useState([]),[y,T]=ni.useState(!!n),w=l.card,m=l.button,g=l.header,h=l.container;ni.useEffect(()=>{sd().then(le=>c(le.data)).catch(()=>{});},[]),ni.useEffect(()=>{T(!!n);},[e?.id]);let S=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,b=e?e.status==="failed"||e.status==="refunded":false,p=b?s.error:S?s.warning:s.success,d=b?"Failed":S?"Processing":"Completed",C=e?.destination_token_metadata?oe(Te(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?oe(t.destinationTokenIconUrl):oe(cr("/icons/tokens/png/usdc.png")),x=e?.created_at?$u(e.created_at):t.submittedAt?$u(t.submittedAt.toISOString()):$u(new Date().toISOString()),_=e?`${Zf(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${Xf(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,k=e?`${Zf(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${Xf(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,v=e?RC(e.source_amount_usd,e.source_amount_base_unit):"$0.00",M=e?ml(u,e.source_chain_type,e.source_chain_id):t.sourceChainId,W=e?ml(u,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,O=e?.transaction_hash,F=e?.explorer_url,U=e?.destination_transaction_hashes?.[0],j=e?.destination_explorer_url;return jsxRuntime.jsxs(at,{style:He.scroll,contentContainerStyle:He.container,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:He.headerRow,children:[n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Zi,{size:22,color:g.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:He.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[He.headerTitle,{color:g.titleColor,fontFamily:a.medium}],children:"Withdrawal Details"}),n?jsxRuntime.jsx(reactNative.View,{style:He.headerSpacer}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:i??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(st,{size:20,color:g.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:He.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:C},style:He.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[He.statusBadge,{backgroundColor:p}],children:b?jsxRuntime.jsx(ea,{size:10,color:"#FFFFFF",strokeWidth:3}):S?jsxRuntime.jsx(reactNative.View,{style:He.spinnerDot}):jsxRuntime.jsx(Le,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:He.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[He.statusDot,{backgroundColor:p}]}),jsxRuntime.jsx(reactNative.Text,{style:[He.statusText,{color:p,fontFamily:a.medium}],children:d})]}),jsxRuntime.jsx(reactNative.Text,{style:[He.dateText,{color:h.subtitleColor,fontFamily:a.regular}],children:x}),jsxRuntime.jsxs(reactNative.View,{style:[He.detailsCard,{backgroundColor:w.backgroundColor,borderRadius:w.borderRadius,borderWidth:w.borderWidth??1,borderColor:w.borderColor}],children:[jsxRuntime.jsx(Ka,{label:"Amount Sent",value:_}),jsxRuntime.jsx(Ka,{label:"Amount Received",value:k}),jsxRuntime.jsx(Ka,{label:"USD Value",value:v}),jsxRuntime.jsx(Ka,{label:"Source Network",value:M}),jsxRuntime.jsx(Ka,{label:"Destination Network",value:W,isLast:true})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:He.moreDetailsRow,onPress:()=>T(le=>!le),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[He.moreDetailsText,{color:h.actionTitle,fontFamily:a.regular}],children:y?"See less":n?"See more":"See more details"}),y?jsxRuntime.jsx(Vo,{size:16,color:h.actionColor,strokeWidth:2}):jsxRuntime.jsx(Gt,{size:16,color:h.actionColor,strokeWidth:2})]}),y&&jsxRuntime.jsx(reactNative.View,{style:[He.detailsCard,{backgroundColor:w.backgroundColor,borderRadius:w.borderRadius,borderWidth:w.borderWidth??1,borderColor:w.borderColor}],children:O&&F?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:He.txRow,onPress:()=>reactNative.Linking.openURL(F),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[He.txLabel,{color:w.subtitleColor,fontFamily:a.regular}],children:"Withdrawal Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[He.txHash,{color:w.titleColor,fontFamily:a.regular}],children:eh(O)}),jsxRuntime.jsx(Do,{size:14,color:w.actionColor,strokeWidth:2})]}),!S&&U&&j&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[He.divider,{backgroundColor:w.borderColor}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:He.txRow,onPress:()=>reactNative.Linking.openURL(j),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[He.txLabel,{color:w.subtitleColor,fontFamily:a.regular}],children:"Completion Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[He.txHash,{color:w.titleColor,fontFamily:a.regular}],children:eh(U)}),jsxRuntime.jsx(Do,{size:14,color:w.actionColor,strokeWidth:2})]})]})]}):jsxRuntime.jsx(reactNative.View,{style:He.detailRow,children:jsxRuntime.jsx(reactNative.Text,{style:[He.detailLabel,{color:w.subtitleColor,fontFamily:a.regular}],children:"Transaction details not yet available"})})}),!n&&jsxRuntime.jsxs(reactNative.View,{style:He.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[He.button,He.halfButton,{backgroundColor:m.secondaryBackground,borderRadius:m.borderRadius,borderWidth:m.borderWidth,borderColor:m.borderColor}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[He.buttonText,{color:m.secondaryText,fontFamily:a.medium}],children:"Withdrawal History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[He.button,He.halfButton,{backgroundColor:m.primaryBackground,borderRadius:m.borderRadius,borderWidth:m.borderWidth,borderColor:m.borderColor}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[He.buttonText,{color:m.primaryText,fontFamily:a.medium}],children:"Close"})})]})]})}var He=reactNative.StyleSheet.create({scroll:{flex:1},container:{alignItems:"center",paddingHorizontal:20,paddingTop:8,paddingBottom:32,gap:12},headerRow:{flexDirection:"row",alignItems:"center",width:"100%",paddingTop:16,marginBottom:4},headerSpacer:{width:28},headerTitle:{flex:1,fontSize:16,textAlign:"center"},iconContainer:{position:"relative",marginTop:8},tokenIcon:{width:64,height:64,borderRadius:32},statusBadge:{position:"absolute",bottom:-2,right:-2,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center"},spinnerDot:{width:10,height:10,borderRadius:5,borderWidth:2,borderColor:"#FFFFFF",borderTopColor:"transparent"},statusRow:{flexDirection:"row",alignItems:"center",gap:6},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:15},dateText:{fontSize:13,marginTop:-4},detailsCard:{width:"100%",paddingHorizontal:16,overflow:"hidden"},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12},detailLabel:{fontSize:13,flex:1},detailValue:{fontSize:13,flexShrink:0,maxWidth:"55%",textAlign:"right"},divider:{height:reactNative.StyleSheet.hairlineWidth,opacity:.5},moreDetailsRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingHorizontal:4},moreDetailsText:{fontSize:14},txRow:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:12},txLabel:{fontSize:13},txHash:{fontSize:13,flex:1,textAlign:"right"},buttonRow:{flexDirection:"row",gap:10,width:"100%",marginTop:4},button:{paddingVertical:14,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},fullButton:{width:"100%"},buttonText:{fontSize:14}});function th(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Bc({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:i,components:s}=V(),a=t.length>0?t[t.length-1]:null,l=a?.status==="succeeded",u=a?.status==="failed",c={borderRadius:s.button.borderRadius,borderWidth:s.button.borderWidth,borderColor:s.button.borderColor};return l?jsxRuntime.jsxs(reactNative.View,{style:Dt.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Dt.closeButton,onPress:r,children:jsxRuntime.jsx(st,{size:20,color:s.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[Dt.iconRing,{backgroundColor:n.successBackground}],children:jsxRuntime.jsx(Le,{size:32,color:n.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Dt.title,{color:n.foreground,fontFamily:i.medium}],children:"Withdrawal Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[Dt.subtitle,{color:n.foregroundMuted,fontFamily:i.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",th(e.recipientAddress)]}),jsxRuntime.jsxs(reactNative.View,{style:Dt.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Dt.button,Dt.halfButton,c,{backgroundColor:s.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Dt.buttonText,{color:s.button.secondaryText,fontFamily:i.medium}],children:"History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Dt.button,Dt.halfButton,c,{backgroundColor:s.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Dt.buttonText,{color:s.button.primaryText,fontFamily:i.medium}],children:"Close"})})]})]}):u?jsxRuntime.jsxs(reactNative.View,{style:Dt.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Dt.closeButton,onPress:r,children:jsxRuntime.jsx(st,{size:20,color:s.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[Dt.iconRing,{backgroundColor:n.errorBackground}],children:jsxRuntime.jsx(st,{size:32,color:n.error,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Dt.title,{color:n.foreground,fontFamily:i.medium}],children:"Withdrawal Failed"}),jsxRuntime.jsx(reactNative.Text,{style:[Dt.subtitle,{color:n.foregroundMuted,fontFamily:i.regular}],children:"Something went wrong. Please try again."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Dt.button,Dt.fullButton,c,{backgroundColor:s.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Dt.buttonText,{color:s.button.primaryText,fontFamily:i.medium}],children:"Close"})})]}):jsxRuntime.jsxs(reactNative.View,{style:Dt.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Dt.closeButton,onPress:r,children:jsxRuntime.jsx(st,{size:20,color:s.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(nt,{size:80,strokeWidth:4,iconSize:68,gradientFrom:n.primary,gradientTo:n.primary,children:e.sourceTokenIconUrl?jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(e.sourceTokenIconUrl)},style:Dt.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[Dt.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[Dt.title,{color:n.foreground,fontFamily:i.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxRuntime.jsxs(reactNative.Text,{style:[Dt.subtitle,{color:n.foregroundMuted,fontFamily:i.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",th(e.recipientAddress)]})]})}var Dt=reactNative.StyleSheet.create({container:{alignItems:"center",paddingHorizontal:24,paddingTop:48,paddingBottom:24},closeButton:{position:"absolute",top:16,right:16,padding:4,zIndex:1},iconRing:{width:80,height:80,borderRadius:40,alignItems:"center",justifyContent:"center",marginBottom:20},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},title:{fontSize:20,marginBottom:8,textAlign:"center"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,marginBottom:24},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,alignItems:"center",justifyContent:"center",borderRadius:12},halfButton:{flex:1},fullButton:{width:"100%"},buttonText:{fontSize:15}});function DC(e){let t=e.source_token_metadata?.decimals??6,r=e.source_amount_base_unit??"0",o=Number(r)/Math.pow(10,t),n=o>=1?o.toFixed(2):o.toPrecision(4).replace(/\.?0+$/,"");return {sourceChainType:e.source_chain_type,sourceChainId:e.source_chain_id,sourceTokenAddress:e.source_token_address,sourceTokenSymbol:e.source_currency?.toUpperCase()??"",sourceTokenIconUrl:oe(Te(e.source_token_metadata,"png")),destinationChainType:e.destination_chain_type,destinationChainId:e.destination_chain_id,destinationTokenAddress:e.destination_token_address,destinationTokenSymbol:e.destination_currency?.toUpperCase()??"",destinationTokenIconUrl:oe(Te(e.destination_token_metadata,"png")),amount:n,amountBaseUnit:r,submittedAt:e.created_at?new Date(e.created_at):void 0,withdrawIntentAddress:e.deposit_wallet?.address??"",recipientAddress:e.recipient_address??""}}var rh=(e,t)=>`${t}:${e}`;function VC(){let{colors:e}=V(),t=ni.useRef(new reactNative.Animated.Value(.5)).current,r=e.cardHover;return ni.useEffect(()=>{let o=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(t,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(t,{toValue:.5,duration:800,useNativeDriver:true})]));return o.start(),()=>o.stop()},[t]),jsxRuntime.jsx(reactNative.View,{style:{gap:12,paddingHorizontal:16},children:[1,2,3].map(o=>jsxRuntime.jsx(reactNative.Animated.View,{style:{height:48,borderRadius:12,backgroundColor:r,opacity:t}},o))})}function Ec({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:i,defaultDestinationChainType:s,defaultDestinationChainId:a,defaultDestinationTokenAddress:l,modalTitle:u="Withdraw Crypto",onWithdraw:c,onWithdrawSuccess:y,onWithdrawError:T,heightPercent:w=.94,sheetBorderRadius:m,sourceChainType:g,sourceChainId:h,sourceTokenAddress:S,sourceTokenSymbol:b,sourceChainName:p,sourceTokenIconUrl:d}){let{colors:C,fonts:x}=V(),[_,k]=ni.useState("form"),[v,M]=ni.useState(g),[W,O]=ni.useState(h),[F,U]=ni.useState(S),[j,le]=ni.useState(b),[Ye,_e]=ni.useState(p),[ne,we]=ni.useState(d),[fe,Pe]=ni.useState(null),[$e,ue]=ni.useState(null),[J,be]=ni.useState(null),[vt,ve]=ni.useState(),[qe,Ne]=ni.useState([]),[Ve,ze]=ni.useState(null),[it,ie]=ni.useState("form"),pe=ni.useRef(new reactNative.Animated.Value(reactNative.Dimensions.get("window").width)).current,et=ni.useRef(null),Ae=!!v&&!!W&&!!F,{data:Ke,isLoading:$t}=Pc(r,e&&_==="form"),Ee=Ke?.data??[],{data:Oe,isLoading:ar}=Eu({sourceChainType:v,sourceChainId:W,sourceTokenAddress:F,sourceTokenSymbol:j,publishableKey:r,enabled:e&&Ae&&_==="form"}),{data:he,isLoading:X}=Mu({address:n,chainType:v,chainId:W,tokenAddress:F,publishableKey:r,enabled:e&&Ae}),{executions:Ce}=zu({userId:o,publishableKey:r,depositWalletId:vt,enabled:!!vt&&e,onWithdrawSuccess:y,onWithdrawError:T});ni.useEffect(()=>{if(!e||_!=="tracker")return;let ce=false;return pn(o,r,"withdraw").then(xt=>{ce||Ne(xt.data);}).catch(console.error),()=>{ce=true;}},[e,_,o,r]),ni.useEffect(()=>{e&&(et.current&&(clearTimeout(et.current),et.current=null),k("form"),M(g),O(h),U(S),le(b),_e(p),we(d),Pe(null),ue(null),be(null),ve(void 0),Ne([]),ze(null),ie("form"),pe.setValue(reactNative.Dimensions.get("window").width));},[e]),ni.useEffect(()=>()=>{et.current&&clearTimeout(et.current);},[]),ni.useEffect(()=>{ne||Oe?.iconUrl&&we(Oe.iconUrl);},[Oe?.iconUrl,ne]),ni.useEffect(()=>{Ye||Oe?.chainName&&_e(Oe.chainName);},[Oe?.chainName,Ye]),ni.useEffect(()=>{if(!Ee.length||fe)return;let ce,xt;if(s&&a)if(l)for(let Ct of Ee){let z=Ct.chains.find(Xr=>Xr.chain_type===s&&Xr.chain_id===a&&Xr.token_address.toLowerCase()===l.toLowerCase());if(z){ce=Ct,xt=z;break}}else for(let Ct of Ee){let z=Ct.chains.find(Xr=>Xr.chain_type===s&&Xr.chain_id===a);if(z){ce=Ct,xt=z;break}}ce||(ce=Ee[0]),ce&&(Pe(ce),ue(xt??ce.chains[0]??null));},[Ee,fe,s,a,l]),ni.useEffect(()=>{_==="confirming"&&Ce.length>0&&k("details");},[_,Ce]);let pt=ni.useCallback(()=>{t(),et.current=setTimeout(()=>{k("form"),M(g),O(h),U(S),le(b),_e(p),we(d),Pe(null),ue(null),be(null),ve(void 0),Ne([]),ze(null),ie("form"),et.current=null;},300);},[t,g,h,S,b,p,d]),It=ni.useCallback(ce=>{let xt=Ee.find(Ct=>Ct.symbol===ce);xt&&(Pe(xt),xt.chains.length>0&&ue(xt.chains[0]));},[Ee]),me=ni.useCallback(ce=>{if(!fe)return;let xt=fe.chains.find(Ct=>rh(Ct.chain_id,Ct.chain_type)===ce);xt&&ue(xt);},[fe]),je=ni.useCallback(async ce=>{let xt=await dn({external_user_id:o,destination_chain_type:ce.destinationChainType,destination_chain_id:ce.destinationChainId,destination_token_address:ce.destinationTokenAddress,recipient_address:ce.recipientAddress,action_type:"withdraw"},r),Ct=un(xt.data,v??"");if(!Ct)throw new Error(`No deposit wallet found for chain type: ${v}`);return ve(Ct.id),{id:Ct.id,address:Ct.address}},[o,r,v]),Vt=ni.useCallback(ce=>{be(ce),k("confirming");},[]),ot=ni.useCallback(ce=>{ze(ce),pe.setValue(reactNative.Dimensions.get("window").width),reactNative.Animated.timing(pe,{toValue:0,duration:280,useNativeDriver:true}).start();},[pe]),Lt=ni.useCallback(()=>{reactNative.Animated.timing(pe,{toValue:reactNative.Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>ze(null));},[pe]),Bt=$t||ar,yt=Oe?.isSupported??null,Se=_==="confirming"?"Withdrawal Status":u,Z=m?.globalBorderTopLeftRadius,Q=m?.globalBorderTopRightRadius,L=m?.main?.borderTopLeftRadius??Z,I=m?.main?.borderTopRightRadius??Q,D=m?.tokenSelector?.borderTopLeftRadius??Z,q=m?.tokenSelector?.borderTopRightRadius??Q,Fe=m?.chainSelector?.borderTopLeftRadius??Z,ke=m?.chainSelector?.borderTopRightRadius??Q,pr=(()=>{if(_!=="form"||!Ae||X||!he)return;let ce=j||he.symbol,xt=he.balanceUsd;if(xt!=null){let Xr=`$${parseFloat(xt).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return ce?`Balance: ${Xr} ${ce}`:`Balance: ${Xr}`}let Ct=he.balanceHuman;if(!(!Ct||Ct==="0"))return ce?`Balance: ${Ct} ${ce}`:`Balance: ${Ct}`})();return jsxRuntime.jsx(bt,{visible:e,onClose:pt,closeOnBackdropPress:false,enablePanDownToClose:_==="tracker"||_==="form",showHandle:_==="tracker"||_==="form",heightPercent:_==="confirming"?.3:_==="details"?.7:_==="tracker"?.6:w,maxHeightPercent:_==="tracker"?.9:void 0,borderTopLeftRadius:L,borderTopRightRadius:I,children:_==="confirming"&&J?jsxRuntime.jsx(Bc,{txInfo:J,executions:Ce,onClose:pt,onViewTracker:()=>{ie("confirming"),k("tracker");}}):_==="details"&&J?jsxRuntime.jsx(Ku,{execution:Ce.length>0?Ce[Ce.length-1]:null,txInfo:J,onClose:pt,onViewHistory:()=>{ie("details"),k("tracker");},onHeaderClose:()=>k("form")}):_==="tracker"?jsxRuntime.jsxs(reactNative.View,{style:nn.trackerContainer,children:[jsxRuntime.jsx(Ur,{title:"Withdrawal History",onClose:()=>k(it)}),qe.length===0?jsxRuntime.jsx(reactNative.View,{style:nn.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[nn.emptyText,{color:C.foregroundMuted,fontFamily:x.regular}],children:"No withdrawals to track yet"})}):jsxRuntime.jsx(rs,{data:qe,keyExtractor:ce=>ce.id,contentContainerStyle:nn.listContent,showsVerticalScrollIndicator:false,renderItem:({item:ce})=>jsxRuntime.jsx(Lc,{execution:ce,onPress:()=>ot(ce)})}),Ve&&jsxRuntime.jsx(reactNative.Animated.View,{style:[nn.historyDetailOverlay,{backgroundColor:C.background,transform:[{translateX:pe}]}],children:jsxRuntime.jsx(Ku,{execution:Ve,txInfo:DC(Ve),onClose:pt,onBack:Lt,onViewHistory:Lt})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ur,{title:Se,subtitle:pr,onClose:pt}),Bt?jsxRuntime.jsx(VC,{}):yt===false?jsxRuntime.jsxs(reactNative.View,{style:nn.unsupportedContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[nn.unsupportedTitle,{color:C.foreground,fontFamily:x.medium}],children:"Unsupported Token"}),jsxRuntime.jsx(reactNative.Text,{style:[nn.unsupportedMessage,{color:C.foregroundMuted,fontFamily:x.regular}],children:Oe?.errorMessage})]}):jsxRuntime.jsx(LC,{publishableKey:r,sourceChainType:v??"",sourceChainId:W??"",sourceTokenAddress:F??"",sourceTokenSymbol:j,sourceChainName:Ye,sourceTokenIconUrl:ne,recipientAddressProp:i,destinationTokens:Ee,selectedToken:fe,selectedChain:$e,selectedChainKey:$e?rh($e.chain_id,$e.chain_type):null,onTokenChange:It,onChainChange:me,tokensLoading:$t,balanceData:he??null,isLoadingBalance:X,sourceValidation:Oe??null,onDepositWalletCreation:je,onWithdraw:c,onWithdrawError:T,onWithdrawSubmitted:Vt,onViewTracker:()=>{ie("form"),k("tracker");},tokenSelectorLeft:D,tokenSelectorRight:q,chainSelectorLeft:Fe,chainSelectorRight:ke})]})})}function LC({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:i,sourceTokenIconUrl:s,recipientAddressProp:a,destinationTokens:l,selectedToken:u,selectedChain:c,selectedChainKey:y,onTokenChange:T,onChainChange:w,tokensLoading:m,balanceData:g,isLoadingBalance:h,sourceValidation:S,onDepositWalletCreation:b,onWithdraw:p,onWithdrawError:d,onWithdrawSubmitted:C,onViewTracker:x,tokenSelectorLeft:_,tokenSelectorRight:k,chainSelectorLeft:v,chainSelectorRight:M}){return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxRuntime.jsxs(at,{style:{flex:1,paddingTop:16},contentContainerStyle:nn.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:nn.doubleInputWrapper,children:jsxRuntime.jsx(qa,{tokens:l,selectedTokenSymbol:u?.symbol??null,selectedChainKey:y,onTokenChange:T,onChainChange:w,isLoading:m,tokenPickerBorderTopLeftRadius:_,tokenPickerBorderTopRightRadius:k,chainPickerBorderTopLeftRadius:v,chainPickerBorderTopRightRadius:M})}),jsxRuntime.jsx(Fc,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:i,sourceTokenIconUrl:s,recipientAddressProp:a,selectedToken:u,selectedChain:c,balanceData:g,isLoadingBalance:h,minimumWithdrawAmountUsd:S?.minimumAmountUsd??null,estimatedProcessingTime:S?.estimatedProcessingTime??null,maxSlippagePercent:S?.maxSlippagePercent??null,priceImpactPercent:S?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:b,onWithdraw:p,onWithdrawError:d,onWithdrawSubmitted:C,onViewTracker:x})]})})}var nn=reactNative.StyleSheet.create({scrollContent:{paddingBottom:32},doubleInputWrapper:{paddingHorizontal:16,paddingBottom:12,paddingTop:4},listContent:{paddingHorizontal:16,paddingBottom:32,gap:8},trackerContainer:{flex:1,overflow:"hidden"},historyDetailOverlay:{position:"absolute",top:0,left:0,right:0,bottom:0},emptyState:{flex:1,alignItems:"center",justifyContent:"center",paddingVertical:48},emptyText:{fontSize:14},unsupportedContainer:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24,paddingVertical:48},unsupportedTitle:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},unsupportedMessage:{fontSize:14,textAlign:"center",lineHeight:20,maxWidth:280}});reactNative.StyleSheet.create({container:{paddingHorizontal:16,paddingTop:16,paddingBottom:24,gap:16},fieldGroup:{gap:8},fieldLabel:{fontSize:12},walletCard:{paddingHorizontal:12,paddingVertical:12,minHeight:48,justifyContent:"center"},walletAddress:{fontSize:13},primaryButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginTop:4},primaryButtonText:{fontSize:16},secondaryButton:{paddingVertical:14,alignItems:"center",justifyContent:"center"},secondaryButtonText:{fontSize:16}});reactNative.StyleSheet.create({base:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},text:{fontWeight:"600",textAlign:"center"},fullWidth:{width:"100%"},disabled:{opacity:.5}});reactNative.StyleSheet.create({icon:{backgroundColor:"transparent"}});var ih=ni.createContext(null);function jC({children:e,publishableKey:t,config:r}){let[o]=ni.useState(()=>new Xd({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,i]=ni.useState(false),[s,a]=ni.useState(null),[l,u]=ni.useState(false),[c,y]=ni.useState(null),T=reactNative.useColorScheme(),w=ni.useRef(false);w.current||(cl({publishableKey:t}),w.current=true);let m=ni.useMemo(()=>{let F=r?.appearance||"dark";return F==="auto"?T==="dark"?"dark":"light":F},[r?.appearance,T]);ni.useEffect(()=>{if(!t||t.trim()===""){console.error("Unifold: publishableKey is required. Please provide a valid publishable key.");return}!t.startsWith("pk_test_")&&!t.startsWith("pk_live_")&&console.warn('Unifold: publishableKey should start with "pk_test_" or "pk_live_". Please ensure you are using a valid publishable key.'),cl({publishableKey:t});},[t]),ni.useEffect(()=>()=>{h.current&&clearTimeout(h.current),x.current&&clearTimeout(x.current);},[]);let g=ni.useRef(null),h=ni.useRef(null),S=ni.useCallback(F=>{h.current&&(clearTimeout(h.current),h.current=null),g.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),g.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),g.current=null);let U=new Promise((j,le)=>{g.current={resolve:j,reject:le};});return a(F),i(true),U},[]),b=ni.useCallback(()=>{g.current&&(g.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),g.current=null),i(false),h.current=setTimeout(()=>{a(null),h.current=null;},200);},[]),p=ni.useCallback(F=>{s?.onSuccess&&s.onSuccess(F),g.current&&(g.current.resolve(F),g.current=null);},[s]),d=ni.useCallback(F=>{console.error("[UnifoldProvider] Deposit error:",F),s?.onError&&s.onError(F),g.current&&(g.current.reject(F),g.current=null);},[s]),C=ni.useRef(null),x=ni.useRef(null),_=ni.useRef(void 0),k=ni.useCallback(F=>{x.current&&(clearTimeout(x.current),x.current=null),C.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),C.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),C.current=null);let U=new Promise((j,le)=>{C.current={resolve:j,reject:le};});return _.current=F.onClose,y(F),u(true),U},[]),v=ni.useCallback(()=>{C.current&&(C.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),C.current=null),_.current?.(),_.current=void 0,u(false),x.current=setTimeout(()=>{y(null),x.current=null;},200);},[]),M=ni.useCallback(F=>{c?.onSuccess&&c.onSuccess(F),C.current&&(C.current.resolve(F),C.current=null);},[c]),W=ni.useCallback(F=>{console.error("[UnifoldProvider] Withdraw error:",F),c?.onError&&c.onError(F),C.current&&(C.current.reject(F),C.current=null);},[c]),O=ni.useMemo(()=>({publishableKey:t,beginDeposit:S,closeDeposit:b,beginWithdraw:k,closeWithdraw:v}),[t,S,b,k,v]);return jsxRuntime.jsx(ru,{client:o,children:jsxRuntime.jsx(ih.Provider,{value:O,children:jsxRuntime.jsxs(ts,{mode:m,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,s&&jsxRuntime.jsx(Ic,{visible:n,onClose:b,publishableKey:t,modalTitle:r?.modalTitle,externalUserId:s.externalUserId,destinationChainType:s.destinationChainType,destinationChainId:s.destinationChainId,destinationTokenSymbol:s.destinationTokenSymbol,recipientAddress:s.recipientAddress,destinationTokenAddress:s.destinationTokenAddress,defaultChainType:s.defaultChainType,defaultChainId:s.defaultChainId,defaultTokenAddress:s.defaultTokenAddress,showBalance:s.showBalance,stripeOnrampEmail:s.stripeOnrampEmail,stripeOnrampPhone:s.stripeOnrampPhone,stripeTheme:{mode:m,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components},depositConfirmationMode:s.depositConfirmationMode??"auto_ui",initialScreen:s.initialScreen,hideDepositTracker:r?.hideDepositTracker,transferInputVariant:r?.transferInputVariant,enableStripeLinkPay:r?.enableStripeLinkPay,stripeMerchantIdentifier:r?.stripeMerchantIdentifier,stripePaymentSelectorPosition:r?.stripePaymentSelectorPosition,stripeSkipSuccessConfirmation:r?.stripeSkipSuccessConfirmation,StripeOnrampComponent:r?.enableStripeLinkPay?hm():void 0,onDepositSuccess:p,onDepositError:d,theme:m,sheetBorderRadius:r?.sheetBorderRadius}),c&&jsxRuntime.jsx(Ec,{visible:l,onClose:v,publishableKey:t,externalUserId:c.externalUserId,senderAddress:c.senderAddress,recipientAddress:c.recipientAddress,sourceChainType:c.sourceChainType,sourceChainId:c.sourceChainId,sourceTokenAddress:c.sourceTokenAddress,sourceTokenSymbol:c.sourceTokenSymbol,defaultDestinationChainType:c.defaultDestinationChainType,defaultDestinationChainId:c.defaultDestinationChainId,defaultDestinationTokenAddress:c.defaultDestinationTokenAddress,onWithdraw:c.withdraw,onWithdrawSuccess:M,onWithdrawError:W,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function $C(){let e=ni.useContext(ih);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
|
|
3
|
-
exports.AmountScreen=
|
|
1
|
+
'use strict';var ci=require('react'),reactNative=require('react-native'),It=require('react-native-svg'),jsxRuntime=require('react/jsx-runtime'),reactNativeGestureHandler=require('react-native-gesture-handler'),up=require('react-native-reanimated'),stripeReactNative=require('@stripe/stripe-react-native'),Ld=require('@react-native-async-storage/async-storage'),Ay=require('expo-constants'),yb=require('react-native-qrcode-svg'),reactNativeWebview=require('react-native-webview');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var ci__namespace=/*#__PURE__*/_interopNamespace(ci);var It__default=/*#__PURE__*/_interopDefault(It);var up__default=/*#__PURE__*/_interopDefault(up);var Ld__default=/*#__PURE__*/_interopDefault(Ld);var Ay__default=/*#__PURE__*/_interopDefault(Ay);var yb__default=/*#__PURE__*/_interopDefault(yb);var rp=e=>{throw TypeError(e)};var Sh=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var qc=(e,t,r)=>t.has(e)||rp("Cannot "+r);var m=(e,t,r)=>(qc(e,t,"read from private field"),r?r.call(e):t.get(e)),ee=(e,t,r)=>t.has(e)?rp("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),M=(e,t,r,o)=>(qc(e,t,"write to private field"),t.set(e,r),r),He=(e,t,r)=>(qc(e,t,"access private method"),r);var ra=(e,t,r,o)=>({set _(n){M(e,t,n);},get _(){return m(e,t,o)}});var Kc={light:{background:"#FFFFFF",card:"#F8FAFC",cardHover:"#F1F5F9",foreground:"#0F172A",foregroundMuted:"#64748B",foregroundSubtle:"#94A3B8",border:"#E2E8F0",borderSecondary:"#CBD5E1",primary:"#3B82F6",primaryForeground:"#FFFFFF",success:"#22C55E",successBackground:"#DCFCE7",warning:"#F59E0B",warningBackground:"#FEF3C7",error:"#EF4444",errorBackground:"#FEE2E2",overlay:"rgba(0, 0, 0, 0.5)"},dark:{background:"#2D2C2F",card:"#3A393C",cardHover:"#48474A",foreground:"#F8FAFC",foregroundMuted:"#94A3B8",foregroundSubtle:"#64748B",border:"#38383A",borderSecondary:"#48484A",primary:"#3B82F6",primaryForeground:"#FFFFFF",success:"#22C55E",successBackground:"rgba(34, 197, 94, 0.1)",warning:"#F59E0B",warningBackground:"rgba(245, 158, 11, 0.1)",error:"#EF4444",errorBackground:"rgba(239, 68, 68, 0.1)",overlay:"rgba(0, 0, 0, 0.7)"}},Qc=Kc;function sl(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function oa(e,t,r){let o=r?t?.[r]:void 0,n=(c,b,T)=>{let w=o?.[c]?.[b];if(w!==void 0)return w;let p=t?.[c]?.[b];return p!==void 0?p:T},s={backgroundColor:n("card","backgroundColor",e.card),titleColor:n("card","titleColor",e.foreground),subtitleColor:n("card","subtitleColor",e.foregroundMuted),labelColor:n("card","labelColor",e.foregroundMuted),headerColor:n("card","headerColor",e.foregroundMuted),labelRightColor:n("card","labelRightColor",e.foregroundMuted),labelHighlightRightColor:n("card","labelHighlightRightColor",e.warning),textRightColor:n("card","textRightColor",e.foreground),subtextRightColor:n("card","subtextRightColor",e.foregroundMuted),rowLeftLabel:n("card","rowLeftLabel",e.foregroundMuted),rowRightLabel:n("card","rowRightLabel",e.foreground),iconColor:n("card","iconColor",e.primary),iconBackgroundColor:n("card","iconBackgroundColor",e.primary+"26"),actionColor:n("card","actionColor",e.foregroundMuted),actionIcon:n("card","actionIcon",e.foregroundMuted),descriptionColor:n("card","descriptionColor",e.foregroundMuted),borderRadius:n("card","borderRadius",12),borderWidth:n("card","borderWidth",0),borderColor:n("card","borderColor",e.border),shadowColor:n("card","shadowColor","#000"),shadowOffset:n("card","shadowOffset",{width:0,height:-4}),shadowOpacity:n("card","shadowOpacity",0),shadowRadius:n("card","shadowRadius",12),elevation:n("card","elevation",0),iconContainerBorderRadius:n("card","iconContainerBorderRadius",12),backShadowColor:"transparent",backShadowOffset:{top:4,left:4,right:-4,bottom:-4},backShadowSpacing:8},i=(o?.depositMenu??t?.depositMenu)?.card,a=(o?.transferCrypto??t?.transferCrypto)?.depositAddress?.card,l=(o?.depositCard??t?.depositCard)?.quoteProvider?.card,u=(o?.depositTracker??t?.depositTracker)?.executionRow?.card;return {header:{titleColor:n("header","titleColor",e.foreground),buttonColor:n("header","buttonColor",e.foreground)},card:s,input:{backgroundColor:n("input","backgroundColor",n("search","backgroundColor",e.card)),textColor:n("input","textColor",n("search","inputColor",e.foreground)),placeholderColor:n("input","placeholderColor",n("search","placeholderColor",e.foregroundMuted)),borderColor:n("input","borderColor",e.border),borderRadius:n("input","borderRadius",n("search","borderRadius",8)),borderWidth:n("input","borderWidth",1)},button:{primaryBackground:n("button","primaryBackground",e.primary),primaryText:n("button","primaryText",e.primaryForeground),secondaryBackground:n("button","secondaryBackground",e.card),secondaryText:n("button","secondaryText",e.foreground),borderRadius:n("button","borderRadius",12),borderWidth:n("button","borderWidth",0),borderColor:n("button","borderColor",e.border)},container:{titleColor:n("container","titleColor",e.foreground),subtitleColor:n("container","subtitleColor",e.foregroundMuted),actionColor:n("container","actionColor",e.foregroundMuted),actionTitle:n("container","actionTitle",e.foregroundMuted),buttonColor:n("container","buttonColor",e.primary),buttonTitleColor:n("container","buttonTitleColor",e.primaryForeground),iconBackgroundColor:n("container","iconBackgroundColor",e.success),iconColor:n("container","iconColor",e.foreground)},search:{backgroundColor:n("search","backgroundColor",e.card),inputColor:n("search","inputColor",e.foreground),placeholderColor:n("search","placeholderColor",e.foregroundMuted),borderRadius:n("search","borderRadius",8)},list:{titleSectionColor:n("list","titleSectionColor",e.foregroundMuted),rowBorderRadius:n("list","rowBorderRadius",12)},badge:{borderRadius:n("badge","borderRadius",8)},sheet:{shadowColor:n("sheet","shadowColor","#000"),shadowOffset:n("sheet","shadowOffset",{width:0,height:-4}),shadowOpacity:n("sheet","shadowOpacity",.1),shadowRadius:n("sheet","shadowRadius",12),elevation:n("sheet","elevation",16)},depositMenu:{card:sl(s,i)},transferCrypto:{depositAddress:{card:sl(s,a)}},depositCard:{quoteProvider:{card:sl(s,l)}},depositTracker:{executionRow:{card:sl(s,u)}}}}function Yc(e,t,r){let n={...Kc[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var Gc=ci.createContext(null);function O(){let e=ci.useContext(Gc);if(!e){let t=Qc.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:oa(t,void 0,"dark"),isDark:true}}return e}function st({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:s,gradientTo:i}){let{colors:a}=O(),l=s??a.warning,u=i??"#FBBF24",c=ci.useRef(new reactNative.Animated.Value(0)).current,b=ci.useId(),T=ci.useMemo(()=>`circularProgressGrad_${b.replace(/[^a-zA-Z0-9_-]/g,"")}`,[b]),w=(e-t)/2,p=2*Math.PI*w,y=e/2,f=o??Math.max(0,Math.round(e-t*2-8)),k=(e-f)/2;ci.useEffect(()=>{let d=reactNative.Animated.loop(reactNative.Animated.timing(c,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true})),x=requestAnimationFrame(()=>d.start());return ()=>{cancelAnimationFrame(x),d.stop();}},[c]);let C=c.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsxs(reactNative.View,{style:[{width:e,height:e},n],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:C}]},children:jsxRuntime.jsxs(It__default.default,{width:e,height:e,children:[jsxRuntime.jsx(It.Defs,{children:jsxRuntime.jsxs(It.LinearGradient,{id:T,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(It.Stop,{offset:"0%",stopColor:l}),jsxRuntime.jsx(It.Stop,{offset:"100%",stopColor:u})]})}),jsxRuntime.jsx(It.Circle,{cx:y,cy:y,r:w,stroke:`url(#${T})`,strokeWidth:t,fill:"none",strokeDasharray:`${p*.75} ${p*.25}`,strokeLinecap:"round",rotation:-90,origin:`${y}, ${y}`})]})}),r!=null?jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:k+1.5,left:k,width:f,height:f},children:r}):null]})}function Zc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(It.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function os({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(It.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function jr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(It.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function na({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(It.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ct({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(It.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Sr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(It.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function ns({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(It.Polyline,{points:"15 18 9 12 15 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Kt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(It.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function fn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(It.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Path,{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function $e({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(It.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function ia({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(It.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Xc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(It.Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ao({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(It.Path,{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Nn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(It.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Path,{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ll({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(It.Path,{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Wo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(It.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function is({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(It.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Path,{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ss({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(It.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function oo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(It.Path,{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function cl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(It.Path,{d:"M3 7V5a2 2 0 0 1 2-2h2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Path,{d:"M17 3h2a2 2 0 0 1 2 2v2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Path,{d:"M21 17v2a2 2 0 0 1-2 2h-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Path,{d:"M7 21H5a2 2 0 0 1-2-2v-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Path,{d:"M8 14s1.5 2 4 2 4-2 4-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Path,{d:"M9 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Path,{d:"M15 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function dl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(It.Path,{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Path,{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function sa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(It.Path,{d:"M5.43 5.43A8.06 8.06 0 0 0 4 10c0 6 8 12 8 12a29.94 29.94 0 0 0 5-5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Path,{d:"M19.18 13.52A8.66 8.66 0 0 0 20 10a8 8 0 0 0-8-8 7.88 7.88 0 0 0-3.52.82",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Path,{d:"M9.13 9.13A2.78 2.78 0 0 0 9 10a3 3 0 0 0 3 3 2.78 2.78 0 0 0 .87-.13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function sp({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(It.Path,{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Path,{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ap({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(It.Circle,{cx:12,cy:5,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(It.Circle,{cx:12,cy:12,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(It.Circle,{cx:12,cy:19,r:1,stroke:t,strokeWidth:r,fill:t})]})}function lp({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(It.Path,{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Polyline,{points:"16 17 21 12 16 7",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(It.Line,{x1:21,y1:12,x2:9,y2:12,stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function cp({height:e=24,color:t="#011e0f"}){let o=e*2.985416666666667;return jsxRuntime.jsxs(It__default.default,{width:o,height:e,viewBox:"0 0 71.65 24",fill:"none",children:[jsxRuntime.jsx(It.Path,{d:"M36.12,3.68c0-1.13.95-2.04,2.07-2.04s2.07.92,2.07,2.04-.92,2.07-2.07,2.07-2.07-.92-2.07-2.07ZM29.98,1.92h3.6v20.16h-3.6s0-20.16,0-20.16ZM40.01,7.68h-3.63v14.4h3.63V7.68ZM66.1,14.39c2.73-1.68,4.59-4.18,5.32-6.72h-3.63c-.95,2.42-3.12,4.24-5.5,5.01V1.92h-3.63v20.16h3.63v-6c2.77.69,4.96,3.09,5.71,6h3.65c-.56-3.05-2.64-5.91-5.55-7.68ZM46.44,9.29c.95-1.26,2.8-2,4.31-2,2.8,0,5.12,2.05,5.13,5.15v9.63h-3.63v-8.83c0-1.27-.57-2.74-2.4-2.74-2.16,0-3.4,1.92-3.4,4.16v7.43h-3.63V7.69h3.63v1.6Z",fill:t}),jsxRuntime.jsx(It.Circle,{cx:12,cy:12,r:12,fill:"#00d66f"}),jsxRuntime.jsx(It.Path,{d:"M11.45,4.8h-3.7c.72,3.01,2.82,5.58,5.45,7.2-2.64,1.62-4.73,4.19-5.45,7.2h3.7c.92-2.78,3.46-5.2,6.58-5.7v-3.01c-3.12-.49-5.66-2.91-6.58-5.69Z",fill:"#011e0f"})]})}function as({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:s,components:i}){let a=reactNative.useColorScheme(),l=ci.useMemo(()=>t==="auto"?a==="dark"?"dark":"light":t,[t,a]),u=ci.useMemo(()=>{let w=o?.[l];return Yc(l,w,r)},[l,o,r]),c=ci.useMemo(()=>oa(u,i,l),[u,i,l]),b=ci.useMemo(()=>s?{regular:s.regular||n,medium:s.medium||n,semibold:s.semibold||n,bold:s.bold||n}:n?{regular:n,medium:n,semibold:n,bold:n}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[n,s]),T=ci.useMemo(()=>({mode:l,colors:u,fonts:b,components:c,isDark:l==="dark"}),[l,u,b,c]);return jsxRuntime.jsx(Gc.Provider,{value:T,children:e})}var da={damping:28,stiffness:300,mass:.8},Jh=80,Zh=500;function wt({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,enablePanDownToClose:n=true,showHandle:s=true,heightPercent:i,maxHeightPercent:a,startExpanded:l=false,noPadding:u=false,borderTopLeftRadius:c=24,borderTopRightRadius:b=24}){let{colors:T}=O(),{height:w}=reactNative.useWindowDimensions(),[p,y]=ci.useState(false),f=ci.useRef(e);f.current=e;let k=ci.useRef(0),C=i!=null&&i>=1,d=C||u?0:reactNative.Platform.OS==="ios"?34:24,x=a!=null&&i!=null&&a>i,v=i!=null?(x?a:i)*w:void 0,h=x?(a-i)*w:0,g=l?0:h,S=up.useSharedValue(w),_=ci.useRef(null),A=ci.useCallback(()=>{_.current&&(clearTimeout(_.current),_.current=null),f.current||y(false);},[]);ci.useEffect(()=>{e?(_.current&&(clearTimeout(_.current),_.current=null),y(true),S.value=up.withSpring(g,da)):p&&(S.value=up.withTiming(w,{duration:250},j=>{j&&up.runOnJS(A)();}),_.current=setTimeout(()=>{_.current=null,A();},350));},[e]),ci.useEffect(()=>()=>{_.current&&clearTimeout(_.current);},[]),ci.useEffect(()=>{p&&e&&(S.value=up.withSpring(g,da));},[g]);let W=ci.useCallback(()=>{o&&t();},[o,t]),I=ci.useMemo(()=>{if(!(!n&&!x))return reactNative.PanResponder.create({onStartShouldSetPanResponder:()=>true,onMoveShouldSetPanResponder:()=>true,onPanResponderGrant:()=>{k.current=S.value;},onPanResponderMove:(j,me)=>{if(Math.abs(me.dy)<4)return;let Xe=k.current+me.dy;S.value=Math.max(0,Xe);},onPanResponderRelease:(j,me)=>{if(!(Math.abs(me.dy)<4)){if(n&&(me.dy>Jh||me.vy>Zh)){t();return}if(x){let Xe=h/2,Ie=S.value<Xe?0:h;S.value=up.withSpring(Ie,da);}else S.value=up.withSpring(g,da);}},onPanResponderTerminate:()=>{S.value=up.withSpring(g,da);}}).panHandlers},[n,x,h,g,S,t]),F=up.useAnimatedStyle(()=>({transform:[{translateY:S.value}]})),z=up.useAnimatedStyle(()=>({opacity:up.interpolate(S.value,[0,w*.5,w],[.5,.25,0],up.Extrapolation.CLAMP)}));return p?jsxRuntime.jsx(reactNative.Modal,{transparent:true,visible:true,animationType:"none",onRequestClose:t,children:jsxRuntime.jsxs(reactNative.View,{style:Ti.root,pointerEvents:e?"auto":"none",children:[jsxRuntime.jsx(up__default.default.View,{style:[Ti.backdrop,z],pointerEvents:e?"auto":"none",children:jsxRuntime.jsx(reactNative.Pressable,{style:reactNative.StyleSheet.absoluteFill,onPress:W})}),jsxRuntime.jsxs(up__default.default.View,{style:[Ti.sheet,F,{height:v,backgroundColor:T.background,borderTopLeftRadius:C?0:c,borderTopRightRadius:C?0:b}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.GestureHandlerRootView,{style:Ti.gestureRoot,children:[s&&jsxRuntime.jsx(reactNative.View,{style:Ti.handleContainer,pointerEvents:"none",children:jsxRuntime.jsx(reactNative.View,{style:[Ti.handle,{backgroundColor:T.foreground+"33"}]})}),r,d>0&&jsxRuntime.jsx(reactNative.View,{style:{height:d}})]}),I&&jsxRuntime.jsx(reactNative.View,{...I,style:Ti.dragOverlay})]})]})}):null}var Ti=reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},backdrop:{...reactNative.StyleSheet.absoluteFillObject,backgroundColor:"#000"},sheet:{overflow:"hidden"},gestureRoot:{flex:1},handleContainer:{alignItems:"center",paddingTop:10,paddingBottom:4,zIndex:1},dragOverlay:{position:"absolute",top:0,left:0,right:0,height:40,zIndex:2},handle:{width:36,height:5,borderRadius:2.5}}),dt=ci__namespace.default.forwardRef((e,t)=>jsxRuntime.jsx(reactNative.ScrollView,{ref:t,...e}));dt.displayName="BottomSheetScrollView";function ls(e){return jsxRuntime.jsx(reactNative.FlatList,{...e})}var Xh="https://api.unifold.io",nd="__UnifoldDevApiBaseUrl__",Mr="pk_test_123",ul={};function eg(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[nd];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function mr(){return eg()??Xh}function pl(e){if(e.publishableKey!==void 0){if(!e.publishableKey||e.publishableKey.trim()==="")throw new Error("Unifold SDK: publishableKey cannot be empty. Please provide a valid publishable key.");!e.publishableKey.startsWith("pk_test_")&&!e.publishableKey.startsWith("pk_live_")&&console.warn('Unifold SDK: publishableKey should start with "pk_test_" or "pk_live_". Please ensure you are using a valid publishable key.'),Mr=e.publishableKey;}e.defaultConfig&&(ul=e.defaultConfig);}function mp(e){if(typeof __DEV__>"u"||!__DEV__){console.warn("[Unifold] setDevApiUrl() is only available in development mode");return}if(typeof globalThis>"u")return;let t=e.trim();t.length>0?globalThis[nd]=t:delete globalThis[nd];}function ua(){return mr()}function ml(){return Mr}function no(e){if(!e||e.trim()==="")throw new Error("Unifold SDK: No publishable key configured. Please provide a valid publishable key via setApiConfig() or pass it directly to the API function.");e==="pk_test_123"&&console.warn('Unifold SDK: Using default test key "pk_test_123". This should only be used for local development. Please use a real publishable key in production.');}function ar(e){let t=e.startsWith("/")?e:`/${e}`;return `${mr()}/api/public${t}`}function oe(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,mr()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${mr()}${e}`:`${mr()}/api/public${e}`:""}async function gn(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||ul.recipientAddress;if(!r)throw new Error("[Unifold] recipient_address is required for createDepositAddress. Pass recipientAddress in your beginDeposit() config.");let o={external_user_id:e.external_user_id,destination_chain_type:e?.destination_chain_type||"ethereum",destination_chain_id:e?.destination_chain_id||ul.destinationChainId||"8453",destination_token_address:e?.destination_token_address||ul.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||Mr;no(n);let s=await fetch(`${mr()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!s.ok)throw new Error(`Failed to create deposit address: ${s.statusText}`);return await s.json()}function yn(e,t){return e.find(r=>r.chain_type===t)}async function bn(e,t,r){let o=t||Mr;no(o);let n=await fetch(`${mr()}/v1/public/direct_executions/query`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify({external_user_id:e,...r&&{action_type:r}})});if(!n.ok)throw new Error(`Failed to query executions: ${n.statusText}`);return n.json()}async function fl(e,t){let r=t||Mr;no(r);let o=await fetch(`${mr()}/v1/public/direct_executions/poll`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify({deposit_wallet_id:e})});if(!o.ok)throw new Error(`Failed to poll executions: ${o.statusText}`);return o.json()}function xe(e,t="svg"){if(!e)return "";if(t==="svg"||!e.icon_urls||e.icon_urls.length===0)return e.icon_url;let r=e.icon_urls.find(o=>o.format===t);return r?r.url:e.icon_url}async function xi(e,t){let r=e||Mr;no(r);let o=`${mr()}/v1/public/tokens/supported_deposit_tokens`;if(t?.destination_token_address&&t?.destination_chain_id&&t?.destination_chain_type){let s=new URLSearchParams({destination_token_address:t.destination_token_address,destination_chain_id:t.destination_chain_id,destination_chain_type:t.destination_chain_type});o=`${o}?${s.toString()}`;}let n=await fetch(o,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch supported deposit tokens: ${n.statusText}`);return n.json()}async function id(e,t){let r=t||Mr;no(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${mr()}/v1/public/tokens/token?${o.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch token metadata: ${n.statusText}`);return n.json()}function hl(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function sd(e,t){let r=t||Mr;no(r);let o=await fetch(`${mr()}/v1/public/onramps/quotes`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to fetch onramp quotes: ${o.statusText}`);return o.json()}async function ad(e,t){let r=t||Mr;no(r);let o=await fetch(`${mr()}/v1/public/onramps/sessions`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to create onramp session: ${o.statusText}`);return o.json()}async function ld(e,t){let r=t||Mr;no(r);let o=new URLSearchParams;e.country_code&&o.append("country_code",e.country_code),e.subdivision_code&&o.append("subdivision_code",e.subdivision_code),o.append("token_address",e.token_address),o.append("chain_id",e.chain_id),o.append("chain_type",e.chain_type);let n=await fetch(`${mr()}/v1/public/onramps/default_token?${o.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch default onramp token: ${n.statusText}`);return n.json()}async function pa(e){let t=e||Mr;no(t);let r=await fetch(`${mr()}/v1/public/onramps/fiat_currencies`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch fiat currencies: ${r.statusText}`);return r.json()}function cs(e,t="png"){if(!e||e.length===0)return;let r=e.find(o=>o.format===t);return r?r.url:e[0]?.url}async function ma(e){let t=e||Mr;no(t);let r=await fetch(`${mr()}/v1/public/projects/config`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch project config: ${r.statusText}`);return r.json()}async function cd(){let e=await fetch(`${mr()}/v1/public/tokens/chains`,{method:"GET",headers:{accept:"application/json"}});if(!e.ok)throw new Error(`Failed to fetch token chains: ${e.statusText}`);return e.json()}function gl(e,t,r){let o=e.find(s=>s.chain_id===r);if(o)return o.chain_name;let n=e.find(s=>s.chain_type===t);return n?n.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}async function fa(){let e=await fetch(`${mr()}/v1/public/ip_address`,{method:"GET",headers:{accept:"application/json"}});if(!e.ok)throw new Error(`Failed to fetch IP address information: ${e.statusText}`);return e.json()}async function yl(e){let t=e||Mr;no(t);let r=await fetch(`${mr()}/v1/public/tokens/supported_destination_tokens`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch supported destination tokens: ${r.statusText}`);return r.json()}async function dd(e,t){let r=t||Mr;no(r);let o=await fetch(`${mr()}/v1/public/addresses/verify`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to verify address: ${o.statusText}`);return o.json()}async function ud(e,t){return fl(e.deposit_wallet_id,t)}async function bl(e,t,r,o,n){let s=n||Mr;no(s);let i=await fetch(`${mr()}/v1/public/addresses/balance`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":s},body:JSON.stringify({address:e,chain_type:t,chain_id:r,token_address:o})});if(!i.ok)throw new Error(`Failed to fetch address balance: ${i.statusText}`);return i.json()}function hp({size:e=28}){return jsxRuntime.jsx(It__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxRuntime.jsxs(It.G,{fillRule:"evenodd",children:[jsxRuntime.jsx(It.Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsxRuntime.jsx(It.Path,{fill:"#FFF",d:"M13.967 23.86c5.445 0 9.86-4.415 9.86-9.86s-4.415-9.86-9.86-9.86c-5.166 0-9.403 3.974-9.825 9.03h14.63v1.642H4.142c.413 5.065 4.654 9.047 9.826 9.047Z"})]})})}function yp({size:e=28}){return jsxRuntime.jsxs(It__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(It.G,{clipPath:"url(#eth_clip)",children:[jsxRuntime.jsx(It.Path,{d:"M14 28C21.732 28 28 21.732 28 14C28 6.26801 21.732 0 14 0C6.26801 0 0 6.26801 0 14C0 21.732 6.26801 28 14 28Z",fill:"#627EEA"}),jsxRuntime.jsx(It.Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(It.Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsxRuntime.jsx(It.Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(It.Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsxRuntime.jsx(It.Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsxRuntime.jsx(It.Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsxRuntime.jsx(It.Defs,{children:jsxRuntime.jsx(It.ClipPath,{id:"eth_clip",children:jsxRuntime.jsx(It.Rect,{width:28,height:28,fill:"white"})})})]})}function wp({size:e=28}){return jsxRuntime.jsxs(It__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(It.G,{clipPath:"url(#btc_clip)",children:[jsxRuntime.jsx(It.Path,{d:"M14 28C21.732 28 28 21.732 28 14C28 6.26801 21.732 0 14 0C6.26801 0 0 6.26801 0 14C0 21.732 6.26801 28 14 28Z",fill:"#F7931A"}),jsxRuntime.jsx(It.Path,{d:"M20.0594 12.1625C20.3438 10.2594 18.9 9.23124 16.9203 8.55311L17.5656 5.97186L15.9906 5.57811L15.3672 8.09374C14.9516 7.9953 14.525 7.89686 14.0985 7.79843L14.7328 5.27186L13.1578 4.87811L12.5125 7.45936C12.1735 7.3828 11.8344 7.30624 11.5063 7.22968V7.21874L9.34065 6.67186L8.92502 8.35624C8.92502 8.35624 10.0844 8.61874 10.0625 8.64061C10.6969 8.79374 10.8063 9.2203 10.7844 9.54843L10.0625 12.4578C10.1063 12.4687 10.161 12.4797 10.2266 12.5125C10.1828 12.5016 10.1281 12.4906 10.0735 12.4687L9.05627 16.5375C8.97971 16.7344 8.78284 17.0187 8.34534 16.9094C8.36721 16.9312 7.20784 16.625 7.20784 16.625L6.43127 18.4297L8.47659 18.9437C8.8594 19.0422 9.23127 19.1406 9.59221 19.2281L8.9469 21.8422L10.5219 22.2359L11.1672 19.6547C11.5938 19.775 12.0094 19.8734 12.4141 19.9828L11.7688 22.5531L13.3438 22.9469L13.9891 20.3328C16.6578 20.8359 18.6594 20.6281 19.5016 18.2219C20.1797 16.2859 19.4688 15.1703 18.0688 14.4375C19.086 14.2078 19.8516 13.5406 20.0594 12.1625ZM16.4938 17.1609C16.0125 19.0969 12.7531 18.0469 11.6922 17.7844L12.5453 14.35C13.6063 14.6125 16.9969 15.1484 16.4938 17.1609ZM16.975 12.1297C16.5375 13.8906 13.825 12.9937 12.95 12.775L13.7266 9.6578C14.6016 9.87655 17.4344 10.2812 16.975 12.1297Z",fill:"white"})]}),jsxRuntime.jsx(It.Defs,{children:jsxRuntime.jsx(It.ClipPath,{id:"btc_clip",children:jsxRuntime.jsx(It.Rect,{width:28,height:28,fill:"white"})})})]})}function Sp({size:e=28}){return jsxRuntime.jsxs(It__default.default,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxRuntime.jsxs(It.Defs,{children:[jsxRuntime.jsxs(It.LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(It.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(It.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(It.LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(It.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(It.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(It.LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(It.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(It.Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsxRuntime.jsx(It.Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxRuntime.jsxs(It.G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsxRuntime.jsx(It.Path,{fill:"url(#sol2)",d:"M64.6,3.8C67.1,1.4,70.4,0,73.8,0h317.4c5.8,0,8.7,7,4.6,11.1l-62.7,62.7c-2.4,2.4-5.7,3.8-9.2,3.8H6.5c-5.8,0-8.7-7-4.6-11.1L64.6,3.8z"}),jsxRuntime.jsx(It.Path,{fill:"url(#sol3)",d:"M333.1,120.1c-2.4-2.4-5.7-3.8-9.2-3.8H6.5c-5.8,0-8.7,7-4.6,11.1l62.7,62.7c2.4,2.4,5.7,3.8,9.2,3.8h317.4c5.8,0,8.7-7,4.6-11.1L333.1,120.1z"}),jsxRuntime.jsx(It.Path,{fill:"url(#sol1)",d:"M64.6,237.9c2.4-2.4,5.7-3.8,9.2-3.8h317.4c5.8,0,8.7,7,4.6,11.1l-62.7,62.7c-2.4,2.4-5.7,3.8-9.2,3.8H6.5c-5.8,0-8.7-7-4.6-11.1L64.6,237.9z"})]})]})}function kp({size:e=28}){return jsxRuntime.jsx(It__default.default,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxRuntime.jsxs(It.G,{children:[jsxRuntime.jsx(It.Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsxRuntime.jsx(It.Path,{fill:"#FFF",d:"M21.092 12.693c-.369-.215-.848-.215-1.254 0l-2.879 1.654-1.955 1.078-2.879 1.653c-.369.216-.848.216-1.254 0l-2.288-1.294c-.369-.215-.627-.61-.627-1.042V12.19c0-.431.221-.826.627-1.042l2.25-1.258c.37-.216.85-.216 1.256 0l2.25 1.258c.37.216.628.611.628 1.042v1.654l1.955-1.115v-1.653a1.16 1.16 0 0 0-.627-1.042l-4.17-2.372c-.369-.216-.848-.216-1.254 0l-4.244 2.372A1.16 1.16 0 0 0 6 11.076v4.78c0 .432.221.827.627 1.043l4.244 2.372c.369.215.849.215 1.254 0l2.879-1.618 1.955-1.114 2.879-1.617c.369-.216.848-.216 1.254 0l2.251 1.258c.37.215.627.61.627 1.042v2.552c0 .431-.22.826-.627 1.042l-2.25 1.294c-.37.216-.85.216-1.255 0l-2.251-1.258c-.37-.216-.628-.611-.628-1.042v-1.654l-1.955 1.115v1.653c0 .431.221.827.627 1.042l4.244 2.372c.369.216.848.216 1.254 0l4.244-2.372c.369-.215.627-.61.627-1.042v-4.78a1.16 1.16 0 0 0-.627-1.042l-4.28-2.409z"})]})})}var Cl=[{label:"Base",value:stripeReactNative.Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:hp},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:yp},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:wp},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:Sp},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:kp}];function wl(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function Sl(e,t){let r=parseFloat(e);if(isNaN(r))return e;let o=t.toLowerCase(),n=["eth","btc"].includes(o)?4:2;return r.toFixed(n)}function ps(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=Cl.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=Cl.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function Tt({onPress:e,title:t,variant:r="close",leftAction:o}){let{components:n,fonts:s}=O(),i=r==="back",a=i?jsxRuntime.jsx(ns,{size:22,color:n.header.buttonColor,strokeWidth:2.5}):jsxRuntime.jsx(ct,{size:20,color:n.header.buttonColor,strokeWidth:2}),l=jsxRuntime.jsx(reactNative.TouchableOpacity,{style:jn.closeBtn,onPress:e,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:i?"Back":"Close",children:a});return t?jsxRuntime.jsxs(reactNative.View,{style:jn.headerWithTitle,children:[i?l:o??jsxRuntime.jsx(reactNative.View,{style:jn.headerSide}),jsxRuntime.jsx(reactNative.Text,{style:[jn.headerTitleText,{color:n.header.titleColor},...s.bold?[{fontFamily:s.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),i?jsxRuntime.jsx(reactNative.View,{style:jn.headerSide}):l]}):jsxRuntime.jsxs(reactNative.View,{style:i?jn.headerWithTitle:jn.header,children:[i?l:jsxRuntime.jsx(reactNative.View,{style:jn.headerSpacer}),!i&&l]})}var kl={paddingTop:8,paddingBottom:8},jn=reactNative.StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...kl},headerWithTitle:{flexDirection:"row",alignItems:"center",...kl,zIndex:9999,overflow:"visible"},headerSpacer:{flex:1},headerSide:{width:28},headerTitleText:{flex:1,textAlign:"center",fontSize:17},closeBtn:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"}});function zr({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=O();return e?jsxRuntime.jsx(reactNative.Text,{style:[Tp.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[Tp.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var Tp=reactNative.StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function vo({quote:e,label:t,value:r,last:o,hideDivider:n}){return jsxRuntime.jsxs(ci.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:e.row,children:[jsxRuntime.jsx(reactNative.Text,{style:e.rowLabel,children:t}),jsxRuntime.jsx(reactNative.Text,{style:[e.rowValue],children:r})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}function yd({quote:e,label:t,address:r,last:o,hideDivider:n}){let[s,i]=ci.useState(false),{colors:a,components:l}=O(),u=()=>{reactNative.Clipboard.setString(r),i(true),setTimeout(()=>i(false),2e3);},c=wl(r);return jsxRuntime.jsxs(ci.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:e.row,children:[jsxRuntime.jsx(reactNative.Text,{style:e.rowLabel,children:t}),jsxRuntime.jsxs(reactNative.View,{style:e.rowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[e.rowValue,{flexShrink:1,minWidth:0}],numberOfLines:1,ellipsizeMode:"middle",selectable:true,children:c}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:u,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:s?jsxRuntime.jsx($e,{size:14,color:a.success,strokeWidth:2.5}):jsxRuntime.jsx(fn,{size:14,color:l.card.actionIcon,strokeWidth:2})})]})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}var Tl={usdc:"#2775CA",usdt:"#26A17B",eth:"#627EEA",btc:"#F7931A",sol:"#9945FF",matic:"#8247E5",dai:"#F5AC37"};function ms({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=O(),s=e.toLowerCase(),i=Tl[s]??n.primary,a=Math.round(o*.42);return jsxRuntime.jsxs(reactNative.View,{style:{width:o,height:o,position:"relative"},children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:t},style:{width:o,height:o,borderRadius:o/2}}):jsxRuntime.jsx(reactNative.View,{style:{width:o,height:o,borderRadius:o/2,backgroundColor:i,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"#FFFFFF",fontWeight:"700",fontSize:o*.38},children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),r?jsxRuntime.jsx(reactNative.Image,{source:{uri:r},style:{position:"absolute",bottom:-2,right:-4,width:a,height:a,borderRadius:a/2,borderWidth:2,borderColor:n.background}}):null]})}function xl({sourceCurrency:e,destinationCurrency:t,destinationNetwork:r,tokenIconUrl:o,networkIconUrl:n,style:s}){let{colors:i,components:a,fonts:l}=O(),u=ar(`/icons/currencies/png/${e.toLowerCase()}.png`),c=ps(r);return jsxRuntime.jsxs(reactNative.View,{style:[ho.diagram,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor},s],children:[jsxRuntime.jsxs(reactNative.View,{style:ho.step,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:u},style:ho.iconImage}),jsxRuntime.jsx(reactNative.Text,{style:[ho.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You paid"}),jsxRuntime.jsx(reactNative.Text,{style:[ho.value,{color:a.card.titleColor,fontFamily:l.medium}],children:e.toUpperCase()})]}),jsxRuntime.jsx(Sr,{size:16,color:i.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:ho.step,children:[jsxRuntime.jsxs(reactNative.View,{style:ho.iconWithBadge,children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:o},style:ho.tokenIcon}):jsxRuntime.jsx(reactNative.View,{style:[ho.tokenIcon,{backgroundColor:Tl[t.toLowerCase()]??i.primary}]}),n?jsxRuntime.jsx(reactNative.Image,{source:{uri:n},style:[ho.networkBadge,{borderColor:i.background}]}):null]}),jsxRuntime.jsx(reactNative.Text,{style:[ho.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You receive"}),jsxRuntime.jsxs(reactNative.Text,{style:[ho.value,{color:a.card.titleColor,fontFamily:l.medium}],children:[t.toUpperCase()," ",c]})]})]})}var ho=reactNative.StyleSheet.create({diagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-around",paddingVertical:20,paddingHorizontal:24,width:"100%"},step:{alignItems:"center"},iconImage:{width:24,height:24,borderRadius:12,marginBottom:4},iconWithBadge:{position:"relative",width:24,height:24,marginBottom:4},tokenIcon:{width:24,height:24,borderRadius:12},networkBadge:{position:"absolute",bottom:-4,right:-6,width:14,height:14,borderRadius:7,borderWidth:2},label:{fontSize:10},value:{fontSize:14,fontWeight:"500",paddingTop:4}});function zo(){let{colors:e,fonts:t,components:r}=O(),o=r.input,n=r.button,s=r.container,i=r.card,a=r.header;return ci.useMemo(()=>{let l=i.borderRadius,u={flex:{flex:1},screen:{flex:1,backgroundColor:e.background,paddingHorizontal:24,paddingBottom:16},content:{flex:1,paddingTop:16},title:{fontSize:18,color:a.titleColor,marginBottom:8,...t.bold?{fontFamily:t.bold}:{}},subtitle:{fontSize:15,color:e.foregroundMuted,marginBottom:36,lineHeight:22,...t.regular?{fontFamily:t.regular}:{}},fieldWrap:{marginBottom:20},fieldLabel:{fontSize:14,color:e.foregroundSubtle,marginBottom:8,...t.semibold?{fontFamily:t.semibold}:{}},input:{backgroundColor:o.backgroundColor,borderRadius:o.borderRadius,padding:16,fontSize:17,color:o.textColor,borderWidth:o.borderWidth,borderColor:o.borderColor,...t.regular?{fontFamily:t.regular}:{}},hint:{fontSize:12,color:e.foregroundSubtle,marginTop:8,...t.regular?{fontFamily:t.regular}:{}},emailRow:{flexDirection:"row",alignItems:"center",gap:6,marginTop:4,backgroundColor:e.card,paddingHorizontal:14,paddingVertical:10,borderRadius:Math.min(l,12)},emailLabel:{fontSize:13,color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},emailValue:{fontSize:13,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},footer:{gap:4},continueBtn:{backgroundColor:s.buttonColor,borderRadius:n.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:s.buttonTitleColor,fontSize:17,...t.bold?{fontFamily:t.bold}:{}},continueBtnTextDisabled:{color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},ghostBtn:{paddingVertical:16,alignItems:"center"},ghostBtnText:{color:e.foregroundMuted,fontSize:15,...t.medium?{fontFamily:t.medium}:{}},loaderInButton:{justifyContent:"center",alignItems:"center"}},c={amountContainer:{flex:1,alignItems:"center",justifyContent:"center",gap:8},amountText:{fontSize:64,color:e.foreground,letterSpacing:-2,minWidth:80,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},amountPlaceholder:{color:e.foregroundSubtle},currencyLabel:{fontSize:15,color:e.foregroundMuted,letterSpacing:1,...t.medium?{fontFamily:t.medium}:{}},minAmountText:{fontSize:13,textAlign:"center",marginTop:8,...t.regular?{fontFamily:t.regular}:{}},quickRow:{flexDirection:"row",gap:10,marginBottom:12},quickPill:{flex:1,paddingVertical:12,alignItems:"center",borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor},quickPillText:{fontSize:14,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},numpad:{gap:4,marginBottom:12},numpadRow:{flexDirection:"row",justifyContent:"space-between"},numpadKey:{flex:1,height:56,alignItems:"center",justifyContent:"center",marginHorizontal:4},numpadKeyText:{fontSize:28,color:e.foreground,...t.regular?{fontFamily:t.regular}:{}},backspaceText:{fontSize:22,color:e.foregroundMuted,...t.regular?{fontFamily:t.regular}:{}},paymentRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,borderRadius:999,backgroundColor:"transparent",alignSelf:"flex-start",marginBottom:12},paymentRowHeader:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:16,borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor,alignSelf:"center"},paymentLeft:{flexDirection:"row",alignItems:"center",gap:6},applePayIcon:{fontSize:20,color:e.foreground},paymentLabel:{fontSize:15,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},paymentHint:{fontSize:13,color:e.foregroundMuted,marginLeft:12,...t.regular?{fontFamily:t.regular}:{}},inlineError:{fontSize:13,color:e.error,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},inlineStatus:{fontSize:13,color:e.foregroundMuted,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},sheetContent:{flex:1,paddingHorizontal:24,paddingTop:8,gap:12},sheetHeader:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:4},sheetBackBtn:{width:32,height:32,borderRadius:16,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitleRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},sheetCloseBtn:{width:28,height:28,borderRadius:14,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitle:{fontSize:18,color:e.foreground,...t.bold?{fontFamily:t.bold}:{}},sheetOption:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border},sheetOptionLeft:{flex:1,flexDirection:"row",alignItems:"center",gap:12},sheetOptionIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},sheetOptionLabel:{fontSize:16,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},sheetOptionHint:{fontSize:13,color:e.foregroundMuted,marginTop:2,...t.regular?{fontFamily:t.regular}:{}},sheetLoading:{alignItems:"center",paddingVertical:32,gap:12},sheetStatusText:{fontSize:15,color:e.foregroundMuted,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},sheetError:{flex:1,justifyContent:"center",paddingVertical:20},sheetErrorText:{fontSize:14,color:e.error,textAlign:"center",lineHeight:20,...t.regular?{fontFamily:t.regular}:{}},addPaymentBtn:{marginTop:12,paddingVertical:14,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center"},addPaymentBtnText:{fontSize:15,color:e.primary,...t.semibold?{fontFamily:t.semibold}:{}}},b={heroBox:{backgroundColor:i.backgroundColor,borderRadius:l,padding:24,alignItems:"center",marginBottom:16,marginTop:8,borderWidth:i.borderWidth,borderColor:i.borderColor,gap:4},heroLabel:{fontSize:12,color:e.foregroundSubtle,letterSpacing:.5,textTransform:"uppercase",...t.semibold?{fontFamily:t.semibold}:{}},heroAmount:{fontSize:48,color:e.foreground,letterSpacing:-1,...t.bold?{fontFamily:t.bold}:{}},heroCurrency:{fontSize:22,color:e.primary,...t.medium?{fontFamily:t.medium}:{}},heroNetwork:{fontSize:15,color:e.foregroundSubtle,marginTop:2,...t.medium?{fontFamily:t.medium}:{}},card:{backgroundColor:i.backgroundColor,borderRadius:l,borderWidth:i.borderWidth,borderColor:i.borderColor,overflow:"hidden",marginBottom:12,marginTop:16},row:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},rowRight:{flex:1,minWidth:0,flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:8},rowDivider:{height:1,marginHorizontal:16,backgroundColor:e.border},rowLabel:{fontSize:14,color:i.rowLeftLabel,...t.regular?{fontFamily:t.regular}:{}},rowValue:{fontSize:14,fontWeight:"500",color:i.rowRightLabel,...t.medium?{fontFamily:t.medium}:{}}},T=Math.max(16,Math.min(l,22)),w={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius:T,borderTopRightRadius:T,borderBottomLeftRadius:10,borderBottomRightRadius:10},swapCardBottom:{borderBottomLeftRadius:T,borderBottomRightRadius:T,borderTopLeftRadius:10,borderTopRightRadius:10,marginTop:16},swapConnectorWrap:{alignSelf:"center",zIndex:3,marginTop:-24,marginBottom:-32},swapConnectorCircle:{width:48,height:48,borderRadius:24,backgroundColor:e.primary,alignItems:"center",justifyContent:"center",borderWidth:4,borderColor:e.background},swapRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginTop:8,gap:12},swapLeftCol:{flex:1,minWidth:0},swapSpendAmount:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceivePrimary:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceiveSub:{fontSize:13,color:e.foregroundMuted,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},swapPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:10,paddingHorizontal:14,borderRadius:999,backgroundColor:e.cardHover,borderWidth:i.borderWidth,borderColor:e.border},swapPillText:{fontSize:16,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},payHint:{fontSize:15,color:e.foregroundMuted,textAlign:"center",marginBottom:18,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},summaryLabel:{fontSize:12,color:e.foregroundSubtle,textTransform:"uppercase",letterSpacing:.3,...t.semibold?{fontFamily:t.semibold}:{}},applePayBtn:{backgroundColor:n.secondaryBackground,borderRadius:n.borderRadius,borderWidth:n.borderWidth>0?n.borderWidth:1,borderColor:n.borderWidth>0?n.borderColor:e.border,paddingVertical:18,alignItems:"center",marginBottom:10},applePayBtnText:{color:n.secondaryText,fontSize:17,...t.bold?{fontFamily:t.bold}:{}}},p={input:{fontSize:14,...t.regular?{fontFamily:t.regular}:{}},list:{gap:8},row:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),borderWidth:i.borderWidth,borderColor:e.border,backgroundColor:e.card},rowSelected:{borderColor:e.primary,backgroundColor:e.successBackground},iconWrap:{width:32,height:32,alignItems:"center",justifyContent:"center",marginRight:12},rowText:{flex:1,fontSize:15,color:e.foregroundMuted,...t.medium?{fontFamily:t.medium}:{}},rowTextSelected:{color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},checkCircle:{width:24,height:24,borderRadius:12,backgroundColor:e.primary,alignItems:"center",justifyContent:"center"}},y={centered:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24},spinnerWrap:{width:80,height:80,borderRadius:40,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center",marginBottom:28},idIcon:{fontSize:36},checkCircle:{width:80,height:80,borderRadius:40,backgroundColor:e.successBackground,borderWidth:2,borderColor:e.success,alignItems:"center",justifyContent:"center",marginBottom:28},heading:{fontSize:28,color:a.titleColor,textAlign:"center",marginBottom:10,...t.bold?{fontFamily:t.bold}:{}},sub:{fontSize:15,color:e.foregroundMuted,textAlign:"center",lineHeight:22,marginBottom:36,...t.regular?{fontFamily:t.regular}:{}},successScrollContent:{flexGrow:1,width:"100%",alignItems:"center",paddingBottom:24},detailCard:{width:"100%"}};return {form:u,quote:b,pm:w,wallet:p,flow:y,amount:c}},[e,t,o,n,s,i,a])}var Rp="",vp;function _l(e){Rp=e;}function Rl(e){vp=e;}function $r(){let e=Rp||ml();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function qr(){return vp??ua()}async function vl(){let e=`${qr()}/v1/public/onramps/headless/stripe/config`,t=$r(),r=await fetch(e,{method:"GET",headers:{"x-publishable-key":t,"Content-Type":"application/json"}});if(!r.ok)throw new Error(`Failed to load Stripe config: ${r.status}`);let o=await r.json();if(!o?.publishable_key)throw new Error("Missing Stripe publishable key in config response");return o.publishable_key}async function bd(e){let t=await fetch(`${qr()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":$r(),"Content-Type":"application/json"},body:JSON.stringify({email:e})});if(!t.ok)throw new Error(`Failed to create auth intent: ${t.status}`);let r=await t.json();return r.auth_intent_id??r.id}async function Ip(e,t){let r=await fetch(`${qr()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":$r(),"Content-Type":"application/json"},body:JSON.stringify({auth_intent_id:e,...t&&{crypto_customer_id:t}})});if(!r.ok)throw new Error(`Failed to exchange auth intent for tokens: ${r.status}`);return r.json()}async function Cd(e,t){let r=await fetch(`${qr()}/v1/public/onramps/headless/stripe/oauth/token/refresh`,{method:"POST",headers:{"x-publishable-key":$r(),"Content-Type":"application/json"},body:JSON.stringify({refresh_token:e,...t&&{crypto_customer_id:t}})}),o=await r.json().catch(()=>({}));if(!r.ok)throw new Error(o?.message??`Failed to refresh OAuth token: ${r.status}`);return o}async function Pp(e,t){let r={crypto_customer_id:e.cryptoCustomerId,payment_token:e.paymentToken,source_amount:e.sourceAmount,source_currency:e.sourceCurrency,destination_currency:e.destinationCurrency,wallet_address:e.walletAddress,destination_network:e.destinationNetwork},o=await fetch(`${qr()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":$r(),"x-stripe-oauth-token":t,"Content-Type":"application/json"},body:JSON.stringify(r)}),n=await o.text();if(!o.ok)throw new Error(`Failed to create onramp session: ${o.status} ${n}`);return JSON.parse(n)}async function Fp(e,t){let r=await fetch(`${qr()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":$r(),"x-stripe-oauth-token":t,"Content-Type":"application/json"}}),o=await r.text();if(!r.ok)throw new Error(`Failed to confirm onramp session: ${r.status} ${o}`);return JSON.parse(o)}async function Cn(e,t){let r=`${qr()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":$r(),"x-stripe-oauth-token":t}}),n=await o.text();if(!o.ok)throw new Error(`Failed to get onramp customer: ${o.status} ${n}`);return JSON.parse(n)}async function Op(e){let t=`${qr()}/v1/public/onramps/headless/stripe/sessions`,r=await fetch(t,{method:"GET",headers:{"x-publishable-key":$r(),"x-stripe-oauth-token":e}}),o=await r.text();if(!r.ok)throw new Error(`Failed to list onramp sessions: ${r.status} ${o}`);return JSON.parse(o)}async function Vp(e,t){let r=`${qr()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":$r(),"x-stripe-oauth-token":t}}),n=await o.text();if(!o.ok)throw new Error(`Failed to get onramp session: ${o.status} ${n}`);return JSON.parse(n)}async function wd(e,t){let r=await fetch(`${qr()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":$r(),"x-stripe-oauth-token":t,"Content-Type":"application/json"}});if(!r.ok){let o=await r.text();throw new Error(`Failed to refresh quote: ${r.status} ${o}`)}return r.json()}async function Sd(e){let t=new URLSearchParams({destinationNetwork:e.destinationNetwork,walletAddress:e.walletAddress});e.destinationTag&&t.set("destinationTag",e.destinationTag),e.cryptoCustomerId&&t.set("crypto_customer_id",e.cryptoCustomerId);let r=await fetch(`${qr()}/v1/public/onramps/headless/stripe/transaction_limits?${t.toString()}`,{method:"GET",headers:{"x-publishable-key":$r(),"x-stripe-oauth-token":e.accessToken}});if(!r.ok){let o=await r.text();throw new Error(`Failed to fetch transaction limits: ${r.status} ${o}`)}return r.json()}async function kd(e,t){let r=await fetch(`${qr()}/v1/public/onramps/headless/stripe/customers/${e}/payment_tokens`,{method:"GET",headers:{"x-publishable-key":$r(),"x-stripe-oauth-token":t}});if(!r.ok){let o=await r.text();throw new Error(`Failed to fetch payment tokens: ${r.status} ${o}`)}return r.json()}async function Dp(e){if(!e.recipient_address)throw new Error("[Unifold] recipient_address is required for fetchDepositAddress. Pass recipientAddress in your onramp config.");let t={external_user_id:e.external_user_id,destination_chain_type:e.destination_chain_type||"ethereum",destination_chain_id:e.destination_chain_id||"8453",destination_token_address:e.destination_token_address||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:e.recipient_address,client_metadata:{}},r=await fetch(`${qr()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":$r(),"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(`Failed to create deposit address: ${r.status}`);return r.json()}function $n(e,t){if(e?.length){let r=e.find(n=>n.format==="png");if(r)return r.url;let o=e.find(n=>n.format==="svg");if(o)return o.url}return t}async function Lp(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await fetch(`${qr()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":$r()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}function vg({size:e=24}){let t=e,r=e*(471/750);return jsxRuntime.jsxs(It__default.default,{width:t,height:r,viewBox:"0 0 750 471",children:[jsxRuntime.jsx(It.Rect,{width:"750",height:"471",rx:"40",fill:"#1A1F71"}),jsxRuntime.jsx(It.Path,{fill:"#FFFFFF",d:"M278.198,334.228l33.36-195.763h53.358l-33.384,195.763H278.198z"}),jsxRuntime.jsx(It.Path,{fill:"#FFFFFF",d:"M524.307,142.687c-10.57-3.966-27.135-8.222-47.822-8.222c-52.725,0-89.863,26.551-90.18,64.604c-0.297,28.129,26.514,43.821,46.754,53.185c20.77,9.597,27.752,15.716,27.652,24.283c-0.133,13.123-16.586,19.116-31.924,19.116c-21.355,0-32.701-2.967-50.225-10.274l-6.877-3.112l-7.488,43.823c12.463,5.466,35.508,10.199,59.438,10.445c56.09,0,92.502-26.248,92.916-66.884c0.199-22.27-14.016-39.216-44.801-53.188c-18.65-9.056-30.072-15.099-29.951-24.269c0-8.137,9.668-16.838,30.559-16.838c17.447-0.271,30.088,3.534,39.936,7.5l4.781,2.259L524.307,142.687"}),jsxRuntime.jsx(It.Path,{fill:"#FFFFFF",d:"M661.615,138.464h-41.23c-12.773,0-22.332,3.486-27.941,16.234l-79.244,179.402h56.031c0,0,9.16-24.121,11.232-29.418c6.123,0,60.555,0.084,68.336,0.084c1.596,6.854,6.492,29.334,6.492,29.334h49.512L661.615,138.464z M596.198,264.872c4.414-11.279,21.26-54.724,21.26-54.724c-0.314,0.521,4.381-11.334,7.074-18.684l3.607,16.878c0,0,10.217,46.729,12.352,56.527h-44.293V264.872z"}),jsxRuntime.jsx(It.Path,{fill:"#FFFFFF",d:"M45.879,138.465l-0.682,4.073c21.093,5.106,39.932,12.496,56.426,21.689l47.346,169.688h56.455l83.004-195.45h-56.526l-52.238,133.496l-5.564-27.131c-0.261-0.838-0.544-1.678-0.834-2.52L156.106,154.992c-3.229-12.396-12.597-16.095-24.186-16.528H45.879z"})]})}function Ig({size:e=24}){return jsxRuntime.jsx(It__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsxs(It.G,{fill:"none",fillRule:"evenodd",children:[jsxRuntime.jsx(It.Circle,{cx:"7",cy:"12",r:"7",fill:"#EA001B"}),jsxRuntime.jsx(It.Circle,{cx:"17",cy:"12",r:"7",fill:"#FFA200",fillOpacity:.8})]})})}function Pg({size:e=24}){return jsxRuntime.jsx(It__default.default,{width:e,height:e,viewBox:"0 0 1152 1152",children:jsxRuntime.jsxs(It.G,{transform:"matrix(1.3333333,0,0,-1.3333333,0,1152)",children:[jsxRuntime.jsx(It.Path,{fill:"#006FCF",d:"M 0,0 H 863.998 V 864 H 0 Z"}),jsxRuntime.jsx(It.G,{transform:"translate(312.9867,136.7145)",children:jsxRuntime.jsx(It.Path,{fill:"#FFFFFF",d:"m 0,0 341.634,-0.725 53.654,59.858 54.038,-59.632 h 101.685 v 87.332 l -63.687,68.682 63.687,68.059 V 309.09 L 0,309.585 Z"})}),jsxRuntime.jsx(It.G,{transform:"translate(349.7917,170.655)",children:jsxRuntime.jsx(It.Path,{fill:"#006FCF",fillRule:"evenodd",d:"m 0,0 v 241.575 h 204.832 v -55.65 H 66.318 V 148.15 H 201.529 V 93.423 H 66.318 V 56.319 H 204.832 V 10e-4 Z"})}),jsxRuntime.jsx(It.G,{transform:"translate(780.0408,412.227)",children:jsxRuntime.jsx(It.Path,{fill:"#006FCF",d:"M 0,0 -69.456,-76.568 -138.713,0 h -87.729 l 113.343,-120.647 -113.341,-120.925 h 85.343 l 69.764,77.335 70.487,-77.335 h 84.803 v 3.43 L -26.971,-120.647 83.957,-1.903 V 0 Z"})}),jsxRuntime.jsx(It.G,{transform:"translate(738.7857,721.0845)",children:jsxRuntime.jsx(It.Path,{fill:"#FFFFFF",d:"M 0,0 -28.373,-79.366 -56.65,0 H -220.625 V -105.93 L -267.278,0 H -400.1 l -136.414,-309.586 h 661.726 l 0,309.586 z"})}),jsxRuntime.jsx(It.G,{transform:"translate(373.0462,548.583)",children:jsxRuntime.jsx(It.Path,{fill:"#006FCF",fillRule:"evenodd",d:"M 0,0 32.145,76.837 64.268,0 Z m -9.212,138.867 -107.187,-241.37 h 73.518 l 20.22,48.332 H 86.914 l 20.207,-48.332 h 75.345 L 75.723,138.867 Z"})}),jsxRuntime.jsx(It.G,{transform:"translate(554.5071,446.121)",children:jsxRuntime.jsx(It.Path,{fill:"#006FCF",d:"M 0,0 64.997,-0.001 V 165.796 L 126.661,-0.001 h 58.418 L 245.49,165.233 V -0.564 l 64,0.563 V 241.368 H 210.032 L 156.513,92.624 103.342,241.012 0,241.369 Z"})})]})})}function xd({sublabel:e,size:t=24,fallbackColor:r="#888"}){if(!e)return jsxRuntime.jsx(os,{size:t*.75,color:r,strokeWidth:1.75});let o=e.toLowerCase();return o.includes("visa")?jsxRuntime.jsx(vg,{size:t}):o.includes("mastercard")?jsxRuntime.jsx(Ig,{size:t}):o.includes("amex")||o.includes("american express")?jsxRuntime.jsx(Pg,{size:t}):jsxRuntime.jsx(os,{size:t*.75,color:r,strokeWidth:1.75})}function Il(e){if(!e)return "";let t=new Date(e*1e3);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:true})}var Rd={initialized:"Initialized",requires_payment:"Awaiting Payment",fulfillment_processing:"Processing",fulfillment_complete:"Complete",rejected:"Rejected"};function vd(e,t){switch(e){case "fulfillment_complete":return t.success;case "fulfillment_processing":case "requires_payment":return t.warning;case "rejected":return t.error;default:return t.foregroundMuted}}function Mp({status:e,colors:t,fontFamily:r}){let o=vd(e,t);return jsxRuntime.jsx(reactNative.View,{style:{paddingHorizontal:8,paddingVertical:2,borderRadius:6,backgroundColor:o+"20"},children:jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:o,fontFamily:r},children:Rd[e]??e})})}function zp({count:e=4}){let{colors:t,components:r}=O(),o=ci.useRef(new reactNative.Animated.Value(.5)).current,n=t.cardHover??t.border,s=Math.min(r.card.borderRadius??12,14);return ci.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[o]),jsxRuntime.jsx(reactNative.View,{style:fs.list,children:Array.from({length:e}).map((i,a)=>jsxRuntime.jsxs(reactNative.View,{style:[fs.row,{backgroundColor:t.card,borderRadius:s,borderWidth:r.card.borderWidth,borderColor:t.border}],children:[jsxRuntime.jsxs(reactNative.View,{style:fs.left,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[fs.amountBar,{backgroundColor:n,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[fs.subtitleBar,{backgroundColor:n,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[fs.badgeBar,{backgroundColor:n,opacity:o}]})]},a))})}var fs=reactNative.StyleSheet.create({list:{gap:8},row:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16},left:{flex:1,gap:6},amountBar:{height:16,width:"40%",borderRadius:8},subtitleBar:{height:12,width:"55%",borderRadius:6},badgeBar:{height:20,width:80,borderRadius:6,marginLeft:12}});function Up({active:e,interval:t=15e3,color:r}){let o=ci.useRef(new reactNative.Animated.Value(0)).current;return ci.useEffect(()=>{if(!e){o.setValue(0);return}let n=()=>{o.setValue(0),reactNative.Animated.timing(o,{toValue:1,duration:t,useNativeDriver:false}).start(({finished:s})=>{s&&n();});};return n(),()=>o.stopAnimation()},[e,t,o]),e?jsxRuntime.jsx(reactNative.View,{style:{height:2,borderRadius:1,overflow:"hidden",opacity:.5},children:jsxRuntime.jsx(reactNative.Animated.View,{style:{height:2,borderRadius:1,backgroundColor:r,width:o.interpolate({inputRange:[0,1],outputRange:["0%","100%"]})}})}):null}function Hp({session:e,onBack:t}){let{colors:r,components:o,fonts:n}=O(),[s,i]=ci.useState(false),a=()=>{reactNative.Clipboard.setString(e.id),i(true),setTimeout(()=>i(false),2e3);},l=e.transaction_details,u=e.status!=="fulfillment_complete"&&e.status!=="rejected",c=vd(e.status,r),b=l?.source_amount?`$${parseFloat(l.source_amount).toFixed(2)}`:"\u2014",T=l?.destination_amount?parseFloat(l.destination_amount).toFixed(2):"\u2014",w=(l?.destination_currency??"").toUpperCase(),p=e.destination_token_metadata,y=$n(p?.icon_urls,p?.icon_url),f=ps(l?.destination_network??""),k=l?.wallet_address?wl(l.wallet_address):null,C=l?.fees?.network_fee_amount?`$${parseFloat(l.fees.network_fee_amount).toFixed(2)}`:null,d=l?.fees?.transaction_fee_amount?`$${parseFloat(l.fees.transaction_fee_amount).toFixed(2)}`:null,x=e.payment_method?e.payment_method.replace(/_/g," ").replace(/\b\w/g,h=>h.toUpperCase()):null,v=[{label:"Amount",value:b},{label:"Received",value:`${T} ${w}`},...x?[{label:"Payment",value:x}]:[],{label:"Network",value:f},...k?[{label:"Wallet",value:k}]:[],...C?[{label:"Network Fee",value:C}]:[],...d?[{label:"Transaction Fee",value:d}]:[]];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:{paddingLeft:16,paddingTop:8},children:jsxRuntime.jsx(Tt,{onPress:t,title:"Purchase Details",variant:"back"})}),jsxRuntime.jsxs(dt,{style:br.scroll,contentContainerStyle:br.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:br.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:{marginBottom:12,width:64,height:64},children:[jsxRuntime.jsx(ms,{currency:w||"USD",tokenIconUrl:y,size:64}),jsxRuntime.jsx(reactNative.View,{style:[br.statusBadge,{backgroundColor:c,borderColor:o.card.backgroundColor??r.background}],children:u?jsxRuntime.jsx(jr,{size:14,color:"#FFFFFF",strokeWidth:2.5}):e.status==="rejected"?jsxRuntime.jsx(ct,{size:14,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx($e,{size:14,color:"#FFFFFF",strokeWidth:2.5})})]}),jsxRuntime.jsxs(reactNative.View,{style:br.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[br.statusDot,{backgroundColor:c}]}),jsxRuntime.jsx(reactNative.Text,{style:[br.statusText,{color:o.container.titleColor,fontFamily:n.semibold}],children:Rd[e.status]??e.status})]}),e.created?jsxRuntime.jsx(reactNative.Text,{style:[br.dateText,{color:o.container.subtitleColor,fontFamily:n.regular}],children:Il(e.created)}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[br.card,{backgroundColor:o.card.backgroundColor,borderRadius:o.card.borderRadius,borderWidth:o.card.borderWidth,borderColor:o.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:br.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[br.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:"ID"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:a,activeOpacity:.7,style:{flexDirection:"row",alignItems:"center",gap:6,flexShrink:1},children:[jsxRuntime.jsx(reactNative.Text,{style:[br.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium,fontSize:12}],numberOfLines:1,children:e.id.length>12?e.id.slice(0,12)+"\u2026":e.id}),s?jsxRuntime.jsx($e,{size:14,color:r.primary,strokeWidth:2}):jsxRuntime.jsx(fn,{size:14,color:r.foregroundMuted,strokeWidth:2})]})]}),v.map(h=>jsxRuntime.jsx(ci__namespace.default.Fragment,{children:jsxRuntime.jsxs(reactNative.View,{style:br.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[br.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:h.label}),jsxRuntime.jsx(reactNative.Text,{style:[br.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium}],selectable:true,children:h.value})]})},h.label))]}),l?.last_error?jsxRuntime.jsx(reactNative.View,{style:[br.card,{backgroundColor:r.errorBackground,borderRadius:o.card.borderRadius}],children:jsxRuntime.jsxs(reactNative.View,{style:br.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[br.cardLabel,{color:r.error,fontFamily:n.regular}],children:"Error"}),jsxRuntime.jsx(reactNative.Text,{style:[br.cardValue,{color:r.error,fontFamily:n.medium,flex:1,textAlign:"right"}],selectable:true,children:l.last_error})]})}):null]})]})}var br=reactNative.StyleSheet.create({scroll:{flex:1,paddingTop:8},scrollContent:{paddingHorizontal:24,paddingBottom:32},iconSection:{alignItems:"center",marginBottom:24},statusBadge:{position:"absolute",bottom:-4,right:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center",borderWidth:2},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16,fontWeight:"600"},dateText:{fontSize:14,marginBottom:2},card:{borderRadius:12,marginBottom:12,overflow:"hidden"},cardRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"}});function jp({onSelect:e,showKycOption:t=true,showSwitchAccount:r=true}){let{colors:o,fonts:n,components:s}=O(),[i,a]=ci.useState(false),l=u=>{a(false),e(u);};return jsxRuntime.jsxs(reactNative.View,{style:Ho.wrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ho.trigger,onPress:()=>a(u=>!u),hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"More options",children:jsxRuntime.jsx(ap,{size:20,color:o.foreground,strokeWidth:2})}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Pressable,{style:Ho.backdrop,onPress:()=>a(false)}),jsxRuntime.jsxs(reactNative.View,{style:[Ho.menu,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius??12,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor,...reactNative.Platform.select({ios:{shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.15,shadowRadius:12},android:{elevation:8}})}],children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ho.menuItem,onPress:()=>l("history"),activeOpacity:.6,children:[jsxRuntime.jsx(jr,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Ho.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Purchase History"})]}),t&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ho.menuItem,onPress:()=>l("kyc"),activeOpacity:.6,children:[jsxRuntime.jsx(oo,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Ho.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Increase Limits (KYC)"})]}),r&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ho.menuItem,onPress:()=>l("logout"),activeOpacity:.6,children:[jsxRuntime.jsx(lp,{size:18,color:o.error,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Ho.menuLabel,{color:o.error,fontFamily:n.regular}],children:"Switch Account"})]})]})]})]})}var Ho=reactNative.StyleSheet.create({wrapper:{zIndex:9999},trigger:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},backdrop:{position:"absolute",top:-500,left:-500,width:2e3,height:2e3,zIndex:9998},menu:{position:"absolute",top:32,left:0,minWidth:200,paddingVertical:6,zIndex:9999},menuItem:{flexDirection:"row",alignItems:"center",paddingHorizontal:14,paddingVertical:12,gap:12},menuLabel:{fontSize:15}});var Ng=[50,100,500],jg=[["1","2","3"],["4","5","6"],["7","8","9"],[".","0","\u232B"]];function qp(e){return e.charAt(0).toUpperCase()+e.slice(1)}function $g(e){return e.card?`${qp(e.card.brand)} ${qp(e.card.funding)} \u2022\u2022\u2022\u2022 ${e.card.last4}`:e.type}function Vl({initialAmount:e="",currency:t="USD",applePaySupported:r=false,hideQuickAmounts:o=false,minAmount:n,maxAmount:s,paymentSelectorPosition:i="inline",onCollectPayment:a,paymentLoading:l=false,paymentStatus:u,paymentError:c,paymentTokens:b=[],onAddPaymentMethod:T,onConfirm:w,onCancel:p,sheetBorderTopLeftRadius:y,sheetBorderTopRightRadius:f,accessToken:k,showHistoryProgressBar:C=true,onLogout:d,onRequestKYC:x,showSwitchAccount:v=true,inputDisabled:h=false}){let g=zo(),{colors:S,components:_,fonts:A}=O(),W=y??_.card.borderRadius,I=f??_.card.borderRadius,[F,z]=ci.useState(e),[j,me]=ci.useState(r?"apple_pay":b.length>0?b[0].id:null),Xe=ci.useRef(false),Ie=P=>{Xe.current=true,me(P);};ci.useEffect(()=>{Xe.current||r||b.length>0&&me(b[0].id);},[b,r]);let[ie,Pe]=ci.useState(false),[Oe,fe]=ci.useState("select"),[Ce,ke]=ci.useState(null),Z=ci.useRef(false);ci.useEffect(()=>{l&&u&&/saving/i.test(u)&&fe("card");},[l,u]);let pe=s,St=pe!=null&&pe>0,ve=ci.useMemo(()=>{if(o)return [];let P=Ng.map(U=>({label:`$${U}`,amount:String(U),disabled:false}));return P.push({label:"MAX",amount:St?String(pe):"0",disabled:!St}),P},[o,St,pe]),lt=P=>{if(P==="\u232B"){z(U=>U.slice(0,-1));return}if(P==="."){if(F.includes("."))return;z(U=>U===""?"0.":U+".");return}z(U=>{let K=U.indexOf(".");return K!==-1&&U.length-K>2?U:U==="0"&&P!=="."?P:U+P});},je=F===""?"0":F,Te=parseFloat(F),rt=n!=null&&!isNaN(Te)&&Te>0&&Te<n,ot=pe!=null&&pe>0&&!isNaN(Te)&&Te>pe,se=F!==""&&!isNaN(Te)&&Te>0&&!rt&&!ot,he=r||b.length>0,Ae=i==="header",we=ci.useMemo(()=>{let P=[];r&&P.push({id:"apple_pay",label:"Apple Pay",hint:"Pay with Apple Pay",isApplePay:true});for(let U of b)P.push({id:U.id,label:$g(U),hint:U.card?`Expires ${U.card.exp_month}/${U.card.exp_year}`:U.type,brand:U.card?.brand,isApplePay:false});return P},[r,b]),ge=we.find(P=>P.id===j),nt=j!=null&&j!=="apple_pay",We=ge?ge.label:nt&&Ce?Ce:nt?"Card":"Pay With",yr=ge?!ge.isApplePay:nt,ce=ge?.brand??Ce??void 0,[re,Se]=ci.useState(false),[mt,ht]=ci.useState([]),[de,Ee]=ci.useState(false),[$t,it]=ci.useState(null),[ir,Ht]=ci.useState(null),sr=ci.useRef(null);sr.current=ir;let Dt=ci.useRef(false);Dt.current=re;let ue=ci.useCallback(async(P=false)=>{if(k){P||(Ee(true),it(null));try{let U=await Op(k);if(!Dt.current)return;let K=Array.isArray(U.data)?U.data:Array.isArray(U)?U:[];ht(K),P||it(null);let Ye=sr.current?.id;if(Ye){let G=K.find(et=>et.id===Ye);G&&Ht(G);}}catch(U){if(!Dt.current)return;P||it(U?.message??"Failed to load history");}finally{!P&&Dt.current&&Ee(false);}}},[k]),Ve=ci.useCallback(()=>{Se(true),ue();},[ue]);ci.useEffect(()=>{if(!re||!k)return;let P=setInterval(()=>ue(true),15e3);return ()=>clearInterval(P)},[re,k,ue]);let D=ci.useCallback(P=>{switch(P){case "history":Ve();break;case "kyc":x?.();break;case "logout":d?.();break}},[Ve,x,d]),H=k?jsxRuntime.jsx(jp,{onSelect:D,showKycOption:!!x,showSwitchAccount:v}):void 0,E=he?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ae?g.amount.paymentRowHeader:g.amount.paymentRow,l&&{opacity:.5}],onPress:()=>{l||(fe("select"),Pe(true));},activeOpacity:.7,disabled:l,children:jsxRuntime.jsxs(reactNative.View,{style:g.amount.paymentLeft,children:[ge?.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:g.amount.applePayIcon,children:"\uF8FF"}):yr?jsxRuntime.jsx(xd,{sublabel:ce,size:20}):null,jsxRuntime.jsx(reactNative.Text,{style:g.amount.paymentLabel,children:We}),jsxRuntime.jsx(Kt,{size:12,color:g.amount.currencyLabel.color,strokeWidth:2.5})]})}):null;return jsxRuntime.jsxs(reactNative.View,{style:g.form.screen,children:[jsxRuntime.jsx(Tt,{onPress:p,title:"Enter amount",leftAction:H}),Ae&&E,jsxRuntime.jsxs(reactNative.View,{style:g.form.content,children:[jsxRuntime.jsxs(reactNative.View,{style:g.amount.amountContainer,children:[jsxRuntime.jsxs(reactNative.Text,{style:[g.amount.amountText,je==="0"&&g.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",je]}),jsxRuntime.jsx(reactNative.Text,{style:g.amount.currencyLabel,children:t.toUpperCase()}),rt&&n!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[g.amount.minAmountText,{color:S.warning}],children:["Minimum amount is $",n.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]}),ot&&pe!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[g.amount.minAmountText,{color:S.warning}],children:["Maximum amount is $",pe.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]})]}),!Ae&&E,ve.length>0&&jsxRuntime.jsx(reactNative.View,{style:g.amount.quickRow,children:ve.map(P=>{let U=!P.disabled&&F===P.amount&&F!=="";return jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[g.amount.quickPill,U&&{backgroundColor:S.primary},P.disabled&&{opacity:.4}],activeOpacity:.7,disabled:P.disabled||l,onPress:()=>z(P.amount),children:jsxRuntime.jsx(reactNative.Text,{style:[g.amount.quickPillText,U&&{color:S.primaryForeground}],children:P.label})},P.label)})}),jsxRuntime.jsx(reactNative.View,{style:g.amount.numpad,children:jg.map((P,U)=>jsxRuntime.jsx(reactNative.View,{style:g.amount.numpadRow,children:P.map(K=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[g.amount.numpadKey,(l||h)&&{opacity:.3}],onPress:()=>lt(K),activeOpacity:.6,disabled:l||h,children:jsxRuntime.jsx(reactNative.Text,{style:K==="\u232B"?g.amount.backspaceText:g.amount.numpadKeyText,children:K})},K))},U))}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[g.form.continueBtn,(!se||l||h)&&g.form.continueBtnDisabled],onPress:()=>se&&!l&&!h&&w(F,j),disabled:!se||l||h,children:l?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:S.primaryForeground}):jsxRuntime.jsx(reactNative.Text,{style:[g.form.continueBtnText,(!se||h)&&g.form.continueBtnTextDisabled],children:"Continue"})}),!ie&&c?jsxRuntime.jsx(reactNative.Text,{style:g.amount.inlineError,children:c}):!ie&&l&&u&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:g.amount.inlineStatus,children:u}):null]}),jsxRuntime.jsx(wt,{visible:ie,onClose:()=>{l||(Pe(false),fe("select"));},closeOnBackdropPress:!l,enablePanDownToClose:!l,showHandle:!l,heightPercent:.44,maxHeightPercent:.9,borderTopLeftRadius:W,borderTopRightRadius:I,children:jsxRuntime.jsx(reactNative.View,{style:g.amount.sheetContent,children:Oe==="select"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:g.amount.sheetTitleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:g.amount.sheetTitle,children:"Pay With"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Pe(false),activeOpacity:.7,style:g.amount.sheetCloseBtn,children:jsxRuntime.jsx(ct,{size:16,color:S.foregroundMuted,strokeWidth:2.5})})]}),jsxRuntime.jsxs(dt,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[we.map(P=>{let U=j===P.id;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:[g.amount.sheetOption,U&&{borderColor:S.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{Ie(P.id),ke(P.isApplePay?null:P.label),Pe(false);},children:[jsxRuntime.jsxs(reactNative.View,{style:g.amount.sheetOptionLeft,children:[jsxRuntime.jsx(reactNative.View,{style:g.amount.sheetOptionIcon,children:P.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:g.amount.applePayIcon,children:"\uF8FF"}):jsxRuntime.jsx(xd,{sublabel:P.brand,size:24})}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1},children:[jsxRuntime.jsx(reactNative.Text,{style:g.amount.sheetOptionLabel,children:P.label}),jsxRuntime.jsx(reactNative.Text,{style:g.amount.sheetOptionHint,children:P.hint})]})]}),U&&jsxRuntime.jsx($e,{size:18,color:S.primary,strokeWidth:2.5})]},P.id)}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:g.amount.addPaymentBtn,activeOpacity:.7,onPress:async()=>{if(!Z.current){Z.current=true;try{let P=await T?.();P&&(Ie(P.token),ke(P.sublabel),Pe(!1));}finally{Z.current=false;}}},children:jsxRuntime.jsx(reactNative.Text,{style:g.amount.addPaymentBtnText,children:"Add Payment Method"})})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:g.amount.sheetHeader,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{l||fe("select");},activeOpacity:.7,style:g.amount.sheetBackBtn,children:jsxRuntime.jsx(ns,{size:20,color:S.foreground,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:g.amount.sheetTitle,children:"Pay With"})]}),l?jsxRuntime.jsxs(reactNative.View,{style:g.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:S.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:g.amount.sheetStatusText,children:u||"Loading Stripe Link..."}):null]}):c?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:g.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:g.amount.sheetErrorText,children:c})}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:g.form.continueBtn,onPress:()=>{a&&se&&a(false,F);},children:jsxRuntime.jsx(reactNative.Text,{style:g.form.continueBtnText,children:"Retry"})})]}):jsxRuntime.jsxs(reactNative.View,{style:g.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:S.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:g.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})}),jsxRuntime.jsx(wt,{visible:re,onClose:()=>{Se(false),Ht(null);},closeOnBackdropPress:true,enablePanDownToClose:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:W,borderTopRightRadius:I,children:ir?jsxRuntime.jsx(Hp,{session:ir,onBack:()=>Ht(null)}):jsxRuntime.jsxs(reactNative.View,{style:g.amount.sheetContent,children:[jsxRuntime.jsx(Tt,{onPress:()=>Se(false),title:"Purchase History"}),C&&jsxRuntime.jsx(Up,{active:re&&!de&&mt.length>0,color:S.primary}),de?jsxRuntime.jsx(zp,{}):$t?jsxRuntime.jsx(reactNative.View,{style:g.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:g.amount.sheetErrorText,children:$t})}):mt.length===0?jsxRuntime.jsx(reactNative.View,{style:g.amount.sheetLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[g.amount.sheetStatusText,{color:S.foregroundMuted}],children:"No purchases yet"})}):jsxRuntime.jsx(dt,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:mt.map(P=>{let U=P.transaction_details,K=U?.source_amount?`$${parseFloat(U.source_amount).toFixed(2)}`:"\u2014",Ye=(U?.destination_currency??"").toUpperCase(),G=U?.destination_amount?`${parseFloat(U.destination_amount).toFixed(2)} ${Ye}`:"",et=Il(P.created),Me=P.destination_token_metadata,Vr=$n(Me?.icon_urls,Me?.icon_url),qt=$n(Me?.chain?.icon_urls,Me?.chain?.icon_url);return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:g.amount.sheetOption,activeOpacity:.7,onPress:()=>Ht(P),children:[jsxRuntime.jsx(ms,{currency:Ye||"USD",tokenIconUrl:Vr,networkIconUrl:qt,size:36}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1,gap:2,marginLeft:12},children:[jsxRuntime.jsx(reactNative.Text,{style:g.amount.sheetOptionLabel,children:K}),G?jsxRuntime.jsx(reactNative.Text,{style:g.amount.sheetOptionHint,children:G}):null]}),jsxRuntime.jsxs(reactNative.View,{style:{flexDirection:"row",alignItems:"center",gap:8},children:[jsxRuntime.jsxs(reactNative.View,{style:{alignItems:"flex-end",gap:2},children:[jsxRuntime.jsx(Mp,{status:P.status,colors:S,fontFamily:A.regular}),et?jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:S.foregroundMuted,fontFamily:A.regular},children:et}):null]}),jsxRuntime.jsx(Sr,{size:14,color:S.foregroundMuted,strokeWidth:2})]})]},P.id)})})]})})]})}function Dl({initialData:e={},loading:t=false,level:r="L0",onComplete:o,onCancel:n}){let s=zo(),{colors:i,fonts:a,components:l}=O(),u=l.input.placeholderColor,c=r==="L0"?["name","address"]:["name","dob","address","ssn"],b=c.length,[T,w]=ci.useState(1),[p,y]=ci.useState(e.firstName??""),[f,k]=ci.useState(e.lastName??""),[C,d]=ci.useState(e.dobMonth??""),[x,v]=ci.useState(e.dobDay??""),[h,g]=ci.useState(e.dobYear??""),[S,_]=ci.useState(e.addressLine1??""),[A,W]=ci.useState(e.addressLine2??""),[I,F]=ci.useState(e.city??""),[z,j]=ci.useState(e.state??""),[me,Xe]=ci.useState(e.postalCode??""),[Ie,ie]=ci.useState(e.country??"US"),[Pe,Oe]=ci.useState(e.idNumber??""),fe=ci.useRef(null),Ce=ci.useRef(null),ke=ci.useRef(null),Z=ci.useRef(null),pe=ci.useRef(null),St=ci.useRef(null),ve=ci.useRef(null),lt=ci.useRef(null),je=c[T-1],Te=()=>{switch(je){case "name":return p.trim().length>0&&f.trim().length>0;case "dob":return C.length===2&&x.length===2&&h.length===4;case "address":return S.trim().length>0&&I.trim().length>0&&z.trim().length>0&&me.trim().length>0;case "ssn":return Pe.trim().length>0;default:return false}},rt=()=>{Te()&&(T<b?w(we=>we+1):o({firstName:p,lastName:f,idNumber:Pe,dobMonth:C,dobDay:x,dobYear:h,addressLine1:S,addressLine2:A,city:I,state:z,postalCode:me,country:Ie}));},ot=()=>{T>1?w(we=>we-1):n();},se={name:{title:"Enter your name",subtitle:"Use your full legal name as it appears on your ID."},dob:{title:"Enter your date of birth",subtitle:"We use this to verify your identity."},address:{title:"Enter your address",subtitle:"Enter the address associated with your ID."},ssn:{title:"Enter your SSN",subtitle:"Your SSN is encrypted and used only for identity verification."}},{subtitle:he}=se[je],Ae=[er.stepCounter,{color:i.foregroundMuted},...a.semibold?[{fontFamily:a.semibold}]:[]];return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:s.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:s.form.screen,children:[jsxRuntime.jsxs(reactNative.View,{style:er.header,children:[jsxRuntime.jsx(reactNative.View,{style:er.headerSide,children:!t&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:er.iconButton,onPress:ot,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:T>1?"Back":"Cancel",children:jsxRuntime.jsx(na,{size:20,color:l.header.buttonColor,strokeWidth:2})})}),jsxRuntime.jsx(reactNative.View,{style:er.headerCenter,children:jsxRuntime.jsxs(reactNative.Text,{style:Ae,children:[T," of ",b]})}),jsxRuntime.jsx(reactNative.View,{style:er.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:er.iconButton,onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx(ct,{size:20,color:l.header.buttonColor,strokeWidth:2})})})]}),jsxRuntime.jsx(reactNative.View,{style:er.progressTrack,children:Array.from({length:b}).map((we,ge)=>jsxRuntime.jsx(reactNative.View,{style:[er.progressSegment,{backgroundColor:ge<T||ge+1===T?i.primary:i.border}]},ge))}),jsxRuntime.jsx(dt,{style:s.form.flex,contentContainerStyle:er.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:jsxRuntime.jsxs(reactNative.View,{pointerEvents:t?"none":"auto",style:[s.form.flex,t&&{opacity:.5}],children:[jsxRuntime.jsx(reactNative.Text,{style:s.form.subtitle,children:he}),je==="name"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Sn,{form:s.form,label:"First name",children:jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"Jane",placeholderTextColor:u,value:p,onChangeText:y,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>fe.current?.focus()})}),jsxRuntime.jsx(Sn,{form:s.form,label:"Last name",children:jsxRuntime.jsx(reactNative.TextInput,{ref:fe,style:s.form.input,placeholder:"Doe",placeholderTextColor:u,value:f,onChangeText:k,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:rt})})]}),je==="dob"&&jsxRuntime.jsxs(reactNative.View,{style:er.dobRow,children:[jsxRuntime.jsxs(reactNative.View,{style:er.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,er.dobLabel],children:"Month"}),jsxRuntime.jsx(reactNative.TextInput,{style:[s.form.input,er.dobInput],placeholder:"MM",placeholderTextColor:u,value:C,onChangeText:we=>{let ge=we.replace(/\D/g,"").slice(0,2);d(ge),ge.length===2&&Ce.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:er.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,er.dobLabel],children:"Day"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Ce,style:[s.form.input,er.dobInput],placeholder:"DD",placeholderTextColor:u,value:x,onChangeText:we=>{let ge=we.replace(/\D/g,"").slice(0,2);v(ge),ge.length===2&&ke.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:er.dobColWide,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,er.dobLabel],children:"Year"}),jsxRuntime.jsx(reactNative.TextInput,{ref:ke,style:[s.form.input,er.dobInput],placeholder:"YYYY",placeholderTextColor:u,value:h,onChangeText:we=>{let ge=we.replace(/\D/g,"").slice(0,4);g(ge);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:rt})]})]}),je==="address"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Sn,{form:s.form,label:"Street address",children:jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"123 Main St",placeholderTextColor:u,value:S,onChangeText:_,returnKeyType:"next",onSubmitEditing:()=>Z.current?.focus()})}),jsxRuntime.jsx(Sn,{form:s.form,label:"Apt, suite, etc. (optional)",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Z,style:s.form.input,placeholder:"Apt 2",placeholderTextColor:u,value:A,onChangeText:W,returnKeyType:"next",onSubmitEditing:()=>pe.current?.focus()})}),jsxRuntime.jsx(Sn,{form:s.form,label:"City",children:jsxRuntime.jsx(reactNative.TextInput,{ref:pe,style:s.form.input,placeholder:"San Francisco",placeholderTextColor:u,value:I,onChangeText:F,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>St.current?.focus()})}),jsxRuntime.jsxs(reactNative.View,{style:er.row,children:[jsxRuntime.jsx(reactNative.View,{style:[s.form.flex,{marginRight:8}],children:jsxRuntime.jsx(Sn,{form:s.form,label:"State",children:jsxRuntime.jsx(reactNative.TextInput,{ref:St,style:s.form.input,placeholder:"CA",placeholderTextColor:u,value:z,onChangeText:we=>j(we.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>ve.current?.focus()})})}),jsxRuntime.jsx(reactNative.View,{style:s.form.flex,children:jsxRuntime.jsx(Sn,{form:s.form,label:"ZIP code",children:jsxRuntime.jsx(reactNative.TextInput,{ref:ve,style:s.form.input,placeholder:"94001",placeholderTextColor:u,value:me,onChangeText:Xe,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>lt.current?.focus()})})})]}),jsxRuntime.jsx(Sn,{form:s.form,label:"Country",children:jsxRuntime.jsx(reactNative.TextInput,{ref:lt,style:s.form.input,placeholder:"US",placeholderTextColor:u,value:Ie,onChangeText:we=>ie(we.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:rt})})]}),je==="ssn"&&jsxRuntime.jsxs(Sn,{form:s.form,label:"Social Security Number",children:[jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"123-45-6789",placeholderTextColor:u,value:Pe,onChangeText:Oe,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:rt}),jsxRuntime.jsx(reactNative.Text,{style:[s.form.hint,er.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]})}),jsxRuntime.jsx(reactNative.View,{style:s.form.footer,children:t&&T>=b?jsxRuntime.jsx(reactNative.View,{style:[s.form.continueBtn,s.form.loaderInButton],children:jsxRuntime.jsx(st,{size:28,strokeWidth:2,gradientFrom:i.primaryForeground,gradientTo:i.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[s.form.continueBtn,!Te()&&s.form.continueBtnDisabled],onPress:rt,disabled:!Te(),children:jsxRuntime.jsx(reactNative.Text,{style:[s.form.continueBtnText,!Te()&&s.form.continueBtnTextDisabled],children:T>=b?"Submit":"Continue"})})})]})})}function Sn({form:e,label:t,children:r}){return jsxRuntime.jsxs(reactNative.View,{style:e.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.fieldLabel,children:t}),r]})}var er=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingTop:16,paddingBottom:16},headerSide:{width:40,alignItems:"center"},headerCenter:{flex:1,alignItems:"center",justifyContent:"center"},iconButton:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"},stepCounter:{fontSize:15},progressTrack:{flexDirection:"row",gap:4,marginBottom:12},progressSegment:{flex:1,height:3,borderRadius:2},scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:4},dobRow:{flexDirection:"row",gap:10,marginBottom:20},dobCol:{flex:1},dobColWide:{flex:1.5},dobLabel:{textAlign:"center"},dobInput:{textAlign:"center"},row:{flexDirection:"row"},ssnHint:{marginTop:10,lineHeight:18}});var Bd="@unifold/stripe_oauth";async function Qp(){try{let e=await Ld__default.default.getItem(Bd);return e?JSON.parse(e):null}catch{return null}}async function Ad(e){try{await Ld__default.default.setItem(Bd,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function ys(){try{await Ld__default.default.removeItem(Bd);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var Xg=5,Zn=null,Wd=false,Ed={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function Ll(e){let t=e?.flowOrder==="amount_first",r=t?"session_params":"email",{configure:o,hasLinkAccount:n,registerLinkUser:s,authorize:i,attachKycInfo:a,presentKycInfoVerification:l,verifyIdentity:u,registerWalletAddress:c,collectPaymentMethod:b,createCryptoPaymentToken:T}=stripeReactNative.useOnramp(),[w,p]=ci.useState(r),[y,f]=ci.useState(!!e?.externalUserId),[k,C]=ci.useState(false),[d,x]=ci.useState(false),[v,h]=ci.useState(""),[g,S]=ci.useState(null),[_,A]=ci.useState(e?.email??""),[W,I]=ci.useState(e?.phone??""),[F,z]=ci.useState(""),[j,me]=ci.useState("US"),[Xe,Ie]=ci.useState(""),[ie,Pe]=ci.useState(""),Oe=ci.useRef(""),fe=ci.useRef(""),Ce=ci.useRef(""),[ke,Z]=ci.useState(false),[pe,St]=ci.useState(false),ve=ci.useRef(0),lt=ci.useRef(false),je=ci.useRef(false),Te=ci.useRef(false),rt=ci.useRef(false),ot=ci.useRef(e?.email??""),se=ci.useRef(false),he=ci.useRef(null),Ae=ci.useRef(""),we=ci.useRef(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),ge=ci.useRef(null),[Jt,nt]=ci.useState(0),[We,yr]=ci.useState(Ed),[ce,re]=ci.useState(e?.defaultWalletAddress??""),[Se,mt]=ci.useState(""),[ht,de]=ci.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[Ee,$t]=ci.useState(e?.defaultSourceAmount??"100"),[it,ir]=ci.useState(e?.defaultSourceCurrency??"usd"),[Ht,sr]=ci.useState(e?.defaultDestinationCurrency??"usdc"),[Dt,ue]=ci.useState(null),[Ve,D]=ci.useState(),[H,E]=ci.useState(),[P,U]=ci.useState(false),K=ci.useRef(null),Ye=ci.useRef(false),G=ci.useRef(0),et=ci.useRef(e?.onComplete),Me=ci.useRef(e?.onError),Vr=ci.useRef(e?.onStepChange),qt=ci.useRef(r);ci.useEffect(()=>{et.current=e?.onComplete;},[e?.onComplete]),ci.useEffect(()=>{Me.current=e?.onError;},[e?.onError]),ci.useEffect(()=>{Vr.current=e?.onStepChange;},[e?.onStepChange]);let wi=ci.useRef(r);ci.useEffect(()=>{w!==wi.current&&(Vr.current?.(w,wi.current),wi.current=w),qt.current=w;},[w]),ci.useEffect(()=>{d&&w!=="email"&&x(false);},[d,w]),ci.useEffect(()=>{y&&w!==r&&f(false);},[y,w,r]);let Y=ci.useCallback((R,V,J)=>{let le={code:R,message:V,step:qt.current,stripeErrorCode:J};S(le),h(""),Me.current?.(le);},[]),Nc=ci.useCallback(R=>{let V={sessionId:R.id,status:R.status,sourceAmount:R.transaction_details.source_amount,sourceCurrency:R.transaction_details.source_currency,destinationAmount:R.transaction_details.destination_amount,destinationCurrency:R.transaction_details.destination_currency,destinationNetwork:R.transaction_details.destination_network,walletAddress:R.transaction_details.wallet_address,fees:{networkFee:R.transaction_details.fees.network_fee_amount,transactionFee:R.transaction_details.fees.transaction_fee_amount}};return et.current?.(V),V},[]),L=ci.useCallback(()=>S(null),[]),ye=R=>R.refresh_token??R.refresh?.refresh_token??"",vt=ci.useCallback((R,V,J,le,ae)=>{fe.current=V,Oe.current=J,e?.externalUserId&&Ad({accessToken:V,refreshToken:J,customerId:R,externalUserId:e.externalUserId,email:ae||_,expiresAt:Date.now()+le*1e3});},[e?.externalUserId,_]),eo=ci.useCallback(async()=>{let R=Oe.current;if(!R)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{let V=await Cd(R,Ce.current??void 0),J=V.access_token,le=ye(V)||R;return Pe(J),vt(Ce.current,J,le,V.expires_in??3600),J}catch(V){return console.error("[tryRefreshAccessToken] refresh failed:",V?.message),await ys(),Zn=null,ge.current=null,fe.current="",Oe.current="",Ce.current="",Pe(""),Ie(""),null}},[vt]),_o=ci.useCallback(async R=>{try{return await R(fe.current)}catch(V){let J=V?.message??"";if(J.includes("stripe_onramp_forbidden")||J.includes("403")){let le=await eo();if(!le)throw Y("authorization_error","Session expired. Please sign in again."),p("email"),V;return await R(le)}throw V}},[eo,Y]);ci.useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){U(false);return}let V=false;return stripeReactNative.isPlatformPaySupported().then(J=>{V||U(J);}),()=>{V=true;}},[e?.merchantIdentifier]),ci.useEffect(()=>(Ye.current=false,()=>{Ye.current=true,K.current&&clearTimeout(K.current);}),[]);let un=ci.useRef(false);ci.useEffect(()=>{if(un.current)return;if(!e?.externalUserId){ys(),Zn=null,ge.current=null,f(false);return}let R=false;return (async()=>{try{let V=await Qp();if(R||!V){R||f(!1);return}if(V.externalUserId!==e.externalUserId){await ys(),Zn=null,ge.current=null,R||f(!1);return}let J=Date.now()>=V.expiresAt,le=V.accessToken,ae=V.refreshToken;if(J)try{let Ue=await Cd(V.refreshToken,V.customerId);if(R)return;le=Ue.access_token,ae=Ue.refresh_token??Ue.refresh?.refresh_token??V.refreshToken,await Ad({accessToken:le,refreshToken:ae,customerId:V.customerId,externalUserId:e.externalUserId,email:V.email,expiresAt:Date.now()+(Ue.expires_in??3600)*1e3});}catch(Ue){console.warn("[useStripeOnramp] refresh failed on mount, user must re-login:",Ue?.message),await ys(),Zn=null,ge.current=null,R||f(!1);return}if(R)return;if(un.current=!0,Ie(V.customerId),Ce.current=V.customerId,Pe(le),fe.current=le,Oe.current=ae,V.email&&(A(V.email),ot.current=V.email),Zn===V.customerId)ge.current=Promise.resolve({error:void 0});else {let Ue=await o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}},cryptoCustomerId:V.customerId});Ue.error?console.error("[useStripeOnramp] restore configureSDK error:",Ue.error.message):Zn=V.customerId,ge.current=Promise.resolve(Ue);}if(R)return;let De=()=>new Promise(Ue=>{let Lt=()=>{se.current&&Ae.current?Ue():setTimeout(Lt,200);};Lt();});try{if(await Promise.race([De(),new Promise((Lt,Ke)=>setTimeout(()=>Ke(new Error("timeout")),1e4))]),R)return;let Ue=Ae.current.toLowerCase();await c(Ue,we.current);}catch(Ue){console.warn("[useStripeOnramp] wallet re-registration on restore failed (non-fatal):",Ue?.message);}if(R)return;try{let Lt=(await Cn(Ce.current,fe.current)).kyc_tiers??[],Ke=Lt.find(to=>to.tier==="l0"),ur=Lt.find(to=>to.tier==="l1"),Ir=Lt.find(to=>to.tier==="l2"),wr=Ke?.verification_status==="verified",Ro=ur?.verification_status==="verified",Bt=Ir?.verification_status==="verified",pn=!!Ke?.verification_status&&Ke.verification_status!=="not_started";p(wr||Ro||Bt?"session_params":pn?"kyc_offer":"kyc");}catch{p("kyc");}}finally{R||f(false);}})(),()=>{R=true;}},[]),ci.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||ke)return;let R=false;St(true);async function V(){try{let[J,le]=await Promise.all([Dp({external_user_id:e.externalUserId,recipient_address:e.recipientAddress,destination_chain_type:e?.destinationChainType,destination_chain_id:e?.destinationChainId,destination_token_address:e?.destinationTokenAddress}),e?.destinationTokenAddress&&e?.destinationChainId&&e?.destinationChainType?Lp({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(Bt=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",Bt?.message),null)):Promise.resolve(null)]);if(R)return;let ae=e?.destinationChainType??"ethereum",De=J.data.find(Bt=>Bt.chain_type===ae);if(De?.address){let Bt=De.address.toLowerCase();re(Bt),Ae.current=Bt,De.recipient_address&&mt(De.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",ae,"in",J.data?.length,"wallets");let Ue={base:stripeReactNative.Onramp.CryptoNetwork.base,ethereum:stripeReactNative.Onramp.CryptoNetwork.ethereum,solana:stripeReactNative.Onramp.CryptoNetwork.solana,bitcoin:stripeReactNative.Onramp.CryptoNetwork.bitcoin,polygon:stripeReactNative.Onramp.CryptoNetwork.polygon},Lt={8453:"base",1:"ethereum",137:"polygon"},Ke=le?.destination_network,ur="none";if(Ke&&Ue[Ke])de(Ue[Ke]),we.current=Ue[Ke],ur=Ke+" (from default_token API)";else if(e?.destinationChainId&&Lt[e.destinationChainId]){let Bt=Lt[e.destinationChainId];Ue[Bt]&&(de(Ue[Bt]),we.current=Ue[Bt]),ur=Bt+" (from chain_id "+e.destinationChainId+")";}else Ue[ae]&&(de(Ue[ae]),we.current=Ue[ae],ur=ae+" (from chain_type fallback)");le?.destination_currency&&sr(le.destination_currency.toLowerCase());let Ir=le?.destination_token_metadata,wr=$n(Ir?.icon_urls,Ir?.icon_url),Ro=$n(Ir?.chain?.icon_urls,Ir?.chain?.icon_url);wr&&D(wr),Ro&&E(Ro),Z(!0),se.current=!0;}catch(J){if(R)return;console.error("[resolveWallet] Failed to resolve wallet:",J?.message),Z(true),se.current=true;}finally{R||St(false);}}return he.current=V(),()=>{R=true;}},[e?.publishableKey,e?.externalUserId,Jt]);let Dr=ci.useCallback(async()=>{if(ge.current)return ge.current;let R=o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(V=>(V.error&&(console.error("[useStripeOnramp] configureSDK error:",V.error.message,V.error.code),ge.current=null),V)).catch(V=>{throw console.error("[useStripeOnramp] configureSDK threw:",V?.message??V),ge.current=null,V});return ge.current=R,R},[o,e?.merchantDisplayName]);ci.useEffect(()=>{e?.externalUserId||Dr();},[]);let ts=ci.useCallback(async R=>{if(!lt.current){lt.current=true,C(true),L(),h("Creating auth intent...");try{let V=await bd(R);h("Waiting for authorization...");let J=await i(V);if(J?.error){Y("authorization_error","Something went wrong during authorization. Please try again."),p("email");return}if(J?.status==="Denied"){Y("authorization_error","Authorization denied by user."),p("email");return}if(J?.status!=="Consented"||!J.customerId){Y("authorization_error","Authorization was canceled."),p("email");return}h("Exchanging tokens...");let le=J.customerId,ae=await Ip(V,le),De=ae.access_token,Ue=ye(ae);A(R),ot.current=R,Ie(le),Ce.current=le,Zn=le,Pe(De),vt(le,De,Ue,ae.expires_in??3600,R),h("Checking verification status...");try{let Ke=(await Cn(le,De)).kyc_tiers??[],ur=Ke.find(Er=>Er.tier==="l0"),Ir=Ke.find(Er=>Er.tier==="l1"),wr=Ke.find(Er=>Er.tier==="l2"),Ro=ur?.verification_status==="verified",Bt=Ir?.verification_status==="verified",pn=wr?.verification_status==="verified",to=!!ur?.verification_status&&ur.verification_status!=="not_started";if(h(""),Ro||Bt||pn){he.current&&(h("Resolving wallet..."),await he.current,h(""));let Er=Ae.current;if(Er)try{let Hn=Er.toLowerCase(),il=we.current,mn=await c(Hn,il);mn?.error?(console.warn("[proceedToAuthorize] wallet registration error:",mn.error.message),Y("wallet_error",mn.error.message,mn.error.code),p("wallet")):p("session_params");}catch(Hn){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",Hn?.message),p("wallet");}else p("wallet");}else to?(await Si(),h(""),p("kyc_offer")):p("kyc");}catch(Lt){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",Lt?.message),h(""),p("kyc");}}catch(V){Y("authorization_error",V?.message??String(V)),p("email");}finally{lt.current=false,C(false);}}},[i,L,Y,vt,c,ht]),ch=ci.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!_){Y("validation_error","Please enter an email address.");return}C(true),L(),h("");try{h("Configuring...");let R=await Dr();if(R.error){Y("configuration_error",R.error.message,R.error.code);return}h("Checking Link account...");let V=await n(_);if(V.error){Y("authorization_error",V.error.message,V.error.code);return}V.hasLinkAccount?await ts(_):(h(""),p("disclaimer"));}catch(R){Y("unknown_error",R?.message??String(R));}finally{C(false);}},[L,Dr,_,Y,n,ts]),dh=ci.useCallback(async()=>{if(!Te.current){if(!W){Y("validation_error","Please enter your phone number.");return}Te.current=true,C(true),L(),h("");try{h("Creating Link account...");let R=await s({email:_,phone:W,fullName:F||_,country:j||"US"});if(R.error){Y("registration_error",R.error.message,R.error.code);return}await ts(_);}catch(R){Y("registration_error",R?.message??String(R));}finally{Te.current=false,C(false);}}},[L,j,_,Y,F,W,s,ts]);ci.useEffect(()=>{if(w!=="email")return;let R=rt.current||Wd;if(R&&(rt.current=false,Wd=false),!e?.email||y)return;if(R){x(true);return}let V=++ve.current,J=false,le=()=>J||ve.current!==V;return e?.phone?(async()=>{C(true),L();try{h("Configuring...");let ae=await Dr();if(le())return;if(ae.error){Y("configuration_error",ae.error.message,ae.error.code);return}h("Checking Link account...");let De=await n(e.email);if(le())return;if(De.error){Y("authorization_error",De.error.message,De.error.code);return}if(De.hasLinkAccount){if(le())return;await ts(e.email);}else {if(le())return;h(""),p("disclaimer");}}catch(ae){le()||Y("unknown_error",ae?.message??String(ae));}finally{C(false);}})():(async()=>{C(true),L();try{h("Configuring...");let ae=await Dr();if(le())return;if(ae.error){Y("configuration_error",ae.error.message,ae.error.code);return}h("Checking Link account...");let De=await n(e.email);if(le())return;if(De.error){Y("authorization_error",De.error.message,De.error.code);return}if(De.hasLinkAccount){if(le())return;await ts(e.email);}else {if(le())return;h(""),p("disclaimer");}}catch(ae){le()||Y("unknown_error",ae?.message??String(ae));}finally{C(false);}})(),()=>{J=true;}},[w,e?.email,e?.phone,y]);let Si=ci.useCallback(async()=>{he.current&&(h("Resolving wallet..."),await he.current);let R=Ae.current;if(R)try{h("Registering wallet...");let V=R.toLowerCase(),J=we.current;await c(V,J);}catch(V){console.warn("[resolveAndRegisterWallet] wallet registration failed (non-fatal):",V?.message);}else console.warn("[resolveAndRegisterWallet] no resolved deposit address \u2014 skipping registration");},[c]),uh=ci.useCallback(async(R,V)=>{C(true),L(),h(""),yr(De=>({...De,...R}));let J=!V,le=V??"kyc_offer",ae=V?"kyc_l1":"kyc";try{let De=R.dobDay&&R.dobMonth&&R.dobYear,Ue=R.firstName&&R.lastName,Lt={};Ue&&(Lt.firstName=R.firstName,Lt.lastName=R.lastName),R.addressLine1&&(Lt.address={line1:R.addressLine1,line2:R.addressLine2||void 0,city:R.city,state:R.state,postalCode:R.postalCode,country:R.country}),R.idNumber&&(Lt.idNumber=R.idNumber),De&&(Lt.dateOfBirth={day:parseInt(R.dobDay,10),month:parseInt(R.dobMonth,10),year:parseInt(R.dobYear,10)});let Ke=await a(Lt);if(Ke?.error?.message&&(/no active link consumer/i.test(Ke.error.message)||/not be verified/i.test(Ke.error.message))){if(h("Verifying identity..."),!await ta()){Y("kyc_error","Please verify your identity to continue."),p(ae);return}Ke=await a(Lt);}if(Ke?.error){let Bt=J?"l0":"l1";try{let to=(await Cn(Ce.current,fe.current)).kyc_tiers?.find(Er=>Er.tier===Bt);if(to?.verification_status==="verified"){let Er=J?"session_params":le;await Si(),h(""),p(Er);return}if(to?.verification_status==="rejected"){if(J){await Si(),h(""),p(le);return}Y("kyc_error","Something went wrong. Please try again."),p(ae);return}}catch(pn){console.warn("[attachKyc] could not fetch verification status:",pn?.message);}if(J){await Si(),h(""),p(le);return}Y("kyc_error",Ke.error.message,Ke.error.stripeErrorCode??Ke.error.code),p(ae);return}if(!(Ke&&Object.keys(Ke).length>0&&!Ke.error)){let Bt=J?"l0":"l1";if(h("Verifying identity..."),(!Ce.current||!fe.current)&&(console.warn(`[attachKyc] \u274C cannot poll ${Bt} \u2014 missing customerIdRef or accessTokenRef`),!J)){Y("kyc_error","Unable to verify identity. Please try again."),p(ae);return}let pn=Ce.current,to=fe.current,Er=10,Hn=!1;if(pn&&to)for(let il=0;il<Er;il++){try{let $c=(await Cn(pn,to)).kyc_tiers?.find(wh=>wh.tier===Bt);if($c?.verification_status==="verified"){Hn=!0;break}if($c?.verification_status==="rejected"){if(J)break;console.warn(`[attachKyc] \u274C ${Bt} rejected:`,$c?.verification_errors),Y("kyc_error","KYC verification was rejected. Please try again."),p(ae);return}}catch(mn){console.warn(`[attachKyc] ${Bt} poll error:`,mn?.message);}await new Promise(mn=>setTimeout(mn,2e3));}if(!Hn&&!J){console.warn(`[attachKyc] \u274C ${Bt} verification timed out after`,Er,"attempts"),Y("kyc_error","Identity verification is taking longer than expected. Please try again."),p(ae);return}await Si(),h(""),p(J&&Hn?"session_params":le);return}h("Please review your KYC information...");let wr=await l(null);if(wr?.error){Y("kyc_error",wr.error.message,wr.error.stripeErrorCode??wr.error.code),p(ae);return}if(wr?.status==="UpdateAddress"){Y("kyc_error","Please update your address and resubmit."),p(ae);return}await Si(),h(""),p(J?"session_params":le);}catch(De){Y("kyc_error",De?.message??String(De)),p(ae);}finally{C(false);}},[a,L,Y,l,Si]),ta=ci.useCallback(async()=>{let R=ot.current||e?.email;if(!R)return console.warn("[reestablishLinkSession] no email available \u2014 emailRef:",JSON.stringify(ot.current),"config.email:",e?.email),false;try{let V=await bd(R),J=await i(V);return J?.status==="Consented"&&J.customerId?(Ce.current=J.customerId,Ie(J.customerId),!0):(console.warn("[reestablishLinkSession] authorize did not consent:",J?.status),!1)}catch(V){return console.warn("[reestablishLinkSession] failed:",V?.message),false}},[i,e?.email]),ep=ci.useCallback(async()=>{if(!je.current){je.current=true,C(true),L(),h("Launching identity verification...");try{let R=await u();if(R?.error?.message&&(/no active link consumer/i.test(R.error.message)||/not be verified/i.test(R.error.message))){if(h("Verifying identity..."),!await ta()){Y("identity_error","Please verify your identity to continue.");return}R=await u();}if(R?.error){let J=R.error.message??"";if(/cancel/i.test(J)){h("");return}Y("identity_error",J,R.error.code);return}h(""),rl.current?(rl.current=!1,p("session_params")):p("wallet");}catch(R){Y("identity_error",R?.message??String(R));}finally{je.current=false,C(false);}}},[L,Y,ta,u]),rl=ci.useRef(false);ci.useEffect(()=>{w==="identity"&&!k&&ep();},[w]);let tp=ci.useCallback(async()=>{if(!ce){Y("validation_error","Please enter a wallet address.");return}C(true),L(),h("");try{let R=ce.toLowerCase(),V=await c(R,ht);if(V?.error){console.warn("[registerWallet] error:",V.error.message),Y("wallet_error",V.error.message,V.error.code);return}h(""),p("kyc_offer");}catch(R){console.error("[registerWallet] exception:",R?.message??String(R)),Y("wallet_error",R?.message??String(R));}finally{C(false);}},[L,Y,ce,ht,c]);ci.useEffect(()=>{w==="wallet"&&ke&&ce&&tp();},[w,ke,ce]);let ol=ci.useCallback(R=>{Ye.current=false,G.current=0;let V=0,J=async()=>{V+=1;let le=fe.current;try{let ae=await Vp(R,le);if(Ye.current)return;G.current=0,ae.status==="fulfillment_complete"?(ue(ae),p("success")):K.current=setTimeout(J,3e3);}catch(ae){if(Ye.current)return;let De=ae?.message??"";if((De.includes("stripe_onramp_forbidden")||De.includes("403"))&&await eo()&&!Ye.current){K.current=setTimeout(J,1e3);return}if(G.current+=1,console.error(`[pollSessionStatus] poll #${V} error:`,De),G.current>=Xg){Y("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}K.current=setTimeout(J,5e3);}};K.current=setTimeout(J,3e3);},[Y,eo]),ph=ci.useCallback(()=>{if(qt.current==="processing"&&Dt?.id){if(!fe.current){Y("session_error","Your session has expired. Your purchase may still complete \u2014 close and check your wallet.");return}L(),G.current=0,K.current&&(clearTimeout(K.current),K.current=null),ol(Dt.id);}},[L,Y,ol,Dt?.id]),nl=ci.useCallback(async R=>{C(true),L(),h("");try{h("Confirming purchase...");let V=await _o(J=>Fp(R,J));ue(V),p("processing"),h(""),ol(V.id);}finally{C(false);}},[L,ol,_o]),jc=ci.useRef(false),mh=ci.useCallback(async()=>{if(!(!Dt||jc.current)){jc.current=true;try{C(!0),L(),h("Refreshing quote...");let R=await _o(V=>wd(Dt.id,V));ue(R),await nl(R.id);}catch{Y("session_error","Something went wrong. Please try again."),p("quote");}finally{C(false),jc.current=false;}}},[L,Y,nl,Dt,_o]),fh=ci.useCallback(async(R=false,V,J)=>{let le=V??Ee;if(!le||isNaN(Number(le))||Number(le)<=0){Y("validation_error","Please enter a valid amount.");return}V&&$t(V),C(true),L(),h("");try{let ae=await Dr();if(ae.error){Y("configuration_error",ae.error.message,ae.error.code);return}let De;if(J)De=J;else if(R){if(!e?.merchantIdentifier?.trim()){Y("configuration_error","Apple Pay is not configured. Pass merchantIdentifier on StripeOnramp or in onramp config."),p("session_params");return}h("Opening Apple Pay...");let Ke={applePay:{merchantCountryCode:"US",currencyCode:it.toUpperCase(),cartItems:[{paymentType:stripeReactNative.PlatformPay.PaymentType.Immediate,label:`${Ht.toUpperCase()} purchase + fees`,amount:le}]}},ur=await b("PlatformPay",Ke);if(ur?.error){let wr=ur.error.message??"",Ro=ur.error.code??"";/cancel/i.test(wr)||/cancel/i.test(Ro)||(Y("payment_error",wr,Ro),p("session_params"));return}if(!ur?.displayData)return;h("Creating payment token...");let Ir=await T();if(Ir?.error){Y("payment_error",Ir.error.message,Ir.error.code),p("session_params");return}De=Ir.cryptoPaymentToken;}else {h("Select a payment method...");let Ke=await b("Card");if(Ke?.error){let Ir=Ke.error.message??"",wr=Ke.error.code??"";/cancel/i.test(Ir)||/cancel/i.test(wr)||(Y("payment_error",Ir,wr),p("session_params"));return}if(!Ke?.displayData)return;h("Creating payment token...");let ur=await T();if(ur?.error){Y("payment_error",ur.error.message,ur.error.code),p("session_params");return}De=ur.cryptoPaymentToken;}h("Creating onramp session...");let Ue=Ae.current||ce;if(!Ue){Y("wallet_error","No wallet address available. Please go back and enter a wallet address.");return}let Lt=await _o(Ke=>Pp({cryptoCustomerId:Ce.current,paymentToken:De,sourceAmount:Number(le),sourceCurrency:it,destinationCurrency:Ht,walletAddress:Ue,destinationNetwork:ht},Ke));ue(Lt),h(""),R?await nl(Lt.id):p("quote");}catch{Y("session_error","Something went wrong. Please try again."),p("session_params");}finally{C(false),h("");}},[L,Dr,b,T,Ht,Y,nl,$t,Ee,it,ce,ht,_o,e?.merchantIdentifier]),hh=ci.useCallback(async()=>{C(true),L(),h("Select a payment method...");try{let R=await Dr();if(R.error)return Y("configuration_error",R.error.message,R.error.code),null;let V=await b("Card");if(V?.error?.message&&(/no active link consumer/i.test(V.error.message)||/not be verified/i.test(V.error.message))){if(!await ta())return Y("authorization_error","Please verify your identity to add a payment method."),null;V=await b("Card");}if(V?.error){let De=V.error.message??"",Ue=V.error.code??"";return /cancel/i.test(De)||/cancel/i.test(Ue)||Y("payment_error",De,Ue),null}if(!V?.displayData)return null;let le=V.displayData;h("Saving payment method...");let ae=await T();return ae?.error?(Y("payment_error",ae.error.message,ae.error.code),null):{token:ae.cryptoPaymentToken,sublabel:le.sublabel??""}}catch(R){return Y("session_error",R?.message??String(R)),null}finally{C(false),h("");}},[L,Dr,b,T,Y,ta]),gh=ci.useCallback(async()=>{if(Dt){C(true),L(),h("");try{let R=await _o(V=>wd(Dt.id,V));ue(R);}catch{Y("session_error","Something went wrong. Please try again.");}finally{C(false);}}},[L,Y,Dt,_o]),yh=ci.useCallback(()=>{Ye.current=true,G.current=0,K.current&&(clearTimeout(K.current),K.current=null),p(r),C(false),x(false),h(""),S(null),A(e?.email??""),ot.current=e?.email??"",I(e?.phone??""),z(""),me("US"),Ie(""),Ce.current="",Pe(""),fe.current="",Oe.current="",Z(false),St(false),he.current=null,nt(R=>R+1),yr(Ed),re(""),Ae.current="",se.current=false,de(stripeReactNative.Onramp.CryptoNetwork.ethereum),$t(e?.defaultSourceAmount??"100"),ir(e?.defaultSourceCurrency??"usd"),sr(e?.defaultDestinationCurrency??"usdc"),mt(""),D(void 0),E(void 0),ue(null),ve.current+=1,lt.current=false,je.current=false,Te.current=false;},[e,r]),bh=ci.useCallback(()=>{rl.current=true,p("kyc_offer");},[]),Ch=ci.useCallback(async()=>{await ys(),Zn=null,ge.current=null,Wd=true,rt.current=true,Ye.current=true,G.current=0,K.current&&(clearTimeout(K.current),K.current=null),ve.current+=1,lt.current=false,je.current=false,Te.current=false,fe.current="",Oe.current="",Ce.current="",Ae.current="",se.current=false,he.current=null,Pe(""),Ie(""),A(e?.email??""),ot.current=e?.email??"",I(e?.phone??""),z(""),me("US"),ue(null),S(null),C(false),x(false),h(""),yr(Ed),re(""),Z(false),St(false),nt(R=>R+1),mt(""),D(void 0),E(void 0),p(r);},[e?.email,e?.phone,r]);return {step:w,restoring:y,loading:k,status:v,error:g,email:_,phone:W,fullName:F,country:j,customerId:Xe,accessToken:ie,session:Dt,kycData:We,walletAddress:ce,resolvedRecipientAddress:Se,walletNetwork:ht,sourceAmount:Ee,sourceCurrency:it,destinationCurrency:Ht,tokenIconUrl:Ve,networkIconUrl:H,applePaySupported:P,walletReady:ke,walletLoading:pe,setStep:p,setStatus:h,setEmail:A,setPhone:I,setFullName:z,setCountry:me,setWalletAddress:re,setWalletNetwork:de,setSourceAmount:$t,setSourceCurrency:ir,setDestinationCurrency:sr,checkEmail:ch,register:dh,attachKyc:uh,verifyIdentity:ep,requestKYCUpgrade:bh,kycUpgradeMode:rl,logout:Ch,registerWallet:tp,collectPaymentMethod:fh,addPaymentMethod:hh,refreshQuote:gh,confirmCheckout:mh,reset:yh,clearError:L,emitComplete:Nc,resumeFulfillmentPolling:ph,amountFirst:t,switchingAccount:d}}function Yp({initialData:e={},loading:t=false,error:r,onComplete:o,onCancel:n,onClose:s}){let i=zo(),{colors:a,fonts:l,components:u}=O(),c=u.input.placeholderColor,[b,T]=ci.useState(e.dobMonth??""),[w,p]=ci.useState(e.dobDay??""),[y,f]=ci.useState(e.dobYear??""),[k,C]=ci.useState(e.idNumber??""),[d,x]=ci.useState(null),v=ci.useRef(null),h=ci.useRef(null),g=ci.useRef(null),S=b.length===2&&w.length===2&&y.length===4&&k.trim().length>0,_=()=>{if(!S)return;let W=parseInt(b,10),I=parseInt(w,10),F=parseInt(y,10),z=new Date().getFullYear();if(W<1||W>12){x("Please enter a valid month (01\u201312).");return}if(I<1||I>31){x("Please enter a valid day (01\u201331).");return}if(F<1900||F>z){x(`Please enter a valid year (1900\u2013${z}).`);return}x(null),o({dobMonth:b,dobDay:w,dobYear:y,idNumber:k});},A=d||r;return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:i.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:i.form.screen,children:[jsxRuntime.jsx(Tt,{onPress:t?s??n:n,title:"Increase Your Limits",variant:t?"close":"back"}),jsxRuntime.jsx(dt,{style:i.form.flex,contentContainerStyle:$o.scrollContent,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{pointerEvents:t?"none":"auto",style:{opacity:t?.5:1},children:[jsxRuntime.jsx(reactNative.Text,{style:i.form.title,children:"Date of birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:i.form.subtitle,children:"This information is used to verify your identity and increase your transaction limits."}),jsxRuntime.jsxs(reactNative.View,{style:$o.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Date of birth"}),jsxRuntime.jsxs(reactNative.View,{style:$o.dobRow,children:[jsxRuntime.jsx(reactNative.View,{style:$o.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{style:[i.form.input,$o.dobInput],placeholder:"MM",placeholderTextColor:c,value:b,onChangeText:W=>{let I=W.replace(/\D/g,"").slice(0,2);T(I),I.length===2&&v.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:$o.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{ref:v,style:[i.form.input,$o.dobInput],placeholder:"DD",placeholderTextColor:c,value:w,onChangeText:W=>{let I=W.replace(/\D/g,"").slice(0,2);p(I),I.length===2&&h.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:$o.dobColWide,children:jsxRuntime.jsx(reactNative.TextInput,{ref:h,style:[i.form.input,$o.dobInput],placeholder:"YYYY",placeholderTextColor:c,value:y,onChangeText:W=>{let I=W.replace(/\D/g,"").slice(0,4);f(I),I.length===4&&g.current?.focus();},keyboardType:"number-pad",maxLength:4,editable:!t})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:$o.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Social Security Number"}),jsxRuntime.jsx(reactNative.TextInput,{ref:g,style:i.form.input,placeholder:"123-45-6789",placeholderTextColor:c,value:k,onChangeText:C,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:_,editable:!t}),jsxRuntime.jsx(reactNative.Text,{style:[i.form.hint,{marginTop:10,lineHeight:18}],children:"Your SSN is transmitted securely and never stored on this device."})]}),A?jsxRuntime.jsx(reactNative.Text,{style:[i.amount.inlineError,{marginTop:20}],children:A}):null]})}),jsxRuntime.jsx(reactNative.View,{style:i.form.footer,children:t?jsxRuntime.jsx(reactNative.View,{style:[i.form.continueBtn,i.form.loaderInButton],children:jsxRuntime.jsx(st,{size:28,strokeWidth:2,gradientFrom:a.primaryForeground,gradientTo:a.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[i.form.continueBtn,!S&&i.form.continueBtnDisabled],onPress:_,disabled:!S,children:jsxRuntime.jsx(reactNative.Text,{style:[i.form.continueBtnText,!S&&i.form.continueBtnTextDisabled],children:"Submit"})})})]})})}var $o=reactNative.StyleSheet.create({scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:16},section:{marginTop:20},dobRow:{flexDirection:"row",gap:10},dobCol:{flex:1},dobColWide:{flex:1.5},dobInput:{textAlign:"center"}});function Gp({borderRadius:e,backgroundColor:t,borderColor:r,borderWidth:o}){let n=ci.useRef(new reactNative.Animated.Value(.3)).current;return ci.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[n]),jsxRuntime.jsxs(reactNative.Animated.View,{style:[at.card,{backgroundColor:t,borderRadius:e,borderColor:r,borderWidth:o,opacity:n,alignItems:"center"}],children:[jsxRuntime.jsx(reactNative.View,{style:at.skeletonLine}),jsxRuntime.jsx(reactNative.View,{style:[at.skeletonLine,{width:"60%"}]})]})}function Jp({onRefresh:e,colors:t,fonts:r}){let[o,n]=ci.useState(10),s=ci.useRef(null);ci.useEffect(()=>(s.current=setInterval(()=>{n(l=>l<=1?(s.current&&clearInterval(s.current),0):l-1);},1e3),()=>{s.current&&clearInterval(s.current);}),[]);let i=ci.useCallback(()=>{o>0||(e(),n(10),s.current=setInterval(()=>{n(l=>l<=1?(s.current&&clearInterval(s.current),0):l-1);},1e3));},[o,e]),a=o===0;return jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:i,disabled:!a,style:at.refreshBtn,activeOpacity:.7,children:a?jsxRuntime.jsx(is,{size:14,color:t.foregroundMuted,strokeWidth:2}):jsxRuntime.jsxs(reactNative.Text,{style:[at.refreshText,{color:t.foregroundMuted,fontFamily:r.regular}],children:[o,"s"]})})}function tm({onSelectL1:e,onSelectL2:t,onSkip:r,onClose:o,onRefresh:n,loading:s=false,loadingTiers:i=false,error:a,l1Status:l="not_started",l2Status:u="not_started",l1Completed:c=false,l2Completed:b=false,canPurchase:T=false,currentLimit:w}){let p=zo(),{colors:y,fonts:f,components:k}=O(),C=[at.card,{backgroundColor:k.card.backgroundColor,borderRadius:k.card.borderRadius??12,borderWidth:k.card.borderWidth,borderColor:k.card.borderColor}],d=[...C,{opacity:.5}],x=l==="verified",v=l==="pending",h=l==="rejected",g=u==="verified",S=u==="pending",_=x&&g,A=!x,W=!g,I=x,F=(T||x)&&!_,z=j=>`$${j.toLocaleString()}`;return jsxRuntime.jsxs(reactNative.View,{style:p.form.screen,children:[jsxRuntime.jsx(Tt,{onPress:o,title:"Increase Your Limits"}),jsxRuntime.jsxs(reactNative.View,{style:at.content,children:[w!==void 0&&jsxRuntime.jsxs(reactNative.View,{style:[at.limitBadge,{backgroundColor:k.card.backgroundColor,borderColor:k.card.borderColor,borderWidth:k.card.borderWidth,borderRadius:k.card.borderRadius??12}],children:[jsxRuntime.jsx(reactNative.Text,{style:[at.limitLabel,{color:y.foregroundMuted,fontFamily:f.regular}],children:"Current transaction limit"}),jsxRuntime.jsxs(reactNative.Text,{style:[at.limitValue,{color:y.foreground,fontFamily:f.semibold}],children:[z(w)," USD"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[at.subtitle,{color:y.foregroundMuted,fontFamily:f.regular}],children:i?"Checking your verification status...":_?"All verification levels have been completed. Your limits are at the maximum available.":T?"Complete additional verification to increase your transaction limits.":"Complete identity verification to start making purchases."}),i?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Gp,{borderRadius:k.card.borderRadius??12,backgroundColor:k.card.backgroundColor,borderColor:k.card.borderColor,borderWidth:k.card.borderWidth}),jsxRuntime.jsx(Gp,{borderRadius:k.card.borderRadius??12,backgroundColor:k.card.backgroundColor,borderColor:k.card.borderColor,borderWidth:k.card.borderWidth})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[A&&(v?jsxRuntime.jsxs(reactNative.View,{style:C,children:[jsxRuntime.jsxs(reactNative.View,{style:at.pendingHeader,children:[jsxRuntime.jsx(oo,{size:20,color:y.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[at.cardTitle,{color:y.foreground,fontFamily:f.semibold,flex:1}],children:"Date of Birth & SSN"}),n?jsxRuntime.jsx(Jp,{onRefresh:n,colors:y,fonts:f}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[at.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[at.cardBody,{color:y.foregroundMuted,fontFamily:f.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(st,{size:18,strokeWidth:2,gradientFrom:y.primary,gradientTo:y.primary})]})]}):jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[C,at.cardRow],onPress:e,activeOpacity:.7,children:[jsxRuntime.jsx(oo,{size:20,color:y.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:at.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[at.cardTitle,{color:y.foreground,fontFamily:f.semibold}],children:h?"Retry Date of Birth & SSN":"Provide Date of Birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:[at.cardBody,{color:y.foregroundMuted,fontFamily:f.regular}],children:h?"Previous verification was unsuccessful. Please try again.":T?"Increases your per-transaction and weekly limits.":"Required to start making purchases."})]}),jsxRuntime.jsx(Sr,{size:18,color:y.foregroundMuted,strokeWidth:2})]})),W&&(S?jsxRuntime.jsxs(reactNative.View,{style:C,children:[jsxRuntime.jsxs(reactNative.View,{style:at.pendingHeader,children:[jsxRuntime.jsx(cl,{size:20,color:y.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[at.cardTitle,{color:y.foreground,fontFamily:f.semibold,flex:1}],children:"Photo ID & Selfie"}),n?jsxRuntime.jsx(Jp,{onRefresh:n,colors:y,fonts:f}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[at.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[at.cardBody,{color:y.foregroundMuted,fontFamily:f.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(st,{size:18,strokeWidth:2,gradientFrom:y.primary,gradientTo:y.primary})]})]}):I?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[C,at.cardRow],onPress:t,activeOpacity:.7,children:[jsxRuntime.jsx(cl,{size:20,color:y.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:at.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[at.cardTitle,{color:y.foreground,fontFamily:f.semibold}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[at.cardBody,{color:y.foregroundMuted,fontFamily:f.regular}],children:"Unlocks the highest transaction limits available."})]}),jsxRuntime.jsx(Sr,{size:18,color:y.foregroundMuted,strokeWidth:2})]}):jsxRuntime.jsxs(reactNative.View,{style:[d,at.cardRow],children:[jsxRuntime.jsx(cl,{size:20,color:y.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:at.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[at.cardTitle,{color:y.foregroundMuted,fontFamily:f.regular}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[at.cardBody,{color:y.foregroundMuted,fontFamily:f.regular}],children:"Complete Date of Birth & SSN first."})]})]}))]})]}),jsxRuntime.jsxs(reactNative.View,{style:at.footer,children:[a?jsxRuntime.jsx(reactNative.Text,{style:[p.form.subtitle,{marginBottom:12,textAlign:"center",color:"red"}],children:a}):null,s?jsxRuntime.jsxs(reactNative.View,{style:at.loaderRow,children:[jsxRuntime.jsx(st,{size:24,strokeWidth:2,gradientFrom:y.primary,gradientTo:y.primary}),jsxRuntime.jsx(reactNative.Text,{style:[p.form.ghostBtnText,{marginLeft:8}],children:"Verifying..."})]}):_?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:p.form.continueBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:p.form.continueBtnText,children:"Done"})}):F?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:p.form.ghostBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:p.form.ghostBtnText,children:"Skip for now"})}):null]})]})}var at=reactNative.StyleSheet.create({content:{flex:1,paddingTop:24,gap:16},limitBadge:{alignItems:"center",paddingVertical:24,paddingHorizontal:20,gap:4},limitLabel:{fontSize:13},limitValue:{fontSize:20,paddingTop:8},subtitle:{fontSize:15,lineHeight:22,textAlign:"center",paddingHorizontal:16,paddingVertical:24},card:{padding:20,gap:6},cardRow:{flexDirection:"row",alignItems:"center",gap:16},cardContent:{flex:1,gap:6},cardTitle:{fontSize:16},cardBody:{fontSize:14,lineHeight:20},skeletonLine:{height:14,borderRadius:7,backgroundColor:"rgba(128, 128, 128, 0.15)",width:"80%",marginBottom:6},pendingHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:4,gap:8},pendingFooter:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},refreshBtn:{flexDirection:"row",alignItems:"center",gap:4,paddingVertical:2,paddingHorizontal:4},refreshText:{fontSize:12},footer:{paddingTop:12,gap:4},loaderRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:12}});var Wl={linkOnrampTerms:"https://link.com/terms/crypto-onramp",bridgeTerms:"https://www.bridge.xyz/legal/us-terms/bridge-building-inc",linkPrivacy:"https://link.com/privacy",bridgePrivacy:"https://www.bridge.xyz/legal/us-privacy-policy/bridge-building-inc"};function om({styles:e,merchantDisplayName:t="This app",onContinue:r,onClose:o}){let{colors:n,fonts:s,components:i}=O(),a=[Oo.link,{color:n.primary,fontFamily:s.medium}],l=i.card.borderRadius??12;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Tt,{onPress:o,title:"Verify Your Identity"}),jsxRuntime.jsx(reactNative.View,{style:Oo.logoRow,children:jsxRuntime.jsx(cp,{height:20,color:n.foreground})}),jsxRuntime.jsxs(reactNative.ScrollView,{style:Oo.scroll,contentContainerStyle:Oo.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:[Oo.card,{backgroundColor:i.card.backgroundColor,borderRadius:l,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Oo.sectionTitle,{color:n.foreground,fontFamily:s.semibold}],children:"Description"}),jsxRuntime.jsxs(reactNative.Text,{style:[Oo.body,{color:n.foregroundMuted,fontFamily:s.regular}],children:["You must verify your identity using Link. ",t," will create or access your Link account on your behalf."]})]}),jsxRuntime.jsxs(reactNative.View,{style:[Oo.card,{backgroundColor:i.card.backgroundColor,borderRadius:l,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Oo.sectionTitle,{color:n.foreground,fontFamily:s.semibold}],children:"Terms"}),jsxRuntime.jsxs(reactNative.Text,{style:[Oo.body,{color:n.foregroundMuted,fontFamily:s.regular}],children:["Your data will be encrypted and processed by our partner, Stripe. Funds transfer services are provided by Stripe Payments Company. Cryptocurrency conversion services are provided by Bridge. By continuing you agree to the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(Wl.linkOnrampTerms),children:"Link Onramp Terms"}),","," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(Wl.bridgeTerms),children:"Bridge Terms"})," ","and you acknowledge receipt of the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(Wl.linkPrivacy),children:"Link US Consumer Privacy Notice"})," ","and the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(Wl.bridgePrivacy),children:"Bridge Privacy Notice"}),"."]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Oo.footer,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Continue"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:o,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Cancel"})})]})]})}var Oo=reactNative.StyleSheet.create({logoRow:{paddingVertical:24,alignItems:"center"},scroll:{flex:1},scrollContent:{paddingTop:16,paddingBottom:16,gap:12},card:{padding:20,gap:10},sectionTitle:{fontSize:15},body:{fontSize:14,lineHeight:21},link:{textDecorationLine:"underline"},footer:{paddingTop:12,gap:4}});function nm({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:s,email:i,setEmail:a,checkEmail:l,onClose:u}){let{colors:c}=O();return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Tt,{onPress:u}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(st,{size:56,strokeWidth:3}),jsxRuntime.jsx(zr,{error:n,progress:s,loading:o})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Tt,{onPress:u}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your email"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll check if you have a Link account or create one for you."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Email address"}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,o&&{opacity:.5}],placeholder:"jane@example.com",placeholderTextColor:t,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,value:i,onChangeText:a,autoFocus:true,returnKeyType:"done",onSubmitEditing:l,editable:!o})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[o?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(st,{size:28,strokeWidth:2,gradientFrom:c.primaryForeground,gradientTo:c.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:l,disabled:!i,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(zr,{error:n,progress:s,loading:o})]})]})})}function sm({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:s}){return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Tt,{onPress:s}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(st,{size:48,strokeWidth:3})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Verifying identity"}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:r||"Preparing identity verification..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(reactNative.Text,{style:e.flow.idIcon,children:"\u{1FAAA}"})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Identity verification"}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:r||"Tap below to continue verification."})]}),jsxRuntime.jsx(zr,{error:o,progress:r,loading:false})]}),!t&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:n,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Continue Verification"})})})]})}function lm({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:s,destinationNetwork:i,tokenIconUrl:a,networkIconUrl:l,onClose:u,onRetryStatusCheck:c}){let{colors:b}=O(),T=!!t;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[T?jsxRuntime.jsx(Tt,{onPress:u}):jsxRuntime.jsx(reactNative.View,{style:kl}),jsxRuntime.jsx(reactNative.View,{style:e.flow.centered,children:t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Could not confirm status"}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:"Your payment may still be completing. Try checking again, or close this screen and verify your wallet balance."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(st,{size:48,strokeWidth:3,gradientFrom:b.primary,gradientTo:b.primary})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Processing your purchase"}),jsxRuntime.jsxs(reactNative.Text,{style:e.flow.sub,children:["Your payment has been confirmed.",`
|
|
2
|
+
`,"We're sending your crypto \u2014 this usually takes less than a minute."]}),n&&s&&i&&jsxRuntime.jsx(xl,{sourceCurrency:n,destinationCurrency:s,destinationNetwork:i,tokenIconUrl:a,networkIconUrl:l,style:{marginTop:24,marginHorizontal:24}})]})}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[jsxRuntime.jsx(zr,{error:t,progress:r,loading:o}),t?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:c,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function cm({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:s,tokenIconUrl:i,networkIconUrl:a,onClose:l,onBack:u}){let{colors:c}=O(),b=t.transaction_details,T=Sl(b.destination_amount,b.destination_currency);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Tt,{onPress:u??l,title:"Review your purchase",variant:u?"back":"close"}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.View,{style:{alignItems:"center",marginTop:24,marginBottom:20},children:jsxRuntime.jsx(ms,{currency:b.destination_currency,tokenIconUrl:i,networkIconUrl:a,size:64})}),jsxRuntime.jsxs(reactNative.View,{style:e.quote.card,children:[jsxRuntime.jsx(vo,{quote:e.quote,label:"You pay",value:`${b.source_amount} ${b.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(vo,{quote:e.quote,label:"You receive",value:`${T} ${b.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(vo,{quote:e.quote,label:"Network fee",value:`$${b.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(vo,{quote:e.quote,label:"Transaction fee",value:`$${b.fees.transaction_fee_amount}`,last:true})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(st,{size:28,strokeWidth:2,gradientFrom:c.primaryForeground,gradientTo:c.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:s,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsxRuntime.jsx(zr,{error:o,progress:n,loading:r})]})]})}function dm({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:s,phone:i,setPhone:a,register:l,onClose:u}){let c=O(),{colors:b,fonts:T,components:w}=c,[p,y]=ci.useState("");ci.useEffect(()=>{if(t)return;let C=p?`+1${p}`:"";a(C);},[p,a,t]);let f=ci.useCallback(C=>{y(C.replace(/[^\d]/g,""));},[]);if(t)return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Tt,{onPress:u}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(st,{size:56,strokeWidth:3}),jsxRuntime.jsx(zr,{error:o,progress:n,loading:r})]})]});let k=p.length>=4;return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Tt,{onPress:u}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your phone"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll send a verification code to confirm your number."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Phone number"}),jsxRuntime.jsxs(reactNative.View,{style:va.phoneRow,children:[jsxRuntime.jsxs(reactNative.View,{style:[va.countryPrefix,{backgroundColor:w.card.backgroundColor,borderColor:w.input.borderColor,borderRadius:w.input.borderRadius,borderWidth:w.card.borderWidth}],children:[jsxRuntime.jsx(reactNative.Text,{style:va.flag,children:"\u{1F1FA}\u{1F1F8}"}),jsxRuntime.jsx(reactNative.Text,{style:[va.dialCode,{color:b.foreground,fontFamily:T.medium}],children:"+1"})]}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,va.phoneInput,r&&{opacity:.5}],placeholder:"Phone number",placeholderTextColor:c.components.input.placeholderColor,keyboardType:"phone-pad",value:p,onChangeText:f,autoFocus:true,returnKeyType:"done",onSubmitEditing:()=>k&&l(),editable:!r})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.emailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.emailLabel,children:"Signing up as"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.emailValue,children:s})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(st,{size:28,strokeWidth:2,gradientFrom:b.primaryForeground,gradientTo:b.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!k&&e.form.continueBtnDisabled],onPress:l,disabled:!k,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!k&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(zr,{error:o,progress:n,loading:r})]})]})})}var va=reactNative.StyleSheet.create({phoneRow:{flexDirection:"row",gap:8,alignItems:"stretch"},countryPrefix:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,gap:8},flag:{fontSize:20},dialCode:{fontSize:16,fontWeight:"600"},phoneInput:{flex:1}});function Iy({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=O(),n=e.toLowerCase(),s=Tl[n]??o.primary,i=Math.round(r*.36);return jsxRuntime.jsxs(reactNative.View,{style:{width:r,height:r,position:"relative"},children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:t},style:{width:r,height:r,borderRadius:r/2}}):jsxRuntime.jsx(reactNative.View,{style:[Yo.tokenCircle,{width:r,height:r,borderRadius:r/2,backgroundColor:s}],children:jsxRuntime.jsx(reactNative.Text,{style:[Yo.tokenLetter,{fontSize:r*.38}],children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),jsxRuntime.jsx(reactNative.View,{style:[Yo.checkBadge,{width:i,height:i,borderRadius:i/2,backgroundColor:o.success,borderColor:o.background}],children:jsxRuntime.jsx($e,{size:i*.55,color:"#FFFFFF",strokeWidth:3})})]})}function um({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:s,onDone:i}){let {colors:a,components:l,fonts:u}=O(),c=t.transaction_details,b=Sl(c.destination_amount,c.destination_currency),T=r||o||"";ps(c.destination_network);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Tt,{onPress:i,title:"Purchase complete"}),jsxRuntime.jsx(reactNative.View,{style:e.form.content,children:jsxRuntime.jsxs(dt,{style:e.form.flex,contentContainerStyle:Yo.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Yo.iconSection,children:[jsxRuntime.jsx(Iy,{currency:c.destination_currency,tokenIconUrl:n,size:72}),jsxRuntime.jsxs(reactNative.View,{style:Yo.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Yo.statusDot,{backgroundColor:a.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[Yo.statusText,{color:a.foreground,fontFamily:u.semibold}],children:"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[Yo.subtitle,{color:a.foregroundMuted}],children:"Your crypto is on its way to your wallet."})]}),jsxRuntime.jsx(xl,{sourceCurrency:c.source_currency,destinationCurrency:c.destination_currency,destinationNetwork:c.destination_network,tokenIconUrl:n,networkIconUrl:s,style:{marginBottom:12}}),jsxRuntime.jsxs(reactNative.View,{style:[e.quote.card,{borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor},Yo.detailCard],children:[jsxRuntime.jsx(vo,{quote:e.quote,label:"You Paid",value:`${c.source_amount} ${c.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(vo,{quote:e.quote,label:"You Received",value:`${b} ${c.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(vo,{quote:e.quote,label:"Network Fee",value:`$${c.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(vo,{quote:e.quote,label:"Transaction Fee",value:`$${c.fees.transaction_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(yd,{quote:e.quote,label:"Intent Address",address:c.wallet_address,hideDivider:true}),T?jsxRuntime.jsx(yd,{quote:e.quote,label:"Recipient Address",address:T,last:true}):jsxRuntime.jsx(vo,{quote:e.quote,label:"Session",value:t.id.slice(0,8)+"..."+t.id.slice(-6),last:true})]})]})}),jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:i,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Done"})})})]})}var Yo=reactNative.StyleSheet.create({scrollContent:{paddingBottom:24,alignItems:"center"},iconSection:{alignItems:"center",marginTop:24,marginBottom:24},tokenCircle:{alignItems:"center",justifyContent:"center"},tokenLetter:{color:"#FFFFFF",fontWeight:"700",letterSpacing:.5},checkBadge:{position:"absolute",bottom:0,right:0,alignItems:"center",justifyContent:"center",borderWidth:3},statusRow:{flexDirection:"row",alignItems:"center",marginTop:16,gap:6},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},subtitle:{fontSize:14,marginTop:4},detailCard:{width:"100%"}});function pm({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:s,walletNetwork:i,setWalletAddress:a,setWalletNetwork:l,setDestinationCurrency:u,registerWallet:c,onClose:b}){let{colors:T,components:w}=O();if(t){let p=!r&&!!o;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Tt,{onPress:b}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[!p&&jsxRuntime.jsx(st,{size:56,strokeWidth:3}),jsxRuntime.jsx(zr,{error:o,progress:n,loading:r})]}),p&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:c,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Retry"})})})]})}return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Tt,{onPress:b}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Your crypto wallet"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"Enter the wallet address where you'd like to receive your crypto."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Wallet address"}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,e.wallet.input],placeholder:"0x...",placeholderTextColor:w.input.placeholderColor,autoCapitalize:"none",autoCorrect:false,value:s,onChangeText:a})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Network"}),jsxRuntime.jsx(reactNative.View,{style:e.wallet.list,children:Cl.map(p=>{let y=i===p.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,y&&e.wallet.rowSelected],onPress:()=>{l(p.value),u(p.defaultCrypto);},children:[jsxRuntime.jsx(reactNative.View,{style:e.wallet.iconWrap,children:jsxRuntime.jsx(p.Icon,{size:24})}),jsxRuntime.jsx(reactNative.Text,{style:[e.wallet.rowText,y&&e.wallet.rowTextSelected],children:p.label}),y&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx($e,{size:14,color:w.container.buttonTitleColor,strokeWidth:2.5})})]},p.value)})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(st,{size:28,strokeWidth:2,gradientFrom:T.primaryForeground,gradientTo:T.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!s&&e.form.continueBtnDisabled],onPress:c,disabled:!s,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!s&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(zr,{error:o,progress:n,loading:r})]})]})})}function Nl({config:e,onClose:t}){let r=O(),o=zo(),{step:n,restoring:s,loading:i,status:a,error:l,email:u,phone:c,session:b,kycData:T,walletAddress:w,resolvedRecipientAddress:p,walletNetwork:y,sourceAmount:f,sourceCurrency:k,destinationCurrency:C,tokenIconUrl:d,networkIconUrl:x,applePaySupported:v,setStep:h,setEmail:g,setPhone:S,setWalletAddress:_,setWalletNetwork:A,setSourceAmount:W,setDestinationCurrency:I,checkEmail:F,register:z,attachKyc:j,verifyIdentity:me,registerWallet:Xe,collectPaymentMethod:Ie,addPaymentMethod:ie,confirmCheckout:Pe,reset:Oe,emitComplete:fe,resumeFulfillmentPolling:Ce,amountFirst:ke,customerId:Z,accessToken:pe,requestKYCUpgrade:St,kycUpgradeMode:ve,logout:lt,clearError:je,switchingAccount:Te}=Ll(e),rt=!!e?.email&&!Te,ot=!!e?.phone,se=!!e?.publishableKey&&!!e?.externalUserId,[he,Ae]=ci.useState(void 0),[we,ge]=ci.useState(void 0),[Jt,nt]=ci.useState([]),[We,yr]=ci.useState(false),[ce,re]=ci.useState(false),[Se,mt]=ci.useState(null),[ht,de]=ci.useState(null),[Ee,$t]=ci.useState(null),[it,ir]=ci.useState(false),Ht=ci.useCallback(async()=>{await lt(),t?.();},[lt,t]);ci.useEffect(()=>{n!=="kyc_offer"||!Z||!pe||(ir(true),Cn(Z,pe).then(D=>{let H=D.kyc_tiers??[],E=H.find(K=>K.tier==="l0"),P=H.find(K=>K.tier==="l1"),U=H.find(K=>K.tier==="l2");E?.verification_status&&mt(E.verification_status),P?.verification_status&&de(P.verification_status),U?.verification_status&&$t(U.verification_status);}).catch(D=>{console.warn("[OnrampScreen] kyc_offer customer fetch error:",D?.message);}).finally(()=>ir(false)),w&&Sd({destinationNetwork:y||"ethereum",walletAddress:w,accessToken:pe,cryptoCustomerId:Z}).then(D=>{let H=D.limits?.usd;if(H?.card?.length){let E=Math.max(...H.card.map(P=>P.limit));Ae(E);}}).catch(D=>{console.warn("[OnrampScreen] kyc_offer transaction_limits error:",D?.message);}));},[n,Z,pe,w,y]),ci.useEffect(()=>{if(s||n!=="session_params"||!Z||!pe)return;let D=E=>{let P=E?.message??"";return P.includes("stripe_onramp_forbidden")||P.includes("403")},H=E=>{D(E)&&Ht();};Cn(Z,pe).then(E=>{let P=E.kyc_tiers??[],U=P.find(Me=>Me.tier==="l0"),K=P.find(Me=>Me.tier==="l1"),Ye=P.find(Me=>Me.tier==="l2"),G=!!K?.verification_status&&K.verification_status!=="not_started",et=Ye?.verification_status==="verified";yr(G),re(!!et),U?.verification_status&&mt(U.verification_status),K?.verification_status&&de(K.verification_status),Ye?.verification_status&&$t(Ye.verification_status);}).catch(E=>{console.warn("[OnrampScreen] customer fetch error:",E?.message),H(E);}),kd(Z,pe).then(E=>{nt(E.data??[]);}).catch(E=>{console.warn("[OnrampScreen] payment_tokens error:",E?.message),H(E);}),w&&Sd({destinationNetwork:y||"ethereum",walletAddress:w,accessToken:pe,cryptoCustomerId:Z}).then(E=>{let P=E.limits?.usd;if(P?.card?.length){let U=Math.max(...P.card.map(K=>K.limit));Ae(U);}}).catch(E=>{console.warn("[OnrampScreen] transaction_limits error:",E?.message),H(E);}),pa(e?.publishableKey).then(E=>{let P=E.data?.find(U=>U.currency_code==="usd");P&&ge(P.minimum_amount);}).catch(E=>{console.warn("[OnrampScreen] fiat_currencies error:",E?.message);});},[s,n,Z,pe,w,y,Oe,Ht]);let sr=async()=>{if(!(!Z||!pe))try{let D=await kd(Z,pe);nt(D.data??[]);}catch(D){console.warn("[OnrampScreen] payment_tokens refresh error:",D?.message);let H=D?.message??"";(H.includes("stripe_onramp_forbidden")||H.includes("403"))&&Ht();}},Dt=async()=>{let D=await ie();return D&&await sr(),D},ue=e?.skipSuccessConfirmation===true;ci.useEffect(()=>{n==="success"&&ue&&b&&(fe(b),Oe(),t?.());},[n,ue,b,fe,Oe,t]),ci.useEffect(()=>{n==="register"&&ot&&z();},[n,ot,z]);let Ve=()=>{Oe(),t?.();};if(s)return jsxRuntime.jsx(reactNative.View,{style:[By.container,{backgroundColor:r.colors.background}],children:jsxRuntime.jsx(st,{size:56,strokeWidth:3,gradientFrom:r.colors.primary,gradientTo:r.colors.primary})});if(n==="disclaimer")return jsxRuntime.jsx(om,{styles:o,merchantDisplayName:e?.merchantDisplayName,onContinue:()=>h("register"),onClose:()=>h("email")});if(n==="email")return jsxRuntime.jsx(nm,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:rt,loading:i,error:l,status:a,email:u,setEmail:g,checkEmail:F,onClose:Ve});if(n==="register")return jsxRuntime.jsx(dm,{styles:o,hasPrefilledPhone:ot,loading:i,error:l,status:a,email:u,phone:c,setPhone:S,register:z,onClose:Ve});if(n==="kyc")return jsxRuntime.jsx(Dl,{initialData:T,loading:i,onComplete:j,onCancel:Ve});if(n==="kyc_offer"){let E=Se==="verified"||ht==="verified"||Ee==="verified",P=()=>{ve.current&&(ve.current=false),h("session_params");};return jsxRuntime.jsx(tm,{onSelectL1:()=>h("kyc_l1"),onSelectL2:()=>{ve.current=true,h("identity");},onSkip:P,onClose:()=>{ve.current?(ve.current=false,h("session_params")):E?P():Ve();},onRefresh:()=>{!Z||!pe||(ir(true),Cn(Z,pe).then(Ye=>{let G=Ye.kyc_tiers??[],et=G.find(qt=>qt.tier==="l0"),Me=G.find(qt=>qt.tier==="l1"),Vr=G.find(qt=>qt.tier==="l2");et?.verification_status&&mt(et.verification_status),Me?.verification_status&&de(Me.verification_status),Vr?.verification_status&&$t(Vr.verification_status);}).catch(Ye=>{console.warn("[OnrampScreen] refresh customer fetch error:",Ye?.message);}).finally(()=>ir(false)));},loading:i,loadingTiers:it,error:l?.message,l1Status:ht??"not_started",l2Status:Ee??"not_started",l1Completed:We,l2Completed:ce,canPurchase:E,currentLimit:E?he:void 0})}if(n==="kyc_l1"){let D=ve.current?"session_params":"wallet";return jsxRuntime.jsx(Yp,{initialData:T,loading:i,error:l?.message,onComplete:H=>{ve.current&&(ve.current=false),j(H,D);},onCancel:()=>{je(),h("kyc_offer");},onClose:Ve})}return n==="identity"?jsxRuntime.jsx(sm,{styles:o,loading:i,status:a,error:l,verifyIdentity:me,onClose:()=>{ve.current?(ve.current=false,h("session_params")):Ve();}}):n==="wallet"?jsxRuntime.jsx(pm,{styles:o,hasAutoWallet:se,loading:i,error:l,status:a,walletAddress:w,walletNetwork:y,setWalletAddress:_,setWalletNetwork:A,setDestinationCurrency:I,registerWallet:Xe,onClose:Ve}):n==="session_params"?jsxRuntime.jsx(Vl,{initialAmount:f,currency:k,applePaySupported:v,paymentSelectorPosition:e?.paymentSelectorPosition??"header",minAmount:we,maxAmount:he,paymentTokens:Jt,onAddPaymentMethod:Dt,onCollectPayment:(D,H)=>{Ie(D,H);},paymentLoading:i,paymentStatus:a,paymentError:l?.message??null,onConfirm:(D,H)=>{if(ke&&!Z)W(D),h("email");else {let E=H==="apple_pay";Ie(E,D,!E&&H?H:void 0);}},onCancel:Ve,accessToken:pe,showHistoryProgressBar:e?.showHistoryProgressBar,onLogout:Ht,onRequestKYC:St,showSwitchAccount:!rt,inputDisabled:(Se!==null||ht!==null)&&Se!=="verified"&&ht!=="verified"&&Ee!=="verified"}):n==="quote"&&b?jsxRuntime.jsx(cm,{styles:o,session:b,loading:i,error:l,status:a,confirmCheckout:Pe,tokenIconUrl:d,networkIconUrl:x,onClose:Ve,onBack:()=>h("session_params")}):n==="processing"?jsxRuntime.jsx(lm,{styles:o,error:l,status:a,loading:i,sourceCurrency:b?.transaction_details.source_currency,destinationCurrency:b?.transaction_details.destination_currency??C,destinationNetwork:b?.transaction_details.destination_network??"base",tokenIconUrl:d,networkIconUrl:x,onClose:Ve,onRetryStatusCheck:Ce}):n==="success"&&b&&!ue?jsxRuntime.jsx(um,{styles:o,session:b,resolvedRecipientAddress:p,recipientFromConfig:e?.recipientAddress,tokenIconUrl:d,networkIconUrl:x,onDone:()=>{fe(b),Oe(),t?.();}}):null}var By=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center"}});function mm(){try{let e=Ay__default.default.expoConfig?.plugins;if(!Array.isArray(e))return;for(let t of e){if(!Array.isArray(t))continue;let[r,o]=t;if(r!=="@stripe/stripe-react-native"||!o||typeof o!="object")continue;let n=o.merchantIdentifier;if(typeof n=="string"){let s=n.trim();if(s.length>0)return s}}}catch{}}function jl({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:s="ethereum",destinationChainId:i="8453",destinationTokenAddress:a,recipientAddress:l,onComplete:u,onError:c,onStepChange:b,onClose:T,merchantIdentifier:w="",urlScheme:p="unifoldOnramp",paymentSelectorPosition:y,skipSuccessConfirmation:f=false,appName:k}){let{colors:C,fonts:d,components:x}=O(),v=e||ml(),h=ci.useMemo(()=>{let I=w.trim();return I.length>0?I:mm()??""},[w]),[g,S]=ci.useState("loading"),[_,A]=ci.useState(null);ci.useEffect(()=>{let I=false;async function F(){try{v&&(_l(v),Rl(ua()));let z=await vl();if(I)return;let j=h.trim();if(await stripeReactNative.initStripe({publishableKey:z,urlScheme:p,...j?{merchantIdentifier:j}:{}}),I)return;S("ready");}catch(z){if(I)return;console.error("[StripeOnramp] Init failed:",z),A(z?.message??"Failed to load Stripe configuration"),S("error");}}return F(),()=>{I=true;}},[v,h,p]);let W=ci.useMemo(()=>{let I={publishableKey:v,externalUserId:o,destinationChainType:s,destinationChainId:i,onComplete:u,onError:c,onStepChange:b};return a&&(I.destinationTokenAddress=a),l&&(I.recipientAddress=l),t&&(I.email=t),r&&(I.phone=r),n&&(I.flowOrder=n),y&&(I.paymentSelectorPosition=y),I.skipSuccessConfirmation=f,I.merchantIdentifier=h,k&&(I.merchantDisplayName=k),I},[v,o,s,i,a,l,t,r,n,y,f,h,k,u,c,b]);return g==="error"?jsxRuntime.jsxs(reactNative.View,{style:[Ts.centered,{backgroundColor:C.background}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Ts.errorText,{color:C.error,fontFamily:d.medium}],children:"Unable to initialize"}),jsxRuntime.jsx(reactNative.Text,{style:[Ts.errorDetail,{color:C.foregroundMuted,fontFamily:d.regular}],children:_}),T&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ts.retryBtn,{backgroundColor:x.button.primaryBackground,borderRadius:x.button.borderRadius}],onPress:T,children:jsxRuntime.jsx(reactNative.Text,{style:[Ts.retryBtnText,{color:x.button.primaryText,fontFamily:d.medium}],children:"Go Back"})})]}):g==="loading"?jsxRuntime.jsx(reactNative.View,{style:[Ts.centered,{backgroundColor:C.background}],children:jsxRuntime.jsx(st,{size:56,strokeWidth:3,gradientFrom:C.primary,gradientTo:C.primary})}):jsxRuntime.jsx(Nl,{config:W,onClose:T})}var Ts=reactNative.StyleSheet.create({centered:{flex:1,justifyContent:"center",alignItems:"center",paddingHorizontal:24},errorText:{fontSize:18,marginBottom:8},errorDetail:{fontSize:14,textAlign:"center",marginBottom:24},retryBtn:{paddingVertical:14,paddingHorizontal:32},retryBtnText:{fontSize:16}});function ym(){let{configure:e}=stripeReactNative.useOnramp(),t=ci.useRef(false);return ci.useEffect(()=>{t.current||(t.current=true,e({merchantDisplayName:"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(r=>{r.error&&console.error("[StripeOnrampPreconfigure] error:",r.error.message);}).catch(r=>{console.error("[StripeOnrampPreconfigure] threw:",r?.message);}));},[e]),null}var bm="__unifold_stripe_onramp__";function $l(e){globalThis[bm]=e;}function Cm(){return globalThis[bm]}$l(jl);var Go=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this);}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe();}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var Oi,ti,xs,wm,$y=(wm=class extends Go{constructor(){super();ee(this,Oi);ee(this,ti);ee(this,xs);M(this,xs,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){m(this,ti)||this.setEventListener(m(this,xs));}onUnsubscribe(){var t;this.hasListeners()||((t=m(this,ti))==null||t.call(this),M(this,ti,void 0));}setEventListener(t){var r;M(this,xs,t),(r=m(this,ti))==null||r.call(this),M(this,ti,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){m(this,Oi)!==t&&(M(this,Oi,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof m(this,Oi)=="boolean"?m(this,Oi):globalThis.document?.visibilityState!=="hidden"}},Oi=new WeakMap,ti=new WeakMap,xs=new WeakMap,wm),_s=new $y;var qy={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Jo,Vi,Sm,Ky=(Sm=class{constructor(){ee(this,Jo,qy);ee(this,Vi,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&m(this,Vi)&&e!==m(this,Jo)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:m(this,Jo),provider:e}),M(this,Jo,e),process.env.NODE_ENV!=="production"&&M(this,Vi,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&M(this,Vi,true),m(this,Jo).setTimeout(e,t)}clearTimeout(e){m(this,Jo).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&M(this,Vi,true),m(this,Jo).setInterval(e,t)}clearInterval(e){m(this,Jo).clearInterval(e);}},Jo=new WeakMap,Vi=new WeakMap,Sm),Zo=new Ky;function km(e){setTimeout(e,0);}var Nd=typeof window>"u"||"Deno"in globalThis;function hr(){}function _m(e,t){return typeof e=="function"?e(t):e}function Ia(e){return typeof e=="number"&&e>=0&&e!==1/0}function Kl(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Vo(e,t){return typeof e=="function"?e(t):e}function Gr(e,t){return typeof e=="function"?e(t):e}function Ql(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:s,queryKey:i,stale:a}=e;if(i){if(o){if(t.queryHash!==Pa(i,t.options))return false}else if(!Bi(t.queryKey,i))return false}if(r!=="all"){let l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return false}return !(typeof a=="boolean"&&t.isStale()!==a||n&&n!==t.state.fetchStatus||s&&!s(t))}function Yl(e,t){let{exact:r,status:o,predicate:n,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return false;if(r){if(Di(t.options.mutationKey)!==Di(s))return false}else if(!Bi(t.options.mutationKey,s))return false}return !(o&&t.state.status!==o||n&&!n(t))}function Pa(e,t){return (t?.queryKeyHashFn||Di)(e)}function Di(e){return JSON.stringify(e,(t,r)=>Hd(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function Bi(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Bi(e[r],t[r])):false}var Qy=Object.prototype.hasOwnProperty;function ql(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=Tm(e)&&Tm(t);if(!o&&!(Hd(e)&&Hd(t)))return t;let s=(o?e:Object.keys(e)).length,i=o?t:Object.keys(t),a=i.length,l=o?new Array(a):{},u=0;for(let c=0;c<a;c++){let b=o?c:i[c],T=e[b],w=t[b];if(T===w){l[b]=T,(o?c<s:Qy.call(e,b))&&u++;continue}if(T===null||w===null||typeof T!="object"||typeof w!="object"){l[b]=w;continue}let p=ql(T,w,r+1);l[b]=p,p===T&&u++;}return s===a&&u===s?e:l}function Gl(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return false;for(let r in e)if(e[r]!==t[r])return false;return true}function Tm(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Hd(e){if(!xm(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!xm(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function xm(e){return Object.prototype.toString.call(e)==="[object Object]"}function Rm(e){return new Promise(t=>{Zo.setTimeout(t,e);})}function Fa(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==false){if(process.env.NODE_ENV!=="production")try{return ql(e,t)}catch(o){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${o}`),o}return ql(e,t)}return t}function vm(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function Im(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var Li=Symbol();function Jl(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Li&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Li?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Zl(e,t){return typeof e=="function"?e(...t):!!e}function Pm(e,t,r){let o=false,n;return Object.defineProperty(e,"signal",{enumerable:true,get:()=>(n??(n=t()),o||(o=true,n.aborted?r():n.addEventListener("abort",r,{once:true})),n)}),e}var Xo=(()=>{let e=()=>Nd;return {isServer(){return e()},setIsServer(t){e=t;}}})();function Oa(){let e,t,r=new Promise((n,s)=>{e=n,t=s;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var Fm=km;function Yy(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=Fm,s=a=>{t?e.push(a):n(()=>{r(a);});},i=()=>{let a=e;e=[],a.length&&n(()=>{o(()=>{a.forEach(l=>{r(l);});});});};return {batch:a=>{let l;t++;try{l=a();}finally{t--,t||i();}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l);});},schedule:s,setNotifyFunction:a=>{r=a;},setBatchNotifyFunction:a=>{o=a;},setScheduler:a=>{n=a;}}}var Et=Yy();var Rs,ri,vs,Om,Gy=(Om=class extends Go{constructor(){super();ee(this,Rs,true);ee(this,ri);ee(this,vs);M(this,vs,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t(true),o=()=>t(false);return window.addEventListener("online",r,false),window.addEventListener("offline",o,false),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o);}}});}onSubscribe(){m(this,ri)||this.setEventListener(m(this,vs));}onUnsubscribe(){var t;this.hasListeners()||((t=m(this,ri))==null||t.call(this),M(this,ri,void 0));}setEventListener(t){var r;M(this,vs,t),(r=m(this,ri))==null||r.call(this),M(this,ri,t(this.setOnline.bind(this)));}setOnline(t){m(this,Rs)!==t&&(M(this,Rs,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return m(this,Rs)}},Rs=new WeakMap,ri=new WeakMap,vs=new WeakMap,Om),Is=new Gy;function Jy(e){return Math.min(1e3*2**e,3e4)}function jd(e){return (e??"online")==="online"?Is.isOnline():true}var Xl=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function ec(e){let t=false,r=0,o,n=Oa(),s=()=>n.status!=="pending",i=y=>{if(!s()){let f=new Xl(y);T(f),e.onCancel?.(f);}},a=()=>{t=true;},l=()=>{t=false;},u=()=>_s.isFocused()&&(e.networkMode==="always"||Is.isOnline())&&e.canRun(),c=()=>jd(e.networkMode)&&e.canRun(),b=y=>{s()||(o?.(),n.resolve(y));},T=y=>{s()||(o?.(),n.reject(y));},w=()=>new Promise(y=>{o=f=>{(s()||u())&&y(f);},e.onPause?.();}).then(()=>{o=void 0,s()||e.onContinue?.();}),p=()=>{if(s())return;let y,f=r===0?e.initialPromise:void 0;try{y=f??e.fn();}catch(k){y=Promise.reject(k);}Promise.resolve(y).then(b).catch(k=>{if(s())return;let C=e.retry??(Xo.isServer()?0:3),d=e.retryDelay??Jy,x=typeof d=="function"?d(r,k):d,v=C===true||typeof C=="number"&&r<C||typeof C=="function"&&C(r,k);if(t||!v){T(k);return}r++,e.onFail?.(r,k),Rm(x).then(()=>u()?void 0:w()).then(()=>{t?T(k):p();});});};return {promise:n,status:()=>n.status,cancel:i,continue:()=>(o?.(),n),cancelRetry:a,continueRetry:l,canStart:c,start:()=>(c()?p():w().then(p),n)}}var Ai,Vm,tc=(Vm=class{constructor(){ee(this,Ai);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),Ia(this.gcTime)&&M(this,Ai,Zo.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Xo.isServer()?1/0:300*1e3));}clearGcTimeout(){m(this,Ai)!==void 0&&(Zo.clearTimeout(m(this,Ai)),M(this,Ai,void 0));}},Ai=new WeakMap,Vm);var Wi,Ps,So,Ei,_r,Va,Mi,uo,Wm,xn,Bm,Am=(Bm=class extends tc{constructor(t){super();ee(this,uo);ee(this,Wi);ee(this,Ps);ee(this,So);ee(this,Ei);ee(this,_r);ee(this,Va);ee(this,Mi);M(this,Mi,false),M(this,Va,t.defaultOptions),this.setOptions(t.options),this.observers=[],M(this,Ei,t.client),M(this,So,m(this,Ei).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,M(this,Wi,Lm(this.options)),this.state=t.state??m(this,Wi),this.scheduleGc();}get meta(){return this.options.meta}get promise(){return m(this,_r)?.promise}setOptions(t){if(this.options={...m(this,Va),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=Lm(this.options);r.data!==void 0&&(this.setState(Dm(r.data,r.dataUpdatedAt)),M(this,Wi,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&m(this,So).remove(this);}setData(t,r){let o=Fa(this.state.data,t,this.options);return He(this,uo,xn).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t,r){He(this,uo,xn).call(this,{type:"setState",state:t,setStateOptions:r});}cancel(t){let r=m(this,_r)?.promise;return m(this,_r)?.cancel(t),r?r.then(hr).catch(hr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return m(this,Wi)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>Gr(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Li||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Vo(t.options.staleTime,this)==="static"):false}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?true:t==="static"?false:this.state.isInvalidated?true:!Kl(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),m(this,_r)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),m(this,_r)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),m(this,So).notify({type:"observerAdded",query:this,observer:t}));}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(m(this,_r)&&(m(this,Mi)||He(this,uo,Wm).call(this)?m(this,_r).cancel({revert:true}):m(this,_r).cancelRetry()),this.scheduleGc()),m(this,So).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||He(this,uo,xn).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&m(this,_r)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(m(this,_r))return m(this,_r).continueRetry(),m(this,_r).promise}if(t&&this.setOptions(t),!this.options.queryFn){let l=this.observers.find(u=>u.options.queryFn);l&&this.setOptions(l.options);}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));let o=new AbortController,n=l=>{Object.defineProperty(l,"signal",{enumerable:true,get:()=>(M(this,Mi,true),o.signal)});},s=()=>{let l=Jl(this.options,r),c=(()=>{let b={client:m(this,Ei),queryKey:this.queryKey,meta:this.meta};return n(b),b})();return M(this,Mi,false),this.options.persister?this.options.persister(l,c,this):l(c)},a=(()=>{let l={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:m(this,Ei),state:this.state,fetchFn:s};return n(l),l})();this.options.behavior?.onFetch(a,this),M(this,Ps,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&He(this,uo,xn).call(this,{type:"fetch",meta:a.fetchOptions?.meta}),M(this,_r,ec({initialPromise:r?.initialPromise,fn:a.fetchFn,onCancel:l=>{l instanceof Xl&&l.revert&&this.setState({...m(this,Ps),fetchStatus:"idle"}),o.abort();},onFail:(l,u)=>{He(this,uo,xn).call(this,{type:"failed",failureCount:l,error:u});},onPause:()=>{He(this,uo,xn).call(this,{type:"pause"});},onContinue:()=>{He(this,uo,xn).call(this,{type:"continue"});},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>true}));try{let l=await m(this,_r).start();if(l===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(l),m(this,So).config.onSuccess?.(l,this),m(this,So).config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof Xl){if(l.silent)return m(this,_r).promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw He(this,uo,xn).call(this,{type:"error",error:l}),m(this,So).config.onError?.(l,this),m(this,So).config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc();}}},Wi=new WeakMap,Ps=new WeakMap,So=new WeakMap,Ei=new WeakMap,_r=new WeakMap,Va=new WeakMap,Mi=new WeakMap,uo=new WeakSet,Wm=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},xn=function(t){let r=o=>{switch(t.type){case "failed":return {...o,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case "pause":return {...o,fetchStatus:"paused"};case "continue":return {...o,fetchStatus:"fetching"};case "fetch":return {...o,...$d(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...Dm(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return M(this,Ps,t.manual?n:void 0),n;case "error":let s=t.error;return {...o,error:s,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:true};case "invalidate":return {...o,isInvalidated:true};case "setState":return {...o,...t.state}}};this.state=r(this.state),Et.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),m(this,So).notify({query:this,type:"updated",action:t});});},Bm);function $d(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:jd(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Dm(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function Lm(e){let t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,o=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return {data:t,dataUpdateCount:0,dataUpdatedAt:r?o??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:false,status:r?"success":"pending",fetchStatus:"idle"}}var Jr,Ge,La,Ur,zi,Fs,_n,oi,Ba,Os,Vs,Ui,Hi,ni,Ds,yt,Da,qd,Kd,Qd,Yd,Gd,Jd,Zd,Um,zm,eu=(zm=class extends Go{constructor(t,r){super();ee(this,yt);ee(this,Jr);ee(this,Ge);ee(this,La);ee(this,Ur);ee(this,zi);ee(this,Fs);ee(this,_n);ee(this,oi);ee(this,Ba);ee(this,Os);ee(this,Vs);ee(this,Ui);ee(this,Hi);ee(this,ni);ee(this,Ds,new Set);this.options=r,M(this,Jr,t),M(this,oi,null),M(this,_n,Oa()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(m(this,Ge).addObserver(this),Em(m(this,Ge),this.options)?He(this,yt,Da).call(this):this.updateResult(),He(this,yt,Yd).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return Xd(m(this,Ge),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Xd(m(this,Ge),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,He(this,yt,Gd).call(this),He(this,yt,Jd).call(this),m(this,Ge).removeObserver(this);}setOptions(t){let r=this.options,o=m(this,Ge);if(this.options=m(this,Jr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Gr(this.options.enabled,m(this,Ge))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");He(this,yt,Zd).call(this),m(this,Ge).setOptions(this.options),r._defaulted&&!Gl(this.options,r)&&m(this,Jr).getQueryCache().notify({type:"observerOptionsUpdated",query:m(this,Ge),observer:this});let n=this.hasListeners();n&&Mm(m(this,Ge),o,this.options,r)&&He(this,yt,Da).call(this),this.updateResult(),n&&(m(this,Ge)!==o||Gr(this.options.enabled,m(this,Ge))!==Gr(r.enabled,m(this,Ge))||Vo(this.options.staleTime,m(this,Ge))!==Vo(r.staleTime,m(this,Ge)))&&He(this,yt,qd).call(this);let s=He(this,yt,Kd).call(this);n&&(m(this,Ge)!==o||Gr(this.options.enabled,m(this,Ge))!==Gr(r.enabled,m(this,Ge))||s!==m(this,ni))&&He(this,yt,Qd).call(this,s);}getOptimisticResult(t){let r=m(this,Jr).getQueryCache().build(m(this,Jr),t),o=this.createResult(r,t);return Xy(this,o)&&(M(this,Ur,o),M(this,Fs,this.options),M(this,zi,m(this,Ge).state)),o}getCurrentResult(){return m(this,Ur)}trackResult(t,r){return new Proxy(t,{get:(o,n)=>(this.trackProp(n),r?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&m(this,_n).status==="pending"&&m(this,_n).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){m(this,Ds).add(t);}getCurrentQuery(){return m(this,Ge)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=m(this,Jr).defaultQueryOptions(t),o=m(this,Jr).getQueryCache().build(m(this,Jr),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return He(this,yt,Da).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),m(this,Ur)))}createResult(t,r){let o=m(this,Ge),n=this.options,s=m(this,Ur),i=m(this,zi),a=m(this,Fs),u=t!==o?t.state:m(this,La),{state:c}=t,b={...c},T=false,w;if(r._optimisticResults){let _=this.hasListeners(),A=!_&&Em(t,r),W=_&&Mm(t,o,r,n);(A||W)&&(b={...b,...$d(c.data,t.options)}),r._optimisticResults==="isRestoring"&&(b.fetchStatus="idle");}let{error:p,errorUpdatedAt:y,status:f}=b;w=b.data;let k=false;if(r.placeholderData!==void 0&&w===void 0&&f==="pending"){let _;s?.isPlaceholderData&&r.placeholderData===a?.placeholderData?(_=s.data,k=true):_=typeof r.placeholderData=="function"?r.placeholderData(m(this,Vs)?.state.data,m(this,Vs)):r.placeholderData,_!==void 0&&(f="success",w=Fa(s?.data,_,r),T=true);}if(r.select&&w!==void 0&&!k)if(s&&w===i?.data&&r.select===m(this,Ba))w=m(this,Os);else try{M(this,Ba,r.select),w=r.select(w),w=Fa(s?.data,w,r),M(this,Os,w),M(this,oi,null);}catch(_){M(this,oi,_);}m(this,oi)&&(p=m(this,oi),w=m(this,Os),y=Date.now(),f="error");let C=b.fetchStatus==="fetching",d=f==="pending",x=f==="error",v=d&&C,h=w!==void 0,S={status:f,fetchStatus:b.fetchStatus,isPending:d,isSuccess:f==="success",isError:x,isInitialLoading:v,isLoading:v,data:w,dataUpdatedAt:b.dataUpdatedAt,error:p,errorUpdatedAt:y,failureCount:b.fetchFailureCount,failureReason:b.fetchFailureReason,errorUpdateCount:b.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:b.dataUpdateCount>u.dataUpdateCount||b.errorUpdateCount>u.errorUpdateCount,isFetching:C,isRefetching:C&&!d,isLoadingError:x&&!h,isPaused:b.fetchStatus==="paused",isPlaceholderData:T,isRefetchError:x&&h,isStale:tu(t,r),refetch:this.refetch,promise:m(this,_n),isEnabled:Gr(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let _=S.data!==void 0,A=S.status==="error"&&!_,W=z=>{A?z.reject(S.error):_&&z.resolve(S.data);},I=()=>{let z=M(this,_n,S.promise=Oa());W(z);},F=m(this,_n);switch(F.status){case "pending":t.queryHash===o.queryHash&&W(F);break;case "fulfilled":(A||S.data!==F.value)&&I();break;case "rejected":(!A||S.error!==F.reason)&&I();break}}return S}updateResult(){let t=m(this,Ur),r=this.createResult(m(this,Ge),this.options);if(M(this,zi,m(this,Ge).state),M(this,Fs,this.options),m(this,zi).data!==void 0&&M(this,Vs,m(this,Ge)),Gl(r,t))return;M(this,Ur,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,s=typeof n=="function"?n():n;if(s==="all"||!s&&!m(this,Ds).size)return true;let i=new Set(s??m(this,Ds));return this.options.throwOnError&&i.add("error"),Object.keys(m(this,Ur)).some(a=>{let l=a;return m(this,Ur)[l]!==t[l]&&i.has(l)})};He(this,yt,Um).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&He(this,yt,Yd).call(this);}},Jr=new WeakMap,Ge=new WeakMap,La=new WeakMap,Ur=new WeakMap,zi=new WeakMap,Fs=new WeakMap,_n=new WeakMap,oi=new WeakMap,Ba=new WeakMap,Os=new WeakMap,Vs=new WeakMap,Ui=new WeakMap,Hi=new WeakMap,ni=new WeakMap,Ds=new WeakMap,yt=new WeakSet,Da=function(t){He(this,yt,Zd).call(this);let r=m(this,Ge).fetch(this.options,t);return t?.throwOnError||(r=r.catch(hr)),r},qd=function(){He(this,yt,Gd).call(this);let t=Vo(this.options.staleTime,m(this,Ge));if(Xo.isServer()||m(this,Ur).isStale||!Ia(t))return;let o=Kl(m(this,Ur).dataUpdatedAt,t)+1;M(this,Ui,Zo.setTimeout(()=>{m(this,Ur).isStale||this.updateResult();},o));},Kd=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(m(this,Ge)):this.options.refetchInterval)??false},Qd=function(t){He(this,yt,Jd).call(this),M(this,ni,t),!(Xo.isServer()||Gr(this.options.enabled,m(this,Ge))===false||!Ia(m(this,ni))||m(this,ni)===0)&&M(this,Hi,Zo.setInterval(()=>{(this.options.refetchIntervalInBackground||_s.isFocused())&&He(this,yt,Da).call(this);},m(this,ni)));},Yd=function(){He(this,yt,qd).call(this),He(this,yt,Qd).call(this,He(this,yt,Kd).call(this));},Gd=function(){m(this,Ui)!==void 0&&(Zo.clearTimeout(m(this,Ui)),M(this,Ui,void 0));},Jd=function(){m(this,Hi)!==void 0&&(Zo.clearInterval(m(this,Hi)),M(this,Hi,void 0));},Zd=function(){let t=m(this,Jr).getQueryCache().build(m(this,Jr),this.options);if(t===m(this,Ge))return;let r=m(this,Ge);M(this,Ge,t),M(this,La,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},Um=function(t){Et.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(m(this,Ur));}),m(this,Jr).getQueryCache().notify({query:m(this,Ge),type:"observerResultsUpdated"});});},zm);function Zy(e,t){return Gr(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===false)}function Em(e,t){return Zy(e,t)||e.state.data!==void 0&&Xd(e,t,t.refetchOnMount)}function Xd(e,t,r){if(Gr(t.enabled,e)!==false&&Vo(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&tu(e,t)}return false}function Mm(e,t,r,o){return (e!==t||Gr(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&tu(e,r)}function tu(e,t){return Gr(t.enabled,e)!==false&&e.isStaleByTime(Vo(t.staleTime,e))}function Xy(e,t){return !Gl(e.getCurrentResult(),t)}function ru(e){return {onFetch:(t,r)=>{let o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,s=t.state.data?.pages||[],i=t.state.data?.pageParams||[],a={pages:[],pageParams:[]},l=0,u=async()=>{let c=false,b=p=>{Pm(p,()=>t.signal,()=>c=true);},T=Jl(t.options,t.fetchOptions),w=async(p,y,f)=>{if(c)return Promise.reject();if(y==null&&p.pages.length)return Promise.resolve(p);let C=(()=>{let h={client:t.client,queryKey:t.queryKey,pageParam:y,direction:f?"backward":"forward",meta:t.options.meta};return b(h),h})(),d=await T(C),{maxPages:x}=t.options,v=f?Im:vm;return {pages:v(p.pages,d,x),pageParams:v(p.pageParams,y,x)}};if(n&&s.length){let p=n==="backward",y=p?eb:Hm,f={pages:s,pageParams:i},k=y(o,f);a=await w(f,k,p);}else {let p=e??s.length;do{let y=l===0?i[0]??o.initialPageParam:Hm(o,a);if(l>0&&y==null)break;a=await w(a,y),l++;}while(l<p)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u;}}}function Hm(e,{pages:t,pageParams:r}){let o=t.length-1;return t.length>0?e.getNextPageParam(t[o],t,r[o],r):void 0}function eb(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Aa,en,Lr,Ni,tn,ii,Nm,jm=(Nm=class extends tc{constructor(t){super();ee(this,tn);ee(this,Aa);ee(this,en);ee(this,Lr);ee(this,Ni);M(this,Aa,t.client),this.mutationId=t.mutationId,M(this,Lr,t.mutationCache),M(this,en,[]),this.state=t.state||tb(),this.setOptions(t.options),this.scheduleGc();}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime);}get meta(){return this.options.meta}addObserver(t){m(this,en).includes(t)||(m(this,en).push(t),this.clearGcTimeout(),m(this,Lr).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){M(this,en,m(this,en).filter(r=>r!==t)),this.scheduleGc(),m(this,Lr).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){m(this,en).length||(this.state.status==="pending"?this.scheduleGc():m(this,Lr).remove(this));}continue(){return m(this,Ni)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{He(this,tn,ii).call(this,{type:"continue"});},o={client:m(this,Aa),meta:this.options.meta,mutationKey:this.options.mutationKey};M(this,Ni,ec({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(i,a)=>{He(this,tn,ii).call(this,{type:"failed",failureCount:i,error:a});},onPause:()=>{He(this,tn,ii).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>m(this,Lr).canRun(this)}));let n=this.state.status==="pending",s=!m(this,Ni).canStart();try{if(n)r();else {He(this,tn,ii).call(this,{type:"pending",variables:t,isPaused:s}),m(this,Lr).config.onMutate&&await m(this,Lr).config.onMutate(t,this,o);let a=await this.options.onMutate?.(t,o);a!==this.state.context&&He(this,tn,ii).call(this,{type:"pending",context:a,variables:t,isPaused:s});}let i=await m(this,Ni).start();return await m(this,Lr).config.onSuccess?.(i,t,this.state.context,this,o),await this.options.onSuccess?.(i,t,this.state.context,o),await m(this,Lr).config.onSettled?.(i,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(i,null,t,this.state.context,o),He(this,tn,ii).call(this,{type:"success",data:i}),i}catch(i){try{await m(this,Lr).config.onError?.(i,t,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onError?.(i,t,this.state.context,o);}catch(a){Promise.reject(a);}try{await m(this,Lr).config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onSettled?.(void 0,i,t,this.state.context,o);}catch(a){Promise.reject(a);}throw He(this,tn,ii).call(this,{type:"error",error:i}),i}finally{m(this,Lr).runNext(this);}}},Aa=new WeakMap,en=new WeakMap,Lr=new WeakMap,Ni=new WeakMap,tn=new WeakSet,ii=function(t){let r=o=>{switch(t.type){case "failed":return {...o,failureCount:t.failureCount,failureReason:t.error};case "pause":return {...o,isPaused:true};case "continue":return {...o,isPaused:false};case "pending":return {...o,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case "success":return {...o,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:false};case "error":return {...o,data:void 0,error:t.error,failureCount:o.failureCount+1,failureReason:t.error,isPaused:false,status:"error"}}};this.state=r(this.state),Et.batch(()=>{m(this,en).forEach(o=>{o.onMutationUpdate(t);}),m(this,Lr).notify({mutation:this,type:"updated",action:t});});},Nm);function tb(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var Rn,Do,Wa,$m,qm=($m=class extends Go{constructor(t={}){super();ee(this,Rn);ee(this,Do);ee(this,Wa);this.config=t,M(this,Rn,new Set),M(this,Do,new Map),M(this,Wa,0);}build(t,r,o){let n=new jm({client:t,mutationCache:this,mutationId:++ra(this,Wa)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){m(this,Rn).add(t);let r=rc(t);if(typeof r=="string"){let o=m(this,Do).get(r);o?o.push(t):m(this,Do).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(m(this,Rn).delete(t)){let r=rc(t);if(typeof r=="string"){let o=m(this,Do).get(r);if(o)if(o.length>1){let n=o.indexOf(t);n!==-1&&o.splice(n,1);}else o[0]===t&&m(this,Do).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=rc(t);if(typeof r=="string"){let n=m(this,Do).get(r)?.find(s=>s.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=rc(t);return typeof r=="string"?m(this,Do).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Et.batch(()=>{m(this,Rn).forEach(t=>{this.notify({type:"removed",mutation:t});}),m(this,Rn).clear(),m(this,Do).clear();});}getAll(){return Array.from(m(this,Rn))}find(t){let r={exact:true,...t};return this.getAll().find(o=>Yl(r,o))}findAll(t={}){return this.getAll().filter(r=>Yl(t,r))}notify(t){Et.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return Et.batch(()=>Promise.all(t.map(r=>r.continue().catch(hr))))}},Rn=new WeakMap,Do=new WeakMap,Wa=new WeakMap,$m);function rc(e){return e.options.scope?.id}var rn,Km,Qm=(Km=class extends Go{constructor(t={}){super();ee(this,rn);this.config=t,M(this,rn,new Map);}build(t,r,o){let n=r.queryKey,s=r.queryHash??Pa(n,r),i=this.get(s);return i||(i=new Am({client:t,queryKey:n,queryHash:s,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(i)),i}add(t){m(this,rn).has(t.queryHash)||(m(this,rn).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=m(this,rn).get(t.queryHash);r&&(t.destroy(),r===t&&m(this,rn).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){Et.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return m(this,rn).get(t)}getAll(){return [...m(this,rn).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>Ql(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>Ql(t,o)):r}notify(t){Et.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){Et.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){Et.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},rn=new WeakMap,Km);var or,si,ai,Ls,Bs,li,As,Ws,Ym,ou=(Ym=class{constructor(e={}){ee(this,or);ee(this,si);ee(this,ai);ee(this,Ls);ee(this,Bs);ee(this,li);ee(this,As);ee(this,Ws);M(this,or,e.queryCache||new Qm),M(this,si,e.mutationCache||new qm),M(this,ai,e.defaultOptions||{}),M(this,Ls,new Map),M(this,Bs,new Map),M(this,li,0);}mount(){ra(this,li)._++,m(this,li)===1&&(M(this,As,_s.subscribe(async e=>{e&&(await this.resumePausedMutations(),m(this,or).onFocus());})),M(this,Ws,Is.subscribe(async e=>{e&&(await this.resumePausedMutations(),m(this,or).onOnline());})));}unmount(){var e,t;ra(this,li)._--,m(this,li)===0&&((e=m(this,As))==null||e.call(this),M(this,As,void 0),(t=m(this,Ws))==null||t.call(this),M(this,Ws,void 0));}isFetching(e){return m(this,or).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return m(this,si).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return m(this,or).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=m(this,or).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Vo(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return m(this,or).findAll(e).map(({queryKey:t,state:r})=>{let o=r.data;return [t,o]})}setQueryData(e,t,r){let o=this.defaultQueryOptions({queryKey:e}),s=m(this,or).get(o.queryHash)?.state.data,i=_m(t,s);if(i!==void 0)return m(this,or).build(this,o).setData(i,{...r,manual:true})}setQueriesData(e,t,r){return Et.batch(()=>m(this,or).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return m(this,or).get(t.queryHash)?.state}removeQueries(e){let t=m(this,or);Et.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=m(this,or);return Et.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=Et.batch(()=>m(this,or).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(hr).catch(hr)}invalidateQueries(e,t={}){return Et.batch(()=>(m(this,or).findAll(e).forEach(r=>{r.invalidate();}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??true},o=Et.batch(()=>m(this,or).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let s=n.fetch(void 0,r);return r.throwOnError||(s=s.catch(hr)),n.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(o).then(hr)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=m(this,or).build(this,t);return r.isStaleByTime(Vo(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(hr).catch(hr)}fetchInfiniteQuery(e){return e.behavior=ru(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(hr).catch(hr)}ensureInfiniteQueryData(e){return e.behavior=ru(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Is.isOnline()?m(this,si).resumePausedMutations():Promise.resolve()}getQueryCache(){return m(this,or)}getMutationCache(){return m(this,si)}getDefaultOptions(){return m(this,ai)}setDefaultOptions(e){M(this,ai,e);}setQueryDefaults(e,t){m(this,Ls).set(Di(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...m(this,Ls).values()],r={};return t.forEach(o=>{Bi(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){m(this,Bs).set(Di(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...m(this,Bs).values()],r={};return t.forEach(o=>{Bi(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...m(this,ai).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=Pa(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Li&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...m(this,ai).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){m(this,or).clear(),m(this,si).clear();}},or=new WeakMap,si=new WeakMap,ai=new WeakMap,Ls=new WeakMap,Bs=new WeakMap,li=new WeakMap,As=new WeakMap,Ws=new WeakMap,Ym);var nu=ci__namespace.createContext(void 0),iu=e=>{let t=ci__namespace.useContext(nu);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},su=({client:e,children:t})=>(ci__namespace.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsxRuntime.jsx(nu.Provider,{value:e,children:t}));var Gm=ci__namespace.createContext(false),Jm=()=>ci__namespace.useContext(Gm);Gm.Provider;function ob(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var nb=ci__namespace.createContext(ob()),Zm=()=>ci__namespace.useContext(nb);var ef=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?Zl(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},tf=e=>{ci__namespace.useEffect(()=>{e.clearReset();},[e]);},rf=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||Zl(r,[e.error,o]));var of=e=>{if(e.suspense){let r=n=>n==="static"?n:Math.max(n??1e3,1e3),o=e.staleTime;e.staleTime=typeof o=="function"?(...n)=>r(o(...n)):r(o),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3));}},nf=(e,t)=>e.isLoading&&e.isFetching&&!t,sf=(e,t)=>e?.suspense&&t.isPending,au=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function af(e,t,r){if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');let o=Jm(),n=Zm(),s=iu(),i=s.defaultQueryOptions(e);s.getDefaultOptions().queries?._experimental_beforeQuery?.(i);let a=s.getQueryCache().get(i.queryHash);process.env.NODE_ENV!=="production"&&(i.queryFn||console.error(`[${i.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),i._optimisticResults=o?"isRestoring":"optimistic",of(i),ef(i,n,a),tf(n);let l=!s.getQueryCache().get(i.queryHash),[u]=ci__namespace.useState(()=>new t(s,i)),c=u.getOptimisticResult(i),b=!o&&e.subscribed!==false;if(ci__namespace.useSyncExternalStore(ci__namespace.useCallback(T=>{let w=b?u.subscribe(Et.batchCalls(T)):hr;return u.updateResult(),w},[u,b]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),ci__namespace.useEffect(()=>{u.setOptions(i);},[i,u]),sf(i,c))throw au(i,u,n);if(rf({result:c,errorResetBoundary:n,throwOnError:i.throwOnError,query:a,suspense:i.suspense}))throw c.error;return s.getDefaultOptions().queries?._experimental_afterQuery?.(i,c),i.experimental_prefetchInRender&&!Xo.isServer()&&nf(c,o)&&(l?au(i,u,n):a?.promise)?.catch(hr).finally(()=>{u.updateResult();}),i.notifyOnChangeProps?c:u.trackResult(c)}function vn(e,t){return af(e,eu)}var zs=new Map;function lf({width:e,height:t,borderRadius:r,color:o}){let n=ci.useRef(new reactNative.Animated.Value(.3)).current;return ci.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:.7,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[n]),jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",width:e,height:t,borderRadius:r,backgroundColor:o,opacity:n}})}function ui({uri:e,width:t,height:r,borderRadius:o=0,borderWidth:n=0,borderColor:s="transparent",backgroundColor:i="transparent",style:a}){let{colors:l}=O(),[u,c]=ci.useState(false),[b,T]=ci.useState(false),[w,p]=ci.useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let v=zs.get(e);return v?{uri:e,xml:v}:null}),y=e?.toLowerCase().endsWith(".svg"),f=y&&e&&w?.uri===e?w.xml:null;ci.useEffect(()=>{c(false),T(false);},[e]),ci.useEffect(()=>{if(!y||!e)return;if(zs.has(e)){p({uri:e,xml:zs.get(e)});return}let v=false;return fetch(e).then(h=>{if(!h.ok)throw new Error(`HTTP ${h.status}`);return h.text()}).then(h=>{v||(zs.set(e,h),p({uri:e,xml:h}));}).catch(()=>{v||c(true);}),()=>{v=true;}},[e,y]);let k=l.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:k},a]});let C={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:s,backgroundColor:i,overflow:"hidden",alignItems:"center",justifyContent:"center",...a},d=t-n*2,x=r-n*2;return u?jsxRuntime.jsx(reactNative.View,{style:[C,{backgroundColor:i||k}]}):y?jsxRuntime.jsxs(reactNative.View,{style:C,children:[!!!f&&jsxRuntime.jsx(lf,{width:d,height:x,borderRadius:o,color:k}),f?jsxRuntime.jsx(It.SvgXml,{xml:f,width:d,height:x,onError:()=>c(true)}):jsxRuntime.jsx(It.SvgUri,{uri:e,width:d,height:x,onError:()=>c(true)})]}):jsxRuntime.jsxs(reactNative.View,{style:C,children:[!b&&jsxRuntime.jsx(lf,{width:d,height:x,borderRadius:o,color:k}),jsxRuntime.jsx(reactNative.Image,{source:{uri:e,cache:"force-cache"},style:{width:d,height:x},resizeMode:"contain",onLoad:()=>T(true),onError:()=>c(true)})]})}function du(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(zs.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{zs.set(r,o);}).catch(()=>{}));}else t.push(reactNative.Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function Hr({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:s,badge:i,showBalance:a=false,balanceAddress:l,balanceChainType:u,balanceChainId:c,balanceTokenAddress:b,publishableKey:T,projectName:w,leftIcon:p,onLeftAction:y}){let{colors:f,fonts:k,components:C}=O(),[d,x]=ci.useState(null),[v,h]=ci.useState(false),g=ci.useState(()=>new reactNative.Animated.Value(0))[0];ci.useEffect(()=>{if(!v)return;let _=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(g,{toValue:1,duration:700,useNativeDriver:true}),reactNative.Animated.timing(g,{toValue:0,duration:700,useNativeDriver:true})]));return _.start(),()=>_.stop()},[v,g]),ci.useEffect(()=>{if(!a||!l||!u||!c||!b||!T){x(null),h(false);return}let _=false;return h(true),bl(l,u,c,b,T).then(A=>{if(_)return;let W=A.balance,I=null;W&&(W.amount_usd!=null&&W.amount_usd!==""?I=`$${W.amount_usd}`:I="$0.00"),x(I);}).catch(()=>{_||x(null);}).finally(()=>{_||h(false);}),()=>{_=true;}},[a,l,u,c,b,T]);let S=g.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxRuntime.jsxs(reactNative.View,{style:Br.header,children:[jsxRuntime.jsx(reactNative.View,{style:Br.leftContainer,children:r&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[Br.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(na,{size:20,color:C.header.buttonColor,strokeWidth:2})}):p&&y?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:y,style:[Br.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:p}):jsxRuntime.jsx(reactNative.View,{style:Br.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:Br.titleContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:Br.titleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Br.title,{color:C.header.titleColor,fontFamily:k.medium}],children:e}),i&&i.count>0&&jsxRuntime.jsx(reactNative.View,{style:[Br.titleBadge,{backgroundColor:f.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[Br.titleBadgeText,{color:f.foregroundMuted,fontFamily:k.regular}],children:i.count})})]}),t?jsxRuntime.jsx(reactNative.Text,{style:[Br.balanceText,{color:f.foregroundMuted,fontFamily:k.regular}],children:t}):null,a&&(v?jsxRuntime.jsx(reactNative.Animated.View,{style:[Br.balanceSkeleton,{backgroundColor:f.cardHover,opacity:S}]}):d!=null?jsxRuntime.jsxs(reactNative.Text,{style:[Br.balanceText,{color:f.foregroundMuted,fontFamily:k.regular}],children:[w?`${w} `:"","Balance: ",d]}):null)]}),jsxRuntime.jsx(reactNative.View,{style:Br.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:s,style:[Br.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ct,{size:20,color:C.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:Br.spacer})})]})}var Br=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},leftContainer:{width:40,alignItems:"flex-start"},rightContainer:{width:40,alignItems:"flex-end"},titleContainer:{flex:1,alignItems:"center"},titleRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},title:{fontSize:16,textAlign:"center"},titleBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:12},titleBadgeText:{fontSize:10,fontWeight:"400"},balanceSkeleton:{height:10,width:120,borderRadius:5,marginTop:4},balanceText:{fontSize:14,marginTop:3,textAlign:"center"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function gr({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:s}){let{components:i}=O(),a=s??i.card,l=a.backShadowColor!=="transparent",u={backgroundColor:a.backgroundColor,borderRadius:a.borderRadius,borderWidth:a.borderWidth,borderColor:a.borderColor},c=[pf.wrapper,t,l&&{marginBottom:a.backShadowSpacing}],b=[u,r];return jsxRuntime.jsxs(reactNative.View,{style:c,children:[l&&jsxRuntime.jsx(reactNative.View,{style:[pf.backShadow,{top:a.backShadowOffset.top,left:a.backShadowOffset.left,right:a.backShadowOffset.right,bottom:a.backShadowOffset.bottom,backgroundColor:a.backShadowColor,borderRadius:a.borderRadius}]}),o!=null?jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:o,activeOpacity:n,style:b,children:e}):jsxRuntime.jsx(reactNative.View,{style:b,children:e})]})}var pf=reactNative.StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function Ma({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:s}=O(),i=s.depositMenu.card,a=o?[...o].sort((l,u)=>l.position-u.position):[];return jsxRuntime.jsxs(gr,{cardTokens:i,onPress:e,style:on.wrapper,contentStyle:on.container,children:[jsxRuntime.jsxs(reactNative.View,{style:on.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[on.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(Zc,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:on.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[on.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[on.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:on.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:on.networkIcons,children:a.map((l,u)=>{let c=l.icon_urls.find(b=>b.format==="png")?.url||l.icon_urls.find(b=>b.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[on.networkIconWrapper,{marginLeft:u===0?0:-6,zIndex:a.length-u}],children:jsxRuntime.jsx(ui,{uri:oe(c),width:20,height:20})},l.name)})})})]})}var on=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},networkIcons:{flexDirection:"row",alignItems:"center"},networkIconWrapper:{}});function Ua({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:s}=O(),i=s.depositMenu.card;return jsxRuntime.jsxs(gr,{cardTokens:i,onPress:e,style:In.wrapper,contentStyle:In.container,children:[jsxRuntime.jsxs(reactNative.View,{style:In.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[In.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(os,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:In.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[In.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[In.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:In.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:In.paymentIcons,children:o?.map(a=>{let l=a.icon_urls.find(u=>u.format==="png")?.url||a.icon_urls.find(u=>u.format==="svg")?.url;return jsxRuntime.jsx(ui,{uri:oe(l),width:32,height:20,borderRadius:4},a.name)})})})]})}var In=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},paymentIcons:{flexDirection:"row",alignItems:"center",gap:6}});function Ha({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:s}=O(),i=s.depositMenu.card;return jsxRuntime.jsx(gr,{cardTokens:i,onPress:e,style:Pn.wrapper,contentStyle:Pn.container,children:jsxRuntime.jsxs(reactNative.View,{style:Pn.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[Pn.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:[jsxRuntime.jsx(jr,{size:20,color:i.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsxRuntime.jsx(reactNative.View,{style:[Pn.badge,{backgroundColor:i.iconColor,borderRadius:s.badge.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[Pn.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),jsxRuntime.jsxs(reactNative.View,{style:Pn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Pn.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Pn.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var Pn=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center",position:"relative"},badge:{position:"absolute",top:-4,right:-4,minWidth:18,height:18,alignItems:"center",justifyContent:"center",paddingHorizontal:4},badgeText:{color:"#FFFFFF",fontSize:10,fontWeight:"600"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});function ja({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=O(),s=n.depositMenu.card;return jsxRuntime.jsxs(gr,{cardTokens:s,onPress:e,style:nn.wrapper,contentStyle:nn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:nn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[nn.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(dl,{size:20,color:s.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:nn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[nn.title,{color:s.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[nn.subtitle,{color:s.subtitleColor,fontFamily:o.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:nn.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:nn.badge,children:jsxRuntime.jsx(reactNative.Text,{style:[nn.badgeText,{fontFamily:o.regular}],children:"Stripe"})})})]})}var nn=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},badge:{paddingHorizontal:10,paddingVertical:4,borderRadius:6,backgroundColor:"#635BFF"},badgeText:{fontSize:12,fontWeight:"600",color:"#FFFFFF"}});var gf=1e4,yf=2500,bf=3e3,Cf=6e4;function $a(e){let{depositConfirmationMode:t,depositAddress:r,chain:o,externalUserId:n,publishableKey:s,modalOpenedAt:i,depositWalletId:a,depositExecutions:l,trackedExecutions:u,setDepositExecutions:c,setTrackedExecutions:b,setLatestExecution:T,setShowStatusSheet:w,onDepositSuccess:p,onExecutionsChange:y,onDepositError:f}=e,[k,C]=ci.useState(false),[d,x]=ci.useState(false);return ci.useEffect(()=>{if(t!=="auto_ui"&&t!=="auto_silent"||!r)return;C(false),t==="auto_ui"&&x(false);let h=setTimeout(()=>{C(true),t==="auto_ui"&&x(true);},gf);return ()=>clearTimeout(h)},[t,r,o]),ci.useEffect(()=>{if(!n||!i)return;let h=new Date(i.getTime()-Cf),g=setInterval(async()=>{try{let A=[...(await bn(n,s,"deposit")).data??[]].sort((I,F)=>{let z=I.created_at?new Date(I.created_at).getTime():0;return (F.created_at?new Date(F.created_at).getTime():0)-z}),W=null;for(let I of A){let F=I.created_at?new Date(I.created_at):null;if(!F||F<=h)continue;let z=u.get(I.id);if(!z){W=I;break}if(["pending","waiting","delayed"].includes(z)&&I.status==="succeeded"){W=I;break}}if(W){let I=W;c(F=>{let z=F.findIndex(j=>j.id===I.id);if(z>=0){let j=[...F];return j[z]=I,j}return [...F,I]}),b(F=>{let z=new Map(F);return z.set(I.id,I.status),z}),T(I),w(!0),I.status==="succeeded"&&p?.({message:"Deposit completed successfully",executionId:I.id}),y?.([...l,I]);}}catch(S){f?.({message:"Failed to check deposit status",error:S});}},yf);return ()=>clearInterval(g)},[n,s,i,u,l,y,p,f]),ci.useEffect(()=>{if(!k||!a)return;let h=async()=>{try{await fl(a,s);}catch{}};h();let g=setInterval(h,bf);return ()=>clearInterval(g)},[k,a,s]),{pollingEnabled:k,showWaitingUi:d,handleIveDeposited:()=>{C(true),x(true);}}}function js({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n}){let{colors:s,isDark:i}=O(),a=i?"#1a1a1a":"#ffffff",l=i?"#ffffff":"#000000",u=n||a;return jsxRuntime.jsxs(reactNative.View,{style:[Sf.container,{width:t,height:t}],children:[jsxRuntime.jsx(yb__default.default,{value:e||"placeholder",size:t,backgroundColor:a,color:l,ecl:"H",quietZone:4}),r&&jsxRuntime.jsx(reactNative.View,{style:[Sf.logoContainer,{width:o+12,height:o+12,backgroundColor:u,borderRadius:(o+12)/2}],children:jsxRuntime.jsx(ui,{uri:r,width:o,height:o,borderRadius:o/2})})]})}var Sf=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function xf(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function kb(e){let r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],o=e.getDate(),n=e.getFullYear(),s=e.getHours(),i=e.getMinutes(),a=s>=12?"pm":"am";s=s%12,s=s||12;let l=i<10?`0${i}`:i;return `${r} ${o}, ${n} at ${s}:${l}${a}`}function $s({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:s,amountUsd:i,onClose:a,borderTopLeftRadius:l,borderTopRightRadius:u}){let{colors:c,fonts:b,components:T}=O(),[w,p]=ci.useState(false),y=t==="pending"||t==="waiting"||t==="delayed",f=t==="succeeded",k=f?.5:.4,C=()=>{o&&reactNative.Linking.openURL(o);},d=()=>{n&&reactNative.Linking.openURL(n);};return jsxRuntime.jsx(wt,{visible:e,onClose:a,closeOnBackdropPress:true,enablePanDownToClose:false,showHandle:false,heightPercent:k,borderTopLeftRadius:l,borderTopRightRadius:u,children:jsxRuntime.jsxs(reactNative.View,{style:Mt.sheetWrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Mt.closeButton,onPress:a,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ct,{size:20,color:T.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.ScrollView,{style:Mt.scrollView,bounces:false,showsVerticalScrollIndicator:false,contentContainerStyle:Mt.container,children:[jsxRuntime.jsx(reactNative.View,{style:Mt.iconContainer,children:y?jsxRuntime.jsx(st,{size:80,strokeWidth:4,iconSize:68,children:r?jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(r)},style:Mt.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[Mt.tokenIconFill,{backgroundColor:c.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r?jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(r)},style:Mt.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[Mt.tokenIconLarge,{backgroundColor:c.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[Mt.statusBadge,{backgroundColor:T.container.iconBackgroundColor}],children:jsxRuntime.jsx($e,{size:16,color:T.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[Mt.title,{color:T.container.titleColor,fontFamily:b.semibold}],children:y?"Deposit Processing":"Deposit Complete"}),i!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[Mt.amount,{color:T.container.titleColor,fontFamily:b.bold}],children:["$",i.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),s&&jsxRuntime.jsx(reactNative.Text,{style:[Mt.date,{color:T.container.subtitleColor,fontFamily:b.regular}],children:kb(s)}),jsxRuntime.jsx(reactNative.Text,{style:[Mt.subtitle,{color:T.container.subtitleColor,fontFamily:b.regular}],children:y?"This usually takes less than a minute.":"Your account has been credited successfully!"}),f&&(o||n)&&jsxRuntime.jsxs(reactNative.View,{style:Mt.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[Mt.divider,{backgroundColor:c.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Mt.detailsToggle,onPress:()=>p(!w),children:[jsxRuntime.jsx(reactNative.Text,{style:[Mt.detailsToggleText,{color:T.container.actionTitle,fontFamily:b.medium}],children:w?"See less":"See more details"}),w?jsxRuntime.jsx(Wo,{size:18,color:T.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Kt,{size:18,color:T.container.actionColor,strokeWidth:2})]}),w&&jsxRuntime.jsxs(reactNative.View,{style:Mt.txButtonsContainer,children:[o&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Mt.txButton,{backgroundColor:T.card.backgroundColor,borderColor:c.border}],onPress:C,children:[jsxRuntime.jsx(reactNative.Text,{style:[Mt.txLabel,{color:T.card.titleColor,fontFamily:b.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Mt.txHash,{color:T.card.subtitleColor,fontFamily:b.regular}],children:xf(o)}),jsxRuntime.jsx(Ao,{size:16,color:T.card.actionColor,strokeWidth:2})]}),n&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Mt.txButton,{backgroundColor:T.card.backgroundColor,borderColor:c.border}],onPress:d,children:[jsxRuntime.jsx(reactNative.Text,{style:[Mt.txLabel,{color:T.card.titleColor,fontFamily:b.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Mt.txHash,{color:T.card.subtitleColor,fontFamily:b.regular}],children:xf(n)}),jsxRuntime.jsx(Ao,{size:16,color:T.card.actionColor,strokeWidth:2})]})]})]})]})]})})}var Mt=reactNative.StyleSheet.create({sheetWrapper:{flex:1},scrollView:{flex:1},container:{alignItems:"center",paddingHorizontal:24,paddingTop:40,paddingBottom:20},closeButton:{position:"absolute",top:16,right:16,padding:4,zIndex:1},iconContainer:{position:"relative",marginBottom:16},tokenIcon:{width:64,height:64,borderRadius:32},tokenIconLarge:{width:68,height:68,borderRadius:34},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});function dc({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){let{colors:s,fonts:i,components:a}=O();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e==="manual"&&t&&!r&&jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,activeOpacity:.8,style:[qi.iveDepositedButton,{backgroundColor:s.primary,borderRadius:a.button.borderRadius,borderWidth:a.button.borderWidth,borderColor:a.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[qi.iveDepositedButtonText,{color:s.primaryForeground??"#FFF",fontFamily:i.semibold}],children:"I've made the deposit"})}),r&&!o&&jsxRuntime.jsxs(reactNative.View,{style:[qi.processingCard,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor,shadowColor:a.card.shadowOpacity>0?a.card.shadowColor:void 0,shadowOffset:a.card.shadowOpacity>0?a.card.shadowOffset:void 0,shadowOpacity:a.card.shadowOpacity,shadowRadius:a.card.shadowRadius,elevation:a.card.elevation}],children:[jsxRuntime.jsx(reactNative.View,{style:[qi.detailIcon,{backgroundColor:a.card.iconBackgroundColor,borderRadius:a.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Xc,{size:14,color:a.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:qi.processingCardText,children:[jsxRuntime.jsx(reactNative.Text,{style:[qi.processingCardTitle,{color:a.card.titleColor,fontFamily:i.semibold}],children:"Processing deposit transactions."}),jsxRuntime.jsx(reactNative.Text,{style:[qi.processingCardSubtitle,{color:a.card.subtitleColor,fontFamily:i.regular}],children:"We're checking if your deposit has landed."})]})]})]})}var qi=reactNative.StyleSheet.create({iveDepositedButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginBottom:12},iveDepositedButtonText:{fontSize:16},processingCard:{flexDirection:"row",alignItems:"center",padding:12,marginBottom:12,gap:12},processingCardText:{flex:1,gap:4},processingCardTitle:{fontSize:14},processingCardSubtitle:{fontSize:12,lineHeight:18},detailIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"}});var qa=(e,t)=>`${t}:${e}`,Ob=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function pc({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:u,depositConfirmationMode:c="auto_ui",onExecutionsChange:b,onDepositSuccess:T,onDepositError:w,borderTopLeftRadius:p,borderTopRightRadius:y,sheetBorderRadius:f}){let{colors:k,fonts:C,components:d}=O(),x=a&&l?`${a}:${l}`:"solana:mainnet",[v,h]=ci.useState("USDC"),[g,S]=ci.useState(x),[_,A]=ci.useState([]),[W,I]=ci.useState(true),[F,z]=ci.useState([]),[j,me]=ci.useState(true),[Xe,Ie]=ci.useState(false),[ie,Pe]=ci.useState(false),[Oe,fe]=ci.useState(false),[Ce,ke]=ci.useState(false),[Z,pe]=ci.useState([]),[St,ve]=ci.useState(new Map),[lt]=ci.useState(()=>new Date),[je,Te]=ci.useState(null),[rt,ot]=ci.useState(false),[se,he]=ci.useState(null),[Ae,we]=ci.useState(false),ge=new Map;F.forEach(D=>{D.chains.forEach(H=>{let E=`${H.chain_type}:${H.chain_id}`;ge.has(E)||ge.set(E,H);});});let Jt=Array.from(ge.values()),nt=Ob(g),yr=Jt.find(D=>D.chain_type===nt.chainType&&D.chain_id===nt.chainId)?.chain_type||"ethereum",ce=yn(_,yr),re=ce?.address||"",Se=ci.useRef(false);ci.useEffect(()=>{async function D(){try{me(!0),Te(null);let E=await xi(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(z(E.data),E.data.length>0&&!Se.current){Se.current=!0;let P,U;if(a&&l)if(u)for(let K of E.data){let Ye=K.chains.find(G=>G.chain_type===a&&G.chain_id===l&&G.token_address.toLowerCase()===u.toLowerCase());if(Ye){P=K,U=Ye;break}}else for(let K of E.data){let Ye=K.chains.find(G=>G.chain_type===a&&G.chain_id===l);if(Ye){P=K,U=Ye;break}}if(!P&&s)for(let K of E.data){let Ye=K.chains.find(G=>G.token_address.toLowerCase()===s.toLowerCase());if(Ye){P=K,U=Ye;break}}P||(P=E.data.find(K=>K.symbol==="USDC"),P&&P.chains.length>0&&(U=P.chains[0])),P||(P=E.data.find(K=>K.symbol==="USDT"),P&&P.chains.length>0&&(U=P.chains[0])),P||(P=E.data[0],P.chains.length>0&&(U=P.chains[0])),P&&h(P.symbol),U&&S(qa(U.chain_id,U.chain_type));}}catch(H){console.error("Error fetching supported tokens:",H),Te("Failed to load supported tokens"),w?.({message:"Failed to load supported tokens",error:H});}finally{me(false);}}D();},[t,w,a,l,u,s,n,o]),ci.useEffect(()=>{async function D(){try{I(!0),Te(null);let H=await gn({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);A(H.data);}catch(H){console.error("Error fetching wallets:",H),Te("Failed to load wallets"),w?.({message:"Failed to load wallets",error:H});}finally{I(false);}}D();},[e,r,o,n,s,t,w]);let mt=ce?.id??"",{showWaitingUi:ht,handleIveDeposited:de}=$a({depositConfirmationMode:c,depositAddress:re,chain:g,externalUserId:e,publishableKey:t,modalOpenedAt:lt,depositWalletId:mt,depositExecutions:Z,trackedExecutions:St,setDepositExecutions:pe,setTrackedExecutions:ve,setLatestExecution:he,setShowStatusSheet:ot,onDepositSuccess:T,onExecutionsChange:b,onDepositError:w});ci.useEffect(()=>{if(!F.length)return;let D=F.find(E=>E.symbol===v);if(!D||D.chains.length===0)return;if(!D.chains.some(E=>qa(E.chain_id,E.chain_type)===g)){let E=D.chains[0];S(qa(E.chain_id,E.chain_type));}},[v,F,g]);let Ee=F.find(D=>D.symbol===v),$t=Ee?.chains||[],it=$t.find(D=>qa(D.chain_id,D.chain_type)===g),ir=async()=>{if(re)try{reactNative.Clipboard.setString(re),Ie(!0),setTimeout(()=>Ie(!1),2e3);}catch(D){console.error("Failed to copy:",D);}},Ht=it?.estimated_price_impact_percent??0,sr=it?.max_slippage_percent??.25,Dt=it?.minimum_deposit_amount_usd??3;if(j)return jsxRuntime.jsxs(reactNative.View,{style:B.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:k.primary}),jsxRuntime.jsx(reactNative.Text,{style:[B.loadingText,{color:k.foregroundMuted,fontFamily:C.regular}],children:"Loading currencies..."})]});if(je&&F.length===0)return jsxRuntime.jsxs(reactNative.View,{style:B.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[B.errorText,{color:k.error,fontFamily:C.regular}],children:je}),jsxRuntime.jsx(reactNative.Text,{style:[B.errorHint,{color:k.foregroundMuted,fontFamily:C.regular}],children:"Please check your network connection and try again."})]});let ue=()=>jsxRuntime.jsxs(wt,{visible:Oe,onClose:()=>fe(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:f?.tokenSelector?.borderTopLeftRadius??p,borderTopRightRadius:f?.tokenSelector?.borderTopRightRadius??y,children:[jsxRuntime.jsxs(reactNative.View,{style:[B.sheetHeader,{borderBottomColor:k.border}],children:[jsxRuntime.jsx(reactNative.View,{style:B.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[B.sheetTitle,{color:d.header.titleColor,fontFamily:C.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>fe(false),style:B.sheetCloseButton,children:jsxRuntime.jsx(ct,{size:20,color:d.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(dt,{style:B.sheetList,contentContainerStyle:B.sheetListContent,showsVerticalScrollIndicator:false,children:F.map(D=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{h(D.symbol),fe(false);},activeOpacity:.7,style:[B.sheetItem,{backgroundColor:v===D.symbol?d.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(xe(D,"png"))},style:B.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:B.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[B.sheetItemTitle,{color:d.card.titleColor,fontFamily:C.medium}],children:D.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[B.sheetItemSubtitle,{color:d.card.subtitleColor,fontFamily:C.regular}],children:[D.chains.length," network",D.chains.length!==1?"s":""," available"]})]}),v===D.symbol&&jsxRuntime.jsx($e,{size:20,color:k.primary,strokeWidth:2})]},D.symbol))})]}),Ve=()=>jsxRuntime.jsxs(wt,{visible:Ce,onClose:()=>ke(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:f?.chainSelector?.borderTopLeftRadius??p,borderTopRightRadius:f?.chainSelector?.borderTopRightRadius??y,children:[jsxRuntime.jsxs(reactNative.View,{style:[B.sheetHeader,{borderBottomColor:k.border}],children:[jsxRuntime.jsx(reactNative.View,{style:B.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[B.sheetTitle,{color:d.header.titleColor,fontFamily:C.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ke(false),style:B.sheetCloseButton,children:jsxRuntime.jsx(ct,{size:20,color:d.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(dt,{style:B.sheetList,contentContainerStyle:B.sheetListContent,showsVerticalScrollIndicator:false,children:$t.map(D=>{let H=qa(D.chain_id,D.chain_type),E=g===H;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{S(H),ke(false);},activeOpacity:.7,style:[B.sheetItem,{backgroundColor:E?d.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(xe(D,"png"))},style:B.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:B.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[B.sheetItemTitle,{color:d.card.titleColor,fontFamily:C.medium}],children:D.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[B.sheetItemSubtitle,{color:d.card.subtitleColor,fontFamily:C.regular}],children:["Min deposit: $",D.minimum_deposit_amount_usd]})]}),E&&jsxRuntime.jsx($e,{size:20,color:k.primary,strokeWidth:2})]},H)})})]});return jsxRuntime.jsxs(reactNative.View,{style:B.container,children:[jsxRuntime.jsxs(reactNative.View,{style:B.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[B.selectorLabel,{color:d.card.labelColor,fontFamily:C.regular}],children:"Token"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>fe(true),style:[B.selector,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[Ee&&jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(xe(Ee,"png"))},style:B.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[B.selectorText,{color:d.card.titleColor,fontFamily:C.medium}],children:v}),jsxRuntime.jsx(Kt,{size:16,color:d.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:B.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[B.selectorLabel,{color:d.card.labelColor,fontFamily:C.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[B.minDeposit,{fontFamily:C.regular}],children:["($",Dt," min)"]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ke(true),style:[B.selector,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[it&&jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(xe(it,"png"))},style:B.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[B.selectorText,{color:d.card.titleColor,fontFamily:C.medium}],numberOfLines:1,children:it?.chain_name||"Select network"}),jsxRuntime.jsx(Kt,{size:16,color:d.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:B.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[B.qrWrapper,{backgroundColor:k.background,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth>0?d.card.borderWidth:1,borderColor:d.card.borderColor}],children:W?jsxRuntime.jsxs(reactNative.View,{style:B.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:k.primary}),jsxRuntime.jsx(reactNative.Text,{style:[B.loadingText,{color:k.foregroundMuted,fontFamily:C.regular}],children:"Loading..."})]}):re?jsxRuntime.jsx(js,{value:re,size:160,logoUri:oe(xe(it,"png")||ar("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:B.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[B.errorText,{color:k.error,fontFamily:C.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:B.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:B.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[B.addressLabel,{color:d.card.labelColor,fontFamily:C.medium}],children:"Deposit Address"}),Xe&&jsxRuntime.jsxs(reactNative.View,{style:B.copiedIndicator,children:[jsxRuntime.jsx($e,{size:14,color:k.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[B.copiedText,{color:k.success,fontFamily:C.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(gr,{cardTokens:d.transferCrypto.depositAddress.card,onPress:!W&&re?ir:void 0,contentStyle:B.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[B.addressText,{color:d.card.titleColor,fontFamily:C.regular}],numberOfLines:2,children:W?"Loading...":re||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:B.addressCopyIcon,children:jsxRuntime.jsx(fn,{size:16,color:d.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[B.detailsCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Pe(!ie),style:B.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:B.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[B.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(jr,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[B.detailsLabel,{color:d.card.titleColor,fontFamily:C.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:B.chevronContainer,children:ie?jsxRuntime.jsx(Wo,{size:16,color:d.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Kt,{size:16,color:d.card.actionColor,strokeWidth:2})})]}),ie&&jsxRuntime.jsxs(reactNative.View,{style:B.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:B.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[B.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Nn,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[B.detailsLabel,{color:d.card.titleColor,fontFamily:C.regular}],children:["Price impact: ",Ht.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>we(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(ss,{size:14,color:d.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:B.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[B.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(oo,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[B.detailsLabel,{color:d.card.titleColor,fontFamily:C.regular}],children:["Slippage: Auto \u2022 ",sr.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>we(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(ss,{size:14,color:d.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:B.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[B.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(ll,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[B.detailsLabel,{color:d.card.titleColor,fontFamily:C.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(dc,{depositConfirmationMode:c,depositAddress:re,showWaitingUi:ht,latestExecution:se,onIveDeposited:de}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:B.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[B.termsText,{color:k.primary,fontFamily:C.regular}],children:"Terms apply"})}),ue(),Ve(),jsxRuntime.jsxs(wt,{visible:Ae,onClose:()=>we(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:f?.infoSheet?.borderTopLeftRadius??p,borderTopRightRadius:f?.infoSheet?.borderTopRightRadius??y,children:[jsxRuntime.jsxs(reactNative.View,{style:[B.sheetHeader,{borderBottomColor:k.border}],children:[jsxRuntime.jsx(reactNative.View,{style:B.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[B.sheetTitle,{color:d.header.titleColor,fontFamily:C.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>we(false),style:B.sheetCloseButton,children:jsxRuntime.jsx(ct,{size:20,color:d.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:B.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[B.infoCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:B.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[B.infoCardIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Nn,{size:16,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[B.infoCardTitle,{color:d.card.titleColor,fontFamily:C.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[B.infoCardValue,{color:d.card.titleColor,fontFamily:C.medium}],children:[Ht.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[B.infoCardDescription,{color:d.card.descriptionColor,fontFamily:C.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[B.infoCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:B.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[B.infoCardIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(oo,{size:16,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[B.infoCardTitle,{color:d.card.titleColor,fontFamily:C.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[B.infoCardValue,{color:d.card.titleColor,fontFamily:C.medium}],children:[sr.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[B.infoCardDescription,{color:d.card.descriptionColor,fontFamily:C.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]}),se&&jsxRuntime.jsx($s,{visible:rt,status:se.status,tokenIconUrl:se.destination_token_metadata?.icon_urls?.find(D=>D.format==="png")?.url||se.destination_token_metadata?.icon_url||xe(Ee,"png"),explorerUrl:se.explorer_url,completionExplorerUrl:se.destination_explorer_url,date:se.created_at?new Date(se.created_at):void 0,amountUsd:se.source_amount_usd?parseFloat(se.source_amount_usd):void 0,onClose:()=>ot(false),borderTopLeftRadius:f?.depositStatus?.borderTopLeftRadius??p,borderTopRightRadius:f?.depositStatus?.borderTopRightRadius??y})]})}var B=reactNative.StyleSheet.create({container:{flex:1,padding:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:13,marginBottom:8},minDeposit:{fontSize:10},selector:{flexDirection:"row",alignItems:"center",gap:10,padding:12,borderRadius:12},selectorIcon:{width:24,height:24,borderRadius:12},selectorText:{flex:1,fontSize:14,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:16},qrWrapper:{padding:16},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:13},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{position:"relative",paddingHorizontal:12,paddingVertical:16},addressText:{fontSize:12,fontFamily:"monospace"},addressCopyIcon:{position:"absolute",right:12,top:0,bottom:0,justifyContent:"center"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},spacer:{flex:1},termsContainer:{alignItems:"center"},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},sheetList:{flex:1,paddingTop:8},sheetListContent:{paddingBottom:56},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:8,borderRadius:12,gap:12},sheetItemIcon:{width:40,height:40,borderRadius:20},sheetItemText:{flex:1},sheetItemTitle:{fontSize:16,fontWeight:"500"},sheetItemSubtitle:{fontSize:12,marginTop:2},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});function mc({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:s}=O();return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[Ki.container,{backgroundColor:s.card.backgroundColor,borderRadius:s.list.rowBorderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ki.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Ki.iconContainer,{backgroundColor:o.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(xe(e,"png"))},style:Ki.icon})}),jsxRuntime.jsxs(reactNative.View,{style:Ki.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ki.name,{color:s.card.titleColor,fontFamily:n.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[Ki.code,{color:s.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx($e,{size:16,color:o.primary,strokeWidth:2})]})}var Ki=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,marginHorizontal:8,marginVertical:4},leftContent:{flexDirection:"row",alignItems:"center",gap:12},iconContainer:{width:40,height:40,borderRadius:20,overflow:"hidden",alignItems:"center",justifyContent:"center"},icon:{width:40,height:40,borderRadius:20},textContainer:{gap:2},name:{fontSize:14,fontWeight:"400"},code:{fontSize:12,fontWeight:"300"}});function Qa({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:s}=O();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:If.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[If.title,{color:s.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(i=>jsxRuntime.jsx(mc,{currency:i,isSelected:r.toLowerCase()===i.currency_code.toLowerCase(),onSelect:o},i.currency_code))]})}var If=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function hc({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:s,borderTopLeftRadius:i,borderTopRightRadius:a}){let{colors:l,fonts:u,components:c}=O(),[b,T]=ci.useState(""),w=o.map(x=>r.find(v=>v.currency_code.toLowerCase()===x.toLowerCase())).filter(x=>x!==void 0),p=r.filter(x=>!o.includes(x.currency_code.toLowerCase())),y=x=>{if(!b)return x;let v=b.toLowerCase();return x.filter(h=>h.name.toLowerCase().includes(v)||h.currency_code.toLowerCase().includes(v))},f=y(w),k=y(p),C=x=>{s(x),t(false),T("");},d=()=>{t(false),T("");};return jsxRuntime.jsxs(wt,{visible:e,onClose:d,closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsxRuntime.jsx(Hr,{title:"Currency",showBack:false,onClose:d}),jsxRuntime.jsx(reactNative.View,{style:Qi.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Qi.searchInput,{backgroundColor:c.search.backgroundColor,color:c.search.inputColor,fontFamily:u.regular,borderRadius:c.input.borderRadius,borderWidth:c.input.borderWidth,borderColor:c.input.borderColor}],value:b,onChangeText:T,placeholder:"Search",placeholderTextColor:c.search.placeholderColor})}),jsxRuntime.jsx(dt,{style:Qi.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{style:Qi.listContent,children:[jsxRuntime.jsx(Qa,{title:"Popular currencies",currencies:f,selectedCurrency:n,onSelect:C}),f.length>0&&k.length>0&&jsxRuntime.jsx(reactNative.View,{style:Qi.sectionSpacer}),jsxRuntime.jsx(Qa,{title:"All currencies",currencies:k,selectedCurrency:n,onSelect:C}),f.length===0&&k.length===0&&jsxRuntime.jsx(reactNative.View,{style:Qi.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Qi.noResultsText,{color:c.container.subtitleColor,fontFamily:u.regular}],children:"No currencies found"})})]})})]})}var Qi=reactNative.StyleSheet.create({searchContainer:{marginTop:8,paddingHorizontal:18,paddingBottom:12},searchInput:{padding:16,fontSize:14},listContainer:{flex:1,paddingHorizontal:12},listContent:{paddingBottom:72},sectionSpacer:{height:8},noResultsContainer:{paddingVertical:32,alignItems:"center"},noResultsText:{fontSize:14}});function Ou(e){try{return new Intl.NumberFormat("en",{style:"currency",currency:e.toUpperCase(),minimumFractionDigits:0,maximumFractionDigits:0}).format(0).replace(/\d/g,"").trim()}catch{return e.toUpperCase()}}function bc({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:s,destinationChainType:i,destinationChainId:a,destinationTokenAddress:l,onDepositSuccess:u,onDepositError:c,borderTopLeftRadius:b,borderTopRightRadius:T,sheetBorderRadius:w}){let{colors:p,fonts:y,components:f}=O(),[k,C]=ci.useState(""),[d,x]=ci.useState("usd"),[v,h]=ci.useState(false),[g,S]=ci.useState(false),[_,A]=ci.useState([]),[W,I]=ci.useState(false),[F,z]=ci.useState(null),[j,me]=ci.useState(null),[Xe,Ie]=ci.useState("amount"),[ie,Pe]=ci.useState(null),[Oe,fe]=ci.useState(true),[Ce,ke]=ci.useState(null),[Z,pe]=ci.useState(false),St=ci.useRef(null),ve=ci.useRef(false);ci.useEffect(()=>{St.current=ie;},[ie]),ci.useEffect(()=>{ve.current=Z;},[Z]);let[lt,je]=ci.useState([]),[Te,rt]=ci.useState(true),[ot,se]=ci.useState(60),[he,Ae]=ci.useState([]),[we,ge]=ci.useState([]),[Jt,nt]=ci.useState(null),[We,yr]=ci.useState(null),[ce,re]=ci.useState(true),[Se,mt]=ci.useState(null),[ht,de]=ci.useState(false),[Ee,$t]=ci.useState(null),[it,ir]=ci.useState(false),[Ht,sr]=ci.useState(false),[Dt,ue]=ci.useState(false),[Ve,D]=ci.useState(null),H=r??Xe,E=ci.useRef(null),P=he.find(L=>L.currency_code.toLowerCase()===d.toLowerCase()),U=ci.useCallback(L=>{Ie(L),L==="quotes"?o?.(L,_.length):o?.(L);},[_.length,o]);ci.useEffect(()=>{async function L(){try{let ye=await fa();yr(ye);}catch(ye){console.error("Error fetching user IP:",ye);}finally{re(false);}}L();},[]),ci.useEffect(()=>{async function L(){try{let ye=await gn({external_user_id:e,recipient_address:s,destination_chain_type:i,destination_chain_id:a,destination_token_address:l},t);je(ye.data);}catch(ye){console.error("Error fetching wallets:",ye),z("Failed to load wallet addresses");}finally{rt(false);}}L();},[e,s,i,a,l,t]);let K=n||Jt?.symbol.toUpperCase()||"USDC",Ye=cs(Jt?.icon_urls,"png")||Jt?.icon_url,G=cs(Jt?.chain_icon_urls,"png")||Jt?.chain_icon_url;ci.useEffect(()=>{async function L(){try{let ye=await pa(t);Ae(ye.data),ge(ye.preferred||[]);}catch(ye){console.error("Error fetching fiat currencies:",ye);}}L();},[t]),ci.useEffect(()=>{if(v||he.length===0||!We?.alpha2)return;let L=We.alpha2.toUpperCase(),ye=he.find(vt=>vt.country_codes.includes(L));if(ye)x(ye.currency_code.toLowerCase()),!k&&!g&&C(String(ye.default_amount??100));else if(!k&&!g){let vt=he.find(eo=>eo.currency_code.toLowerCase()==="usd");vt&&C(String(vt.default_amount??100));}},[he,We,v,k,g]),ci.useEffect(()=>{if(he.length!==0){if(E.current!==null&&E.current!==d){let L=he.find(ye=>ye.currency_code.toLowerCase()===d.toLowerCase());L&&C(String(L.default_amount??100));}E.current=d;}},[d,he]),ci.useEffect(()=>{async function L(){try{let ye=await id({chain_type:i||"",chain_id:a||"",token_address:l||""},t);nt(ye);}catch(ye){console.error("Error fetching supported tokens:",ye);}}L();},[i,a,l,t]),ci.useEffect(()=>{async function L(){if(!(!l||!a||!i)&&!ce){de(true);try{let ye=await ld({country_code:We?.alpha2?.toUpperCase()||"US",subdivision_code:We?.state||void 0,token_address:l,chain_id:a,chain_type:i},t);mt(ye);}catch(ye){console.error("Error fetching default onramp token:",ye);}finally{de(false);}}}L();},[l,a,i,We,ce,t]),ci.useEffect(()=>{let L=parseFloat(k);if(isNaN(L)||L<=0){A([]),me(null);return}if(!Se||ht){A([]),Pe(null);return}let ye=he.find(eo=>eo.currency_code.toLowerCase()===d.toLowerCase());if(ye){if(L<ye.minimum_amount){A([]),Pe(null),me(`Minimum amount is ${Ou(d)}${ye.minimum_amount.toLocaleString()}`);return}if(L>ye.maximum_amount){A([]),Pe(null),me(`Maximum amount is ${Ou(d)}${ye.maximum_amount.toLocaleString()}`);return}}me(null);let vt=setTimeout(()=>{et(L);},500);return ()=>clearTimeout(vt)},[k,d,t,Se,ht,he]);let et=async L=>{if(!Se){z("Loading token information...");return}I(true),z(null);try{let ye={country_code:We?.alpha2?.toUpperCase()||"US",source_amount:L.toString(),source_currency:d.toLowerCase(),destination_currency:Se.destination_currency,destination_network:Se.destination_network,subdivision_code:We?.state||void 0},vt=await sd(ye,t);A(vt.data);let eo=ve.current,_o=St.current;if(eo&&_o){let un=vt.data.find(Dr=>Dr.service_provider===_o.service_provider);if(un){if(Pe(un),vt.data.length>0){let Dr=vt.data[0];Ce||ke(Dr.service_provider),fe(un.service_provider===Ce);}}else if(vt.data.length>0){let Dr=vt.data[0];Pe(Dr),ke(Dr.service_provider),fe(!0),pe(!1);}}else if(vt.data.length>0){let un=vt.data[0];Pe(un),ke(un.service_provider),fe(!0);}se(60);}catch(ye){console.error("Failed to fetch quotes:",ye),z("Failed to fetch quotes. Please try again."),A([]);}finally{I(false);}};ci.useEffect(()=>{if(_.length===0)return;let L=setInterval(()=>{se(ye=>{if(ye<=1){let vt=parseFloat(k);return !isNaN(vt)&&vt>0&&et(vt),60}return ye-1});},1e3);return ()=>clearInterval(L)},[_.length,k]);let Me=L=>{(/^\d*\.?\d{0,2}$/.test(L)||L==="")&&(C(L),S(true));},Vr=L=>{C(L.toString()),S(true);},qt=async()=>{if(ie&&Se)try{let L=Se.destination_token_metadata.chain_type,ye=yn(lt,L);if(!ye?.address){z("Wallet address not available");return}let vt={service_provider:ie.service_provider,country_code:ie.country_code?.toUpperCase()||We?.alpha2?.toUpperCase()||"US",source_currency:ie.source_currency,source_amount:k,destination_currency:ie.destination_currency,destination_network:ie.destination_network,wallet_address:ye.address,subdivision_code:We?.state||void 0},eo=await ad(vt,t);$t({provider:ie,sourceCurrency:d,sourceAmount:k,sessionUrl:eo.url}),D(eo.url),ue(!0);}catch(L){console.error("Failed to create session:",L),z("Failed to start payment flow"),c?.({message:"Failed to start payment flow",error:L});}},wi=Ou(d),Y=()=>{ue(false),U("onramp"),u?.({message:"Payment flow completed"});},Nc=()=>jsxRuntime.jsx($b,{visible:Dt,onClose:Y,url:Ve,providerName:ie?.service_provider_display_name||"Complete Payment",colors:p,fonts:y,borderTopLeftRadius:w?.webView?.borderTopLeftRadius??b,borderTopRightRadius:w?.webView?.borderTopRightRadius??T});return H==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:Q.amountViewContainer,children:[jsxRuntime.jsxs(dt,{style:Q.scrollContainer,contentContainerStyle:Q.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:Q.currencySelector,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ir(true),style:[Q.currencyButton,{backgroundColor:f.card.backgroundColor,borderRadius:f.input.borderRadius,borderWidth:f.input.borderWidth,borderColor:f.input.borderColor}],children:[P&&jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(xe(P,"png"))},style:Q.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Q.currencyText,{color:f.card.titleColor,fontFamily:y.medium}],children:d.toUpperCase()}),jsxRuntime.jsx(Kt,{size:16,color:f.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(hc,{open:it,onOpenChange:ir,currencies:he,preferredCurrencyCodes:we,selectedCurrency:d,onSelectCurrency:L=>{x(L.toLowerCase()),h(true);},borderTopLeftRadius:w?.currencyModal?.borderTopLeftRadius??b,borderTopRightRadius:w?.currencyModal?.borderTopRightRadius??T}),jsxRuntime.jsx(reactNative.View,{style:Q.amountContainer,children:jsxRuntime.jsxs(reactNative.View,{style:Q.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Q.currencySymbol,{color:f.container.titleColor,fontFamily:y.medium}],children:wi}),jsxRuntime.jsx(reactNative.TextInput,{style:[Q.amountInput,{color:f.container.titleColor,fontFamily:y.medium}],value:k,onChangeText:Me,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:p.foregroundMuted})]})}),P?.suggested_amounts&&P.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:Q.quickAmounts,children:P.suggested_amounts.map(L=>jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Vr(L),style:[Q.quickAmountButton,{backgroundColor:f.card.backgroundColor,borderRadius:f.button.borderRadius,borderWidth:parseFloat(k)===L?2:f.button.borderWidth,borderColor:parseFloat(k)===L?p.primary:f.button.borderColor}],children:jsxRuntime.jsxs(reactNative.Text,{style:[Q.quickAmountText,{color:f.card.titleColor,fontFamily:y.medium}],children:[wi,L.toLocaleString()]})},L))}),j&&jsxRuntime.jsx(reactNative.Text,{style:[Q.validationError,{color:p.error,fontFamily:y.regular}],children:j}),jsxRuntime.jsxs(reactNative.View,{style:Q.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:Q.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[Q.providerLabel,{color:f.card.labelColor,fontFamily:y.medium}],children:"Provider"}),_.length>0&&!W&&jsxRuntime.jsxs(reactNative.Text,{style:[Q.refreshText,{color:f.card.labelRightColor,fontFamily:y.regular}],children:["Refreshing in ",ot,"s"]})]}),jsxRuntime.jsx(gr,{cardTokens:f.depositCard.quoteProvider.card,onPress:W||_.length===0?void 0:()=>sr(true),contentStyle:reactNative.StyleSheet.flatten([Q.providerButton,(W||_.length===0)&&Q.disabled]),children:W?jsxRuntime.jsxs(reactNative.View,{style:Q.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:p.primary}),jsxRuntime.jsx(reactNative.Text,{style:[Q.loadingText,{color:f.container.subtitleColor,fontFamily:y.regular}],children:"Finding best rates..."})]}):ie?jsxRuntime.jsxs(reactNative.View,{style:Q.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:Q.providerInfo,children:[Oe&&jsxRuntime.jsx(reactNative.Text,{style:[Q.autoPickedText,{color:f.container.subtitleColor,fontFamily:y.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:Q.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(hl(ie.icon_urls,"png",ie.icon_url))},style:Q.providerIconImage},`provider-${ie.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[Q.providerName,{color:f.card.titleColor,fontFamily:y.medium}],children:ie.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[Q.bestPriceText,{color:f.container.subtitleColor,fontFamily:y.regular}],children:[ie.destination_amount.toFixed(2)," ",K]})]})]})]}),jsxRuntime.jsx(Sr,{size:20,color:f.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[Q.noProviderText,{color:f.container.subtitleColor,fontFamily:y.regular}],children:parseFloat(k)>0?"No providers available":"Enter an amount to see providers"})}),F&&jsxRuntime.jsx(reactNative.Text,{style:[Q.errorText,{color:p.error,fontFamily:y.regular}],children:F})]}),jsxRuntime.jsxs(wt,{visible:Ht,onClose:()=>sr(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:w?.providerModal?.borderTopLeftRadius??b,borderTopRightRadius:w?.providerModal?.borderTopRightRadius??T,children:[jsxRuntime.jsx(Hr,{title:"Select Provider",showBack:false,onClose:()=>sr(false)}),jsxRuntime.jsx(dt,{style:Q.providerModalList,contentContainerStyle:Q.providerModalListContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:Q.quotesList,children:_.map(L=>{let ye=ie?.service_provider===L.service_provider;return jsxRuntime.jsxs(gr,{cardTokens:f.depositCard.quoteProvider.card,onPress:()=>{Pe(L),pe(true),fe(L.service_provider===Ce),sr(false);},contentStyle:reactNative.StyleSheet.flatten([Q.quoteItem,ye&&{borderWidth:2,borderColor:p.primary}]),children:[jsxRuntime.jsxs(reactNative.View,{style:Q.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(hl(L.icon_urls,"png",L.icon_url))},style:Q.providerIconImage}),jsxRuntime.jsx(reactNative.View,{children:jsxRuntime.jsx(reactNative.Text,{style:[Q.quoteName,{color:f.card.titleColor,fontFamily:y.medium}],children:L.service_provider_display_name})})]}),jsxRuntime.jsxs(reactNative.View,{style:Q.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[Q.quoteAmount,{color:f.card.textRightColor,fontFamily:y.medium}],children:[L.destination_amount.toFixed(2)," ",K]}),jsxRuntime.jsxs(reactNative.Text,{style:[Q.quoteSource,{color:f.card.subtextRightColor,fontFamily:y.regular}],children:["Fee: ",wi,L.total_fee.toFixed(2)]})]})]},L.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[Q.continueButtonContainer,{backgroundColor:p.background}],children:jsxRuntime.jsx(reactNative.View,{style:{opacity:W||Te||!ie||parseFloat(k)<=0?.5:1},children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:qt,disabled:W||Te||!ie||parseFloat(k)<=0,style:[Q.continueButton,{backgroundColor:f.container.buttonColor,borderRadius:f.button.borderRadius,borderWidth:f.button.borderWidth,borderColor:f.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[Q.continueButtonText,{color:f.container.buttonTitleColor,fontFamily:y.medium}],children:Te?"Loading...":"Continue"})})})})]}),Nc()]}):H==="onramp"&&Ee?jsxRuntime.jsxs(reactNative.View,{style:Q.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(hl(Ee.provider.icon_urls,"png",Ee.provider.icon_url))},style:Q.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[Q.onrampTitle,{color:f.container.titleColor,fontFamily:y.medium}],children:["Complete transaction with ",Ee.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[Q.onrampSubtitle,{color:f.container.subtitleColor,fontFamily:y.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[Q.flowDiagram,{backgroundColor:f.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Q.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ar(`/icons/currencies/png/${Ee.sourceCurrency.toLowerCase()}.png`)},style:Q.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[Q.flowLabel,{color:f.card.subtitleColor,fontFamily:y.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[Q.flowValue,{color:f.card.titleColor,fontFamily:y.medium}],children:Ee.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(Sr,{size:16,color:f.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:Q.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:Q.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:cs(Se?.destination_token_metadata?.icon_urls,"png")||Se?.destination_token_metadata?.icon_url||ar("/icons/tokens/png/usdc.png")},style:Q.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:cs(Se?.destination_token_metadata?.chain?.icon_urls,"png")||Se?.destination_token_metadata?.chain?.icon_url||ar("/icons/networks/png/polygon.png")},style:[Q.flowNetworkBadge,{borderColor:p.background,borderRadius:f.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[Q.flowLabel,{color:f.card.subtitleColor,fontFamily:y.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[Q.flowValue,{color:f.card.titleColor,fontFamily:y.medium}],children:"USDC"})]}),jsxRuntime.jsx(Sr,{size:16,color:f.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:Q.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:Q.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Ye||ar("/icons/tokens/png/usdc.png")},style:Q.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:G||ar("/icons/networks/png/polygon.png")},style:[Q.flowNetworkBadge,{borderColor:p.background,borderRadius:f.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[Q.flowLabel,{color:f.card.subtitleColor,fontFamily:y.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[Q.flowValue,{color:f.card.titleColor,fontFamily:y.medium}],children:K})]})]}),jsxRuntime.jsx(reactNative.View,{style:[Q.onrampInfoBox,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[Q.onrampInfoText,{color:f.card.descriptionColor,fontFamily:y.regular}],children:"The wallet address displayed in the payment provider is a temporary deposit address. Your funds will be automatically converted and deposited into your account."})})]}):null}function $b({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:s,borderTopLeftRadius:i,borderTopRightRadius:a}){return jsxRuntime.jsxs(wt,{visible:e,onClose:t,closeOnBackdropPress:false,enablePanDownToClose:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsxRuntime.jsxs(reactNative.View,{style:Yi.header,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:Yi.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx($e,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Yi.headerTitle,{color:n.foreground,fontFamily:s.medium}],children:o}),jsxRuntime.jsx(reactNative.View,{style:Yi.headerSpacer})]}),r&&jsxRuntime.jsx(reactNative.View,{style:Yi.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:r},style:Yi.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:Yi.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:n.primary})})})})]})}var Yi=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},headerButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},headerSpacer:{width:28,height:28},container:{flex:1},webView:{flex:1},loading:{position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"center"}}),Q=reactNative.StyleSheet.create({amountViewContainer:{flex:1},scrollContainer:{flex:1},scrollContent:{padding:16,paddingBottom:16},currencySelector:{alignItems:"center",marginBottom:16},currencyButton:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:12,paddingVertical:8},currencyText:{fontSize:14,fontWeight:"500"},currencyIcon:{width:24,height:24,borderRadius:12},amountContainer:{alignItems:"center",marginBottom:24},amountInputRow:{flexDirection:"row",alignItems:"center",marginBottom:8},currencySymbol:{fontSize:48,fontWeight:"300"},amountInput:{fontSize:48,fontWeight:"300",minWidth:50},usdcPreview:{fontSize:14},quickAmounts:{flexDirection:"row",justifyContent:"center",gap:12,marginBottom:24},quickAmountButton:{paddingHorizontal:20,paddingVertical:10},quickAmountText:{fontSize:14,fontWeight:"500"},validationError:{fontSize:12,textAlign:"center",marginTop:12,paddingHorizontal:16},providerSection:{marginBottom:24},providerHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},providerLabel:{fontSize:12,fontWeight:"500"},refreshText:{fontSize:10},providerButton:{padding:16},disabled:{opacity:.5},providerLoading:{flexDirection:"row",alignItems:"center",gap:12},loadingText:{fontSize:14},providerContent:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},providerInfo:{flex:1},autoPickedText:{fontSize:12,marginBottom:6},providerRow:{flexDirection:"row",alignItems:"center",gap:12},providerIcon:{width:32,height:32,borderRadius:16},providerIconPlaceholder:{width:32,height:32,borderRadius:8},providerIconImage:{width:32,height:32,borderRadius:8},providerName:{fontSize:14,fontWeight:"500"},bestPriceText:{fontSize:11,marginTop:2},noProviderText:{fontSize:14,textAlign:"center"},errorText:{fontSize:12,marginTop:8},continueButtonContainer:{padding:16,paddingBottom:48},continueButton:{paddingVertical:16,alignItems:"center"},continueButtonText:{fontSize:16,fontWeight:"600"},webViewHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},webViewHeaderButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},webViewHeaderTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},webViewHeaderSpacer:{width:28,height:28},webViewContainer:{flex:1},webView:{flex:1},webViewLoading:{position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"center"},providerModalList:{flex:1,paddingHorizontal:12,marginTop:8},providerModalListContent:{paddingBottom:72},quotesList:{gap:8,paddingBottom:24,minHeight:468},quoteItem:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",padding:12},quoteLeft:{flexDirection:"row",alignItems:"center",gap:12},quoteIcon:{width:40,height:40,borderRadius:20},quoteName:{fontSize:14,fontWeight:"500"},quoteRight:{alignItems:"flex-end"},quoteAmount:{fontSize:14,fontWeight:"500"},quoteSource:{fontSize:12},onrampContainer:{flex:1,padding:16,alignItems:"center",paddingTop:24},onrampProviderIcon:{width:64,height:64,borderRadius:16},onrampTitle:{fontSize:18,fontWeight:"600",textAlign:"center",marginTop:20,marginBottom:8,paddingHorizontal:16},onrampSubtitle:{fontSize:14,textAlign:"center",marginBottom:24},flowDiagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:20,paddingHorizontal:24,borderRadius:12,width:"100%"},flowIconWithBadge:{position:"relative",width:24,height:24,marginBottom:4},flowIconImageNoBadge:{width:24,height:24,borderRadius:12},flowNetworkBadge:{position:"absolute",bottom:-4,right:-6,width:14,height:14,borderWidth:2},onrampInfoBox:{marginTop:16,padding:16,width:"100%"},onrampInfoText:{fontSize:13,lineHeight:20},flowStep:{alignItems:"center"},flowIcon:{width:28,height:28,borderRadius:14,marginBottom:4},flowIconImage:{width:24,height:24,borderRadius:12,marginBottom:4},flowLabel:{fontSize:10},flowValue:{fontSize:14,fontWeight:"500"}});function Yb(e){try{let t=new Date(e);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}catch{return e}}function Gb(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Sc({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=O(),s=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=oe(xe(e.destination_token_metadata,"png")||ar("/icons/tokens/png/usdc.png")),u=i?"Deposit Processing":"Deposit Completed",c=Yb(e.created_at||new Date().toISOString()),b=Gb(e.source_amount_usd);return jsxRuntime.jsxs(gr,{cardTokens:s,onPress:t,contentStyle:Ln.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Ln.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:l},style:Ln.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Ln.statusBadge,{backgroundColor:i?r.warning:r.success,borderColor:s.backgroundColor}],children:i?jsxRuntime.jsx(is,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx($e,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ln.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ln.title,{color:s.titleColor,fontFamily:o.medium}],children:u}),jsxRuntime.jsx(reactNative.Text,{style:[Ln.dateTime,{color:s.subtitleColor,fontFamily:o.regular}],children:c})]}),jsxRuntime.jsxs(reactNative.View,{style:Ln.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ln.amount,{color:s.textRightColor,fontFamily:o.medium}],children:b}),jsxRuntime.jsx(Sr,{size:20,color:s.actionColor,strokeWidth:2})]})]})}var Ln=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-4,right:-4,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center",borderWidth:2},textContainer:{flex:1,gap:2},title:{fontSize:16,fontWeight:"500"},dateTime:{fontSize:13},rightContainer:{flexDirection:"row",alignItems:"center",gap:8},amount:{fontSize:16,fontWeight:"500"}});function Vf(e,t){let r={solana:"Solana",ethereum:"Ethereum",bitcoin:"Bitcoin"};return e==="ethereum"?{1:"Ethereum",137:"Polygon",8453:"Base",42161:"Arbitrum",10:"Optimism"}[t]||r[e]||e:r[e]||e}function Df(e,t=6){if(!e)return "\u2014";try{let r=Number(e)/Math.pow(10,t);return r===0?"0.00":r>=1?r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:8,minimumSignificantDigits:2,maximumSignificantDigits:6})}catch{return "0.00"}}function Zb(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var Lf=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function Bf(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Xb(e){try{let t=new Date(e);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}catch{return e}}function eC({count:e=4}){let{colors:t,components:r}=O(),o=ci.useRef(new reactNative.Animated.Value(.5)).current,n=r.depositTracker.executionRow.card,s=t.cardHover;return ci.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[o]),jsxRuntime.jsx(reactNative.View,{style:Gi.list,children:Array.from({length:e}).map((i,a)=>jsxRuntime.jsxs(reactNative.View,{style:[Gi.row,{backgroundColor:n.backgroundColor,borderRadius:n.borderRadius??12,borderWidth:n.borderWidth,borderColor:n.borderColor}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Gi.icon,{backgroundColor:s,opacity:o}]}),jsxRuntime.jsxs(reactNative.View,{style:Gi.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Gi.titleBar,{backgroundColor:s,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Gi.subtitleBar,{backgroundColor:s,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Gi.amountBar,{backgroundColor:s,opacity:o}]})]},a))})}var Gi=reactNative.StyleSheet.create({list:{paddingTop:16,paddingHorizontal:16,gap:12},row:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},icon:{width:40,height:40,borderRadius:20,marginRight:12},textBlock:{flex:1,gap:6},titleBar:{height:14,width:"65%",borderRadius:7},subtitleBar:{height:11,width:"45%",borderRadius:5.5},amountBar:{height:14,width:50,borderRadius:7,marginLeft:12}});function Lu({active:e,onClose:t,executions:r,externalUserId:o,publishableKey:n}){let{colors:s,fonts:i,components:a}=O(),[l,u]=ci.useState(r),[c,b]=ci.useState(false),[T,w]=ci.useState(null),[p,y]=ci.useState(false),f=ci.useRef(null);ci.useEffect(()=>{if(!e||!o)return;let g=async()=>{b(true);try{let A=[...(await bn(o,n,"deposit")).data].sort((W,I)=>{let F=W.created_at?new Date(W.created_at).getTime():0;return (I.created_at?new Date(I.created_at).getTime():0)-F});u(A);}catch(_){console.error("Failed to fetch executions:",_),u(r);}finally{b(false);}};g();let S=setInterval(g,1e4);return ()=>clearInterval(S)},[e,o,n,r]),ci.useEffect(()=>{r.length>0&&u(g=>{let S=new Set(g.map(A=>A.id)),_=r.filter(A=>!S.has(A.id));return _.length>0?[..._,...g]:g});},[r]),ci.useEffect(()=>{e||w(null);},[e]);let k=g=>{w(g);},C=()=>{w(null),y(false);},d=()=>{w(null),t();},x=()=>{if(!T)return null;let g=T,S=g.status==="pending"||g.status==="waiting"||g.status==="delayed",_=g.status==="succeeded",A=oe(xe(g.destination_token_metadata,"png")||ar("/icons/tokens/png/usdc.png")),W=g.provider_metadata?.details,I=W?.currencyIn,F=W?.currencyOut;I?.currency?.symbol||"USDC";F?.currency?.symbol||"USDC";let me=Df(g.source_amount_base_unit,g.source_token_metadata?.decimals),Xe=Df(g.destination_amount_base_unit,g.destination_token_metadata?.decimals),Ie=Zb(g.source_amount_usd),ie=Vf(g.source_chain_type,g.source_chain_id),Pe=Vf(g.destination_chain_type,g.destination_chain_id),Oe=()=>{g.explorer_url&&reactNative.Linking.openURL(g.explorer_url);},fe=()=>{g.destination_explorer_url&&reactNative.Linking.openURL(g.destination_explorer_url);};return jsxRuntime.jsxs(dt,{ref:f,style:be.scrollContainer,contentContainerStyle:be.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:be.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:be.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:A},style:be.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[be.statusBadge,{backgroundColor:S?s.warning:s.success,borderColor:s.background}],children:S?jsxRuntime.jsx(Kt,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx($e,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:be.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[be.statusDot,{backgroundColor:S?s.warning:s.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[be.statusText,{color:a.container.titleColor,fontFamily:i.semibold}],children:S?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[be.dateText,{color:a.container.subtitleColor,fontFamily:i.regular}],children:Xb(g.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[be.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:be.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[be.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[be.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:[me," ",Bf(g.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[be.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:be.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[be.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[be.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:[Xe," ",Bf(g.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[be.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:be.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[be.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[be.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Ie})]}),jsxRuntime.jsx(reactNative.View,{style:[be.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:be.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[be.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[be.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:ie})]}),jsxRuntime.jsx(reactNative.View,{style:[be.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:be.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[be.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[be.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Pe})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let Ce=!p;y(Ce),Ce?setTimeout(()=>{f.current?.scrollToEnd({animated:true});},100):f.current?.scrollTo({y:0,animated:true});},style:be.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[be.toggleText,{color:a.container.actionTitle,fontFamily:i.regular}],children:p?"See less":"See more details"}),p?jsxRuntime.jsx(Wo,{size:14,color:a.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Kt,{size:14,color:a.container.actionColor,strokeWidth:2})]}),p&&jsxRuntime.jsxs(reactNative.View,{style:[be.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[g.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:Oe,style:be.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[be.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:be.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[be.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Lf(g.transaction_hash)}),jsxRuntime.jsx(Ao,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[be.cardDivider,{backgroundColor:s.border}]})]}),g.destination_explorer_url&&_&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:fe,style:be.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[be.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:be.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[be.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Lf(g.destination_transaction_hashes[0])}),jsxRuntime.jsx(Ao,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]})]})]})},v=c&&l.length===0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Hr,{title:T?"Deposit Details":"Deposit Tracker",onClose:d,showClose:!T,showBack:!!T,onBack:C}),T?x():v?jsxRuntime.jsx(eC,{}):jsxRuntime.jsx(dt,{style:be.scrollContainer,contentContainerStyle:be.scrollContent,showsVerticalScrollIndicator:false,children:l.length===0?jsxRuntime.jsxs(reactNative.View,{style:be.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[be.emptyText,{color:a.container.titleColor,fontFamily:i.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[be.emptySubtext,{color:a.container.subtitleColor,fontFamily:i.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:be.executionsList,children:l.map(g=>jsxRuntime.jsx(Sc,{execution:g,onPress:()=>k(g)},g.id))})})]})}var be=reactNative.StyleSheet.create({scrollContainer:{flex:1,paddingTop:16},scrollContent:{paddingHorizontal:16,paddingBottom:40},emptyContainer:{paddingVertical:40,paddingHorizontal:16,alignItems:"center"},emptyText:{fontSize:14,marginBottom:4},emptySubtext:{fontSize:12},executionsList:{paddingTop:8,gap:12},detailsContent:{paddingHorizontal:16,paddingBottom:32},iconSection:{alignItems:"center",marginBottom:24},iconWrapper:{position:"relative",marginBottom:12},tokenIcon:{width:72,height:72,borderRadius:36},statusBadge:{position:"absolute",bottom:0,right:0,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center",borderWidth:3},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16,fontWeight:"600"},dateText:{fontSize:14},card:{borderRadius:12,marginBottom:12,overflow:"hidden"},cardRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},cardRowRight:{flexDirection:"row",alignItems:"center",gap:8},cardDivider:{height:1,marginHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"},toggleButton:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12,paddingHorizontal:4},toggleText:{fontSize:14},buttonSection:{marginTop:12,gap:10},actionButton:{flexDirection:"row",alignItems:"center",paddingVertical:16,paddingHorizontal:16,borderRadius:12},buttonIconLeft:{marginRight:12},buttonIconRight:{marginLeft:12},buttonText:{color:"#FFFFFF",fontSize:14,fontWeight:"600",flex:1,textAlign:"left"},hintText:{fontSize:12,textAlign:"center",marginTop:8}});function Ya(e,t=true){let[r,o]=ci.useState(null),[n,s]=ci.useState(null),[i,a]=ci.useState(false),[l,u]=ci.useState(false),[c,b]=ci.useState(null),[T,w]=ci.useState(null);ci.useEffect(()=>{!t||r||(a(true),fa().then(k=>{o(k),b(null);}).catch(k=>{b(k instanceof Error?k:new Error(String(k)));}).finally(()=>{a(false);}));},[t,r]),ci.useEffect(()=>{!t||!e||n||(u(true),ma(e).then(k=>{s(k),w(null);}).catch(k=>{w(k instanceof Error?k:new Error(String(k)));}).finally(()=>{u(false);}));},[t,e,n]);let p=i||l,y=c||T||null,f=null;if(r&&n){let k=n.blocked_country_codes||[],C=r.alpha2.toUpperCase();f=!k.some(d=>d.toUpperCase()===C);}return {isAllowed:f,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:p,error:y}}var Wu="unifold_recent_tokens",iC=5,Uf=[{symbol:"ETH",chainType:"ethereum",chainId:"1"},{symbol:"SOL",chainType:"solana",chainId:"mainnet"},{symbol:"USDC",chainType:"solana",chainId:"mainnet"},{symbol:"POL",chainType:"ethereum",chainId:"137"},{symbol:"BNB",chainType:"ethereum",chainId:"56"},{symbol:"BTC",chainType:"bitcoin",chainId:"mainnet"}];async function Rc(){try{let e=await Ld__default.default.getItem(Wu);return e?JSON.parse(e):[]}catch{return []}}async function sC(e){try{let r=(await Rc()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,iC);await Ld__default.default.setItem(Wu,JSON.stringify(o));}catch{}}async function aC(e){try{let r=(await Rc()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await Ld__default.default.setItem(Wu,JSON.stringify(r)),r}catch{return []}}function Eu({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:s,borderTopLeftRadius:i,borderTopRightRadius:a}){let{colors:l,fonts:u,components:c}=O(),[b,T]=ci.useState(""),[w,p]=ci.useState([]);ci.useEffect(()=>{e&&Rc().then(p);},[e]),ci.useEffect(()=>{e||T("");},[e]);let y=ci.useMemo(()=>{let v=[];return r.forEach(h=>{h.chains.forEach(g=>{v.push({token:h,chain:g});});}),v},[r]),f=ci.useMemo(()=>{let v=[],h=new Set,g=(S,_,A,W)=>{let I=`${S}-${_}:${A}`;if(h.has(I))return;let F=r.find(j=>j.symbol===S);if(!F)return;let z=F.chains.find(j=>j.chain_type===_&&j.chain_id===A);z&&(h.add(I),v.push({token:F,chain:z,isRecent:W}));};return w.forEach(S=>{g(S.symbol,S.chainType,S.chainId,true);}),Uf.forEach(S=>{g(S.symbol,S.chainType,S.chainId,false);}),v},[r,w]),k=ci.useMemo(()=>{if(!b.trim())return y;let v=b.toLowerCase();return y.filter(({token:h,chain:g})=>h.symbol.toLowerCase().includes(v)||h.name.toLowerCase().includes(v)||g.chain_name.toLowerCase().includes(v))},[y,b]),C=(v,h,g)=>Uf.some(S=>S.symbol===v&&S.chainType===h&&S.chainId===g),d=async(v,h)=>{let g=`${h.chain_type}:${h.chain_id}`;if(!C(v.symbol,h.chain_type,h.chain_id)){await sC({symbol:v.symbol,chainType:h.chain_type,chainId:h.chain_id});let S=await Rc();p(S);}T(""),s(v.symbol,g),t();},x=async(v,h)=>{let g=await aC({symbol:v.symbol,chainType:h.chain_type,chainId:h.chain_id});p(g);};return jsxRuntime.jsxs(wt,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:true,heightPercent:.9,startExpanded:false,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsxRuntime.jsxs(reactNative.View,{style:Ct.header,children:[jsxRuntime.jsx(reactNative.View,{style:Ct.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Ct.headerTitle,{color:c.header.titleColor,fontFamily:u.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:Ct.closeButton,children:jsxRuntime.jsx(ct,{size:20,color:c.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:Ct.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Ct.searchInput,{backgroundColor:c.search.backgroundColor,color:c.search.inputColor,fontFamily:u.regular,borderRadius:c.input.borderRadius,borderWidth:c.input.borderWidth,borderColor:c.input.borderColor}],placeholder:"Search",placeholderTextColor:c.search.placeholderColor,value:b,onChangeText:T,autoCapitalize:"none",autoCorrect:false})}),f.length>0&&!b&&jsxRuntime.jsxs(reactNative.View,{style:Ct.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ct.sectionLabel,{color:c.list.titleSectionColor,fontFamily:u.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:Ct.quickSelectScroll,children:f.map(({token:v,chain:h,isRecent:g})=>{let S=`${h.chain_type}:${h.chain_id}`;v.symbol===o&&S===n;return jsxRuntime.jsxs(reactNative.View,{children:[g&&jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>x(v,h),style:Ct.removeButton,children:jsxRuntime.jsx(ct,{size:12,color:l.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>d(v,h),activeOpacity:.7,style:[Ct.quickSelectItem,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ct.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(xe(v,"png"))},style:Ct.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(xe(h,"png"))},style:[Ct.quickSelectChainBadge,{borderColor:c.card.backgroundColor,borderRadius:c.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:Ct.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ct.quickSelectSymbol,{color:c.card.titleColor,fontFamily:u.medium}],children:v.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Ct.quickSelectChain,{color:c.card.subtitleColor,fontFamily:u.regular}],children:h.chain_name})]})]})]},`quick-${v.symbol}-${S}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[Ct.sectionLabel,{color:c.list.titleSectionColor,fontFamily:u.regular}],children:"All supported tokens"}),jsxRuntime.jsx(dt,{style:Ct.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:Ct.tokenListContent,children:k.length===0?jsxRuntime.jsx(reactNative.View,{style:Ct.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Ct.emptyText,{color:l.foregroundMuted,fontFamily:u.regular}],children:"No tokens found"})}):k.map(({token:v,chain:h})=>{let g=`${h.chain_type}:${h.chain_id}`,S=v.symbol===o&&g===n;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>d(v,h),activeOpacity:.7,style:[Ct.tokenItem,{backgroundColor:S?c.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ct.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(xe(v,"png"))},style:Ct.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(xe(h,"png"))},style:[Ct.tokenChainBadge,{borderColor:c.card.backgroundColor,borderRadius:c.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:Ct.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ct.tokenSymbol,{color:c.card.titleColor,fontFamily:u.medium}],children:v.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Ct.tokenChainName,{color:c.card.subtitleColor,fontFamily:u.regular}],children:h.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[Ct.minDeposit,{color:c.card.labelColor,fontFamily:u.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:c.card.labelHighlightRightColor,fontFamily:u.regular},children:["$",h.minimum_deposit_amount_usd]})]})]},`${v.symbol}-${g}`)})})]})}var Ct=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},closeButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",textAlign:"center",flex:1},headerSpacer:{width:28},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:40,paddingHorizontal:16,fontSize:14},quickSelectSection:{marginBottom:12},sectionLabel:{fontSize:12,paddingHorizontal:16,marginBottom:8},quickSelectScroll:{paddingHorizontal:16,gap:8},quickSelectItem:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:8,paddingHorizontal:12},removeButton:{position:"absolute",top:-2,right:-6,zIndex:1,padding:2},tokenIconContainer:{position:"relative"},quickSelectIcon:{width:28,height:28,borderRadius:14},quickSelectChainBadge:{position:"absolute",bottom:-2,right:-2,width:14,height:14,borderRadius:7,borderWidth:2},quickSelectText:{alignItems:"flex-start"},quickSelectSymbol:{fontSize:12,fontWeight:"500"},quickSelectChain:{fontSize:10},tokenList:{flex:1},tokenListContent:{paddingHorizontal:16,paddingBottom:72,gap:4},emptyState:{padding:32,alignItems:"center"},emptyText:{fontSize:14},tokenItem:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:12},tokenIconContainerLarge:{position:"relative"},tokenIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenInfo:{flex:1},tokenSymbol:{fontSize:14,fontWeight:"500"},tokenChainName:{fontSize:12},minDeposit:{fontSize:12}});var Ic=(e,t)=>`${t}:${e}`,pC=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function Mu({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:u,depositConfirmationMode:c="auto_ui",onExecutionsChange:b,onDepositSuccess:T,onDepositError:w,wallets:p,borderTopLeftRadius:y,borderTopRightRadius:f,sheetBorderRadius:k}){let{colors:C,fonts:d,components:x}=O(),v=a&&l?`${a}:${l}`:"solana:mainnet",[h,g]=ci.useState("USDC"),[S,_]=ci.useState(v),[A,W]=ci.useState([]),[I,F]=ci.useState(!p?.length),z=p?.length?p:A,[j,me]=ci.useState([]),[Xe,Ie]=ci.useState(true),[ie,Pe]=ci.useState(false),[Oe,fe]=ci.useState(false),[Ce,ke]=ci.useState(false),[Z,pe]=ci.useState([]),[St,ve]=ci.useState(new Map),[lt]=ci.useState(()=>new Date),[je,Te]=ci.useState(null),[rt,ot]=ci.useState(false),[se,he]=ci.useState(null),[Ae,we]=ci.useState(false),ge=new Map;j.forEach(ue=>{ue.chains.forEach(Ve=>{let D=`${Ve.chain_type}:${Ve.chain_id}`;ge.has(D)||ge.set(D,Ve);});});let Jt=Array.from(ge.values()),nt=pC(S),We=Jt.find(ue=>ue.chain_type===nt.chainType&&ue.chain_id===nt.chainId),yr=We?.chain_type||"ethereum",ce=yn(z,yr),re=ce?.address||"",Se=ci.useRef(false);ci.useEffect(()=>{async function ue(){try{Ie(!0),Te(null);let D=await xi(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(me(D.data),D.data.length>0&&!Se.current){Se.current=!0;let H,E;if(a&&l)if(u)for(let P of D.data){let U=P.chains.find(K=>K.chain_type===a&&K.chain_id===l&&K.token_address.toLowerCase()===u.toLowerCase());if(U){H=P,E=U;break}}else for(let P of D.data){let U=P.chains.find(K=>K.chain_type===a&&K.chain_id===l);if(U){H=P,E=U;break}}if(!H&&s)for(let P of D.data){let U=P.chains.find(K=>K.token_address.toLowerCase()===s.toLowerCase());if(U){H=P,E=U;break}}H||(H=D.data.find(P=>P.symbol==="USDC"),H&&H.chains.length>0&&(E=H.chains[0])),H||(H=D.data.find(P=>P.symbol==="USDT"),H&&H.chains.length>0&&(E=H.chains[0])),H||(H=D.data[0],H.chains.length>0&&(E=H.chains[0])),H&&g(H.symbol),E&&_(Ic(E.chain_id,E.chain_type));}}catch(Ve){console.error("Error fetching supported tokens:",Ve),Te("Failed to load supported tokens"),w?.({message:"Failed to load supported tokens",error:Ve});}finally{Ie(false);}}ue();},[t,s,n,o,a,l,u,w]),ci.useEffect(()=>{b&&b(Z);},[Z,b]),ci.useEffect(()=>{if(p?.length){F(false);return}if(A.length>0){F(false);return}let ue=null,Ve=false,D=async()=>{if(!Ve){F(true);try{let H=await gn({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);Ve||(W(H.data),Te(null),F(!1));}catch(H){console.error("Error fetching wallets, retrying in 5s:",H),Ve||(Te(H instanceof Error?H.message:"Failed to load wallets"),F(false),ue=setTimeout(D,5e3));}}};return D(),()=>{Ve=true,ue&&clearTimeout(ue);}},[e,r,o,n,s,t,p,A.length]);let mt=ce?.id??"",{showWaitingUi:ht,handleIveDeposited:de}=$a({depositConfirmationMode:c,depositAddress:re,chain:S,externalUserId:e,publishableKey:t,modalOpenedAt:lt,depositWalletId:mt,depositExecutions:Z,trackedExecutions:St,setDepositExecutions:pe,setTrackedExecutions:ve,setLatestExecution:he,setShowStatusSheet:ot,onDepositSuccess:T,onExecutionsChange:b,onDepositError:w});ci.useEffect(()=>{if(!j.length)return;let ue=j.find(D=>D.symbol===h);if(!ue||ue.chains.length===0)return;if(!ue.chains.some(D=>Ic(D.chain_id,D.chain_type)===S)){let D=ue.chains[0];_(Ic(D.chain_id,D.chain_type));}},[h,j,S]);let Ee=j.find(ue=>ue.symbol===h),it=(Ee?.chains||[]).find(ue=>Ic(ue.chain_id,ue.chain_type)===S),ir=async()=>{if(re)try{reactNative.Clipboard.setString(re),Pe(!0),setTimeout(()=>Pe(!1),2e3);}catch(ue){console.error("Failed to copy:",ue);}},Ht=it?.estimated_price_impact_percent??0,sr=it?.max_slippage_percent??.25,Dt=it?.minimum_deposit_amount_usd??3;return Xe?jsxRuntime.jsxs(reactNative.View,{style:q.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:C.primary}),jsxRuntime.jsx(reactNative.Text,{style:[q.loadingText,{color:C.foregroundMuted,fontFamily:d.regular}],children:"Loading currencies..."})]}):je&&j.length===0?jsxRuntime.jsxs(reactNative.View,{style:q.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[q.errorText,{color:C.error,fontFamily:d.regular}],children:je}),jsxRuntime.jsx(reactNative.Text,{style:[q.errorHint,{color:C.foregroundMuted,fontFamily:d.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:q.container,children:[jsxRuntime.jsxs(reactNative.View,{style:q.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[q.selectorLabel,{color:x.card.labelColor,fontFamily:d.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ke(true),disabled:Xe||j.length===0,style:[q.tokenSelectorButton,{backgroundColor:x.card.backgroundColor,borderRadius:x.card.borderRadius,borderWidth:x.card.borderWidth,borderColor:x.card.borderColor}],activeOpacity:.7,children:Xe?jsxRuntime.jsxs(reactNative.View,{style:q.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[q.loadingIcon,{backgroundColor:C.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:q.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[q.loadingLine,{backgroundColor:C.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[q.loadingLine,{backgroundColor:C.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:q.tokenIconWrapper,children:[Ee&&jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(xe(Ee,"png"))},style:q.tokenMainIcon}),(it||We)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(xe(it||We,"png"))},style:[q.tokenChainBadge,{borderColor:x.card.backgroundColor,borderRadius:x.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:q.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[q.tokenSelectorSymbol,{color:x.card.titleColor,fontFamily:d.semibold}],children:Ee?.symbol||h}),jsxRuntime.jsx(reactNative.Text,{style:[q.tokenSelectorNetwork,{color:x.card.subtitleColor,fontFamily:d.regular}],numberOfLines:1,children:it?.chain_name||We?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:q.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[q.minDepositText,{color:x.card.labelHighlightRightColor,fontFamily:d.medium}],children:["$",Dt," min"]}),jsxRuntime.jsx(Sr,{size:16,color:x.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(Eu,{visible:Ce,onClose:()=>ke(false),tokens:j,selectedToken:h,selectedChainKey:S,onSelect:(ue,Ve)=>{g(ue),_(Ve);},borderTopLeftRadius:k?.tokenSelector?.borderTopLeftRadius??y,borderTopRightRadius:k?.tokenSelector?.borderTopRightRadius??f}),jsxRuntime.jsx(reactNative.View,{style:q.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[q.qrWrapper,{backgroundColor:C.background,borderRadius:x.card.borderRadius,borderWidth:x.card.borderWidth>0?x.card.borderWidth:1,borderColor:x.card.borderColor}],children:I?jsxRuntime.jsxs(reactNative.View,{style:q.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primary}),jsxRuntime.jsx(reactNative.Text,{style:[q.loadingText,{color:C.foregroundMuted,fontFamily:d.regular}],children:"Loading..."})]}):re?jsxRuntime.jsx(js,{value:re,size:180,logoUri:oe(xe(it,"png")||ar("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:q.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[q.errorText,{color:C.error,fontFamily:d.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:q.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:q.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[q.addressLabel,{color:x.card.labelColor,fontFamily:d.medium}],children:"Deposit Address"}),ie&&jsxRuntime.jsxs(reactNative.View,{style:q.copiedIndicator,children:[jsxRuntime.jsx($e,{size:14,color:C.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[q.copiedText,{color:C.success,fontFamily:d.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(gr,{cardTokens:x.transferCrypto.depositAddress.card,onPress:!I&&re?ir:void 0,contentStyle:q.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[q.addressText,{color:x.card.titleColor,fontFamily:d.regular}],numberOfLines:2,children:I?"Loading...":re||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:q.addressCopyIcon,children:jsxRuntime.jsx(fn,{size:16,color:x.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[q.detailsCard,{backgroundColor:x.card.backgroundColor,borderRadius:x.card.borderRadius,borderWidth:x.card.borderWidth,borderColor:x.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>fe(!Oe),style:q.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:q.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[q.detailIcon,{backgroundColor:x.card.iconBackgroundColor,borderRadius:x.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(jr,{size:12,color:x.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[q.detailsLabel,{color:x.card.titleColor,fontFamily:d.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:q.chevronContainer,children:Oe?jsxRuntime.jsx(Wo,{size:16,color:x.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Kt,{size:16,color:x.card.actionColor,strokeWidth:2})})]}),Oe&&jsxRuntime.jsxs(reactNative.View,{style:q.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:q.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[q.detailIcon,{backgroundColor:x.card.iconBackgroundColor,borderRadius:x.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Nn,{size:12,color:x.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[q.detailsLabel,{color:x.card.titleColor,fontFamily:d.regular}],children:["Price impact: ",Ht.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>we(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(ss,{size:14,color:x.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:q.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[q.detailIcon,{backgroundColor:x.card.iconBackgroundColor,borderRadius:x.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(oo,{size:12,color:x.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[q.detailsLabel,{color:x.card.titleColor,fontFamily:d.regular}],children:["Slippage: Auto \u2022 ",sr.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>we(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(ss,{size:14,color:x.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:q.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[q.detailIcon,{backgroundColor:x.card.iconBackgroundColor,borderRadius:x.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(ll,{size:12,color:x.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[q.detailsLabel,{color:x.card.titleColor,fontFamily:d.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(dc,{depositConfirmationMode:c,depositAddress:re,showWaitingUi:ht,latestExecution:se,onIveDeposited:de}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:q.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[q.termsText,{color:C.primary,fontFamily:d.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(wt,{visible:Ae,onClose:()=>we(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:k?.infoSheet?.borderTopLeftRadius??y,borderTopRightRadius:k?.infoSheet?.borderTopRightRadius??f,children:[jsxRuntime.jsxs(reactNative.View,{style:[q.sheetHeader,{borderBottomColor:C.border}],children:[jsxRuntime.jsx(reactNative.View,{style:q.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[q.sheetTitle,{color:x.header.titleColor,fontFamily:d.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>we(false),style:q.sheetCloseButton,children:jsxRuntime.jsx(ct,{size:20,color:x.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:q.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[q.infoCard,{backgroundColor:x.card.backgroundColor,borderRadius:x.card.borderRadius,borderWidth:x.card.borderWidth,borderColor:x.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:q.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[q.infoCardIcon,{backgroundColor:x.card.iconBackgroundColor,borderRadius:x.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Nn,{size:16,color:x.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[q.infoCardTitle,{color:x.card.titleColor,fontFamily:d.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[q.infoCardValue,{color:x.card.titleColor,fontFamily:d.medium}],children:[Ht.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[q.infoCardDescription,{color:x.card.descriptionColor,fontFamily:d.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[q.infoCard,{backgroundColor:x.card.backgroundColor,borderRadius:x.card.borderRadius,borderWidth:x.card.borderWidth,borderColor:x.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:q.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[q.infoCardIcon,{backgroundColor:x.card.iconBackgroundColor,borderRadius:x.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(oo,{size:16,color:x.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[q.infoCardTitle,{color:x.card.titleColor,fontFamily:d.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[q.infoCardValue,{color:x.card.titleColor,fontFamily:d.medium}],children:[sr.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[q.infoCardDescription,{color:x.card.descriptionColor,fontFamily:d.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]}),se&&jsxRuntime.jsx($s,{visible:rt,status:se.status,tokenIconUrl:se.destination_token_metadata?.icon_urls?.find(ue=>ue.format==="png")?.url||se.destination_token_metadata?.icon_url||xe(Ee,"png"),explorerUrl:se.explorer_url,completionExplorerUrl:se.destination_explorer_url,date:se.created_at?new Date(se.created_at):void 0,amountUsd:se.source_amount_usd?parseFloat(se.source_amount_usd):void 0,onClose:()=>ot(false),borderTopLeftRadius:k?.depositStatus?.borderTopLeftRadius??y,borderTopRightRadius:k?.depositStatus?.borderTopRightRadius??f})]})}var q=reactNative.StyleSheet.create({container:{flex:1,paddingHorizontal:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:12,marginBottom:8},tokenSelectorButton:{flexDirection:"row",alignItems:"center",gap:12,padding:12},tokenSelectorLoading:{flexDirection:"row",alignItems:"center",gap:12,flex:1},loadingIcon:{width:40,height:40,borderRadius:20},loadingTextContainer:{flex:1},loadingLine:{height:12,borderRadius:6},tokenIconWrapper:{position:"relative"},tokenMainIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenSelectorInfo:{flex:1},tokenSelectorSymbol:{fontSize:14,fontWeight:"500"},tokenSelectorNetwork:{fontSize:12,marginTop:2},tokenSelectorRight:{flexDirection:"row",alignItems:"center",gap:8},minDepositText:{fontSize:12,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:8},qrWrapper:{padding:16},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:12},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{position:"relative",paddingHorizontal:12,paddingVertical:16},addressText:{fontSize:12,fontFamily:"monospace"},addressCopyIcon:{position:"absolute",right:12,top:0,bottom:0,justifyContent:"center"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},termsContainer:{alignItems:"center",paddingVertical:8},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});var Wn={transferCrypto:{title:"Transfer Crypto",subtitle:"No limit \u2022 Instant"},depositWithCard:{title:"Deposit with Card",subtitle:"$50,000 limit \u2022 2 min"},stripeLinkPay:{title:"Pay with Stripe Link",subtitle:"Apple Pay or Card"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"}};function yC(){let{colors:e,components:t}=O(),r=ci.useRef(new reactNative.Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;ci.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(r,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(r,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[r]);let s=({rightIcons:i=2})=>jsxRuntime.jsxs(reactNative.View,{style:[yi.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[yi.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxRuntime.jsxs(reactNative.View,{style:yi.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[yi.titleBar,{backgroundColor:n,opacity:r}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[yi.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsxRuntime.jsx(reactNative.View,{style:yi.rightIcons,children:Array.from({length:i}).map((a,l)=>jsxRuntime.jsx(reactNative.Animated.View,{style:[yi.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxRuntime.jsxs(reactNative.View,{style:yi.container,children:[jsxRuntime.jsx(s,{rightIcons:3}),jsxRuntime.jsx(s,{rightIcons:2}),jsxRuntime.jsx(s,{rightIcons:0})]})}var yi=reactNative.StyleSheet.create({container:{paddingTop:8,paddingBottom:24,gap:8},card:{marginHorizontal:16,flexDirection:"row",alignItems:"center",paddingVertical:16,paddingHorizontal:12,gap:12},leftIcon:{width:36,height:36},textBlock:{flex:1,gap:6},titleBar:{height:12,width:"70%",borderRadius:6},subtitleBar:{height:10,width:"50%",borderRadius:5},rightIcons:{flexDirection:"row",alignItems:"center",gap:4},rightIcon:{width:20,height:20,borderRadius:10}});function bC({visible:e,onClose:t,externalUserId:r,publishableKey:o,modalTitle:n="Deposit",destinationTokenSymbol:s,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:u,defaultChainType:c,defaultChainId:b,defaultTokenAddress:T,showBalance:w=false,hideDepositTracker:p=false,enableStripeLinkPay:y=false,StripeOnrampComponent:f,stripeOnrampEmail:k,stripeOnrampPhone:C,stripeMerchantIdentifier:d,stripePaymentSelectorPosition:x,stripeSkipSuccessConfirmation:v,stripeTheme:h,depositConfirmationMode:g="auto_ui",transferInputVariant:S="double_input",initialScreen:_="main",onDepositSuccess:A,onDepositError:W,sheetBorderRadius:I}){let F=I?.globalBorderTopLeftRadius,z=I?.globalBorderTopRightRadius,{colors:j,fonts:me}=O(),[Xe,Ie]=ci.useState([]),[ie,Pe]=ci.useState(null),[Oe,fe]=ci.useState("amount"),Ce=_==="tracker"&&!p?"tracker":_==="transfer"?"transfer":_==="card"?"card":"main",ke=Ce==="main",[Z,pe]=ci.useState(Ce),{isAllowed:St,isLoading:ve}=Ya(o,e);ci.useEffect(()=>{if(!e||ie)return;let ce=false;return ma(o).then(async re=>{if(ce)return;let Se=[];for(let mt of re?.transfer_crypto?.networks??[]){let ht=mt.icon_urls.find(de=>de.format==="png")?.url||mt.icon_urls.find(de=>de.format==="svg")?.url;ht&&Se.push(oe(ht));}for(let mt of re?.payment_networks?.networks??[]){let ht=mt.icon_urls.find(de=>de.format==="png")?.url||mt.icon_urls.find(de=>de.format==="svg")?.url;ht&&Se.push(oe(ht));}Se.length>0&&await du(Se),ce||Pe(re);}).catch(console.error),()=>{ce=true;}},[e,ie,o]);let lt=()=>{t();};ci.useEffect(()=>{e&&(pe(Ce),fe("amount"));},[e,Ce]);let je=ci.useCallback(()=>{ke?(pe("main"),fe("amount")):lt();},[ke,lt]),Te=Xe.filter(ce=>ce.status==="pending"||ce.status==="waiting").length,ot=!!(i&&a&&l&&u&&o)&&w!==false&&!!ie,se=ve||e&&!ie,he=St===false,Ae=null;if(Z==="stripe"&&f){let ce=jsxRuntime.jsx(f,{publishableKey:o,email:k,phone:C,externalUserId:r,recipientAddress:i??"",destinationChainType:a,destinationChainId:l,destinationTokenAddress:u,merchantIdentifier:d,paymentSelectorPosition:x,skipSuccessConfirmation:v,appName:ie?.project_name??"",onClose:je});Ae=h?jsxRuntime.jsx(as,{...h,children:ce}):ce;}let we=Z==="stripe"?.9:Z==="transfer"||Z==="card"?.94:Z==="tracker"?.9:Z==="main"?.5:void 0,ge=Z==="main"?.9:void 0,nt={main:I?.main,transfer:I?.transferCrypto,card:I?.buyWithCard,stripe:I?.stripeLinkPay,tracker:I?.depositsTracker}[Z],We=nt?.borderTopLeftRadius??F,yr=nt?.borderTopRightRadius??z;return jsxRuntime.jsxs(wt,{visible:e,onClose:Z==="main"?lt:je,closeOnBackdropPress:false,enablePanDownToClose:true,showHandle:true,heightPercent:we,maxHeightPercent:ge,borderTopLeftRadius:We,borderTopRightRadius:yr,children:[Z==="main"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Hr,{title:n,showBack:false,onClose:lt,showBalance:ot,balanceAddress:i,balanceChainType:a,balanceChainId:l,balanceTokenAddress:u,publishableKey:o,projectName:ie?.project_name}),se&&jsxRuntime.jsx(yC,{}),!se&&he&&jsxRuntime.jsxs(reactNative.View,{style:Wr.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[Wr.iconContainer,{backgroundColor:j.cardHover}],children:jsxRuntime.jsx(sa,{size:32,color:j.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Wr.blockedTitle,{color:j.foreground,fontFamily:me.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[Wr.blockedDescription,{color:j.foreground,opacity:.7,fontFamily:me.regular}],children:"There are no supported tokens available from your current location."})]}),!se&&!he&&jsxRuntime.jsxs(reactNative.View,{style:Wr.optionsContainer,children:[jsxRuntime.jsx(Ma,{onPress:()=>pe("transfer"),title:Wn.transferCrypto.title,subtitle:Wn.transferCrypto.subtitle,featuredTokens:ie?.transfer_crypto?.networks}),jsxRuntime.jsx(Ua,{onPress:()=>pe("card"),title:Wn.depositWithCard.title,subtitle:Wn.depositWithCard.subtitle,paymentNetworks:ie?.payment_networks?.networks}),y&&f&&jsxRuntime.jsx(ja,{onPress:()=>pe("stripe"),title:Wn.stripeLinkPay.title,subtitle:Wn.stripeLinkPay.subtitle}),!p&&jsxRuntime.jsx(Ha,{onPress:()=>pe("tracker"),title:Wn.depositTracker.title,subtitle:Wn.depositTracker.subtitle,badge:Te>0?Te:void 0})]})]}),Z==="transfer"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Hr,{title:Wn.transferCrypto.title,showBack:false,onClose:je,showBalance:ot,balanceAddress:i,balanceChainType:a,balanceChainId:l,balanceTokenAddress:u,publishableKey:o,projectName:ie?.project_name}),ve&&jsxRuntime.jsx(reactNative.View,{style:[Wr.centeredContainer,Wr.centeredFlex],children:jsxRuntime.jsx(reactNative.ActivityIndicator,{color:j.primary})}),!ve&&he&&jsxRuntime.jsxs(reactNative.View,{style:[Wr.centeredContainer,Wr.centeredFlex],children:[jsxRuntime.jsx(reactNative.View,{style:[Wr.iconContainer,{backgroundColor:j.cardHover}],children:jsxRuntime.jsx(sa,{size:32,color:j.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Wr.blockedTitle,{color:j.foreground,fontFamily:me.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[Wr.blockedDescription,{color:j.foreground,opacity:.7,fontFamily:me.regular}],children:"There are no supported tokens available from your current location."})]}),!ve&&!he&&jsxRuntime.jsx(dt,{style:Wr.transferScrollContainer,contentContainerStyle:Wr.scrollContent,showsVerticalScrollIndicator:false,children:S==="single_input"?jsxRuntime.jsx(Mu,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:u,destinationTokenSymbol:s,defaultChainType:c,defaultChainId:b,defaultTokenAddress:T,depositConfirmationMode:g,onExecutionsChange:Ie,onDepositSuccess:A,onDepositError:W,borderTopLeftRadius:F,borderTopRightRadius:z,sheetBorderRadius:{tokenSelector:I?.tokenSelector,infoSheet:I?.infoSheet,depositStatus:I?.depositStatus}}):jsxRuntime.jsx(pc,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:u,destinationTokenSymbol:s,defaultChainType:c,defaultChainId:b,defaultTokenAddress:T,depositConfirmationMode:g,onExecutionsChange:Ie,onDepositSuccess:A,onDepositError:W,borderTopLeftRadius:F,borderTopRightRadius:z,sheetBorderRadius:{tokenSelector:I?.tokenSelector,chainSelector:I?.chainSelector,infoSheet:I?.infoSheet,depositStatus:I?.depositStatus}})})]}),Z==="card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Hr,{title:`Deposit ${s||"USDC"}`,showBack:Oe==="onramp",onBack:()=>fe("amount"),onClose:je,showBalance:ot,balanceAddress:i,balanceChainType:a,balanceChainId:l,balanceTokenAddress:u,publishableKey:o,projectName:ie?.project_name}),jsxRuntime.jsx(reactNative.View,{style:Wr.buyWithCardContainer,children:jsxRuntime.jsx(bc,{externalUserId:r,publishableKey:o,destinationTokenSymbol:s,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:u,onDepositSuccess:A,onDepositError:W,view:Oe,onViewChange:ce=>fe(ce),borderTopLeftRadius:F,borderTopRightRadius:z,sheetBorderRadius:{providerModal:I?.providerModal,webView:I?.webView,currencyModal:I?.currencyModal}})})]}),Z==="stripe"&&Ae&&jsxRuntime.jsx(reactNative.View,{style:Wr.stripeLinkPayContainer,children:Ae}),Z==="tracker"&&jsxRuntime.jsx(Lu,{active:Z==="tracker",onClose:je,executions:Xe,externalUserId:r,publishableKey:o})]})}function Oc({theme:e="auto",...t}){return jsxRuntime.jsx(bC,{...t})}var Wr=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},buyWithCardContainer:{flex:1},stripeLinkPayContainer:{flex:1},centeredContainer:{alignItems:"center",justifyContent:"center",paddingVertical:48,paddingHorizontal:16,minHeight:200},centeredFlex:{flex:1},iconContainer:{width:64,height:64,borderRadius:32,alignItems:"center",justifyContent:"center",marginBottom:16},blockedTitle:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},blockedDescription:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20}});function Vc(e,t=true){return vn({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>yl(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function Hu(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:s,enabled:i=true}=e;return vn({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,s],queryFn:async()=>{let l=await xi(s),u=null,c=null,b=null,T=null,w,p,y,f=l.data.some(k=>k.chains.some(C=>{let d=C.chain_type===t&&C.chain_id===r&&C.token_address.toLowerCase()===o.toLowerCase();return d&&(u=C.minimum_deposit_amount_usd,c=C.estimated_processing_time,b=C.max_slippage_percent,T=C.estimated_price_impact_percent,y=C.chain_name,p=k),d}));if(p){let k=xe(p,"png");k&&(w=oe(k));}return {isSupported:f,minimumAmountUsd:u,estimatedProcessingTime:c,maxSlippagePercent:b,priceImpactPercent:T,errorMessage:f?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:w,chainName:y}},enabled:i&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function Nu(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:s,enabled:i=true}=e;return vn({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,s],queryFn:async()=>{let l=await bl(t,r,o,n,s);if(l.balance){let u=l.balance.token?.decimals??6,c=l.balance.token?.symbol??"",b=l.balance.amount,T=BigInt(b),w=BigInt(10**u),p=T/w,f=(T%w).toString().padStart(u,"0").replace(/0+$/,""),k=f?`${p}.${f}`:p.toString();return {balanceBaseUnit:b,balanceHuman:k,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:u,symbol:c}}return {balanceBaseUnit:"0",balanceHuman:"0",balanceUsd:"0",exchangeRate:null,decimals:6,symbol:""}},enabled:i&&(!!t&&!!r&&!!o&&!!n),staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,refetchOnMount:"always"})}var wC=2500,SC=3e3,kC=6e4;function ju({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:s}){let[i,a]=ci.useState([]),[l,u]=ci.useState(false),c=ci.useRef(new Date),b=ci.useRef(new Map),T=ci.useRef(false),w=ci.useRef(n),p=ci.useRef(s);return ci.useEffect(()=>{w.current=n;},[n]),ci.useEffect(()=>{p.current=s;},[s]),ci.useEffect(()=>{o&&!T.current&&(c.current=new Date,b.current.clear()),o||b.current.clear(),T.current=o;},[o]),ci.useEffect(()=>{if(!e||!o)return;let y=c.current,f=async()=>{try{let C=await bn(e,t,"withdraw"),d=new Date(y.getTime()-kC),x=[...C.data].sort((S,_)=>{let A=S.created_at?new Date(S.created_at).getTime():0;return (_.created_at?new Date(_.created_at).getTime():0)-A}),v=["pending","waiting","delayed"],h=["succeeded","failed"],g=null;for(let S of x){let _=S.created_at?new Date(S.created_at):null;if(!_||_<d)continue;let A=b.current.get(S.id);if(!A){g=S;break}if(v.includes(A)&&h.includes(S.status)){g=S;break}}if(g){let S=g,_=S.created_at?new Date(S.created_at):null;if(!_||_<c.current)return;let A=b.current.get(S.id);b.current.set(S.id,S.status),a(W=>{let I=W.findIndex(F=>F.id===S.id);if(I>=0){let F=[...W];return F[I]=S,F}return [...W,S]}),S.status==="succeeded"&&(!A||v.includes(A))?w.current?.({message:"Withdrawal completed successfully",transaction:S}):S.status==="failed"&&A!=="failed"&&p.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:S});}}catch(C){console.error("Failed to fetch withdraw executions:",C),p.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:C});}};f();let k=setInterval(f,wC);return u(true),()=>{clearInterval(k),u(false);}},[e,t,o]),ci.useEffect(()=>{if(!o||!r)return;let y=async()=>{try{await ud({deposit_wallet_id:r},t);}catch{}};y();let f=setInterval(y,SC);return ()=>clearInterval(f)},[o,r,t]),{executions:i,isPolling:l}}var $u=(e,t)=>`${t}:${e}`;function Za({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:s=false,tokenLabel:i="Receive token",chainLabel:a="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:u,chainPickerBorderTopLeftRadius:c,chainPickerBorderTopRightRadius:b}){let{colors:T,fonts:w,components:p}=O(),[y,f]=ci.useState(false),[k,C]=ci.useState(false),d=p.card,x=t?e.find(S=>S.symbol===t):void 0,v=x?.chains||[],h=r?v.find(S=>$u(S.chain_id,S.chain_type)===r):void 0,g={backgroundColor:d.backgroundColor,borderRadius:d.borderRadius,borderWidth:d.borderWidth||1,borderColor:d.borderColor};return jsxRuntime.jsxs(reactNative.View,{style:tt.row,children:[jsxRuntime.jsxs(reactNative.View,{style:tt.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[tt.label,{color:d.labelColor,fontFamily:w.medium}],children:i}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[tt.selectButton,g],onPress:()=>!s&&e.length>0&&f(true),activeOpacity:.7,disabled:s||e.length===0,children:[s?jsxRuntime.jsx(reactNative.Text,{style:[tt.placeholder,{color:d.subtitleColor,fontFamily:w.regular}],children:"Loading..."}):x?jsxRuntime.jsxs(reactNative.View,{style:tt.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(xe(x,"png"))},style:tt.icon}),jsxRuntime.jsx(reactNative.Text,{style:[tt.selectedText,{color:d.titleColor,fontFamily:w.medium}],numberOfLines:1,children:x.symbol})]}):jsxRuntime.jsx(reactNative.Text,{style:[tt.placeholder,{color:d.subtitleColor,fontFamily:w.regular}],children:"Select receive token"}),jsxRuntime.jsx(Kt,{size:16,color:d.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:tt.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[tt.label,{color:d.labelColor,fontFamily:w.medium}],children:a}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[tt.selectButton,g,(!x||v.length===0)&&tt.disabled],onPress:()=>!s&&x&&v.length>0&&C(true),activeOpacity:.7,disabled:s||!x||v.length===0,children:[h?jsxRuntime.jsxs(reactNative.View,{style:tt.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(xe(h,"png"))},style:tt.icon}),jsxRuntime.jsx(reactNative.Text,{style:[tt.selectedText,{color:d.titleColor,fontFamily:w.medium}],numberOfLines:1,children:h.chain_name})]}):jsxRuntime.jsx(reactNative.Text,{style:[tt.placeholder,{color:d.subtitleColor,fontFamily:w.regular}],children:"Chain"}),jsxRuntime.jsx(Kt,{size:16,color:d.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(wt,{visible:y,onClose:()=>f(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:l,borderTopRightRadius:u,children:[jsxRuntime.jsxs(reactNative.View,{style:tt.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:tt.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[tt.pickerTitle,{color:T.foreground,fontFamily:w.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:tt.pickerHeaderClose,onPress:()=>f(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ct,{size:20,color:T.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(ls,{data:e,keyExtractor:S=>S.symbol,contentContainerStyle:tt.listContent,showsVerticalScrollIndicator:false,renderItem:({item:S})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[tt.pickerItem,{backgroundColor:S.symbol===t?T.cardHover:"transparent"}],onPress:()=>{o(S.symbol),f(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(xe(S,"png"))},style:tt.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[tt.pickerItemText,{color:T.foreground,fontFamily:w.medium}],children:S.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[tt.pickerItemSub,{color:T.foregroundMuted,fontFamily:w.regular}],children:S.name}),S.symbol===t&&jsxRuntime.jsx($e,{size:18,color:T.primary,strokeWidth:2.5})]})})]}),jsxRuntime.jsxs(wt,{visible:k,onClose:()=>C(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:c,borderTopRightRadius:b,children:[jsxRuntime.jsxs(reactNative.View,{style:tt.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:tt.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[tt.pickerTitle,{color:T.foreground,fontFamily:w.medium}],children:"Select Chain"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:tt.pickerHeaderClose,onPress:()=>C(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ct,{size:20,color:T.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(ls,{data:v,keyExtractor:S=>$u(S.chain_id,S.chain_type),contentContainerStyle:tt.listContent,showsVerticalScrollIndicator:false,renderItem:({item:S})=>{let _=$u(S.chain_id,S.chain_type);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[tt.pickerItem,{backgroundColor:_===r?T.cardHover:"transparent"}],onPress:()=>{n(_),C(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(xe(S,"png"))},style:tt.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[tt.pickerItemText,{color:T.foreground,fontFamily:w.medium}],children:S.chain_name}),_===r&&jsxRuntime.jsx($e,{size:18,color:T.primary,strokeWidth:2.5})]})}})]})]})}var tt=reactNative.StyleSheet.create({row:{flexDirection:"column",gap:10},col:{},label:{fontSize:12,marginBottom:6},selectButton:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:12,gap:6,minHeight:48},selectedItem:{flex:1,flexDirection:"row",alignItems:"center",gap:6},icon:{width:20,height:20,borderRadius:10},selectedText:{fontSize:13,flexShrink:1},placeholder:{flex:1,fontSize:13},disabled:{opacity:.4},pickerHeader:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingTop:16,paddingBottom:12},pickerHeaderSpacer:{width:28},pickerHeaderClose:{width:28,alignItems:"flex-end"},pickerTitle:{flex:1,fontSize:16,textAlign:"center"},listContent:{paddingHorizontal:16,paddingVertical:8},pickerItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:12,borderRadius:10,gap:10},pickerIcon:{width:32,height:32,borderRadius:16},pickerItemText:{fontSize:15,flex:1},pickerItemSub:{fontSize:13}});function qu(e){let{chainType:t,chainId:r,tokenAddress:o,recipientAddress:n,publishableKey:s,enabled:i=true}=e,a=n?.trim()||"",l=!!t&&!!r&&!!o&&a.length>0;return vn({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,a,s],queryFn:()=>dd({chain_type:t,chain_id:r,token_address:o,recipient_address:a},s),enabled:i&&l,staleTime:1e3*60*5,gcTime:1e3*60*30,retry:1,refetchOnMount:false})}function RC(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function vC(e,t){if(e<=0)return "0";if(t===0)return BigInt(Math.round(e)).toString();let r=e.toFixed(t),[o,n=""]=r.split("."),s=n.padEnd(t,"0").slice(0,t);return (BigInt(o)*BigInt(10**t)+BigInt(s)).toString()}function IC(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function Lc({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,selectedToken:l,selectedChain:u,balanceData:c,isLoadingBalance:b,minimumWithdrawAmountUsd:T,estimatedProcessingTime:w,maxSlippagePercent:p,priceImpactPercent:y,canWithdraw:f,onDepositWalletCreation:k,onWithdraw:C,onWithdrawError:d,onWithdrawSubmitted:x,onViewTracker:v}){let h="https://unifold.io/terms",g="https://unifold.io/support",{colors:S,fonts:_,components:A}=O(),[W,I]=ci.useState(a||""),[F,z]=ci.useState(""),[j,me]=ci.useState(false),[Xe,Ie]=ci.useState(null),[ie,Pe]=ci.useState(false),[Oe,fe]=ci.useState(""),Ce=ci.useRef(null);ci.useEffect(()=>{I(a||""),z(""),Ie(null);},[a]);let ke=W.trim();ci.useEffect(()=>{let de=setTimeout(()=>fe(ke),500);return ()=>clearTimeout(de)},[ke]);let{data:Z,isLoading:pe,error:St}=qu({chainType:u?.chain_type,chainId:u?.chain_id,tokenAddress:u?.token_address,recipientAddress:Oe,publishableKey:e,enabled:Oe.length>5&&!!u}),ve=ke!==Oe,lt=ci.useMemo(()=>!ke||ke.length<=5||ve||pe?null:St?"Invalid address":Z&&!Z.valid?Z.failure_code==="account_not_found"?`Account not found on ${u?.chain_name}`:Z.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${u?.chain_name}`:"Invalid address":null,[ke,ve,pe,St,Z,u,l]),je=!ve&&!!Z?.valid&&!lt,Te=ci.useMemo(()=>c?.exchangeRate?parseFloat(c.exchangeRate):0,[c]),rt=ci.useMemo(()=>c?.balanceHuman?parseFloat(c.balanceHuman):0,[c]),ot=n||c?.symbol||"TOKEN",se=c?.decimals??6,he=ci.useMemo(()=>{let de=parseFloat(F);return !de||de<=0?0:de},[F]),Ae=ci.useMemo(()=>{let de=parseFloat(F);return !de||de<=0?0:de*Te},[F,Te]),we=ci.useCallback(async()=>{try{let Ee=await Sh("expo-clipboard").getStringAsync();Ee&&(I(Ee.trim()),Ie(null));}catch{}},[]),ge=ci.useCallback(()=>{rt<=0||z(c?.balanceHuman??"0");},[rt,c]),Jt=T!==null&&Ae>0&&Ae<T,nt=he>0&&rt>0&&he>rt,We=ke.length>0&&F.trim().length>0&&he>0&&je&&!Jt&&!nt&&!!c,yr=ci.useCallback(async()=>{if(!(!l||!u||!We||!f)){me(true),Ie(null);try{let de=await k({destinationChainType:u.chain_type,destinationChainId:u.chain_id,destinationTokenAddress:u.token_address,recipientAddress:ke}),Ee=vC(he,se),$t=IC(he,se),it={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:ot,sourceTokenIconUrl:i,destinationChainType:u.chain_type,destinationChainId:u.chain_id,destinationTokenAddress:u.token_address,destinationTokenSymbol:l.symbol,destinationChainName:u.chain_name,destinationTokenIconUrl:l?oe(xe(l,"png")):void 0,amount:$t,amountBaseUnit:Ee,submittedAt:new Date,withdrawIntentAddress:de.address,recipientAddress:ke};await C(it),x(it);}catch(de){let Ee=de instanceof Error?de.message:"Withdrawal failed. Please try again.",$t=Ee.length>120?"Withdrawal failed. Please try again.":Ee;Ie($t),d?.({message:Ee,error:de,code:"WITHDRAW_FAILED"});}finally{me(false);}}},[l,u,We,f,ke,t,r,o,ot,i,F,rt,c,he,se,Ae,k,C,d,x]),ce=A.input,re=A.card,Se=A.button,mt=lt?S.error:ce.borderColor,ht=ci.useMemo(()=>j?"Processing...":nt?"Insufficient balance":Jt?`Minimum $${T?.toFixed(2)}`:Xe?"Withdrawal failed \u2014 try again":"Withdraw",[j,nt,Jt,T,Xe]);return jsxRuntime.jsxs(reactNative.View,{style:Ze.container,children:[jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.View,{style:Ze.labelRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ze.label,{color:re.labelColor,fontFamily:_.medium}],children:"Recipient address"}),(ve||pe)&&ke.length>5?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:S.primary}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:we,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsxRuntime.jsx(sp,{size:16,color:S.foregroundMuted,strokeWidth:1.75})})]}),jsxRuntime.jsx(reactNative.View,{style:[Ze.inputRow,{backgroundColor:ce.backgroundColor,borderRadius:ce.borderRadius,borderWidth:ce.borderWidth,borderColor:mt}],children:jsxRuntime.jsx(reactNative.TextInput,{style:[Ze.textInput,{color:ce.textColor,fontFamily:_.regular}],placeholder:"Enter wallet address",placeholderTextColor:ce.placeholderColor,value:W,onChangeText:de=>{I(de),Ie(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>Ce.current?.focus()})}),lt?jsxRuntime.jsx(reactNative.Text,{style:[Ze.errorText,{color:S.error,fontFamily:_.regular}],children:lt}):null]}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.Text,{style:[Ze.label,{color:re.labelColor,fontFamily:_.medium,paddingBottom:8}],children:["Amount",T!=null&&T>0&&jsxRuntime.jsx(reactNative.Text,{style:{color:S.warning,fontFamily:_.regular},children:` ($${T.toFixed(2)} min)`})]}),jsxRuntime.jsxs(reactNative.View,{style:[Ze.amountRow,{backgroundColor:ce.backgroundColor,borderRadius:ce.borderRadius,borderWidth:ce.borderWidth,borderColor:ce.borderColor}],children:[jsxRuntime.jsx(reactNative.TextInput,{ref:Ce,style:[Ze.amountInput,{color:ce.textColor,fontFamily:_.regular}],placeholder:"0.00",placeholderTextColor:ce.placeholderColor,value:F,onChangeText:de=>{(de===""||/^\d*\.?\d*$/.test(de))&&(z(de),Ie(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsxRuntime.jsx(reactNative.Text,{style:[Ze.unitLabel,{color:S.foregroundMuted,fontFamily:_.medium}],children:ot}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ze.maxButton,{backgroundColor:`${S.primary}20`}],onPress:ge,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Ze.maxText,{color:S.primary,fontFamily:_.medium}],children:"Max"})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[Ze.detailsCard,{marginTop:24,backgroundColor:re.backgroundColor,borderRadius:re.borderRadius,borderWidth:re.borderWidth||1,borderColor:re.borderColor}],children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ze.detailsToggle,onPress:()=>Pe(!ie),activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.View,{style:Ze.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ze.detailIcon,{backgroundColor:re.iconBackgroundColor,borderRadius:re.iconContainerBorderRadius}],children:jsxRuntime.jsx(jr,{size:12,color:re.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Ze.detailsLabel,{color:re.titleColor,fontFamily:_.regular}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{fontFamily:_.medium},children:RC(w)})]}),jsxRuntime.jsx(reactNative.View,{style:{transform:[{rotate:ie?"180deg":"0deg"}]},children:jsxRuntime.jsx(Kt,{size:16,color:re.actionColor,strokeWidth:2})})]})}),ie&&jsxRuntime.jsxs(reactNative.View,{style:Ze.detailsExpanded,children:[jsxRuntime.jsxs(reactNative.View,{style:Ze.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ze.detailIcon,{backgroundColor:re.iconBackgroundColor,borderRadius:re.iconContainerBorderRadius}],children:jsxRuntime.jsx(oo,{size:12,color:re.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Ze.detailsLabel,{color:re.titleColor,fontFamily:_.regular}],children:["Slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:_.medium},children:["Auto \u2022 ",(p??.25).toFixed(2),"%"]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Ze.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ze.detailIcon,{backgroundColor:re.iconBackgroundColor,borderRadius:re.iconContainerBorderRadius}],children:jsxRuntime.jsx(Nn,{size:12,color:re.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Ze.detailsLabel,{color:re.titleColor,fontFamily:_.regular}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:_.medium},children:[(y??0).toFixed(2),"%"]})]})]})]})]}),Xe&&jsxRuntime.jsx(reactNative.Text,{style:[Ze.errorText,{color:S.error,fontFamily:_.regular,textAlign:"center"}],children:Xe}),jsxRuntime.jsxs(reactNative.View,{style:Ze.withdrawRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ze.withdrawButton,{backgroundColor:Se.primaryBackground,borderRadius:Se.borderRadius,borderWidth:Se.borderWidth,borderColor:Se.borderColor,opacity:!We||!f||j?.5:1}],onPress:yr,disabled:!We||!f||j,activeOpacity:.8,children:[j&&jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:Se.primaryText}),jsxRuntime.jsx(reactNative.Text,{style:[Ze.withdrawButtonText,{color:Se.primaryText,fontFamily:_.medium}],children:ht})]}),jsxRuntime.jsxs(reactNative.View,{style:Ze.footerRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ze.historyLink,onPress:v,activeOpacity:.7,children:[jsxRuntime.jsx(jr,{size:14,color:S.foregroundMuted,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Ze.historyText,{color:S.foregroundMuted,fontFamily:_.regular}],children:"Withdrawal history"})]}),jsxRuntime.jsxs(reactNative.View,{style:Ze.legalLinks,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(h),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Ze.legalText,{color:S.foregroundMuted,fontFamily:_.regular}],children:"Terms"})}),jsxRuntime.jsx(reactNative.Text,{style:[Ze.legalSeparator,{color:S.foregroundMuted,fontFamily:_.regular}],children:"|"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(g),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Ze.legalText,{color:S.foregroundMuted,fontFamily:_.regular}],children:"Help"})})]})]})]})]})}var Ze=reactNative.StyleSheet.create({container:{gap:12,paddingHorizontal:16,paddingBottom:16},label:{fontSize:12},labelRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:6},inputRow:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:6,minHeight:48},textInput:{flex:1,fontSize:14,paddingVertical:8},errorText:{fontSize:12,marginTop:4},amountRow:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:6,minHeight:48,gap:8},amountInput:{flex:1,fontSize:14,paddingVertical:8},unitLabel:{fontSize:14,flexShrink:0},maxButton:{paddingHorizontal:8,paddingVertical:4,borderRadius:6},maxText:{fontSize:12,fontWeight:"600"},withdrawRow:{gap:12},footerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},historyLink:{flexDirection:"row",alignItems:"center",gap:6},historyText:{fontSize:13},legalLinks:{flexDirection:"row",alignItems:"center",gap:6},legalText:{fontSize:13},legalSeparator:{fontSize:13},detailsCard:{paddingHorizontal:12,overflow:"hidden"},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13,flex:1},detailsExpanded:{gap:10,paddingBottom:12},withdrawButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:15,gap:8},withdrawButtonText:{fontSize:16,fontWeight:"600"}});function OC(e){try{let t=new Date(e);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}catch{return e}}function VC(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Wc({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=O(),s=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed",a=e.status==="failed"||e.status==="refunded",l=a?r.error:i?r.warning:r.success,u=oe(xe(e.destination_token_metadata,"png")||ar("/icons/tokens/png/usdc.png")),c=a?"Withdrawal Failed":i?"Withdrawal Processing":"Withdrawal Completed",b=OC(e.created_at||new Date().toISOString()),T=VC(e.source_amount_usd);return jsxRuntime.jsxs(gr,{cardTokens:s,onPress:t,contentStyle:Mn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Mn.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:u},style:Mn.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Mn.statusBadge,{backgroundColor:l,borderColor:s.backgroundColor}],children:a?jsxRuntime.jsx(ia,{size:12,color:"#FFFFFF",strokeWidth:2.5}):i?jsxRuntime.jsx(is,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx($e,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Mn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Mn.title,{color:s.titleColor,fontFamily:o.medium}],children:c}),jsxRuntime.jsx(reactNative.Text,{style:[Mn.dateTime,{color:s.subtitleColor,fontFamily:o.regular}],children:b})]}),jsxRuntime.jsxs(reactNative.View,{style:Mn.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Mn.amount,{color:s.textRightColor,fontFamily:o.medium}],children:T}),jsxRuntime.jsx(Sr,{size:20,color:s.actionColor,strokeWidth:2})]})]})}var Mn=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-4,right:-4,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center",borderWidth:2},textContainer:{flex:1,gap:2},title:{fontSize:16},dateTime:{fontSize:13},rightContainer:{flexDirection:"row",alignItems:"center",gap:8},amount:{fontSize:16}});function Yu(e){try{let t=new Date(e),o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],n=t.getDate(),s=t.getFullYear(),i=t.getHours(),a=t.getMinutes(),l=i>=12?"PM":"AM";i=i%12||12;let u=a<10?`0${a}`:`${a}`;return `${o} ${n}, ${s} at ${i}:${u} ${l}`}catch{return e}}function th(e,t=6){if(!e)return "\u2014";try{let r=Number(e)/Math.pow(10,t);return r===0?"0.00":r>=1?r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:8,minimumSignificantDigits:2,maximumSignificantDigits:6})}catch{return "0.00"}}function LC(e,t){if(e)try{return `$${Number(e).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}catch{}if(t)try{return `$${(Number(t)/1e6).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}catch{}return "$0.00"}function rh(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function oh(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function Xa({label:e,value:t,isLast:r}){let{fonts:o,components:n}=O(),s=n.card;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:Ne.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ne.detailLabel,{color:s.subtitleColor,fontFamily:o.regular}],children:e}),jsxRuntime.jsx(reactNative.Text,{style:[Ne.detailValue,{color:s.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsxRuntime.jsx(reactNative.View,{style:[Ne.divider,{backgroundColor:s.borderColor}]})]})}function Ju({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:s}){let{colors:i,fonts:a,components:l}=O(),[u,c]=ci.useState([]),[b,T]=ci.useState(!!n),w=l.card,p=l.button,y=l.header,f=l.container;ci.useEffect(()=>{cd().then(me=>c(me.data)).catch(()=>{});},[]),ci.useEffect(()=>{T(!!n);},[e?.id]);let k=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,C=e?e.status==="failed"||e.status==="refunded":false,d=C?i.error:k?i.warning:i.success,x=C?"Failed":k?"Processing":"Completed",v=e?.destination_token_metadata?oe(xe(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?oe(t.destinationTokenIconUrl):oe(ar("/icons/tokens/png/usdc.png")),h=e?.created_at?Yu(e.created_at):t.submittedAt?Yu(t.submittedAt.toISOString()):Yu(new Date().toISOString()),g=e?`${th(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${rh(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,S=e?`${th(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${rh(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,_=e?LC(e.source_amount_usd,e.source_amount_base_unit):"$0.00",A=e?gl(u,e.source_chain_type,e.source_chain_id):t.sourceChainId,W=e?gl(u,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,I=e?.transaction_hash,F=e?.explorer_url,z=e?.destination_transaction_hashes?.[0],j=e?.destination_explorer_url;return jsxRuntime.jsxs(dt,{style:Ne.scroll,contentContainerStyle:Ne.container,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Ne.headerRow,children:[n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ns,{size:22,color:y.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:Ne.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Ne.headerTitle,{color:y.titleColor,fontFamily:a.medium}],children:"Withdrawal Details"}),n?jsxRuntime.jsx(reactNative.View,{style:Ne.headerSpacer}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:s??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ct,{size:20,color:y.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ne.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:v},style:Ne.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Ne.statusBadge,{backgroundColor:d}],children:C?jsxRuntime.jsx(ia,{size:10,color:"#FFFFFF",strokeWidth:3}):k?jsxRuntime.jsx(reactNative.View,{style:Ne.spinnerDot}):jsxRuntime.jsx($e,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ne.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ne.statusDot,{backgroundColor:d}]}),jsxRuntime.jsx(reactNative.Text,{style:[Ne.statusText,{color:d,fontFamily:a.medium}],children:x})]}),jsxRuntime.jsx(reactNative.Text,{style:[Ne.dateText,{color:f.subtitleColor,fontFamily:a.regular}],children:h}),jsxRuntime.jsxs(reactNative.View,{style:[Ne.detailsCard,{backgroundColor:w.backgroundColor,borderRadius:w.borderRadius,borderWidth:w.borderWidth??1,borderColor:w.borderColor}],children:[jsxRuntime.jsx(Xa,{label:"Amount Sent",value:g}),jsxRuntime.jsx(Xa,{label:"Amount Received",value:S}),jsxRuntime.jsx(Xa,{label:"USD Value",value:_}),jsxRuntime.jsx(Xa,{label:"Source Network",value:A}),jsxRuntime.jsx(Xa,{label:"Destination Network",value:W,isLast:true})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ne.moreDetailsRow,onPress:()=>T(me=>!me),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ne.moreDetailsText,{color:f.actionTitle,fontFamily:a.regular}],children:b?"See less":n?"See more":"See more details"}),b?jsxRuntime.jsx(Wo,{size:16,color:f.actionColor,strokeWidth:2}):jsxRuntime.jsx(Kt,{size:16,color:f.actionColor,strokeWidth:2})]}),b&&jsxRuntime.jsx(reactNative.View,{style:[Ne.detailsCard,{backgroundColor:w.backgroundColor,borderRadius:w.borderRadius,borderWidth:w.borderWidth??1,borderColor:w.borderColor}],children:I&&F?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ne.txRow,onPress:()=>reactNative.Linking.openURL(F),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ne.txLabel,{color:w.subtitleColor,fontFamily:a.regular}],children:"Withdrawal Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Ne.txHash,{color:w.titleColor,fontFamily:a.regular}],children:oh(I)}),jsxRuntime.jsx(Ao,{size:14,color:w.actionColor,strokeWidth:2})]}),!k&&z&&j&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[Ne.divider,{backgroundColor:w.borderColor}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ne.txRow,onPress:()=>reactNative.Linking.openURL(j),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ne.txLabel,{color:w.subtitleColor,fontFamily:a.regular}],children:"Completion Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Ne.txHash,{color:w.titleColor,fontFamily:a.regular}],children:oh(z)}),jsxRuntime.jsx(Ao,{size:14,color:w.actionColor,strokeWidth:2})]})]})]}):jsxRuntime.jsx(reactNative.View,{style:Ne.detailRow,children:jsxRuntime.jsx(reactNative.Text,{style:[Ne.detailLabel,{color:w.subtitleColor,fontFamily:a.regular}],children:"Transaction details not yet available"})})}),!n&&jsxRuntime.jsxs(reactNative.View,{style:Ne.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ne.button,Ne.halfButton,{backgroundColor:p.secondaryBackground,borderRadius:p.borderRadius,borderWidth:p.borderWidth,borderColor:p.borderColor}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Ne.buttonText,{color:p.secondaryText,fontFamily:a.medium}],children:"Withdrawal History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ne.button,Ne.halfButton,{backgroundColor:p.primaryBackground,borderRadius:p.borderRadius,borderWidth:p.borderWidth,borderColor:p.borderColor}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Ne.buttonText,{color:p.primaryText,fontFamily:a.medium}],children:"Close"})})]})]})}var Ne=reactNative.StyleSheet.create({scroll:{flex:1},container:{alignItems:"center",paddingHorizontal:20,paddingTop:8,paddingBottom:32,gap:12},headerRow:{flexDirection:"row",alignItems:"center",width:"100%",paddingTop:16,marginBottom:4},headerSpacer:{width:28},headerTitle:{flex:1,fontSize:16,textAlign:"center"},iconContainer:{position:"relative",marginTop:8},tokenIcon:{width:64,height:64,borderRadius:32},statusBadge:{position:"absolute",bottom:-2,right:-2,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center"},spinnerDot:{width:10,height:10,borderRadius:5,borderWidth:2,borderColor:"#FFFFFF",borderTopColor:"transparent"},statusRow:{flexDirection:"row",alignItems:"center",gap:6},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:15},dateText:{fontSize:13,marginTop:-4},detailsCard:{width:"100%",paddingHorizontal:16,overflow:"hidden"},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12},detailLabel:{fontSize:13,flex:1},detailValue:{fontSize:13,flexShrink:0,maxWidth:"55%",textAlign:"right"},divider:{height:reactNative.StyleSheet.hairlineWidth,opacity:.5},moreDetailsRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingHorizontal:4},moreDetailsText:{fontSize:14},txRow:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:12},txLabel:{fontSize:13},txHash:{fontSize:13,flex:1,textAlign:"right"},buttonRow:{flexDirection:"row",gap:10,width:"100%",marginTop:4},button:{paddingVertical:14,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},fullButton:{width:"100%"},buttonText:{fontSize:14}});function nh(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Ec({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:s,components:i}=O(),a=t.length>0?t[t.length-1]:null,l=a?.status==="succeeded",u=a?.status==="failed",c={borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor};return l?jsxRuntime.jsxs(reactNative.View,{style:Vt.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Vt.closeButton,onPress:r,children:jsxRuntime.jsx(ct,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[Vt.iconRing,{backgroundColor:n.successBackground}],children:jsxRuntime.jsx($e,{size:32,color:n.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.title,{color:n.foreground,fontFamily:s.medium}],children:"Withdrawal Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[Vt.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",nh(e.recipientAddress)]}),jsxRuntime.jsxs(reactNative.View,{style:Vt.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Vt.button,Vt.halfButton,c,{backgroundColor:i.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Vt.buttonText,{color:i.button.secondaryText,fontFamily:s.medium}],children:"History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Vt.button,Vt.halfButton,c,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Vt.buttonText,{color:i.button.primaryText,fontFamily:s.medium}],children:"Close"})})]})]}):u?jsxRuntime.jsxs(reactNative.View,{style:Vt.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Vt.closeButton,onPress:r,children:jsxRuntime.jsx(ct,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[Vt.iconRing,{backgroundColor:n.errorBackground}],children:jsxRuntime.jsx(ct,{size:32,color:n.error,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.title,{color:n.foreground,fontFamily:s.medium}],children:"Withdrawal Failed"}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:"Something went wrong. Please try again."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Vt.button,Vt.fullButton,c,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Vt.buttonText,{color:i.button.primaryText,fontFamily:s.medium}],children:"Close"})})]}):jsxRuntime.jsxs(reactNative.View,{style:Vt.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Vt.closeButton,onPress:r,children:jsxRuntime.jsx(ct,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(st,{size:80,strokeWidth:4,iconSize:68,gradientFrom:n.primary,gradientTo:n.primary,children:e.sourceTokenIconUrl?jsxRuntime.jsx(reactNative.Image,{source:{uri:oe(e.sourceTokenIconUrl)},style:Vt.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[Vt.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[Vt.title,{color:n.foreground,fontFamily:s.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxRuntime.jsxs(reactNative.Text,{style:[Vt.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",nh(e.recipientAddress)]})]})}var Vt=reactNative.StyleSheet.create({container:{alignItems:"center",paddingHorizontal:24,paddingTop:48,paddingBottom:24},closeButton:{position:"absolute",top:16,right:16,padding:4,zIndex:1},iconRing:{width:80,height:80,borderRadius:40,alignItems:"center",justifyContent:"center",marginBottom:20},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},title:{fontSize:20,marginBottom:8,textAlign:"center"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,marginBottom:24},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,alignItems:"center",justifyContent:"center",borderRadius:12},halfButton:{flex:1},fullButton:{width:"100%"},buttonText:{fontSize:15}});function zC(e){let t=e.source_token_metadata?.decimals??6,r=e.source_amount_base_unit??"0",o=Number(r)/Math.pow(10,t),n=o>=1?o.toFixed(2):o.toPrecision(4).replace(/\.?0+$/,"");return {sourceChainType:e.source_chain_type,sourceChainId:e.source_chain_id,sourceTokenAddress:e.source_token_address,sourceTokenSymbol:e.source_currency?.toUpperCase()??"",sourceTokenIconUrl:oe(xe(e.source_token_metadata,"png")),destinationChainType:e.destination_chain_type,destinationChainId:e.destination_chain_id,destinationTokenAddress:e.destination_token_address,destinationTokenSymbol:e.destination_currency?.toUpperCase()??"",destinationTokenIconUrl:oe(xe(e.destination_token_metadata,"png")),amount:n,amountBaseUnit:r,submittedAt:e.created_at?new Date(e.created_at):void 0,withdrawIntentAddress:e.deposit_wallet?.address??"",recipientAddress:e.recipient_address??""}}var ih=(e,t)=>`${t}:${e}`;function UC(){let{colors:e}=O(),t=ci.useRef(new reactNative.Animated.Value(.5)).current,r=e.cardHover;return ci.useEffect(()=>{let o=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(t,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(t,{toValue:.5,duration:800,useNativeDriver:true})]));return o.start(),()=>o.stop()},[t]),jsxRuntime.jsx(reactNative.View,{style:{gap:12,paddingHorizontal:16},children:[1,2,3].map(o=>jsxRuntime.jsx(reactNative.Animated.View,{style:{height:48,borderRadius:12,backgroundColor:r,opacity:t}},o))})}function Uc({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:s,defaultDestinationChainType:i,defaultDestinationChainId:a,defaultDestinationTokenAddress:l,modalTitle:u="Withdraw Crypto",onWithdraw:c,onWithdrawSuccess:b,onWithdrawError:T,heightPercent:w=.94,sheetBorderRadius:p,sourceChainType:y,sourceChainId:f,sourceTokenAddress:k,sourceTokenSymbol:C,sourceChainName:d,sourceTokenIconUrl:x}){let{colors:v,fonts:h}=O(),[g,S]=ci.useState("form"),[_,A]=ci.useState(y),[W,I]=ci.useState(f),[F,z]=ci.useState(k),[j,me]=ci.useState(C),[Xe,Ie]=ci.useState(d),[ie,Pe]=ci.useState(x),[Oe,fe]=ci.useState(null),[Ce,ke]=ci.useState(null),[Z,pe]=ci.useState(null),[St,ve]=ci.useState(),[lt,je]=ci.useState([]),[Te,rt]=ci.useState(null),[ot,se]=ci.useState("form"),he=ci.useRef(new reactNative.Animated.Value(reactNative.Dimensions.get("window").width)).current,Ae=ci.useRef(null),we=!!_&&!!W&&!!F,{data:ge,isLoading:Jt}=Vc(r,e&&g==="form"),nt=ge?.data??[],{data:We,isLoading:yr}=Hu({sourceChainType:_,sourceChainId:W,sourceTokenAddress:F,sourceTokenSymbol:j,publishableKey:r,enabled:e&&we&&g==="form"}),{data:ce,isLoading:re}=Nu({address:n,chainType:_,chainId:W,tokenAddress:F,publishableKey:r,enabled:e&&we}),{executions:Se}=ju({userId:o,publishableKey:r,depositWalletId:St,enabled:!!St&&e,onWithdrawSuccess:b,onWithdrawError:T});ci.useEffect(()=>{if(!e||g!=="tracker")return;let G=false;return bn(o,r,"withdraw").then(et=>{G||je(et.data);}).catch(console.error),()=>{G=true;}},[e,g,o,r]),ci.useEffect(()=>{e&&(Ae.current&&(clearTimeout(Ae.current),Ae.current=null),S("form"),A(y),I(f),z(k),me(C),Ie(d),Pe(x),fe(null),ke(null),pe(null),ve(void 0),je([]),rt(null),se("form"),he.setValue(reactNative.Dimensions.get("window").width));},[e]),ci.useEffect(()=>()=>{Ae.current&&clearTimeout(Ae.current);},[]),ci.useEffect(()=>{ie||We?.iconUrl&&Pe(We.iconUrl);},[We?.iconUrl,ie]),ci.useEffect(()=>{Xe||We?.chainName&&Ie(We.chainName);},[We?.chainName,Xe]),ci.useEffect(()=>{if(!nt.length||Oe)return;let G,et;if(i&&a)if(l)for(let Me of nt){let Vr=Me.chains.find(qt=>qt.chain_type===i&&qt.chain_id===a&&qt.token_address.toLowerCase()===l.toLowerCase());if(Vr){G=Me,et=Vr;break}}else for(let Me of nt){let Vr=Me.chains.find(qt=>qt.chain_type===i&&qt.chain_id===a);if(Vr){G=Me,et=Vr;break}}G||(G=nt[0]),G&&(fe(G),ke(et??G.chains[0]??null));},[nt,Oe,i,a,l]),ci.useEffect(()=>{g==="confirming"&&Se.length>0&&S("details");},[g,Se]);let mt=ci.useCallback(()=>{t(),Ae.current=setTimeout(()=>{S("form"),A(y),I(f),z(k),me(C),Ie(d),Pe(x),fe(null),ke(null),pe(null),ve(void 0),je([]),rt(null),se("form"),Ae.current=null;},300);},[t,y,f,k,C,d,x]),ht=ci.useCallback(G=>{let et=nt.find(Me=>Me.symbol===G);et&&(fe(et),et.chains.length>0&&ke(et.chains[0]));},[nt]),de=ci.useCallback(G=>{if(!Oe)return;let et=Oe.chains.find(Me=>ih(Me.chain_id,Me.chain_type)===G);et&&ke(et);},[Oe]),Ee=ci.useCallback(async G=>{let et=await gn({external_user_id:o,destination_chain_type:G.destinationChainType,destination_chain_id:G.destinationChainId,destination_token_address:G.destinationTokenAddress,recipient_address:G.recipientAddress,action_type:"withdraw"},r),Me=yn(et.data,_??"");if(!Me)throw new Error(`No deposit wallet found for chain type: ${_}`);return ve(Me.id),{id:Me.id,address:Me.address}},[o,r,_]),$t=ci.useCallback(G=>{pe(G),S("confirming");},[]),it=ci.useCallback(G=>{rt(G),he.setValue(reactNative.Dimensions.get("window").width),reactNative.Animated.timing(he,{toValue:0,duration:280,useNativeDriver:true}).start();},[he]),ir=ci.useCallback(()=>{reactNative.Animated.timing(he,{toValue:reactNative.Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>rt(null));},[he]),Ht=Jt||yr,sr=We?.isSupported??null,Dt=g==="confirming"?"Withdrawal Status":u,ue=p?.globalBorderTopLeftRadius,Ve=p?.globalBorderTopRightRadius,D=p?.main?.borderTopLeftRadius??ue,H=p?.main?.borderTopRightRadius??Ve,E=p?.tokenSelector?.borderTopLeftRadius??ue,P=p?.tokenSelector?.borderTopRightRadius??Ve,U=p?.chainSelector?.borderTopLeftRadius??ue,K=p?.chainSelector?.borderTopRightRadius??Ve,Ye=(()=>{if(g!=="form"||!we||re||!ce)return;let G=j||ce.symbol,et=ce.balanceUsd;if(et!=null){let qt=`$${parseFloat(et).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return G?`Balance: ${qt} ${G}`:`Balance: ${qt}`}let Me=ce.balanceHuman;if(!(!Me||Me==="0"))return G?`Balance: ${Me} ${G}`:`Balance: ${Me}`})();return jsxRuntime.jsx(wt,{visible:e,onClose:mt,closeOnBackdropPress:false,enablePanDownToClose:g==="tracker"||g==="form",showHandle:g==="tracker"||g==="form",heightPercent:g==="confirming"?.3:g==="details"?.7:g==="tracker"?.9:w,borderTopLeftRadius:D,borderTopRightRadius:H,children:g==="confirming"&&Z?jsxRuntime.jsx(Ec,{txInfo:Z,executions:Se,onClose:mt,onViewTracker:()=>{se("confirming"),S("tracker");}}):g==="details"&&Z?jsxRuntime.jsx(Ju,{execution:Se.length>0?Se[Se.length-1]:null,txInfo:Z,onClose:mt,onViewHistory:()=>{se("details"),S("tracker");},onHeaderClose:()=>S("form")}):g==="tracker"?jsxRuntime.jsxs(reactNative.View,{style:cn.trackerContainer,children:[jsxRuntime.jsx(Hr,{title:"Withdrawal History",onClose:()=>S(ot)}),lt.length===0?jsxRuntime.jsx(reactNative.View,{style:cn.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[cn.emptyText,{color:v.foregroundMuted,fontFamily:h.regular}],children:"No withdrawals to track yet"})}):jsxRuntime.jsx(ls,{data:lt,keyExtractor:G=>G.id,contentContainerStyle:cn.listContent,showsVerticalScrollIndicator:false,renderItem:({item:G})=>jsxRuntime.jsx(Wc,{execution:G,onPress:()=>it(G)})}),Te&&jsxRuntime.jsx(reactNative.Animated.View,{style:[cn.historyDetailOverlay,{backgroundColor:v.background,transform:[{translateX:he}]}],children:jsxRuntime.jsx(Ju,{execution:Te,txInfo:zC(Te),onClose:mt,onBack:ir,onViewHistory:ir})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Hr,{title:Dt,subtitle:Ye,onClose:mt}),Ht?jsxRuntime.jsx(UC,{}):sr===false?jsxRuntime.jsxs(reactNative.View,{style:cn.unsupportedContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[cn.unsupportedTitle,{color:v.foreground,fontFamily:h.medium}],children:"Unsupported Token"}),jsxRuntime.jsx(reactNative.Text,{style:[cn.unsupportedMessage,{color:v.foregroundMuted,fontFamily:h.regular}],children:We?.errorMessage})]}):jsxRuntime.jsx(HC,{publishableKey:r,sourceChainType:_??"",sourceChainId:W??"",sourceTokenAddress:F??"",sourceTokenSymbol:j,sourceChainName:Xe,sourceTokenIconUrl:ie,recipientAddressProp:s,destinationTokens:nt,selectedToken:Oe,selectedChain:Ce,selectedChainKey:Ce?ih(Ce.chain_id,Ce.chain_type):null,onTokenChange:ht,onChainChange:de,tokensLoading:Jt,balanceData:ce??null,isLoadingBalance:re,sourceValidation:We??null,onDepositWalletCreation:Ee,onWithdraw:c,onWithdrawError:T,onWithdrawSubmitted:$t,onViewTracker:()=>{se("form"),S("tracker");},tokenSelectorLeft:E,tokenSelectorRight:P,chainSelectorLeft:U,chainSelectorRight:K})]})})}function HC({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,destinationTokens:l,selectedToken:u,selectedChain:c,selectedChainKey:b,onTokenChange:T,onChainChange:w,tokensLoading:p,balanceData:y,isLoadingBalance:f,sourceValidation:k,onDepositWalletCreation:C,onWithdraw:d,onWithdrawError:x,onWithdrawSubmitted:v,onViewTracker:h,tokenSelectorLeft:g,tokenSelectorRight:S,chainSelectorLeft:_,chainSelectorRight:A}){return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxRuntime.jsxs(dt,{style:{flex:1,paddingTop:16},contentContainerStyle:cn.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:cn.doubleInputWrapper,children:jsxRuntime.jsx(Za,{tokens:l,selectedTokenSymbol:u?.symbol??null,selectedChainKey:b,onTokenChange:T,onChainChange:w,isLoading:p,tokenPickerBorderTopLeftRadius:g,tokenPickerBorderTopRightRadius:S,chainPickerBorderTopLeftRadius:_,chainPickerBorderTopRightRadius:A})}),jsxRuntime.jsx(Lc,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,selectedToken:u,selectedChain:c,balanceData:y,isLoadingBalance:f,minimumWithdrawAmountUsd:k?.minimumAmountUsd??null,estimatedProcessingTime:k?.estimatedProcessingTime??null,maxSlippagePercent:k?.maxSlippagePercent??null,priceImpactPercent:k?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:C,onWithdraw:d,onWithdrawError:x,onWithdrawSubmitted:v,onViewTracker:h})]})})}var cn=reactNative.StyleSheet.create({scrollContent:{paddingBottom:32},doubleInputWrapper:{paddingHorizontal:16,paddingBottom:12,paddingTop:4},listContent:{paddingHorizontal:16,paddingBottom:32,gap:8},trackerContainer:{flex:1,overflow:"hidden"},historyDetailOverlay:{position:"absolute",top:0,left:0,right:0,bottom:0},emptyState:{flex:1,alignItems:"center",justifyContent:"center",paddingVertical:48},emptyText:{fontSize:14},unsupportedContainer:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24,paddingVertical:48},unsupportedTitle:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},unsupportedMessage:{fontSize:14,textAlign:"center",lineHeight:20,maxWidth:280}});reactNative.StyleSheet.create({container:{paddingHorizontal:16,paddingTop:16,paddingBottom:24,gap:16},fieldGroup:{gap:8},fieldLabel:{fontSize:12},walletCard:{paddingHorizontal:12,paddingVertical:12,minHeight:48,justifyContent:"center"},walletAddress:{fontSize:13},primaryButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginTop:4},primaryButtonText:{fontSize:16},secondaryButton:{paddingVertical:14,alignItems:"center",justifyContent:"center"},secondaryButtonText:{fontSize:16}});reactNative.StyleSheet.create({base:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},text:{fontWeight:"600",textAlign:"center"},fullWidth:{width:"100%"},disabled:{opacity:.5}});reactNative.StyleSheet.create({icon:{backgroundColor:"transparent"}});var lh=ci.createContext(null);function ZC({children:e,publishableKey:t,config:r}){let[o]=ci.useState(()=>new ou({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,s]=ci.useState(false),[i,a]=ci.useState(null),[l,u]=ci.useState(false),[c,b]=ci.useState(null),T=reactNative.useColorScheme(),w=ci.useRef(false);w.current||(pl({publishableKey:t}),w.current=true);let p=ci.useMemo(()=>{let F=r?.appearance||"dark";return F==="auto"?T==="dark"?"dark":"light":F},[r?.appearance,T]);ci.useEffect(()=>{if(!t||t.trim()===""){console.error("Unifold: publishableKey is required. Please provide a valid publishable key.");return}!t.startsWith("pk_test_")&&!t.startsWith("pk_live_")&&console.warn('Unifold: publishableKey should start with "pk_test_" or "pk_live_". Please ensure you are using a valid publishable key.'),pl({publishableKey:t});},[t]),ci.useEffect(()=>()=>{f.current&&clearTimeout(f.current),h.current&&clearTimeout(h.current);},[]);let y=ci.useRef(null),f=ci.useRef(null),k=ci.useCallback(F=>{f.current&&(clearTimeout(f.current),f.current=null),y.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),y.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),y.current=null);let z=new Promise((j,me)=>{y.current={resolve:j,reject:me};});return a(F),s(true),z},[]),C=ci.useCallback(()=>{y.current&&(y.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),y.current=null),s(false),f.current=setTimeout(()=>{a(null),f.current=null;},200);},[]),d=ci.useCallback(F=>{i?.onSuccess&&i.onSuccess(F),y.current&&(y.current.resolve(F),y.current=null);},[i]),x=ci.useCallback(F=>{console.error("[UnifoldProvider] Deposit error:",F),i?.onError&&i.onError(F),y.current&&(y.current.reject(F),y.current=null);},[i]),v=ci.useRef(null),h=ci.useRef(null),g=ci.useRef(void 0),S=ci.useCallback(F=>{h.current&&(clearTimeout(h.current),h.current=null),v.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),v.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),v.current=null);let z=new Promise((j,me)=>{v.current={resolve:j,reject:me};});return g.current=F.onClose,b(F),u(true),z},[]),_=ci.useCallback(()=>{v.current&&(v.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),v.current=null),g.current?.(),g.current=void 0,u(false),h.current=setTimeout(()=>{b(null),h.current=null;},200);},[]),A=ci.useCallback(F=>{c?.onSuccess&&c.onSuccess(F),v.current&&(v.current.resolve(F),v.current=null);},[c]),W=ci.useCallback(F=>{console.error("[UnifoldProvider] Withdraw error:",F),c?.onError&&c.onError(F),v.current&&(v.current.reject(F),v.current=null);},[c]),I=ci.useMemo(()=>({publishableKey:t,beginDeposit:k,closeDeposit:C,beginWithdraw:S,closeWithdraw:_}),[t,k,C,S,_]);return jsxRuntime.jsx(su,{client:o,children:jsxRuntime.jsx(lh.Provider,{value:I,children:jsxRuntime.jsxs(as,{mode:p,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,i&&jsxRuntime.jsx(Oc,{visible:n,onClose:C,publishableKey:t,modalTitle:r?.modalTitle,externalUserId:i.externalUserId,destinationChainType:i.destinationChainType,destinationChainId:i.destinationChainId,destinationTokenSymbol:i.destinationTokenSymbol,recipientAddress:i.recipientAddress,destinationTokenAddress:i.destinationTokenAddress,defaultChainType:i.defaultChainType,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,showBalance:i.showBalance,stripeOnrampEmail:i.stripeOnrampEmail,stripeOnrampPhone:i.stripeOnrampPhone,stripeTheme:{mode:p,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components},depositConfirmationMode:i.depositConfirmationMode??"auto_ui",initialScreen:i.initialScreen,hideDepositTracker:r?.hideDepositTracker,transferInputVariant:r?.transferInputVariant,enableStripeLinkPay:r?.enableStripeLinkPay,stripeMerchantIdentifier:r?.stripeMerchantIdentifier,stripePaymentSelectorPosition:r?.stripePaymentSelectorPosition,stripeSkipSuccessConfirmation:r?.stripeSkipSuccessConfirmation,StripeOnrampComponent:r?.enableStripeLinkPay?Cm():void 0,onDepositSuccess:d,onDepositError:x,theme:p,sheetBorderRadius:r?.sheetBorderRadius}),c&&jsxRuntime.jsx(Uc,{visible:l,onClose:_,publishableKey:t,externalUserId:c.externalUserId,senderAddress:c.senderAddress,recipientAddress:c.recipientAddress,sourceChainType:c.sourceChainType,sourceChainId:c.sourceChainId,sourceTokenAddress:c.sourceTokenAddress,sourceTokenSymbol:c.sourceTokenSymbol,defaultDestinationChainType:c.defaultDestinationChainType,defaultDestinationChainId:c.defaultDestinationChainId,defaultDestinationTokenAddress:c.defaultDestinationTokenAddress,onWithdraw:c.withdraw,onWithdrawSuccess:A,onWithdrawError:W,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function XC(){let e=ci.useContext(lh);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
|
|
3
|
+
exports.AmountScreen=Vl;exports.BottomSheet=wt;exports.KYCWizardScreen=Dl;exports.OnrampScreen=Nl;exports.StripeOnramp=jl;exports.StripeOnrampPreconfigure=ym;exports.UnifoldProvider=ZC;exports.getPreferredIcon=xe;exports.getStripePublishableKey=vl;exports.getSupportedDestinationTokens=yl;exports.normalizeIconUrl=oe;exports.registerStripeOnramp=$l;exports.setDevApiUrl=mp;exports.setStripeOnrampApiUrl=Rl;exports.setStripeOnrampPublishableKey=_l;exports.useAllowedCountry=Ya;exports.useStripeOnramp=Ll;exports.useTheme=O;exports.useUnifold=XC;
|